version 1.2, 1996/12/11 13:44:56 |
version 1.3, 1997/06/17 20:28:56 |
|
|
extern char *current_token; |
extern char *current_token; |
extern int table_number, current; |
extern int table_number, current; |
char buffer[BUFSIZ]; |
char buffer[BUFSIZ]; |
char *table_name = (char *)NULL; |
char *table_name = NULL; |
FILE *hfile, *cfile; |
FILE *hfile, *cfile; |
|
|
/* C library */ |
/* C library */ |
|
|
strcpy (p, filename); |
strcpy (p, filename); |
filename = p; |
filename = p; |
p = strrchr(filename, '/'); |
p = strrchr(filename, '/'); |
if (p == (char *)NULL) |
if (p == NULL) |
p = filename; |
p = filename; |
else |
else |
p++; |
p++; |
|
|
} |
} |
|
|
hfile = fopen(h_file, "w"); |
hfile = fopen(h_file, "w"); |
if (hfile == (FILE *)NULL) { |
if (hfile == NULL) { |
perror(h_file); |
perror(h_file); |
exit(1); |
exit(1); |
} |
} |
fprintf (hfile, warning, h_file); |
fprintf (hfile, warning, h_file); |
|
|
cfile = fopen(c_file, "w"); |
cfile = fopen(c_file, "w"); |
if (cfile == (FILE *)NULL) { |
if (cfile == NULL) { |
perror(c_file); |
perror(c_file); |
exit(1); |
exit(1); |
} |
} |
|
|
for (cpp = struct_def; *cpp; cpp++) |
for (cpp = struct_def; *cpp; cpp++) |
fputs (*cpp, cfile); |
fputs (*cpp, cfile); |
fprintf(cfile, |
fprintf(cfile, |
"static const struct error_table et = { text, %ldL, %d };\n\n", |
"static const struct error_table et = { text, %dL, %d };\n\n", |
table_number, current); |
table_number, current); |
fputs("static struct et_list link = { 0, 0 };\n\n", |
fputs("static struct et_list link = { 0, 0 };\n\n", |
cfile); |
cfile); |
|
|
|
|
fprintf (hfile, "extern void initialize_%s_error_table ();\n", |
fprintf (hfile, "extern void initialize_%s_error_table ();\n", |
table_name); |
table_name); |
fprintf (hfile, "#define ERROR_TABLE_BASE_%s (%ldL)\n", |
fprintf (hfile, "#define ERROR_TABLE_BASE_%s (%dL)\n", |
table_name, table_number); |
table_name, table_number); |
/* compatibility... */ |
/* compatibility... */ |
fprintf (hfile, "\n/* for compatibility with older versions... */\n"); |
fprintf (hfile, "\n/* for compatibility with older versions... */\n"); |
|
|
fputs(s, stderr); |
fputs(s, stderr); |
fprintf(stderr, "\nLine number %d; last token was '%s'\n", |
fprintf(stderr, "\nLine number %d; last token was '%s'\n", |
lineno, current_token); |
lineno, current_token); |
|
|
|
return 0; |
} |
} |