diff options
Diffstat (limited to 'test/rlhc.d/case/forder3.c-C-G0--goto-backend.in')
-rw-r--r-- | test/rlhc.d/case/forder3.c-C-G0--goto-backend.in | 307 |
1 files changed, 307 insertions, 0 deletions
diff --git a/test/rlhc.d/case/forder3.c-C-G0--goto-backend.in b/test/rlhc.d/case/forder3.c-C-G0--goto-backend.in new file mode 100644 index 00000000..58f33541 --- /dev/null +++ b/test/rlhc.d/case/forder3.c-C-G0--goto-backend.in @@ -0,0 +1,307 @@ +host( "working/forder3.rl", 1 ) @{/* + * @@LANG: c + */ + + #include <stdio.h> + #include <string.h> + + struct forder + { + int cs; + }; + + + +}@ +array s8 _forder_actions( 0, 7 ) = { 0, 1, 4, 1, 7, 2, 1, 6, 2, 2, 3, 2, 4, 7, 3, 5, 6, 7, 5, 0, 1, 2, 3, 6, 0 }; + +array s8 _forder_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _forder_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _forder_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _forder_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +value int forder_start = 1; +value int forder_first_final = 11; +value int forder_error = 0; + +value int forder_en_main = 1; + +host( "working/forder3.rl", 31 ) @{ + + void forder_init( struct forder *fsm ) + { + }@ + { + host( "-", 1 ) ={ fsm->cs}= = cast(int)forder_start; + } + host( "working/forder3.rl", 35 ) @{ + } + + void forder_execute( struct forder *fsm, const char *_data, int _len ) + { + const char *p = _data; + const char *pe = _data+_len; + + }@ + { + index s8 _acts; + uint _nacts; + + if ( p == pe ) + goto _test_eof; + if ( host( "-", 1 ) ={ fsm->cs}= == 0 ) + goto _out; + _resume: + switch ( host( "-", 1 ) ={ fsm->cs}= ) { + case 1: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr0; + } + case 97: { + goto ctr2; + } + case 98: { + goto ctr3; + } + } + { + goto ctr1; + } + case 0: + goto _out; + case 11: + { + goto ctr1; + } + case 2: + if ( ( deref( data, p )) == 97 ) { + goto ctr4; + } + { + goto ctr1; + } + case 3: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr5; + } + case 97: { + goto ctr6; + } + case 98: { + goto ctr7; + } + } + { + goto ctr1; + } + case 4: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 97: { + goto ctr9; + } + case 98: { + goto ctr10; + } + } + { + goto ctr1; + } + case 5: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 97: { + goto ctr9; + } + } + { + goto ctr1; + } + case 6: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 97: { + goto ctr9; + } + case 98: { + goto ctr11; + } + } + { + goto ctr1; + } + case 7: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 97: { + goto ctr9; + } + case 98: { + goto ctr12; + } + } + { + goto ctr1; + } + case 8: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr13; + } + case 97: { + goto ctr14; + } + case 98: { + goto ctr15; + } + } + { + goto ctr1; + } + case 9: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 97: { + goto ctr16; + } + } + { + goto ctr1; + } + case 10: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr13; + } + case 97: { + goto ctr14; + } + } + { + goto ctr1; + } + } + + ctr1: host( "-", 1 ) ={ fsm->cs}= = 0; goto _again; + ctr6: host( "-", 1 ) ={ fsm->cs}= = 2; goto _again; + ctr2: host( "-", 1 ) ={ fsm->cs}= = 2; goto f1; + ctr4: host( "-", 1 ) ={ fsm->cs}= = 3; goto _again; + ctr10: host( "-", 1 ) ={ fsm->cs}= = 4; goto _again; + ctr7: host( "-", 1 ) ={ fsm->cs}= = 4; goto f4; + ctr9: host( "-", 1 ) ={ fsm->cs}= = 5; goto _again; + ctr15: host( "-", 1 ) ={ fsm->cs}= = 6; goto _again; + ctr3: host( "-", 1 ) ={ fsm->cs}= = 6; goto f2; + ctr11: host( "-", 1 ) ={ fsm->cs}= = 7; goto _again; + ctr12: host( "-", 1 ) ={ fsm->cs}= = 8; goto _again; + ctr14: host( "-", 1 ) ={ fsm->cs}= = 9; goto _again; + ctr16: host( "-", 1 ) ={ fsm->cs}= = 10; goto _again; + ctr0: host( "-", 1 ) ={ fsm->cs}= = 11; goto f0; + ctr5: host( "-", 1 ) ={ fsm->cs}= = 11; goto f3; + ctr8: host( "-", 1 ) ={ fsm->cs}= = 11; goto f5; + ctr13: host( "-", 1 ) ={ fsm->cs}= = 11; goto f6; + + f5: _acts = offset( _forder_actions, 1 ); goto execFuncs; + f3: _acts = offset( _forder_actions, 3 ); goto execFuncs; + f1: _acts = offset( _forder_actions, 5 ); goto execFuncs; + f4: _acts = offset( _forder_actions, 8 ); goto execFuncs; + f6: _acts = offset( _forder_actions, 11 ); goto execFuncs; + f0: _acts = offset( _forder_actions, 14 ); goto execFuncs; + f2: _acts = offset( _forder_actions, 18 ); goto execFuncs; + + execFuncs: + _nacts = cast(uint)deref( _forder_actions, _acts ); + _acts += 1; + while ( _nacts > 0 ) { + switch ( deref( _forder_actions, _acts ) ) { + case 0{ + host( "working/forder3.rl", 17 ) ${printf("enter m1 aa\n");}$ + } + case 1{ + host( "working/forder3.rl", 18 ) ${printf("enter m1 aa\n");}$ + } + case 2{ + host( "working/forder3.rl", 18 ) ${printf("leave m1 aa\n");}$ + } + case 3{ + host( "working/forder3.rl", 19 ) ${printf("through m1 b\n");}$ + } + case 4{ + host( "working/forder3.rl", 24 ) ${printf("accept m1\n");}$ + } + case 5{ + host( "working/forder3.rl", 25 ) ${printf("enter m2\n");}$ + } + case 6{ + host( "working/forder3.rl", 26 ) ${printf("enter m2\n");}$ + } + case 7{ + host( "working/forder3.rl", 26 ) ${printf("accept m2\n");}$ + } + } + _acts += 1; + _nacts -= 1; + } + + goto _again; + + _again: + if ( host( "-", 1 ) ={ fsm->cs}= == 0 ) + goto _out; + p += 1; + if ( p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + host( "working/forder3.rl", 43 ) @{ + } + + int forder_finish( struct forder *fsm ) + { + if ( fsm->cs == forder_error ) + return -1; + if ( fsm->cs >= forder_first_final ) + return 1; + return 0; + } + + struct forder fsm; + + void test( char *buf ) + { + int len = strlen( buf ); + forder_init( &fsm ); + forder_execute( &fsm, buf, len ); + if ( forder_finish( &fsm ) > 0 ) + printf("ACCEPT\n"); + else + printf("FAIL\n"); + } + + int main() + { + test( "aaaaaabbbaa\n" ); + test( "\n" ); + test( "bbbbbbaaaaaaa\n" ); + test( "bbbbbbaaaaaa\n" ); + test( "aaaaa\n" ); + + return 0; + } + +}@
\ No newline at end of file |