Tizen 2.0 Release tizen_2.0 accepted/tizen_2.0/20130215.203243 submit/tizen_2.0/20130215.191824
authorHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:18:08 +0000 (00:18 +0900)
committerHyungKyu Song <hk76.song@samsung.com>
Fri, 15 Feb 2013 15:18:08 +0000 (00:18 +0900)
69 files changed:
AUTHORS
COPYING
ChangeLog
INSTALL
Makefile.am
NEWS
README [new file with mode: 0644]
autogen.sh
configure.ac [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat
debian/control
debian/copyright
debian/libembryo-dev.install
debian/libembryo0.symbols [new file with mode: 0644]
debian/rules [changed mode: 0644->0755]
doc/Doxyfile.in [new file with mode: 0644]
doc/Makefile.am [new file with mode: 0644]
doc/e.css
doc/embryo.dox.in [new file with mode: 0644]
doc/foot.html
doc/head.html
doc/img/e.png [new file with mode: 0755]
doc/img/e_big.png [new file with mode: 0755]
doc/img/edoxy.css [new file with mode: 0755]
doc/img/foot_bg.png [new file with mode: 0755]
doc/img/head_bg.png [new file with mode: 0755]
doc/img/menu_bg.png [new file with mode: 0755]
doc/img/menu_bg_current.png [new file with mode: 0755]
doc/img/menu_bg_hover.png [new file with mode: 0755]
doc/img/menu_bg_last.png [new file with mode: 0755]
doc/img/menu_bg_unsel.png [new file with mode: 0755]
embryo.manifest [new file with mode: 0644]
embryo.pc.in
embryo.spec.in
include/default.inc
m4/ac_attribute.m4 [new file with mode: 0644]
m4/efl_binary.m4 [new file with mode: 0644]
m4/efl_doxygen.m4 [new file with mode: 0644]
m4/efl_fnmatch.m4 [new file with mode: 0644]
m4/efl_gettimeofday.m4 [new file with mode: 0644]
m4/efl_path_max.m4 [new file with mode: 0644]
packaging/embryo.spec [new file with mode: 0644]
src/bin/Makefile.am
src/bin/embryo_cc_amx.h
src/bin/embryo_cc_osdefs.h
src/bin/embryo_cc_prefix.c
src/bin/embryo_cc_prefix.h
src/bin/embryo_cc_sc.h
src/bin/embryo_cc_sc1.c
src/bin/embryo_cc_sc2.c
src/bin/embryo_cc_sc3.c
src/bin/embryo_cc_sc4.c
src/bin/embryo_cc_sc5.c
src/bin/embryo_cc_sc6.c
src/bin/embryo_cc_sc7.c
src/bin/embryo_cc_scexpand.c
src/bin/embryo_cc_sclist.c
src/bin/embryo_cc_scvars.c
src/lib/Embryo.h
src/lib/Makefile.am
src/lib/embryo_amx.c
src/lib/embryo_args.c
src/lib/embryo_float.c
src/lib/embryo_main.c
src/lib/embryo_private.h
src/lib/embryo_rand.c
src/lib/embryo_str.c
src/lib/embryo_time.c

diff --git a/AUTHORS b/AUTHORS
index 7bf31c1..0f8136b 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,2 +1,2 @@
 The Rasterman (Carsten Haitzler) <raster@rasterman.com>
 The Rasterman (Carsten Haitzler) <raster@rasterman.com>
-
+Jérôme Pinot <ngc891@gmail.com>
diff --git a/COPYING b/COPYING
index 474fcc5..26d6208 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,28 +1,47 @@
-Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS)
-
-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. This includes
-acknowledgments 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 it's 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 notice for Embryo:
+
+Copyright (C) 2004-2011 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 from the
+original Small (renamed to Pawn afterwards, but was named Small when
+Embryo split off). 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.
index e69de29..2611b84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -0,0 +1,51 @@
+2011-01-29  Carsten Haitzler (The Rasterman)
+
+        1.0.0 release
+
+2011-05-12  Carsten Haitzler (The Rasterman)
+
+       * Make embryo_cc use eina and eina_prefix to determine include location
+
+2011-07-16  Vincent Torri
+
+       * delete temporary files on Windows
+
+2011-10-05  Vincent Torri
+
+       * use fseek() instead of rewind() as the latter does not exist on
+       Windows CE and fix compilation with Evil.
+
+2011-12-02 Carsten Haitzler (The Rasterman)
+
+        1.1.0 release
+
+2012-02-24  Cedric Bail
+
+        * Add exotic support
+
+2012-03-07  Vincent Torri
+
+       * Fix windows compilation issues
+
+2012-04-16 Carsten Haitzler (The Rasterman)
+
+        * Add asin(), acos(), atan(), atan2(), log1p(), cbrt(), exp(),
+        exp2(), hypot(), EMBRYO_12 define
+
+2012-04-26 Carsten Haitzler (The Rasterman)
+
+        1.2.0 release
+
+2012-06-14 Carsten Haitzler (The Rasterman)
+
+        * Fix divide by 0 possibilities in the fp support so no FPE is
+        produced (bad).
+
+2012-08-30  Carsten Haitzler (The Rasterman)
+
+        1.7.0 release
+
+2012-09-12  Carsten Haitzler (The Rasterman)
+
+        * Fix windows utf/whitespace parsing issue in windows
+
diff --git a/INSTALL b/INSTALL
index 348d009..23e5f25 100644 (file)
--- a/INSTALL
+++ b/INSTALL
-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.
index 44b44d4..5c70db3 100644 (file)
@@ -1,4 +1,6 @@
-SUBDIRS = src include
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src include doc
 
 MAINTAINERCLEANFILES = \
 Makefile.in \
 
 MAINTAINERCLEANFILES = \
 Makefile.in \
@@ -6,13 +8,16 @@ aclocal.m4 \
 compile \
 config.guess \
 config.h.in \
 compile \
 config.guess \
 config.h.in \
+config.h.in~ \
 config.sub \
 configure \
 depcomp \
 install-sh \
 ltmain.sh \
 missing \
 config.sub \
 configure \
 depcomp \
 install-sh \
 ltmain.sh \
 missing \
-embryo_docs.tar.gz \
+$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.gz \
+$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).tar.bz2 \
+$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc.tar.bz2 \
 m4/libtool.m4 \
 m4/lt~obsolete.m4 \
 m4/ltoptions.m4 \
 m4/libtool.m4 \
 m4/lt~obsolete.m4 \
 m4/ltoptions.m4 \
@@ -22,17 +27,18 @@ m4/ltversion.m4
 EXTRA_DIST = \
 AUTHORS \
 COPYING \
 EXTRA_DIST = \
 AUTHORS \
 COPYING \
-COPYING-PLAIN \
 autogen.sh \
 autogen.sh \
-embryo.c.in \
 embryo.pc.in \
 embryo.spec.in \
 embryo.pc.in \
 embryo.spec.in \
-embryo.spec \
-README.in \
-README \
-Doxyfile \
-doc \
-gendoc
+embryo.spec
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = embryo.pc
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = embryo.pc
+
+.PHONY: doc
+
+# Documentation
+
+doc:
+       @echo "entering doc/"
+       make -C doc doc
diff --git a/NEWS b/NEWS
index e69de29..5b0201b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -0,0 +1,53 @@
+Embryo 1.8.0
+
+Changes since Embryo 1.7.0:
+---------------------------
+
+Fixes:
+
+    * Fix windows utf8 shitepsace parse issue.
+
+Changes since Embryo 1.2.0:
+---------------------------
+
+Fixes:
+
+    * Fix divide by 0 n FP support to avoid FPE.
+
+Changes since Embryo 1.1.0:
+---------------------------
+
+Additions:
+
+    * exotic support
+    * asin()
+    * acos()
+    * atan()
+    * atan2()
+    * log1p()
+    * cbrt()
+    * exp(),
+    * exp2()
+    * hypot()
+    * EMBRYO_12
+    
+Fixes:
+
+    * windows compilation support
+
+Improvements:
+
+    * exotic support
+    
+Changes since Embryo 1.0.0:
+---------------------------
+
+Fixes:
+
+    * on windows use fseek instead of rewind as rewind doesn't exist on wince
+    * delete tmp files on windows
+
+Improvements:
+
+    * make embryo_cc use eina_prefix to determine installation location
+
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..a434404
--- /dev/null
+++ b/README
@@ -0,0 +1,90 @@
+Embryo 1.7.99
+
+******************************************************************************
+
+ FOR ANY ISSUES PLEASE EMAIL:
+ enlightenment-devel@lists.sourceforge.net
+  
+******************************************************************************
+  
+Requirements:
+-------------
+
+Must:
+  eina
+  libc
+
+WARNING: gcc compatibility!!!
+There seems to be some bug (or disagreement) between embryo and gcc 3.2.x
+where IEEE floating point format encoding does not "agree" with embryo's own
+hand-made tests. embryo_cc may not work if you compile using gcc 3.2.x. gcc
+3.3.x is known to work fine. we are not 100% sure whose fault this is yet, so
+we won't be jumping up and down, but be warned - gcc 3.2.x does not agree
+with embryo.
+
+To view the API docs, run ./gendoc and view doc/html/index.html.
+
+OK a lot of people ask this. What is Embryo?
+
+Embryo is primarily a shared library that gives you an API to load and control
+interpreted programs compiled into an abstract machine bytecode that it
+understands.  This abstract (or virtual) machine is similar to a real machine
+with a CPU, but it is emulated in software.  The architecture is simple and is
+the same as the abstract machine (AMX) in the 
+<a href=http://www.compuphase.com/pawn>PAWN</a> language (formerly called
+SMALL) as it is based on exactly the same code. Embryo has modified the code
+for the AMX extensively and has made it smaller and more portable.  It is VERY
+small.  The total size of the virtual machine code AND header files is less
+than 2500 lines of code.  It includes the floating point library support by
+default as well.  This makes it one of the smallest interpreters around, and
+thus makes is very efficient to use in code.
+
+Embryo also uses the PAWN compiler from the same code base. This code has
+barely been touched and so suffers from lots of portability issues. It has
+been partially fixed and now works on both big and little endian but the code
+still need to be gone over and really cleaned up . It does work, but it's only
+just working.  It has been called embryo_cc and compiled a subset of PAWN
+binary outputs.  It does not support packed strings, variable alignment, or
+debugging output.  It does not support many features of the full PAWN
+compiler because the Embryo AMX does not support these either. You will find
+the Embryo codebase to work much better on Linux (and BSD and MacOS X) and
+other UNIX operating systems as it has been developed and tested on them. IT
+is known to work on:
+  gcc Linux   (x86-32)
+  gcc Linux   (PPC)
+  gcc MacOS X (PPC)
+
+And will likely work on more combinations. IT currently has problems on 64bit
+SPARC CPUs. Other 64bit systems are untested. It is the aim to fix the code
+so it works on all commonly used architectures (32, 64bit, big and little
+endian, alignment forgiving/unforgiving).  So far 64bit support is the major
+issue.
+
+For more documentation please see the Language guide here:
+
+<a href=http://www.compuphase.com/pawn>Pawn Language Booklet</a>
+  
+This documents the PAWN language and is 100% relevant for Embryo and the
+syntax of files it can compile (.sma files).
+
+Any help is appreciated in helping clean and port this code, so feel free to
+send patches to the Enlightenment development lists.
+
+The main aim of Embryo is to provide an easy to use library for running
+compiled PAWN programs and giving them access to the calling program and
+any API it exports to the PAWN script.  PAWN programs/scripts are completely
+sand-boxed. They cannot access any system or function calls other than the
+ones provided by the calling application to the Embryo API. This means a
+PAWN script cannot open or write to, delete or load files. It is fairly
+harmless and this also keeps Embryo small.
+
+This is a work in progress, so please be patient if things don't work for you
+- and patches and help in fixing it is very much appreciated.
+
+------------------------------------------------------------------------------
+COMPILING AND INSTALLING:
+
+  ./configure
+  make
+(as root unless you are installing in your users directories):
+  make install
index 0846992..72e1033 100755 (executable)
@@ -3,14 +3,36 @@
 rm -rf autom4te.cache
 rm -f aclocal.m4 ltmain.sh
 
 rm -rf autom4te.cache
 rm -f aclocal.m4 ltmain.sh
 
-touch README
+touch ABOUT-NLS
 
 
-echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
+echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
 echo "Running autoheader..." ; autoheader || exit 1
 echo "Running autoconf..." ; autoconf || exit 1
 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
 
 echo "Running autoheader..." ; autoheader || exit 1
 echo "Running autoconf..." ; autoconf || exit 1
 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
 
+W=0
+
+rm -f config.cache-env.tmp
+echo "OLD_PARM=\"$@\"" >> config.cache-env.tmp
+echo "OLD_CFLAGS=\"$CFLAGS\"" >> config.cache-env.tmp
+echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp
+echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp
+echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp
+
+cmp config.cache-env.tmp config.cache-env >> /dev/null
+if [ $? -ne 0 ]; then
+       W=1;
+fi
+
+if [ $W -ne 0 ]; then
+       echo "Cleaning configure cache...";
+       rm -f config.cache config.cache-env
+       mv config.cache-env.tmp config.cache-env
+else
+       rm -f config.cache-env.tmp
+fi
+
 if [ -z "$NOCONFIGURE" ]; then
 if [ -z "$NOCONFIGURE" ]; then
-       ./configure "$@"
+       ./configure -C "$@"
 fi
 fi
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..a918f3e
--- /dev/null
@@ -0,0 +1,222 @@
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+m4_define([v_maj], [1])
+m4_define([v_min], [7])
+m4_define([v_mic], [99])
+m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || 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])
+##--   When doing snapshots - change soname. remove dnl on below line
+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_define([lt_cur], m4_eval(v_maj + v_min))
+m4_define([lt_rev], v_mic)
+m4_define([lt_age], v_min)
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+
+AC_INIT([embryo], [v_ver], [enlightenment-devel@lists.sourceforge.net])
+AC_PREREQ([2.52])
+AC_CONFIG_SRCDIR([configure.ac])
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_CONFIG_HEADERS([config.h])
+AH_TOP([
+#ifndef EFL_CONFIG_H__
+#define EFL_CONFIG_H__
+])
+AH_BOTTOM([
+#endif /* EFL_CONFIG_H__ */
+])
+
+AM_INIT_AUTOMAKE([1.6 dist-bzip2])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_LIBTOOL_WIN32_DLL
+define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
+define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
+AC_PROG_LIBTOOL
+
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
+m4_ifdef([v_rel], , [m4_define([v_rel], [])])
+AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
+AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
+AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
+AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
+version_info="lt_cur:lt_rev:lt_age"
+release_info="v_rel"
+AC_SUBST(version_info)
+AC_SUBST(release_info)
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
+VMAJ=v_maj
+AC_SUBST(VMAJ)
+
+### Default options with respect to host
+
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+requirement_embryo=""
+embryoincludedir="${datadir}/include"
+
+
+### Additional options to configure
+
+EFL_ENABLE_BIN([embryo-cc])
+
+
+### Checks for programs
+AC_PROG_CC
+
+# doxygen program for documentation building
+
+EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
+
+# pkg-config
+
+PKG_PROG_PKG_CONFIG
+
+# Check whether pkg-config supports Requires.private
+if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
+   pkgconfig_requires_private="Requires.private"
+else
+   pkgconfig_requires_private="Requires"
+fi
+AC_SUBST(pkgconfig_requires_private)
+
+
+### Checks for libraries
+
+# Evil library for compilation on Windows
+
+EFL_EMBRYO_BUILD=""
+case "$host_os" in
+   mingw*)
+   PKG_CHECK_MODULES([EVIL], [evil >= 1.6.99])
+   AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
+   requirement_embryo="evil ${requirement_embryo}"
+   EFL_EMBRYO_BUILD="-DEFL_EMBRYO_BUILD"
+   ;;
+esac
+AC_SUBST(EFL_EMBRYO_BUILD)
+
+# For embryo_cc_prefix.c
+PKG_CHECK_MODULES([EINA], [eina >= 1.6.99])
+
+### Checks for portability layer
+
+PKG_CHECK_MODULES([EXOTIC],
+   [exotic],
+   [enable_exotic="yes"],
+   [enable_exotic="no"])
+
+if test "x${enable_exotic}" = "xyes"; then
+    requirement_embryo="exotic ${requirement_embryo}"
+
+    AC_DEFINE([HAVE_EXOTIC], [1], [Define to 1 if you have Exotic.])
+fi
+
+### Checks for header files
+
+AC_CHECK_HEADERS([unistd.h])
+EFL_CHECK_PATH_MAX
+
+
+### Checks for types
+
+
+### Checks for structures
+
+
+### Checks for compiler characteristics
+AC_C_BIGENDIAN
+AM_PROG_CC_C_O
+AC_C_CONST
+AC_C_INLINE
+AC_PROG_CC_STDC
+AC_HEADER_STDC
+AC_C___ATTRIBUTE__
+
+EMBRYO_CPPFLAGS=""
+EMBRYO_CFLAGS=""
+case "$host_os" in
+   mingw32ce*)
+      EMBRYO_CPPFLAGS="-D_WIN32_WCE=0x0420"
+      ;;
+esac
+AC_SUBST(EMBRYO_CPPFLAGS)
+AC_SUBST(EMBRYO_CFLAGS)
+
+
+### Checks for linker characteristics
+
+lt_enable_auto_import=""
+case "$host_os" in
+   mingw*)
+      lt_enable_auto_import="-Wl,--enable-auto-import"
+      ;;
+esac
+AC_SUBST(lt_enable_auto_import)
+
+
+### Checks for library functions
+
+AC_ISC_POSIX
+
+# alloca
+AC_FUNC_ALLOCA
+
+# fnmatch
+EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
+
+# gettimeofday
+EFL_CHECK_GETTIMEOFDAY([], [AC_MSG_ERROR([Cannot find gettimeofday()])])
+
+
+AC_SUBST(requirement_embryo)
+AC_SUBST(embryoincludedir)
+
+AC_OUTPUT([
+Makefile
+doc/Makefile
+doc/Doxyfile
+doc/embryo.dox
+embryo.pc
+include/Makefile
+src/Makefile
+src/lib/Makefile
+src/bin/Makefile
+embryo.spec
+])
+
+
+#####################################################################
+## Info
+
+echo
+echo
+echo
+echo "------------------------------------------------------------------------"
+echo "$PACKAGE $VERSION"
+echo "------------------------------------------------------------------------"
+echo
+echo "Configuration Options Summary:"
+echo
+echo "  Build embryo_cc......: $have_embryo_cc"
+echo
+echo "  Documentation........: ${build_doc}"
+echo
+echo "Compilation............: make (or gmake)"
+echo "  CPPFLAGS.............: $CPPFLAGS"
+echo "  CFLAGS...............: $CFLAGS"
+echo "  LDFLAGS..............: $LDFLAGS"
+echo
+echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
+echo "  prefix...............: $prefix"
+echo
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..b59df57
--- /dev/null
@@ -0,0 +1,420 @@
+embryo (1.2.0+svn.70375slp2+build02) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.2.0+svn.70375slp2+build02
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Wed, 25 Apr 2012 17:28:40 +0900
+
+embryo (1.2.0+svn.70375slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.2.0+svn.70375slp2+build01
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Wed, 25 Apr 2012 15:14:02 +0900
+
+embryo (1.2.0+svn.70344slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.2.0+svn.70344slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Mon, 23 Apr 2012 15:29:05 +0900
+
+embryo (1.2.0+svn.70204slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.2.0+svn.70204slp2+build01
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 18 Apr 2012 18:08:02 +0900
+
+embryo (1.2.0+svn.69899slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.2.0+svn.69899slp2+build01
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Fri, 06 Apr 2012 18:17:05 +0900
+
+embryo (1.1.0+svn.69490slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.69490slp2+build01
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Wed, 28 Mar 2012 14:29:30 +0900
+
+embryo (1.1.0+svn.68928slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.68928slp2+build01
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Sat, 10 Mar 2012 13:51:25 +0900
+
+embryo (1.1.0+svn.68718slp2+build02) unstable; urgency=low
+
+  * 68928
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.68718slp2+build02
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Sat, 10 Mar 2012 13:21:01 +0900
+
+embryo (1.1.0+svn.68718slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.68718slp2+build01
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Wed, 07 Mar 2012 16:44:53 +0900
+
+embryo (1.1.0+svn.68421slp2+build01) unstable; urgency=low
+
+  * Package upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.68421slp2+build01
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Fri, 02 Mar 2012 06:32:43 -0500
+
+embryo (1.1.0+svn.67705slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.67705slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Wed, 15 Feb 2012 19:01:34 +0900
+
+embryo (1.1.0+svn.66150slp2+build01) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.66150slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Mon, 16 Jan 2012 18:36:25 +0900
+
+embryo (1.1.0+svn.65860slp2+build01) unstable; urgency=low
+
+  * Package Upload for migration
+  * Git: slp-scm.sec.samsung.net:slp/pkgs/e/embryo
+  * Tag: embryo_1.1.0+svn.65860slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Thu, 08 Dec 2011 13:52:17 +0900
+
+embryo (1.1.0+svn.65304slp2+build01) unstable; urgency=low
+
+  * Merge with upstream @65304
+
+ -- Mike McCormack <mj.mccormack@samsung.com>  Thu, 17 Nov 2011 09:10:41 +0900
+
+embryo (1.0.0.001+svn.64802slp2+build01) unstable; urgency=low
+
+  * Merge with upstream @64802
+
+ -- Mike McCormack <mj.mccormack@samsung.com>  Thu, 10 Nov 2011 14:10:35 +0900
+
+embryo (1.0.0.001+svn.63811slp2+build01) unstable; urgency=low
+
+  * Merge with upstream
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.63811slp2+build01
+
+ -- Mike McCormack <mj.mccormack@samsung.com>  Wed, 05 Oct 2011 16:45:36 +0900
+
+embryo (1.0.0.001+svn.62382slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r62382
+  * Important Changes
+       [Migration upstream r62382]
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.62382slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Fri, 02 Sep 2011 18:43:44 +0900
+
+embryo (1.0.0.001+svn.60294slp2+build02) unstable; urgency=low
+
+  * Package Upload
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.60294slp2+build02
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Fri, 24 Jun 2011 19:33:14 +0900
+
+embryo (1.0.0.001+svn.60294slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r60294
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.60294slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Fri, 24 Jun 2011 18:10:13 +0900
+
+embryo (1.0.0.001+svn.58120slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r58120
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.58120slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Tue, 05 Apr 2011 15:55:13 +0900
+
+embryo (1.0.0.001+svn.57246slp2+build06) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r57246
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.57246slp2+build06
+
+ -- Shinwoo Kim <cinoo.kim@samsung.com>  Tue, 29 Mar 2011 18:55:38 +0900
+
+embryo (1.0.0.001+svn.57246slp2+build05) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r57246
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.57246slp2+build05
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Wed, 09 Mar 2011 11:29:49 +0900
+
+embryo (1.0.0.001+svn.57246slp2+build04) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r57246
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.57246slp2+build04
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Wed, 09 Mar 2011 11:15:04 +0900
+
+embryo (1.0.0.001+svn.57246slp2+build03) unstable; urgency=low
+
+  * Package Uplaod : Rollback
+  * Git: 165.213.180.234:/slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.57246slp2+build03
+
+ -- WooHyun Jung <wh0705.jung@samsung.com>  Tue, 08 Mar 2011 12:41:39 +0900
+
+embryo (1.0.0.001+svn.57246slp2+build02) unstable; urgency=low
+
+  * Package Upload : rollback
+  * Git: 165.213.180.234:/slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.57246slp2+build02
+
+ -- WooHyun Jung <wh0705.jung@samsung.com>  Tue, 08 Mar 2011 11:11:56 +0900
+
+embryo (1.0.0.001+svn.57246slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r57246
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.57246slp2+build01
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Mon, 07 Mar 2011 17:28:18 +0900
+
+embryo (1.0.0.001+svn.56205slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r56205
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.56205slp2+build01
+
+ -- WooHyun Jung <wh0705.jung@samsung.com>  Thu, 27 Jan 2011 12:22:41 +0900
+
+embryo (1.0.0.001+svn.55945slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r55945
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.55945slp2+build01
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.55945slp2+build01
+
+ -- WooHyun Jung <wh0705.jung@samsung.com>  Wed, 19 Jan 2011 16:18:16 +0900
+
+embryo (1.0.0.001+svn.55682slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r55682
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.55682slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Mon, 03 Jan 2011 21:20:27 +0900
+
+embryo (1.0.0.001+svn.55489slp2+build01) unstable; urgency=low
+
+  * [SVN EFL Migration] embryo in SLP is merged with SVN r55489
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.55489slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Wed, 22 Dec 2010 20:04:36 +0900
+
+embryo (1.0.0.001+svn.55238slp2+build01) unstable; urgency=low
+
+  * [SVN's EFL Migration] embryo in SLP is merged with SVN r55238.
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.55238slp2+build01
+
+ -- Juyung Seo <juyung.seo@samsung.com>  Tue, 14 Dec 2010 17:51:21 +0900
+
+embryo (1.0.0.001+svn.51480slp2+build04) unstable; urgency=low
+
+  * [SVN's EFL Migration] embryo in SLP is merged with SVN r55238.
+  * Git: 165.213.180.234:slp/pkgs/e/embryo
+  * Tag: embryo_1.0.0.001+svn.51480slp2+build04
+
+ -- Juyung Seo <juyung.seo@samsung.com>  Tue, 14 Dec 2010 14:58:09 +0900
+
+embryo (1.0.0.001+svn.51480slp2+build03) unstable; urgency=low
+
+  * [SVN 54507 Merge]
+  * Update to SVN Revision 54507.
+  * Git: 165.213.180.234:/git/slp/pkgs/embryo
+  * Tag: embryo_1.0.0.001+svn.51480slp2+build03
+
+ -- Juyung Seo <juyung.seo@samsung.com>  Fri, 26 Nov 2010 15:39:26 +0900
+
+embryo (1.0.0.001+svn.51480slp2+build02) unstable; urgency=low
+
+  * add as-needed
+  * Git: 165.213.180.234:/git/slp/pkgs/embryo
+  * Tag: embryo_1.0.0.001+svn.51480slp2+build02
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Wed, 15 Sep 2010 10:51:24 +0900
+
+embryo (1.0.0.001+svn.51480slp2+build01) unstable; urgency=low
+
+  * efl 1.0 alpha upgrade
+  * Git: 165.213.180.234:/git/slp/pkgs/embryo
+  * Tag: embryo_1.0.0.001+svn.51480slp2+build01
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Tue, 31 Aug 2010 22:47:22 +0900
+
+embryo (0.9.9.060+svn.49540slp2+3build04) unstable; urgency=low
+
+  * Packaging.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo
+  * Tag: embryo_0.9.9.060+svn.49540slp2+3build04
+
+ -- Daniel Juyung Seo <juyung.seo@samsung.com>  Thu, 10 Jun 2010 21:09:44 +0900
+
+embryo (0.9.9.060+svn.49540slp2+3build03) unstable; urgency=low
+
+  * Packaging.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo
+  * Tag: embryo_0.9.9.060+svn.49540slp2+3build03
+
+ -- Daniel Juyung Seo <juyung.seo@samsung.com>  Thu, 10 Jun 2010 21:04:28 +0900
+
+embryo (0.9.9.060+svn.49540slp2+3build02) unstable; urgency=low
+
+  * Packaging.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo
+  * Tag: embryo_0.9.9.060+svn.49540slp2+3build02
+
+ -- Daniel Juyung Seo <juyung.seo@samsung.com>  목, 10  6월 2010 21:00:52 +0900
+
+embryo (0.9.9.060+svn.49540slp2+3) unstable; urgency=low
+
+  * Packaging.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo
+  * Tag: embryo_0.9.9.060+svn.49540slp2+3
+
+ -- Daniel Juyung Seo <juyung.seo@samsung.com>  Thu, 10 Jun 2010 20:46:54 +0900
+
+embryo (0.9.9.060+svn.49540slp2+2) unstable; urgency=low
+
+  * Packaging.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo
+  * Tag: embryo_0.9.9.060+svn.49540slp2+2
+
+ -- Daniel Juyung Seo <juyung.seo@samsung.net>  Thu, 10 Jun 2010 20:46:08 +0900
+
+embryo (0.9.9.060+svn.49540slp2+1) unstable; urgency=low
+
+  * Packaging.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/EFL-pkgs/embryo
+  * Tag: embryo_0.9.9.060+svn.49540slp2+1
+
+ -- Daniel Juyung Seo <juyung.seo@samsung.net>  Thu, 10 Jun 2010 20:22:44 +0900
+
+embryo (0.9.9.060+svn.49540slp2+0) unstable; urgency=low
+
+  * Update opensource EFL from SVN
+  * SVN revision: 49540 (Total EFL revision: 49550)
+  * Tag: 0.9.9.060+svn.49540slp2+0
+
+ -- Daniel Juyung Seo <juyung.seo@smasung.net>  Thu, 10 Jun 2010 15:50:43 +0900
+
+embryo (0.9.9.060+svn20100304slp2) unstable; urgency=low
+
+  * change package version
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Thu, 25 Mar 2010 16:03:48 +0900
+
+embryo (0.9.9.060+svn20100304-1) unstable; urgency=low
+
+  * EFL_update_revision_46864
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Wed, 10 Mar 2010 16:06:36 +0900
+
+embryo (0.9.9.060+svn20100203-2) unstable; urgency=low
+
+  * repack
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Thu, 04 Feb 2010 20:29:08 +0900
+
+embryo (0.9.9.060+svn20100203-1) unstable; urgency=low
+
+  * EFL_update_revision_45828
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Wed, 03 Feb 2010 16:39:22 +0900
+
+embryo (0.9.9.060+svn20100119-1) unstable; urgency=low
+
+  * EFL_update_revision_45322
+
+ -- Jihoon Kim <jihoon48.kim@samsung.com>  Tue, 19 Jan 2010 20:44:48 +0900
+
+embryo (0.9.9.060+svn20100111-3) unstable; urgency=low
+
+  * reupload EFL i686
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Tue, 12 Jan 2010 17:35:36 +0900
+
+embryo (0.9.9.060+svn20100111-2) unstable; urgency=low
+
+  * reupload EFL
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Mon, 11 Jan 2010 22:16:57 +0900
+
+embryo (0.9.9.060+svn20100111-1) unstable; urgency=low
+
+  * update EFL revision
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Mon, 11 Jan 2010 13:28:05 +0900
+
+embryo (0.9.9.060+svn20091229-1) unstable; urgency=low
+
+  * update EFL
+
+ -- Jaehwan Kim <jae.hwan.kim@samsung.com>  Tue, 29 Dec 2009 14:27:04 +0900
+
+embryo (0.9.9.060+svn20091112-3) unstable; urgency=low
+
+  * change arch to any
+
+ -- youmin ha <youmin.ha@samsung.com>  Fri, 27 Nov 2009 16:31:01 +0900
+
+embryo (0.9.9.060+svn20091112-2) unstable; urgency=low
+
+  * svn stable version
+
+ -- Sangho Park <sangho.g.park@samsung.com>  Thu, 19 Nov 2009 19:01:51 +0900
+
+embryo (0.9.9.060+svn20091112-1) unstable; urgency=low
+
+  * Clean up changelog
+
+ -- Sangho Park <sangho.g.park@samsung.com>  Fri, 13 Nov 2009 08:56:08 +0900
+
+embryo (0.9.9.060+svnYYYYMMDD-1) unstable; urgency=low
+
+  * Clean up changelog
+
+ -- quaker <quaker66@gmail.com>  Thu, 22 Apr 2009 19:26:08 +0100
+
+embryo (0.9.9.050+svnYYYYMMDD-1) unstable; urgency=low
+
+  * Clean up changelog
+
+ -- quaker <quaker66@gmail.com>  Tue, 21 Apr 2009 19:15:09 +0100
index 1e8b314..7ed6ff8 100644 (file)
@@ -1 +1 @@
-6
+5
index 6ab8585..06cad25 100644 (file)
@@ -1,16 +1,16 @@
 Source: embryo
 Section: libs
 Priority: optional
 Source: embryo
 Section: libs
 Priority: optional
-Maintainer: Falko Schmidt <falko@alphagemini.org>
-Build-Depends: debhelper (>= 6), cdbs, doxygen
-Standards-Version: 3.7.3
+Maintainer: Jaehwan Kim <jae.hwan.kim@samsung.com>, Juyung Seo <juyung.seo@samsung.com>, Mike McCormack <mj.mccormack@samsung.com>, Jeonghyun Yun <jh0506.yun@samsung.com>, Hyoyoung Chang <hyoyoung.chang@samsung.com>
+Build-Depends: dpkg-dev , debhelper (>= 6), cdbs, doxygen, pkg-config, libtool, libeina-dev
+Standards-Version: 3.8.1
 Homepage: http://www.enlightenment.org
 
 Package: libembryo-dev
 Section: libdevel
 Architecture: any
 Homepage: http://www.enlightenment.org
 
 Package: libembryo-dev
 Section: libdevel
 Architecture: any
-Depends: libembryo0 (= ${Source-Version}), pkg-config
-Description: Development files for libembryo
+Depends: ${misc:Depends}, libembryo0 (= ${binary:Version}), pkg-config
+Description: Development files for libembryo0
  Embryo is primarily a shared library that gives you an API to load
  and control interpreted programs compiled into an abstract machine
  bytecode that it understands.  This abstract (or virtual) machine is
  Embryo is primarily a shared library that gives you an API to load
  and control interpreted programs compiled into an abstract machine
  bytecode that it understands.  This abstract (or virtual) machine is
@@ -21,8 +21,7 @@ Description: Development files for libembryo
 
 Package: libembryo0
 Architecture: any
 
 Package: libembryo0
 Architecture: any
-Provides: libembryo
-Depends: ${shlibs:Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends}
 Suggests: libembryo-bin
 Description: SMALL-based abstract machine (AMX) bytecode interpreter
  Embryo is primarily a shared library that gives you an API to load
 Suggests: libembryo-bin
 Description: SMALL-based abstract machine (AMX) bytecode interpreter
  Embryo is primarily a shared library that gives you an API to load
@@ -43,7 +42,8 @@ Description: SMALL-based abstract machine (AMX) bytecode interpreter
 
 Package: libembryo-doc
 Section: doc
 
 Package: libembryo-doc
 Section: doc
-Architecture: all
+Architecture: any
+Depends: ${misc:Depends}
 Enhances: libembryo-dev
 Description: libembryo0 development documentation
  Embryo is primarily a shared library that gives you an API to load
 Enhances: libembryo-dev
 Description: libembryo0 development documentation
  Embryo is primarily a shared library that gives you an API to load
@@ -57,9 +57,9 @@ Description: libembryo0 development documentation
 Package: libembryo-dbg
 Architecture: any
 Section: libdevel
 Package: libembryo-dbg
 Architecture: any
 Section: libdevel
-Depends: libembryo0 (= ${binary:Version})
+Depends: ${misc:Depends}, libembryo0 (= ${binary:Version})
 Priority: extra
 Priority: extra
-Description: SMALL-based abstract machine (AMX) bytecode interpreter
+Description: Debugging symbols for libembryo
  Embryo is primarily a shared library that gives you an API to load
  and control interpreted programs compiled into an abstract machine
  bytecode that it understands.  This abstract (or virtual) machine is
  Embryo is primarily a shared library that gives you an API to load
  and control interpreted programs compiled into an abstract machine
  bytecode that it understands.  This abstract (or virtual) machine is
@@ -74,7 +74,7 @@ Description: SMALL-based abstract machine (AMX) bytecode interpreter
 Package: libembryo-bin
 Section: devel
 Architecture: any
 Package: libembryo-bin
 Section: devel
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${misc:Depends}, ${shlibs:Depends}
 Description: SMALL compiler creating Embryo bytecode
  Embryo is primarily a shared library that gives you an API to load
  and control interpreted programs compiled into an abstract machine
 Description: SMALL compiler creating Embryo bytecode
  Embryo is primarily a shared library that gives you an API to load
  and control interpreted programs compiled into an abstract machine
index 62a8856..cee0fb6 100644 (file)
@@ -1,18 +1,46 @@
-This package was debianized by Falko Schmidt <falko@alphagemini.org> on
-Fri,  4 Apr 2008 15:43:15 +0000.
+This package was debianized by Victor Koeppel <v_koeppel@yahoo.fr> on
+Wed, 24 Mar 2004 15:44:55 +0100.
 
 
-The source is from the e17/libs/embryo module of the enlightenment CVS
-tree. For more information, see:
+It was downloaded from http://download.enlightenment.org/
 
 
- http://www.enlightenment.org
-
-Upstream Author:
-       
-       Carsten Haitzler <raster@rasterman.com>
+Upstream Author: Carsten Haitzler <raster@rasterman.com>
 
 Copyright:
 
 
 Copyright:
 
-       Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS)
+  Copyright (C) 2000 Carsten Haitzler and various contributors (see AUTHORS)
+
+Additional copyrights:
+  src/bin: embryo_cc_amx.h, embryo_cc_osdefs.h, embryo_cc_scvars.c,
+  embryo_cc_sc[1-7].c, embryo_cc_scvars.c: Copyright ITB CompuPhase, 1997-2003
+
+  src/bin/embryo_cc_sc{5,7}.scp: Copyright (c) ITB CompuPhase, 2000-2003
+  src/bin/embryo_cc_sclist.c: Copyright (c) ITB CompuPhase, 2001-2003
+  src/bin/embryo_cc_scexpand.c: Copyright 1996 Philip Gage
+  src/bin/embryo_cc_sc.h: Copyright R. Cain, 1980, J.E. Hendrix, 1982, 1983,
+                          T. Riemersma, 1997-2003
+
+  src/lib/embryo_amx.c: Copyright (c) ITB CompuPhase, 1997-2003
+                        Portions Copyright (c) Carsten Haitzler, 2004
+  src/lib/embryo_float.c: Copyright (c) Artran, Inc. 1999
+                          Portions Copyright (c) Carsten Haitzler, 2004
+
+  These files are all licensed under the zLib license:
+    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.
+
 License:
 
   Permission is hereby granted, free of charge, to any person obtaining a copy
 License:
 
   Permission is hereby granted, free of charge, to any person obtaining a copy
index 33c14b5..5f9e41c 100644 (file)
@@ -1,4 +1,4 @@
 debian/tmp/usr/include/*
 debian/tmp/usr/include/*
+debian/tmp/usr/lib/pkgconfig/*
 debian/tmp/usr/lib/lib*.a
 debian/tmp/usr/lib/lib*.so
 debian/tmp/usr/lib/lib*.a
 debian/tmp/usr/lib/lib*.so
-debian/tmp/usr/lib/pkgconfig/*
diff --git a/debian/libembryo0.symbols b/debian/libembryo0.symbols
new file mode 100644 (file)
index 0000000..eb4c0f5
--- /dev/null
@@ -0,0 +1,36 @@
+libembryo.so.0 libembryo0 #MINVER#
+ embryo_data_address_get@Base 0.9.1.042
+ embryo_data_heap_pop@Base 0.9.1.042
+ embryo_data_heap_push@Base 0.9.1.042
+ embryo_data_string_get@Base 0.9.1.042
+ embryo_data_string_length_get@Base 0.9.1.042
+ embryo_data_string_set@Base 0.9.1.042
+ embryo_error_string_get@Base 0.9.1.042
+ embryo_init@Base 0.9.1.042
+ embryo_parameter_cell_array_push@Base 0.9.1.042
+ embryo_parameter_cell_push@Base 0.9.1.042
+ embryo_parameter_string_push@Base 0.9.1.042
+ embryo_program_const_new@Base 0.9.1.042
+ embryo_program_data_get@Base 0.9.1.042
+ embryo_program_data_set@Base 0.9.1.042
+ embryo_program_error_get@Base 0.9.1.042
+ embryo_program_error_set@Base 0.9.1.042
+ embryo_program_free@Base 0.9.1.042
+ embryo_program_function_find@Base 0.9.1.042
+ embryo_program_load@Base 0.9.1.042
+ embryo_program_max_cycle_run_get@Base 0.9.1.042
+ embryo_program_max_cycle_run_set@Base 0.9.1.042
+ embryo_program_native_call_add@Base 0.9.1.042
+ embryo_program_new@Base 0.9.1.042
+ embryo_program_recursion_get@Base 0.9.1.042
+ embryo_program_return_value_get@Base 0.9.1.042
+ embryo_program_run@Base 0.9.1.042
+ embryo_program_variable_count_get@Base 0.9.1.042
+ embryo_program_variable_find@Base 0.9.1.042
+ embryo_program_variable_get@Base 0.9.1.042
+ embryo_program_vm_pop@Base 0.9.1.042
+ embryo_program_vm_push@Base 0.9.1.042
+ embryo_program_vm_reset@Base 0.9.1.042
+ embryo_shutdown@Base 0.9.1.042
+ embryo_swap_16@Base 0.9.1.042
+ embryo_swap_32@Base 0.9.1.042
old mode 100644 (file)
new mode 100755 (executable)
index 7cfecc0..ee17a73
@@ -4,19 +4,23 @@ include /usr/share/cdbs/1/class/autotools.mk
 include /usr/share/cdbs/1/rules/debhelper.mk
 
 DEB_DH_STRIP_ARGS := --dbg-package=libembryo-dbg
 include /usr/share/cdbs/1/rules/debhelper.mk
 
 DEB_DH_STRIP_ARGS := --dbg-package=libembryo-dbg
-DEB_CONFIGURE_EXTRA_FLAGS := --disable-rpath
-DEB_MAKE_CLEAN_TARGET := clean
+DEB_CONFIGURE_EXTRA_FLAGS :=
+DEB_CONFIGURE_SCRIPT := ./autogen.sh
+DEB_MAKE_CLEAN_TARGET := distclean
+#DEB_SOURCE_VERSION := $(shell grep AC_INIT $(DEB_SRCDIR)/configure.ac | cut -d, -f2 | tr -d ' []')
+DEB_SOURCE_VERSION := 0.9.9.0
+CFLAGS += -fvisibility=hidden -fPIC
+LDFLAGS += -fvisibility=hidden -Wl,--hash-style=both -Wl,--as-needed
 
 
-build/libembryo-doc::
-       cd $(DEB_SRCDIR) && doxygen
+#build/libembryo-doc::
+#      cd $(DEB_SRCDIR)/doc && make doc
 
 
-install/libembryo-doc::
-       cp -R $(DEB_SRCDIR)/doc/html debian/libembryo-doc/usr/share/doc/libembryo-doc/
-       rm $(DEB_SRCDIR)/doc/man/man3/todo.3
+#install/libembryo-doc::
+#      tar jxf embryo-*-doc.tar.bz2 -C $(DEB_SRCDIR)
+#      cp -R $(DEB_SRCDIR)/doc/html $(DEB_SRCDIR)/debian/libembryo-doc/usr/share/doc/libembryo-doc/
+#      cp -R $(DEB_SRCDIR)/embryo-$(DEB_SOURCE_VERSION)-doc/doc/html debian/libembryo-doc/usr/share/doc/libembryo-doc/
+#      rm -rf $(DEB_SRCDIR)/doc/
 
 clean::
 
 clean::
-       rm -rf $(DEB_SRCDIR)/doc/html $(DEB_SRCDIR)/doc/latex $(DEB_SRCDIR)/doc/man
-       mkdir -p $(DEB_SRCDIR)/doc/html
-       cp $(DEB_SRCDIR)/doc/img/*.png $(DEB_SRCDIR)/doc/html/
-       cp $(DEB_SRCDIR)/doc/img/*.gif $(DEB_SRCDIR)/doc/html/
-       ./autogen.sh --prefix=/usr $(DEB_CONFIGURE_EXTRA_FLAGS)
+       [ ! -f Makefile ] || make distclean
+       rm -f embryo-*.tar.* embryo-*.cdbs-config_list
diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in
new file mode 100644 (file)
index 0000000..5476347
--- /dev/null
@@ -0,0 +1,137 @@
+PROJECT_NAME           = Embryo
+PROJECT_NUMBER         =
+OUTPUT_DIRECTORY       = .
+INPUT                  = @srcdir@/embryo.dox @top_srcdir@/src/lib/
+IMAGE_PATH             = img
+OUTPUT_LANGUAGE        = English
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = @srcdir@/head.html
+HTML_FOOTER            = @srcdir@/foot.html
+HTML_STYLESHEET        = @srcdir@/e.css
+HTML_ALIGN_MEMBERS     = YES
+ENUM_VALUES_PER_LINE   = 1
+GENERATE_HTMLHELP      = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = YES
+EXTRACT_ALL            = NO
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+HIDE_UNDOC_MEMBERS     = YES
+HIDE_UNDOC_CLASSES     = YES
+HIDE_FRIEND_COMPOUNDS  = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+INTERNAL_DOCS          = NO
+STRIP_CODE_COMMENTS    = YES
+CASE_SENSE_NAMES       = YES
+SHORT_NAMES            = NO
+HIDE_SCOPE_NAMES       = NO
+VERBATIM_HEADERS       = NO
+SHOW_INCLUDE_FILES     = NO
+JAVADOC_AUTOBRIEF      = YES
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS           = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 2
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ALIASES                = 
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SHOW_USED_FILES        = NO
+QUIET                  = YES
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+FILE_PATTERNS          =
+RECURSIVE              = NO
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+INPUT_FILTER           = 
+FILTER_SOURCE_FILES    = NO
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+ALPHABETICAL_INDEX     = YES
+COLS_IN_ALPHA_INDEX    = 2
+IGNORE_PREFIX          = 
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+GENERATE_LATEX         = YES
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+GENERATE_MAN           = YES
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = YES
+GENERATE_XML           = NO
+XML_SCHEMA             = 
+XML_DTD                = 
+GENERATE_AUTOGEN_DEF   = NO
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = NO
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+CLASS_DIAGRAMS         = NO
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = NO
+COLLABORATION_GRAPH    = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = NO
+INCLUDED_BY_GRAPH      = NO
+GRAPHICAL_HIERARCHY    = NO
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+DOT_GRAPH_MAX_NODES    = 50
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+SEARCHENGINE           = NO
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..91c79f3
--- /dev/null
@@ -0,0 +1,33 @@
+
+MAINTAINERCLEANFILES = Makefile.in embryo.dox
+
+.PHONY: doc
+
+PACKAGE_DOCNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc
+
+if EFL_BUILD_DOC
+
+doc-clean:
+       rm -rf html/ latex/ man/ xml/ $(top_builddir)/$(PACKAGE_DOCNAME).tar*
+
+doc: all doc-clean
+       $(efl_doxygen)
+       cp $(srcdir)/img/* html/
+       rm -rf $(PACKAGE_DOCNAME).tar*
+       mkdir -p $(PACKAGE_DOCNAME)/doc
+       cp -R html/ latex/ man/ $(PACKAGE_DOCNAME)/doc
+       tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/
+       bzip2 -9 $(PACKAGE_DOCNAME).tar
+       rm -rf $(PACKAGE_DOCNAME)/
+       mv $(PACKAGE_DOCNAME).tar.bz2 $(top_builddir)
+
+clean-local: doc-clean
+
+else
+
+doc:
+       @echo "Documentation not built. Run ./configure --help"
+
+endif
+
+EXTRA_DIST = Doxyfile e.css foot.html head.html $(wildcard img/*.*) embryo.dox.in
index 604ee7f..07ebd1e 100644 (file)
--- a/doc/e.css
+++ b/doc/e.css
+/*
+    Author:
+        Andres Blanc <andresblanc@gmail.com>
+       DaveMDS Andreoli <dave@gurumeditation.it>
+
+    Supported Browsers:
+        ie7, opera9, konqueror4 and firefox3
+
+        Please use a different file for ie6, ie5, etc. hacks.
+*/
+
+
+/* Necessary to place the footer at the bottom of the page */
+html, body {
+       height: 100%;
+       margin: 0px;
+       padding: 0px;
+}
+
+#container {
+       min-height: 100%;
+       height: auto !important;
+       height: 100%;
+       margin: 0 auto -53px;
+}
+
+#footer, #push {
+       height: 53px;
+}
+
+
+* html #container {
+       height: 100%;
+}
+
+/* Prevent floating elements overflowing containers */
+.clear {
+       clear: both;
+       width: 0px;
+       height: 0px;
+}
+
+/* Flexible & centered layout from 750 to 960 pixels */
+.layout {
+       max-width: 960px;
+       min-width: 760px;
+       margin-left: auto;
+       margin-right: auto;
+}
+
 body {
 body {
-    background: url("b.png");
-    background-repeat: repeat-x;
-    background-position: top left;
-    background-color: #f4f4f4;
-    text-align: center;
-    font-family: sans-serif;
-    padding: 0;
-    margin: 0;
-}
-
-div.main {
-    margin: 1em auto;
-    vertical-align: top;
-    font-family: "Bitstream Vera", "Vera", "Trebuchet MS", Trebuchet, Tahoma, sans-serif;
-    color: #444444;
-    font-size: 0.8em;
-    text-align: justify;
-    width: 80%;
-}
-
-td.t { background-image:url("t.gif"); }
-td.t[class] { background-image:url("t.png"); }
-td.tl { background-image:url("tl.gif"); }
-td.tl[class] { background-image:url("tl.png"); }
-
-td.nav, td.lnav,  td.rnav {
-   align: middle;
-   text-align: center;
-   vertical-align: middle;
-   width: 100px;
-   height: 25px;
-   font-family: "Bitstream Vera", "Vera", "Trebuchet MS", Trebuchet, Tahoma, sans-serif;
-   color: #000000;
-   font-size: 9px;
-   font-weight: bold;
-   white-space: no-wrap;
-}  
-
-td.lnav[class] { background-image:url("n.png"); }
-td.lnav[class] { background-image:url("n.png"); }
-td.rnav { background-image:url("n.gif"); }
-td.rnav[class] { background-image:url("n.png"); }
-
-hr {
-    width: 200px;
-    height: 1px;
-    background: #dddddd;
-    border: 0;
-}
-
-p { color: #444444 ;}
-p.tiny, small {
-    color: #888888;
-    font-size: 0.5em;
-}
-
-h1 { 
-    text-align: center;
-    font-size: 1.3em; 
-}
-
-h2 { font-size: 1.1em; }
-h3 { font-size: 0.9em; }
-
-span.keyword { color: #008000; }
-span.keywordtype { color: #604020; }
-span.keywordflow { color: #e08000; }
-span.comment { color: #800000; }
-span.preprocessor { color: #806020; }
-span.stringliteral { color: #002080; }
-span.charliteral { color: #008080; }
-
-a:link {
-    color: #445566;
-    text-decoration: underline;
-}  
-   
-a:visited {
-    color: #667788;
-    text-decoration: underline;
-}  
-
-a:active {                
-    color: #88cccc;
-    text-decoration: none;
-}
-
-a:hover {
-    color: #112266;
-    text-decoration: underline;
-}  
-
-a.nav {
-    text-decoration: none;
-    display: block;
-}
-a.nav:link, a.nav:visited { color: #888888; }
-a.nav:active { color: #000000; }
-a.nav:hover { color: #444444; }
-a.code:link, a.code:visited { text-decoration: none; }
-
-div.fragment {
-    font-size: 1em;
-    border: 1px dotted #cccccc;
-    background-color: #ffffff;
-    text-align: left;
-    vertical-align: middle;
-    padding: 2px;
-    margin-left: 25px;
-    margin-right: 25px;
-    overflow: auto;
-}
-
-td.indexkey {
-    font-weight: bold;
-    padding-left: 10px;
-    padding-right: 0;
-    padding-top: 2px;
-    padding-bottom: 0px;
-    margin: 0;
-    margin-top: 2px;
-    margin-bottom: 2px;
-    border: 1px dotted #cccccc;
-    border-right: 0px dotted #cccccc;
-}
-
-td.indexvalue {
-    font-style: italic;
-    padding-right: 10px;
-    padding-left: 0;
-    padding-top: 2px;
-    padding-bottom: 2px;
-    margin: 0;
-    margin-top: 2px;
-    margin-bottom: 2px;
-    border: 1px dotted #cccccc;
-    border-left: 0px dotted #cccccc;
-}
-
-.mdescRight { font-style: italic; }
-.memitem {
-    padding-left: 2px;
-    padding-right: 2px;
-    border: 1px dotted #cccccc;
-    background-color: #ffffff;
-}
-.memname {
-    white-space: nowrap;
-    font-weight: bold;
-}
-.paramname { font-weight: normal; }
-
-div.ah {
-    border: thin solid #888888;
-    font-weight: bold;
-    margin-bottom: 3px;
-    margin-top: 3px;
+       /*font-family: Lucida Grande, Helvetica, sans-serif;*/
+       font-family: "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif
+}
+
+/* Prevent design overflowing the viewport in small resolutions */
+#container {
+       padding-right: 17px;
+       padding-left: 17px;
+       background-image: url(head_bg.png);
+       background-repeat: repeat-x;
+}
+
+#header {
+       width: 100%;
+       height: 102px;
+}
+
+#header h1 {
+       width: 63px;
+       height: 63px;
+       background-image: url(e.png);
+       background-repeat: no-repeat;
+       position: absolute;
+       margin: 0px;
+}
+
+#header h1 span {
+       display: none;
+}
+
+#header h2 {
+       display: none;
+}
+
+/* .menu-container is used to set properties common to .menu and .submenu */
+#header .menu-container {
+}
+
+#header .menu-container ul {
+       list-style-type: none;
+       list-style-position: inside;
+       margin: 0;
+}
+
+#header .menu-container li {
+       display: block;
+       float: right;
+}
+
+#header .menu {
+       height: 63px;
+       display: block;
+       background-image: url(menu_bg.png);
+       background-repeat: repeat-x;
+}
+
+#header .menu ul {
+       height: 100%;
+       display: block;
+       background-image: url(menu_bg_last.png);
+       background-repeat: no-repeat;
+       background-position: top right;
+       padding-right: 17px;
+}
+
+#header .menu li {
+       height: 100%;
+       text-align: center;
+       background-image: url(menu_bg_unsel.png);
+       background-repeat: no-repeat;
+}
+
+#header .menu a {
+       height: 100%;
+       display: block;
+       color: #cdcdcd;
+       text-decoration: none;
+       font-size: 10pt;
+       line-height: 59px;
+       text-align: center;
+       padding: 0px 15px 0px 15px;
+}
+
+#header .menu li:hover {
+       background-image: url(menu_bg_hover.png);
+       background-repeat: no-repeat;
+}
+
+#header .menu li:hover a {
+       color: #FFFFFF;
+}
+
+#header .menu li.current {
+       background-image: url(menu_bg_current.png);
+       background-repeat: no-repeat;
+}
+
+#header .menu li.current a {
+       color: #646464;
+}
+
+
+/* Hide all the submenus but the current */
+#header .submenu ul {
+       display: none;
+}
+
+#header .submenu .current {
+       display: block;
+}
+
+#header .submenu {
+       font: bold 10px verdana,'Bitstream Vera Sans',helvetica,arial,sans-serif;
+       margin-top: 10px;
+}
+
+#header .submenu a {
+       color: #888888;
+       text-decoration: none;
+       font-size: 0.9em;
+       line-height: 15px;
+       padding:0px 5px 0px 5px;
+}
+
+#header .submenu a:hover {
+       color: #444444;
+}
+
+#header .submenu li {
+       border-left: 1px solid #DDDDDD;
+}
+
+#header .submenu li:last-child {
+       border-left: 0;
+}
+
+#header .doxytitle {
+       position: absolute;
+       font-size: 1.8em;
+       font-weight: bold;
+       color: #444444;
+       line-height: 35px;
+}
+
+#header small {
+       font-size: 0.4em;
+}
+
+#footer {
+       background-image: url(foot_bg.png);
+       width: 100%;
+}
+
+#footer table {
+       width: 100%;
+       text-align: center;
+       white-space: nowrap;
+       padding: 5px 30px 5px 30px;
+       font-size: 0.8em;
+       font-family: "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif;
+       color: #888888;
+}
+
+#footer td.copyright {
+       width: 100%;
+}
+
+/*
+    Author:
+        Andres Blanc <andresblanc@gmail.com>
+       DaveMDS Andreoli <dave@gurumeditation.it>
+
+    Supported Browsers:
+        ie7, opera9, konqueror4 and firefox3
+
+        Please use a different file for ie6, ie5, etc. hacks.
+*/
+
+
+/* Necessary to place the footer at the bottom of the page */
+html, body {
+       height: 100%;
+       margin: 0px;
+       padding: 0px;
+}
+
+#container {
+       min-height: 100%;
+       height: auto !important;
+       height: 100%;
+       margin: 0 auto -53px;
+}
+
+#footer, #push {
+       height: 53px;
+}
+
+
+* html #container {
+       height: 100%;
+}
+
+/* Prevent floating elements overflowing containers */
+.clear {
+       clear: both;
+       width: 0px;
+       height: 0px;
+}
+
+/* Flexible & centered layout from 750 to 960 pixels */
+.layout {
+       max-width: 960px;
+       min-width: 760px;
+       margin-left: auto;
+       margin-right: auto;
+}
+
+body {
+       /*font-family: Lucida Grande, Helvetica, sans-serif;*/
+       font-family: "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif
+}
+
+/* Prevent design overflowing the viewport in small resolutions */
+#container {
+       padding-right: 17px;
+       padding-left: 17px;
+       background-image: url(head_bg.png);
+       background-repeat: repeat-x;
+}
+
+#header {
+       width: 100%;
+       height: 102px;
+}
+
+#header h1 {
+       width: 63px;
+       height: 63px;
+       background-image: url(e.png);
+       background-repeat: no-repeat;
+       position: absolute;
+       margin: 0px;
+}
+
+#header h1 span {
+       display: none;
+}
+
+#header h2 {
+       display: none;
+}
+
+/* .menu-container is used to set properties common to .menu and .submenu */
+#header .menu-container {
+}
+
+#header .menu-container ul {
+       list-style-type: none;
+       list-style-position: inside;
+       margin: 0;
+}
+
+#header .menu-container li {
+       display: block;
+       float: right;
+}
+
+#header .menu {
+       height: 63px;
+       display: block;
+       background-image: url(menu_bg.png);
+       background-repeat: repeat-x;
+}
+
+#header .menu ul {
+       height: 100%;
+       display: block;
+       background-image: url(menu_bg_last.png);
+       background-repeat: no-repeat;
+       background-position: top right;
+       padding-right: 17px;
+}
+
+#header .menu li {
+       height: 100%;
+       text-align: center;
+       background-image: url(menu_bg_unsel.png);
+       background-repeat: no-repeat;
+}
+
+#header .menu a {
+       height: 100%;
+       display: block;
+       color: #cdcdcd;
+       text-decoration: none;
+       font-size: 10pt;
+       line-height: 59px;
+       text-align: center;
+       padding: 0px 15px 0px 15px;
+}
+
+#header .menu li:hover {
+       background-image: url(menu_bg_hover.png);
+       background-repeat: no-repeat;
+}
+
+#header .menu li:hover a {
+       color: #FFFFFF;
+}
+
+#header .menu li.current {
+       background-image: url(menu_bg_current.png);
+       background-repeat: no-repeat;
+}
+
+#header .menu li.current a {
+       color: #646464;
+}
+
+
+/* Hide all the submenus but the current */
+#header .submenu ul {
+       display: none;
+}
+
+#header .submenu .current {
+       display: block;
+}
+
+#header .submenu {
+       font: bold 10px verdana,'Bitstream Vera Sans',helvetica,arial,sans-serif;
+       margin-top: 10px;
+}
+
+#header .submenu a {
+       color: #888888;
+       text-decoration: none;
+       font-size: 0.9em;
+       line-height: 15px;
+       padding:0px 5px 0px 5px;
+}
+
+#header .submenu a:hover {
+       color: #444444;
+}
+
+#header .submenu li {
+       border-left: 1px solid #DDDDDD;
+}
+
+#header .submenu li:last-child {
+       border-left: 0;
+}
+
+#header .doxytitle {
+       position: absolute;
+       font-size: 1.8em;
+       font-weight: bold;
+       color: #444444;
+       line-height: 35px;
+}
+
+#header small {
+       font-size: 0.4em;
+}
+
+#footer {
+       background-image: url(foot_bg.png);
+       width: 100%;
+}
+
+#footer table {
+       width: 100%;
+       text-align: center;
+       white-space: nowrap;
+       padding: 5px 30px 5px 30px;
+       font-size: 0.8em;
+       font-family: "Bitstream Vera","Vera","Trebuchet MS",Trebuchet,Tahoma,sans-serif;
+       color: #888888;
+}
+
+#footer td.copyright {
+       width: 100%;
 }
 
 }
 
diff --git a/doc/embryo.dox.in b/doc/embryo.dox.in
new file mode 100644 (file)
index 0000000..e69de29
index 0d3303d..78ef911 100644 (file)
@@ -1,6 +1,19 @@
+ <div id="push"></div>
+ </div> <!-- #content -->
+  </div> <!-- .layout -->
+ </div> <!-- #container -->
+  <div id="footer">
+    <table><tr>
+      <td class="poweredby"><img src="doxygen.png"></td>
+      <td class="copyright">Copyright &copy;$year Enlightenment</td>
+      <td class="generated">Docs generated $datetime</td>
+    </tr></table>
   </div>
   </div>
-  <hr />
-  <p class="tiny">Copyright &copy; Enlightenment.org</p>
-  <p class="tiny">$projectname Documentation Generated: $datetime</p>
- </body>
+
+
+</body>
 </html>
 </html>
index daaa652..48032d9 100644 (file)
@@ -1,44 +1,66 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
 <html>
 <html>
- <head>
-  <title>$title</title>
-  <link href="e.css" rel="stylesheet" type="text/css" />
- </head>
+<head>
+    <title>$title</title>
+    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
+    <meta name="author" content="Andres Blanc" >
+    
+    <link rel="icon" href="img/favicon.png" type="image/x-icon">
+    <link rel="shortcut icon" href="img/favicon.png" type="image/x-icon">
+    <link rel="icon" href="img/favicon.png" type="image/ico">
+    <link rel="shortcut icon" href="img/favicon.png" type="image/ico">
+
+    <link rel="stylesheet" type="text/css" media="screen" href="e.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="edoxy.css">
+</head>
 
 <body>
 
 <body>
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr>
-   <td class="t" width="50%" valign="top" align="left">
-     <table width="100px" height="100px" border="0" cellpadding="0" cellspacing="0">
-     <tr><td class="lnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=index">Home</a></td></tr>
-     <tr><td class="lnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=news">News</a></td></tr>
-     <tr><td class="lnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=about">About</a></td></tr>
-     <tr><td class="rnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=download">Download</a></td></tr>
-    </table>
-   </td>
-   <td class="tl" width="612" height="250" valign="bottom" align="center">
-    <img src="_.gif" width="612" height="1" />
-    <table border="0" cellpadding="0" cellspacing="4px">
-     <tr>
-      <td class='nav'><a class='nav' href="index.html">Main&nbsp;Page</a></td>
-      <td class='nav'><a class='nav' href="modules.html">Modules</a></td>
-      <td class='nav'><a class='nav' href="Embryo_8h.html">API Reference</a></td>
-      <td class="nav"><a class="nav" href="pages.html">Related Pages</a></td>
-     </tr>
-    </table>
-    <hr />
-   </td>
-   <td class="t" width="50%" valign="top" align="right">
-    <table width="100px" height="100px" border="0" cellpadding="0" cellspacing="0">
-     <tr><td class="rnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=support">Support</a></td></tr>
-     <tr><td class="lnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=contribute">Contribute</a></td></tr>
-     <tr><td class="lnav"><a class="nav" href="http://web.enlightenment.org/p.php?p=contact">Contact</a></td></tr>
-     <tr><td class="lnav"><a class="nav" href="http://trac.enlightenment.org/e">Tracker</a></td></tr>
-    </table>
-   </td>
-  </tr>
- </table>
-
- <div class="main">
+
+<div id="container">
+
+<div id="header">
+<div class="layout">
+    
+    <h1><span>Enlightenment</span></h1>
+    <h2><span>Beauty at your fingertips</span></h2>
+
+    <div class="menu-container">
+        <div class="menu">
+            <ul>
+               <li class="current"><a href="http://web.enlightenment.org/p.php?p=docs">Docs</a></li>
+                <li><a href="http://trac.enlightenment.org/e">Tracker</a></li>
+                <li><a href="http://www.enlightenment.org/p.php?p=contact">Contact</a></li>
+                <li><a href="http://www.enlightenment.org/p.php?p=contribute">Contribute</a></li>
+                <li><a href="http://www.enlightenment.org/p.php?p=support">Support</a></li>
+                <li><a href="http://www.enlightenment.org/p.php?p=download">Download</a></li>
+                <li><a href="http://www.enlightenment.org/p.php?p=about">About</a></li>
+                <li><a href="http://www.enlightenment.org/p.php?p=news">News</a></li>
+                <li><a href="http://www.enlightenment.org/">Home</a></li>
+            </ul>
+        </div>
+    </div>
+
+    <div class="doxytitle">
+        $projectname Documentation <small>at $date</small>
+    </div>
+
+    <div class="menu-container">
+        <div class="submenu">
+            <ul class="current">
+                <li><a href="todo.html">Todo</a></li>
+                <li><a href="files.html">Files</a></li>
+                <li><a href="annotated.html">Data Structures</a></li>
+                <li><a href="globals.html">Globals</a></li>
+                <li><a href="modules.html">Modules</a></li>
+                <li><a href="pages.html">Related Pages</a></li>
+               <li class="current"><a href="index.html">Main Page</a></li>
+            </ul>
+        </div>
+    </div>
+
+
+    <div class="clear"></div>
+</div>
+</div>
+
+<div id="content">
+<div class="layout">
diff --git a/doc/img/e.png b/doc/img/e.png
new file mode 100755 (executable)
index 0000000..b3884a5
Binary files /dev/null and b/doc/img/e.png differ
diff --git a/doc/img/e_big.png b/doc/img/e_big.png
new file mode 100755 (executable)
index 0000000..d42aeb4
Binary files /dev/null and b/doc/img/e_big.png differ
diff --git a/doc/img/edoxy.css b/doc/img/edoxy.css
new file mode 100755 (executable)
index 0000000..616a0c5
--- /dev/null
@@ -0,0 +1,966 @@
+/*
+ * This file contain a custom doxygen style to match e.org graphics
+ */
+
+
+
+/* BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+       font-family: Geneva, Arial, Helvetica, sans-serif;
+}*/ 
+BODY, TD {
+       font-size: 12px;
+}
+H1 {
+       text-align: center;
+       font-size: 160%;
+}
+H2 {
+       font-size: 120%;
+}
+H3 {
+       font-size: 100%;
+}
+CAPTION { 
+       font-weight: bold 
+}
+DIV.qindex {
+       width: 100%;
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       padding: 2px;
+       line-height: 140%;
+}
+DIV.navpath {
+       width: 100%;
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       padding: 2px;
+       line-height: 140%;
+}
+DIV.navtab {
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       margin-right: 15px;
+       padding: 2px;
+}
+TD.navtab {
+       font-size: 70%;
+}
+A.qindex {
+       text-decoration: none;
+       font-weight: bold;
+       color: #1A419D;
+}
+A.qindex:visited {
+       text-decoration: none;
+       font-weight: bold;
+       color: #1A419D
+}
+A.qindex:hover {
+       text-decoration: none;
+       background-color: #ddddff;
+}
+A.qindexHL {
+       text-decoration: none;
+       font-weight: bold;
+       background-color: #6666cc;
+       color: #ffffff;
+       border: 1px double #9295C2;
+}
+A.qindexHL:hover {
+       text-decoration: none;
+       background-color: #6666cc;
+       color: #ffffff;
+}
+A.qindexHL:visited { 
+       text-decoration: none; 
+       background-color: #6666cc; 
+       color: #ffffff 
+}
+A.el { 
+       text-decoration: none; 
+       font-weight: bold 
+}
+A.elRef { 
+       font-weight: bold 
+}
+A.code:link { 
+       text-decoration: none; 
+       font-weight: normal; 
+       color: #0000FF
+}
+A.code:visited { 
+       text-decoration: none; 
+       font-weight: normal; 
+       color: #0000FF
+}
+A.codeRef:link { 
+       font-weight: normal; 
+       color: #0000FF
+}
+A.codeRef:visited { 
+       font-weight: normal; 
+       color: #0000FF
+}
+A:hover, A:visited:hover { 
+       text-decoration: none;  
+       /* background-color: #f2f2ff; */
+       color: #000055;
+}
+A.anchor {
+       color: #000;
+}
+DL.el { 
+       margin-left: -1cm 
+}
+.fragment {
+       font-family: monospace, fixed;
+       font-size: 95%;
+}
+PRE.fragment {
+       border: 1px solid #CCCCCC;
+       background-color: #f5f5f5;
+       margin-top: 4px;
+       margin-bottom: 4px;
+       margin-left: 2px;
+       margin-right: 8px;
+       padding-left: 6px;
+       padding-right: 6px;
+       padding-top: 4px;
+       padding-bottom: 4px;
+}
+DIV.ah { 
+       background-color: black; 
+       font-weight: bold; 
+       color: #ffffff; 
+       margin-bottom: 3px; 
+       margin-top: 3px 
+}
+
+DIV.groupHeader {
+       margin-left: 16px;
+       margin-top: 12px;
+       margin-bottom: 6px;
+       font-weight: bold;
+}
+DIV.groupText { 
+       margin-left: 16px; 
+       font-style: italic; 
+       font-size: 90% 
+}
+/*BODY {
+       background: white;
+       color: black;
+       margin-right: 20px;
+       margin-left: 20px;
+}*/
+TD.indexkey {
+       background-color: #e8eef2;
+       font-weight: bold;
+       padding-right  : 10px;
+       padding-top    : 2px;
+       padding-left   : 10px;
+       padding-bottom : 2px;
+       margin-left    : 0px;
+       margin-right   : 0px;
+       margin-top     : 2px;
+       margin-bottom  : 2px;
+       border: 1px solid #CCCCCC;
+}
+TD.indexvalue {
+       background-color: #e8eef2;
+       font-style: italic;
+       padding-right  : 10px;
+       padding-top    : 2px;
+       padding-left   : 10px;
+       padding-bottom : 2px;
+       margin-left    : 0px;
+       margin-right   : 0px;
+       margin-top     : 2px;
+       margin-bottom  : 2px;
+       border: 1px solid #CCCCCC;
+}
+TR.memlist {
+       background-color: #f0f0f0; 
+}
+P.formulaDsp { 
+       text-align: center; 
+}
+IMG.formulaDsp {
+}
+IMG.formulaInl { 
+       vertical-align: middle; 
+}
+SPAN.keyword       { color: #008000 }
+SPAN.keywordtype   { color: #604020 }
+SPAN.keywordflow   { color: #e08000 }
+SPAN.comment       { color: #800000 }
+SPAN.preprocessor  { color: #806020 }
+SPAN.stringliteral { color: #002080 }
+SPAN.charliteral   { color: #008080 }
+SPAN.vhdldigit     { color: #ff00ff }
+SPAN.vhdlchar      { color: #000000 }
+SPAN.vhdlkeyword   { color: #700070 }
+SPAN.vhdllogic     { color: #ff0000 }
+
+.mdescLeft {
+       padding: 0px 8px 4px 8px;
+       font-size: 80%;
+       font-style: italic;
+       background-color: #FAFAFA;
+       border-top: 1px none #E0E0E0;
+       border-right: 1px none #E0E0E0;
+       border-bottom: 1px none #E0E0E0;
+       border-left: 1px none #E0E0E0;
+       margin: 0px;
+}
+.mdescRight {
+        padding: 0px 8px 4px 8px;
+       font-size: 80%;
+       font-style: italic;
+       background-color: #FAFAFA;
+       border-top: 1px none #E0E0E0;
+       border-right: 1px none #E0E0E0;
+       border-bottom: 1px none #E0E0E0;
+       border-left: 1px none #E0E0E0;
+       margin: 0px;
+}
+.memItemLeft {
+       padding: 1px 0px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: solid;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memItemRight {
+       padding: 1px 8px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: solid;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memTemplItemLeft {
+       padding: 1px 0px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: none;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memTemplItemRight {
+       padding: 1px 8px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: none;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memTemplParams {
+       padding: 1px 0px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: solid;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       color: #606060;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.search { 
+       color: #003399;
+       font-weight: bold;
+}
+FORM.search {
+       margin-bottom: 0px;
+       margin-top: 0px;
+}
+INPUT.search { 
+       font-size: 75%;
+       color: #000080;
+       font-weight: normal;
+       background-color: #e8eef2;
+}
+TD.tiny { 
+       font-size: 75%;
+}
+a {
+       color: #1A41A8;
+}
+a:visited {
+       color: #2A3798;
+}
+.dirtab { 
+       padding: 4px;
+       border-collapse: collapse;
+       border: 1px solid #84b0c7;
+}
+TH.dirtab { 
+       background: #e8eef2;
+       font-weight: bold;
+}
+HR { 
+       height: 1px;
+       border: none;
+       border-top: 1px solid black;
+}
+
+/* Style for detailed member documentation */
+.memtemplate {
+       font-size: 80%;
+       color: #606060;
+       font-weight: normal;
+       margin-left: 3px;
+} 
+.memnav { 
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       margin-right: 15px;
+       padding: 2px;
+}
+.memitem {
+       padding: 4px;
+       background-color: #eef3f5;
+       border-width: 1px;
+       border-style: solid;
+       border-color: #dedeee;
+       -moz-border-radius: 8px 8px 8px 8px;
+}
+.memname {
+       white-space: nowrap;
+       font-weight: bold;
+}
+.memdoc{
+       padding-left: 10px;
+}
+.memproto {
+       background-color: #d5e1e8;
+       width: 100%;
+       border-width: 1px;
+       border-style: solid;
+       border-color: #84b0c7;
+       font-weight: bold;
+       -moz-border-radius: 8px 8px 8px 8px;
+}
+.paramkey {
+       text-align: right;
+}
+.paramtype {
+       white-space: nowrap;
+}
+.paramname {
+       color: #602020;
+       font-style: italic;
+       white-space: nowrap;
+}
+/* End Styling for detailed member documentation */
+
+/* for the tree view */
+.ftvtree {
+       font-family: sans-serif;
+       margin:0.5em;
+}
+/* these are for tree view when used as main index */
+.directory { 
+       font-size: 9pt; 
+       font-weight: bold; 
+}
+.directory h3 { 
+       margin: 0px; 
+       margin-top: 1em; 
+       font-size: 11pt; 
+}
+
+/* The following two styles can be used to replace the root node title */
+/* with an image of your choice.  Simply uncomment the next two styles, */
+/* specify the name of your image and be sure to set 'height' to the */
+/* proper pixel height of your image. */
+
+/* .directory h3.swap { */
+/*     height: 61px; */
+/*     background-repeat: no-repeat; */
+/*     background-image: url("yourimage.gif"); */
+/* } */
+/* .directory h3.swap span { */
+/*     display: none; */
+/* } */
+
+.directory > h3 { 
+       margin-top: 0; 
+}
+.directory p { 
+       margin: 0px; 
+       white-space: nowrap; 
+}
+.directory div { 
+       display: none; 
+       margin: 0px; 
+}
+.directory img { 
+       vertical-align: -30%; 
+}
+/* these are for tree view when not used as main index */
+.directory-alt { 
+       font-size: 100%; 
+       font-weight: bold; 
+}
+.directory-alt h3 { 
+       margin: 0px; 
+       margin-top: 1em; 
+       font-size: 11pt; 
+}
+.directory-alt > h3 { 
+       margin-top: 0; 
+}
+.directory-alt p { 
+       margin: 0px; 
+       white-space: nowrap; 
+}
+.directory-alt div { 
+       display: none; 
+       margin: 0px; 
+}
+.directory-alt img { 
+       vertical-align: -30%; 
+}
+
+/*
+ * This file contain a custom doxygen style to match e.org graphics
+ */
+
+
+
+/* BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+       font-family: Geneva, Arial, Helvetica, sans-serif;
+}*/ 
+BODY, TD {
+       font-size: 12px;
+}
+H1 {
+       text-align: center;
+       font-size: 160%;
+}
+H2 {
+       font-size: 120%;
+}
+H3 {
+       font-size: 100%;
+}
+CAPTION { 
+       font-weight: bold 
+}
+DIV.qindex {
+       width: 100%;
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       padding: 2px;
+       line-height: 140%;
+}
+DIV.navpath {
+       width: 100%;
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       padding: 2px;
+       line-height: 140%;
+}
+DIV.navtab {
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       margin-right: 15px;
+       padding: 2px;
+}
+TD.navtab {
+       font-size: 70%;
+}
+A.qindex {
+       text-decoration: none;
+       font-weight: bold;
+       color: #1A419D;
+}
+A.qindex:visited {
+       text-decoration: none;
+       font-weight: bold;
+       color: #1A419D
+}
+A.qindex:hover {
+       text-decoration: none;
+       background-color: #ddddff;
+}
+A.qindexHL {
+       text-decoration: none;
+       font-weight: bold;
+       background-color: #6666cc;
+       color: #ffffff;
+       border: 1px double #9295C2;
+}
+A.qindexHL:hover {
+       text-decoration: none;
+       background-color: #6666cc;
+       color: #ffffff;
+}
+A.qindexHL:visited { 
+       text-decoration: none; 
+       background-color: #6666cc; 
+       color: #ffffff 
+}
+A.el { 
+       text-decoration: none; 
+       font-weight: bold 
+}
+A.elRef { 
+       font-weight: bold 
+}
+A.code:link { 
+       text-decoration: none; 
+       font-weight: normal; 
+       color: #0000FF
+}
+A.code:visited { 
+       text-decoration: none; 
+       font-weight: normal; 
+       color: #0000FF
+}
+A.codeRef:link { 
+       font-weight: normal; 
+       color: #0000FF
+}
+A.codeRef:visited { 
+       font-weight: normal; 
+       color: #0000FF
+}
+A:hover, A:visited:hover { 
+       text-decoration: none;  
+       /* background-color: #f2f2ff; */
+       color: #000055;
+}
+A.anchor {
+       color: #000;
+}
+DL.el { 
+       margin-left: -1cm 
+}
+.fragment {
+       font-family: monospace, fixed;
+       font-size: 95%;
+}
+PRE.fragment {
+       border: 1px solid #CCCCCC;
+       background-color: #f5f5f5;
+       margin-top: 4px;
+       margin-bottom: 4px;
+       margin-left: 2px;
+       margin-right: 8px;
+       padding-left: 6px;
+       padding-right: 6px;
+       padding-top: 4px;
+       padding-bottom: 4px;
+}
+DIV.ah { 
+       background-color: black; 
+       font-weight: bold; 
+       color: #ffffff; 
+       margin-bottom: 3px; 
+       margin-top: 3px 
+}
+
+DIV.groupHeader {
+       margin-left: 16px;
+       margin-top: 12px;
+       margin-bottom: 6px;
+       font-weight: bold;
+}
+DIV.groupText { 
+       margin-left: 16px; 
+       font-style: italic; 
+       font-size: 90% 
+}
+/*BODY {
+       background: white;
+       color: black;
+       margin-right: 20px;
+       margin-left: 20px;
+}*/
+TD.indexkey {
+       background-color: #e8eef2;
+       font-weight: bold;
+       padding-right  : 10px;
+       padding-top    : 2px;
+       padding-left   : 10px;
+       padding-bottom : 2px;
+       margin-left    : 0px;
+       margin-right   : 0px;
+       margin-top     : 2px;
+       margin-bottom  : 2px;
+       border: 1px solid #CCCCCC;
+}
+TD.indexvalue {
+       background-color: #e8eef2;
+       font-style: italic;
+       padding-right  : 10px;
+       padding-top    : 2px;
+       padding-left   : 10px;
+       padding-bottom : 2px;
+       margin-left    : 0px;
+       margin-right   : 0px;
+       margin-top     : 2px;
+       margin-bottom  : 2px;
+       border: 1px solid #CCCCCC;
+}
+TR.memlist {
+       background-color: #f0f0f0; 
+}
+P.formulaDsp { 
+       text-align: center; 
+}
+IMG.formulaDsp {
+}
+IMG.formulaInl { 
+       vertical-align: middle; 
+}
+SPAN.keyword       { color: #008000 }
+SPAN.keywordtype   { color: #604020 }
+SPAN.keywordflow   { color: #e08000 }
+SPAN.comment       { color: #800000 }
+SPAN.preprocessor  { color: #806020 }
+SPAN.stringliteral { color: #002080 }
+SPAN.charliteral   { color: #008080 }
+SPAN.vhdldigit     { color: #ff00ff }
+SPAN.vhdlchar      { color: #000000 }
+SPAN.vhdlkeyword   { color: #700070 }
+SPAN.vhdllogic     { color: #ff0000 }
+
+.mdescLeft {
+       padding: 0px 8px 4px 8px;
+       font-size: 80%;
+       font-style: italic;
+       background-color: #FAFAFA;
+       border-top: 1px none #E0E0E0;
+       border-right: 1px none #E0E0E0;
+       border-bottom: 1px none #E0E0E0;
+       border-left: 1px none #E0E0E0;
+       margin: 0px;
+}
+.mdescRight {
+        padding: 0px 8px 4px 8px;
+       font-size: 80%;
+       font-style: italic;
+       background-color: #FAFAFA;
+       border-top: 1px none #E0E0E0;
+       border-right: 1px none #E0E0E0;
+       border-bottom: 1px none #E0E0E0;
+       border-left: 1px none #E0E0E0;
+       margin: 0px;
+}
+.memItemLeft {
+       padding: 1px 0px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: solid;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memItemRight {
+       padding: 1px 8px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: solid;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memTemplItemLeft {
+       padding: 1px 0px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: none;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memTemplItemRight {
+       padding: 1px 8px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: none;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.memTemplParams {
+       padding: 1px 0px 0px 8px;
+       margin: 4px;
+       border-top-width: 1px;
+       border-right-width: 1px;
+       border-bottom-width: 1px;
+       border-left-width: 1px;
+       border-top-color: #E0E0E0;
+       border-right-color: #E0E0E0;
+       border-bottom-color: #E0E0E0;
+       border-left-color: #E0E0E0;
+       border-top-style: solid;
+       border-right-style: none;
+       border-bottom-style: none;
+       border-left-style: none;
+       color: #606060;
+       background-color: #FAFAFA;
+       font-size: 80%;
+}
+.search { 
+       color: #003399;
+       font-weight: bold;
+}
+FORM.search {
+       margin-bottom: 0px;
+       margin-top: 0px;
+}
+INPUT.search { 
+       font-size: 75%;
+       color: #000080;
+       font-weight: normal;
+       background-color: #e8eef2;
+}
+TD.tiny { 
+       font-size: 75%;
+}
+a {
+       color: #1A41A8;
+}
+a:visited {
+       color: #2A3798;
+}
+.dirtab { 
+       padding: 4px;
+       border-collapse: collapse;
+       border: 1px solid #84b0c7;
+}
+TH.dirtab { 
+       background: #e8eef2;
+       font-weight: bold;
+}
+HR { 
+       height: 1px;
+       border: none;
+       border-top: 1px solid black;
+}
+
+/* Style for detailed member documentation */
+.memtemplate {
+       font-size: 80%;
+       color: #606060;
+       font-weight: normal;
+       margin-left: 3px;
+} 
+.memnav { 
+       background-color: #e8eef2;
+       border: 1px solid #84b0c7;
+       text-align: center;
+       margin: 2px;
+       margin-right: 15px;
+       padding: 2px;
+}
+.memitem {
+       padding: 4px;
+       background-color: #eef3f5;
+       border-width: 1px;
+       border-style: solid;
+       border-color: #dedeee;
+       -moz-border-radius: 8px 8px 8px 8px;
+}
+.memname {
+       white-space: nowrap;
+       font-weight: bold;
+}
+.memdoc{
+       padding-left: 10px;
+}
+.memproto {
+       background-color: #d5e1e8;
+       width: 100%;
+       border-width: 1px;
+       border-style: solid;
+       border-color: #84b0c7;
+       font-weight: bold;
+       -moz-border-radius: 8px 8px 8px 8px;
+}
+.paramkey {
+       text-align: right;
+}
+.paramtype {
+       white-space: nowrap;
+}
+.paramname {
+       color: #602020;
+       font-style: italic;
+       white-space: nowrap;
+}
+/* End Styling for detailed member documentation */
+
+/* for the tree view */
+.ftvtree {
+       font-family: sans-serif;
+       margin:0.5em;
+}
+/* these are for tree view when used as main index */
+.directory { 
+       font-size: 9pt; 
+       font-weight: bold; 
+}
+.directory h3 { 
+       margin: 0px; 
+       margin-top: 1em; 
+       font-size: 11pt; 
+}
+
+/* The following two styles can be used to replace the root node title */
+/* with an image of your choice.  Simply uncomment the next two styles, */
+/* specify the name of your image and be sure to set 'height' to the */
+/* proper pixel height of your image. */
+
+/* .directory h3.swap { */
+/*     height: 61px; */
+/*     background-repeat: no-repeat; */
+/*     background-image: url("yourimage.gif"); */
+/* } */
+/* .directory h3.swap span { */
+/*     display: none; */
+/* } */
+
+.directory > h3 { 
+       margin-top: 0; 
+}
+.directory p { 
+       margin: 0px; 
+       white-space: nowrap; 
+}
+.directory div { 
+       display: none; 
+       margin: 0px; 
+}
+.directory img { 
+       vertical-align: -30%; 
+}
+/* these are for tree view when not used as main index */
+.directory-alt { 
+       font-size: 100%; 
+       font-weight: bold; 
+}
+.directory-alt h3 { 
+       margin: 0px; 
+       margin-top: 1em; 
+       font-size: 11pt; 
+}
+.directory-alt > h3 { 
+       margin-top: 0; 
+}
+.directory-alt p { 
+       margin: 0px; 
+       white-space: nowrap; 
+}
+.directory-alt div { 
+       display: none; 
+       margin: 0px; 
+}
+.directory-alt img { 
+       vertical-align: -30%; 
+}
+
diff --git a/doc/img/foot_bg.png b/doc/img/foot_bg.png
new file mode 100755 (executable)
index 0000000..b24f3a4
Binary files /dev/null and b/doc/img/foot_bg.png differ
diff --git a/doc/img/head_bg.png b/doc/img/head_bg.png
new file mode 100755 (executable)
index 0000000..081dc13
Binary files /dev/null and b/doc/img/head_bg.png differ
diff --git a/doc/img/menu_bg.png b/doc/img/menu_bg.png
new file mode 100755 (executable)
index 0000000..e978743
Binary files /dev/null and b/doc/img/menu_bg.png differ
diff --git a/doc/img/menu_bg_current.png b/doc/img/menu_bg_current.png
new file mode 100755 (executable)
index 0000000..de97c92
Binary files /dev/null and b/doc/img/menu_bg_current.png differ
diff --git a/doc/img/menu_bg_hover.png b/doc/img/menu_bg_hover.png
new file mode 100755 (executable)
index 0000000..3fd851d
Binary files /dev/null and b/doc/img/menu_bg_hover.png differ
diff --git a/doc/img/menu_bg_last.png b/doc/img/menu_bg_last.png
new file mode 100755 (executable)
index 0000000..88c116c
Binary files /dev/null and b/doc/img/menu_bg_last.png differ
diff --git a/doc/img/menu_bg_unsel.png b/doc/img/menu_bg_unsel.png
new file mode 100755 (executable)
index 0000000..50e5fd8
Binary files /dev/null and b/doc/img/menu_bg_unsel.png differ
diff --git a/embryo.manifest b/embryo.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
index 8ffd2c6..540f27c 100644 (file)
@@ -1,13 +1,15 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-datadir=@datadir@/@PACKAGE@
 libdir=@libdir@
 includedir=@includedir@
 libdir=@libdir@
 includedir=@includedir@
+datarootdir=@datarootdir@
+datadir=@datadir@/@PACKAGE@
 embryoincludedir=@embryoincludedir@
 
 Name: embryo
 Description: A small virtual machine engine and bytecode compiler
 embryoincludedir=@embryoincludedir@
 
 Name: embryo
 Description: A small virtual machine engine and bytecode compiler
+@pkgconfig_requires_private@: @requirement_embryo@
 Version: @VERSION@
 Libs: -L${libdir} -lembryo
 Version: @VERSION@
 Libs: -L${libdir} -lembryo
-Libs.private: -lm
-Cflags: -I${includedir}
+Libs.private: @EFL_FNMATCH_LIBS@ -lm
+Cflags: -I${includedir}/embryo-@VMAJ@
index 140d4d3..4c37ede 100644 (file)
@@ -1,9 +1,11 @@
 %define _missing_doc_files_terminate_build 0
 
 %define _missing_doc_files_terminate_build 0
 
+%{!?_rel:%{expand:%%global _rel 0.enl%{?dist}}}
+
 Summary: A small virtual machine engine (in a library) and bytecode compiler
 Name: @PACKAGE@
 Version: @VERSION@
 Summary: A small virtual machine engine (in a library) and bytecode compiler
 Name: @PACKAGE@
 Version: @VERSION@
-Release: 0.%(date '+%Y%m%d')
+Release: %{_rel}
 License: BSD
 Group: System Environment/Libraries
 Source: %{name}-%{version}.tar.gz
 License: BSD
 Group: System Environment/Libraries
 Source: %{name}-%{version}.tar.gz
@@ -70,6 +72,6 @@ test "x$RPM_BUILD_ROOT" != "x/" && rm -rf $RPM_BUILD_ROOT
 %{_libdir}/*.la
 %{_libdir}/*.a
 %{_libdir}/pkgconfig/*
 %{_libdir}/*.la
 %{_libdir}/*.a
 %{_libdir}/pkgconfig/*
-%{_includedir}/*.h
+%{_includedir}/embryo-1/*.h
 
 %changelog
 
 %changelog
index 0733503..b82ff14 100644 (file)
@@ -211,3 +211,21 @@ stock bool:operator!(Float:oper)
 forward operator%(Float:oper1, Float:oper2);
 forward operator%(Float:oper1, oper2);
 forward operator%(oper1, Float:oper2);
 forward operator%(Float:oper1, Float:oper2);
 forward operator%(Float:oper1, oper2);
 forward operator%(oper1, Float:oper2);
+
+/**************************************************************************/
+/* ADDED in embryo 1.2                                                    */
+/**************************************************************************/
+/* use this to determine embryo age */
+#define EMBRYO_12 12
+/* Return the inverse sine, cosine or tangent. The output may be radians, */
+/* degrees or grades. */
+native Float:asin(Float:value, Float_Angle_Mode:mode=RADIAN);
+native Float:acos(Float:value, Float_Angle_Mode:mode=RADIAN);
+native Float:atan(Float:value, Float_Angle_Mode:mode=RADIAN);
+native Float:atan2(Float:valuey, Float:valuex, Float_Angle_Mode:mode=RADIAN);
+/* same as libc functions */
+native Float:log1p(Float:value);
+native Float:cbrt(Float:value);
+native Float:exp(Float:value);
+native Float:exp2(Float:value);
+native Float:hypot(Float:valuex, Float:valuey);
diff --git a/m4/ac_attribute.m4 b/m4/ac_attribute.m4
new file mode 100644 (file)
index 0000000..23479a9
--- /dev/null
@@ -0,0 +1,47 @@
+dnl Copyright (C) 2004-2008 Kim Woelders
+dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
+dnl That code is public domain and can be freely used or copied.
+dnl Originally snatched from somewhere...
+
+dnl Macro for checking if the compiler supports __attribute__
+
+dnl Usage: AC_C___ATTRIBUTE__
+dnl call AC_DEFINE for HAVE___ATTRIBUTE__ and __UNUSED__
+dnl if the compiler supports __attribute__, HAVE___ATTRIBUTE__ is
+dnl defined to 1 and __UNUSED__ is defined to __attribute__((unused))
+dnl otherwise, HAVE___ATTRIBUTE__ is not defined and __UNUSED__ is
+dnl defined to nothing.
+
+AC_DEFUN([AC_C___ATTRIBUTE__],
+[
+
+AC_MSG_CHECKING([for __attribute__])
+
+AC_CACHE_VAL([ac_cv___attribute__],
+   [AC_TRY_COMPILE(
+       [
+#include <stdlib.h>
+
+int func(int x);
+int foo(int x __attribute__ ((unused)))
+{
+   exit(1);
+}
+       ],
+       [],
+       [ac_cv___attribute__="yes"],
+       [ac_cv___attribute__="no"]
+    )])
+
+AC_MSG_RESULT($ac_cv___attribute__)
+
+if test "x${ac_cv___attribute__}" = "xyes" ; then
+   AC_DEFINE([HAVE___ATTRIBUTE__], [1], [Define to 1 if your compiler has __attribute__])
+   AC_DEFINE([__UNUSED__], [__attribute__((unused))], [Macro declaring a function argument to be unused])
+  else
+    AC_DEFINE([__UNUSED__], [], [Macro declaring a function argument to be unused])
+fi
+
+])
+
+dnl End of ac_attribute.m4
diff --git a/m4/efl_binary.m4 b/m4/efl_binary.m4
new file mode 100644 (file)
index 0000000..93d6934
--- /dev/null
@@ -0,0 +1,44 @@
+dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
+dnl That code is public domain and can be freely used or copied.
+
+dnl Macro that check if a binary is built or not
+
+dnl Usage: EFL_ENABLE_BIN(binary)
+dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being transformed into _)
+dnl Define have_binary (- is transformed into _)
+dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being transformed into _)
+
+AC_DEFUN([EFL_ENABLE_BIN],
+[
+
+m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
+m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
+
+have_[]m4_defn([DOWN])="yes"
+
+dnl configure option
+
+AC_ARG_ENABLE([$1],
+   [AC_HELP_STRING([--disable-$1], [disable building of ]DOWN)],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       have_[]m4_defn([DOWN])="yes"
+    else
+       have_[]m4_defn([DOWN])="no"
+    fi
+   ])
+
+AC_MSG_CHECKING([whether to build ]DOWN[ binary])
+AC_MSG_RESULT([$have_[]m4_defn([DOWN])])
+
+if test "x$have_[]m4_defn([DOWN])" = "xyes"; then
+   UP[]_PRG=DOWN[${EXEEXT}]
+fi
+
+AC_SUBST(UP[]_PRG)
+
+AM_CONDITIONAL(BUILD_[]UP, test "x$have_[]m4_defn([DOWN])" = "xyes")
+
+AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$2], [$3])
+
+])
diff --git a/m4/efl_doxygen.m4 b/m4/efl_doxygen.m4
new file mode 100644 (file)
index 0000000..d83ed68
--- /dev/null
@@ -0,0 +1,97 @@
+dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
+dnl That code is public domain and can be freely used or copied.
+
+dnl Macro that check if doxygen is available or not.
+
+dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for the doxygen program
+dnl Defines efl_doxygen
+dnl Defines the automake conditionnal EFL_BUILD_DOC
+dnl
+AC_DEFUN([EFL_CHECK_DOXYGEN],
+[
+
+dnl
+dnl Disable the build of the documentation
+dnl
+AC_ARG_ENABLE([doc],
+   [AC_HELP_STRING(
+       [--disable-doc],
+       [Disable documentation build @<:@default=enabled@:>@])],
+   [
+    if test "x${enableval}" = "xyes" ; then
+       efl_enable_doc="yes"
+    else
+       efl_enable_doc="no"
+    fi
+   ],
+   [efl_enable_doc="yes"])
+
+AC_MSG_CHECKING([whether to build documentation])
+AC_MSG_RESULT([${efl_enable_doc}])
+
+if test "x${efl_enable_doc}" = "xyes" ; then
+
+dnl Specify the file name, without path
+
+   efl_doxygen="doxygen"
+
+   AC_ARG_WITH([doxygen],
+      [AC_HELP_STRING(
+          [--with-doxygen=FILE],
+          [doxygen program to use @<:@default=doxygen@:>@])],
+
+dnl Check the given doxygen program.
+
+      [efl_doxygen=${withval}
+       AC_CHECK_PROG([efl_have_doxygen],
+          [${efl_doxygen}],
+          [yes],
+          [no])
+       if test "x${efl_have_doxygen}" = "xno" ; then
+          echo "WARNING:"
+          echo "The doxygen program you specified:"
+          echo "${efl_doxygen}"
+          echo "was not found.  Please check the path and make sure "
+          echo "the program exists and is executable."
+          AC_MSG_WARN([no doxygen detected. Documentation will not be built])
+       fi
+      ],
+      [AC_CHECK_PROG([efl_have_doxygen],
+          [${efl_doxygen}],
+          [yes],
+          [no])
+       if test "x${efl_have_doxygen}" = "xno" ; then
+          echo "WARNING:"
+          echo "The doxygen program was not found in your execute path."
+          echo "You may have doxygen installed somewhere not covered by your path."
+          echo ""
+          echo "If this is the case make sure you have the packages installed, AND"
+          echo "that the doxygen program is in your execute path (see your"
+          echo "shell manual page on setting the \$PATH environment variable), OR"
+          echo "alternatively, specify the program to use with --with-doxygen."
+          AC_MSG_WARN([no doxygen detected. Documentation will not be built])
+       fi
+      ])
+fi
+
+dnl
+dnl Substitution
+dnl
+AC_SUBST([efl_doxygen])
+
+if ! test "x${efl_have_doxygen}" = "xyes" ; then
+   efl_enable_doc="no"
+fi
+
+AM_CONDITIONAL(EFL_BUILD_DOC, test "x${efl_enable_doc}" = "xyes")
+
+if test "x${efl_enable_doc}" = "xyes" ; then
+  m4_default([$1], [:])
+else
+  m4_default([$2], [:])
+fi
+
+])
+
+dnl End of efl_doxygen.m4
diff --git a/m4/efl_fnmatch.m4 b/m4/efl_fnmatch.m4
new file mode 100644 (file)
index 0000000..c857046
--- /dev/null
@@ -0,0 +1,31 @@
+dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
+dnl That code is public domain and can be freely used or copied.
+
+dnl Macro that check if fnmatch functions are available or not.
+
+dnl Usage: EFL_CHECK_FNMATCH([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Call AC_SUBST(EFL_FNMATCH_LIBS)
+
+AC_DEFUN([EFL_CHECK_FNMATCH],
+[
+
+AC_CHECK_HEADER([fnmatch.h], [_efl_have_fnmatch="yes"], [_efl_have_fnmatch="no"])
+
+if test "x${_efl_have_fnmatch}" = "xyes" ; then
+   AC_SEARCH_LIBS([fnmatch],
+      [fnmatch evil exotic iberty],
+      [_efl_have_fnmatch="yes"],
+      [_efl_have_fnmatch="no"])
+fi
+
+EFL_FNMATCH_LIBS=""
+
+if (! test "x${ac_cv_search_fnmatch}" = "xnone required") && (! test "x${ac_cv_search_fnmatch}" = "xno") && (! test "x${ac_cv_search_fnmatch}" = "x-levil") ; then
+   EFL_FNMATCH_LIBS=${ac_cv_search_fnmatch}
+fi
+
+AC_SUBST(EFL_FNMATCH_LIBS)
+
+AS_IF([test "x$_efl_have_fnmatch" = "xyes"], [$1], [$2])
+
+])
diff --git a/m4/efl_gettimeofday.m4 b/m4/efl_gettimeofday.m4
new file mode 100644 (file)
index 0000000..9b767e5
--- /dev/null
@@ -0,0 +1,48 @@
+dnl Copyright (C) 2011 Cedric Bail <cedric.bail@free.fr>
+dnl This code is public domain and can be freely used or copied.
+
+dnl Macro that check for gettimeofday definition
+
+dnl Usage: EFL_CHECK_GETTIMEOFDAY(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
+dnl Define EFL_HAVE_GETTIMEOFDAY
+
+AC_DEFUN([EFL_CHECK_GETTIMEOFDAY],
+[
+
+_efl_have_gettimeofday="no"
+
+AC_LINK_IFELSE(
+   [AC_LANG_PROGRAM([[
+#include <stdlib.h>
+#include <sys/time.h>
+                   ]],
+                   [[
+int res;
+res = gettimeofday(NULL, NULL);
+                   ]])],
+   [_efl_have_gettimeofday="yes"],
+   [_efl_have_gettimeofday="no"])
+
+if test "x${_efl_have_gettimeofday}" = "xno" -a "x${enable_exotic}" = "xyes"; then
+   SAVE_LIBS="${LIBS}"
+   SAVE_CFLAGS="${CFLAGS}"
+   LIBS="${LIBS} ${EXOTIC_LIBS}"
+   CFLAGS="${CFLAGS} ${EXOTIC_CFLAGS}"
+   AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[
+#include <Exotic.h>
+                      ]],
+                      [[
+int res;
+res = gettimeofday(NULL, NULL);
+                      ]])],
+      [_efl_have_gettimeofday="yes"],
+      [_efl_have_gettimeofday="no"])
+fi
+
+if test "x${_efl_have_gettimeofday}" = "xyes"; then
+   AC_DEFINE([EFL_HAVE_GETTIMEOFDAY], [1], [Defined if gettimeofday is available.])
+fi
+
+AS_IF([test "x${_efl_have_gettimeofday}" = "xyes"], [$1], [$2])
+])
diff --git a/m4/efl_path_max.m4 b/m4/efl_path_max.m4
new file mode 100644 (file)
index 0000000..f57bfd2
--- /dev/null
@@ -0,0 +1,36 @@
+dnl Check for PATH_MAX in limits.h, and define a default value if not found
+dnl This is a workaround for systems not providing PATH_MAX, like GNU/Hurd
+
+dnl EFL_CHECK_PATH_MAX([DEFAULT_VALUE_IF_NOT_FOUND])
+dnl
+dnl If PATH_MAX is not defined in <limits.h>, defines it
+dnl to DEFAULT_VALUE_IF_NOT_FOUND if it exists, or fallback
+dnl to using 4096
+
+AC_DEFUN([EFL_CHECK_PATH_MAX],
+[
+
+default_max=m4_default([$1], "4096")
+AC_LANG_PUSH([C])
+
+AC_MSG_CHECKING([for PATH_MAX in limits.h])
+AC_COMPILE_IFELSE(
+   [AC_LANG_PROGRAM(
+       [[
+#include <limits.h>
+       ]],
+       [[
+int i = PATH_MAX;
+       ]])],
+   [AC_MSG_RESULT([yes])],
+   [
+    AC_DEFINE_UNQUOTED([PATH_MAX],
+       [${default_max}],
+       [default value since PATH_MAX is not defined])
+    AC_MSG_RESULT([no: using ${default_max}])
+   ])
+
+AC_LANG_POP([C])
+
+])
+dnl end of efl_path_max.m4
diff --git a/packaging/embryo.spec b/packaging/embryo.spec
new file mode 100644 (file)
index 0000000..4a569c7
--- /dev/null
@@ -0,0 +1,68 @@
+#sbs-git:slp/pkgs/e/embryo embryo 1.1.0+svn.68928slp2+build01 ff312ab0f1dd243c5f94e56b2e55f3c43b0cf40f
+Name:       embryo
+Summary:    A small virtual machine engine (in a library) and bytecode compiler
+Version:    1.7.1+svn.76491+build01r01
+Release:    1
+Group:      System/Libraries
+License:    BSD
+URL:        http://www.enlightenment.org/
+Source0:    %{name}-%{version}.tar.gz
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires: pkgconfig(eina)
+Provides: embryo-bin
+
+
+%description
+Development files for libembryo0 Embryo is primarily a shared library that gives you an API to load
+ and control interpreted programs compiled into an abstract machine
+ bytecode that it understands.  This abstract (or virtual) machine is
+ similar to a real machine with a CPU, but it is emulated in
+ software.
+ .
+ This packages contains headers and static libraries for Embryo.
+
+
+
+%package devel
+Summary:    A small virtual machine engine and bytecode compile (devel)
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+A small virtual machine engine (in a library) and bytecode compile (devel)
+
+%prep
+%setup -q
+
+
+%build
+export CFLAGS+=" -fvisibility=hidden -fPIC"
+export LDFLAGS+=" -fvisibility=hidden -Wl,--hash-style=both -Wl,--as-needed"
+
+%autogen --disable-static
+%configure --disable-static
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{buildsubdir}/COPYING %{buildroot}/usr/share/license/%{name}
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libembryo.so.*
+%{_bindir}/embryo_cc
+%{_datadir}/embryo/include/default.inc
+/usr/share/license/%{name}
+%manifest %{name}.manifest
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/embryo-1/Embryo.h
+%{_libdir}/libembryo.so
+%{_libdir}/pkgconfig/*.pc
index e26d109..09f6ffd 100644 (file)
@@ -9,13 +9,14 @@ AM_CPPFLAGS = \
 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
+@EINA_CFLAGS@ \
 @EVIL_CFLAGS@
 
 @EVIL_CFLAGS@
 
-bin_PROGRAMS = embryo_cc
+bin_PROGRAMS = @EMBRYO_CC_PRG@
+EXTRA_PROGRAMS = embryo_cc
 
 embryo_cc_SOURCES = \
 embryo_cc_amx.h \
 
 embryo_cc_SOURCES = \
 embryo_cc_amx.h \
-embryo_cc_osdefs.h \
 embryo_cc_sc.h \
 embryo_cc_sc1.c \
 embryo_cc_sc2.c \
 embryo_cc_sc.h \
 embryo_cc_sc1.c \
 embryo_cc_sc2.c \
@@ -30,10 +31,9 @@ embryo_cc_scvars.c \
 embryo_cc_prefix.c \
 embryo_cc_prefix.h
 
 embryo_cc_prefix.c \
 embryo_cc_prefix.h
 
-embryo_cc_CFLAGS = @WIN32_CFLAGS@
-embryo_cc_LDADD = $(top_builddir)/src/lib/libembryo.la @EVIL_LIBS@ -lm
+embryo_cc_CFLAGS = @EMBRYO_CFLAGS@
+embryo_cc_LDADD = $(top_builddir)/src/lib/libembryo.la @EVIL_LIBS@ @EINA_LIBS@ -lm
 embryo_cc_LDFLAGS = @lt_enable_auto_import@
 embryo_cc_LDFLAGS = @lt_enable_auto_import@
-embryo_cc_DEPENDENCIES = $(top_builddir)/src/lib/libembryo.la
 
 EXTRA_DIST = \
 embryo_cc_sc5.scp \
 
 EXTRA_DIST = \
 embryo_cc_sc5.scp \
index d5cb64e..0118e2d 100644 (file)
@@ -21,8 +21,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-#include "embryo_cc_osdefs.h"
-
 #ifndef EMBRYO_CC_AMX_H
 #define EMBRYO_CC_AMX_H
 
 #ifndef EMBRYO_CC_AMX_H
 #define EMBRYO_CC_AMX_H
 
 #define sEXPMAX         19     /* maximum name length for file version <= 6 */
 #define sNAMEMAX        31     /* maximum name length of symbol name */
 
 #define sEXPMAX         19     /* maximum name length for file version <= 6 */
 #define sNAMEMAX        31     /* maximum name length of symbol name */
 
+#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
+# pragma pack(1)
+# define EMBRYO_STRUCT_PACKED
+#elif defined (__GNUC__) || (defined (__SUNPRO_C) && __SUNPRO_C >= 0x5100)
+# define EMBRYO_STRUCT_PACKED __attribute__((packed))
+#else
+# define EMBRYO_STRUCT_PACKED
+#endif
+
    typedef struct tagAMX_FUNCSTUB
    {
       unsigned int        address;
       char                name[sEXPMAX + 1];
    typedef struct tagAMX_FUNCSTUB
    {
       unsigned int        address;
       char                name[sEXPMAX + 1];
-   } __attribute__((packed)) AMX_FUNCSTUB;
+   } EMBRYO_STRUCT_PACKED AMX_FUNCSTUB;
 
 /* The AMX structure is the internal structure for many functions. Not all
  * fields are valid at all times; many fields are cached in local variables.
 
 /* The AMX structure is the internal structure for many functions. Not all
  * fields are valid at all times; many fields are cached in local variables.
       cell reset_stk     ;
       cell reset_hea     ;
       cell          *syscall_d;        /* relocated value/address for the SYSCALL.D opcode */
       cell reset_stk     ;
       cell reset_hea     ;
       cell          *syscall_d;        /* relocated value/address for the SYSCALL.D opcode */
-   } __attribute__((packed)) AMX;
+   } EMBRYO_STRUCT_PACKED AMX;
 
 /* The AMX_HEADER structure is both the memory format as the file format. The
  * structure is used internaly.
 
 /* The AMX_HEADER structure is both the memory format as the file format. The
  * structure is used internaly.
       int pubvars    ; /* the "public variables" table */
       int tags       ; /* the "public tagnames" table */
       int nametable  ; /* name table, file version 7 only */
       int pubvars    ; /* the "public variables" table */
       int tags       ; /* the "public tagnames" table */
       int nametable  ; /* name table, file version 7 only */
-   } __attribute__((packed)) AMX_HEADER;
+   } EMBRYO_STRUCT_PACKED AMX_HEADER;
+
+#if defined _MSC_VER || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
+# pragma pack()
+#endif
+
 #define AMX_MAGIC       0xf1e0
 
    enum
 #define AMX_MAGIC       0xf1e0
 
    enum
             amx_GetAddr((amx), (param), &amx_cstr_);                 \
             amx_StrLen(amx_cstr_, &amx_length_);                     \
             if (amx_length_ > 0 &&                                   \
             amx_GetAddr((amx), (param), &amx_cstr_);                 \
             amx_StrLen(amx_cstr_, &amx_length_);                     \
             if (amx_length_ > 0 &&                                   \
-                ((result) = (char*)alloca(amx_length_ + 1)) != NULL) \
+                ((result) = (char *)alloca(amx_length_ + 1))) \
               amx_GetString((result), amx_cstr_);                    \
             else (result) = NULL;                                    \
 }
               amx_GetString((result), amx_cstr_);                    \
             else (result) = NULL;                                    \
 }
index 3e21814..e69de29 100644 (file)
@@ -1,38 +0,0 @@
-/*
- * Copyright 1998-2003, ITB CompuPhase, The Netherlands.
- * info@compuphase.com.
- */
-
-#ifndef EMBRYO_CC_OSDEFS_H
-# define EMBRYO_CC_OSDEFS_H
-
-# ifdef HAVE_STDINT_H
-#  include <stdint.h>
-# endif
-
-/* _MAX_PATH is sometimes called differently and it may be in limits.h instead
- * stdio.h.
- */
-# if !defined _MAX_PATH
-/* not defined, perhaps stdio.h was not included */
-#  include <stdio.h>
-#  if !defined _MAX_PATH
-/* still undefined, try a common alternative name */
-#   if defined MAX_PATH
-#    define _MAX_PATH    MAX_PATH
-#   else
-/* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */
-#    include <limits.h>
-#    if defined PATH_MAX
-#     define _MAX_PATH  PATH_MAX
-#    elif defined _POSIX_PATH_MAX
-#     define _MAX_PATH  _POSIX_PATH_MAX
-#    else
-/* everything failed, actually we have a problem here... */
-#     define _MAX_PATH  4096
-#    endif
-#   endif
-#  endif
-# endif
-
-#endif
index dad6e3c..9b57704 100644 (file)
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/param.h>
-#include <math.h>
-#include <fnmatch.h>
-#include <limits.h>
-#include <ctype.h>
-#include <time.h>
-#include <dirent.h>
-#include <dlfcn.h>      /* dlopen,dlclose,etc */
-#ifdef HAVE_EVIL
-# include <Evil.h>      /* for realpath */
-#else
-# include <pwd.h>
-# include <grp.h>
-# include <glob.h>
-#endif /* ! HAVE_EVIL */
+#include <Eina.h>
 
 #include "embryo_cc_prefix.h"
 
 /* local subsystem functions */
 
 #include "embryo_cc_prefix.h"
 
 /* local subsystem functions */
-static int _e_prefix_share_hunt(void);
-static int _e_prefix_fallbacks(void);
-static int _e_prefix_try_proc(void);
-static int _e_prefix_try_argv(char *argv0);
 
 /* local subsystem globals */
 
 /* local subsystem globals */
-static char *_exe_path = NULL;
-static char *_prefix_path = NULL;
-static char *_prefix_path_bin = NULL;
-static char *_prefix_path_data = NULL;
-static char *_prefix_path_lib = NULL;
-
-#define E_FREE(p) { if (p) {free(p); p = NULL;} }
 
 
-/*#define PREFIX_CACHE_FILE 1*/
-#define SHARE_D "share/embryo"
-#define MAGIC_FILE "include/default.inc"
-#define MAGIC_DAT SHARE_D"/"MAGIC_FILE
+static Eina_Prefix *pfx = NULL;
 
 /* externally accessible functions */
 int
 e_prefix_determine(char *argv0)
 {
 
 /* externally accessible functions */
 int
 e_prefix_determine(char *argv0)
 {
-   char *p, buf[4096];
-   struct stat st;
-
-   e_prefix_shutdown();
-
-   /* if user provides E_PREFIX - then use that or also more specific sub
-    * dirs for bin, lib, data and locale */
-   if (getenv("E_PREFIX"))
-     {
-       _prefix_path = strdup(getenv("E_PREFIX"));
-       if (getenv("E_BIN_DIR"))
-         snprintf(buf, sizeof(buf), "%s/bin", getenv("E_BIN_DIR"));
-       else
-         snprintf(buf, sizeof(buf), "%s/bin", _prefix_path);
-       _prefix_path_bin = strdup(buf);
-
-       if (getenv("E_LIB_DIR"))
-         snprintf(buf, sizeof(buf), "%s/lib", getenv("E_LIB_DIR"));
-       else
-         snprintf(buf, sizeof(buf), "%s/lib", _prefix_path);
-       _prefix_path_lib = strdup(buf);
-
-       if (getenv("E_DATA_DIR"))
-         snprintf(buf, sizeof(buf), "%s/"SHARE_D, getenv("E_DATA_DIR"));
-       else
-         snprintf(buf, sizeof(buf), "%s/"SHARE_D, _prefix_path);
-       _prefix_path_data = strdup(buf);
-       return 1;
-     }
-   /* no env var - examine process and possible argv0 */
-   if (!_e_prefix_try_proc())
-     {
-       if (!_e_prefix_try_argv(argv0))
-         {
-            _e_prefix_fallbacks();
-            return 0;
-         }
-     }
-   /* _exe_path is now a full absolute path TO this exe - figure out rest */
-   /*   if
-    * exe        = /blah/whatever/bin/exe
-    *   then
-    * prefix     = /blah/whatever
-    * bin_dir    = /blah/whatever/bin
-    * data_dir   = /blah/whatever/share/enlightenment
-    * lib_dir    = /blah/whatever/lib
-    */
-   p = strrchr(_exe_path, '/');
-   if (p)
-     {
-       p--;
-       while (p >= _exe_path)
-         {
-            if (*p == '/')
-              {
-                 _prefix_path = malloc(p - _exe_path + 1);
-                 if (_prefix_path)
-                   {
-                      strncpy(_prefix_path, _exe_path, p - _exe_path);
-                      _prefix_path[p - _exe_path] = 0;
-
-                      /* bin and lib always together */
-                      snprintf(buf, sizeof(buf), "%s/bin", _prefix_path);
-                      _prefix_path_bin = strdup(buf);
-                      snprintf(buf, sizeof(buf), "%s/lib", _prefix_path);
-                      _prefix_path_lib = strdup(buf);
-
-                      /* check if AUTHORS file is there - then our guess is right */
-                      snprintf(buf, sizeof(buf), "%s/"MAGIC_DAT, _prefix_path);
-                      if (stat(buf, &st) == 0)
-                        {
-                           snprintf(buf, sizeof(buf), "%s/"SHARE_D, _prefix_path);
-                           _prefix_path_data = strdup(buf);
-                        }
-                      /* AUTHORS file not there. time to start hunting! */
-                      else
-                        {
-                           if (_e_prefix_share_hunt())
-                             {
-                                return 1;
-                             }
-                           else
-                             {
-                                e_prefix_fallback();
-                                return 0;
-                             }
-                        }
-                      return 1;
-                   }
-                 else
-                   {
-                      e_prefix_fallback();
-                      return 0;
-                   }
-              }
-            p--;
-         }
-     }
-   e_prefix_fallback();
-   return 0;
+   if (pfx) return 1;
+   eina_init();
+   pfx = eina_prefix_new(argv0, e_prefix_determine,
+                         "EMBRYO", "embryo", "include/default.inc",
+                         PACKAGE_BIN_DIR,
+                         PACKAGE_LIB_DIR,
+                         PACKAGE_DATA_DIR,
+                         PACKAGE_DATA_DIR);
+   if (!pfx) return 0;
+   return 1;
 }
 
 void
 e_prefix_shutdown(void)
 {
 }
 
 void
 e_prefix_shutdown(void)
 {
-   E_FREE(_exe_path);
-   E_FREE(_prefix_path);
-   E_FREE(_prefix_path_bin);
-   E_FREE(_prefix_path_data);
-   E_FREE(_prefix_path_lib);
-}
-
-void
-e_prefix_fallback(void)
-{
-   e_prefix_shutdown();
-   _e_prefix_fallbacks();
+   eina_prefix_free(pfx);
+   pfx = NULL;
+   eina_shutdown();
 }
 
 const char *
 e_prefix_get(void)
 {
 }
 
 const char *
 e_prefix_get(void)
 {
-   return _prefix_path;
+   return eina_prefix_get(pfx);
 }
 
 const char *
 e_prefix_bin_get(void)
 {
 }
 
 const char *
 e_prefix_bin_get(void)
 {
-   return _prefix_path_bin;
+   return eina_prefix_bin_get(pfx);
 }
 
 const char *
 e_prefix_data_get(void)
 {
 }
 
 const char *
 e_prefix_data_get(void)
 {
-   return _prefix_path_data;
+   return eina_prefix_data_get(pfx);
 }
 
 const char *
 e_prefix_lib_get(void)
 {
 }
 
 const char *
 e_prefix_lib_get(void)
 {
-   return _prefix_path_lib;
-}
-
-/* local subsystem functions */
-static int
-_e_prefix_share_hunt(void)
-{
-   char buf[4096], buf2[4096], *p;
-   struct stat st;
-
-   /* sometimes this isnt the case - so we need to do a more exhaustive search
-    * through more parent and subdirs. hre is an example i have seen:
-    *
-    * /blah/whatever/exec/bin/exe
-    * ->
-    * /blah/whatever/exec/bin
-    * /blah/whatever/common/share/enlightenment
-    * /blah/whatever/exec/lib
-    */
-
-   /* this is pure black magic to try and find data shares */
-   /* 2. cache file doesn't exist or is invalid - we need to search - this is
-    * where the real black magic begins */
-
-   /* BLACK MAGIC 1:
-    * /blah/whatever/dir1/bin
-    * /blah/whatever/dir2/share/enlightenment
-    */
-   if (!_prefix_path_data)
-     {
-       DIR                *dirp;
-       struct dirent      *dp;
-
-       snprintf(buf, sizeof(buf), "%s", _prefix_path);
-       p = strrchr(buf, '/');
-       if (p) *p = 0;
-       dirp = opendir(buf);
-       if (dirp)
-         {
-            char *file;
-
-            while ((dp = readdir(dirp)))
-              {
-                 if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
-                   {
-                      file = dp->d_name;
-                      snprintf(buf2, sizeof(buf2), "%s/%s/"MAGIC_DAT, buf, file);
-                      if (stat(buf2, &st) == 0)
-                        {
-                           snprintf(buf2, sizeof(buf2), "%s/%s/"SHARE_D, buf, file);
-                           _prefix_path_data = strdup(buf2);
-                           break;
-                        }
-                   }
-              }
-            closedir(dirp);
-         }
-     }
-
-   /* BLACK MAGIC 2:
-    * /blah/whatever/dir1/bin
-    * /blah/whatever/share/enlightenment
-    */
-   if (!_prefix_path_data)
-     {
-       snprintf(buf, sizeof(buf), "%s", _prefix_path);
-       p = strrchr(buf, '/');
-       if (p) *p = 0;
-       snprintf(buf2, sizeof(buf2), "%s/"MAGIC_DAT, buf);
-       if (stat(buf, &st) == 0)
-         {
-            snprintf(buf2, sizeof(buf2), "%s/"SHARE_D, buf);
-            _prefix_path_data = strdup(buf2);
-         }
-     }
-
-   /* add more black magic as required as we discover weridnesss - remember
-    * this is to save users having to set environment variables to tell
-    * e where it lives, so e auto-adapts. so these code snippets are just
-    * logic to figure that out for the user
-    */
-
-   /* done. we found it - write cache file */
-   if (_prefix_path_data)
-     {
-       return 1;
-     }
-   /* fail. everything failed */
-   return 0;
-}
-
-static int
-_e_prefix_fallbacks(void)
-{
-   char *p;
-
-   _prefix_path = strdup(PACKAGE_BIN_DIR);
-   p = strrchr(_prefix_path, '/');
-   if (p) *p = 0;
-   _prefix_path_bin    = strdup(PACKAGE_BIN_DIR);
-   _prefix_path_data   = strdup(PACKAGE_DATA_DIR);
-   _prefix_path_lib    = strdup(PACKAGE_LIB_DIR);
-   printf("WARNING: Embryo could not determine its installed prefix\n"
-         "         and is falling back on the compiled in default:\n"
-         "           %s\n"
-         "         You might like to try setting the following environment variables:\n"
-         "           E_PREFIX     - points to the base prefix of install\n"
-         "           E_BIN_DIR    - optional in addition to E_PREFIX to provide\n"
-         "                          a more specific binary directory\n"
-         "           E_LIB_DIR    - optional in addition to E_PREFIX to provide\n"
-         "                          a more specific library dir\n"
-         "           E_DATA_DIR   - optional in addition to E_PREFIX to provide\n"
-         "                          a more specific location for shared data\n"
-         ,
-         _prefix_path);
-   return 1;
-}
-
-static int
-_e_prefix_try_proc(void)
-{
-   FILE *f;
-   char buf[4096];
-   void *func = NULL;
-
-   func = (void *)_e_prefix_try_proc;
-   f = fopen("/proc/self/maps", "r");
-   if (!f) return 0;
-   while (fgets(buf, sizeof(buf), f))
-     {
-       int len;
-       char *p, mode[5] = "";
-       unsigned long ptr1 = 0, ptr2 = 0;
-
-       len = strlen(buf);
-       if (buf[len - 1] == '\n')
-         {
-            buf[len - 1] = 0;
-            len--;
-         }
-       if (sscanf(buf, "%lx-%lx %4s", &ptr1, &ptr2, mode) == 3)
-         {
-            if (!strcmp(mode, "r-xp"))
-              {
-                 if (((void *)ptr1 <= func) && (func < (void *)ptr2))
-                   {
-                      p = strchr(buf, '/');
-                      if (p)
-                        {
-                           if (len > 10)
-                             {
-                                if (!strcmp(buf + len - 10, " (deleted)"))
-                                  buf[len - 10] = 0;
-                             }
-                           _exe_path = strdup(p);
-                           fclose(f);
-                           return 1;
-                        }
-                      else
-                        break;
-                   }
-              }
-         }
-     }
-   fclose(f);
-   return 0;
-}
-
-static int
-_e_prefix_try_argv(char *argv0)
-{
-   char *path, *p, *cp, *s;
-   int len, lenexe;
-   char buf[4096], buf2[4096], buf3[4096];
-
-   /* 1. is argv0 abs path? */
-   if (argv0[0] == '/')
-     {
-       _exe_path = strdup(argv0);
-       if (access(_exe_path, X_OK) == 0) return 1;
-       free(_exe_path);
-       _exe_path = NULL;
-       return 0;
-     }
-   /* 2. relative path */
-   if (strchr(argv0, '/'))
-     {
-       if (getcwd(buf3, sizeof(buf3)))
-         {
-            snprintf(buf2, sizeof(buf2), "%s/%s", buf3, argv0);
-            if (realpath(buf2, buf))
-              {
-                 _exe_path = strdup(buf);
-                 if (access(_exe_path, X_OK) == 0) return 1;
-                 free(_exe_path);
-                 _exe_path = NULL;
-              }
-         }
-     }
-   /* 3. argv0 no path - look in PATH */
-   path = getenv("PATH");
-   if (!path) return 0;
-   p = path;
-   cp = p;
-   lenexe = strlen(argv0);
-   while ((p = strchr(cp, ':')))
-     {
-       len = p - cp;
-       s = malloc(len + 1 + lenexe + 1);
-       if (s)
-         {
-            strncpy(s, cp, len);
-            s[len] = '/';
-            strcpy(s + len + 1, argv0);
-            if (realpath(s, buf))
-              {
-                 if (access(buf, X_OK) == 0)
-                   {
-                      _exe_path = strdup(buf);
-                      free(s);
-                      return 1;
-                   }
-              }
-            free(s);
-         }
-        cp = p + 1;
-     }
-   len = strlen(cp);
-   s = malloc(len + 1 + lenexe + 1);
-   if (s)
-     {
-       strncpy(s, cp, len);
-       s[len] = '/';
-       strcpy(s + len + 1, argv0);
-       if (realpath(s, buf))
-         {
-            if (access(buf, X_OK) == 0)
-              {
-                 _exe_path = strdup(buf);
-                 free(s);
-                 return 1;
-              }
-         }
-       free(s);
-     }
-   /* 4. big problems. arg[0] != executable - weird execution */
-   return 0;
+   return eina_prefix_lib_get(pfx);
 }
 }
index 4bea3f9..d6dc7b2 100644 (file)
@@ -1,10 +1,5 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
 int         e_prefix_determine(char *argv0);
 void        e_prefix_shutdown(void);
 int         e_prefix_determine(char *argv0);
 void        e_prefix_shutdown(void);
-void        e_prefix_fallback(void);
 const char *e_prefix_get(void);
 const char *e_prefix_bin_get(void);
 const char *e_prefix_data_get(void);
 const char *e_prefix_get(void);
 const char *e_prefix_bin_get(void);
 const char *e_prefix_data_get(void);
index 53a4992..9eaf6b8 100644 (file)
 #include <stdarg.h>
 #include <stdio.h>
 #include <setjmp.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <setjmp.h>
-#include "embryo_cc_osdefs.h"
-#include "embryo_cc_amx.h"
 
 
-#if HAVE___ATTRIBUTE__
-#define __UNUSED__ __attribute__((unused))
+#ifndef _MSC_VER
+# include <stdint.h>
 #else
 #else
-#define __UNUSED__
+# include <stddef.h>
+# include <Evil.h>
 #endif
 
 #endif
 
+#include "embryo_cc_amx.h"
+
 /* Note: the "cell" and "ucell" types are defined in AMX.H */
 
 #define PUBLIC_CHAR '@'                /* character that defines a function "public" */
 /* Note: the "cell" and "ucell" types are defined in AMX.H */
 
 #define PUBLIC_CHAR '@'                /* character that defines a function "public" */
 
 #define sDIMEN_MAX     2       /* maximum number of array dimensions */
 #define sDEF_LITMAX  500       /* initial size of the literal pool, in "cells" */
 
 #define sDIMEN_MAX     2       /* maximum number of array dimensions */
 #define sDEF_LITMAX  500       /* initial size of the literal pool, in "cells" */
-#define sLINEMAX     65535     /* input line length (in characters) */
+#define sLINEMAX (640 * 1024)  /* input line length (in characters) */
 #define sDEF_AMXSTACK 4096     /* default stack size for AMX files */
 #define sSTKMAX       80       /* stack for nested #includes and other uses */
 #define PREPROC_TERM  '\x7f'   /* termination character for preprocessor expressions (the "DEL" code) */
 #define sDEF_PREFIX   "default.inc"    /* default prefix filename */
 
 #define sDEF_AMXSTACK 4096     /* default stack size for AMX files */
 #define sSTKMAX       80       /* stack for nested #includes and other uses */
 #define PREPROC_TERM  '\x7f'   /* termination character for preprocessor expressions (the "DEL" code) */
 #define sDEF_PREFIX   "default.inc"    /* default prefix filename */
 
-typedef void       *stkitem;   /* type of items stored on the stack */
+typedef intptr_t stkitem;      /* type of items stored on the stack */
 
 typedef struct __s_arginfo
 {                              /* function argument info */
 
 typedef struct __s_arginfo
 {                              /* function argument info */
@@ -663,4 +664,10 @@ extern FILE      *outf;    /* file written to */
 
 extern jmp_buf    errbuf;      /* target of longjmp() on a fatal error */
 
 
 extern jmp_buf    errbuf;      /* target of longjmp() on a fatal error */
 
+#define sc_isspace(x)  isspace ((int)((unsigned char)x))
+#define sc_isalpha(x)  isalpha ((int)((unsigned char)x))
+#define sc_isdigit(x)  isdigit ((int)((unsigned char)x))
+#define sc_isupper(x)  isupper ((int)((unsigned char)x))
+#define sc_isxdigit(x) isxdigit((int)((unsigned char)x))
+
 #endif
 #endif
index c34688e..9ee3ad8 100644 (file)
@@ -1,7 +1,4 @@
-/*
- *  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
  *  Function and variable definition and declaration, statement parser.
  *
  *  Copyright (c) ITB CompuPhase, 1997-2003
@@ -24,9 +21,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
 #ifdef HAVE_EVIL
 # include <Evil.h>
 #endif /* HAVE_EVIL */
 
 #ifdef HAVE_EVIL
 # include <Evil.h>
 #endif /* HAVE_EVIL */
 
-#include "embryo_cc_osdefs.h"
 #include "embryo_cc_sc.h"
 #include "embryo_cc_prefix.h"
 
 #include "embryo_cc_sc.h"
 #include "embryo_cc_prefix.h"
 
@@ -117,36 +114,12 @@ static int          rettype = 0;  /* the type that a "return" expression should h
 static int          skipinput = 0;     /* number of lines to skip from the first input file */
 static int          wq[wqTABSZ];       /* "while queue", internal stack for nested loops */
 static int         *wqptr;     /* pointer to next entry */
 static int          skipinput = 0;     /* number of lines to skip from the first input file */
 static int          wq[wqTABSZ];       /* "while queue", internal stack for nested loops */
 static int         *wqptr;     /* pointer to next entry */
-static char         binfname[_MAX_PATH];       /* binary file name */
+static char         binfname[PATH_MAX];        /* binary file name */
 
 int
 main(int argc, char *argv[], char *env[] __UNUSED__)
 {
 
 int
 main(int argc, char *argv[], char *env[] __UNUSED__)
 {
-   char                argv0[_MAX_PATH];
-   int                 i;
-
-   snprintf(argv0, _MAX_PATH, "%s", argv[0]);
-   /* Linux stores the name of the program in argv[0], but not the path.
-    * To adjust this, I store a string with the path in argv[0]. To do
-    * 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, _MAX_PATH))
-     {
-       i = strlen(argv0);
-       snprintf(argv0 + i, _MAX_PATH - i, "/%s", argv[0]);
-     }
-   else
-     {
-       char               *pwd = getenv("PWD");
-
-       if (pwd != NULL)
-          snprintf(argv0, _MAX_PATH, "%s/%s", pwd, argv[0]);
-     }                         /* if */
-   argv[0] = argv0;            /* set location to new first parameter */
-
-   e_prefix_determine(argv0);
-
+   e_prefix_determine(argv[0]);
    return sc_compile(argc, argv);
 }
 
    return sc_compile(argc, argv);
 }
 
@@ -224,7 +197,7 @@ sc_openasm(int fd)
 void
 sc_closeasm(void *handle)
 {
 void
 sc_closeasm(void *handle)
 {
-   if (handle != NULL)
+   if (handle)
       fclose((FILE *) handle);
 }
 
       fclose((FILE *) handle);
 }
 
@@ -287,8 +260,8 @@ sc_compile(int argc, char *argv[])
 {
    int                 entry, i, jmpcode, fd_out;
    int                 retcode;
 {
    int                 entry, i, jmpcode, fd_out;
    int                 retcode;
-   char                incfname[_MAX_PATH];
-   char                reportname[_MAX_PATH];
+   char                incfname[PATH_MAX];
+   char                reportname[PATH_MAX];
    FILE               *binf;
    void               *inpfmark;
    char                lcl_ctrlchar;
    FILE               *binf;
    void               *inpfmark;
    char                lcl_ctrlchar;
@@ -308,9 +281,9 @@ sc_compile(int argc, char *argv[])
       goto cleanup;
 
    /* allocate memory for fixed tables */
       goto cleanup;
 
    /* allocate memory for fixed tables */
-   inpfname = (char *)malloc(_MAX_PATH);
+   inpfname = (char *)malloc(PATH_MAX);
    litq = (cell *) malloc(litmax * sizeof(cell));
    litq = (cell *) malloc(litmax * sizeof(cell));
-   if (litq == NULL)
+   if (!litq)
       error(103);              /* insufficient memory */
    if (!phopt_init())
       error(103);              /* insufficient memory */
       error(103);              /* insufficient memory */
    if (!phopt_init())
       error(103);              /* insufficient memory */
@@ -326,33 +299,31 @@ sc_compile(int argc, char *argv[])
    tmpdir = (char *)evil_tmpdir_get();
 #endif /* ! HAVE_EVIL */
 
    tmpdir = (char *)evil_tmpdir_get();
 #endif /* ! HAVE_EVIL */
 
-   snprintf(outfname, _MAX_PATH, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
+   snprintf(outfname, PATH_MAX, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
    fd_out = mkstemp(outfname);
    if (fd_out < 0)
      error(101, outfname);
 
    fd_out = mkstemp(outfname);
    if (fd_out < 0)
      error(101, outfname);
 
-   unlink (outfname); /* kill this file as soon as it's (f)close'd */
-
    setconfig(argv[0]);         /* the path to the include files */
    lcl_ctrlchar = sc_ctrlchar;
    lcl_packstr = sc_packstr;
    lcl_needsemicolon = sc_needsemicolon;
    lcl_tabsize = sc_tabsize;
    inpf = inpf_org = (FILE *) sc_opensrc(inpfname);
    setconfig(argv[0]);         /* the path to the include files */
    lcl_ctrlchar = sc_ctrlchar;
    lcl_packstr = sc_packstr;
    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) */
       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);
       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 */
      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;
         fline++;               /* keep line number up to date */
    skipinput = fline;
    sc_status = statFIRST;
@@ -425,7 +396,7 @@ sc_compile(int argc, char *argv[])
       error(13);               /* no entry point (no public functions) */
 
  cleanup:
       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_closesrc(inpf);
    /* write the binary file (the file is already open) */
    if (errnum == 0 && jmpcode == 0)
@@ -434,14 +405,15 @@ sc_compile(int argc, char *argv[])
        sc_resetasm(outf);      /* flush and loop back, for reading */
        assemble(binf, outf);   /* assembler file is now input */
      }                         /* if */
        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);
       sc_closeasm(outf);
-   if (binf != NULL)
+   unlink (outfname);
+   if (binf)
       sc_closebin(binf, errnum != 0);
 
       sc_closebin(binf, errnum != 0);
 
-   if (inpfname != NULL)
+   if (inpfname)
       free(inpfname);
       free(inpfname);
-   if (litq != NULL)
+   if (litq)
       free(litq);
    phopt_cleanup();
    stgbuffer_cleanup();
       free(litq);
    phopt_cleanup();
    stgbuffer_cleanup();
@@ -492,7 +464,7 @@ sc_addtag(char *name)
    constvalue         *ptr;
    int                 last, tag;
 
    constvalue         *ptr;
    int                 last, tag;
 
-   if (name == NULL)
+   if (!name)
      {
        /* no tagname was given, check for one */
        if (lex(&val, &name) != tLABEL)
      {
        /* no tagname was given, check for one */
        if (lex(&val, &name) != tLABEL)
@@ -504,7 +476,7 @@ sc_addtag(char *name)
 
    last = 0;
    ptr = tagname_tab.next;
 
    last = 0;
    ptr = tagname_tab.next;
-   while (ptr != NULL)
+   while (ptr)
      {
        tag = (int)(ptr->value & TAGMASK);
        if (strcmp(name, ptr->name) == 0)
      {
        tag = (int)(ptr->value & TAGMASK);
        if (strcmp(name, ptr->name) == 0)
@@ -517,7 +489,7 @@ sc_addtag(char *name)
 
    /* tagname currently unknown, add it */
    tag = last + 1;             /* guaranteed not to exist already */
 
    /* tagname currently unknown, add it */
    tag = last + 1;             /* guaranteed not to exist already */
-   if (isupper(*name))
+   if (sc_isupper(*name))
       tag |= (int)FIXEDTAG;
    append_constval(&tagname_tab, name, (cell) tag, 0);
    return tag;
       tag |= (int)FIXEDTAG;
    append_constval(&tagname_tab, name, (cell) tag, 0);
    return tag;
@@ -677,20 +649,22 @@ setopt(int argc, char **argv, char *iname, char *oname,
 static void
 setconfig(char *root)
 {
 static void
 setconfig(char *root)
 {
-   char                path[_MAX_PATH];
+   char                path[PATH_MAX];
    char               *ptr;
    int                 len;
 
    char               *ptr;
    int                 len;
 
+   path[sizeof(path) - 1] = 0;
+
    /* add the default "include" directory */
    /* 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 : */
      {
        /* 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
      {
        /* If there was no terminating "\" or ":",
         * the filename probably does not
@@ -831,7 +805,7 @@ parse(void)
          case tSTATIC:
             /* This can be a static function or a static global variable;
              * we know which of the two as soon as we have parsed up to the
          case tSTATIC:
             /* This can be a static function or a static global variable;
              * we know which of the two as soon as we have parsed up to the
-             * point where an opening paranthesis of a function would be
+             * point where an opening parenthesis of a function would be
              * expected. To back out after deciding it was a declaration of
              * a static variable after all, we have to store the symbol name
              * and tag.
              * expected. To back out after deciding it was a declaration of
              * a static variable after all, we have to store the symbol name
              * and tag.
@@ -1045,7 +1019,7 @@ declglb(char *firstname, int firsttag, int fpublic, int fstatic,
        size = 1;               /* single size (no array) */
        numdim = 0;             /* no dimensions */
        ident = iVARIABLE;
        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 */
          {
             assert(strlen(firstname) <= sNAMEMAX);
             strcpy(name, firstname);   /* save symbol name */
@@ -1061,9 +1035,9 @@ declglb(char *firstname, int firsttag, int fpublic, int fstatic,
             strcpy(name, str); /* save symbol name */
          }                     /* if */
        sym = findglb(name);
             strcpy(name, str); /* save symbol name */
          }                     /* if */
        sym = findglb(name);
-       if (sym == NULL)
+       if (!sym)
           sym = findconst(name);
           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)
           error(21, name);     /* symbol already defined */
        ispublic = fpublic;
        if (name[0] == PUBLIC_CHAR)
@@ -1097,7 +1071,7 @@ declglb(char *firstname, int firsttag, int fpublic, int fstatic,
         * for public variables
         */
        cidx = 0;               /* only to avoid a compiler warning */
         * 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;
            && (sym->usage & (uREAD | uWRITTEN | uPUBLIC)) == 0)
          {
             sc_status = statSKIP;
@@ -1124,7 +1098,7 @@ declglb(char *firstname, int firsttag, int fpublic, int fstatic,
        dumplits();             /* dump the literal queue */
        dumpzero((int)size - litidx);
        litidx = 0;
        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,
          {                     /* define only if not yet defined */
             sym =
                addvariable(name, sizeof(cell) * glb_declared, ident, sGLOBAL,
@@ -1204,14 +1178,14 @@ declloc(int fstatic)
         * the "nesting level" of local variables to verify the
         * multi-definition of symbols.
         */
         * 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.
         */
           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('['))
          {
           error(219, name);    /* variable shadows another symbol */
        while (matchtoken('['))
          {
@@ -1713,7 +1687,7 @@ fetchfunc(char *name, int tag)
         * symbol instruction.
         */
      }                         /* if */
         * symbol instruction.
         */
      }                         /* if */
-   if ((sym = findglb(name)) != 0)
+   if ((sym = findglb(name)))
      {                         /* already in symbol table? */
        if (sym->ident != iFUNCTN)
          {
      {                         /* already in symbol table? */
        if (sym->ident != iFUNCTN)
          {
@@ -1761,7 +1735,7 @@ define_args(void)
     * local symbols are function arguments.
     */
    sym = loctab.next;
     * local symbols are function arguments.
     */
    sym = loctab.next;
-   while (sym != NULL)
+   while (sym)
      {
        assert(sym->ident != iLABEL);
        assert(sym->vclass == sLOCAL);
      {
        assert(sym->ident != iLABEL);
        assert(sym->vclass == sLOCAL);
@@ -1770,7 +1744,7 @@ define_args(void)
          {
             symbol             *sub = sym;
 
          {
             symbol             *sub = sym;
 
-            while (sub != NULL)
+            while (sub)
               {
                  symbolrange(sub->dim.array.level, sub->dim.array.length);
                  sub = finddepend(sub);
               {
                  symbolrange(sub->dim.array.level, sub->dim.array.length);
                  sub = finddepend(sub);
@@ -1907,7 +1881,7 @@ operatoradjust(int opertok, symbol * sym, char *opername, int resulttag)
    /* change the operator name */
    assert(opername[0] != '\0');
    operator_symname(tmpname, opername, tags[0], tags[1], count, resulttag);
    /* 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;
 
      {
        int                 i;
 
@@ -1921,7 +1895,7 @@ operatoradjust(int opertok, symbol * sym, char *opername, int resulttag)
        sym->usage |= oldsym->usage;    /* copy flags from the previous
                                         * definition */
        for (i = 0; i < oldsym->numrefers; 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 */
              refer_symbol(sym, oldsym->refer[i]);
        delete_symbol(&glbtab, oldsym);
      }                         /* if */
@@ -1975,7 +1949,7 @@ tag2str(char *dest, int tag)
    tag &= TAGMASK;
    assert(tag >= 0);
    sprintf(dest, "0%x", tag);
    tag &= TAGMASK;
    assert(tag >= 0);
    sprintf(dest, "0%x", tag);
-   return isdigit(dest[1]) ? &dest[1] : dest;
+   return sc_isdigit(dest[1]) ? &dest[1] : dest;
 }
 
 char       *
 }
 
 char       *
@@ -2021,7 +1995,7 @@ parse_funcname(char *fname, int *tag1, int *tag2, char *opname)
      }                         /* if */
    assert(!unary || *tag1 == 0);
    assert(*ptr != '\0');
      }                         /* if */
    assert(!unary || *tag1 == 0);
    assert(*ptr != '\0');
-   for (name = opname; !isdigit(*ptr);)
+   for (name = opname; !sc_isdigit(*ptr);)
       *name++ = *ptr++;
    *name = '\0';
    *tag2 = (int)strtol(ptr, NULL, 16);
       *name++ = *ptr++;
    *name = '\0';
    *tag2 = (int)strtol(ptr, NULL, 16);
@@ -2036,7 +2010,7 @@ funcdisplayname(char *dest, char *funcname)
    constvalue         *tagsym[2];
    int                 unary;
 
    constvalue         *tagsym[2];
    int                 unary;
 
-   if (isalpha(*funcname) || *funcname == '_' || *funcname == PUBLIC_CHAR
+   if (sc_isalpha(*funcname) || *funcname == '_' || *funcname == PUBLIC_CHAR
        || *funcname == '\0')
      {
        if (dest != funcname)
        || *funcname == '\0')
      {
        if (dest != funcname)
@@ -2113,7 +2087,7 @@ funcstub(int native)
 
    sym = fetchfunc(symbolname, tag);   /* get a pointer to the
                                         * function entry */
 
    sym = fetchfunc(symbolname, tag);   /* get a pointer to the
                                         * function entry */
-   if (sym == NULL)
+   if (!sym)
       return;
    if (native)
      {
       return;
    if (native)
      {
@@ -2202,7 +2176,7 @@ newfunc(char *firstname, int firsttag, int fpublic, int fstatic, int stock)
    glbdecl = 0;
    filenum = fcurrent;         /* save file number at start of declaration */
 
    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 */
      {
        assert(strlen(firstname) <= sNAMEMAX);
        strcpy(symbolname, firstname);  /* save symbol name */
@@ -2246,7 +2220,7 @@ newfunc(char *firstname, int firsttag, int fpublic, int fstatic, int stock)
      }                         /* if */
    sym = fetchfunc(symbolname, tag);   /* get a pointer to the
                                         * function entry */
      }                         /* if */
    sym = fetchfunc(symbolname, tag);   /* get a pointer to the
                                         * function entry */
-   if (sym == NULL)
+   if (!sym)
       return TRUE;
    if (fpublic)
       sym->usage |= uPUBLIC;
       return TRUE;
    if (fpublic)
       sym->usage |= uPUBLIC;
@@ -2520,7 +2494,7 @@ declargs(symbol * sym)
                       sym->dim.arglist =
                          (arginfo *) realloc(sym->dim.arglist,
                                              (argcnt + 2) * sizeof(arginfo));
                       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
                          error(103);   /* insufficient memory */
                       sym->dim.arglist[argcnt] = arg;
                       sym->dim.arglist[argcnt + 1].ident = 0;  /* keep the list
@@ -2557,7 +2531,7 @@ declargs(symbol * sym)
                       sym->dim.arglist =
                          (arginfo *) realloc(sym->dim.arglist,
                                              (argcnt + 2) * sizeof(arginfo));
                       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 */
                          error(103);   /* insufficient memory */
                       sym->dim.arglist[argcnt + 1].ident = 0;  /* keep the list
                                                                 * terminated */
@@ -2568,7 +2542,7 @@ declargs(symbol * sym)
                       sym->dim.arglist[argcnt].numtags = numtags;
                       sym->dim.arglist[argcnt].tags =
                          (int *)malloc(numtags * sizeof tags[0]);
                       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]);
                          error(103);   /* insufficient memory */
                       memcpy(sym->dim.arglist[argcnt].tags, tags,
                              numtags * sizeof tags[0]);
@@ -2700,7 +2674,7 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
             assert(size >= litidx);
             /* allocate memory to hold the initial values */
             arg->defvalue.array.data = (cell *) malloc(litidx * sizeof(cell));
             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;
 
               {
                  int                 i;
 
@@ -2708,7 +2682,7 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
                  arg->hasdefault = TRUE;       /* argument has default value */
                  arg->defvalue.array.size = litidx;
                  arg->defvalue.array.addr = -1;
                  arg->hasdefault = TRUE;       /* argument has default value */
                  arg->defvalue.array.size = litidx;
                  arg->defvalue.array.addr = -1;
-                 /* calulate size to reserve on the heap */
+                 /* calculate size to reserve on the heap */
                  arg->defvalue.array.arraysize = 1;
                  for (i = 0; i < arg->numdim; i++)
                     arg->defvalue.array.arraysize *= arg->dim[i];
                  arg->defvalue.array.arraysize = 1;
                  for (i = 0; i < arg->numdim; i++)
                     arg->defvalue.array.arraysize *= arg->dim[i];
@@ -2747,8 +2721,7 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
                       cell                val;
 
                       tokeninfo(&val, &name);
                       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)
                          error(103);   /* insufficient memory */
                       arg->defvalue.size.level = 0;
                       if (size_tag_token == uSIZEOF)
@@ -2779,17 +2752,17 @@ doarg(char *name, int ident, int offset, int tags[], int numtags,
    arg->usage = (char)(fconst ? uCONST : 0);
    arg->numtags = numtags;
    arg->tags = (int *)malloc(numtags * sizeof tags[0]);
    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);
       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
      {
      {
        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);
           error(219, name);    /* variable shadows another symbol */
        /* add details of type and address */
        assert(numtags > 0);
@@ -2813,7 +2786,7 @@ count_referrers(symbol * entry)
 
    count = 0;
    for (i = 0; i < entry->numrefers; i++)
 
    count = 0;
    for (i = 0; i < entry->numrefers; i++)
-      if (entry->refer[i] != NULL)
+      if (entry->refer[i])
         count++;
    return count;
 }
         count++;
    return count;
 }
@@ -2832,9 +2805,9 @@ reduce_referrers(symbol * root)
    do
      {
        restart = 0;
    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
                continue;       /* hierarchical data type */
             if (sym->ident == iFUNCTN
                 && (sym->usage & uNATIVE) == 0
@@ -2845,9 +2818,9 @@ reduce_referrers(symbol * root)
                  sym->usage &= ~(uREAD | uWRITTEN);    /* erase usage bits if
                                                         * there is no referrer */
                  /* find all symbols that are referred by this symbol */
                  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;
                          continue;     /* hierarchical data type */
                       assert(ref->refer != NULL);
                       for (i = 0; i < ref->numrefers && ref->refer[i] != sym;
@@ -2863,7 +2836,7 @@ reduce_referrers(symbol * root)
               }
             else if ((sym->ident == iVARIABLE || sym->ident == iARRAY)
                      && (sym->usage & uPUBLIC) == 0
               }
             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 */
               {
                  sym->usage &= ~(uREAD | uWRITTEN);    /* erase usage bits if
                                                         * there is no referrer */
@@ -2895,7 +2868,7 @@ testsymbols(symbol * root, int level, int testlabs, int testconst)
 
    symbol             *sym = root->next;
 
 
    symbol             *sym = root->next;
 
-   while (sym != NULL && sym->compound >= level)
+   while (sym && sym->compound >= level)
      {
        switch (sym->ident)
          {
      {
        switch (sym->ident)
          {
@@ -2926,7 +2899,7 @@ testsymbols(symbol * root, int level, int testlabs, int testconst)
             break;
          default:
             /* a variable */
             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
                break;          /* hierarchical data type */
             if ((sym->usage & (uWRITTEN | uREAD | uSTOCK | uPUBLIC)) == 0)
                error(203, sym->name);  /* symbol isn't used (and not stock
@@ -2959,7 +2932,7 @@ calc_array_datasize(symbol * sym, cell * offset)
      {
        cell                sublength =
           calc_array_datasize(finddepend(sym), offset);
      {
        cell                sublength =
           calc_array_datasize(finddepend(sym), offset);
-       if (offset != NULL)
+       if (offset)
           *offset = length * (*offset + sizeof(cell));
        if (sublength > 0)
           length *= length * sublength;
           *offset = length * (*offset + sizeof(cell));
        if (sublength > 0)
           length *= length * sublength;
@@ -2968,7 +2941,7 @@ calc_array_datasize(symbol * sym, cell * offset)
      }
    else
      {
      }
    else
      {
-       if (offset != NULL)
+       if (offset)
           *offset = 0;
      }                         /* if */
    return length;
           *offset = 0;
      }                         /* if */
    return length;
@@ -2981,7 +2954,7 @@ destructsymbols(symbol * root, int level)
    int                 savepri = FALSE;
    symbol             *sym = root->next;
 
    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)
          {
      {
        if (sym->ident == iVARIABLE || sym->ident == iARRAY)
          {
@@ -2991,9 +2964,9 @@ destructsymbols(symbol * root, int level)
 
             /* check that the '~' operator is defined for this tag */
             operator_symname(symbolname, "~", sym->tag, 0, 1, 0);
 
             /* 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 */
+                 /* save PRI, in case of a return statement */
                  if (!savepri)
                    {
                       push1(); /* right-hand operand is in PRI */
                  if (!savepri)
                    {
                       push1(); /* right-hand operand is in PRI */
@@ -3025,7 +2998,7 @@ destructsymbols(symbol * root, int level)
                  if (sc_status != statSKIP)
                     markusage(opsym, uREAD);   /* do not mark as "used" when this
                                                 * call itself is skipped */
                  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 */
                     opsym->x.lib->value += 1;  /* increment "usage count"
                                                 * of the library */
               }                /* if */
@@ -3039,41 +3012,41 @@ destructsymbols(symbol * root, int level)
 
 static constvalue  *
 insert_constval(constvalue * prev, constvalue * next, char *name,
 
 static constvalue  *
 insert_constval(constvalue * prev, constvalue * next, char *name,
-               cell val, short index)
+               cell val, short idx)
 {
    constvalue         *cur;
 
 {
    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);
    cur->value = val;
       error(103);              /* insufficient memory (fatal error) */
    memset(cur, 0, sizeof(constvalue));
    strcpy(cur->name, name);
    cur->value = val;
-   cur->index = index;
+   cur->index = idx;
    cur->next = next;
    prev->next = cur;
    return cur;
 }
 
 constvalue *
    cur->next = next;
    prev->next = cur;
    return cur;
 }
 
 constvalue *
-append_constval(constvalue * table, char *name, cell val, short index)
+append_constval(constvalue * table, char *name, cell val, short idx)
 {
    constvalue         *cur, *prev;
 
    /* find the end of the constant table */
 {
    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 */ ;
        prev = cur, cur = cur->next)
       /* nothing */ ;
-   return insert_constval(prev, NULL, name, val, index);
+   return insert_constval(prev, NULL, name, val, idx);
 }
 
 constvalue *
 }
 
 constvalue *
-find_constval(constvalue * table, char *name, short index)
+find_constval(constvalue * table, char *name, short idx)
 {
    constvalue         *ptr = table->next;
 
 {
    constvalue         *ptr = table->next;
 
-   while (ptr != NULL)
+   while (ptr)
      {
      {
-       if (strcmp(name, ptr->name) == 0 && ptr->index == index)
+       if (strcmp(name, ptr->name) == 0 && ptr->index == idx)
           return ptr;
        ptr = ptr->next;
      }                         /* while */
           return ptr;
        ptr = ptr->next;
      }                         /* while */
@@ -3085,7 +3058,7 @@ find_constval_byval(constvalue * table, cell val)
 {
    constvalue         *ptr = table->next;
 
 {
    constvalue         *ptr = table->next;
 
-   while (ptr != NULL)
+   while (ptr)
      {
        if (ptr->value == val)
           return ptr;
      {
        if (ptr->value == val)
           return ptr;
@@ -3121,7 +3094,7 @@ delete_consttable(constvalue * table)
 {
    constvalue         *cur = table->next, *next;
 
 {
    constvalue         *cur = table->next, *next;
 
-   while (cur != NULL)
+   while (cur)
      {
        next = cur->next;
        free(cur);
      {
        next = cur->next;
        free(cur);
@@ -3190,7 +3163,7 @@ statement(int *lastindent, int allow_decl)
    if (tok != '{')
       setline(fline, fcurrent);
    /* lex() has set stmtindent */
    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 0
        if (*lastindent >= 0 && *lastindent != stmtindent &&
@@ -3355,7 +3328,7 @@ static void
 doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
        int *tag, int chkfuncresult)
 {
 doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
        int *tag, int chkfuncresult)
 {
-   int                 constant, index, ident;
+   int                 constant, idx, ident;
    int                 localstaging = FALSE;
    cell                val;
 
    int                 localstaging = FALSE;
    cell                val;
 
@@ -3365,12 +3338,12 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
        localstaging = TRUE;
        assert(stgidx == 0);
      }                         /* if */
        localstaging = TRUE;
        assert(stgidx == 0);
      }                         /* if */
-   index = stgidx;
+   idx = stgidx;
    errorset(sEXPRMARK);
    do
      {
        /* on second round through, mark the end of the previous expression */
    errorset(sEXPRMARK);
    do
      {
        /* on second round through, mark the end of the previous expression */
-       if (index != stgidx)
+       if (idx != stgidx)
           endexpr(TRUE);
        sideeffect = FALSE;
        ident = expression(&constant, &val, tag, chkfuncresult);
           endexpr(TRUE);
        sideeffect = FALSE;
        ident = expression(&constant, &val, tag, chkfuncresult);
@@ -3385,7 +3358,7 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
    errorset(sEXPRRELEASE);
    if (localstaging)
      {
    errorset(sEXPRRELEASE);
    if (localstaging)
      {
-       stgout(index);
+       stgout(idx);
        stgset(FALSE);          /* stop staging */
      }                         /* if */
 }
        stgset(FALSE);          /* stop staging */
      }                         /* if */
 }
@@ -3395,14 +3368,14 @@ doexpr(int comma, int chkeffect, int allowarray, int mark_endexpr,
 int
 constexpr(cell * val, int *tag)
 {
 int
 constexpr(cell * val, int *tag)
 {
-   int                 constant, index;
+   int                 constant, idx;
    cell                cidx;
 
    stgset(TRUE);               /* start stage-buffering */
    cell                cidx;
 
    stgset(TRUE);               /* start stage-buffering */
-   stgget(&index, &cidx);      /* mark position in code generator */
+   stgget(&idx, &cidx);        /* mark position in code generator */
    errorset(sEXPRMARK);
    expression(&constant, val, tag, FALSE);
    errorset(sEXPRMARK);
    expression(&constant, val, tag, FALSE);
-   stgdel(index, cidx);                /* scratch generated code */
+   stgdel(idx, cidx);          /* scratch generated code */
    stgset(FALSE);              /* stop stage-buffering */
    if (constant == 0)
       error(8);                        /* must be constant expression */
    stgset(FALSE);              /* stop stage-buffering */
    if (constant == 0)
       error(8);                        /* must be constant expression */
@@ -3424,7 +3397,7 @@ constexpr(cell * val, int *tag)
 static void
 test(int label, int parens, int invert)
 {
 static void
 test(int label, int parens, int invert)
 {
-   int                 index, tok;
+   int                 idx, tok;
    cell                cidx;
    value               lval = { NULL, 0, 0, 0, 0, NULL };
    int                 localstaging = FALSE;
    cell                cidx;
    value               lval = { NULL, 0, 0, 0, 0, NULL };
    int                 localstaging = FALSE;
@@ -3434,20 +3407,19 @@ test(int label, int parens, int invert)
        stgset(TRUE);           /* start staging */
        localstaging = TRUE;
 #if !defined NDEBUG
        stgset(TRUE);           /* start staging */
        localstaging = TRUE;
 #if !defined NDEBUG
-       stgget(&index, &cidx);  /* should start at zero if started
+       stgget(&idx, &cidx);    /* should start at zero if started
                                 * locally */
                                 * locally */
-       assert(index == 0);
+       assert(idx == 0);
 #endif
      }                         /* if */
 
 #endif
      }                         /* if */
 
-   /* FIXME: 64bit unsafe! putting an int on a stack of void *'s */
    pushstk((stkitem) intest);
    intest = 1;
    if (parens)
       needtoken('(');
    do
      {
    pushstk((stkitem) intest);
    intest = 1;
    if (parens)
       needtoken('(');
    do
      {
-       stgget(&index, &cidx);  /* mark position (of last expression) in
+       stgget(&idx, &cidx);    /* mark position (of last expression) in
                                 * code generator */
        if (hier14(&lval))
           rvalue(&lval);
                                 * code generator */
        if (hier14(&lval))
           rvalue(&lval);
@@ -3461,13 +3433,13 @@ test(int label, int parens, int invert)
    if (lval.ident == iARRAY || lval.ident == iREFARRAY)
      {
        char               *ptr =
    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)
      {                         /* constant expression */
        intest = (int)(long)popstk();   /* restore stack */
        error(33, ptr);         /* array must be indexed */
      }                         /* if */
    if (lval.ident == iCONSTEXPR)
      {                         /* constant expression */
        intest = (int)(long)popstk();   /* restore stack */
-       stgdel(index, cidx);
+       stgdel(idx, cidx);
        if (lval.constval)
          {                     /* code always executed */
             error(206);        /* redundant test: always non-zero */
        if (lval.constval)
          {                     /* code always executed */
             error(206);        /* redundant test: always non-zero */
@@ -3579,7 +3551,7 @@ dofor(void)
 {
    int                 wq[wqSIZE], skiplab;
    cell                save_decl;
 {
    int                 wq[wqSIZE], skiplab;
    cell                save_decl;
-   int                 save_nestlevel, index;
+   int                 save_nestlevel, idx;
    int                *ptr;
 
    save_decl = declared;
    int                *ptr;
 
    save_decl = declared;
@@ -3625,7 +3597,7 @@ dofor(void)
    assert(!staging);
    stgset(TRUE);               /* start staging */
    assert(stgidx == 0);
    assert(!staging);
    stgset(TRUE);               /* start staging */
    assert(stgidx == 0);
-   index = stgidx;
+   idx = stgidx;
    stgmark(sSTARTREORDER);
    stgmark((char)(sEXPRSTART + 0));    /* mark start of 2nd expression
                                         * in stage */
    stgmark(sSTARTREORDER);
    stgmark((char)(sEXPRSTART + 0));    /* mark start of 2nd expression
                                         * in stage */
@@ -3644,7 +3616,7 @@ dofor(void)
        needtoken(')');
      }                         /* if */
    stgmark(sENDREORDER);       /* mark end of reversed evaluation */
        needtoken(')');
      }                         /* if */
    stgmark(sENDREORDER);       /* mark end of reversed evaluation */
-   stgout(index);
+   stgout(idx);
    stgset(FALSE);              /* stop staging */
    statement(NULL, FALSE);
    jumplabel(wq[wqLOOP]);
    stgset(FALSE);              /* stop staging */
    statement(NULL, FALSE);
    jumplabel(wq[wqLOOP]);
@@ -3734,10 +3706,10 @@ doswitch(void)
                   * case values at the same time.
                   */
                  for (csp = &caselist, cse = caselist.next;
                   * 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 */ ;
                       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
                     error(40, val);    /* duplicate "case" label */
                  /* Since the label is stored as a string in the
                   * "constvalue", the size of an identifier must
@@ -3760,10 +3732,10 @@ doswitch(void)
                            casecount++;
                            /* find the new insertion point */
                            for (csp = &caselist, cse = caselist.next;
                            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 */ ;
                                 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 */
                               error(40, val);  /* duplicate "case" label */
                            insert_constval(csp, cse, itoh(lbl_case), val, 0);
                         }      /* if */
@@ -3802,10 +3774,10 @@ doswitch(void)
    while (tok != '}');
 
 #if !defined NDEBUG
    while (tok != '}');
 
 #if !defined NDEBUG
-   /* verify that the case table is sorted (unfortunatly, duplicates can
+   /* verify that the case table is sorted (unfortunately, 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). */
     * 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.
      ; /* 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.
@@ -3827,7 +3799,7 @@ doswitch(void)
      }                         /* if */
    ffcase(casecount, labelname, TRUE);
    /* generate the rest of the table */
      }                         /* 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);
       ffcase(cse->value, cse->name, FALSE);
 
    setlabel(lbl_exit);
@@ -3837,7 +3809,7 @@ doswitch(void)
 static void
 doassert(void)
 {
 static void
 doassert(void)
 {
-   int                 flab1, index;
+   int                 flab1, idx;
    cell                cidx;
    value               lval = { NULL, 0, 0, 0, 0, NULL };
 
    cell                cidx;
    value               lval = { NULL, 0, 0, 0, 0, NULL };
 
@@ -3854,12 +3826,12 @@ doassert(void)
    else
      {
        stgset(TRUE);           /* start staging */
    else
      {
        stgset(TRUE);           /* start staging */
-       stgget(&index, &cidx);  /* mark position in code generator */
+       stgget(&idx, &cidx);    /* mark position in code generator */
        do
          {
             if (hier14(&lval))
                rvalue(&lval);
        do
          {
             if (hier14(&lval))
                rvalue(&lval);
-            stgdel(index, cidx);       /* just scrap the code */
+            stgdel(idx, cidx); /* just scrap the code */
          }
        while (matchtoken(','));
        stgset(FALSE);          /* stop staging */
          }
        while (matchtoken(','));
        stgset(FALSE);          /* stop staging */
@@ -3900,7 +3872,7 @@ dolabel(void)
    symbol             *sym;
 
    tokeninfo(&val, &st);       /* retrieve label name again */
    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);
       error(221, st);          /* label name shadows tagname */
    sym = fetchlab(st);
    setlabel((int)sym->addr);
@@ -3987,7 +3959,7 @@ dobreak(void)
 
    ptr = readwhile();          /* readwhile() gives an error if not in loop */
    needtoken(tTERM);
 
    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));
       return;
    destructsymbols(&loctab, nestlevel);
    modstk(((int)declared - ptr[wqBRK]) * sizeof(cell));
@@ -4001,7 +3973,7 @@ docont(void)
 
    ptr = readwhile();          /* readwhile() gives an error if not in loop */
    needtoken(tTERM);
 
    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));
       return;
    destructsymbols(&loctab, nestlevel);
    modstk(((int)declared - ptr[wqCONT]) * sizeof(cell));
@@ -4020,9 +3992,9 @@ exporttag(int tag)
 
        assert((tag & PUBLICTAG) == 0);
        for (ptr = tagname_tab.next;
 
        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 */ ;
           /* nothing */ ;
-       if (ptr != NULL)
+       if (ptr)
           ptr->value |= PUBLICTAG;
      }                         /* if */
 }
           ptr->value |= PUBLICTAG;
      }                         /* if */
 }
index 269b31e..f72703a 100644 (file)
@@ -1,7 +1,4 @@
-/*
- *  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
  *
  *
  *  Copyright (c) ITB CompuPhase, 1997-2003
  *
@@ -24,9 +21,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -38,7 +32,6 @@
 #include <string.h>
 #include <ctype.h>
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
 #include <math.h>
-#include "embryo_cc_osdefs.h"
 #include "embryo_cc_sc.h"
 #include "Embryo.h"
 
 #include "embryo_cc_sc.h"
 #include "Embryo.h"
 
@@ -98,18 +91,19 @@ plungequalifiedfile(char *name)
      {
        fp = (FILE *) sc_opensrc(name);
        ext = strchr(name, '\0');       /* save position */
      {
        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);
          {
             /* 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++;
      }
                *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 < (int)(sizeof extensions / sizeof extensions[0])));
+   if (!fp)
      {
        *ext = '\0';            /* restore filename */
        return FALSE;
      {
        *ext = '\0';            /* restore filename */
        return FALSE;
@@ -117,17 +111,13 @@ plungequalifiedfile(char *name)
    pushstk((stkitem) inpf);
    pushstk((stkitem) inpfname);        /* pointer to current file name */
    pushstk((stkitem) curlibrary);
    pushstk((stkitem) inpf);
    pushstk((stkitem) inpfname);        /* pointer to current file name */
    pushstk((stkitem) curlibrary);
-   /* FIXME: 64bit unsafe */
    pushstk((stkitem) iflevel);
    assert(skiplevel == 0);
    pushstk((stkitem) iflevel);
    assert(skiplevel == 0);
-   /* FIXME: 64bit unsafe */
    pushstk((stkitem) icomment);
    pushstk((stkitem) icomment);
-   /* FIXME: 64bit unsafe */
    pushstk((stkitem) fcurrent);
    pushstk((stkitem) fcurrent);
-   /* FIXME: 64bit unsafe */
    pushstk((stkitem) fline);
    inpfname = strdup(name);    /* set name of include file */
    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++;
       error(103);              /* insufficient memory */
    inpf = fp;                  /* set input file pointer to include file */
    fnumber++;
@@ -152,9 +142,9 @@ plungefile(char *name, int try_currentpath, int try_includepaths)
 
    if (try_includepaths && name[0] != DIRSEP_CHAR)
      {
 
    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[_MAX_PATH];
+            char                path[PATH_MAX];
 
             strncpy(path, ptr, sizeof path);
             path[sizeof path - 1] = '\0';      /* force '\0' termination */
 
             strncpy(path, ptr, sizeof path);
             path[sizeof path - 1] = '\0';      /* force '\0' termination */
@@ -190,7 +180,7 @@ check_empty(char *lptr)
 static void
 doinclude(void)
 {
 static void
 doinclude(void)
 {
-   char                name[_MAX_PATH], c;
+   char                name[PATH_MAX], c;
    int                 i, result;
 
    while (*lptr <= ' ' && *lptr != 0)  /* skip leading whitespace */
    int                 i, result;
 
    while (*lptr <= ' ' && *lptr != 0)  /* skip leading whitespace */
@@ -208,11 +198,11 @@ doinclude(void)
      }                         /* if */
 
    i = 0;
      }                         /* if */
 
    i = 0;
-   while (*lptr != c && *lptr != '\0' && i < sizeof name - 1)  /* find the end of the string */
+   while ((*lptr != c) && (*lptr != '\0') && (i < (int)(sizeof(name) - 1))) /* find the end of the string */
       name[i++] = *lptr++;
    while (i > 0 && name[i - 1] <= ' ')
       i--;                     /* strip trailing whitespace */
       name[i++] = *lptr++;
    while (i > 0 && name[i - 1] <= ' ')
       i--;                     /* strip trailing whitespace */
-   assert(i >= 0 && i < sizeof name);
+   assert((i >= 0) && (i < (int)(sizeof(name))));
    name[i] = '\0';             /* zero-terminate the string */
 
    if (*lptr != c)
    name[i] = '\0';             /* zero-terminate the string */
 
    if (*lptr != c)
@@ -253,11 +243,11 @@ readline(char *line)
    cont = FALSE;
    do
      {
    cont = FALSE;
    do
      {
-       if (inpf == NULL || sc_eofsrc(inpf))
+       if (!inpf || sc_eofsrc(inpf))
          {
             if (cont)
                error(49);      /* invalid line continuation */
          {
             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)
                sc_closesrc(inpf);
             i = (int)(long)popstk();
             if (i == -1)
@@ -288,7 +278,7 @@ readline(char *line)
             elsedone = 0;
          }                     /* if */
 
             elsedone = 0;
          }                     /* if */
 
-       if (sc_readsrc(inpf, line, num) == NULL)
+       if (!sc_readsrc(inpf, line, num))
          {
             *line = '\0';      /* delete line */
             cont = FALSE;
          {
             *line = '\0';      /* delete line */
             cont = FALSE;
@@ -307,10 +297,10 @@ readline(char *line)
               }                /* if */
             cont = FALSE;
             /* check whether a full line was read */
               }                /* 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 */
                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
               {
                  assert(*(ptr + 1) == '\0');   /* '\n' should be last in the string */
                  while (ptr > line
@@ -379,7 +369,7 @@ stripcom(char *line)
               }
             else if (*line == '/' && *(line + 1) == '/')
               {                /* comment to end of 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 */
                     error(49); /* invalid line continuation */
                  *line++ = '\n';       /* put "newline" at first slash */
                  *line = '\0'; /* put "zero-terminator" at second slash */
@@ -453,9 +443,9 @@ dtoi(cell * val, char *curptr)
 
    *val = 0;
    ptr = curptr;
 
    *val = 0;
    ptr = curptr;
-   if (!isdigit(*ptr))         /* should start with digit */
+   if (!sc_isdigit(*ptr))              /* should start with digit */
       return 0;
       return 0;
-   while (isdigit(*ptr) || *ptr == '_')
+   while (sc_isdigit(*ptr) || *ptr == '_')
      {
        if (*ptr != '_')
           *val = (*val * 10) + (*ptr - '0');
      {
        if (*ptr != '_')
           *val = (*val * 10) + (*ptr - '0');
@@ -463,7 +453,7 @@ dtoi(cell * val, char *curptr)
      }                         /* while */
    if (alphanum(*ptr))         /* number must be delimited by non-alphanumerical */
       return 0;
      }                         /* while */
    if (alphanum(*ptr))         /* number must be delimited by non-alphanumerical */
       return 0;
-   if (*ptr == '.' && isdigit(*(ptr + 1)))
+   if (*ptr == '.' && sc_isdigit(*(ptr + 1)))
       return 0;                        /* but a fractional part must not be present */
    return (int)(ptr - curptr);
 }
       return 0;                        /* but a fractional part must not be present */
    return (int)(ptr - curptr);
 }
@@ -481,18 +471,18 @@ htoi(cell * val, char *curptr)
 
    *val = 0;
    ptr = curptr;
 
    *val = 0;
    ptr = curptr;
-   if (!isdigit(*ptr))         /* should start with digit */
+   if (!sc_isdigit(*ptr))              /* should start with digit */
       return 0;
    if (*ptr == '0' && *(ptr + 1) == 'x')
      {                         /* C style hexadecimal notation */
        ptr += 2;
       return 0;
    if (*ptr == '0' && *(ptr + 1) == 'x')
      {                         /* C style hexadecimal notation */
        ptr += 2;
-       while (isxdigit(*ptr) || *ptr == '_')
+       while (sc_isxdigit(*ptr) || *ptr == '_')
          {
             if (*ptr != '_')
               {
          {
             if (*ptr != '_')
               {
-                 assert(isxdigit(*ptr));
+                 assert(sc_isxdigit(*ptr));
                  *val = *val << 4;
                  *val = *val << 4;
-                 if (isdigit(*ptr))
+                 if (sc_isdigit(*ptr))
                     *val += (*ptr - '0');
                  else
                     *val += (tolower(*ptr) - 'a' + 10);
                     *val += (*ptr - '0');
                  else
                     *val += (tolower(*ptr) - 'a' + 10);
@@ -564,9 +554,9 @@ ftoi(cell * val, char *curptr)
    fnum = 0.0;
    dnum = 0L;
    ptr = curptr;
    fnum = 0.0;
    dnum = 0L;
    ptr = curptr;
-   if (!isdigit(*ptr))         /* should start with digit */
+   if (!sc_isdigit(*ptr))              /* should start with digit */
       return 0;
       return 0;
-   while (isdigit(*ptr) || *ptr == '_')
+   while (sc_isdigit(*ptr) || *ptr == '_')
      {
        if (*ptr != '_')
          {
      {
        if (*ptr != '_')
          {
@@ -578,12 +568,12 @@ ftoi(cell * val, char *curptr)
    if (*ptr != '.')
       return 0;                        /* there must be a period */
    ptr++;
    if (*ptr != '.')
       return 0;                        /* there must be a period */
    ptr++;
-   if (!isdigit(*ptr))         /* there must be at least one digit after the dot */
+   if (!sc_isdigit(*ptr))              /* there must be at least one digit after the dot */
       return 0;
    ffrac = 0.0;
    fmult = 1.0;
    ignore = FALSE;
       return 0;
    ffrac = 0.0;
    fmult = 1.0;
    ignore = FALSE;
-   while (isdigit(*ptr) || *ptr == '_')
+   while (sc_isdigit(*ptr) || *ptr == '_')
      {
        if (*ptr != '_')
          {
      {
        if (*ptr != '_')
          {
@@ -615,10 +605,10 @@ ftoi(cell * val, char *curptr)
          {
             sign = 1;
          }                     /* if */
          {
             sign = 1;
          }                     /* if */
-       if (!isdigit(*ptr))     /* 'e' should be followed by a digit */
+       if (!sc_isdigit(*ptr))  /* 'e' should be followed by a digit */
           return 0;
        exp = 0;
           return 0;
        exp = 0;
-       while (isdigit(*ptr))
+       while (sc_isdigit(*ptr))
          {
             exp = (exp * 10) + (*ptr - '0');
             ptr++;
          {
             exp = (exp * 10) + (*ptr - '0');
             ptr++;
@@ -640,8 +630,9 @@ ftoi(cell * val, char *curptr)
      }
    else if (rational_digits == 0)
      {
      }
    else if (rational_digits == 0)
      {
+       float f = (float) fnum;
        /* floating point */
        /* floating point */
-      *val = EMBRYO_FLOAT_TO_CELL((float) fnum);
+      *val = EMBRYO_FLOAT_TO_CELL(f);
 #if !defined NDEBUG
        /* I assume that the C/C++ compiler stores "float" values in IEEE 754
         * format (as mandated in the ANSI standard). Test this assumption anyway.
 #if !defined NDEBUG
        /* I assume that the C/C++ compiler stores "float" values in IEEE 754
         * format (as mandated in the ANSI standard). Test this assumption anyway.
@@ -730,7 +721,7 @@ static int
 preproc_expr(cell * val, int *tag)
 {
    int                 result;
 preproc_expr(cell * val, int *tag)
 {
    int                 result;
-   int                 index;
+   int                 idx;
    cell                code_index;
    char               *term;
 
    cell                code_index;
    char               *term;
 
@@ -739,7 +730,7 @@ preproc_expr(cell * val, int *tag)
     * compilations. Reset the staging index, but keep the code
     * index.
     */
     * compilations. Reset the staging index, but keep the code
     * index.
     */
-   if (stgget(&index, &code_index))
+   if (stgget(&idx, &code_index))
      {
        error(57);              /* unfinished expression */
        stgdel(0, code_index);
      {
        error(57);              /* unfinished expression */
        stgdel(0, code_index);
@@ -764,29 +755,29 @@ preproc_expr(cell * val, int *tag)
  * character that caused the input to be ended.
  */
 static char        *
  * character that caused the input to be ended.
  */
 static char        *
-getstring(char *dest, int max, char *line)
+getstring(char *dest, int max)
 {
 {
-   assert(dest != NULL && line != NULL);
+   assert(dest != NULL);
    *dest = '\0';
    *dest = '\0';
-   while (*line <= ' ' && *line != '\0')
-      line++;                  /* skip whitespace */
-   if (*line != '"')
+   while (*lptr <= ' ' && *lptr != '\0')
+      lptr++;                  /* skip whitespace */
+   if (*lptr != '"')
      {
        error(37);              /* invalid string */
      }
      {
        error(37);              /* invalid string */
      }
-   else if (*line == '\0')
+   else
      {
        int                 len = 0;
 
      {
        int                 len = 0;
 
-       line++;                 /* skip " */
-       while (*line != '"' && *line != '\0')
+       lptr++;                 /* skip " */
+       while (*lptr != '"' && *lptr != '\0')
          {
             if (len < max - 1)
          {
             if (len < max - 1)
-               dest[len++] = *line;
-            line++;
+               dest[len++] = *lptr;
+            lptr++;
          }                     /* if */
        dest[len] = '\0';
          }                     /* if */
        dest[len] = '\0';
-       if (*line == '"')
+       if (*lptr == '"')
           lptr++;              /* skip closing " */
        else
           error(37);           /* invalid string */
           lptr++;              /* skip closing " */
        else
           error(37);           /* invalid string */
@@ -828,7 +819,7 @@ command(void)
    int                 tok, ret;
    cell                val;
    char               *str;
    int                 tok, ret;
    cell                val;
    char               *str;
-   int                 index;
+   int                 idx;
    cell                code_index;
 
    while (*lptr <= ' ' && *lptr != '\0')
    cell                code_index;
 
    while (*lptr <= ' ' && *lptr != '\0')
@@ -843,7 +834,7 @@ command(void)
    /* on a pending expression, force to return a silent ';' token and force to
     * re-read the line
     */
    /* on a pending expression, force to return a silent ';' token and force to
     * re-read the line
     */
-   if (!sc_needsemicolon && stgget(&index, &code_index))
+   if (!sc_needsemicolon && stgget(&idx, &code_index))
      {
        lptr = term_expr;
        return CMD_TERM;
      {
        lptr = term_expr;
        return CMD_TERM;
@@ -932,14 +923,14 @@ command(void)
      case tpFILE:
        if (skiplevel == 0)
          {
      case tpFILE:
        if (skiplevel == 0)
          {
-            char                pathname[_MAX_PATH];
+            char                pathname[PATH_MAX];
 
 
-            lptr = getstring(pathname, sizeof pathname, lptr);
+            lptr = getstring(pathname, sizeof pathname);
             if (pathname[0] != '\0')
               {
                  free(inpfname);
                  inpfname = strdup(pathname);
             if (pathname[0] != '\0')
               {
                  free(inpfname);
                  inpfname = strdup(pathname);
-                 if (inpfname == NULL)
+                 if (!inpfname)
                     error(103);        /* insufficient memory */
               }                /* if */
          }                     /* if */
                     error(103);        /* insufficient memory */
               }                /* if */
          }                     /* if */
@@ -951,6 +942,22 @@ command(void)
             if (lex(&val, &str) != tNUMBER)
                error(8);       /* invalid/non-constant expression */
             fline = (int)val;
             if (lex(&val, &str) != tNUMBER)
                error(8);       /* invalid/non-constant expression */
             fline = (int)val;
+
+            while (*lptr == ' ' && *lptr != '\0')
+               lptr++;                 /* skip whitespace */
+            if (*lptr == '"')
+               {
+                 char pathname[PATH_MAX];
+
+                 lptr = getstring(pathname, sizeof pathname);
+                 if (pathname[0] != '\0')
+                   {
+                      free(inpfname);
+                      inpfname = strdup(pathname);
+                      if (!inpfname)
+                         error(103);   /* insufficient memory */
+                   }           /* if */
+              }
          }                     /* if */
        check_empty(lptr);
        break;
          }                     /* if */
        check_empty(lptr);
        break;
@@ -993,13 +1000,15 @@ command(void)
                          lptr++;
                       if (*lptr == '"')
                         {
                          lptr++;
                       if (*lptr == '"')
                         {
-                           lptr = getstring(name, sizeof name, lptr);
+                           lptr = getstring(name, sizeof name);
                         }
                       else
                         {
                            int                 i;
 
                         }
                       else
                         {
                            int                 i;
 
-                           for (i = 0; i < sizeof name && alphanum(*lptr);
+                           for (i = 0; 
+                                 (i < (int)(sizeof(name))) && 
+                                 (alphanum(*lptr));
                                 i++, lptr++)
                               name[i] = *lptr;
                            name[i] = '\0';
                                 i++, lptr++)
                               name[i] = *lptr;
                            name[i] = '\0';
@@ -1013,7 +1022,7 @@ command(void)
                            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 (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 */
                               curlibrary =
                                  append_constval(&libname_tab, name, 0, 0);
                         }      /* if */
@@ -1032,9 +1041,11 @@ command(void)
                       int                 i;
 
                       /* first gather all information, start with the tag name */
                       int                 i;
 
                       /* first gather all information, start with the tag name */
-                      while (*lptr <= ' ' && *lptr != '\0')
+                      while ((*lptr <= ' ') && (*lptr != '\0'))
                          lptr++;
                          lptr++;
-                      for (i = 0; i < sizeof name && alphanum(*lptr);
+                      for (i = 0; 
+                            (i < (int)(sizeof(name))) && 
+                            (alphanum(*lptr));
                            i++, lptr++)
                          name[i] = *lptr;
                       name[i] = '\0';
                            i++, lptr++)
                          name[i] = *lptr;
                       name[i] = '\0';
@@ -1094,17 +1105,19 @@ command(void)
                       do
                         {
                            /* get the name */
                       do
                         {
                            /* get the name */
-                           while (*lptr <= ' ' && *lptr != '\0')
+                           while ((*lptr <= ' ') && (*lptr != '\0'))
                               lptr++;
                               lptr++;
-                           for (i = 0; i < sizeof name && isalpha(*lptr);
+                           for (i = 0; 
+                                 (i < (int)(sizeof(name))) && 
+                                 (sc_isalpha(*lptr));
                                 i++, lptr++)
                               name[i] = *lptr;
                            name[i] = '\0';
                            /* get the symbol */
                            sym = findloc(name);
                                 i++, lptr++)
                               name[i] = *lptr;
                            name[i] = '\0';
                            /* get the symbol */
                            sym = findloc(name);
-                           if (sym == NULL)
+                           if (!sym)
                               sym = findglb(name);
                               sym = findglb(name);
-                           if (sym != NULL)
+                           if (sym)
                              {
                                 sym->usage |= uREAD;
                                 if (sym->ident == iVARIABLE
                              {
                                 sym->usage |= uREAD;
                                 if (sym->ident == iVARIABLE
@@ -1158,7 +1171,7 @@ command(void)
 
           while (*lptr <= ' ' && *lptr != '\0')
              lptr++;
 
           while (*lptr <= ' ' && *lptr != '\0')
              lptr++;
-          for (i = 0; i < 40 && (isalpha(*lptr) || *lptr == '.'); i++, lptr++)
+          for (i = 0; i < 40 && (sc_isalpha(*lptr) || *lptr == '.'); i++, lptr++)
              name[i] = (char)tolower(*lptr);
           name[i] = '\0';
           stgwrite("\t");
              name[i] = (char)tolower(*lptr);
           name[i] = '\0';
           stgwrite("\t");
@@ -1182,9 +1195,9 @@ command(void)
                     break;
                  case tSYMBOL:
                     sym = findloc(str);
                     break;
                  case tSYMBOL:
                     sym = findloc(str);
-                    if (sym == NULL)
+                    if (!sym)
                        sym = findglb(str);
                        sym = findglb(str);
-                    if (sym == NULL || (sym->ident != iFUNCTN
+                    if (!sym || (sym->ident != iFUNCTN
                         && sym->ident != iREFFUNC
                         && (sym->usage & uDEFINE) == 0))
                       {
                         && sym->ident != iREFFUNC
                         && (sym->usage & uDEFINE) == 0))
                       {
@@ -1240,14 +1253,14 @@ command(void)
                  }             /* while */
                end = lptr;
                /* check pattern to match */
                  }             /* while */
                end = lptr;
                /* check pattern to match */
-               if (!isalpha(*start) && *start != '_')
+               if (!sc_isalpha(*start) && *start != '_')
                  {
                     error(74); /* pattern must start with an alphabetic character */
                     break;
                  }             /* if */
                /* store matched pattern */
                pattern = malloc(count + 1);
                  {
                     error(74); /* pattern must start with an alphabetic character */
                     break;
                  }             /* if */
                /* store matched pattern */
                pattern = malloc(count + 1);
-               if (pattern == NULL)
+               if (!pattern)
                   error(103);  /* insufficient memory */
                lptr = start;
                count = 0;
                   error(103);  /* insufficient memory */
                lptr = start;
                count = 0;
@@ -1259,7 +1272,7 @@ command(void)
                  }             /* while */
                pattern[count] = '\0';
                /* special case, erase trailing variable, because it could match anything */
                  }             /* while */
                pattern[count] = '\0';
                /* special case, erase trailing variable, because it could match anything */
-               if (count >= 2 && isdigit(pattern[count - 1])
+               if (count >= 2 && sc_isdigit(pattern[count - 1])
                    && pattern[count - 2] == '%')
                   pattern[count - 2] = '\0';
                /* find substitution string */
                    && pattern[count - 2] == '%')
                   pattern[count - 2] = '\0';
                /* find substitution string */
@@ -1273,7 +1286,7 @@ command(void)
                     /* keep position of the start of trailing whitespace */
                     if (*lptr <= ' ')
                       {
                     /* keep position of the start of trailing whitespace */
                     if (*lptr <= ' ')
                       {
-                         if (end == NULL)
+                         if (!end)
                             end = lptr;
                       }
                     else
                             end = lptr;
                       }
                     else
@@ -1283,11 +1296,11 @@ command(void)
                     count++;
                     lptr++;
                  }             /* while */
                     count++;
                     lptr++;
                  }             /* while */
-               if (end == NULL)
+               if (!end)
                   end = lptr;
                /* store matched substitution */
                substitution = malloc(count + 1);       /* +1 for '\0' */
                   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;
                   error(103);  /* insufficient memory */
                lptr = start;
                count = 0;
@@ -1300,11 +1313,11 @@ command(void)
                substitution[count] = '\0';
                /* check whether the definition already exists */
                for (prefixlen = 0, start = pattern;
                substitution[count] = '\0';
                /* check whether the definition already exists */
                for (prefixlen = 0, start = pattern;
-                    isalpha(*start) || isdigit(*start) || *start == '_';
+                    sc_isalpha(*start) || sc_isdigit(*start) || *start == '_';
                     prefixlen++, start++)
                   /* nothing */ ;
                assert(prefixlen > 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 (strcmp(def->first, pattern) != 0
                         || strcmp(def->second, substitution) != 0)
@@ -1471,7 +1484,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
    memset(args, 0, sizeof args);
 
    /* check the length of the prefix */
    memset(args, 0, sizeof args);
 
    /* check the length of the prefix */
-   for (prefixlen = 0, s = pattern; isalpha(*s) || isdigit(*s) || *s == '_';
+   for (prefixlen = 0, s = pattern; sc_isalpha(*s) || sc_isdigit(*s) || *s == '_';
        prefixlen++, s++)
       /* nothing */ ;
    assert(prefixlen > 0);
        prefixlen++, s++)
       /* nothing */ ;
    assert(prefixlen > 0);
@@ -1488,7 +1501,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
        if (*p == '%')
          {
             p++;               /* skip '%' */
        if (*p == '%')
          {
             p++;               /* skip '%' */
-            if (isdigit(*p))
+            if (sc_isdigit(*p))
               {
                  arg = *p - '0';
                  assert(arg >= 0 && arg <= 9);
               {
                  arg = *p - '0';
                  assert(arg >= 0 && arg <= 9);
@@ -1502,18 +1515,18 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
                    {
                       if (is_startstring(e))   /* skip strings */
                          e = skipstring(e);
                    {
                       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) */
                          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);
                     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';
                     error(103);        /* insufficient memory */
                  strncpy(args[arg], s, len);
                  args[arg][len] = '\0';
@@ -1583,11 +1596,11 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
        /* calculate the length of the substituted string */
        for (e = substitution, len = 0; *e != '\0'; e++)
          {
        /* calculate the length of the substituted string */
        for (e = substitution, len = 0; *e != '\0'; e++)
          {
-            if (*e == '%' && isdigit(*(e + 1)))
+            if (*e == '%' && sc_isdigit(*(e + 1)))
               {
                  arg = *(e + 1) - '0';
                  assert(arg >= 0 && arg <= 9);
               {
                  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 */
               }
                     len += strlen(args[arg]);
                  e++;          /* skip %, digit is skipped later */
               }
@@ -1607,11 +1620,11 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
             strdel(line, (int)(s - line));
             for (e = substitution, s = line; *e != '\0'; e++)
               {
             strdel(line, (int)(s - line));
             for (e = substitution, s = line; *e != '\0'; e++)
               {
-                 if (*e == '%' && isdigit(*(e + 1)))
+                 if (*e == '%' && sc_isdigit(*(e + 1)))
                    {
                       arg = *(e + 1) - '0';
                       assert(arg >= 0 && arg <= 9);
                    {
                       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]);
                         {
                            strins(s, args[arg], strlen(args[arg]));
                            s += strlen(args[arg]);
@@ -1628,7 +1641,7 @@ substpattern(char *line, size_t buffersize, char *pattern, char *substitution)
      }                         /* if */
 
    for (arg = 0; arg < 10; arg++)
      }                         /* if */
 
    for (arg = 0; arg < 10; arg++)
-      if (args[arg] != NULL)
+      if (args[arg])
         free(args[arg]);
 
    return match;
         free(args[arg]);
 
    return match;
@@ -1647,7 +1660,7 @@ substallpatterns(char *line, int buffersize)
        /* find the start of a prefix (skip all non-alphabetic characters),
         * also skip strings
         */
        /* find the start of a prefix (skip all non-alphabetic characters),
         * also skip strings
         */
-       while (!isalpha(*start) && *start != '_' && *start != '\0')
+       while (!sc_isalpha(*start) && *start != '_' && *start != '\0')
          {
             /* skip strings */
             if (is_startstring(start))
          {
             /* skip strings */
             if (is_startstring(start))
@@ -1663,14 +1676,14 @@ substallpatterns(char *line, int buffersize)
        /* get the prefix (length), look for a matching definition */
        prefixlen = 0;
        end = start;
        /* get the prefix (length), look for a matching definition */
        prefixlen = 0;
        end = start;
-       while (isalpha(*end) || isdigit(*end) || *end == '_')
+       while (sc_isalpha(*end) || sc_isdigit(*end) || *end == '_')
          {
             prefixlen++;
             end++;
          }                     /* while */
        assert(prefixlen > 0);
        subst = find_subst(start, prefixlen);
          {
             prefixlen++;
             end++;
          }                     /* while */
        assert(prefixlen > 0);
        subst = find_subst(start, prefixlen);
-       if (subst != NULL)
+       if (subst)
          {
             /* properly match the pattern and substitute */
             if (!substpattern
          {
             /* properly match the pattern and substitute */
             if (!substpattern
@@ -2225,7 +2238,7 @@ stowlit(cell value)
 
        litmax += sDEF_LITMAX;
        p = (cell *) realloc(litq, litmax * sizeof(cell));
 
        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 */
           error(102, "literal table"); /* literal table overflow (fatal error) */
        litq = p;
      }                         /* if */
@@ -2305,7 +2318,7 @@ litchar(char **lptr, int rawmode)
                  cptr += 1;
                  break;
               default:
                  cptr += 1;
                  break;
               default:
-                 if (isdigit(*cptr))
+                 if (sc_isdigit(*cptr))
                    {           /* \ddd */
                       c = 0;
                       while (*cptr >= '0' && *cptr <= '9')     /* decimal! */
                    {           /* \ddd */
                       c = 0;
                       while (*cptr >= '0' && *cptr <= '9')     /* decimal! */
@@ -2333,7 +2346,7 @@ litchar(char **lptr, int rawmode)
 static int
 alpha(char c)
 {
 static int
 alpha(char c)
 {
-   return (isalpha(c) || c == '_' || c == PUBLIC_CHAR);
+   return (sc_isalpha(c) || c == '_' || c == PUBLIC_CHAR);
 }
 
 /*  alphanum
 }
 
 /*  alphanum
@@ -2343,7 +2356,7 @@ alpha(char c)
 int
 alphanum(char c)
 {
 int
 alphanum(char c)
 {
-   return (alpha(c) || isdigit(c));
+   return (alpha(c) || sc_isdigit(c));
 }
 
 /* The local variable table must be searched backwards, so that the deepest
 }
 
 /* The local variable table must be searched backwards, so that the deepest
@@ -2358,10 +2371,10 @@ add_symbol(symbol * root, symbol * entry, int sort)
    symbol             *newsym;
 
    if (sort)
    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;
 
         root = root->next;
 
-   if ((newsym = (symbol *) malloc(sizeof(symbol))) == NULL)
+   if (!(newsym = (symbol *)malloc(sizeof(symbol))))
      {
        error(103);
        return NULL;
      {
        error(103);
        return NULL;
@@ -2431,7 +2444,7 @@ delete_symbols(symbol * root, int level, int delete_labels,
 
    /* erase only the symbols with a deeper nesting level than the
     * specified nesting level */
 
    /* 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)
      {
        sym = root->next;
        if (sym->compound < level)
@@ -2463,7 +2476,7 @@ delete_symbols(symbol * root, int level, int delete_labels,
             /* for user defined operators, also remove the "prototyped" flag, as
              * user-defined operators *must* be declared before use
              */
             /* for user defined operators, also remove the "prototyped" flag, as
              * user-defined operators *must* be declared before use
              */
-            if (sym->ident == iFUNCTN && !isalpha(*sym->name)
+            if (sym->ident == iFUNCTN && !sc_isalpha(*sym->name)
                 && *sym->name != '_' && *sym->name != PUBLIC_CHAR)
                sym->usage &= ~uPROTOTYPED;
             root = sym;        /* skip the symbol */
                 && *sym->name != '_' && *sym->name != PUBLIC_CHAR)
                sym->usage &= ~uPROTOTYPED;
             root = sym;        /* skip the symbol */
@@ -2494,10 +2507,10 @@ find_symbol(symbol * root, char *name, int fnumber)
    symbol             *ptr = root->next;
    unsigned long       hash = namehash(name);
 
    symbol             *ptr = root->next;
    unsigned long       hash = namehash(name);
 
-   while (ptr != NULL)
+   while (ptr)
      {
        if (hash == ptr->hash && strcmp(name, ptr->name) == 0
      {
        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;
                                       || ptr->fnumber == fnumber))
           return ptr;
        ptr = ptr->next;
@@ -2510,7 +2523,7 @@ find_symbol_child(symbol * root, symbol * sym)
 {
    symbol             *ptr = root->next;
 
 {
    symbol             *ptr = root->next;
 
-   while (ptr != NULL)
+   while (ptr)
      {
        if (ptr->parent == sym)
           return ptr;
      {
        if (ptr->parent == sym)
           return ptr;
@@ -2543,7 +2556,7 @@ refer_symbol(symbol * entry, symbol * bywhom)
      }                         /* if */
 
    /* see if there is an empty spot in the referrer list */
      }                         /* 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);
        count++)
       /* nothing */ ;
    assert(count <= entry->numrefers);
@@ -2555,7 +2568,7 @@ refer_symbol(symbol * entry, symbol * bywhom)
        assert(newsize > 0);
        /* grow the referrer list */
        refer = (symbol **) realloc(entry->refer, newsize * sizeof(symbol *));
        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;
           return FALSE;        /* insufficient memory */
        /* initialize the new entries */
        entry->refer = refer;
@@ -2585,7 +2598,7 @@ markusage(symbol * sym, int usage)
              * outside functions; in the case of syntax errors, however, the
              * compiler may arrive through this function
              */
              * 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 */
                refer_symbol(sym, curfunc);
          }                     /* if */
      }                         /* if */
@@ -2618,9 +2631,9 @@ findconst(char *name)
    symbol             *sym;
 
    sym = find_symbol(&loctab, name, -1);       /* try local symbols first */
    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);
       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;
       return NULL;
    assert(sym->parent == NULL);        /* constants have no hierarchy */
    return sym;
@@ -2632,7 +2645,7 @@ finddepend(symbol * parent)
    symbol             *sym;
 
    sym = find_symbol_child(&loctab, parent);   /* try local symbols first */
    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;
 }
       sym = find_symbol_child(&glbtab, parent);
    return sym;
 }
@@ -2654,7 +2667,7 @@ addsym(char *name, cell addr, int ident, int vclass, int tag, int usage)
    assert(ident != iLABEL || findloc(name) == NULL);
 
    /* create an empty referrer list */
    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;
      {
        error(103);             /* insufficient memory */
        return NULL;
index f10bb35..1206857 100644 (file)
@@ -21,9 +21,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -31,7 +28,7 @@
 
 #include <assert.h>
 #include <stdio.h>
 
 #include <assert.h>
 #include <stdio.h>
-#include <stdlib.h>            /* for _MAX_PATH */
+#include <limits.h>            /* for PATH_MAX */
 #include <string.h>
 
 #include "embryo_cc_sc.h"
 #include <string.h>
 
 #include "embryo_cc_sc.h"
@@ -157,11 +154,11 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
    /* find the name with the operator */
    if (numparam == 2)
      {
    /* find the name with the operator */
    if (numparam == 2)
      {
-       if (oper == NULL)
+       if (!oper)
          {
             /* assignment operator: a special case */
             strcpy(opername, "=");
          {
             /* assignment operator: a special case */
             strcpy(opername, "=");
-            if (lval != NULL
+            if (lval
                 && (lval->ident == iARRAYCELL || lval->ident == iARRAYCHAR))
                savealt = TRUE;
          }
                 && (lval->ident == iARRAYCELL || lval->ident == iARRAYCHAR))
                savealt = TRUE;
          }
@@ -169,7 +166,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
          {
             assert((sizeof binoperstr / sizeof binoperstr[0]) ==
                    (sizeof op1 / sizeof op1[0]));
          {
             assert((sizeof binoperstr / sizeof binoperstr[0]) ==
                    (sizeof op1 / sizeof op1[0]));
-            for (i = 0; i < sizeof op1 / sizeof op1[0]; i++)
+            for (i = 0; i < (int)(sizeof op1 / sizeof op1[0]); i++)
               {
                  if (oper == op1[i])
                    {
               {
                  if (oper == op1[i])
                    {
@@ -189,7 +186,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
               (sizeof unopers / sizeof unopers[0]));
        if (opername[0] == '\0')
          {
               (sizeof unopers / sizeof unopers[0]));
        if (opername[0] == '\0')
          {
-            for (i = 0; i < sizeof unopers / sizeof unopers[0]; i++)
+            for (i = 0; i < (int)(sizeof unopers / sizeof unopers[0]); i++)
               {
                  if (oper == unopers[i])
                    {
               {
                  if (oper == unopers[i])
                    {
@@ -208,10 +205,10 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
    operator_symname(symbolname, opername, tag1, tag2, numparam, tag2);
    swapparams = FALSE;
    sym = findglb(symbolname);
    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 */
      {                         /* ??? 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
           return FALSE;        /* not commutative, cannot swap operands */
        /* if arrived here, the operator is commutative and the tags are different,
         * swap tags and try again
@@ -220,11 +217,11 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
        operator_symname(symbolname, opername, tag2, tag1, numparam, tag1);
        swapparams = TRUE;
        sym = findglb(symbolname);
        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 */
 
           return FALSE;
      }                         /* if */
 
-   /* check existance and the proper declaration of this function */
+   /* check existence and the proper declaration of this function */
    if ((sym->usage & uMISSING) != 0 || (sym->usage & uPROTOTYPED) == 0)
      {
        char                symname[2 * sNAMEMAX + 16]; /* allow space for user defined operators */
    if ((sym->usage & uMISSING) != 0 || (sym->usage & uPROTOTYPED) == 0)
      {
        char                symname[2 * sNAMEMAX + 16]; /* allow space for user defined operators */
@@ -269,7 +266,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
    else if (savealt)
      {
        /* for the assignment operator, ALT may contain an address at which the
    else if (savealt)
      {
        /* for the assignment operator, ALT may contain an address at which the
-        * result must be stored; this address must be preserved accross the
+        * result must be stored; this address must be preserved across the
         * call
         */
        assert(lval != NULL);   /* this was checked earlier */
         * call
         */
        assert(lval != NULL);   /* this was checked earlier */
@@ -278,7 +275,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
      }                         /* if */
 
    /* push parameters, call the function */
      }                         /* if */
 
    /* push parameters, call the function */
-   paramspassed = (oper == NULL) ? 1 : numparam;
+   paramspassed = (!oper) ? 1 : numparam;
    switch (paramspassed)
      {
      case 1:
    switch (paramspassed)
      {
      case 1:
@@ -308,7 +305,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
    ffcall(sym, paramspassed);
    if (sc_status != statSKIP)
       markusage(sym, uREAD);   /* do not mark as "used" when this call itself is skipped */
    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);
       sym->x.lib->value += 1;  /* increment "usage count" of the library */
    sideeffect = TRUE;          /* assume functions carry out a side-effect */
    assert(resulttag != NULL);
@@ -486,7 +483,7 @@ checkfunction(value * lval)
 {
    symbol             *sym = lval->sym;
 
 {
    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)
       return;                  /* no known symbol, or not a function result */
 
    if ((sym->usage & uDEFINE) != 0)
@@ -535,7 +532,7 @@ plnge(int *opstr, int opoff, int (*hier) (value * lval), value * lval,
        plnge2(op1[opidx], hier, lval, &lval2);
        if (op1[opidx] == ob_and || op1[opidx] == ob_or)
           bitwise_opercount++;
        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 */
           lval->tag = sc_addtag(forcetag);
      }
    while (nextop(&opidx, opstr));      /* do */
@@ -674,13 +671,13 @@ plnge2(void         (*oper) (void),
        if (lval1->ident == iARRAY || lval1->ident == iREFARRAY)
          {
             char               *ptr =
        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 =
             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 */
             error(33, ptr);    /* array must be indexed */
          }                     /* if */
        /* ??? ^^^ should do same kind of error checking with functions */
@@ -776,8 +773,9 @@ expression(int *constant, cell * val, int *tag, int chkfuncresult)
    else
      {
        *constant = FALSE;
    else
      {
        *constant = FALSE;
+       *val = 0;
      }                         /* if */
      }                         /* if */
-   if (tag != NULL)
+   if (tag)
       *tag = lval.tag;
    if (chkfuncresult)
       checkfunction(&lval);
       *tag = lval.tag;
    if (chkfuncresult)
       checkfunction(&lval);
@@ -822,7 +820,7 @@ array_levelsize(symbol * sym, int level)
  *
  *  Lowest hierarchy level (except for the , operator).
  *
  *
  *  Lowest hierarchy level (except for the , operator).
  *
- *  Global references: intest   (reffered to only)
+ *  Global references: intest   (referred to only)
  */
 int
 hier14(value * lval1)
  */
 int
 hier14(value * lval1)
@@ -843,7 +841,7 @@ hier14(value * lval1)
    for (i = 0; i < sDIMEN_MAX; i++)
       arrayidx1[i] = arrayidx2[i] = 0;
    org_arrayidx = lval1->arrayidx;     /* save current pointer, to reset later */
    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)
       lval1->arrayidx = arrayidx1;
    lvalue = plnge1(hier13, lval1);
    if (lval1->ident != iARRAYCELL && lval1->ident != iARRAYCHAR)
@@ -940,7 +938,7 @@ hier14(value * lval1)
           lval2.arrayidx = NULL;
        if (oper)
           pop2();
           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;
            && lval3.ident == lval2.ident && lval3.sym == lval2.sym)
          {
             int                 same = TRUE;
@@ -986,7 +984,7 @@ hier14(value * lval1)
 
        if (lval2.ident != iARRAY && lval2.ident != iREFARRAY)
           error(33, lval3.sym->name);  /* array must be indexed */
 
        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;
          {
             val = lval2.sym->dim.array.length; /* array variable */
             level = lval2.sym->dim.array.level;
@@ -1097,13 +1095,13 @@ hier13(value * lval)
        if (array1 && !array2)
          {
             char               *ptr =
        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 =
             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 */
             error(33, ptr);    /* array must be indexed */
          }                     /* if */
        /* ??? if both are arrays, should check dimensions */
@@ -1297,13 +1295,13 @@ hier2(value * lval)
        if (tok != tSYMBOL)
           return error(20, st);        /* illegal symbol name */
        sym = findloc(st);
        if (tok != tSYMBOL)
           return error(20, st);        /* illegal symbol name */
        sym = findloc(st);
-       if (sym == NULL)
+       if (!sym)
           sym = findglb(st);
           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" */
            && (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)
+       val = !!sym;
+       if (!val && find_subst(st, strlen(st)))
           val = 1;
        clear_value(lval);
        lval->ident = iCONSTEXPR;
           val = 1;
        clear_value(lval);
        lval->ident = iCONSTEXPR;
@@ -1320,9 +1318,9 @@ hier2(value * lval)
        if (tok != tSYMBOL)
           return error(20, st);        /* illegal symbol name */
        sym = findloc(st);
        if (tok != tSYMBOL)
           return error(20, st);        /* illegal symbol name */
        sym = findloc(st);
-       if (sym == NULL)
+       if (!sym)
           sym = findglb(st);
           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 */
           return error(17, st);        /* undefined symbol */
        if (sym->ident == iCONSTEXPR)
           error(39);           /* constant symbol has no size */
@@ -1343,7 +1341,7 @@ hier2(value * lval)
                error(28);      /* invalid subscript */
             else
                lval->constval = array_levelsize(sym, level);
                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);
                error(224, st); /* indeterminate array size in "sizeof" expression */
          }                     /* if */
        const1(lval->constval);
@@ -1364,9 +1362,9 @@ hier2(value * lval)
        else
          {
             sym = findloc(st);
        else
          {
             sym = findloc(st);
-            if (sym == NULL)
+            if (!sym)
                sym = findglb(st);
                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) */
                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) */
@@ -1499,7 +1497,7 @@ hier1(value * lval1)
    if (matchtoken('[') || matchtoken('{') || matchtoken('('))
      {
        tok = tokeninfo(&val, &st);     /* get token read by matchtoken() */
    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
          {
             /* 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
@@ -1511,7 +1509,7 @@ hier1(value * lval1)
        if (tok == '[' || tok == '{')
          {                     /* subscript */
             close = (char)((tok == '[') ? ']' : '}');
        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);
               {                /* sym==NULL if lval is a constant or a literal */
                  error(28);    /* cannot subscript */
                  needtoken(close);
@@ -1541,7 +1539,7 @@ hier1(value * lval1)
             if (lval2.ident == iCONSTEXPR)
               {                /* constant expression */
                  stgdel(index, cidx);  /* scratch generated code */
             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);
                    {           /* keep constant index, for checking */
                       assert(sym->dim.array.level >= 0
                              && sym->dim.array.level < sDIMEN_MAX);
@@ -1636,16 +1634,16 @@ hier1(value * lval1)
          }
        else
          {                     /* tok=='(' -> function(...) */
          }
        else
          {                     /* tok=='(' -> function(...) */
-            if (sym == NULL
+            if (!sym
                 || (sym->ident != iFUNCTN && sym->ident != iREFFUNC))
               {
                 || (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);
                    {
                       /* 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 */
                          markusage(sym, uREAD);
                    }           /* if */
                  return error(12);     /* invalid function call */
@@ -1664,7 +1662,7 @@ hier1(value * lval1)
             return FALSE;      /* result of function call is no lvalue */
          }                     /* if */
      }                         /* if */
             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);
      {
        assert(sym->ident == iFUNCTN);
        address(sym);
@@ -1697,9 +1695,7 @@ primary(value * lval)
 
    if (matchtoken('('))
      {                         /* sub-expression - (expression,...) */
 
    if (matchtoken('('))
      {                         /* sub-expression - (expression,...) */
-       /* FIXME: 64bit unsafe */
        pushstk((stkitem) intest);
        pushstk((stkitem) intest);
-       /* FIXME: 64bit unsafe */
        pushstk((stkitem) sc_allowtags);
 
        intest = 0;             /* no longer in "test" expression */
        pushstk((stkitem) sc_allowtags);
 
        intest = 0;             /* no longer in "test" expression */
@@ -1727,7 +1723,7 @@ primary(value * lval)
    if (tok == tSYMBOL && !findconst(st))
      {
        /* first look for a local variable */
    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 (sym->ident == iLABEL)
               {
@@ -1749,7 +1745,7 @@ primary(value * lval)
               }                /* if */
          }                     /* if */
        /* now try a global variable */
               }                /* if */
          }                     /* if */
        /* now try a global variable */
-       if ((sym = findglb(st)) != 0)
+       if ((sym = findglb(st)))
          {
             if (sym->ident == iFUNCTN || sym->ident == iREFFUNC)
               {
          {
             if (sym->ident == iFUNCTN || sym->ident == iREFFUNC)
               {
@@ -2013,7 +2009,7 @@ callfunction(symbol * sym)
                         }      /* if */
                       /* ??? handle const array passed by reference */
                       /* otherwise, the address is already in PRI */
                         }      /* 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
                          markusage(lval.sym, uWRITTEN);
 /*
  * Dont need this warning - its varargs. there is no way of knowing the
@@ -2042,7 +2038,7 @@ callfunction(symbol * sym)
                    case iREFERENCE:
                       if (!lvalue || lval.ident == iARRAYCHAR)
                          error(35, argidx + 1);        /* argument type mismatch */
                    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].usage & uCONST) == 0)
                          error(35, argidx + 1);        /* argument type mismatch */
                       if (lval.ident == iVARIABLE || lval.ident == iREFERENCE)
@@ -2063,7 +2059,7 @@ callfunction(symbol * sym)
                           (arg[argidx].tags, arg[argidx].numtags, lval.tag))
                          error(213);
                       argidx++;        /* argument done */
                           (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:
                          markusage(lval.sym, uWRITTEN);
                       break;
                    case iREFARRAY:
@@ -2073,14 +2069,14 @@ callfunction(symbol * sym)
                            error(35, argidx + 1);      /* argument type mismatch */
                            break;
                         }      /* if */
                            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.
                        */
                           && (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)
                              {
                         {
                            if (arg[argidx].numdim != 1)
                              {
@@ -2271,7 +2267,7 @@ callfunction(symbol * sym)
              */
             asz = find_constval(&arrayszlst, arg[argidx].defvalue.size.symname,
                                 arg[argidx].defvalue.size.level);
              */
             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)
               {
                  array_sz = asz->value;
                  if (array_sz == 0)
@@ -2288,9 +2284,9 @@ callfunction(symbol * sym)
 
             assert((arg[argidx].hasdefault & uTAGOF) != 0);
             sym = findloc(arg[argidx].defvalue.size.symname);
 
             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);
                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);
             exporttag(array_sz);
          }                     /* if */
        const1(array_sz);
@@ -2305,7 +2301,7 @@ callfunction(symbol * sym)
    ffcall(sym, nargs);
    if (sc_status != statSKIP)
       markusage(sym, uREAD);   /* do not mark as "used" when this call itself is skipped */
    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 */
       sym->x.lib->value += 1;  /* increment "usage count" of the library */
    modheap(-heapalloc * sizeof(cell));
    sideeffect = TRUE;          /* assume functions carry out a side-effect */
@@ -2375,7 +2371,7 @@ constant(value * lval)
    symbol             *sym;
 
    tok = lex(&val, &st);
    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);
      {
        lval->constval = sym->addr;
        const1(lval->constval);
index 600112f..258d714 100644 (file)
@@ -21,9 +21,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -32,7 +29,7 @@
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
-#include <stdlib.h>            /* for _MAX_PATH */
+#include <limits.h>            /* for PATH_MAX */
 #include <string.h>
 
 #include "embryo_cc_sc.h"
 #include <string.h>
 
 #include "embryo_cc_sc.h"
@@ -250,7 +247,7 @@ alignframe(int numbytes)
    /* "numbytes" should be a power of 2 for this code to work */
    int                 i, count = 0;
 
    /* "numbytes" should be a power of 2 for this code to work */
    int                 i, count = 0;
 
-   for (i = 0; i < sizeof numbytes * 8; i++)
+   for (i = 0; i < (int)(sizeof(numbytes) * 8); i++)
       if (numbytes & (1 << i))
         count++;
    assert(count == 1);
       if (numbytes & (1 << i))
         count++;
    assert(count == 1);
@@ -484,9 +481,9 @@ copyarray(symbol * sym, cell size)
 }
 
 void
 }
 
 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
 
    assert(sym != NULL);
    /* the symbol can be a local array, a global array, or an array
@@ -640,7 +637,7 @@ ffswitch(int label)
 }
 
 void
 }
 
 void
-ffcase(cell value, char *labelname, int newtable)
+ffcase(cell val, char *labelname, int newtable)
 {
    if (newtable)
      {
 {
    if (newtable)
      {
@@ -648,7 +645,7 @@ ffcase(cell value, char *labelname, int newtable)
        code_idx += opcodes(1);
      }                         /* if */
    stgwrite("\tcase ");
        code_idx += opcodes(1);
      }                         /* if */
    stgwrite("\tcase ");
-   outval(value, FALSE);
+   outval(val, FALSE);
    stgwrite(" ");
    stgwrite(labelname);
    stgwrite("\n");
    stgwrite(" ");
    stgwrite(labelname);
    stgwrite("\n");
@@ -752,17 +749,17 @@ modstk(int delta)
 
 /* set the stack to a hard offset from the frame */
 void
 
 /* set the stack to a hard offset from the frame */
 void
-setstk(cell value)
+setstk(cell val)
 {
    stgwrite("\tlctrl 5\n");    /* get FRM */
 {
    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 ");
      {
        stgwrite("\tadd.c ");
-       outval(value, TRUE);    /* add (negative) offset */
+       outval(val, TRUE);      /* add (negative) offset */
        code_idx += opcodes(1) + opargs(1);
        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 */
        //     zero PRI
        //     need new FILL opcode that takes a variable size
      }                         /* if */
@@ -792,10 +789,10 @@ setheap_pri(void)
 }
 
 void
 }
 
 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();
 }
    code_idx += opcodes(1) + opargs(1);
    setheap_pri();
 }
@@ -878,12 +875,12 @@ charalign(void)
  *  Add a constant to the primary register.
  */
 void
  *  Add a constant to the primary register.
  */
 void
-addconst(cell value)
+addconst(cell val)
 {
 {
-   if (value != 0)
+   if (val != 0)
      {
        stgwrite("\tadd.c ");
      {
        stgwrite("\tadd.c ");
-       outval(value, TRUE);
+       outval(val, TRUE);
        code_idx += opcodes(1) + opargs(1);
      }                         /* if */
 }
        code_idx += opcodes(1) + opargs(1);
      }                         /* if */
 }
index cc5fd4f..a8af498 100644 (file)
@@ -1,7 +1,4 @@
-/*
- *  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
  *  In fact a very simple system, using only 'panic mode'.
  *
  *  Copyright (c) ITB CompuPhase, 1997-2003
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
 #include "embryo_cc_sc.h"
 #include "embryo_cc_sc5.scp"
 
 #include "embryo_cc_sc.h"
 #include "embryo_cc_sc5.scp"
 
@@ -51,17 +49,16 @@ static int errstart;        /* line number at which the instruction started */
  *  errors are ignored until lex() finds a semicolumn or a keyword
  *  (lex() resets "errflag" in that case).
  *
  *  errors are ignored until lex() finds a semicolumn or a keyword
  *  (lex() resets "errflag" in that case).
  *
- *  Global references: inpfname   (reffered to only)
- *                     fline      (reffered to only)
- *                     fcurrent   (reffered to only)
+ *  Global references: inpfname   (referred to only)
+ *                     fline      (referred to only)
+ *                     fcurrent   (referred to only)
  *                     errflag    (altered)
  */
 int
 error(int number, ...)
 {
  *                     errflag    (altered)
  */
 int
 error(int number, ...)
 {
-   static char        *prefix[3] = { "error", "fatal error", "warning" };
    static int          lastline, lastfile, errorcount;
    static int          lastline, lastfile, errorcount;
-   char               *msg, *pre;
+   char               *msg;
    va_list             argptr;
    char                string[1024];
    int start;
    va_list             argptr;
    char                string[1024];
    int start;
@@ -78,20 +75,17 @@ error(int number, ...)
    if (number < 100)
      {
        msg = errmsg[number - 1];
    if (number < 100)
      {
        msg = errmsg[number - 1];
-       pre = prefix[0];
        errflag = TRUE; /* set errflag (skip rest of erroneous expression) */
        errnum++;
      }
    else if (number < 200)
      {
        msg = fatalmsg[number - 100];
        errflag = TRUE; /* set errflag (skip rest of erroneous expression) */
        errnum++;
      }
    else if (number < 200)
      {
        msg = fatalmsg[number - 100];
-       pre = prefix[1];
        errnum++; /* a fatal error also counts as an error */
      }
    else
      {
        msg = warnmsg[number - 200];
        errnum++; /* a fatal error also counts as an error */
      }
    else
      {
        msg = warnmsg[number - 200];
-       pre = prefix[2];
        warnnum++;
      }
 
        warnnum++;
      }
 
@@ -116,7 +110,7 @@ error(int number, ...)
        sc_error(0, "\nCompilation aborted.", NULL, 0, 0, argptr);
        va_end(argptr);
 
        sc_error(0, "\nCompilation aborted.", NULL, 0, 0, argptr);
        va_end(argptr);
 
-       if (outf != NULL)
+       if (outf)
          {
             sc_closeasm(outf);
             outf = NULL;
          {
             sc_closeasm(outf);
             outf = NULL;
index 3c2fca2..3525d27 100644 (file)
@@ -21,9 +21,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -34,7 +31,6 @@
 #include <stdlib.h>            /* for macro max() */
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>            /* for macro max() */
 #include <string.h>
 #include <ctype.h>
-#include "embryo_cc_osdefs.h"
 #include "embryo_cc_sc.h"
 
 typedef             cell(*OPCODE_PROC) (FILE * fbin, char *params, cell opcode);
 #include "embryo_cc_sc.h"
 
 typedef             cell(*OPCODE_PROC) (FILE * fbin, char *params, cell opcode);
@@ -87,7 +83,7 @@ hex2long(char *s, char **n)
        result = (result << 4) | digit;
        s++;
      }                         /* for */
        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 */
       *n = s;
    if (negate)
       result = (~result) + 1;  /* take two's complement of the result */
@@ -138,7 +134,7 @@ align32(long *v)
 static char        *
 skipwhitespace(char *str)
 {
 static char        *
 skipwhitespace(char *str)
 {
-   while (isspace(*str))
+   while (sc_isspace(*str))
       str++;
    return str;
 }
       str++;
    return str;
 }
@@ -148,7 +144,7 @@ stripcomment(char *str)
 {
    char               *ptr = strchr(str, ';');
 
 {
    char               *ptr = strchr(str, ';');
 
-   if (ptr != NULL)
+   if (ptr)
      {
        *ptr++ = '\n';          /* terminate the line, but leave the '\n' */
        *ptr = '\0';
      {
        *ptr++ = '\n';          /* terminate the line, but leave the '\n' */
        *ptr = '\0';
@@ -227,7 +223,7 @@ noop(FILE * fbin __UNUSED__, char *params __UNUSED__, cell opcode __UNUSED__)
 static cell
 parm0(FILE * fbin, char *params __UNUSED__, cell opcode)
 {
 static cell
 parm0(FILE * fbin, char *params __UNUSED__, cell opcode)
 {
-   if (fbin != NULL)
+   if (fbin)
       write_encoded(fbin, (ucell *) & opcode, 1);
    return opcodes(1);
 }
       write_encoded(fbin, (ucell *) & opcode, 1);
    return opcodes(1);
 }
@@ -237,7 +233,7 @@ parm1(FILE * fbin, char *params, cell opcode)
 {
    ucell               p = hex2long(params, NULL);
 
 {
    ucell               p = hex2long(params, NULL);
 
-   if (fbin != NULL)
+   if (fbin)
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, &p, 1);
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, &p, 1);
@@ -252,7 +248,7 @@ parm2(FILE * fbin, char *params, cell opcode)
 
    p[0] = hex2long(params, &params);
    p[1] = hex2long(params, NULL);
 
    p[0] = hex2long(params, &params);
    p[1] = hex2long(params, NULL);
-   if (fbin != NULL)
+   if (fbin)
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, p, 2);
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, p, 2);
@@ -273,10 +269,10 @@ do_dump(FILE * fbin, char *params, cell opcode __UNUSED__)
    while (*params != '\0')
      {
        p = hex2long(params, &params);
    while (*params != '\0')
      {
        p = hex2long(params, &params);
-       if (fbin != NULL)
+       if (fbin)
           write_encoded(fbin, &p, 1);
        num++;
           write_encoded(fbin, &p, 1);
        num++;
-       while (isspace(*params))
+       while (sc_isspace(*params))
           params++;
      }                         /* while */
    return num * sizeof(cell);
           params++;
      }                         /* while */
    return num * sizeof(cell);
@@ -290,7 +286,7 @@ do_call(FILE * fbin, char *params, cell opcode)
    symbol             *sym;
    ucell               p;
 
    symbol             *sym;
    ucell               p;
 
-   for (i = 0; !isspace(*params); i++, params++)
+   for (i = 0; !sc_isspace(*params); i++, params++)
      {
        assert(*params != '\0');
        assert(i < sNAMEMAX);
      {
        assert(*params != '\0');
        assert(i < sNAMEMAX);
@@ -307,7 +303,7 @@ do_call(FILE * fbin, char *params, cell opcode)
    assert(sym->vclass == sGLOBAL);
 
    p = sym->addr;
    assert(sym->vclass == sGLOBAL);
 
    p = sym->addr;
-   if (fbin != NULL)
+   if (fbin)
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, &p, 1);
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, &p, 1);
@@ -324,7 +320,7 @@ do_jump(FILE * fbin, char *params, cell opcode)
    i = (int)hex2long(params, NULL);
    assert(i >= 0 && i < labnum);
 
    i = (int)hex2long(params, NULL);
    assert(i >= 0 && i < labnum);
 
-   if (fbin != NULL)
+   if (fbin)
      {
        assert(lbltab != NULL);
        p = lbltab[i];
      {
        assert(lbltab != NULL);
        p = lbltab[i];
@@ -343,10 +339,10 @@ do_file(FILE * fbin, char *params, cell opcode)
    p = hex2long(params, &params);
 
    /* remove leading and trailing white space from the filename */
    p = hex2long(params, &params);
 
    /* remove leading and trailing white space from the filename */
-   while (isspace(*params))
+   while (sc_isspace(*params))
       params++;
    len = strlen(params);
       params++;
    len = strlen(params);
-   while (len > 0 && isspace(params[len - 1]))
+   while (len > 0 && sc_isspace(params[len - 1]))
       len--;
    params[len++] = '\0';       /* zero-terminate */
    while (len % sizeof(cell) != 0)
       len--;
    params[len++] = '\0';       /* zero-terminate */
    while (len % sizeof(cell) != 0)
@@ -354,7 +350,7 @@ do_file(FILE * fbin, char *params, cell opcode)
    assert(len > 0 && len < 256);
    clen = len + sizeof(cell);  /* add size of file ordinal */
 
    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);
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, &clen, 1);
@@ -372,7 +368,7 @@ do_symbol(FILE * fbin, char *params, cell opcode)
    int                 len;
    unsigned char       mclass, type;
 
    int                 len;
    unsigned char       mclass, type;
 
-   for (endptr = params; !isspace(*endptr) && endptr != '\0'; endptr++)
+   for (endptr = params; !sc_isspace(*endptr) && endptr != '\0'; endptr++)
       /* nothing */ ;
    assert(*endptr == ' ');
 
       /* nothing */ ;
    assert(*endptr == ' ');
 
@@ -389,7 +385,7 @@ do_symbol(FILE * fbin, char *params, cell opcode)
       params[len++] = '\0';    /* pad with zeros up to full cell */
    clen = len + 2 * sizeof(cell);      /* add size of symbol address and flags */
 
       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);
      {
        write_encoded(fbin, (ucell *) & opcode, 1);
        write_encoded(fbin, &clen, 1);
@@ -400,7 +396,7 @@ do_symbol(FILE * fbin, char *params, cell opcode)
 
 #if !defined NDEBUG
    /* function should start right after the symbolic information */
 
 #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
 
       assert(offset == codeindex + opcodes(1) + opargs(1) + clen);
 #endif
 
@@ -416,7 +412,7 @@ do_switch(FILE * fbin, char *params, cell opcode)
    i = (int)hex2long(params, NULL);
    assert(i >= 0 && i < labnum);
 
    i = (int)hex2long(params, NULL);
    assert(i >= 0 && i < labnum);
 
-   if (fbin != NULL)
+   if (fbin)
      {
        assert(lbltab != NULL);
        p = lbltab[i];
      {
        assert(lbltab != NULL);
        p = lbltab[i];
@@ -440,7 +436,7 @@ do_case(FILE * fbin, char *params, cell opcode __UNUSED__)
    i = (int)hex2long(params, NULL);
    assert(i >= 0 && i < labnum);
 
    i = (int)hex2long(params, NULL);
    assert(i >= 0 && i < labnum);
 
-   if (fbin != NULL)
+   if (fbin)
      {
        assert(lbltab != NULL);
        p = lbltab[i];
      {
        assert(lbltab != NULL);
        p = lbltab[i];
@@ -662,14 +658,14 @@ assemble(FILE * fout, FILE * fin)
    constvalue         *constptr;
    cell                mainaddr;
    int                 nametable, tags, libraries, publics, natives, pubvars;
    constvalue         *constptr;
    cell                mainaddr;
    int                 nametable, tags, libraries, publics, natives, pubvars;
-   int                 cod, dat, hea, stp, cip, size, defsize;
+   int                 cod, defsize;
 
 #if !defined NDEBUG
    /* verify that the opcode list is sorted (skip entry 1; it is reserved
 
 #if !defined NDEBUG
    /* verify that the opcode list is sorted (skip entry 1; it is reserved
-    * for a non-existant opcode)
+    * for a non-existent opcode)
     */
    assert(opcodelist[1].name != NULL);
     */
    assert(opcodelist[1].name != NULL);
-   for (i = 2; i < (sizeof opcodelist / sizeof opcodelist[0]); i++)
+   for (i = 2; i < (int)(sizeof(opcodelist) / sizeof(opcodelist[0])); i++)
      {
        assert(opcodelist[i].name != NULL);
        assert(strcasecmp(opcodelist[i].name, opcodelist[i - 1].name) > 0);
      {
        assert(opcodelist[i].name != NULL);
        assert(strcasecmp(opcodelist[i].name, opcodelist[i - 1].name) > 0);
@@ -683,7 +679,7 @@ assemble(FILE * fout, FILE * fin)
    numpubvars = 0;
    mainaddr = -1;
    /* count number of public and native functions and public variables */
    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;
      {
        char                alias[sNAMEMAX + 1] = "";
        int                 match = 0;
@@ -727,7 +723,7 @@ assemble(FILE * fout, FILE * fin)
 
    /* count number of libraries */
    numlibraries = 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)
        constptr = constptr->next)
      {
        if (constptr->value > 0)
@@ -740,7 +736,7 @@ assemble(FILE * fout, FILE * fin)
 
    /* count number of public tags */
    numtags = 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)
        constptr = constptr->next)
      {
        if ((constptr->value & PUBLICTAG) != 0)
@@ -785,11 +781,11 @@ assemble(FILE * fout, FILE * fin)
    tags = hdr.tags = hdr.pubvars + numpubvars * sizeof(FUNCSTUB);
    nametable = hdr.nametable = hdr.tags + numtags * sizeof(FUNCSTUB);
    cod = hdr.cod = hdr.nametable + nametablesize + padding;
    tags = hdr.tags = hdr.pubvars + numpubvars * sizeof(FUNCSTUB);
    nametable = hdr.nametable = hdr.tags + numtags * sizeof(FUNCSTUB);
    cod = hdr.cod = hdr.nametable + nametablesize + padding;
-   dat = hdr.dat = hdr.cod + code_idx;
-   hea = hdr.hea = hdr.dat + glb_declared * sizeof(cell);
-   stp = hdr.stp = hdr.hea + sc_stksize * sizeof(cell);
-   cip = hdr.cip = mainaddr;
-   size = hdr.size = hdr.hea;  /* preset, this is incorrect in case of compressed output */
+   hdr.dat = hdr.cod + code_idx;
+   hdr.hea = hdr.dat + glb_declared * sizeof(cell);
+   hdr.stp = hdr.hea + sc_stksize * sizeof(cell);
+   hdr.cip = mainaddr;
+   hdr.size = hdr.hea; /* preset, this is incorrect in case of compressed output */
 #ifdef WORDS_BIGENDIAN
    align32(&hdr.size);
    align16(&hdr.magic);
 #ifdef WORDS_BIGENDIAN
    align32(&hdr.size);
    align16(&hdr.magic);
@@ -816,7 +812,7 @@ assemble(FILE * fout, FILE * fin)
 
    /* write the public functions table */
    count = 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 (sym->ident == iFUNCTN
            && (sym->usage & uPUBLIC) != 0 && (sym->usage & uDEFINE) != 0)
@@ -851,12 +847,12 @@ assemble(FILE * fout, FILE * fin)
    if (numnatives > 0)
      {
        nativelist = (symbol **) malloc(numnatives * sizeof(symbol *));
    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
           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)
          {
             if (sym->ident == iFUNCTN && (sym->usage & uNATIVE) != 0
                 && (sym->usage & uREAD) != 0 && sym->addr >= 0)
@@ -896,7 +892,7 @@ assemble(FILE * fout, FILE * fin)
 
    /* write the libraries table */
    count = 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)
        constptr = constptr->next)
      {
        if (constptr->value > 0)
@@ -919,7 +915,7 @@ assemble(FILE * fout, FILE * fin)
 
    /* write the public variables table */
    count = 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)
          {
      {
        if (sym->ident == iVARIABLE && (sym->usage & uPUBLIC) != 0)
          {
@@ -942,7 +938,7 @@ assemble(FILE * fout, FILE * fin)
 
    /* write the public tagnames table */
    count = 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)
        constptr = constptr->next)
      {
        if ((constptr->value & PUBLICTAG) != 0)
@@ -984,11 +980,11 @@ assemble(FILE * fout, FILE * fin)
        /* only very short programs have zero labels; no first pass is needed
         * if there are no labels */
        lbltab = (cell *) malloc(labnum * sizeof(cell));
        /* 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);
           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);
          {
             stripcomment(line);
             instr = skipwhitespace(line);
@@ -1007,12 +1003,12 @@ assemble(FILE * fout, FILE * fin)
                  /* get to the end of the instruction (make use of the '\n' that fgets()
                   * added at the end of the line; this way we will *always* drop on a
                   * whitespace character) */
                  /* get to the end of the instruction (make use of the '\n' that fgets()
                   * added at the end of the line; this way we will *always* drop on a
                   * whitespace character) */
-                 for (params = instr; *params != '\0' && !isspace(*params);
+                 for (params = instr; *params != '\0' && !sc_isspace(*params);
                       params++)
                     /* nothing */ ;
                  assert(params > instr);
                  i = findopcode(instr, (int)(params - instr));
                       params++)
                     /* 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 */
                    {
                       *params = '\0';
                       error(104, instr);       /* invalid assembler instruction */
@@ -1031,7 +1027,7 @@ assemble(FILE * fout, FILE * fin)
    for (pass = sIN_CSEG; pass <= sIN_DSEG; pass++)
      {
        sc_resetasm(fin);
    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);
          {
             stripcomment(line);
             instr = skipwhitespace(line);
@@ -1043,7 +1039,7 @@ assemble(FILE * fout, FILE * fin)
             /* get to the end of the instruction (make use of the '\n' that fgets()
              * added at the end of the line; this way we will *always* drop on a
              * whitespace character) */
             /* get to the end of the instruction (make use of the '\n' that fgets()
              * added at the end of the line; this way we will *always* drop on a
              * whitespace character) */
-            for (params = instr; *params != '\0' && !isspace(*params);
+            for (params = instr; *params != '\0' && !sc_isspace(*params);
                  params++)
                /* nothing */ ;
             assert(params > instr);
                  params++)
                /* nothing */ ;
             assert(params > instr);
@@ -1057,7 +1053,7 @@ assemble(FILE * fout, FILE * fin)
    if (bytes_out - bytes_in > 0)
       error(106);              /* compression buffer overflow */
 
    if (bytes_out - bytes_in > 0)
       error(106);              /* compression buffer overflow */
 
-   if (lbltab != NULL)
+   if (lbltab)
      {
        free(lbltab);
 #if !defined NDEBUG
      {
        free(lbltab);
 #if !defined NDEBUG
index 7eecabb..b51f2ea 100644 (file)
@@ -38,9 +38,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -80,7 +77,7 @@ static void
 grow_stgbuffer(int requiredsize)
 {
    char               *p;
 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
 
    assert(stgmax < requiredsize);
    /* if the staging buffer (holding intermediate code for one line) grows
@@ -89,11 +86,11 @@ grow_stgbuffer(int requiredsize)
    if (requiredsize > sSTG_MAX)
       error(102, "staging buffer");    /* staging buffer overflow (fatal error) */
    stgmax = requiredsize + sSTG_GROW;
    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));
       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)
       error(102, "staging buffer");    /* staging buffer overflow (fatal error) */
    stgbuf = p;
    if (clear)
@@ -103,7 +100,7 @@ grow_stgbuffer(int requiredsize)
 void
 stgbuffer_cleanup(void)
 {
 void
 stgbuffer_cleanup(void)
 {
-   if (stgbuf != NULL)
+   if (stgbuf)
      {
        free(stgbuf);
        stgbuf = NULL;
      {
        free(stgbuf);
        stgbuf = NULL;
@@ -238,7 +235,7 @@ typedef struct
  *  by '[', sENDREORDER by ']' and sEXPRSTART by '|' the following applies:
  *     '[]...'     valid, but useless; no output
  *     '[|...]     valid, but useless; only one string
  *  by '[', sENDREORDER by ']' and sEXPRSTART by '|' the following applies:
  *     '[]...'     valid, but useless; no output
  *     '[|...]     valid, but useless; only one string
- *     '[|...|...] valid and usefull
+ *     '[|...|...] valid and useful
  *     '[...|...]  invalid, first string doesn't start with '|'
  *     '[|...|]    invalid
  */
  *     '[...|...]  invalid, first string doesn't start with '|'
  *     '[|...|]    invalid
  */
@@ -256,7 +253,7 @@ stgstring(char *start, char *end)
             start += 1;        /* skip token */
             /* allocate a argstack with sMAXARGS items */
             stack = (argstack *) malloc(sMAXARGS * sizeof(argstack));
             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 */
                error(103);     /* insufficient memory */
             nest = 1;          /* nesting counter */
             argc = 0;          /* argument counter */
@@ -319,7 +316,7 @@ stgstring(char *start, char *end)
  *  Scraps code from the staging buffer by resetting "stgidx" to "index".
  *
  *  Global references: stgidx (altered)
  *  Scraps code from the staging buffer by resetting "stgidx" to "index".
  *
  *  Global references: stgidx (altered)
- *                     staging (reffered to only)
+ *                     staging (referred to only)
  */
 void
 stgdel(int index, cell code_index)
  */
 void
 stgdel(int index, cell code_index)
@@ -384,11 +381,11 @@ phopt_init(void)
    char                str[160];
 
    /* count number of sequences */
    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 */
 
       /* 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) */
       return FALSE;
 
    /* pre-initialize all to NULL (in case of failure) */
@@ -405,21 +402,21 @@ phopt_init(void)
        len =
           strexpand(str, (unsigned char *)sequences_cmp[i].find, sizeof str,
                     SCPACK_TABLE);
        len =
           strexpand(str, (unsigned char *)sequences_cmp[i].find, sizeof str,
                     SCPACK_TABLE);
-       assert(len <= sizeof str);
-       assert(len == (int)strlen(str) + 1);
+       assert(len <= (int)(sizeof(str)));
+       assert(len == (int)(strlen(str) + 1));
        sequences[i].find = (char *)malloc(len);
        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,
                     SCPACK_TABLE);
           strcpy(sequences[i].find, str);
        len =
           strexpand(str, (unsigned char *)sequences_cmp[i].replace, sizeof str,
                     SCPACK_TABLE);
-       assert(len <= sizeof str);
-       assert(len == (int)strlen(str) + 1);
+       assert(len <= (int)(sizeof(str)));
+       assert(len == (int)(strlen(str) + 1));
        sequences[i].replace = (char *)malloc(len);
        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;
           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 */
 
           return phopt_cleanup();
      }                         /* for */
 
@@ -431,14 +428,14 @@ phopt_cleanup(void)
 {
    int                 i;
 
 {
    int                 i;
 
-   if (sequences != NULL)
+   if (sequences)
      {
        i = 0;
      {
        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);
                free(sequences[i].find);
-            if (sequences[i].replace != NULL)
+            if (sequences[i].replace)
                free(sequences[i].replace);
             i++;
          }                     /* while */
                free(sequences[i].replace);
             i++;
          }                     /* while */
@@ -474,7 +471,7 @@ matchsequence(char *start, char *end, char *pattern,
          {
          case '%':             /* new "symbol" */
             pattern++;
          {
          case '%':             /* new "symbol" */
             pattern++;
-            assert(isdigit(*pattern));
+            assert(sc_isdigit(*pattern));
             var = atoi(pattern) - 1;
             assert(var >= 0 && var < _maxoptvars);
             assert(alphanum(*start));
             var = atoi(pattern) - 1;
             assert(var >= 0 && var < _maxoptvars);
             assert(alphanum(*start));
@@ -545,7 +542,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
          {
          case '%':
             lptr++;            /* skip '%' */
          {
          case '%':
             lptr++;            /* skip '%' */
-            assert(isdigit(*lptr));
+            assert(sc_isdigit(*lptr));
             var = atoi(lptr) - 1;
             assert(var >= 0 && var < _maxoptvars);
             assert(symbols[var][0] != '\0');   /* variable should be defined */
             var = atoi(lptr) - 1;
             assert(var >= 0 && var < _maxoptvars);
             assert(symbols[var][0] != '\0');   /* variable should be defined */
@@ -561,7 +558,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
      }                         /* while */
 
    /* allocate a buffer to replace the sequence in */
      }                         /* while */
 
    /* allocate a buffer to replace the sequence in */
-   if ((buffer = malloc(*repl_length)) == NULL)
+   if (!(buffer = malloc(*repl_length)))
      {
        error(103);
        return NULL;
      {
        error(103);
        return NULL;
@@ -578,7 +575,7 @@ replacesequence(char *pattern, char symbols[_maxoptvars][_aliasmax + 1],
          case '%':
             /* write out the symbol */
             pattern++;
          case '%':
             /* write out the symbol */
             pattern++;
-            assert(isdigit(*pattern));
+            assert(sc_isdigit(*pattern));
             var = atoi(pattern) - 1;
             assert(var >= 0 && var < _maxoptvars);
             assert(symbols[var][0] != '\0');   /* variable should be defined */
             var = atoi(pattern) - 1;
             assert(var >= 0 && var < _maxoptvars);
             assert(symbols[var][0] != '\0');   /* variable should be defined */
@@ -641,7 +638,7 @@ stgopt(char *start, char *end)
        else
          {
             seq = 0;
        else
          {
             seq = 0;
-            while (sequences[seq].find != NULL)
+            while (sequences[seq].find)
               {
                  assert(seq >= 0);
                  if (matchsequence
               {
                  assert(seq >= 0);
                  if (matchsequence
index d724765..6ab34a1 100644 (file)
@@ -11,9 +11,6 @@
  * complete file.
  */
 
  * complete file.
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #include "embryo_cc_sc.h"
 
 
 #include "embryo_cc_sc.h"
 
index 957fc19..e908248 100644 (file)
@@ -24,9 +24,6 @@
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -46,22 +43,22 @@ insert_stringpair(stringpair * root, char *first, char *second, int matchlength)
    assert(first != NULL);
    assert(second != NULL);
    /* create a new node, and check whether all is okay */
    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;
       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);
           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 */
           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;
        pred = pred->next)
       /* nothing */ ;
    cur->next = pred->next;
@@ -76,7 +73,7 @@ delete_stringpairtable(stringpair * root)
 
    assert(root != NULL);
    cur = root->next;
 
    assert(root != NULL);
    cur = root->next;
-   while (cur != NULL)
+   while (cur)
      {
        next = cur->next;
        assert(cur->first != NULL);
      {
        next = cur->next;
        assert(cur->first != NULL);
@@ -96,7 +93,7 @@ find_stringpair(stringpair * cur, char *first, int matchlength)
 
    assert(matchlength > 0);    /* the function cannot handle zero-length comparison */
    assert(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)
      {
        result = (int)*cur->first - (int)*first;
        if (result == 0 && matchlength == cur->matchlength)
@@ -117,7 +114,7 @@ delete_stringpair(stringpair * root, stringpair * item)
 
    assert(root != NULL);
    cur = root;
 
    assert(root != NULL);
    cur = root;
-   while (cur->next != NULL)
+   while (cur->next)
      {
        if (cur->next == item)
          {
      {
        if (cur->next == item)
          {
@@ -146,7 +143,7 @@ insert_alias(char *name, char *alias)
    assert(strlen(name) <= sNAMEMAX);
    assert(alias != NULL);
    assert(strlen(alias) <= sEXPMAX);
    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;
 }
       error(103);              /* insufficient memory (fatal error) */
    return cur;
 }
@@ -156,12 +153,12 @@ lookup_alias(char *target, char *name)
 {
    stringpair         *cur =
       find_stringpair(alias_tab.next, name, strlen(name));
 {
    stringpair         *cur =
       find_stringpair(alias_tab.next, name, strlen(name));
-   if (cur != NULL)
+   if (cur)
      {
        assert(strlen(cur->second) <= sEXPMAX);
        strcpy(target, cur->second);
      }                         /* if */
      {
        assert(strlen(cur->second) <= sEXPMAX);
        strcpy(target, cur->second);
      }                         /* if */
-   return cur != NULL;
+   return !!cur;
 }
 
 void
 }
 
 void
@@ -179,9 +176,9 @@ insert_path(char *path)
    stringlist         *cur;
 
    assert(path != NULL);
    stringlist         *cur;
 
    assert(path != NULL);
-   if ((cur = (stringlist *) malloc(sizeof(stringlist))) == NULL)
+   if (!(cur = (stringlist *)malloc(sizeof(stringlist))))
       error(103);              /* insufficient memory (fatal error) */
       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;
       error(103);              /* insufficient memory (fatal error) */
    cur->next = includepaths.next;
    includepaths.next = cur;
@@ -193,9 +190,9 @@ get_path(int index)
 {
    stringlist         *cur = includepaths.next;
 
 {
    stringlist         *cur = includepaths.next;
 
-   while (cur != NULL && index-- > 0)
+   while (cur && index-- > 0)
       cur = cur->next;
       cur = cur->next;
-   if (cur != NULL)
+   if (cur)
      {
        assert(cur->line != NULL);
        return cur->line;
      {
        assert(cur->line != NULL);
        return cur->line;
@@ -208,7 +205,7 @@ delete_pathtable(void)
 {
    stringlist         *cur = includepaths.next, *next;
 
 {
    stringlist         *cur = includepaths.next, *next;
 
-   while (cur != NULL)
+   while (cur)
      {
        next = cur->next;
        assert(cur->line != NULL);
      {
        next = cur->next;
        assert(cur->line != NULL);
@@ -232,7 +229,7 @@ adjustindex(char c)
    assert((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_');
    assert('A' < '_' && '_' < 'z');
 
    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;
        cur = cur->next)
       /* nothing */ ;
    substindex[(int)c - 'A'] = cur;
@@ -245,9 +242,7 @@ insert_subst(char *pattern, char *substitution, int prefixlen)
 
    assert(pattern != NULL);
    assert(substitution != NULL);
 
    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;
       error(103);              /* insufficient memory (fatal error) */
    adjustindex(*pattern);
    return cur;
@@ -263,7 +258,7 @@ find_subst(char *name, int length)
    assert((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z')
          || *name == '_');
    item = substindex[(int)*name - 'A'];
    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;
 }
       item = find_stringpair(item, name, length);
    return item;
 }
@@ -278,9 +273,9 @@ delete_subst(char *name, int length)
    assert((*name >= 'A' && *name <= 'Z') || (*name >= 'a' && *name <= 'z')
          || *name == '_');
    item = substindex[(int)*name - 'A'];
    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);
       item = find_stringpair(item, name, length);
-   if (item == NULL)
+   if (!item)
       return FALSE;
    delete_stringpair(&substpair, item);
    adjustindex(*name);
       return FALSE;
    delete_stringpair(&substpair, item);
    adjustindex(*name);
@@ -293,6 +288,6 @@ delete_substtable(void)
    int                 i;
 
    delete_stringpairtable(&substpair);
    int                 i;
 
    delete_stringpairtable(&substpair);
-   for (i = 0; i < sizeof substindex / sizeof substindex[0]; i++)
+   for (i = 0; i < (int)(sizeof(substindex) / sizeof(substindex[0])); i++)
       substindex[i] = NULL;
 }
       substindex[i] = NULL;
 }
index 0fa802a..f369b9b 100644 (file)
  *  Version: $Id$
  */
 
  *  Version: $Id$
  */
 
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
 
 
-#include <stdlib.h>            /* for _MAX_PATH */
+#ifdef HAVE_CONFIG_H
+# include <config.h>           /* for PATH_MAX */
+#endif
+
 #include "embryo_cc_sc.h"
 
 /*  global variables
 #include "embryo_cc_sc.h"
 
 /*  global variables
@@ -45,7 +45,7 @@ constvalue libname_tab = { NULL, "", 0, 0 };  /* library table (#pragma library "
 constvalue *curlibrary = NULL; /* current library */
 symbol  *curfunc;      /* pointer to current function */
 char    *inpfname;     /* pointer to name of the file currently read from */
 constvalue *curlibrary = NULL; /* current library */
 symbol  *curfunc;      /* pointer to current function */
 char    *inpfname;     /* pointer to name of the file currently read from */
-char     outfname[_MAX_PATH];  /* output file name */
+char     outfname[PATH_MAX];   /* output file name */
 char     sc_ctrlchar = CTRL_CHAR;      /* the control character (or escape character) */
 int      litidx = 0;   /* index to literal table */
 int      litmax = sDEF_LITMAX; /* current size of the literal table */
 char     sc_ctrlchar = CTRL_CHAR;      /* the control character (or escape character) */
 int      litidx = 0;   /* index to literal table */
 int      litmax = sDEF_LITMAX; /* current size of the literal table */
index 50ab731..650aa83 100644 (file)
@@ -1,3 +1,312 @@
+/** 
+@brief Embryo Library
+These routines are used for Embryo.
+
+@mainpage Embryo Library Documentation
+
+@image html  e_big.png
+
+@version 1.7.0
+@author Carsten Haitzler <raster\@rasterman.com>
+@author Compuphase http://www.compuphase.com
+@date 2004-2012
+
+@section intro What is Embryo?
+
+Embryo is a tiny library designed to interpret limited Small programs
+compiled by the included compiler, @c embryo_cc.  It is mostly a cleaned
+up and smaller version of the original Small abstract machine.  The
+compiler is mostly untouched.
+
+Small was renamed to Pawn.
+For more information about the Pawn language, see 
+@htmlonly <a href=http://www.compuphase.com/pawn/pawn.htm>Pawn</a>
+@endhtmlonly
+@latexonly http://www.compuphase.com/pawn/pawn.htm @endlatexonly
+For the basics about the Small language, see @ref Small_Page.
+
+@section How_to_Use How to Use Embryo?
+
+To use Embryo in your code, you need to do at least the following:
+
+@li Include @ref Embryo.h.
+@li Load the Embryo program using one of the 
+    @ref Embryo_Program_Creation_Group.
+@li Set up the native calls with @ref embryo_program_native_call_add.
+@li Create a virtual machine with @ref embryo_program_vm_push.
+@li Then run the program with @ref embryo_program_run.
+
+@todo Clean up compiler code.
+@todo Proper overview of the operation of the interpreter, that is how
+      the heap, stack, virtual machines, etc fit together.
+
+@page Small_Page Brief Introduction to Small
+
+This section describes the basics of Small, as compiled and interpreted
+with Embryo.
+
+This summary assumes that you are familar with C.  For a full list of
+differences between C and Small, again, see the full documentation.
+
+@section Small_Variables_Section Variables
+
+@subsection Small_Type_Subsection Types
+
+There is only one type, known as the "cell", which can hold an integer.
+
+@subsection Small_Scope_Subsection Scope
+
+The scope and usage of a variable depends on its declaration.
+
+@li A local variable is normally declared with the @c new keyword. E.g.
+    @code new variable @endcode
+@li A static function variable is defined within a function with the
+    @c static keyword.
+@li A global static variable is one that is only available within the
+    file it was declared in.  Again, use the @c static keyword, but outside
+    of any function.
+@li A stock variable is one that may not be compiled into a program if it
+    is not used.  It is declared using @c stock.
+@li A public variable is one that can be read by the host program using
+    @ref embryo_program_variable_find.  It is declared using @c public
+    keyword.
+
+Remember that the keywords above are to be used on their own.  That is,
+for example: @code public testvar @endcode not:
+@code new public testvar @endcode
+
+@subsection Small_Constants_Subsection Constants
+
+You can declare constants in two ways:
+@li Using the preprocessor macro @c \#define.
+@li By inserting @c const between the keyword and variable name of a
+    variable declaration.  For example, to declare the variable @c var1
+    constant, you type @code new const var1 = 2 @endcode  Now @c var1
+    cannot be changed.
+
+@subsection Small_Arrays_Subsection Arrays
+
+To declare an array, append square brackets to the end of the variable
+name.  The following examples show how to declare arrays.  Note the
+use of the ellipsis operator, which bases the array based on the last two
+declared values:
+
+@code
+new msg[] = "A message."
+new ints[] = {1, 3, 4}
+new ints2[20] = {1, 3}         // All other elements 0.
+new ints3[10] = {1, ... }      // All elements = 1
+new ints4[10] = {10, 20, ... } // Elements = 10 -> 100.
+                               // The difference can be negative.
+new ints5[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
+@endcode
+
+@note Array initialisers need to be constant.
+
+@section Small_Func_Calls_Section Function Calls
+
+A typical function declaration is as follows:
+
+@code
+testfunc(param) {
+  // Do something ...
+  // over a couple of lines.
+}
+@endcode
+
+You can pass by reference.  That is, the parameter you pass is changed
+outside of the function.  For example:
+
+@code
+testfunc(&param) {
+  param = 10
+  // The passed variable will be set to 10 outside of the function.
+}
+@endcode
+
+To pass an array:
+
+@code
+testfunc(param[]) {
+  // Do something to the array
+}
+@endcode
+
+@note Arrays are passed by reference.
+
+@section Small_Control_Subsection Control Structures.
+
+Small has the following control structures, which similar to their C
+counterparts:
+@li @code if (expression) statement1 else statement2 @endcode
+@li @code switch (expression) {
+  case 0:
+    statement1 // Can only be one statement.  Look Ma, no breaks!
+  case 1..3:   // For values between 1 and 3 inclusive.
+    statement2
+  default:     // Optional
+    statement3
+}
+@endcode
+@li @code while(expression) statement @endcode
+@li @code do statement while (expression) @endcode
+@li @code for (init_expression; before_iter_test_expression; after_iter_expression) statement @endcode
+
+@section Small_Preprocessor_Section Preprocessor
+
+The following preprocessor directives are available:
+@li @code #assert constant_expression @endcode
+@li @code #define pattern replacement @endcode
+@li @code #define pattern(%1,%2,...) replacement @endcode
+@li @code #include filename @endcode
+@li @code #if constant_expression
+  // Various bits of code
+#else
+  // Other bits of code
+#endif 
+@endcode
+@li @code #undef pattern @endcode
+
+
+@page Available_Native_Calls_Page Available Calls
+
+Embryo provides a minimal set of native calls that can be used within
+any Embryo script.  Those calls are detailed here.
+
+@note Some of the "core" functions here are also described in the full
+      Small documentation given 
+
+@todo Finish this section.
+
+@section Args_ANC_Section Argument Functions
+
+@subsection Numargs_Desc numargs
+
+Returns the number of arguments passed to a function.  Useful
+when dealing with variable argument lists.
+
+@subsection Getargs_Desc getarg(arg, index=0)
+
+Retrieves the argument number @c arg.  If the argument is an array,
+use @c index to specify the index of the array to return.
+
+@subsection Setargs_Desc setargs(arg, index=0, value)
+
+Sets the argument number @c arg to the given @c arg.  @c index specifies
+the index of @c arg to set if @c arg is an array.
+
+@section String_ANC_Section String Functions
+
+Functions that work on strings.
+
+@subsection Atoi_Desc atoi
+
+Translates an number in string form into an integer.
+
+@subsection Fnmatch_Desc fnmatch
+
+Buggered if I know what this does?
+
+@subsection Strcmp_Desc strcmp
+
+String comparing function.
+
+
+@section Float_ANC_Section Float Functions
+
+@subsection Float_Desc float
+
+@subsection Atof_Desc atof
+
+@subsection Float_Mul_Desc float_mul
+
+@subsection Float_Div_Desc float_div
+
+@subsection Float_Add_Desc float_add
+
+@subsection Float_Sub_Desc float_sub
+
+@subsection Fract_Desc fract
+
+@subsection Round_Desc round
+
+@subsection Float_Cmp_Desc float_cmp
+
+@subsection Sqrt_Desc sqrt
+
+@subsection Pow_Desc pow
+
+@subsection Log_Desc log
+
+@subsection Sin_Desc sin
+
+@subsection Cos_Desc cos
+
+@subsection Tan_Desc tan
+
+@subsection Abs_Desc abs
+
+Returns the absolute value of the given float.
+
+@section Time_ANC_Section Time Functions
+
+@subsection Seconds_Desc seconds()
+
+@subsection Date_Desc date
+
+
+@section Rand_ANC_Section Random Functions
+
+@subsection Rand_Desc rand()
+
+Returns a random integer.
+
+@subsection Randf_Desc randf()
+
+Returns a random float.
+
+@file Embryo.h
+@brief Embryo virtual machine library.
+
+This file includes the routines needed for Embryo library interaction.
+This is the @e only file you need to include.
+
+*/
+
+// The following definitions are in Embryo.h, but I did not want to
+// mess up the formatting of the file
+
+/**
+  @def EMBRYO_FUNCTION_NONE 
+  An invalid/non-existent function.
+*/
+
+/**
+  @def EMBRYO_FUNCTION_MAIN
+  Start at program entry point.  For use with @ref embryo_program_run.
+*/
+
+/**
+  @def EMBRYO_FUNCTION_CONT
+  Continue from last address.  For use with @ref embryo_program_run.
+*/
+
+/**
+  @def EMBRYO_PROGRAM_OK
+  Program was run successfully.
+*/
+
+/**
+  @def EMBRYO_PROGRAM_SLEEP
+  The program's execution was interrupted by a Small @c sleep command.
+*/
+
+/**
+  @def EMBRYO_PROGRAM_FAIL
+  An error in the program caused it to fail.
+*/
+
 #ifndef _EMBRYO_H
 #define _EMBRYO_H
 
 #ifndef _EMBRYO_H
 #define _EMBRYO_H
 
 extern "C" {
 #endif
 
 extern "C" {
 #endif
 
-   /* potentioal error values */
-   enum
+#define EMBRYO_VERSION_MAJOR 1
+#define EMBRYO_VERSION_MINOR 8
+   
+   typedef struct _Embryo_Version
+     {
+        int major;
+        int minor;
+        int micro;
+        int revision;
+     } Embryo_Version;
+   
+   EAPI extern Embryo_Version *embryo_version;
+   
+   /* potential error values */
+   typedef enum _Embryo_Error
      {
        EMBRYO_ERROR_NONE,
          /* reserve the first 15 error codes for exit codes of the abstract machine */
      {
        EMBRYO_ERROR_NONE,
          /* reserve the first 15 error codes for exit codes of the abstract machine */
@@ -60,25 +382,29 @@ extern "C" {
          EMBRYO_ERROR_INIT_JIT,     /** Cannot initialize the JIT */
          EMBRYO_ERROR_PARAMS,       /** Parameter error */
          EMBRYO_ERROR_DOMAIN,       /** Domain error, expression result does not fit in range */
          EMBRYO_ERROR_INIT_JIT,     /** Cannot initialize the JIT */
          EMBRYO_ERROR_PARAMS,       /** Parameter error */
          EMBRYO_ERROR_DOMAIN,       /** Domain error, expression result does not fit in range */
-     };
+     } Embryo_Error;
 
 
-   /* possible function type values that are enumerated */
-#define EMBRYO_FUNCTION_NONE 0x7fffffff /* An invalid/non existant function */
-#define EMBRYO_FUNCTION_MAIN -1         /* Start at program entry point */
-#define EMBRYO_FUNCTION_CONT -2         /* Continue from last address */
-  /** An invalid cell reference */
-#define EMBRYO_CELL_NONE     0x7fffffff
    /* program run return values */
    /* program run return values */
-#define EMBRYO_PROGRAM_OK      1
-#define EMBRYO_PROGRAM_SLEEP   2
-#define EMBRYO_PROGRAM_BUSY    3
-#define EMBRYO_PROGRAM_TOOLONG 4
-#define EMBRYO_PROGRAM_FAIL    0
-
+   typedef enum _Embryo_Status
+     {
+        EMBRYO_PROGRAM_FAIL = 0,
+        EMBRYO_PROGRAM_OK = 1,
+        EMBRYO_PROGRAM_SLEEP = 2,
+        EMBRYO_PROGRAM_BUSY = 3,
+        EMBRYO_PROGRAM_TOOLONG = 4
+     } Embryo_Status;
+   
    typedef unsigned int                Embryo_UCell;
    typedef int                         Embryo_Cell;
    typedef unsigned int                Embryo_UCell;
    typedef int                         Embryo_Cell;
+  /** An invalid cell reference */
+#define EMBRYO_CELL_NONE     0x7fffffff
+   
    typedef struct _Embryo_Program      Embryo_Program;
    typedef int                         Embryo_Function;
    typedef struct _Embryo_Program      Embryo_Program;
    typedef int                         Embryo_Function;
+   /* possible function type values that are enumerated */
+#define EMBRYO_FUNCTION_NONE 0x7fffffff /* An invalid/non existent function */
+#define EMBRYO_FUNCTION_MAIN -1         /* Start at program entry point */
+#define EMBRYO_FUNCTION_CONT -2         /* Continue from last address */
 
    typedef union
      {
 
    typedef union
      {
@@ -86,47 +412,487 @@ extern "C" {
        Embryo_Cell c;
      } Embryo_Float_Cell;
 
        Embryo_Cell c;
      } Embryo_Float_Cell;
 
+#if defined _MSC_VER || defined __SUNPRO_C
 /** Float to Embryo_Cell */
 /** Float to Embryo_Cell */
-#define EMBRYO_FLOAT_TO_CELL(f) ((Embryo_Float_Cell) f).c
+# define EMBRYO_FLOAT_TO_CELL(f) (((Embryo_Float_Cell *)&(f))->c)
 /** Embryo_Cell to float */
 /** Embryo_Cell to float */
-#define EMBRYO_CELL_TO_FLOAT(c) ((Embryo_Float_Cell) c).f
-
-   EAPI int              embryo_init(void);
-   EAPI int              embryo_shutdown(void);
-
-   EAPI Embryo_Program  *embryo_program_new(void *data, int size);
-   EAPI Embryo_Program  *embryo_program_const_new(void *data, int size);
-   EAPI Embryo_Program  *embryo_program_load(char *file);
-   EAPI void             embryo_program_free(Embryo_Program *ep);
-   EAPI void             embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params));
-   EAPI void             embryo_program_vm_reset(Embryo_Program *ep);
-   EAPI void             embryo_program_vm_push(Embryo_Program *ep);
-   EAPI void             embryo_program_vm_pop(Embryo_Program *ep);
-   EAPI void             embryo_swap_16(unsigned short *v);
-   EAPI void             embryo_swap_32(unsigned int *v);
-   EAPI Embryo_Function  embryo_program_function_find(Embryo_Program *ep, const char *name);
-   EAPI Embryo_Cell      embryo_program_variable_find(Embryo_Program *ep, const char *name);
-   EAPI int              embryo_program_variable_count_get(Embryo_Program *ep);
-   EAPI Embryo_Cell      embryo_program_variable_get(Embryo_Program *ep, int num);
-   EAPI void             embryo_program_error_set(Embryo_Program *ep, int error);
-   EAPI int              embryo_program_error_get(Embryo_Program *ep);
-   EAPI void             embryo_program_data_set(Embryo_Program *ep, void *data);
-   EAPI void            *embryo_program_data_get(Embryo_Program *ep);
-   EAPI const char      *embryo_error_string_get(int error);
-   EAPI int              embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell);
-   EAPI void             embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst);
-   EAPI void             embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cell);
-   EAPI Embryo_Cell     *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr);
-   EAPI Embryo_Cell      embryo_data_heap_push(Embryo_Program *ep, int cells);
-   EAPI void             embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to);
-   EAPI int              embryo_program_recursion_get(Embryo_Program *ep);
-   EAPI int              embryo_program_run(Embryo_Program *ep, Embryo_Function func);
-   EAPI Embryo_Cell      embryo_program_return_value_get(Embryo_Program *ep);
-   EAPI void             embryo_program_max_cycle_run_set(Embryo_Program *ep, int max);
-   EAPI int              embryo_program_max_cycle_run_get(Embryo_Program *ep);
-   EAPI int              embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell);
-   EAPI int              embryo_parameter_string_push(Embryo_Program *ep, const char *str);
-   EAPI int              embryo_parameter_cell_array_push(Embryo_Program *ep, Embryo_Cell *cells, int num);
+# define EMBRYO_CELL_TO_FLOAT(c) (((Embryo_Float_Cell *)&(c))->f)
+#else
+/** Float to Embryo_Cell */
+# define EMBRYO_FLOAT_TO_CELL(f) ((Embryo_Float_Cell) f).c
+/** Embryo_Cell to float */
+# define EMBRYO_CELL_TO_FLOAT(c) ((Embryo_Float_Cell) c).f
+#endif
+
+   /**
+    * @defgroup Embryo_Library_Group Library Maintenance Functions
+    *
+    * Functions that start up and shutdown the Embryo library.
+    */
+   
+   
+/**
+ * Initialises the Embryo library.
+ * @return  The number of times the library has been initialised without being
+ *          shut down.
+ * @ingroup Embryo_Library_Group
+ */
+EAPI int              embryo_init(void);
+   
+/**
+ * Shuts down the Embryo library.
+ * @return  The number of times the library has been initialised without being
+ *          shutdown.
+ * @ingroup Embryo_Library_Group
+ */
+EAPI int              embryo_shutdown(void);
+
+   /**
+    * @defgroup Embryo_Program_Creation_Group Program Creation and Destruction Functions
+    *
+    * Functions that set up programs, and destroy them.
+    */
+   
+/**
+ * Creates a new Embryo program, with bytecode data that can be freed.
+ * @param   data Pointer to the bytecode of the program.
+ * @param   size Number of bytes of bytecode.
+ * @return  A new Embryo program.
+ * @ingroup Embryo_Program_Creation_Group
+ */
+EAPI Embryo_Program  *embryo_program_new(void *data, int size);
+   
+/**
+ * Creates a new Embryo program, with bytecode data that cannot be
+ * freed.
+ * @param   data Pointer to the bytecode of the program.
+ * @param   size Number of bytes of bytecode.
+ * @return  A new Embryo program.
+ * @ingroup Embryo_Program_Creation_Group
+ */
+EAPI Embryo_Program  *embryo_program_const_new(void *data, int size);
+   
+/**
+ * Creates a new Embryo program based on the bytecode data stored in the
+ * given file.
+ * @param   file Filename of the given file.
+ * @return  A new Embryo program.
+ * @ingroup Embryo_Program_Creation_Group
+ */
+EAPI Embryo_Program  *embryo_program_load(const char *file);
+   
+/**
+ * Frees the given Embryo program.
+ * @param   ep The given program.
+ * @ingroup Embryo_Program_Creation_Group
+ */
+EAPI void             embryo_program_free(Embryo_Program *ep);
+   
+/**
+ * Adds a native program call to the given Embryo program.
+ * @param   ep   The given Embryo program.
+ * @param   name The name for the call used in the script.
+ * @param   func The function to use when the call is made.
+ * @ingroup Embryo_Func_Group
+ */
+
+/**
+ * @defgroup Embryo_Func_Group Function Functions
+ *
+ * Functions that deal with Embryo program functions.
+ */
+EAPI void             embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params));
+   
+/**
+ * Resets the current virtual machine session of the given program.
+ * @param   ep The given program.
+ * @ingroup Embryo_Program_VM_Group
+ */
+
+/**
+ * @defgroup Embryo_Program_VM_Group Virtual Machine Functions
+ *
+ * Functions that deal with creating and destroying virtual machine sessions
+ * for a given program.
+ *
+ * A given embryo program can have multiple virtual machine sessions running.
+ * This is useful when you have a native call that in turn calls a function in
+ * the embryo program.  The native call can start a new virtual machine
+ * session to run the function it needs.  Once completed, the session can be
+ * popped off the program's stack, and the native call can return its value
+ * to the old session.
+ *
+ * A new virtual machine session is created by pushing a new virtual machine
+ * onto the session stack of a program using @ref embryo_program_vm_push.
+ * The current virtual machine session can be destroyed by calling
+ * @ref embryo_program_vm_pop.
+ */
+EAPI void             embryo_program_vm_reset(Embryo_Program *ep);
+   
+/**
+ * Starts a new virtual machine session for the given program.
+ *
+ * See @ref Embryo_Program_VM_Group for more information about how this works.
+ *
+ * @param   ep The given program.
+ * @ingroup Embryo_Program_VM_Group
+ */
+EAPI void             embryo_program_vm_push(Embryo_Program *ep);
+   
+/**
+ * Frees the current virtual machine session associated with the given program.
+ *
+ * See @ref Embryo_Program_VM_Group for more information about how this works.
+ * Note that you will need to retrieve any return data or data on the stack
+ * before you pop.
+ *
+ * @param   ep The given program.
+ * @ingroup Embryo_Program_VM_Group
+ */
+EAPI void             embryo_program_vm_pop(Embryo_Program *ep);
+   
+/**
+ * Ensures that the given unsigned short integer is in the small
+ * endian format.
+ * @param   v Pointer to the given integer.
+ * @ingroup Embryo_Swap_Group
+ */
+
+/**
+ * @defgroup Embryo_Swap_Group Byte Swapping Functions
+ *
+ * Functions that are used to ensure that integers passed to the
+ * virtual machine are in small endian format.  These functions are
+ * used to ensure that the virtual machine operates correctly on big
+ * endian machines.
+ */
+EAPI void             embryo_swap_16(unsigned short *v);
+   
+/**
+ * Ensures that the given unsigned integer is in the small endian
+ * format.
+ * @param   v Pointer to the given integer.
+ * @ingroup Embryo_Swap_Group
+ */
+EAPI void             embryo_swap_32(unsigned int *v);
+   
+/**
+ * Returns the function in the given program with the given name.
+ * @param   ep The given program.
+ * @param   name The given function name.
+ * @return  The function if successful.  Otherwise, @c EMBRYO_FUNCTION_NONE.
+ * @ingroup Embryo_Func_Group
+ */
+EAPI Embryo_Function  embryo_program_function_find(Embryo_Program *ep, const char *name);
+   
+/**
+ * Retrieves the location of the public variable in the given program
+ * with the given name.
+ * @param   ep   The given program.
+ * @param   name The given name.
+ * @return  The address of the variable if found.  @c EMBRYO_CELL_NONE
+ *          otherwise.
+ * @ingroup Embryo_Public_Variable_Group
+ */
+
+/**
+ * @defgroup Embryo_Public_Variable_Group Public Variable Access Functions
+ *
+ * In an Embryo program, a global variable can be declared public, as
+ * described in @ref Small_Scope_Subsection.  The functions here allow
+ * the host program to access these public variables.
+ */
+EAPI Embryo_Cell      embryo_program_variable_find(Embryo_Program *ep, const char *name);
+   
+/**
+ * Retrieves the number of public variables in the given program.
+ * @param   ep The given program.
+ * @return  The number of public variables.
+ * @ingroup Embryo_Public_Variable_Group
+ */
+EAPI int              embryo_program_variable_count_get(Embryo_Program *ep);
+   
+/**
+ * Retrieves the location of the public variable in the given program
+ * with the given identifier.
+ * @param   ep  The given program.
+ * @param   num The identifier of the public variable.
+ * @return  The virtual machine address of the variable if found.
+ *          @c EMBRYO_CELL_NONE otherwise.
+ * @ingroup Embryo_Public_Variable_Group
+ */
+EAPI Embryo_Cell      embryo_program_variable_get(Embryo_Program *ep, int num);
+   
+/**
+ * Sets the error code for the given program to the given code.
+ * @param   ep The given program.
+ * @param   error The given error code.
+ * @ingroup Embryo_Error_Group
+ */
+
+/**
+ * @defgroup Embryo_Error_Group Error Functions
+ *
+ * Functions that set and retrieve error codes in Embryo programs.
+ */
+EAPI void             embryo_program_error_set(Embryo_Program *ep, Embryo_Error error);
+   
+/**
+ * Retrieves the current error code for the given program.
+ * @param   ep The given program.
+ * @return  The current error code.
+ * @ingroup Embryo_Error_Group
+ */
+EAPI Embryo_Error     embryo_program_error_get(Embryo_Program *ep);
+   
+/**
+ * Sets the data associated to the given program.
+ * @param   ep   The given program.
+ * @param   data New bytecode data.
+ * @ingroup Embryo_Program_Data_Group
+ */
+
+/**
+ * @defgroup Embryo_Program_Data_Group Program Data Functions
+ *
+ * Functions that set and retrieve data associated with the given
+ * program.
+ */
+EAPI void             embryo_program_data_set(Embryo_Program *ep, void *data);
+   
+/**
+ * Retrieves the data associated to the given program.
+ * @param   ep The given program.
+ * @ingroup Embryo_Program_Data_Group
+ */
+EAPI void            *embryo_program_data_get(Embryo_Program *ep);
+   
+/**
+ * Retrieves a string describing the given error code.
+ * @param   error The given error code.
+ * @return  String describing the given error code.  If the given code is not
+ *          known, the string "(unknown)" is returned.
+ * @ingroup Embryo_Error_Group
+ */
+EAPI const char      *embryo_error_string_get(Embryo_Error error);
+   
+/**
+ * Retrieves the length of the string starting at the given cell.
+ * @param   ep       The program the cell is part of.
+ * @param   str_cell Pointer to the first cell of the string.
+ * @return  The length of the string.  @c 0 is returned if there is an error.
+ * @ingroup Embryo_Data_String_Group
+ */
+
+/**
+ * @defgroup Embryo_Data_String_Group Embryo Data String Functions
+ *
+ * Functions that operate on strings in the memory of a virtual machine.
+ */
+EAPI int              embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell);
+   
+/**
+ * Copies the string starting at the given cell to the given buffer.
+ * @param   ep       The program the cell is part of.
+ * @param   str_cell Pointer to the first cell of the string.
+ * @param   dst      The given buffer.
+ * @ingroup Embryo_Data_String_Group
+ */
+EAPI void             embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst);
+   
+/**
+ * Copies string in the given buffer into the virtual machine memory
+ * starting at the given cell.
+ * @param ep       The program the cell is part of.
+ * @param src      The given buffer.
+ * @param str_cell Pointer to the first cell to copy the string to.
+ * @ingroup Embryo_Data_String_Group
+ */
+EAPI void             embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cell);
+   
+/**
+ * Retreives a pointer to the address in the virtual machine given by the
+ * given cell.
+ * @param   ep   The program whose virtual machine address is being queried.
+ * @param   addr The given cell.
+ * @return  A pointer to the cell at the given address.
+ * @ingroup Embryo_Data_String_Group
+ */
+EAPI Embryo_Cell     *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr);
+   
+/**
+ * Increases the size of the heap of the given virtual machine by the given
+ * number of Embryo_Cells.
+ * @param   ep    The program with the given virtual machine.
+ * @param   cells The given number of Embryo_Cells.
+ * @return  The address of the new memory region on success.
+ *          @c EMBRYO_CELL_NONE otherwise.
+ * @ingroup Embryo_Heap_Group
+ */
+
+/**
+ * @defgroup Embryo_Heap_Group Heap Functions
+ *
+ * The heap is an area of memory that can be allocated for program
+ * use at runtime.  The heap functions here change the amount of heap
+ * memory available.
+ */
+EAPI Embryo_Cell      embryo_data_heap_push(Embryo_Program *ep, int cells);
+   
+/**
+ * Decreases the size of the heap of the given virtual machine down to the
+ * given size.
+ * @param   ep      The program with the given virtual machine.
+ * @param   down_to The given size.
+ * @ingroup Embryo_Heap_Group
+ */
+EAPI void             embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to);
+   
+/**
+ * Returns the number of virtual machines are running for the given program.
+ * @param   ep The given program.
+ * @return  The number of virtual machines running.
+ * @ingroup Embryo_Run_Group
+ */
+
+/**
+ * @defgroup Embryo_Run_Group Program Run Functions
+ *
+ * Functions that are involved in actually running functions in an
+ * Embryo program.
+ */
+EAPI int              embryo_program_recursion_get(Embryo_Program *ep);
+   
+/**
+ * Runs the given function of the given Embryo program in the current
+ * virtual machine.  The parameter @p fn can be found using
+ * @ref embryo_program_function_find.
+ *
+ * @note For Embryo to be able to run a function, it must have been
+ *       declared @c public in the Small source code.
+ *
+ * @param   ep The given program.
+ * @param   func The given function.  Normally "main", in which case the
+ *             constant @c EMBRYO_FUNCTION_MAIN can be used.
+ * @return  @c EMBRYO_PROGRAM_OK on success.  @c EMBRYO_PROGRAM_SLEEP if the
+ *          program is halted by the Small @c sleep call.
+ *          @c EMBRYO_PROGRAM_FAIL if there is an error.
+ *          @c EMBRYO_PROGRAM_TOOLONG if the program executes for longer than
+ *          it is allowed to in abstract machine instruction count.
+ * @ingroup Embryo_Run_Group
+ */
+EAPI Embryo_Status    embryo_program_run(Embryo_Program *ep, Embryo_Function func);
+   
+/**
+ * Retreives the return value of the last called function of the given
+ * program.
+ * @param   ep The given program.
+ * @return  An Embryo_Cell representing the return value of the function
+ *          that was last called.
+ * @ingroup Embryo_Run_Group
+ */
+EAPI Embryo_Cell      embryo_program_return_value_get(Embryo_Program *ep);
+   
+/**
+ * Sets the maximum number of abstract machine cycles any given program run
+ * can execute before being put to sleep and returning.
+ *
+ * @param   ep The given program.
+ * @param   max The number of machine cycles as a limit.
+ *
+ * This sets the maximum number of abstract machine (virtual machine)
+ * instructions that a single run of an embryo function (even if its main)
+ * can use before embryo embryo_program_run() reutrns with the value
+ * EMBRYO_PROGRAM_TOOLONG. If the function fully executes within this number
+ * of cycles, embryo_program_run() will return as normal with either
+ * EMBRYO_PROGRAM_OK, EMBRYO_PROGRAM_FAIL or EMBRYO_PROGRAM_SLEEP. If the
+ * run exceeds this instruction count, then EMBRYO_PROGRAM_TOOLONG will be
+ * returned indicating the program exceeded its run count. If the app wishes
+ * to continue running this anyway - it is free to process its own events or
+ * whatever it wants and continue the function by calling
+ * embryo_program_run(program, EMBRYO_FUNCTION_CONT); which will start the
+ * run again until the instruction count is reached. This can keep being done
+ * to allow the calling program to still be able to control things outside the
+ * embryo function being called. If the maximum run cycle count is 0 then the
+ * program is allowed to run forever only returning when it is done.
+ *
+ * It is important to note that abstract machine cycles are NOT the same as
+ * the host machine cpu cycles. They are not fixed in runtime per cycle, so
+ * this is more of a helper tool than a way to HARD-FORCE a script to only
+ * run for a specific period of time. If the cycle count is set to something
+ * low like 5000 or 1000, then every 1000 (or 5000) cycles control will be
+ * returned to the calling process where it can check a timer to see if a
+ * physical runtime limit has been elapsed and then abort running further
+ * assuming a "runaway script" or keep continuing the script run. This
+ * limits resolution to only that many cycles which do not take a determined
+ * amount of time to execute, as this varies from cpu to cpu and also depends
+ * on how loaded the system is. Making the max cycle run too low will
+ * impact performance requiring the abstract machine to do setup and teardown
+ * cycles too often comapred to cycles actually executed.
+ *
+ * Also note it does NOT include nested abstract machines. IF this abstract
+ * machine run calls embryo script that calls a native function that in turn
+ * calls more embryo script, then the 2nd (and so on) levels are not included
+ * in this run count. They can set their own max instruction count values
+ * separately.
+ *
+ * The default max cycle run value is 0 in any program until set with this
+ * function.
+ *
+ * @ingroup Embryo_Run_Group
+ */
+EAPI void             embryo_program_max_cycle_run_set(Embryo_Program *ep, int max);
+   
+/**
+ * Retreives the maximum number of abstract machine cycles a program is allowed
+ * to run.
+ * @param   ep The given program.
+ * @return  The number of cycles a run cycle is allowed to run for this
+ *          program.
+ *
+ * This returns the value set by embryo_program_max_cycle_run_set(). See
+ * embryo_program_max_cycle_run_set() for more information.
+ *
+ * @ingroup Embryo_Run_Group
+ */
+EAPI int              embryo_program_max_cycle_run_get(Embryo_Program *ep);
+   
+/**
+ * Pushes an Embryo_Cell onto the function stack to use as a parameter for
+ * the next function that is called in the given program.
+ * @param   ep   The given program.
+ * @param   cell The Embryo_Cell to push onto the stack.
+ * @return  @c 1 if successful.  @c 0 otherwise.
+ * @ingroup Embryo_Parameter_Group
+ */
+
+/**
+ * @defgroup Embryo_Parameter_Group Function Parameter Functions
+ *
+ * Functions that set parameters for the next function that is called.
+ */
+EAPI int              embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell);
+   
+/**
+ * Pushes a string onto the function stack to use as a parameter for the
+ * next function that is called in the given program.
+ * @param   ep The given program.
+ * @param   str The string to push onto the stack.
+ * @return  @c 1 if successful.  @c 0 otherwise.
+ * @ingroup Embryo_Parameter_Group
+ */
+EAPI int              embryo_parameter_string_push(Embryo_Program *ep, const char *str);
+   
+/**
+ * Pushes an array of Embryo_Cells onto the function stack to be used as
+ * parameters for the next function that is called in the given program.
+ * @param   ep    The given program.
+ * @param   cells The array of Embryo_Cells.
+ * @param   num   The number of cells in @p cells.
+ * @return  @c 1 if successful.  @c 0 otherwise.
+ * @ingroup Embryo_Parameter_Group
+ */
+EAPI int              embryo_parameter_cell_array_push(Embryo_Program *ep, Embryo_Cell *cells, int num);
 
 #ifdef  __cplusplus
 }
 
 #ifdef  __cplusplus
 }
index 9b94e2c..d2ccb55 100644 (file)
@@ -9,9 +9,14 @@ AM_CPPFLAGS = \
 -I$(top_srcdir)/src/lib/include \
 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
 -I$(top_srcdir)/src/lib/include \
 -DPACKAGE_BIN_DIR=\"$(bindir)\" \
 -DPACKAGE_LIB_DIR=\"$(libdir)\" \
--DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\"
+-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
+@EVIL_CFLAGS@ \
+@EXOTIC_CFLAGS@ \
+@EMBRYO_CPPFLAGS@ \
+@EFL_EMBRYO_BUILD@
 
 
-include_HEADERS = Embryo.h
+includes_HEADERS = Embryo.h
+includesdir = $(includedir)/embryo-@VMAJ@
 
 lib_LTLIBRARIES = libembryo.la
 
 
 lib_LTLIBRARIES = libembryo.la
 
@@ -24,9 +29,8 @@ embryo_rand.c \
 embryo_str.c \
 embryo_time.c
 
 embryo_str.c \
 embryo_time.c
 
-libembryo_la_CFLAGS = @WIN32_CFLAGS@
-libembryo_la_LIBADD = -lm @fnmatch_libs@
-libembryo_la_DEPENDENCIES = $(top_builddir)/config.h
-libembryo_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -version-info @version_info@
+libembryo_la_CFLAGS = @EMBRYO_CFLAGS@
+libembryo_la_LIBADD = @EXOTIC_LIBS@ @EVIL_LIBS@ -lm
+libembryo_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@
 
 EXTRA_DIST = embryo_private.h
 
 EXTRA_DIST = embryo_private.h
index 8b4325c..55423b4 100644 (file)
@@ -1,7 +1,7 @@
 /*  Abstract Machine for the Small compiler
  *
  *  Copyright (c) ITB CompuPhase, 1997-2003
 /*  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
  *
  *  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.
  */
 
  *  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"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_EXOTIC
+# include <Exotic.h>
+#endif
+
+#include "Embryo.h"
 #include "embryo_private.h"
 
 #include "embryo_private.h"
 
+
 #define JUMPABS(base, ip)     ((Embryo_Cell *)(code + (*ip)))
 
 #ifdef WORDS_BIGENDIAN
 static void _embryo_byte_swap_16 (unsigned short *v);
 static void _embryo_byte_swap_32 (unsigned int *v);
 #endif
 #define JUMPABS(base, ip)     ((Embryo_Cell *)(code + (*ip)))
 
 #ifdef WORDS_BIGENDIAN
 static void _embryo_byte_swap_16 (unsigned short *v);
 static void _embryo_byte_swap_32 (unsigned int *v);
 #endif
-static int  _embryo_native_call  (Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result, Embryo_Cell *params);
-static int  _embryo_func_get     (Embryo_Program *ep, int index, char *funcname);
-static int  _embryo_var_get      (Embryo_Program *ep, int index, char *varname, Embryo_Cell *ep_addr);
+static int  _embryo_native_call  (Embryo_Program *ep, Embryo_Cell idx, Embryo_Cell *result, Embryo_Cell *params);
+static int  _embryo_func_get     (Embryo_Program *ep, int idx, char *funcname);
+static int  _embryo_var_get      (Embryo_Program *ep, int idx, char *varname, Embryo_Cell *ep_addr);
 static int  _embryo_program_init (Embryo_Program *ep, void *code);
 
 #ifdef WORDS_BIGENDIAN
 static int  _embryo_program_init (Embryo_Program *ep, void *code);
 
 #ifdef WORDS_BIGENDIAN
@@ -59,14 +70,14 @@ _embryo_byte_swap_32(unsigned int *v)
 #endif
 
 static int
 #endif
 
 static int
-_embryo_native_call(Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result, Embryo_Cell *params)
+_embryo_native_call(Embryo_Program *ep, Embryo_Cell idx, Embryo_Cell *result, Embryo_Cell *params)
 {
    Embryo_Header    *hdr;
    Embryo_Func_Stub *func_entry;
    Embryo_Native     f;
 
    hdr = (Embryo_Header *)ep->base;
 {
    Embryo_Header    *hdr;
    Embryo_Func_Stub *func_entry;
    Embryo_Native     f;
 
    hdr = (Embryo_Header *)ep->base;
-   func_entry = GETENTRY(hdr, natives, index);
+   func_entry = GETENTRY(hdr, natives, idx);
    if ((func_entry->address <= 0) ||
        (func_entry->address > ep->native_calls_size))
      {
    if ((func_entry->address <= 0) ||
        (func_entry->address > ep->native_calls_size))
      {
@@ -85,32 +96,32 @@ _embryo_native_call(Embryo_Program *ep, Embryo_Cell index, Embryo_Cell *result,
 }
 
 static int
 }
 
 static int
-_embryo_func_get(Embryo_Program *ep, int index, char *funcname)
+_embryo_func_get(Embryo_Program *ep, int idx, char *funcname)
 {
    Embryo_Header    *hdr;
    Embryo_Func_Stub *func;
 
    hdr = (Embryo_Header *)ep->code;
 {
    Embryo_Header    *hdr;
    Embryo_Func_Stub *func;
 
    hdr = (Embryo_Header *)ep->code;
-   if (index >= (Embryo_Cell)NUMENTRIES(hdr, publics, natives))
+   if (idx >= (Embryo_Cell)NUMENTRIES(hdr, publics, natives))
      return EMBRYO_ERROR_INDEX;
 
      return EMBRYO_ERROR_INDEX;
 
-   func = GETENTRY(hdr, publics, index);
+   func = GETENTRY(hdr, publics, idx);
    strcpy(funcname, GETENTRYNAME(hdr, func));
    return EMBRYO_ERROR_NONE;
 }
 
 static int
    strcpy(funcname, GETENTRYNAME(hdr, func));
    return EMBRYO_ERROR_NONE;
 }
 
 static int
-_embryo_var_get(Embryo_Program *ep, int index, char *varname, Embryo_Cell *ep_addr)
+_embryo_var_get(Embryo_Program *ep, int idx, char *varname, Embryo_Cell *ep_addr)
 {
 
   Embryo_Header    *hdr;
   Embryo_Func_Stub *var;
 
   hdr=(Embryo_Header *)ep->base;
 {
 
   Embryo_Header    *hdr;
   Embryo_Func_Stub *var;
 
   hdr=(Embryo_Header *)ep->base;
-  if (index >= (Embryo_Cell)NUMENTRIES(hdr, pubvars, tags))
+  if (idx >= (Embryo_Cell)NUMENTRIES(hdr, pubvars, tags))
      return EMBRYO_ERROR_INDEX;
 
      return EMBRYO_ERROR_INDEX;
 
-  var = GETENTRY(hdr, pubvars, index);
+  var = GETENTRY(hdr, pubvars, idx);
   strcpy(varname, GETENTRYNAME(hdr, var));
   *ep_addr = var->address;
   return EMBRYO_ERROR_NONE;
   strcpy(varname, GETENTRYNAME(hdr, var));
   *ep_addr = var->address;
   return EMBRYO_ERROR_NONE;
@@ -195,12 +206,13 @@ _embryo_program_init(Embryo_Program *ep, void *code)
    ep->flags = EMBRYO_FLAG_RELOC;
 
      {
    ep->flags = EMBRYO_FLAG_RELOC;
 
      {
-       Embryo_Cell cip, code_size;
+       Embryo_Cell cip, code_size, cip_end;
        Embryo_Cell *code;
 
        code_size = hdr->dat - hdr->cod;
        code = (Embryo_Cell *)((unsigned char *)ep->code + (int)hdr->cod);
        Embryo_Cell *code;
 
        code_size = hdr->dat - hdr->cod;
        code = (Embryo_Cell *)((unsigned char *)ep->code + (int)hdr->cod);
-       for (cip = 0; cip < (code_size / sizeof(Embryo_Cell)); cip++)
+        cip_end = code_size / sizeof(Embryo_Cell);
+       for (cip = 0; cip < cip_end; cip++)
          {
 /* move this here - later we probably want something that verifies opcodes
  * are valid and ok...
          {
 /* move this here - later we probably want something that verifies opcodes
  * are valid and ok...
@@ -222,19 +234,6 @@ _embryo_program_init(Embryo_Program *ep, void *code)
 
 /*** EXPORTED CALLS ***/
 
 
 /*** EXPORTED CALLS ***/
 
-/**
- * @defgroup Embryo_Program_Creation_Group Program Creation and Destruction Functions
- *
- * Functions that set up programs, and destroy them.
- */
-
-/**
- * Creates a new Embryo program, with bytecode data that can be freed.
- * @param   data Pointer to the bytecode of the program.
- * @param   size Number of bytes of bytecode.
- * @return  A new Embryo program.
- * @ingroup Embryo_Program_Creation_Group
- */
 EAPI Embryo_Program *
 embryo_program_new(void *data, int size)
 {
 EAPI Embryo_Program *
 embryo_program_new(void *data, int size)
 {
@@ -259,14 +258,6 @@ embryo_program_new(void *data, int size)
    return NULL;
 }
 
    return NULL;
 }
 
-/**
- * Creates a new Embryo program, with bytecode data that cannot be
- * freed.
- * @param   data Pointer to the bytecode of the program.
- * @param   size Number of bytes of bytecode.
- * @return  A new Embryo program.
- * @ingroup Embryo_Program_Creation_Group
- */
 EAPI Embryo_Program *
 embryo_program_const_new(void *data, int size)
 {
 EAPI Embryo_Program *
 embryo_program_const_new(void *data, int size)
 {
@@ -286,15 +277,8 @@ embryo_program_const_new(void *data, int size)
    return NULL;
 }
 
    return NULL;
 }
 
-/**
- * Creates a new Embryo program based on the bytecode data stored in the
- * given file.
- * @param   file Filename of the given file.
- * @return  A new Embryo program.
- * @ingroup Embryo_Program_Creation_Group
- */
 EAPI Embryo_Program *
 EAPI Embryo_Program *
-embryo_program_load(char *file)
+embryo_program_load(const char *file)
 {
    Embryo_Program *ep;
    Embryo_Header   hdr;
 {
    Embryo_Program *ep;
    Embryo_Header   hdr;
@@ -306,7 +290,7 @@ embryo_program_load(char *file)
    if (!f) return NULL;
    fseek(f, 0, SEEK_END);
    program_size = ftell(f);
    if (!f) return NULL;
    fseek(f, 0, SEEK_END);
    program_size = ftell(f);
-   rewind(f);
+   fseek(f, 0L, SEEK_SET);
    if (program_size < (int)sizeof(Embryo_Header))
      {
        fclose(f);
    if (program_size < (int)sizeof(Embryo_Header))
      {
        fclose(f);
@@ -317,7 +301,7 @@ embryo_program_load(char *file)
        fclose(f);
        return NULL;
      }
        fclose(f);
        return NULL;
      }
-   rewind(f);
+   fseek(f, 0L, SEEK_SET);
 #ifdef WORDS_BIGENDIAN
    embryo_swap_32((unsigned int *)(&hdr.size));
 #endif
 #ifdef WORDS_BIGENDIAN
    embryo_swap_32((unsigned int *)(&hdr.size));
 #endif
@@ -340,11 +324,6 @@ embryo_program_load(char *file)
    return ep;
 }
 
    return ep;
 }
 
-/**
- * Frees the given Embryo program.
- * @param   ep The given program.
- * @ingroup Embryo_Program_Creation_Group
- */
 EAPI void
 embryo_program_free(Embryo_Program *ep)
 {
 EAPI void
 embryo_program_free(Embryo_Program *ep)
 {
@@ -362,19 +341,7 @@ embryo_program_free(Embryo_Program *ep)
    free(ep);
 }
 
    free(ep);
 }
 
-/**
- * @defgroup Embryo_Func_Group Function Functions
- *
- * Functions that deal with Embryo program functions.
- */
 
 
-/**
- * Adds a native program call to the given Embryo program.
- * @param   ep   The given Embryo program.
- * @param   name The name for the call used in the script.
- * @param   func The function to use when the call is made.
- * @ingroup Embryo_Func_Group
- */
 EAPI void
 embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params))
 {
 EAPI void
 embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params))
 {
@@ -382,7 +349,7 @@ embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell
    Embryo_Header    *hdr;
    int               i, num;
 
    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;
    if (strlen(name) > sNAMEMAX) return;
 
    hdr = (Embryo_Header *)ep->code;
@@ -395,13 +362,13 @@ embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell
      {
        Embryo_Native *calls;
 
      {
        Embryo_Native *calls;
 
-       ep->native_calls_alloc += 16;
+       ep->native_calls_alloc += 32;
        calls = realloc(ep->native_calls,
                        ep->native_calls_alloc * sizeof(Embryo_Native));
        if (!calls)
          {
             ep->native_calls_size--;
        calls = realloc(ep->native_calls,
                        ep->native_calls_alloc * sizeof(Embryo_Native));
        if (!calls)
          {
             ep->native_calls_size--;
-            ep->native_calls_alloc -= 16;
+            ep->native_calls_alloc -= 32;
             return;
          }
        ep->native_calls = calls;
             return;
          }
        ep->native_calls = calls;
@@ -430,30 +397,7 @@ embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell
      }
 }
 
      }
 }
 
-/**
- * @defgroup Embryo_Program_VM_Group Virtual Machine Functions
- *
- * Functions that deal with creating and destroying virtual machine sessions
- * for a given program.
- *
- * A given embryo program can have multiple virtual machine sessions running.
- * This is useful when you have a native call that in turn calls a function in
- * the embryo program.  The native call can start a new virtual machine
- * session to run the function it needs.  Once completed, the session can be
- * popped off the program's stack, and the native call can return its value
- * to the old session.
- *
- * A new virtual machine session is created by pushing a new virtual machine
- * onto the session stack of a program using @ref embryo_program_vm_push.
- * The current virtual machine session can be destroyed by calling
- * @ref embryo_program_vm_pop.
- */
 
 
-/**
- * Resets the current virtual machine session of the given program.
- * @param   ep The given program.
- * @ingroup Embryo_Program_VM_Group
- */
 EAPI void
 embryo_program_vm_reset(Embryo_Program *ep)
 {
 EAPI void
 embryo_program_vm_reset(Embryo_Program *ep)
 {
@@ -470,14 +414,6 @@ embryo_program_vm_reset(Embryo_Program *ep)
    ep->stk = ep->stp;
 }
 
    ep->stk = ep->stp;
 }
 
-/**
- * Starts a new virtual machine session for the given program.
- *
- * See @ref Embryo_Program_VM_Group for more information about how this works.
- *
- * @param   ep The given program.
- * @ingroup Embryo_Program_VM_Group
- */
 EAPI void
 embryo_program_vm_push(Embryo_Program *ep)
 {
 EAPI void
 embryo_program_vm_push(Embryo_Program *ep)
 {
@@ -491,7 +427,7 @@ embryo_program_vm_push(Embryo_Program *ep)
        return;
      }
    hdr = (Embryo_Header *)ep->code;
        return;
      }
    hdr = (Embryo_Header *)ep->code;
-   ep->base = malloc(hdr->stp);
+   ep->base = calloc(1, hdr->stp);
    if (!ep->base)
      {
        ep->pushes = 0;
    if (!ep->base)
      {
        ep->pushes = 0;
@@ -500,16 +436,6 @@ embryo_program_vm_push(Embryo_Program *ep)
    embryo_program_vm_reset(ep);
 }
 
    embryo_program_vm_reset(ep);
 }
 
-/**
- * Frees the current virtual machine session associated with the given program.
- *
- * See @ref Embryo_Program_VM_Group for more information about how this works.
- * Note that you will need to retrieve any return data or data on the stack
- * before you pop.
- *
- * @param   ep The given program.
- * @ingroup Embryo_Program_VM_Group
- */
 EAPI void
 embryo_program_vm_pop(Embryo_Program *ep)
 {
 EAPI void
 embryo_program_vm_pop(Embryo_Program *ep)
 {
@@ -520,50 +446,31 @@ embryo_program_vm_pop(Embryo_Program *ep)
    ep->base = NULL;
 }
 
    ep->base = NULL;
 }
 
-/**
- * @defgroup Embryo_Swap_Group Byte Swapping Functions
- *
- * Functions that are used to ensure that integers passed to the
- * virtual machine are in small endian format.  These functions are
- * used to ensure that the virtual machine operates correctly on big
- * endian machines.
- */
 
 
-/**
- * Ensures that the given unsigned short integer is in the small
- * endian format.
- * @param   v Pointer to the given integer.
- * @ingroup Embryo_Swap_Group
- */
 EAPI void
 EAPI void
-embryo_swap_16(unsigned short *v)
+embryo_swap_16(unsigned short *v
+#ifndef WORDS_BIGENDIAN
+               __UNUSED__
+#endif               
+              )
 {
 #ifdef WORDS_BIGENDIAN
    _embryo_byte_swap_16(v);
 #endif
 }
 
 {
 #ifdef WORDS_BIGENDIAN
    _embryo_byte_swap_16(v);
 #endif
 }
 
-/**
- * Ensures that the given unsigned integer is in the small endian
- * format.
- * @param   v Pointer to the given integer.
- * @ingroup Embryo_Swap_Group
- */
 EAPI void
 EAPI void
-embryo_swap_32(unsigned int *v)
+embryo_swap_32(unsigned int *v
+#ifndef WORDS_BIGENDIAN
+               __UNUSED__
+#endif
+               )
 {
 #ifdef WORDS_BIGENDIAN
    _embryo_byte_swap_32(v);
 #endif
 }
 
 {
 #ifdef WORDS_BIGENDIAN
    _embryo_byte_swap_32(v);
 #endif
 }
 
-/**
- * Returns the function in the given program with the given name.
- * @param   ep The given program.
- * @param   name The given function name.
- * @return  The function if successful.  Otherwise, @c EMBRYO_FUNCTION_NONE.
- * @ingroup Embryo_Func_Group
- */
 EAPI Embryo_Function
 embryo_program_function_find(Embryo_Program *ep, const char *name)
 {
 EAPI Embryo_Function
 embryo_program_function_find(Embryo_Program *ep, const char *name)
 {
@@ -591,23 +498,7 @@ embryo_program_function_find(Embryo_Program *ep, const char *name)
    return EMBRYO_FUNCTION_NONE;
 }
 
    return EMBRYO_FUNCTION_NONE;
 }
 
-/**
- * @defgroup Embryo_Public_Variable_Group Public Variable Access Functions
- *
- * In an Embryo program, a global variable can be declared public, as
- * described in @ref Small_Scope_Subsection.  The functions here allow
- * the host program to access these public variables.
- */
 
 
-/**
- * Retrieves the location of the public variable in the given program
- * with the given name.
- * @param   ep   The given program.
- * @param   name The given name.
- * @return  The address of the variable if found.  @c EMBRYO_CELL_NONE
- *          otherwise.
- * @ingroup Embryo_Public_Variable_Group
- */
 EAPI Embryo_Cell
 embryo_program_variable_find(Embryo_Program *ep, const char *name)
 {
 EAPI Embryo_Cell
 embryo_program_variable_find(Embryo_Program *ep, const char *name)
 {
@@ -637,12 +528,6 @@ embryo_program_variable_find(Embryo_Program *ep, const char *name)
    return EMBRYO_CELL_NONE;
 }
 
    return EMBRYO_CELL_NONE;
 }
 
-/**
- * Retrieves the number of public variables in the given program.
- * @param   ep The given program.
- * @return  The number of public variables.
- * @ingroup Embryo_Public_Variable_Group
- */
 EAPI int
 embryo_program_variable_count_get(Embryo_Program *ep)
 {
 EAPI int
 embryo_program_variable_count_get(Embryo_Program *ep)
 {
@@ -654,75 +539,35 @@ embryo_program_variable_count_get(Embryo_Program *ep)
    return NUMENTRIES(hdr, pubvars, tags);
 }
 
    return NUMENTRIES(hdr, pubvars, tags);
 }
 
-/**
- * Retrieves the location of the public variable in the given program
- * with the given identifier.
- * @param   ep  The given program.
- * @param   num The identifier of the public variable.
- * @return  The virtual machine address of the variable if found.
- *          @c EMBRYO_CELL_NONE otherwise.
- * @ingroup Embryo_Public_Variable_Group
- */
 EAPI Embryo_Cell
 embryo_program_variable_get(Embryo_Program *ep, int num)
 {
 EAPI Embryo_Cell
 embryo_program_variable_get(Embryo_Program *ep, int num)
 {
-   Embryo_Header *hdr;
    Embryo_Cell    paddr;
    char           pname[sNAMEMAX + 1];
 
    if (!ep) return EMBRYO_CELL_NONE;
    if (!ep->base) return EMBRYO_CELL_NONE;
    Embryo_Cell    paddr;
    char           pname[sNAMEMAX + 1];
 
    if (!ep) return EMBRYO_CELL_NONE;
    if (!ep->base) return EMBRYO_CELL_NONE;
-   hdr = (Embryo_Header *)ep->base;
    if (_embryo_var_get(ep, num, pname, &paddr) == EMBRYO_ERROR_NONE)
      return paddr;
    return EMBRYO_CELL_NONE;
 }
 
    if (_embryo_var_get(ep, num, pname, &paddr) == EMBRYO_ERROR_NONE)
      return paddr;
    return EMBRYO_CELL_NONE;
 }
 
-/**
- * @defgroup Embryo_Error_Group Error Functions
- *
- * Functions that set and retrieve error codes in Embryo programs.
- */
 
 
-/**
- * Sets the error code for the given program to the given code.
- * @param   ep The given program.
- * @param   error The given error code.
- * @ingroup Embryo_Error_Group
- */
 EAPI void
 EAPI void
-embryo_program_error_set(Embryo_Program *ep, int error)
+embryo_program_error_set(Embryo_Program *ep, Embryo_Error error)
 {
    if (!ep) return;
    ep->error = error;
 }
 
 {
    if (!ep) return;
    ep->error = error;
 }
 
-/**
- * Retrieves the current error code for the given program.
- * @param   ep The given program.
- * @return  The current error code.
- * @ingroup Embryo_Error_Group
- */
-EAPI int
+EAPI Embryo_Error
 embryo_program_error_get(Embryo_Program *ep)
 {
    if (!ep) return EMBRYO_ERROR_NONE;
    return ep->error;
 }
 
 embryo_program_error_get(Embryo_Program *ep)
 {
    if (!ep) return EMBRYO_ERROR_NONE;
    return ep->error;
 }
 
-/**
- * @defgroup Embryo_Program_Data_Group Program Data Functions
- *
- * Functions that set and retrieve data associated with the given
- * program.
- */
 
 
-/**
- * Sets the data associated to the given program.
- * @param   ep   The given program.
- * @param   data New bytecode data.
- * @ingroup Embryo_Program_Data_Group
- */
 EAPI void
 embryo_program_data_set(Embryo_Program *ep, void *data)
 {
 EAPI void
 embryo_program_data_set(Embryo_Program *ep, void *data)
 {
@@ -730,11 +575,6 @@ embryo_program_data_set(Embryo_Program *ep, void *data)
    ep->data = data;
 }
 
    ep->data = data;
 }
 
-/**
- * Retrieves the data associated to the given program.
- * @param   ep The given program.
- * @ingroup Embryo_Program_Data_Group
- */
 EAPI void *
 embryo_program_data_get(Embryo_Program *ep)
 {
 EAPI void *
 embryo_program_data_get(Embryo_Program *ep)
 {
@@ -742,15 +582,8 @@ embryo_program_data_get(Embryo_Program *ep)
    return ep->data;
 }
 
    return ep->data;
 }
 
-/**
- * Retrieves a string describing the given error code.
- * @param   error The given error code.
- * @return  String describing the given error code.  If the given code is not
- *          known, the string "(unknown)" is returned.
- * @ingroup Embryo_Error_Group
- */
 EAPI const char *
 EAPI const char *
-embryo_error_string_get(int error)
+embryo_error_string_get(Embryo_Error error)
 {
    const char *messages[] =
      {
 {
    const char *messages[] =
      {
@@ -781,24 +614,13 @@ embryo_error_string_get(int error)
          /* EMBRYO_ERROR_INIT_JIT  */ "Cannot initialize the JIT",
          /* EMBRYO_ERROR_PARAMS    */ "Parameter error",
      };
          /* EMBRYO_ERROR_INIT_JIT  */ "Cannot initialize the JIT",
          /* EMBRYO_ERROR_PARAMS    */ "Parameter error",
      };
-   if ((error < 0) || (error >= (int)(sizeof(messages) / sizeof(messages[0]))))
+   if (((int)error < 0) || 
+       ((int)error >= (int)(sizeof(messages) / sizeof(messages[0]))))
      return (const char *)"(unknown)";
    return messages[error];
 }
 
      return (const char *)"(unknown)";
    return messages[error];
 }
 
-/**
- * @defgroup Embryo_Data_String_Group Embryo Data String Functions
- *
- * Functions that operate on strings in the memory of a virtual machine.
- */
 
 
-/**
- * Retrieves the length of the string starting at the given cell.
- * @param   ep       The program the cell is part of.
- * @param   str_cell Pointer to the first cell of the string.
- * @return  The length of the string.  @c 0 is returned if there is an error.
- * @ingroup Embryo_Data_String_Group
- */
 EAPI int
 embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell)
 {
 EAPI int
 embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell)
 {
@@ -815,13 +637,6 @@ embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell)
    return len;
 }
 
    return len;
 }
 
-/**
- * Copies the string starting at the given cell to the given buffer.
- * @param   ep       The program the cell is part of.
- * @param   str_cell Pointer to the first cell of the string.
- * @param   dst      The given buffer.
- * @ingroup Embryo_Data_String_Group
- */
 EAPI void
 embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst)
 {
 EAPI void
 embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst)
 {
@@ -859,14 +674,6 @@ embryo_data_string_get(Embryo_Program *ep, Embryo_Cell *str_cell, char *dst)
    dst[i] = 0;
 }
 
    dst[i] = 0;
 }
 
-/**
- * Copies string in the given buffer into the virtual machine memory
- * starting at the given cell.
- * @param ep       The program the cell is part of.
- * @param src      The given buffer.
- * @param str_cell Pointer to the first cell to copy the string to.
- * @ingroup Embryo_Data_String_Group
- */
 EAPI void
 embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cell)
 {
 EAPI void
 embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cell)
 {
@@ -908,14 +715,6 @@ embryo_data_string_set(Embryo_Program *ep, const char *src, Embryo_Cell *str_cel
    str_cell[i] = 0;
 }
 
    str_cell[i] = 0;
 }
 
-/**
- * Retreives a pointer to the address in the virtual machine given by the
- * given cell.
- * @param   ep   The program whose virtual machine address is being queried.
- * @param   addr The given cell.
- * @return  A pointer to the cell at the given address.
- * @ingroup Embryo_Data_String_Group
- */
 EAPI Embryo_Cell *
 embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr)
 {
 EAPI Embryo_Cell *
 embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr)
 {
@@ -929,33 +728,15 @@ embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr)
    return (Embryo_Cell *)(data + (int)addr);
 }
 
    return (Embryo_Cell *)(data + (int)addr);
 }
 
-/**
- * @defgroup Embryo_Heap_Group Heap Functions
- *
- * The heap is an area of memory that can be allocated for program
- * use at runtime.  The heap functions here change the amount of heap
- * memory available.
- */
 
 
-/**
- * Increases the size of the heap of the given virtual machine by the given
- * number of Embryo_Cells.
- * @param   ep    The program with the given virtual machine.
- * @param   cells The given number of Embryo_Cells.
- * @return  The address of the new memory region on success.
- *          @c EMBRYO_CELL_NONE otherwise.
- * @ingroup Embryo_Heap_Group
- */
 EAPI Embryo_Cell
 embryo_data_heap_push(Embryo_Program *ep, int cells)
 {
    Embryo_Header *hdr;
 EAPI Embryo_Cell
 embryo_data_heap_push(Embryo_Program *ep, int cells)
 {
    Embryo_Header *hdr;
-   unsigned char *data;
    Embryo_Cell    addr;
 
    if ((!ep) || (!ep->base)) return EMBRYO_CELL_NONE;
    hdr = (Embryo_Header *)ep->base;
    Embryo_Cell    addr;
 
    if ((!ep) || (!ep->base)) return EMBRYO_CELL_NONE;
    hdr = (Embryo_Header *)ep->base;
-   data = ep->base + (int)hdr->dat;
    if (ep->stk - ep->hea - (cells * sizeof(Embryo_Cell)) < STKMARGIN)
      return EMBRYO_CELL_NONE;
    addr = ep->hea;
    if (ep->stk - ep->hea - (cells * sizeof(Embryo_Cell)) < STKMARGIN)
      return EMBRYO_CELL_NONE;
    addr = ep->hea;
@@ -963,13 +744,6 @@ embryo_data_heap_push(Embryo_Program *ep, int cells)
    return addr;
 }
 
    return addr;
 }
 
-/**
- * Decreases the size of the heap of the given virtual machine down to the
- * given size.
- * @param   ep      The program with the given virtual machine.
- * @param   down_to The given size.
- * @ingroup Embryo_Heap_Group
- */
 EAPI void
 embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to)
 {
 EAPI void
 embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to)
 {
@@ -978,19 +752,7 @@ embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to)
    if (ep->hea > down_to) ep->hea = down_to;
 }
 
    if (ep->hea > down_to) ep->hea = down_to;
 }
 
-/**
- * @defgroup Embryo_Run_Group Program Run Functions
- *
- * Functions that are involved in actually running functions in an
- * Embryo program.
- */
 
 
-/**
- * Returns the number of virtual machines are running for the given program.
- * @param   ep The given program.
- * @return  The number of virtual machines running.
- * @ingroup Embryo_Run_Group
- */
 EAPI int
 embryo_program_recursion_get(Embryo_Program *ep)
 {
 EAPI int
 embryo_program_recursion_get(Embryo_Program *ep)
 {
@@ -1016,25 +778,7 @@ embryo_program_recursion_get(Embryo_Program *ep)
 #define BREAK break
 #endif
 
 #define BREAK break
 #endif
 
-/**
- * Runs the given function of the given Embryo program in the current
- * virtual machine.  The parameter @p fn can be found using
- * @ref embryo_program_function_find.
- *
- * @note For Embryo to be able to run a function, it must have been
- *       declared @c public in the Small source code.
- *
- * @param   ep The given program.
- * @param   fn The given function.  Normally "main", in which case the
- *             constant @c EMBRYO_FUNCTION_MAIN can be used.
- * @return  @c EMBRYO_PROGRAM_OK on success.  @c EMBRYO_PROGRAM_SLEEP if the
- *          program is halted by the Small @c sleep call.
- *          @c EMBRYO_PROGRAM_FAIL if there is an error.
- *          @c EMBRYO_PROGRAM_TOOLONG if the program executes for longer than
- *          it is allowed to in abstract machine instruction count.
- * @ingroup Embryo_Run_Group
- */
-EAPI int
+EAPI Embryo_Status
 embryo_program_run(Embryo_Program *ep, Embryo_Function fn)
 {
    Embryo_Header    *hdr;
 embryo_program_run(Embryo_Program *ep, Embryo_Function fn)
 {
    Embryo_Header    *hdr;
@@ -2055,7 +1799,7 @@ embryo_program_run(Embryo_Program *ep, Embryo_Function fn)
 
                       entry_name = GETENTRYNAME(hdr, func_entry);
                       if (i == offs)
 
                       entry_name = GETENTRYNAME(hdr, func_entry);
                       if (i == offs)
-                        printf("EMBRYO: CALL [%i] %s() non-existant!\n", i, entry_name);
+                        printf("EMBRYO: CALL [%i] %s() non-existent!\n", i, entry_name);
                       func_entry =
                         (Embryo_Func_Stub *)((unsigned char *)func_entry + hdr->defsize);
                    }
                       func_entry =
                         (Embryo_Func_Stub *)((unsigned char *)func_entry + hdr->defsize);
                    }
@@ -2142,14 +1886,6 @@ embryo_program_run(Embryo_Program *ep, Embryo_Function fn)
    return EMBRYO_PROGRAM_OK;
 }
 
    return EMBRYO_PROGRAM_OK;
 }
 
-/**
- * Retreives the return value of the last called function of the given
- * program.
- * @param   ep The given program.
- * @return  An Embryo_Cell representing the return value of the function
- *          that was last called.
- * @ingroup Embryo_Run_Group
- */
 EAPI Embryo_Cell
 embryo_program_return_value_get(Embryo_Program *ep)
 {
 EAPI Embryo_Cell
 embryo_program_return_value_get(Embryo_Program *ep)
 {
@@ -2157,54 +1893,6 @@ embryo_program_return_value_get(Embryo_Program *ep)
    return ep->retval;
 }
 
    return ep->retval;
 }
 
-/**
- * Sets the maximum number of abstract machine cycles any given program run
- * can execute before being put to sleep and returning.
- *
- * @param   ep The given program.
- * @param   max The number of machine cycles as a limit.
- *
- * This sets the maximum number of abstract machine (virtual machine)
- * instructions that a single run of an embryo function (even if its main)
- * can use before embryo embryo_program_run() reutrns with the value
- * EMBRYO_PROGRAM_TOOLONG. If the function fully executes within this number
- * of cycles, embryo_program_run() will return as normal with either
- * EMBRYO_PROGRAM_OK, EMBRYO_PROGRAM_FAIL or EMBRYO_PROGRAM_SLEEP. If the
- * run exceeds this instruction count, then EMBRYO_PROGRAM_TOOLONG will be
- * returned indicating the program exceeded its run count. If the app wishes
- * to continue running this anyway - it is free to process its own events or
- * whatever it wants and continue the function by calling
- * embryo_program_run(program, EMBRYO_FUNCTION_CONT); which will start the
- * run again until the instruction count is reached. This can keep being done
- * to allow the calling program to still be able to control things outside the
- * embryo function being called. If the maximum run cycle count is 0 then the
- * program is allowed to run forever only returning when it is done.
- *
- * It is important to note that abstract machine cycles are NOT the same as
- * the host machine cpu cycles. They are not fixed in runtime per cycle, so
- * this is more of a helper tool than a way to HARD-FORCE a script to only
- * run for a specific period of time. If the cycle count is set to something
- * low like 5000 or 1000, then every 1000 (or 5000) cycles control will be
- * returned to the calling process where it can check a timer to see if a
- * physical runtime limit has been elapsed and then abort runing further
- * assuming a "runaway script" or keep continuing the script run. This
- * limits resolution to only that many cycles which do not take a determined
- * amount of time to execute, as this varies from cpu to cpu and also depends
- * on how loaded the system is. Making the max cycle run too low will
- * impact performance requiring the abstract machine to do setup and teardown
- * cycles too often comapred to cycles actually executed.
- *
- * Also note it does NOT include nested abstract machines. IF this abstract
- * machine run calls embryo script that calls a native function that in turn
- * calls more embryo script, then the 2nd (and so on) levels are not included
- * in this run count. They can set their own max instruction count values
- * separately.
- *
- * The default max cycle run value is 0 in any program until set with this
- * function.
- *
- * @ingroup Embryo_Run_Group
- */
 EAPI void
 embryo_program_max_cycle_run_set(Embryo_Program *ep, int max)
 {
 EAPI void
 embryo_program_max_cycle_run_set(Embryo_Program *ep, int max)
 {
@@ -2213,18 +1901,6 @@ embryo_program_max_cycle_run_set(Embryo_Program *ep, int max)
    ep->max_run_cycles = max;
 }
 
    ep->max_run_cycles = max;
 }
 
-/**
- * Retreives the maximum number of abstract machine cycles a program is allowed
- * to run.
- * @param   ep The given program.
- * @return  The number of cycles a run cycle is allowed to run for this
- *          program.
- *
- * This returns the value set by embryo_program_max_cycle_run_set(). See
- * embryo_program_max_cycle_run_set() for more information.
- *
- * @ingroup Embryo_Run_Group
- */
 EAPI int
 embryo_program_max_cycle_run_get(Embryo_Program *ep)
 {
 EAPI int
 embryo_program_max_cycle_run_get(Embryo_Program *ep)
 {
@@ -2232,20 +1908,7 @@ embryo_program_max_cycle_run_get(Embryo_Program *ep)
    return ep->max_run_cycles;
 }
 
    return ep->max_run_cycles;
 }
 
-/**
- * @defgroup Embryo_Parameter_Group Function Parameter Functions
- *
- * Functions that set parameters for the next function that is called.
- */
 
 
-/**
- * Pushes an Embryo_Cell onto the function stack to use as a parameter for
- * the next function that is called in the given program.
- * @param   ep   The given program.
- * @param   cell The Embryo_Cell to push onto the stack.
- * @return  @c 1 if successful.  @c 0 otherwise.
- * @ingroup Embryo_Parameter_Group
- */
 EAPI int
 embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell)
 {
 EAPI int
 embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell)
 {
@@ -2268,14 +1931,6 @@ embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell)
    return 1;
 }
 
    return 1;
 }
 
-/**
- * Pushes a string onto the function stack to use as a parameter for the
- * next function that is called in the given program.
- * @param   ep The given program.
- * @param   str The string to push onto the stack.
- * @return  @c 1 if successful.  @c 0 otherwise.
- * @ingroup Embryo_Parameter_Group
- */
 EAPI int
 embryo_parameter_string_push(Embryo_Program *ep, const char *str)
 {
 EAPI int
 embryo_parameter_string_push(Embryo_Program *ep, const char *str)
 {
@@ -2307,24 +1962,15 @@ embryo_parameter_string_push(Embryo_Program *ep, const char *str)
    return 1;
 }
 
    return 1;
 }
 
-/**
- * Pushes an array of Embryo_Cells onto the function stack to be used as
- * parameters for the next function that is called in the given program.
- * @param   ep    The given program.
- * @param   cells The array of Embryo_Cells.
- * @param   num   The number of cells in @p cells.
- * @return  @c 1 if successful.  @c 0 otherwise.
- * @ingroup Embryo_Parameter_Group
- */
 EAPI int
 embryo_parameter_cell_array_push(Embryo_Program *ep, Embryo_Cell *cells, int num)
 {
    Embryo_Param *pr;
    Embryo_Cell *cell_array;
 
 EAPI int
 embryo_parameter_cell_array_push(Embryo_Program *ep, Embryo_Cell *cells, int num)
 {
    Embryo_Param *pr;
    Embryo_Cell *cell_array;
 
-   cell_array = malloc(num * sizeof(Embryo_Cell));
    if ((!cells) || (num <= 0))
      return embryo_parameter_cell_push(ep, 0);
    if ((!cells) || (num <= 0))
      return embryo_parameter_cell_push(ep, 0);
+   cell_array = malloc(num * sizeof(Embryo_Cell));
    ep->params_size++;
    if (ep->params_size > ep->params_alloc)
      {
    ep->params_size++;
    if (ep->params_size > ep->params_alloc)
      {
index b7456f4..0c0089e 100644 (file)
@@ -1,7 +1,25 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
-
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#elif defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#else
+# include <stddef.h>
+# ifdef  __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
+
+#include "Embryo.h"
 #include "embryo_private.h"
 
 #define STRSET(ep, par, str) { \
 #include "embryo_private.h"
 
 #define STRSET(ep, par, str) { \
index af241b6..ffaa87d 100644 (file)
  *             Carsten Haitzler, <raster@rasterman.com>
  */
 
  *             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"
+#endif
+
+#include <stdlib.h>
 #include <math.h>
 #include <math.h>
+
+#include "Embryo.h"
 #include "embryo_private.h"
 
 #include "embryo_private.h"
 
-#define PI  3.1415926535897932384626433832795
+#define PI  3.1415926535897932384626433832795f
+#ifndef MAXFLOAT
+#define MAXFLOAT 3.40282347e+38f
+#endif
 
 /* internally useful calls */
 
 
 /* internally useful calls */
 
@@ -53,9 +60,9 @@ _embryo_fp_degrees_to_radians(float angle, int radix)
    switch (radix)
      {
       case 1: /* degrees, sexagesimal system (technically: degrees/minutes/seconds) */
    switch (radix)
      {
       case 1: /* degrees, sexagesimal system (technically: degrees/minutes/seconds) */
-       return (float)(angle * PI / 180.0);
+       return (angle * PI / 180.0f);
       case 2: /* grades, centesimal system */
       case 2: /* grades, centesimal system */
-       return (float)(angle * PI / 200.0);
+       return (angle * PI / 200.0f);
       default: /* assume already radian */
        break;
      }
       default: /* assume already radian */
        break;
      }
@@ -87,7 +94,7 @@ _embryo_fp_str(Embryo_Program *ep, Embryo_Cell *params)
    if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
    str = embryo_data_address_get(ep, params[1]);
    len = embryo_data_string_length_get(ep, str);
    if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
    str = embryo_data_address_get(ep, params[1]);
    len = embryo_data_string_length_get(ep, str);
-   if ((len == 0) || (len >= sizeof(buf))) return 0;
+   if ((len == 0) || (len >= (int)sizeof(buf))) return 0;
    embryo_data_string_get(ep, str, buf);
    f = (float)atof(buf);
    return EMBRYO_FLOAT_TO_CELL(f);
    embryo_data_string_get(ep, str, buf);
    f = (float)atof(buf);
    return EMBRYO_FLOAT_TO_CELL(f);
@@ -110,10 +117,21 @@ _embryo_fp_div(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
 {
    /* params[1] = float dividend (top) */
    /* params[2] = float divisor (bottom) */
 {
    /* params[1] = float dividend (top) */
    /* params[2] = float divisor (bottom) */
-   float f;
+   float f, ff;
 
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
 
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
-   f = EMBRYO_CELL_TO_FLOAT(params[1]) / EMBRYO_CELL_TO_FLOAT(params[2]);
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   ff = EMBRYO_CELL_TO_FLOAT(params[2]);
+   if (ff == 0.0)
+     {
+        if (f == 0.0)
+          return EMBRYO_FLOAT_TO_CELL(0.0f);
+        else if (f < 0.0)
+          return EMBRYO_FLOAT_TO_CELL(-MAXFLOAT);
+        else
+          return EMBRYO_FLOAT_TO_CELL(MAXFLOAT);
+     }
+   f = f / ff;
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -150,7 +168,7 @@ _embryo_fp_fract(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
 
    if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
 
    if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
-   f -= (float)(floor((double)f));
+   f -= (floorf(f));
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -167,17 +185,17 @@ _embryo_fp_round(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
    switch (params[2])
      {
       case 1: /* round downwards (truncate) */
    switch (params[2])
      {
       case 1: /* round downwards (truncate) */
-       f = (float)(floor((double)f));
+       f = (floorf(f));
        break;
       case 2: /* round upwards */
        break;
       case 2: /* round upwards */
-       f = (float)(ceil((double)f));
+       f = (ceilf(f));
        break;
       case 3: /* round towards zero */
        break;
       case 3: /* round towards zero */
-       if (f >= 0.0) f = (float)(floor((double)f));
-       else          f = (float)(ceil((double)f));
+       if (f >= 0.0) f = (floorf(f));
+       else          f = (ceilf(f));
        break;
       default: /* standard, round to nearest */
        break;
       default: /* standard, round to nearest */
-       f = (float)(floor((double)f + 0.5));
+       f = (floorf(f + 0.5));
        break;
      }
     return (Embryo_Cell)f;
        break;
      }
     return (Embryo_Cell)f;
@@ -206,7 +224,7 @@ _embryo_fp_sqroot(Embryo_Program *ep, Embryo_Cell *params)
 
    if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
 
    if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
-   f = (float)sqrt(f);
+   f = sqrtf(f);
    if (f < 0)
      {
        embryo_program_error_set(ep, EMBRYO_ERROR_DOMAIN);
    if (f < 0)
      {
        embryo_program_error_set(ep, EMBRYO_ERROR_DOMAIN);
@@ -225,7 +243,7 @@ _embryo_fp_power(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    ff = EMBRYO_CELL_TO_FLOAT(params[2]);
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    ff = EMBRYO_CELL_TO_FLOAT(params[2]);
-   f = (float)pow(f, ff);
+   f = powf(f, ff);
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -234,7 +252,7 @@ _embryo_fp_log(Embryo_Program *ep, Embryo_Cell *params)
 {
    /* params[1] = float operand 1 (value) */
    /* params[2] = float operand 2 (base) */
 {
    /* params[1] = float operand 1 (value) */
    /* params[2] = float operand 2 (base) */
-   float f, ff;
+   float f, ff, tf;
 
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
 
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
@@ -244,8 +262,14 @@ _embryo_fp_log(Embryo_Program *ep, Embryo_Cell *params)
        embryo_program_error_set(ep, EMBRYO_ERROR_DOMAIN);
        return 0;
      }
        embryo_program_error_set(ep, EMBRYO_ERROR_DOMAIN);
        return 0;
      }
-    if (ff == 10.0) f = (float)log10(f);
-    else f = (float)(log(f) / log(ff));
+    if (ff == 10.0) f = log10f(f);
+    else if (ff == 2.0) f = log2f(f);
+    else
+     {
+        tf = logf(ff);
+        if (tf == 0.0) f = 0.0;
+        else f = (logf(f) / tf);
+     }
     return EMBRYO_FLOAT_TO_CELL(f);
 }
 
     return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -259,7 +283,7 @@ _embryo_fp_sin(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    f = _embryo_fp_degrees_to_radians(f, params[2]);
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    f = _embryo_fp_degrees_to_radians(f, params[2]);
-   f = sin(f);
+   f = sinf(f);
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -273,7 +297,7 @@ _embryo_fp_cos(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    f = _embryo_fp_degrees_to_radians(f, params[2]);
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    f = _embryo_fp_degrees_to_radians(f, params[2]);
-   f = cos(f);
+   f = cosf(f);
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -287,7 +311,7 @@ _embryo_fp_tan(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    f = _embryo_fp_degrees_to_radians(f, params[2]);
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    f = EMBRYO_CELL_TO_FLOAT(params[1]);
    f = _embryo_fp_degrees_to_radians(f, params[2]);
-   f = tan(f);
+   f = tanf(f);
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
@@ -303,6 +327,125 @@ _embryo_fp_abs(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
    return EMBRYO_FLOAT_TO_CELL(f);
 }
 
+static Embryo_Cell
+_embryo_fp_asin(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand 1 (angle) */
+   /* params[2] = float operand 2 (radix) */
+   float f;
+
+   if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = sinf(f);
+   f = _embryo_fp_degrees_to_radians(f, params[2]);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_acos(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand 1 (angle) */
+   /* params[2] = float operand 2 (radix) */
+   float f;
+
+   if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = cosf(f);
+   f = _embryo_fp_degrees_to_radians(f, params[2]);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_atan(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand 1 (angle) */
+   /* params[2] = float operand 2 (radix) */
+   float f;
+
+   if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = tanf(f);
+   f = _embryo_fp_degrees_to_radians(f, params[2]);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_atan2(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand 1 (y) */
+   /* params[2] = float operand 2 (x) */
+   /* params[3] = float operand 3 (radix) */
+   float f, ff;
+
+   if (params[0] != (3 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   ff = EMBRYO_CELL_TO_FLOAT(params[2]);
+   f = atan2f(f, ff);
+   f = _embryo_fp_degrees_to_radians(f, params[3]);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_log1p(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand */
+   float f;
+
+   if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = log1pf(f);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_cbrt(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand */
+   float f;
+
+   if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = cbrtf(f);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_exp(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand */
+   float f;
+
+   if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = expf(f);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_exp2(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand */
+   float f;
+
+   if (params[0] != (1 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   f = exp2f(f);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
+static Embryo_Cell
+_embryo_fp_hypot(Embryo_Program *ep __UNUSED__, Embryo_Cell *params)
+{
+   /* params[1] = float operand */
+   float f, ff;
+
+   if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
+   f = EMBRYO_CELL_TO_FLOAT(params[1]);
+   ff = EMBRYO_CELL_TO_FLOAT(params[2]);
+   f = hypotf(f, ff);
+   return EMBRYO_FLOAT_TO_CELL(f);
+}
+
 /* functions used by the rest of embryo */
 
 void
 /* functions used by the rest of embryo */
 
 void
@@ -324,4 +467,14 @@ _embryo_fp_init(Embryo_Program *ep)
    embryo_program_native_call_add(ep, "cos",       _embryo_fp_cos);
    embryo_program_native_call_add(ep, "tan",       _embryo_fp_tan);
    embryo_program_native_call_add(ep, "abs",       _embryo_fp_abs);
    embryo_program_native_call_add(ep, "cos",       _embryo_fp_cos);
    embryo_program_native_call_add(ep, "tan",       _embryo_fp_tan);
    embryo_program_native_call_add(ep, "abs",       _embryo_fp_abs);
+   /* Added in embryo 1.2 */
+   embryo_program_native_call_add(ep, "asin",      _embryo_fp_asin);
+   embryo_program_native_call_add(ep, "acos",      _embryo_fp_acos);
+   embryo_program_native_call_add(ep, "atan",      _embryo_fp_atan);
+   embryo_program_native_call_add(ep, "atan2",     _embryo_fp_atan2);
+   embryo_program_native_call_add(ep, "log1p",     _embryo_fp_log1p);
+   embryo_program_native_call_add(ep, "cbrt",      _embryo_fp_cbrt);
+   embryo_program_native_call_add(ep, "exp",       _embryo_fp_exp);
+   embryo_program_native_call_add(ep, "exp2",      _embryo_fp_exp2);
+   embryo_program_native_call_add(ep, "hypot",     _embryo_fp_hypot);
 }
 }
index 48f5ba8..3c57ec7 100644 (file)
@@ -1,48 +1,42 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 
-#include "embryo_private.h"
+#include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
 
 #include <time.h>
 
+#include "Embryo.h"
+#include "embryo_private.h"
+
+static Embryo_Version _version = { VMAJ, VMIN, VMIC, VREV };
+EAPI Embryo_Version *embryo_version = &_version;
+
 static int _embryo_init_count = 0;
 
 /*** EXPORTED CALLS ***/
 
 static int _embryo_init_count = 0;
 
 /*** EXPORTED CALLS ***/
 
-/**
- * @defgroup Embryo_Library_Group Library Maintenance Functions
- *
- * Functions that start up and shutdown the Embryo library.
- */
-
-/**
- * Initialises the Embryo library.
- * @return  The number of times the library has been initialised without being
- *          shut down.
- * @ingroup Embryo_Library_Group
- */
 EAPI int
 embryo_init(void)
 {
 EAPI int
 embryo_init(void)
 {
-   _embryo_init_count++;
-   if (_embryo_init_count > 1) return _embryo_init_count;
+   if (++_embryo_init_count != 1)
+     return _embryo_init_count;
 
    srand(time(NULL));
 
    return _embryo_init_count;
 }
 
 
    srand(time(NULL));
 
    return _embryo_init_count;
 }
 
-/**
- * Shuts down the Embryo library.
- * @return  The number of times the library has been initialised without being
- *          shutdown.
- * @ingroup Embryo_Library_Group
- */
 EAPI int
 embryo_shutdown(void)
 {
 EAPI int
 embryo_shutdown(void)
 {
-   _embryo_init_count--;
-   if (_embryo_init_count > 0) return _embryo_init_count;
+   if (_embryo_init_count <= 0)
+     {
+        printf("%s:%i Init count not greater than 0 in shutdown.", __FUNCTION__, __LINE__);
+        return 0;
+     }
+   if (--_embryo_init_count != 0)
+     return _embryo_init_count;
 
    return _embryo_init_count;
 }
 
    return _embryo_init_count;
 }
index 0a0511c..a4205e1 100644 (file)
@@ -1,36 +1,6 @@
 #ifndef _EMBRYO_PRIVATE_H
 #define _EMBRYO_PRIVATE_H
 
 #ifndef _EMBRYO_PRIVATE_H
 #define _EMBRYO_PRIVATE_H
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <string.h>
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#elif defined __GNUC__
-# define alloca __builtin_alloca
-#elif defined _AIX
-# define alloca __alloca
-#elif defined _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-#else
-# include <stddef.h>
-# ifdef  __cplusplus
-extern "C"
-# endif
-void *alloca (size_t);
-#endif
-
-#include "Embryo.h"
 
 #ifdef __GNUC__
 # if __GNUC__ >= 4
 
 #ifdef __GNUC__
 # if __GNUC__ >= 4
@@ -39,12 +9,6 @@ void *alloca (size_t);
 # endif
 #endif
 
 # endif
 #endif
 
-#if HAVE___ATTRIBUTE__
-#define __UNUSED__ __attribute__((unused))
-#else
-#define __UNUSED__
-#endif
-
 typedef enum _Embryo_Opcode Embryo_Opcode;
 
 enum _Embryo_Opcode
 typedef enum _Embryo_Opcode Embryo_Opcode;
 
 enum _Embryo_Opcode
@@ -285,11 +249,20 @@ struct _Embryo_Program
    void          *data;
 };
 
    void          *data;
 };
 
+#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
+# pragma pack(1)
+# define EMBRYO_STRUCT_PACKED
+#elif defined (__GNUC__) || (defined (__SUNPRO_C) && __SUNPRO_C >= 0x5100)
+# define EMBRYO_STRUCT_PACKED __attribute__((packed))
+#else
+# define EMBRYO_STRUCT_PACKED
+#endif
+
 struct _Embryo_Func_Stub
 {
    int  address;
    char name[sEXPMAX+1];
 struct _Embryo_Func_Stub
 {
    int  address;
    char name[sEXPMAX+1];
-} __attribute__((packed));
+} EMBRYO_STRUCT_PACKED;
 
 struct _Embryo_Header
 {
 
 struct _Embryo_Header
 {
@@ -310,7 +283,11 @@ struct _Embryo_Header
    int pubvars; /* the "public variables" table */
    int tags; /* the "public tagnames" table */
    int nametable; /* name table, file version 7 only */
    int pubvars; /* the "public variables" table */
    int tags; /* the "public tagnames" table */
    int nametable; /* name table, file version 7 only */
-} __attribute__((packed));
+} EMBRYO_STRUCT_PACKED;
+
+#if defined _MSC_VER || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100)
+# pragma pack()
+#endif
 
 void _embryo_args_init(Embryo_Program *ep);
 void _embryo_fp_init(Embryo_Program *ep);
 
 void _embryo_args_init(Embryo_Program *ep);
 void _embryo_fp_init(Embryo_Program *ep);
index 16025b7..627f7ed 100644 (file)
@@ -1,7 +1,10 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 
+#include <stdlib.h>
+
+#include "Embryo.h"
 #include "embryo_private.h"
 
 /* exported random number api */
 #include "embryo_private.h"
 
 /* exported random number api */
index 2ed03c7..0c2faa2 100644 (file)
@@ -1,9 +1,44 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif !defined alloca
+# ifdef __GNUC__
+#  define alloca __builtin_alloca
+# elif defined _AIX
+#  define alloca __alloca
+# elif defined _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# elif !defined HAVE_ALLOCA
+#  ifdef  __cplusplus
+extern "C"
+#  endif
+void *alloca (size_t);
+# endif
+#endif
+
+#ifdef HAVE_EXOTIC
+# include <Exotic.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <fnmatch.h>
 
 
+#include "Embryo.h"
 #include "embryo_private.h"
 #include "embryo_private.h"
-#include <fnmatch.h>
 
 #define STRGET(ep, str, par) { \
    Embryo_Cell *___cptr; \
 
 #define STRGET(ep, str, par) { \
    Embryo_Cell *___cptr; \
@@ -254,7 +289,7 @@ _embryo_str_snprintf(Embryo_Program *ep, Embryo_Cell *params)
    /* params[2] = bufsize */
    /* params[3] = format_string */
    /* params[4] = first arg ... */
    /* params[2] = bufsize */
    /* params[3] = format_string */
    /* params[4] = first arg ... */
-   if (params[0] < (3 * sizeof(Embryo_Cell))) return 0;
+   if (params[0] < (Embryo_Cell)(3 * sizeof(Embryo_Cell))) return 0;
    if (params[2] <= 0) return 0;
    STRGET(ep, s1, params[3]);
    if (!s1) return -1;
    if (params[2] <= 0) return 0;
    STRGET(ep, s1, params[3]);
    if (!s1) return -1;
@@ -403,7 +438,7 @@ _embryo_str_strstr(Embryo_Program *ep, Embryo_Cell *params)
    STRGET(ep, s2, params[2]);
    if ((!s1) || (!s2)) return -1;
    p = strstr(s1, s2);
    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);
 }
 
    return (Embryo_Cell)(p - s1);
 }
 
@@ -417,8 +452,9 @@ _embryo_str_strchr(Embryo_Program *ep, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    STRGET(ep, s1, params[1]);
    STRGET(ep, s2, params[2]);
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    STRGET(ep, s1, params[1]);
    STRGET(ep, s2, params[2]);
+   if ((!s1) || (!s2)) return -1;
    p = strchr(s1, s2[0]);
    p = strchr(s1, s2[0]);
-   if (p == NULL) return -1;
+   if (!p) return -1;
    return (Embryo_Cell)(p - s1);
 }
 
    return (Embryo_Cell)(p - s1);
 }
 
@@ -432,8 +468,9 @@ _embryo_str_strrchr(Embryo_Program *ep, Embryo_Cell *params)
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    STRGET(ep, s1, params[1]);
    STRGET(ep, s2, params[2]);
    if (params[0] != (2 * sizeof(Embryo_Cell))) return 0;
    STRGET(ep, s1, params[1]);
    STRGET(ep, s2, params[2]);
+   if ((!s1) || (!s2)) return -1;
    p = strrchr(s1, s2[0]);
    p = strrchr(s1, s2[0]);
-   if (p == NULL) return -1;
+   if (!p) return -1;
    return (Embryo_Cell)(p - s1);
 }
 
    return (Embryo_Cell)(p - s1);
 }
 
index a05441e..90c14cf 100644 (file)
@@ -1,15 +1,29 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef EFL_HAVE_GETTIMEOFDAY
+# error "Your platform isn't supported yet"
+#endif
 
 
-#include "embryo_private.h"
 #include <sys/time.h>
 #include <time.h>
 
 #include <sys/time.h>
 #include <time.h>
 
-#ifndef HAVE_GETTIMEOFDAY
-# error "Your platform isn't supported yet"
+#ifdef _MSC_VER
+# include <winsock2.h>
 #endif
 
 #endif
 
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#endif
+
+#ifdef HAVE_EXOTIC
+# include <Exotic.h>
+#endif
+
+#include "Embryo.h"
+#include "embryo_private.h"
+
 /* exported time api */
 
 static Embryo_Cell
 /* exported time api */
 
 static Embryo_Cell