summaryrefslogtreecommitdiffstats
path: root/src/interfaces/ecpg/preproc/type.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/preproc/type.h')
-rw-r--r--src/interfaces/ecpg/preproc/type.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h
index 08b739e..a36d93d 100644
--- a/src/interfaces/ecpg/preproc/type.h
+++ b/src/interfaces/ecpg/preproc/type.h
@@ -158,13 +158,25 @@ struct typedefs
struct typedefs *next;
};
+/*
+ * Info about a defined symbol (macro), coming from a -D command line switch
+ * or a define command in the program. These are stored in a simple list.
+ * Because ecpg supports compiling multiple files per run, we have to remember
+ * the command-line definitions and be able to revert to those; this motivates
+ * storing cmdvalue separately from value.
+ * name and value are separately-malloc'd strings; cmdvalue typically isn't.
+ * used is NULL unless we are currently expanding the macro, in which case
+ * it points to the buffer before the one scanning the macro; we reset it
+ * to NULL upon returning to that buffer. This is used to prevent recursive
+ * expansion of the macro.
+ */
struct _defines
{
- char *olddef;
- char *newdef;
- int pertinent;
- void *used;
- struct _defines *next;
+ char *name; /* symbol's name */
+ char *value; /* current value, or NULL if undefined */
+ const char *cmdvalue; /* value set on command line, or NULL */
+ void *used; /* buffer pointer, or NULL */
+ struct _defines *next; /* list link */
};
/* This is a linked list of the variable names and types. */