NOTE: gettextize now needs to be run before building.
svn path=/trunk/yasm/; revision=153
config.*
stamp-h*
aclocal.m4
+intl
+ABOUT-NLS
-SUBDIRS = src
+SUBDIRS = intl src po
EXTRA_DIST = config/install-sh config/missing config/mkinstalldirs
-/* $Id: acconfig.h,v 1.1 2001/08/19 04:25:18 peter Exp $ */
+/* $Id: acconfig.h,v 1.2 2001/08/30 03:45:16 peter Exp $ */
#ifndef YASM_CONFIG_H
#define YASM_CONFIG_H
/* Workaround for bad <sys/queue.h> implementations. */
#undef HAVE_BOGUS_SYS_QUEUE_H
+/* gettext tests */
+#undef ENABLE_NLS
+#undef HAVE_CATGETS
+#undef HAVE_GETTEXT
+#undef HAVE_LC_MESSAGES
+#undef HAVE_STPCPY
+
@BOTTOM@
#endif /* YASM_CONFIG_H */
--- /dev/null
+# $Id: acinclude.m4,v 1.1 2001/08/30 03:45:16 peter Exp $
+
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it. Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+# configure.in:##: AC_TRY_COMPILE was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN([AC_ISC_POSIX],
+ [
+ dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+ AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+ ]
+)
+
AM_PROG_CC_STDC
+ALL_LINGUAS=""
+AM_GNU_GETTEXT
+
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_INSTALL
;;
esac
-AC_OUTPUT(Makefile src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/outfmts/Makefile src/outfmts/dbg/Makefile)
+AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/outfmts/Makefile src/outfmts/dbg/Makefile)
AM_PROG_CC_STDC
+ALL_LINGUAS=""
+AM_GNU_GETTEXT
+
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_INSTALL
;;
esac
-AC_OUTPUT(Makefile src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/outfmts/Makefile src/outfmts/dbg/Makefile)
+AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile src/parsers/Makefile src/parsers/nasm/Makefile src/preprocs/Makefile src/preprocs/raw/Makefile src/outfmts/Makefile src/outfmts/dbg/Makefile)
-/* $Id: bytecode.c,v 1.19 2001/08/19 07:46:52 peter Exp $
+/* $Id: bytecode.c,v 1.20 2001/08/30 03:45:26 peter Exp $
* Bytecode utility functions
*
* Copyright (C) 2001 Peter Johnson
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "expr.h"
#include "bytecode.h"
-RCSID("$Id: bytecode.c,v 1.19 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: bytecode.c,v 1.20 2001/08/30 03:45:26 peter Exp $");
/* Static structures for when NULL is passed to conversion functions. */
/* for Convert*ToEA() */
ptr->disp = im_ptr->val;
if (im_ptr->len > im_len)
- Warning(WARN_VALUE_EXCEEDS_BOUNDS, (char *)NULL, "word");
+ Warning(_("%s value exceeds bounds"), "word");
ptr->len = im_len;
ptr->segment = 0;
ptr->valid_modrm = 0;
return;
if (ptr->segment != 0)
- Warning(WARN_MULT_SEG_OVERRIDE, (char *)NULL);
+ Warning(_("multiple segment overrides, using leftmost"));
ptr->segment = segment;
}
break;
default:
InternalError(__LINE__, __FILE__,
- "OperSize override applied to non-instruction");
+ _("OperSize override applied to non-instruction"));
return;
}
}
break;
default:
InternalError(__LINE__, __FILE__,
- "AddrSize override applied to non-instruction");
+ _("AddrSize override applied to non-instruction"));
return;
}
}
break;
default:
InternalError(__LINE__, __FILE__,
- "LockRep prefix applied to non-instruction");
+ _("LockRep prefix applied to non-instruction"));
return;
}
if (*lockrep_pre != 0)
- Warning(WARN_MULT_LOCKREP_PREFIX, (char *)NULL);
+ Warning(_("multiple LOCK or REP prefixes, using leftmost"));
*lockrep_pre = prefix;
}
return;
if ((*old_sel == JR_SHORT_FORCED) || (*old_sel == JR_NEAR_FORCED))
- Warning(WARN_MULT_SHORTNEAR, (char *)NULL);
+ Warning(_("multiple SHORT or NEAR specifiers, using leftmost"));
*old_sel = new_sel;
}
bc->data.jmprel.op_sel = target->op_sel;
if ((target->op_sel == JR_SHORT_FORCED) && (!short_valid))
- Error(ERR_NO_JMPREL_FORM, (char *)NULL, "SHORT");
+ Error(_("no SHORT form of that jump instruction exists"));
if ((target->op_sel == JR_NEAR_FORCED) && (!near_valid))
- Error(ERR_NO_JMPREL_FORM, (char *)NULL, "NEAR");
+ Error(_("no NEAR form of that jump instruction exists"));
bc->data.jmprel.shortop.valid = short_valid;
if (short_valid) {
break;
case DV_FLOAT:
if (size == 1)
- Error(ERR_DECLDATA_FLOAT, (char *)NULL, "DB");
+ Error(_("floating-point constant encountered in `%s'"),
+ "DB");
else if (size == 2)
- Error(ERR_DECLDATA_FLOAT, (char *)NULL, "DW");
+ Error(_("floating-point constant encountered in `%s'"),
+ "DW");
break;
case DV_EXPR:
if (size == 10)
- Error(ERR_DECLDATA_EXPR, (char *)NULL, "DT");
+ Error(_("non-floating-point value encountered in `%s'"),
+ "DT");
break;
}
}
-/* $Id: errwarn.c,v 1.22 2001/08/19 07:46:52 peter Exp $
+/* $Id: errwarn.c,v 1.23 2001/08/30 03:45:26 peter Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+
#include "globals.h"
#include "errwarn.h"
-RCSID("$Id: errwarn.c,v 1.22 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: errwarn.c,v 1.23 2001/08/30 03:45:26 peter Exp $");
/* Total error count for entire assembler run.
* Assembler should exit with EXIT_FAILURE if this is >= 0 on finish. */
/* Fatal error messages. Match up with fatal_num enum in errwarn.h. */
static char *fatal_msgs[] = {
- "unknown",
- "out of memory"
-};
-
-/* Error messages. Match up with err_num enum in errwarn.h. */
-static char *err_msgs[] = {
- "",
- "parser error: %s",
- "missing '%1'",
- "missing argument to %s",
- "invalid argument to %s",
- "invalid effective address",
- "label or instruction expected at start of line",
- "expression syntax error",
- "duplicate definition of `%1'; previously defined line %2",
- "mismatch in operand sizes",
- "no %s form of that jump instruction exists",
- "unterminated string",
- "unexpected end of file in string",
- "expression syntax error",
- "floating-point constant encountered in `%s'",
- "non-floating-point value encountered in `%s'",
- "could not open file `%s'",
- "error when reading from file"
-};
-
-/* Warning messages. Match up with warn_num enum in errwarn.h. */
-static char *warn_msgs[] = {
- "",
- "ignoring unrecognized character '%s'",
- "%s value exceeds bounds",
- "multiple segment overrides, using leftmost",
- "multiple LOCK or REP prefixes, using leftmost",
- "no non-local label before '%s'",
- "multiple SHORT or NEAR specifiers, using leftmost",
- "character constant too large, ignoring trailing characters"
+ N_("unknown"),
+ N_("out of memory")
};
/* I hate to define these strings as static buffers; a better solution would be
/* Last warning message string. Set by Warning(), read by OutputWarning(). */
static char last_warn[1024];
-/* Last error number. Set by Error(), read and reset by OutputError(). */
-static err_num last_err_num = ERR_NONE;
+/* Has there been an error since the last time we output one? Set by Error(),
+ * read and reset by OutputError(). */
+static int new_error = 0;
+
+/* Is the last error a parser error? Error() lets other errors override parser
+ * errors. Set by yyerror(), read and reset by Error(). */
+static int parser_error = 0;
-/* Last warning number. Set by Warning(), read and reset by
- * OutputWarning(). */
-static warn_num last_warn_num = WARN_NONE;
+/* Has there been a warning since the last time we output one? Set by
+ * Warning(), read and reset by OutputWarning(). */
+static int new_warning = 0;
/* Static buffer for use by conv_unprint(). */
static char unprint[5];
/* Parser error handler. Moves error into our error handling system. */
void
-yyerror(char *s)
+ParserError(char *s)
{
- Error(ERR_PARSER, (char *)NULL, s);
+ Error("%s %s", _("parser error:"), s);
+ parser_error = 1;
}
/* Report an internal error. Essentially a fatal error with trace info.
void
InternalError(unsigned int line, char *file, char *message)
{
- fprintf(stderr, "INTERNAL ERROR at %s, line %d: %s\n", file, line,
+ fprintf(stderr, _("INTERNAL ERROR at %s, line %d: %s\n"), file, line,
message);
exit(EXIT_FAILURE);
}
void
Fatal(fatal_num num)
{
- fprintf(stderr, "FATAL: %s\n", fatal_msgs[num]);
+ fprintf(stderr, "%s %s\n", _("FATAL:"), gettext(fatal_msgs[num]));
exit(EXIT_FAILURE);
}
-/* Argument replacement function for use in error messages.
- * Replaces %1, %2, etc in src with %c, %s, etc. in argtypes.
- * Currently limits maximum number of args to 9 (%1-%9).
- *
- * We need this because messages that take multiple arguments become dependent
- * on the order and type of the arguments passed to Error()/Warning().
- *
- * i.e. an error string "'%d' is not a valid specifier for '%s'" would require
- * that the arguments passed to Error() always be an int and a char *, in that
- * order. If the string was changed to be "'%s': invalid specifier '%d'", all
- * the times Error() was called for that string would need to be changed to
- * reorder the arguments. Or if the %d was not right in some circumstances,
- * we'd have to add another string for that type.
- *
- * This function fixes this problem by allowing the string to be specified as
- * "'%1' is not a valid specifier for '%2'" and then specifying at the time of
- * the Error() call what the types of %1 and %2 are by passing a argtype string
- * "%d%s" (to emulate the first behavior). If the string was changed to be
- * "'%2': invalid specifier '%1'", no change would need to be made to the
- * Error calls using that string. And as the type is specified with the
- * argument list, mismatches are far less likely.
- *
- * For strings that only have one argument of a fixed type, it can be directly
- * specified and NULL passed for the argtypes parameter when Error() is
- * called. */
-static char *
-process_argtypes(char *src, char *argtypes)
-{
- char *dest;
- char *argtype[9];
- int at_num;
- char *destp, *srcp, *argtypep;
-
- if (argtypes) {
- dest = malloc(strlen(src) + strlen(argtypes));
- if (!dest)
- Fatal(FATAL_NOMEM);
- /* split argtypes by % */
- at_num = 0;
- while ((argtypes = strchr(argtypes, '%')) && at_num < 9)
- argtype[at_num++] = ++argtypes;
- /* search through src for %, copying as we go */
- destp = dest;
- srcp = src;
- while (*srcp != '\0') {
- *(destp++) = *srcp;
- if (*(srcp++) == '%') {
- if (isdigit(*srcp)) {
- /* %1, %2, etc */
- argtypep = argtype[*srcp - '1'];
- while ((*argtypep != '%') && (*argtypep != '\0'))
- *(destp++) = *(argtypep++);
- } else
- *(destp++) = *srcp;
- srcp++;
- }
- }
- } else {
- dest = strdup(src);
- if (!dest)
- Fatal(FATAL_NOMEM);
- }
- return dest;
-}
-
/* Register an error. Uses argtypes as described above to specify the
* argument types. Does not print the error, only stores it for
* OutputError() to print. */
void
-Error(err_num num, char *argtypes, ...)
+Error(char *fmt, ...)
{
va_list ap;
- char *printf_str;
- if ((last_err_num != ERR_NONE) && (last_err_num != ERR_PARSER))
+ if (new_error && !parser_error)
return;
- last_err_num = num;
+ new_error = 1;
+ parser_error = 0;
- printf_str = process_argtypes(err_msgs[num], argtypes);
-
- va_start(ap, argtypes);
- vsprintf(last_err, printf_str, ap);
+ va_start(ap, fmt);
+ vsprintf(last_err, fmt, ap);
va_end(ap);
- free(printf_str);
-
error_count++;
}
* argument types. Does not print the warning, only stores it for
* OutputWarning() to print. */
void
-Warning(warn_num num, char *argtypes, ...)
+Warning(char *fmt, ...)
{
va_list ap;
- char *printf_str;
- if (last_warn_num != WARN_NONE)
+ if (new_warning)
return;
- last_warn_num = num;
+ new_warning = 1;
- printf_str = process_argtypes(warn_msgs[num], argtypes);
-
- va_start(ap, argtypes);
- vsprintf(last_warn, printf_str, ap);
+ va_start(ap, fmt);
+ vsprintf(last_warn, fmt, ap);
va_end(ap);
- free(printf_str);
-
warning_count++;
}
void
OutputError(void)
{
- if (last_err_num != ERR_NONE)
+ if (new_error)
fprintf(stderr, "%s:%u: %s\n", filename, line_number, last_err);
- last_err_num = ERR_NONE;
+ new_error = 0;
}
/* Output a previously stored warning (if any) to stderr. */
void
OutputWarning(void)
{
- if (last_warn_num != WARN_NONE)
- fprintf(stderr, "%s:%u: warning: %s\n", filename, line_number,
- last_warn);
- last_warn_num = WARN_NONE;
+ if (new_warning)
+ fprintf(stderr, "%s:%u: %s %s\n", filename, line_number,
+ _("warning:"), last_warn);
+ new_warning = 0;
}
-/* $Id: errwarn.h,v 1.13 2001/08/18 23:05:37 peter Exp $
+/* $Id: errwarn.h,v 1.14 2001/08/30 03:45:26 peter Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
#ifndef YASM_ERRWARN_H
#define YASM_ERRWARN_H
-/* See errwarn.c for strings that match up to these constants.
+/* Fatal error constants.
+ * See fatal_msgs in errwarn.c for strings that match up to these constants.
* When adding a constant here, keep errwarn.c in sync! */
-
-/* Fatal error constants. Match up with fatal_msgs in errwarn.c. */
typedef enum {
FATAL_UNKNOWN = 0,
FATAL_NOMEM
} fatal_num;
-/* Error constants. Match up with err_msgs in errwarn.c. */
-/* FIXME: These shouldn't be ERR_* because they'll violate namespace
- * constraints if errno.h is included. */
-typedef enum {
- ERR_NONE = 0,
- ERR_PARSER,
- ERR_MISSING,
- ERR_MISSING_ARG,
- ERR_INVALID_ARG,
- ERR_INVALID_EA,
- ERR_INVALID_LINE,
- ERR_EXP_SYNTAX,
- ERR_DUPLICATE_DEF,
- ERR_OP_SIZE_MISMATCH,
- ERR_NO_JMPREL_FORM,
- ERR_STRING_UNTERM,
- ERR_STRING_EOF,
- ERR_EXPR_SYNTAX,
- ERR_DECLDATA_FLOAT,
- ERR_DECLDATA_EXPR,
- ERR_FILE_OPEN,
- ERR_FILE_READ
-} err_num;
-
-/* Warning constants. Match up with warn_msgs in errwarn.c. */
-typedef enum {
- WARN_NONE = 0,
- WARN_UNREC_CHAR,
- WARN_VALUE_EXCEEDS_BOUNDS,
- WARN_MULT_SEG_OVERRIDE,
- WARN_MULT_LOCKREP_PREFIX,
- WARN_NO_BASE_LABEL,
- WARN_MULT_SHORTNEAR,
- WARN_CHAR_CONST_TOO_BIG
-} warn_num;
-
char *conv_unprint(char ch);
+void ParserError(char *);
+
void InternalError(unsigned int line, char *file, char *message);
void Fatal(fatal_num);
-void Error(err_num, char *, ...);
-void Warning(warn_num, char *, ...);
+void Error(char *, ...);
+void Warning(char *, ...);
void OutputError(void);
void OutputWarning(void);
-/* $Id: symrec.c,v 1.8 2001/08/19 07:46:52 peter Exp $
+/* $Id: symrec.c,v 1.9 2001/08/30 03:45:26 peter Exp $
* Symbol table handling
*
* Copyright (C) 2001 Michael Urman
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "symrec.h"
-RCSID("$Id: symrec.c,v 1.8 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: symrec.c,v 1.9 2001/08/30 03:45:26 peter Exp $");
/* private functions */
static symtab *symtab_get(char *);
tab = symtab_get_or_new(name, type);
if (tab->rec.status & SYM_DECLARED)
- Error(ERR_DUPLICATE_DEF, "%s%d", tab->rec.name, tab->rec.line);
+ Error(_("duplicate definition of `%s'; previously defined on line %d"),
+ tab->rec.name, tab->rec.line);
tab->rec.status |= SYM_DECLARED;
return &(tab->rec);
}
liboutfmt_a_SOURCES = \
outfmt.c
-INCLUDES=-I$(top_srcdir)/src
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/intl
if DEV
CFLAGS = -ansi -pedantic -Wall -g
AM_YFLAGS = -d --name-prefix=nasm_parser_
AM_LFLAGS = -Pnasm_parser_ -olex.yy.c
-INCLUDES=-I$(top_srcdir)/src
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/intl
if DEV
CFLAGS = -ansi -pedantic -Wall -g
-/* $Id: bison.y.in,v 1.27 2001/08/19 07:46:52 peter Exp $
+/* $Id: bison.y.in,v 1.28 2001/08/30 03:45:26 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
# include <math.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "expr.h"
#include "bytecode.h"
-RCSID("$Id: bison.y.in,v 1.27 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: bison.y.in,v 1.28 2001/08/30 03:45:26 peter Exp $");
#define YYDEBUG 1
void init_table(void);
extern int nasm_parser_lex(void);
-extern void yyerror(char *);
static unsigned long ConvertCharConstToInt(char *);
void nasm_parser_error(char *);
| exp '\n' { DebugPrintBC(&$1); $$ = $1; }
| directive '\n' { $$.type = BC_EMPTY; }
| error '\n' {
- Error(ERR_INVALID_LINE, (char *)NULL);
+ Error(_("label or instruction expected at start of line"));
$$.type = BC_EMPTY;
yyerrok;
}
| FLTNUM { $$ = dataval_new_float($1); }
| STRING { $$ = dataval_new_string($1); }
| error {
- Error(ERR_EXPR_SYNTAX, (char *)NULL);
+ Error(_("expression syntax error"));
$$ = (dataval *)NULL;
}
;
printf("Directive: Name='%s' Value='%s'\n", $2, $3);
}
| '[' DIRECTIVE_NAME DIRECTIVE_VAL error {
- Error(ERR_MISSING, "%c", ']');
+ Error(_("missing `%c'"), ']');
}
| '[' DIRECTIVE_NAME error {
- Error(ERR_MISSING_ARG, (char *)NULL, $2);
+ Error(_("missing argument to `%s'"), $2);
}
;
size_t len = strlen(cc);
if(len > 4)
- Warning(WARN_CHAR_CONST_TOO_BIG, (char *)NULL);
+ Warning(_("character constant too large, ignoring trailing characters"));
switch(len) {
case 4:
void
nasm_parser_error(char *s)
{
- yyerror(s);
+ ParserError(s);
}
#!/usr/bin/perl -w
-# $Id: gen_instr.pl,v 1.18 2001/07/11 04:07:11 peter Exp $
+# $Id: gen_instr.pl,v 1.19 2001/08/30 03:45:26 peter Exp $
# Generates bison.y and token.l from instrs.dat for YASM
#
# Copyright (C) 2001 Michael Urman
# print error action
# ASSUMES: at least one previous action exists
print GRAMMAR " | \Ugrp_$group\E error {\n";
- print GRAMMAR " Error (ERR_EXP_SYNTAX, (char *)NULL);\n";
+ print GRAMMAR " Error (_(\"expression syntax error\"));\n";
print GRAMMAR " }\n";
# terminate the rule
-/* $Id: nasm-bison.y,v 1.27 2001/08/19 07:46:52 peter Exp $
+/* $Id: nasm-bison.y,v 1.28 2001/08/30 03:45:26 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
# include <math.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "expr.h"
#include "bytecode.h"
-RCSID("$Id: nasm-bison.y,v 1.27 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: nasm-bison.y,v 1.28 2001/08/30 03:45:26 peter Exp $");
#define YYDEBUG 1
void init_table(void);
extern int nasm_parser_lex(void);
-extern void yyerror(char *);
static unsigned long ConvertCharConstToInt(char *);
void nasm_parser_error(char *);
| exp '\n' { DebugPrintBC(&$1); $$ = $1; }
| directive '\n' { $$.type = BC_EMPTY; }
| error '\n' {
- Error(ERR_INVALID_LINE, (char *)NULL);
+ Error(_("label or instruction expected at start of line"));
$$.type = BC_EMPTY;
yyerrok;
}
| FLTNUM { $$ = dataval_new_float($1); }
| STRING { $$ = dataval_new_string($1); }
| error {
- Error(ERR_EXPR_SYNTAX, (char *)NULL);
+ Error(_("expression syntax error"));
$$ = (dataval *)NULL;
}
;
printf("Directive: Name='%s' Value='%s'\n", $2, $3);
}
| '[' DIRECTIVE_NAME DIRECTIVE_VAL error {
- Error(ERR_MISSING, "%c", ']');
+ Error(_("missing `%c'"), ']');
}
| '[' DIRECTIVE_NAME error {
- Error(ERR_MISSING_ARG, (char *)NULL, $2);
+ Error(_("missing argument to `%s'"), $2);
}
;
size_t len = strlen(cc);
if(len > 4)
- Warning(WARN_CHAR_CONST_TOO_BIG, (char *)NULL);
+ Warning(_("character constant too large, ignoring trailing characters"));
switch(len) {
case 4:
void
nasm_parser_error(char *s)
{
- yyerror(s);
+ ParserError(s);
}
-/* $Id: token.l.in,v 1.15 2001/08/19 07:46:52 peter Exp $
+/* $Id: token.l.in,v 1.16 2001/08/30 03:45:26 peter Exp $
* Main lexer
*
* Copyright (C) 2001 Peter Johnson
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "errwarn.h"
#include "expr.h"
#include "symrec.h"
#include "bison.h"
-RCSID("$Id: token.l.in,v 1.15 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: token.l.in,v 1.16 2001/08/30 03:45:26 peter Exp $");
#define yylval nasm_parser_lval
}
if(inch == '\n')
- Error(ERR_STRING_UNTERM, (char *)NULL);
+ Error(_("unterminated string"));
else if(inch == EOF)
- Error(ERR_STRING_EOF, (char *)NULL);
+ Error(_("unexpected end of file in string"));
strbuf[count] = '\0';
return DIRECTIVE_VAL;
}
<DIRECTIVE>. {
- Warning(WARN_UNREC_CHAR, (char *)NULL, conv_unprint(yytext[0]));
+ Warning(_("ignoring unrecognized character `%s'"),
+ conv_unprint(yytext[0]));
}
<DIRECTIVE2>. {
- Warning(WARN_UNREC_CHAR, (char *)NULL, conv_unprint(yytext[0]));
+ Warning(_("ignoring unrecognized character `%s'"),
+ conv_unprint(yytext[0]));
}
/* size specifiers */
\.[a-z0-9_$#@~?][a-z0-9_$#@~.?]* {
if (locallabel_base == NULL)
{
- Warning (WARN_NO_BASE_LABEL, (char *)NULL, yytext);
+ Warning (_("no non-local label before `%s'"), yytext);
yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
}
\n return '\n';
-. { Warning(WARN_UNREC_CHAR, (char *)NULL, conv_unprint(yytext[0])); }
+. {
+ Warning(_("ignoring unrecognized character `%s'"),
+ conv_unprint(yytext[0]));
+}
libpreproc_a_SOURCES = \
preproc.c
-INCLUDES=-I$(top_srcdir)/src
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/intl
if DEV
CFLAGS = -ansi -pedantic -Wall -g
-/* $Id: preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $
+/* $Id: preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
#include <stdio.h>
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "errwarn.h"
#include "outfmt.h"
#include "preproc.h"
-RCSID("$Id: preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $");
static int is_interactive;
static FILE *in;
if (c == '\n')
buf[n++] = (char)c;
if (c == EOF && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
} else if (((n = fread(buf, 1, max_size, in)) == 0) && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
return n;
}
-/* $Id: raw-preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $
+/* $Id: raw-preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
#include <stdio.h>
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "errwarn.h"
#include "outfmt.h"
#include "preproc.h"
-RCSID("$Id: raw-preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: raw-preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $");
static int is_interactive;
static FILE *in;
if (c == '\n')
buf[n++] = (char)c;
if (c == EOF && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
} else if (((n = fread(buf, 1, max_size, in)) == 0) && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
return n;
}
--- /dev/null
+Makefile
+Makefile.in
+Makefile.in.in
+POTFILES
+cat-id-tbl.c
+yasm.pot
+stamp-cat-id
--- /dev/null
+# List of source files containing translatable strings.
+# Copyright (c) 2001 Peter Johnson
+#
+# $Id: POTFILES.in,v 1.1 2001/08/30 03:45:16 peter Exp $
+
+src/errwarn.c
+src/bytecode.c
+src/symrec.c
+src/parsers/nasm/bison.c
+src/parsers/nasm/token.c
+src/preprocs/raw/preproc.c
SUBDIRS = parsers preprocs outfmts
+INCLUDES = -I$(top_srcdir)/intl
+
bin_PROGRAMS = yasm
yasm_SOURCES = \
yasm_LDADD = \
parsers/nasm/libparser.a \
preprocs/raw/libpreproc.a \
- outfmts/dbg/liboutfmt.a
+ outfmts/dbg/liboutfmt.a \
+ $(INTLLIBS)
if DEV
CFLAGS = -ansi -pedantic -Wall -g
-/* $Id: bytecode.c,v 1.19 2001/08/19 07:46:52 peter Exp $
+/* $Id: bytecode.c,v 1.20 2001/08/30 03:45:26 peter Exp $
* Bytecode utility functions
*
* Copyright (C) 2001 Peter Johnson
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "expr.h"
#include "bytecode.h"
-RCSID("$Id: bytecode.c,v 1.19 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: bytecode.c,v 1.20 2001/08/30 03:45:26 peter Exp $");
/* Static structures for when NULL is passed to conversion functions. */
/* for Convert*ToEA() */
ptr->disp = im_ptr->val;
if (im_ptr->len > im_len)
- Warning(WARN_VALUE_EXCEEDS_BOUNDS, (char *)NULL, "word");
+ Warning(_("%s value exceeds bounds"), "word");
ptr->len = im_len;
ptr->segment = 0;
ptr->valid_modrm = 0;
return;
if (ptr->segment != 0)
- Warning(WARN_MULT_SEG_OVERRIDE, (char *)NULL);
+ Warning(_("multiple segment overrides, using leftmost"));
ptr->segment = segment;
}
break;
default:
InternalError(__LINE__, __FILE__,
- "OperSize override applied to non-instruction");
+ _("OperSize override applied to non-instruction"));
return;
}
}
break;
default:
InternalError(__LINE__, __FILE__,
- "AddrSize override applied to non-instruction");
+ _("AddrSize override applied to non-instruction"));
return;
}
}
break;
default:
InternalError(__LINE__, __FILE__,
- "LockRep prefix applied to non-instruction");
+ _("LockRep prefix applied to non-instruction"));
return;
}
if (*lockrep_pre != 0)
- Warning(WARN_MULT_LOCKREP_PREFIX, (char *)NULL);
+ Warning(_("multiple LOCK or REP prefixes, using leftmost"));
*lockrep_pre = prefix;
}
return;
if ((*old_sel == JR_SHORT_FORCED) || (*old_sel == JR_NEAR_FORCED))
- Warning(WARN_MULT_SHORTNEAR, (char *)NULL);
+ Warning(_("multiple SHORT or NEAR specifiers, using leftmost"));
*old_sel = new_sel;
}
bc->data.jmprel.op_sel = target->op_sel;
if ((target->op_sel == JR_SHORT_FORCED) && (!short_valid))
- Error(ERR_NO_JMPREL_FORM, (char *)NULL, "SHORT");
+ Error(_("no SHORT form of that jump instruction exists"));
if ((target->op_sel == JR_NEAR_FORCED) && (!near_valid))
- Error(ERR_NO_JMPREL_FORM, (char *)NULL, "NEAR");
+ Error(_("no NEAR form of that jump instruction exists"));
bc->data.jmprel.shortop.valid = short_valid;
if (short_valid) {
break;
case DV_FLOAT:
if (size == 1)
- Error(ERR_DECLDATA_FLOAT, (char *)NULL, "DB");
+ Error(_("floating-point constant encountered in `%s'"),
+ "DB");
else if (size == 2)
- Error(ERR_DECLDATA_FLOAT, (char *)NULL, "DW");
+ Error(_("floating-point constant encountered in `%s'"),
+ "DW");
break;
case DV_EXPR:
if (size == 10)
- Error(ERR_DECLDATA_EXPR, (char *)NULL, "DT");
+ Error(_("non-floating-point value encountered in `%s'"),
+ "DT");
break;
}
}
-/* $Id: errwarn.c,v 1.22 2001/08/19 07:46:52 peter Exp $
+/* $Id: errwarn.c,v 1.23 2001/08/30 03:45:26 peter Exp $
* Error and warning reporting and related functions.
*
* Copyright (C) 2001 Peter Johnson
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+
#include "globals.h"
#include "errwarn.h"
-RCSID("$Id: errwarn.c,v 1.22 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: errwarn.c,v 1.23 2001/08/30 03:45:26 peter Exp $");
/* Total error count for entire assembler run.
* Assembler should exit with EXIT_FAILURE if this is >= 0 on finish. */
/* Fatal error messages. Match up with fatal_num enum in errwarn.h. */
static char *fatal_msgs[] = {
- "unknown",
- "out of memory"
-};
-
-/* Error messages. Match up with err_num enum in errwarn.h. */
-static char *err_msgs[] = {
- "",
- "parser error: %s",
- "missing '%1'",
- "missing argument to %s",
- "invalid argument to %s",
- "invalid effective address",
- "label or instruction expected at start of line",
- "expression syntax error",
- "duplicate definition of `%1'; previously defined line %2",
- "mismatch in operand sizes",
- "no %s form of that jump instruction exists",
- "unterminated string",
- "unexpected end of file in string",
- "expression syntax error",
- "floating-point constant encountered in `%s'",
- "non-floating-point value encountered in `%s'",
- "could not open file `%s'",
- "error when reading from file"
-};
-
-/* Warning messages. Match up with warn_num enum in errwarn.h. */
-static char *warn_msgs[] = {
- "",
- "ignoring unrecognized character '%s'",
- "%s value exceeds bounds",
- "multiple segment overrides, using leftmost",
- "multiple LOCK or REP prefixes, using leftmost",
- "no non-local label before '%s'",
- "multiple SHORT or NEAR specifiers, using leftmost",
- "character constant too large, ignoring trailing characters"
+ N_("unknown"),
+ N_("out of memory")
};
/* I hate to define these strings as static buffers; a better solution would be
/* Last warning message string. Set by Warning(), read by OutputWarning(). */
static char last_warn[1024];
-/* Last error number. Set by Error(), read and reset by OutputError(). */
-static err_num last_err_num = ERR_NONE;
+/* Has there been an error since the last time we output one? Set by Error(),
+ * read and reset by OutputError(). */
+static int new_error = 0;
+
+/* Is the last error a parser error? Error() lets other errors override parser
+ * errors. Set by yyerror(), read and reset by Error(). */
+static int parser_error = 0;
-/* Last warning number. Set by Warning(), read and reset by
- * OutputWarning(). */
-static warn_num last_warn_num = WARN_NONE;
+/* Has there been a warning since the last time we output one? Set by
+ * Warning(), read and reset by OutputWarning(). */
+static int new_warning = 0;
/* Static buffer for use by conv_unprint(). */
static char unprint[5];
/* Parser error handler. Moves error into our error handling system. */
void
-yyerror(char *s)
+ParserError(char *s)
{
- Error(ERR_PARSER, (char *)NULL, s);
+ Error("%s %s", _("parser error:"), s);
+ parser_error = 1;
}
/* Report an internal error. Essentially a fatal error with trace info.
void
InternalError(unsigned int line, char *file, char *message)
{
- fprintf(stderr, "INTERNAL ERROR at %s, line %d: %s\n", file, line,
+ fprintf(stderr, _("INTERNAL ERROR at %s, line %d: %s\n"), file, line,
message);
exit(EXIT_FAILURE);
}
void
Fatal(fatal_num num)
{
- fprintf(stderr, "FATAL: %s\n", fatal_msgs[num]);
+ fprintf(stderr, "%s %s\n", _("FATAL:"), gettext(fatal_msgs[num]));
exit(EXIT_FAILURE);
}
-/* Argument replacement function for use in error messages.
- * Replaces %1, %2, etc in src with %c, %s, etc. in argtypes.
- * Currently limits maximum number of args to 9 (%1-%9).
- *
- * We need this because messages that take multiple arguments become dependent
- * on the order and type of the arguments passed to Error()/Warning().
- *
- * i.e. an error string "'%d' is not a valid specifier for '%s'" would require
- * that the arguments passed to Error() always be an int and a char *, in that
- * order. If the string was changed to be "'%s': invalid specifier '%d'", all
- * the times Error() was called for that string would need to be changed to
- * reorder the arguments. Or if the %d was not right in some circumstances,
- * we'd have to add another string for that type.
- *
- * This function fixes this problem by allowing the string to be specified as
- * "'%1' is not a valid specifier for '%2'" and then specifying at the time of
- * the Error() call what the types of %1 and %2 are by passing a argtype string
- * "%d%s" (to emulate the first behavior). If the string was changed to be
- * "'%2': invalid specifier '%1'", no change would need to be made to the
- * Error calls using that string. And as the type is specified with the
- * argument list, mismatches are far less likely.
- *
- * For strings that only have one argument of a fixed type, it can be directly
- * specified and NULL passed for the argtypes parameter when Error() is
- * called. */
-static char *
-process_argtypes(char *src, char *argtypes)
-{
- char *dest;
- char *argtype[9];
- int at_num;
- char *destp, *srcp, *argtypep;
-
- if (argtypes) {
- dest = malloc(strlen(src) + strlen(argtypes));
- if (!dest)
- Fatal(FATAL_NOMEM);
- /* split argtypes by % */
- at_num = 0;
- while ((argtypes = strchr(argtypes, '%')) && at_num < 9)
- argtype[at_num++] = ++argtypes;
- /* search through src for %, copying as we go */
- destp = dest;
- srcp = src;
- while (*srcp != '\0') {
- *(destp++) = *srcp;
- if (*(srcp++) == '%') {
- if (isdigit(*srcp)) {
- /* %1, %2, etc */
- argtypep = argtype[*srcp - '1'];
- while ((*argtypep != '%') && (*argtypep != '\0'))
- *(destp++) = *(argtypep++);
- } else
- *(destp++) = *srcp;
- srcp++;
- }
- }
- } else {
- dest = strdup(src);
- if (!dest)
- Fatal(FATAL_NOMEM);
- }
- return dest;
-}
-
/* Register an error. Uses argtypes as described above to specify the
* argument types. Does not print the error, only stores it for
* OutputError() to print. */
void
-Error(err_num num, char *argtypes, ...)
+Error(char *fmt, ...)
{
va_list ap;
- char *printf_str;
- if ((last_err_num != ERR_NONE) && (last_err_num != ERR_PARSER))
+ if (new_error && !parser_error)
return;
- last_err_num = num;
+ new_error = 1;
+ parser_error = 0;
- printf_str = process_argtypes(err_msgs[num], argtypes);
-
- va_start(ap, argtypes);
- vsprintf(last_err, printf_str, ap);
+ va_start(ap, fmt);
+ vsprintf(last_err, fmt, ap);
va_end(ap);
- free(printf_str);
-
error_count++;
}
* argument types. Does not print the warning, only stores it for
* OutputWarning() to print. */
void
-Warning(warn_num num, char *argtypes, ...)
+Warning(char *fmt, ...)
{
va_list ap;
- char *printf_str;
- if (last_warn_num != WARN_NONE)
+ if (new_warning)
return;
- last_warn_num = num;
+ new_warning = 1;
- printf_str = process_argtypes(warn_msgs[num], argtypes);
-
- va_start(ap, argtypes);
- vsprintf(last_warn, printf_str, ap);
+ va_start(ap, fmt);
+ vsprintf(last_warn, fmt, ap);
va_end(ap);
- free(printf_str);
-
warning_count++;
}
void
OutputError(void)
{
- if (last_err_num != ERR_NONE)
+ if (new_error)
fprintf(stderr, "%s:%u: %s\n", filename, line_number, last_err);
- last_err_num = ERR_NONE;
+ new_error = 0;
}
/* Output a previously stored warning (if any) to stderr. */
void
OutputWarning(void)
{
- if (last_warn_num != WARN_NONE)
- fprintf(stderr, "%s:%u: warning: %s\n", filename, line_number,
- last_warn);
- last_warn_num = WARN_NONE;
+ if (new_warning)
+ fprintf(stderr, "%s:%u: %s %s\n", filename, line_number,
+ _("warning:"), last_warn);
+ new_warning = 0;
}
-/* $Id: errwarn.h,v 1.13 2001/08/18 23:05:37 peter Exp $
+/* $Id: errwarn.h,v 1.14 2001/08/30 03:45:26 peter Exp $
* Error and warning reporting and related functions header file.
*
* Copyright (C) 2001 Peter Johnson
#ifndef YASM_ERRWARN_H
#define YASM_ERRWARN_H
-/* See errwarn.c for strings that match up to these constants.
+/* Fatal error constants.
+ * See fatal_msgs in errwarn.c for strings that match up to these constants.
* When adding a constant here, keep errwarn.c in sync! */
-
-/* Fatal error constants. Match up with fatal_msgs in errwarn.c. */
typedef enum {
FATAL_UNKNOWN = 0,
FATAL_NOMEM
} fatal_num;
-/* Error constants. Match up with err_msgs in errwarn.c. */
-/* FIXME: These shouldn't be ERR_* because they'll violate namespace
- * constraints if errno.h is included. */
-typedef enum {
- ERR_NONE = 0,
- ERR_PARSER,
- ERR_MISSING,
- ERR_MISSING_ARG,
- ERR_INVALID_ARG,
- ERR_INVALID_EA,
- ERR_INVALID_LINE,
- ERR_EXP_SYNTAX,
- ERR_DUPLICATE_DEF,
- ERR_OP_SIZE_MISMATCH,
- ERR_NO_JMPREL_FORM,
- ERR_STRING_UNTERM,
- ERR_STRING_EOF,
- ERR_EXPR_SYNTAX,
- ERR_DECLDATA_FLOAT,
- ERR_DECLDATA_EXPR,
- ERR_FILE_OPEN,
- ERR_FILE_READ
-} err_num;
-
-/* Warning constants. Match up with warn_msgs in errwarn.c. */
-typedef enum {
- WARN_NONE = 0,
- WARN_UNREC_CHAR,
- WARN_VALUE_EXCEEDS_BOUNDS,
- WARN_MULT_SEG_OVERRIDE,
- WARN_MULT_LOCKREP_PREFIX,
- WARN_NO_BASE_LABEL,
- WARN_MULT_SHORTNEAR,
- WARN_CHAR_CONST_TOO_BIG
-} warn_num;
-
char *conv_unprint(char ch);
+void ParserError(char *);
+
void InternalError(unsigned int line, char *file, char *message);
void Fatal(fatal_num);
-void Error(err_num, char *, ...);
-void Warning(warn_num, char *, ...);
+void Error(char *, ...);
+void Warning(char *, ...);
void OutputError(void);
void OutputWarning(void);
liboutfmt_a_SOURCES = \
outfmt.c
-INCLUDES=-I$(top_srcdir)/src
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/intl
if DEV
CFLAGS = -ansi -pedantic -Wall -g
AM_YFLAGS = -d --name-prefix=nasm_parser_
AM_LFLAGS = -Pnasm_parser_ -olex.yy.c
-INCLUDES=-I$(top_srcdir)/src
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/intl
if DEV
CFLAGS = -ansi -pedantic -Wall -g
-/* $Id: bison.y.in,v 1.27 2001/08/19 07:46:52 peter Exp $
+/* $Id: bison.y.in,v 1.28 2001/08/30 03:45:26 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
# include <math.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "expr.h"
#include "bytecode.h"
-RCSID("$Id: bison.y.in,v 1.27 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: bison.y.in,v 1.28 2001/08/30 03:45:26 peter Exp $");
#define YYDEBUG 1
void init_table(void);
extern int nasm_parser_lex(void);
-extern void yyerror(char *);
static unsigned long ConvertCharConstToInt(char *);
void nasm_parser_error(char *);
| exp '\n' { DebugPrintBC(&$1); $$ = $1; }
| directive '\n' { $$.type = BC_EMPTY; }
| error '\n' {
- Error(ERR_INVALID_LINE, (char *)NULL);
+ Error(_("label or instruction expected at start of line"));
$$.type = BC_EMPTY;
yyerrok;
}
| FLTNUM { $$ = dataval_new_float($1); }
| STRING { $$ = dataval_new_string($1); }
| error {
- Error(ERR_EXPR_SYNTAX, (char *)NULL);
+ Error(_("expression syntax error"));
$$ = (dataval *)NULL;
}
;
printf("Directive: Name='%s' Value='%s'\n", $2, $3);
}
| '[' DIRECTIVE_NAME DIRECTIVE_VAL error {
- Error(ERR_MISSING, "%c", ']');
+ Error(_("missing `%c'"), ']');
}
| '[' DIRECTIVE_NAME error {
- Error(ERR_MISSING_ARG, (char *)NULL, $2);
+ Error(_("missing argument to `%s'"), $2);
}
;
size_t len = strlen(cc);
if(len > 4)
- Warning(WARN_CHAR_CONST_TOO_BIG, (char *)NULL);
+ Warning(_("character constant too large, ignoring trailing characters"));
switch(len) {
case 4:
void
nasm_parser_error(char *s)
{
- yyerror(s);
+ ParserError(s);
}
#!/usr/bin/perl -w
-# $Id: gen_instr.pl,v 1.18 2001/07/11 04:07:11 peter Exp $
+# $Id: gen_instr.pl,v 1.19 2001/08/30 03:45:26 peter Exp $
# Generates bison.y and token.l from instrs.dat for YASM
#
# Copyright (C) 2001 Michael Urman
# print error action
# ASSUMES: at least one previous action exists
print GRAMMAR " | \Ugrp_$group\E error {\n";
- print GRAMMAR " Error (ERR_EXP_SYNTAX, (char *)NULL);\n";
+ print GRAMMAR " Error (_(\"expression syntax error\"));\n";
print GRAMMAR " }\n";
# terminate the rule
-/* $Id: nasm-bison.y,v 1.27 2001/08/19 07:46:52 peter Exp $
+/* $Id: nasm-bison.y,v 1.28 2001/08/30 03:45:26 peter Exp $
* Main bison parser
*
* Copyright (C) 2001 Peter Johnson, Michael Urman
# include <math.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "expr.h"
#include "bytecode.h"
-RCSID("$Id: nasm-bison.y,v 1.27 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: nasm-bison.y,v 1.28 2001/08/30 03:45:26 peter Exp $");
#define YYDEBUG 1
void init_table(void);
extern int nasm_parser_lex(void);
-extern void yyerror(char *);
static unsigned long ConvertCharConstToInt(char *);
void nasm_parser_error(char *);
| exp '\n' { DebugPrintBC(&$1); $$ = $1; }
| directive '\n' { $$.type = BC_EMPTY; }
| error '\n' {
- Error(ERR_INVALID_LINE, (char *)NULL);
+ Error(_("label or instruction expected at start of line"));
$$.type = BC_EMPTY;
yyerrok;
}
| FLTNUM { $$ = dataval_new_float($1); }
| STRING { $$ = dataval_new_string($1); }
| error {
- Error(ERR_EXPR_SYNTAX, (char *)NULL);
+ Error(_("expression syntax error"));
$$ = (dataval *)NULL;
}
;
printf("Directive: Name='%s' Value='%s'\n", $2, $3);
}
| '[' DIRECTIVE_NAME DIRECTIVE_VAL error {
- Error(ERR_MISSING, "%c", ']');
+ Error(_("missing `%c'"), ']');
}
| '[' DIRECTIVE_NAME error {
- Error(ERR_MISSING_ARG, (char *)NULL, $2);
+ Error(_("missing argument to `%s'"), $2);
}
;
size_t len = strlen(cc);
if(len > 4)
- Warning(WARN_CHAR_CONST_TOO_BIG, (char *)NULL);
+ Warning(_("character constant too large, ignoring trailing characters"));
switch(len) {
case 4:
void
nasm_parser_error(char *s)
{
- yyerror(s);
+ ParserError(s);
}
-/* $Id: token.l.in,v 1.15 2001/08/19 07:46:52 peter Exp $
+/* $Id: token.l.in,v 1.16 2001/08/30 03:45:26 peter Exp $
* Main lexer
*
* Copyright (C) 2001 Peter Johnson
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "errwarn.h"
#include "expr.h"
#include "symrec.h"
#include "bison.h"
-RCSID("$Id: token.l.in,v 1.15 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: token.l.in,v 1.16 2001/08/30 03:45:26 peter Exp $");
#define yylval nasm_parser_lval
}
if(inch == '\n')
- Error(ERR_STRING_UNTERM, (char *)NULL);
+ Error(_("unterminated string"));
else if(inch == EOF)
- Error(ERR_STRING_EOF, (char *)NULL);
+ Error(_("unexpected end of file in string"));
strbuf[count] = '\0';
return DIRECTIVE_VAL;
}
<DIRECTIVE>. {
- Warning(WARN_UNREC_CHAR, (char *)NULL, conv_unprint(yytext[0]));
+ Warning(_("ignoring unrecognized character `%s'"),
+ conv_unprint(yytext[0]));
}
<DIRECTIVE2>. {
- Warning(WARN_UNREC_CHAR, (char *)NULL, conv_unprint(yytext[0]));
+ Warning(_("ignoring unrecognized character `%s'"),
+ conv_unprint(yytext[0]));
}
/* size specifiers */
\.[a-z0-9_$#@~?][a-z0-9_$#@~.?]* {
if (locallabel_base == NULL)
{
- Warning (WARN_NO_BASE_LABEL, (char *)NULL, yytext);
+ Warning (_("no non-local label before `%s'"), yytext);
yylval.syminfo.name = strdup (yytext);
if (yylval.syminfo.name == NULL) Fatal (FATAL_NOMEM);
}
\n return '\n';
-. { Warning(WARN_UNREC_CHAR, (char *)NULL, conv_unprint(yytext[0])); }
+. {
+ Warning(_("ignoring unrecognized character `%s'"),
+ conv_unprint(yytext[0]));
+}
libpreproc_a_SOURCES = \
preproc.c
-INCLUDES=-I$(top_srcdir)/src
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/intl
if DEV
CFLAGS = -ansi -pedantic -Wall -g
-/* $Id: preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $
+/* $Id: preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
#include <stdio.h>
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "errwarn.h"
#include "outfmt.h"
#include "preproc.h"
-RCSID("$Id: preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $");
static int is_interactive;
static FILE *in;
if (c == '\n')
buf[n++] = (char)c;
if (c == EOF && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
} else if (((n = fread(buf, 1, max_size, in)) == 0) && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
return n;
}
-/* $Id: raw-preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $
+/* $Id: raw-preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $
* Raw preprocessor (preforms NO preprocessing)
*
* Copyright (C) 2001 Peter Johnson
#include <stdio.h>
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "errwarn.h"
#include "outfmt.h"
#include "preproc.h"
-RCSID("$Id: raw-preproc.c,v 1.5 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: raw-preproc.c,v 1.6 2001/08/30 03:45:26 peter Exp $");
static int is_interactive;
static FILE *in;
if (c == '\n')
buf[n++] = (char)c;
if (c == EOF && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
} else if (((n = fread(buf, 1, max_size, in)) == 0) && ferror(in))
- Error(ERR_FILE_READ, (char *)NULL);
+ Error(_("error when reading from file"));
return n;
}
-/* $Id: symrec.c,v 1.8 2001/08/19 07:46:52 peter Exp $
+/* $Id: symrec.c,v 1.9 2001/08/30 03:45:26 peter Exp $
* Symbol table handling
*
* Copyright (C) 2001 Michael Urman
# include <string.h>
#endif
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include "globals.h"
#include "errwarn.h"
#include "symrec.h"
-RCSID("$Id: symrec.c,v 1.8 2001/08/19 07:46:52 peter Exp $");
+RCSID("$Id: symrec.c,v 1.9 2001/08/30 03:45:26 peter Exp $");
/* private functions */
static symtab *symtab_get(char *);
tab = symtab_get_or_new(name, type);
if (tab->rec.status & SYM_DECLARED)
- Error(ERR_DUPLICATE_DEF, "%s%d", tab->rec.name, tab->rec.line);
+ Error(_("duplicate definition of `%s'; previously defined on line %d"),
+ tab->rec.name, tab->rec.line);
tab->rec.status |= SYM_DECLARED;
return &(tab->rec);
}