bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: Merging 1.29 into the trunk


From: Akim Demaille
Subject: FYI: Merging 1.29 into the trunk
Date: 04 Oct 2001 17:05:10 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

>From now on, every commit in 1.29 should be duplicated here.

There are a few failures, but I think they will be easy to fix.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.222
diff -u -w -r1.222 ChangeLog
--- ChangeLog   2001/09/25 11:36:25     1.222
+++ ChangeLog   2001/10/04 14:53:13
@@ -1,3 +1,451 @@
+2001-10-04  Akim Demaille  <address@hidden>
+
+       Merge in the branch 1.29.
+
+       * src/reader.c (packsymbols): Use a temporary obstack for
+       `%%tokendef', since output_stack is already used elsewhere.
+
+       2001-10-02  Akim Demaille  <address@hidden>
+
+       Bump 1.29d.
+
+       2001-10-02  Akim Demaille  <address@hidden>
+
+       Version 1.29c.
+
+       2001-10-02  Akim Demaille  <address@hidden>
+
+       * tests/regression.at (Invalid CPP headers): New.
+       From Alexander Belopolsky.
+       * src/files.c (compute_header_macro): Map non alnum chars to `_'.
+
+       2001-10-02  Akim Demaille  <address@hidden>
+
+       * tests/regression.at (Invalid input): New.
+       * src/lex.c (lex): Be sure to set `token_buffer' in any case.
+       Reported by Shura.
+
+       2001-10-02  Akim Demaille  <address@hidden>
+
+       * tests/calc.at: Now that --debug works, the tests must be adjusted.
+
+       2001-10-02  Akim Demaille  <address@hidden>
+
+       * src/output.c (output_parser): Assert `skeleton'.
+       * src/files.c (skeleton_find): Look harder for skeletons on DOSish
+       systems.
+       From Shura.
+
+       2001-10-01  Marc Autret  <address@hidden>
+
+       * src/lex.h: Echo modifications.
+       * src/lex.c (unlex): Parameter is now token_t.
+       From Hans Aberg.
+
+       2001-10-01  Marc Autret  <address@hidden>
+
+       * src/main.c: Include lex.h.
+       From Hans Aberg.
+
+       2001-09-29  Akim Demaille  <address@hidden>
+
+       * src/getargs.c (longopts): `--debug' is `-t', not `-d'.
+
+       2001-09-28  Akim Demaille  <address@hidden>
+
+       * tests/testsuite.at: Update to newer Autotest.
+       * tests/Makefile.am (EXTRA_DIST): bison is not to be shipped.
+
+       2001-09-27  Akim Demaille  <address@hidden>
+
+       Position independent wrapper.
+
+       * tests/bison: Remove.
+       * tests/bison.in: New.
+       * configure.in: Adjust.
+
+       2001-09-27  Paul Eggert  <address@hidden>
+
+       Port quotearg fixes from tar 1.13.24.
+
+       * lib/quotearg.c: BSD/OS 4.1 wchar.h requires FILE and struct
+       tm to be declared.
+       (HAVE_MBSINIT): Undef if !HAVE_MBRTOWC.
+       (mbsinit): Define to 1 if !defined mbsinit && !HAVE_MBSINIT.
+
+       * m4/Makefile.am (EXTRA_DIST): Add mbrtowc.m4.
+       * m4/mbrtowc.m4: New file.
+       * m4/prereq.m4 (jm_PREREQ_QUOTEARG): Check for mbsinit and stddef.h.
+       Use jm_FUNC_MBRTOWC instead of AC_CHECK_FUNCS(mbrtowc).
+
+       2001-09-27  Akim Demaille  <address@hidden>
+
+       Bump to 1.29c.
+
+       2001-09-27  Akim Demaille  <address@hidden>
+
+       Version 1.29b.
+
+       2001-09-25  Akim Demaille  <address@hidden>
+
+       * src/system.h: Include `xalloc.h'.
+       Remove it from the C files.
+       * src/files.c (output_files): Free the obstacks.
+       * src/lex.c (init_lex): Rename as...
+       (lex_init): this.
+       (lex_free): New.
+       * src/main.c (main): Use it.
+
+       2001-09-24  Marc Autret  <address@hidden>
+
+       * src/vcg.c (open_edge, close_edge, open_node, close_node): Change
+       to output informations in fout (FILE*).
+       (open_graph, close_graph): Likewise.
+       (output_graph, output_edge, output_node): Likewise.
+       * src/vcg.h: Update function prototypes.
+       * src/print_graph.c (print_graph): Open output graph file.
+       (print_actions): Adjust.
+       * src/files.h: Remove extern declaration.
+       * src/files.c: Remove graph_obstack declaration.
+       (open_files): Remove graph_obstack initialization.
+       (output_files): Remove graph_obstack saving.
+
+       2001-09-24  Marc Autret  <address@hidden>
+
+       * src/files.c (compute_output_file_names): Fix.
+
+       2001-09-24  Marc Autret  <address@hidden>,
+                   Akim Demaille  <address@hidden>
+
+       * src/reader.c (reader): Remove call to free_symtab ().
+       * src/main.c (main): Call it here.
+       Include symtab.h.
+       * src/conflicts.c (initialize_conflicts): Rename as...
+       (solve_conflicts): this.
+       * src/print.c (print_core, print_actions, print_state)
+       (print_grammar): Dump to a file instead a `output_obstack'.
+       (print_results): Dump `output_obstack', and then proceed with the
+       FILE *.
+       * src/files.c (compute_output_file_names, close_files): New.
+       (output_files): Adjust.
+       * src/main.c (main): Adjust.
+
+       2001-09-23  Marc Autret  <address@hidden>
+
+       * src/files.c (compute_header_macro): Computes header macro name
+       from spec_defines_file when given.
+
+       2001-09-23  Marc Autret  <address@hidden>
+
+       * src/files.c (output_files): Add default extensions.
+
+       2001-09-22  Akim Demaille  <address@hidden>
+
+       * src/conflicts.c (finalize_conflicts): Rename as...
+       (free_conflicts): this.
+
+       2001-09-22  Akim Demaille  <address@hidden>
+
+       * src/gram.c (gram_free): Rename back as...
+       (dummy): this.
+       (output_token_translations): Free `token_translations'.
+       * src/symtab.c (free_symtab): Free the tag field.
+
+       2001-09-22  Akim Demaille  <address@hidden>
+
+       Remove `translations' as it is always set to true.
+
+       * src/gram.h: Adjust.
+       * src/reader.c (packsymbols, parse_token_decl): Adjust
+       * src/print.c (print_grammar): Adjust.
+       * src/output.c (output_token_translations): Adjust.
+       * src/lex.c (lex): Adjust.
+       * src/gram.c: Be sure the set pointers to NULL.
+       (dummy): Rename as...
+       (gram_free): this.
+
+       2001-09-22  Akim Demaille  <address@hidden>
+
+       * configure.in: Invoke AM_LIB_DMALLOC.
+       * src/system.h: Use dmalloc.
+       * src/LR0.c: Be sure to have pointers initialized to NULL.
+       (allocate_itemsets): Allocate kernel_items only if needed.
+
+       2001-09-22  Akim Demaille  <address@hidden>
+
+       * configure.in: Bump to 1.29b.
+       * tests/Makefile.am (DISTCLEANFILES): Add package.m4.
+       * tests/calc.at (_AT_DATA_CALC_Y): #undef malloc so that we don't
+       need xmalloc.c in calc.y.
+       From Pascal Bart.
+
+       2001-09-21  Akim Demaille  <address@hidden>
+
+       Version 1.29a.
+       * Makefile.maint, config/config.guess, config/config.sub,
+       * config/missing: Update from masters.
+       * tests/Makefile.am ($(srcdir)/$(TESTSUITE)): No longer depend
+       upon package.m4.
+       * configure.in (ALL_LINGUAS): Add `tr'.
+
+       2001-09-21  Akim Demaille  <address@hidden>
+
+       * tests/Makefile.am (package.m4): Move to...
+       ($(srcdir)/$(TESTSUITE)): here.
+
+       2001-09-20  Akim Demaille  <address@hidden>
+
+       * src/complain.c: No longer try to be standalone: use system.h.
+       Don't assume __STDC__ is defined to 1. Just test if it is defined.
+       * src/complain.h: Likewise.
+       * src/reduce.c (useless_nonterminals, inaccessable_symbols):
+       Remove the unused variable `n'.
+       From Albert Chin-A-Young.
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       * doc/bison.1: Update.
+       * doc/bison.texinfo (Bison Options): Update --defines and --graph
+       descriptions.
+       (Option Cross Key): Update.
+       Add --graph.
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       * tests/regression.at: New test (comment in %union).
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       * src/reader.c (parse_union_decl): Do not output '/'. Let copy_comment
+       do that.
+       Reported by Keith Browne.
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       * tests/output.at: Add tests for --defines and --graph.
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       * tests/output.at: Removes tests of %{header,src}_extension features.
+
+       2001-09-18  Akim Demaille  <address@hidden>
+
+       * tests/Makefile.am (package.m4): New.
+       * tests/calc.at (_AT_CHECK_CALC): Just run `calc input'.
+       (_AT_CHECK_CALC_ERROR): Likewise.
+       Factor the `, ' part of verbose error messages.
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       * src/getargs.c (longopts): Declare --defines and --graph as options
+       with optional arguments.
+       * src/files.h: Add extern declarations.
+       * src/files.c (spec_graph_file, spec_defines_file): New.
+       (output_files): Update.
+       Remove CPP-outed code.
+
+       2001-09-18  Marc Autret  <address@hidden>
+
+       Turn off %{source,header}_extension feature.
+
+       * src/files.c (compute_exts_from_gf): Update.
+       (compute_exts_from_src): Update.
+       (output_files): CPP-out useless code.
+       * src/files.h: Remove {header,source}_extension extern declarations.
+       * src/reader.c (parse_dquoted_param): CPP-out.
+       (parse_header_extension_decl): Remove.
+       (parse_source_extension_decl): Remove.
+       (read_declarations): Remove cases tok_{hdrext,srcext}.
+       * src/lex.c (percent_table): Remove {header,source}_extension entries.
+       * src/lex.h (token_t): Remove tok_hdrext and tok_srcext.
+
+       2001-09-10  Akim Demaille  <address@hidden>
+
+       * tests/output.at (AT_CHECK_BISON_FLAGS, AT_CHECK_BISON_PERCENT):
+       (AT_CHECK_BISON_PERCENT_FLAGS): Merge into...
+       (AT_CHECK_OUTPUT): this.
+       Merely check ls' exit status, its output is useless.
+
+       2001-09-10  Akim Demaille  <address@hidden>
+
+       * tests/calc.at: Use m4_match.
+       (_AT_DATA_CALC_Y): Check `yyin != NULL', not `stdin != NULL'.
+
+       2001-09-10  Marc Autret  <address@hidden>,
+                   Akim Demaille  <address@hidden>
+
+       * src/vcg.h (graph_s): color, textcolor, bordercolor are now
+       enum color_e.
+       * src/print_graph.c (print_graph): Initalize graph.layoutalgorithm
+       to `normal'.
+       * src/reader.c (parse_token_decl): Initialize token with tok_eof.
+       * src/lex.h: Adjust prototype.
+       (token_t): Add `tok_undef'.
+       * src/lex.c (struct percent_table_struct): Retval is now a token_t.
+       (parse_percent_token): Now returns token_t.
+       Add default statement in switch.
+       (lex): Separate `c' as an input variable, from the token_t result
+       part.
+       (unlexed): Is a token_t.
+
+       2001-09-10  Akim Demaille  <address@hidden>
+
+       * configure.in: Bump to 1.29a.
+
+       2001-09-07  Akim Demaille  <address@hidden>
+
+       Version 1.29.
+
+       2001-08-30  Akim Demaille  <address@hidden>
+
+       * tests/atgeneral.m4, tests/atconfig.in, tests/suite.at: Remove.
+       * m4/atconfig.m4: Remove.
+       * tests/testsuite.at, tests/atlocal.in, tests/output.at,
+       * tests/bison: New.
+       * tests/regression.at, tests/calc.at: Use m4_define, AT_BANNER,
+       m4_if, m4_patsubst, and m4_regexp.
+       * tests/calc.at (_AT_CHECK_CALC, _AT_CHECK_CALC_ERROR): Use an
+       `input' file instead of echo.
+
+       2001-08-29  Akim Demaille  <address@hidden>
+
+       Bump to 1.28e.
+
+       2001-08-29  Akim Demaille  <address@hidden>
+
+       Version 1.28d.
+
+       2001-08-29  Paul Eggert  <address@hidden>
+
+       * src/bison.simple (yyparse): Don't take the address of an
+       item before the start of an array, as that doesn't conform to
+       the C Standard.
+
+       2001-08-29  Robert Anisko  <address@hidden>
+
+       * doc/bison.texinfo (Location Tracking Calc): New node.
+
+       2001-08-29  Paul Eggert  <address@hidden>
+
+       * src/output.c (output): Do not define const, as this now
+       causes more problems than it cures.
+
+       2001-08-29  Akim Demaille  <address@hidden>
+
+       * doc/bison.texinfo: Modernize address@hidden' and address@hidden' use: 
just name
+       the nodes.
+       Be sure to tag the `detailmenu'.
+
+       2001-08-29  Akim Demaille  <address@hidden>
+
+       * Makefile.maint (do-po-update): Wget refuses to overwrite files:
+       download in a tmp dir.
+
+       2001-08-28  Marc Autret  <address@hidden>
+
+       * config/depcomp: New file.
+
+       2001-08-28  Marc Autret  <address@hidden>
+
+       * doc/bison.1 (mandoc): Adjust.
+       From Juan Manuel Guerrero.
+
+       2001-08-28  Marc Autret  <address@hidden>
+
+       * src/print_graph.c (print_state): Fix.
+
+       2001-08-27  Marc Autret  <address@hidden>
+
+       * src/vcg.h (classname_s, infoname_s, node_s): Constify the
+       char * members.
+       Echo modifications to the functions prototypes.
+       * src/vcg.c (add_classname, add_infoname): Adjust arguments.
+
+       2001-08-27  Marc Autret  <address@hidden>
+
+       * src/vcg.c: Include `xalloc.h'.
+       (add_colorentry): New.
+       (add_classname): New.
+       (add_infoname): New.
+       * src/vcg.h: Add new prototypes.
+
+       2001-08-27  Akim Demaille  <address@hidden>
+
+       * Makefile.maint: Sync. again with CVS Autoconf.
+
+       2001-08-27  Akim Demaille  <address@hidden>
+
+       * Makefile.maint: Formatting changes.
+       (po-update, cvs-update, update): New targets.
+       (AMTAR): Remove.
+
+       2001-08-27  Akim Demaille  <address@hidden>
+
+       * Makefile.am (AUTOMAKE_OPTIONS): 1.5.
+       * Makefile.maint: Sync. with CVS Autoconf.
+
+       2001-08-27  Marc Autret  <address@hidden>
+
+       * src/vcg.h (struct infoname_s): New.
+       (struct colorentry_s): New.
+       (graph_s): New fields {vertical,horizontal}_order in structure.
+       Add `infoname' field.
+       Add `colorentry' field;
+       * src/vcg_defaults.h (G_VERTICAL_ORDER): New.
+       (G_HORIZONTAL_ORDER): New.
+       (G_INFONAME): New.
+       (G_COLORENTRY): New.
+       * src/vcg.c (output_graph): Add output of {vertical,horizontal}_order.
+       Add output of `infoname'.
+       Add output of `colorentry'.
+
+       2001-08-27  Marc Autret  <address@hidden>
+
+       * src/reader.c (parse_dquoted_param): Rename variable `index' to `i'.
+       This one shadowed a global parameter.
+
+       2001-08-24  Marc Autret  <address@hidden>
+
+       * src/print_graph.c (node_output_size): Declared POSIX `size_t' type,
+       instead of `unsigned'.
+       (print_state): Do not call obstack_object_size () in obstack_grow ()
+       to avoid macro variables shadowing.
+
+       2001-08-23  Marc Autret  <address@hidden>
+
+       * src/lex.c (percent_table): Typo: s/naem/name/.
+       Add graph option.
+       Normalize new options declarations.
+
+       2001-08-20  Pascal Bart  <address@hidden>
+
+       * tests/suite.at: Exercise %header_extension and %source_extension.
+
+       2001-08-16  Marc Autret  <address@hidden>
+
+       * src/reader.c (parse_dquoted_param): New.
+       (parse_header_extension_decl): Use it.
+       (parse_source_extension_decl): Likewise.
+
+       2001-08-16  Marc Autret  <address@hidden>
+
+       * src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.
+       (get_xxxx_str): Use assert () instead of complain ().
+       Remove return invokations in default cases.
+       (get_decision_str): Modify default behaviour. Remove second argument.
+       Echo modifications on calls.
+       (output_graph): Fix.
+
+       2001-08-16  Marc Autret  <address@hidden>
+
+       * src/getargs.c (usage): Update with ``-g, --graph''.
+
+       2001-08-16  Marc Autret  <address@hidden>
+
+       * doc/bison.texinfo (Bison Options): Add items `-g', `--graph'.
+       (Option Cross Key): Likewise.
+       * doc/bison.1: Update.
+
 2001-09-25  Pascal Bart  <address@hidden>
 
        * src/output.c (output_master_parser): Don't finish action_obstack.
Index: .cvsignore
===================================================================
RCS file: /cvsroot/bison/bison/.cvsignore,v
retrieving revision 1.17
diff -u -w -r1.17 .cvsignore
--- .cvsignore  2001/09/25 11:37:26     1.17
+++ .cvsignore  2001/10/04 14:53:13
@@ -3,10 +3,11 @@
 config.h
 config.log
 config.status
-stamp-h
+stamp-h*
 bison-*
 patches
 *.patch *.log log patches applied
 *.prj
 releases
 *.flc
\ No newline at end of file
+autom4te.cache
Index: Makefile.am
===================================================================
RCS file: /cvsroot/bison/bison/Makefile.am,v
retrieving revision 1.19
diff -u -w -r1.19 Makefile.am
--- Makefile.am 2001/08/27 08:57:53     1.19
+++ Makefile.am 2001/10/04 14:53:13
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
-AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha
+AUTOMAKE_OPTIONS = 1.5 check-news readme-alpha dist-bzip2
 
 ACLOCAL_AMFLAGS = -I m4
 
@@ -26,3 +26,5 @@
 # Files to update automatically.
 wget_files = $(srcdir)/config/config.guess $(srcdir)/config/config.sub \
             $(srcdir)/config/texinfo.tex
+
+cvs_files = $(srcdir)/config/missing
Index: Makefile.maint
===================================================================
RCS file: /cvsroot/bison/bison/Makefile.maint,v
retrieving revision 1.6
diff -u -w -r1.6 Makefile.maint
--- Makefile.maint      2001/08/15 08:08:56     1.6
+++ Makefile.maint      2001/10/04 14:53:13
@@ -22,9 +22,6 @@
 # Do not save the original name or timestamp in the .tar.gz file.
 GZIP_ENV = '--no-name --best'
 
-# Automake 1.4 does not define AMTAR.
-AMTAR ?= $(TAR)
-
 CVS = cvs
 
 prev_version_file ?= .prev-version
@@ -46,12 +43,101 @@
 
 
 
