From 240f5c9faaf37d76a793c86a5b880edc37105249 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 28 Apr 1998 00:07:48 +0000 Subject: [PATCH] Added Internationalisation macros to English text strings. --- opcodes/ChangeLog | 23 +++++++++++++++++++++++ opcodes/cgen-asm.c | 14 +++++++------- opcodes/cgen-asm.in | 30 ++++++++++++++++-------------- opcodes/opintl.h | 34 +++++++++++++++++----------------- opcodes/po/POTFILES.in | 3 --- 5 files changed, 63 insertions(+), 41 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0e3bfa89e12..25f60c8eb57 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -17,7 +17,30 @@ Mon Apr 27 14:31:00 1998 Nick Clifton * aclocal.m4: Rebuilt. * config.in: Rebuilt. * configure: Rebuilt. + * alpha-opc.c: Internationalised. + * arc-dis.c: Internationalised. + * arc-opc.c: Internationalised. * arm-dis.c: Internationalised. + * cgen-asm.c: Internationalised. + * cgen-asm.in: Internationalised. + * cgen-dis.in: Internationalised. + * d30v-dis.c: Internationalised. + * dis-buf.c: Internationalised. + * dvp-dis.c: Internationalised. + * dvp-opc.c: Internationalised. + * dvp-opc.c: Internationalised. + * h8300-dis.c: Internationalised. + * h8500-dis.c: Internationalised. + * i386-dis.c: Internationalised. + * m10200-dis.c: Internationalised. + * m10300-dis.c: Internationalised. + * m68k-dis.c: Internationalised. + * m88k-dis.c: Internationalised. + * mips-dis.c: Internationalised. + * ns32k-dis.c: Internationalised. + * opintl.h: Internationalised. + * ppc-opc.c: Internationalised. + * sparc-dis.c: Internationalised. * v850-dis.c: Internationalised. * v850-opc.c: Internationalised. diff --git a/opcodes/cgen-asm.c b/opcodes/cgen-asm.c index 3519f8a7494..e522d160157 100644 --- a/opcodes/cgen-asm.c +++ b/opcodes/cgen-asm.c @@ -26,6 +26,7 @@ #include "bfd.h" #include "symcat.h" #include "opcode/cgen.h" +#include "opintl.h" /* Operand parsing callback. */ const char * (*cgen_parse_operand_fn) @@ -235,7 +236,7 @@ cgen_parse_keyword (strp, keyword_table, valuep) ++p; if (p - start >= (int) sizeof (buf)) - return "unrecognized keyword/register name"; + return _("unrecognized keyword/register name"); memcpy (buf, start, p - start); buf[p - start] = 0; @@ -331,11 +332,11 @@ cgen_validate_signed_integer (value, min, max) { if (value < min || value > max) { - const char *err = - "operand out of range (%ld not between %ld and %ld)"; static char buf[100]; - sprintf (buf, err, value, min, max); + /* xgettext:c-format */ + sprintf (buf, _("operand out of range (%ld not between %ld and %ld)"), + value, min, max); return buf; } @@ -352,11 +353,10 @@ cgen_validate_unsigned_integer (value, min, max) { if (value < min || value > max) { - const char *err = - "operand out of range (%lu not between %lu and %lu)"; static char buf[100]; - sprintf (buf, err, value, min, max); + sprintf (buf, _("operand out of range (%lu not between %lu and %lu)"), + value, min, max); return buf; } diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in index 722c0be8762..b714009d69b 100644 --- a/opcodes/cgen-asm.in +++ b/opcodes/cgen-asm.in @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "symcat.h" #include "@arch@-opc.h" +#include "opintl.h" /* ??? The layout of this stuff is still work in progress. For speed in assembly/disassembly, we use inline functions. That of course @@ -76,9 +77,8 @@ insert_normal (value, attrs, start, length, total_length, buffer) unsigned long max = (1 << length) - 1; if ((unsigned long) value > max) { - const char *err = "operand out of range (%lu not between 0 and %lu)"; - - sprintf (buf, err, value, max); + sprintf (buf, _("operand out of range (%lu not between 0 and %lu)"), + value, max); return buf; } } @@ -87,12 +87,9 @@ insert_normal (value, attrs, start, length, total_length, buffer) long min = - (1 << (length - 1)); long max = (1 << (length - 1)) - 1; if (value < min || value > max) - { - const char *err = "operand out of range (%ld not between %ld and %ld)"; - - sprintf (buf, err, value, min, max); - return buf; - } + return sprintf + (buf, _("operand out of range (%ld not between %ld and %ld)"), + value, min, max); } #if 0 /*def CGEN_INT_INSN*/ @@ -182,8 +179,9 @@ parse_insn_normal (insn, strp, fields) p = CGEN_INSN_MNEMONIC (insn); while (* p && * p == * str) ++ p, ++ str; + if (* p || (* str && !isspace (* str))) - return "unrecognized instruction"; + return _("unrecognized instruction"); CGEN_INIT_PARSE (); cgen_init_parse_operand (); @@ -221,7 +219,7 @@ parse_insn_normal (insn, strp, fields) /* Syntax char didn't match. Can't be this insn. */ /* FIXME: would like to return something like "expected char `c'" */ - return "syntax error"; + return _("syntax error"); } continue; } @@ -247,7 +245,7 @@ parse_insn_normal (insn, strp, fields) ++ str; if (* str != '\0') - return "junk at end of line"; /* FIXME: would like to include `str' */ + return _("junk at end of line"); /* FIXME: would like to include `str' */ return NULL; } @@ -397,8 +395,12 @@ const CGEN_INSN * Need to track why it failed and pick the right one. */ { static char errbuf[100]; - sprintf (errbuf, "bad instruction `%.50s%s'", - start, strlen (start) > 50 ? "..." : ""); + /* xgettext:c-format */ + if (strlen (start) > 50) + sprintf (errbuf, _("bad instruction `%.50s...'"), start); + else + sprintf (errbuf, _("bad instruction `%.50s'"), start); + *errmsg = errbuf; return NULL; } diff --git a/opcodes/opintl.h b/opcodes/opintl.h index 87f1d26f9c4..8a5203f73ba 100644 --- a/opcodes/opintl.h +++ b/opcodes/opintl.h @@ -11,24 +11,24 @@ 02111-1307, USA. */ #ifdef ENABLE_NLS -#include -#define _(String) gettext (String) -#ifdef gettext_noop -#define N_(String) gettext_noop (String) -#else -#define N_(String) (String) -#endif +# include +# define _(String) gettext (String) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif #else /* Stubs that do something close enough. */ -#define textdomain(String) (String) -#define gettext(String) (String) -#define dgettext(Domain,Message) (Message) -#define dcgettext(Domain,Message,Type) (Message) -#define bindtextdomain(Domain,Directory) (Domain) -#define _(String) (String) -#define N_(String) (String) +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define N_(String) (String) /* In this case we don't care about the value. */ -#ifndef LC_MESSAGES -#define LC_MESSAGES 0 -#endif +# ifndef LC_MESSAGES +# define LC_MESSAGES 0 +# endif #endif diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in index b175de3137e..36c079c3168 100644 --- a/opcodes/po/POTFILES.in +++ b/opcodes/po/POTFILES.in @@ -1,5 +1,4 @@ a29k-dis.c -acconfig.h alpha-dis.c alpha-opc.c arc-dis.c @@ -41,14 +40,12 @@ mips-dis.c mips-opc.c mips16-opc.c ns32k-dis.c -opintl.h ppc-dis.c ppc-opc.c sh-dis.c sh-opc.h sparc-dis.c sparc-opc.c -sysdep.h tic30-dis.c tic80-dis.c tic80-opc.c