]> granicus.if.org Git - flex/commitdiff
internationalization aids
authorVern Paxson <vern@ee.lbl.gov>
Sat, 4 Mar 1995 16:09:54 +0000 (16:09 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Sat, 4 Mar 1995 16:09:54 +0000 (16:09 +0000)
dfa.c
flexdef.h
gen.c
main.c
misc.c
nfa.c
scan.l
sym.c
yylex.c

diff --git a/dfa.c b/dfa.c
index 72c80cf30c54f16e0c3a145075ce9f6fac190cbd..646d6cba258801191fba499e81e412d08dfd65d1 100644 (file)
--- a/dfa.c
+++ b/dfa.c
@@ -60,7 +60,7 @@ int state[];
                if ( backing_up_report )
                        {
                        fprintf( backing_up_file,
-                               "State #%d is non-accepting -\n", ds );
+                               _( "State #%d is non-accepting -\n" ), ds );
 
                        /* identify the state */
                        dump_associated_rules( backing_up_file, ds );
@@ -127,7 +127,7 @@ int nacc;
                                if ( accset[j] & YY_TRAILING_HEAD_MASK )
                                        {
                                        line_warning(
-                                               "dangerous trailing context",
+                                       _( "dangerous trailing context" ),
                                                rule_linenum[ar] );
                                        return;
                                        }
@@ -170,7 +170,7 @@ int ds;
 
        bubble( rule_set, num_associated_rules );
 
-       fprintf( file, " associated rule line numbers:" );
+       fprintf( file, _( " associated rule line numbers:" ) );
 
        for ( i = 1; i <= num_associated_rules; ++i )
                {
@@ -208,7 +208,7 @@ int state[];
                out_char_set[i] = state[ec];
                }
 
-       fprintf( file, " out-transitions: " );
+       fprintf( file, _( " out-transitions: " ) );
 
        list_character_set( file, out_char_set );
 
@@ -216,7 +216,7 @@ int state[];
        for ( i = 0; i < csize; ++i )
                out_char_set[i] = ! out_char_set[i];
 
-       fprintf( file, "\n jam-transitions: EOF " );
+       fprintf( file, _( "\n jam-transitions: EOF " ) );
 
        list_character_set( file, out_char_set );
 
@@ -352,7 +352,8 @@ ADD_STATE(state) \
                if ( IS_MARKED(stk[stkpos]) )
                        UNMARK_STATE(stk[stkpos])
                else
-                       flexfatal( "consistency check failed in epsclosure()" );
+                       flexfatal(
+                       _( "consistency check failed in epsclosure()" ) );
                }
 
        *ns_addr = numstates;
@@ -435,7 +436,7 @@ void ntod()
        if ( trace )
                {
                dumpnfa( scset[1] );
-               fputs( "\n\nDFA Dump:\n\n", stderr );
+               fputs( _( "\n\nDFA Dump:\n\n" ), stderr );
                }
 
        inittbl();
@@ -582,7 +583,7 @@ void ntod()
                {
                if ( ! snstods( nset, 0, accset, 0, 0, &end_of_buffer_state ) )
                        flexfatal(
-                               "could not create unique end-of-buffer state" );
+                       _( "could not create unique end-of-buffer state" ) );
 
                ++numas;
                ++num_start_states;
@@ -603,7 +604,7 @@ void ntod()
                dsize = dfasiz[ds];
 
                if ( trace )
-                       fprintf( stderr, "state # %d:\n", ds );
+                       fprintf( stderr, _( "state # %d:\n" ), ds );
 
                sympartition( dset, dsize, symlist, duplist );
 
@@ -987,7 +988,8 @@ int ds[], dsize, transsym, nset[];
                        }
 
                else if ( sym >= 'A' && sym <= 'Z' && caseins )
-                       flexfatal( "consistency check failed in symfollowset" );
+                       flexfatal(
+                       _( "consistency check failed in symfollowset" ) );
 
                else if ( sym == SYM_EPSILON )
                        { /* do nothing */
@@ -1040,7 +1042,7 @@ int symlist[], duplist[];
                        if ( tch < -lastccl || tch >= csize )
                                {
                                flexfatal(
-                       "bad transition character detected in sympartition()" );
+               _( "bad transition character detected in sympartition()" ) );
                                }
 
                        if ( tch >= 0 )
index eee441cf6954c7d47f1bd333f1e8aa7b7aaac647..58fdd190a39c52a650c968e6d4f4cbcdba05401b 100644 (file)
--- a/flexdef.h
+++ b/flexdef.h
 #include <stdlib.h>
 #endif
 
+/* As an aid for the internationalization patch to flex, which
+ * is maintained outside this distribution for copyright reasons.
+ */
+#define _(String) (String)
+
 /* Always be prepared to generate an 8-bit scanner. */
 #define CSIZE 256
 #define Char unsigned char
@@ -842,7 +847,7 @@ extern void lerrif PROTO((const char[], int));
 /* Report an error message formatted with one string argument. */
 extern void lerrsf PROTO((const char[], const char[]));
 
