bison-patches
[Top][All Lists]
Advanced

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

more filename -> file_name gotchas


From: Paul Eggert
Subject: more filename -> file_name gotchas
Date: Fri, 09 Sep 2005 15:43:45 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

My previous patch was incomplete, which caused "make check" to fail.
That's what I get for trying to switch terminology!  Anyway, I
installed this to fix things up:

2005-09-09  Paul Eggert  <address@hidden>

        * doc/bison.texinfo: Fix typos in previous change.
        * data/glr.c: b4_filename -> b4_file_name.
        * data/lalr1.cc: Likewise.  Also, b4_filename_type -> b4_file_name_type.
        All uses changed.
        (class position): filename -> file_name.  All uses changed.
        * data/yacc.c: b4_filename -> b4_file_name.
        * lib/bitset.h: filename -> file_name in local vars.
        * lib/bitset_stats.c: Likewise.
        * src/files.c: Likewise.
        * src/scan-skel.l ("@output ".*\n): Likewise.
        * src/files.c (file_name_split): Renamed from filename_split.
        * src/muscle_tab.c (muscle_init): Output b4_file_name, not b4_filename.

Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.117
diff -p -u -r1.117 glr.c
--- data/glr.c  26 Aug 2005 20:16:16 -0000      1.117
+++ data/glr.c  9 Sep 2005 22:41:27 -0000
@@ -179,7 +179,7 @@ b4_pre_prologue[
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_filename])
+[b4_syncline([b4_stype_line], [b4_file_name])
 typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
 /* Line __line__ of glr.c.  */
 b4_syncline(address@hidden@], address@hidden@])],
@@ -2306,7 +2306,7 @@ b4_token_defines(b4_tokens)
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_filename])
+[b4_syncline([b4_stype_line], [b4_file_name])
 typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
 /* Line __line__ of glr.c.  */
 b4_syncline(address@hidden@], address@hidden@])],
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.93
diff -p -u -r1.93 lalr1.cc
--- data/lalr1.cc       22 Aug 2005 02:31:10 -0000      1.93
+++ data/lalr1.cc       9 Sep 2005 22:41:27 -0000
@@ -48,7 +48,7 @@ m4_define([b4_rhs_value],
 [(address@hidden([$1 - $2])@}m4_ifval([$3], [.$3]))])
 
 m4_define_default([b4_location_type], [location])
-m4_define_default([b4_filename_type], [std::string])
+m4_define_default([b4_file_name_type], [std::string])
 
 # b4_lhs_location()
 # -----------------
@@ -164,7 +164,7 @@ b4_syncline(address@hidden@], address@hidden@])[
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_filename])
+[b4_syncline([b4_stype_line], [b4_file_name])
 union YYSTYPE b4_stype;
 /* Line __line__ of lalr1.cc.  */
 b4_syncline(address@hidden@], address@hidden@])],
@@ -1256,7 +1256,7 @@ namespace yy
   public:
     /// Construct a position.
     position () :
-      filename (0),
+      file_name (0),
       line (initial_line),
       column (initial_column)
     {
@@ -1288,7 +1288,7 @@ namespace yy
 
   public:
     /// File name to which this position refers.
-    ]b4_filename_type[* filename;
+    ]b4_file_name_type[* file_name;
     /// Current line number.
     unsigned int line;
     /// Current column number.
@@ -1332,8 +1332,8 @@ namespace yy
   inline std::ostream&
   operator<< (std::ostream& ostr, const position& pos)
   {
-    if (pos.filename)
-      ostr << *pos.filename << ':';
+    if (pos.file_name)
+      ostr << *pos.file_name << ':';
     return ostr << pos.line << '.' << pos.column;
   }
 
@@ -1435,9 +1435,9 @@ namespace yy
   {
     position last = loc.end - 1;
     ostr << loc.begin;
-    if (last.filename
-       && (!loc.begin.filename
-           || *loc.begin.filename != *last.filename))
+    if (last.file_name
+       && (!loc.begin.file_name
+           || *loc.begin.file_name != *last.file_name))
       ostr << '-' << last;
     else if (loc.begin.line != last.line)
       ostr << '-' << last.line  << '.' << last.column;
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.102
diff -p -u -r1.102 yacc.c
--- data/yacc.c 22 Aug 2005 02:31:10 -0000      1.102
+++ data/yacc.c 9 Sep 2005 22:41:27 -0000
@@ -189,7 +189,7 @@ b4_location_if([#define yylloc b4_prefix
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 ]m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_filename])
+[b4_syncline([b4_stype_line], [b4_file_name])
 typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
 /* Line __line__ of yacc.c.  */
 b4_syncline(address@hidden@], address@hidden@])],
@@ -1414,7 +1414,7 @@ b4_token_defines(b4_tokens)
 
 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 m4_ifdef([b4_stype],
-[b4_syncline([b4_stype_line], [b4_filename])
+[b4_syncline([b4_stype_line], [b4_file_name])
 typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
 /* Line __line__ of yacc.c.  */
 b4_syncline(address@hidden@], address@hidden@])],
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.156
diff -p -u -r1.156 bison.texinfo
--- doc/bison.texinfo   9 Sep 2005 22:14:28 -0000       1.156
+++ doc/bison.texinfo   9 Sep 2005 22:41:28 -0000
@@ -3779,10 +3779,11 @@ Declare that the @var{code} must be invo
 For instance, if your locations use a file name, you may use
 
 @example
-%parse-param @{ const char *file @};
+%parse-param @{ char const *file_name @};
 %initial-action
 @{
-  @@$.begin.file = @@$.end.file = file;
+  @@$.begin.file_name = @@$.end.file_name = file_name;
+  @@$.begin.file_name = @@$.end.file_name = file_name;
 @};
 @end example
 
@@ -6950,7 +6951,7 @@ Symbols}.
 @c - %locations
 @c - class Position
 @c - class Location
address@hidden - %define "file_type" "const symbol::Symbol"
address@hidden - %define "file_name_type" "const symbol::Symbol"
 
 When the directive @code{%locations} is used, the C++ parser supports
 location tracking, see @ref{Locations, , Locations Overview}.  Two
@@ -6962,7 +6963,7 @@ and a @code{location}, a range composed 
 The name of the file.  It will always be handled as a pointer, the
 parser will never duplicate nor deallocate it.  As an experimental
 feature you may change it to @address@hidden using @samp{%define
-"file_type" "@var{type}"}.
+"file_name_type" "@var{type}"}.
 @end deftypemethod
 
 @deftypemethod {position} {unsigned int} line
@@ -7322,7 +7323,7 @@ automatically propagated.
 %initial-action
 @{
   // Initialize the initial location.
-  @@$.begin.file = @@$.end.file = &driver.file;
+  @@$.begin.file_name = @@$.end.file_name = &driver.file;
 @};
 @end example
 
Index: lib/bitset.h
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset.h,v
retrieving revision 1.18
diff -p -u -r1.18 bitset.h
--- lib/bitset.h        24 Jul 2005 07:24:22 -0000      1.18
+++ lib/bitset.h        9 Sep 2005 22:41:28 -0000
@@ -371,10 +371,10 @@ extern void bitset_stats_enable (void);
 extern void bitset_stats_disable (void);
 
 /* Read bitset stats file of accummulated stats.  */
-void bitset_stats_read (const char *filename);
+void bitset_stats_read (const char *file_name);
 
 /* Write bitset stats file of accummulated stats.  */
-void bitset_stats_write (const char *filename);
+void bitset_stats_write (const char *file_name);
 
 /* Dump bitset stats.  */
 extern void bitset_stats_dump (FILE *);
Index: lib/bitset_stats.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset_stats.c,v
retrieving revision 1.16
diff -p -u -r1.16 bitset_stats.c
--- lib/bitset_stats.c  24 Jul 2005 07:24:22 -0000      1.16
+++ lib/bitset_stats.c  9 Sep 2005 22:41:28 -0000
@@ -241,17 +241,17 @@ bitset_stats_disable (void)
 
 /* Read bitset statistics file.  */
 void
