X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fwebcc.git;a=blobdiff_plain;f=src%2Fbin%2Ftools%2Ftestapc.c;h=77b825e2826e80e374b5c282ff06e1419e963a13;hp=4db0b86e0f5eae5366f9c7d0f22ed8167544891e;hb=301cac5f6e2edcecf2e1bd89aee5182130a213fc;hpb=0f505368fa8abbc2e9ab0296b9a5e6bd4869345f diff --git a/src/bin/tools/testapc.c b/src/bin/tools/testapc.c index 4db0b86..77b825e 100644 --- a/src/bin/tools/testapc.c +++ b/src/bin/tools/testapc.c @@ -9,6 +9,7 @@ #include //print #include //errors #include //strnlen +#include //non-local jumps /* Posix */ #include //exit #include //getopt @@ -28,9 +29,11 @@ int testapc_yyparse(void); int test_yyparse(void); extern //bison -int yyparse(void); +int yyparse(void); extern //lexer.c int lexer_init(void); +extern //scanner.c +int scanner_init(void); extern //apc.c const char* cargs['Z']; @@ -39,6 +42,9 @@ YYSTYPE yylval; extern //lexer.c int lexer(void); +static +jmp_buf testapc_jump; + /* Ansi Term Colors */ #define RED "\x1b[31m" #define GREEN "\x1b[32m" @@ -55,7 +61,8 @@ int main ( int argc, char* argv[] ) -{ apc_main(argc, argv); +{ setjmp(testapc_jump); + apc_main(argc, argv); printf(GREEN "PASS" CLRC "\n"); exit(EXIT_SUCCESS); } @@ -79,7 +86,7 @@ int testapc_yyparse return YYABORT; } bPassedTest = 't'; - apc_main(0,NULL); + longjmp(testapc_jump,0); } return yyparse(); }