+## ---------------- ##
+## Updating files.  ##
+## ---------------- ##
+
+WGET = wget
+ftp-gnu = ftp://ftp.gnu.org/gnu
+
+# Use mv, if you don't have/want move-if-change.
+move_if_change ?= move-if-change
+
+# ------------------- #
+# Updating PO files.  #
+# ------------------- #
+
+po_repo = http://www.iro.umontreal.ca/contrib/po/maint/$(PACKAGE)
+.PHONY: do-po-update po-update
+do-po-update:
+       tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
+       rm -rf $$tmppo && \
+       mkdir $$tmppo && \
+       (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
+       cp $$tmppo/*.po po
+       cd po && $(MAKE) update-po
+       $(MAKE) po-check
+
+po-update:
+       if test -d "po"; then \
+         $(MAKE) do-po-update; \
+       fi
+
+# -------------------------- #
+# Updating GNU build tools.  #
+# -------------------------- #
+
+# The following pseudo table associates a local directory and a URL
+# with each of the files that belongs to some other package and is
+# regularly updated from the specified URL.
+wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
+              $(srcdir)/src/ansi2knr.c \
+             $(srcdir)/doc/texinfo.tex
+wget-targets = $(patsubst %, get-%, $(wget_files))
+
+config.guess-url_prefix = $(ftp-gnu)/config/
+config.sub-url_prefix = $(ftp-gnu)/config/
+
+ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
+
+texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
+
+standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
+make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
+
+target = $(patsubst get-%, %, $@)
+url = $($(notdir $(target))-url_prefix)$(notdir $(target))
+
+.PHONY: $(wget-targets)
+$(wget-targets):
+       $(WGET) $(url) -O $(target).t \
+         && $(move_if_change) $(target).t $(target)
+
+.PHONY: wget-update
+wget-update: $(wget-targets)
+
+
+# Updating tools via CVS.
+cvs_files ?= depcomp missing
+cvs-targets = $(patsubst %, get-%, $(cvs_files))
+
+automake_repo = :pserver:address@hidden:/cvs/automake
+.PHONY: $(cvs-targets)
+$(cvs-targets):
+       $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
+         >$(target).t \
+           && $(move_if_change) $(target).t $(target);
+
+.PHONY: cvs-update
+cvs-update: $(cvs-targets)
+
+
+# --------------------- #
+# Updating everything.  #
+# --------------------- #
+
+.PHONY: update
+update: wget-update cvs-update po-update
+
+
+
 ## --------------- ##
 ## Sanity checks.  ##
 ## --------------- ##
 
-# Checks that don't require cvs.
-local-check: changelog-check po-check writable-files copyright-check
+# Checks that don't require cvs.  Run `changelog-check' last as
+# previous test may reveal problems requiring new ChangeLog entries.
+local-check: po-check copyright-check writable-files changelog-check
 
 changelog-check:
        if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
@@ -117,10 +203,16 @@
        $(MAKE) my-distcheck
 
 
+
+## -------------- ##
+## Making dists.  ##
+## -------------- ##
+
+
 # Tag before making distribution.  Also, don't make a distribution if
 # checks fail.  Also, make sure the NEWS file is up-to-date.
 # FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck.
-cvs-dist: cvs-check maintainer-distcheck
+cvs-dist: local-check cvs-check maintainer-distcheck
        $(CVS) update po
        $(CVS) tag -c $(this-cvs-tag)
        $(MAKE) dist
@@ -130,6 +222,7 @@
 null_AM_MAKEFLAGS = \
   ACLOCAL=false \
   AUTOCONF=false \
+  AUTOM4TE=false \
   AUTOMAKE=false \
   AUTOHEADER=false \
   MAKEINFO=false
@@ -177,7 +270,7 @@
        md5_tmp=/tmp/rel-check-md5-$$$$; \
        set -e; \
        trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \
-       wget -q --output-document=$$tarz $(url); \
+       $(WGET) -q --output-document=$$tarz $(url); \
        echo "$(md5)  -" > $$md5_tmp; \
        md5sum -c $$md5_tmp < $$tarz
 
@@ -228,48 +321,6 @@
              -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \
        )
 
-WGET = wget
-ftp-gnu = ftp://ftp.gnu.org/gnu
-
-# Use mv, if you don't have/want move-if-change.
-move_if_change ?= move-if-change
-
-# The following pseudo table associates a local directory and a URL
-# with each of the files that belongs to some other package and is
-# regularly updated from the specified URL.
-wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \
-              $(srcdir)/src/ansi2knr.c \
-             $(srcdir)/doc/texinfo.tex
-get-targets = $(patsubst %, get-%, $(wget_files))
-
-config.guess-url_prefix = $(ftp-gnu)/config/
-config.sub-url_prefix = $(ftp-gnu)/config/
-
-ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
-
-texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
-
-standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
-make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
-
-target = $(patsubst get-%, %, $@)
-url = $($(notdir $(target))-url_prefix)$(notdir $(target))
-
-.PHONY: $(get-targets)
-$(get-targets):
-       $(WGET) $(url) -O $(target).t \
-         && $(move_if_change) $(target).t $(target)
-
-automake_repo=:pserver:address@hidden:/cvs/automake
-.PHONY: wget-update
-wget-update: $(get-targets)
-       for f in depcomp missing; do                                    \
-         test -f $$f || continue;                                      \
-         echo checking out $$f...;                                     \
-         $(CVS) -d $(automake_repo) co -p automake/lib/$$f > $$f.t        \
-           && $(move_if_change) $$f.t $$f;                             \
-       done
-
 define emit-rsync-commands
        echo =====================================
        echo =====================================
@@ -284,7 +335,7 @@
 $(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz
        xdelta delta -9 $^ $@ || :
 
-alpha: local-check
+alpha:
        $(MAKE) cvs-dist
        $(MAKE) $(xd-delta)
        $(MAKE) -s announcement > /tmp/announce-$(my_distdir)
Index: NEWS
===================================================================
RCS file: /cvsroot/bison/bison/NEWS,v
retrieving revision 1.21
diff -u -w -r1.21 NEWS
--- NEWS        2001/08/14 14:13:16     1.21
+++ NEWS        2001/10/04 14:53:13
@@ -1,7 +1,27 @@
 Bison News
 ----------
 
-Changes in version 1.28c:
+Changes in version 1.29d:
+
+* `--defines' and `--graph' have now an optionnal argument which is the
+  output file name. `-d' and `-g' do not change, they do not take any
+  argument.
+
+* `%source_extension' and `%header_extension' are removed, failed
+  experiment.
+
+* The test suite is more portable.
+
+* Better portability.
+
+Changes in version 1.29:
+
+* The output file does not define const, as this caused problems when used
+  with common autoconfiguration schemes.  If you still use ancient compilers
+  that lack const, compile with the equivalent of the C compiler option
+  `-Dconst='.  autoconf's AC_C_CONST macro provides one way to do this.
+
+* Added `-g' and `--graph'.
 
 * The Bison manual is now distributed under the terms of the GNU FDL.
 
Index: THANKS
===================================================================
RCS file: /cvsroot/bison/bison/THANKS,v
retrieving revision 1.10
diff -u -w -r1.10 THANKS
--- THANKS      2001/08/08 23:16:44     1.10
+++ THANKS      2001/10/04 14:53:13
@@ -2,12 +2,16 @@
 it is today without the invaluable help of these people:
 
 Akim Demaille          address@hidden
+Albert Chin-A-Young     address@hidden
+Alexander Belopolsky    address@hidden
 Daniel Hagerty         address@hidden
 David J. MacKenzie     address@hidden
 Fabrice Bauzac         address@hidden
 Hans Aberg             address@hidden
 Jesse Thilo            address@hidden
 Jim Meyering           address@hidden
+Juan Manuel Guerrero    address@hidden
+Keith Browne            address@hidden
 Laurent Mascherpa      address@hidden
 Marc Autret             address@hidden
 Neil Booth             address@hidden
@@ -17,6 +21,7 @@
 Piotr Gackiewicz       address@hidden
 Richard Stallman       address@hidden
 Robert Anisko           address@hidden
+Shura                   address@hidden
 
 Many people are not named here because we lost track of them.  We
 thank them!  Please, help us keeping this list up to date.
Index: configure.in
===================================================================
RCS file: /cvsroot/bison/bison/configure.in,v
retrieving revision 1.39
diff -u -w -r1.39 configure.in
--- configure.in        2001/08/06 08:35:21     1.39
+++ configure.in        2001/10/04 14:53:13
@@ -1,12 +1,32 @@
-# Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.52)
-AC_INIT(bison, 1.28c, address@hidden)
+# Configure template for GNU Bison.                   -*-Autoconf-*-
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307  USA
+
+# We need a recent Autoconf to run a recent Autotest.
+AC_PREREQ(2.52e)
+
+AC_INIT([GNU Bison], [1.29d], address@hidden)
 AC_CONFIG_AUX_DIR(config)
-AM_INIT_AUTOMAKE(bison, 1.28c)
+
+AM_INIT_AUTOMAKE([bison], [1.29d])
 AM_CONFIG_HEADER(config.h:config.hin)
 
 # Initialize the test suite.
-AT_CONFIG(../src)
+AC_CONFIG_TESTDIR(tests)
+AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
 
 # Checks for programs.
 AC_PROG_CC
@@ -69,8 +89,9 @@
 jm_FUNC_REALLOC
 jm_PREREQ_QUOTEARG
 jm_PREREQ_ERROR
+AM_WITH_DMALLOC
 
-ALL_LINGUAS="de es et fr ja nl ru"
+ALL_LINGUAS="de es et fr ja nl tr ru"
 AM_GNU_GETTEXT
 
 # This is necessary so that .o files in LIBOBJS are also built via
@@ -83,4 +104,4 @@
            intl/Makefile po/Makefile.in
            lib/Makefile src/Makefile doc/Makefile
            m4/Makefile
-           tests/Makefile tests/atconfig])
+           tests/Makefile])
cvs server: Diffing config
Index: config/prev-version.txt
===================================================================
RCS file: /cvsroot/bison/bison/config/prev-version.txt,v
retrieving revision 1.2
diff -u -w -r1.2 prev-version.txt
--- config/prev-version.txt     2001/08/15 08:56:45     1.2
+++ config/prev-version.txt     2001/10/04 14:53:13
@@ -1 +1 @@
-1.28c
+1.29c
cvs server: Diffing doc
Index: doc/bison.1
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.1,v
retrieving revision 1.7
diff -u -w -r1.7 bison.1
--- doc/bison.1 2001/08/01 18:08:48     1.7
+++ doc/bison.1 2001/10/04 14:53:13
@@ -10,8 +10,12 @@
 ] [
 .B \-d
 ] [
-.B \-\-defines
+.BI \-\-defines= defines-file
 ] [
+.B \-g
+] [
+.BI \-\-graph= graph-file
+] [
 .B \-k
 ] [
 .B \-\-token-table
@@ -123,8 +127,6 @@
 .B \-d
 .br
 .ns
-.TP
-.B \-\-defines
 Write an extra output file containing macro definitions for the token
 type names defined in the grammar and the semantic value type
 .BR YYSTYPE ,
@@ -145,6 +147,32 @@
 needs to be able to refer to token type codes and the variable
 .BR yylval .
 .TP
+.BI \-\-defines= defines-file
+The behaviour of
+.BI \-\-defines 
+is the same than 
+.BI \-d 
+option. 
+The only difference is that it has an optionnal argument which is 
+the name of the output filename.
+.TP
+.BI \-g
+.br
+.ns
+Output a VCG definition of the LALR(1) grammar automaton computed by
+Bison. If the grammar file is 
+.BR foo.y
+, the VCG output file will be
+.BR foo.vcg .
+.TP
+.BI \-\-graph= graph-file
+The behaviour of 
+.BI \-\-graph 
+is the same than
+.BI \-g
+option. The only difference is that it has an optionnal argument which 
+is the name of the output graph filename.
+.TP
 .B \-k
 .br
 .ns
@@ -315,9 +343,9 @@
 .sp
 .RE
 .SH FILES
-/usr/local/lib/bison.simple    simple parser
+/usr/local/share/bison/bison.simple    simple parser
 .br
-/usr/local/lib/bison.hairy     complicated parser
+/usr/local/share/bison/bison.hairy     complicated parser
 .SH "ENVIRONMENT VARIABLES"
 .TP
 .SM BISON_SIMPLE
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.38
diff -u -w -r1.38 bison.texinfo
--- doc/bison.texinfo   2001/09/20 18:24:27     1.38
+++ doc/bison.texinfo   2001/10/04 14:53:14
@@ -129,12 +129,14 @@
 
 @contents
 
address@hidden Top, Introduction, (dir), (dir)
address@hidden
address@hidden Top
address@hidden Bison
+
+This manual documents version @value{VERSION} of Bison, updated
address@hidden
address@hidden ifnottex
 
address@hidden
-This manual documents version @value{VERSION} of Bison.
address@hidden ifinfo
-
 @menu
 * Introduction::
 * Conditions::
@@ -159,7 +161,7 @@
 * Copying This Manual::  License for copying this manual.
 * Index::             Cross-references to the text.
 
- --- The Detailed Node Listing ---
address@hidden --- The Detailed Node Listing ---
 
 The Concepts of Bison
 
@@ -182,6 +184,7 @@
 * Infix Calc::        Infix (algebraic) notation calculator.
                         Operator precedence is introduced.
 * Simple Error Recovery::  Continuing after syntax errors.
+* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
 * Multi-function Calc::    Calculator with memory and trig functions.
                         It uses multiple data-types for semantic values.
 * Exercises::         Ideas for improving the multi-function calculator.
@@ -202,6 +205,12 @@
 * Rpcalc Line::
 * Rpcalc Expr::
 
+Location Tracking Calculator: @code{ltcalc}
+
+* Decls: Ltcalc Decls.  Bison and C declarations for ltcalc.
+* Rules: Ltcalc Rules.  Grammar rules for ltcalc, with explanations.
+* Lexer: Ltcalc Lexer.  The lexical analyzer.
+
 Multi-Function Calculator: @code{mfcalc}
 
 * Decl: Mfcalc Decl.      Bison declarations for multi-function calculator.
@@ -301,9 +310,10 @@
 
 * GNU Free Documentation License::  License for copying this manual.
 
address@hidden detailmenu
 @end menu
 
address@hidden Introduction, Conditions, Top, Top
address@hidden Introduction
 @unnumbered Introduction
 @cindex introduction
 
@@ -329,7 +339,7 @@
 
 This edition corresponds to version @value{VERSION} of Bison.
 
address@hidden Conditions, Copying, Introduction, Top
address@hidden Conditions
 @unnumbered Conditions for Using Bison
 
 As of Bison version 1.24, we have changed the distribution terms for
@@ -359,7 +369,7 @@
 
 @include gpl.texi
 
address@hidden Concepts, Examples, Copying, Top
address@hidden Concepts
 @chapter The Concepts of Bison
 
 This chapter introduces many of the basic concepts without which the
@@ -381,7 +391,7 @@
 * Grammar Layout::    Overall structure of a Bison grammar file.
 @end menu
 
address@hidden Language and Grammar, Grammar in Bison,  , Concepts
address@hidden Language and Grammar
 @section Languages and Context-Free Grammars
 
 @cindex context-free grammar
@@ -490,7 +500,7 @@
 must be a `sequence of definitions and declarations'.  If not, the parser
 reports a syntax error.
 
address@hidden Grammar in Bison, Semantic Values, Language and Grammar, Concepts
address@hidden Grammar in Bison
 @section From Formal Rules to Bison Input
 @cindex Bison grammar
 @cindex grammar, Bison
@@ -535,7 +545,7 @@
 @noindent
 @xref{Rules, ,Syntax of Grammar Rules}.
 
address@hidden Semantic Values, Semantic Actions, Grammar in Bison, Concepts
address@hidden Semantic Values
 @section Semantic Values
 @cindex semantic value
 @cindex value, semantic
@@ -577,7 +587,7 @@
 language, an expression typically has a semantic value that is a tree
 structure describing the meaning of the expression.
 
address@hidden Semantic Actions, Locations Overview, Semantic Values, Concepts
address@hidden Semantic Actions
 @section Semantic Actions
 @cindex semantic actions
 @cindex actions, semantic
@@ -608,7 +618,7 @@
 The action says how to produce the semantic value of the sum expression
 from the values of the two subexpressions.
 
address@hidden Locations Overview, Bison Parser, Semantic Actions, Concepts
address@hidden Locations Overview
 @section Locations
 @cindex location
 @cindex textual position
@@ -637,7 +647,7 @@
 grouping, the default behavior of the output parser is to take the beginning
 of the first symbol, and the end of the last symbol.
 
address@hidden Bison Parser, Stages, Locations Overview, Concepts
address@hidden Bison Parser
 @section Bison Output: the Parser File
 @cindex Bison parser
 @cindex Bison utility
@@ -682,7 +692,7 @@
 or @samp{YY} in the Bison grammar file except for the ones defined in
 this manual.
 
address@hidden Stages, Grammar Layout, Bison Parser, Concepts
address@hidden Stages
 @section Stages in Using Bison
 @cindex stages in using Bison
 @cindex using Bison
@@ -724,7 +734,7 @@
 Link the object files to produce the finished product.
 @end enumerate
 
address@hidden Grammar Layout,  , Stages, Concepts
address@hidden Grammar Layout
 @section The Overall Layout of a Bison Grammar
 @cindex grammar file
 @cindex file format
@@ -767,7 +777,7 @@
 actions in the grammar rules.  In a simple program, all the rest of the 
 program can go here.
 
address@hidden Examples, Grammar File, Concepts, Top
address@hidden Examples
 @chapter Examples
 @cindex simple examples
 @cindex examples, simple
@@ -791,12 +801,13 @@
 * Infix Calc::        Infix (algebraic) notation calculator.
                         Operator precedence is introduced.
 * Simple Error Recovery::  Continuing after syntax errors.
+* Location Tracking Calc:: Demonstrating the use of @@@var{n} and @@$.
 * Multi-function Calc::  Calculator with memory and trig functions.
                            It uses multiple data-types for semantic values.
 * Exercises::         Ideas for improving the multi-function calculator.
 @end menu
 
address@hidden RPN Calc, Infix Calc,  , Examples
address@hidden RPN Calc
 @section Reverse Polish Notation Calculator
 @cindex reverse polish notation
 @cindex polish notation calculator
@@ -821,7 +832,7 @@
 * Comp: Rpcalc Compile. Run the C compiler on the output code.
 @end menu
 
address@hidden Rpcalc Decls, Rpcalc Rules,  , RPN Calc
address@hidden Rpcalc Decls
 @subsection Declarations for @code{rpcalc}
 
 Here are the C and Bison declarations for the reverse polish notation
@@ -861,7 +872,7 @@
 only terminal symbol that needs to be declared is @code{NUM}, the token
 type for numeric constants.
 
address@hidden Rpcalc Rules, Rpcalc Lexer, Rpcalc Decls, RPN Calc
address@hidden Rpcalc Rules
 @subsection Grammar Rules for @code{rpcalc}
 
 Here are the grammar rules for the reverse polish notation calculator.
@@ -912,7 +923,7 @@
 * Rpcalc Expr::
 @end menu
 
address@hidden Rpcalc Input, Rpcalc Line,  , Rpcalc Rules
address@hidden Rpcalc Input
 @subsubsection Explanation of @code{input}
 
 Consider the definition of @code{input}:
@@ -946,7 +957,7 @@
 grammatical error is seen or the lexical analyzer says there are no more
 input tokens; we will arrange for the latter to happen at end of file.
 
address@hidden Rpcalc Line, Rpcalc Expr, Rpcalc Input, Rpcalc Rules
address@hidden Rpcalc Line
 @subsubsection Explanation of @code{line}
 
 Now consider the definition of @code{line}:
@@ -971,7 +982,7 @@
 that value were ever used, but we don't use it: once rpcalc has printed the
 value of the user's input line, that value is no longer needed.
 
address@hidden Rpcalc Expr,  , Rpcalc Line, Rpcalc Rules
address@hidden Rpcalc Expr
 @subsubsection Explanation of @code{expr}
 
 The @code{exp} grouping has several rules, one for each kind of expression.
@@ -1030,7 +1041,7 @@
 @noindent
 The latter, however, is much more readable.
 
address@hidden Rpcalc Lexer, Rpcalc Main, Rpcalc Rules, RPN Calc
address@hidden Rpcalc Lexer
 @subsection The @code{rpcalc} Lexical Analyzer
 @cindex writing a lexical analyzer
 @cindex lexical analyzer, writing
@@ -1105,7 +1116,7 @@
 @end group
 @end example
 
address@hidden Rpcalc Main, Rpcalc Error, Rpcalc Lexer, RPN Calc
address@hidden Rpcalc Main
 @subsection The Controlling Function
 @cindex controlling function
 @cindex main function in simple example
@@ -1124,7 +1135,7 @@
 @end group
 @end example
 
address@hidden Rpcalc Error, Rpcalc Gen, Rpcalc Main, RPN Calc
address@hidden Rpcalc Error
 @subsection The Error Reporting Routine
 @cindex error reporting routine
 
@@ -1153,7 +1164,7 @@
 cause the calculator program to exit.  This is not clean behavior for a
 real calculator, but it is adequate for the first example.
 
address@hidden Rpcalc Gen, Rpcalc Compile, Rpcalc Error, RPN Calc
address@hidden Rpcalc Gen
 @subsection Running Bison to Make the Parser
 @cindex running Bison (introduction)
 
@@ -1182,7 +1193,7 @@
 functions in the input file (@code{yylex}, @code{yyerror} and @code{main})
 are copied verbatim to the output.
 
address@hidden Rpcalc Compile,  , Rpcalc Gen, RPN Calc
address@hidden Rpcalc Compile
 @subsection Compiling the Parser File
 @cindex compiling the parser
 
@@ -1227,7 +1238,7 @@
 %
 @end example
 
address@hidden Infix Calc, Simple Error Recovery, RPN Calc, Examples
address@hidden Infix Calc
 @section Infix Notation Calculator: @code{calc}
 @cindex infix notation calculator
 @cindex @code{calc}
@@ -1313,7 +1324,7 @@
 9
 @end example
 
address@hidden Simple Error Recovery, Multi-function Calc, Infix Calc, Examples
address@hidden Simple Error Recovery
 @section Simple Error Recovery
 @cindex error recovery, simple
 
@@ -1354,8 +1365,206 @@
 input lines; it would also have to discard the rest of the current line of
 input.  We won't discuss this issue further because it is not specific to
 Bison programs.
+
address@hidden Location Tracking Calc
address@hidden Location Tracking Calculator: @code{ltcalc}
address@hidden location tracking calculator
address@hidden @code{ltcalc}
address@hidden calculator, location tracking
+
+This example extends the infix notation calculator with location tracking.
+This feature will be used to improve error reporting, and provide better
+error messages.
+
+For the sake of clarity, we will switch for this example to an integer
+calculator, since most of the work needed to use locations will be done
+in the lexical analyser.
 
address@hidden Multi-function Calc, Exercises, Simple Error Recovery, Examples
address@hidden
+* Decls: Ltcalc Decls.  Bison and C declarations for ltcalc.
+* Rules: Ltcalc Rules.  Grammar rules for ltcalc, with explanations.
+* Lexer: Ltcalc Lexer.  The lexical analyzer.
address@hidden menu
+
address@hidden Ltcalc Decls
address@hidden Declarations for @code{ltcalc}
+
+The C and Bison declarations for the location tracking calculator are the same
+as the declarations for the infix notation calculator.
+
address@hidden
+/* Location tracking calculator.  */
+
address@hidden
+#define YYSTYPE int
+#include <math.h>
address@hidden
+
+/* Bison declarations.  */
+%token NUM
+
+%left '-' '+'
+%left '*' '/'
+%left NEG
+%right '^'
+
+%% /* Grammar follows */
address@hidden example
+
+In the code above, there are no declarations specific to locations.  Defining
+a data type for storing locations is not needed: we will use the type provided
+by default (@pxref{Location Type, ,Data Types of Locations}), which is a four
+member structure with the following integer fields: @code{first_line},
address@hidden, @code{last_line} and @code{last_column}.
+
address@hidden Ltcalc Rules
address@hidden Grammar Rules for @code{ltcalc}
+
+Whether you choose to handle locations or not has no effect on the syntax of
+your language.  Therefore, grammar rules for this example will be very close to
+those of the previous example: we will only modify them to benefit from the new
+informations we will have.
+
+Here, we will use locations to report divisions by zero, and locate the wrong
+expressions or subexpressions.
+
address@hidden
address@hidden
+input   : /* empty */
+        | input line
+;
address@hidden group
+
address@hidden
+line    : '\n'
+        | exp '\n' @{ printf ("%d\n", $1); @}
+;
address@hidden group
+
address@hidden
+exp     : NUM           @{ $$ = $1; @}
+        | exp '+' exp   @{ $$ = $1 + $3; @}
+        | exp '-' exp   @{ $$ = $1 - $3; @}
+        | exp '*' exp   @{ $$ = $1 * $3; @}
address@hidden group
+        | exp '/' exp
address@hidden
+            @{
+              if ($3)
+                $$ = $1 / $3;
+              else
+                @{
+                  $$ = 1;
+                  printf("Division by zero, l%d,c%d-l%d,c%d",
+                         @@3.first_line, @@3.first_column,
+                         @@3.last_line, @@3.last_column);
+                @}
+            @}
address@hidden group
address@hidden
+        | '-' exp %preg NEG     @{ $$ = -$2; @}
+        | exp '^' exp           @{ $$ = pow ($1, $3); @}
+        | '(' exp ')'           @{ $$ = $2; @}
address@hidden group
address@hidden example
+
+This code shows how to reach locations inside of semantic actions, by
+using the pseudo-variables @code{@@@var{n}} for rule components, and the
+pseudo-variable @code{@@$} for groupings.
+
+In this example, we never assign a value to @code{@@$}, because the
+output parser can do this automatically.  By default, before executing
+the C code of each action, @code{@@$} is set to range from the beginning
+of @code{@@1} to the end of @code{@@@var{n}}, for a rule with @var{n}
+components.
+
+Of course, this behavior can be redefined (@pxref{Location Default
+Action, , Default Action for Locations}), and for very specific rules,
address@hidden@@$} can be computed by hand.
+
address@hidden Ltcalc Lexer
address@hidden The @code{ltcalc} Lexical Analyzer.
+
+Until now, we relied on Bison's defaults to enable location tracking. The next
+step is to rewrite the lexical analyser, and make it able to feed the parser
+with locations of tokens, as he already does for semantic values.
+
+To do so, we must take into account every single character of the input text,
+to avoid the computed locations of being fuzzy or wrong:
+
address@hidden
address@hidden
+int
+yylex (void)
address@hidden
+  int c;
+
+  /* skip white space */
+  while ((c = getchar ()) == ' ' || c == '\t')
+    ++yylloc.last_column;
+
+  /* step */
+  yylloc.first_line = yylloc.last_line;
+  yylloc.first_column = yylloc.last_column;
address@hidden group
+
address@hidden
+  /* process numbers */
+  if (isdigit (c))
+    @{
+      yylval = c - '0';
+      ++yylloc.last_column;
+      while (isdigit (c = getchar ()))
+        @{
+          ++yylloc.last_column;
+          yylval = yylval * 10 + c - '0';
+        @}
+      ungetc (c, stdin);
+      return NUM;
+    @}
address@hidden group
+
+  /* return end-of-file */
+  if (c == EOF)
+    return 0;
+
+  /* return single chars and update location */
+  if (c == '\n')
+    @{
+      ++yylloc.last_line;
+      yylloc.last_column = 0;
+    @}
+  else
+    ++yylloc.last_column;
+  return c;
address@hidden
address@hidden example
+
+Basically, the lexical analyzer does the same processing as before: it skips
+blanks and tabs, and reads numbers or single-character tokens.  In addition
+to this, it updates the @code{yylloc} global variable (of type @code{YYLTYPE}),
+where the location of tokens is stored.
+
+Now, each time this function returns a token, the parser has it's number as
+well as it's semantic value, and it's position in the text. The last needed
+change is to initialize @code{yylloc}, for example in the controlling
+function:
+
address@hidden
+int
+main (void)
address@hidden
+  yylloc.first_line = yylloc.last_line = 1;
+  yylloc.first_column = yylloc.last_column = 0;
+  return yyparse ();
address@hidden
address@hidden example
+
+Remember that computing locations is not a matter of syntax.  Every character
+must be associated to a location update, whether it is in valid input, in
+comments, in literal strings, and so on...
+
address@hidden Multi-function Calc
 @section Multi-Function Calculator: @code{mfcalc}
 @cindex multi-function calculator
 @cindex @code{mfcalc}
@@ -1407,7 +1616,7 @@
 * Symtab: Mfcalc Symtab.  Symbol table management subroutines.
 @end menu
 
address@hidden Mfcalc Decl, Mfcalc Rules,  , Multi-function Calc
address@hidden Mfcalc Decl
 @subsection Declarations for @code{mfcalc}
 
 Here are the C and Bison declarations for the multi-function calculator.
@@ -1458,7 +1667,7 @@
 implicitly by the rules that define them.  But @code{exp} must be declared
 explicitly so we can specify its value type.  @xref{Type Decl, ,Nonterminal 
Symbols}.
 
address@hidden Mfcalc Rules, Mfcalc Symtab, Mfcalc Decl, Multi-function Calc
address@hidden Mfcalc Rules
 @subsection Grammar Rules for @code{mfcalc}
 
 Here are the grammar rules for the multi-function calculator.
@@ -1492,7 +1701,7 @@
 %%
 @end smallexample
 
address@hidden Mfcalc Symtab,  , Mfcalc Rules, Multi-function Calc
address@hidden Mfcalc Symtab
 @subsection The @code{mfcalc} Symbol Table
 @cindex symbol table example
 
@@ -1733,7 +1942,7 @@
 functions, and it is a simple job to modify this code to install predefined
 variables such as @code{pi} or @code{e} as well.
 
address@hidden Exercises,  , Multi-function Calc, Examples
address@hidden Exercises
 @section Exercises
 @cindex exercises
 
@@ -1751,7 +1960,7 @@
 uninitialized variable in any way except to store a value in it.
 @end enumerate
 
address@hidden Grammar File, Interface, Examples, Top
address@hidden Grammar File
 @chapter Bison Grammar Files
 
 Bison takes as input a context-free grammar specification and produces a
@@ -1771,7 +1980,7 @@
 * Multiple Parsers::  Putting more than one Bison parser in one program.
 @end menu
 
address@hidden Grammar Outline, Symbols,  , Grammar File
address@hidden Grammar Outline
 @section Outline of a Bison Grammar
 
 A Bison grammar file has four main sections, shown here with the
@@ -1814,7 +2023,7 @@
 need any C declarations, you may omit the @address@hidden and @address@hidden
 delimiters that bracket this section.
 
address@hidden Bison Declarations, Grammar Rules, Prologue, Grammar Outline
address@hidden Bison Declarations
 @subsection The Bison Declarations Section
 @cindex Bison declarations (introduction)
 @cindex declarations, Bison (introduction)
@@ -1824,7 +2033,7 @@
 In some simple grammars you may not need any declarations.
 @xref{Declarations, ,Bison Declarations}.
 
address@hidden Grammar Rules, Epilogue, Bison Declarations, Grammar Outline
address@hidden Grammar Rules
 @subsection The Grammar Rules Section
 @cindex grammar rules section
 @cindex rules section for grammar
@@ -1857,7 +2066,7 @@
 good idea to avoid using any such names (except those documented in this
 manual) in the epilogue of the grammar file.
 
address@hidden Symbols, Rules, Grammar Outline, Grammar File
address@hidden Symbols
 @section Symbols, Terminal and Nonterminal
 @cindex nonterminal symbol
 @cindex terminal symbol
@@ -1969,7 +2178,7 @@
 (@pxref{Error Recovery}); you shouldn't use it for any other purpose.
 In particular, @code{yylex} should never return this value.
 
address@hidden Rules, Recursion, Symbols, Grammar File
address@hidden Rules
 @section Syntax of Grammar Rules
 @cindex rule syntax
 @cindex grammar rule syntax
@@ -2064,7 +2273,7 @@
 It is customary to write a comment @samp{/* empty */} in each rule
 with no components.
 
address@hidden Recursion, Semantics, Rules, Grammar File
address@hidden Recursion
 @section Recursive Rules
 @cindex recursive rule
 
@@ -2133,7 +2342,7 @@
 defines two mutually-recursive nonterminals, since each refers to the
 other.
 
address@hidden Semantics, Locations, Recursion, Grammar File
address@hidden Semantics
 @section Defining Language Semantics
 @cindex defining language semantics
 @cindex language semantics, defining
@@ -2157,7 +2366,7 @@
                         action in the middle of a rule.
 @end menu
 
address@hidden Value Type, Multiple Types,  , Semantics
address@hidden Value Type
 @subsection Data Types of Semantic Values
 @cindex semantic value type
 @cindex value type, semantic
@@ -2179,7 +2388,7 @@
 This macro definition must go in the prologue of the grammar file 
 (@pxref{Grammar Outline, ,Outline of a Bison Grammar}).
 
address@hidden Multiple Types, Actions, Value Type, Semantics
address@hidden Multiple Types
 @subsection More Than One Value Type
 
 In most programs, you will need different data types for different kinds
@@ -2203,7 +2412,7 @@
 Decl, ,Nonterminal Symbols}).
 @end itemize
 
address@hidden Actions, Action Types, Multiple Types, Semantics
address@hidden Actions
 @subsection Actions
 @cindex action
 @vindex $$
@@ -2279,7 +2488,7 @@
 always refers to the @code{expr} which precedes @code{bar} in the
 definition of @code{foo}.
 
address@hidden Action Types, Mid-Rule Actions, Actions, Semantics
address@hidden Action Types
 @subsection Data Types of Values in Actions
 @cindex action data types
 @cindex data types in actions
@@ -2324,7 +2533,7 @@
 then you can write @code{$<itype>1} to refer to the first subunit of the
 rule as an integer, or @code{$<dtype>1} to refer to it as a double.
 
address@hidden Mid-Rule Actions,  , Action Types, Semantics
address@hidden Mid-Rule Actions
 @subsection Actions in Mid-Rule
 @cindex actions in mid-rule
 @cindex mid-rule actions
@@ -2486,7 +2695,7 @@
 converted to an end-of-rule action in this way, and this is what Bison
 actually does to implement mid-rule actions.
 
address@hidden Locations, Declarations, Semantics, Grammar File
address@hidden Locations
 @section Tracking Locations
 @cindex location
 @cindex textual position
@@ -2507,7 +2716,7 @@
 * Location Default Action::     Defining a general way to compute locations.
 @end menu
 
address@hidden Location Type, Actions and Locations,  , Locations
address@hidden Location Type
 @subsection Data Type of Locations
 @cindex data type of locations
 @cindex default location type
@@ -2529,7 +2738,7 @@
 @}
 @end example
 
address@hidden Actions and Locations, Location Default Action, Location Type, 
Locations
address@hidden Actions and Locations
 @subsection Actions and Locations
 @cindex location actions
 @cindex actions, location
@@ -2596,7 +2805,7 @@
 @end group
 @end example
 
address@hidden Location Default Action,  , Actions and Locations, Locations
address@hidden Location Default Action
 @subsection Default Action for Locations
 @vindex YYLLOC_DEFAULT
 
@@ -2640,7 +2849,7 @@
 range from 1 to @var{n}.
 @end itemize
 
address@hidden Declarations, Multiple Parsers, Locations, Grammar File
address@hidden Declarations
 @section Bison Declarations
 @cindex declarations, Bison
 @cindex Bison declarations
@@ -2669,7 +2878,7 @@
 * Decl Summary::      Table of all Bison declarations.
 @end menu
 
address@hidden Token Decl, Precedence Decl,  , Declarations
address@hidden Token Decl
 @subsection Token Type Names
 @cindex declaring token type names
 @cindex token type names, declaring
@@ -2743,7 +2952,7 @@
 @code{yylex} function can use the token name or the literal string to
 obtain the token type code number (@pxref{Calling Convention}).
 
address@hidden Precedence Decl, Union Decl, Token Decl, Declarations
address@hidden Precedence Decl
 @subsection Operator Precedence
 @cindex precedence declarations
 @cindex declaring operator precedence
@@ -2792,7 +3001,7 @@
 the one declared later has the higher precedence and is grouped first.
 @end itemize
 
address@hidden Union Decl, Type Decl, Precedence Decl, Declarations
address@hidden Union Decl
 @subsection The Collection of Value Types
 @cindex declaring value types
 @cindex value types, declaring
@@ -2823,7 +3032,7 @@
 Note that, unlike making a @code{union} declaration in C, you do not write
 a semicolon after the closing brace.
 
address@hidden Type Decl, Expect Decl, Union Decl, Declarations
address@hidden Type Decl
 @subsection Nonterminal Symbols
 @cindex declaring value types, nonterminals
 @cindex value types, nonterminals, declaring
@@ -2850,7 +3059,7 @@
 terminal symbol.  All kinds of token declarations allow
 @code{<@var{type}>}.
 
address@hidden Expect Decl, Start Decl, Type Decl, Declarations
address@hidden Expect Decl
 @subsection Suppressing Conflict Warnings
 @cindex suppressing conflict warnings
 @cindex preventing warnings about conflicts
@@ -2898,7 +3107,7 @@
 it will warn you again if changes in the grammar result in additional
 conflicts.
 
address@hidden Start Decl, Pure Decl, Expect Decl, Declarations
address@hidden Start Decl
 @subsection The Start-Symbol
 @cindex declaring the start symbol
 @cindex start symbol, declaring
@@ -2913,7 +3122,7 @@
 %start @var{symbol}
 @end example
 
address@hidden Pure Decl, Decl Summary, Start Decl, Declarations
address@hidden Pure Decl
 @subsection A Pure (Reentrant) Parser
 @cindex reentrant parser
 @cindex pure parser
@@ -2953,7 +3162,7 @@
 You can generate either a pure parser or a nonreentrant parser from any
 valid grammar.
 
address@hidden Decl Summary,  , Pure Decl, Declarations
address@hidden Decl Summary
 @subsection Bison Declaration Summary
 @cindex Bison declaration summary
 @cindex declaration summary
@@ -3110,7 +3319,7 @@
 @end table
 @end table
 
address@hidden Multiple Parsers,, Declarations, Grammar File
address@hidden Multiple Parsers
 @section Multiple Parsers in the Same Program
 
 Most programs that use Bison parse only one language and therefore contain
@@ -3140,7 +3349,7 @@
 @address@hidden, and so on.  This effectively substitutes one
 name for the other in the entire parser file.
 
address@hidden Interface, Algorithm, Grammar File, Top
address@hidden Interface
 @chapter Parser C-Language Interface
 @cindex C-language interface
 @cindex interface
@@ -3162,7 +3371,7 @@
 * Action Features::   Special features for use in actions.
 @end menu
 
address@hidden Parser Function, Lexical,  , Interface
address@hidden Parser Function
 @section The Parser Function @code{yyparse}
 @findex yyparse
 
@@ -3190,7 +3399,7 @@
 Return immediately with value 1 (to report failure).
 @end table
 
address@hidden Lexical, Error Reporting, Parser Function, Interface
address@hidden Lexical
 @section The Lexical Analyzer Function @code{yylex}
 @findex yylex
 @cindex lexical analyzer
@@ -3219,7 +3428,7 @@
                         in a pure parser (@pxref{Pure Decl, ,A Pure 
(Reentrant) Parser}).
 @end menu
 
address@hidden Calling Convention, Token Values,  , Lexical
address@hidden Calling Convention
 @subsection Calling Convention for @code{yylex}
 
 The value that @code{yylex} returns must be the numeric code for the type
@@ -3296,7 +3505,7 @@
 @code{%token_table} declaration.  @xref{Decl Summary}.
 @end itemize
 
address@hidden Token Values, Token Positions, Calling Convention, Lexical
address@hidden Token Values
 @subsection Semantic Values of Tokens
 
 @vindex yylval
@@ -3342,7 +3551,7 @@
 @end group
 @end example
 
address@hidden Token Positions, Pure Calling, Token Values, Lexical
address@hidden Token Positions
 @subsection Textual Positions of Tokens
 
 @vindex yylloc
@@ -3363,7 +3572,7 @@
 @tindex YYLTYPE
 The data type of @code{yylloc} has the name @code{YYLTYPE}.
 
address@hidden Pure Calling,  , Token Positions, Lexical
address@hidden Pure Calling
 @subsection Calling Conventions for Pure Parsers
 
 When you use the Bison declaration @code{%pure_parser} to request a
@@ -3470,7 +3679,7 @@
 also using @code{YYPARSE_PARAM}.  Then you should call @code{yyparse}
 with no arguments, as usual.
 
address@hidden Error Reporting, Action Features, Lexical, Interface
address@hidden Error Reporting
 @section The Error Reporting Function @code{yyerror}
 @cindex error reporting function
 @findex yyerror
@@ -3530,7 +3739,7 @@
 request a pure parser (@pxref{Pure Decl, ,A Pure (Reentrant) Parser}) then it 
is a local variable
 which only the actions can access.
 
address@hidden Action Features,  , Error Reporting, Interface
address@hidden Action Features
 @section Special Features for Use in Actions
 @cindex summary, action features
 @cindex action features summary
@@ -3644,7 +3853,7 @@
 
 @end table
 
address@hidden Algorithm, Error Recovery, Interface, Top
address@hidden Algorithm
 @chapter The Bison Parser Algorithm
 @cindex Bison parser algorithm
 @cindex algorithm of parser
@@ -3711,7 +3920,7 @@
 * Stack Overflow::    What happens when stack gets full.  How to avoid it.
 @end menu
 
address@hidden Look-Ahead, Shift/Reduce,  , Algorithm
address@hidden Look-Ahead
 @section Look-Ahead Tokens
 @cindex look-ahead token
 
@@ -3766,7 +3975,7 @@
 The current look-ahead token is stored in the variable @code{yychar}.
 @xref{Action Features, ,Special Features for Use in Actions}.
 
address@hidden Shift/Reduce, Precedence, Look-Ahead, Algorithm
address@hidden Shift/Reduce
 @section Shift/Reduce Conflicts
 @cindex conflicts
 @cindex shift/reduce conflicts
@@ -3862,7 +4071,7 @@
         ;
 @end example
 
address@hidden Precedence, Contextual Precedence, Shift/Reduce, Algorithm
address@hidden Precedence
 @section Operator Precedence
 @cindex operator precedence
 @cindex precedence of operators
@@ -3879,7 +4088,7 @@
 * How Precedence::    How they work.
 @end menu
 
address@hidden Why Precedence, Using Precedence,  , Precedence
address@hidden Why Precedence
 @subsection When Precedence is Needed
 
 Consider the following ambiguous grammar fragment (ambiguous because the
@@ -3926,7 +4135,7 @@
 contains @address@hidden - 2}} and the look-ahead token is @samp{-}: shifting
 makes right-associativity.
 
address@hidden Using Precedence, Precedence Examples, Why Precedence, Precedence
address@hidden Using Precedence
 @subsection Specifying Operator Precedence
 @findex %left
 @findex %right
@@ -3947,7 +4156,7 @@
 precedence is lowest, the next such declaration declares the operators
 whose precedence is a little higher, and so on.
 
address@hidden Precedence Examples, How Precedence, Using Precedence, Precedence
address@hidden Precedence Examples
 @subsection Precedence Examples
 
 In our example, we would want the following declarations:
@@ -3973,7 +4182,7 @@
 and so on.  We assume that these tokens are more than one character long
 and therefore are represented by names, not character literals.)
 
address@hidden How Precedence,  , Precedence Examples, Precedence
address@hidden How Precedence
 @subsection How Precedence Works
 
 The first effect of the precedence declarations is to assign precedence
@@ -3994,7 +4203,7 @@
 Not all rules and not all tokens have precedence.  If either the rule or
 the look-ahead token has no precedence, then the default is to shift.
 
address@hidden Contextual Precedence, Parser States, Precedence, Algorithm
address@hidden Contextual Precedence
 @section Context-Dependent Precedence
 @cindex context-dependent precedence
 @cindex unary operator precedence
@@ -4052,7 +4261,7 @@
 @end group
 @end example
 
address@hidden Parser States, Reduce/Reduce, Contextual Precedence, Algorithm
address@hidden Parser States
 @section Parser States
 @cindex finite-state machine
 @cindex parser state
@@ -4078,7 +4287,7 @@
 is erroneous in the current state.  This causes error processing to begin
 (@pxref{Error Recovery}).
 
address@hidden Reduce/Reduce, Mystery Conflicts, Parser States, Algorithm
address@hidden Reduce/Reduce
 @section Reduce/Reduce Conflicts
 @cindex reduce/reduce conflict
 @cindex conflicts, reduce/reduce
@@ -4193,7 +4402,7 @@
         ;
 @end example
 
address@hidden Mystery Conflicts, Stack Overflow, Reduce/Reduce, Algorithm
address@hidden Mystery Conflicts
 @section Mysterious Reduce/Reduce Conflicts
 
 Sometimes reduce/reduce conflicts can occur that don't look warranted.
@@ -4301,7 +4510,7 @@
         ;
 @end example
 
address@hidden Stack Overflow,  , Mystery Conflicts, Algorithm
address@hidden Stack Overflow
 @section Stack Overflow, and How to Avoid It
 @cindex stack overflow
 @cindex parser stack overflow
@@ -4335,7 +4544,7 @@
 macro @code{YYINITDEPTH}.  This value too must be a compile-time
 constant integer.  The default is 200.
 
address@hidden Error Recovery, Context Dependency, Algorithm, Top
address@hidden Error Recovery
 @chapter Error Recovery
 @cindex error recovery
 @cindex recovery from errors
@@ -4453,7 +4662,7 @@
 rest of the time.  A value of 1 indicates that error messages are
 currently suppressed for new syntax errors.
 
address@hidden Context Dependency, Debugging, Error Recovery, Top
address@hidden Context Dependency
 @chapter Handling Context Dependencies
 
 The Bison paradigm is to parse tokens first, then group them into larger
@@ -4472,7 +4681,7 @@
 (Actually, ``kludge'' means any technique that gets its job done but is
 neither clean nor robust.)
 
address@hidden Semantic Tokens, Lexical Tie-ins,  , Context Dependency
address@hidden Semantic Tokens
 @section Semantic Info in Token Types
 
 The C language has a context dependency: the way an identifier is used
@@ -4547,7 +4756,7 @@
 program.  A true lexical tie-in has a special-purpose flag controlled by
 the syntactic context.
 
address@hidden Lexical Tie-ins, Tie-in Recovery, Semantic Tokens, Context 
Dependency
address@hidden Lexical Tie-ins
 @section Lexical Tie-ins
 @cindex lexical tie-in
 
@@ -4600,7 +4809,7 @@
 is needed to make it accessible to the actions (@pxref{Prologue, ,The 
Prologue}).  
 You must also write the code in @code{yylex} to obey the flag.
 
address@hidden Tie-in Recovery,  , Lexical Tie-ins, Context Dependency
address@hidden Tie-in Recovery
 @section Lexical Tie-ins and Error Recovery
 
 Lexical tie-ins make strict demands on any error recovery rules you have.
@@ -4655,7 +4864,7 @@
 be such that you can be sure that it always will, or always won't, have to
 clear the flag.
 
address@hidden Debugging, Invocation, Context Dependency, Top
address@hidden Debugging
 @chapter Debugging Your Parser
 @findex YYDEBUG
 @findex yydebug
@@ -4736,7 +4945,7 @@
 @}
 @end smallexample
 
address@hidden Invocation, Table of Symbols, Debugging, Top
address@hidden Invocation
 @chapter Invoking Bison
 @cindex invoking Bison
 @cindex Bison invocation
@@ -4782,7 +4991,7 @@
 * VMS Invocation::    Bison command syntax on VMS.
 @end menu
 
address@hidden Bison Options, Environment Variables,  , Invocation
address@hidden Bison Options
 @section Bison Options
 
 Bison supports both traditional single-letter options and mnemonic long
@@ -4875,12 +5084,16 @@
 
 @table @option
 @item -d
address@hidden --defines
 Pretend that @code{%verbose} was specified, i.e., write an extra output
 file containing macro definitions for the token type names defined in
 the grammar and the semantic value type @code{YYSTYPE}, as well as a few
 @code{extern} variable declarations.  @xref{Decl Summary}.
 
address@hidden address@hidden
+The behaviour of @var{--defines} is the same than @samp{-d}. The only
+difference is that it has an optionnal argument which is the name of
+the output filename.
+
 @item -b @var{file-prefix}
 @itemx address@hidden
 Specify a prefix to use for all Bison output file names.  The names are
@@ -4898,9 +5111,19 @@
 
 The other output files' names are constructed from @var{outfile}
 as described under the @samp{-v} and @samp{-d} options.
+
address@hidden -g
+Output a VCG definition of the LALR(1) grammar automaton computed by
+Bison. If the grammar file is @file{foo.y}, the VCG output file will
+be @file{foo.vcg}.
+
address@hidden address@hidden
+The behaviour of @var{--graph} is the same than @samp{-g}. The only
+difference is that it has an optionnal argument which is the name of
+the output graph filename.
 @end table
 
address@hidden Environment Variables, Option Cross Key, Bison Options, 
Invocation
address@hidden Environment Variables
 @section Environment Variables
 @cindex environment variables
 @cindex BISON_HAIRY
@@ -4925,7 +5148,7 @@
 
 @end table
 
address@hidden Option Cross Key, VMS Invocation, Environment Variables, 
Invocation
address@hidden Option Cross Key
 @section Option Cross Key
 
 Here is a list of options, alphabetized by long option, to help you find
@@ -4939,6 +5162,7 @@
 \line{ --defines \leaderfill -d}
 \line{ --file-prefix \leaderfill -b}
 \line{ --fixed-output-files \leaderfill -y}
+\line{ --graph \leaderfill -g}
 \line{ --help \leaderfill -h}
 \line{ --name-prefix \leaderfill -p}
 \line{ --no-lines \leaderfill -l}
@@ -4954,9 +5178,10 @@
 @ifinfo
 @example
 --debug                               -t
---defines                             -d
address@hidden          -d
 address@hidden                  -b @var{file-prefix}
 --fixed-output-files --yacc           -y
address@hidden              -d
 --help                                -h
 address@hidden                  -p @var{name-prefix}
 --no-lines                            -l
@@ -4968,7 +5193,7 @@
 @end example
 @end ifinfo
 
address@hidden VMS Invocation,  , Option Cross Key, Invocation
address@hidden VMS Invocation
 @section Invoking Bison under VMS
 @cindex invoking Bison under VMS
 @cindex VMS
@@ -4996,7 +5221,7 @@
 @file{foo.tab.c}.  In the above example, the output file
 would instead be named @file{foo_tab.c}.
 
address@hidden Table of Symbols, Glossary, Invocation, Top
address@hidden Table of Symbols
 @appendix Bison Symbols
 @cindex Bison symbols, table of
 @cindex symbols in Bison, table of
@@ -5215,7 +5440,7 @@
 @xref{Rules, ,Syntax of Grammar Rules}.
 @end table
 
address@hidden Glossary, Copying This Manual, Table of Symbols, Top
address@hidden Glossary
 @appendix Glossary
 @cindex glossary
 
@@ -5376,7 +5601,7 @@
 @xref{Language and Grammar, ,Languages and Context-Free Grammars}.
 @end table
 
address@hidden Copying This Manual, Index, Glossary, Top
address@hidden Copying This Manual
 @appendix Copying This Manual
 
 @menu
@@ -5385,7 +5610,7 @@
 
 @include fdl.texi
 
address@hidden Index,  , Copying This Manual, Top
address@hidden Index
 @unnumbered Index
 
 @printindex cp
cvs server: Diffing etc
cvs server: Diffing intl
cvs server: Diffing lib
Index: lib/quotearg.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/quotearg.c,v
retrieving revision 1.2
diff -u -w -r1.2 quotearg.c
--- lib/quotearg.c      2001/08/03 08:48:49     1.2
+++ lib/quotearg.c      2001/10/04 14:53:14
@@ -63,6 +63,11 @@
 #endif
 
 #if HAVE_WCHAR_H
+
+/* BSD/OS 4.1 wchar.h requires FILE and struct tm to be declared.  */
+# include <stdio.h>
+# include <time.h>
+
 # include <wchar.h>
 #endif
 
@@ -73,8 +78,12 @@
 # undef MB_CUR_MAX
 # define MB_CUR_MAX 1
 # define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
-# define mbsinit(ps) 1
 # define iswprint(wc) ISPRINT ((unsigned char) (wc))
+# undef HAVE_MBSINIT
+#endif
+
+#if !defined mbsinit && !HAVE_MBSINIT
+# define mbsinit(ps) 1
 #endif
 
 #ifndef iswprint
cvs server: Diffing m4
Index: m4/Makefile.am
===================================================================
RCS file: /cvsroot/bison/bison/m4/Makefile.am,v
retrieving revision 1.9
diff -u -w -r1.9 Makefile.am
--- m4/Makefile.am      2001/08/03 08:22:03     1.9
+++ m4/Makefile.am      2001/10/04 14:53:14
@@ -1,8 +1,8 @@
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
 EXTRA_DIST =                                   \
-atconfig.m4                                    \
 c-bs-a.m4                                      \
 codeset.m4                                     \
+dmalloc.m4                                     \
 error.m4                                       \
 gettext.m4                                     \
 glibc21.m4                                     \
@@ -11,6 +11,7 @@
 lcmessage.m4                                   \
 m4.m4                                          \
 malloc.m4                                      \
+mbrtowc.m4                                     \
 mbstate_t.m4                                   \
 prereq.m4                                      \
 progtest.m4                                    \