-/* Spit out a "# line" statement. */
+/* Spit out a "#line" statement. */
 extern void line_directive_out PROTO((FILE*, int));
 
 /* Mark the current position in the action array as the end of the section 1
diff --git a/gen.c b/gen.c
index 9f06b4237e55bff064985ea35fafbbaad519277b..1d2c2829a57ac8ed2788c9a63fb56f9d8c63ebaa 100644 (file)
--- a/gen.c
+++ b/gen.c
@@ -245,7 +245,7 @@ void genecs()
 
        if ( trace )
                {
-               fputs( "\n\nEquivalence Classes:\n\n", stderr );
+               fputs( _( "\n\nEquivalence Classes:\n\n" ), stderr );
 
                numrows = csize / 8;
 
@@ -423,7 +423,7 @@ void genftbl()
                mkdata( anum );
 
                if ( trace && anum )
-                       fprintf( stderr, "state # %d accepts: [%d]\n",
+                       fprintf( stderr, _( "state # %d accepts: [%d]\n" ),
                                i, anum );
                }
 
@@ -815,7 +815,8 @@ void gentabs()
 
                                if ( trace )
                                        fprintf( stderr,
-                                               "state # %d accepts: ", i );
+                                               _( "state # %d accepts: " ),
+                                               i );
 
                                for ( k = 1; k <= nacc; ++k )
                                        {
@@ -893,7 +894,7 @@ void gentabs()
                mkdata( acc_array[i] );
 
                if ( ! reject && trace && acc_array[i] )
-                       fprintf( stderr, "state # %d accepts: [%d]\n",
+                       fprintf( stderr, _( "state # %d accepts: [%d]\n" ),
                                i, acc_array[i] );
                }
 
@@ -916,7 +917,8 @@ void gentabs()
                 */
 
                if ( trace )
-                       fputs( "\n\nMeta-Equivalence Classes:\n", stderr );
+                       fputs( _( "\n\nMeta-Equivalence Classes:\n" ),
+                             stderr );
 
                out_str_dec( C_int_decl, "yy_meta", numecs + 1 );
 
diff --git a/main.c b/main.c
index aee483c296cb1ba88f3ec8fe00649396ebd24b00..c401981d400063e3c372eb83a4205f3fde71c50a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -150,11 +150,12 @@ char **argv;
 
        for ( i = 1; i <= num_rules; ++i )
                if ( ! rule_useful[i] && i != default_rule )
-                       line_warning( "rule cannot be matched",
+                       line_warning( _( "rule cannot be matched" ),
                                        rule_linenum[i] );
 
        if ( spprdflt && ! reject && rule_useful[default_rule] )
-               line_warning( "-s option given but default rule can be matched",
+               line_warning(
+                       _( "-s option given but default rule can be matched" ),
                        rule_linenum[default_rule] );
 
        /* Generate the C state transition tables from the DFA. */
@@ -178,10 +179,10 @@ void check_options()
        if ( lex_compat )
                {
                if ( C_plus_plus )
-                       flexerror( "Can't use -+ with -l option" );
+                       flexerror( _( "Can't use -+ with -l option" ) );
 
                if ( fulltbl || fullspd )
-                       flexerror( "Can't use -f or -F with -l option" );
+                       flexerror( _( "Can't use -f or -F with -l option" ) );
 
                /* Don't rely on detecting use of yymore() and REJECT,
                 * just assume they'll be used.
@@ -209,20 +210,20 @@ void check_options()
                }
 
        if ( (fulltbl || fullspd) && usemecs )
-               flexerror( "-Cf/-CF and -Cm don't make sense together" );
+               flexerror( _( "-Cf/-CF and -Cm don't make sense together" ) );
 
        if ( (fulltbl || fullspd) && interactive )
-               flexerror( "-Cf/-CF and -I are incompatible" );
+               flexerror( _( "-Cf/-CF and -I are incompatible" ) );
 
        if ( fulltbl && fullspd )
-               flexerror( "-Cf and -CF are mutually exclusive" );
+               flexerror( _( "-Cf and -CF are mutually exclusive" ) );
 
        if ( C_plus_plus && fullspd )
-               flexerror( "Can't use -+ with -CF option" );
+               flexerror( _( "Can't use -+ with -CF option" ) );
 
        if ( C_plus_plus && yytext_is_array )
                {
-               warn( "%array incompatible with -+ option" );
+               warn( _( "%array incompatible with -+ option" ) );
                yytext_is_array = false;
                }
 
@@ -275,13 +276,13 @@ void check_options()
                prev_stdout = freopen( outfilename, "w", stdout );
 
                if ( prev_stdout == NULL )
-                       lerrsf( "could not create %s", outfilename );
+                       lerrsf( _( "could not create %s" ), outfilename );
 
                outfile_created = 1;
                }
 
        if ( skelname && (skelfile = fopen( skelname, "r" )) == NULL )
-               lerrsf( "can't open skeleton file %s", skelname );
+               lerrsf( _( "can't open skeleton file %s" ), skelname );
 
        if ( strcmp( prefix, "yy" ) )
                {
@@ -338,50 +339,56 @@ int exit_status;
        if ( skelfile != NULL )
                {
                if ( ferror( skelfile ) )
-                       lerrsf( "input error reading skeleton file %s",
+                       lerrsf( _( "input error reading skeleton file %s" ),
                                skelname );
 
                else if ( fclose( skelfile ) )
-                       lerrsf( "error closing skeleton file %s", skelname );
+                       lerrsf( _( "error closing skeleton file %s" ),
+                               skelname );
                }
 
        if ( exit_status != 0 && outfile_created )
                {
                if ( ferror( stdout ) )
-                       lerrsf( "error writing output file %s", outfilename );
+                       lerrsf( _( "error writing output file %s" ),
+                               outfilename );
 
                else if ( fclose( stdout ) )
-                       lerrsf( "error closing output file %s", outfilename );
+                       lerrsf( _( "error closing output file %s" ),
+                               outfilename );
 
                else if ( unlink( outfilename ) )
-                       lerrsf( "error deleting output file %s", outfilename );
+                       lerrsf( _( "error deleting output file %s" ),
+                               outfilename );
                }
 
        if ( backing_up_report && backing_up_file )
                {
                if ( num_backing_up == 0 )
-                       fprintf( backing_up_file, "No backing up.\n" );
+                       fprintf( backing_up_file, _( "No backing up.\n" ) );
                else if ( fullspd || fulltbl )
                        fprintf( backing_up_file,
-                               "%d backing up (non-accepting) states.\n",
+                               _( "%d backing up (non-accepting) states.\n" ),
                                num_backing_up );
                else
                        fprintf( backing_up_file,
-                               "Compressed tables always back up.\n" );
+                               _( "Compressed tables always back up.\n" ) );
 
                if ( ferror( backing_up_file ) )
-                       lerrsf( "error writing backup file %s", backing_name );
+                       lerrsf( _( "error writing backup file %s" ),
+                               backing_name );
 
                else if ( fclose( backing_up_file ) )
-                       lerrsf( "error closing backup file %s", backing_name );
+                       lerrsf( _( "error closing backup file %s" ),
+                               backing_name );
                }
 
        if ( printstats )
                {
-               fprintf( stderr, "%s version %s usage statistics:\n",
+               fprintf( stderr, _( "%s version %s usage statistics:\n" ),
                        program_name, flex_version );
 
-               fprintf( stderr, "  scanner options: -" );
+               fprintf( stderr, _( "  scanner options: -" ) );
 
                if ( C_plus_plus )
                        putc( '+', stderr );
@@ -452,68 +459,74 @@ int exit_status;
 
                putc( '\n', stderr );
 
-               fprintf( stderr, "  %d/%d NFA states\n", lastnfa, current_mns );
-               fprintf( stderr, "  %d/%d DFA states (%d words)\n", lastdfa,
-                       current_max_dfas, totnst );
-               fprintf( stderr, "  %d rules\n",
+               fprintf( stderr, _( "  %d/%d NFA states\n" ),
+                       lastnfa, current_mns );
+               fprintf( stderr, _( "  %d/%d DFA states (%d words)\n" ),
+                       lastdfa, current_max_dfas, totnst );
+               fprintf( stderr, _( "  %d rules\n" ),
                num_rules + num_eof_rules - 1 /* - 1 for def. rule */ );
 
                if ( num_backing_up == 0 )
-                       fprintf( stderr, "  No backing up\n" );
+                       fprintf( stderr, _( "  No backing up\n" ) );
                else if ( fullspd || fulltbl )
                        fprintf( stderr,
-                               "  %d backing-up (non-accepting) states\n",
+                       _( "  %d backing-up (non-accepting) states\n" ),
                                num_backing_up );
                else
                        fprintf( stderr,
-                               "  Compressed tables always back-up\n" );
+                               _( "  Compressed tables always back-up\n" ) );
 
                if ( bol_needed )
                        fprintf( stderr,
-                               "  Beginning-of-line patterns used\n" );
+                               _( "  Beginning-of-line patterns used\n" ) );
 
