diff options
Diffstat (limited to 'test/rlhc.d/case/atoi1_c.c-C-G1--goto-backend.exp')
-rw-r--r-- | test/rlhc.d/case/atoi1_c.c-C-G1--goto-backend.exp | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/test/rlhc.d/case/atoi1_c.c-C-G1--goto-backend.exp b/test/rlhc.d/case/atoi1_c.c-C-G1--goto-backend.exp new file mode 100644 index 00000000..0e4e6ca9 --- /dev/null +++ b/test/rlhc.d/case/atoi1_c.c-C-G1--goto-backend.exp @@ -0,0 +1,224 @@ +#include <string.h> +#include <stdio.h> + +int neg ; +int value ; + + + + + +static const char _atoi_nfa_targs [] = { 0, 0 , }; +static const char _atoi_nfa_offsets [] = { 0, 0, 0, 0, 0, 0 , }; +static const char _atoi_nfa_push_actions [] = { 0, 0 , }; +static const char _atoi_nfa_pop_trans [] = { 0, 0 , }; +static const int atoi_start = 1; +static const int atoi_first_final = 4; +static const int atoi_error = 0; +static const int atoi_en_main = 1; +int cs; +int blen; +char buffer[1024]; + +void init() +{ + value = 0; + neg = 0; + + { + cs = ( int ) atoi_start; + } +} + +void exec( char *data, int len ) +{ + char *p = data; + char *pe = data + len; + + { + if ( p == pe ) + goto _test_eof; + + if ( cs == 0 ) + goto _out; + + _resume: + switch ( cs ) { + case 1: + switch ( ((*( p )) + ) ) { + case 43: + { + goto ctr0; + } + case 45: + { + goto ctr2; + } + + } + if ( 48 <= ((*( p )) + )&& ((*( p )) + )<= 57 ) + { + goto ctr3; + } + + { + goto ctr1; + } + case 0: + goto _out; + case 2: + if ( 48 <= ((*( p )) + )&& ((*( p )) + )<= 57 ) + { + goto ctr4; + } + + { + goto ctr1; + } + case 3: + if ( ((*( p )) + )== 10 ) + { + goto ctr5; + } + + if ( 48 <= ((*( p )) + )&& ((*( p )) + )<= 57 ) + { + goto ctr4; + } + + { + goto ctr1; + } + case 4: + { + goto ctr1; + } + + } + ctr1: cs = 0; + goto _again; + ctr0: cs = 2; + goto f0; + ctr2: cs = 2; + goto f1; + ctr3: cs = 3; + goto f2; + ctr4: cs = 3; + goto f3; + ctr5: cs = 4; + goto f4; + + f0: + { + neg = 0; + value = 0; + + } + + goto _again; + f3: + { + value = value * 10 + ( int ) ( (((*( p )) + )) - 48 ) + ; + + } + + goto _again; + f1: + { + neg = 0; + value = 0; + + } + { + neg = 1; + + } + + goto _again; + f2: + { + neg = 0; + value = 0; + + } + { + value = value * 10 + ( int ) ( (((*( p )) + )) - 48 ) + ; + + } + + goto _again; + f4: + { + if ( neg != 0 ) + { + value = -1 * value; + + } + + } + { + printf( "%d", value ); + printf( "%s", "\n" ); + + } + + goto _again; + + _again: + if ( cs == 0 ) + goto _out; + + p+= 1; + if ( p != pe ) + goto _resume; + + _test_eof: {} + _out: {} + } +} + +void finish( ) +{ + if ( cs >= atoi_first_final ) + printf( "ACCEPT\n" ); + else + printf( "FAIL\n" ); +} + +char *inp[] = { + "1\n", + "12\n", + "222222\n", + "+2123\n", + "213 3213\n", + "-12321\n", + "--123\n", + "-99\n", + " -3000\n", +}; + +int inplen = 9; + +int main( ) +{ + int i; + for ( i = 0; i < inplen; i++ ) { + init(); + exec( inp[i], strlen(inp[i]) ); + finish(); + } + return 0; +} + |