Index: m4/atconfig.m4
===================================================================
RCS file: atconfig.m4
diff -N atconfig.m4
--- /tmp/cvsbqxB43      Thu Oct  4 10:53:14 2001
+++ /dev/null   Sat Apr 14 20:46:23 2001
@@ -1,22 +0,0 @@
-## ----------------------##
-## Prepare for testing.  ##
-## ----------------------##
-
-# serial 2
-
-# Single argument says where are built sources to test, relative to the
-# built test directory.  Maybe omitted if the same (flat distribution).
-
-AC_DEFUN([AT_CONFIG],
-[AT_TESTPATH=ifelse([$1], [], [.], [$1])
-AC_SUBST([AT_TESTPATH])
-# Try to be compatible with both Autoconf 2.13 and 2.50.
-if test -z "$ECHO_C$ECHO_N$ECHO_T"; then
-  ECHO_C="$ac_c"
-  ECHO_N="$ac_n"
-  ECHO_T="$ac_t"
-  AC_SUBST([ECHO_C])
-  AC_SUBST([ECHO_N])
-  AC_SUBST([ECHO_T])
-fi
-])
Index: m4/dmalloc.m4
===================================================================
RCS file: dmalloc.m4
diff -N dmalloc.m4
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ dmalloc.m4  Thu Oct  4 10:53:14 2001
@@ -0,0 +1,22 @@
+## ----------------------------------- ##
+## Check if --with-dmalloc was given.  ##
+## From Franc,ois Pinard               ##
+## ----------------------------------- ##
+
+# serial 1
+
+AC_DEFUN([AM_WITH_DMALLOC],
+[AC_MSG_CHECKING([if malloc debugging is wanted])
+AC_ARG_WITH(dmalloc,
+[  --with-dmalloc          use dmalloc, as in
+                          http://www.dmalloc.com/dmalloc.tar.gz],
+[if test "$withval" = yes; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(WITH_DMALLOC,1,
+            [Define if using the dmalloc debugging malloc package])
+  LIBS="$LIBS -ldmalloc"
+  LDFLAGS="$LDFLAGS -g"
+else
+  AC_MSG_RESULT(no)
+fi], [AC_MSG_RESULT(no)])
+])
Index: m4/mbrtowc.m4
===================================================================
RCS file: mbrtowc.m4
diff -N mbrtowc.m4
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ mbrtowc.m4  Thu Oct  4 10:53:14 2001
@@ -0,0 +1,18 @@
+#serial 4
+
+dnl From Paul Eggert
+
+AC_DEFUN([jm_FUNC_MBRTOWC],
+[
+  AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
+    jm_cv_func_mbrtowc,
+    [AC_TRY_LINK(
+       [#include <wchar.h>],
+       [mbstate_t state; return ! (sizeof state && mbrtowc);],
+       jm_cv_func_mbrtowc=yes,
+       jm_cv_func_mbrtowc=no)])
+  if test $jm_cv_func_mbrtowc = yes; then
+    AC_DEFINE(HAVE_MBRTOWC, 1,
+      [Define to 1 if mbrtowc and mbstate_t are properly declared.])
+  fi
+])
Index: m4/prereq.m4
===================================================================
RCS file: /cvsroot/bison/bison/m4/prereq.m4,v
retrieving revision 1.1
diff -u -w -r1.1 prereq.m4
--- m4/prereq.m4        2000/10/16 17:28:40     1.1
+++ m4/prereq.m4        2001/10/04 14:53:14
@@ -1,12 +1,13 @@
-#serial 1
+#serial 2
 
 dnl These are the prerequisite macros for files in the lib/
 dnl directories of Bison.
 
 AC_DEFUN([jm_PREREQ_QUOTEARG],
 [
-  AC_CHECK_FUNCS(isascii iswprint mbrtowc)
-  AC_CHECK_HEADERS(limits.h stdlib.h string.h wchar.h wctype.h)
+  AC_CHECK_FUNCS(isascii iswprint mbsinit)
+  jm_FUNC_MBRTOWC
+  AC_CHECK_HEADERS(limits.h stddef.h stdlib.h string.h wchar.h wctype.h)
   AC_HEADER_STDC
   AC_C_BACKSLASH_A
   AC_MBSTATE_T
cvs server: Diffing po
Index: po/.cvsignore
===================================================================
RCS file: /cvsroot/bison/bison/po/.cvsignore,v
retrieving revision 1.4
diff -u -w -r1.4 .cvsignore
--- po/.cvsignore       2001/01/15 13:46:43     1.4
+++ po/.cvsignore       2001/10/04 14:53:14
@@ -4,3 +4,4 @@
 POTFILES
 bison.pot
 stamp-cat-id
+*.gmo
Index: po/ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/po/ChangeLog,v
retrieving revision 1.1
diff -u -w -r1.1 ChangeLog
--- po/ChangeLog        2001/08/09 09:59:03     1.1
+++ po/ChangeLog        2001/10/04 14:53:14
@@ -1,3 +1,13 @@
+2001-10-04  gettextize  <address@hidden>
+
+       * Makefile.in.in: Upgrade to gettext-0.10.40.
+       * cat-id-tbl.c: Remove file.
+
+2001-09-27  gettextize  <address@hidden>
+
+       * Makefile.in.in: Upgrade to gettext-0.10.40.
+       * cat-id-tbl.c: Remove file.
+
 2001-08-03  gettextize  <address@hidden>
 
        * Makefile.in.in: Upgrade to gettext-0.10.39.
Index: po/POTFILES.in
===================================================================
RCS file: /cvsroot/bison/bison/po/POTFILES.in,v
retrieving revision 1.8
diff -u -w -r1.8 POTFILES.in
--- po/POTFILES.in      2001/08/15 08:49:20     1.8
+++ po/POTFILES.in      2001/10/04 14:53:14
@@ -13,7 +13,6 @@
 src/print_graph.c
 src/reader.c
 src/reduce.c
-src/vcg.c
 
 lib/error.c
 lib/getopt.c
cvs server: cannot find po/cat-id-tbl.c
cvs server: Diffing src
Index: src/LR0.c
===================================================================
RCS file: /cvsroot/bison/bison/src/LR0.c,v
retrieving revision 1.15
diff -u -w -r1.15 LR0.c
--- src/LR0.c   2000/11/07 16:28:46     1.15
+++ src/LR0.c   2001/10/04 14:53:14
@@ -23,7 +23,6 @@
    The entry point is generate_states.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "state.h"
 #include "complain.h"
@@ -33,39 +32,39 @@
 
 int nstates;
 int final_state;
-core *first_state;
-shifts *first_shift;
-reductions *first_reduction;
-
-static core *this_state;
-static core *last_state;
-static shifts *last_shift;
-static reductions *last_reduction;
+core *first_state = NULL;
+shifts *first_shift = NULL;
+reductions *first_reduction = NULL;
+
+static core *this_state = NULL;
+static core *last_state = NULL;
+static shifts *last_shift = NULL;
+static reductions *last_reduction = NULL;
 
 static int nshifts;
-static short *shift_symbol;
+static short *shift_symbol = NULL;
 
-static short *redset;
-static short *shiftset;
+static short *redset = NULL;
+static short *shiftset = NULL;
 
-static short **kernel_base;
-static short **kernel_end;
-static short *kernel_items;
+static short **kernel_base = NULL;
+static short **kernel_end = NULL;
+static short *kernel_items = NULL;
 
 /* hash table for states, to recognize equivalent ones.  */
 
 #define        STATE_TABLE_SIZE        1009
-static core **state_table;
+static core **state_table = NULL;
 
 
 static void
 allocate_itemsets (void)
 {
-  short *itemp;
+  short *itemp = NULL;
   int symbol;
   int i;
   int count;
-  short *symbol_count;
+  short *symbol_count = NULL;
 
   count = 0;
   symbol_count = XCALLOC (short, nsyms);
@@ -89,6 +88,7 @@
      We allocate that much space for each symbol.  */
 
   kernel_base = XCALLOC (short *, nsyms);
+  if (count)
   kernel_items = XCALLOC (short, count);
 
   count = 0;
Index: src/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/src/bison.simple,v
retrieving revision 1.68
diff -u -w -r1.68 bison.simple
--- src/bison.simple    2001/09/25 11:36:25     1.68
+++ src/bison.simple    2001/10/04 14:53:14
@@ -995,4 +995,3 @@
 
 #line %%input_line "%%filename"
 %%epilogue
-
Index: src/closure.c
===================================================================
RCS file: /cvsroot/bison/bison/src/closure.c,v
retrieving revision 1.13
diff -u -w -r1.13 closure.c
--- src/closure.c       2000/11/07 16:28:46     1.13
+++ src/closure.c       2001/10/04 14:53:14
@@ -19,7 +19,6 @@
    02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "closure.h"
 #include "derives.h"
Index: src/complain.c
===================================================================
RCS file: /cvsroot/bison/bison/src/complain.c,v
retrieving revision 1.4
diff -u -w -r1.4 complain.c
--- src/complain.c      2001/08/03 09:38:03     1.4
+++ src/complain.c      2001/10/04 14:53:14
@@ -19,14 +19,10 @@
 /* Based on error.c and error.h,
    written by David MacKenzie <address@hidden>.  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
+#include "system.h"
 
 #if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
-# if __STDC__
+# ifdef __STDC__
 #  include <stdarg.h>
 #  define VA_START(args, lastarg) va_start(args, lastarg)
 # else
@@ -119,7 +115,7 @@
 `--------------------------------*/
 
 void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined __STDC__
 warn (const char *message, ...)
 #else
 warn (message, va_alist)
@@ -171,7 +167,7 @@
 `-----------------------------------------------------------*/
 
 void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined __STDC__
 complain (const char *message, ...)
 #else
 complain (message, va_alist)
@@ -221,7 +217,7 @@
 `-------------------------------------------------*/
 
 void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined __STDC__
 fatal (const char *message, ...)
 #else
 fatal (message, va_alist)
@@ -259,7 +255,7 @@
 `------------------------------------------------------------------*/
 
 void
-#if defined VA_START && __STDC__
+#if defined VA_START && defined __STDC__
 error (int status, int errnum,
        const char *message, ...)
 #else
Index: src/complain.h
===================================================================
RCS file: /cvsroot/bison/bison/src/complain.h,v
retrieving revision 1.2
diff -u -w -r1.2 complain.h
--- src/complain.h      2000/11/07 16:28:46     1.2
+++ src/complain.h      2001/10/04 14:53:14
@@ -23,7 +23,7 @@
 extern "C" {
 #endif
 
-#if defined (__STDC__) && __STDC__
+#ifdef __STDC__
 
 /* Informative messages, but we proceed. */
 
Index: src/conflicts.c
===================================================================
RCS file: /cvsroot/bison/bison/src/conflicts.c,v
retrieving revision 1.22
diff -u -w -r1.22 conflicts.c
--- src/conflicts.c     2001/02/08 14:51:33     1.22
+++ src/conflicts.c     2001/10/04 14:53:14
@@ -20,7 +20,6 @@
 
 #include "system.h"
 #include "getargs.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "state.h"
@@ -30,12 +29,12 @@
 #include "LR0.h"
 
 int any_conflicts = 0;
-errs **err_table;
+errs **err_table = NULL;
 int expected_conflicts;
-static char *conflicts;
+static char *conflicts = NULL;
 
-static unsigned *shiftset;
-static unsigned *lookaheadset;
+static unsigned *shiftset = NULL;
+static unsigned *lookaheadset = NULL;
 static int src_total;
 static int rrc_total;
 static int src_count;
@@ -264,7 +263,7 @@
 }
 
 void
-initialize_conflicts (void)
+solve_conflicts (void)
 {
   int i;
 
@@ -458,7 +457,7 @@
 `---------------------------------------------*/
 
 void
-print_conflicts (void)
+print_conflicts (FILE *out)
 {
   int i;
 
@@ -478,9 +477,8 @@
 
          if (verbose_flag)
            {
-             obstack_fgrow1 (&output_obstack, _("State %d contains"), i);
-             obstack_sgrow (&output_obstack,
-                            conflict_report (src_count, rrc_count));
+             fprintf (out, _("State %d contains"), i);
+             fputs (conflict_report (src_count, rrc_count), out);
            }
        }
     }
@@ -738,7 +736,7 @@
 
 
 void
-finalize_conflicts (void)
+free_conflicts (void)
 {
   XFREE (conflicts);
   XFREE (shiftset);
Index: src/conflicts.h
===================================================================
RCS file: /cvsroot/bison/bison/src/conflicts.h,v
retrieving revision 1.3
diff -u -w -r1.3 conflicts.h
--- src/conflicts.h     2000/11/07 16:28:46     1.3
+++ src/conflicts.h     2001/10/04 14:53:14
@@ -22,10 +22,10 @@
 # define CONFLICTS_H_
 # include "state.h"
 
-void initialize_conflicts PARAMS ((void));
-void print_conflicts PARAMS ((void));
+void solve_conflicts PARAMS ((void));
+void print_conflicts PARAMS ((FILE *out));
 void print_reductions PARAMS ((int));
-void finalize_conflicts PARAMS ((void));
+void free_conflicts PARAMS ((void));
 
 /* Were there conflicts? */
 extern int any_conflicts;
Index: src/derives.c
===================================================================
RCS file: /cvsroot/bison/bison/src/derives.c,v
retrieving revision 1.13
diff -u -w -r1.13 derives.c
--- src/derives.c       2000/11/07 16:28:46     1.13
+++ src/derives.c       2001/10/04 14:53:14
@@ -25,7 +25,6 @@
    */
 
 #include "system.h"
-#include "xalloc.h"
 #include "types.h"
 #include "gram.h"
 #include "derives.h"
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.51
diff -u -w -r1.51 files.c
--- src/files.c 2001/08/15 08:53:15     1.51
+++ src/files.c 2001/10/04 14:53:14
@@ -22,7 +22,6 @@
 #include "system.h"
 #include "getargs.h"
 #include "files.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "complain.h"
 
@@ -34,11 +33,13 @@
 struct obstack defines_obstack;
 struct obstack guard_obstack;
 struct obstack output_obstack;
-struct obstack graph_obstack;
 
 char *spec_outfile = NULL;     /* for -o. */
 char *spec_file_prefix = NULL; /* for -b. */
 char *spec_name_prefix = NULL; /* for -p. */
+char *spec_verbose_file = NULL;   /* for --verbose. */
+char *spec_graph_file = NULL;   /* for -g. */
+char *spec_defines_file = NULL; /* for --defines. */
 
 char *infile = NULL;
 char *attrsfile = NULL;
@@ -93,24 +94,26 @@
 static char *
 compute_header_macro (void)
 {
-  int ite;
-  char *macro_name;
+  char *macro_name, *cp;
 
+  if (spec_defines_file)
+    macro_name = xstrdup (spec_defines_file);
+  else
+    {
   macro_name = XMALLOC (char,
                        strlen (base_name) +
                        strlen (header_extension) + 1);
 
   stpcpy (macro_name, base_name);
   strcat (macro_name, header_extension);
-
-  for (ite = 0; macro_name[ite]; ite++)
-    if (macro_name[ite] == '.')
-      macro_name[ite] = '_';
-    else
-      {
-       if (islower (macro_name[ite]))
-         macro_name[ite] -= ('a' - 'A');
       }
+
+  for (cp = macro_name; *cp; ++cp)
+    if (islower (*cp))
+      *cp = toupper (*cp);
+    else if (!isalnum (*cp))
+      *cp = '_';
+
   return macro_name;
 }
 
@@ -194,17 +197,42 @@
 {
   const char *res = getenv (envvar);
 
-#ifdef MSDOS
-  const char *cp;
+#if defined (MSDOS) || defined (_WIN32)
+  if (!res)
+    {
+      /* Skeleton file name without path */
+      const char *skel_name = strrchr(skeleton_name, '/');
+      if (!skel_name)
+        skel_name = strrchr(skeleton_name, '\\');
+      if (!skel_name)
+        skel_name = skeleton_name;
+      else
+        ++skel_name;
 
   /* File doesn't exist in current directory; try in INIT directory.  */
-  if (!res && (cp = getenv ("INIT")))
+      const char *cp = getenv ("INIT");
+      if (cp)
     {
-      res = XMALLOC (char, strlen (cp) + strlen (skeleton_name) + 2);
-      sprintf (res, "%s%c%s", cp, '/', skeleton_name);
+         res = XMALLOC (char, strlen (cp) + strlen (skel_name) + 2);
+         sprintf (res, "%s%c%s", cp, '\\', skel_name);
     }
-#endif /* !MSDOS */
-
+      else if (access (skel_name, 4) == 0) /* Look in current dir. */
+        res = skel_name;
+      else
+       {
+         /* Look in program locations dir. */
+         extern char *program_name;
+         cp = strrchr(program_name, '\\');
+         if (!cp)
+           return skeleton_name;
+         else
+           ++cp;
+         res = XMALLOC (char, cp - program_name + strlen (skel_name) + 1);
+         strncpy (res, program_name, cp - program_name);
+         strcpy (res + (cp - program_name), skel_name);
+       }
+    }
+#endif /* defined (MSDOS) || defined (_WIN32) */
   if (!res)
     res = skeleton_name;
 
@@ -260,21 +288,11 @@
 static void
 compute_exts_from_gf (const char *ext)
 {
-  /* Checks if SRC_EXTENSION is NULL. In the other case, %source_extension
-     was specified in the grammar file.  */
-  if (src_extension == NULL)
-    {
       src_extension = tr (ext, 'y', 'c');
       src_extension = tr (src_extension, 'Y', 'C');
-    }
-  /* Checks if HEADER_EXTENSION is NULL. In the other case,
-     %header_extension was specified in the grammar file.  */
-  if (header_extension == NULL)
-    {
       header_extension = tr (ext, 'y', 'h');
       header_extension = tr (header_extension, 'Y', 'H');
     }
-}
 
 /* Computes extensions from the given c source file extension. */
 static void
@@ -395,6 +413,38 @@
   }
 }
 
+/*-------------------------------------------------------.
+| Close the open files, compute the output files names.  |
+`-------------------------------------------------------*/
+
+void
+compute_output_file_names (void)
+{
+  compute_base_names ();
+
+  /* If not yet done. */
+  if (!src_extension)
+    src_extension = ".c";
+  if (!header_extension)
+    header_extension = ".h";
+
+  /* It the defines filename if not given, we create it.  */
+  if (!spec_defines_file)
+    spec_defines_file = stringappend (base_name, header_extension);
+
+  /* It the graph filename if not given, we create it.  */
+  if (!spec_graph_file)
+    spec_graph_file = stringappend (short_base_name, ".vcg");
+
+  spec_verbose_file = stringappend (short_base_name, EXT_OUTPUT);
+
+  attrsfile = stringappend (short_base_name, EXT_STYPE_H);
+#ifndef MSDOS
+  attrsfile = stringappend (attrsfile, header_extension);
+#endif /* MSDOS */
+
+}
+
 /*-----------------------------------------------------------------.
 | Open the input file.  Look for the skeletons.  Find the names of |
 | the output files.  Prepare the obstacks.                         |
@@ -412,46 +462,47 @@
   obstack_init (&defines_obstack);
   obstack_init (&guard_obstack);
   obstack_init (&output_obstack);
-  obstack_init (&graph_obstack);
 }
 
 
 
-/*-----------------------------------------------------.
-| Close the open files, produce all the output files.  |
-`-----------------------------------------------------*/
+/*-----------------------.
+| Close the open file..  |
+`-----------------------*/
 
 void
-output_files (void)
+close_files (void)
 {
   xfclose (finput);
-
-  compute_base_names ();
-
-  /* Set default extensions */
-  if (!src_extension)
-    src_extension = ".c";
-  if (!header_extension)
-    header_extension = ".h";
+}
 
-  attrsfile = stringappend (short_base_name, EXT_STYPE_H);
-#ifndef MSDOS
-  stringappend (attrsfile, header_extension);
-#endif /* MSDOS */
+/*---------------------------.
+| Produce the output files.  |
+`---------------------------*/
 
+void
+output_files (void)
+{
   /* Output the main file.  */
   if (spec_outfile)
     obstack_save (&table_obstack, spec_outfile);
   else
     obstack_save (&table_obstack, stringappend (base_name, src_extension));
+  obstack_free (&table_obstack, NULL);
 
   /* Output the header file if wanted. */
   if (defines_flag)
-    defines_obstack_save (stringappend (base_name, header_extension));
+    defines_obstack_save (spec_defines_file);
+  obstack_free (&defines_obstack, NULL);
 
+#if 0
+  /* Seems to be invalid now --akim. */
+
   /* If we output only the table, dump the actions in ACTFILE. */
   if (no_parser_flag)
     obstack_save (&action_obstack, stringappend (short_base_name, ".act"));
+  obstack_free (&action_obstack, NULL);
+#endif
 
   /* If we produced a semantic parser ATTRS_OBSTACK must be dumped
      into its own file, ATTTRSFILE.  */
@@ -460,19 +511,12 @@
       char *temp_name;
 
       obstack_save (&attrs_obstack, attrsfile);
+      obstack_free (&attrs_obstack, NULL);
       temp_name = stringappend (short_base_name, EXT_GUARD_C);
 #ifndef MSDOS
       temp_name = stringappend (temp_name, src_extension);
 #endif /* MSDOS */
       obstack_save (&guard_obstack, temp_name);
+      obstack_free (&guard_obstack, NULL);
     }
-
-  if (verbose_flag)
-    /* We used to use just .out if spec_name_prefix (-p) was used, but
-       that conflicts with Posix.  */
-    obstack_save (&output_obstack,
-                 stringappend (short_base_name, EXT_OUTPUT));
-
-  if (graph_flag)
-    obstack_save (&graph_obstack, stringappend (short_base_name, ".vcg"));
 }
Index: src/files.h
===================================================================
RCS file: /cvsroot/bison/bison/src/files.h,v
retrieving revision 1.18
diff -u -w -r1.18 files.h
--- src/files.h 2001/08/06 09:22:33     1.18
+++ src/files.h 2001/10/04 14:53:14
@@ -33,10 +33,19 @@
 /* File name pfx specified with -b, or 0 if no -b.  */
 extern char *spec_file_prefix;
 
+/* --verbose. */
+extern char *spec_verbose_file;
 
+/* File name specified for the output VCG graph.  */
+extern char *spec_graph_file;
+
+/* File name specified with --defines.  */
+extern char *spec_defines_file;
+
 /* Read grammar specifications. */
 extern FILE *finput;
 
+
 /* Output all the action code; precise form depends on which parser. */
 extern struct obstack action_obstack;
 
@@ -56,17 +65,13 @@
 /* The verbose output. */
 extern struct obstack output_obstack;
 
-/* The VCG graph output. */
-extern struct obstack graph_obstack;
-
 extern char *infile;
 extern char *attrsfile;
 
-extern const char *src_extension;
-extern const char *header_extension;
-
 void open_files PARAMS((void));
+void close_files PARAMS((void));
 
+void compute_output_file_names PARAMS((void));
 void output_files PARAMS((void));
 
 FILE *xfopen PARAMS ((const char *name, const char *mode));
Index: src/getargs.c
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.c,v
retrieving revision 1.25
diff -u -w -r1.25 getargs.c
--- src/getargs.c       2001/09/20 18:32:20     1.25
+++ src/getargs.c       2001/10/04 14:53:14
@@ -89,7 +89,9 @@
   -d, --defines              also produce a header file\n\
   -v, --verbose              also produce an explanation of the automaton\n\
   -b, --file-prefix=PREFIX   specify a PREFIX for output files\n\
-  -o, --output-file=FILE     leave output to FILE\n"), stream);
+  -o, --output-file=FILE     leave output to FILE\n\
+  -g, --graph                also produce a VCG graph description of the \
+automaton\n"), stream);
   putc ('\n', stream);
 
   fputs (_("\
@@ -153,7 +155,9 @@
        exit (0);
 
       case 'g':
+       /* Here, the -g and --graph=FILE options are differentiated.  */
        graph_flag = 1;
+       spec_graph_file = optarg;
        break;
 
       case 'v':
@@ -165,7 +169,9 @@
        break;
 
       case 'd':
+       /* Here, the -d and --defines options are differentiated.  */
        defines_flag = 1;
+       spec_defines_file = optarg;
        break;
 
       case 'l':
Index: src/gram.c
===================================================================
RCS file: /cvsroot/bison/bison/src/gram.c,v
retrieving revision 1.6
diff -u -w -r1.6 gram.c
--- src/gram.c  2000/11/07 16:28:46     1.6
+++ src/gram.c  2001/10/04 14:53:14
@@ -31,20 +31,18 @@
 int ntokens;
 int nvars;
 
-short *ritem;
-short *rlhs;
-short *rrhs;
-short *rprec;
-short *rprecsym;
-short *sprec;
-short *rassoc;
-short *sassoc;
-short *token_translations;
-short *rline;
+short *ritem = NULL;
+short *rlhs = NULL;
+short *rrhs = NULL;
+short *rprec = NULL;
+short *rprecsym = NULL;
+short *sprec = NULL;
+short *rassoc = NULL;
+short *sassoc = NULL;
+short *token_translations = NULL;
+short *rline = NULL;
 
 int start_symbol;
-
-int translations;
 
 int max_user_token_number;
 
Index: src/gram.h
===================================================================
RCS file: /cvsroot/bison/bison/src/gram.h,v
retrieving revision 1.6
diff -u -w -r1.6 gram.h
--- src/gram.h  2000/11/07 16:28:46     1.6
+++ src/gram.h  2001/10/04 14:53:14
@@ -107,13 +107,9 @@
 
 /* token translation table: indexed by a token number as returned by
    the user's yylex routine, it yields the internal token number used
-   by the parser and throughout bison.  If translations is zero, the
-   translation table is not used because the two kinds of token
-   numbers are the same.  (It is noted in reader.c that "Nowadays
-   translations is always set to 1...") */
+   by the parser and throughout bison.  */
 
 extern short *token_translations;
-extern int translations;
 extern int max_user_token_number;
 
 /* SEMANTIC_PARSER is nonzero if the input file says to use the hairy
Index: src/lalr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lalr.c,v
retrieving revision 1.16
diff -u -w -r1.16 lalr.c
--- src/lalr.c  2000/11/07 16:28:46     1.16
+++ src/lalr.c  2001/10/04 14:53:14
@@ -26,7 +26,6 @@
 #include "system.h"
 #include "types.h"
 #include "LR0.h"
-#include "xalloc.h"
 #include "gram.h"
 #include "complain.h"
 #include "lalr.h"
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.39
diff -u -w -r1.39 lex.c
--- src/lex.c   2001/09/21 15:42:26     1.39
+++ src/lex.c   2001/10/04 14:53:14
@@ -25,7 +25,6 @@
 #include "symtab.h"
 #include "options.h"
 #include "lex.h"
-#include "xalloc.h"
 #include "complain.h"
 #include "gram.h"
 #include "quote.h"
@@ -37,18 +36,27 @@
 bucket *symval;
 int numval;
 
-static int unlexed;            /* these two describe a token to be reread */
-static bucket *unlexed_symval; /* by the next call to lex */
+/* these two describe a token to be reread */
+static token_t unlexed = tok_undef;
+/* by the next call to lex */
+static bucket *unlexed_symval = NULL;
 
 
 void
-init_lex (void)
+lex_init (void)
 {
   obstack_init (&token_obstack);
-  unlexed = -1;
+  unlexed = tok_undef;
 }
 
 
+void
+lex_free (void)
+{
+  obstack_free (&token_obstack, NULL);
+}
+
+
 int
 skip_white_space (void)
 {
@@ -314,7 +322,7 @@
 
 
 void
-unlex (int token)
+unlex (token_t token)
 {
   unlexed = token;
   unlexed_symval = symval;
@@ -357,12 +365,12 @@
   /* Just to make sure. */
   token_buffer = NULL;
 
-  if (unlexed >= 0)
+  if (unlexed != tok_undef)
     {
+      token_t res = unlexed;
       symval = unlexed_symval;
-      c = unlexed;
-      unlexed = -1;
-      return c;
+      unlexed = tok_undef;
+      return res;
     }
 
   c = skip_white_space ();
@@ -418,7 +426,6 @@
     case '\'':
       /* parse the literal token and compute character code in  code  */
 
-      translations = -1;
       {
        int code, discode;
 
@@ -446,7 +453,6 @@
     case '\"':
       /* parse the literal string token and treat as an identifier */
 
-      translations = -1;
       {
        int code;               /* ignored here */
 
@@ -464,32 +470,40 @@
       }
 
     case ',':
+      token_buffer = ",";
       return tok_comma;
 
     case ':':
+      token_buffer = ":";
       return tok_colon;
 
     case ';':
+      token_buffer = ";";
       return tok_semicolon;
 
     case '|':
+      token_buffer = "|";
       return tok_bar;
 
     case '{':
+      token_buffer = "{";
       return tok_left_curly;
 
     case '=':
+      obstack_1grow (&token_obstack, c);
       do
        {
          c = getc (finput);
+         obstack_1grow (&token_obstack, c);
          if (c == '\n')
            lineno++;
        }
       while (c == ' ' || c == '\n' || c == '\t');
+      obstack_1grow (&token_obstack, '\0');
+      token_buffer = obstack_finish (&token_obstack);
 
       if (c == '{')
        {
-         token_buffer = "={";
          return tok_left_curly;
        }
       else
@@ -506,6 +520,9 @@
       return parse_percent_token ();
 
     default:
+      obstack_1grow (&token_obstack, c);
+      obstack_1grow (&token_obstack, '\0');
+      token_buffer = obstack_finish (&token_obstack);
       return tok_illegal;
     }
 }
@@ -519,7 +536,8 @@
     const unsigned char *l, *r;
     int c;
 
-    assert(left != NULL && right != NULL);     
+  assert (left);
+  assert (right);
     l = (const unsigned char *)left;
     r = (const unsigned char *)right;
     while (((c = *l - *r++) == 0 && *l != '\0')
@@ -531,13 +549,12 @@
 /* Parse a token which starts with %.
    Assumes the % has already been read and discarded.  */
 
-int
+token_t
 parse_percent_token (void)
 {
-  int c;
   const struct option_table_struct *tx;
 
-  c = getc (finput);
+  int c = getc (finput);
 
   switch (c)
     {
@@ -600,6 +617,10 @@
 
     case tok_obsolete:
       fatal (_("`%s' is no longer supported"), token_buffer);
+      break;
+
+    default:
+      /* Other cases do not apply here. */
       break;
     }
 
Index: src/lex.h
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.h,v
retrieving revision 1.17
diff -u -w -r1.17 lex.h
--- src/lex.h   2001/08/30 00:41:37     1.17
+++ src/lex.h   2001/10/04 14:53:14
@@ -24,6 +24,7 @@
 /* Token-type codes. */
 typedef enum token_e
   {
+    tok_undef, /* Not defined.  Used to initial token_t vars. */
     tok_eof,
     tok_identifier,
     tok_comma,
@@ -47,8 +48,6 @@
     tok_number,
     tok_expect,
     tok_thong,
-    tok_hdrext,
-    tok_srcext,
     tok_define,
     tok_skel,
     tok_noop,
@@ -61,9 +60,10 @@
 extern bucket *symval;
 extern int numval;
 
-void init_lex PARAMS ((void));
+void lex_init PARAMS ((void));
+void lex_free PARAMS ((void));
 int skip_white_space PARAMS ((void));
-void unlex PARAMS ((int));
+void unlex PARAMS ((token_t));
 void read_type_name PARAMS ((FILE *fin));
 
 /* Return one of the token-type codes.  When an identifier is seen,
@@ -73,6 +73,6 @@
 
 token_t lex PARAMS ((void));
 
-int parse_percent_token PARAMS ((void));
+token_t parse_percent_token PARAMS ((void));
 
 #endif /* !LEX_H_ */
Index: src/main.c
===================================================================
RCS file: /cvsroot/bison/bison/src/main.c,v
retrieving revision 1.36
diff -u -w -r1.36 main.c
--- src/main.c  2001/09/02 15:43:29     1.36
+++ src/main.c  2001/10/04 14:53:14
@@ -1,5 +1,5 @@
 /* Top level entry point of bison,
-   Copyright 1984, 1986, 1989, 1992, 1995, 2000
+   Copyright 1984, 1986, 1989, 1992, 1995, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
@@ -35,6 +35,8 @@
 #include "conflicts.h"
 #include "print_graph.h"
 #include "muscle_tab.h"
+#include "symtab.h"
+#include "lex.h"
 
 /* The name this program was run with, for messages.  */
 char *program_name;
@@ -81,8 +83,16 @@
      lookahead is not enough to disambiguate the parsing.  In file
      conflicts.  Also resolve s/r conflicts based on precedence
      declarations.  */
-  initialize_conflicts ();
+  solve_conflicts ();
 
+  /* Output file names. */
+  compute_output_file_names ();
+
+  /* Stop if there were errors, to avoid trashing previous output
+     files.  */
+  if (complain_message_count)
+    exit (1);
+
   /* Print information about results, if requested.  */
   print_results ();
 
@@ -91,12 +101,19 @@
 
   /* Output the tables and the parser to ftable.  In file output.  */
   output ();
+
+  /* Free the symbol table data structure.  */
+  free_symtab ();
+
+  lex_free ();
+
+  /* Close the input files. */
+  close_files ();
 
-  finalize_conflicts ();
+  free_conflicts ();
   free_nullable ();
   free_derives ();
 
-  if (!complain_message_count)
     output_files ();
 
   exit (complain_message_count ? 1 : 0);
Index: src/nullable.c
===================================================================
RCS file: /cvsroot/bison/bison/src/nullable.c,v
retrieving revision 1.10
diff -u -w -r1.10 nullable.c
--- src/nullable.c      2000/11/07 16:28:47     1.10
+++ src/nullable.c      2001/10/04 14:53:14
@@ -26,7 +26,6 @@
 #include "system.h"
 #include "types.h"
 #include "gram.h"
-#include "xalloc.h"
 #include "nullable.h"
 
 char *nullable = NULL;
Index: src/options.c
===================================================================
RCS file: /cvsroot/bison/bison/src/options.c,v
retrieving revision 1.3
diff -u -w -r1.3 options.c
--- src/options.c       2001/09/21 15:42:26     1.3
+++ src/options.c       2001/10/04 14:53:14
@@ -53,7 +53,7 @@
   /* Output. */
   {opt_cmd_line, "file-prefix",        required_argument,         0,         
0,   'b'},
   {opt_cmd_line, "output-file",        required_argument,         0,         
0,   'o'},
-  {opt_cmd_line, "graph",     no_argument,                0,         0,   'g'},
+  {opt_cmd_line, "graph",      optional_argument,         0,         0,   'g'},
 
   /* Hidden. */
   {opt_cmd_line, "statistics", no_argument, &statistics_flag,        0,     1},
@@ -86,8 +86,6 @@
   {opt_both, "file-prefix", 
required_argument,&spec_file_prefix,tok_setopt,'b'},
   {opt_both, "name-prefix", 
required_argument,&spec_name_prefix,tok_setopt,'p'},
 #endif
-  {opt_percent, "header-extension",    0,              NULL, tok_hdrext,    0},
-  {opt_percent, "source-extension",    0,              NULL, tok_srcext,    0},
   {opt_percent, "define",              0,              NULL, tok_define,    0},
   {opt_percent, "semantic-parser",     0,  &semantic_parser, tok_noop,      0},
   {opt_percent, "pure-parser",         0,      &pure_parser, tok_noop,      0},
@@ -101,7 +99,7 @@
      the same, the char `-'.  */
 
   /* Output.  */
-  {opt_both, "defines",               no_argument,   &defines_flag, tok_noop,  
   'd'},
+  {opt_both, "defines",               optional_argument,   &defines_flag, 
tok_noop,       'd'},
   {opt_both, "verbose",               no_argument,   &verbose_flag, tok_noop,  
   'v'},
 
   /* Operation modes.  */
@@ -109,7 +107,7 @@
   {opt_both, "yacc",          no_argument,      &yacc_flag, tok_noop,     'y'},
 
   /* Parser.  */
-  {opt_both, "debug",         no_argument,     &debug_flag, tok_noop,     'd'},
+  {opt_both, "debug",         no_argument,     &debug_flag, tok_noop,     't'},
   {opt_both, "locations",      no_argument, &locations_flag, tok_noop,       
1},
   {opt_both, "no-lines",       no_argument,  &no_lines_flag, tok_noop,    'l'},
   {opt_both, "no-parser",      no_argument, &no_parser_flag, tok_noop,    'n'},
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.61
diff -u -w -r1.61 output.c
--- src/output.c        2001/09/25 11:36:25     1.61
+++ src/output.c        2001/10/04 14:53:14
@@ -94,7 +94,6 @@
 #include "obstack.h"
 #include "quotearg.h"
 #include "getargs.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
@@ -109,17 +108,17 @@
 
 static int nvectors;
 static int nentries;
-static short **froms;
-static short **tos;
-static short *tally;
-static short *width;
-static short *actrow;
-static short *state_count;
-static short *order;
-static short *base;
-static short *pos;
-static short *table;
-static short *check;
+static short **froms = NULL;
+static short **tos = NULL;
+static short *tally = NULL;
+static short *width = NULL;
+static short *actrow = NULL;
+static short *state_count = NULL;
+static short *order = NULL;
+static short *base = NULL;
+static short *pos = NULL;
+static short *table = NULL;
+static short *check = NULL;
 static int lowzero;
 static int high;
 
@@ -161,6 +160,7 @@
   output_table_data (&output_obstack, token_translations, 
                     0, 1, max_user_token_number + 1);
   muscle_insert ("translate", obstack_finish (&output_obstack));
+  XFREE (token_translations);
 }
 
 
Index: src/print.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print.c,v
retrieving revision 1.17
diff -u -w -r1.17 print.c
--- src/print.c 2000/12/20 17:21:14     1.17
+++ src/print.c 2001/10/04 14:53:14
@@ -20,7 +20,6 @@
 
 
 #include "system.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
@@ -35,17 +34,17 @@
 static void
 print_token (int extnum, int token)
 {
-  obstack_fgrow2 (&output_obstack, _(" type %d is %s\n"), extnum, tags[token]);
+  fprintf (out, _(" type %d is %s\n"), extnum, tags[token]);
 }
 #endif
 
 
-/*================================\
+/*--------------------------------.
 | Report information on a state.  |
-\================================*/
+`--------------------------------*/
 
 static void
-print_core (int state)
+print_core (FILE *out, int state)
 {
   int i;
   int k;
@@ -68,30 +67,30 @@
        sp++;
 
       rule = -(*sp);
-      obstack_fgrow1 (&output_obstack, "    %s  ->  ", tags[rlhs[rule]]);
+      fprintf (out, "    %s  ->  ", tags[rlhs[rule]]);
 
       for (sp = ritem + rrhs[rule]; sp < sp1; sp++)
        {
-         obstack_fgrow1 (&output_obstack, "%s ", tags[*sp]);
+         fprintf (out, "%s ", tags[*sp]);
        }
 
-      obstack_1grow (&output_obstack, '.');
+      fputc ('.', out);
 
       while (*sp > 0)
        {
-         obstack_fgrow1 (&output_obstack, " %s", tags[*sp]);
+         fprintf (out, " %s", tags[*sp]);
          sp++;
        }
 
-      obstack_fgrow1 (&output_obstack, _("   (rule %d)"), rule);
-      obstack_1grow (&output_obstack, '\n');
+      fprintf (out, _("   (rule %d)"), rule);
+      fputc ('\n', out);
     }
 
-  obstack_1grow (&output_obstack, '\n');
+  fputc ('\n', out);
 }
 
 static void
-print_actions (int state)
+print_actions (FILE *out, int state)
 {
   int i;
   int k;
@@ -109,9 +108,9 @@
   if (!shiftp && !redp)
     {
       if (final_state == state)
-       obstack_sgrow (&output_obstack, _("    $default\taccept\n"));
+       fprintf (out, _("    $default\taccept\n"));
       else
-       obstack_sgrow (&output_obstack, _("    NO ACTIONS\n"));
+       fprintf (out, _("    NO ACTIONS\n"));
       return;
     }
 
@@ -129,16 +128,16 @@
          if (ISVAR (symbol))
            break;
          if (symbol == 0)      /* I.e. strcmp(tags[symbol],"$")==0 */
-           obstack_fgrow1 (&output_obstack,
+           fprintf (out,
                            _("    $   \tgo to state %d\n"), state1);
          else
-           obstack_fgrow2 (&output_obstack,
+           fprintf (out,
                            _("    %-4s\tshift, and go to state %d\n"),
                            tags[symbol], state1);
        }
 
       if (i > 0)
-       obstack_1grow (&output_obstack, '\n');
+       fputc ('\n', out);
     }
   else
     {
@@ -157,20 +156,19 @@
          if (!errp->errs[j])
            continue;
          symbol = errp->errs[j];
-         obstack_fgrow1 (&output_obstack, _("    %-4s\terror 
(nonassociative)\n"),
+         fprintf (out, _("    %-4s\terror (nonassociative)\n"),
                   tags[symbol]);
        }
 
       if (j > 0)
-       obstack_1grow (&output_obstack, '\n');
+       fputc ('\n', out);
     }
 
   if (consistent[state] && redp)
     {
       rule = redp->rules[0];
       symbol = rlhs[rule];
-      obstack_fgrow2 (&output_obstack,
-                     _("    $default\treduce using rule %d (%s)\n\n"),
+      fprintf (out, _("    $default\treduce using rule %d (%s)\n\n"),
                      rule, tags[symbol]);
     }
   else if (redp)
@@ -186,23 +184,22 @@
            continue;
          state1 = shiftp->shifts[i];
          symbol = accessing_symbol[state1];
-         obstack_fgrow2 (&output_obstack,
-                         _("    %-4s\tgo to state %d\n"),
+         fprintf (out, _("    %-4s\tgo to state %d\n"),
                          tags[symbol], state1);
        }
 
-      obstack_1grow (&output_obstack, '\n');
+      fputc ('\n', out);
     }
 }
 
 static void
-print_state (int state)
+print_state (FILE *out, int state)
 {
-  obstack_sgrow (&output_obstack, "\n\n");
-  obstack_fgrow1 (&output_obstack, _("state %d"), state);
-  obstack_sgrow (&output_obstack, "\n\n");
-  print_core (state);
-  print_actions (state);
+  fputs ("\n\n", out);
+  fprintf (out, _("state %d"), state);
+  fputs ("\n\n", out);
+  print_core (out, state);
+  print_actions (out, state);
 }
 
 /*-----------------------------------------.
@@ -213,7 +210,7 @@
 do {                                                           \
   if (column + strlen(buffer) > (End))                         \
     {                                                          \
-      obstack_fgrow1 (&output_obstack, "%s\n   ", buffer);     \
+      fprintf (out, "%s\n   ", buffer);                \
       column = 3;                                              \
       buffer[0] = 0;                                           \
     }                                                          \
@@ -221,7 +218,7 @@
 
 
 static void
-print_grammar (void)
+print_grammar (FILE *out)
 {
   int i, j;
   short *rule;
@@ -229,38 +226,30 @@
   int column = 0;
 
   /* rule # : LHS -> RHS */
-  obstack_1grow (&output_obstack, '\n');
-  obstack_sgrow (&output_obstack, _("Grammar"));
-  obstack_1grow (&output_obstack, '\n');
+  fprintf (out, "\n%s\n", _("Grammar"));
   for (i = 1; i <= nrules; i++)
     /* Don't print rules disabled in reduce_grammar_tables.  */
     if (rlhs[i] >= 0)
       {
-       obstack_fgrow2 (&output_obstack,
-                       _("rule %-4d %s ->"), i, tags[rlhs[i]]);
+       fprintf (out, _("rule %-4d %s ->"), i, tags[rlhs[i]]);
        rule = &ritem[rrhs[i]];
        if (*rule > 0)
          while (*rule > 0)
-           obstack_fgrow1 (&output_obstack, " %s", tags[*rule++]);
+           fprintf (out, " %s", tags[*rule++]);
        else
-         obstack_sgrow (&output_obstack, _("           /* empty */"));
-       obstack_1grow (&output_obstack, '\n');
+         fprintf (out, "               /* %s */\n", _("empty"));
       }
 
   /* TERMINAL (type #) : rule #s terminal is on RHS */
-  obstack_sgrow (&output_obstack, "\n");
-  obstack_sgrow (&output_obstack,
-                _("Terminals, with rules where they appear"));
-  obstack_sgrow (&output_obstack, "\n\n");
-  obstack_fgrow1 (&output_obstack, "%s (-1)\n", tags[0]);
-  if (translations)
-    {
+  fprintf (out, "\n%s\n\n", _("Terminals, with rules where they appear"));
+  fprintf (out, "%s (-1)\n", tags[0]);
+
       for (i = 0; i <= max_user_token_number; i++)
        if (token_translations[i] != 2)
          {
            buffer[0] = 0;
            column = strlen (tags[token_translations[i]]);
-           obstack_sgrow (&output_obstack, tags[token_translations[i]]);
+       fputs (tags[token_translations[i]], out);
            END_TEST (50);
            sprintf (buffer, " (%d)", i);
 
@@ -272,35 +261,11 @@
                    sprintf (buffer + strlen (buffer), " %d", j);
                    break;
                  }
-           obstack_fgrow1 (&output_obstack, "%s\n", buffer);
+       fprintf (out, "%s\n", buffer);
          }
-    }
-  else
-    {
-      for (i = 1; i < ntokens; i++)
-       {
-         buffer[0] = 0;
-         column = strlen (tags[i]);
-         obstack_sgrow (&output_obstack, tags[i]);
-         END_TEST (50);
-         sprintf (buffer, " (%d)", i);
 
-         for (j = 1; j <= nrules; j++)
-           for (rule = &ritem[rrhs[j]]; *rule > 0; rule++)
-             if (*rule == i)
-               {
-                 END_TEST (65);
-                 sprintf (buffer + strlen (buffer), " %d", j);
-                 break;
-               }
-         obstack_fgrow1 (&output_obstack, "%s\n", buffer);
-       }
-    }
-
-  obstack_sgrow (&output_obstack, "\n");
-  obstack_sgrow (&output_obstack,
+  fprintf (out, "\n%s\n\n",
                 _("Nonterminals, with rules where they appear"));
-  obstack_sgrow (&output_obstack, "\n\n");
   for (i = ntokens; i <= nsyms - 1; i++)
     {
       int left_count = 0, right_count = 0;
@@ -318,7 +283,7 @@
        }
 
       buffer[0] = 0;
-      obstack_sgrow (&output_obstack, tags[i]);
+      fputs (tags[i], out);
       column = strlen (tags[i]);
       sprintf (buffer, " (%d)", i);
       END_TEST (0);
@@ -353,22 +318,33 @@
                  }
            }
        }
-      obstack_fgrow1 (&output_obstack, "%s\n", buffer);
+      fprintf (out, "%s\n", buffer);
     }
 }
 
 void
 print_results (void)
 {
+  if (verbose_flag)
+    {
   int i;
 
+      /* We used to use just .out if spec_name_prefix (-p) was used, but
+        that conflicts with Posix.  */
+      FILE *out = xfopen (spec_verbose_file, "w");
+
+      size_t size = obstack_object_size (&output_obstack);
+      fwrite (obstack_finish (&output_obstack), 1, size, out);
+
   if (any_conflicts)
-    print_conflicts ();
+       print_conflicts (out);
 
-  if (verbose_flag)
-    print_grammar ();
+      print_grammar (out);
 
-  if (verbose_flag)
     for (i = 0; i < nstates; i++)
-      print_state (i);
+       print_state (out, i);
+
+      xfclose (out);
+    }
+  obstack_free (&output_obstack, NULL);
 }
Index: src/print_graph.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print_graph.c,v
retrieving revision 1.6
diff -u -w -r1.6 print_graph.c
--- src/print_graph.c   2001/08/08 20:31:21     1.6
+++ src/print_graph.c   2001/10/04 14:53:14
@@ -19,7 +19,6 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "system.h"
-#include "xalloc.h"
 #include "files.h"
 #include "gram.h"
 #include "LR0.h"
@@ -35,8 +34,9 @@
 #include "quotearg.h"
 
 static graph_t graph;
+static FILE *fgraph = NULL;
 
-static unsigned node_output_size = 0;
+static size_t node_output_size = 0;
 
 /* Return an unambiguous printable representated, allocated in slot 0,
    for NAME, suitable for C strings.  */
@@ -136,7 +136,7 @@
 
            if (state > state1)
              edge.type = back_edge;
-           open_edge (&edge, &graph_obstack);
+           open_edge (&edge, fgraph);
            /* The edge source is the current node.  */
            edge.sourcename = node_name;
            sprintf (buff, "%d", state1);
@@ -145,8 +145,8 @@
            /* FIXME: Be aware that quote uses static memory.  The string
               must be output immediately (which is the case here). */
            edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
-           output_edge (&edge, &graph_obstack);
-           close_edge (&graph_obstack);
+           output_edge (&edge, fgraph);
+           close_edge (fgraph);
          }
        }
     }
@@ -198,14 +198,14 @@
          symbol = accessing_symbol[state1];
 
          new_edge (&edge);
-         open_edge (&edge, &graph_obstack);
+         open_edge (&edge, fgraph);
          edge.sourcename = node_name;
          sprintf (buff, "%d", state1);
          edge.targetname = buff;
          edge.color = red;
          edge.label = tags[symbol] ? quote (tags[symbol]) : NULL;
-         output_edge (&edge, &graph_obstack);
-         close_edge (&graph_obstack);
+         output_edge (&edge, fgraph);
+         close_edge (fgraph);
        }
     }
 }
