version 1.17, 2002/12/29 17:29:35 |
version 1.18, 2004/04/07 13:11:36 |
|
|
static int ParseSkipEmptyLines(Buffer); |
static int ParseSkipEmptyLines(Buffer); |
|
|
static IFile * |
static IFile * |
new_ifile(name, stream) |
new_ifile(const char *name, FILE *stream) |
const char *name; |
|
FILE *stream; |
|
{ |
{ |
IFile *ifile; |
IFile *ifile; |
#if 0 |
#if 0 |
|
|
} |
} |
|
|
static void |
static void |
free_ifile(ifile) |
free_ifile(IFile *ifile) |
IFile *ifile; |
|
{ |
{ |
if (ifile->F && fileno(ifile->F) != STDIN_FILENO) |
if (ifile->F && fileno(ifile->F) != STDIN_FILENO) |
(void)fclose(ifile->F); |
(void)fclose(ifile->F); |
|
|
} |
} |
|
|
static IFile * |
static IFile * |
new_istring(str, name, lineno) |
new_istring(char *str, const char *name, unsigned long lineno) |
char *str; |
|
const char *name; |
|
unsigned long lineno; |
|
{ |
{ |
IFile *ifile; |
IFile *ifile; |
|
|
|
|
|
|
|
|
void |
void |
Parse_FromString(str, lineno) |
Parse_FromString(char *str, unsigned long lineno) |
char *str; |
|
unsigned long lineno; |
|
{ |
{ |
if (DEBUG(FOR)) |
if (DEBUG(FOR)) |
(void)fprintf(stderr, "%s\n----\n", str); |
(void)fprintf(stderr, "%s\n----\n", str); |
|
|
|
|
|
|
void |
void |
Parse_FromFile(name, stream) |
Parse_FromFile(const char *name, FILE *stream) |
const char *name; |
|
FILE *stream; |
|
{ |
{ |
if (current != NULL) |
if (current != NULL) |
Lst_Push(&input_stack, current); |
Lst_Push(&input_stack, current); |
|
|
} |
} |
|
|
bool |
bool |
Parse_NextFile() |
Parse_NextFile(void) |
{ |
{ |
if (current != NULL) |
if (current != NULL) |
free_ifile(current); |
free_ifile(current); |
|
|
} |
} |
|
|
static int |
static int |
newline() |
newline(void) |
{ |
{ |
size_t len; |
size_t len; |
|
|
|
|
} |
} |
|
|
static int |
static int |
skiptoendofline() |
skiptoendofline(void) |
{ |
{ |
if (current->F) { |
if (current->F) { |
if (current->end - current->ptr > 1) |
if (current->end - current->ptr > 1) |
|
|
|
|
|
|
char * |
char * |
Parse_ReadNextConditionalLine(linebuf) |
Parse_ReadNextConditionalLine(Buffer linebuf) |
Buffer linebuf; |
|
{ |
{ |
int c; |
int c; |
|
|
|
|
} |
} |
|
|
static void |
static void |
ParseFoldLF(linebuf, c) |
ParseFoldLF(Buffer linebuf, int c) |
Buffer linebuf; |
|
int c; |
|
{ |
{ |
for (;;) { |
for (;;) { |
if (c == '\n') { |
if (c == '\n') { |
|
|
} |
} |
|
|
char * |
char * |
Parse_ReadUnparsedLine(linebuf, type) |
Parse_ReadUnparsedLine(Buffer linebuf, const char *type) |
Buffer linebuf; |
|
const char *type; |
|
{ |
{ |
int c; |
int c; |
|
|
|
|
/* This is a fairly complex function, but without it, we could not skip |
/* This is a fairly complex function, but without it, we could not skip |
* blocks of comments without reading them. */ |
* blocks of comments without reading them. */ |
static int |
static int |
ParseSkipEmptyLines(linebuf) |
ParseSkipEmptyLines(Buffer linebuf) |
Buffer linebuf; |
|
{ |
{ |
int c; /* the current character */ |
int c; /* the current character */ |
|
|
|
|
} |
} |
|
|
/* Parse_ReadNormalLine removes beginning and trailing blanks (but keeps |
/* Parse_ReadNormalLine removes beginning and trailing blanks (but keeps |
* the first tab), handles escaped newlines, and skip over uninteresting |
* the first tab), handles escaped newlines, and skips over uninteresting |
* lines. |
* lines. |
* |
* |
* The line number is advanced, which implies that continuation |
* The line number is incremented, which implies that continuation |
* lines are numbered with the last line no (we could do better, at a |
* lines are numbered with the last line number (we could do better, at a |
* price). |
* price). |
* |
* |
* Trivial comments are also removed, but we can't do more, as |
* Trivial comments are also removed, but we can't do more, as |
* we don't know which lines are shell commands or not. */ |
* we don't know which lines are shell commands or not. */ |
char * |
char * |
Parse_ReadNormalLine(linebuf) |
Parse_ReadNormalLine(Buffer linebuf) |
Buffer linebuf; |
|
{ |
{ |
int c; /* the current character */ |
int c; /* the current character */ |
|
|
|
|
} |
} |
|
|
unsigned long |
unsigned long |
Parse_Getlineno() |
Parse_Getlineno(void) |
{ |
{ |
return current ? current->lineno : 0; |
return current ? current->lineno : 0; |
} |
} |
|
|
const char * |
const char * |
Parse_Getfilename() |
Parse_Getfilename(void) |
{ |
{ |
return current ? current->fname : NULL; |
return current ? current->fname : NULL; |
} |
} |
|
|
#ifdef CLEANUP |
#ifdef CLEANUP |
void |
void |
LowParse_Init() |
LowParse_Init(void) |
{ |
{ |
Static_Lst_Init(&input_stack); |
Static_Lst_Init(&input_stack); |
current = NULL; |
current = NULL; |
} |
} |
|
|
void |
void |
LowParse_End() |
LowParse_End(void) |
{ |
{ |
Lst_Destroy(&input_stack, NOFREE); /* Should be empty now */ |
Lst_Destroy(&input_stack, NOFREE); /* Should be empty now */ |
#if 0 |
#if 0 |
|
|
|
|
|
|
void |
void |
Parse_ReportErrors() |
Parse_ReportErrors(void) |
{ |
{ |
if (fatal_errors) { |
if (fatal_errors) { |
#ifdef CLEANUP |
#ifdef CLEANUP |