+Copyright notice for Embryo:
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies of the Software and its Copyright notices. In addition publicly
-documented acknowledgment must be given that this software has been used if no
-source code of this software is made available publicly. Making the source
-available publicly means including the source for this software with the
-distribution, or a method to get this software via some reasonable mechanism
-(electronic transfer via a network or media) as well as making an offer to
-supply the source on request. This Copyright notice serves as an offer to
-supply the source on on request as well. Instead of this, supplying
-acknowledgments of use of this software in either Copyright notices, Manuals,
-Publicity and Marketing documents or any documentation provided with any
-product containing this software. This License does not apply to any software
-that links to the libraries provided by this software (statically or
-dynamically), but only to the software provided.
-
-Please see the COPYING-PLAIN for a plain-english explanation of this notice
-and its intent.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+Copyright (C) 2004-2010 Carsten Haitzler and various contributors (see AUTHORS)
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Large parts of this source come under the following license (less
+restrictive than the above). See the source files that are clearly marked
+as below:
+
+Copyright (c) ITB CompuPhase, 1997-2003
+
+This software is provided "as-is", without any express or implied warranty.
+In no event will the authors be held liable for any damages arising from
+the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software in
+ a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
-COMPILING and INSTALLING:
+Installation Instructions
+*************************
-If you got a official release tar archive do:
- ./configure
-
-( otherwise if you got this from enlightenment cvs do: ./autogen.sh )
-
-Then to compile:
- make
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
-To install (run this as root, or the user who handles installs):
- make install
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
-NOTE: You MUST make install Embryo for it to run properly.
EXTRA_DIST = \
AUTHORS \
COPYING \
-COPYING-PLAIN \
autogen.sh \
embryo.pc.in \
embryo.spec.in \
-Embryo @VERSION@
+Embryo @VERSION@ ALPHA
+******************************************************************************
+
+ FOR ANY ISSUES PLEASE EMAIL:
+ enlightenment-devel@lists.sourceforge.net
+
+******************************************************************************
+
Requirements:
-------------
Must:
- libc libm
+ libc
+ libm
WARNING: gcc compatibility!!!
There seems to be some bug (or disagreement) between embryo and gcc 3.2.x
./configure
make
-(as root unless youa re installing in your users directories):
+(as root unless you are installing in your users directories):
make install
-
-------------------------------------------------------------------------------
-BUILDING PACKAGES:
-
-RPM: To build rpm packages:
-
- sudo rpm -ta @PACKAGE@-@VERSION@.tar.gz
-
-You will find rpm packages in your system /usr/src/redhat/* dirs (note you may
-not need to use sudo or root if you have your own ~/.rpmrc. see rpm documents
-for more details)
-
-DEB: To build deb packages:
-
- tar zvf @PACKAGE@-@VERSION@.tar.gz
- cd @PACKAGE@-@VERSION@
- dpkg-buildpackage -us -uc -rfakeroot
- cd ..
- rm -rf @PACKAGE@-@VERSION@
-
-You will find all the debian source, binary etc. packages put in the directory
-where you first untarred the source tarball.
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-m4_define([v_maj], [0])
-m4_define([v_min], [9])
-m4_define([v_mic], [9])
-m4_define([v_rev], m4_esyscmd([(svnversion . | grep -v exported || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
+m4_define([v_maj], [1])
+m4_define([v_min], [0])
+m4_define([v_mic], [0])
+m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
##-- When released, remove the dnl on the below line
-dnl m4_undefine([v_rev])
+m4_undefine([v_rev])
##-- When doing snapshots - change soname. remove dnl on below line
-m4_define([v_rel], [-release ver-pre-svn-06])
+dnl m4_define([relname], [ver-pre-svn-07])
+dnl m4_define([v_rel], [-release ver-pre-svn-07])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])],
-[m4_define([v_ver], [v_maj.v_min.v_mic])])
+m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])], [m4_define([v_ver], [v_maj.v_min.v_mic])])
m4_define([lt_rev], m4_eval(v_maj + v_min))
m4_define([lt_cur], v_mic)
m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-AC_INIT([embryo], [v_ver], [enlightenment-devel@lists.sourceforge.net])
+AC_INIT([embryo], [v_ver-alpha], [enlightenment-devel@lists.sourceforge.net])
AC_PREREQ([2.52])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(release_info)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+VMAJ=v_maj
+AC_SUBST(VMAJ)
EFL_CHECK_PATH_MAX
-Revision 49550
-Last Changed Rev 49540
+Revision 51480
+Last Changed Rev 51174
Version: @VERSION@
Libs: -L${libdir} -lembryo
Libs.private: @EFL_FNMATCH_LIBS@ -lm
-Cflags: -I${includedir}
+Cflags: -I${includedir}/embryo-@VMAJ@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
int e_prefix_determine(char *argv0);
void e_prefix_shutdown(void);
void e_prefix_fallback(void);
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- *
- * Small compiler
+/* Small compiler
* Function and variable definition and declaration, statement parser.
*
* Copyright (c) ITB CompuPhase, 1997-2003
* must not be misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source
* distribution.
- * Version: $Id: embryo_cc_sc1.c 45428 2010-01-22 06:37:19Z caro $
+ * Version: $Id: embryo_cc_sc1.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
* so, I try to get the current path with getcwd(), and if that fails
* I search for the PWD= setting in the environment.
*/
- if (NULL != getcwd(argv0, PATH_MAX))
+ if (getcwd(argv0, PATH_MAX))
{
i = strlen(argv0);
snprintf(argv0 + i, sizeof(argv0) - i, "/%s", argv[0]);
{
char *pwd = getenv("PWD");
- if (pwd != NULL)
+ if (pwd)
snprintf(argv0, sizeof(argv0), "%s/%s", pwd, argv[0]);
} /* if */
argv[0] = argv0; /* set location to new first parameter */
void
sc_closeasm(void *handle)
{
- if (handle != NULL)
+ if (handle)
fclose((FILE *) handle);
}
/* allocate memory for fixed tables */
inpfname = (char *)malloc(PATH_MAX);
litq = (cell *) malloc(litmax * sizeof(cell));
- if (litq == NULL)
+ if (!litq)
error(103); /* insufficient memory */
if (!phopt_init())
error(103); /* insufficient memory */
lcl_needsemicolon = sc_needsemicolon;
lcl_tabsize = sc_tabsize;
inpf = inpf_org = (FILE *) sc_opensrc(inpfname);
- if (inpf == NULL)
+ if (!inpf)
error(100, inpfname);
freading = TRUE;
outf = (FILE *) sc_openasm(fd_out); /* first write to assembler
* file (may be temporary) */
- if (outf == NULL)
+ if (!outf)
error(101, outfname);
/* immediately open the binary file, for other programs to check */
binf = (FILE *) sc_openbin(binfname);
- if (binf == NULL)
+ if (!binf)
error(101, binfname);
setconstants(); /* set predefined constants and tagnames */
for (i = 0; i < skipinput; i++) /* skip lines in the input file */
- if (sc_readsrc(inpf, pline, sLINEMAX) != NULL)
+ if (sc_readsrc(inpf, pline, sLINEMAX))
fline++; /* keep line number up to date */
skipinput = fline;
sc_status = statFIRST;
error(13); /* no entry point (no public functions) */
cleanup:
- if (inpf != NULL) /* main source file is not closed, do it now */
+ if (inpf) /* main source file is not closed, do it now */
sc_closesrc(inpf);
/* write the binary file (the file is already open) */
if (errnum == 0 && jmpcode == 0)
sc_resetasm(outf); /* flush and loop back, for reading */
assemble(binf, outf); /* assembler file is now input */
} /* if */
- if (outf != NULL)
+ if (outf)
sc_closeasm(outf);
- if (binf != NULL)
+ if (binf)
sc_closebin(binf, errnum != 0);
- if (inpfname != NULL)
+ if (inpfname)
free(inpfname);
- if (litq != NULL)
+ if (litq)
free(litq);
phopt_cleanup();
stgbuffer_cleanup();
constvalue *ptr;
int last, tag;
- if (name == NULL)
+ if (!name)
{
/* no tagname was given, check for one */
if (lex(&val, &name) != tLABEL)
last = 0;
ptr = tagname_tab.next;
- while (ptr != NULL)
+ while (ptr)
{
tag = (int)(ptr->value & TAGMASK);
if (strcmp(name, ptr->name) == 0)
int len;
/* add the default "include" directory */
- if (root != NULL)
+ if (root)
{
/* path + filename (hopefully) */
strncpy(path, root, sizeof(path) - 1);
path[sizeof(path) - 1] = 0;
}
/* terminate just behind last \ or : */
- if ((ptr = strrchr(path, DIRSEP_CHAR)) != NULL
- || (ptr = strchr(path, ':')) != NULL)
+ if ((ptr = strrchr(path, DIRSEP_CHAR))
+ || (ptr = strchr(path, ':')))
{
/* If there was no terminating "\" or ":",
* the filename probably does not
size = 1; /* single size (no array) */
numdim = 0; /* no dimensions */
ident = iVARIABLE;
- if (firstname != NULL)
+ if (firstname)
{
assert(strlen(firstname) <= sNAMEMAX);
strcpy(name, firstname); /* save symbol name */
strcpy(name, str); /* save symbol name */
} /* if */
sym = findglb(name);
- if (sym == NULL)
+ if (!sym)
sym = findconst(name);
- if (sym != NULL && (sym->usage & uDEFINE) != 0)
+ if (sym && (sym->usage & uDEFINE) != 0)
error(21, name); /* symbol already defined */
ispublic = fpublic;
if (name[0] == PUBLIC_CHAR)
* for public variables
*/
cidx = 0; /* only to avoid a compiler warning */
- if (sc_status == statWRITE && sym != NULL
+ if (sc_status == statWRITE && sym
&& (sym->usage & (uREAD | uWRITTEN | uPUBLIC)) == 0)
{
sc_status = statSKIP;
dumplits(); /* dump the literal queue */
dumpzero((int)size - litidx);
litidx = 0;
- if (sym == NULL)
+ if (!sym)
{ /* define only if not yet defined */
sym =
addvariable(name, sizeof(cell) * glb_declared, ident, sGLOBAL,
* the "nesting level" of local variables to verify the
* multi-definition of symbols.
*/
- if ((sym = findloc(name)) != NULL && sym->compound == nestlevel)
+ if ((sym = findloc(name)) && sym->compound == nestlevel)
error(21, name); /* symbol already defined */
/* Although valid, a local variable whose name is equal to that
* of a global variable or to that of a local variable at a lower
* level might indicate a bug.
*/
- if (((sym = findloc(name)) != NULL && sym->compound != nestlevel)
- || findglb(name) != NULL)
+ if (((sym = findloc(name)) && sym->compound != nestlevel)
+ || findglb(name))
error(219, name); /* variable shadows another symbol */
while (matchtoken('['))
{
* symbol instruction.
*/
} /* if */
- if ((sym = findglb(name)) != 0)
+ if ((sym = findglb(name)))
{ /* already in symbol table? */
if (sym->ident != iFUNCTN)
{
* local symbols are function arguments.
*/
sym = loctab.next;
- while (sym != NULL)
+ while (sym)
{
assert(sym->ident != iLABEL);
assert(sym->vclass == sLOCAL);
{
symbol *sub = sym;
- while (sub != NULL)
+ while (sub)
{
symbolrange(sub->dim.array.level, sub->dim.array.length);
sub = finddepend(sub);
/* change the operator name */
assert(opername[0] != '\0');
operator_symname(tmpname, opername, tags[0], tags[1], count, resulttag);
- if ((oldsym = findglb(tmpname)) != NULL)
+ if ((oldsym = findglb(tmpname)))
{
int i;
sym->usage |= oldsym->usage; /* copy flags from the previous
* definition */
for (i = 0; i < oldsym->numrefers; i++)
- if (oldsym->refer[i] != NULL)
+ if (oldsym->refer[i])
refer_symbol(sym, oldsym->refer[i]);
delete_symbol(&glbtab, oldsym);
} /* if */
sym = fetchfunc(symbolname, tag); /* get a pointer to the
* function entry */
- if (sym == NULL)
+ if (!sym)
return;
if (native)
{
glbdecl = 0;
filenum = fcurrent; /* save file number at start of declaration */
- if (firstname != NULL)
+ if (firstname)
{
assert(strlen(firstname) <= sNAMEMAX);
strcpy(symbolname, firstname); /* save symbol name */
} /* if */
sym = fetchfunc(symbolname, tag); /* get a pointer to the
* function entry */
- if (sym == NULL)
+ if (!sym)
return TRUE;
if (fpublic)
sym->usage |= uPUBLIC;
sym->dim.arglist =
(arginfo *) realloc(sym->dim.arglist,
(argcnt + 2) * sizeof(arginfo));
- if (sym->dim.arglist == 0)
+ if (!sym->dim.arglist)
error(103); /* insufficient memory */
sym->dim.arglist[argcnt] = arg;
sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
sym->dim.arglist =
(arginfo *) realloc(sym->dim.arglist,
(argcnt + 2) * sizeof(arginfo));
- if (sym->dim.arglist == 0)
+ if (!sym->dim.arglist)
error(103); /* insufficient memory */
sym->dim.arglist[argcnt + 1].ident = 0; /* keep the list
* terminated */
sym->dim.arglist[argcnt].numtags = numtags;
sym->dim.arglist[argcnt].tags =
(int *)malloc(numtags * sizeof tags[0]);
- if (sym->dim.arglist[argcnt].tags == NULL)
+ if (!sym->dim.arglist[argcnt].tags)
error(103); /* insufficient memory */
memcpy(sym->dim.arglist[argcnt].tags, tags,
numtags * sizeof tags[0]);
assert(size >= litidx);
/* allocate memory to hold the initial values */
arg->defvalue.array.data = (cell *) malloc(litidx * sizeof(cell));
- if (arg->defvalue.array.data != NULL)
+ if (arg->defvalue.array.data)
{
int i;
cell val;
tokeninfo(&val, &name);
- if ((arg->defvalue.size.symname =
- strdup(name)) == NULL)
+ if (!(arg->defvalue.size.symname = strdup(name)))
error(103); /* insufficient memory */
arg->defvalue.size.level = 0;
if (size_tag_token == uSIZEOF)
arg->usage = (char)(fconst ? uCONST : 0);
arg->numtags = numtags;
arg->tags = (int *)malloc(numtags * sizeof tags[0]);
- if (arg->tags == NULL)
+ if (!arg->tags)
error(103); /* insufficient memory */
memcpy(arg->tags, tags, numtags * sizeof tags[0]);
argsym = findloc(name);
- if (argsym != NULL)
+ if (argsym)
{
error(21, name); /* symbol already defined */
}
else
{
- if ((argsym = findglb(name)) != NULL && argsym->ident != iFUNCTN)
+ if ((argsym = findglb(name)) && argsym->ident != iFUNCTN)
error(219, name); /* variable shadows another symbol */
/* add details of type and address */
assert(numtags > 0);
count = 0;
for (i = 0; i < entry->numrefers; i++)
- if (entry->refer[i] != NULL)
+ if (entry->refer[i])
count++;
return count;
}
do
{
restart = 0;
- for (sym = root->next; sym != NULL; sym = sym->next)
+ for (sym = root->next; sym; sym = sym->next)
{
- if (sym->parent != NULL)
+ if (sym->parent)
continue; /* hierarchical data type */
if (sym->ident == iFUNCTN
&& (sym->usage & uNATIVE) == 0
sym->usage &= ~(uREAD | uWRITTEN); /* erase usage bits if
* there is no referrer */
/* find all symbols that are referred by this symbol */
- for (ref = root->next; ref != NULL; ref = ref->next)
+ for (ref = root->next; ref; ref = ref->next)
{
- if (ref->parent != NULL)
+ if (ref->parent)
continue; /* hierarchical data type */
assert(ref->refer != NULL);
for (i = 0; i < ref->numrefers && ref->refer[i] != sym;
}
else if ((sym->ident == iVARIABLE || sym->ident == iARRAY)
&& (sym->usage & uPUBLIC) == 0
- && sym->parent == NULL && count_referrers(sym) == 0)
+ && !sym->parent && count_referrers(sym) == 0)
{
sym->usage &= ~(uREAD | uWRITTEN); /* erase usage bits if
* there is no referrer */
symbol *sym = root->next;
- while (sym != NULL && sym->compound >= level)
+ while (sym && sym->compound >= level)
{
switch (sym->ident)
{
break;
default:
/* a variable */
- if (sym->parent != NULL)
+ if (sym->parent)
break; /* hierarchical data type */
if ((sym->usage & (uWRITTEN | uREAD | uSTOCK | uPUBLIC)) == 0)
error(203, sym->name); /* symbol isn't used (and not stock
{
cell sublength =
calc_array_datasize(finddepend(sym), offset);
- if (offset != NULL)
+ if (offset)
*offset = length * (*offset + sizeof(cell));
if (sublength > 0)
length *= length * sublength;
}
else
{
- if (offset != NULL)
+ if (offset)
*offset = 0;
} /* if */
return length;
int savepri = FALSE;
symbol *sym = root->next;
- while (sym != NULL && sym->compound >= level)
+ while (sym && sym->compound >= level)
{
if (sym->ident == iVARIABLE || sym->ident == iARRAY)
{
/* check that the '~' operator is defined for this tag */
operator_symname(symbolname, "~", sym->tag, 0, 1, 0);
- if ((opsym = findglb(symbolname)) != NULL)
+ if ((opsym = findglb(symbolname)))
{
/* save PRI, in case of a return statment */
if (!savepri)
if (sc_status != statSKIP)
markusage(opsym, uREAD); /* do not mark as "used" when this
* call itself is skipped */
- if (opsym->x.lib != NULL)
+ if (opsym->x.lib)
opsym->x.lib->value += 1; /* increment "usage count"
* of the library */
} /* if */
{
constvalue *cur;
- if ((cur = (constvalue *) malloc(sizeof(constvalue))) == NULL)
+ if (!(cur = (constvalue *)malloc(sizeof(constvalue))))
error(103); /* insufficient memory (fatal error) */
memset(cur, 0, sizeof(constvalue));
strcpy(cur->name, name);
constvalue *cur, *prev;
/* find the end of the constant table */
- for (prev = table, cur = table->next; cur != NULL;
+ for (prev = table, cur = table->next; cur;
prev = cur, cur = cur->next)
/* nothing */ ;
return insert_constval(prev, NULL, name, val, index);
{
constvalue *ptr = table->next;
- while (ptr != NULL)
+ while (ptr)
{
if (strcmp(name, ptr->name) == 0 && ptr->index == index)
return ptr;
{
constvalue *ptr = table->next;
- while (ptr != NULL)
+ while (ptr)
{
if (ptr->value == val)
return ptr;
{
constvalue *cur = table->next, *next;
- while (cur != NULL)
+ while (cur)
{
next = cur->next;
free(cur);
if (tok != '{')
setline(fline, fcurrent);
/* lex() has set stmtindent */
- if (lastindent != NULL && tok != tLABEL)
+ if (lastindent && tok != tLABEL)
{
#if 0
if (*lastindent >= 0 && *lastindent != stmtindent &&
if (lval.ident == iARRAY || lval.ident == iREFARRAY)
{
char *ptr =
- (lval.sym->name != NULL) ? lval.sym->name : "-unknown-";
+ (lval.sym->name) ? lval.sym->name : "-unknown-";
error(33, ptr); /* array must be indexed */
} /* if */
if (lval.ident == iCONSTEXPR)
* case values at the same time.
*/
for (csp = &caselist, cse = caselist.next;
- cse != NULL && cse->value < val;
+ cse && cse->value < val;
csp = cse, cse = cse->next)
/* nothing */ ;
- if (cse != NULL && cse->value == val)
+ if (cse && cse->value == val)
error(40, val); /* duplicate "case" label */
/* Since the label is stored as a string in the
* "constvalue", the size of an identifier must
casecount++;
/* find the new insertion point */
for (csp = &caselist, cse = caselist.next;
- cse != NULL && cse->value < val;
+ cse && cse->value < val;
csp = cse, cse = cse->next)
/* nothing */ ;
- if (cse != NULL && cse->value == val)
+ if (cse && cse->value == val)
error(40, val); /* duplicate "case" label */
insert_constval(csp, cse, itoh(lbl_case), val, 0);
} /* if */
/* verify that the case table is sorted (unfortunatly, duplicates can
* occur; there really shouldn't be duplicate cases, but the compiler
* may not crash or drop into an assertion for a user error). */
- for (cse = caselist.next; cse != NULL && cse->next != NULL; cse = cse->next)
+ for (cse = caselist.next; cse && cse->next; cse = cse->next)
; /* empty. no idea whether this is correct, but we MUST NOT do
* the setlabel(lbl_table) call in the loop body. doing so breaks
* switch statements that only have one case statement following.
} /* if */
ffcase(casecount, labelname, TRUE);
/* generate the rest of the table */
- for (cse = caselist.next; cse != NULL; cse = cse->next)
+ for (cse = caselist.next; cse; cse = cse->next)
ffcase(cse->value, cse->name, FALSE);
setlabel(lbl_exit);
symbol *sym;
tokeninfo(&val, &st); /* retrieve label name again */
- if (find_constval(&tagname_tab, st, 0) != NULL)
+ if (find_constval(&tagname_tab, st, 0))
error(221, st); /* label name shadows tagname */
sym = fetchlab(st);
setlabel((int)sym->addr);
ptr = readwhile(); /* readwhile() gives an error if not in loop */
needtoken(tTERM);
- if (ptr == NULL)
+ if (!ptr)
return;
destructsymbols(&loctab, nestlevel);
modstk(((int)declared - ptr[wqBRK]) * sizeof(cell));
ptr = readwhile(); /* readwhile() gives an error if not in loop */
needtoken(tTERM);
- if (ptr == NULL)
+ if (!ptr)
return;
destructsymbols(&loctab, nestlevel);
modstk(((int)declared - ptr[wqCONT]) * sizeof(cell));
assert((tag & PUBLICTAG) == 0);
for (ptr = tagname_tab.next;
- ptr != NULL && tag != (int)(ptr->value & TAGMASK); ptr = ptr->next)
+ ptr && tag != (int)(ptr->value & TAGMASK); ptr = ptr->next)
/* nothing */ ;
- if (ptr != NULL)
+ if (ptr)
ptr->value |= PUBLICTAG;
} /* if */
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- *
- * Small compiler - File input, preprocessing and lexical analysis functions
+/* Small compiler - File input, preprocessing and lexical analysis functions
*
* Copyright (c) ITB CompuPhase, 1997-2003
*
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sc2.c 45428 2010-01-22 06:37:19Z caro $
+ * Version: $Id: embryo_cc_sc2.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
{
fp = (FILE *) sc_opensrc(name);
ext = strchr(name, '\0'); /* save position */
- if (fp == NULL)
+ if (!fp)
{
/* try to append an extension */
strcpy(ext, extensions[ext_idx]);
fp = (FILE *) sc_opensrc(name);
- if (fp == NULL)
+ if (!fp)
*ext = '\0'; /* on failure, restore filename */
} /* if */
ext_idx++;
}
- while (fp == NULL && ext_idx < (sizeof extensions / sizeof extensions[0]));
- if (fp == NULL)
+ while (!fp && ext_idx < (sizeof extensions / sizeof extensions[0]));
+ if (!fp)
{
*ext = '\0'; /* restore filename */
return FALSE;
pushstk((stkitem) fcurrent);
pushstk((stkitem) fline);
inpfname = strdup(name); /* set name of include file */
- if (inpfname == NULL)
+ if (!inpfname)
error(103); /* insufficient memory */
inpf = fp; /* set input file pointer to include file */
fnumber++;
if (try_includepaths && name[0] != DIRSEP_CHAR)
{
- for (i = 0; !result && (ptr = get_path(i)) != NULL; i++)
+ for (i = 0; !result && (ptr = get_path(i)); i++)
{
char path[PATH_MAX];
cont = FALSE;
do
{
- if (inpf == NULL || sc_eofsrc(inpf))
+ if (!inpf || sc_eofsrc(inpf))
{
if (cont)
error(49); /* invalid line continuation */
- if (inpf != NULL && inpf != inpf_org)
+ if (inpf && inpf != inpf_org)
sc_closesrc(inpf);
i = (int)(long)popstk();
if (i == -1)
elsedone = 0;
} /* if */
- if (sc_readsrc(inpf, line, num) == NULL)
+ if (!sc_readsrc(inpf, line, num))
{
*line = '\0'; /* delete line */
cont = FALSE;
} /* if */
cont = FALSE;
/* check whether a full line was read */
- if (strchr(line, '\n') == NULL && !sc_eofsrc(inpf))
+ if (!strchr(line, '\n') && !sc_eofsrc(inpf))
error(75); /* line too long */
/* check if the next line must be concatenated to this line */
- if ((ptr = strchr(line, '\n')) != NULL && ptr > line)
+ if ((ptr = strchr(line, '\n')) && ptr > line)
{
assert(*(ptr + 1) == '\0'); /* '\n' should be last in the string */
while (ptr > line
}
else if (*line == '/' && *(line + 1) == '/')
{ /* comment to end of line */
- if (strchr(line, '\a') != NULL)
+ if (strchr(line, '\a'))
error(49); /* invalid line continuation */
*line++ = '\n'; /* put "newline" at first slash */
*line = '\0'; /* put "zero-terminator" at second slash */
{
free(inpfname);
inpfname = strdup(pathname);
- if (inpfname == NULL)
+ if (!inpfname)
error(103); /* insufficient memory */
} /* if */
} /* if */
if (strlen(name) > sEXPMAX)
error(220, name, sEXPMAX); /* exported symbol is truncated */
/* add the name if it does not yet exist in the table */
- if (find_constval(&libname_tab, name, 0) == NULL)
+ if (!find_constval(&libname_tab, name, 0))
curlibrary =
append_constval(&libname_tab, name, 0, 0);
} /* if */
name[i] = '\0';
/* get the symbol */
sym = findloc(name);
- if (sym == NULL)
+ if (!sym)
sym = findglb(name);
- if (sym != NULL)
+ if (sym)
{
sym->usage |= uREAD;
if (sym->ident == iVARIABLE
break;
case tSYMBOL:
sym = findloc(str);
- if (sym == NULL)
+ if (!sym)
sym = findglb(str);
- if (sym == NULL || (sym->ident != iFUNCTN
+ if (!sym || (sym->ident != iFUNCTN
&& sym->ident != iREFFUNC
&& (sym->usage & uDEFINE) == 0))
{
} /* if */
/* store matched pattern */
pattern = malloc(count + 1);
- if (pattern == NULL)
+ if (!pattern)
error(103); /* insufficient memory */
lptr = start;
count = 0;
/* keep position of the start of trailing whitespace */
if (*lptr <= ' ')
{
- if (end == NULL)
+ if (!end)
end = lptr;
}
else
count++;
lptr++;
} /* while */
- if (end == NULL)
+ if (!end)
end = lptr;
/* store matched substitution */
substitution = malloc(count + 1); /* +1 for '\0' */
- if (substitution == NULL)
+ if (!substitution)
error(103); /* insufficient memory */
lptr = start;
count = 0;
prefixlen++, start++)
/* nothing */ ;
assert(prefixlen > 0);
- if ((def = find_subst(pattern, prefixlen)) != NULL)
+ if ((def = find_subst(pattern, prefixlen)))
{
if (strcmp(def->first, pattern) != 0
|| strcmp(def->second, substitution) != 0)
{
if (is_startstring(e)) /* skip strings */
e = skipstring(e);
- else if (strchr("({[", *e) != NULL) /* skip parenthized groups */
+ else if (strchr("({[", *e)) /* skip parenthized groups */
e = skippgroup(e);
if (*e != '\0')
e++; /* skip non-alphapetic character (or closing quote of
* a string, or the closing paranthese of a group) */
} /* while */
/* store the parameter (overrule any earlier) */
- if (args[arg] != NULL)
+ if (args[arg])
free(args[arg]);
len = (int)(e - s);
args[arg] = malloc(len + 1);
- if (args[arg] == NULL)
+ if (!args[arg])
error(103); /* insufficient memory */
strncpy(args[arg], s, len);
args[arg][len] = '\0';
{
arg = *(e + 1) - '0';
assert(arg >= 0 && arg <= 9);
- if (args[arg] != NULL)
+ if (args[arg])
len += strlen(args[arg]);
e++; /* skip %, digit is skipped later */
}
{
arg = *(e + 1) - '0';
assert(arg >= 0 && arg <= 9);
- if (args[arg] != NULL)
+ if (args[arg])
{
strins(s, args[arg], strlen(args[arg]));
s += strlen(args[arg]);
} /* if */
for (arg = 0; arg < 10; arg++)
- if (args[arg] != NULL)
+ if (args[arg])
free(args[arg]);
return match;
} /* while */
assert(prefixlen > 0);
subst = find_subst(start, prefixlen);
- if (subst != NULL)
+ if (subst)
{
/* properly match the pattern and substitute */
if (!substpattern
litmax += sDEF_LITMAX;
p = (cell *) realloc(litq, litmax * sizeof(cell));
- if (p == NULL)
+ if (!p)
error(102, "literal table"); /* literal table overflow (fatal error) */
litq = p;
} /* if */
symbol *newsym;
if (sort)
- while (root->next != NULL && strcmp(entry->name, root->next->name) > 0)
+ while (root->next && strcmp(entry->name, root->next->name) > 0)
root = root->next;
- if ((newsym = (symbol *) malloc(sizeof(symbol))) == NULL)
+ if (!(newsym = (symbol *)malloc(sizeof(symbol))))
{
error(103);
return NULL;
/* erase only the symbols with a deeper nesting level than the
* specified nesting level */
- while (root->next != NULL)
+ while (root->next)
{
sym = root->next;
if (sym->compound < level)
symbol *ptr = root->next;
unsigned long hash = namehash(name);
- while (ptr != NULL)
+ while (ptr)
{
if (hash == ptr->hash && strcmp(name, ptr->name) == 0
- && ptr->parent == NULL && (ptr->fnumber < 0
+ && !ptr->parent && (ptr->fnumber < 0
|| ptr->fnumber == fnumber))
return ptr;
ptr = ptr->next;
{
symbol *ptr = root->next;
- while (ptr != NULL)
+ while (ptr)
{
if (ptr->parent == sym)
return ptr;
} /* if */
/* see if there is an empty spot in the referrer list */
- for (count = 0; count < entry->numrefers && entry->refer[count] != NULL;
+ for (count = 0; count < entry->numrefers && entry->refer[count];
count++)
/* nothing */ ;
assert(count <= entry->numrefers);
assert(newsize > 0);
/* grow the referrer list */
refer = (symbol **) realloc(entry->refer, newsize * sizeof(symbol *));
- if (refer == NULL)
+ if (!refer)
return FALSE; /* insufficient memory */
/* initialize the new entries */
entry->refer = refer;
* outside functions; in the case of syntax errors, however, the
* compiler may arrive through this function
*/
- if (curfunc != NULL)
+ if (curfunc)
refer_symbol(sym, curfunc);
} /* if */
} /* if */
symbol *sym;
sym = find_symbol(&loctab, name, -1); /* try local symbols first */
- if (sym == NULL || sym->ident != iCONSTEXPR) /* not found, or not a constant */
+ if (!sym || sym->ident != iCONSTEXPR) /* not found, or not a constant */
sym = find_symbol(&glbtab, name, fcurrent);
- if (sym == NULL || sym->ident != iCONSTEXPR)
+ if (!sym || sym->ident != iCONSTEXPR)
return NULL;
assert(sym->parent == NULL); /* constants have no hierarchy */
return sym;
symbol *sym;
sym = find_symbol_child(&loctab, parent); /* try local symbols first */
- if (sym == NULL) /* not found */
+ if (!sym) /* not found */
sym = find_symbol_child(&glbtab, parent);
return sym;
}
assert(ident != iLABEL || findloc(name) == NULL);
/* create an empty referrer list */
- if ((refer = (symbol **) malloc(sizeof(symbol *))) == NULL)
+ if (!(refer = (symbol **)malloc(sizeof(symbol *))))
{
error(103); /* insufficient memory */
return NULL;
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sc3.c 45428 2010-01-22 06:37:19Z caro $
+ * Version: $Id: embryo_cc_sc3.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
/* find the name with the operator */
if (numparam == 2)
{
- if (oper == NULL)
+ if (!oper)
{
/* assignment operator: a special case */
strcpy(opername, "=");
- if (lval != NULL
+ if (lval
&& (lval->ident == iARRAYCELL || lval->ident == iARRAYCHAR))
savealt = TRUE;
}
operator_symname(symbolname, opername, tag1, tag2, numparam, tag2);
swapparams = FALSE;
sym = findglb(symbolname);
- if (sym == NULL /*|| (sym->usage & uDEFINE)==0 */ )
+ if (!sym /*|| (sym->usage & uDEFINE)==0 */ )
{ /* ??? should not check uDEFINE; first pass clears these bits */
/* check for commutative operators */
- if (tag1 == tag2 || oper == NULL || !commutative(oper))
+ if (tag1 == tag2 || !oper || !commutative(oper))
return FALSE; /* not commutative, cannot swap operands */
/* if arrived here, the operator is commutative and the tags are different,
* swap tags and try again
operator_symname(symbolname, opername, tag2, tag1, numparam, tag1);
swapparams = TRUE;
sym = findglb(symbolname);
- if (sym == NULL /*|| (sym->usage & uDEFINE)==0 */ )
+ if (!sym /*|| (sym->usage & uDEFINE)==0 */ )
return FALSE;
} /* if */
} /* if */
/* push parameters, call the function */
- paramspassed = (oper == NULL) ? 1 : numparam;
+ paramspassed = (!oper) ? 1 : numparam;
switch (paramspassed)
{
case 1:
ffcall(sym, paramspassed);
if (sc_status != statSKIP)
markusage(sym, uREAD); /* do not mark as "used" when this call itself is skipped */
- if (sym->x.lib != NULL)
+ if (sym->x.lib)
sym->x.lib->value += 1; /* increment "usage count" of the library */
sideeffect = TRUE; /* assume functions carry out a side-effect */
assert(resulttag != NULL);
{
symbol *sym = lval->sym;
- if (sym == NULL || (sym->ident != iFUNCTN && sym->ident != iREFFUNC))
+ if (!sym || (sym->ident != iFUNCTN && sym->ident != iREFFUNC))
return; /* no known symbol, or not a function result */
if ((sym->usage & uDEFINE) != 0)
plnge2(op1[opidx], hier, lval, &lval2);
if (op1[opidx] == ob_and || op1[opidx] == ob_or)
bitwise_opercount++;
- if (forcetag != NULL)
+ if (forcetag)
lval->tag = sc_addtag(forcetag);
}
while (nextop(&opidx, opstr)); /* do */
if (lval1->ident == iARRAY || lval1->ident == iREFARRAY)
{
char *ptr =
- (lval1->sym != NULL) ? lval1->sym->name : "-unknown-";
+ (lval1->sym) ? lval1->sym->name : "-unknown-";
error(33, ptr); /* array must be indexed */
}
else if (lval2->ident == iARRAY || lval2->ident == iREFARRAY)
{
char *ptr =
- (lval2->sym != NULL) ? lval2->sym->name : "-unknown-";
+ (lval2->sym) ? lval2->sym->name : "-unknown-";
error(33, ptr); /* array must be indexed */
} /* if */
/* ??? ^^^ should do same kind of error checking with functions */
*constant = FALSE;
*val = 0;
} /* if */
- if (tag != NULL)
+ if (tag)
*tag = lval.tag;
if (chkfuncresult)
checkfunction(&lval);
for (i = 0; i < sDIMEN_MAX; i++)
arrayidx1[i] = arrayidx2[i] = 0;
org_arrayidx = lval1->arrayidx; /* save current pointer, to reset later */
- if (lval1->arrayidx == NULL)
+ if (!lval1->arrayidx)
lval1->arrayidx = arrayidx1;
lvalue = plnge1(hier13, lval1);
if (lval1->ident != iARRAYCELL && lval1->ident != iARRAYCHAR)
lval2.arrayidx = NULL;
if (oper)
pop2();
- if (!oper && lval3.arrayidx != NULL && lval2.arrayidx != NULL
+ if (!oper && lval3.arrayidx && lval2.arrayidx
&& lval3.ident == lval2.ident && lval3.sym == lval2.sym)
{
int same = TRUE;
if (lval2.ident != iARRAY && lval2.ident != iREFARRAY)
error(33, lval3.sym->name); /* array must be indexed */
- if (lval2.sym != NULL)
+ if (lval2.sym)
{
val = lval2.sym->dim.array.length; /* array variable */
level = lval2.sym->dim.array.level;
if (array1 && !array2)
{
char *ptr =
- (lval->sym->name != NULL) ? lval->sym->name : "-unknown-";
+ (lval->sym->name) ? lval->sym->name : "-unknown-";
error(33, ptr); /* array must be indexed */
}
else if (!array1 && array2)
{
char *ptr =
- (lval2.sym->name != NULL) ? lval2.sym->name : "-unknown-";
+ (lval2.sym->name) ? lval2.sym->name : "-unknown-";
error(33, ptr); /* array must be indexed */
} /* if */
/* ??? if both are arrays, should check dimensions */
if (tok != tSYMBOL)
return error(20, st); /* illegal symbol name */
sym = findloc(st);
- if (sym == NULL)
+ if (!sym)
sym = findglb(st);
- if (sym != NULL && sym->ident != iFUNCTN && sym->ident != iREFFUNC
+ if (sym && sym->ident != iFUNCTN && sym->ident != iREFFUNC
&& (sym->usage & uDEFINE) == 0)
sym = NULL; /* symbol is not a function, it is in the table, but not "defined" */
val = (sym != NULL);
- if (!val && find_subst(st, strlen(st)) != NULL)
+ if (!val && find_subst(st, strlen(st)))
val = 1;
clear_value(lval);
lval->ident = iCONSTEXPR;
if (tok != tSYMBOL)
return error(20, st); /* illegal symbol name */
sym = findloc(st);
- if (sym == NULL)
+ if (!sym)
sym = findglb(st);
- if (sym == NULL)
+ if (!sym)
return error(17, st); /* undefined symbol */
if (sym->ident == iCONSTEXPR)
error(39); /* constant symbol has no size */
error(28); /* invalid subscript */
else
lval->constval = array_levelsize(sym, level);
- if (lval->constval == 0 && strchr(lptr, PREPROC_TERM) == NULL)
+ if (lval->constval == 0 && !strchr(lptr, PREPROC_TERM))
error(224, st); /* indeterminate array size in "sizeof" expression */
} /* if */
const1(lval->constval);
else
{
sym = findloc(st);
- if (sym == NULL)
+ if (!sym)
sym = findglb(st);
- if (sym == NULL)
+ if (!sym)
return error(17, st); /* undefined symbol */
if ((sym->usage & uDEFINE) == 0)
return error(17, st); /* undefined symbol (symbol is in the table, but it is "used" only) */
if (matchtoken('[') || matchtoken('{') || matchtoken('('))
{
tok = tokeninfo(&val, &st); /* get token read by matchtoken() */
- if (sym == NULL && symtok != tSYMBOL)
+ if (!sym && symtok != tSYMBOL)
{
/* we do not have a valid symbol and we appear not to have read a valid
* symbol name (so it is unlikely that we would have read a name of an
if (tok == '[' || tok == '{')
{ /* subscript */
close = (char)((tok == '[') ? ']' : '}');
- if (sym == NULL)
+ if (!sym)
{ /* sym==NULL if lval is a constant or a literal */
error(28); /* cannot subscript */
needtoken(close);
if (lval2.ident == iCONSTEXPR)
{ /* constant expression */
stgdel(index, cidx); /* scratch generated code */
- if (lval1->arrayidx != NULL)
+ if (lval1->arrayidx)
{ /* keep constant index, for checking */
assert(sym->dim.array.level >= 0
&& sym->dim.array.level < sDIMEN_MAX);
}
else
{ /* tok=='(' -> function(...) */
- if (sym == NULL
+ if (!sym
|| (sym->ident != iFUNCTN && sym->ident != iREFFUNC))
{
- if (sym == NULL && sc_status == statFIRST)
+ if (!sym && sc_status == statFIRST)
{
/* could be a "use before declaration"; in that case, create a stub
* function so that the usage can be marked.
*/
sym = fetchfunc(lastsymbol, 0);
- if (sym != NULL)
+ if (sym)
markusage(sym, uREAD);
} /* if */
return error(12); /* invalid function call */
return FALSE; /* result of function call is no lvalue */
} /* if */
} /* if */
- if (sym != NULL && lval1->ident == iFUNCTN)
+ if (sym && lval1->ident == iFUNCTN)
{
assert(sym->ident == iFUNCTN);
address(sym);
if (tok == tSYMBOL && !findconst(st))
{
/* first look for a local variable */
- if ((sym = findloc(st)) != 0)
+ if ((sym = findloc(st)))
{
if (sym->ident == iLABEL)
{
} /* if */
} /* if */
/* now try a global variable */
- if ((sym = findglb(st)) != 0)
+ if ((sym = findglb(st)))
{
if (sym->ident == iFUNCTN || sym->ident == iREFFUNC)
{
} /* if */
/* ??? handle const array passed by reference */
/* otherwise, the address is already in PRI */
- if (lval.sym != NULL)
+ if (lval.sym)
markusage(lval.sym, uWRITTEN);
/*
* Dont need this warning - its varargs. there is no way of knowing the
case iREFERENCE:
if (!lvalue || lval.ident == iARRAYCHAR)
error(35, argidx + 1); /* argument type mismatch */
- if (lval.sym != NULL && (lval.sym->usage & uCONST) != 0
+ if (lval.sym && (lval.sym->usage & uCONST) != 0
&& (arg[argidx].usage & uCONST) == 0)
error(35, argidx + 1); /* argument type mismatch */
if (lval.ident == iVARIABLE || lval.ident == iREFERENCE)
(arg[argidx].tags, arg[argidx].numtags, lval.tag))
error(213);
argidx++; /* argument done */
- if (lval.sym != NULL)
+ if (lval.sym)
markusage(lval.sym, uWRITTEN);
break;
case iREFARRAY:
error(35, argidx + 1); /* argument type mismatch */
break;
} /* if */
- if (lval.sym != NULL && (lval.sym->usage & uCONST) != 0
+ if (lval.sym && (lval.sym->usage & uCONST) != 0
&& (arg[argidx].usage & uCONST) == 0)
error(35, argidx + 1); /* argument type mismatch */
/* Verify that the dimensions match with those in arg[argidx].
* A literal array always has a single dimension.
* An iARRAYCELL parameter is also assumed to have a single dimension.
*/
- if (lval.sym == NULL || lval.ident == iARRAYCELL)
+ if (!lval.sym || lval.ident == iARRAYCELL)
{
if (arg[argidx].numdim != 1)
{
*/
asz = find_constval(&arrayszlst, arg[argidx].defvalue.size.symname,
arg[argidx].defvalue.size.level);
- if (asz != NULL)
+ if (asz)
{
array_sz = asz->value;
if (array_sz == 0)
assert((arg[argidx].hasdefault & uTAGOF) != 0);
sym = findloc(arg[argidx].defvalue.size.symname);
- if (sym == NULL)
+ if (!sym)
sym = findglb(arg[argidx].defvalue.size.symname);
- array_sz = (sym != NULL) ? sym->tag : 0;
+ array_sz = (sym) ? sym->tag : 0;
exporttag(array_sz);
} /* if */
const1(array_sz);
ffcall(sym, nargs);
if (sc_status != statSKIP)
markusage(sym, uREAD); /* do not mark as "used" when this call itself is skipped */
- if (sym->x.lib != NULL)
+ if (sym->x.lib)
sym->x.lib->value += 1; /* increment "usage count" of the library */
modheap(-heapalloc * sizeof(cell));
sideeffect = TRUE; /* assume functions carry out a side-effect */
symbol *sym;
tok = lex(&val, &st);
- if (tok == tSYMBOL && (sym = findconst(st)) != 0)
+ if (tok == tSYMBOL && (sym = findconst(st)))
{
lval->constval = sym->addr;
const1(lval->constval);
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sc4.c 45071 2010-01-12 22:44:25Z caro $
+ * Version: $Id: embryo_cc_sc4.c 50816 2010-08-04 16:57:32Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
}
void
-fillarray(symbol * sym, cell size, cell value)
+fillarray(symbol * sym, cell size, cell val)
{
- const1(value); /* load value in PRI */
+ const1(val); /* load val in PRI */
assert(sym != NULL);
/* the symbol can be a local array, a global array, or an array
}
void
-ffcase(cell value, char *labelname, int newtable)
+ffcase(cell val, char *labelname, int newtable)
{
if (newtable)
{
code_idx += opcodes(1);
} /* if */
stgwrite("\tcase ");
- outval(value, FALSE);
+ outval(val, FALSE);
stgwrite(" ");
stgwrite(labelname);
stgwrite("\n");
/* set the stack to a hard offset from the frame */
void
-setstk(cell value)
+setstk(cell val)
{
stgwrite("\tlctrl 5\n"); /* get FRM */
- assert(value <= 0); /* STK should always become <= FRM */
- if (value < 0)
+ assert(val <= 0); /* STK should always become <= FRM */
+ if (val < 0)
{
stgwrite("\tadd.c ");
- outval(value, TRUE); /* add (negative) offset */
+ outval(val, TRUE); /* add (negative) offset */
code_idx += opcodes(1) + opargs(1);
- // ??? write zeros in the space between STK and the value in PRI (the new stk)
- // get value of STK in ALT
+ // ??? write zeros in the space between STK and the val in PRI (the new stk)
+ // get val of STK in ALT
// zero PRI
// need new FILL opcode that takes a variable size
} /* if */
}
void
-setheap(cell value)
+setheap(cell val)
{
- stgwrite("\tconst.pri "); /* load default value in PRI */
- outval(value, TRUE);
+ stgwrite("\tconst.pri "); /* load default val in PRI */
+ outval(val, TRUE);
code_idx += opcodes(1) + opargs(1);
setheap_pri();
}
* Add a constant to the primary register.
*/
void
-addconst(cell value)
+addconst(cell val)
{
- if (value != 0)
+ if (val != 0)
{
stgwrite("\tadd.c ");
- outval(value, TRUE);
+ outval(val, TRUE);
code_idx += opcodes(1) + opargs(1);
} /* if */
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- *
- * Small compiler - Error message system
+/* Small compiler - Error message system
* In fact a very simple system, using only 'panic mode'.
*
* Copyright (c) ITB CompuPhase, 1997-2003
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sc5.c 45192 2010-01-15 19:44:25Z englebass $
+ * Version: $Id: embryo_cc_sc5.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
sc_error(0, "\nCompilation aborted.", NULL, 0, 0, argptr);
va_end(argptr);
- if (outf != NULL)
+ if (outf)
{
sc_closeasm(outf);
outf = NULL;
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sc6.c 45192 2010-01-15 19:44:25Z englebass $
+ * Version: $Id: embryo_cc_sc6.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
result = (result << 4) | digit;
s++;
} /* for */
- if (n != NULL)
+ if (n)
*n = s;
if (negate)
result = (~result) + 1; /* take two's complement of the result */
{
char *ptr = strchr(str, ';');
- if (ptr != NULL)
+ if (ptr)
{
*ptr++ = '\n'; /* terminate the line, but leave the '\n' */
*ptr = '\0';
static cell
parm0(FILE * fbin, char *params __UNUSED__, cell opcode)
{
- if (fbin != NULL)
+ if (fbin)
write_encoded(fbin, (ucell *) & opcode, 1);
return opcodes(1);
}
{
ucell p = hex2long(params, NULL);
- if (fbin != NULL)
+ if (fbin)
{
write_encoded(fbin, (ucell *) & opcode, 1);
write_encoded(fbin, &p, 1);
p[0] = hex2long(params, ¶ms);
p[1] = hex2long(params, NULL);
- if (fbin != NULL)
+ if (fbin)
{
write_encoded(fbin, (ucell *) & opcode, 1);
write_encoded(fbin, p, 2);
while (*params != '\0')
{
p = hex2long(params, ¶ms);
- if (fbin != NULL)
+ if (fbin)
write_encoded(fbin, &p, 1);
num++;
while (isspace(*params))
assert(sym->vclass == sGLOBAL);
p = sym->addr;
- if (fbin != NULL)
+ if (fbin)
{
write_encoded(fbin, (ucell *) & opcode, 1);
write_encoded(fbin, &p, 1);
i = (int)hex2long(params, NULL);
assert(i >= 0 && i < labnum);
- if (fbin != NULL)
+ if (fbin)
{
assert(lbltab != NULL);
p = lbltab[i];
assert(len > 0 && len < 256);
clen = len + sizeof(cell); /* add size of file ordinal */
- if (fbin != NULL)
+ if (fbin)
{
write_encoded(fbin, (ucell *) & opcode, 1);
write_encoded(fbin, &clen, 1);
params[len++] = '\0'; /* pad with zeros up to full cell */
clen = len + 2 * sizeof(cell); /* add size of symbol address and flags */
- if (fbin != NULL)
+ if (fbin)
{
write_encoded(fbin, (ucell *) & opcode, 1);
write_encoded(fbin, &clen, 1);
#if !defined NDEBUG
/* function should start right after the symbolic information */
- if (fbin == NULL && mclass == 0 && type == iFUNCTN)
+ if (!fbin && mclass == 0 && type == iFUNCTN)
assert(offset == codeindex + opcodes(1) + opargs(1) + clen);
#endif
i = (int)hex2long(params, NULL);
assert(i >= 0 && i < labnum);
- if (fbin != NULL)
+ if (fbin)
{
assert(lbltab != NULL);
p = lbltab[i];
i = (int)hex2long(params, NULL);
assert(i >= 0 && i < labnum);
- if (fbin != NULL)
+ if (fbin)
{
assert(lbltab != NULL);
p = lbltab[i];
numpubvars = 0;
mainaddr = -1;
/* count number of public and native functions and public variables */
- for (sym = glbtab.next; sym != NULL; sym = sym->next)
+ for (sym = glbtab.next; sym; sym = sym->next)
{
char alias[sNAMEMAX + 1] = "";
int match = 0;
/* count number of libraries */
numlibraries = 0;
- for (constptr = libname_tab.next; constptr != NULL;
+ for (constptr = libname_tab.next; constptr;
constptr = constptr->next)
{
if (constptr->value > 0)
/* count number of public tags */
numtags = 0;
- for (constptr = tagname_tab.next; constptr != NULL;
+ for (constptr = tagname_tab.next; constptr;
constptr = constptr->next)
{
if ((constptr->value & PUBLICTAG) != 0)
/* write the public functions table */
count = 0;
- for (sym = glbtab.next; sym != NULL; sym = sym->next)
+ for (sym = glbtab.next; sym; sym = sym->next)
{
if (sym->ident == iFUNCTN
&& (sym->usage & uPUBLIC) != 0 && (sym->usage & uDEFINE) != 0)
if (numnatives > 0)
{
nativelist = (symbol **) malloc(numnatives * sizeof(symbol *));
- if (nativelist == NULL)
+ if (!nativelist)
error(103); /* insufficient memory */
#if !defined NDEBUG
memset(nativelist, 0, numnatives * sizeof(symbol *)); /* for NULL checking */
#endif
- for (sym = glbtab.next; sym != NULL; sym = sym->next)
+ for (sym = glbtab.next; sym; sym = sym->next)
{
if (sym->ident == iFUNCTN && (sym->usage & uNATIVE) != 0
&& (sym->usage & uREAD) != 0 && sym->addr >= 0)
/* write the libraries table */
count = 0;
- for (constptr = libname_tab.next; constptr != NULL;
+ for (constptr = libname_tab.next; constptr;
constptr = constptr->next)
{
if (constptr->value > 0)
/* write the public variables table */
count = 0;
- for (sym = glbtab.next; sym != NULL; sym = sym->next)
+ for (sym = glbtab.next; sym; sym = sym->next)
{
if (sym->ident == iVARIABLE && (sym->usage & uPUBLIC) != 0)
{
/* write the public tagnames table */
count = 0;
- for (constptr = tagname_tab.next; constptr != NULL;
+ for (constptr = tagname_tab.next; constptr;
constptr = constptr->next)
{
if ((constptr->value & PUBLICTAG) != 0)
/* only very short programs have zero labels; no first pass is needed
* if there are no labels */
lbltab = (cell *) malloc(labnum * sizeof(cell));
- if (lbltab == NULL)
+ if (!lbltab)
error(103); /* insufficient memory */
codeindex = 0;
sc_resetasm(fin);
- while (sc_readasm(fin, line, sizeof line) != NULL)
+ while (sc_readasm(fin, line, sizeof line))
{
stripcomment(line);
instr = skipwhitespace(line);
/* nothing */ ;
assert(params > instr);
i = findopcode(instr, (int)(params - instr));
- if (opcodelist[i].name == NULL)
+ if (!opcodelist[i].name)
{
*params = '\0';
error(104, instr); /* invalid assembler instruction */
for (pass = sIN_CSEG; pass <= sIN_DSEG; pass++)
{
sc_resetasm(fin);
- while (sc_readasm(fin, line, sizeof line) != NULL)
+ while (sc_readasm(fin, line, sizeof line))
{
stripcomment(line);
instr = skipwhitespace(line);
if (bytes_out - bytes_in > 0)
error(106); /* compression buffer overflow */
- if (lbltab != NULL)
+ if (lbltab)
{
free(lbltab);
#if !defined NDEBUG
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sc7.c 34246 2008-04-11 19:06:18Z doursse $
+ * Version: $Id: embryo_cc_sc7.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
grow_stgbuffer(int requiredsize)
{
char *p;
- int clear = stgbuf == NULL; /* if previously none, empty buffer explicitly */
+ int clear = !stgbuf; /* if previously none, empty buffer explicitly */
assert(stgmax < requiredsize);
/* if the staging buffer (holding intermediate code for one line) grows
if (requiredsize > sSTG_MAX)
error(102, "staging buffer"); /* staging buffer overflow (fatal error) */
stgmax = requiredsize + sSTG_GROW;
- if (stgbuf != NULL)
+ if (stgbuf)
p = (char *)realloc(stgbuf, stgmax * sizeof(char));
else
p = (char *)malloc(stgmax * sizeof(char));
- if (p == NULL)
+ if (!p)
error(102, "staging buffer"); /* staging buffer overflow (fatal error) */
stgbuf = p;
if (clear)
void
stgbuffer_cleanup(void)
{
- if (stgbuf != NULL)
+ if (stgbuf)
{
free(stgbuf);
stgbuf = NULL;
start += 1; /* skip token */
/* allocate a argstack with sMAXARGS items */
stack = (argstack *) malloc(sMAXARGS * sizeof(argstack));
- if (stack == NULL)
+ if (!stack)
error(103); /* insufficient memory */
nest = 1; /* nesting counter */
argc = 0; /* argument counter */
char str[160];
/* count number of sequences */
- for (number = 0; sequences_cmp[number].find != NULL; number++)
+ for (number = 0; sequences_cmp[number].find; number++)
/* nothing */ ;
number++; /* include an item for the NULL terminator */
- if ((sequences = (SEQUENCE *) malloc(number * sizeof(SEQUENCE))) == NULL)
+ if (!(sequences = (SEQUENCE *)malloc(number * sizeof(SEQUENCE))))
return FALSE;
/* pre-initialize all to NULL (in case of failure) */
assert(len <= sizeof str);
assert(len == (int)strlen(str) + 1);
sequences[i].find = (char *)malloc(len);
- if (sequences[i].find != NULL)
+ if (sequences[i].find)
strcpy(sequences[i].find, str);
len =
strexpand(str, (unsigned char *)sequences_cmp[i].replace, sizeof str,
assert(len <= sizeof str);
assert(len == (int)strlen(str) + 1);
sequences[i].replace = (char *)malloc(len);
- if (sequences[i].replace != NULL)
+ if (sequences[i].replace)
strcpy(sequences[i].replace, str);
sequences[i].savesize = sequences_cmp[i].savesize;
- if (sequences[i].find == NULL || sequences[i].replace == NULL)
+ if (!sequences[i].find || !sequences[i].replace)
return phopt_cleanup();
} /* for */
{
int i;
- if (sequences != NULL)
+ if (sequences)
{
i = 0;
- while (sequences[i].find != NULL || sequences[i].replace != NULL)
+ while (sequences[i].find || sequences[i].replace)
{
- if (sequences[i].find != NULL)
+ if (sequences[i].find)
free(sequences[i].find);
- if (sequences[i].replace != NULL)
+ if (sequences[i].replace)
free(sequences[i].replace);
i++;
} /* while */
} /* while */
/* allocate a buffer to replace the sequence in */
- if ((buffer = malloc(*repl_length)) == NULL)
+ if (!(buffer = malloc(*repl_length)))
{
error(103);
return NULL;
else
{
seq = 0;
- while (sequences[seq].find != NULL)
+ while (sequences[seq].find)
{
assert(seq >= 0);
if (matchsequence
* complete file.
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#include "embryo_cc_sc.h"
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_sclist.c 34246 2008-04-11 19:06:18Z doursse $
+ * Version: $Id: embryo_cc_sclist.c 51023 2010-08-11 20:35:26Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h>
assert(first != NULL);
assert(second != NULL);
/* create a new node, and check whether all is okay */
- if ((cur = (stringpair *) malloc(sizeof(stringpair))) == NULL)
+ if (!(cur = (stringpair *)malloc(sizeof(stringpair))))
return NULL;
cur->first = strdup(first);
cur->second = strdup(second);
cur->matchlength = matchlength;
- if (cur->first == NULL || cur->second == NULL)
+ if (!cur->first || !cur->second)
{
- if (cur->first != NULL)
+ if (cur->first)
free(cur->first);
- if (cur->second != NULL)
+ if (cur->second)
free(cur->second);
free(cur);
return NULL;
} /* if */
/* link the node to the tree, find the position */
- for (pred = root; pred->next != NULL && strcmp(pred->next->first, first) < 0;
+ for (pred = root; pred->next && strcmp(pred->next->first, first) < 0;
pred = pred->next)
/* nothing */ ;
cur->next = pred->next;
assert(root != NULL);
cur = root->next;
- while (cur != NULL)
+ while (cur)
{
next = cur->next;
assert(cur->first != NULL);
assert(matchlength > 0); /* the function cannot handle zero-length comparison */
assert(first != NULL);
- while (cur != NULL && result <= 0)
+ while (cur && result <= 0)
{
result = (int)*cur->first - (int)*first;
if (result == 0 && matchlength == cur->matchlength)
assert(root != NULL);
cur = root;
- while (cur->next != NULL)
+ while (cur->next)
{
if (cur->next == item)
{
assert(strlen(name) <= sNAMEMAX);
assert(alias != NULL);
assert(strlen(alias) <= sEXPMAX);
- if ((cur = insert_stringpair(&alias_tab, name, alias, strlen(name))) == NULL)
+ if (!(cur = insert_stringpair(&alias_tab, name, alias, strlen(name))))
error(103); /* insufficient memory (fatal error) */
return cur;
}
{
stringpair *cur =
find_stringpair(alias_tab.next, name, strlen(name));
- if (cur != NULL)
+ if (cur)
{
assert(strlen(cur->second) <= sEXPMAX);
strcpy(target, cur->second);
stringlist *cur;
assert(path != NULL);
- if ((cur = (stringlist *) malloc(sizeof(stringlist))) == NULL)
+ if (!(cur = (stringlist *)malloc(sizeof(stringlist))))
error(103); /* insufficient memory (fatal error) */
- if ((cur->line = strdup(path)) == NULL)
+ if (!(cur->line = strdup(path)))
error(103); /* insufficient memory (fatal error) */
cur->next = includepaths.next;
includepaths.next = cur;
{
stringlist *cur = includepaths.next;
- while (cur != NULL && index-- > 0)
+ while (cur && index-- > 0)
cur = cur->next;
- if (cur != NULL)
+ if (cur)
{
assert(cur->line != NULL);
return cur->line;
{
stringlist *cur = includepaths.next, *next;
- while (cur != NULL)
+ while (cur)
{
next = cur->next;
assert(cur->line != NULL);
assert((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_');
assert('A' < '_' && '_' < 'z');
- for (cur = substpair.next; cur != NULL && cur->first[0] != c;
+ for (cur = substpair.next; cur && cur->first[0] != c;
cur = cur->next)
/* nothing */ ;
substindex[(int)c - 'A'] = cur;
assert(pattern != NULL);
assert(substitution != NULL);
- if ((cur =
- insert_stringpair(&substpair, pattern, substitution,
- prefixlen)) == NULL)
+ if (!(cur = insert_stringpair(&substpair, pattern, substitution, prefixlen)))
error(103); /* insufficient memory (fatal error) */
adjustindex(*pattern);
return cur;
assert((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z')
|| *name == '_');
item = substindex[(int)*name - 'A'];
- if (item != NULL)
+ if (item)
item = find_stringpair(item, name, length);
return item;
}
assert((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z')
|| *name == '_');
item = substindex[(int)*name - 'A'];
- if (item != NULL)
+ if (item)
item = find_stringpair(item, name, length);
- if (item == NULL)
+ if (!item)
return FALSE;
delete_stringpair(&substpair, item);
adjustindex(*name);
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
- * Version: $Id: embryo_cc_scvars.c 47527 2010-03-28 08:36:55Z caro $
+ * Version: $Id: embryo_cc_scvars.c 50816 2010-08-04 16:57:32Z lucas $
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include <config.h> /* for PATH_MAX */
extern "C" {
#endif
-#define EMBRYO_VERSION_MAJOR 0
-#define EMBRYO_VERSION_MINOR 9
+#define EMBRYO_VERSION_MAJOR 1
+#define EMBRYO_VERSION_MINOR 0
typedef struct _Embryo_Version
{
@EMBRYO_CPPFLAGS@ \
@EFL_EMBRYO_BUILD@
-include_HEADERS = Embryo.h
+includes_HEADERS = Embryo.h
+includesdir = $(includedir)/embryo-@VMAJ@
lib_LTLIBRARIES = libembryo.la
/* Abstract Machine for the Small compiler
*
* Copyright (c) ITB CompuPhase, 1997-2003
- * Portions Copyright (c) Carsten Haitzler, 2004 <raster@rasterman.com>
+ * Portions Copyright (c) Carsten Haitzler, 2004-2010 <raster@rasterman.com>
*
* This software is provided "as-is", without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* 3. This notice may not be removed or altered from any source distribution.
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include "config.h"
Embryo_Header *hdr;
int i, num;
- if ((ep == NULL ) || (name == NULL) || (func == NULL)) return;
+ if ((!ep ) || (!name) || (!func)) return;
if (strlen(name) > sNAMEMAX) return;
hdr = (Embryo_Header *)ep->code;
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
* Carsten Haitzler, <raster@rasterman.com>
*/
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
#ifdef HAVE_CONFIG_H
# include "config.h"
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
STRGET(ep, s2, params[2]);
if ((!s1) || (!s2)) return -1;
p = strstr(s1, s2);
- if (p == NULL) return -1;
+ if (!p) return -1;
return (Embryo_Cell)(p - s1);
}
STRGET(ep, s1, params[1]);
STRGET(ep, s2, params[2]);
p = strchr(s1, s2[0]);
- if (p == NULL) return -1;
+ if (!p) return -1;
return (Embryo_Cell)(p - s1);
}
STRGET(ep, s1, params[1]);
STRGET(ep, s2, params[2]);
p = strrchr(s1, s2[0]);
- if (p == NULL) return -1;
+ if (!p) return -1;
return (Embryo_Cell)(p - s1);
}
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif