[Merge] merge with upstream
authorWooHyun Jung <wh0705.jung@samsung.com>
Thu, 25 Nov 2010 06:16:24 +0000 (15:16 +0900)
committerWooHyun Jung <wh0705.jung@samsung.com>
Thu, 25 Nov 2010 06:16:24 +0000 (15:16 +0900)
41 files changed:
COPYING
COPYING-PLAIN [deleted file]
README.in
configure.ac
doc/embryo.dox.in
doc/img/_.gif [deleted file]
doc/img/b.png [deleted file]
doc/img/embryo.png [deleted file]
doc/img/embryo_big.png [deleted file]
doc/img/embryo_mini.png [deleted file]
doc/img/embryo_small.png [deleted file]
doc/img/evas.png [deleted file]
doc/img/evas_big.png [deleted file]
doc/img/evas_mini.png [deleted file]
doc/img/evas_small.png [deleted file]
doc/img/n.gif [deleted file]
doc/img/n.png [deleted file]
doc/img/t.gif [deleted file]
doc/img/t.png [deleted file]
doc/img/tl.gif [deleted file]
doc/img/tl.png [deleted file]
m4/efl_binary.m4
readme.slp2 [deleted file]
src/bin/embryo_cc_amx.h
src/bin/embryo_cc_prefix.c
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_sc5.scp
src/bin/embryo_cc_sc6.c
src/bin/embryo_cc_sc7.c
src/bin/embryo_cc_sc7.scp
src/bin/embryo_cc_sclist.c
src/bin/embryo_cc_scvars.c
src/lib/Embryo.h
src/lib/embryo_amx.c
src/lib/embryo_float.c
src/lib/embryo_str.c

diff --git a/COPYING b/COPYING
index 1b97605..9f46f12 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -25,7 +25,7 @@ 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 
+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
diff --git a/COPYING-PLAIN b/COPYING-PLAIN
deleted file mode 100644 (file)
index 376875e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-Plain English Copyright Notice
-
-This file is not intended to be the actual License. The reason this file
-exists is that we here are programmers and engineers. We aren't lawyers. We
-provide licenses that we THINK say the right things, but we have our own
-intentions at heart. This is a plain-english explanation of what those
-intentions are, and if you follow them you will be within the "spirit" of
-the license.
-
-The intent is for us to enjoy writing software that is useful to us (the
-AUTHORS) and allow others to use it freely and also benefit from the work we
-put into making it. We don't want to restrict others using it. They should
-not *HAVE* to make the source code of the applications they write that
-simply link to these libraries (be that statically or dynamically), or for
-them to be limited as to what license they choose to use (be it open, closed
-or anything else). But we would like to know you are using these libraries.
-We simply would like to know that it has been useful to someone. This is why
-we ask for acknowledgement of some sort.
-
-You can do what you want with the source of this software - it doesn't
-matter. We still have it here for ourselves and it is open and free to use
-and download and play with. It can't be taken away. We don't really mind what
-you do with the source to your software. We would simply like to know that
-you are using it - especially if it makes it to a commerical product. If you
-simply e-mail all the AUTHORS (see COPYING and AUTHORS files) telling us, and
-then make sure you include a paragraph or page in the manual for the product
-with the copyright notice and state that you used this software, we will be
-very happy. If you want to contribute back modifications and fixes you may have
-made we will welcome those too with open arms (generally). If you want help
-with changes needed, ports needed or features to be added, arrangements can
-be easily made with some dialogue.
-
-Carsten Haitzler <raster@rasterman.com>
index c3960a7..80fad6f 100644 (file)
--- a/README.in
+++ b/README.in
@@ -1,4 +1,4 @@
-Embryo @VERSION@ ALPHA
+Embryo @VERSION@ BETA
 
 ******************************************************************************
 
