• Home
  • Raw
  • Download

Lines Matching refs:state

35 char* Evaluate(State* state, Expr* expr) {  in Evaluate()  argument
36 Value* v = expr->fn(expr->name, state, expr->argc, expr->argv); in Evaluate()
39 ErrorAbort(state, "expecting string, got value type %d", v->type); in Evaluate()
48 Value* EvaluateValue(State* state, Expr* expr) { in EvaluateValue() argument
49 return expr->fn(expr->name, state, expr->argc, expr->argv); in EvaluateValue()
67 Value* ConcatFn(const char* name, State* state, int argc, Expr* argv[]) { in ConcatFn() argument
79 strings[i] = Evaluate(state, argv[i]); in ConcatFn()
102 Value* IfElseFn(const char* name, State* state, int argc, Expr* argv[]) { in IfElseFn() argument
104 free(state->errmsg); in IfElseFn()
105 state->errmsg = strdup("ifelse expects 2 or 3 arguments"); in IfElseFn()
108 char* cond = Evaluate(state, argv[0]); in IfElseFn()
115 return EvaluateValue(state, argv[1]); in IfElseFn()
119 return EvaluateValue(state, argv[2]); in IfElseFn()
126 Value* AbortFn(const char* name, State* state, int argc, Expr* argv[]) { in AbortFn() argument
129 msg = Evaluate(state, argv[0]); in AbortFn()
131 free(state->errmsg); in AbortFn()
133 state->errmsg = msg; in AbortFn()
135 state->errmsg = strdup("called abort()"); in AbortFn()
140 Value* AssertFn(const char* name, State* state, int argc, Expr* argv[]) { in AssertFn() argument
143 char* v = Evaluate(state, argv[i]); in AssertFn()
155 memcpy(err_src + prefix_len, state->script + argv[i]->start, len); in AssertFn()
157 free(state->errmsg); in AssertFn()
158 state->errmsg = err_src; in AssertFn()
165 Value* SleepFn(const char* name, State* state, int argc, Expr* argv[]) { in SleepFn() argument
166 char* val = Evaluate(state, argv[0]); in SleepFn()
175 Value* StdoutFn(const char* name, State* state, int argc, Expr* argv[]) { in StdoutFn() argument
178 char* v = Evaluate(state, argv[i]); in StdoutFn()
188 Value* LogicalAndFn(const char* name, State* state, in LogicalAndFn() argument
190 char* left = Evaluate(state, argv[0]); in LogicalAndFn()
194 return EvaluateValue(state, argv[1]); in LogicalAndFn()
200 Value* LogicalOrFn(const char* name, State* state, in LogicalOrFn() argument
202 char* left = Evaluate(state, argv[0]); in LogicalOrFn()
206 return EvaluateValue(state, argv[1]); in LogicalOrFn()
212 Value* LogicalNotFn(const char* name, State* state, in LogicalNotFn() argument
214 char* val = Evaluate(state, argv[0]); in LogicalNotFn()
221 Value* SubstringFn(const char* name, State* state, in SubstringFn() argument
223 char* needle = Evaluate(state, argv[0]); in SubstringFn()
225 char* haystack = Evaluate(state, argv[1]); in SubstringFn()
237 Value* EqualityFn(const char* name, State* state, int argc, Expr* argv[]) { in EqualityFn() argument
238 char* left = Evaluate(state, argv[0]); in EqualityFn()
240 char* right = Evaluate(state, argv[1]); in EqualityFn()
252 Value* InequalityFn(const char* name, State* state, int argc, Expr* argv[]) { in InequalityFn() argument
253 char* left = Evaluate(state, argv[0]); in InequalityFn()
255 char* right = Evaluate(state, argv[1]); in InequalityFn()
267 Value* SequenceFn(const char* name, State* state, int argc, Expr* argv[]) { in SequenceFn() argument
268 Value* left = EvaluateValue(state, argv[0]); in SequenceFn()
271 return EvaluateValue(state, argv[1]); in SequenceFn()
274 Value* LessThanIntFn(const char* name, State* state, int argc, Expr* argv[]) { in LessThanIntFn() argument
276 free(state->errmsg); in LessThanIntFn()
277 state->errmsg = strdup("less_than_int expects 2 arguments"); in LessThanIntFn()
283 if (ReadArgs(state, argv, 2, &left, &right) < 0) return NULL; in LessThanIntFn()
308 Value* GreaterThanIntFn(const char* name, State* state, in GreaterThanIntFn() argument
311 free(state->errmsg); in GreaterThanIntFn()
312 state->errmsg = strdup("greater_than_int expects 2 arguments"); in GreaterThanIntFn()
320 return LessThanIntFn(name, state, 2, temp); in GreaterThanIntFn()
323 Value* Literal(const char* name, State* state, int argc, Expr* argv[]) { in Literal() argument
405 int ReadArgs(State* state, Expr* argv[], int count, ...) { in ReadArgs() argument
411 args[i] = Evaluate(state, argv[i]); in ReadArgs()
431 int ReadValueArgs(State* state, Expr* argv[], int count, ...) { in ReadValueArgs() argument
437 args[i] = EvaluateValue(state, argv[i]); in ReadValueArgs()
458 char** ReadVarArgs(State* state, int argc, Expr* argv[]) { in ReadVarArgs() argument
462 args[i] = Evaluate(state, argv[i]); in ReadVarArgs()
479 Value** ReadValueVarArgs(State* state, int argc, Expr* argv[]) { in ReadValueVarArgs() argument
483 args[i] = EvaluateValue(state, argv[i]); in ReadValueVarArgs()
498 Value* ErrorAbort(State* state, const char* format, ...) { in ErrorAbort() argument
504 free(state->errmsg); in ErrorAbort()
505 state->errmsg = buffer; in ErrorAbort()