/* How about a DEFINE? */
for (ptr = defines; ptr; ptr = ptr->next)
{
- if (strcmp(yytext, ptr->old) == 0)
+ if (strcmp(yytext, ptr->old) == 0 && ptr->used == NULL)
{
struct _yy_buffer *yb;
yb->buffer = YY_CURRENT_BUFFER;
yb->lineno = yylineno;
yb->filename = mm_strdup(input_filename);
- yb->next = yy_buffer;
+ ptr->used = yb->next = yy_buffer;
yy_buffer = yb;
/* is it a define? */
for (ptr = defines; ptr; ptr = ptr->next)
{
- if (strcmp(yytext, ptr->old) == 0)
+ if (strcmp(yytext, ptr->old) == 0 && ptr->used == NULL)
{
struct _yy_buffer *yb;
yb->buffer = YY_CURRENT_BUFFER;
yb->lineno = yylineno;
yb->filename = mm_strdup(input_filename);
- yb->next = yy_buffer;
+ ptr->used = yb->next = yy_buffer;
yy_buffer = yb;
<C>"-" { return('-'); }
<C>"(" { return('('); }
<C>")" { return(')'); }
-<C>{space} { ECHO; }
+<C,xskip>{space} { ECHO; }
<C>\{ { return('{'); }
<C>\} { return('}'); }
<C>\[ { return('['); }
}
if (ptr == NULL)
{
- this = (struct _defines *) mm_alloc(sizeof(struct _defines));
+ this = (struct _defines *) mm_alloc(sizeof(struct _defines));
- /* initial definition */
- this->old = old;
- this->new = mm_strdup(literalbuf);
+ /* initial definition */
+ this->old = old;
+ this->new = mm_strdup(literalbuf);
this->next = defines;
+ this->used = NULL;
defines = this;
}
{
struct _yy_buffer *yb = yy_buffer;
int i;
-
+ struct _defines *ptr;
+
+ for (ptr = defines; ptr; ptr = ptr->next)
+ if (ptr->used == yy_buffer)
+ {
+ ptr->used = NULL;
+ break;
+ }
+
if (yyin != NULL)
fclose(yyin);