Finished the norm in stdme normal code
This commit is contained in:
parent
3cfbf07882
commit
5bc68504f9
19 changed files with 44 additions and 325 deletions
|
|
@ -6,12 +6,13 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/26 15:14:50 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/30 14:07:29 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/07/30 16:31:20 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "./arith.h"
|
||||
#include "exec/arith.h"
|
||||
#include "me/types.h"
|
||||
#include "me/convert/str_to_numbers.h"
|
||||
|
||||
/// ADD OPERATOR STUFF
|
||||
t_error _binary_get_op(t_ast_arithmetic_operator op, t_arith_op_func *out)
|
||||
|
|
@ -100,17 +101,6 @@ t_ast_node _arith_postfix_to_ast_node(t_ast_arithmetic_postfix *self)
|
|||
struct s_ast_node, data.arithmetic_postfix)));
|
||||
}
|
||||
|
||||
/*
|
||||
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)));
|
||||
}
|
||||
*/
|
||||
|
||||
// this is black magic don't worry
|
||||
t_ast_node _arith_literal_to_ast_node(t_ast_arithmetic_literal *self)
|
||||
{
|
||||
|
|
@ -182,7 +172,6 @@ t_error run_arithmetic_binary(t_ast_arithmetic_binary *arithmetic_binary, \
|
|||
t_error run_arithmetic_ternary(t_ast_arithmetic_ternary *arithmetic_ternary, \
|
||||
t_state *state, t_i64 *out)
|
||||
{
|
||||
t_arith_op_func func;
|
||||
t_i64 cond;
|
||||
|
||||
if (arithmetic_ternary == NULL || state == NULL || out == NULL)
|
||||
|
|
@ -234,11 +223,7 @@ t_ast_arithmetic_unary *arithmetic_unary, t_state *state, t_i64 *out)
|
|||
t_error run_arithmetic_expansion( \
|
||||
t_ast_arithmetic_expansion *arithmetic_expansion, t_state *state, t_i64 *out)
|
||||
{
|
||||
t_arith_op_func func;
|
||||
|
||||
if (arithmetic_expansion == NULL || state == NULL || out == NULL)
|
||||
return (ERROR);
|
||||
if (_get_node_number(arithmetic_expansion->expr, state, out))
|
||||
return (ERROR);
|
||||
return (NO_ERROR);
|
||||
return (_get_node_number(arithmetic_expansion->expr, state, out));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* arith.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/27 21:13:15 by rparodi #+# #+# */
|
||||
/* Updated: 2024/07/30 14:07:41 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ARITH_H
|
||||
# define ARITH_H
|
||||
|
||||
# include <stddef.h>
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
|
||||
# include "app/state.h"
|
||||
# include "ast/ast.h"
|
||||
# include "exec/run.h"
|
||||
# include "me/convert/numbers_to_str.h"
|
||||
# include "me/convert/str_to_numbers.h"
|
||||
# include "me/hashmap/hashmap_env.h"
|
||||
# include "me/mem/mem.h"
|
||||
# include "me/os/pipe.h"
|
||||
# include "me/os/process.h"
|
||||
# include "me/str/str.h"
|
||||
# include "me/string/string.h"
|
||||
# include "me/types.h"
|
||||
# include "me/vec/vec_estr.h"
|
||||
# include "me/vec/vec_str.h"
|
||||
|
||||
typedef t_error (*t_arith_op_func)(t_ast_node self, t_state *state, t_i64 *out);
|
||||
|
||||
t_error run_arithmetic_binary( \
|
||||
t_ast_arithmetic_binary *arithmetic_binary, t_state *state, t_i64 *out);
|
||||
t_error run_arithmetic_literal( \
|
||||
t_ast_arithmetic_literal *arithmetic_literal, t_state *state, t_i64 *out);
|
||||
t_error run_arithmetic_postfix( \
|
||||
t_ast_arithmetic_postfix *arithmetic_postfix, t_state *state, t_i64 *out);
|
||||
t_error run_arithmetic_ternary( \
|
||||
t_ast_arithmetic_ternary *arithmetic_ternary, t_state *state, t_i64 *out);
|
||||
t_error run_arithmetic_unary( \
|
||||
t_ast_arithmetic_unary *arithmetic_unary, t_state *state, t_i64 *out);
|
||||
t_error run_arithmetic_expansion( \
|
||||
t_ast_arithmetic_expansion *arithmetic_expansion, t_state *state, t_i64 *out);
|
||||
|
||||
t_error _get_node_number(t_ast_node self, t_state *state, t_i64 *out);
|
||||
|
||||
t_error _binary_op_add(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _binary_op_sub(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _binary_op_mul(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _binary_op_div(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _binary_op_mod(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _postfix_op_inc(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _postfix_op_dec(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _unary_op_plus(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_error _unary_op_minus(t_ast_node self, t_state *state, t_i64 *out);
|
||||
t_ast_node _arith_binary_to_ast_node(t_ast_arithmetic_binary *self);
|
||||
|
||||
#endif
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "./arith.h"
|
||||
#include "exec/arith.h"
|
||||
|
||||
t_error _binary_op_add(t_ast_node self, t_state *state, t_i64 *out)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/01/04 22:27:00 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/30 14:53:11 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/30 16:03:43 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
#include "exec/spawn_cmd/process.h"
|
||||
#include "me/types.h"
|
||||
|
||||
t_error handle_redirections(t_spawn_info *info, t_process *process)
|
||||
t_error handle_redirections(t_exec_spawn_info *info, t_exec_process *process)
|
||||
{
|
||||
return (ERROR);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue