diff options
author | Adrian Thurston <thurston@colm.net> | 2019-09-09 10:19:58 -0600 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-09-09 10:19:58 -0600 |
commit | fff52cd5a567ec541cd487b9fee2d89bf9b6f6eb (patch) | |
tree | 046a3f0f457343f7c99bf096863daf023a085051 /test/rlhc.d/case/fnext2.c-C-T0--var-backend.exp | |
parent | 2d8e9c3f5c0417d6237c945c50f92bf8d28b32d5 (diff) | |
download | colm-fff52cd5a567ec541cd487b9fee2d89bf9b6f6eb.tar.gz |
base (aapl, colm, ragel) test cases building
Diffstat (limited to 'test/rlhc.d/case/fnext2.c-C-T0--var-backend.exp')
-rw-r--r-- | test/rlhc.d/case/fnext2.c-C-T0--var-backend.exp | 408 |
1 files changed, 408 insertions, 0 deletions
diff --git a/test/rlhc.d/case/fnext2.c-C-T0--var-backend.exp b/test/rlhc.d/case/fnext2.c-C-T0--var-backend.exp new file mode 100644 index 00000000..77ef7359 --- /dev/null +++ b/test/rlhc.d/case/fnext2.c-C-T0--var-backend.exp @@ -0,0 +1,408 @@ +#include <string.h> +#include <stdio.h> + +char comm; +int top; +int stack [32]; + + + +int cs; +char *ts, *te; +int act; + +static const char _fnext_actions [] = { 0, 1, 0, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 2, 1, 2, 2, 3, 4, 0 , }; +static const char _fnext_key_offsets [] = { 0, 0, 1, 2, 3, 4, 5, 5, 5, 5, 6, 0 , }; +static const char _fnext_trans_keys [] = { 104, 101, 108, 108, 10, 111, 0 , }; +static const char _fnext_single_lengths [] = { 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0 , }; +static const char _fnext_range_lengths [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , }; +static const char _fnext_index_offsets [] = { 0, 0, 2, 4, 6, 8, 10, 11, 12, 13, 15, 0 , }; +static const char _fnext_trans_cond_spaces [] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 , }; +static const char _fnext_trans_offsets [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 , }; +static const char _fnext_trans_lengths [] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 , }; +static const char _fnext_cond_keys [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , }; +static const char _fnext_cond_targs [] = { 6, 0, 7, 0, 4, 0, 8, 0, 10, 0, 0, 0, 0, 9, 0, 0, 0 , }; +static const char _fnext_cond_actions [] = { 1, 0, 13, 0, 3, 0, 16, 0, 5, 0, 0, 0, 0, 11, 0, 0, 0 , }; +static const char _fnext_to_state_actions [] = { 0, 7, 7, 7, 0, 7, 0, 0, 0, 7, 0, 0 , }; +static const char _fnext_from_state_actions [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0 , }; +static const char _fnext_nfa_targs [] = { 0, 0 , }; +static const char _fnext_nfa_offsets [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , }; +static const char _fnext_nfa_push_actions [] = { 0, 0 , }; +static const char _fnext_nfa_pop_trans [] = { 0, 0 , }; +static const int fnext_start = 1; +static const int fnext_first_final = 6; +static const int fnext_error = 0; +static const int fnext_en_main = 1; +static const int fnext_en_e = 2; +static const int fnext_en_l = 3; +static const int fnext_en_o = 9; +static const int fnext_en_nl = 5; +void init() +{ + + { + cs = ( int ) fnext_start; + ts = 0; + te = 0; + } +} + +void exec( char *data, int len ) +{ + char *p = data; + char *pe = data + len; + + while ( cs != fnext_error && p < pe ) { + printf( "%c\n", *p ); + + { + int _klen; + unsigned int _trans = 0; + unsigned int _cond = 0; + unsigned int _have = 0; + unsigned int _cont = 1; + const char *_acts; + unsigned int _nacts; + const char *_keys; + const char *_ckeys; + int _cpc; + while ( _cont == 1 ) + { + + if ( cs == 0 ) + _cont = 0; + + _have = 0; + if ( p == pe ) + { + if ( _have == 0 ) + _cont = 0; + + } + + if ( _cont == 1 ) + { + if ( _have == 0 ) + { + _acts = _fnext_actions + _fnext_from_state_actions[cs]; + _nacts = ( unsigned int ) (*( _acts )) + ; + _acts += 1; + while ( _nacts > 0 ) + { + switch ( (*( _acts )) + ) { + case 7 : + { + { + ts = p; + + } + + } + + break; + + } + _nacts -= 1; + _acts += 1; + } + + + _keys = _fnext_trans_keys + _fnext_key_offsets[cs]; + _trans = ( unsigned int ) _fnext_index_offsets[cs]; + _have = 0; + _klen = ( int ) _fnext_single_lengths[cs]; + if ( _klen > 0 ) + { + const char *_lower; + const char *_mid; + const char *_upper; + _lower = _keys; + _upper = _keys + _klen - 1; + while ( _upper >= _lower && _have == 0 ) + { + _mid = _lower + ((_upper-_lower)>> 1); + if ( ((*( p )) + )< (*( _mid )) + ) + _upper = _mid - 1; + + else if ( ((*( p )) + )> (*( _mid )) + ) + _lower = _mid + 1; + + else + { + _trans += ( unsigned int ) (_mid - _keys); + _have = 1; + } + + } + + if ( _have == 0 ) + { + _keys += _klen; + _trans += ( unsigned int ) _klen; + } + + } + + + if ( _have == 0 ) + { + _klen = ( int ) _fnext_range_lengths[cs]; + if ( _klen > 0 ) + { + const char *_lower; + const char *_mid; + const char *_upper; + _lower = _keys; + _upper = _keys + (_klen<<1)- 2; + while ( _have == 0 && _lower <= _upper ) + { + _mid = _lower + (((_upper-_lower)>> 1)& ~1); + if ( ((*( p )) + )< (*( _mid )) + ) + _upper = _mid - 2; + + else if ( ((*( p )) + )> (*( _mid + 1 )) + ) + _lower = _mid + 2; + + else + { + _trans += ( unsigned int ) ((_mid - _keys)>>1); + _have = 1; + } + + } + + if ( _have == 0 ) + _trans += ( unsigned int ) _klen; + + } + + } + + + _ckeys = _fnext_cond_keys + _fnext_trans_offsets[_trans]; + _klen = ( int ) _fnext_trans_lengths[_trans]; + _cond = ( unsigned int ) _fnext_trans_offsets[_trans]; + _have = 0; + _cpc = 0; + { + const char *_lower; + const char *_mid; + const char *_upper; + _lower = _ckeys; + _upper = _ckeys + _klen - 1; + while ( _have == 0 && _lower <= _upper ) + { + _mid = _lower + ((_upper-_lower)>> 1); + if ( _cpc < ( int ) (*( _mid )) + ) + _upper = _mid - 1; + + else if ( _cpc > ( int ) (*( _mid )) + ) + _lower = _mid + 1; + + else + { + _cond += ( unsigned int ) (_mid - _ckeys); + _have = 1; + } + + } + + if ( _have == 0 ) + { + cs = 0; + _cont = 0; + } + + } + } + + if ( _cont == 1 ) + { + cs = ( int ) _fnext_cond_targs[_cond]; + if ( _fnext_cond_actions[_cond]!= 0 ) + { + _acts = _fnext_actions + _fnext_cond_actions[_cond]; + _nacts = ( unsigned int ) (*( _acts )) + ; + _acts += 1; + while ( _nacts > 0 ) + { + switch ( (*( _acts )) + ) { + case 0 : + { + { + cs = 2; + + } + { + p+= 1; + _cont = 0; + + } + + } + + break; + case 1 : + { + { + cs = 3; + + } + + } + + break; + case 2 : + { + { + p+= 1; + _cont = 0; + + } + + } + + break; + case 3 : + { + { + cs = 9; + + } + + } + + break; + case 4 : + { + { + p+= 1; + _cont = 0; + + } + + } + + break; + case 5 : + { + { + p+= 1; + _cont = 0; + + } + printf("ACCEPT\n"); + } + + break; + case 8 : + { + { + te = p+1; + { + { + cs = 5; + + } + { + p+= 1; + _cont = 0; + + } + + } + + } + + } + + break; + + } + _nacts -= 1; + _acts += 1; + } + + } + + + _acts = _fnext_actions + _fnext_to_state_actions[cs]; + _nacts = ( unsigned int ) (*( _acts )) + ; + _acts += 1; + while ( _nacts > 0 ) + { + switch ( (*( _acts )) + ) { + case 6 : + { + { + ts = 0; + + } + + } + + break; + + } + _nacts -= 1; + _acts += 1; + } + + + if ( cs == 0 ) + _cont = 0; + + if ( _cont == 1 ) + p += 1; + + } + + } + + } + + } + } +} + +void finish( ) +{ + if ( cs >= fnext_first_final ) + printf( "ACCEPT\n" ); + else + printf( "FAIL\n" ); +} + +char *inp[] = { + "hello\n" +}; + +int inplen = 1; + +int main( ) +{ + int i; + for ( i = 0; i < inplen; i++ ) { + init(); + exec( inp[i], strlen(inp[i]) ); + finish(); + } + return 0; +} + |