bison-patches
[Top][All Lists]
Advanced

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

Guard macro


From: Hans Aberg
Subject: Guard macro
Date: Wed, 29 Dec 2004 19:15:37 +0100
User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6

The larl1.cc file has:

/* FIXME: This is wrong, we want computed header guards.
   I don't know why the macros are missing now. :( */
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H

For use with Bison 2.0, I have in my skeleton file
m4_define_default([b4_header_guard],
                  [m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
                                [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
...
[#]ifndef b4_header_guard
[#] define b4_header_guard
...
[#]endif /* ndef b4_header_guard */

For some reason, unknown to me, one has to bracket the #.

The reason that the stuff above does not work with Bison 2.0. is that
(relative Bison 1.75), some code was zipped out of prepare() in output.c:
static void
prepare (void)
{
  ...

  /* File names.  */
  MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix :
"yy");
  /* Put this is: */
  MUSCLE_INSERT_STRING ("output_prefix", short_base_name);
  MUSCLE_INSERT_STRING ("output_parser_name", parser_file_name);
  MUSCLE_INSERT_STRING ("output_header_name", spec_defines_file);
  ...
}

In fact, it would be good if a few more macors were created here, so that
one can customize output better.

  Hans Aberg






reply via email to

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