Editing the protoype of the funcs (arith)

This commit is contained in:
Raphael (rparodi) 2024-07-30 13:17:40 +02:00
parent ab8b8a77bb
commit d9999a85d9
2 changed files with 40 additions and 2 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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)
{

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <stddef.h>
# include <stdio.h>
# include <unistd.h>
# include "app/state.h"
# include "ast/ast.h"