summaryrefslogtreecommitdiff
path: root/test/rlhc.d/case/forder2.c-C-F0--goto-backend.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/rlhc.d/case/forder2.c-C-F0--goto-backend.exp')
-rw-r--r--test/rlhc.d/case/forder2.c-C-F0--goto-backend.exp203
1 files changed, 203 insertions, 0 deletions
diff --git a/test/rlhc.d/case/forder2.c-C-F0--goto-backend.exp b/test/rlhc.d/case/forder2.c-C-F0--goto-backend.exp
new file mode 100644
index 00000000..4c6f9176
--- /dev/null
+++ b/test/rlhc.d/case/forder2.c-C-F0--goto-backend.exp
@@ -0,0 +1,203 @@
+#include <stdio.h>
+#include <string.h>
+
+/*
+* After the fact start and ending transitions. Behaves like constructors of
+* and destructors in c++.
+*/
+
+struct forder
+{
+ int cs;
+};
+
+
+
+static const char _forder_actions [] = { 0, 2, 1, 4, 2, 2, 5, 4, 3, 0, 1, 4, 0 , };
+static const char _forder_trans_keys [] = { 1, 0, 3, 3, 4, 4, 4, 4, 2, 2, 5, 5, 0, 0, 1, 0, 0 , };
+static const char _forder_char_class [] = { 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, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 4, 1, 1, 1, 5, 0 , };
+static const char _forder_index_offsets [] = { 0, 0, 1, 2, 3, 4, 5, 6, 0 , };
+static const char _forder_indicies [] = { 0, 2, 3, 4, 5, 6, 0 , };
+static const char _forder_index_defaults [] = { 0, 1, 1, 1, 1, 1, 1, 1, 0 , };
+static const char _forder_trans_cond_spaces [] = { -1, -1, -1, -1, -1, -1, -1, 0 , };
+static const char _forder_cond_targs [] = { 2, 0, 3, 4, 5, 6, 7, 0 , };
+static const char _forder_cond_actions [] = { 7, 0, 1, 1, 1, 1, 4, 0 , };
+static const char _forder_nfa_targs [] = { 0, 0 , };
+static const char _forder_nfa_offsets [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 , };
+static const char _forder_nfa_push_actions [] = { 0, 0 , };
+static const char _forder_nfa_pop_trans [] = { 0, 0 , };
+static const int forder_start = 1;
+static const int forder_first_final = 7;
+static const int forder_error = 0;
+static const int forder_en_main = 1;
+void forder_init( struct forder *fsm )
+{
+
+ {
+ (fsm->cs) = ( int ) forder_start;
+ }
+}
+
+void forder_execute( struct forder *fsm, const char *_data, int _len )
+{
+ const char *p = _data;
+ const char *pe = _data+_len;
+
+
+ {
+ int _trans = 0;
+ const char *_acts;
+ unsigned int _nacts;
+ const char *_keys;
+ const char *_inds;
+ if ( p == pe )
+ goto _test_eof;
+
+ if ( (fsm->cs) == 0 )
+ goto _out;
+
+ _resume :
+ _keys = _forder_trans_keys + ((fsm->cs)<<1);
+ _inds = _forder_indicies + _forder_index_offsets[(fsm->cs)];
+ if ( ((*( p ))
+ )<= 114 && ((*( p ))
+ )>= 10 )
+ {
+ int _ic = ( int ) _forder_char_class[( int ) ((*( p ))
+ )- 10];
+ if ( _ic <= ( int ) (*( _keys+1 ))
+ && _ic >= ( int ) (*( _keys ))
+ )
+ _trans = ( int ) (*( _inds + ( int ) (_ic - ( int ) (*( _keys ))
+ ) ))
+ ;
+
+ else
+ _trans = ( int ) _forder_index_defaults[(fsm->cs)];
+
+ }
+
+ else
+ {
+ _trans = ( int ) _forder_index_defaults[(fsm->cs)];
+ }
+
+
+ goto _match_cond;
+
+ _match_cond :
+ (fsm->cs) = ( int ) _forder_cond_targs[_trans];
+ if ( _forder_cond_actions[_trans]== 0 )
+ goto _again;
+
+
+ _acts = _forder_actions + _forder_cond_actions[_trans];
+ _nacts = ( unsigned int ) (*( _acts ))
+ ;
+ _acts += 1;
+ while ( _nacts > 0 )
+ {
+ switch ( (*( _acts ))
+ ) {
+ case 0 :
+ {
+ printf("enter inner\n");
+ }
+
+ break;
+ case 1 :
+ {
+ printf("inside inner\n");
+ }
+
+ break;
+ case 2 :
+ {
+ printf("leave inner\n");
+ }
+
+ break;
+ case 3 :
+ {
+ printf("enter outter\n");
+ }
+
+ break;
+ case 4 :
+ {
+ printf("inside outter\n");
+ }
+
+ break;
+ case 5 :
+ {
+ printf("leave outter\n");
+ }
+
+ break;
+
+ }
+ _nacts -= 1;
+ _acts += 1;
+ }
+
+
+
+
+ _again :
+ if ( (fsm->cs) == 0 )
+ goto _out;
+
+ p += 1;
+ if ( p != pe )
+ goto _resume;
+
+
+ _test_eof :
+ {}
+
+ _out :
+ {}
+
+ }
+}
+
+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( "inner\n");
+
+ test(
+ "inner\n"
+ "foobar\n"
+ );
+
+ test( "" );
+ test( "\n" );
+ test( "inn\n" );
+
+ return 0;
+}
+