]> git.saurik.com Git - bison.git/blob - src/vmsgetargs.c
* src/LR0.c (state_list_t, state_list_append): New.
[bison.git] / src / vmsgetargs.c
1 /* VMS version of getargs; Uses DCL command parsing.
2 Copyright 1989, 1992 Free Software Foundation, Inc.
3
4 This file is part of Bison, the GNU Compiler Compiler.
5
6 Bison is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 Bison is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Bison; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21
22 #include <ctype.h>
23 #include <stdio.h>
24 #include "files.h"
25
26 /*
27 * VMS version of getargs: Uses DCL command parsing
28 * (argc and argv are ignored)
29 */
30 int verbose_flag;
31 int defines_flag;
32 int debug_flag;
33 int no_lines_flag;
34 extern int no_parser_flag;
35 extern int token_table_flag;
36 extern int raw_flag;
37 extern int yacc_flag;
38 extern char * version_string;
39
40 getargs(argc,argv)
41 int argc;
42 char *argv[];
43 {
44 register char *cp;
45 static char Input_File[256];
46 static char output_spec[256], name_prefix_spec[256], file_prefix_spec[256];
47 extern char *infile;
48
49 verbose_flag = 0;
50 defines_flag = 0;
51 debug_flag = 0;
52 yacc_flag = 0;
53 no_lines_flag = 0;
54 no_parser_flag = 0;
55 token_table_flag = 0;
56 raw_flag = 0;
57 /*
58 * Check for /VERBOSE qualifier
59 */
60 if (cli_present("BISON$VERBOSE")) verbose_flag = 1;
61 /*
62 * Check for /DEFINES qualifier
63 */
64 if (cli_present("BISON$DEFINES")) defines_flag = 1;
65 /*
66 * Check for /FIXED_OUTFILES qualifier
67 */
68 if (cli_present("BISON$FIXED_OUTFILES")) yacc_flag = 1;
69 if (cli_present("BISON$YACC")) yacc_flag = 1;
70 /*
71 * Check for /VERSION qualifier
72 */
73 if (cli_present("BISON$VERSION")) printf("%s",version_string);
74 /*
75 * Check for /NOLINES qualifier
76 */
77 if (cli_present("BISON$NOLINES")) no_lines_flag = 1;
78 /*
79 * Check for /NOPARSER qualifier
80 */
81 if (cli_present("BISON$NOPARSER")) no_parser_flag = 1;
82 /*
83 * Check for /RAW qualifier
84 */
85 if (cli_present("BISON$RAW")) raw_flag = 1;
86 /*
87 * Check for /TOKEN_TABLE qualifier
88 */
89 if (cli_present("BISON$TOKEN_TABLE")) token_table_flag = 1;
90 /*
91 * Check for /DEBUG qualifier
92 */
93 if (cli_present("BISON$DEBUG")) debug_flag = 1;
94 /*
95 * Get the filename
96 */
97 cli_get_value("BISON$INFILE", Input_File, sizeof(Input_File));
98 /*
99 * Lowercaseify the input filename
100 */
101 cp = Input_File;
102 while(*cp)
103 {
104 if (isupper(*cp)) *cp = tolower(*cp);
105 cp++;
106 }
107 infile = Input_File;
108 /*
109 * Get the output file
110 */
111 if (cli_present("BISON$OUTPUT"))
112 {
113 cli_get_value("BISON$OUTPUT", output_spec, sizeof(output_spec));
114 for (cp = spec_outfile = output_spec; *cp; cp++)
115 if (isupper(*cp))
116 *cp = tolower(*cp);
117 }
118 /*
119 * Get the output file
120 */
121 if (cli_present("BISON$FILE_PREFIX"))
122 {
123 cli_get_value("BISON$FILE_PREFIX", file_prefix_spec,
124 sizeof(file_prefix_spec));
125 for (cp = spec_file_prefix = file_prefix_spec; *cp; cp++)
126 if (isupper(*cp))
127 *cp = tolower(*cp);
128 }
129 /*
130 * Get the output file
131 */
132 if (cli_present("BISON$NAME_PREFIX"))
133 {
134 cli_get_value("BISON$NAME_PREFIX", name_prefix_spec,
135 sizeof(name_prefix_spec));
136 for (cp = spec_name_prefix = name_prefix_spec; *cp; cp++)
137 if (isupper(*cp))
138 *cp = tolower(*cp);
139 }
140 }
141
142 /************ DCL PARSING ROUTINES **********/
143
144 /*
145 * See if "NAME" is present
146 */
147 int
148 cli_present(Name)
149 char *Name;
150 {
151 struct {int Size; char *Ptr;} Descr;
152
153 Descr.Ptr = Name;
154 Descr.Size = strlen(Name);
155 return (cli$present(&Descr) & 1) ? 1 : 0;
156 }
157
158 /*
159 * Get value of "NAME"
160 */
161 int
162 cli_get_value(Name,Buffer,Size)
163 char *Name;
164 char *Buffer;
165 {
166 struct {int Size; char *Ptr;} Descr1,Descr2;
167
168 Descr1.Ptr = Name;
169 Descr1.Size = strlen(Name);
170 Descr2.Ptr = Buffer;
171 Descr2.Size = Size-1;
172 if (cli$get_value(&Descr1,&Descr2,&Descr2.Size) & 1) {
173 Buffer[Descr2.Size] = 0;
174 return 1;
175 }
176 return 0;
177 }