3 * @ALLOW_GENFLAGS: -T0 -T1 -F0 -F1 -P
4 * @ALLOW_MINFLAGS: -n -m -l
14 variable curstate fsm->cs;
17 "/lib/ld-linux.so.2\n" |
18 "libstdc++-libc6.2-2.so.3\n" |
20 "__cp_push_exception\n" |
22 "endl__FR7ostream\n" |
27 "__ls__7ostreamPFR7ostream_R7ostream\n" |
32 "__ls__7ostreamPCc\n" |
33 "__deregister_frame_info\n" |
37 "__8ofstreamiPCcii\n" |
38 "__builtin_vec_new\n" |
41 "__builtin_vec_delete\n" |
42 "_GLOBAL_OFFSET_TABLE_\n" |
46 "__builtin_delete\n" |
49 "__register_frame_info\n" |
74 "__errno_location\n" |
79 "__libc_start_main\n" |
165 "usage: ragel [options] file\n" |
167 " -h, -H, -? Disply this usage.\n" |
168 " -o <file> Write output to <file>.\n" |
169 " -s Print stats on the compiled fsm.\n" |
170 " -f Dump the final fsm.\n" |
171 "fsm minimization:\n" |
172 " -n No minimization (default).\n" |
173 " -m Find the minimal fsm accepting the language.\n" |
174 "generated code language:\n" |
175 " -c Generate c code (default).\n" |
176 " -C Generate c++ code.\n" |
177 "generated code style:\n" |
178 " -T0 Generate a table driven fsm (default).\n" |
179 " -T1 Generate a faster table driven fsm.\n" |
180 " -S0 Generate a switch driven fsm.\n" |
181 " -G0 Generate a goto driven fsm.\n" |
182 " -G1 Generate a faster goto driven fsm.\n" |
183 " -G2 Generate a really fast goto driven fsm.\n" |
184 "char * FileNameFromStem(char *, char *)\n" |
188 "ragel: main graph not defined\n" |
190 "graph transitions: \n" |
191 "machine states: \n" |
192 "machine functions: \n" |
193 "function array: \n" |
194 "T:S:G:Cco:senmabjkfhH?-:\n" |
195 "ragel: zero length output file name given\n" |
196 "ragel: output file already given\n" |
197 "ragel: invalid param specified (try -h for a list of options)\n" |
199 "ragel: zero length input file name given\n" |
200 "ragel: input file already given\n" |
201 "ragel: warning: -e given but minimization is not enabled\n" |
202 "ragel: no input file (try -h for a list of options)\n" |
204 "ragel: could not open \n" |
206 "ragel: error opening \n" |
207 " * Parts of this file are copied from Ragel source covered by the GNU\n" |
208 " * GPL. As a special exception, you may use the parts of this file copied\n" |
209 " * from Ragel source without restriction. The remainder is derived from\n" |
211 "%s:%i: unterminated literal\n" |
212 "%s:%i: unterminated comment\n" |
213 "%s:%i: bad character in literal\n" |
214 "fatal flex scanner internal error--no action found\n" |
215 "fatal flex scanner internal error--end of buffer missed\n" |
216 "fatal error - scanner input buffer overflow\n" |
217 "input in flex scanner failed\n" |
218 "out of dynamic memory in yy_create_buffer()\n" |
219 "out of dynamic memory in yy_scan_buffer()\n" |
220 "out of dynamic memory in yy_scan_bytes()\n" |
221 "bad buffer in yy_scan_bytes()\n" |
223 "%s:%i: warning: range gives null fsm\n" |
224 "%s:%i: warning: literal used in range is not of length 1, using 0x%x\n" |
225 "%s:%i: warning: overflow in byte constant\n" |
227 "parser stack overflow\n" |
243 "struct Fsm * FactorWithAugNode::Walk()\n" |
251 "void FsmGraph<State,int,Trans>::AttachStates(State *, State *, Trans *, FsmKeyType, int)\n" |
252 "rlfsm/fsmattach.cpp\n" |
253 "trans->toState == __null\n" |
254 "trans->fromState == __null\n" |
255 "void FsmGraph<State,int,Trans>::DetachStates(State *, State *, Trans *, FsmKeyType, int)\n" |
256 "trans->toState == to\n" |
257 "trans->fromState == from\n" |
258 "inTel != __null\n" |
259 "void Vector<BstMapEl<int,int>,ResizeExpn>::setAs(const Vector<BstMapEl<int,int>,ResizeExpn> &)\n" |
260 "aapl/vectcommon.h\n" |
262 "void FsmGraph<State,int,Trans>::ChangeRangeLowerKey(Trans *, int, int)\n" |
263 "inRangeEl != __null\n" |
264 "void FsmGraph<State,int,Trans>::IsolateStartState()\n" |
265 "rlfsm/fsmgraph.cpp\n" |
266 "md.stateDict.nodeCount == 0\n" |
267 "md.stfil.listLength == 0\n" |
268 "struct State * FsmGraph<State,int,Trans>::DetachState(State *)\n" |
269 "fromTel != __null\n" |
270 "struct Trans * FsmGraph<State,int,Trans>::AttachStates(State *, State *, FsmKeyType, int, int)\n" |
271 "outTel != __null\n" |
272 "outTel1 != __null\n" |
273 "from->defOutTrans == __null\n" |
274 "void FsmGraph<State,int,Trans>::VerifyOutFuncs()\n" |
275 "state->outTransFuncTable.tableLength == 0\n" |
276 "!state->isOutPriorSet\n" |
277 "state->outPriority == 0\n" |
278 "void FsmGraph<State,int,Trans>::VerifyIntegrity()\n" |
279 "rlfsm/fsmbase.cpp\n" |
280 "outIt.trans->fromState == state\n" |
281 "inIt.trans->toState == state\n" |
282 "static int FsmTrans<State,Trans,int,CmpOrd<int> >::ComparePartPtr(FsmTrans<State,Trans,int,CmpOrd<int> > *, FsmTrans<State,Trans,int,CmpOrd<int> > *)\n" |
283 "rlfsm/fsmstate.cpp\n" |
285 "void FsmGraph<State,int,Trans>::InTransMove(State *, State *)\n" |
287 "static bool FsmTrans<State,Trans,int,CmpOrd<int> >::ShouldMarkPtr(MarkIndex<State> &, FsmTrans<State,Trans,int,CmpOrd<int> > *, FsmTrans<State,Trans,int,CmpOrd<int> > *)\n" |
297 "/* Forward dec state for the transition structure. */\n" |
300 "/* A single transition. */\n" |
304 "StateStruct *toState;\n" |
306 "typedef struct \n" |
309 "/* A single state. */\n" |
313 " int highIndex;\n" |
314 " void *transIndex;\n" |
315 " unsigned int dflIndex;\n" |
316 " int *outFuncs;\n" |
317 " int isFinState;\n" |
318 "typedef struct \n" |
321 "/* Only non-static data: current state. */\n" |
324 "State *curState;\n" |
326 "typedef struct \n" |
328 "/* Init the fsm. */\n" |
332 "/* Execute some chunk of data. */\n" |
335 " *fsm, char *data, int dlen );\n" |
336 "/* Indicate to the fsm tha there is no more data. */\n" |
340 "/* Did the machine accept? */\n" |
348 "/* The array of functions. */\n" |
353 "/* The array of indicies into the transition array. */\n" |
358 "/* The aray of states. */\n" |
362 "/* The array of transitions. */\n" |
366 "/* The start state. */\n" |
369 "_startState = s+\n" |
374 "* Execute functions pointed to by funcs until the null function is found. \n" |
375 "inline static void \n" |
377 " *fsm, int *funcs, char *p )\n" |
378 " int len = *funcs++;\n" |
379 " while ( len-- > 0 ) {\n" |
380 " switch ( *funcs++ ) {\n" |
381 " * Init the fsm to a runnable state.\n" |
384 " fsm->curState = \n" |
386 " fsm->accept = 0;\n" |
387 " * Did the fsm accept? \n" |
390 " return fsm->accept;\n" |
391 " * Execute the fsm on some chunk of data. \n" |
393 " *fsm, char *data, int dlen )\n" |
394 " char *p = data;\n" |
395 " int len = dlen;\n" |
396 "State *cs = fsm->curState;\n" |
397 " for ( ; len > 0; p++, len-- ) {\n" |
398 " int c = (unsigned char) *p;\n" |
400 " if ( cs == 0 )\n" |
401 " goto finished;\n" |
402 " /* If the character is within the index bounds then get the\n" |
403 " * transition for it. If it is out of the transition bounds\n" |
404 " * we will use the default transition. */\n" |
405 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
406 " /* Use the index to look into the transition array. */\n" |
410 "*)cs->transIndex)[c - cs->lowIndex];\n" |
412 " /* Use the default index as the char is out of range. */\n" |
414 "_t + cs->dflIndex;\n" |
415 " /* If there are functions for this transition then execute them. */\n" |
416 " if ( trans->funcs != 0 )\n" |
417 "ExecFuncs( fsm, trans->funcs, p );\n" |
418 " /* Move to the new state. */\n" |
419 " cs = trans->toState;\n" |
421 " fsm->curState = cs;\n" |
422 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
425 "State *cs = fsm->curState;\n" |
426 " if ( cs != 0 && cs->isFinState ) {\n" |
427 " /* If finishing in a final state then execute the\n" |
428 " * out functions for it. (if any). */\n" |
429 " if ( cs->outFuncs != 0 )\n" |
430 "ExecFuncs( fsm, cs->outFuncs, 0 );\n" |
431 " fsm->accept = 1;\n" |
433 " /* If we are not in a final state then this\n" |
434 " * is an error. Move to the error state. */\n" |
435 " fsm->curState = 0;\n" |
438 " /* Forward dec state for the transition structure. */\n" |
440 " /* A single transition. */\n" |
442 " State *toState;\n" |
444 " /* A single state. */\n" |
447 " int highIndex;\n" |
448 " void *transIndex;\n" |
449 " unsigned int dflIndex;\n" |
450 " int *outFuncs;\n" |
451 " int isFinState;\n" |
452 " /* Constructor. */\n" |
454 " /* Execute some chunk of data. */\n" |
455 " void Execute( char *data, int dlen );\n" |
456 " /* Indicate to the fsm tha there is no more data. */\n" |
457 " void Finish( );\n" |
458 " /* Did the machine accept? */\n" |
459 " int Accept( );\n" |
460 " State *curState;\n" |
462 " inline void ExecFuncs( int *funcs, char *p );\n" |
463 "/* The array of functions. */\n" |
466 "/* The array of trainsitions. */\n" |
469 "/* The start state. */\n" |
472 " * Execute functions pointed to by funcs until the null function is found. \n" |
474 "::ExecFuncs( int *funcs, char *p )\n" |
475 " int len = *funcs++;\n" |
476 " while ( len-- > 0 ) {\n" |
477 " switch ( *funcs++ ) {\n" |
487 " return accept;\n" |
488 "::Execute( char *data, int dlen )\n" |
489 " char *p = data;\n" |
490 " int len = dlen;\n" |
491 " State *cs = curState;\n" |
492 " for ( ; len > 0; p++, len-- ) {\n" |
493 " int c = (unsigned char)*p;\n" |
495 " if ( cs == 0 )\n" |
496 " goto finished;\n" |
497 " /* If the character is within the index bounds then get the\n" |
498 " * transition for it. If it is out of the transition bounds\n" |
499 " * we will use the default transition. */\n" |
500 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
501 " /* Use the index to look into the transition array. */\n" |
503 "_t + cs->dflIndex;\n" |
504 " /* If there are functions for this transition then execute them. */\n" |
505 " if ( trans->funcs != 0 )\n" |
506 " ExecFuncs( trans->funcs, p );\n" |
507 " /* Move to the new state. */\n" |
508 " cs = trans->toState;\n" |
510 " curState = cs;\n" |
512 " State *cs = curState;\n" |
513 " if ( cs != 0 && cs->isFinState ) {\n" |
514 " /* If finishing in a final state then execute the\n" |
515 " * out functions for it. (if any). */\n" |
516 " if ( cs->outFuncs != 0 )\n" |
517 " ExecFuncs( cs->outFuncs, 0 );\n" |
520 " /* If we are not in a final state then this\n" |
521 " * is an error. Move to the error state. */\n" |
530 "/* Forward dec state for the transition structure. */\n" |
533 "/* A single transition. */\n" |
537 "StateStruct *toState;\n" |
539 "typedef struct \n" |
542 "/* A single state. */\n" |
546 " int highIndex;\n" |
547 " void *transIndex;\n" |
550 " int isFinState;\n" |
551 "typedef struct \n" |
554 "/* Only non-static data: current state. */\n" |
557 "State *curState;\n" |
559 "typedef struct \n" |
561 "/* Init the fsm. */\n" |
565 "/* Execute some chunk of data. */\n" |
568 " *fsm, char *data, int dlen );\n" |
569 "/* Indicate to the fsm tha there is no more data. */\n" |
573 "/* Did the machine accept? */\n" |
580 "/* The array of indicies into the transition array. */\n" |
585 "/* The aray of states. */\n" |
589 "/* The array of trainsitions. */\n" |
593 "/* The start state. */\n" |
596 "_startState = s+\n" |
601 "/***************************************************************************\n" |
602 " * Execute functions pointed to by funcs until the null function is found. \n" |
603 "inline static void \n" |
605 " *fsm, int funcs, char *p )\n" |
606 " switch ( funcs ) {\n" |
607 "/****************************************\n" |
611 " fsm->curState = \n" |
613 " fsm->accept = 0;\n" |
614 "/****************************************\n" |
616 " * Did the fsm accept? \n" |
619 " return fsm->accept;\n" |
620 "/**********************************************************************\n" |
621 " * Execute the fsm on some chunk of data. \n" |
623 " *fsm, char *data, int dlen )\n" |
624 " char *p = data;\n" |
625 " int len = dlen;\n" |
626 "State *cs = fsm->curState;\n" |
627 " for ( ; len > 0; p++, len-- ) {\n" |
628 " int c = (unsigned char)*p;\n" |
630 " if ( cs == 0 )\n" |
631 " goto finished;\n" |
632 " /* If the character is within the index bounds then get the\n" |
633 " * transition for it. If it is out of the transition bounds\n" |
634 " * we will use the default transition. */\n" |
635 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
636 " /* Use the index to look into the transition array. */\n" |
640 "*)cs->transIndex)[c - cs->lowIndex];\n" |
642 " /* Use the default index as the char is out of range. */\n" |
644 "_t + cs->dflIndex;\n" |
645 " /* If there are functions for this transition then execute them. */\n" |
646 " if ( trans->funcs >= 0 )\n" |
647 "ExecFuncs( fsm, trans->funcs, p );\n" |
648 " /* Move to the new state. */\n" |
649 " cs = trans->toState;\n" |
651 " fsm->curState = cs;\n" |
652 "/**********************************************************************\n" |
654 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
657 "State *cs = fsm->curState;\n" |
658 " if ( cs != 0 && cs->isFinState ) {\n" |
659 " /* If finishing in a final state then execute the\n" |
660 " * out functions for it. (if any). */\n" |
661 " if ( cs->outFuncs != 0 )\n" |
662 "ExecFuncs( fsm, cs->outFuncs, 0 );\n" |
663 " fsm->accept = 1;\n" |
665 " /* If we are not in a final state then this\n" |
666 " * is an error. Move to the error state. */\n" |
667 " fsm->curState = 0;\n" |
670 " /* Function and index type. */\n" |
671 " typedef int Func;\n" |
672 " /* Forward dec state for the transition structure. */\n" |
674 " /* A single transition. */\n" |
676 " State *toState;\n" |
678 " /* A single state. */\n" |
681 " int highIndex;\n" |
682 " void *transIndex;\n" |
685 " int isFinState;\n" |
686 " /* Constructor. */\n" |
688 " /* Execute some chunk of data. */\n" |
689 " void Execute( char *data, int dlen );\n" |
690 " /* Indicate to the fsm tha there is no more data. */\n" |
691 " void Finish( );\n" |
692 " /* Did the machine accept? */\n" |
693 " int Accept( );\n" |
694 " State *curState;\n" |
696 " inline void ExecFuncs( int funcs, char *p );\n" |
700 "/***************************************************************************\n" |
701 " * Execute functions pointed to by funcs until the null function is found. \n" |
703 "::ExecFuncs( int funcs, char *p )\n" |
704 " switch ( funcs ) {\n" |
705 "/****************************************\n" |
708 "/****************************************\n" |
713 "/****************************************\n" |
714 " * Did the fsm accept? \n" |
717 " return accept;\n" |
718 "/**********************************************************************\n" |
719 " * Execute the fsm on some chunk of data. \n" |
721 "::Execute( char *data, int dlen )\n" |
722 " char *p = data;\n" |
723 " int len = dlen;\n" |
724 " State *cs = curState;\n" |
725 " for ( ; len > 0; p++, len-- ) {\n" |
726 " int c = (unsigned char)*p;\n" |
728 " if ( cs == 0 )\n" |
729 " goto finished;\n" |
730 " /* If the character is within the index bounds then get the\n" |
731 " * transition for it. If it is out of the transition bounds\n" |
732 " * we will use the default transition. */\n" |
733 " if ( cs->lowIndex <= c && c < cs->highIndex ) {\n" |
734 " /* Use the index to look into the transition array. */\n" |
736 "_t + cs->dflIndex;\n" |
737 " /* If there are functions for this transition then execute them. */\n" |
738 " if ( trans->funcs != 0 )\n" |
739 " ExecFuncs( trans->funcs, p );\n" |
740 " /* Move to the new state. */\n" |
741 " cs = trans->toState;\n" |
743 " curState = cs;\n" |
744 "/**********************************************************************\n" |
745 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
748 " State *cs = curState;\n" |
749 " if ( cs != 0 && cs->isFinState ) {\n" |
750 " /* If finishing in a final state then execute the\n" |
751 " * out functions for it. (if any). */\n" |
752 " if ( cs->outFuncs != 0 )\n" |
753 " ExecFuncs( cs->outFuncs, 0 );\n" |
756 " /* If we are not in a final state then this\n" |
757 " * is an error. Move to the error state. */\n" |
761 "13CCFTabCodeGen\n" |
766 " switch( cs ) {\n" |
768 " switch ( c ) {\n" |
773 " switch( cs ) {\n" |
775 "/* Only non-static data: current state. */\n" |
780 "typedef struct \n" |
782 "/* Init the fsm. */\n" |
786 "/* Execute some chunk of data. */\n" |
789 " *fsm, char *data, int dlen );\n" |
790 "/* Indicate to the fsm tha there is no more data. */\n" |
794 "/* Did the machine accept? */\n" |
798 "/* The start state. */\n" |
801 "/****************************************\n" |
805 " fsm->curState = \n" |
807 " fsm->accept = 0;\n" |
808 "/**********************************************************************\n" |
809 " * Execute the fsm on some chunk of data. \n" |
811 " *fsm, char *data, int dlen )\n" |
812 " char *p = data;\n" |
813 " int len = dlen;\n" |
814 " int cs = fsm->curState;\n" |
815 " for ( ; len > 0; p++, len-- ) {\n" |
816 " unsigned char c = (unsigned char)*p;\n" |
817 " fsm->curState = cs;\n" |
818 "/**********************************************************************\n" |
820 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
823 " int cs = fsm->curState;\n" |
824 " int accept = 0;\n" |
825 " fsm->accept = accept;\n" |
826 "/*******************************************************\n" |
828 " * Did the machine accept?\n" |
831 " return fsm->accept;\n" |
832 "/* Only non-static data: current state. */\n" |
835 " /* Init the fsm. */\n" |
837 " /* Execute some chunk of data. */\n" |
838 " void Execute( char *data, int dlen );\n" |
839 " /* Indicate to the fsm tha there is no more data. */\n" |
840 " void Finish( );\n" |
841 " /* Did the machine accept? */\n" |
842 " int Accept( );\n" |
845 " /* The start state. */\n" |
846 " static int startState;\n" |
847 "/* The start state. */\n" |
849 "::startState = \n" |
851 "/****************************************\n" |
855 " curState = startState;\n" |
857 "::Execute( char *data, int dlen )\n" |
858 " char *p = data;\n" |
859 " int len = dlen;\n" |
860 " int cs = curState;\n" |
861 " for ( ; len > 0; p++, len-- ) {\n" |
862 " unsigned char c = (unsigned char)*p;\n" |
863 " curState = cs;\n" |
864 "/**********************************************************************\n" |
866 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
869 " int cs = curState;\n" |
870 " int accept = 0;\n" |
871 " this->accept = accept;\n" |
872 "/*******************************************************\n" |
874 " * Did the machine accept?\n" |
877 " return accept;\n" |
890 " default: return;\n" |
892 " if ( --len == 0 )\n" |
894 " switch( (alph) *++p ) {\n" |
899 " switch( cs ) {\n" |
905 "ExecFuncs( fsm, f+\n" |
907 "/* Only non-static data: current state. */\n" |
912 "typedef struct \n" |
914 "/* Init the fsm. */\n" |
918 "/* Execute some chunk of data. */\n" |
921 " *fsm, char *data, int dlen );\n" |
922 "/* Indicate to the fsm tha there is no more data. */\n" |
926 "/* Did the machine accept? */\n" |
930 "/* The start state. */\n" |
934 "#define alph unsigned char\n" |
935 "/* The array of functions. */\n" |
940 "/****************************************\n" |
944 " fsm->curState = \n" |
946 " fsm->accept = 0;\n" |
947 "/***************************************************************************\n" |
948 " * Function exection. We do not inline this as in tab\n" |
949 " * code gen because if we did, we might as well just expand \n" |
950 " * the function as in the faster goto code generator.\n" |
953 " *fsm, int *funcs, char *p )\n" |
954 " int len = *funcs++;\n" |
955 " while ( len-- > 0 ) {\n" |
956 " switch ( *funcs++ ) {\n" |
957 "/**********************************************************************\n" |
958 " * Execute the fsm on some chunk of data. \n" |
960 " *fsm, char *data, int dlen )\n" |
961 " /* Prime these to one back to simulate entering the \n" |
962 " * machine on a transition. */ \n" |
963 " register char *p = data - 1;\n" |
964 " register int len = dlen + 1;\n" |
965 " /* Switch statment to enter the machine. */\n" |
968 "/**********************************************************************\n" |
969 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
972 " int cs = fsm->curState;\n" |
973 " int accept = 0;\n" |
974 " fsm->accept = accept;\n" |
975 "/*******************************************************\n" |
976 " * Did the machine accept?\n" |
979 " return fsm->accept;\n" |
983 "/* Only non-static data: current state. */\n" |
986 " /* Init the fsm. */\n" |
988 " /* Execute some chunk of data. */\n" |
989 " void Execute( char *data, int dlen );\n" |
990 " /* Indicate to the fsm tha there is no more data. */\n" |
991 " void Finish( );\n" |
992 " /* Did the machine accept? */\n" |
993 " int Accept( );\n" |
996 " /* The start state. */\n" |
997 " static int startState;\n" |
998 " /* Function exection. We do not inline this as in tab code gen\n" |
999 " * because if we did, we might as well just expand the function \n" |
1000 " * as in the faster goto code generator. */\n" |
1001 " void ExecFuncs( int *funcs, char * );\n" |
1002 "/* The start state. */\n" |
1004 "::startState = \n" |
1005 "/* some defines to lessen the code size. */\n" |
1008 "/****************************************\n" |
1009 " * Make sure the fsm is initted.\n" |
1011 "/****************************************\n" |
1012 " * Initialize the fsm.\n" |
1015 " curState = startState;\n" |
1017 "/***************************************************************************\n" |
1018 " * Execute functions pointed to by funcs until the null function is found. \n" |
1020 "::ExecFuncs( int *funcs, char *p )\n" |
1021 " int len = *funcs++;\n" |
1022 " while ( len-- > 0 ) {\n" |
1023 " switch ( *funcs++ ) {\n" |
1024 "/**********************************************************************\n" |
1025 " * Execute the fsm on some chunk of data. \n" |
1027 "::Execute( char *data, int dlen )\n" |
1028 " /* Prime these to one back to simulate entering the \n" |
1029 " * machine on a transition. */ \n" |
1030 " register char *p = data - 1;\n" |
1031 " register int len = dlen + 1;\n" |
1032 " /* Switch statment to enter the machine. */\n" |
1033 " switch ( curState ) {\n" |
1034 "/**********************************************************************\n" |
1036 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1039 " int cs = curState;\n" |
1040 " int accept = 0;\n" |
1041 " this->accept = accept;\n" |
1042 "/*******************************************************\n" |
1044 " * Did the machine accept?\n" |
1047 " return accept;\n" |
1051 "12CGotoCodeGen\n" |
1052 "13CCGotoCodeGen\n" |
1058 "ExecFuncs( fsm, \n" |
1060 "/* Only non-static data: current state. */\n" |
1063 " int curState;\n" |
1065 "typedef struct \n" |
1067 "/* Init the fsm. */\n" |
1071 "/* Execute some chunk of data. */\n" |
1074 " *fsm, char *data, int dlen );\n" |
1075 "/* Indicate to the fsm tha there is no more data. */\n" |
1079 "/* Did the machine accept? */\n" |
1083 "/* The start state. */\n" |
1085 "_startState = \n" |
1086 "/****************************************\n" |
1090 " fsm->curState = \n" |
1092 " fsm->accept = 0;\n" |
1093 "/***************************************************************************\n" |
1094 " * Function exection. We do not inline this as in tab\n" |
1095 " * code gen because if we did, we might as well just expand \n" |
1096 " * the function as in the faster goto code generator.\n" |
1099 " *fsm, int func, char *p )\n" |
1100 " switch ( func ) {\n" |
1101 "#define alph unsigned char\n" |
1102 "/**********************************************************************\n" |
1103 " * Execute the fsm on some chunk of data. \n" |
1105 " *fsm, char *data, int dlen )\n" |
1106 " /* Prime these to one back to simulate entering the \n" |
1107 " * machine on a transition. */ \n" |
1108 " register char *p = data-1;\n" |
1109 " register int len = dlen+1;\n" |
1110 " /* Switch statment to enter the machine. */\n" |
1113 "/**********************************************************************\n" |
1115 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1118 " int cs = fsm->curState;\n" |
1119 " int accept = 0;\n" |
1120 " fsm->accept = accept;\n" |
1121 "/*******************************************************\n" |
1123 " * Did the machine accept?\n" |
1126 " return fsm->accept;\n" |
1129 "/* Only non-static data: current state. */\n" |
1132 " /* Init the fsm. */\n" |
1133 " void Init( );\n" |
1134 " /* Execute some chunk of data. */\n" |
1135 " void Execute( char *data, int dlen );\n" |
1136 " /* Indicate to the fsm tha there is no more data. */\n" |
1137 " void Finish( );\n" |
1138 " /* Did the machine accept? */\n" |
1139 " int Accept( );\n" |
1140 " int curState;\n" |
1142 " /* The start state. */\n" |
1143 " static int startState;\n" |
1144 " /* Function exection. We do not inline this as in tab code gen\n" |
1145 " * because if we did, we might as well just expand the function \n" |
1146 " * as in the faster goto code generator. */\n" |
1147 " void ExecFuncs( int func, char *p );\n" |
1148 "/* The start state. */\n" |
1150 "::startState = \n" |
1152 "/****************************************\n" |
1156 " curState = startState;\n" |
1158 "/***************************************************************************\n" |
1159 " * Execute functions pointed to by funcs until the null function is found. \n" |
1161 "::ExecFuncs( int func, char *p )\n" |
1162 " switch ( func ) {\n" |
1163 "::Execute( char *data, int dlen )\n" |
1164 " /* Prime these to one back to simulate entering the \n" |
1165 " * machine on a transition. */ \n" |
1166 " register char *p = data-1;\n" |
1167 " register int len = dlen+1;\n" |
1168 " /* Switch statment to enter the machine. */\n" |
1169 " switch ( curState ) {\n" |
1171 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1174 " int cs = curState;\n" |
1175 " int accept = 0;\n" |
1176 " this->accept = accept;\n" |
1177 "/*******************************************************\n" |
1179 " * Did the machine accept?\n" |
1182 " return accept;\n" |
1184 "12FGotoCodeGen\n" |
1185 "13CFGotoCodeGen\n" |
1186 "14CCFGotoCodeGen\n" |
1191 "/* Only non-static data: current state. */\n" |
1194 " int curState;\n" |
1196 "typedef struct \n" |
1198 "/* Init the fsm. */\n" |
1202 "/* Execute some chunk of data. */\n" |
1205 " *fsm, char *data, int dlen );\n" |
1206 "/* Indicate to the fsm tha there is no more data. */\n" |
1210 "/* Did the machine accept? */\n" |
1214 "/* The start state. */\n" |
1216 "_startState = \n" |
1217 "/****************************************\n" |
1221 " fsm->curState = \n" |
1223 " fsm->accept = 0;\n" |
1224 "#define alph unsigned char\n" |
1225 "/**********************************************************************\n" |
1226 " * Execute the fsm on some chunk of data. \n" |
1228 " *fsm, char *data, int dlen )\n" |
1229 " /* Prime these to one back to simulate entering the \n" |
1230 " * machine on a transition. */ \n" |
1231 " register char *p = data-1;\n" |
1232 " register int len = dlen+1;\n" |
1233 " /* Switch statment to enter the machine. */\n" |
1236 "/**********************************************************************\n" |
1238 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1241 " int cs = fsm->curState;\n" |
1242 " int accept = 0;\n" |
1243 " fsm->accept = accept;\n" |
1244 "/*******************************************************\n" |
1246 " * Did the machine accept?\n" |
1249 " return fsm->accept;\n" |
1251 "/* Only non-static data: current state. */\n" |
1254 " /* Init the fsm. */\n" |
1255 " void Init( );\n" |
1256 " /* Execute some chunk of data. */\n" |
1257 " void Execute( char *data, int dlen );\n" |
1258 " /* Indicate to the fsm tha there is no more data. */\n" |
1259 " void Finish( );\n" |
1260 " /* Did the machine accept? */\n" |
1261 " int Accept( );\n" |
1262 " int curState;\n" |
1264 " /* The start state. */\n" |
1265 " static int startState;\n" |
1266 "/* The start state. */\n" |
1268 "::startState = \n" |
1270 "/****************************************\n" |
1274 " curState = startState;\n" |
1276 "#define alph unsigned char\n" |
1277 "/**********************************************************************\n" |
1278 " * Execute the fsm on some chunk of data. \n" |
1280 "::Execute( char *data, int dlen )\n" |
1281 " /* Prime these to one back to simulate entering the \n" |
1282 " * machine on a transition. */ \n" |
1283 " register char *p = data-1;\n" |
1284 " register int len = dlen+1;\n" |
1285 " /* Switch statment to enter the machine. */\n" |
1286 " switch ( curState ) {\n" |
1288 " * Indicate to the fsm that the input is done. Does cleanup tasks.\n" |
1291 " int cs = curState;\n" |
1292 " int accept = 0;\n" |
1293 " this->accept = accept;\n" |
1294 "/*******************************************************\n" |
1296 " * Did the machine accept?\n" |
1299 " return accept;\n" |
1301 "13IpGotoCodeGen\n" |
1302 "14CIpGotoCodeGen\n" |
1303 "15CCIpGotoCodeGen\n" |
1309 struct strs the_fsm;
1311 void test( char *buf )
1313 struct strs *fsm = &the_fsm;
1315 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_____