8 # Get the machine 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 using the C language translations.
12 sed -n '/\/\*/,/\*\//d;p' $file | txl -q stdin langtrans_c.txl > $file.pr
14 needs_eof=`sed '/@NEEDS_EOF/s/^.*$/yes/p;d' $file`
15 if [ "$needs_eof" != 'yes' ]; then
16 needs_eof=`sed -n '/\/\*/,/\*\//d;p' $file | txl -q stdin checkeofact.txl`
19 # Begin writing out the test case.
29 # Write the data declarations
30 sed -n '/^%%$/q;p' $file.pr
32 # Write out the machine specification.
33 sed -n '/^%%{$/,/^}%%/p' $file.pr
35 # Write out the init and execute routines.
43 sed -n '0,/^%%$/d; /^%%{$/q; {s/^/\t/;p}' $file.pr
49 void exec( char *data, int len )
52 char *pe = data + len;
55 [ "$needs_eof" = "yes" ] && echo "char *eof = pe;"
63 if ( cs >= ${machine}_first_final )
64 printf( "ACCEPT\\n" );
70 # Write out the test data.
71 sed -n '0,/\/\* _____INPUT_____/d; /_____INPUT_____ \*\//q; p;' $file | awk '
73 print "char *inp[] = {"
81 print "int inplen = " NR ";"
84 # Write out the main routine.
90 for ( i = 0; i < inplen; i++ ) {
92 exec( inp[i], strlen(inp[i]) );
97 #ifdef _____OUTPUT_____
100 # Write out the expected output.
101 sed -n '0,/\/\* _____OUTPUT_____/d; /_____OUTPUT_____ \*\//q; p;' $file
104 # Don't need this language-specific file anymore.