]> git.saurik.com Git - bison.git/commitdiff
Turn on %{source,header}_extension features.
authorMarc Autret <autret_m@epita.fr>
Tue, 14 Aug 2001 11:28:48 +0000 (11:28 +0000)
committerMarc Autret <autret_m@epita.fr>
Tue, 14 Aug 2001 11:28:48 +0000 (11:28 +0000)
* 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.

ChangeLog
NEWS
src/files.c
src/lex.c

index ef2baf2d9378c3a9ea95ad3db230ffb4d415743b..4f039d229139137d7922459735c4d7732be7ec31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-08-14  Marc Autret  <autret_m@epita.fr>
+
+       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  <autret_m@epita.fr>
 
        * src/files.c (compute_base_names): Add extensions computing when
diff --git a/NEWS b/NEWS
index 27c16351e1917a0cf7075073fc1458b3cb99d6c8..e53400b2b6da92aad0f010bedb1762a4434d0fbf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,8 +21,8 @@ Changes in version 1.28c:
   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'.
 \f
 Changes in version 1.28:
 
index cf1cdca644910b4f5b45ba75595a06aec8e87b62..402025bfe0c00bddf7b3e962aa5992bfd3aa0744 100644 (file)
@@ -210,12 +210,16 @@ get_extension_index(const char *filename)
 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 @@ compute_exts_from_gf(const char *ext)
 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 05599980f3a56f17f861ba461cd73aed04962afb..4bd0a6f26344d4fbc883b38f6c5543166255b27a 100644 (file)
--- a/src/lex.c
+++ b/src/lex.c
@@ -551,9 +551,9 @@ struct percent_table_struct percent_table[] =
   { "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 },