diff options
Diffstat (limited to 'test/rlhc.d/case/import1.c-C-T0--goto-backend.in')
-rw-r--r-- | test/rlhc.d/case/import1.c-C-T0--goto-backend.in | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/test/rlhc.d/case/import1.c-C-T0--goto-backend.in b/test/rlhc.d/case/import1.c-C-T0--goto-backend.in new file mode 100644 index 00000000..8a11e842 --- /dev/null +++ b/test/rlhc.d/case/import1.c-C-T0--goto-backend.in @@ -0,0 +1,241 @@ +host( "working/import1.rl", 1 ) @{/* + * @@LANG: c + */ + + #include <stdio.h> + + char *foo = "foo"; + + char b = 98; + char a = 97; + char r = 114; + + #define SP 32 + #define NL '\n' + + + +}@ +array s8 _tmp_actions( 0, 1 ) = { 0, 1, 0, 1, 1, 0 }; + +array s8 _tmp_key_offsets( 0, 12 ) = { 0, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 0 }; + +array char _tmp_trans_keys( 0, 114 ) = { 97, 114, 32, 98, 102, 97, 114, 10, 111, 111, 111, 111, 98, 102, 0 }; + +array s8 _tmp_single_lengths( 0, 2 ) = { 0, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 0 }; + +array s8 _tmp_range_lengths( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _tmp_index_offsets( 0, 23 ) = { 0, 0, 2, 4, 6, 9, 11, 13, 15, 17, 19, 21, 23, 0 }; + +array s8 _tmp_trans_cond_spaces( -1, 0 ) = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 }; + +array s8 _tmp_trans_offsets( 0, 25 ) = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0 }; + +array s8 _tmp_trans_lengths( 0, 1 ) = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }; + +array s8 _tmp_cond_keys( 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 _tmp_cond_targs( 0, 12 ) = { 2, 0, 3, 0, 4, 0, 5, 8, 0, 6, 0, 7, 0, 12, 0, 9, 0, 7, 0, 11, 0, 3, 0, 1, 10, 0, 0 }; + +array s8 _tmp_cond_actions( 0, 3 ) = { 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0 }; + +array s8 _tmp_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _tmp_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _tmp_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _tmp_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +value int tmp_start = 12; +value int tmp_first_final = 12; +value int tmp_error = 0; + +value int tmp_en_main = 12; + +host( "working/import1.rl", 28 ) @{ + + int cs; + + void exec_str( char *p, int len ) + { + char *pe = p + len; + }@ + { + int _klen; + uint _trans = 0; + uint _cond = 0; + index s8 _acts; + uint _nacts; + index char _keys; + index s8 _ckeys; + int _cpc; + entry { + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; + label _resume { + _keys = offset( _tmp_trans_keys, _tmp_key_offsets[cs] ); + _trans = cast(uint)_tmp_index_offsets[cs]; + + _klen = cast(int)_tmp_single_lengths[cs]; + if ( _klen > 0 ) { + index char _lower; + index char _mid; + index char _upper; + _lower = _keys; + _upper = _keys + _klen - 1; + while ( TRUE ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( ( deref( data, p )) < deref( _tmp_trans_keys, _mid ) ) + _upper = _mid - 1; + else if ( ( deref( data, p )) > deref( _tmp_trans_keys, _mid ) ) + _lower = _mid + 1; + else { + _trans += cast(uint)(_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += cast(uint)_klen; + } + + _klen = cast(int)_tmp_range_lengths[cs]; + if ( _klen > 0 ) { + index char _lower; + index char _mid; + index char _upper; + _lower = _keys; + _upper = _keys + (_klen<<1) - 2; + while ( TRUE ) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( ( deref( data, p )) < deref( _tmp_trans_keys, _mid ) ) + _upper = _mid - 2; + else if ( ( deref( data, p )) > deref( _tmp_trans_keys, _mid + 1 ) ) + _lower = _mid + 2; + else { + _trans += cast(uint)((_mid - _keys)>>1); + goto _match; + } + } + _trans += cast(uint)_klen; + } + + } + label _match { + _ckeys = offset( _tmp_cond_keys, _tmp_trans_offsets[_trans] ); + _klen = cast(int)_tmp_trans_lengths[_trans]; + _cond = cast(uint)_tmp_trans_offsets[_trans]; + + _cpc = 0; + { + index s8 _lower; + index s8 _mid; + index s8 _upper; + _lower = _ckeys; + _upper = _ckeys + _klen - 1; + while ( TRUE ) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < cast(int)deref( _tmp_cond_keys, _mid ) ) + _upper = _mid - 1; + else if ( _cpc > cast(int)deref( _tmp_cond_keys, _mid ) ) + _lower = _mid + 1; + else { + _cond += cast(uint)(_mid - _ckeys); + goto _match_cond; + } + } + cs = 0; + goto _again; + } + } + label _match_cond { + cs = cast(int)_tmp_cond_targs[_cond]; + + if ( _tmp_cond_actions[_cond] == 0 ) + goto _again; + + _acts = offset( _tmp_actions, _tmp_cond_actions[_cond] ); + _nacts = cast(uint)deref( _tmp_actions, _acts ); + _acts += 1; + while ( _nacts > 0 ) + { + switch ( deref( _tmp_actions, _acts ) ) + { + case 0 { + host( "working/import1.rl", 21 ) ${printf("foo\n"); }$ + } + case 1 { + host( "working/import1.rl", 22 ) ${printf("bar\n");}$ + } + } + _nacts -= 1; + _acts += 1; + } + + + } + label _again { + if ( cs == 0 ) + goto _out; + p += 1; + if ( p != pe ) + goto _resume; + } + label _test_eof { {} + } + label _out { {} + } + } + } + host( "working/import1.rl", 35 ) @{ + } + + void exec_c( char c ) + { + exec_str( &c, 1 ); + } + + int main() + { + }@ + { + cs = cast(int)tmp_start; + } + host( "working/import1.rl", 45 ) @{ + + exec_str( foo, 3 ); + exec_c( SP ); + exec_c( b ); + exec_c( a ); + exec_c( r ); + exec_c( NL ); + + exec_c( b ); + exec_c( a ); + exec_c( r ); + exec_c( SP ); + exec_str( foo, 3 ); + exec_c( NL ); + + if ( cs < tmp_first_final ) + printf("FAIL\n"); + else + printf("ACCEPT\n"); + + return 0; + } + +}@
\ No newline at end of file |