Lines Matching refs:expr
344 struct cras_expr_expression *expr; in new_boolean_literal() local
345 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_boolean_literal()
346 expr->type = EXPR_TYPE_LITERAL; in new_boolean_literal()
347 value_set_boolean(&expr->u.literal, boolean); in new_boolean_literal()
348 return expr; in new_boolean_literal()
353 struct cras_expr_expression *expr; in new_integer_literal() local
354 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_integer_literal()
355 expr->type = EXPR_TYPE_LITERAL; in new_integer_literal()
356 value_set_integer(&expr->u.literal, integer); in new_integer_literal()
357 return expr; in new_integer_literal()
363 struct cras_expr_expression *expr; in new_string_literal() local
364 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_string_literal()
365 expr->type = EXPR_TYPE_LITERAL; in new_string_literal()
366 value_set_string2(&expr->u.literal, begin, end); in new_string_literal()
367 return expr; in new_string_literal()
373 struct cras_expr_expression *expr; in new_variable() local
374 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_variable()
375 expr->type = EXPR_TYPE_VARIABLE; in new_variable()
376 expr->u.variable = copy_str(begin, end); in new_variable()
377 return expr; in new_variable()
382 struct cras_expr_expression *expr; in new_compound_expression() local
383 expr = calloc(1, sizeof(struct cras_expr_expression)); in new_compound_expression()
384 expr->type = EXPR_TYPE_COMPOUND; in new_compound_expression()
385 return expr; in new_compound_expression()
388 static void add_sub_expression(struct cras_expr_expression *expr, in add_sub_expression() argument
391 ARRAY_APPEND(&expr->u.children, sub); in add_sub_expression()
451 struct cras_expr_expression *expr = new_compound_expression(); in parse_one_expr() local
456 add_sub_expression(expr, next); in parse_one_expr()
460 cras_expr_expression_free(expr); in parse_one_expr()
465 return expr; in parse_one_expr()
510 const struct cras_expr_expression *expr, in dump_one_expression() argument
516 switch (expr->type) { in dump_one_expression()
522 dump_value(d, &expr->u.literal, indent + 2); in dump_one_expression()
526 expr->u.variable); in dump_one_expression()
530 FOR_ARRAY_ELEMENT(&expr->u.children, i, sub) { in dump_one_expression()
538 const struct cras_expr_expression *expr) in cras_expr_expression_dump() argument
540 dump_one_expression(d, expr, 0); in cras_expr_expression_dump()
543 void cras_expr_expression_free(struct cras_expr_expression *expr) in cras_expr_expression_free() argument
545 if (!expr) in cras_expr_expression_free()
548 switch (expr->type) { in cras_expr_expression_free()
552 cras_expr_value_free(&expr->u.literal); in cras_expr_expression_free()
555 free((char *)expr->u.variable); in cras_expr_expression_free()
561 FOR_ARRAY_ELEMENT(&expr->u.children, i, psub) { in cras_expr_expression_free()
564 ARRAY_FREE(&expr->u.children); in cras_expr_expression_free()
568 free(expr); in cras_expr_expression_free()
571 void cras_expr_expression_eval(struct cras_expr_expression *expr, in cras_expr_expression_eval() argument
577 switch (expr->type) { in cras_expr_expression_eval()
581 copy_value(result, &expr->u.literal); in cras_expr_expression_eval()
586 expr->u.variable); in cras_expr_expression_eval()
589 expr->u.variable); in cras_expr_expression_eval()
602 FOR_ARRAY_ELEMENT(&expr->u.children, i, psub) { in cras_expr_expression_eval()
628 int cras_expr_expression_eval_int(struct cras_expr_expression *expr, in cras_expr_expression_eval_int() argument
635 cras_expr_expression_eval(expr, env, &value); in cras_expr_expression_eval_int()
646 int cras_expr_expression_eval_boolean(struct cras_expr_expression *expr, in cras_expr_expression_eval_boolean() argument
653 cras_expr_expression_eval(expr, env, &value); in cras_expr_expression_eval_boolean()