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
+++ /dev/null
-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>
-Embryo @VERSION@ ALPHA
+Embryo @VERSION@ BETA
******************************************************************************
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
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).
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
-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])
/**
@def EMBRYO_FUNCTION_NONE
- An invalid/non-existant function.
+ An invalid/non-existent function.
*/
/**
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],
[
+++ /dev/null
-EFL:embryo repo for SLP2
* 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
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
* 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
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.
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];
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 */
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)
} /* 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 */
} /* 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)
{
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';
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';
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';
{
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])
{
(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])
{
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 */
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 */
*
* Lowest hierarchy level (except for the , operator).
*
- * Global references: intest (reffered to only)
+ * Global references: intest (referred to only)
*/
int
hier14(value * lval1)
/* "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);
* 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$
*/
* 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
* 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,
#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);
* 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
*/
* 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)
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);
* 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,
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;
}
* 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$
*/
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 */
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
{
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);
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);
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...
* @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);
* @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);
* @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;
* @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;
* @ingroup Embryo_Error_Group
*/
EAPI const char *
-embryo_error_string_get(int error)
+embryo_error_string_get(Embryo_Error error)
{
const char *messages[] =
{
/* 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];
}
* 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;
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);
}
* 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
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);
/* 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;