@@ -223,9 +223,6 @@
   new_node (&node);    /* Set node attributs default value.  */
   sprintf (name, "%d", state);
   node.title = name;   /* Give a name to the node.  */
-  open_node (&node_obstack);
-  /* Output a VCG formatted attributs list.  */
-  output_node (&node, &node_obstack);
   
   { 
     /* Here we begin to compute the node label. */  
@@ -241,15 +238,17 @@
     print_actions (state, node.title, &node_obstack);
     
     obstack_sgrow (&node_obstack, "\"\n");             /* Close Label.  */
-    
-    close_node (&node_obstack);
   }
+
+  open_node (fgraph);
+  /* Output a VCG formatted attributs list.  */
+  output_node (&node, fgraph);
+  /* Save the node label.  */
+  fwrite (obstack_base (&node_obstack), 
+         obstack_object_size (&node_obstack), 1, fgraph);
+  close_node (fgraph);
   
-  /* `obstack_cat' NODE_OBSTACK to GRAPH_OBSTACK.  */
-  obstack_grow (&graph_obstack, 
-               obstack_base (&node_obstack), 
-               obstack_object_size (&node_obstack));
-  obstack_finish (&node_obstack);
+  obstack_free (&node_obstack, 0);
 }
 
 
@@ -260,6 +259,10 @@
 
   if (!graph_flag)
     return;
+
+  /* Output file.  */
+  fgraph = xfopen (spec_graph_file, "w");
+
   new_graph (&graph);
 
 #if 0
@@ -268,7 +271,7 @@
 #endif
 
   graph.display_edge_labels = yes;
-  graph.layoutalgorithm = 0;
+  graph.layoutalgorithm = normal;
 
   graph.port_sharing = no;
   graph.finetuning = yes;
@@ -279,13 +282,14 @@
   graph.crossing_weight = median;
 
   /* Output graph options. */
-  open_graph (&graph_obstack);
-  output_graph (&graph, &graph_obstack);
+  open_graph (fgraph);
+  output_graph (&graph, fgraph);
 
   for (i = 0; i < nstates; i++)
     /* Output nodes & edges. */
     print_state (i);
 
   /* Close graph. */
-  close_graph (&graph, &graph_obstack);
+  close_graph (&graph, fgraph);
+  xfclose (fgraph);
 }
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.89
diff -u -w -r1.89 reader.c
--- src/reader.c        2001/09/23 15:33:14     1.89
+++ src/reader.c        2001/10/04 14:53:14
@@ -26,7 +26,6 @@
 #include "quote.h"
 #include "getargs.h"
 #include "files.h"
-#include "xalloc.h"
 #include "symtab.h"
 #include "options.h"
 #include "lex.h"
@@ -491,8 +490,8 @@
 static void
 parse_token_decl (symbol_class what_is, symbol_class what_is_not)
 {
-  token_t token = 0;
-  char *typename = 0;
+  token_t token = tok_undef;
+  char *typename = NULL;
 
   /* The symbol being defined.  */
   struct bucket *symbol = NULL;
@@ -541,7 +540,6 @@
              /* symbol and symval combined are only one symbol */
              nsyms--;
            }
-         translations = 1;
          symbol = NULL;
        }
       else if (token == tok_identifier)
@@ -566,7 +564,6 @@
       else if (symbol && token == tok_number)
        {
          symbol->user_token_number = numval;
-         translations = 1;
        }
       else
        {
@@ -708,7 +705,6 @@
          if (prev == tok_identifier)
            {
              symval->user_token_number = numval;
-             translations = 1;
            }
          else
            {
@@ -763,10 +759,14 @@
   c = getc (finput);
 
   while (c != EOF)
+    {
+      /* If C contains '/', it is output by copy_comment ().  */
+      if (c != '/')
     {
-      obstack_1grow (&union_obstack, c);
+         obstack_1grow (&attrs_obstack, c);
       if (defines_flag)
        obstack_1grow (&defines_obstack, c);
+       }
 
       switch (c)
        {
@@ -852,7 +852,6 @@
   char *typename = 0;
   int usrtoknum;
 
-  translations = 1;
   token = lex ();              /* fetch typename or first token */
   if (token == tok_typename)
     {
@@ -904,8 +903,6 @@
   nsyms--;
 }
 
-/* FIXME. */
-
 static void
 parse_muscle_decl (void)
 {
@@ -957,36 +954,6 @@
   /* Complete with parse_dquoted_param () on the CVS branch 1.29.  */
 }
 
-/*------------------------------------------.
-| Parse what comes after %header_extension. |
-`------------------------------------------*/
-
-static void
-parse_header_extension_decl (void)
-{
-  char buff[32];
-
-  if (header_extension)
-    complain (_("multiple %%header_extension declarations"));
-  fscanf (finput, "%s", buff);
-  header_extension = xstrdup (buff);
-}
-
-/*------------------------------------------.
-| Parse what comes after %source_extension. |
-`------------------------------------------*/
-
-static void
-parse_source_extension_decl (void)
-{
-  char buff[32];
-
-  if (src_extension)
-    complain (_("multiple %%source_extension declarations"));
-  fscanf (finput, "%s", buff);
-  src_extension = xstrdup (buff);
-}
-
 /*----------------------------------------------------------------.
 | Read from finput until `%%' is seen.  Discard the `%%'.  Handle |
 | any `%' declarations, and copy the contents of any `%{ ... %}'  |
@@ -1056,14 +1023,6 @@
              parse_assoc_decl (non_assoc);
              break;
 
-           case tok_hdrext:
-             parse_header_extension_decl ();
-             break;
-
-           case tok_srcext:
-             parse_source_extension_decl ();
-             break;
-
            case tok_define:
              parse_muscle_decl ();
              break;
@@ -1729,9 +1688,10 @@
        continue;
 
       obstack_fgrow2 (oout, "# define\t%s\t%d\n",
-                     symbol,
-                     (translations ? bp->user_token_number : bp->value));
+                     symbol, bp->user_token_number);
       if (semantic_parser)
+       /* FIXME: This is certainly dead wrong, and should be just as
+          above. --akim.  */
        obstack_fgrow2 (oout, "# define\tT%s\t%d\n", symbol, bp->value);
     }
 }
@@ -1746,9 +1706,9 @@
 static void
 packsymbols (void)
 {
-  bucket *bp;
+  bucket *bp = NULL;
   int tokno = 1;
-  int i;
+  int i, j;
   int last_user_token_number;
   static char DOLLAR[] = "$";
 
@@ -1812,7 +1772,7 @@
 
       if (bp->class == token_sym)
        {
-         if (translations && !(bp->user_token_number))
+         if (!bp->user_token_number)
            bp->user_token_number = ++last_user_token_number;
          if (bp->user_token_number > max_user_token_number)
            max_user_token_number = bp->user_token_number;
@@ -1822,13 +1782,8 @@
       user_toknums[bp->value] = bp->user_token_number;
       sprec[bp->value] = bp->prec;
       sassoc[bp->value] = bp->assoc;
-
     }
 
-  if (translations)
-    {
-      int j;
-
       token_translations = XCALLOC (short, max_user_token_number + 1);
 
       /* initialize all entries for literal tokens to 2, the internal
@@ -1849,13 +1804,17 @@
                      bp->tag, bp->user_token_number);
          token_translations[bp->user_token_number] = bp->value;
        }
-    }
 
   error_token_number = errtoken->value;
 
-  output_token_defines (&output_obstack);
-  obstack_1grow (&output_obstack, 0);
-  muscle_insert ("tokendef", obstack_finish (&output_obstack));
+  {
+    struct obstack tokendefs;
+    obstack_init (&tokendefs);
+    output_token_defines (&tokendefs);
+    obstack_1grow (&tokendefs, 0);
+    muscle_insert ("tokendef", xstrdup (obstack_finish (&tokendefs)));
+    obstack_free (&tokendefs, NULL);
+  }
 
 #if 0
   if (!no_parser_flag)
@@ -1980,15 +1939,6 @@
   start_flag = 0;
   startval = NULL;             /* start symbol not specified yet. */
 
-#if 0
-  /* initially assume token number translation not needed.  */
-  translations = 0;
-#endif
-  /* Nowadays translations is always set to 1, since we give `error' a
-     user-token-number to satisfy the Posix demand for YYERRCODE==256.
-   */
-  translations = 1;
-
   nsyms = 1;
   nvars = 0;
   nrules = 0;
@@ -2004,7 +1954,7 @@
 
   grammar = NULL;
 
-  init_lex ();
+  lex_init ();
   lineno = 1;
 
   /* Initialize the muscle obstack.  */
@@ -2043,7 +1993,4 @@
   packsymbols ();
   /* Convert the grammar into the format described in gram.h.  */
   packgram ();
-  /* Free the symbol table data structure since symbols are now all
-     referred to by symbol number.  */
-  free_symtab ();
 }
Index: src/reduce.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reduce.c,v
retrieving revision 1.19
diff -u -w -r1.19 reduce.c
--- src/reduce.c        2000/12/20 17:21:14     1.19
+++ src/reduce.c        2001/10/04 14:53:14
@@ -29,7 +29,6 @@
 #include "getargs.h"
 #include "files.h"
 #include "gram.h"
-#include "xalloc.h"
 #include "complain.h"
 #include "reduce.h"
 #include "reader.h"
@@ -117,7 +116,7 @@
 useless_nonterminals (void)
 {
   BSet Np, Ns;
-  int i, n;
+  int i;
 
   /* N is set as built.  Np is set being built this iteration. P is
      set of all productions which have a RHS all in N.  */
@@ -140,7 +139,6 @@
      saved to be used when finding useful productions: only
      productions in this set will appear in the final grammar.  */
 
-  n = 0;
   while (1)
     {
       for (i = WORDSIZE (nvars) - 1; i >= 0; i--)
@@ -171,7 +169,7 @@
 inaccessable_symbols (void)
 {
   BSet Vp, Vs, Pp;
-  int i, n;
+  int i;
   short t;
   rule r;
 
@@ -207,7 +205,6 @@
 
   SETBIT (V, start_symbol);
 
-  n = 0;
   while (1)
     {
       for (i = WORDSIZE (nsyms) - 1; i >= 0; i--)
Index: src/symtab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.c,v
retrieving revision 1.13
diff -u -w -r1.13 symtab.c
--- src/symtab.c        2000/11/07 16:28:47     1.13
+++ src/symtab.c        2001/10/04 14:53:14
@@ -20,7 +20,6 @@
 
 
 #include "system.h"
-#include "xalloc.h"
 #include "symtab.h"
 #include "gram.h"
 
@@ -143,6 +142,7 @@
          if (bp->type_name)
            XFREE (bp->type_name);
 #endif
+         XFREE (bp->tag);
          XFREE (bp);
          bp = bptmp;
        }
Index: src/system.h
===================================================================
RCS file: /cvsroot/bison/bison/src/system.h,v
retrieving revision 1.23
diff -u -w -r1.23 system.h
--- src/system.h        2001/08/10 09:35:50     1.23
+++ src/system.h        2001/10/04 14:53:14
@@ -73,8 +73,8 @@
 # define PARAMS(p) ()
 #endif
 
+# include "xalloc.h"
 
-
 /*---------------------.
 | Missing prototypes.  |
 `---------------------*/
@@ -143,8 +143,6 @@
 # define LOCALEDIR "/usr/local/share/locale"
 #endif
 
-#endif  /* BISON_SYSTEM_H */
-
 
 /*-----------.
 | Booleans.  |
@@ -264,3 +262,15 @@
 #  define BISON_HAIRY "c:/usr/local/lib/bison.hairy"
 # endif
 #endif
+
+
+/*---------------------------------.
+| Debugging the memory allocator.  |
+`---------------------------------*/
+
+# if WITH_DMALLOC
+#  define DMALLOC_FUNC_CHECK
+#  include <dmalloc.h>
+# endif /* WITH_DMALLOC */
+
+#endif  /* BISON_SYSTEM_H */
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.5
diff -u -w -r1.5 vcg.c
--- src/vcg.c   2001/08/15 08:49:20     1.5
+++ src/vcg.c   2001/10/04 14:53:14
@@ -21,8 +21,6 @@
 #include "system.h"
 #include "vcg.h"
 #include "vcg_defaults.h"
-#include "xalloc.h"
-#include "complain.h"
 
 /* Initialize a graph with the default values. */
 void
@@ -51,6 +49,9 @@
   g->textmode = G_TEXTMODE;
   g->shape = G_SHAPE;
 
+  g->vertical_order = G_VERTICAL_ORDER;
+  g->horizontal_order = G_HORIZONTAL_ORDER;
+
   g->xmax = G_XMAX; /* Not output. */
   g->ymax = G_YMAX; /* Not output. */
 
@@ -231,8 +232,7 @@
     case orchid:       return "orchid";
     case black:                return "black";
     default:
-      complain (_("vcg graph: no such color."));
-      return get_color_str(G_COLOR);
+      assert (!"Not a default color.");
     }
   return NULL;
 }
@@ -246,8 +246,7 @@
     case left_justify: return "left_justify";
     case right_justify:        return "right_justify";
     default:
-      complain (_("vcg graph: no such text mode"));
-      return get_textmode_str(G_TEXTMODE);
+      assert (!"Not a text mode.");
     }
   return NULL;
 }
@@ -262,8 +261,7 @@
     case ellipse:      return "ellipse";
     case triangle:     return "triangle";
     default:
-      complain (_("vcg graph: no such shape"));
-      return get_shape_str(G_SHAPE);
+      assert (!"Not a shape.");
     }
   return NULL;
 }
