mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
* Makefile: added all: and default: targets.
* many files: made some functions static; removed "extern int errno;". * frozenmain.c: fixed bugs introduced on 24 June... * flmodule.c: remove 1.5 bw compat hacks, add new functions in 2.2a (and some old functions that were omitted). * timemodule.c: added MSDOS floatsleep version . * pgenmain.c: changed exit() to goaway() and added defn of goaway(). * intrcheck.c: add hack (to UNIX only) so interrupting 3 times will exit from a hanging program. The second interrupt prints a message explaining this to the user.
This commit is contained in:
parent
9e90a672b4
commit
f1dc566328
16 changed files with 140 additions and 165 deletions
|
@ -47,6 +47,13 @@ int main PROTO((int, char **));
|
|||
char *askfile PROTO((void));
|
||||
#endif
|
||||
|
||||
void
|
||||
goaway(sts)
|
||||
int sts;
|
||||
{
|
||||
exit(sts);
|
||||
}
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
|
@ -62,7 +69,7 @@ main(argc, argv)
|
|||
#else
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s grammar\n", argv[0]);
|
||||
exit(2);
|
||||
goaway(2);
|
||||
}
|
||||
filename = argv[1];
|
||||
#endif
|
||||
|
@ -70,7 +77,7 @@ main(argc, argv)
|
|||
fp = fopen("graminit.c", "w");
|
||||
if (fp == NULL) {
|
||||
perror("graminit.c");
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
printf("Writing graminit.c ...\n");
|
||||
printgrammar(g, fp);
|
||||
|
@ -78,12 +85,12 @@ main(argc, argv)
|
|||
fp = fopen("graminit.h", "w");
|
||||
if (fp == NULL) {
|
||||
perror("graminit.h");
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
printf("Writing graminit.h ...\n");
|
||||
printnonterminals(g, fp);
|
||||
fclose(fp);
|
||||
exit(0);
|
||||
goaway(0);
|
||||
}
|
||||
|
||||
grammar *
|
||||
|
@ -97,7 +104,7 @@ getgrammar(filename)
|
|||
fp = fopen(filename, "r");
|
||||
if (fp == NULL) {
|
||||
perror(filename);
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
g0 = meta_grammar();
|
||||
n = NULL;
|
||||
|
@ -105,12 +112,12 @@ getgrammar(filename)
|
|||
fclose(fp);
|
||||
if (n == NULL) {
|
||||
fprintf(stderr, "Parsing error.\n");
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
g = pgen(n);
|
||||
if (g == NULL) {
|
||||
printf("Bad grammar.\n");
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
@ -124,12 +131,12 @@ askfile()
|
|||
printf("Input file name: ");
|
||||
if (fgets(buf, sizeof buf, stdin) == NULL) {
|
||||
printf("EOF\n");
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
/* XXX The (unsigned char *) case is needed by THINK C 3.0 */
|
||||
if (sscanf(/*(unsigned char *)*/buf, " %s ", name) != 1) {
|
||||
printf("No file\n");
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -140,7 +147,7 @@ fatal(msg)
|
|||
char *msg;
|
||||
{
|
||||
fprintf(stderr, "pgen: FATAL ERROR: %s\n", msg);
|
||||
exit(1);
|
||||
goaway(1);
|
||||
}
|
||||
|
||||
#ifdef macintosh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue