54 |
static void read_number(char *text, int len, int base); |
static void read_number(char *text, int len, int base); |
55 |
|
|
56 |
static struct obstack stack; /* Obstack for keeping string values */ |
static struct obstack stack; /* Obstack for keeping string values */ |
57 |
char *source_filename; /* Current filename */ |
LOCUS source_locus; |
58 |
ino_t source_inode; /* Inode of the current source (for preventing |
ino_t source_inode; /* Inode of the current source (for preventing |
59 |
recursive inclusion */ |
recursive inclusion */ |
60 |
int source_line_num; /* Current line number */ |
|
61 |
|
|
62 |
#ifdef FLEX_SCANNER |
#ifdef FLEX_SCANNER |
63 |
#define xinput() (yyin ? getc(yyin) : EOF) |
#define xinput() (yyin ? getc(yyin) : EOF) |
195 |
|
|
196 |
struct buffer_ctx { |
struct buffer_ctx { |
197 |
struct buffer_ctx *prev; |
struct buffer_ctx *prev; |
198 |
char *filename; |
LOCUS loc; |
|
int line; |
|
199 |
ino_t i_node; |
ino_t i_node; |
200 |
FILE *yyin; |
FILE *yyin; |
201 |
LEX_BUFFER_STATE state; |
LEX_BUFFER_STATE state; |
232 |
return 1; |
return 1; |
233 |
} |
} |
234 |
|
|
235 |
if (source_filename && st.st_ino == source_inode) { |
if (source_locus.file && st.st_ino == source_inode) { |
236 |
yyerror("recursive inclusion"); |
yyerror("recursive inclusion"); |
237 |
return 1; |
return 1; |
238 |
} |
} |
239 |
if (ctx = ctx_lookup(st.st_ino)) { |
if (ctx = ctx_lookup(st.st_ino)) { |
240 |
yyerror("recursive inclusion"); |
yyerror("recursive inclusion"); |
241 |
if (ctx->prev) |
if (ctx->prev) |
242 |
radlog(L_ERR, _("%s:%d: `%s' already included here"), |
radlog_loc(L_ERR, &ctx->prev->loc, |
243 |
ctx->prev->filename, ctx->prev->line, name); |
_("`%s' already included here"), |
244 |
|
name); |
245 |
else |
else |
246 |
radlog(L_ERR, _("`%s' already included at top level"), |
radlog(L_ERR, _("`%s' already included at top level"), |
247 |
name); |
name); |
256 |
} |
} |
257 |
|
|
258 |
/* Push current context */ |
/* Push current context */ |
259 |
if (source_filename) { |
if (source_locus.file) { |
260 |
ctx = emalloc(sizeof(*ctx)); |
ctx = emalloc(sizeof(*ctx)); |
261 |
ctx->filename = source_filename; |
ctx->loc = source_locus; |
|
ctx->line = source_line_num; |
|
262 |
ctx->i_node = source_inode; |
ctx->i_node = source_inode; |
263 |
ctx->yyin = yyin; |
ctx->yyin = yyin; |
264 |
ctx->prev = context_stack; |
ctx->prev = context_stack; |
275 |
lex_set_buffer(yyin); |
lex_set_buffer(yyin); |
276 |
#endif |
#endif |
277 |
} |
} |
278 |
source_filename = name; |
source_locus.file = name; |
279 |
source_line_num = 1; |
source_locus.line = 1; |
280 |
source_inode = st.st_ino; |
source_inode = st.st_ino; |
281 |
return 0; |
return 0; |
282 |
} |
} |
298 |
return 1; |
return 1; |
299 |
} |
} |
300 |
/* Restore previous context */ |
/* Restore previous context */ |
301 |
source_filename = context_stack->filename; |
source_locus = context_stack->loc; |
|
source_line_num = context_stack->line; |
|
302 |
source_inode = context_stack->i_node; |
source_inode = context_stack->i_node; |
303 |
RESTORE_BUFFER_STATE(context_stack->state); |
RESTORE_BUFFER_STATE(context_stack->state); |
304 |
ctx = context_stack->prev; |
ctx = context_stack->prev; |
319 |
#.*\n { |
#.*\n { |
320 |
if (strncmp(yytext+1, "debug", 5) == 0) |
if (strncmp(yytext+1, "debug", 5) == 0) |
321 |
enable_usr_dbg(1); |
enable_usr_dbg(1); |
322 |
source_line_num++; /* a comment */ |
source_locus.line++; /* a comment */ |
323 |
} |
} |
324 |
#.* /* end-of-file comment */; |
#.* /* end-of-file comment */; |
325 |
\$.*$ preproc(); |
\$.*$ preproc(); |
396 |
} |
} |
397 |
{WS} ; |
{WS} ; |
398 |
\n { |
\n { |
399 |
source_line_num++; |
source_locus.line++; |
400 |
} |
} |
401 |
"=" return EQ; |
"=" return EQ; |
402 |
"!=" return NE; |
"!=" return NE; |
438 |
obstack_init(&stack); |
obstack_init(&stack); |
439 |
|
|
440 |
context_stack = NULL; |
context_stack = NULL; |
441 |
source_filename = NULL; |
source_locus.file = NULL; |
442 |
return push_source(name); |
return push_source(name); |
443 |
} |
} |
444 |
|
|