1 /* $Id: GCIPM.c,v 1.5 1994/06/24 10:16:33 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /*** Generic C Identifier Processing Module ***/
7 /* IMPORT CheckId(char *, int), DoOption(char *), BeginOfProgram(), and
15 extern BeginOfProgram(), EndOfProgram();
17 #define MAX_ID_LEN 256
34 if ((*argv)[0] == '-') {
38 nargv[nargc++] = *argv++;
44 if ((fp = fopen(*nargv, "r")) == NULL) {
45 fprintf(stderr, "%s: cannot read file \"%s\"\n",
66 while ((c = getc(fp)) != EOF) {
71 if (GCcopy) putchar(c);
76 if (GCcopy) putchar(c);
77 if ((c = getc(fp)) == '*') {
78 if (GCcopy) putchar(c);
90 else if (StartNum(c)) {
91 if (GCcopy) putchar(c);
94 else if (GCcopy) putchar(c);
101 SkipString(fp, stopc)
106 while ((c = getc(fp)) != EOF) {
107 if (GCcopy) putchar(c);
114 if (GCcopy) putchar(c);
124 while ((c = getc(fp)) != EOF) {
125 if (GCcopy) putchar(c);
127 if ((c = getc(fp)) == '/') {
128 if (GCcopy) putchar(c);
139 char id_buf[MAX_ID_LEN];
145 while ((c = getc(fp)) != EOF) {
152 CheckId(id_buf, cnt);
162 case 'a': case 'b': case 'c': case 'd': case 'e':
163 case 'f': case 'g': case 'h': case 'i': case 'j':
164 case 'k': case 'l': case 'm': case 'n': case 'o':
165 case 'p': case 'q': case 'r': case 's': case 't':
166 case 'u': case 'v': case 'w': case 'x': case 'y':
168 case 'A': case 'B': case 'C': case 'D': case 'E':
169 case 'F': case 'G': case 'H': case 'I': case 'J':
170 case 'K': case 'L': case 'M': case 'N': case 'O':
171 case 'P': case 'Q': case 'R': case 'S': case 'T':
172 case 'U': case 'V': case 'W': case 'X': case 'Y':
186 case 'a': case 'b': case 'c': case 'd': case 'e':
187 case 'f': case 'g': case 'h': case 'i': case 'j':
188 case 'k': case 'l': case 'm': case 'n': case 'o':
189 case 'p': case 'q': case 'r': case 's': case 't':
190 case 'u': case 'v': case 'w': case 'x': case 'y':
192 case 'A': case 'B': case 'C': case 'D': case 'E':
193 case 'F': case 'G': case 'H': case 'I': case 'J':
194 case 'K': case 'L': case 'M': case 'N': case 'O':
195 case 'P': case 'Q': case 'R': case 'S': case 'T':
196 case 'U': case 'V': case 'W': case 'X': case 'Y':
199 case '0': case '1': case '2': case '3': case '4':
200 case '5': case '6': case '7': case '8': case '9':
211 case '0': case '1': case '2': case '3': case '4':
212 case '5': case '6': case '7': case '8': case '9':
218 #define inrange(c, l, u) ((unsigned)((c) - (l)) <= ((u) - (l)))
219 #define isdec(c) inrange(c, '0', '9')
220 #define isoct(c) inrange(c, '0', '7')
221 #define ishex(c) (isdec(c) || inrange(c, 'a', 'f') || inrange(c, 'A', 'F'))
222 #define getdec(c, fp) do { c = getc((fp)); if (GCcopy) putchar(c);} while (isdec(c))
223 #define getoct(c, fp) do { c = getc((fp)); if (GCcopy) putchar(c);} while (isoct(c))
224 #define gethex(c, fp) do { c = getc((fp)); if (GCcopy) putchar(c);} while (ishex(c))
235 if (c == '+' || c == '-')
243 if (GCcopy) putchar(c);
244 if (c == 'x' || c == 'X')