summaryrefslogtreecommitdiff
path: root/variable.h
diff options
context:
space:
mode:
Diffstat (limited to 'variable.h')
-rw-r--r--variable.h32
1 files changed, 25 insertions, 7 deletions
diff --git a/variable.h b/variable.h
index 19ec31e..d449ef8 100644
--- a/variable.h
+++ b/variable.h
@@ -40,6 +40,7 @@ struct variable
struct variable *next; /* Link in the chain. */
char *name; /* Variable name. */
char *value; /* Variable value. */
+ struct floc fileinfo; /* Where the variable was defined. */
enum variable_origin
origin ENUM_BITFIELD (3); /* Variable origin. */
unsigned int recursive:1; /* Gets recursively re-evaluated. */
@@ -101,19 +102,36 @@ extern struct variable_set_list *create_new_variable_set PARAMS ((void));
extern struct variable_set_list *push_new_variable_scope PARAMS ((void));
extern void pop_variable_scope PARAMS ((void));
extern void define_automatic_variables PARAMS ((void));
-extern void initialize_file_variables PARAMS ((struct file *file));
+extern void initialize_file_variables PARAMS ((struct file *file, int read));
extern void print_file_variables PARAMS ((struct file *file));
extern void print_variable_set PARAMS ((struct variable_set *set, char *prefix));
extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
extern struct variable *try_variable_definition PARAMS ((const struct floc *flocp, char *line, enum variable_origin origin, int target_var));
extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length));
-extern struct variable *define_variable PARAMS ((char *name, unsigned int length, char *value,
- enum variable_origin origin, int recursive));
-extern struct variable *define_variable_in_set PARAMS ((char *name, unsigned int length,
- char *value, enum variable_origin origin, int recursive, struct variable_set *set));
-extern struct variable *define_variable_for_file PARAMS ((char *name, unsigned int length,
- char *value, enum variable_origin origin, int recursive, struct file *file));
+
+extern struct variable *define_variable_in_set
+ PARAMS ((char *name, unsigned int length, char *value,
+ enum variable_origin origin, int recursive,
+ struct variable_set *set, const struct floc *flocp));
+
+/* Define a variable in the current variable set. */
+
+#define define_variable(n,l,v,o,r) \
+ define_variable_in_set((n),(l),(v),(o),(r),\
+ current_variable_set_list->set,NILF)
+
+/* Define a variable with a location in the current variable set. */
+
+#define define_variable_loc(n,l,v,o,r,f) \
+ define_variable_in_set((n),(l),(v),(o),(r),\
+ current_variable_set_list->set,(f))
+
+/* Define a variable in FILE's variable set. */
+
+#define define_variable_for_file(n,l,v,o,r,f) \
+ define_variable_in_set((n),(l),(v),(o),(r),(f)->variables->set,NILF)
+
extern char **target_environment PARAMS ((struct file *file));
extern int export_all_variables;