version 1.37, 2000/03/26 16:21:32 |
version 1.38, 2000/04/17 23:45:24 |
|
|
#include "buf.h" |
#include "buf.h" |
#include "pathnames.h" |
#include "pathnames.h" |
|
|
|
#ifdef CLEANUP |
|
static Lst fileNames; /* file names to free at end */ |
|
#endif |
|
|
/* |
/* |
* These values are returned by ParseEOF to tell Parse_File whether to |
* These values are returned by ParseEOF to tell Parse_File whether to |
* CONTINUE parsing, i.e. it had only reached the end of an include file, |
* CONTINUE parsing, i.e. it had only reached the end of an include file, |
|
|
* place. Naturally enough, we start reading at line number 0. |
* place. Naturally enough, we start reading at line number 0. |
*/ |
*/ |
fname = fullname; |
fname = fullname; |
|
#ifdef CLEANUP |
|
Lst_AtEnd(fileNames, fname); |
|
#endif |
lineno = 0; |
lineno = 0; |
|
|
curFILE = fopen (fullname, "r"); |
curFILE = fopen (fullname, "r"); |
|
|
curPTR = (PTR *) emalloc (sizeof (PTR)); |
curPTR = (PTR *) emalloc (sizeof (PTR)); |
curPTR->str = curPTR->ptr = str; |
curPTR->str = curPTR->ptr = str; |
lineno = newlineno; |
lineno = newlineno; |
fname = estrdup(fname); |
|
} |
} |
|
|
|
|
|
|
* place. Naturally enough, we start reading at line number 0. |
* place. Naturally enough, we start reading at line number 0. |
*/ |
*/ |
fname = fullname; |
fname = fullname; |
|
#ifdef CLEANUP |
|
lst_AtEnd(fileNames, fname); |
|
#endif |
lineno = 0; |
lineno = 0; |
|
|
curFILE = fopen (fullname, "r"); |
curFILE = fopen (fullname, "r"); |
|
|
|
|
if ((ifile = (IFile *)Lst_DeQueue(includes)) == NULL) |
if ((ifile = (IFile *)Lst_DeQueue(includes)) == NULL) |
return DONE; |
return DONE; |
free ((Address) fname); |
|
fname = ifile->fname; |
fname = ifile->fname; |
lineno = ifile->lineno; |
lineno = ifile->lineno; |
if (opened && curFILE) |
if (opened && curFILE) |
|
|
*line; /* the line we're working on */ |
*line; /* the line we're working on */ |
|
|
inLine = FALSE; |
inLine = FALSE; |
fname = name; |
fname = estrdup(name); |
|
#ifdef CLEANUP |
|
Lst_AtEnd(fileNames, fname); |
|
#endif |
curFILE = stream; |
curFILE = stream; |
lineno = 0; |
lineno = 0; |
fatals = 0; |
fatals = 0; |
|
|
includes = Lst_Init(); |
includes = Lst_Init(); |
#ifdef CLEANUP |
#ifdef CLEANUP |
targCmds = Lst_Init(); |
targCmds = Lst_Init(); |
|
fileNames = Lst_Init(); |
#endif |
#endif |
} |
} |
|
|
|
|
{ |
{ |
#ifdef CLEANUP |
#ifdef CLEANUP |
Lst_Destroy(targCmds, (void (*) __P((ClientData))) free); |
Lst_Destroy(targCmds, (void (*) __P((ClientData))) free); |
|
Lst_Destroy(fileNames, (void (*) __P((ClientData))) free); |
if (targets) |
if (targets) |
Lst_Destroy(targets, NOFREE); |
Lst_Destroy(targets, NOFREE); |
Lst_Destroy(sysIncPath, Dir_Destroy); |
Lst_Destroy(sysIncPath, Dir_Destroy); |
|
|
Parse_Getlineno() |
Parse_Getlineno() |
{ |
{ |
return lineno; |
return lineno; |
|
} |
|
|
|
const char * |
|
Parse_Getfilename() |
|
{ |
|
return fname; |
} |
} |
|
|