Lines 90-100
void free(), exit(), perror();
Link Here
|
90 |
|
90 |
|
91 |
#ifdef USE_READLINE |
91 |
#ifdef USE_READLINE |
92 |
# include <readline/readline.h> |
92 |
# include <readline/readline.h> |
|
|
93 |
# include <readline/history.h> |
93 |
/* prototypes for functions related to readline() */ |
94 |
/* prototypes for functions related to readline() */ |
94 |
char * mygetline(); |
95 |
char * mygetline(); |
95 |
char ** attempt_completion(char *, int, int); |
96 |
char ** attempt_completion(char *, int, int); |
96 |
char * keyword_completion(char *, int); |
97 |
char * keyword_completion(char *, int); |
97 |
char * command_completion(const char *, int); |
98 |
char * command_completion(const char *, int); |
|
|
99 |
int dotmpfile_from_string(char *s); |
98 |
#endif |
100 |
#endif |
99 |
|
101 |
|
100 |
/* maximum # of chars from progname to display in prompt */ |
102 |
/* maximum # of chars from progname to display in prompt */ |
Lines 245-251
struct
Link Here
|
245 |
/* for unsupported combinations of types. */ |
247 |
/* for unsupported combinations of types. */ |
246 |
void mbcheck() |
248 |
void mbcheck() |
247 |
{ |
249 |
{ |
248 |
register int i, j, restrict; |
250 |
register int i, j, cd_restrict; |
249 |
char *t1, *t2; |
251 |
char *t1, *t2; |
250 |
|
252 |
|
251 |
/* Loop through the types */ |
253 |
/* Loop through the types */ |
Lines 262-287
void mbcheck()
Link Here
|
262 |
if (!(modbits & crosstypes[j].bit)) |
264 |
if (!(modbits & crosstypes[j].bit)) |
263 |
continue; |
265 |
continue; |
264 |
/* check the type of restriction */ |
266 |
/* check the type of restriction */ |
265 |
restrict = crosscheck[i][j]; |
267 |
cd_restrict = crosscheck[i][j]; |
266 |
if (restrict == ALWAYS) |
268 |
if (cd_restrict == ALWAYS) |
267 |
continue; |
269 |
continue; |
268 |
t1 = crosstypes[i].name; |
270 |
t1 = crosstypes[i].name; |
269 |
t2 = crosstypes[j].name; |
271 |
t2 = crosstypes[j].name; |
270 |
if (restrict == NEVER) |
272 |
if (cd_restrict == NEVER) |
271 |
{ |
273 |
{ |
272 |
notsupported("", t1, t2); |
274 |
notsupported("", t1, t2); |
273 |
} |
275 |
} |
274 |
else if (restrict == RITCHIE) |
276 |
else if (cd_restrict == RITCHIE) |
275 |
{ |
277 |
{ |
276 |
if (RitchieFlag) |
278 |
if (RitchieFlag) |
277 |
notsupported(" (Ritchie Compiler)", t1, t2); |
279 |
notsupported(" (Ritchie Compiler)", t1, t2); |
278 |
} |
280 |
} |
279 |
else if (restrict == PREANSI) |
281 |
else if (cd_restrict == PREANSI) |
280 |
{ |
282 |
{ |
281 |
if (PreANSIFlag || RitchieFlag) |
283 |
if (PreANSIFlag || RitchieFlag) |
282 |
notsupported(" (Pre-ANSI Compiler)", t1, t2); |
284 |
notsupported(" (Pre-ANSI Compiler)", t1, t2); |
283 |
} |
285 |
} |
284 |
else if (restrict == ANSI) |
286 |
else if (cd_restrict == ANSI) |
285 |
{ |
287 |
{ |
286 |
if (!RitchieFlag && !PreANSIFlag) |
288 |
if (!RitchieFlag && !PreANSIFlag) |
287 |
notsupported(" (ANSI Compiler)", t1, t2); |
289 |
notsupported(" (ANSI Compiler)", t1, t2); |
Lines 290-296
void mbcheck()
Link Here
|
290 |
{ |
292 |
{ |
291 |
(void) fprintf (stderr, |
293 |
(void) fprintf (stderr, |
292 |
"%s: Internal error in crosscheck[%d,%d]=%d!\n", |
294 |
"%s: Internal error in crosscheck[%d,%d]=%d!\n", |
293 |
progname, i, j, restrict); |
295 |
progname, i, j, cd_restrict); |
294 |
exit(1); /* NOTREACHED */ |
296 |
exit(1); /* NOTREACHED */ |
295 |
} |
297 |
} |
296 |
} |
298 |
} |
Lines 418-424
char * command_completion(const char *te
Link Here
|
418 |
len = strlen(text); |
420 |
len = strlen(text); |
419 |
} |
421 |
} |
420 |
|
422 |
|
421 |
while (command = commands[index]) { |
423 |
while ((command = commands[index])) { |
422 |
index++; |
424 |
index++; |
423 |
if (!strncmp(command, text, len)) return strdup(command); |
425 |
if (!strncmp(command, text, len)) return strdup(command); |
424 |
} |
426 |
} |
Lines 439-445
char * keyword_completion(char *text, in
Link Here
|
439 |
} |
441 |
} |
440 |
|
442 |
|
441 |
if (set) { |
443 |
if (set) { |
442 |
while (option = options[index]) { |
444 |
while ((option = options[index])) { |
443 |
index++; |
445 |
index++; |
444 |
if (!strncmp(option, text, len)) return strdup(option); |
446 |
if (!strncmp(option, text, len)) return strdup(option); |
445 |
} |
447 |
} |
Lines 459-465
char * keyword_completion(char *text, in
Link Here
|
459 |
return strdup("into"); |
461 |
return strdup("into"); |
460 |
else |
462 |
else |
461 |
return strdup("int"); |
463 |
return strdup("int"); |
462 |
} else while (keyword = keywords[index]) { |
464 |
} else while ((keyword = keywords[index])) { |
463 |
index++; |
465 |
index++; |
464 |
if (!strncmp(keyword, text, len)) return strdup(keyword); |
466 |
if (!strncmp(keyword, text, len)) return strdup(keyword); |
465 |
} |
467 |
} |
Lines 1103-1109
char *name, *storage, *left, *right, *ty
Link Here
|
1103 |
void dodexplain(storage, constvol, type, decl) |
1105 |
void dodexplain(storage, constvol, type, decl) |
1104 |
char *storage, *constvol, *type, *decl; |
1106 |
char *storage, *constvol, *type, *decl; |
1105 |
{ |
1107 |
{ |
1106 |
if (type && (strcmp(type, "void") == 0)) |
1108 |
if (type && (strcmp(type, "void") == 0)) { |
1107 |
if (prev == 'n') |
1109 |
if (prev == 'n') |
1108 |
unsupp("Variable of type void", |
1110 |
unsupp("Variable of type void", |
1109 |
"variable of type pointer to void"); |
1111 |
"variable of type pointer to void"); |
Lines 1113-1118
char *storage, *constvol, *type, *decl;
Link Here
|
1113 |
else if (prev == 'r') |
1115 |
else if (prev == 'r') |
1114 |
unsupp("reference to type void", |
1116 |
unsupp("reference to type void", |
1115 |
"pointer to void"); |
1117 |
"pointer to void"); |
|
|
1118 |
} |
1116 |
|
1119 |
|
1117 |
if (*storage == 'r') |
1120 |
if (*storage == 'r') |
1118 |
switch (prev) |
1121 |
switch (prev) |
Lines 1135-1147
char *storage, *constvol, *type, *decl;
Link Here
|
1135 |
void docexplain(constvol, type, cast, name) |
1138 |
void docexplain(constvol, type, cast, name) |
1136 |
char *constvol, *type, *cast, *name; |
1139 |
char *constvol, *type, *cast, *name; |
1137 |
{ |
1140 |
{ |
1138 |
if (strcmp(type, "void") == 0) |
1141 |
if (strcmp(type, "void") == 0) { |
1139 |
if (prev == 'a') |
1142 |
if (prev == 'a') |
1140 |
unsupp("array of type void", |
1143 |
unsupp("array of type void", |
1141 |
"array of type pointer to void"); |
1144 |
"array of type pointer to void"); |
1142 |
else if (prev == 'r') |
1145 |
else if (prev == 'r') |
1143 |
unsupp("reference to type void", |
1146 |
unsupp("reference to type void", |
1144 |
"pointer to void"); |
1147 |
"pointer to void"); |
|
|
1148 |
} |
1145 |
(void) printf("cast %s into %s", name, cast); |
1149 |
(void) printf("cast %s into %s", name, cast); |
1146 |
if (strlen(constvol) > 0) |
1150 |
if (strlen(constvol) > 0) |
1147 |
(void) printf("%s ", constvol); |
1151 |
(void) printf("%s ", constvol); |