#include "libiberty.h"
#include "sb.h"
#include "macro.h"
+#include "asintl.h"
char *program_version = "1.2";
if (ptr->value.s.len)
{
if (!again)
- ERROR ((stderr, "redefinition not allowed\n"));
+ ERROR ((stderr, _("redefinition not allowed\n")));
}
ptr->type = hash_string;
if (term->add_symbol.len
|| term->sub_symbol.len)
{
- ERROR ((stderr, "the %c operator cannot take non-absolute arguments.\n", op));
+ ERROR ((stderr, _("the %c operator cannot take non-absolute arguments.\n"), op));
}
}
lhs->value = 0;
- if (isdigit (string->ptr[idx]))
+ if (isdigit ((unsigned char) string->ptr[idx]))
{
idx = sb_strtol (idx, string, 10, &lhs->value);
}
{
sb acc;
sb_new (&acc);
- ERROR ((stderr, "string where expression expected.\n"));
+ ERROR ((stderr, _("string where expression expected.\n")));
idx = getstring (idx, string, &acc);
sb_kill (&acc);
}
else
{
- ERROR ((stderr, "can't find primary in expression.\n"));
+ ERROR ((stderr, _("can't find primary in expression.\n")));
idx++;
}
return sb_skip_white (idx, string);
idx++;
idx = level_5 (sb_skip_white (idx, string), string, lhs);
if (string->ptr[idx] != ')')
- ERROR ((stderr, "misplaced closing parens.\n"));
+ ERROR ((stderr, _("misplaced closing parens.\n")));
else
idx++;
break;
checkconst ('/', lhs);
checkconst ('/', &rhs);
if (rhs.value == 0)
- ERROR ((stderr, "attempt to divide by zero.\n"));
+ ERROR ((stderr, _("attempt to divide by zero.\n")));
else
lhs->value /= rhs.value;
break;
lhs->value += rhs.value;
if (lhs->add_symbol.name && rhs.add_symbol.name)
{
- ERROR ((stderr, "can't add two relocatable expressions\n"));
+ ERROR ((stderr, _("can't add two relocatable expressions\n")));
}
/* change nn+symbol to symbol + nn */
if (rhs.add_symbol.name)
{
sp++;
if (sp - include_stack >= MAX_INCLUDES)
- FATAL ((stderr, "unreasonable nesting.\n"));
+ FATAL ((stderr, _("unreasonable nesting.\n")));
sb_new (&sp->name);
sb_add_sb (&sp->name, name);
sp->handle = 0;
{
if (online)
{
- WARNING ((stderr, "End of file not at start of line.\n"));
+ WARNING ((stderr, _("End of file not at start of line.\n")));
if (copysource)
putc ('\n', outfile);
ch = '\n';
{
int i = 0;
sb_reset (out);
- if (ISFIRSTCHAR (in->ptr[i]))
+ if (ISFIRSTCHAR (in->ptr[i]) || in->ptr[i] == '\\')
{
sb_add_char (out, in->ptr[i]);
i++;
base = 10;
break;
default:
- ERROR ((stderr, "Illegal base character %c.\n", in->ptr[idx]));
+ ERROR ((stderr, _("Illegal base character %c.\n"), in->ptr[idx]));
base = 10;
break;
}
idx++;
}
}
- else if (isdigit (in->ptr[idx]))
+ else if (isdigit ((unsigned char) in->ptr[idx]))
{
int value;
/* all numbers must start with a digit, let's chew it and
radix = 16;
break;
default:
- ERROR ((stderr, "radix is %c must be one of b, q, d or h", radix));
+ ERROR ((stderr, _("radix is %c must be one of b, q, d or h"), radix));
}
}
case '\t':
break;
default:
- ERROR ((stderr, "size must be one of b, w or l, is %c.\n", in->ptr[idx]));
+ ERROR ((stderr, _("size must be one of b, w or l, is %c.\n"), in->ptr[idx]));
break;
}
idx++;
idx = get_opsize (idx, in, &opsize);
- idx = exp_get_abs ("datab repeat must be constant.\n", idx, in, &repeat);
+ idx = exp_get_abs (_("datab repeat must be constant.\n"), idx, in, &repeat);
idx = sb_skip_comma (idx, in);
- idx = exp_get_abs ("datab data must be absolute.\n", idx, in, &fill);
+ idx = exp_get_abs (_("datab data must be absolute.\n"), idx, in, &fill);
fprintf (outfile, ".fill\t%d,%d,%d\n", repeat, opsize, fill);
}
{
int al, have_fill, fill;
- idx = exp_get_abs ("align needs absolute expression.\n", idx, in, &al);
+ idx = exp_get_abs (_("align needs absolute expression.\n"), idx, in, &al);
idx = sb_skip_white (idx, in);
have_fill = 0;
fill = 0;
if (! eol (idx, in))
{
idx = sb_skip_comma (idx, in);
- idx = exp_get_abs (".align needs absolute fill value.\n", idx, in,
+ idx = exp_get_abs (_(".align needs absolute fill value.\n"), idx, in,
&fill);
have_fill = 1;
}
if (al != 1
&& al != 2
&& al != 4)
- WARNING ((stderr, "alignment must be one of 1, 2 or 4.\n"));
+ WARNING ((stderr, _("alignment must be one of 1, 2 or 4.\n")));
fprintf (outfile, ".align %d", al);
if (have_fill)
idx = sb_skip_white (idx, in);
if (in->ptr[idx] == ',')
idx++;
- idx = exp_get_abs ("res needs absolute expression for fill count.\n", idx, in, &count);
+ idx = exp_get_abs (_("res needs absolute expression for fill count.\n"), idx, in, &count);
if (type == 'c' || type == 'z')
count++;
if (strncasecmp (in->ptr + idx, "LIN=", 4) == 0)
{
idx += 4;
- idx = exp_get_abs ("form LIN= needs absolute expresssion.\n", idx, in, &lines);
+ idx = exp_get_abs (_("form LIN= needs absolute expresssion.\n"), idx, in, &lines);
}
- if (strncasecmp (in->ptr + idx, "COL=", 4) == 0)
+ if (strncasecmp (in->ptr + idx, _("COL="), 4) == 0)
{
idx += 4;
- idx = exp_get_abs ("form COL= needs absolute expresssion.\n", idx, in, &columns);
+ idx = exp_get_abs (_("form COL= needs absolute expresssion.\n"), idx, in, &columns);
}
idx++;
int val;
char buf[20];
/* Turns the next expression into a string */
- idx = exp_get_abs ("% operator needs absolute expression",
+ idx = exp_get_abs (_("% operator needs absolute expression"),
idx + 1,
in,
&val);
{
idx = sb_skip_white (idx, in);
if (in->ptr[idx] != '(')
- ERROR ((stderr, "misplaced ( .\n"));
+ ERROR ((stderr, _("misplaced ( .\n")));
idx = sb_skip_white (idx + 1, in);
return idx;
}
{
idx = sb_skip_white (idx, in);
if (in->ptr[idx] != ')')
- ERROR ((stderr, "misplaced ).\n"));
+ ERROR ((stderr, _("misplaced ).\n")));
idx = sb_skip_white (idx + 1, in);
return idx;
}
idx = sb_skip_comma (idx, in);
idx = get_and_process (idx, in, &search);
idx = sb_skip_comma (idx, in);
- if (isdigit (in->ptr[idx]))
+ if (isdigit ((unsigned char) in->ptr[idx]))
{
- idx = exp_get_abs (".instr needs absolute expresson.\n", idx, in, &start);
+ idx = exp_get_abs (_(".instr needs absolute expresson.\n"), idx, in, &start);
}
else
{
idx = skip_openp (idx, in);
idx = get_and_process (idx, in, &string);
idx = sb_skip_comma (idx, in);
- idx = exp_get_abs ("need absolute position.\n", idx, in, &pos);
+ idx = exp_get_abs (_("need absolute position.\n"), idx, in, &pos);
idx = sb_skip_comma (idx, in);
- idx = exp_get_abs ("need absolute length.\n", idx, in, &len);
+ idx = exp_get_abs (_("need absolute length.\n"), idx, in, &len);
idx = skip_closep (idx, in);
}
if (!had_end && !mri)
- WARNING ((stderr, "END missing from end of file.\n"));
+ WARNING ((stderr, _("END missing from end of file.\n")));
}
sb_new (&tmp);
process_assigns (idx, in, &tmp);
- idx = exp_get_abs (".ASSIGNA needs constant expression argument.\n", 0, &tmp, &val);
+ idx = exp_get_abs (_(".ASSIGNA needs constant expression argument.\n"), 0, &tmp, &val);
if (!label.len)
{
- ERROR ((stderr, ".ASSIGNA without label.\n"));
+ ERROR ((stderr, _(".ASSIGNA without label.\n")));
}
else
{
if (!label.len)
{
- ERROR ((stderr, ".ASSIGNS without label.\n"));
+ ERROR ((stderr, _(".ASSIGNS without label.\n")));
}
else
{
{
if (warn)
{
- WARNING ((stderr, "Can't find preprocessor variable %s.\n", sb_name (&condass_acc)));
+ WARNING ((stderr, _("Can't find preprocessor variable %s.\n"), sb_name (&condass_acc)));
}
else
{
}
if (cond == NEVER)
{
- ERROR ((stderr, "Comparison operator must be one of EQ, NE, LT, LE, GT or GE.\n"));
+ ERROR ((stderr, _("Comparison operator must be one of EQ, NE, LT, LE, GT or GE.\n")));
cond = NEVER;
}
idx = sb_skip_white (idx + 2, in);
if (cond != EQ && cond != NE)
{
- ERROR ((stderr, "Comparison operator for strings must be EQ or NE\n"));
+ ERROR ((stderr, _("Comparison operator for strings must be EQ or NE\n")));
res = 0;
}
else
int vala;
int valb;
int cond;
- idx = exp_get_abs ("Conditional operator must have absolute operands.\n", idx, in, &vala);
+ idx = exp_get_abs (_("Conditional operator must have absolute operands.\n"), idx, in, &vala);
idx = whatcond (idx, in, &cond);
idx = sb_skip_white (idx, in);
if (in->ptr[idx] == '"')
{
- WARNING ((stderr, "String compared against expression.\n"));
+ WARNING ((stderr, _("String compared against expression.\n")));
res = 0;
}
else
{
- idx = exp_get_abs ("Conditional operator must have absolute operands.\n", idx, in, &valb);
+ idx = exp_get_abs (_("Conditional operator must have absolute operands.\n"), idx, in, &valb);
switch (cond)
{
default:
{
if (ifi >= IFNESTING)
{
- FATAL ((stderr, "AIF nesting unreasonable.\n"));
+ FATAL ((stderr, _("AIF nesting unreasonable.\n")));
}
ifi++;
ifstack[ifi].on = ifstack[ifi-1].on ? istrue (idx, in) : 0;
ifstack[ifi].on = ifstack[ifi-1].on ? !ifstack[ifi].on : 0;
if (ifstack[ifi].hadelse)
{
- ERROR ((stderr, "Multiple AELSEs in AIF.\n"));
+ ERROR ((stderr, _("Multiple AELSEs in AIF.\n")));
}
ifstack[ifi].hadelse = 1;
}
}
else
{
- ERROR ((stderr, "AENDI without AIF.\n"));
+ ERROR ((stderr, _("AENDI without AIF.\n")));
}
}
if (ifi >= IFNESTING)
{
- FATAL ((stderr, "IF nesting unreasonable.\n"));
+ FATAL ((stderr, _("IF nesting unreasonable.\n")));
}
- idx = exp_get_abs ("Conditional operator must have absolute operands.\n",
+ idx = exp_get_abs (_("Conditional operator must have absolute operands.\n"),
idx, in, &val);
switch (cond)
{
if (ifi >= IFNESTING)
{
- FATAL ((stderr, "IF nesting unreasonable.\n"));
+ FATAL ((stderr, _("IF nesting unreasonable.\n")));
}
sb_new (&first);
if (idx >= in->len || in->ptr[idx] != ',')
{
- ERROR ((stderr, "Bad format for IF or IFNC.\n"));
+ ERROR ((stderr, _("Bad format for IF or IFNC.\n")));
return;
}
do_aendr ()
{
if (!mri)
- ERROR ((stderr, "AENDR without a AREPEAT.\n"));
+ ERROR ((stderr, _("AENDR without a AREPEAT.\n")));
else
- ERROR ((stderr, "ENDR without a REPT.\n"));
+ ERROR ((stderr, _("ENDR without a REPT.\n")));
}
/* .AWHILE */
doit = istrue (0, &exp);
if (! buffer_and_nest ("AWHILE", "AENDW", &sub, get_line))
- FATAL ((stderr, "AWHILE without a AENDW at %d.\n", line - 1));
+ FATAL ((stderr, _("AWHILE without a AENDW at %d.\n"), line - 1));
/* Turn
.AWHILE exp
static void
do_aendw ()
{
- ERROR ((stderr, "AENDW without a AENDW.\n"));
+ ERROR ((stderr, _("AENDW without a AENDW.\n")));
}
sb_new (©);
sb_new (&sub);
process_assigns (idx, in, &exp);
- idx = exp_get_abs ("AREPEAT must have absolute operand.\n", 0, &exp, &rc);
+ idx = exp_get_abs (_("AREPEAT must have absolute operand.\n"), 0, &exp, &rc);
if (!mri)
ret = buffer_and_nest ("AREPEAT", "AENDR", &sub, get_line);
else
ret = buffer_and_nest ("REPT", "ENDR", &sub, get_line);
if (! ret)
- FATAL ((stderr, "AREPEAT without a AENDR at %d.\n", line - 1));
+ FATAL ((stderr, _("AREPEAT without a AENDR at %d.\n"), line - 1));
if (rc > 0)
{
/* Push back the text following the repeat, and another repeat block
static void
do_endm ()
{
- ERROR ((stderr, ".ENDM without a matching .MACRO.\n"));
+ ERROR ((stderr, _(".ENDM without a matching .MACRO.\n")));
}
/* MRI IRP pseudo-op. */
int idx;
sb *line;
{
- ERROR ((stderr, "LOCAL outside of MACRO"));
+ ERROR ((stderr, _("LOCAL outside of MACRO")));
}
static void
err = define_macro (idx, in, &label, get_line, (const char **) NULL);
if (err != NULL)
- ERROR ((stderr, "macro at line %d: %s\n", line - 1, err));
+ ERROR ((stderr, _("macro at line %d: %s\n"), line - 1, err));
}
static int
ERROR ((stderr, "%s\n", err));
sb_new (&name);
- sb_add_string (&name, "macro expansion");
+ sb_add_string (&name, _("macro expansion"));
include_buf (&name, &out, include_macro, include_next_index ());
else {
int code;
idx++;
- idx = exp_get_abs ("Character code in string must be absolute expression.\n",
+ idx = exp_get_abs (_("Character code in string must be absolute expression.\n"),
idx, in, &code);
sb_add_char (acc, code);
if (in->ptr[idx] != '>')
- ERROR ((stderr, "Missing > for character code.\n"));
+ ERROR ((stderr, _("Missing > for character code.\n")));
idx++;
}
}
{
if (acc.len > 255)
{
- ERROR ((stderr, "string for SDATAC longer than 255 characters (%d).\n", acc.len));
+ ERROR ((stderr, _("string for SDATAC longer than 255 characters (%d).\n"), acc.len));
}
fprintf (outfile, "%d", acc.len);
nc = 1;
if (!alternate && in->ptr[idx] != ',' && idx != in->len)
{
fprintf (outfile, "\n");
- ERROR ((stderr, "illegal character in SDATA line (0x%x).\n", in->ptr[idx]));
+ ERROR ((stderr, _("illegal character in SDATA line (0x%x).\n"), in->ptr[idx]));
break;
}
idx++;
sb acc;
sb_new (&acc);
- idx = exp_get_abs ("Must have absolute SDATAB repeat count.\n", idx, in, &repeat);
+ idx = exp_get_abs (_("Must have absolute SDATAB repeat count.\n"), idx, in, &repeat);
if (repeat <= 0)
{
- ERROR ((stderr, "Must have positive SDATAB repeat count (%d).\n", repeat));
+ ERROR ((stderr, _("Must have positive SDATAB repeat count (%d).\n"), repeat));
repeat = 1;
}
return 0;
if (isp == MAX_INCLUDES)
- FATAL ((stderr, "Unreasonable include depth (%ld).\n", (long) isp));
+ FATAL ((stderr, _("Unreasonable include depth (%ld).\n"), (long) isp));
sp++;
sp->handle = newone;
if (!includes)
{
if (! new_file (sb_name (&t)))
- FATAL ((stderr, "Can't open include file `%s'.\n", sb_name (&t)));
+ FATAL ((stderr, _("Can't open include file `%s'.\n"), sb_name (&t)));
}
sb_kill (&cat);
sb_kill (&t);
static int index;
if (!unreasonable
&& index > MAX_REASONABLE)
- FATAL ((stderr, "Unreasonable expansion (-u turns off check).\n"));
+ FATAL ((stderr, _("Unreasonable expansion (-u turns off check).\n")));
return ++index;
}
#if 0
/* This one causes lots of pain when trying to preprocess
ordinary code */
- WARNING ((stderr, "Unrecognised pseudo op `%s'.\n", sb_name (acc)));
+ WARNING ((stderr, _("Unrecognised pseudo op `%s'.\n"), sb_name (acc)));
#endif
return 0;
}
do_aendi ();
return 1;
case K_ORG:
- ERROR ((stderr, "ORG command not allowed.\n"));
+ ERROR ((stderr, _("ORG command not allowed.\n")));
break;
case K_RADIX:
do_radix (line);
sb_add_char (&value, *string);
string++;
}
- exp_get_abs ("Invalid expression on command line.\n", 0, &value, &res);
+ exp_get_abs (_("Invalid expression on command line.\n"), 0, &value, &res);
sb_kill (&value);
break;
}
FILE *file;
int status;
{
- fprintf (file, "\
+ fprintf (file, _("\
Usage: %s \n\
[-a] [--alternate] enter alternate macro mode\n\
[-c char] [--commentchar char] change the comment character from !\n\
[-h] [--help] print this message\n\
[-M] [--mri] enter MRI compatibility mode\n\
[-o out] [--output out] set the output file\n\
- [-p] [--print] print line numbers\n", program_name);
- fprintf (file, "\
+ [-p] [--print] print line numbers\n"), program_name);
+ fprintf (file, _("\
[-s] [--copysource] copy source through as comments \n\
[-u] [--unreasonable] allow unreasonable nesting\n\
[-v] [--version] print the program version\n\
[-Dname=value] create preprocessor variable called name, with value\n\
[-Ipath] add to include path list\n\
- [in-file]\n");
+ [in-file]\n"));
if (status == 0)
exit (status);
}
static void
show_help ()
{
- printf ("%s: Gnu Assembler Macro Preprocessor\n",
+ printf (_("%s: Gnu Assembler Macro Preprocessor\n"),
program_name);
show_usage (stdout, 0);
}
ifstack[0].on = 1;
ifi = 0;
-
+#ifdef HAVE_SETLOCALE
+ setlocale (LC_MESSAGES, "");
+#endif
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
program_name = argv[0];
xmalloc_set_program_name (program_name);
case 'I':
{
include_path *p = (include_path *) xmalloc (sizeof (include_path));
+ p->next = NULL;
sb_new (&p->path);
sb_add_string (&p->path, optarg);
if (paths_tail)
/*NOTREACHED*/
case 'v':
/* This output is intended to follow the GNU standards document. */
- printf ("GNU assembler pre-processor %s\n", program_version);
- printf ("Copyright 1996 Free Software Foundation, Inc.\n");
- printf ("\
+ printf (_("GNU assembler pre-processor %s\n"), program_version);
+ printf (_("Copyright 1996 Free Software Foundation, Inc.\n"));
+ printf (_("\
This program is free software; you may redistribute it under the terms of\n\
-the GNU General Public License. This program has absolutely no warranty.\n");
+the GNU General Public License. This program has absolutely no warranty.\n"));
exit (0);
/*NOTREACHED*/
case 0:
outfile = fopen (out_name, "w");
if (!outfile)
{
- fprintf (stderr, "%s: Can't open output file `%s'.\n",
+ fprintf (stderr, _("%s: Can't open output file `%s'.\n"),
program_name, out_name);
exit (1);
}
}
else
{
- fprintf (stderr, "%s: Can't open input file `%s'.\n",
+ fprintf (stderr, _("%s: Can't open input file `%s'.\n"),
program_name, argv[optind]);
exit (1);
}
const char *file, *fn;
int line;
{
- fprintf (stderr, "Internal error, aborting at %s line %d", file, line);
+ fprintf (stderr, _("Internal error, aborting at %s line %d"), file, line);
if (fn)
fprintf (stderr, " in %s", fn);
- fprintf (stderr, "\nPlease report this bug.\n");
+ fprintf (stderr, _("\nPlease report this bug.\n"));
exit (1);
}