nestlevel count per file

This commit is contained in:
ceriel 1987-08-10 10:43:51 +00:00
parent 7d2f8e4d3e
commit b630da3424
4 changed files with 4 additions and 2 deletions

View file

@ -30,7 +30,6 @@ 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. */
int nestlevel = -1; /* initially no nesting level. */
PRIVATE char * PRIVATE char *
GetIdentifier() GetIdentifier()
@ -263,6 +262,7 @@ do_include()
} }
else { else {
WorkingDir = getwdir(result); WorkingDir = getwdir(result);
nestlevel = -1;
FileName = result; FileName = result;
LineNumber = 1; LineNumber = 1;
} }

View file

@ -9,10 +9,12 @@ struct file_info {
unsigned int fil_lino; unsigned int fil_lino;
char *fil_name; char *fil_name;
char *fil_wdir; char *fil_wdir;
int fil_nestlevel;
}; };
#define LineNumber finfo.fil_lino #define LineNumber finfo.fil_lino
#define FileName finfo.fil_name #define FileName finfo.fil_name
#define WorkingDir finfo.fil_wdir #define WorkingDir finfo.fil_wdir
#define nestlevel finfo.fil_nestlevel
extern struct file_info finfo; /* input.c */ extern struct file_info finfo; /* input.c */

View file

@ -47,7 +47,6 @@ AtEoIT()
AtEoIF() AtEoIF()
{ {
extern int nestlevel;
if (nestlevel != -1) warning("missing #endif"); if (nestlevel != -1) warning("missing #endif");
else if (NoUnstack) warning("unexpected EOF"); else if (NoUnstack) warning("unexpected EOF");

View file

@ -77,5 +77,6 @@ compile(argc, argv)
fatal("%s: no source file %s\n", prog_name, fatal("%s: no source file %s\n", prog_name,
source ? source : "stdin"); source ? source : "stdin");
if (source) WorkingDir = getwdir(dummy); if (source) WorkingDir = getwdir(dummy);
nestlevel = -1;
preprocess(source); preprocess(source);
} }