|
|
@ -612,6 +612,10 @@ YYSTYPE yylval; |
|
|
|
|
|
|
|
#define YY_CTX_LOCAL 1 |
|
|
|
|
|
|
|
struct _yycontext; |
|
|
|
|
|
|
|
struct _yycontext *yyctx = 0; |
|
|
|
|
|
|
|
#define YYPARSEFROM yymeta_parsefrom |
|
|
|
#define YYPARSE yymeta_parse |
|
|
|
#define YYRELEASE yymeta_release |
|
|
@ -2021,7 +2025,7 @@ oop evalArgs(oop scope, oop asts) |
|
|
|
|
|
|
|
oop AST= NULL; |
|
|
|
|
|
|
|
void readEvalPrint(yycontext *yy, oop scope, char *fileName) |
|
|
|
void readEvalPrint(oop scope, char *fileName) |
|
|
|
{ |
|
|
|
inputStackPush(fileName); |
|
|
|
input_t *top= inputStack; |
|
|
@ -2030,7 +2034,7 @@ void readEvalPrint(yycontext *yy, oop scope, char *fileName) |
|
|
|
int jbt= sigsetjmp(jbs->jb, 0); |
|
|
|
|
|
|
|
if (0 == jbt) { |
|
|
|
while (YYPARSE(yy)) { |
|
|
|
while (YYPARSE(yyctx)) { |
|
|
|
if (opt_v > 1) printf("%s:%i: ", get(inputStack->name, String, value), inputStack->lineNumber); |
|
|
|
if (!yylval) { |
|
|
|
fclose(inputStack->file); |
|
|
@ -2063,16 +2067,13 @@ void readEvalPrint(yycontext *yy, oop scope, char *fileName) |
|
|
|
|
|
|
|
oop prim_import(oop scope, oop params) |
|
|
|
{ |
|
|
|
yycontext yy, *yyctx = &yy; |
|
|
|
memset(yyctx, 0, sizeof(yy)); |
|
|
|
|
|
|
|
if (map_hasIntegerKey(params, 0)) { |
|
|
|
char *file= get(get(params, Map, elements)[0].value, String, value); |
|
|
|
if (yyctx->__pos < yyctx->__limit) { |
|
|
|
yyctx->__limit--; |
|
|
|
ungetc(yyctx->__buf[yyctx->__limit], inputStack->file); |
|
|
|
} |
|
|
|
readEvalPrint(yyctx, scope, file); |
|
|
|
readEvalPrint(scope, file); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
@ -2321,8 +2322,10 @@ oop prim_microseconds(oop scope, oop params) |
|
|
|
return makeInteger(ru.ru_utime.tv_sec * 1000*1000 + ru.ru_utime.tv_usec); |
|
|
|
} |
|
|
|
|
|
|
|
void meta_init(void) |
|
|
|
void meta_init(yycontext *yy) |
|
|
|
{ |
|
|
|
yyctx = yy; |
|
|
|
|
|
|
|
# if (USE_GC) |
|
|
|
GC_INIT(); |
|
|
|
# endif |
|
|
@ -2375,9 +2378,10 @@ void meta_init(void) |
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
meta_init(); |
|
|
|
|
|
|
|
yycontext yy; |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
|
|
|
|
meta_init(&yy); |
|
|
|
|
|
|
|
int repled = 0; |
|
|
|
while (argc-- > 1) { |
|
|
@ -2385,19 +2389,16 @@ int main(int argc, char **argv) |
|
|
|
if (!strcmp(*argv, "-g")) ++opt_g; |
|
|
|
else if (!strcmp(*argv, "-v")) ++opt_v; |
|
|
|
else if (!strcmp(*argv, "-")) { |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
readEvalPrint(&yy, globals, NULL); |
|
|
|
readEvalPrint(globals, NULL); |
|
|
|
repled= 1; |
|
|
|
} |
|
|
|
else { |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
readEvalPrint(&yy, globals, *argv); |
|
|
|
readEvalPrint(globals, *argv); |
|
|
|
repled= 1; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!repled) { |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
readEvalPrint(&yy, globals, NULL); |
|
|
|
readEvalPrint(globals, NULL); |
|
|
|
} |
|
|
|
|
|
|
|
if (opt_g) { |
|
|
|