* lib/quote.h, lib/quote.c, lib/quotearg.h, lib/quotearg.c:

* m4/prereq.m4, m4/c-bs-a.m4, m4/mbstate.m4:
New files, from Fileutils 4.0.27.
* src/main.c (printable_version): Remove.
* src/lex.c, src/reader.c: Use `quote'.


* lib/error.c, lib/error.h: New files, needed by xmalloc.c.
This commit is contained in:
Akim Demaille
2000-10-16 17:28:41 +00:00
parent 14ded68250
commit ff4a34be27
26 changed files with 1795 additions and 489 deletions

View File

@@ -27,9 +27,7 @@
#include "xalloc.h"
#include "complain.h"
#include "gram.h"
/* functions from main.c */
extern char *printable_version PARAMS ((int));
#include "quote.h"
/* Buffer for storing the current token. */
char *token_buffer;
@@ -238,8 +236,10 @@ literalchar (char **pp, int *pcode, char term)
}
else
{
char buf [] = "c";
buf[0] = c;
complain (_("unknown escape sequence: `\\' followed by `%s'"),
printable_version (c));
quote (buf));
code = '?';
}
} /* has \ */

View File

@@ -39,8 +39,6 @@ char *program_name;
extern void berror PARAMS((const char *));
extern char *printable_version PARAMS ((int));
int
main (int argc, char *argv[])
{
@@ -98,23 +96,6 @@ main (int argc, char *argv[])
exit (complain_message_count ? 1 : 0);
}
/* Return a string containing a printable version of C:
either C itself, or the corresponding \DDD code. */
char *
printable_version (int c)
{
static char buf[10];
if (c < ' ' || c >= '\177')
sprintf (buf, "\\%o", c);
else
{
buf[0] = c;
buf[1] = '\0';
}
return buf;
}
/* Abort for an internal error denoted by string S. */
void

View File

@@ -31,8 +31,7 @@
#include "output.h"
#include "reader.h"
#include "conflicts.h"
extern char *printable_version PARAMS ((int));
#include "quote.h"
/* Number of slots allocated (but not necessarily used yet) in `rline' */
static int rline_allocated;
@@ -266,7 +265,11 @@ copy_at (FILE *fin, FILE *fout, int stack_offset)
locations_flag = 1;
}
else
complain (_("@%s is invalid"), printable_version (c));
{
char buf[] = "@c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
}
/*-------------------------------------------------------------------.
@@ -702,7 +705,7 @@ static void
parse_expect_decl (void)
{
int c;
int count;
size_t count;
char buffer[20];
c = getc (finput);
@@ -898,7 +901,9 @@ read_declarations (void)
fatal (_("no input grammar"));
else
{
complain (_("unknown character: %s"), printable_version (c));
char buf[] = "c";
buf[0] = c;
complain (_("unknown character: %s"), quote (buf));
skip_to_char ('%');
}
}
@@ -1010,7 +1015,11 @@ copy_action (symbol_list * rule, int stack_offset)
continue;
}
else
complain (_("$%s is invalid"), printable_version (c));
{
char buf[] = "$c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
break;
@@ -1159,7 +1168,11 @@ copy_guard (symbol_list * rule, int stack_offset)
continue;
}
else
complain (_("$%s is invalid"), printable_version (c));
{
char buf[] = "$c";
buf[1] = c;
complain (_("%s is invalid"), quote (buf));
}
break;
case '@':
@@ -1296,9 +1309,11 @@ readgram (void)
symbol_list *p1;
bucket *bp;
symbol_list *crule; /* points to first symbol_list of current rule. */
/* its symbol is the lhs of the rule. */
symbol_list *crule1; /* points to the symbol_list preceding crule. */
/* Points to first symbol_list of current rule. its symbol is the
lhs of the rule. */
symbol_list *crule;
/* Points to the symbol_list preceding crule. */
symbol_list *crule1;
p1 = NULL;
@@ -1309,7 +1324,8 @@ readgram (void)
if (t == IDENTIFIER || t == BAR)
{
int action_flag = 0;
int rulelength = 0; /* number of symbols in rhs of this rule so far */
/* Number of symbols in rhs of this rule so far */
int rulelength = 0;
int xactions = 0; /* JF for error checking */
bucket *first_rhs = 0;
@@ -1473,9 +1489,7 @@ readgram (void)
if (t == GUARD)
{
if (!semantic_parser)
complain ("%s",
_
("%guard present but %semantic_parser not specified"));
complain (_("%%guard present but %%semantic_parser not specified"));
copy_guard (crule, rulelength);
t = lex ();
@@ -1561,7 +1575,8 @@ readgram (void)
if (nrules == 0)
fatal (_("no rules in the input grammar"));
if (typed == 0 /* JF put out same default YYSTYPE as YACC does */
/* JF put out same default YYSTYPE as YACC does */
if (typed == 0
&& !value_components_used)
{
/* We used to use `unsigned long' as YYSTYPE on MSDOS,
@@ -1579,7 +1594,7 @@ readgram (void)
{
complain (_
("symbol %s is used, but is not defined as a token and has no rules"),
bp->tag);
bp->tag);
bp->class = nterm_sym;
bp->value = nvars++;
}

View File

@@ -23,3 +23,28 @@
void RTC PARAMS ((unsigned *, int));
#endif /* !WARSHALL_H_ */
/* Generate transitive closure of a matrix,
Copyright (C) 1984, 1989, 2000 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
Bison is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
Bison is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bison; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef WARSHALL_H_
# define WARSHALL_H_
void RTC PARAMS ((unsigned *, int));
#endif /* !WARSHALL_H_ */