@@ -31,7 +31,7 @@ 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.htm>PAWN</a> language (formerly called
+<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
@@ -62,7 +62,7 @@ issue.
 
 For more documentation please see the Language guide here:
 
-<a href=http://www.compuphase.com/pawn/pawn-lang.pdf>Pawn Language Booklet</a>
+<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).
index e634fdc..ef0ac50 100644 (file)
@@ -18,7 +18,7 @@ m4_define([lt_age], v_min)
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 
-AC_INIT([embryo], [v_ver-alpha], [enlightenment-devel@lists.sourceforge.net])
+AC_INIT([embryo], [v_ver.beta2], [enlightenment-devel@lists.sourceforge.net])
 AC_PREREQ([2.52])
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_MACRO_DIR([m4])
index bf036fc..7fb62f8 100644 (file)
@@ -289,7 +289,7 @@ This is the @e only file you need to include.
 
 /**
   @def EMBRYO_FUNCTION_NONE 
-  An invalid/non-existant function.
+  An invalid/non-existent function.
 */
 
 /**
diff --git a/doc/img/_.gif b/doc/img/_.gif
deleted file mode 100644 (file)
index 60fa7a1..0000000
Binary files a/doc/img/_.gif and /dev/null differ
diff --git a/doc/img/b.png b/doc/img/b.png
deleted file mode 100644 (file)
index 6fbfc2b..0000000
Binary files a/doc/img/b.png and /dev/null differ
diff --git a/doc/img/embryo.png b/doc/img/embryo.png
deleted file mode 100644 (file)
index 47597a8..0000000
Binary files a/doc/img/embryo.png and /dev/null differ
diff --git a/doc/img/embryo_big.png b/doc/img/embryo_big.png
deleted file mode 100644 (file)
index cd818f7..0000000
Binary files a/doc/img/embryo_big.png and /dev/null differ
diff --git a/doc/img/embryo_mini.png b/doc/img/embryo_mini.png
deleted file mode 100644 (file)
index f4f99f0..0000000
Binary files a/doc/img/embryo_mini.png and /dev/null differ
diff --git a/doc/img/embryo_small.png b/doc/img/embryo_small.png
deleted file mode 100644 (file)
index 8bea367..0000000
Binary files a/doc/img/embryo_small.png and /dev/null differ
diff --git a/doc/img/evas.png b/doc/img/evas.png
deleted file mode 100644 (file)
index 47597a8..0000000
Binary files a/doc/img/evas.png and /dev/null differ
diff --git a/doc/img/evas_big.png b/doc/img/evas_big.png
deleted file mode 100644 (file)
index cd818f7..0000000
Binary files a/doc/img/evas_big.png and /dev/null differ
diff --git a/doc/img/evas_mini.png b/doc/img/evas_mini.png
deleted file mode 100644 (file)
index f4f99f0..0000000
Binary files a/doc/img/evas_mini.png and /dev/null differ
diff --git a/doc/img/evas_small.png b/doc/img/evas_small.png
deleted file mode 100644 (file)
index 8bea367..0000000
Binary files a/doc/img/evas_small.png and /dev/null differ
diff --git a/doc/img/n.gif b/doc/img/n.gif
deleted file mode 100644 (file)
index 8c3148f..0000000
Binary files a/doc/img/n.gif and /dev/null differ
diff --git a/doc/img/n.png b/doc/img/n.png
deleted file mode 100644 (file)
index 6d80004..0000000
Binary files a/doc/img/n.png and /dev/null differ
diff --git a/doc/img/t.gif b/doc/img/t.gif
deleted file mode 100644 (file)
index cff3068..0000000
Binary files a/doc/img/t.gif and /dev/null differ
diff --git a/doc/img/t.png b/doc/img/t.png
deleted file mode 100644 (file)
index 5a40479..0000000
Binary files a/doc/img/t.png and /dev/null differ
diff --git a/doc/img/tl.gif b/doc/img/tl.gif
deleted file mode 100644 (file)
index c5e973a..0000000
Binary files a/doc/img/tl.gif and /dev/null differ
diff --git a/doc/img/tl.png b/doc/img/tl.png
deleted file mode 100644 (file)
index b14a7f1..0000000
Binary files a/doc/img/tl.png and /dev/null differ
index 0fe85ab..93d6934 100644 (file)
@@ -4,9 +4,9 @@ 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 tranformed into _)
-dnl Define have_binary (- is tranformed into _)
-dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being tranformed into _)
+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],
 [
diff --git a/readme.slp2 b/readme.slp2
deleted file mode 100644 (file)
index cd02b7f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-EFL:embryo repo for SLP2
index 875b2ef..0118e2d 100644 (file)
@@ -18,7 +18,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_amx.h 45071 2010-01-12 22:44:25Z caro $
+ *  Version: $Id$
  */
 
 #ifndef EMBRYO_CC_AMX_H
