+2003-02-03 Paul Eggert <eggert@twinsun.com>
+
+ * src/gram.h (start_symbol): Remove unused decl.
+
+ Use more-consistent naming conventions for local vars.
+
+ * src/derives.c (derives_compute): Change type of local var from
+ int to rule_number.
+ * src/gram.c (grammar_rules_partial_print): Likewise.
+ * src/print.c (print_core): Likewise.
+ * src/reduce.c (reduce_grammar_tables): Likewise.
+
+ * src/gram.c (grammar_dump): Change name of item_number *
+ local var from r to rp.
+ * src/nullable.c (nullable_compute): Likewise.
+
+ * src/gram.h (ISTOKEN, ISVAR): Use i, not s, for int var.
+
+ * src/gram.h (symbol_number_as_item_number): Use sym, not s,
+ for symbol or symbol_number var.
+ * src/reader.c (grammar_start_symbol_set): Likewise.
+ * src/reader.h (grammar_start_symbol_set, grammar_symbol_append):
+ Likewise.
+ * src/state.c (transitions_to): Likewise.
+ * src/state.h: Likewise.
+ * src/tables.c (symbol_number_to_vector_number): Likewise.
+
+ * src/muscle_tab.h (MUSCLE_OBSTACK_SGROW): Use p, not s, for
+ char * var.
+
+ * src/parse-gram.y (lloc_default): Use loc, not r, for YYLTYPE
+ var.
+
+ * src/scan-gram.l (no_cr_read): Use bytes_read, not s, for size
+ var.
+
+ * src/system.h (xstrndup, strchr, strspn, strnlen, memchr, memrchr):
+ Use str, not s, for char * var. Use ch, not c, for character var.
+ Use size for size var.
+
+ * src/uniqstr.c (uniqstr_new, uniqstr_assert): Use str, not s, for
+ char * var.
+ (uniqstr_print, uniqst_print_processor): Use ustr, not s, for
+ uniqstr var.
+ * src/uniqstr.h: Likewise.
+
+ * src/vcg.c (get_color_str, get_textmode_str, get_shape_str,
+ get_layoutalgorithm_str, get_decision_str, get_orientation_str,
+ get_node_alignment_str, get_arrow_mode_str, get_crossing_type_str,
+ get_view_str, get_linestyle_str, get_arrowstyle_str): Rename
+ param to have same name as that of enum, so that we don't use
+ "s" to stand for a non-state.
+
2003-02-02 Akim Demaille <akim@epita.fr>
* src/scan-skel.l: Scan more than one inert character per yylex
/* Match rules with nonterminals for bison,
- Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software
+ Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
derives_compute (void)
{
symbol_number i;
- int r;
+ rule_number r;
rule **q;
/* DSET[NTERM - NTOKENS] -- A linked list of the numbers of the rules
/* Allocate input grammar variables for Bison.
- Copyright (C) 1984, 1986, 1989, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1986, 1989, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
grammar_rules_partial_print (FILE *out, const char *title,
rule_filter filter)
{
- int r;
+ rule_number r;
bool first = true;
symbol *previous_lhs = NULL;
for (i = 0; i < nrules + nuseless_productions; i++)
{
rule *rule_i = &rules[i];
- item_number *r = NULL;
+ item_number *rp = NULL;
unsigned int rhs_itemno = rule_i->rhs - ritem;
unsigned int rhs_count = 0;
/* Find the last RHS index in ritems. */
- for (r = rule_i->rhs; *r >= 0; ++r)
+ for (rp = rule_i->rhs; *rp >= 0; ++rp)
++rhs_count;
fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u) %2d ->",
i,
rhs_itemno + rhs_count - 1,
rule_i->lhs->number);
/* Dumped the RHS. */
- for (r = rule_i->rhs; *r >= 0; r++)
- fprintf (out, " %3d", *r);
- fprintf (out, " [%d]\n", item_number_as_rule_number (*r));
+ for (rp = rule_i->rhs; *rp >= 0; rp++)
+ fprintf (out, " %3d", *rp);
+ fprintf (out, " [%d]\n", item_number_as_rule_number (*rp));
}
}
fprintf (out, "\n\n");
/* Muscle table manager for Bison,
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
#define MUSCLE_OBSTACK_SGROW(Obstack, Value) \
{ \
- char const *s; \
- for (s = Value; *s; s++) \
- switch (*s) \
+ char const *p; \
+ for (p = Value; *p; p++) \
+ switch (*p) \
{ \
case '$': obstack_sgrow (Obstack, "$]["); break; \
case '@': obstack_sgrow (Obstack, "@@" ); break; \
case '[': obstack_sgrow (Obstack, "@{" ); break; \
case ']': obstack_sgrow (Obstack, "@}" ); break; \
- default: obstack_1grow (Obstack, *s); break; \
+ default: obstack_1grow (Obstack, *p); break; \
} \
}
/* Calculate which nonterminals can expand into the null string for Bison.
- Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
if (rules_ruleno->rhs[0] >= 0)
{
/* This rule has a non empty RHS. */
- item_number *r = NULL;
+ item_number *rp = NULL;
int any_tokens = 0;
- for (r = rules_ruleno->rhs; *r >= 0; ++r)
- if (ISTOKEN (*r))
+ for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
+ if (ISTOKEN (*rp))
any_tokens = 1;
/* This rule has only nonterminals: schedule it for the second
pass. */
if (!any_tokens)
- for (r = rules_ruleno->rhs; *r >= 0; ++r)
+ for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
{
rcount[ruleno]++;
- p->next = rsets[*r - ntokens];
+ p->next = rsets[*rp - ntokens];
p->value = rules_ruleno;
- rsets[*r - ntokens] = p;
+ rsets[*rp - ntokens] = p;
p++;
}
}
/* Bison Grammar Parser -*- C -*-
- Copyright (C) 2002 Free Software Foundation, Inc.
+
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
lloc_default (YYLTYPE const *rhs, int n)
{
int i;
- YYLTYPE r;
- r.start = r.end = rhs[n].end;
+ YYLTYPE loc;
+ loc.start = loc.end = rhs[n].end;
/* Ignore empty nonterminals the start of the the right-hand side.
Do not bother to ignore them at the end of the right-hand side,
for (i = 1; i <= n; i++)
if (! equal_boundaries (rhs[i].start, rhs[i].end))
{
- r.start = rhs[i].start;
+ loc.start = rhs[i].start;
break;
}
- return r;
+ return loc;
}
/* Print information on generated parser, for bison,
- Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002
+
+ Copyright (C) 1984, 1986, 1989, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
{
item_number *sp;
item_number *sp1;
- int r;
+ rule_number r;
sp1 = sp = ritem + sitems[i];
/* Input parser for Bison
- Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002
+ Copyright (C) 1984, 1986, 1989, 1992, 1998, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
`-----------------------*/
void
-grammar_start_symbol_set (symbol *s, location loc)
+grammar_start_symbol_set (symbol *sym, location loc)
{
if (start_flag)
complain_at (loc, _("multiple %s declarations"), "%start");
else
{
start_flag = 1;
- startsymbol = s;
+ startsymbol = sym;
startsymbol_location = loc;
}
}
/* Input parser for Bison
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
/* From reader.c. */
-void grammar_start_symbol_set (symbol *s, location loc);
+void grammar_start_symbol_set (symbol *sym, location loc);
void prologue_augment (const char *prologue, location loc);
void epilogue_augment (const char *epilogue, location loc);
-void grammar_symbol_append (symbol *s, location loc);
+void grammar_symbol_append (symbol *sym, location loc);
void grammar_rule_begin (symbol *lhs, location loc);
void grammar_rule_end (location loc);
void grammar_midrule_action (void);
/* Grammar reduction for Bison.
- Copyright (C) 1988, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1989, 2000, 2001, 2002, 2003 Free Software
+ Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
/* Adjust NRITEMS. */
{
- int r;
+ rule_number r;
int length;
for (r = nrules; r < nrules + nuseless_productions; ++r)
{
/* Bison Grammar Scanner -*- C -*-
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
static size_t
no_cr_read (FILE *fp, char *buf, size_t size)
{
- size_t s = fread (buf, 1, size, fp);
- if (s)
+ size_t bytes_read = fread (buf, 1, size, fp);
+ if (bytes_read)
{
- char *w = memchr (buf, '\r', s);
+ char *w = memchr (buf, '\r', bytes_read);
if (w)
{
char const *r = ++w;
- char const *lim = buf + s;
+ char const *lim = buf + bytes_read;
for (;;)
{
}
}
- return s;
+ return bytes_read;
}
/* Type definitions for nondeterministic finite state machine for Bison.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
}
-/*-------------------------------------------------------------------.
-| Return the state such these TRANSITIONS contain a shift/goto to it |
-| on S. Abort if none found. |
-`-------------------------------------------------------------------*/
+/*-------------------------------------------------------.
+| Return the state such that SHIFTS contain a shift/goto |
+| to it on SYM. Abort if none found. |
+`-------------------------------------------------------*/
state *
-transitions_to (transitions *shifts, symbol_number s)
+transitions_to (transitions *shifts, symbol_number sym)
{
int j;
for (j = 0; j < shifts->num; j++)
- if (TRANSITION_SYMBOL (shifts, j) == s)
+ if (TRANSITION_SYMBOL (shifts, j) == sym)
return shifts->states[j];
abort ();
}
/* Type definitions for nondeterministic finite state machine for Bison.
- Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software
+ Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
if (!TRANSITION_IS_DISABLED (Transitions, Iter))
-/* Return the state such SHIFTS contain a shift/goto to it on S.
+/* Return the state such SHIFTS contain a shift/goto to it on SYM.
Abort if none found. */
-struct state *transitions_to (transitions *shifts, symbol_number s);
+struct state *transitions_to (transitions *shifts, symbol_number sym);
/*-------.
#define REALLOC(P, N) ((P) = xrealloc (P, (N) * sizeof *(P)))
/* From xstrndup.c. */
-char *xstrndup (const char *s, size_t n);
+char *xstrndup (const char *str, size_t size);
/*---------------------.
#endif
#if defined HAVE_DECL_STRCHR && !HAVE_DECL_STRCHR
-char *strchr (const char *s, int c);
+char *strchr (const char *str, int ch);
#endif
#if defined HAVE_DECL_STRSPN && !HAVE_DECL_STRSPN
-size_t strspn (const char *s, const char *accept);
+size_t strspn (const char *str, const char *accept);
#endif
#if defined HAVE_DECL_STRNLEN && !HAVE_DECL_STRNLEN
-size_t strnlen (const char *s, size_t maxlen);
+size_t strnlen (const char *str, size_t maxlen);
#endif
#if defined HAVE_DECL_MEMCHR && !HAVE_DECL_MEMCHR
-void *memchr (const void *s, int c, size_t n);
+void *memchr (const void *str, int ch, size_t size);
#endif
#if defined HAVE_DECL_MEMRCHR && !HAVE_DECL_MEMRCHR
-void *memrchr (const void *s, int c, size_t n);
+void *memrchr (const void *str, int ch, size_t size);
#endif
/* Output the generated parsing program for Bison.
- Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
+ Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
}
static inline vector_number
-symbol_number_to_vector_number (symbol_number s)
+symbol_number_to_vector_number (symbol_number sym)
{
- return state_number_as_int (nstates) + s - ntokens;
+ return state_number_as_int (nstates) + sym - ntokens;
}
int nvectors;
/* Keep a unique copy of strings.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
`-------------------------------------*/
uniqstr
-uniqstr_new (char const *s)
+uniqstr_new (char const *str)
{
- uniqstr res = hash_lookup (uniqstrs_table, s);
+ uniqstr res = hash_lookup (uniqstrs_table, str);
if (!res)
{
/* First insertion in the hash. */
- res = xstrdup (s);
+ res = xstrdup (str);
hash_insert (uniqstrs_table, res);
}
return res;
`------------------------------*/
void
-uniqstr_assert (char const *s)
+uniqstr_assert (char const *str)
{
- if (!hash_lookup (uniqstrs_table, s))
+ if (!hash_lookup (uniqstrs_table, str))
{
- error (0, 0, "not a uniqstr: %s", quotearg (s));
+ error (0, 0, "not a uniqstr: %s", quotearg (str));
abort ();
}
}
`--------------------*/
static inline bool
-uniqstr_print (uniqstr s)
+uniqstr_print (uniqstr ustr)
{
- fprintf (stderr, "%s\n", s);
+ fprintf (stderr, "%s\n", ustr);
return true;
}
static bool
-uniqstr_print_processor (void *s, void *null ATTRIBUTE_UNUSED)
+uniqstr_print_processor (void *ustr, void *null ATTRIBUTE_UNUSED)
{
- return uniqstr_print (s);
+ return uniqstr_print (ustr);
}
\f
/* Keeping a unique copy of strings.
- Copyright (C) 2002 Free Software Foundation, Inc.
+
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
typedef char const *uniqstr;
-/* Return the uniqstr for S. */
-uniqstr uniqstr_new (char const *s);
+/* Return the uniqstr for STR. */
+uniqstr uniqstr_new (char const *str);
-/* Two uniqstr have the same value iff they are the same. */
-#define UNIQSTR_EQ(S1, S2) ((S1) == (S2))
+/* Two uniqstr values have the same value iff they are the same. */
+#define UNIQSTR_EQ(USTR1, USTR2) ((USTR1) == (USTR2))
/*--------------------------------------.
| Initializing, destroying, debugging. |
/* Create the string table. */
void uniqstrs_new (void);
-/* Die if S is not a uniqstr. */
-void uniqstr_assert (char const *s);
+/* Die if STR is not a uniqstr. */
+void uniqstr_assert (char const *str);
/* Free all the memory allocated for symbols. */
void uniqstrs_free (void);
/* VCG description handler for Bison.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
`----------------------------------------------*/
static const char *
-get_color_str (enum color c)
+get_color_str (enum color color)
{
- switch (c)
+ switch (color)
{
case white: return "white";
case blue: return "blue";
}
static const char *
-get_textmode_str (enum textmode t)
+get_textmode_str (enum textmode textmode)
{
- switch (t)
+ switch (textmode)
{
case centered: return "center";
case left_justify: return "left_justify";
}
static const char *
-get_shape_str (enum shape s)
+get_shape_str (enum shape shape)
{
- switch (s)
+ switch (shape)
{
case box: return "box";
case rhomb: return "rhomb";
}
static const char *
-get_layoutalgorithm_str (enum layoutalgorithm l)
+get_layoutalgorithm_str (enum layoutalgorithm layoutalgorithm)
{
- switch (l)
+ switch (layoutalgorithm)
{
case normal: return "normal";
case maxdepth: return "maxdepth";
}
static const char *
-get_decision_str (enum decision d)
+get_decision_str (enum decision decision)
{
- switch (d)
+ switch (decision)
{
case no: return "no";
case yes: return "yes";
}
static const char *
-get_orientation_str (enum orientation o)
+get_orientation_str (enum orientation orientation)
{
- switch (o)
+ switch (orientation)
{
case top_to_bottom: return "top_to_bottom";
case bottom_to_top: return "bottom_to_top";
}
static const char *
-get_node_alignment_str (enum alignment a)
+get_node_alignment_str (enum alignment alignment)
{
- switch (a)
+ switch (alignment)
{
case center: return "center";
case top: return "top";
}
static const char *
-get_arrow_mode_str (enum arrow_mode a)
+get_arrow_mode_str (enum arrow_mode arrow_mode)
{
- switch (a)
+ switch (arrow_mode)
{
case fixed: return "fixed";
case free_a: return "free";
}
static const char *
-get_crossing_type_str (enum crossing_type c)
+get_crossing_type_str (enum crossing_type crossing_type)
{
- switch (c)
+ switch (crossing_type)
{
case bary: return "bary";
case median: return "median";
}
static const char *
-get_view_str (enum view v)
+get_view_str (enum view view)
{
- switch (v)
+ switch (view)
{
case normal_view: return "normal_view";
case cfish: return "cfish";
}
static const char *
-get_linestyle_str (enum linestyle l)
+get_linestyle_str (enum linestyle linestyle)
{
- switch (l)
+ switch (linestyle)
{
case continuous: return "continuous";
case dashed: return "dashed";
}
static const char *
-get_arrowstyle_str (enum arrowstyle a)
+get_arrowstyle_str (enum arrowstyle arrowstyle)
{
- switch (a)
+ switch (arrowstyle)
{
case solid: return "solid";
case line: return "line";