some fixes

This commit is contained in:
ceriel 1987-08-07 19:54:45 +00:00
parent 4623ed60b0
commit 16082b9056
4 changed files with 15 additions and 7 deletions

View file

@ -30,7 +30,7 @@ IMPORT char *getwdir();
PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */ PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
/* 1 if a corresponding ELSE has been */ /* 1 if a corresponding ELSE has been */
/* encountered. */ /* encountered. */
PRIVATE int nestlevel = -1; /* initially no nesting level. */ int nestlevel = -1; /* initially no nesting level. */
PRIVATE char * PRIVATE char *
GetIdentifier() GetIdentifier()

View file

@ -36,7 +36,7 @@ error(fmt, args)
warning(fmt, args) warning(fmt, args)
char *fmt; char *fmt;
{ {
err_hdr("warning "); err_hdr("(warning) ");
doprnt(ERROUT, fmt, &args); doprnt(ERROUT, fmt, &args);
fprint(ERROUT, "\n"); fprint(ERROUT, "\n");
} }
@ -46,7 +46,7 @@ crash(fmt, args)
char *fmt; char *fmt;
int args; int args;
{ {
err_hdr("crash "); err_hdr("CRASH\007 ");
doprnt(ERROUT, fmt, &args); doprnt(ERROUT, fmt, &args);
fprint(ERROUT, "\n"); fprint(ERROUT, "\n");
sys_stop(S_ABORT); sys_stop(S_ABORT);
@ -57,7 +57,7 @@ fatal(fmt, args)
char *fmt; char *fmt;
int args; int args;
{ {
err_hdr("fatal "); err_hdr("fatal error -- ");
doprnt(ERROUT, fmt, &args); doprnt(ERROUT, fmt, &args);
fprint(ERROUT, "\n"); fprint(ERROUT, "\n");
sys_stop(S_EXIT); sys_stop(S_EXIT);

View file

@ -40,13 +40,16 @@ int Unstacked;
AtEoIT() AtEoIT()
{ {
if (NoUnstack) error("unexpected EOF"); if (NoUnstack) warning("unexpected EOF");
DoUnstack(); DoUnstack();
return 0; return 0;
} }
AtEoIF() AtEoIF()
{ {
if (NoUnstack) error("unexpected EOF"); extern int nestlevel;
if (nestlevel != -1) warning("missing #endif");
else if (NoUnstack) warning("unexpected EOF");
return 0; return 0;
} }

View file

@ -64,10 +64,11 @@ getactuals(idef)
*/ */
warning("argument mismatch, %s", idef->id_text); warning("argument mismatch, %s", idef->id_text);
while (++nr_of_params < acnt) { while (nr_of_params < acnt) {
/* too few paraeters: remaining actuals are "" /* too few paraeters: remaining actuals are ""
*/ */
actparams[nr_of_params] = ""; actparams[nr_of_params] = "";
nr_of_params++;
} }
} }
@ -110,16 +111,19 @@ copyact(ch1, ch2, level)
switch(ch) { switch(ch) {
#ifdef __MATCHING_PAR__
case ')': case ')':
case '}': case '}':
case ']': case ']':
error("unbalanced parenthesis"); error("unbalanced parenthesis");
break; break;
#endif __MATCHING_PAR__
case '(': case '(':
copyact('(', ')', level+1); copyact('(', ')', level+1);
break; break;
#ifdef __MATCHING_PAR__
case '{': case '{':
/* example: /* example:
#define declare(v, t) t v #define declare(v, t) t v
@ -131,6 +135,7 @@ copyact(ch1, ch2, level)
case '[': case '[':
copyact('[', ']', level+1); copyact('[', ']', level+1);
break; break;
#endif __MATCHING_PAR__
case '\n': case '\n':
LoadChar(ch); LoadChar(ch);