-               fprintf( stderr, "  %d/%d start conditions\n", lastsc,
+               fprintf( stderr, _( "  %d/%d start conditions\n" ), lastsc,
                        current_max_scs );
                fprintf( stderr,
-                       "  %d epsilon states, %d double epsilon states\n",
+                       _( "  %d epsilon states, %d double epsilon states\n" ),
                        numeps, eps2 );
 
                if ( lastccl == 0 )
-                       fprintf( stderr, "  no character classes\n" );
+                       fprintf( stderr, _( "  no character classes\n" ) );
                else
                        fprintf( stderr,
-       "  %d/%d character classes needed %d/%d words of storage, %d reused\n",
+_( "  %d/%d character classes needed %d/%d words of storage, %d reused\n" ),
                                lastccl, current_maxccls,
                                cclmap[lastccl] + ccllen[lastccl],
                                current_max_ccl_tbl_size, cclreuse );
 
-               fprintf( stderr, "  %d state/nextstate pairs created\n",
+               fprintf( stderr, _( "  %d state/nextstate pairs created\n" ),
                        numsnpairs );
-               fprintf( stderr, "  %d/%d unique/duplicate transitions\n",
+               fprintf( stderr, _( "  %d/%d unique/duplicate transitions\n" ),
                        numuniq, numdup );
 
                if ( fulltbl )
                        {
                        tblsiz = lastdfa * numecs;
-                       fprintf( stderr, "  %d table entries\n", tblsiz );
+                       fprintf( stderr, _( "  %d table entries\n" ), tblsiz );
                        }
 
                else
                        {
                        tblsiz = 2 * (lastdfa + numtemps) + 2 * tblend;
 
-                       fprintf( stderr, "  %d/%d base-def entries created\n",
+                       fprintf( stderr,
+                               _( "  %d/%d base-def entries created\n" ),
                                lastdfa + numtemps, current_max_dfas );
                        fprintf( stderr,
-                               "  %d/%d (peak %d) nxt-chk entries created\n",
+                       _( "  %d/%d (peak %d) nxt-chk entries created\n" ),
                                tblend, current_max_xpairs, peakpairs );
                        fprintf( stderr,
-                       "  %d/%d (peak %d) template nxt-chk entries created\n",
-                               numtemps * nummecs, current_max_template_xpairs,
+               _( "  %d/%d (peak %d) template nxt-chk entries created\n" ),
+                               numtemps * nummecs,
+                               current_max_template_xpairs,
                                numtemps * numecs );
-                       fprintf( stderr, "  %d empty table entries\n", nummt );
-                       fprintf( stderr, "  %d protos created\n", numprots );
-                       fprintf( stderr, "  %d templates created, %d uses\n",
+                       fprintf( stderr, _( "  %d empty table entries\n" ),
+                               nummt );
+                       fprintf( stderr, _( "  %d protos created\n" ),
+                               numprots );
+                       fprintf( stderr,
+                               _( "  %d templates created, %d uses\n" ),
                                numtemps, tmpuses );
                        }
 
@@ -521,7 +534,7 @@ int exit_status;
                        {
                        tblsiz = tblsiz + csize;
                        fprintf( stderr,
-                               "  %d/%d equivalence classes created\n",
+                               _( "  %d/%d equivalence classes created\n" ),
                                numecs, csize );
                        }
 
@@ -529,16 +542,17 @@ int exit_status;
                        {
                        tblsiz = tblsiz + numecs;
                        fprintf( stderr,
-                               "  %d/%d meta-equivalence classes created\n",
+                       _( "  %d/%d meta-equivalence classes created\n" ),
                                nummecs, csize );
                        }
 
                fprintf( stderr,
-                       "  %d (%d saved) hash collisions, %d DFAs equal\n",
+               _( "  %d (%d saved) hash collisions, %d DFAs equal\n" ),
                        hshcol, hshsave, dfaeql );
-               fprintf( stderr, "  %d sets of reallocations needed\n",
+               fprintf( stderr, _( "  %d sets of reallocations needed\n" ),
                        num_reallocs );
-               fprintf( stderr, "  %d total table entries needed\n", tblsiz );
+               fprintf( stderr, _( "  %d total table entries needed\n" ),
+                       tblsiz );
                }
 
 #ifndef VMS
@@ -622,7 +636,7 @@ char **argv;
                                case 'C':
                                        if ( i != 1 )
                                                flexerror(
-                                       "-C flag must be given separately" );
+                               _( "-C flag must be given separately" ) );
 
                                        if ( ! sawcmpflag )
                                                {
@@ -662,7 +676,7 @@ char **argv;
 
                                                        default:
                                                                lerrif(
-                                               "unknown -C option '%c'",
+                                               _( "unknown -C option '%c'" ),
                                                                (int) arg[i] );
                                                                break;
                                                        }
@@ -713,7 +727,7 @@ char **argv;
                                case 'o':
                                        if ( i != 1 )
                                                flexerror(
-                                       "-o flag must be given separately" );
+                               _( "-o flag must be given separately" ) );
 
                                        outfilename = arg + i + 1;
                                        did_outfilename = 1;
@@ -722,7 +736,7 @@ char **argv;
                                case 'P':
                                        if ( i != 1 )
                                                flexerror(
-                                       "-P flag must be given separately" );
+                               _( "-P flag must be given separately" ) );
 
                                        prefix = arg + i + 1;
                                        goto get_next_arg;
@@ -734,7 +748,7 @@ char **argv;
                                case 'S':
                                        if ( i != 1 )
                                                flexerror(
-                                       "-S flag must be given separately" );
+                               _( "-S flag must be given separately" ) );
 
                                        skelname = arg + i + 1;
                                        goto get_next_arg;
@@ -756,7 +770,7 @@ char **argv;
                                        break;
 
                                case 'V':
-                                       printf( "%s version %s\n",
+                                       printf( _( "%s version %s\n" ),
                                                program_name, flex_version );
                                        exit( 0 );
 
@@ -774,7 +788,7 @@ char **argv;
 
                                default:
                                        fprintf( stderr,
-               "%s: unknown flag '%c'.  For usage, try\n\t%s --help\n",
+               _( "%s: unknown flag '%c'.  For usage, try\n\t%s --help\n" ),
                                                program_name, (int) arg[i],
                                                program_name );
                                        exit( 1 );
@@ -822,7 +836,7 @@ void readin()
 
        if ( yyparse() )
                {
-               pinpoint_message( "fatal parse error" );
+               pinpoint_message( _( "fatal parse error" ) );
                flexend( 1 );
                }
 
@@ -833,7 +847,8 @@ void readin()
                {
                backing_up_file = fopen( backing_name, "w" );
                if ( backing_up_file == NULL )
-                       lerrsf( "could not create backing-up info file %s",
+                       lerrsf(
+                       _( "could not create backing-up info file %s" ),
                                backing_name );
                }
 
@@ -855,29 +870,29 @@ void readin()
                if ( lex_compat )
                        {
                        fprintf( stderr,
-"-l AT&T lex compatibility option entails a large performance penalty\n" );
+_( "-l AT&T lex compatibility option entails a large performance penalty\n" ) );
                        fprintf( stderr,
-" and may be the actual source of other reported performance penalties\n" );
+_( " and may be the actual source of other reported performance penalties\n" ) );
                        }
 
                if ( performance_report > 1 )
                        {
                        if ( interactive )
                                fprintf( stderr,
-               "-I (interactive) entails a minor performance penalty\n" );
+       _( "-I (interactive) entails a minor performance penalty\n" ) );
 
                        if ( yymore_used )
                                fprintf( stderr,
-                       "yymore() entails a minor performance penalty\n" );
+               _( "yymore() entails a minor performance penalty\n" ) );
                        }
 
                if ( reject )
                        fprintf( stderr,
-                       "REJECT entails a large performance penalty\n" );
+                       _( "REJECT entails a large performance penalty\n" ) );
 
                if ( variable_trailing_context_rules )
                        fprintf( stderr,
-"Variable trailing context rules entail a large performance penalty\n" );
+_( "Variable trailing context rules entail a large performance penalty\n" ) );
                }
 
        if ( reject )