-bitset_stats_read (const char *filename)
+bitset_stats_read (const char *file_name)
 {
   FILE *file;
 
   if (!bitset_stats_info)
     return;
 
-  if (!filename)
-    filename = BITSET_STATS_FILE;
+  if (!file_name)
+    file_name = BITSET_STATS_FILE;
 
-  file = fopen (filename, "r");
+  file = fopen (file_name, "r");
   if (file)
     {
       if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
@@ -271,17 +271,17 @@ bitset_stats_read (const char *filename)
 
 /* Write bitset statistics file.  */
 void
-bitset_stats_write (const char *filename)
+bitset_stats_write (const char *file_name)
 {
   FILE *file;
 
   if (!bitset_stats_info)
     return;
 
-  if (!filename)
-    filename = BITSET_STATS_FILE;
+  if (!file_name)
+    file_name = BITSET_STATS_FILE;
 
-  file = fopen (filename, "w");
+  file = fopen (file_name, "w");
   if (file)
     {
       if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data),
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.91
diff -p -u -r1.91 files.c
--- src/files.c 22 Aug 2005 01:28:07 -0000      1.91
+++ src/files.c 9 Sep 2005 22:41:28 -0000
@@ -165,8 +165,8 @@ compute_exts_from_src (const char *ext)
 }
 
 
-/* Decompose FILENAME in four parts: *BASE, *TAB, and *EXT, the fourth
-   part, (the directory) is ranging from FILENAME to the char before
+/* Decompose FILE_NAME in four parts: *BASE, *TAB, and *EXT, the fourth
+   part, (the directory) is ranging from FILE_NAME to the char before
    *BASE, so we don't need an additional parameter.
 
    *EXT points to the last period in the basename, or NULL if none.
@@ -175,7 +175,7 @@ compute_exts_from_src (const char *ext)
    `.tab' or `_tab' if present right before *EXT, or is NULL. *TAB
    cannot be equal to *BASE.
 
-   None are allocated, they are simply pointers to parts of FILENAME.
+   None are allocated, they are simply pointers to parts of FILE_NAME.
    Examples:
 
    '/tmp/foo.tab.c' -> *BASE = 'foo.tab.c', *TAB = '.tab.c', *EXT =
@@ -194,10 +194,10 @@ compute_exts_from_src (const char *ext)
    'foo' -> *BASE = 'foo', *TAB = NULL, *EXT = NULL.  */
 
 static void
-filename_split (const char *filename,
-               const char **base, const char **tab, const char **ext)
+file_name_split (const char *file_name,
+                const char **base, const char **tab, const char **ext)
 {
-  *base = base_name (filename);
+  *base = base_name (file_name);
 
   /* Look for the extension, i.e., look for the last dot. */
   *ext = strrchr (*base, '.');
@@ -232,7 +232,7 @@ compute_base_names (void)
      files, remove the ".c" or ".tab.c" suffix.  */
   if (spec_outfile)
     {
-      filename_split (spec_outfile, &base, &tab, &ext);
+      file_name_split (spec_outfile, &base, &tab, &ext);
 
       /* The full base name goes up the EXT, excluding it. */
       full_base_name =
@@ -270,7 +270,7 @@ compute_base_names (void)
        {
          /* Otherwise, the short base name is computed from the input
             grammar: `foo/bar.yy' => `bar'.  */
-         filename_split (grammar_file, &base, &tab, &ext);
+         file_name_split (grammar_file, &base, &tab, &ext);
          short_base_name =
            xstrndup (base,
                      (strlen (base) - (ext ? strlen (ext) : 0)));
@@ -281,7 +281,7 @@ compute_base_names (void)
       stpcpy (stpcpy (full_base_name, short_base_name), TAB_EXT);
 
       /* Compute the extensions from the grammar file name.  */
-      filename_split (grammar_file, &base, &tab, &ext);
+      file_name_split (grammar_file, &base, &tab, &ext);
       if (ext && !yacc_flag)
        compute_exts_from_gf (ext);
     }
Index: src/muscle_tab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/muscle_tab.c,v
retrieving revision 1.36
diff -p -u -r1.36 muscle_tab.c
--- src/muscle_tab.c    24 Jul 2005 07:24:22 -0000      1.36
+++ src/muscle_tab.c    9 Sep 2005 22:41:28 -0000
@@ -74,7 +74,7 @@ muscle_init (void)
 
   /* Version and input file.  */
   MUSCLE_INSERT_STRING ("version", VERSION);
-  MUSCLE_INSERT_C_STRING ("filename", grammar_file);
+  MUSCLE_INSERT_C_STRING ("file_name", grammar_file);
 }
 
 
Index: src/scan-skel.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-skel.l,v
retrieving revision 1.32
diff -p -u -r1.32 scan-skel.l
--- src/scan-skel.l     24 Jul 2005 07:24:22 -0000      1.32
+++ src/scan-skel.l     9 Sep 2005 22:41:28 -0000
@@ -45,15 +45,15 @@
 %}
 
 "@output ".*\n {
-  char const *filename = yytext + sizeof "@output " - 1;
+  char const *file_name = yytext + sizeof "@output " - 1;
   yytext[yyleng - 1] = '\0';
 
-  if (*filename == '@')
+  if (*file_name == '@')
     {
-      if (strcmp (filename, "@output_header_name@") == 0)
-       filename = spec_defines_file;
-      else if (strcmp (filename, "@output_parser_name@") == 0)
-       filename = parser_file_name;
+      if (strcmp (file_name, "@output_header_name@") == 0)
+       file_name = spec_defines_file;
+      else if (strcmp (file_name, "@output_parser_name@") == 0)
+       file_name = parser_file_name;
       else
        fatal ("invalid token in skeleton: %s", yytext);
     }
@@ -63,7 +63,7 @@
       free (outname);
       xfclose (yyout);
     }
-  outname = xstrdup (filename);
+  outname = xstrdup (file_name);
   yyout = xfopen (outname, "w");
   lineno = 1;
 }




reply via email to

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