mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 14:53:03 +00:00
* src/lex.c (parse_percent_token): Change type of variable `tx', which
is now an option_table_struct*. (option_strcmp): New function option_strcmp. (parse_percent_token): Call option_strcmp. * src/getargs.c (xalloc.h, options.h): Include it. (getargs): Call create_long_option_table. (getargs): Free longopts at the end of the function. (shortopts): Move in options.c. * src/options.c (create_long_option_table): New function. Convert information from option_table to option structure. * src/reader.c (options.h): Include it. * src/Makefile.am: Adjust. * src/options.c (option_table): Create from longopts and percent_table. * src/getargs.c (longopts): Delete. * src/lex.c (struct percent_table_struct): Delete. (percent_table): Delete. (options.h): Include it. * src/options.c: Create. * src/options.h: Create. Declare enum opt_access_e. Define struct option_table_struct.
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#include "files.h"
|
||||
#include "complain.h"
|
||||
#include "getargs.h"
|
||||
#include "xalloc.h"
|
||||
#include "options.h"
|
||||
|
||||
int debug_flag = 0;
|
||||
int defines_flag = 0;
|
||||
@@ -39,37 +41,6 @@ int graph_flag = 0;
|
||||
const char *skeleton = NULL;
|
||||
|
||||
extern char *program_name;
|
||||
const char *shortopts = "yvgdhrltknVo:b:p:S:";
|
||||
static struct option longopts[] =
|
||||
{
|
||||
/* Operation modes. */
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"yacc", no_argument, 0, 'y'},
|
||||
{"fixed-output-files",no_argument, 0, 'y'},
|
||||
|
||||
/* Parser. */
|
||||
{"skeleton", required_argument, 0, 'S'},
|
||||
{"debug", no_argument, 0, 'd'},
|
||||
{"locations", no_argument, &locations_flag, 1},
|
||||
/* was 'a'; apparently unused -wjh */
|
||||
{"name-prefix", required_argument, 0, 'p'},
|
||||
{"no-lines", no_argument, 0, 'l'},
|
||||
{"no-parser", no_argument, 0, 'n'},
|
||||
{"raw", no_argument, 0, 'r'},
|
||||
{"token-table", no_argument, 0, 'k'},
|
||||
|
||||
/* Output. */
|
||||
{"defines", no_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'},
|
||||
|
||||
/* Hidden. */
|
||||
{"statistics", no_argument, &statistics_flag, 1},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/*---------------------------.
|
||||
| Display the help message. |
|
||||
@@ -161,6 +132,7 @@ getargs (int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
|
||||
create_long_option_table ();
|
||||
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
@@ -234,6 +206,7 @@ getargs (int argc, char *argv[])
|
||||
exit (1);
|
||||
}
|
||||
|
||||
XFREE (longopts);
|
||||
if (optind == argc)
|
||||
{
|
||||
fprintf (stderr, _("%s: no grammar file given\n"), program_name);
|
||||
|
||||
Reference in New Issue
Block a user