[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: [bison-1_29-branch] spec_filenames.patch
From: |
marc-alexandre autret |
Subject: |
FYI: [bison-1_29-branch] spec_filenames.patch |
Date: |
Tue, 18 Sep 2001 01:00:46 +0000 (GMT) |
Better ideas to handles filenames.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/bison/bison/ChangeLog,v
retrieving revision 1.173.2.32
diff -u -r1.173.2.32 ChangeLog
--- ChangeLog 2001/09/17 22:20:07 1.173.2.32
+++ ChangeLog 2001/09/17 22:58:53
@@ -1,4 +1,13 @@
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.
Index: src/files.c
===================================================================
RCS file: /cvsroot/bison/bison/src/files.c,v
retrieving revision 1.51.2.1
diff -u -r1.51.2.1 files.c
--- src/files.c 2001/09/17 22:20:07 1.51.2.1
+++ src/files.c 2001/09/17 22:58:55
@@ -39,6 +39,8 @@
char *spec_outfile = NULL; /* for -o. */
char *spec_file_prefix = NULL; /* for -b. */
char *spec_name_prefix = NULL; /* for -p. */
+char *spec_graph_file = NULL; /* for -g. */
+char *spec_defines_file = NULL; /* for --defines. */
char *infile = NULL;
char *attrsfile = NULL;
@@ -418,14 +420,14 @@
compute_base_names ();
-#if 0
- /* Set default extensions */
- if (!src_extension)
- src_extension = ".c";
- if (!header_extension)
- header_extension = ".h";
-#endif
-
+ /* 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");
+
attrsfile = stringappend (short_base_name, EXT_STYPE_H);
#ifndef MSDOS
stringappend (attrsfile, header_extension);
@@ -439,7 +441,7 @@
/* Output the header file if wanted. */
if (defines_flag)
- defines_obstack_save (stringappend (base_name, header_extension));
+ defines_obstack_save (spec_defines_file);
/* If we output only the table, dump the actions in ACTFILE. */
if (no_parser_flag)
@@ -466,5 +468,5 @@
stringappend (short_base_name, EXT_OUTPUT));
if (graph_flag)
- obstack_save (&graph_obstack, stringappend (short_base_name, ".vcg"));
+ obstack_save (&graph_obstack, spec_graph_file);
}
Index: src/files.h
===================================================================
RCS file: /cvsroot/bison/bison/src/files.h,v
retrieving revision 1.18.2.1
diff -u -r1.18.2.1 files.h
--- src/files.h 2001/09/17 22:20:07 1.18.2.1
+++ src/files.h 2001/09/17 22:58:55
@@ -33,9 +33,15 @@
/* File name pfx specified with -b, or 0 if no -b. */
extern char *spec_file_prefix;
+/* 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;
Index: src/getargs.c
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.c,v
retrieving revision 1.24.2.1
diff -u -r1.24.2.1 getargs.c
--- src/getargs.c 2001/08/16 18:50:04 1.24.2.1
+++ src/getargs.c 2001/09/17 22:58:55
@@ -60,11 +60,11 @@
{"token-table", no_argument, 0, 'k'},
/* Output. */
- {"defines", no_argument, 0, 'd'},
+ {"defines", optional_argument, 0, 'd'},
{"verbose", no_argument, 0, 'v'},
{"file-prefix", required_argument, 0, 'b'},
{"output-file", required_argument, 0, 'o'},
- {"graph", no_argument, 0, 'g'},
+ {"graph", optional_argument, 0, 'g'},
/* Hidden. */
{"statistics", no_argument, &statistics_flag, 1},
@@ -183,7 +183,9 @@
exit (0);
case 'g':
+ /* Here, the -g and --graph=FILE options are differentiated. */
graph_flag = 1;
+ spec_graph_file = optarg;
break;
case 'v':
@@ -195,7 +197,9 @@
break;
case 'd':
+ /* Here, the -d and --defines options are differentiated. */
defines_flag = 1;
+ spec_defines_file = optarg;
break;
case 'l':
--
Autret Marc (address@hidden)
Eleve Ingenieur en Informatique.
- FYI: [bison-1_29-branch] spec_filenames.patch,
marc-alexandre autret <=