From: Joseph Myers Date: Tue, 10 Feb 2004 19:12:34 +0000 (+0000) Subject: gjavah.c: Include "intl.h". X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0237b2dc30312a14a02cd6cc42daeec82b49b913;p=gcc.git gjavah.c: Include "intl.h". * gjavah.c: Include "intl.h". (error): New function. (main): Call gcc_init_libintl. (get_field_name, throwable_p, print_c_decl, print_full_cxx_name, print_stub_or_jni, process_file, main): Use error rather than fprintf. (print_method_info, usage, help, version, main): Mark strings for translation with _. Avoid splitting up sentences. Send information messages to stdout. * jcf-dump.c: Include "intl.h". (main): Call gcc_init_libintl. (process_class, usage, help, version, main, CHECK_PC_IN_RANGE): Mark error, usage and version messages for translation with _. Avoid splitting up sentences. * jv-scan.c: Include "intl.h". (fatal_error, warning): Change parameter s to msgid. Translate messages. (main): Call gcc_init_libintl. (usage, help, version): Mark error, usage and version messages for translation with _. Avoid splitting up sentences. * jvgenmain.c: Include "intl.h". (main): Call gcc_init_libintl. (usage, main): Mark error messages for translation with _. * Make-lang.in (GCJH_OBJS, JVSCAN_OBJS, JCFDUMP_OBJS, JVGENMAIN_OBJS): Add intl.o. (java/jcf-dump.o, java/gjavah.o, java/jv-scan.o, java/jvgenmain.o): Update dependencies. From-SVN: r77614 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 2132bc4c319..8b8a3f85099 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,33 @@ +2004-02-10 Joseph S. Myers + + * gjavah.c: Include "intl.h". + (error): New function. + (main): Call gcc_init_libintl. + (get_field_name, throwable_p, print_c_decl, print_full_cxx_name, + print_stub_or_jni, process_file, main): Use error rather than + fprintf. + (print_method_info, usage, help, version, main): Mark strings for + translation with _. Avoid splitting up sentences. Send + information messages to stdout. + * jcf-dump.c: Include "intl.h". + (main): Call gcc_init_libintl. + (process_class, usage, help, version, main, CHECK_PC_IN_RANGE): + Mark error, usage and version messages for translation with _. + Avoid splitting up sentences. + * jv-scan.c: Include "intl.h". + (fatal_error, warning): Change parameter s to msgid. Translate + messages. + (main): Call gcc_init_libintl. + (usage, help, version): Mark error, usage and version messages for + translation with _. Avoid splitting up sentences. + * jvgenmain.c: Include "intl.h". + (main): Call gcc_init_libintl. + (usage, main): Mark error messages for translation with _. + * Make-lang.in (GCJH_OBJS, JVSCAN_OBJS, JCFDUMP_OBJS, + JVGENMAIN_OBJS): Add intl.o. + (java/jcf-dump.o, java/gjavah.o, java/jv-scan.o, + java/jvgenmain.o): Update dependencies. + 2004-02-08 Per Bothner * parse.y (resolve_qualified_expression_name): In case of inaccessible diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in index c4e6866aaac..1a20362f58a 100644 --- a/gcc/java/Make-lang.in +++ b/gcc/java/Make-lang.in @@ -1,6 +1,6 @@ # Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM) # language. -# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. #This file is part of GCC. @@ -108,14 +108,15 @@ JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \ java/jcf-path.o java/xref.o java/boehm.o java/java-tree-inline.o mkdeps.o GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \ - java/win32-host.o java/zextract.o version.o mkdeps.o errors.o ggc-none.o + java/win32-host.o java/zextract.o version.o mkdeps.o errors.o ggc-none.o \ + intl.o -JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o +JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o intl.o JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \ - java/win32-host.o java/zextract.o errors.o version.o mkdeps.o ggc-none.o + java/win32-host.o java/zextract.o errors.o version.o mkdeps.o ggc-none.o intl.o -JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o +JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o # Use loose warnings for this front end. java-warn = $(WERROR) @@ -272,9 +273,10 @@ JAVA_LEX_C = java/lex.c java/keyword.h java/chartables.h java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \ java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \ - version.h $(GGC_H) + version.h $(GGC_H) intl.h java/gjavah.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \ - java/gjavah.c java/jcf-reader.c java/jcf.h java/javaop.h version.h $(GGC_H) + java/gjavah.c java/jcf-reader.c java/jcf.h java/javaop.h version.h $(GGC_H) \ + intl.h java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(JAVA_TREE_H) java/parse.h toplev.h java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) coretypes.h \ @@ -308,9 +310,9 @@ java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \ $(RTL_H) java/java-opcodes.h java/parse.h java/buffer.h $(SYSTEM_H) \ coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-jcf-write.h $(TM_P_H) java/jv-scan.o: java/jv-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ - version.h + version.h intl.h java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \ - coretypes.h $(TM_H) + coretypes.h $(TM_H) intl.h java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \ toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(EXPR_H) diagnostic.h \ langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c index b9a34e3bbdb..4afa1495955 100644 --- a/gcc/java/gjavah.c +++ b/gcc/java/gjavah.c @@ -1,7 +1,7 @@ /* Program to write C++-suitable header files from a Java(TM) .class file. This is similar to SUN's javah. -Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003 +Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -40,6 +40,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "java-opcodes.h" #include "ggc.h" #include "hashtab.h" +#include "intl.h" #include @@ -150,6 +151,7 @@ static const unsigned char * decode_signature_piece (FILE *, const unsigned char *, const unsigned char *, int *); static void print_class_decls (FILE *, JCF *, int); +static void error (const char *msgid, ...); static void usage (void) ATTRIBUTE_NORETURN; static void help (void) ATTRIBUTE_NORETURN; static void version (void) ATTRIBUTE_NORETURN; @@ -251,6 +253,21 @@ static int decompiled = 0; #include "jcf-reader.c" +/* Print an error message and set found_error. */ +static void +error (const char *msgid, ...) +{ + va_list ap; + + va_start (ap, msgid); + + fprintf (stderr, "gcjh: "); + vfprintf (stderr, _(msgid), ap); + va_end (ap); + fprintf (stderr, "\n"); + found_error = 1; +} + /* Print a single-precision float, suitable for parsing by g++. */ static void jni_print_float (FILE *stream, jfloat f) @@ -652,8 +669,7 @@ get_field_name (JCF *jcf, int name_index, JCF_u2 flags) trouble. */ if ((flags & ACC_STATIC)) { - fprintf (stderr, "static field has same name as method\n"); - found_error = 1; + error ("static field has same name as method"); return NULL; } @@ -812,9 +828,9 @@ print_method_info (FILE *stream, JCF* jcf, int name_index, int sig_index, { /* FIXME: i18n bug here. Order of prints should not be fixed. */ - fprintf (stderr, "ignored method `"); + fprintf (stderr, _("ignored method `")); jcf_print_utf8 (stderr, str, length); - fprintf (stderr, "' marked virtual\n"); + fprintf (stderr, _("' marked virtual\n")); found_error = 1; return; } @@ -1161,16 +1177,14 @@ throwable_p (const unsigned char *clname) if (! classfile_name) { - fprintf (stderr, "couldn't find class %s\n", current); - found_error = 1; + error ("couldn't find class %s", current); return 0; } if (jcf_parse_preamble (&jcf) != 0 || jcf_parse_constant_pool (&jcf) != 0 || verify_constant_pool (&jcf) > 0) { - fprintf (stderr, "parse error while reading %s\n", classfile_name); - found_error = 1; + error ("parse error while reading %s", classfile_name); return 0; } jcf_parse_class (&jcf); @@ -1396,8 +1410,7 @@ print_c_decl (FILE* stream, JCF* jcf, int name_index, int signature_index, next = decode_signature_piece (stream, str, limit, &need_space); if (! next) { - fprintf (stderr, "unparseable signature: `%s'\n", str0); - found_error = 1; + error ("unparseable signature: `%s'", str0); return; } } @@ -1499,8 +1512,7 @@ print_full_cxx_name (FILE* stream, JCF* jcf, int name_index, next = decode_signature_piece (stream, str, limit, &need_space); if (! next) { - fprintf (stderr, "unparseable signature: `%s'\n", str0); - found_error = 1; + error ("unparseable signature: `%s'", str0); return; } @@ -1575,8 +1587,7 @@ print_stub_or_jni (FILE* stream, JCF* jcf, int name_index, next = decode_signature_piece (stream, str, limit, &need_space); if (! next) { - fprintf (stderr, "unparseable signature: `%s'\n", str0); - found_error = 1; + error ("unparseable signature: `%s'", str0); return; } } @@ -1966,8 +1977,7 @@ process_file (JCF *jcf, FILE *out) if (jcf_parse_preamble (jcf) != 0) { - fprintf (stderr, "Not a valid Java .class file.\n"); - found_error = 1; + error ("Not a valid Java .class file."); return; } @@ -1975,15 +1985,13 @@ process_file (JCF *jcf, FILE *out) code = jcf_parse_constant_pool (jcf); if (code != 0) { - fprintf (stderr, "error while parsing constant pool\n"); - found_error = 1; + error ("error while parsing constant pool"); return; } code = verify_constant_pool (jcf); if (code > 0) { - fprintf (stderr, "error in constant pool entry #%d\n", code); - found_error = 1; + error ("error in constant pool entry #%d", code); return; } @@ -2126,8 +2134,7 @@ process_file (JCF *jcf, FILE *out) if (! print_cxx_classname (out, "class ", jcf, jcf->this_class, 0)) { - fprintf (stderr, "class is of array type\n"); - found_error = 1; + error ("class is of array type\n"); return; } if (jcf->super_class) @@ -2135,8 +2142,7 @@ process_file (JCF *jcf, FILE *out) if (! print_cxx_classname (out, " : public ", jcf, jcf->super_class, 1)) { - fprintf (stderr, "base class is of array type\n"); - found_error = 1; + error ("base class is of array type"); return; } } @@ -2252,45 +2258,45 @@ static const struct option options[] = static void usage (void) { - fprintf (stderr, "Try `gcjh --help' for more information.\n"); + fprintf (stderr, _("Try `gcjh --help' for more information.\n")); exit (1); } static void help (void) { - printf ("Usage: gcjh [OPTION]... CLASS...\n\n"); - printf ("Generate C++ header files from .class files\n\n"); - printf (" -stubs Generate an implementation stub file\n"); - printf (" -jni Generate a JNI header or stub\n"); + printf (_("Usage: gcjh [OPTION]... CLASS...\n\n")); + printf (_("Generate C++ header files from .class files\n\n")); + printf (_(" -stubs Generate an implementation stub file\n")); + printf (_(" -jni Generate a JNI header or stub\n")); printf ("\n"); - printf (" -add TEXT Insert TEXT into class body\n"); - printf (" -append TEXT Insert TEXT after class declaration\n"); - printf (" -friend TEXT Insert TEXT as `friend' declaration\n"); - printf (" -prepend TEXT Insert TEXT before start of class\n"); + printf (_(" -add TEXT Insert TEXT into class body\n")); + printf (_(" -append TEXT Insert TEXT after class declaration\n")); + printf (_(" -friend TEXT Insert TEXT as `friend' declaration\n")); + printf (_(" -prepend TEXT Insert TEXT before start of class\n")); printf ("\n"); - printf (" --classpath PATH Set path to find .class files\n"); - printf (" -IDIR Append directory to class path\n"); - printf (" --bootclasspath PATH Override built-in class path\n"); - printf (" --extdirs PATH Set extensions directory path\n"); - printf (" -d DIRECTORY Set output directory name\n"); - printf (" -o FILE Set output file name\n"); - printf (" -td DIRECTORY Set temporary directory name\n"); + printf (_(" --classpath PATH Set path to find .class files\n")); + printf (_(" -IDIR Append directory to class path\n")); + printf (_(" --bootclasspath PATH Override built-in class path\n")); + printf (_(" --extdirs PATH Set extensions directory path\n")); + printf (_(" -d DIRECTORY Set output directory name\n")); + printf (_(" -o FILE Set output file name\n")); + printf (_(" -td DIRECTORY Set temporary directory name\n")); printf ("\n"); - printf (" --help Print this help, then exit\n"); - printf (" --version Print version number, then exit\n"); - printf (" -v, --verbose Print extra information while running\n"); + printf (_(" --help Print this help, then exit\n")); + printf (_(" --version Print version number, then exit\n")); + printf (_(" -v, --verbose Print extra information while running\n")); printf ("\n"); - printf (" -M Print all dependencies to stdout;\n"); - printf (" suppress ordinary output\n"); - printf (" -MM Print non-system dependencies to stdout;\n"); - printf (" suppress ordinary output\n"); - printf (" -MD Print all dependencies to stdout\n"); - printf (" -MMD Print non-system dependencies to stdout\n"); + printf (_(" -M Print all dependencies to stdout;\n" + " suppress ordinary output\n")); + printf (_(" -MM Print non-system dependencies to stdout;\n" + " suppress ordinary output\n")); + printf (_(" -MD Print all dependencies to stdout\n")); + printf (_(" -MMD Print non-system dependencies to stdout\n")); /* We omit -MG until it is implemented. */ printf ("\n"); - printf ("For bug reporting instructions, please see:\n"); - printf ("%s.\n", bug_report_url); + printf (_("For bug reporting instructions, please see:\n" + "%s.\n"), bug_report_url); exit (0); } @@ -2298,9 +2304,9 @@ static void version (void) { printf ("gcjh (GCC) %s\n\n", version_string); - printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); - printf ("This is free software; see the source for copying conditions. There is NO\n"); - printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); + printf ("Copyright %s 2004 Free Software Foundation, Inc.\n", _("(C)")); + printf (_("This is free software; see the source for copying conditions. There is NO\n" + "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n")); exit (0); } @@ -2313,9 +2319,11 @@ main (int argc, char** argv) int emit_dependencies = 0, suppress_output = 0; int opt; + gcc_init_libintl (); + if (argc <= 1) { - fprintf (stderr, "gcjh: no classes specified\n"); + error ("no classes specified"); usage (); } @@ -2408,7 +2416,7 @@ main (int argc, char** argv) break; case OPT_MG: - fprintf (stderr, "gcjh: `-MG' option is unimplemented\n"); + error ("`-MG' option is unimplemented"); exit (1); case OPT_MD: @@ -2429,7 +2437,7 @@ main (int argc, char** argv) if (optind == argc) { - fprintf (stderr, "gcjh: no classes specified\n"); + error ("no classes specified"); usage (); } @@ -2437,7 +2445,7 @@ main (int argc, char** argv) if (output_file && emit_dependencies) { - fprintf (stderr, "gcjh: can't specify both -o and -MD\n"); + error ("can't specify both -o and -MD"); exit (1); } @@ -2448,17 +2456,17 @@ main (int argc, char** argv) const char *classfile_name; if (verbose) - fprintf (stderr, "Processing %s\n", classname); + printf (_("Processing %s\n"), classname); if (! output_file) jcf_dependency_reset (); classfile_name = find_class (classname, strlen (classname), &jcf, 0); if (classfile_name == NULL) { - fprintf (stderr, "%s: no such class\n", classname); + error ("%s: no such class", classname); exit (1); } if (verbose) - fprintf (stderr, "Found in %s\n", classfile_name); + printf (_("Found in %s\n"), classfile_name); if (output_file) { if (strcmp (output_file, "-") == 0) diff --git a/gcc/java/jcf-dump.c b/gcc/java/jcf-dump.c index a95f122ac19..0776629a81e 100644 --- a/gcc/java/jcf-dump.c +++ b/gcc/java/jcf-dump.c @@ -1,7 +1,7 @@ /* Program to dump out a Java(TM) .class file. Functionally similar to Sun's javap. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -54,6 +54,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "coretypes.h" #include "tm.h" #include "ggc.h" +#include "intl.h" #include "jcf.h" #include "tree.h" @@ -795,19 +796,19 @@ process_class (JCF *jcf) { int code; if (jcf_parse_preamble (jcf) != 0) - fprintf (stderr, "Not a valid Java .class file.\n"); + fprintf (stderr, _("Not a valid Java .class file.\n")); /* Parse and possibly print constant pool */ code = jcf_parse_constant_pool (jcf); if (code != 0) { - fprintf (stderr, "error while parsing constant pool\n"); + fprintf (stderr, _("error while parsing constant pool\n")); exit (FATAL_EXIT_CODE); } code = verify_constant_pool (jcf); if (code > 0) { - fprintf (stderr, "error in constant pool entry #%d\n", code); + fprintf (stderr, _("error in constant pool entry #%d\n"), code); exit (FATAL_EXIT_CODE); } if (flag_print_constant_pool) @@ -817,19 +818,19 @@ process_class (JCF *jcf) code = jcf_parse_fields (jcf); if (code != 0) { - fprintf (stderr, "error while parsing fields\n"); + fprintf (stderr, _("error while parsing fields\n")); exit (FATAL_EXIT_CODE); } code = jcf_parse_methods (jcf); if (code != 0) { - fprintf (stderr, "error while parsing methods\n"); + fprintf (stderr, _("error while parsing methods\n")); exit (FATAL_EXIT_CODE); } code = jcf_parse_final_attributes (jcf); if (code != 0) { - fprintf (stderr, "error while parsing final attributes\n"); + fprintf (stderr, _("error while parsing final attributes\n")); exit (FATAL_EXIT_CODE); } jcf->filename = NULL; @@ -865,30 +866,30 @@ static const struct option options[] = static void usage (void) { - fprintf (stderr, "Try `jcf-dump --help' for more information.\n"); + fprintf (stderr, _("Try `jcf-dump --help' for more information.\n")); exit (1); } static void help (void) { - printf ("Usage: jcf-dump [OPTION]... CLASS...\n\n"); - printf ("Display contents of a class file in readable form.\n\n"); - printf (" -c Disassemble method bodies\n"); - printf (" --javap Generate output in `javap' format\n"); + printf (_("Usage: jcf-dump [OPTION]... CLASS...\n\n")); + printf (_("Display contents of a class file in readable form.\n\n")); + printf (_(" -c Disassemble method bodies\n")); + printf (_(" --javap Generate output in `javap' format\n")); printf ("\n"); - printf (" --classpath PATH Set path to find .class files\n"); - printf (" -IDIR Append directory to class path\n"); - printf (" --bootclasspath PATH Override built-in class path\n"); - printf (" --extdirs PATH Set extensions directory path\n"); - printf (" -o FILE Set output file name\n"); + printf (_(" --classpath PATH Set path to find .class files\n")); + printf (_(" -IDIR Append directory to class path\n")); + printf (_(" --bootclasspath PATH Override built-in class path\n")); + printf (_(" --extdirs PATH Set extensions directory path\n")); + printf (_(" -o FILE Set output file name\n")); printf ("\n"); - printf (" --help Print this help, then exit\n"); - printf (" --version Print version number, then exit\n"); - printf (" -v, --verbose Print extra information while running\n"); + printf (_(" --help Print this help, then exit\n")); + printf (_(" --version Print version number, then exit\n")); + printf (_(" -v, --verbose Print extra information while running\n")); printf ("\n"); - printf ("For bug reporting instructions, please see:\n"); - printf ("%s.\n", bug_report_url); + printf (_("For bug reporting instructions, please see:\n" + "%s.\n"), bug_report_url); exit (0); } @@ -896,9 +897,9 @@ static void version (void) { printf ("jcf-dump (GCC) %s\n\n", version_string); - printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); - printf ("This is free software; see the source for copying conditions. There is NO\n"); - printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); + printf ("Copyright %s 2004 Free Software Foundation, Inc.\n", _("(C)")); + printf (_("This is free software; see the source for copying conditions. There is NO\n" + "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n")); exit (0); } @@ -908,9 +909,11 @@ main (int argc, char** argv) JCF jcf[1]; int argi, opt; + gcc_init_libintl (); + if (argc <= 1) { - fprintf (stderr, "jcf-dump: no classes specified\n"); + fprintf (stderr, _("jcf-dump: no classes specified\n")); usage (); } @@ -975,7 +978,7 @@ main (int argc, char** argv) if (optind == argc) { - fprintf (stderr, "jcf-dump: no classes specified\n"); + fprintf (stderr, _("jcf-dump: no classes specified\n")); usage (); } @@ -995,7 +998,7 @@ main (int argc, char** argv) out = fopen (output_file, "w"); if (! out) { - fprintf (stderr, "Cannot open '%s' for output.\n", output_file); + fprintf (stderr, _("Cannot open '%s' for output.\n"), output_file); return FATAL_EXIT_CODE; } } @@ -1041,7 +1044,7 @@ main (int argc, char** argv) break; /* got to central directory */ if (magic != 0x04034b50) /* ZIPMAGIC (little-endian) */ { - fprintf (stderr, "bad format of .zip/.jar archive\n"); + fprintf (stderr, _("bad format of .zip/.jar archive\n")); return FATAL_EXIT_CODE; } JCF_FILL (jcf, 26); @@ -1159,7 +1162,7 @@ disassemble_method (JCF* jcf, const unsigned char *byte_ops, int len) #define VAR_INDEX_2 (saw_index = 1, IMMEDIATE_u2) #define CHECK_PC_IN_RANGE(PC) (PC < 0 || PC > len ? \ - (fprintf(stderr, "Bad byte codes.\n"), exit(-1)) : 1) + (fprintf(stderr, _("Bad byte codes.\n")), exit(-1)) : 1) /* Print out operand (if not implied by the opcode) for PUSCH opcodes. These all push a constant onto the opcode stack. */ diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c index 7c8d2d3e58e..1e9490b0aa0 100644 --- a/gcc/java/jv-scan.c +++ b/gcc/java/jv-scan.c @@ -1,5 +1,5 @@ /* Main for jv-scan - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */ #include "system.h" #include "coretypes.h" #include "tm.h" +#include "intl.h" #include "obstack.h" /* We use obstacks in lex.c */ @@ -39,9 +40,9 @@ Boston, MA 02111-1307, USA. */ #include -extern void fatal_error (const char *s, ...) +extern void fatal_error (const char *msgid, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -void warning (const char *s, ...) ATTRIBUTE_PRINTF_1; +void warning (const char *msgid, ...) ATTRIBUTE_PRINTF_1; void report (void); static void usage (void) ATTRIBUTE_NORETURN; @@ -93,28 +94,28 @@ static const struct option options[] = static void usage (void) { - fprintf (stderr, "Try `jv-scan --help' for more information.\n"); + fprintf (stderr, _("Try `jv-scan --help' for more information.\n")); exit (1); } static void help (void) { - printf ("Usage: jv-scan [OPTION]... FILE...\n\n"); - printf ("Print useful information read from Java source files.\n\n"); - printf (" --no-assert Don't recognize the assert keyword\n"); - printf (" --complexity Print cyclomatic complexity of input file\n"); - printf (" --encoding NAME Specify encoding of input file\n"); - printf (" --print-main Print name of class containing `main'\n"); - printf (" --list-class List all classes defined in file\n"); - printf (" --list-filename Print input filename when listing class names\n"); - printf (" -o FILE Set output file name\n"); + printf (_("Usage: jv-scan [OPTION]... FILE...\n\n")); + printf (_("Print useful information read from Java source files.\n\n")); + printf (_(" --no-assert Don't recognize the assert keyword\n")); + printf (_(" --complexity Print cyclomatic complexity of input file\n")); + printf (_(" --encoding NAME Specify encoding of input file\n")); + printf (_(" --print-main Print name of class containing `main'\n")); + printf (_(" --list-class List all classes defined in file\n")); + printf (_(" --list-filename Print input filename when listing class names\n")); + printf (_(" -o FILE Set output file name\n")); printf ("\n"); - printf (" --help Print this help, then exit\n"); - printf (" --version Print version number, then exit\n"); + printf (_(" --help Print this help, then exit\n")); + printf (_(" --version Print version number, then exit\n")); printf ("\n"); - printf ("For bug reporting instructions, please see:\n"); - printf ("%s.\n", bug_report_url); + printf (_("For bug reporting instructions, please see:\n" + "%s.\n"), bug_report_url); exit (0); } @@ -122,9 +123,9 @@ static void version (void) { printf ("jv-scan (GCC) %s\n\n", version_string); - printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); - printf ("This is free software; see the source for copying conditions. There is NO\n"); - printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); + printf ("Copyright %s 2004 Free Software Foundation, Inc.\n", _("(C)")); + printf (_("This is free software; see the source for copying conditions. There is NO\n" + "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n")); exit (0); } @@ -143,6 +144,8 @@ main (int argc, char **argv) /* Default for output */ out = stdout; + gcc_init_libintl (); + /* Process options first. We use getopt_long and not getopt_long_only because we only support `--' long options here. */ while ((opt = getopt_long (argc, argv, "o:", options, NULL)) != -1) @@ -237,24 +240,24 @@ main (int argc, char **argv) functions */ void -fatal_error (const char *s, ...) +fatal_error (const char *msgid, ...) { va_list ap; - va_start (ap, s); - fprintf (stderr, "%s: error: ", exec_name); - vfprintf (stderr, s, ap); + va_start (ap, msgid); + fprintf (stderr, _("%s: error: "), exec_name); + vfprintf (stderr, _(msgid), ap); fputc ('\n', stderr); va_end (ap); exit (1); } void -warning (const char *s, ...) +warning (const char *msgid, ...) { va_list ap; - va_start (ap, s); - fprintf (stderr, "%s: warning: ", exec_name); - vfprintf (stderr, s, ap); + va_start (ap, msgid); + fprintf (stderr, _("%s: warning: "), exec_name); + vfprintf (stderr, _(msgid), ap); fputc ('\n', stderr); va_end (ap); } diff --git a/gcc/java/jvgenmain.c b/gcc/java/jvgenmain.c index 1bf2d77cb52..1e228a16191 100644 --- a/gcc/java/jvgenmain.c +++ b/gcc/java/jvgenmain.c @@ -1,5 +1,5 @@ /* Program to generate "main" a Java(TM) class containing a main method. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -33,6 +33,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "jcf.h" #include "tree.h" #include "java-tree.h" +#include "intl.h" static char * do_mangle_classname (const char *string); @@ -44,7 +45,8 @@ static void usage (const char *) ATTRIBUTE_NORETURN; static void usage (const char *name) { - fprintf (stderr, "Usage: %s [OPTIONS]... CLASSNAMEmain [OUTFILE]\n", name); + fprintf (stderr, _("Usage: %s [OPTIONS]... CLASSNAMEmain [OUTFILE]\n"), + name); exit (1); } @@ -56,6 +58,8 @@ main (int argc, char **argv) const char *mangled_classname; int i, last_arg; + gcc_init_libintl (); + if (argc < 2) usage (argv[0]); @@ -91,7 +95,7 @@ main (int argc, char **argv) stream = fopen (outfile, "w"); if (stream == NULL) { - fprintf (stderr, "%s: Cannot open output file: %s\n", + fprintf (stderr, _("%s: Cannot open output file: %s\n"), argv[0], outfile); exit (1); } @@ -128,7 +132,7 @@ main (int argc, char **argv) fprintf (stream, "}\n"); if (stream != stdout && fclose (stream) != 0) { - fprintf (stderr, "%s: Failed to close output file %s\n", + fprintf (stderr, _("%s: Failed to close output file %s\n"), argv[0], argv[2]); exit (1); }