index 27e4c1a..028376d 100644 (file)
@@ -205,7 +205,7 @@ _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
+   /* sometimes this isn't 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
index cac7ff7..89fd1c3 100644 (file)
@@ -9,7 +9,7 @@
  *  Copyright J.E. Hendrix, 1982, 1983
  *  Copyright T. Riemersma, 1997-2003
  *
- *  Version: $Id: embryo_cc_sc.h 47528 2010-03-28 08:43:53Z caro $
+ *  Version: $Id$
  *
  *  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
index 2beeb38..d7e8659 100644 (file)
@@ -828,7 +828,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
-             * 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.
@@ -2705,7 +2705,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;
-                 /* 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];
@@ -2989,7 +2989,7 @@ destructsymbols(symbol * root, int level)
             operator_symname(symbolname, "~", sym->tag, 0, 1, 0);
             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 */
@@ -3797,7 +3797,7 @@ doswitch(void)
    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). */
    for (cse = caselist.next; cse && cse->next; cse = cse->next)
index 67845f8..e9b6166 100644 (file)
@@ -101,7 +101,8 @@ plungequalifiedfile(char *name)
          }                     /* if */
        ext_idx++;
      }
-   while (!fp && ext_idx < (sizeof extensions / sizeof extensions[0]));
+   while ((!fp) && 
+          (ext_idx < (int)(sizeof extensions / sizeof extensions[0])));
    if (!fp)
      {
        *ext = '\0';            /* restore filename */
@@ -197,11 +198,11 @@ doinclude(void)
      }                         /* 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 */
-   assert(i >= 0 && i < sizeof name);
+   assert((i >= 0) && (i < (int)(sizeof(name))));
    name[i] = '\0';             /* zero-terminate the string */
 
    if (*lptr != c)
@@ -989,7 +990,9 @@ command(void)
                         {
                            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';
@@ -1022,9 +1025,11 @@ command(void)
                       int                 i;
 
                       /* first gather all information, start with the tag name */
-                      while (*lptr <= ' ' && *lptr != '\0')
+                      while ((*lptr <= ' ') && (*lptr != '\0'))
                          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';
@@ -1084,9 +1089,11 @@ command(void)
                       do
                         {
                            /* get the name */
-                           while (*lptr <= ' ' && *lptr != '\0')
+                           while ((*lptr <= ' ') && (*lptr != '\0'))
                               lptr++;
-                           for (i = 0; i < sizeof name && isalpha(*lptr);
+                           for (i = 0; 
+                                 (i < (int)(sizeof(name))) && 
+                                 (isalpha(*lptr));
                                 i++, lptr++)
                               name[i] = *lptr;
                            name[i] = '\0';
index ad30e0c..1206857 100644 (file)
@@ -166,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]));
-            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])
                    {
@@ -186,7 +186,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
               (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])
                    {
@@ -221,7 +221,7 @@ check_userop(void   (*oper) (void), int tag1, int tag2, int numparam,
           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 */
@@ -266,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
-        * 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 */
@@ -820,7 +820,7 @@ array_levelsize(symbol * sym, int level)
  *
  *  Lowest hierarchy level (except for the , operator).
  *
- *  Global references: intest   (reffered to only)
+ *  Global references: intest   (referred to only)
  */
 int
 hier14(value * lval1)
index 57cbca1..258d714 100644 (file)
@@ -247,7 +247,7 @@ alignframe(int numbytes)
    /* "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);
index 57ce68c..ebbd6a0 100644 (file)
@@ -19,7 +19,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_sc5.c 51023 2010-08-11 20:35:26Z lucas $
+ *  Version: $Id$
  */
 
 
@@ -49,9 +49,9 @@ 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).
  *
- *  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
index 8005f79..bf0a606 100644 (file)
@@ -18,7 +18,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_sc5.scp 14177 2005-04-13 19:37:01Z tsauerbeck $
+ *  Version: $Id$
  */
 
 int         strexpand(char *dest, unsigned char *source, int maxlen,
index 61e1828..417a8a1 100644 (file)
@@ -662,10 +662,10 @@ assemble(FILE * fout, FILE * fin)
 
 #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);
-   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);
index c8a977e..910c522 100644 (file)
@@ -235,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
- *     '[|...|...] valid and usefull
+ *     '[|...|...] valid and useful
  *     '[...|...]  invalid, first string doesn't start with '|'
  *     '[|...|]    invalid
  */
@@ -316,7 +316,7 @@ stgstring(char *start, char *end)
  *  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)
