diff options
Diffstat (limited to 'test/rlhc.d/case/call1.c-C-G1--goto-backend.in')
-rw-r--r-- | test/rlhc.d/case/call1.c-C-G1--goto-backend.in | 323 |
1 files changed, 323 insertions, 0 deletions
diff --git a/test/rlhc.d/case/call1.c-C-G1--goto-backend.in b/test/rlhc.d/case/call1.c-C-G1--goto-backend.in new file mode 100644 index 00000000..cef6589e --- /dev/null +++ b/test/rlhc.d/case/call1.c-C-G1--goto-backend.in @@ -0,0 +1,323 @@ +host( "working/call1.rl", 1 ) @{/* + * @@LANG: c + * @@PROHIBIT_FEATFLAGS: --var-backend + */ + + #include <stdio.h> + #include <string.h> + + int num = 0; + + struct test + { + int cs, top, stack[32]; + }; + + + +}@ +array s8 _test_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _test_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _test_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _test_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +value int test_start = 1; +value int test_first_final = 23; +value int test_error = 0; + +value int test_en_even = 13; +value int test_en_odd = 18; +value int test_en_fail = 22; +value int test_en_main = 1; + +host( "working/call1.rl", 43 ) @{ + + void test_init( struct test *fsm ) + { + num = 0; + }@ + { + host( "-", 1 ) @{fsm->}@ -> cs = cast(int)test_start; + host( "-", 1 ) @{fsm->}@ -> top = 0; + } + host( "working/call1.rl", 48 ) @{ + } + + void test_execute( struct test *fsm, const char *data, int len ) + { + const char *p = data; + const char *pe = data+len; + + }@ + { + if ( p == pe ) + goto _test_eof; + if ( host( "-", 1 ) @{fsm->}@ -> cs == 0 ) + goto _out; + _resume: + switch ( host( "-", 1 ) @{fsm->}@ -> cs ) { + case 1: + if ( ( deref( data, p )) == 79 ) { + goto ctr2; + } + if ( 48 <= ( deref( data, p )) && ( deref( data, p )) <= 57 ) { + goto ctr0; + } + { + goto ctr1; + } + case 0: + goto _out; + case 2: + if ( ( deref( data, p )) == 32 ) { + goto ctr3; + } + if ( 48 <= ( deref( data, p )) && ( deref( data, p )) <= 57 ) { + goto ctr0; + } + { + goto ctr1; + } + case 3: + if ( ( deref( data, p )) == 10 ) { + goto ctr4; + } + { + goto ctr1; + } + case 23: + { + goto ctr1; + } + case 4: + if ( ( deref( data, p )) == 65 ) { + goto ctr5; + } + { + goto ctr1; + } + case 5: + if ( ( deref( data, p )) == 32 ) { + goto ctr6; + } + { + goto ctr1; + } + case 6: + switch( ( deref( data, p )) ) { + case 101: { + goto ctr7; + } + case 111: { + goto ctr8; + } + } + { + goto ctr1; + } + case 7: + if ( ( deref( data, p )) == 114 ) { + goto ctr9; + } + { + goto ctr1; + } + case 8: + if ( ( deref( data, p )) == 114 ) { + goto ctr10; + } + { + goto ctr1; + } + case 9: + if ( ( deref( data, p )) == 111 ) { + goto ctr11; + } + { + goto ctr1; + } + case 10: + if ( ( deref( data, p )) == 114 ) { + goto ctr12; + } + { + goto ctr1; + } + case 11: + if ( 49 <= ( deref( data, p )) && ( deref( data, p )) <= 50 ) { + goto ctr13; + } + { + goto ctr1; + } + case 12: + if ( ( deref( data, p )) == 107 ) { + goto ctr13; + } + { + goto ctr1; + } + case 13: + if ( ( deref( data, p )) == 101 ) { + goto ctr14; + } + { + goto ctr1; + } + case 14: + if ( ( deref( data, p )) == 118 ) { + goto ctr15; + } + { + goto ctr1; + } + case 15: + if ( ( deref( data, p )) == 101 ) { + goto ctr16; + } + { + goto ctr1; + } + case 16: + if ( ( deref( data, p )) == 110 ) { + goto ctr17; + } + { + goto ctr1; + } + case 17: + { + goto ctr18; + } + case 24: + { + goto ctr1; + } + case 18: + if ( ( deref( data, p )) == 111 ) { + goto ctr19; + } + { + goto ctr1; + } + case 19: + if ( ( deref( data, p )) == 100 ) { + goto ctr20; + } + { + goto ctr1; + } + case 20: + if ( ( deref( data, p )) == 100 ) { + goto ctr21; + } + { + goto ctr1; + } + case 21: + { + goto ctr22; + } + case 25: + { + goto ctr1; + } + case 22: + { + goto ctr1; + } + } + + ctr1: host( "-", 1 ) @{fsm->}@ -> cs = 0; goto _again; + ctr0: host( "-", 1 ) @{fsm->}@ -> cs = 2; goto f0; + ctr13: host( "-", 1 ) @{fsm->}@ -> cs = 3; goto _again; + ctr3: host( "-", 1 ) @{fsm->}@ -> cs = 3; goto f1; + ctr2: host( "-", 1 ) @{fsm->}@ -> cs = 4; goto _again; + ctr5: host( "-", 1 ) @{fsm->}@ -> cs = 5; goto _again; + ctr6: host( "-", 1 ) @{fsm->}@ -> cs = 6; goto _again; + ctr7: host( "-", 1 ) @{fsm->}@ -> cs = 7; goto _again; + ctr9: host( "-", 1 ) @{fsm->}@ -> cs = 8; goto _again; + ctr10: host( "-", 1 ) @{fsm->}@ -> cs = 9; goto _again; + ctr11: host( "-", 1 ) @{fsm->}@ -> cs = 10; goto _again; + ctr12: host( "-", 1 ) @{fsm->}@ -> cs = 11; goto _again; + ctr8: host( "-", 1 ) @{fsm->}@ -> cs = 12; goto _again; + ctr14: host( "-", 1 ) @{fsm->}@ -> cs = 14; goto _again; + ctr15: host( "-", 1 ) @{fsm->}@ -> cs = 15; goto _again; + ctr16: host( "-", 1 ) @{fsm->}@ -> cs = 16; goto _again; + ctr17: host( "-", 1 ) @{fsm->}@ -> cs = 17; goto _again; + ctr19: host( "-", 1 ) @{fsm->}@ -> cs = 19; goto _again; + ctr20: host( "-", 1 ) @{fsm->}@ -> cs = 20; goto _again; + ctr21: host( "-", 1 ) @{fsm->}@ -> cs = 21; goto _again; + ctr4: host( "-", 1 ) @{fsm->}@ -> cs = 23; goto _again; + ctr18: host( "-", 1 ) @{fsm->}@ -> cs = 24; goto f2; + ctr22: host( "-", 1 ) @{fsm->}@ -> cs = 25; goto f3; + + f1: + host( "working/call1.rl", 20 ) ${ + if ( num & 1 ) + ${host( "-", 1 ) @{fsm->}@ -> stack[host( "-", 1 ) @{fsm->}@ -> top] = host( "-", 1 ) @{fsm->}@ -> cs; host( "-", 1 ) @{fsm->}@ -> top += 1;host( "-", 1 ) @{fsm->}@ -> cs = host( "-", 1 ) ={18}=; goto _again;}$ + else + ${host( "-", 1 ) @{fsm->}@ -> stack[host( "-", 1 ) @{fsm->}@ -> top] = host( "-", 1 ) @{fsm->}@ -> cs; host( "-", 1 ) @{fsm->}@ -> top += 1;host( "-", 1 ) @{fsm->}@ -> cs = 13; goto _again;}$}$ + goto _again; + f2: + host( "working/call1.rl", 28 ) ${${p = p - 1; }$ ${host( "-", 1 ) @{fsm->}@ -> top-= 1;host( "-", 1 ) @{fsm->}@ -> cs = host( "-", 1 ) @{fsm->}@ -> stack[host( "-", 1 ) @{fsm->}@ -> top];goto _again;}$}$ + goto _again; + f3: + host( "working/call1.rl", 29 ) ${${p = p - 1; }$ ${host( "-", 1 ) @{fsm->}@ -> top-= 1;host( "-", 1 ) @{fsm->}@ -> cs = host( "-", 1 ) @{fsm->}@ -> stack[host( "-", 1 ) @{fsm->}@ -> top];goto _again;}$}$ + goto _again; + f0: + host( "working/call1.rl", 30 ) ${ num = num * 10 + (={( deref( data, p ))}= - '0'); }$ + goto _again; + + _again: + if ( host( "-", 1 ) @{fsm->}@ -> cs == 0 ) + goto _out; + p+= 1; + if ( p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + host( "working/call1.rl", 56 ) @{ + } + + int test_finish( struct test *fsm ) + { + if ( fsm->cs == test_error ) + return -1; + if ( fsm->cs >= test_first_final ) + return 1; + return 0; + } + + #define BUFSIZE 1024 + + void test( char *buf ) + { + struct test test; + test_init( &test ); + test_execute( &test, buf, strlen(buf) ); + if ( test_finish( &test ) > 0 ) + printf( "ACCEPT\n" ); + else + printf( "FAIL\n" ); + } + + int main() + { + test( "78 even\n" ); + test( "89 odd\n" ); + test( "1 even\n" ); + test( "0 odd\n" ); + test( "OA ok\n" ); + test( "OA error1\n" ); + test( "OA error2\n" ); + + return 0; + } + + +}@
\ No newline at end of file |