Lines Matching refs:variable
27 #include "variable.h"
42 /* Create a new pattern-specific variable struct. */
64 /* Look up a target in the pattern-specific variable list. */
104 /* Hash table of all global variable definitions. */
109 struct variable const *key = (struct variable const *) keyv;
116 struct variable const *key = (struct variable const *) keyv;
123 struct variable const *x = (struct variable const *) xv;
124 struct variable const *y = (struct variable const *) yv;
156 /* Define variable named NAME with value VALUE in SET. VALUE is copied.
158 ORIGIN specifies the origin of the variable (makefile, command line
160 If RECURSIVE is nonzero a flag is set in the variable saying
163 struct variable *
169 struct variable *v;
170 struct variable **var_slot;
171 struct variable var_key;
178 var_slot = (struct variable **) hash_find_slot (&set->table, &var_key);
191 /* A variable of this name is already defined.
209 /* Create a new variable definition and add it to the hash table. */
211 v = (struct variable *) xmalloc (sizeof (struct variable));
248 /* If the variable passed in is "special", handle its special nature.
254 Returns the variable reference passed in. */
258 static struct variable *
259 handle_special_var (struct variable *var)
267 it sees that some new construct (a new target or variable) is defined that
276 variable is created that the previous target is completed.
295 struct variable **vp = (struct variable **) global_variable_set.table.ht_vec;
296 struct variable **end = &vp[global_variable_set.table.ht_size];
307 struct variable *v = *vp;
338 /* Lookup a variable whose name is a string starting at NAME
340 Returns address of the `struct variable' containing all info
341 on the variable, or nil if no such variable is defined. */
343 struct variable *
347 struct variable var_key;
356 struct variable *v;
358 v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key);
365 variable via getenv() here. */
423 /* Lookup a variable whose name is a string starting at NAME
425 Returns address of the `struct variable' containing all info
426 on the variable, or nil if no such variable is defined. */
428 struct variable *
432 struct variable var_key;
437 return (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key);
441 /* Initialize FILE's variable set list. If FILE already has a variable set
442 list, the topmost variable set is left intact, but the the rest of the
444 rule, then we will use the "root" double-colon target's variable set as the
445 parent of FILE's variable set.
447 If we're READing a makefile, don't do the pattern variable search now,
448 since the pattern variable might not have been defined yet. */
496 /* We found at least one. Set up a new variable set to accumulate
506 struct variable *v;
508 if (p->variable.flavor == f_simple)
511 p->variable.name, strlen (p->variable.name),
512 p->variable.value, p->variable.origin,
513 0, &p->variable.fileinfo);
520 &p->variable.fileinfo, p->variable.name,
521 p->variable.value, p->variable.origin,
522 p->variable.flavor, 1);
526 v->per_target = p->variable.per_target;
527 v->export = p->variable.export;
536 /* If we have a pattern variable match, set it up. */
546 /* Pop the top set off the current variable set list,
570 struct variable *v = (struct variable *) item;
584 /* Create a new variable set and push it on the current setlist.
586 scope) then we need to "push" it the other way: file variable sets point
650 struct variable **from_var_slot = (struct variable **) from_set->table.ht_vec;
651 struct variable **from_var_end = from_var_slot + from_set->table.ht_size;
656 struct variable *from_var = *from_var_slot;
657 struct variable **to_var_slot
658 = (struct variable **) hash_find_slot (&to_set->table, *from_var_slot);
718 register struct variable *v;
738 struct variable *mshp = lookup_variable ("MAKESHELL", 9);
739 struct variable *comp = lookup_variable ("COMSPEC", 7);
748 struct variable *shp = lookup_variable (shell_str, shlen);
758 struct variable *shell = lookup_variable (shell_str, shlen);
759 struct variable *replace = lookup_variable ("MAKESHELL", 9);
765 /* if $MAKESHELL is not defined use $SHELL but only if the variable
809 environment variable on MSDOS, so whoever sets it, does that on purpose.
860 The child's MAKELEVEL variable is incremented. */
868 struct variable **v_slot;
869 struct variable **v_end;
870 struct variable makelevel_key;
882 /* Run through all the variable sets in the list,
887 v_slot = (struct variable **) set->table.ht_vec;
892 struct variable **new_slot;
893 struct variable *v = *v_slot;
895 /* If this is a per-target variable and it hasn't been touched
900 struct variable *gv;
915 /* The variable doesn't have a name that can be exported. */
929 /* If this is the SHELL variable and it's not exported, then
933 extern struct variable shell_var;
945 new_slot = (struct variable **) hash_find_slot (&table, v);
957 v_slot = (struct variable **) table.ht_vec;
962 struct variable *v = *v_slot;
1000 /* Given a variable, a value, and a flavor, define the variable.
1003 struct variable *
1009 struct variable *v;
1013 /* Calculate the variable's new value in VALUE. */
1022 /* A simple variable definition "var := value". Expand the value.
1024 variable buffer, and we may still need that if we're looking at a
1025 target-specific variable. */
1029 /* A conditional variable definition "var ?= value".
1030 The value is set IFF the variable is not defined yet. */
1039 /* A recursive variable definition "var = value".
1045 /* If we have += but we're in a target variable context, we want to
1054 target-specific variable definition exists. */
1077 /* The previous definition of the variable was recursive.
1081 /* The previous definition of the variable was simple.
1085 buffer if we're looking at a target-specific variable. */
1135 struct variable *pathv = lookup_variable ("PATH", 4);
1189 set new value for SHELL variable. */
1208 different variable context pushed, not the global context (maybe we're
1211 make sure we define this variable in the global set. */
1228 /* Try to interpret LINE (a null-terminated string) as a variable definition.
1231 or o_command specifying that the variable definition comes
1237 If LINE was recognized as a variable definition, a pointer to its `struct
1238 variable' is returned. If LINE is not a variable definition, NULL is
1241 struct variable *
1242 parse_variable_definition (struct variable *v, char *line)
1270 /* A colon other than := is a rule line, not a variable defn. */
1286 /* This might begin a variable expansion reference. Make sure we
1328 fatal (&v->fileinfo, _("empty variable name"));
1334 /* Try to interpret LINE (a null-terminated string) as a variable definition.
1337 or o_command specifying that the variable definition comes
1343 If LINE was recognized as a variable definition, a pointer to its `struct
1344 variable' is returned. If LINE is not a variable definition, NULL is
1347 struct variable *
1351 struct variable v;
1352 struct variable *vp;
1371 /* Print information for variable V, prefixing it with PREFIX. */
1376 const struct variable *v = (struct variable *) item;
1445 the actual variable definitions (everything else is comments). */
1452 fputs (_("# variable set hash-table stats:\n"), stdout);
1467 puts (_("\n# Pattern-specific Variable Values"));
1477 print_variable (&p->variable, "# ");
1481 puts (_("\n# No pattern-specific variable values."));
1483 printf (_("\n# %u pattern-specific variable values"), rules);