@@ -889,10 +904,11 @@ void readin()
        if ( (fulltbl || fullspd) && reject )
                {
                if ( real_reject )
-                       flexerror( "REJECT cannot be used with -f or -F" );
+                       flexerror(
+                               _( "REJECT cannot be used with -f or -F" ) );
                else
                        flexerror(
-       "variable trailing context rules cannot be used with -f or -F" );
+       _( "variable trailing context rules cannot be used with -f or -F" ) );
                }
 
        if ( reject )
@@ -1041,22 +1057,22 @@ void usage()
        FILE *f = stdout;
 
        fprintf( f,
-"%s [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput -Pprefix -Sskeleton]\n",
+_( "%s [-bcdfhilnpstvwBFILTV78+? -C[aefFmr] -ooutput -Pprefix -Sskeleton]\n" ),
                program_name );
-       fprintf( f, "\t[--help --version] [file ...]\n" );
-
-       fprintf( f,
-               "\t-b  generate backing-up information to %s\n", backing_name );
-       fprintf( f, "\t-c  do-nothing POSIX option\n" );
-       fprintf( f, "\t-d  turn on debug mode in generated scanner\n" );
-       fprintf( f, "\t-f  generate fast, large scanner\n" );
-       fprintf( f, "\t-h  produce this help message\n" );
-       fprintf( f, "\t-i  generate case-insensitive scanner\n" );
-       fprintf( f, "\t-l  maximal compatibility with original lex\n" );
-       fprintf( f, "\t-n  do-nothing POSIX option\n" );
-       fprintf( f, "\t-p  generate performance report to stderr\n" );
+       fprintf( f, _( "\t[--help --version] [file ...]\n" ) );
+
+       fprintf( f, _( "\t-b  generate backing-up information to %s\n" ),
+               backing_name );
+       fprintf( f, _( "\t-c  do-nothing POSIX option\n" ) );
+       fprintf( f, _( "\t-d  turn on debug mode in generated scanner\n" ) );
+       fprintf( f, _( "\t-f  generate fast, large scanner\n" ) );
+       fprintf( f, _( "\t-h  produce this help message\n" ) );
+       fprintf( f, _( "\t-i  generate case-insensitive scanner\n" ) );
+       fprintf( f, _( "\t-l  maximal compatibility with original lex\n" ) );
+       fprintf( f, _( "\t-n  do-nothing POSIX option\n" ) );
+       fprintf( f, _( "\t-p  generate performance report to stderr\n" ) );
        fprintf( f,
-               "\t-s  suppress default rule to ECHO unmatched text\n" );
+               _( "\t-s  suppress default rule to ECHO unmatched text\n" ) );
 
        if ( ! did_outfilename )
                {
@@ -1066,39 +1082,39 @@ void usage()
                }
 
        fprintf( f,
-               "\t-t  write generated scanner on stdout instead of %s\n",
+               _( "\t-t  write generated scanner on stdout instead of %s\n" ),
                outfilename );
 
        fprintf( f,
-               "\t-v  write summary of scanner statistics to f\n" );
-       fprintf( f, "\t-w  do not generate warnings\n" );
-       fprintf( f, "\t-B  generate batch scanner (opposite of -I)\n" );
+               _( "\t-v  write summary of scanner statistics to f\n" ) );
+       fprintf( f, _( "\t-w  do not generate warnings\n" ) );
+       fprintf( f, _( "\t-B  generate batch scanner (opposite of -I)\n" ) );
        fprintf( f,
-               "\t-F  use alternative fast scanner representation\n" );
+               _( "\t-F  use alternative fast scanner representation\n" ) );
        fprintf( f,
-               "\t-I  generate interactive scanner (opposite of -B)\n" );
-       fprintf( f, "\t-L  suppress #line directives in scanner\n" );
-       fprintf( f, "\t-T  %s should run in trace mode\n", program_name );
-       fprintf( f, "\t-V  report %s version\n", program_name );
-       fprintf( f, "\t-7  generate 7-bit scanner\n" );
-       fprintf( f, "\t-8  generate 8-bit scanner\n" );
-       fprintf( f, "\t-+  generate C++ scanner class\n" );
-       fprintf( f, "\t-?  produce this help message\n" );
+               _( "\t-I  generate interactive scanner (opposite of -B)\n" ) );
+       fprintf( f, _( "\t-L  suppress #line directives in scanner\n" ) );
+       fprintf( f, _( "\t-T  %s should run in trace mode\n" ), program_name );
+       fprintf( f, _( "\t-V  report %s version\n" ), program_name );
+       fprintf( f, _( "\t-7  generate 7-bit scanner\n" ) );
+       fprintf( f, _( "\t-8  generate 8-bit scanner\n" ) );
+       fprintf( f, _( "\t-+  generate C++ scanner class\n" ) );
+       fprintf( f, _( "\t-?  produce this help message\n" ) );
        fprintf( f,
-       "\t-C  specify degree of table compression (default is -Cem):\n" );
+_( "\t-C  specify degree of table compression (default is -Cem):\n" ) );
        fprintf( f,
-       "\t\t-Ca  trade off larger tables for better memory alignment\n" );
-       fprintf( f, "\t\t-Ce  construct equivalence classes\n" );
+_( "\t\t-Ca  trade off larger tables for better memory alignment\n" ) );
+       fprintf( f, _( "\t\t-Ce  construct equivalence classes\n" ) );
        fprintf( f,
-       "\t\t-Cf  do not compress scanner tables; use -f representation\n" );
+_( "\t\t-Cf  do not compress scanner tables; use -f representation\n" ) );
        fprintf( f,
-       "\t\t-CF  do not compress scanner tables; use -F representation\n" );
-       fprintf( f, "\t\t-Cm  construct meta-equivalence classes\n" );
+_( "\t\t-CF  do not compress scanner tables; use -F representation\n" ) );
+       fprintf( f, _( "\t\t-Cm  construct meta-equivalence classes\n" ) );
        fprintf( f,
-               "\t\t-Cr  use read() instead of stdio for scanner input\n" );
-       fprintf( f, "\t-o  specify output filename\n" );
-       fprintf( f, "\t-P  specify scanner prefix other than \"yy\"\n" );
-       fprintf( f, "\t-S  specify skeleton file\n" );
-       fprintf( f, "\t--help     produce this help message\n" );
-       fprintf( f, "\t--version  report %s version\n", program_name );
+       _( "\t\t-Cr  use read() instead of stdio for scanner input\n" ) );
+       fprintf( f, _( "\t-o  specify output filename\n" ) );
+       fprintf( f, _( "\t-P  specify scanner prefix other than \"yy\"\n" ) );
+       fprintf( f, _( "\t-S  specify skeleton file\n" ) );
+       fprintf( f, _( "\t--help     produce this help message\n" ) );
+       fprintf( f, _( "\t--version  report %s version\n" ), program_name );
        }
diff --git a/misc.c b/misc.c
index 72741ab5d418ecad319761de3a0d5e68fe7b4abc..a0151090f53edcef652f92716f3e7ccd32a784d7 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -46,7 +46,7 @@ int value;
 
        if ( strlen( defname ) > MAXLINE / 2 )
                {
-               format_pinpoint_message( "name \"%s\" ridiculously long"
+               format_pinpoint_message( _( "name \"%s\" ridiculously long" )
                        defname );
                return;
                }
@@ -94,7 +94,8 @@ size_t element_size;
 
        mem = flex_alloc( num_bytes );
        if ( ! mem )
-               flexfatal( "memory allocation failed in allocate_array()" );
+               flexfatal(
+                       _( "memory allocation failed in allocate_array()" ) );
 
        return mem;
        }
@@ -172,11 +173,12 @@ void check_char( c )
 int c;
        {
        if ( c >= CSIZE )
-               lerrsf( "bad character '%s' detected in check_char()",
+               lerrsf( _( "bad character '%s' detected in check_char()" ),
                        readable_form( c ) );
 
        if ( c >= csize )
-               lerrsf( "scanner requires -8 flag to use the character %s",
+               lerrsf(
+               _( "scanner requires -8 flag to use the character %s" ),
                        readable_form( c ) );
        }
 
@@ -209,7 +211,7 @@ register const char *str;
        copy = (char *) flex_alloc( size );
 
        if ( copy == NULL )
-               flexfatal( "dynamic memory failure in copy_string()" );
+               flexfatal( _( "dynamic memory failure in copy_string()" ) );
 
        for ( c2 = copy; (*c2++ = *str++) != 0; )
                ;
@@ -341,7 +343,8 @@ const char msg[];
 void flexfatal( msg )
 const char msg[];
        {
-       fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
+       fprintf( stderr, _( "%s: fatal internal error, %s\n" ),
+               program_name, msg );
        exit( 1 );
        }
 
@@ -383,7 +386,7 @@ const char msg[], arg[];
        }
 
 
-/* line_directive_out - spit out a "# line" statement */
+/* line_directive_out - spit out a "#line" statement */
 
 void line_directive_out( output_file, do_infile )
 FILE *output_file;
@@ -768,7 +771,7 @@ size_t element_size;
 
        new_array = flex_realloc( array, num_bytes );
        if ( ! new_array )
-               flexfatal( "attempt to increase array size failed" );
+               flexfatal( _( "attempt to increase array size failed" ) );
 
        return new_array;
        }
