Home | History | Annotate | Download | only in make

Lines Matching defs:expr

702 	char *expr;
717 expr = str_concat3("${", name, "}");
718 val = Var_Subst(expr, scope, VARE_EVAL);
728 free(expr);
974 char *expr = str_concat3(
976 char *filtered = Var_Subst(expr, SCOPE_GLOBAL, VARE_EVAL);
980 free(expr);
1979 * expression from ch->expr->value, or the variable name from ch->var->name,
1980 * and stores the result back in ch->expr->value via Expr_SetValueOwn or
2013 typedef struct Expr {
2019 } Expr;
2045 Expr *expr;
2061 Expr_Define(Expr *expr)
2063 if (expr->defined == DEF_UNDEF)
2064 expr->defined = DEF_DEFINED;
2068 Expr_Str(const Expr *expr)
2070 return expr->value.str;
2074 Expr_Words(const Expr *expr)
2076 return Substring_Words(Expr_Str(expr), false);
2080 Expr_SetValue(Expr *expr, FStr value)
2082 FStr_Done(&expr->value);
2083 expr->value = value;
2087 Expr_SetValueOwn(Expr *expr, char *value)
2089 Expr_SetValue(expr, FStr_InitOwn(value));
2093 Expr_SetValueRefer(Expr *expr, const char *value)
2095 Expr_SetValue(expr, FStr_InitRefer(value));
2099 Expr_ShouldEval(const Expr *expr)
2101 return VarEvalMode_ShouldEval(expr->emode);
2107 return Expr_ShouldEval(ch->expr);
2143 FStr nested_val = Var_Parse(&p, ch->expr->scope,
2360 Expr *expr = ch->expr;
2361 const char *val = Expr_Str(expr);
2393 Expr_SetValueOwn(expr, SepBuf_DoneData(&result));
2400 Expr *expr = ch->expr;
2406 args.scope = expr->scope;
2428 if (!Expr_ShouldEval(expr))
2431 args.emode = VarEvalMode_WithoutKeepDollar(expr->emode);
2437 Var_Delete(expr->scope, args.var);
2478 FStr val = Var_Parse(&p, ch->expr->scope,
2479 shouldEval ? ch->expr->emode : VARE_PARSE);
2498 Expr *expr = ch->expr;
2501 Expr_ShouldEval(expr) &&
2502 (**pp == 'D') == (expr->defined == DEF_REGULAR);
2506 Expr_Define(expr);
2508 Expr_SetValue(expr, Substring_Str(LazyBuf_Get(&buf)));
2518 Expr *expr = ch->expr;
2522 if (Expr_ShouldEval(expr)) {
2523 Expr_Define(expr);
2524 Expr_SetValueOwn(expr, bmake_strdup(expr->name));
2553 Expr *expr;
2567 if (!ParseModifierPart(&p, ':', ch->endc, ch->expr->emode,
2588 expr = ch->expr;
2589 if (Expr_ShouldEval(expr))
2590 Expr_SetValueOwn(expr, FormatTime(Expr_Str(expr), t, gmt));
2604 Expr_SetValueOwn(ch->expr, Hash(Expr_Str(ch->expr)));
2613 Expr *expr = ch->expr;
2619 if (!Expr_ShouldEval(expr))
2622 Expr_Define(expr);
2624 gn = Targ_FindNode(expr->name);
2631 path = Dir_FindFile(expr->name, searchPath);
2634 path = bmake_strdup(expr->name);
2635 Expr_SetValueOwn(expr, path);
2644 Expr *expr = ch->expr;
2649 if (!ParseModifierPart(pp, '!', '!', expr->emode,
2654 if (Expr_ShouldEval(expr)) {
2657 Expr_SetValueOwn(expr, output);
2663 Expr_SetValueRefer(expr, "");
2666 Expr_Define(expr);
2704 SubstringWords words = Expr_Words(ch->expr);
2721 Expr_SetValueOwn(ch->expr, Buf_DoneData(&buf));
2730 Expr *expr = ch->expr;
2795 pattern = Var_Subst(pattern, expr->scope, expr->emode);
2967 if (!ParseModifierPart(pp, delim, delim, ch->expr->emode,
2972 if (!ParseModifierPart(pp, delim, delim, ch->expr->emode,
3009 if (!ParseModifierPart(pp, delim, delim, ch->expr->emode,
3014 if (!ParseModifierPart(pp, delim, delim, ch->expr->emode,
3065 QuoteShell(Expr_Str(ch->expr), quoteDollar, &buf);
3067 Expr_SetValue(ch->expr, LazyBuf_DoneGet(&buf));
3190 Expr *expr = ch->expr;
3211 if (Expr_ShouldEval(expr))
3212 Expr_SetValueOwn(expr, str_totitle(Expr_Str(expr)));
3218 if (Expr_ShouldEval(expr))
3219 Expr_SetValueOwn(expr, str_toupper(Expr_Str(expr)));
3225 if (Expr_ShouldEval(expr))
3226 Expr_SetValueOwn(expr, str_tolower(Expr_Str(expr)));
3243 Expr *expr = ch->expr;
3250 if (!ParseModifierPart(pp, ']', ']', expr->emode,
3271 Expr_SetValueRefer(expr, "1");
3275 SubstringWords words = Expr_Words(expr);
3281 Expr_SetValueOwn(expr, Buf_DoneData(&buf));
3317 Expr_SetValueOwn(expr,
3318 VarSelectWords(Expr_Str(expr), first, last,
3456 words = Expr_Words(ch->expr);
3463 Expr_SetValueOwn(ch->expr, SubstringWords_JoinFree(words));
3472 Expr *expr = ch->expr;
3481 if (Expr_ShouldEval(expr)) {
3483 cond_rc = Cond_EvalCondition(expr->name);
3485 then_emode = expr->emode;
3487 else_emode = expr->emode;
3513 if (!Expr_ShouldEval(expr)) {
3517 Expr_SetValue(expr, LazyBuf_DoneGet(&thenBuf));
3521 Expr_SetValue(expr, LazyBuf_DoneGet(&elseBuf));
3523 Expr_Define(expr);
3552 Expr *expr = ch->expr;
3567 if (expr->name[0] == '\0') {
3581 if (!ParseModifierPart(pp, ch->endc, ch->endc, expr->emode,
3588 if (!Expr_ShouldEval(expr))
3591 scope = expr->scope; /* scope where v belongs */
3592 if (expr->defined == DEF_REGULAR && expr->scope != SCOPE_GLOBAL
3593 && VarFind(expr->name, expr->scope, false) == NULL)
3597 Var_Append(scope, expr->name, val.str);
3605 Var_Set(scope, expr->name, output);
3607 } else if (op[0] == '?' && expr->defined == DEF_REGULAR) {
3610 Var_Set(scope, expr->name, val.str);
3612 Expr_SetValueRefer(expr, "");
3626 Expr *expr = ch->expr;
3647 if (Expr_ShouldEval(expr))
3648 Var_Set(SCOPE_GLOBAL, name.str, Expr_Str(expr));
3684 words = Expr_Words(ch->expr);
3694 Expr_SetValueOwn(ch->expr, SubstringWords_JoinFree(words));
3723 Expr *expr = ch->expr;
3735 if (!ParseModifierPart(pp, '=', '=', expr->emode,
3739 if (!ParseModifierPart(pp, ch->endc, ch->endc, expr->emode,
3749 if (lhsBuf.len == 0 && Expr_Str(expr)[0] == '\0')
3755 args.scope = expr->scope;
3774 Expr *expr = ch->expr;
3780 if (Expr_ShouldEval(expr)) {
3782 output = Cmd_Exec(Expr_Str(expr), &error);
3787 Expr_SetValueOwn(expr, output);
3798 ShouldLogInSimpleFormat(const Expr *expr)
3800 return (expr->emode == VARE_EVAL
3801 || expr->emode == VARE_EVAL_DEFINED
3802 || expr->emode == VARE_EVAL_DEFINED_LOUD)
3803 && expr->defined == DEF_REGULAR;
3809 const Expr *expr = ch->expr;
3817 if (!Expr_ShouldEval(expr)) {
3819 expr->name, mod[0], is_single_char ? "" : "...");
3823 if (ShouldLogInSimpleFormat(expr)) {
3826 expr->name, mod[0], is_single_char ? "" : "...",
3827 Expr_Str(expr));
3833 expr->name, mod[0], is_single_char ? "" : "...", Expr_Str(expr),
3834 VarEvalMode_Name[expr->emode], ExprDefined_Name[expr->defined]);
3840 const Expr *expr = ch->expr;
3841 const char *value = Expr_Str(expr);
3843 if (ShouldLogInSimpleFormat(expr)) {
3845 expr->name, (int)(p - mod), mod, value);
3850 expr->name, (int)(p - mod), mod, value,
3851 VarEvalMode_Name[expr->emode],
3852 ExprDefined_Name[expr->defined]);
3918 static void ApplyModifiers(Expr *, const char **, char, char);
3945 Expr *expr = ch->expr;
3947 FStr mods = Var_Parse(&p, expr->scope, expr->emode);
3961 ApplyModifiers(expr, &modsp, '\0', '\0');
3963 if (Expr_Str(expr) == var_Error || *modsp != '\0') {
4019 Expr_SetValueRefer(ch->expr, var_Error);
4051 #define ModChain_Init(expr, startc, endc, sep, oneBigWord) \
4052 (ModChain) { expr, startc, endc, sep, oneBigWord }
4055 ModChain_Init(Expr *expr, char startc, char endc, char sep, bool oneBigWord)
4058 ch.expr = expr;
4070 Expr *expr,
4076 ModChain ch = ModChain_Init(expr, startc, endc, ' ', false);
4081 assert(Expr_Str(expr) != NULL);
4114 assert(Expr_Str(expr) != NULL); /* Use var_Error or varUndefined. */
4129 Expr_SetValueRefer(expr, var_Error);
4480 (Expr) { name, value, emode, scope, defined }
4482 MAKE_INLINE Expr
4486 Expr expr;
4488 expr.name = name;
4489 expr.value = value;
4490 expr.emode = emode;
4491 expr.scope = scope;
4492 expr.defined = defined;
4493 return expr;
4572 Expr expr = Expr_Init(NULL, FStr_InitRefer(NULL),
4599 if (!ParseVarnameLong(&p, startc, scope, emode, expr.emode,
4603 &dynamic, &expr.defined))
4607 expr.name = v->name.str;
4636 expr.value = FStr_InitRefer(v->val.data);
4640 else if (expr.name[0] != '\0')
4641 EvalStack_Push(VSK_VARNAME, expr.name, &expr.value);
4643 EvalStack_Push(VSK_EXPR, start, &expr.value);
4650 strchr(Expr_Str(&expr), '$') != NULL) {
4653 expanded = Var_Subst(Expr_Str(&expr), scope, expr.emode);
4656 Expr_SetValueOwn(&expr, expanded);
4661 ApplyModifiers(&expr, &em, '\0', '\0');
4666 ApplyModifiers(&expr, &p, startc, endc);
4674 if (expr.defined == DEF_UNDEF) {
4675 Substring varname = Substring_InitStr(expr.name);
4678 Expr_SetValue(&expr, value);
4684 if (expr.value.str == v->val.data) {
4686 expr.value.freeIt = v->val.data;
4692 return expr.value;