@@ -402,16 +402,16 @@ phopt_init(void)
        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);
        if (sequences[i].find)
           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);
        if (sequences[i].replace)
           strcpy(sequences[i].replace, str);
index 83d49a1..38f784d 100644 (file)
@@ -19,7 +19,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_sc7.scp 14177 2005-04-13 19:37:01Z tsauerbeck $
+ *  Version: $Id$
  */
 
 int         strexpand(char *dest, unsigned char *source, int maxlen,
index aaf5a12..e908248 100644 (file)
@@ -288,6 +288,6 @@ delete_substtable(void)
    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;
 }
index fb9eb12..f369b9b 100644 (file)
@@ -20,7 +20,7 @@
  *      misrepresented as being the original software.
  *  3.  This notice may not be removed or altered from any source distribution.
  *
- *  Version: $Id: embryo_cc_scvars.c 50816 2010-08-04 16:57:32Z lucas $
+ *  Version: $Id$
  */
 
 
index 7fdcfe0..e7c1a72 100644 (file)
@@ -44,8 +44,8 @@ extern "C" {
    
    EAPI extern Embryo_Version *embryo_version;
    
-   /* potentioal error values */
-   enum
+   /* potential error values */
+   typedef enum _Embryo_Error
      {
        EMBRYO_ERROR_NONE,
          /* reserve the first 15 error codes for exit codes of the abstract machine */
@@ -73,25 +73,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;
 
-   /* 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 */
-#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;
+  /** An invalid cell reference */
+#define EMBRYO_CELL_NONE     0x7fffffff
+   
    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
      {
@@ -128,11 +132,11 @@ extern "C" {
    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_error_set(Embryo_Program *ep, Embryo_Error error);
+   EAPI Embryo_Error     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 const char      *embryo_error_string_get(Embryo_Error 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);
@@ -140,7 +144,7 @@ extern "C" {
    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_Status    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);
index 97c0b12..ab96ab7 100644 (file)
@@ -206,12 +206,13 @@ _embryo_program_init(Embryo_Program *ep, void *code)
    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);
-       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...
@@ -547,7 +548,11 @@ embryo_program_vm_pop(Embryo_Program *ep)
  * @ingroup Embryo_Swap_Group
  */
 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);
@@ -561,7 +566,11 @@ embryo_swap_16(unsigned short *v)
  * @ingroup Embryo_Swap_Group
  */
 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);
@@ -700,7 +709,7 @@ embryo_program_variable_get(Embryo_Program *ep, int num)
  * @ingroup Embryo_Error_Group
  */
 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;
@@ -712,7 +721,7 @@ embryo_program_error_set(Embryo_Program *ep, int error)
  * @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;
@@ -759,7 +768,7 @@ embryo_program_data_get(Embryo_Program *ep)
  * @ingroup Embryo_Error_Group
  */
 EAPI const char *
-embryo_error_string_get(int error)
+embryo_error_string_get(Embryo_Error error)
 {
    const char *messages[] =
      {
@@ -790,7 +799,8 @@ embryo_error_string_get(int 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];
 }
@@ -1041,7 +1051,7 @@ embryo_program_recursion_get(Embryo_Program *ep)
  *          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;
@@ -2062,7 +2072,7 @@ embryo_program_run(Embryo_Program *ep, Embryo_Function fn)
 
                       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);
                    }
@@ -2193,7 +2203,7 @@ embryo_program_return_value_get(Embryo_Program *ep)
  * 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
+ * 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
index 54f81e4..a65fbe5 100644 (file)
@@ -91,7 +91,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 ((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);
index 653ff50..46a3284 100644 (file)
@@ -276,7 +276,7 @@ _embryo_str_snprintf(Embryo_Program *ep, Embryo_Cell *params)
    /* 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;