diff --git a/exec/src/arith/arith.c b/exec/src/arith/arith.c index 21093347..12e55744 100644 --- a/exec/src/arith/arith.c +++ b/exec/src/arith/arith.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/26 15:14:50 by maiboyer #+# #+# */ -/* Updated: 2024/07/29 17:50:51 by rparodi ### ########.fr */ +/* Updated: 2024/07/30 13:17:25 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,6 +71,42 @@ t_ast_node _arith_binary_to_ast_node(t_ast_arithmetic_binary *self) struct s_ast_node, data.arithmetic_binary))); } +t_ast_node _arith_ternary_to_ast_node(t_ast_arithmetic_ternary *self) +{ + t_u8 *ptr; + + ptr = (void *)(self); + return ((void *)(ptr - offsetof(\ + struct s_ast_node, data.arithmetic_ternary))); +} + +t_ast_node _arith_unary_to_ast_node(t_ast_arithmetic_unary *self) +{ + t_u8 *ptr; + + ptr = (void *)(self); + return ((void *)(ptr - offsetof(\ + struct s_ast_node, data.arithmetic_unary))); +} + +t_ast_node _arith_postfix_to_ast_node(t_ast_arithmetic_postfix *self) +{ + t_u8 *ptr; + + ptr = (void *)(self); + return ((void *)(ptr - offsetof(\ + struct s_ast_node, data.arithmetic_postfix))); +} + +t_ast_node _arith_expansion_to_ast_node(t_ast_arithmetic_postfix *self) +{ + t_u8 *ptr; + + ptr = (void *)(self); + return ((void *)(ptr - offsetof(\ + struct s_ast_node, data.arithmetic_expansion))); +} + // this is black magic don't worry t_ast_node _arith_literal_to_ast_node(t_ast_arithmetic_literal *self) { @@ -156,6 +192,7 @@ t_error run_arithmetic_ternary(t_ast_arithmetic_ternary *arithmetic_ternary, \ return (NO_ERROR); } + t_error run_arithmetic_postfix( \ t_ast_arithmetic_postfix *arithmetic_postfix, t_state *state, t_i64 *out) { diff --git a/exec/src/arith/arith.h b/exec/src/arith/arith.h index 9261054e..ef5930cc 100644 --- a/exec/src/arith/arith.h +++ b/exec/src/arith/arith.h @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/27 21:13:15 by rparodi #+# #+# */ -/* Updated: 2024/07/27 22:51:50 by rparodi ### ########.fr */ +/* Updated: 2024/07/30 11:59:09 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,6 +15,7 @@ # include # include +# include # include "app/state.h" # include "ast/ast.h"