From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- 42sh/src/exec/ast_eval.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 42sh/src/exec/ast_eval.h (limited to '42sh/src/exec/ast_eval.h') diff --git a/42sh/src/exec/ast_eval.h b/42sh/src/exec/ast_eval.h new file mode 100644 index 0000000..785df5a --- /dev/null +++ b/42sh/src/exec/ast_eval.h @@ -0,0 +1,24 @@ +#ifndef AST_EVAL_H +#define AST_EVAL_H + +#include "ast/ast.h" + +/** + * @brief Shell true value, this is not the builtin true. + */ +#define SHELL_TRUE 0 + +/** + * @brief Shell false value, this is not the builtin false. + */ +#define SHELL_FALSE 1 + +/** + * @brief Returns the exit code of the given AST. + * @param ast The AST to evaluate. It is given as a `struct ast*` + * and uses an inheritance-like principle. + * An AST can be of any type from the `enum ast_node`. + */ +int eval_ast(struct ast *ast); + +#endif /* ! AST_EVAL_H */ -- cgit v1.2.3