8 # Get the amchine name.
9 machine=`sed -n 's/^[\t ]*machine[\t ]*\([a-zA-Z_0-9]*\)[\t ]*;[\t ]*$/\1/p' $file`
11 # Make a temporary version of the test case the C language translations.
12 sed -n '/\/\*/,/\*\//d;p' $file | txl -q stdin langtrans_c.txl > $file.pr
14 # Begin writing out the test case.
24 # Write the data declarations
25 sed -n '/^%%$/q;p' $file.pr
27 # Write out the machine specification.
28 sed -n '/^%%{$/,/^}%%/p' $file.pr
30 # Write out the init and execute routines.
38 sed -n '1,/^%%$/d; /^%%{$/q; {s/^/\t/;p}' $file.pr
44 void exec( char *data, int len )
47 char *pe = data + len;
54 if ( cs >= ${machine}_first_final )
55 printf( "ACCEPT\\n" );
61 # Write out the test data.
62 sed -n '1,/\/\* _____INPUT_____/d; /_____INPUT_____ \*\//q; p;' $file | awk '
64 print "char *inp[] = {"
72 print "int inplen = " NR ";"
75 # Write out the main routine.
81 for ( i = 0; i < inplen; i++ ) {
83 exec( inp[i], strlen(inp[i]) );
88 #ifdef _____OUTPUT_____
91 # Write out the expected output.
92 sed -n '1,/\/\* _____OUTPUT_____/d; /_____OUTPUT_____ \*\//q; p;' $file
95 # Don't need this language-specific file anymore.