Lines Matching refs:expr

306 	struct cras_expr_expression *expr;  in new_boolean_literal()  local
307 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_boolean_literal()
308 expr->type = EXPR_TYPE_LITERAL; in new_boolean_literal()
309 value_set_boolean(&expr->u.literal, boolean); in new_boolean_literal()
310 return expr; in new_boolean_literal()
315 struct cras_expr_expression *expr; in new_integer_literal() local
316 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_integer_literal()
317 expr->type = EXPR_TYPE_LITERAL; in new_integer_literal()
318 value_set_integer(&expr->u.literal, integer); in new_integer_literal()
319 return expr; in new_integer_literal()
325 struct cras_expr_expression *expr; in new_string_literal() local
326 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_string_literal()
327 expr->type = EXPR_TYPE_LITERAL; in new_string_literal()
328 value_set_string2(&expr->u.literal, begin, end); in new_string_literal()
329 return expr; in new_string_literal()
335 struct cras_expr_expression *expr; in new_variable() local
336 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_variable()
337 expr->type = EXPR_TYPE_VARIABLE; in new_variable()
338 expr->u.variable = copy_str(begin, end); in new_variable()
339 return expr; in new_variable()
344 struct cras_expr_expression *expr; in new_compound_expression() local
345 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_compound_expression()
346 expr->type = EXPR_TYPE_COMPOUND; in new_compound_expression()
347 return expr; in new_compound_expression()
350 static void add_sub_expression(struct cras_expr_expression *expr, in add_sub_expression() argument
353 ARRAY_APPEND(&expr->u.children, sub); in add_sub_expression()
413 struct cras_expr_expression *expr = new_compound_expression(); in parse_one_expr() local
418 add_sub_expression(expr, next); in parse_one_expr()
422 cras_expr_expression_free(expr); in parse_one_expr()
427 return expr; in parse_one_expr()
448 void cras_expr_expression_free(struct cras_expr_expression *expr) in cras_expr_expression_free() argument
450 if (!expr) in cras_expr_expression_free()
453 switch (expr->type) { in cras_expr_expression_free()
457 cras_expr_value_free(&expr->u.literal); in cras_expr_expression_free()
460 free((char *)expr->u.variable); in cras_expr_expression_free()
466 FOR_ARRAY_ELEMENT(&expr->u.children, i, psub) { in cras_expr_expression_free()
469 ARRAY_FREE(&expr->u.children); in cras_expr_expression_free()
473 free(expr); in cras_expr_expression_free()
476 void cras_expr_expression_eval(struct cras_expr_expression *expr, in cras_expr_expression_eval() argument
482 switch (expr->type) { in cras_expr_expression_eval()
486 copy_value(result, &expr->u.literal); in cras_expr_expression_eval()
491 expr->u.variable); in cras_expr_expression_eval()
494 expr->u.variable); in cras_expr_expression_eval()
507 FOR_ARRAY_ELEMENT(&expr->u.children, i, psub) { in cras_expr_expression_eval()
533 int cras_expr_expression_eval_int(struct cras_expr_expression *expr, in cras_expr_expression_eval_int() argument
540 cras_expr_expression_eval(expr, env, &value); in cras_expr_expression_eval_int()
551 int cras_expr_expression_eval_boolean(struct cras_expr_expression *expr, in cras_expr_expression_eval_boolean() argument
558 cras_expr_expression_eval(expr, env, &value); in cras_expr_expression_eval_boolean()