void genecs() { Char clower(); static char C_char_decl[] = "static const %s %s[%d] =\n { 0,\n"; /* } so vi doesn't get confused */ register int i, j; int numrows; if ( numecs < csize ) printf( C_char_decl, "YY_CHAR", "yy_ec", csize ); else printf( C_char_decl, "short", "yy_ec", csize ); for ( i = 1; i < csize; ++i ) { if ( caseins && (i >= 'A') && (i <= 'Z') ) ecgroup[i] = ecgroup[clower( i )]; ecgroup[i] = abs( ecgroup[i] ); mkdata( ecgroup[i] ); } dataend(); if ( trace ) { fputs( "\n\nEquivalence Classes:\n\n", stderr ); numrows = csize / 8; for ( j = 0; j < numrows; ++j ) { for ( i = j; i < csize; i = i + numrows ) { fprintf( stderr, "%4s = %-2d", readable_form( i ), ecgroup[i] ); putc( ' ', stderr ); } putc( '\n', stderr ); } } }
/* * process a simple option */ static void opt_char(char c) { switch (clower(c)) { case 'a': obsolete=1; break; case 'd': debug=1; break; case 'n': noexec=1; break; case 'k': keepgoing=1; break; case 'v': verbose=1; break; default: fprintf(stderr, "Unknown switch: %c\n", c); break; } }
void genecs() { register int i, j; int numrows; if ( csize == 65536 && long_align ) out_str_dec( C_long_decl, "yy_ec", csize ); else if ( csize == 65536 && numecs < 256 ) out_str_dec( C_uchar_decl, "yy_ec", csize ); else if ( csize == 65536 && numecs < 65536 ) out_str_dec( C_ushort_decl, "yy_ec", csize ); else out_str_dec( C_int_decl, "yy_ec", csize ); for ( i = 1; i < csize; ++i ) { if ( caseins && (i >= 'A') && (i <= 'Z') ) ecgroup[i] = ecgroup[clower( i )]; ecgroup[i] = ABS( ecgroup[i] ); mkdata( ecgroup[i] ); } dataend(); if ( trace ) { fputs( _( "\n\nEquivalence Classes:\n\n" ), stderr ); numrows = csize / 8; for ( j = 0; j < numrows; ++j ) { for ( i = j; i < csize; i = i + numrows ) { fprintf( stderr, "%4s = %-2d", readable_form( i ), ecgroup[i] ); putc( ' ', stderr ); } putc( '\n', stderr ); } } }
int main(int argc, char** argv) { int arg, i; char *mfile = NULL; for (arg = 1; arg < argc; ++arg) if (*argv[arg] == '-') { if ('f'==clower(argv[arg][1])) { if (++arg >= argc) { fprintf(stderr, "-f needs filename argument.\n"); return 1; } mfile = argv[arg]; } else opt_char(argv[arg][1]); } else if (modcount < MAXMODS) { if (argv[arg][0]) /* ignore trailing whitespace */ modnames[modcount++] = argv[arg]; } else { fprintf(stderr, "Too many module names.\n"); return 1; } if (mfile != NULL) { arg = fmake(mfile); if (arg == -1) fprintf(stderr, "\nCannot open makefile\n"); } else { for (i = 0; *mfiles[i]; ++i) if ((arg=fmake(mfiles[i])) != -1) break; if (!*mfiles[i]) fprintf(stderr, "\nCannot open makefile\n"); } if (debug) prtree(); return arg; }
void genecs(void) { int i, j; int numrows; out_str_dec( C_int_decl, "yy_ec", csize ); for ( i = 1; i < csize; ++i ) { if ( caseins && (i >= 'A') && (i <= 'Z') ) ecgroup[i] = ecgroup[clower( i )]; ecgroup[i] = ABS( ecgroup[i] ); mkdata( ecgroup[i] ); } dataend(); if ( trace ) { fputs( _( "\n\nEquivalence Classes:\n\n" ), stderr ); numrows = csize / 8; for ( j = 0; j < numrows; ++j ) { for ( i = j; i < csize; i = i + numrows ) { fprintf( stderr, "%4s = %-2d", readable_form( i ), ecgroup[i] ); putc( ' ', stderr ); } putc( '\n', stderr ); } } }
int toup(a) { return clower(a) ? a+'A'-'a' : a; }