@@ -288,21 +286,20 @@
     case dfs:          return "dfs";
     case tree:         return "tree";
     default:
-      return "normal";
+      assert (!"Not a layout algorithm.");
     }
   return NULL;
 }
 
 static const char *
-get_decision_str (enum decision_e d, enum decision_e defaults)
+get_decision_str (enum decision_e d)
 {
   switch (d)
     {
     case no:   return "no";
     case yes:  return "yes";
     default:
-      complain (_("vcg graph: no such decision"));
-      return get_decision_str(defaults, 0);
+      assert (!"Either yes nor no.");
     }
   return NULL;
 }
@@ -317,8 +314,7 @@
     case left_to_right: return "left_to_right";
     case right_to_left: return "right_to_left";
     default:
-      complain (_("vcg graph: no such an orientation"));
-      return get_orientation_str(G_ORIENTATION);
+      assert (!"Not an orientation.");
     }
   return NULL;
 }
@@ -332,8 +328,7 @@
     case top:          return "top";
     case bottom:       return "bottom";
     default:
-      complain (_("vcg graph: no such an alignement"));
-      return get_node_alignement_str(G_NODE_ALIGNEMENT);
+      assert (!"Not an alignement.");
     }
   return NULL;
 }
@@ -346,8 +341,7 @@
     case fixed:                return "fixed";
     case free_a:       return "free";
     default:
-      complain (_("vcg graph: no such an arrow mode"));
-      return get_arrow_mode_str(G_ARROW_MODE);
+      assert (!"Not an arrow mode.");
     }
   return NULL;
 }
@@ -362,8 +356,7 @@
     case barymedian:   return "barymedian";
     case medianbary:   return "medianbary";
     default:
-      complain (_("vcg graph: no such crossing_type"));
-      return get_crossing_type_str(G_CROSSING_WEIGHT);
+      assert (!"Not a crossing type.");
     }
   return NULL;
 }
@@ -379,8 +372,7 @@
     case fcfish:       return "fcfish";
     case fpfish:       return "fpfish";
     default:
-      complain (_("vcg graph: no such view"));
-      return get_view_str(G_VIEW);
+      assert (!"Not a view.");
     }
   return NULL;
 }
@@ -395,8 +387,7 @@
     case dotted:       return "dotted";
     case invisible:    return "invisible";
     default:
-      complain (_("vcg graph: no such linestyle"));
-      return get_linestyle_str(E_LINESTYLE);
+      assert (!"Not a line style.");
     }
   return NULL;
 }
@@ -410,8 +401,7 @@
     case line: return "line";
     case none: return "none";
     default:
-      complain (_("vcg graph: no such an arrowstyle"));
-      return get_arrowstyle_str(E_ARROWSTYLE);
+      assert (!"Not an arrow style.");
     }
   return NULL;
 }
@@ -435,402 +425,461 @@
   graph->edge_list = edge;
 }
 
+void
+add_classname (graph_t *g, int val, const char *name)
+{
+  struct classname_s *classname;
+  
+  classname = XMALLOC (struct classname_s, 1);
+  classname->no = val;
+  classname->name = name;
+  classname->next = g->classname;
+  g->classname = classname;
+}
+
+void
+add_infoname (graph_t *g, int integer, const char *string)
+{
+  struct infoname_s *infoname;
+  
+  infoname = XMALLOC (struct infoname_s, 1);
+  infoname->integer = integer;
+  infoname->string = string;
+  infoname->next = g->infoname;
+  g->infoname = infoname;
+}
+
+/* Build a colorentry struct and add it to the list.  */
+void
+add_colorentry (graph_t *g, int color_idx, int red_cp, 
+               int green_cp, int blue_cp)
+{
+  struct colorentry_s *ce;
+  
+  ce = XMALLOC (struct colorentry_s, 1);
+  ce->color_index = color_idx;
+  ce->red_cp = red_cp;
+  ce->green_cp = green_cp;
+  ce->blue_cp = blue_cp;
+  ce->next = g->colorentry;
+  g->colorentry = ce;
+}
+
 /*-------------------------------------.
 | Open and close functions (formatted) |
 `-------------------------------------*/
 
 void
-open_edge(edge_t *edge, struct obstack *os)
+open_edge(edge_t *edge, FILE *fout)
 {
   switch (edge->type)
     {
     case normal_edge:
-      obstack_sgrow (os, "\tedge: {\n");
+      fputs ("\tedge: {\n", fout);
       break;
     case back_edge:
-      obstack_sgrow (os, "\tbackedge: {\n");
+      fputs ("\tbackedge: {\n", fout);
       break;
     case near_edge:
-      obstack_sgrow (os, "\tnearedge: {\n");
+      fputs ("\tnearedge: {\n", fout);
       break;
     case bent_near_edge:
-      obstack_sgrow (os, "\tbentnearedge: {\n");
+      fputs ("\tbentnearedge: {\n", fout);
       break;
     default:
-      obstack_sgrow (os, "\tedge: {\n");
+      fputs ("\tedge: {\n", fout);
     }
 }
 
 void
-close_edge(struct obstack *os)
+close_edge(FILE *fout)
 {
-  obstack_sgrow (os, "\t}\n");
+  fputs ("\t}\n", fout);
 }
 
 void
-open_node(struct obstack *os)
+open_node(FILE *fout)
 {
-  obstack_sgrow (os, "\tnode: {\n");
+  fputs ("\tnode: {\n", fout);
 }
 
 void
-close_node(struct obstack *os)
+close_node(FILE *fout)
 {
-  obstack_sgrow (os, "\t}\n");
+  fputs ("\t}\n", fout);
 }
 
 void
-open_graph(struct obstack *os)
+open_graph(FILE *fout)
 {
-  obstack_sgrow (os, "graph: {\n");
+  fputs ("graph: {\n", fout);
 }
 
 void
-close_graph(graph_t *graph, struct obstack *os)
+close_graph(graph_t *graph, FILE *fout)
 {
-  obstack_1grow (os, '\n');
+  fputc ('\n', fout);
 
+  /* FIXME: Unallocate nodes and edges if required.  */
   {
     node_t *node;
 
     for (node = graph->node_list; node; node = node->next)
       {
-       open_node (os);
-       output_node (node, os);
-       close_node (os);
+       open_node (fout);
+       output_node (node, fout);
+       close_node (fout);
       }
   }
 
-  obstack_1grow (os, '\n');
+  fputc ('\n', fout);
 
   {
     edge_t *edge;
 
     for (edge = graph->edge_list; edge; edge = edge->next)
       {
-       open_edge (edge, os);
-       output_edge (edge, os);
-       close_edge (os);
+       open_edge (edge, fout);
+       output_edge (edge, fout);
+       close_edge (fout);
       }
   }
 
-  obstack_sgrow (os, "}\n");
+  fputs ("}\n", fout);
 }
 
 /*-------------------------------------------.
-| Output functions (formatted) in obstack os |
+| Output functions (formatted) in file FOUT  |
 `-------------------------------------------*/
 
 void
-output_node (node_t *node, struct obstack *os)
+output_node (node_t *node, FILE *fout)
 {
   if (node->title != N_TITLE)
-    obstack_fgrow1 (os, "\t\ttitle:\t\"%s\"\n", node->title);
+    fprintf (fout, "\t\ttitle:\t\"%s\"\n", node->title);
   if (node->label != N_LABEL)
-    obstack_fgrow1 (os, "\t\tlabel:\t\"%s\"\n", node->label);
+    fprintf (fout, "\t\tlabel:\t\"%s\"\n", node->label);
 
   if ((node->locx != N_LOCX) && (node->locy != N_LOCY))
-    obstack_fgrow2 (os, "\t\tloc { x: %d  y: %d }\t\n", node->locx, 
node->locy);
+    fprintf (fout, "\t\tloc { x: %d  y: %d }\t\n", node->locx, node->locy);
 
   if (node->vertical_order != N_VERTICAL_ORDER)
-    obstack_fgrow1 (os, "\t\tvertical_order:\t%d\n", node->vertical_order);
+    fprintf (fout, "\t\tvertical_order:\t%d\n", node->vertical_order);
   if (node->horizontal_order != N_HORIZONTAL_ORDER)
-    obstack_fgrow1 (os, "\t\thorizontal_order:\t%d\n", node->horizontal_order);
+    fprintf (fout, "\t\thorizontal_order:\t%d\n", node->horizontal_order);
 
   if (node->width != N_WIDTH)
-    obstack_fgrow1 (os, "\t\twidth:\t%d\n", node->width);
+    fprintf (fout, "\t\twidth:\t%d\n", node->width);
   if (node->height != N_HEIGHT)
-    obstack_fgrow1 (os, "\t\theight:\t%d\n", node->height);
+    fprintf (fout, "\t\theight:\t%d\n", node->height);
 
   if (node->shrink != N_SHRINK)
-    obstack_fgrow1 (os, "\t\tshrink:\t%d\n", node->shrink);
+    fprintf (fout, "\t\tshrink:\t%d\n", node->shrink);
   if (node->stretch != N_STRETCH)
-    obstack_fgrow1 (os, "\t\tstretch:\t%d\n", node->stretch);
+    fprintf (fout, "\t\tstretch:\t%d\n", node->stretch);
 
   if (node->folding != N_FOLDING)
-    obstack_fgrow1 (os, "\t\tfolding:\t%d\n", node->folding);
+    fprintf (fout, "\t\tfolding:\t%d\n", node->folding);
 
   if (node->textmode != N_TEXTMODE)
-    obstack_fgrow1 (os, "\t\ttextmode:\t%s\n",
+    fprintf (fout, "\t\ttextmode:\t%s\n",
                    get_textmode_str (node->textmode));
 
   if (node->shape != N_SHAPE)
-    obstack_fgrow1 (os, "\t\tshape:\t%s\n", get_shape_str (node->shape));
+    fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (node->shape));
 
   if (node->borderwidth != N_BORDERWIDTH)
-    obstack_fgrow1 (os, "\t\tborderwidth:\t%d\n", node->borderwidth);
+    fprintf (fout, "\t\tborderwidth:\t%d\n", node->borderwidth);
 
   if (node->color != N_COLOR)
-    obstack_fgrow1 (os, "\t\tcolor:\t%s\n", get_color_str (node->color));
+    fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (node->color));
   if (node->textcolor != N_TEXTCOLOR)
