bison-patches
[Top][All Lists]
Advanced

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

FYI: extension directives (%source_ex..)


From: marc-alexandre autret
Subject: FYI: extension directives (%source_ex..)
Date: Tue, 14 Aug 2001 13:27:20 +0000 (GMT)

Turn on features.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.166
diff -u -r1.166 ChangeLog
--- ChangeLog   2001/08/14 10:38:12     1.166
+++ ChangeLog   2001/08/14 11:21:19
@@ -1,5 +1,15 @@
 2001-08-14  Marc Autret  <address@hidden>
 
+       Turn on %{source,header}_extension features.
+
+       * src/lex.c (percent_table): Un-CPP out header_extension and 
+       source_extension.
+       * src/files.c (compute_exts_from_gf): Compare pointers with NULL.
+       (compute_exts_from_src): Remove conditions. It restores priorities 
+       between options.
+
+2001-08-14  Marc Autret  <address@hidden>
+
        * src/files.c (compute_base_names): Add extensions computing when
        `--file-prefix' used.
        Standardize function calls.
Index: NEWS
===================================================================
RCS file: /cvsroot/bison/bison/NEWS,v
retrieving revision 1.19
diff -u -r1.19 NEWS
--- NEWS        2001/08/10 08:40:02     1.19
+++ NEWS        2001/08/14 11:21:19
@@ -21,8 +21,8 @@
   of the #line lines with path names including backslashes.
 
 * New directives.
-  `%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose' and
-  `%debug'.
+  `%yacc', `%fixed_output_files', `%defines', `%no_parser', `%verbose',
+  `%debug', `%source_extension' and `%header_extension'.
 
 Changes in version 1.28:
 
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.47
diff -u -r1.47 files.c
--- src/files.c 2001/08/14 10:38:12     1.47
+++ src/files.c 2001/08/14 11:21:21
@@ -210,12 +210,16 @@
 static void
 compute_exts_from_gf(const char *ext)
 {
-  if (!src_extension)
+  /* 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');
     }
-  if (!header_extension)
+  /* 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');
@@ -226,13 +230,12 @@
 static void
 compute_exts_from_src(const char *ext)
 {
-  if (!src_extension)
-    src_extension = xstrdup(ext);
-  if (!header_extension)
-    {
-      header_extension = tr(ext, 'c', 'h');
-      header_extension = tr(header_extension, 'C', 'H');
-    }
+  /* We use this function when the user specifies `-o' or `--output',
+     so the extenions must be computed unconditionally from the file name
+     given by this option.  */
+  src_extension = xstrdup(ext);
+  header_extension = tr(ext, 'c', 'h');
+  header_extension = tr(header_extension, 'C', 'H');
 }
 
 /* FIXME: Should use xstrndup. */
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.32
diff -u -r1.32 lex.c
--- src/lex.c   2001/08/06 08:51:41     1.32
+++ src/lex.c   2001/08/14 11:21:21
@@ -551,9 +551,9 @@
   { "output_file",     &spec_outfile,          tok_setopt },   /* -o */
   { "file_prefix",     &spec_file_prefix,      tok_setopt },   /* -b */
   { "name_prefix",     &spec_name_prefix,      tok_setopt },   /* -p */
+#endif
   { "header_extension",        NULL,                   tok_hdrext},
   { "source_extension",        NULL,                   tok_srcext},
-#endif
   { "verbose",         &verbose_flag,          tok_noop },     /* -v */
   { "debug",           &debug_flag,            tok_noop },     /* -t */
   { "semantic_parser", &semantic_parser,       tok_noop },


-- 
Autret Marc (address@hidden)
Eleve Ingenieur en Informatique 



reply via email to

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