nestlevel count per file

This commit is contained in:
ceriel 1987-08-10 11:17:20 +00:00
parent b630da3424
commit e5af61151e
4 changed files with 4 additions and 2 deletions

View file

@ -31,7 +31,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 struct idf * PRIVATE struct idf *
GetIdentifier() GetIdentifier()
@ -250,6 +249,7 @@ do_include()
File_Inserted = 1; File_Inserted = 1;
FileName = result; FileName = result;
LineNumber = 0; LineNumber = 0;
nestlevel = -1;
} }
} }
} }

View file

@ -7,10 +7,12 @@
struct file_info { struct file_info {
unsigned int fil_lino; unsigned int fil_lino;
int fil_nestlevel;
char *fil_name; char *fil_name;
char *fil_wdir; char *fil_wdir;
}; };
#define nestlevel finfo.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

View file

@ -53,7 +53,6 @@ AtEoIT()
AtEoIF() AtEoIF()
{ {
#ifndef NOPP #ifndef NOPP
extern int nestlevel;
if (nestlevel != -1) lexwarning("missing #endif"); if (nestlevel != -1) lexwarning("missing #endif");
else else

View file

@ -171,6 +171,7 @@ compile(argc, argv)
File_Inserted = 1; File_Inserted = 1;
init(); init();
LineNumber = 0; LineNumber = 0;
nestlevel = -1;
#ifndef NOPP #ifndef NOPP
WorkingDir = getwdir(source); WorkingDir = getwdir(source);
#endif NOPP #endif NOPP