@@ -814,7 +817,7 @@ void skelout()
 
                                default:
                                        flexfatal(
-                                               "bad line in skeleton file" );
+                                       _( "bad line in skeleton file" ) );
                                }
                        }
 
@@ -866,7 +869,8 @@ int size;
        void *result = flex_alloc( (size_t) size );
 
        if ( ! result  )
-               flexfatal( "memory allocation failed in yy_flex_xmalloc()" );
+               flexfatal(
+                       _( "memory allocation failed in yy_flex_xmalloc()" ) );
 
        return result;
        }
diff --git a/nfa.c b/nfa.c
index 9d95e1f14f1d398aab3cb7b552ab3745af85e5a7..801408e1949613ba92ad24970f4077f1561d5859 100644 (file)
--- a/nfa.c
+++ b/nfa.c
@@ -97,7 +97,7 @@ int state1;
        int sym, tsp1, tsp2, anum, ns;
 
        fprintf( stderr,
-               "\n\n********** beginning dump of nfa with start state %d\n",
+       _( "\n\n********** beginning dump of nfa with start state %d\n" ),
                state1 );
 
        /* We probably should loop starting at firstst[state1] and going to
@@ -109,7 +109,7 @@ int state1;
        /* for ( ns = firstst[state1]; ns <= lastst[state1]; ++ns ) */
        for ( ns = 1; ns <= lastnfa; ++ns )
                {
-               fprintf( stderr, "state # %4d\t", ns );
+               fprintf( stderr, _( "state # %4d\t" ), ns );
 
                sym = transchar[ns];
                tsp1 = trans1[ns];
@@ -124,7 +124,7 @@ int state1;
                fprintf( stderr, "\n" );
                }
 
-       fprintf( stderr, "********** end of dump\n" );
+       fprintf( stderr, _( "********** end of dump\n" ) );
        }
 
 
@@ -170,7 +170,7 @@ int mach;
                }
 
        if ( state == 0 )
-               flexfatal( "empty machine in dupmachine()" );
+               flexfatal( _( "empty machine in dupmachine()" ) );
 
        state_offset = state - i + 1;
 
@@ -222,7 +222,7 @@ int mach, variable_trail_rule, headcnt, trailcnt;
 
                if ( performance_report > 0 )
                        fprintf( stderr,
-                               "Variable trailing context rule at line %d\n",
+                       _( "Variable trailing context rule at line %d\n" ),
                                rule_linenum[num_rules] );
 
                variable_trailing_context_rules = true;
@@ -344,7 +344,7 @@ register int mach;
 
                default:
                        flexerror(
-                               "bad state type in mark_beginning_as_normal()" );
+                       _( "bad state type in mark_beginning_as_normal()" ) );
                        break;
                }
        }
@@ -597,7 +597,7 @@ int sym;
                {
                if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS )
                        lerrif(
-                       "input rules are too complicated (>= %d NFA states)",
+               _( "input rules are too complicated (>= %d NFA states)" ),
                                current_mns );
 
                ++num_reallocs;
@@ -676,7 +676,7 @@ int statefrom, stateto;
 
        else if ( (transchar[statefrom] != SYM_EPSILON) ||
                  (trans2[statefrom] != NO_TRANSITION) )
-               flexfatal( "found too many transitions in mkxtion()" );
+               flexfatal( _( "found too many transitions in mkxtion()" ) );
 
        else
                { /* second out-transition for an epsilon state */
@@ -702,7 +702,7 @@ void new_rule()
                }
 
        if ( num_rules > MAX_RULE )
-               lerrif( "too many rules (> %d)!", MAX_RULE );
+               lerrif( _( "too many rules (> %d)!" ), MAX_RULE );
 
        rule_linenum[num_rules] = linenum;
        rule_useful[num_rules] = false;
diff --git a/scan.l b/scan.l
index afd2c04e944dd0db859d36a031be77ff9c31ff13..748a0cb1c5bcdef4cf3a342c9b58ffbab658030b 100644 (file)
--- a/scan.l
+++ b/scan.l
@@ -133,7 +133,7 @@ LEXOPT              [aceknopr]
        ^"%"{LEXOPT}{OPTWS}[[:digit:]]*{OPTWS}{NL}      ++linenum; /* ignore */
        ^"%"{LEXOPT}{WS}.*{NL}  ++linenum;      /* ignore */
 
-       ^"%"[^sxaceknopr{}].*   synerr( "unrecognized '%' directive" );
+       ^"%"[^sxaceknopr{}].*   synerr( _( "unrecognized '%' directive" ) );
 
        ^{NAME}         {
                        strcpy( nmstr, yytext );
@@ -200,7 +200,7 @@ LEXOPT              [aceknopr]
 
        {NL}            {
                        if ( ! didadef )
-                               synerr( "incomplete name definition" );
+                               synerr( _( "incomplete name definition" ) );
                        BEGIN(INITIAL);
                        ++linenum;
                        }
@@ -281,7 +281,8 @@ LEXOPT              [aceknopr]
                        }
 
        (([a-mo-z]|n[a-np-z])[[:alpha:]\-+]*)|. {
-                       format_synerr( "unrecognized %%option: %s", yytext );
+                       format_synerr( _( "unrecognized %%option: %s" ),
+                               yytext );
                        BEGIN(RECOVER);
                        }
 }
