fix some typedefs... and cell arrays...

SVN revision: 12416
This commit is contained in:
Carsten Haitzler 2004-12-09 05:10:42 +00:00
parent d0f2572394
commit 5d5a4b4551
4 changed files with 19 additions and 8 deletions

View File

@ -4,4 +4,4 @@
#define TEST_INC #define TEST_INC
native printf(format[], ...); native printf(format[], ...);
native call(string[], string2[], val); native native_rec(arg1, str[], arg2);

View File

@ -102,9 +102,19 @@ main()
printf("\n\n"); printf("\n\n");
printf("native_rec(1, 77)\n");
native_rec(1, "Smelly", 77);
printf("native_rec() done\n");
return 7; return 7;
} }
public rec1(arg1, str[], arg2)
{
printf("arg1=%i str=%s arg2=%i\n", arg1, str, arg2);
return native_rec(arg1 + 1, str, arg2);
}
vargs(a, b, ...) vargs(a, b, ...)
{ {
printf("ARGS...\n"); printf("ARGS...\n");

View File

@ -71,15 +71,16 @@ extern "C" {
typedef struct _Embryo_Program Embryo_Program; typedef struct _Embryo_Program Embryo_Program;
typedef int Embryo_Function; typedef int Embryo_Function;
typedef union { typedef union
float f; {
Embryo_Cell c; float f;
} FloatEmbryoCell; Embryo_Cell c;
} Embryo_Float_Cell;
/** Float to Embryo_Cell */ /** Float to Embryo_Cell */
#define EMBRYO_FLOAT_TO_CELL(f) ((FloatEmbryoCell) 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) ((FloatEmbryoCell) c).f #define EMBRYO_CELL_TO_FLOAT(c) ((Embryo_Float_Cell) c).f
EAPI int embryo_init(void); EAPI int embryo_init(void);
EAPI int embryo_shutdown(void); EAPI int embryo_shutdown(void);

View File

@ -1312,7 +1312,7 @@ embryo_program_run(Embryo_Program *ep, Embryo_Function fn)
int len; int len;
Embryo_Cell ep_addr, *addr; Embryo_Cell ep_addr, *addr;
len = strlen(pr->string); len = pr->cell_array_size;
ep_addr = embryo_data_heap_push(ep, len + 1); ep_addr = embryo_data_heap_push(ep, len + 1);
if (ep_addr == EMBRYO_CELL_NONE) if (ep_addr == EMBRYO_CELL_NONE)
{ {