home *** CD-ROM | disk | FTP | other *** search
- /* Parse command line arguments for bison,
- Copyright (C) 1984, 1986, 1989 Free Software Foundation, Inc.
-
- This file is part of Bison, the GNU Compiler Compiler.
-
- Bison is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- Bison is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Bison; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
- #include <stdio.h>
- #include "system.h"
- #include "files.h"
-
- int verboseflag;
- int definesflag;
- int debugflag;
- int nolinesflag;
- extern int fixed_outfiles; /* JF */
-
- extern char *version_string;
-
- #define OPTIONS "?yvdlto:T:"
-
- #define USAGE \
- "Usage: Bison [options] grammar\n" \
- "\n" \
- "Options:\n" \
- " -d Generate a definitions file H.<file>\n" \
- " -l Do not generate #line directives\n" \
- " -o <file> Generate parser code in <file>\n" \
- " -t Include debugging code in the parser\n" \
- " -T <dir> Put temporary files in <dir>\n" \
- " -v Generate verbose parser report in Out.<file>\n" \
- " -y Use output filenames C.Y_Tab and H.Y_Tab\n"
-
- void getargs(int argc, char *argv[])
- {
- register int c;
-
- extern int optind;
- extern char *optarg;
-
- verboseflag = 0;
- definesflag = 0;
- debugflag = 0;
- fixed_outfiles = 0;
-
- while ((c = getopt (argc, argv, OPTIONS)) != EOF)
- switch (c)
- {
- case 'd':
- definesflag = 1;
- break;
-
- case 'l':
- nolinesflag = 1;
- break;
-
- case 'o':
- spec_outfile = optarg;
-
- case 't':
- debugflag = 1;
- break;
-
- case 'T':
- temp_dir = optarg;
- break;
-
- case 'v':
- verboseflag = 1;
- break;
-
- case 'y':
- fixed_outfiles = 1;
- break;
-
- default:
- fprintf(stderr, "%s\n\n", version_string);
- fprintf(stderr, "%s", USAGE);
- done(c != '?');
- }
-
- if (optind == argc)
- fatal("Grammar file not specified");
- else
- infile = argv[optind];
-
- if (optind < argc - 1)
- fprintf(stderr, "Bison: Warning - extra arguments ignored\n");
- }
-