-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.81.2.1 2003/12/18 18:55:06 petere Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.81.2.2 2004/07/20 18:22:53 meskes Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
else
{
defines->old = define_copy;
- defines->new = mm_strdup("");
+ defines->new = mm_strdup("1");
}
defines->pertinent = true;
+ defines->used = NULL;
defines->next = pd;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.122.2.2 2004/02/15 13:50:02 meskes Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.122.2.3 2004/07/20 18:22:53 meskes Exp $
*
*-------------------------------------------------------------------------
*/
/* 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);