diff --git a/legacy/embryo/examples/test.inc b/legacy/embryo/examples/test.inc index 7009cc57e0..97116ef4cd 100644 --- a/legacy/embryo/examples/test.inc +++ b/legacy/embryo/examples/test.inc @@ -4,4 +4,4 @@ #define TEST_INC native printf(format[], ...); -native call(string[], string2[], val); +native native_rec(arg1, str[], arg2); diff --git a/legacy/embryo/examples/test.sma b/legacy/embryo/examples/test.sma index 5c8df2c757..2bd4e766b5 100644 --- a/legacy/embryo/examples/test.sma +++ b/legacy/embryo/examples/test.sma @@ -102,9 +102,19 @@ main() printf("\n\n"); + printf("native_rec(1, 77)\n"); + native_rec(1, "Smelly", 77); + printf("native_rec() done\n"); + 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, ...) { printf("ARGS...\n"); diff --git a/legacy/embryo/src/lib/Embryo.h b/legacy/embryo/src/lib/Embryo.h index b3e7fa8133..366bbd5112 100644 --- a/legacy/embryo/src/lib/Embryo.h +++ b/legacy/embryo/src/lib/Embryo.h @@ -71,15 +71,16 @@ extern "C" { typedef struct _Embryo_Program Embryo_Program; typedef int Embryo_Function; - typedef union { - float f; - Embryo_Cell c; - } FloatEmbryoCell; + typedef union + { + float f; + Embryo_Cell c; + } Embryo_Float_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 */ -#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_shutdown(void); diff --git a/legacy/embryo/src/lib/embryo_amx.c b/legacy/embryo/src/lib/embryo_amx.c index 2afee870e7..43c44c7b19 100644 --- a/legacy/embryo/src/lib/embryo_amx.c +++ b/legacy/embryo/src/lib/embryo_amx.c @@ -1312,7 +1312,7 @@ embryo_program_run(Embryo_Program *ep, Embryo_Function fn) int len; Embryo_Cell ep_addr, *addr; - len = strlen(pr->string); + len = pr->cell_array_size; ep_addr = embryo_data_heap_push(ep, len + 1); if (ep_addr == EMBRYO_CELL_NONE) {