-    obstack_fgrow1 (os, "\t\ttextcolor:\t%s\n",
+    fprintf (fout, "\t\ttextcolor:\t%s\n",
                    get_color_str (node->textcolor));
   if (node->bordercolor != N_BORDERCOLOR)
-    obstack_fgrow1 (os, "\t\tbordercolor:\t%s\n",
+    fprintf (fout, "\t\tbordercolor:\t%s\n",
                    get_color_str (node->bordercolor));
 
   if (node->infos[0])
-    obstack_fgrow1 (os, "\t\tinfo1:\t\"%s\"\n", node->infos[0]);
+    fprintf (fout, "\t\tinfo1:\t\"%s\"\n", node->infos[0]);
   if (node->infos[1])
-    obstack_fgrow1 (os, "\t\tinfo2:\t\"%s\"\n", node->infos[1]);
+    fprintf (fout, "\t\tinfo2:\t\"%s\"\n", node->infos[1]);
   if (node->infos[2])
-    obstack_fgrow1 (os, "\t\tinfo3:\t\"%s\"\n", node->infos[2]);
+    fprintf (fout, "\t\tinfo3:\t\"%s\"\n", node->infos[2]);
 }
 
 void
-output_edge (edge_t *edge, struct obstack *os)
+output_edge (edge_t *edge, FILE *fout)
 {
   /* FIXME: SOURCENAME and TARGETNAME are mandatory
      so it has to be fatal not to give these informations.  */
   if (edge->sourcename != E_SOURCENAME)
-    obstack_fgrow1 (os, "\t\tsourcename:\t\"%s\"\n", edge->sourcename);
+    fprintf (fout, "\t\tsourcename:\t\"%s\"\n", edge->sourcename);
   if (edge->targetname != E_TARGETNAME)
-    obstack_fgrow1 (os, "\t\ttargetname:\t\"%s\"\n", edge->targetname);
+    fprintf (fout, "\t\ttargetname:\t\"%s\"\n", edge->targetname);
 
   if (edge->label != E_LABEL)
-    obstack_fgrow1 (os, "\t\tlabel:\t\"%s\"\n", edge->label);
+    fprintf (fout, "\t\tlabel:\t\"%s\"\n", edge->label);
 
   if (edge->linestyle != E_LINESTYLE)
-    obstack_fgrow1 (os, "\t\tlinestyle:\t\"%s\"\n",
+    fprintf (fout, "\t\tlinestyle:\t\"%s\"\n", 
                    get_linestyle_str(edge->linestyle));
 
   if (edge->thickness != E_THICKNESS)
-    obstack_fgrow1 (os, "\t\tthickness:\t%d\n", edge->thickness);
+    fprintf (fout, "\t\tthickness:\t%d\n", edge->thickness);
   if (edge->class != E_CLASS)
-    obstack_fgrow1 (os, "\t\tclass:\t%d\n", edge->class);
+    fprintf (fout, "\t\tclass:\t%d\n", edge->class);
 
   if (edge->color != E_COLOR)
-    obstack_fgrow1 (os, "\t\tcolor:\t%s\n", get_color_str (edge->color));
+    fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (edge->color));
   if (edge->color != E_TEXTCOLOR)
-    obstack_fgrow1 (os, "\t\ttextcolor:\t%s\n",
+    fprintf (fout, "\t\ttextcolor:\t%s\n",
                    get_color_str (edge->textcolor));
   if (edge->arrowcolor != E_ARROWCOLOR)
-    obstack_fgrow1 (os, "\t\tarrowcolor:\t%s\n",
+    fprintf (fout, "\t\tarrowcolor:\t%s\n",
                    get_color_str (edge->arrowcolor));
   if (edge->backarrowcolor != E_BACKARROWCOLOR)
-    obstack_fgrow1 (os, "\t\tbackarrowcolor:\t%s\n",
+    fprintf (fout, "\t\tbackarrowcolor:\t%s\n",
                    get_color_str (edge->backarrowcolor));
 
   if (edge->arrowsize != E_ARROWSIZE)
-    obstack_fgrow1 (os, "\t\tarrowsize:\t%d\n", edge->arrowsize);
+    fprintf (fout, "\t\tarrowsize:\t%d\n", edge->arrowsize);
   if (edge->backarrowsize != E_BACKARROWSIZE)
-    obstack_fgrow1 (os, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);
+    fprintf (fout, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);
 
   if (edge->arrowstyle != E_ARROWSTYLE)
-    obstack_fgrow1 (os, "\t\tarrowstyle:\t%s\n",
+    fprintf (fout, "\t\tarrowstyle:\t%s\n",
                    get_arrowstyle_str(edge->arrowstyle));
   if (edge->backarrowstyle != E_BACKARROWSTYLE)
-    obstack_fgrow1 (os, "\t\tbackarrowstyle:\t%s\n",
+    fprintf (fout, "\t\tbackarrowstyle:\t%s\n",
                    get_arrowstyle_str(edge->backarrowstyle));
 
   if (edge->priority != E_PRIORITY)
-    obstack_fgrow1 (os, "\t\tpriority:\t%d\n", edge->priority);
+    fprintf (fout, "\t\tpriority:\t%d\n", edge->priority);
   if (edge->anchor != E_ANCHOR)
-    obstack_fgrow1 (os, "\t\tanchor:\t%d\n", edge->anchor);
+    fprintf (fout, "\t\tanchor:\t%d\n", edge->anchor);
   if (edge->horizontal_order != E_HORIZONTAL_ORDER)
-    obstack_fgrow1 (os, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);
+    fprintf (fout, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);
 }
 
 void
-output_graph (graph_t *graph, struct obstack *os)
+output_graph (graph_t *graph, FILE *fout)
 {
   if (graph->title)
-    obstack_fgrow1 (os, "\ttitle:\t\"%s\"\n", graph->title);
+    fprintf (fout, "\ttitle:\t\"%s\"\n", graph->title);
   if (graph->label)
-    obstack_fgrow1 (os, "\tlabel:\t\"%s\"\n", graph->label);
+    fprintf (fout, "\tlabel:\t\"%s\"\n", graph->label);
 
   if (graph->infos[0])
-    obstack_fgrow1 (os, "\tinfo1:\t\"%s\"\n", graph->infos[0]);
+    fprintf (fout, "\tinfo1:\t\"%s\"\n", graph->infos[0]);
   if (graph->infos[1])
-    obstack_fgrow1 (os, "\tinfo2:\t\"%s\"\n", graph->infos[1]);
+    fprintf (fout, "\tinfo2:\t\"%s\"\n", graph->infos[1]);
   if (graph->infos[2])
-    obstack_fgrow1 (os, "\tinfo3:\t\"%s\"\n", graph->infos[2]);
+    fprintf (fout, "\tinfo3:\t\"%s\"\n", graph->infos[2]);
 
   if (graph->color != G_COLOR)
-    obstack_fgrow1 (os, "\tcolor:\t%s\n", get_color_str (graph->color));
+    fprintf (fout, "\tcolor:\t%s\n", get_color_str (graph->color));
   if (graph->textcolor != G_TEXTCOLOR)
-    obstack_fgrow1 (os, "\ttextcolor:\t%s\n", get_color_str 
(graph->textcolor));
+    fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor));
   if (graph->bordercolor != G_BORDERCOLOR)
-    obstack_fgrow1 (os, "\tbordercolor:\t%s\n",
+    fprintf (fout, "\tbordercolor:\t%s\n",
                    get_color_str (graph->bordercolor));
 
   if (graph->width != G_WIDTH)
-    obstack_fgrow1 (os, "\twidth:\t%d\n", graph->width);
+    fprintf (fout, "\twidth:\t%d\n", graph->width);
   if (graph->height != G_HEIGHT)
-    obstack_fgrow1 (os, "\theight:\t%d\n", graph->height);
+    fprintf (fout, "\theight:\t%d\n", graph->height);
   if (graph->borderwidth != G_BORDERWIDTH)
-    obstack_fgrow1 (os, "\tborderwidth:\t%d\n", graph->borderwidth);
+    fprintf (fout, "\tborderwidth:\t%d\n", graph->borderwidth);
 
   if (graph->x != G_X)
-    obstack_fgrow1 (os, "\tx:\t%d\n", graph->x);
+    fprintf (fout, "\tx:\t%d\n", graph->x);
   if (graph->y != G_Y)
-    obstack_fgrow1 (os, "\ty:\t%d\n", graph->y);
+    fprintf (fout, "\ty:\t%d\n", graph->y);
 
   if (graph->folding != G_FOLDING)
-    obstack_fgrow1 (os, "\tfolding:\t%d\n", graph->folding);
+    fprintf (fout, "\tfolding:\t%d\n", graph->folding);
 
   if (graph->shrink != G_SHRINK)
-    obstack_fgrow1 (os, "\tshrink:\t%d\n", graph->shrink);
+    fprintf (fout, "\tshrink:\t%d\n", graph->shrink);
   if (graph->stretch != G_STRETCH)
-    obstack_fgrow1 (os, "\tstretch:\t%d\n", graph->stretch);
+    fprintf (fout, "\tstretch:\t%d\n", graph->stretch);
 
   if (graph->textmode != G_TEXTMODE)
-    obstack_fgrow1 (os, "\ttextmode:\t%s\n",
+    fprintf (fout, "\ttextmode:\t%s\n",
                    get_textmode_str (graph->textmode));
 
   if (graph->shape != G_SHAPE)
-    obstack_fgrow1 (os, "\tshape:\t%s\n", get_shape_str (graph->shape));
+    fprintf (fout, "\tshape:\t%s\n", get_shape_str (graph->shape));
 
+  if (graph->vertical_order != G_VERTICAL_ORDER)
+    fprintf (fout, "\tvertical_order:\t%d\n", graph->vertical_order);  
+  if (graph->horizontal_order != G_HORIZONTAL_ORDER)
+    fprintf (fout, "\thorizontal_order:\t%d\n", graph->horizontal_order);  
+
   if (graph->xmax != G_XMAX)
-    obstack_fgrow1 (os, "\txmax:\t%d\n", graph->xmax);
+    fprintf (fout, "\txmax:\t%d\n", graph->xmax);
   if (graph->ymax != G_YMAX)
-    obstack_fgrow1 (os, "\tymax:\t%d\n", graph->ymax);
+    fprintf (fout, "\tymax:\t%d\n", graph->ymax);
 
   if (graph->xbase != G_XBASE)
-    obstack_fgrow1 (os, "\txbase:\t%d\n", graph->xbase);
+    fprintf (fout, "\txbase:\t%d\n", graph->xbase);
   if (graph->ybase != G_YBASE)
-    obstack_fgrow1 (os, "\tybase:\t%d\n", graph->ybase);
+    fprintf (fout, "\tybase:\t%d\n", graph->ybase);
 
   if (graph->xspace != G_XSPACE)
-    obstack_fgrow1 (os, "\txspace:\t%d\n", graph->xspace);
+    fprintf (fout, "\txspace:\t%d\n", graph->xspace);
   if (graph->yspace != G_YSPACE)
-    obstack_fgrow1 (os, "\tyspace:\t%d\n", graph->yspace);
+    fprintf (fout, "\tyspace:\t%d\n", graph->yspace);
   if (graph->xlspace != G_XLSPACE)
-    obstack_fgrow1 (os, "\txlspace:\t%d\n", graph->xlspace);
+    fprintf (fout, "\txlspace:\t%d\n", graph->xlspace);
 
   if (graph->xraster != G_XRASTER)
-    obstack_fgrow1 (os, "\txraster:\t%d\n", graph->xraster);
+    fprintf (fout, "\txraster:\t%d\n", graph->xraster);
   if (graph->yraster != G_YRASTER)
-    obstack_fgrow1 (os, "\tyraster:\t%d\n", graph->yraster);
+    fprintf (fout, "\tyraster:\t%d\n", graph->yraster);
   if (graph->xlraster != G_XLRASTER)
-    obstack_fgrow1 (os, "\txlraster:\t%d\n", graph->xlraster);
+    fprintf (fout, "\txlraster:\t%d\n", graph->xlraster);
 
   if (graph->hidden != G_HIDDEN)
-    obstack_fgrow1 (os, "\thidden:\t%d\n", graph->hidden);
+    fprintf (fout, "\thidden:\t%d\n", graph->hidden);
 
+  /* FIXME: Unallocate struct list if required.  
+     Maybe with a little function.  */
   if (graph->classname != G_CLASSNAME)
     {
       struct classname_s *ite;
 
       for (ite = graph->classname; ite; ite = ite->next)
-       obstack_fgrow2 (os, "\tclassname %d :\t%s\n", ite->no, ite->name);
+       fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);
+    }
+
+  if (graph->infoname != G_INFONAME)
+    {
+      struct infoname_s *ite;
+
+      for (ite = graph->infoname; ite; ite = ite->next)
+       fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->string);
+    }
+
+  if (graph->colorentry != G_COLORENTRY)
+    {
+      struct colorentry_s *ite;
+      
+      for (ite = graph->colorentry; ite; ite = ite->next)
+       {       
+         fprintf (fout, "\tcolorentry %d :\t%d %d %d\n", 
+                  ite->color_index, 
+                  ite->red_cp,
+                  ite->green_cp,
+                  ite->blue_cp);
+       }    
     }
 
   if (graph->layoutalgorithm != G_LAYOUTALGORITHM)
-    obstack_fgrow1 (os, "\tlayoutalgorithm:\t%s\n",
+    fprintf (fout, "\tlayoutalgorithm:\t%s\n",
                    get_layoutalgorithm_str(graph->layoutalgorithm));
 
   if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR)
-    obstack_fgrow1 (os, "\tlayout_downfactor:\t%d\n", 
graph->layout_downfactor);
+    fprintf (fout, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor);
   if (graph->layout_upfactor != G_LAYOUT_UPFACTOR)
-    obstack_fgrow1 (os, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);
+    fprintf (fout, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);
   if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR)
-    obstack_fgrow1 (os, "\tlayout_nearfactor:\t%d\n", 
graph->layout_nearfactor);
+    fprintf (fout, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor);
   if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)
-    obstack_fgrow1 (os, "\tlayout_splinefactor:\t%d\n",
+    fprintf (fout, "\tlayout_splinefactor:\t%d\n",
                    graph->layout_splinefactor);
 
   if (graph->late_edge_labels != G_LATE_EDGE_LABELS)
-    obstack_fgrow1 (os, "\tlate_edge_labels:\t%s\n",
-                   get_decision_str(graph->late_edge_labels,
-                                    G_LATE_EDGE_LABELS));
+    fprintf (fout, "\tlate_edge_labels:\t%s\n",
+            get_decision_str(graph->late_edge_labels));
   if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)
-    obstack_fgrow1 (os, "\tdisplay_edge_labels:\t%s\n",
-                   get_decision_str(graph->display_edge_labels,
-                                    G_DISPLAY_EDGE_LABELS));
+    fprintf (fout, "\tdisplay_edge_labels:\t%s\n",
+            get_decision_str(graph->display_edge_labels));
   if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
-    obstack_fgrow1 (os, "\tdirty_edge_labels:\t%s\n",
-                   get_decision_str(graph->dirty_edge_labels,
-                                    G_DIRTY_EDGE_LABELS));
+    fprintf (fout, "\tdirty_edge_labels:\t%s\n",
+            get_decision_str(graph->dirty_edge_labels));
   if (graph->finetuning != G_FINETUNING)
-    obstack_fgrow1 (os, "\tfinetuning:\t%s\n",
-                   get_decision_str(graph->finetuning, G_FINETUNING));
+    fprintf (fout, "\tfinetuning:\t%s\n",
+            get_decision_str(graph->finetuning));
   if (graph->ignore_singles != G_IGNORE_SINGLES)
-    obstack_fgrow1 (os, "\tignore_singles:\t%s\n",
-                   get_decision_str(graph->ignore_singles, G_IGNORE_SINGLES));
+    fprintf (fout, "\tignore_singles:\t%s\n",
+            get_decision_str(graph->ignore_singles));
   if (graph->straight_phase != G_STRAIGHT_PHASE)
-    obstack_fgrow1 (os, "\tstraight_phase:\t%s\n",
-                   get_decision_str(graph->straight_phase, G_STRAIGHT_PHASE));
+    fprintf (fout, "\tstraight_phase:\t%s\n",
+            get_decision_str(graph->straight_phase));
   if (graph->priority_phase != G_PRIORITY_PHASE)
-    obstack_fgrow1 (os, "\tpriority_phase:\t%s\n",
-                   get_decision_str(graph->priority_phase, G_PRIORITY_PHASE));
+    fprintf (fout, "\tpriority_phase:\t%s\n",
+            get_decision_str(graph->priority_phase));
   if (graph->manhattan_edges != G_MANHATTAN_EDGES)
-    obstack_fgrow1 (os,
+    fprintf (fout,
                    "\tmanhattan_edges:\t%s\n",
-                   get_decision_str(graph->manhattan_edges,
-                                    G_MANHATTAN_EDGES));
+            get_decision_str(graph->manhattan_edges));
   if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)
-    obstack_fgrow1 (os,
+    fprintf (fout,
                    "\tsmanhattan_edges:\t%s\n",
-                   get_decision_str(graph->smanhattan_edges,
-                                    G_SMANHATTAN_EDGES));
+            get_decision_str(graph->smanhattan_edges));
   if (graph->near_edges != G_NEAR_EDGES)
-    obstack_fgrow1 (os, "\tnear_edges:\t%s\n",
-                   get_decision_str(graph->near_edges, G_NEAR_EDGES));
+    fprintf (fout, "\tnear_edges:\t%s\n",
+            get_decision_str(graph->near_edges));
 
   if (graph->orientation != G_ORIENTATION)
-    obstack_fgrow1 (os, "\torientation:\t%s\n",
-                   get_decision_str(graph->orientation, G_ORIENTATION));
+    fprintf (fout, "\torientation:\t%s\n",
+            get_orientation_str(graph->orientation));
 
   if (graph->node_alignement != G_NODE_ALIGNEMENT)
-    obstack_fgrow1 (os, "\tnode_alignement:\t%s\n",
-                   get_decision_str(graph->node_alignement,
-                                    G_NODE_ALIGNEMENT));
+    fprintf (fout, "\tnode_alignement:\t%s\n",
+            get_node_alignement_str(graph->node_alignement));
 
   if (graph->port_sharing != G_PORT_SHARING)
-    obstack_fgrow1 (os, "\tport_sharing:\t%s\n",
-                   get_decision_str(graph->port_sharing, G_PORT_SHARING));
+    fprintf (fout, "\tport_sharing:\t%s\n",
+            get_decision_str(graph->port_sharing));
 
   if (graph->arrow_mode != G_ARROW_MODE)
-    obstack_fgrow1 (os, "\tarrow_mode:\t%s\n",
+    fprintf (fout, "\tarrow_mode:\t%s\n",
                    get_arrow_mode_str(graph->arrow_mode));
 
   if (graph->treefactor != G_TREEFACTOR)
-    obstack_fgrow1 (os, "\ttreefactor:\t%f\n", graph->treefactor);
+    fprintf (fout, "\ttreefactor:\t%f\n", graph->treefactor);
   if (graph->spreadlevel != G_SPREADLEVEL)
-    obstack_fgrow1 (os, "\tspreadlevel:\t%d\n", graph->spreadlevel);
+    fprintf (fout, "\tspreadlevel:\t%d\n", graph->spreadlevel);
 
   if (graph->crossing_weight != G_CROSSING_WEIGHT)
-    obstack_fgrow1 (os, "\tcrossing_weight:\t%s\n",
+    fprintf (fout, "\tcrossing_weight:\t%s\n",
                    get_crossing_type_str(graph->crossing_weight));
   if (graph->crossing_phase2 != G_CROSSING_PHASE2)
-    obstack_fgrow1 (os, "\tcrossing_phase2:\t%s\n",
-                   get_decision_str(graph->crossing_phase2,
-                                    G_CROSSING_PHASE2));
+    fprintf (fout, "\tcrossing_phase2:\t%s\n",
+            get_decision_str(graph->crossing_phase2));
   if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)
-    obstack_fgrow1 (os, "\tcrossing_optimization:\t%s\n",
-                   get_decision_str(graph->crossing_optimization,
-                                    G_CROSSING_OPTIMIZATION));
+    fprintf (fout, "\tcrossing_optimization:\t%s\n",
+            get_decision_str(graph->crossing_optimization));
 
   if (graph->view != G_VIEW)
-    obstack_fgrow1 (os, "\tview:\t%s\n", get_view_str(graph->view));
+    fprintf (fout, "\tview:\t%s\n", get_view_str(graph->view));
 
   if (graph->edges != G_EDGES)
-    obstack_fgrow1 (os, "\tedges:\t%s\n", get_decision_str(graph->edges,
-                                                          G_EDGES));
+    fprintf (fout, "\tedges:\t%s\n", get_decision_str(graph->edges));
 
   if (graph->nodes != G_NODES)
-    obstack_fgrow1 (os,"\tnodes:\t%s\n",
-                   get_decision_str(graph->nodes, G_NODES));
+    fprintf (fout,"\tnodes:\t%s\n", get_decision_str(graph->nodes));
 
   if (graph->splines != G_SPLINES)
-    obstack_fgrow1 (os, "\tsplines:\t%s\n",
-                   get_decision_str(graph->splines, G_SPLINES));
+    fprintf (fout, "\tsplines:\t%s\n", get_decision_str(graph->splines));
 
   if (graph->bmax != G_BMAX)
-    obstack_fgrow1 (os, "\tbmax:\t%d\n", graph->bmax);
+    fprintf (fout, "\tbmax:\t%d\n", graph->bmax);
   if (graph->cmin != G_CMIN)
-    obstack_fgrow1 (os, "\tcmin:\t%d\n", graph->cmin);
+    fprintf (fout, "\tcmin:\t%d\n", graph->cmin);
   if (graph->cmax != G_CMAX)
-    obstack_fgrow1 (os, "\tcmax:\t%d\n", graph->cmax);
+    fprintf (fout, "\tcmax:\t%d\n", graph->cmax);
   if (graph->pmin != G_PMIN)
-    obstack_fgrow1 (os, "\tpmin:\t%d\n", graph->pmin);
+    fprintf (fout, "\tpmin:\t%d\n", graph->pmin);
   if (graph->pmax != G_PMAX)
-    obstack_fgrow1 (os, "\tpmax:\t%d\n", graph->pmax);
+    fprintf (fout, "\tpmax:\t%d\n", graph->pmax);
   if (graph->rmin != G_RMIN)
-    obstack_fgrow1 (os, "\trmin:\t%d\n", graph->rmin);
+    fprintf (fout, "\trmin:\t%d\n", graph->rmin);
   if (graph->rmax != G_RMAX)
-    obstack_fgrow1 (os, "\trmax:\t%d\n", graph->rmax);
+    fprintf (fout, "\trmax:\t%d\n", graph->rmax);
   if (graph->smax != G_SMAX)
-    obstack_fgrow1 (os, "\tsmax:\t%d\n", graph->smax);
+    fprintf (fout, "\tsmax:\t%d\n", graph->smax);
 }
Index: src/vcg.h
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.h,v
retrieving revision 1.3
diff -u -w -r1.3 vcg.h
--- src/vcg.h   2001/08/08 20:31:21     1.3
+++ src/vcg.h   2001/10/04 14:53:14
@@ -75,14 +75,32 @@
   triangle
 };
 
+/* Structure for colorentries.  */
+struct colorentry_s
+{
+  int color_index;
+  int red_cp;
+  int green_cp;
+  int blue_cp;
+  struct colorentry_s *next;
+};
+
 /* Structure to construct lists of classnames. */
 struct classname_s
 {
   int no; /* Class number */
-  char *name; /* Name associated to the class no. */
+  const char *name; /* Name associated to the class no. */
   struct classname_s *next; /* next name class association. */
 };
 
+/* Structure is in infoname.  */
+struct infoname_s
+{
+  int integer;
+  const char *string;
+  struct infoname_s *next;
+};
+
 /* Layout Algorithms which can be found in VCG.
    Details about each algoithm can be found below. */
 enum layoutalgorithm_e
@@ -161,13 +179,13 @@
 {
   /* Title the unique string identifying the node. This attribute is
      mandatory. */
-  char *title;
+  const char *title;
 
   /* Label the text displayed inside the node. If no label is specified
      then the title of the node will be used. Note that this text may
      contain control characters like NEWLINE that influences the size of
      the node. */
-  char *label;
+  const char *label;
 
   /* loc is the location as x, y position relatively to the system of
      coordinates of the graph. Locations are specified in the form
@@ -277,7 +295,7 @@
   /* info2, info3 can be selected from the menu. The corresponding text
      labels can be shown by mouse clicks on nodes.
      Default are null strings. */
-  char *infos[3];
+  const char *infos[3];
 
   /* Node border color.
      Default is textcolor. */
@@ -483,19 +501,19 @@
      index 2, green has index 3, etc.
      Default is white for background and white or transparent for summary
      nodes. */
-  unsigned char color;
+  enum color_e color;
 
   /* Textcolor.
      need explainations ???
      defalut is black for summary nodes. */
-  unsigned char textcolor;
+  enum color_e textcolor;
 
   /* Bordercolor is the color of the summary node's border. Default color
      is the textcolor. width, height are width and height of the
      displayed part of the window of the outermost graph in pixels, or
      width and height of the summary node of inner subgraphs.
      Default is the defalut of the textcolor. */
-  unsigned char bordercolor;
+  enum color_e bordercolor;
 
   /* Width, height are width and height of the displayed part of the
      window of the outermost graph in pixels, or width and height of the
@@ -559,7 +577,22 @@
      Defalut is box, other: rhomb, ellipse, triangle. */
   enum shape_e shape;
 
-  /* FIXME {vertival,horizontal}_order */
+  /* Vertical order is the level position (rank) of the summary node of an 
+     inner subgraph, if this subgraph is folded. We can also specify 
+     level: int. The level is only recognized, if an automatical layout is 
+     calculated.  */
+  int vertical_order;
+
+  /* Horizontal order is the horizontal position of the summary node within 
+     a level. The nodes which are specified with horizontal positions are 
+     ordered according to these positions within the levels. The nodes which 
+     do not have this attribute are inserted into this ordering by the 
+     crossing reduction mechanism. Note that connected components are 
+     handled separately, thus it is not possible to intermix such components 
+     by specifying a horizontal order. If the algorithm for downward laid 
+     out trees is used, the horizontal order influences only the order of 
+     the child nodes at a node, but not the order of the whole level.  */
+  int horizontal_order;
 
   /* xmax, ymax specify the maximal size of the virtual window that is
      used to display the graph. This is usually larger than the displayed
@@ -630,8 +663,19 @@
      By default, no class names. */
   struct classname_s *classname;
 
-  /* FIXME : infoname. */
-  /* FIXME : colorentry. */
+  /* Infoname allows to introduce names for the additional text labels. 
+     The names are used in the menus.  
+     Infoname is given by an integer and a string.  
+     The default value is NULL.  */
+  struct infoname_s *infoname;
+  
+  /* Colorentry allows to fill the color map. A color is a triplet of integer 
+     values for the red/green/blue-part. Each integer is between 0 (off) and 
+     255 (on), e.g., 0 0 0 is black and 255 255 255 is white. For instance 
+     colorentry 75 : 70 130 180 sets the map entry 75 to steel blue. This 
+     color can be used by specifying just the number 75.
+     Default id NULL.  */
+  struct colorentry_s *colorentry;
 
   /* layoutalgorithm chooses different graph layout algorithms
      Possibilities are maxdepth, mindepth, maxdepthslow, mindepthslow,
@@ -955,16 +999,21 @@
 void add_node PARAMS ((graph_t *graph, node_t *node));
 void add_edge PARAMS ((graph_t *graph, edge_t *edge));
 
-void open_node PARAMS ((struct obstack *os));
-void output_node PARAMS ((node_t *node, struct obstack *os));
-void close_node PARAMS ((struct obstack *os));
-
-void open_edge PARAMS ((edge_t *edge, struct obstack *os));
-void output_edge PARAMS ((edge_t *edge, struct obstack *os));
-void close_edge PARAMS ((struct obstack *os));
-
-void open_graph PARAMS ((struct obstack *os));
-void output_graph PARAMS ((graph_t *graph, struct obstack *os));
-void close_graph PARAMS ((graph_t *graph, struct obstack *os));
+void add_colorentry PARAMS ((graph_t *g, int color_idx, int red_cp, 
+                            int green_cp, int blue_cp));
+void add_classname PARAMS ((graph_t *g, int val, const char *name));
+void add_infoname PARAMS ((graph_t *g, int val, const char *name));
+
+void open_node PARAMS ((FILE *fout));
+void output_node PARAMS ((node_t *node, FILE *fout));
+void close_node PARAMS ((FILE *fout));
+
+void open_edge PARAMS ((edge_t *edge, FILE *fout));
+void output_edge PARAMS ((edge_t *edge, FILE *fout));
+void close_edge PARAMS ((FILE *fout));
+
+void open_graph PARAMS ((FILE *fout));
+void output_graph PARAMS ((graph_t *graph, FILE *fout));
+void close_graph PARAMS ((graph_t *graph, FILE *fout));
 
 #endif /* VCG_H_ */
Index: src/vcg_defaults.h
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg_defaults.h,v
retrieving revision 1.2
diff -u -w -r1.2 vcg_defaults.h
--- src/vcg_defaults.h  2001/08/08 20:31:21     1.2
+++ src/vcg_defaults.h  2001/10/04 14:53:14
@@ -47,6 +47,9 @@
 # define G_TEXTMODE            centered
 # define G_SHAPE               box
 
+# define G_VERTICAL_ORDER      0       /* Unspecified for subgraphs. */
+# define G_HORIZONTAL_ORDER    0       /* Unspecified for subgraphs. */
+
 # define G_XMAX                        90              /* Not output */
 # define G_YMAX                        90              /* Not output */
 
@@ -64,6 +67,9 @@
 # define G_HIDDEN              -1              /* No default value. */
 
 # define G_CLASSNAME           NULL            /* No class name association */
+# define G_INFONAME            NULL
+# define G_COLORENTRY          NULL
+
 # define G_LAYOUTALGORITHM     normal
 # define G_LAYOUT_DOWNFACTOR   1
 # define G_LAYOUT_UPFACTOR     1
cvs server: Diffing tests
Index: tests/.cvsignore
===================================================================
RCS file: /cvsroot/bison/bison/tests/.cvsignore,v
retrieving revision 1.6
diff -u -w -r1.6 .cvsignore
--- tests/.cvsignore    2001/08/25 13:13:14     1.6
+++ tests/.cvsignore    2001/10/04 14:53:14
@@ -1,7 +1,6 @@
 Makefile
 Makefile.in
 at-*
-debug-*
 atconfig
 empty
 experr
@@ -9,7 +8,12 @@
 stderr
 stdout
 testsuite
+testsuite.[0-9]
+testsuite.[0-9][0-9]
+package.m4
 calc.[chy]
 calc.tab.*
 calc
 *.output *.vcg
+autom4te.cache
+bison
Index: tests/Makefile.am
===================================================================
RCS file: /cvsroot/bison/bison/tests/Makefile.am,v
retrieving revision 1.5
diff -u -w -r1.5 Makefile.am
--- tests/Makefile.am   2001/08/03 10:13:42     1.5
+++ tests/Makefile.am   2001/10/04 14:53:14
@@ -18,23 +18,34 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
 
-# Distribute the testsuite since GNU M4 is needed to build it.
-noinst_SCRIPTS = testsuite
+EXTRA_DIST = atlocal.in $(TESTSUITE_AT) testsuite
 
-SUITE = calc.at regression.at
+DISTCLEANFILES       = atconfig atlocal bison package.m4
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
 
-EXTRA_DIST = atgeneral.m4 suite.at $(SUITE) $(noinst_SCRIPTS)
+TESTSUITE_AT = \
+       testsuite.at \
+       output.at calc.at regression.at
+TESTSUITE = $(srcdir)/testsuite
 
-check-local: atconfig $(srcdir)/testsuite
-       $(SHELL) $(srcdir)/testsuite
-
-testsuite: atgeneral.m4 suite.at $(SUITE)
-       $(M4) -I $(srcdir) atgeneral.m4 suite.at | \
-          sed -e 's/[  ]*$$//' | \
-         sed -e '/^$$/N;/\n$$/D' > address@hidden
-       chmod +x address@hidden
-       mv address@hidden $@
-
-CLEANFILES = debug-*.sh empty
-DISTCLEANFILES = atconfig
-MAINTAINERCLEANFILES = testsuite
+AUTOM4TE = autom4te
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(srcdir)/$(TESTSUITE): $(TESTSUITE_AT)
+       $(AUTOTEST) -I $(srcdir) testsuite.at -o address@hidden
+       mv address@hidden $@
+
+atconfig: $(top_builddir)/config.status
+       cd $(top_builddir) && ./config.status tests/$@
+
+atlocal: $(srcdir)/atlocal.in $(top_builddir)/config.status
+       cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+       $(SHELL) $(TESTSUITE) --clean
+
+check-local: atconfig atlocal $(TESTSUITE)
+       $(SHELL) $(TESTSUITE)
+
+# Run the test suite on the *installed* tree.
+installcheck-local:
+       $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
Index: tests/atconfig.in
===================================================================
RCS file: atconfig.in
diff -N atconfig.in
--- /tmp/cvsHIYvnc      Thu Oct  4 10:53:15 2001
+++ /dev/null   Sat Apr 14 20:46:23 2001
@@ -1,97 +0,0 @@
-# @configure_input@                                    -*- shell-script -*-
-# Configurable variable values for building test suites.
-# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
-
-# This program 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.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# This script is part of Autotest.  Unlimited permission to copy,
-# distribute and modify the testing scripts that are the output of
-# that Autotest script is given.  You need not follow the terms of the
-# GNU General Public License when using or distributing such scripts,
-# even though portions of the text of Autotest appear in them.  The
-# GNU General Public License (GPL) does govern all other use of the
-# material that constitutes the Autotest.
-#
-# Certain portions of the Autotest source text are designed to be
-# copied (in certain cases, depending on the input) into the output of
-# Autotest.  We call these the "data" portions.  The rest of the
-# Autotest source text consists of comments plus executable code that
-# decides which of the data portions to output in any given case.  We
-# call these comments and executable code the "non-data" portions.
-# Autotest never copies any of the non-data portions into its output.
-#
-# This special exception to the GPL applies to versions of Autotest
-# released by the Free Software Foundation.  When you make and
-# distribute a modified version of Autotest, you may extend this
-# special exception to the GPL to apply to your modified version as
-# well, *unless* your modified version has the potential to copy into
-# its output some of the text that was the non-data portion of the
-# version that you started with.  (In other words, unless your change
-# moves or copies text from the non-data portions to the data
-# portions.)  If your modification has such potential, you must delete
-# any notice of this special exception to the GPL from your modified
-# version.
-
-# Snippet (1
-# This debugging script has been automatically generated from `make check'.
-# Call it with `--help' to get a quick usage summary.
-
-at_package='@PACKAGE@'
-at_version='@VERSION@'
-# Snippet )1
-# Snippet (2
-at_n='@ECHO_N@'
-at_c='@ECHO_C@'
-test -f atlocal && . ./atlocal
-
-# LC_MESSAGES is always shadowed by LC_ALL.  Here are the only cases:
-# - GNU:       LANGUAGE -> LC_ALL -> LC_MESSAGES -> LANG
-# - POSIX:     LC_ALL -> LC_MESSAGES -> LANG
-# - XPG4:      LC_ALL -> LANG
-# - SysV/XPG2: LANG
-export LANGUAGE; LANGUAGE=C
-export LANG; LANG=C
-export LC_ALL; LC_ALL=C
-
address@hidden@
address@hidden@
-# Use absolute file notations, as the test might change directories.
-at_srcdir=`cd @srcdir@ && pwd`
-at_top_srcdir=`cd @top_srcdir@ && pwd`
-at_builddir=`pwd`
-at_top_builddir=`cd .. && pwd`
-if test -n "@AT_TESTPATH@"; then
-  export PATH; PATH=`pwd`:`cd @AT_TESTPATH@ && pwd`:$PATH
-else
-  export PATH; PATH=`pwd`:$PATH
-fi
-
-# We need GNU M4.
-M4='@M4@'
-
-# We need a C compiler.
-CC='@CC@'
-CFLAGS='@CFLAGS@'
-
-# We need `config.h'.
-CPPFLAGS="-I$at_top_builddir @CPPFLAGS@"
-
-# We want to use the files shipped with Bison.
-BISON_SIMPLE=$at_top_srcdir/src/bison.simple
-export BISON_SIMPLE
-BISON_HAIRY=$at_top_srcdir/src/bison.hairy
-export BISON_HAIRY
-# Snippet )2
Index: tests/atgeneral.m4
===================================================================
RCS file: atgeneral.m4
diff -N atgeneral.m4
--- /tmp/cvshclqsj      Thu Oct  4 10:53:15 2001
+++ /dev/null   Sat Apr 14 20:46:23 2001
@@ -1,420 +0,0 @@
-divert(-1)                                                 -*- Autoconf -*-
-# `m4' macros used in building test suites.
-# Copyright (C) 2000 Free Software Foundation, Inc.
-
-# This program 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.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# This script is part of Autotest.  Unlimited permission to copy,
-# distribute and modify the testing scripts that are the output of
-# that Autotest script is given.  You need not follow the terms of the
-# GNU General Public License when using or distributing such scripts,
-# even though portions of the text of Autotest appear in them.  The
-# GNU General Public License (GPL) does govern all other use of the
-# material that constitutes the Autotest.
-#
-# Certain portions of the Autotest source text are designed to be
-# copied (in certain cases, depending on the input) into the output of
-# Autotest.  We call these the "data" portions.  The rest of the
-# Autotest source text consists of comments plus executable code that
-# decides which of the data portions to output in any given case.  We
-# call these comments and executable code the "non-data" portions.
-# Autotest never copies any of the non-data portions into its output.
-#
-# This special exception to the GPL applies to versions of Autotest
-# released by the Free Software Foundation.  When you make and
-# distribute a modified version of Autotest, you may extend this
-# special exception to the GPL to apply to your modified version as
-# well, *unless* your modified version has the potential to copy into
-# its output some of the text that was the non-data portion of the
-# version that you started with.  (In other words, unless your change
-# moves or copies text from the non-data portions to the data
-# portions.)  If your modification has such potential, you must delete
-# any notice of this special exception to the GPL from your modified
-# version.
-
-changequote()
-changequote([, ])
-
-define([AT_DEFINE], defn([define]))
-define([AT_EVAL], defn([eval]))
-define([AT_FORMAT], defn([format]))
-define([AT_INCLUDE], defn([include]))
-define([AT_SHIFT], defn([shift]))
-define([AT_UNDEFINE], defn([undefine]))
-
-undefine([define])
-undefine([eval])
-undefine([format])
-undefine([include])
-undefine([shift])
-undefine([undefine])
-
-
-# AT_CASE(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT)
-# -----------------------------------------------------------
-# m4 equivalent of
-# switch (SWITCH)
-# {
-#   case VAL1:
-#     IF-VAL1;
-#     break;
-#   case VAL2:
-#     IF-VAL2;
-#     break;
-#   ...
-#   default:
-#     DEFAULT;
-#     break;
-# }.
-# All the values are optional, and the macro is robust to active
-# symbols properly quoted.
-AT_DEFINE([AT_CASE],
-[ifelse([$#], 0, [],
-       [$#], 1, [],
-       [$#], 2, [$2],
-        [$1], [$2], [$3],
-        [AT_CASE([$1], AT_SHIFT(AT_SHIFT(AT_SHIFT($@))))])])
-
-
-# Use of diversions:
-#  0 - overall initialization; for each test group: skipping and cleanups;
-#  1 - for each test group: proper code, to reinsert between cleanups;
-#  2 - overall wrap up: generation of debugging scripts and statistics.
-
-
-# AT_LINE
-# -------
-# Return the current file sans directory, a colon, and the current line.
-AT_DEFINE([AT_LINE],
-[patsubst(__file__, ^.*/\(.*\), \1):__line__])
-
-
-# AT_INIT(PROGRAM)
-# ----------------
-# Begin testing suite, using PROGRAM to check version.  The search path
-# should be already preset so the proper executable will be selected.
-AT_DEFINE([AT_INIT],
-[AT_DEFINE(AT_ordinal, 0)
-. ./atconfig
-# Snippet (3
-# -e sets to true
-at_stop_on_error=false;
-# Shall we save and check stdout and stderr?
-# -n sets to false
-at_check_stds=:;
-# Shall we
-# -s sets to false, and -v to true
-at_verbose=false
-
-at_usage="Usage: $[0] [OPTION]...
-
-  -e  Abort the full suite and inhibit normal clean up if a test fails
-  -n  Do not redirect stdout and stderr and do not test their contents
-  -s  Inhibit verbosity while generating or executing debugging scripts
-  -v  Force more detailed output, default for debugging scripts unless -s
-  -x  Have the shell to trace command execution; also implies option -n"
-
-# Snippet )3
-
-# Snippet (4
-while test $[#] -gt 0; do
-  case "$[1]" in
-    --help) echo "$at_usage"; exit 0 ;;
-    --version) echo "$[0] ($at_package) $at_version"; exit 0 ;;
-    -e) at_stop_on_error=:;;
-    -n) at_check_stds=false;;
-    -s) at_verbose=false; at_silent=1;;
-    -v) at_verbose=:; at_silent=;;
-    -x) at_traceon='set -vx'; at_traceoff='set +vx'; at_check_stds=false;;
-    *) echo 1>&2 "Try \`$[0] --help' for more information."; exit 1 ;;
-  esac
-  shift
-done
-
-
-# To check whether a test succeeded or not, we compare an expected
-# output with a reference.  In the testing suite, we just need `cmp'
-# but in debugging scripts, we want more information, so we prefer
-# `diff -u'.  Nonetheless we will use `diff' only, because in DOS
-# environments, `diff' considers that two files are equal included
-# when there are only differences on the coding of new lines. `cmp'
-# does not.
-#
-# Finally, not all the `diff' support `-u', and some, like Tru64, even
-# refuse to `diff' /dev/null.
-: >empty
-
-if diff -u empty empty >/dev/null 2>&1; then
-  at_diff='diff -u'
-else
-  at_diff='diff'
-fi
-
-
-
-# Each generated debugging script, containing a single test group, cleans
-# up files at the beginning only, not at the end.  This is so we can repeat
-# the script many times and browse left over files.  To cope with such left
-# over files, the full test suite cleans up both before and after test groups.
-# Snippet )4
-
-if $1 --version | grep "$at_package.*$at_version" >/dev/null; then
-  at_banner="Testing suite for $at_package, version $at_version"
-  at_dashes=`echo $at_banner | sed s/./=/g`
-  echo "$at_dashes"
-  echo "$at_banner"
-  echo "$at_dashes"
-else
-  echo '======================================================='
-  echo 'ERROR: Not using the proper version, no tests performed'
-  echo '======================================================='
-  exit 1
-fi
-
-# Remove any debugging script resulting from a previous run.
-rm -f debug-*.sh
-
-at_failed_list=
-at_ignore_count=0
-divert(2)[]dnl
-
-# Wrap up the testing suite with summary statistics.
-
-rm -f at-check-line at-setup-line
-at_fail_count=0
-if test -z "$at_failed_list"; then
-  if test "$at_ignore_count" = 0; then
-    at_banner="All $at_test_count tests were successful"
-  else
-    at_banner="All $at_test_count tests were successful ($at_ignore_count 
ignored)"
-  fi
-else
-  echo
-  echo $at_n "Writing \`debug-NN.sh' scripts, NN =$at_c"
-  for at_group in $at_failed_list; do
-    echo $at_n " $at_group$at_c"
-    ( echo '#!/bin/sh'
-      sed -n '/^[#] Snippet (1/,/^[#] Snippet )1/p' atconfig
-      sed -n '/^[#] Snippet (2/,/^[#] Snippet )2/p' atconfig
-      sed -n "/^[#] Snippet (3/,/^[#] Snippet )3/p" $[0]
-      test -z "$at_silent" && echo 'at_verbose=:'
-      sed -n "/^[#] Snippet (4/,/^[#] Snippet )4/p" $[0]
-      sed -n "/^[#] Snippet (c$at_group(/,/^[#] Snippet )c$at_group)/p" $[0]
-      at_desc=`sed -n \
-        '/^[#] Snippet (d'$at_group'(/,/^[#] Snippet )d'$at_group')/p' $[0] \
-        | sed -n '2s/^[#] //p'`
-      echo 'if $at_verbose; then'
-      echo '  at_banner="$[0]: '$at_desc'"'
-      echo '  at_dashes=`echo $at_banner | sed s/./=/g`'
-      echo '  echo'
-      echo '  echo "$at_dashes"'
-      echo '  echo "$at_banner"'
-      echo '  echo "$at_dashes"'
-      echo 'fi'
-      echo
-      sed -n "/^[#] Snippet (d$at_group(/,/^[#] Snippet )d$at_group)/p" $[0]
-      sed -n "/^[#] Snippet (s$at_group(/,/^[#] Snippet )s$at_group)/p" $[0]
-      echo 'exit 0'
-    ) | grep -v '^[#] Snippet' > debug-$at_group.sh
-    chmod +x debug-$at_group.sh
-    at_fail_count=`expr $at_fail_count + 1`
-  done
-  echo ', done'
-  if $at_stop_on_error; then
-    at_banner='ERROR: One of the tests failed, inhibiting subsequent tests'
-  else
-    at_banner="ERROR: Suite unsuccessful, $at_fail_count of $at_test_count 
tests failed"
-  fi
-fi
-at_dashes=`echo $at_banner | sed s/./=/g`
-echo
-echo "$at_dashes"
-echo "$at_banner"
-echo "$at_dashes"
-
-if test -n "$at_failed_list"; then
-  if test -z "$at_silent"; then
-    echo
-    echo 'When reporting failed tests to maintainers, do not merely list test'
-    echo 'numbers, as the numbering changes between releases and pretests.'
-    echo 'Be careful to give at least all the information you got about them.'
-    echo 'You may investigate any problem if you feel able to do so, in which'
-    echo 'case the generated debugging scripts provide good starting points.'
-    echo "Go on and modify them at will.  \`./debug-NN --help' gives usage"
-    echo 'information.  Now, failed tests will be executed again, verbosely.'
-    for at_group in $at_failed_list; do
-      ./debug-$at_group.sh
-    done
-  fi
-  exit 1
-fi
-
-exit 0
-divert[]dnl
-])# AT_INIT
-
-
-
-# AT_SETUP(DESCRIPTION)
-# ---------------------
-# Start a group of related tests, all to be executed in the same subshell.
-# The group is testing what DESCRIPTION says.
-AT_DEFINE([AT_SETUP],
-[AT_DEFINE([AT_ordinal], AT_EVAL(AT_ordinal + 1))
-pushdef([AT_group_description], [$1])
-pushdef([AT_data_files], )
-pushdef([AT_data_expout], )
-pushdef([AT_data_experr], )
-if $at_stop_on_error && test -n "$at_failed_list"; then :; else
-divert(1)[]dnl
-  echo AT_LINE > at-check-line
-  echo AT_LINE > at-setup-line
-  if $at_verbose; then
-    echo 'testing AT_group_description'
-    echo $at_n "     $at_c"
-  fi
-  if $at_verbose; then
-    echo "AT_ordinal. $srcdir/AT_LINE..."
-  else
-    echo $at_n "substr(AT_ordinal. $srcdir/AT_LINE                            
, 0, 30)[]$at_c"
-  fi
-  if test -z "$at_skip_mode"; then
-    (
-[#] Snippet (d[]AT_ordinal[](
-[#] Testing AT_group_description
-[#] Snippet )d[]AT_ordinal[])
-[#] Snippet (s[]AT_ordinal[](
-[#] starting from `AT_LINE'.
-$at_traceon
-])
-
-
-# AT_CLEANUP(FILES)
-# -----------------
-# Complete a group of related tests, recursively remove those FILES
-# created within the test.  There is no need to list stdout, stderr,
-# nor files created with AT_DATA.
-AT_DEFINE([AT_CLEANUP],
-$at_traceoff
-[[#] Snippet )s[]AT_ordinal[])
-    )
-    at_status=$?
-    $at_verbose &&
-      echo $at_n "     AT_ordinal. $srcdir/`cat at-setup-line`: $at_c"
-    case $at_status in
-      0) echo ok
-         ;;
-      77) echo "ignored near \``cat at-check-line`'"
-          at_ignore_count=`expr $at_ignore_count + 1`
-          ;;
-      *) echo "FAILED near \``cat at-check-line`'"
-         at_failed_list="$at_failed_list AT_ordinal"
-         ;;
-    esac
-  else
-     echo 'ignored (skipped)'
-     at_ignore_count=`expr $at_ignore_count + 1`
-  fi
-  at_test_count=AT_ordinal
-  if $at_stop_on_error && test -n "$at_failed_list"; then :; else
-divert(0)[]dnl
-[#] Snippet (c[]AT_ordinal[](
-
-rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ 
$1])]) stdout stderr[]AT_data_expout[]AT_data_experr
-[#] Snippet )c[]AT_ordinal[])
-undivert(1)[]dnl
-    rm ifelse([AT_data_files$1], , [-f], [-rf[]AT_data_files[]ifelse($1, , , [ 
$1])]) stdout stderr[]AT_data_expout[]AT_data_experr
-  fi
-fi
-popdef([AT_data_experr])
-popdef([AT_data_expout])
-popdef([AT_data_files])
-popdef([AT_group_description])[]dnl
-])# AT_CLEANUP
-
-
-# AT_DATA(FILE, CONTENTS)
-# -----------------------
-# Initialize an input data FILE with given CONTENTS, which should end with
-# an end of line.
-# This macro is not robust to active symbols in CONTENTS *on purpose*.
-# If you don't want CONTENT to be evaluated, quote it twice.
-AT_DEFINE([AT_DATA],
-[AT_DEFINE([AT_data_files], AT_data_files[ ]$1)
-cat >$1 <<'_ATEOF'
-$2[]_ATEOF
-])
-
-
-# AT_CHECK(COMMANDS, [STATUS], STDOUT, STDERR)
-# --------------------------------------------
-# Execute a test by performing given shell COMMANDS.  These commands
-# should normally exit with STATUS, while producing expected STDOUT and
-# STDERR contents.  The special word `expout' for STDOUT means that file
-# `expout' contents has been set to the expected stdout.  The special word
-# `experr' for STDERR means that file `experr' contents has been set to
-# the expected stderr.
-# STATUS is not checked if it is empty.
-# STDOUT and STDERR can be the special value `ignore', in which case
-# their content is not checked.
-AT_DEFINE([AT_CHECK],
-[$at_traceoff
-$at_verbose && echo "$srcdir/AT_LINE: patsubst([$1], [\([\"`$]\)], \\\1)"
-echo AT_LINE > at-check-line
-$at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr
-$at_traceon
-$1
-ifelse([$2], [], [],
-[at_status=$?
-if test $at_status != $2; then
-  $at_verbose && echo "Exit code was $at_status, expected $2" >&6
-dnl Maybe there was an important message to read before it died.
-  $at_verbose && $at_check_stds && cat stderr >&6
-dnl Preserve exit code 77.
-  test $at_status = 77 && exit 77
-  exit 1
-fi
-])dnl
-$at_traceoff
-if $at_check_stds; then
-dnl Restore stdout to fd1 and stderr to fd2.
-  exec 1>&5 2>&6
-dnl If not verbose, neutralize the output of diff.
-  $at_verbose || exec 1>/dev/null 2>/dev/null
-  at_failed=false;
-  AT_CASE([$4],
-          ignore, [$at_verbose && cat stderr;:],
-          experr, [AT_DEFINE([AT_data_experr], [ experr])dnl
-$at_diff experr stderr || at_failed=:],
-          [], [$at_diff empty stderr || at_failed=:],
-          [echo $at_n "patsubst([$4], [\([\"`$]\)], \\\1)$at_c" | $at_diff - 
stderr || at_failed=:])
-  AT_CASE([$3],
-          ignore, [$at_verbose && cat stdout;:],
-          expout, [AT_DEFINE([AT_data_expout], [ expout])dnl
-$at_diff expout stdout || at_failed=:],
-          [], [$at_diff empty stdout || at_failed=:],
-          [echo $at_n "patsubst([$3], [\([\"`$]\)], \\\1)$at_c" | $at_diff - 
stdout || at_failed=:])
-  if $at_failed; then
-    exit 1
-  else
-    :
-  fi
-fi
-$at_traceon
-])# AT_CHECK
-
-
-divert(0)dnl
Index: tests/atlocal.in
===================================================================
RCS file: atlocal.in
diff -N atlocal.in
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ atlocal.in  Thu Oct  4 10:53:14 2001
@@ -0,0 +1,10 @@
+# @configure_input@                                    -*- shell-script -*-
+# Configurable variable values for Bison test suite.
+# Copyright 2000, 2001 Free Software Foundation, Inc.
+
+# We need a C compiler.
+CC='@CC@'
+CFLAGS='@CFLAGS@'
+
+# We need `config.h'.
+CPPFLAGS="-I $top_builddir @CPPFLAGS@"
Index: tests/bison.in
===================================================================
RCS file: bison.in
diff -N bison.in
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ bison.in    Thu Oct  4 10:53:14 2001
@@ -0,0 +1,11 @@
+#! /bin/sh
+# @configure_generated@
+# Wrapper around a non installed bison to make it work as an installed one.
+
+# We want to use the files shipped with Bison.
+BISON_SIMPLE='@top_srcpath@/src/bison.simple'
+export BISON_SIMPLE
+BISON_HAIRY='@top_srcpath@/src/bison.hairy'
+export BISON_HAIRY
+
+exec '@top_buildpath@/src/bison' ${1+"$@"}
Index: tests/calc.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/calc.at,v
retrieving revision 1.6
diff -u -w -r1.6 calc.at
--- tests/calc.at       2001/09/01 01:20:54     1.6
+++ tests/calc.at       2001/10/04 14:53:14
@@ -1,12 +1,23 @@
-#                                                        -*- Autoconf -*-
+# Checking the output filenames.                         -*- Autotest -*-
+# Copyright 2000, 2001 Free Software Foundation, Inc.
 