@@ -406,7 +407,7 @@ LEXOPT              [aceknopr]
                        if ( (cclval = ccllookup( (Char *) nmstr )) != 0 )
                                {
                                if ( input() != ']' )
-                                       synerr( "bad character class" );
+                                       synerr( _( "bad character class" ) );
 
                                yylval = cclval;
                                ++cclreuse;
@@ -437,7 +438,8 @@ LEXOPT              [aceknopr]
                        nmstr[yyleng - 2] = '\0';  /* chop trailing brace */
 
                        if ( (nmdefptr = ndlookup( nmstr )) == 0 )
-                               format_synerr( "undefined definition {%s}",
+                               format_synerr(
+                                       _( "undefined definition {%s}" ),
                                                nmstr );
 
                        else
@@ -472,7 +474,10 @@ LEXOPT             [aceknopr]
        ">"             BEGIN(SECT2); return '>';
        ">"/^           BEGIN(CARETISBOL); return '>';
        {SCNAME}        RETURNNAME;
-       .               format_synerr( "bad <start condition>: %s", yytext );
+       .               {
+                       format_synerr( _( "bad <start condition>: %s" ),
+                               yytext );
+                       }
 }
 
 <CARETISBOL>"^"                BEGIN(SECT2); return '^';
@@ -483,7 +488,7 @@ LEXOPT              [aceknopr]
        \"              BEGIN(SECT2); return '"';
 
        {NL}            {
-                       synerr( "missing quote" );
+                       synerr( _( "missing quote" ) );
                        BEGIN(SECT2);
                        ++linenum;
                        return '"';
@@ -502,7 +507,7 @@ LEXOPT              [aceknopr]
        [^\]\n]         RETURNCHAR;
        "]"             BEGIN(SECT2); return ']';
        .|{NL}          {
-                       synerr( "bad character class" );
+                       synerr( _( "bad character class" ) );
                        BEGIN(SECT2);
                        return ']';
                        }
@@ -522,7 +527,8 @@ LEXOPT              [aceknopr]
        "[:upper:]"     BEGIN(CCL); return CCE_UPPER;
        "[:xdigit:]"    BEGIN(CCL); return CCE_XDIGIT;
        {CCL_EXPR}      {
-                       format_synerr( "bad character class expression: %s",
+                       format_synerr(
+                               _( "bad character class expression: %s" ),
                                        yytext );
                        BEGIN(CCL); return CCE_ALNUM;
                        }
@@ -538,13 +544,13 @@ LEXOPT            [aceknopr]
        "}"             BEGIN(SECT2); return '}';
 
        .               {
-                       synerr( "bad character inside {}'s" );
+                       synerr( _( "bad character inside {}'s" ) );
                        BEGIN(SECT2);
                        return '}';
                        }
 
        {NL}            {
-                       synerr( "missing }" );
+                       synerr( _( "missing }" ) );
                        BEGIN(SECT2);
                        ++linenum;
                        return '}';
@@ -617,7 +623,7 @@ LEXOPT              [aceknopr]
 }
 
 <COMMENT,ACTION,ACTION_STRING><<EOF>>  {
-                       synerr( "EOF encountered inside an action" );
+                       synerr( _( "EOF encountered inside an action" ) );
                        yyterminate();
                        }
 
@@ -637,7 +643,7 @@ LEXOPT              [aceknopr]
        <<EOF>>         sectnum = 0; yyterminate();
 }
 
-<*>.|\n                        format_synerr( "bad character: %s", yytext );
+<*>.|\n                        format_synerr( _( "bad character: %s" ), yytext );
 
 %%
 
@@ -666,7 +672,7 @@ char *file;
                yyin = fopen( infilename, "r" );
 
                if ( yyin == NULL )
-                       lerrsf( "can't open %s", file );
+                       lerrsf( _( "can't open %s" ), file );
                }
 
        else
diff --git a/sym.c b/sym.c
index d3578b6af8d4246771d5d9771ffdb9eb04e6c8cb..1d24a43c602c5ab4af29a8d403412d807cc8cb31 100644 (file)
--- a/sym.c
+++ b/sym.c
@@ -75,7 +75,7 @@ int table_size;
                flex_alloc( sizeof( struct hash_entry ) );
 
        if ( new_entry == NULL )
-               flexfatal( "symbol table memory allocation failed" );
+               flexfatal( _( "symbol table memory allocation failed" ) );
 
        if ( (successor = table[hash_val]) != 0 )
                {
@@ -185,7 +185,7 @@ Char definition[];
        if ( addsym( copy_string( name ),
                        (char *) copy_unsigned_string( definition ), 0,
                        ndtbl, NAME_TABLE_HASH_SIZE ) )
-               synerr( "name defined twice" );
+               synerr( _( "name defined twice" ) );
        }
 
 
@@ -239,7 +239,8 @@ int xcluflg;
 
        if ( addsym( scname[lastsc], (char *) 0, lastsc,
                        sctbl, START_COND_HASH_SIZE ) )
-               format_pinpoint_message( "start condition %s declared twice",
+               format_pinpoint_message(
+                               _( "start condition %s declared twice" ),
                                        str );
 
        scset[lastsc] = mkstate( SYM_EPSILON );
diff --git a/yylex.c b/yylex.c
index 988e086c752d70017896b1ead5aae07689858483..2d801dba72676d2d59c53adbe9b2cd65772136f4 100644 (file)
--- a/yylex.c
+++ b/yylex.c
@@ -52,7 +52,7 @@ int yylex()
 
                if ( sectnum == 1 )
                        {
-                       synerr( "premature EOF" );
+                       synerr( _( "premature EOF" ) );
                        sectnum = 2;
                        toktype = SECTEND;
                        }
@@ -201,12 +201,12 @@ int yylex()
                                break;
 
                        case 0:
-                               fprintf( stderr, "End Marker\n" );
+                               fprintf( stderr, _( "End Marker\n" ) );
                                break;
 
                        default:
                                fprintf( stderr,
-                                       "*Something Weird* - tok: %d val: %d\n",
+                               _( "*Something Weird* - tok: %d val: %d\n" ),
                                        toktype, yylval );
                                break;
                        }