3 * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1
4 * @ALLOW_MINFLAGS: -n -m -l
6 * Test works with split code gen.
19 "/lib/ld-linux.so.2\n" |
20 "libstdc++-libc6.2-2.so.3\n" |
22 "__cp_push_exception\n" |
24 "endl__FR7ostream\n" |
29 "__ls__7ostreamPFR7ostream_R7ostream\n" |
34 "__ls__7ostreamPCc\n" |
35 "__deregister_frame_info\n" |
39 "__8ofstreamiPCcii\n" |
40 "__builtin_vec_new\n" |
43 "__builtin_vec_delete\n" |
44 "_GLOBAL_OFFSET_TABLE_\n" |
48 "__builtin_delete\n" |
51 "__register_frame_info\n" |
76 "__errno_location\n" |
81 "__libc_start_main\n" |
167 "usage: ragel [options] file\n" |
169 " -h, -H, -? Disply this usage.\n" |
170 " -o <file> Write output to <file>.\n" |
171 " -s Print stats on the compiled fsm.\n" |
172 " -f Dump the final fsm.\n" |
173 "fsm minimization:\n" |
174 " -n No minimization (default).\n" |
175 " -m Find the minimal fsm accepting the language.\n" |
176 "generated code language:\n" |
177 " -c Generate c code (default).\n" |
178 " -C Generate c++ code.\n" |
179 "generated code style:\n" |
180 " -T0 Generate a table driven fsm (default).\n" |
181 " -T1 Generate a faster table driven fsm.\n" |
182 " -S0 Generate a switch driven fsm.\n" |
183 " -G0 Generate a goto driven fsm.\n" |
184 " -G1 Generate a faster goto driven fsm.\n" |
185 " -G2 Generate a really fast goto driven fsm.\n" |
186 "char * FileNameFromStem(char *, char *)\n" |
190 "ragel: main graph not defined\n" |
192 "graph transitions: \n" |
193 "machine states: \n" |
194 "machine functions: \n" |
195 "function array: \n" |
196 "T:S:G:Cco:senmabjkfhH?-:\n" |
197 "ragel: zero length output file name given\n" |
198 "ragel: output file already given\n" |
199 "ragel: invalid param specified (try -h for a list of options)\n" |
201 "ragel: zero length input file name given\n" |
202 "ragel: input file already given\n" |
203 "ragel: warning: -e given but minimization is not enabled\n" |
204 "ragel: no input file (try -h for a list of options)\n" |
206 "ragel: could not open \n" |
208 "ragel: error opening \n" |
209 " * Parts of this file are copied from Ragel source covered by the GNU\n" |
210 " * GPL. As a special exception, you may use the parts of this file copied\n" |
211 " * from Ragel source without restriction. The remainder is derived from\n" |
213 "%s:%i: unterminated literal\n" |
214 "%s:%i: unterminated comment\n" |
215 "%s:%i: bad character in literal\n" |
216 "fatal flex scanner internal error--no action found\n" |
217 "fatal flex scanner internal error--end of buffer missed\n" |
218 "fatal error - scanner input buffer overflow\n" |
219 "input in flex scanner failed\n" |
220 "out of dynamic memory in yy_create_buffer()\n" |
221 "out of dynamic memory in yy_scan_buffer()\n" |
222 "out of dynamic memory in yy_scan_bytes()\n" |
223 "bad buffer in yy_scan_bytes()\n" |
225 "%s:%i: warning: range gives null fsm\n" |
226 "%s:%i: warning: literal used in range is not of length 1, using 0x%x\n" |
227 "%s:%i: warning: overflow in byte constant\n" |
229 "parser stack overflow\n" |
245 "struct Fsm * FactorWithAugNode::Walk()\n" |
253 "void FsmGraph<State,int,Trans>::AttachStates(State *, State *, Trans *, FsmKeyType, int)\n" |
254 "rlfsm/fsmattach.cpp\n" |
255 "trans->toState == __null\n" |
256 "trans->fromState == __null\n" |
257 "void FsmGraph<State,int,Trans>::DetachStates(State *, State *, Trans *, FsmKeyType, int)\n" |
258 "trans->toState == to\n" |
259 "trans->fromState == from\n" |
260 "inTel != __null\n" |
261 "void Vector<BstMapEl<int,int>,ResizeExpn>::setAs(const Vector<BstMapEl<int,int>,ResizeExpn> &)\n" |
262 "aapl/vectcommon.h\n" |
264 "void FsmGraph<State,int,Trans>::ChangeRangeLowerKey(Trans *, int, int)\n" |
265 "inRangeEl != __null\n" |
266 "void FsmGraph<State,int,Trans>::IsolateStartState()\n" |
267 "rlfsm/fsmgraph.cpp\n" |
268 "md.stateDict.nodeCount == 0\n" |
269 "md.stfil.listLength == 0\n" |
270 "struct State * FsmGraph<State,int,Trans>::DetachState(State *)\n" |
271 "fromTel != __null\n" |
272 "struct Trans * FsmGraph<State,int,Trans>::AttachStates(State *, State *, FsmKeyType, int, int)\n" |
273 "outTel != __null\n" |
274 "outTel1 != __null\n" |
275 "from->defOutTrans == __null\n" |
276 "void FsmGraph<State,int,Trans>::VerifyOutFuncs()\n" |
277 "state->outTransFuncTable.tableLength == 0\n" |
278 "!state->isOutPriorSet\n" |
279 "state->outPriority == 0\n" |
280 "void FsmGraph<State,int,Trans>::VerifyIntegrity()\n" |
281 "rlfsm/fsmbase.cpp\n" |
282 "outIt.trans->fromState == state\n" |
283 "inIt.trans->toState == state\n" |
284 "static int FsmTrans<State,Trans,int,CmpOrd<int> >::ComparePartPtr(FsmTrans<State,Trans,int,CmpOrd<int> > *, FsmTrans<State,Trans,int,CmpOrd<int> > *)\n" |
285 "rlfsm/fsmstate.cpp\n" |
287 "void FsmGraph<State,int,Trans>::InTransMove(State *, State *)\n" |
289 "static bool FsmTrans<State,Trans,int,CmpOrd<int> >::ShouldMarkPtr(MarkIndex<State> &, FsmTrans<State,Trans,int,CmpOrd<int> > *, FsmTrans<State,Trans,int,CmpOrd<int> > *)\n" |
299 "/* Forward dec state for the transition structure. */\n" |
302 "/* A single transition. */\n" |
306 "StateStruct *toState;\n" |
308 "typedef struct \n" |
311 "/* A single state. */\n" |
315 " int highIndex;\n" |
316 " void *transIndex;\n" |
317 " unsigned int dflIndex;\n" |
318 " int *outFuncs;\n" |
319 " int isFinState;\n" |
320 "typedef struct \n" |
323 "/* Only non-static data: current state. */\n" |
326 "State *curState;\n" |
328 "typedef struct \n" |
330 "/* Init the fsm. */\n" |
334 "/* Execute some chunk of data. */\n" |
337 " *fsm, char *data, int dlen );\n" |
338 "/* Indicate to the fsm tha there is no more data. */\n" |
342 "/* Did the machine accept? */\n" |
350 "/* The array of functions. */\n" |
355 "/* The array of indicies into the transition array. */\n" |
360 "/* The aray of states. */\n" |
364 "/* The array of transitions. */\n" |
368 "/* The start state. */\n" |
371 "_startState = s+\n" |
376 "* Execute functions pointed to by funcs until the null function is found. \n" |
377 "inline static void \n" |
379 " *fsm, int *funcs, char *p )\n" |
380 " int len = *funcs++;\n" |
381 " while ( len-- > 0 ) {\n" |
382 " switch ( *funcs++ ) {\n" |
383 " * Init the fsm to a runnable state.\n" |
386 " fsm->curState = \n" |
388 " fsm->accept = 0;\n" |
389 " * Did the fsm accept? \n" |
392 " return fsm->accept;\n" |
393 " * Execute the fsm on some chunk of data. \n" |
395 " *fsm, char *data, int dlen )\n" |
396 " char *p = data;\n" |
397 " int len = dlen;\n" |
398 "State *cs = fsm->curState;\n" |
399 " for ( ; len > 0; p++, len-- ) {\n" |
400 " int c = (unsigned char) *p;\n" |
402 " if ( cs == 0 )\n" |
403 " goto finished;\n" |
404 " /* If the character is within the index bounds then get the\n" |
405 " * transition for it. If it is out of the transition bounds\n" |
406 " * we will use the default transition. */\n" |
407 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
408 " /* Use the index to look into the transition array. */\n" |
412 "*)cs->transIndex)[c - cs->lowIndex];\n" |
414 " /* Use the default index as the char is out of range. */\n" |
416 "_t + cs->dflIndex;\n" |
417 " /* If there are functions for this transition then execute them. */\n" |
418 " if ( trans->funcs != 0 )\n" |
419 "ExecFuncs( fsm, trans->funcs, p );\n" |
420 " /* Move to the new state. */\n" |
421 " cs = trans->toState;\n" |
423 " fsm->curState = cs;\n" |
424 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
427 "State *cs = fsm->curState;\n" |
428 " if ( cs != 0 && cs->isFinState ) {\n" |
429 " /* If finishing in a final state then execute the\n" |
430 " * out functions for it. (if any). */\n" |
431 " if ( cs->outFuncs != 0 )\n" |
432 "ExecFuncs( fsm, cs->outFuncs, 0 );\n" |
433 " fsm->accept = 1;\n" |
435 " /* If we are not in a final state then this\n" |
436 " * is an error. Move to the error state. */\n" |
437 " fsm->curState = 0;\n" |
440 " /* Forward dec state for the transition structure. */\n" |
442 " /* A single transition. */\n" |
444 " State *toState;\n" |
446 " /* A single state. */\n" |
449 " int highIndex;\n" |
450 " void *transIndex;\n" |
451 " unsigned int dflIndex;\n" |
452 " int *outFuncs;\n" |
453 " int isFinState;\n" |
454 " /* Constructor. */\n" |
456 " /* Execute some chunk of data. */\n" |
457 " void Execute( char *data, int dlen );\n" |
458 " /* Indicate to the fsm tha there is no more data. */\n" |
459 " void Finish( );\n" |
460 " /* Did the machine accept? */\n" |
461 " int Accept( );\n" |
462 " State *curState;\n" |
464 " inline void ExecFuncs( int *funcs, char *p );\n" |
465 "/* The array of functions. */\n" |
468 "/* The array of trainsitions. */\n" |
471 "/* The start state. */\n" |
474 " * Execute functions pointed to by funcs until the null function is found. \n" |
476 "::ExecFuncs( int *funcs, char *p )\n" |
477 " int len = *funcs++;\n" |
478 " while ( len-- > 0 ) {\n" |
479 " switch ( *funcs++ ) {\n" |
489 " return accept;\n" |
490 "::Execute( char *data, int dlen )\n" |
491 " char *p = data;\n" |
492 " int len = dlen;\n" |
493 " State *cs = curState;\n" |
494 " for ( ; len > 0; p++, len-- ) {\n" |
495 " int c = (unsigned char)*p;\n" |
497 " if ( cs == 0 )\n" |
498 " goto finished;\n" |
499 " /* If the character is within the index bounds then get the\n" |
500 " * transition for it. If it is out of the transition bounds\n" |
501 " * we will use the default transition. */\n" |
502 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
503 " /* Use the index to look into the transition array. */\n" |
505 "_t + cs->dflIndex;\n" |
506 " /* If there are functions for this transition then execute them. */\n" |
507 " if ( trans->funcs != 0 )\n" |
508 " ExecFuncs( trans->funcs, p );\n" |
509 " /* Move to the new state. */\n" |
510 " cs = trans->toState;\n" |
512 " curState = cs;\n" |
514 " State *cs = curState;\n" |
515 " if ( cs != 0 && cs->isFinState ) {\n" |
516 " /* If finishing in a final state then execute the\n" |
517 " * out functions for it. (if any). */\n" |
518 " if ( cs->outFuncs != 0 )\n" |
519 " ExecFuncs( cs->outFuncs, 0 );\n" |
522 " /* If we are not in a final state then this\n" |
523 " * is an error. Move to the error state. */\n" |
532 "/* Forward dec state for the transition structure. */\n" |
535 "/* A single transition. */\n" |
539 "StateStruct *toState;\n" |
541 "typedef struct \n" |
544 "/* A single state. */\n" |
548 " int highIndex;\n" |
549 " void *transIndex;\n" |
552 " int isFinState;\n" |
553 "typedef struct \n" |
556 "/* Only non-static data: current state. */\n" |
559 "State *curState;\n" |
561 "typedef struct \n" |
563 "/* Init the fsm. */\n" |
567 "/* Execute some chunk of data. */\n" |
570 " *fsm, char *data, int dlen );\n" |
571 "/* Indicate to the fsm tha there is no more data. */\n" |
575 "/* Did the machine accept? */\n" |
582 "/* The array of indicies into the transition array. */\n" |
587 "/* The aray of states. */\n" |
591 "/* The array of trainsitions. */\n" |
595 "/* The start state. */\n" |
598 "_startState = s+\n" |
603 "/***************************************************************************\n" |
604 " * Execute functions pointed to by funcs until the null function is found. \n" |
605 "inline static void \n" |
607 " *fsm, int funcs, char *p )\n" |
608 " switch ( funcs ) {\n" |
609 "/****************************************\n" |
613 " fsm->curState = \n" |
615 " fsm->accept = 0;\n" |
616 "/****************************************\n" |
618 " * Did the fsm accept? \n" |
621 " return fsm->accept;\n" |
622 "/**********************************************************************\n" |
623 " * Execute the fsm on some chunk of data. \n" |
625 " *fsm, char *data, int dlen )\n" |
626 " char *p = data;\n" |
627 " int len = dlen;\n" |
628 "State *cs = fsm->curState;\n" |
629 " for ( ; len > 0; p++, len-- ) {\n" |
630 " int c = (unsigned char)*p;\n" |
632 " if ( cs == 0 )\n" |
633 " goto finished;\n" |
634 " /* If the character is within the index bounds then get the\n" |
635 " * transition for it. If it is out of the transition bounds\n" |
636 " * we will use the default transition. */\n" |
637 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
638 " /* Use the index to look into the transition array. */\n" |
642 "*)cs->transIndex)[c - cs->lowIndex];\n" |
644 " /* Use the default index as the char is out of range. */\n" |
646 "_t + cs->dflIndex;\n" |
647 " /* If there are functions for this transition then execute them. */\n" |
648 " if ( trans->funcs >= 0 )\n" |
649 "ExecFuncs( fsm, trans->funcs, p );\n" |
650 " /* Move to the new state. */\n" |
651 " cs = trans->toState;\n" |
653 " fsm->curState = cs;\n" |
654 "/**********************************************************************\n" |
656 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
659 "State *cs = fsm->curState;\n" |
660 " if ( cs != 0 && cs->isFinState ) {\n" |
661 " /* If finishing in a final state then execute the\n" |
662 " * out functions for it. (if any). */\n" |
663 " if ( cs->outFuncs != 0 )\n" |
664 "ExecFuncs( fsm, cs->outFuncs, 0 );\n" |
665 " fsm->accept = 1;\n" |
667 " /* If we are not in a final state then this\n" |
668 " * is an error. Move to the error state. */\n" |
669 " fsm->curState = 0;\n" |
672 " /* Function and index type. */\n" |
673 " typedef int Func;\n" |
674 " /* Forward dec state for the transition structure. */\n" |
676 " /* A single transition. */\n" |
678 " State *toState;\n" |
680 " /* A single state. */\n" |
683 " int highIndex;\n" |
684 " void *transIndex;\n" |
687 " int isFinState;\n" |
688 " /* Constructor. */\n" |
690 " /* Execute some chunk of data. */\n" |
691 " void Execute( char *data, int dlen );\n" |
692 " /* Indicate to the fsm tha there is no more data. */\n" |
693 " void Finish( );\n" |
694 " /* Did the machine accept? */\n" |
695 " int Accept( );\n" |
696 " State *curState;\n" |
698 " inline void ExecFuncs( int funcs, char *p );\n" |
702 "/***************************************************************************\n" |
703 " * Execute functions pointed to by funcs until the null function is found. \n" |
705 "::ExecFuncs( int funcs, char *p )\n" |
706 " switch ( funcs ) {\n" |
707 "/****************************************\n" |
710 "/****************************************\n" |
715 "/****************************************\n" |
716 " * Did the fsm accept? \n" |
719 " return accept;\n" |
720 "/**********************************************************************\n" |
721 " * Execute the fsm on some chunk of data. \n" |
723 "::Execute( char *data, int dlen )\n" |
724 " char *p = data;\n" |
725 " int len = dlen;\n" |
726 " State *cs = curState;\n" |
727 " for ( ; len > 0; p++, len-- ) {\n" |
728 " int c = (unsigned char)*p;\n" |
730 " if ( cs == 0 )\n" |
731 " goto finished;\n" |
732 " /* If the character is within the index bounds then get the\n" |
733 " * transition for it. If it is out of the transition bounds\n" |
734 " * we will use the default transition. */\n" |
735 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
736 " /* Use the index to look into the transition array. */\n" |
738 "_t + cs->dflIndex;\n" |
739 " /* If there are functions for this transition then execute them. */\n" |
740 " if ( trans->funcs != 0 )\n" |
741 " ExecFuncs( trans->funcs, p );\n" |
742 " /* Move to the new state. */\n" |
743 " cs = trans->toState;\n" |
745 " curState = cs;\n" |
746 "/**********************************************************************\n" |
747 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
750 " State *cs = curState;\n" |
751 " if ( cs != 0 && cs->isFinState ) {\n" |
752 " /* If finishing in a final state then execute the\n" |
753 " * out functions for it. (if any). */\n" |
754 " if ( cs->outFuncs != 0 )\n" |
755 " ExecFuncs( cs->outFuncs, 0 );\n" |
758 " /* If we are not in a final state then this\n" |
759 " * is an error. Move to the error state. */\n" |
763 "13CCFTabCodeGen\n" |
768 " switch( cs ) {\n" |
770 " switch ( c ) {\n" |
775 " switch( cs ) {\n" |
777 "/* Only non-static data: current state. */\n" |
782 "typedef struct \n" |
784 "/* Init the fsm. */\n" |
788 "/* Execute some chunk of data. */\n" |
791 " *fsm, char *data, int dlen );\n" |
792 "/* Indicate to the fsm tha there is no more data. */\n" |
796 "/* Did the machine accept? */\n" |
800 "/* The start state. */\n" |
803 "/****************************************\n" |
807 " fsm->curState = \n" |
809 " fsm->accept = 0;\n" |
810 "/**********************************************************************\n" |
811 " * Execute the fsm on some chunk of data. \n" |
813 " *fsm, char *data, int dlen )\n" |
814 " char *p = data;\n" |
815 " int len = dlen;\n" |
816 " int cs = fsm->curState;\n" |
817 " for ( ; len > 0; p++, len-- ) {\n" |
818 " unsigned char c = (unsigned char)*p;\n" |
819 " fsm->curState = cs;\n" |
820 "/**********************************************************************\n" |
822 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
825 " int cs = fsm->curState;\n" |
826 " int accept = 0;\n" |
827 " fsm->accept = accept;\n" |
828 "/*******************************************************\n" |
830 " * Did the machine accept?\n" |
833 " return fsm->accept;\n" |
834 "/* Only non-static data: current state. */\n" |
837 " /* Init the fsm. */\n" |
839 " /* Execute some chunk of data. */\n" |
840 " void Execute( char *data, int dlen );\n" |
841 " /* Indicate to the fsm tha there is no more data. */\n" |
842 " void Finish( );\n" |
843 " /* Did the machine accept? */\n" |
844 " int Accept( );\n" |
847 " /* The start state. */\n" |
848 " static int startState;\n" |
849 "/* The start state. */\n" |
851 "::startState = \n" |
853 "/****************************************\n" |
857 " curState = startState;\n" |
859 "::Execute( char *data, int dlen )\n" |
860 " char *p = data;\n" |
861 " int len = dlen;\n" |
862 " int cs = curState;\n" |
863 " for ( ; len > 0; p++, len-- ) {\n" |
864 " unsigned char c = (unsigned char)*p;\n" |
865 " curState = cs;\n" |
866 "/**********************************************************************\n" |
868 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
871 " int cs = curState;\n" |
872 " int accept = 0;\n" |
873 " this->accept = accept;\n" |
874 "/*******************************************************\n" |
876 " * Did the machine accept?\n" |
879 " return accept;\n" |
892 " default: return;\n" |
894 " if ( --len == 0 )\n" |
896 " switch( (alph) *++p ) {\n" |
901 " switch( cs ) {\n" |
907 "ExecFuncs( fsm, f+\n" |
909 "/* Only non-static data: current state. */\n" |
914 "typedef struct \n" |
916 "/* Init the fsm. */\n" |
920 "/* Execute some chunk of data. */\n" |
923 " *fsm, char *data, int dlen );\n" |
924 "/* Indicate to the fsm tha there is no more data. */\n" |
928 "/* Did the machine accept? */\n" |
932 "/* The start state. */\n" |
936 "#define alph unsigned char\n" |
937 "/* The array of functions. */\n" |
942 "/****************************************\n" |
946 " fsm->curState = \n" |
948 " fsm->accept = 0;\n" |
949 "/***************************************************************************\n" |
950 " * Function exection. We do not inline this as in tab\n" |
951 " * code gen because if we did, we might as well just expand \n" |
952 " * the function as in the faster goto code generator.\n" |
955 " *fsm, int *funcs, char *p )\n" |
956 " int len = *funcs++;\n" |
957 " while ( len-- > 0 ) {\n" |
958 " switch ( *funcs++ ) {\n" |
959 "/**********************************************************************\n" |
960 " * Execute the fsm on some chunk of data. \n" |
962 " *fsm, char *data, int dlen )\n" |
963 " /* Prime these to one back to simulate entering the \n" |
964 " * machine on a transition. */ \n" |
965 " register char *p = data - 1;\n" |
966 " register int len = dlen + 1;\n" |
967 " /* Switch statment to enter the machine. */\n" |
970 "/**********************************************************************\n" |
971 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
974 " int cs = fsm->curState;\n" |
975 " int accept = 0;\n" |
976 " fsm->accept = accept;\n" |
977 "/*******************************************************\n" |
978 " * Did the machine accept?\n" |
981 " return fsm->accept;\n" |
985 "/* Only non-static data: current state. */\n" |
988 " /* Init the fsm. */\n" |
990 " /* Execute some chunk of data. */\n" |
991 " void Execute( char *data, int dlen );\n" |
992 " /* Indicate to the fsm tha there is no more data. */\n" |
993 " void Finish( );\n" |
994 " /* Did the machine accept? */\n" |
995 " int Accept( );\n" |
998 " /* The start state. */\n" |
999 " static int startState;\n" |
1000 " /* Function exection. We do not inline this as in tab code gen\n" |
1001 " * because if we did, we might as well just expand the function \n" |
1002 " * as in the faster goto code generator. */\n" |
1003 " void ExecFuncs( int *funcs, char * );\n" |
1004 "/* The start state. */\n" |
1006 "::startState = \n" |
1007 "/* some defines to lessen the code size. */\n" |
1010 "/****************************************\n" |
1011 " * Make sure the fsm is initted.\n" |
1013 "/****************************************\n" |
1014 " * Initialize the fsm.\n" |
1017 " curState = startState;\n" |
1019 "/***************************************************************************\n" |
1020 " * Execute functions pointed to by funcs until the null function is found. \n" |
1022 "::ExecFuncs( int *funcs, char *p )\n" |
1023 " int len = *funcs++;\n" |
1024 " while ( len-- > 0 ) {\n" |
1025 " switch ( *funcs++ ) {\n" |
1026 "/**********************************************************************\n" |
1027 " * Execute the fsm on some chunk of data. \n" |
1029 "::Execute( char *data, int dlen )\n" |
1030 " /* Prime these to one back to simulate entering the \n" |
1031 " * machine on a transition. */ \n" |
1032 " register char *p = data - 1;\n" |
1033 " register int len = dlen + 1;\n" |
1034 " /* Switch statment to enter the machine. */\n" |
1035 " switch ( curState ) {\n" |
1036 "/**********************************************************************\n" |
1038 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1041 " int cs = curState;\n" |
1042 " int accept = 0;\n" |
1043 " this->accept = accept;\n" |
1044 "/*******************************************************\n" |
1046 " * Did the machine accept?\n" |
1049 " return accept;\n" |
1053 "12CGotoCodeGen\n" |
1054 "13CCGotoCodeGen\n" |
1060 "ExecFuncs( fsm, \n" |
1062 "/* Only non-static data: current state. */\n" |
1065 " int curState;\n" |
1067 "typedef struct \n" |
1069 "/* Init the fsm. */\n" |
1073 "/* Execute some chunk of data. */\n" |
1076 " *fsm, char *data, int dlen );\n" |
1077 "/* Indicate to the fsm tha there is no more data. */\n" |
1081 "/* Did the machine accept? */\n" |
1085 "/* The start state. */\n" |
1087 "_startState = \n" |
1088 "/****************************************\n" |
1092 " fsm->curState = \n" |
1094 " fsm->accept = 0;\n" |
1095 "/***************************************************************************\n" |
1096 " * Function exection. We do not inline this as in tab\n" |
1097 " * code gen because if we did, we might as well just expand \n" |
1098 " * the function as in the faster goto code generator.\n" |
1101 " *fsm, int func, char *p )\n" |
1102 " switch ( func ) {\n" |
1103 "#define alph unsigned char\n" |
1104 "/**********************************************************************\n" |
1105 " * Execute the fsm on some chunk of data. \n" |
1107 " *fsm, char *data, int dlen )\n" |
1108 " /* Prime these to one back to simulate entering the \n" |
1109 " * machine on a transition. */ \n" |
1110 " register char *p = data-1;\n" |
1111 " register int len = dlen+1;\n" |
1112 " /* Switch statment to enter the machine. */\n" |
1115 "/**********************************************************************\n" |
1117 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1120 " int cs = fsm->curState;\n" |
1121 " int accept = 0;\n" |
1122 " fsm->accept = accept;\n" |
1123 "/*******************************************************\n" |
1125 " * Did the machine accept?\n" |
1128 " return fsm->accept;\n" |
1131 "/* Only non-static data: current state. */\n" |
1134 " /* Init the fsm. */\n" |
1135 " void Init( );\n" |
1136 " /* Execute some chunk of data. */\n" |
1137 " void Execute( char *data, int dlen );\n" |
1138 " /* Indicate to the fsm tha there is no more data. */\n" |
1139 " void Finish( );\n" |
1140 " /* Did the machine accept? */\n" |
1141 " int Accept( );\n" |
1142 " int curState;\n" |
1144 " /* The start state. */\n" |
1145 " static int startState;\n" |
1146 " /* Function exection. We do not inline this as in tab code gen\n" |
1147 " * because if we did, we might as well just expand the function \n" |
1148 " * as in the faster goto code generator. */\n" |
1149 " void ExecFuncs( int func, char *p );\n" |
1150 "/* The start state. */\n" |
1152 "::startState = \n" |
1154 "/****************************************\n" |
1158 " curState = startState;\n" |
1160 "/***************************************************************************\n" |
1161 " * Execute functions pointed to by funcs until the null function is found. \n" |
1163 "::ExecFuncs( int func, char *p )\n" |
1164 " switch ( func ) {\n" |
1165 "::Execute( char *data, int dlen )\n" |
1166 " /* Prime these to one back to simulate entering the \n" |
1167 " * machine on a transition. */ \n" |
1168 " register char *p = data-1;\n" |
1169 " register int len = dlen+1;\n" |
1170 " /* Switch statment to enter the machine. */\n" |
1171 " switch ( curState ) {\n" |
1173 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1176 " int cs = curState;\n" |
1177 " int accept = 0;\n" |
1178 " this->accept = accept;\n" |
1179 "/*******************************************************\n" |
1181 " * Did the machine accept?\n" |
1184 " return accept;\n" |
1186 "12FGotoCodeGen\n" |
1187 "13CFGotoCodeGen\n" |
1188 "14CCFGotoCodeGen\n" |
1193 "/* Only non-static data: current state. */\n" |
1196 " int curState;\n" |
1198 "typedef struct \n" |
1200 "/* Init the fsm. */\n" |
1204 "/* Execute some chunk of data. */\n" |
1207 " *fsm, char *data, int dlen );\n" |
1208 "/* Indicate to the fsm tha there is no more data. */\n" |
1212 "/* Did the machine accept? */\n" |
1216 "/* The start state. */\n" |
1218 "_startState = \n" |
1219 "/****************************************\n" |
1223 " fsm->curState = \n" |
1225 " fsm->accept = 0;\n" |
1226 "#define alph unsigned char\n" |
1227 "/**********************************************************************\n" |
1228 " * Execute the fsm on some chunk of data. \n" |
1230 " *fsm, char *data, int dlen )\n" |
1231 " /* Prime these to one back to simulate entering the \n" |
1232 " * machine on a transition. */ \n" |
1233 " register char *p = data-1;\n" |
1234 " register int len = dlen+1;\n" |
1235 " /* Switch statment to enter the machine. */\n" |
1238 "/**********************************************************************\n" |
1240 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1243 " int cs = fsm->curState;\n" |
1244 " int accept = 0;\n" |
1245 " fsm->accept = accept;\n" |
1246 "/*******************************************************\n" |
1248 " * Did the machine accept?\n" |
1251 " return fsm->accept;\n" |
1253 "/* Only non-static data: current state. */\n" |
1256 " /* Init the fsm. */\n" |
1257 " void Init( );\n" |
1258 " /* Execute some chunk of data. */\n" |
1259 " void Execute( char *data, int dlen );\n" |
1260 " /* Indicate to the fsm tha there is no more data. */\n" |
1261 " void Finish( );\n" |
1262 " /* Did the machine accept? */\n" |
1263 " int Accept( );\n" |
1264 " int curState;\n" |
1266 " /* The start state. */\n" |
1267 " static int startState;\n" |
1268 "/* The start state. */\n" |
1270 "::startState = \n" |
1272 "/****************************************\n" |
1276 " curState = startState;\n" |
1278 "#define alph unsigned char\n" |
1279 "/**********************************************************************\n" |
1280 " * Execute the fsm on some chunk of data. \n" |
1282 "::Execute( char *data, int dlen )\n" |
1283 " /* Prime these to one back to simulate entering the \n" |
1284 " * machine on a transition. */ \n" |
1285 " register char *p = data-1;\n" |
1286 " register int len = dlen+1;\n" |
1287 " /* Switch statment to enter the machine. */\n" |
1288 " switch ( curState ) {\n" |
1290 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1293 " int cs = curState;\n" |
1294 " int accept = 0;\n" |
1295 " this->accept = accept;\n" |
1296 "/*******************************************************\n" |
1298 " * Did the machine accept?\n" |
1301 " return accept;\n" |
1303 "13IpGotoCodeGen\n" |
1304 "14CIpGotoCodeGen\n" |
1305 "15CCIpGotoCodeGen\n" |
1311 struct strs the_fsm;
1313 void test( char *buf )
1315 struct strs *fsm = &the_fsm;
1317 char *pe = buf + strlen( buf );
1322 if ( fsm->cs >= strs_first_final )
1332 test( "bad_alloc\n" );
1333 test( "_GLOBAL_OFFSET_TABLE_\n" );
1343 #ifdef _____OUTPUT_____