-cat <<EOF
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
-Simple Calculator.
+AT_BANNER([[Simple Calculator.]])
 
-EOF
-
-
 ## ---------------------------------------------------- ##
 ## Compile the grammar described in the documentation.  ##
 ## ---------------------------------------------------- ##
@@ -23,16 +34,16 @@
 # some occurrences of `$1' etc. which will be interpreted by m4.  So
 # you should call it with $1, $2, and $3 as arguments, which is what
 # AT_DATA_CALC_Y does.
-AT_DEFINE([_AT_DATA_CALC_Y],
-[ifelse([$1$2$3],
-        $[1]$[2]$[3], [],
-        [errprint([$0: Invalid arguments: $@
-])m4exit(1)])dnl
+m4_define([_AT_DATA_CALC_Y],
+[m4_if([$1$2$3], $[1]$[2]$[3], [],
+       [m4_fatal([$0: Invalid arguments: address@hidden)])dnl
 AT_DATA([calc.y],
 [[/* Infix notation calculator--calc */
 
 %{
 #include <config.h>
+/* We don't need a perfect malloc for these tests. */
+#undef malloc
 #include <stdio.h>
 
 #if STDC_HEADERS
@@ -211,14 +222,16 @@
 }
 
 int
-main (int argn, const char **argv)
+main (int argc, const char **argv)
 {
-  if (argn == 2)
+  yyin = NULL;
+
+  if (argc == 2)
     yyin = fopen (argv[1], "r");
   else
     yyin = stdin;
 
-  if (!stdin)
+  if (!yyin)
     {
       perror (argv[1]);
       exit (1);
@@ -241,57 +254,83 @@
 # AT_DATA_CALC_Y([BISON-OPTIONS])
 # -------------------------------
 # Produce `calc.y'.
-AT_DEFINE([AT_DATA_CALC_Y],
+m4_define([AT_DATA_CALC_Y],
 [_AT_DATA_CALC_Y($[1], $[2], $[3],
-                 [ifelse(regexp([$1], [--yyerror-verbose]),
-                         [-1], [],
+                 [m4_match([$1], [--yyerror-verbose],
                          [[#define YYERROR_VERBOSE 1]])])])
 
 
 
-# _AT_CHECK_CALC(BISON-OPTIONS, INPUT)
-# ------------------------------------
+# _AT_CHECK_CALC(BISON-OPTIONS, INPUT, [NUM-STDERR-LINES = 0])
+# ------------------------------------------------------------
 # Run `calc' on INPUT and expect no STDOUT nor STDERR.
-# If `--debug' is passed to bison, discard all the debugging traces
-# preserving only the `parse errors'.  Note that since there should be
-# none, the `grep' will fail with exit status 1.
-AT_DEFINE([_AT_CHECK_CALC],
-[ifelse(regexp([$1], [--debug]),
-  [-1],
-     [AT_CHECK([echo "$2" | calc],
-               [0], [], [])],
-     [AT_CHECK([echo "$2" | calc 2>&1 >/dev/null | grep 'parse error' >&2],
-               [1], [], [])])])
+#
+# If BISON-OPTIONS contains `--debug', then NUM-STDERR-LINES is the number
+# of expected lines on stderr.
+m4_define([_AT_CHECK_CALC],
+[AT_DATA([[input]],
+[[$2
+]])
+AT_CHECK([calc input], 0, [], [stderr])dnl
+AT_CHECK([wc -l <stderr | sed 's/[[^0-9]]//g'], 0,
+         [m4_match([$1], [--debug],
+                   [$3], [0])
+])
+])
 
 
-# _AT_CHECK_CALC_ERROR(BISON-OPTIONS, INPUT,
+# _AT_CHECK_CALC_ERROR(BISON-OPTIONS, INPUT, [NUM-DEBUG-LINES],
 #                      [ERROR-LOCATION], [IF-YYERROR-VERBOSE])
 # ------------------------------------------------------------
-# Run `calc' on INPUT, and expect STDERR.
-AT_DEFINE([_AT_CHECK_CALC_ERROR],
-[AT_CHECK([echo "$2" | calc 2>&1 >/dev/null | grep 'parse error' >&2], 0,
-          [],
-[ifelse(regexp([$1], [--location]),
-        [-1], [], [$3: ])[]dnl
+# Run `calc' on INPUT, and expect a `parse error' message.
+#
+# If BISON-OPTIONS contains `--location', then make sure the ERROR-LOCATION
+# is correctly output on stderr.
+#
+# If BISON-OPTIONS contains `--yyerror-verbose', then make sure the
+# IF-YYERROR-VERBOSE message is properly output after `parse error, '
+# on STDERR.
+#
+# If BISON-OPTIONS contains `--debug', then NUM-STDERR-LINES is the number
+# of expected lines on stderr.
+m4_define([_AT_CHECK_CALC_ERROR],
+[AT_DATA([[input]],
+[[$2
+]])
+
+AT_CHECK([calc input], 0, [], [stderr])
+
+
+AT_CHECK([wc -l <stderr | sed 's/[[^0-9]]//g'], 0,
+         [m4_match([$1], [--debug],
+                   [$3], [1])
+])
+
+egrep -v '^((Start|Enter|Read|Reduc|Shift)ing|state|Error:) ' stderr >at-stderr
+mv at-stderr stderr
+
+AT_CHECK([cat stderr], 0,
+[m4_match([$1], [--location], [$4: ])[]dnl
 parse error[]dnl
-ifelse(regexp([$1], [--yyerror-verbose]),
-       [-1], [], [$4])[]dnl
+m4_match([$1], [--yyerror-verbose], [, $5])[]dnl
+
+])
 
-])])
+])
 
 
 # AT_CHECK_CALC([BISON-OPTIONS], [PARSER-EXPECTED-STDERR])
 # --------------------------------------------------------
 # Start a testing chunk which compiles `calc' grammar with
 # BISON-OPTIONS, and performs several tests over the parser.
-AT_DEFINE([AT_CHECK_CALC],
+m4_define([AT_CHECK_CALC],
 [# We use integers to avoid dependencies upon the precision of doubles.
 AT_SETUP([Calculator $1])
 
 AT_DATA_CALC_Y([$1])
 
 # Specify the output files to avoid problems on different file systems.
-AT_CHECK([bison calc.y -o calc.c patsubst([$1], [--yyerror-verbose])],
+AT_CHECK([bison calc.y -o calc.c m4_patsubst([$1], [--yyerror-verbose])],
          [0], [], [])
 AT_CHECK([$CC $CFLAGS $CPPFLAGS calc.c -o calc], 0, [], [])
 
@@ -309,26 +348,27 @@
 1 - (2 - 3) = 2
 
 2^2^3 = 256
-(2^2)^3 = 64], [$2])
+(2^2)^3 = 64], [491])
 
 # Some parse errors.
-_AT_CHECK_CALC_ERROR([$1], [+1],
+_AT_CHECK_CALC_ERROR([$1], [+1], [8],
                      [1.0:1.1],
-                     [, unexpected `'+''])
-_AT_CHECK_CALC_ERROR([$1], [1//2],
+                     [unexpected `'+''])
+_AT_CHECK_CALC_ERROR([$1], [1//2], [17],
                      [1.2:1.3],
-                     [, unexpected `'/'', expecting `NUM' or `'-'' or `'(''])
-_AT_CHECK_CALC_ERROR([$1], [error],
+                     [unexpected `'/'', expecting `NUM' or `'-'' or `'(''])
+_AT_CHECK_CALC_ERROR([$1], [error], [8],
                      [1.0:1.1],
-                     [, unexpected `$undefined.'])
-_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3],
+                     [unexpected `$undefined.'])
+_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [23],
                      [1.6:1.7],
-                     [, unexpected `'=''])
+                     [unexpected `'=''])
 _AT_CHECK_CALC_ERROR([$1],
                      [
 +1],
+                     [16],
                      [2.0:2.1],
-                     [, unexpected `'+''])
+                     [unexpected `'+''])
 
 AT_CLEANUP(calc calc.c calc.h calc.output)
 ])# AT_CHECK_CALC
Index: tests/output.at
===================================================================
RCS file: output.at
diff -N output.at
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ output.at   Thu Oct  4 10:53:14 2001
@@ -0,0 +1,70 @@
+# Checking the output filenames.                    -*- Autotest -*-
+# Copyright 2000, 2001 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AT_BANNER([[Output file names.]])
+
+
+# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES)
+# ------------------------------------------------------------------
+m4_define([AT_CHECK_OUTPUT],
+[AT_SETUP([Output files: $2 & $3.])
+AT_DATA([$1],
+[[$2
+%%
+foo: {}
+]])
+
+AT_CHECK([bison $3 $1], 0)
+AT_CHECK([ls $4], [], [ignore])
+AT_CLEANUP($4)
+])
+
+AT_CHECK_OUTPUT([foo.y], [], [-dv],
+                [foo.output foo.tab.c foo.tab.h])
+AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
+                [foo.c foo.h foo.output])
+AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.tab.c],
+                [foo.output foo.tab.c foo.tab.h])
+AT_CHECK_OUTPUT([foo.y], [], [-dv -y],
+                [y.output y.tab.c y.tab.h])
+AT_CHECK_OUTPUT([foo.y], [], [-dv -b bar],
+                [bar.output bar.tab.c bar.tab.h])
+AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c],
+                [foo.c foo.h foo.output foo.vcg])
+
+
+AT_CHECK_OUTPUT([foo.y], [%defines %verbose],      [],
+                [foo.output foo.tab.c foo.tab.h])
+AT_CHECK_OUTPUT([foo.y], [%defines %verbose %yacc],[],
+                [y.output y.tab.c y.tab.h])
+
+
+# Check priorities of extension control.
+AT_CHECK_OUTPUT([foo.yy], [%defines %verbose], [],
+                [foo.output foo.tab.cc foo.tab.hh])
+
+AT_CHECK_OUTPUT([foo.yy], [%defines %verbose ], [-o foo.c],
+                [foo.c foo.h foo.output])
+
+AT_CHECK_OUTPUT([foo.yy], [],
+                [--defines=foo.hpp -o foo.c++],
+                [foo.c++ foo.hpp])
+
+AT_CHECK_OUTPUT([foo.yy], [],
+                [-o foo.c++ --graph=foo.gph],
+                [foo.c++ foo.gph])
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.1
diff -u -w -r1.1 regression.at
--- tests/regression.at 2000/12/15 09:44:44     1.1
+++ tests/regression.at 2001/10/04 14:53:14
@@ -1,12 +1,23 @@
-#                                                        -*- Autoconf -*-
+# Bison Regressions.                               -*- Autotest -*-
+# Copyright 2001 Free Software Foundation, Inc.
 
-cat <<EOF
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
 
-Regression tests.
+AT_BANNER([[Regression tests.]])
 
-EOF
-
-
 ## ------------------ ##
 ## Duplicate string.  ##
 ## ------------------ ##
@@ -53,3 +64,68 @@
 AT_CHECK([bison --defines union.y])
 
 AT_CLEANUP([union.*])
+
+
+## --------------------------------------- ##
+## Duplicate '/' in C comments in %union   ##
+## --------------------------------------- ##
+
+
+AT_SETUP([%union and C comments])
+
+AT_DATA([union-comment.y],
+[%union
+{
+  /* The int.  */      int   integer;
+  /* The string.  */   char *string ;
+}
+%%
+exp: {};
+])
+
+AT_CHECK([bison union-comment.y])
+AT_CHECK([fgrep '//*' union-comment.tab.c], [1], [])
+
+AT_CLEANUP([union-comment.*])
+
+
+## --------------- ##
+## invalid input.  ##
+## --------------- ##
+
+
+AT_SETUP([Invalid input])
+
+AT_DATA([input.y],
+[[%%
+?
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[input.y:2: invalid input: `?'
+input.y:3: fatal error: no rules in the input grammar
+])
+
+AT_CLEANUP
+
+
+## --------------------- ##
+## Invalid CPP headers.  ##
+## --------------------- ##
+
+AT_SETUP([Invalid CPP headers])
+
+mkdir input
+
+AT_DATA([input/input.y],
+[%%
+dummy:
+])
+
+AT_CHECK([bison --defines input/input.y])
+
+AT_CHECK([sed 1q input/input.tab.h], 0,
+[[#ifndef INPUT_INPUT_TAB_H
+]])
+
+AT_CLEANUP(input)
Index: tests/suite.at
===================================================================
RCS file: suite.at
diff -N suite.at
--- /tmp/cvsRxA4jJ      Thu Oct  4 10:53:15 2001
+++ /dev/null   Sat Apr 14 20:46:23 2001
@@ -1,61 +0,0 @@
-#! /bin/sh
-# -*- Autoconf -*-
-# Validation suite for Bison.
-# Copyright 2000 Free Software Foundation, Inc.
-
-AT_INIT([bison])
-
-## ---------------------------- ##
-## Checking output file names.  ##
-## ---------------------------- ##
-
-# AT_CHECK_BISON_FLAGS(FLAGS, EXPECTED-FILES-SORTED)
-# --------------------------------------------------
-AT_DEFINE([AT_CHECK_BISON_FLAGS],
-[AT_SETUP([Output files: $1.])
-AT_DATA([foo.y],
-[[%%
-foo: {}
-]])
-rm -rf $2
-AT_CHECK([bison -dv foo.y $1], 0, ignore, ignore)
-AT_CHECK([ls $2 | sort | tr '\n' ' ' | sed 's/.$//g'], 0, [$2])
-rm -f $2
-AT_CLEANUP
-])
-
-AT_CHECK_BISON_FLAGS([],             [foo.output foo.tab.c foo.tab.h])
-AT_CHECK_BISON_FLAGS([-o foo.c],     [foo.c foo.h foo.output])
-AT_CHECK_BISON_FLAGS([-o foo.tab.c], [foo.output foo.tab.c foo.tab.h])
-AT_CHECK_BISON_FLAGS([-y],           [y.output y.tab.c y.tab.h])
-AT_CHECK_BISON_FLAGS([-b bar],       [bar.output bar.tab.c bar.tab.h])
-
-
-
-# AT_CHECK_BISON_PERCENT(GRAMMAR-OPTIONS, EXPECTED-FILES-SORTED)
-# --------------------------------------------------------------
-AT_DEFINE([AT_CHECK_BISON_PERCENT],
-[AT_SETUP([Output files: $1.])
-AT_DATA([foo.y],
-[[$1
-%defines
-%verbose
-%%
-foo: {}
-]])
-rm -rf $2
-AT_CHECK([bison foo.y], 0, ignore, ignore)
-AT_CHECK([ls $2 | sort | tr '\n' ' ' | sed 's/.$//g'], 0, [$2])
-rm -f $2
-AT_CLEANUP
-])
-
-# The sames, but using the % directives.
-AT_CHECK_BISON_PERCENT([],                  [foo.output foo.tab.c foo.tab.h])
-# AT_CHECK_BISON_PERCENT([%output foo.c],     [foo.c foo.h foo.output])
-# AT_CHECK_BISON_PERCENT([%output foo.tab.c], [foo.output foo.tab.c foo.tab.h])
-AT_CHECK_BISON_PERCENT([%yacc],             [y.output y.tab.c y.tab.h])
-# AT_CHECK_BISON_PERCENT([%file_prefix bar],  [bar.output bar.tab.c bar.tab.h])
-
-AT_INCLUDE([calc.at])
-AT_INCLUDE([regression.at])
nostromo: Transferred: stdin 183918, stdout 52102, stderr 0 bytes in 7.3 seconds
nostromo: Bytes per second: stdin 25094.0, stdout 7108.9, stderr 0.0
nostromo: Exit status 0
Index: tests/testsuite.at
===================================================================
RCS file: testsuite.at
diff -N testsuite.at
--- /dev/null   Sat Apr 14 20:46:23 2001
+++ testsuite.at        Thu Oct  4 10:53:14 2001
@@ -0,0 +1,30 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU Bison.
+# Copyright 2000, 2001 Free Software Foundation, Inc.
+
+# This program 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.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# We need a recent Autotest.
+m4_version_prereq([2.52e])
+
+AT_INIT
+
+AT_TESTED([bison])
+
+m4_include([output.at])
+m4_include([calc.at])
+m4_include([regression.at])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]