Lines Matching +defs:value +defs:mod

74  * Variables are set using lines of the form VAR=value.  Both the variable
75 * name and the value can contain references to other variables, by using
80 * Var_SetExpand Set the value of the variable, creating it if
86 * necessary. A space is placed between the old value and
93 * Var_Value Return the unexpanded value of a variable, or NULL if
134 * Variables are defined using one of the VAR=value assignments. Their
135 * value can be queried by expressions such as $V, ${VAR}, or with modifiers
161 /* The unexpanded value of the variable. */
176 * Appending to its value depends on the scope, see var-op-append.mk.
181 * The variable value cannot be changed anymore, and the variable
271 const FStr *value;
284 * Special return value for Var_Parse, indicating a parse error. It may be
291 * Special return value for Var_Parse, indicating an undefined variable in
351 EvalStack_Push(EvalStackElementKind kind, const char *str, const FStr *value)
360 evalStack.elems[evalStack.len].value = value;
388 const char* value = elem->value != NULL
390 ? elem->value->str : NULL;
393 value != NULL ? "\" with value \"" : "",
394 value != NULL ? value : "");
399 VarNew(FStr name, const char *value,
402 size_t value_len = strlen(value);
406 Buf_AddBytes(&var->val, value, value_len);
519 /* If the variable is short-lived, free it, including its value. */
532 ValueDescription(const char *value)
534 if (value[0] == '\0')
536 if (ch_isspace(value[strlen(value) - 1]))
541 /* Add a new variable of the given name and value to the given scope. */
543 VarAdd(const char *name, const char *value, GNode *scope, VarSetFlags flags)
546 Var *v = VarNew(FStr_InitRefer(/* aliased to */ he->key), value,
550 scope->name, name, value, ValueDescription(value));
570 v = he->value;
608 Var *v = hi.entry->value;
786 * children see a correctly incremented value.
801 Var *var = hi.entry->value;
995 /* Set the variable to the value; the name is not expanded. */
1035 * wrong value.
1118 * replace its value.
1141 Global_Set(const char *name, const char *value)
1143 Var_Set(SCOPE_GLOBAL, name, value);
1153 Global_Set_ReadOnly(const char *name, const char *value)
1155 Var_SetWithFlags(SCOPE_GLOBAL, name, value, VAR_SET_NONE);
1160 * Append the value to the named variable.
1163 * and the given value are appended.
1202 * scope, add a space and the value, otherwise set the variable to the value.
1228 Global_Append(const char *name, const char *value)
1230 Var_Append(SCOPE_GLOBAL, name, value);
1265 * Return the unexpanded value of the given variable in the given scope,
1273 * The value if the variable exists, NULL if it doesn't.
1274 * The value is valid until the next modification to any variable.
1280 char *value;
1288 value = v->val.data;
1292 return FStr_InitOwn(value);
1311 * Return the unexpanded variable value from this node, without trying to look
1916 * parsing the modifier, evaluating it and finally updating the value of the
1950 * only noticeable effect is that they update the value of the expression.
1953 * Evaluating the modifier usually takes the current value of the
1954 * expression from ch->expr->value, or the variable name from ch->var->name,
1955 * and stores the result back in ch->expr->value via Expr_SetValueOwn or
1994 FStr value;
2032 * Whether some modifiers that otherwise split the variable value
2033 * into words, like :S and :C, treat the variable value as a single
2049 return expr->value.str;
2059 Expr_SetValue(Expr *expr, FStr value)
2061 FStr_Done(&expr->value);
2062 expr->value = value;
2066 Expr_SetValueOwn(Expr *expr, char *value)
2068 Expr_SetValue(expr, FStr_InitOwn(value));
2072 Expr_SetValueRefer(Expr *expr, const char *value)
2074 Expr_SetValue(expr, FStr_InitRefer(value));
2250 /* Test whether mod starts with modname, followed by a delimiter. */
2252 ModMatch(const char *mod, const char *modname, const ModChain *ch)
2255 return strncmp(mod, modname, n) == 0 && IsDelimiter(mod[n], ch);
2258 /* Test whether mod starts with modname, followed by a delimiter or '='. */
2260 ModMatchEq(const char *mod, const char *modname, const ModChain *ch)
2263 return strncmp(mod, modname, n) == 0 &&
2264 (IsDelimiter(mod[n], ch) || mod[n] == '=');
2415 /* XXX: Consider restoring the previous value instead of deleting. */
2535 const char *mod = *pp;
2536 bool gmt = mod[0] == 'g';
2538 if (!ModMatchEq(mod, gmt ? "gmtime" : "localtime", ch))
2540 args = mod + (gmt ? 6 : 9);
2554 "Invalid time value \"%s\"", arg.str);
2661 const char *mod = *pp;
2662 if (!ModMatchEq(mod, "range", ch))
2665 if (mod[5] == '=') {
2666 const char *p = mod + 6;
2670 mod + 6);
2676 *pp = mod + 5;
2708 const char *mod = *pp;
2727 for (p = mod + 1; *p != '\0' && !(*p == ':' && depth == 0); p++) {
2753 pattern = bmake_malloc((size_t)(endpat - (mod + 1)) + 1);
2755 src = mod + 1;
2765 pattern = bmake_strsedup(mod + 1, endpat);
2779 DEBUG2(VAR, "Pattern for ':%c' is \"%s\"\n", mod[0], pattern);
2811 char mod = **pp;
2819 args.neg = mod == 'N';
2866 const char *p, *mod = *pp;
2869 if (!ModMatchEq(mod, "mtime", ch))
3177 const char *mod = *pp;
3178 assert(mod[0] == 't');
3180 if (IsDelimiter(mod[1], ch)) {
3181 *pp = mod + 1;
3185 if (mod[1] == 's')
3188 if (!IsDelimiter(mod[2], ch)) { /* :t<any><any> */
3189 *pp = mod + 1;
3193 if (mod[1] == 'A') { /* :tA */
3194 *pp = mod + 2;
3199 if (mod[1] == 't') { /* :tt */
3200 *pp = mod + 2;
3206 if (mod[1] == 'u') { /* :tu */
3207 *pp = mod + 2;
3213 if (mod[1] == 'l') { /* :tl */
3214 *pp = mod + 2;
3220 if (mod[1] == 'W' || mod[1] == 'w') { /* :tW, :tw */
3221 *pp = mod + 2;
3222 ch->oneBigWord = mod[1] == 'W';
3227 *pp = mod + 1; /* XXX: unnecessary but observable */
3413 const char *mod = *pp;
3417 if (IsDelimiter(mod[1], ch)) {
3420 } else if (IsDelimiter(mod[2], ch)) {
3421 if (mod[1] == 'n')
3423 else if (mod[1] == 'r')
3425 else if (mod[1] == 'x')
3430 } else if (IsDelimiter(mod[3], ch)) {
3431 if ((mod[1] == 'n' && mod[2] == 'r') ||
3432 (mod[1] == 'r' && mod[2] == 'n'))
3521 * The ::= modifiers are special in that they do not read the variable value
3535 * ::=<str> Assigns <str> as the new value of variable.
3536 * ::?=<str> Assigns <str> as value of variable if
3539 * ::!=<cmd> Assigns output of <cmd> as the new value of
3550 const char *mod = *pp;
3551 const char *op = mod + 1;
3561 *pp = mod + 1;
3565 *pp = mod + (op[0] != '=' ? 3 : 2);
3607 * remember current value
3613 const char *mod = *pp;
3616 if (!ModMatchEq(mod, "_", ch))
3620 if (mod[1] == '=') {
3626 const char *arg = mod + 2;
3631 *pp = mod + 1;
3641 * Apply the given function to each word of the variable value,
3722 const char *mod = *pp;
3724 if (!IsSysVModifier(mod, ch->startc, ch->endc))
3799 LogBeforeApply(const ModChain *ch, const char *mod)
3802 bool is_single_char = mod[0] != '\0' && IsDelimiter(mod[1], ch);
3811 expr->name, mod[0], is_single_char ? "" : "...");
3817 "Evaluating modifier ${%s:%c%s} on value \"%s\"\n",
3818 expr->name, mod[0], is_single_char ? "" : "...",
3824 "Evaluating modifier ${%s:%c%s} on value \"%s\" (%s, %s)\n",
3825 expr->name, mod[0], is_single_char ? "" : "...", Expr_Str(expr),
3830 LogAfterApply(const ModChain *ch, const char *p, const char *mod)
3833 const char *value = Expr_Str(expr);
3834 const char *quot = value == var_Error ? "" : "\"";
3838 expr->name, (int)(p - mod), mod,
3839 quot, value == var_Error ? "error" : value, quot);
3844 expr->name, (int)(p - mod), mod,
3845 quot, value == var_Error ? "error" : value, quot,
3983 const char *mod = *pp;
3987 LogBeforeApply(ch, mod);
3992 assert(p == mod);
4006 (int)(p - mod), mod);
4015 LogAfterApply(ch, p, mod);
4021 ch->endc, (int)(p - mod), mod);
4027 (int)(p - mod), mod);
4054 /* Apply any modifiers (such as :Mpattern or :@var@loop@ or :Q or ::=value). */
4065 const char *mod;
4096 mod = p;
4112 (int)strcspn(mod, ":)}"), mod);
4436 * instead of the actually computed value.
4453 #define Expr_Init(name, value, emode, scope, defined) \
4454 (Expr) { name, value, emode, scope, defined }
4457 Expr_Init(const char *name, FStr value,
4463 expr.value = value;
4472 * Expressions of the form ${:U...} with a trivial value are often generated
4501 * the modifiers to the value of the expression.
4512 * TODO: After a parse error, the value of *pp is
4517 * return The value of the expression, never NULL.
4591 * FIXME: This assignment creates an alias to the current value of the
4592 * variable. This means that as long as the value of the expression
4593 * stays the same, the value of the variable must not change, and the
4596 * while its value is still being used:
4598 * VAR= value
4604 * At the bottom of this function, the resulting value is compared to
4605 * the then-current value of the variable. This might also invoke
4608 expr.value = FStr_InitRefer(v->val.data);
4613 EvalStack_Push(VSK_VARNAME, expr.name, &expr.value);
4615 EvalStack_Push(VSK_EXPR, start, &expr.value);
4619 * the variable value.
4658 if (expr.value.str == v->val.data) {
4660 expr.value.freeIt = v->val.data;
4667 return expr.value;