diff --git a/Filelist.sh.mk b/Filelist.sh.mk index 91b48ec4..9b920b0b 100644 --- a/Filelist.sh.mk +++ b/Filelist.sh.mk @@ -1,8 +1,8 @@ SRC_FILES = \ -_env_norm_helper \ -_helper_main \ env \ +_env_norm_helper \ ft_exit \ +_helper_main \ main \ signal_handler \ diff --git a/Makefile b/Makefile index 4be758a0..24b6d1b1 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,6 @@ ifeq ($(shell uname), Darwin) endif endif -# TODO: ADD THIS WHEN FINISHING THIS: CFLAGS_ADDITIONAL += -DNVALGRIND # TODO: REMOVE THIS WHEN FINISHING THIS: @@ -130,7 +129,6 @@ re: header tokei: /bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh' - build_filelist: @$(MAKE) --no-print-directory -C ./stdme/ build_filelist @$(MAKE) --no-print-directory -C ./allocator/ build_filelist @@ -139,7 +137,6 @@ build_filelist: @$(MAKE) --no-print-directory -C ./line/ build_filelist @$(MAKE) --no-print-directory -C ./parser/ build_filelist @$(MAKE) --no-print-directory -f ./Minishell.mk build_filelist - @$(MAKE) --no-print-directory -C test ./Test.mk build_filelist - + # phony .PHONY: all bonus clean fclean re header footer build_filelist diff --git a/allocator/Filelist.aq.mk b/allocator/Filelist.aq.mk index ead60e1c..63698d77 100644 --- a/allocator/Filelist.aq.mk +++ b/allocator/Filelist.aq.mk @@ -9,11 +9,11 @@ me_alloc/merge_blocks \ me_alloc/pages \ me_alloc/realloc \ vg/dummy_block \ -vg/dummy_mem_status \ vg/dummy_mempool \ vg/dummy_mempool_bis \ +vg/dummy_mem_status \ vg/valgrind_block \ -vg/valgrind_mem_status \ vg/valgrind_mempool \ vg/valgrind_mempool_bis \ +vg/valgrind_mem_status \ diff --git a/exec/Filelist.exec.mk b/exec/Filelist.exec.mk index 0e672409..57752618 100644 --- a/exec/Filelist.exec.mk +++ b/exec/Filelist.exec.mk @@ -1,19 +1,19 @@ SRC_FILES = \ -_read_dir \ -builtins/_debug \ builtins/cd \ +builtins/_debug \ builtins/echo \ builtins/env \ builtins/exit \ builtins/export \ builtins/pwd \ builtins/unset \ -run_arithmetic/_get_op \ -run_arithmetic/_run_arith \ -run_arithmetic/_to_ast_node \ +_read_dir \ run_arithmetic/arithmetic \ run_arithmetic/arithmetic_operation \ +run_arithmetic/_get_op \ run_arithmetic/operator_bis \ +run_arithmetic/_run_arith \ +run_arithmetic/_to_ast_node \ run_ast/_ast_into_str \ run_ast/_ast_into_str2 \ run_ast/_ast_into_str3 \ @@ -21,21 +21,21 @@ run_ast/_ast_into_str4 \ run_ast/_ast_into_str5 \ run_ast/_ast_into_str6 \ run_ast/_get_pid \ -run_ast/_run_exit_code \ -run_ast/_run_exp_operators \ -run_ast/_spawn_cmd \ -run_ast/_spawn_cmd_redir_fd \ -run_ast/_spawn_cmd_redir_heredoc \ run_ast/run_builtins \ run_ast/run_builtins2 \ run_ast/run_cmd_sub \ run_ast/run_command \ +run_ast/_run_exit_code \ run_ast/run_expansion \ run_ast/run_expansion_builtin \ +run_ast/_run_exp_operators \ run_ast/run_list \ run_ast/run_pipeline \ run_ast/run_pipeline_helper \ run_ast/run_program \ run_ast/run_subshell \ run_ast/run_words \ +run_ast/_spawn_cmd \ +run_ast/_spawn_cmd_redir_fd \ +run_ast/_spawn_cmd_redir_heredoc \ diff --git a/line/Filelist.line.mk b/line/Filelist.line.mk index 4d84cc2e..2c93bfb5 100644 --- a/line/Filelist.line.mk +++ b/line/Filelist.line.mk @@ -2,11 +2,11 @@ SRC_FILES = \ line \ line_edit_actions \ line_edit_actions2 \ +line_editing \ +line_editing2 \ line_edit_mode \ line_edit_mode_interal \ line_edit_mode_specific_key \ -line_editing \ -line_editing2 \ line_globals \ line_history \ line_internals \ diff --git a/parser/Filelist.parser.mk b/parser/Filelist.parser.mk index 2ff18ebf..6509fd1c 100644 --- a/parser/Filelist.parser.mk +++ b/parser/Filelist.parser.mk @@ -14,11 +14,11 @@ passes/paren_to_nquote \ passes/remove_whitespace \ passes/split_double_paren \ passes/verify_invalid_tokens \ +tokenizer \ +tokenizer_utils \ token_lifetime \ token_name \ token_utils \ -tokenizer \ -tokenizer_utils \ ts_print \ yard/yard \ yard/yard_cmd \ diff --git a/stdme/Filelist.me.mk b/stdme/Filelist.me.mk index b7582c81..5b83a1f7 100644 --- a/stdme/Filelist.me.mk +++ b/stdme/Filelist.me.mk @@ -18,10 +18,10 @@ fs/fs_internal \ fs/getters \ fs/putfd \ gnl/get_next_line \ +hash/hasher \ hash/hash_signed \ hash/hash_str \ hash/hash_unsigned \ -hash/hasher \ hash/sip/sip13 \ hash/sip/sip_utils \ hash/sip/sip_utils2 \ @@ -69,6 +69,10 @@ printf/printf \ printf/printf_fd \ printf/printf_str \ printf/vprintf \ +string/mod \ +string/string_insert \ +string/string_remove \ +string/string_reserve \ str/str_clone \ str/str_compare \ str/str_find_chr \ @@ -85,10 +89,6 @@ str/str_n_find_str \ str/str_split \ str/str_substring \ str/str_trim \ -string/mod \ -string/string_insert \ -string/string_remove \ -string/string_reserve \ GEN_FILES = \ convert/i16_to_str \ diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index ee4c9268..00000000 --- a/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/test diff --git a/test/Filelist.test.mk b/test/Filelist.test.mk deleted file mode 100644 index 3bf076b3..00000000 --- a/test/Filelist.test.mk +++ /dev/null @@ -1,6 +0,0 @@ -SRC_FILES = \ -main \ - -GEN_FILES = \ - \ - diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index a5b60e98..00000000 --- a/test/Makefile +++ /dev/null @@ -1,145 +0,0 @@ -# **************************************************************************** #make -# # -# ::: :::::::: # -# Makefile :+: :+: :+: # -# +:+ +:+ +:+ # -# By: rparodi +#+ +:+ +#+ # -# +#+#+#+#+#+ +#+ # -# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/10/11 10:54:39 by maiboyer ### ########.fr # -# # -# **************************************************************************** # - -# Objdir -BUILD_DIR = $(shell realpath ../build/test) -BASE_PATH = $(shell pwd) - -# Colors -GREEN = \033[32m -CYAN = \033[36m -GREY = \033[0;90m -RED = \033[0;31m -GOLD = \033[38;5;220m -END = \033[0m -BOLD = \033[1m -ITALIC = \033[3m -UNDERLINE = \033[4m - -# Rules -SRC_DIR = ./sources -GEN_DIR = ./output -NAME = minishell - -# PMAKE_DISABLE = -PMAKE = -ifndef PMAKE_DISABLE -ifeq ($(shell uname), Linux) - PMAKE = -j$(shell grep -c ^processor /proc/cpuinfo) - #CFLAGS_ADDITIONAL += -DPRINT_BACKTRACE -endif -ifeq ($(shell uname), Darwin) - PMAKE = -j$(shell sysctl -n hw.ncpu) - #CFLAGS_ADDITIONAL += -DNVALGRIND -endif -endif - -# TODO: ADD THIS WHEN FINISHING THIS: -# CFLAGS_ADDITIONAL += -DNVALGRIND - -# TODO: REMOVE THIS WHEN FINISHING THIS: -# CFLAGS_ADDITIONAL += -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins #-fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--allow-multiple -# CFLAGS_ADDITIONAL += -O0 -# CFLAGS_ADDITIONAL += -Wno-cpp -Wno-type-limits -Wno-unused-command-line-argument - CFLAGS_ADDITIONAL += -gcolumn-info -g3 -fno-builtin - CFLAGS_ADDITIONAL += '-DERROR=((void)printf("ERROR HERE: " __FILE__ ":%d in %s\n", __LINE__, __func__), 1)' -CFLAGS_ADDITIONAL += -O2 -# CFLAGS_ADDITIONAL += -fuse-ld=gold -Wl,--print-symbol-counts -Wl,/tmp/symbols_count.log -# CFLAGS_ADDITIONAL += -fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-O3 -# CFLAGS_ADDITIONAL += -I$(shell realpath ./includes) -I$(shell realpath ./output/include) - -export CFLAGS_ADDITIONAL -export CC -export BASE_PATH -export BUILD_DIR - - -# All (make all) -all: - @$(MAKE) --no-print-directory header - @$(MAKE) --no-print-directory -f ./Test.mk $(PMAKE) - @$(MAKE) --no-print-directory footer - -bonus: - @$(MAKE) --no-print-directory header - @$(MAKE) --no-print-directory -f ./Test.mk $(PMAKE) bonus - @$(MAKE) --no-print-directory footer - -# Header -header: - @clear - @echo -e '' - @echo -e '$(GOLD) ******* ****** ******* $(END)' - @echo -e '$(GOLD) ****** *** ******* $(END)' - @echo -e '$(GOLD) ******* * ******* $(END)' - @echo -e '$(GOLD) ****** ******* $(END)' - @echo -e '$(GOLD) ******* ******* $(END)' - @echo -e '$(GOLD) ******************* ******* * $(END)' - @echo -e '$(GOLD) ******************* ******* *** $(END)' - @echo -e '$(GOLD) ****** ******* ****** $(END)' - @echo -e '$(GOLD) ****** $(END)' - @echo -e '$(GOLD) ****** $(END)' - @echo -e '$(GREY) Made by maiboyerlpb x rparodi$(END)' - -# Footer -footer: - @echo -e '$(GOLD) _ $(END)' - @echo -e '$(GOLD) | \ $(END)' - @echo -e '$(GOLD) | | $(END)' - @echo -e '$(GOLD) | | $(END)' - @echo -e '$(GOLD) |\ $(CYAN)$(BOLD)$(UNDERLINE)shcat$(END)$(GOLD) | | $(END)' - @echo -e '$(GOLD) /, ~\ / / $(END)' - @echo -e '$(GOLD) X `-.....-------./ / $(END)' - @echo -e '$(GOLD) ~-. ~ ~ | $(END)' - @echo -e '$(GOLD) \ / | $(END)' - @echo -e '$(GOLD) \ /_ ___\ / $(END)' - @echo -e '$(GOLD) | /\ ~~~~~ \ | $(END)' - @echo -e '$(GOLD) | | \ || | $(END)' - @echo -e '$(GOLD) | |\ \ || ) $(END)' - @echo -e '$(GOLD) (_/ (_/ ((_/ $(END)' - @echo -e ' $(GREY)The compilation is $(END)$(GOLD)finished$(END)' - @echo -e ' $(GREY)Have a good $(END)$(GOLD)correction$(END)' - - -# Clean (make clean) -clean: - @echo -e '$(GREY) Removing $(END)$(RED)Objects$(END)' - @echo -e '$(GREY) Removing $(END)$(RED)Objects Folder$(END)' - @$(RM) -r $(BUILD_DIR) - -# Clean (make fclean) -fclean: clean - @echo -e '$(GREY) Removing $(END)$(RED)Program$(END)' - @$(RM) $(NAME) - @echo "" - -# Restart (make re) -re: header - @$(MAKE) --no-print-directory fclean - @$(MAKE) --no-print-directory all - -tokei: - /bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh' - - -build_filelist: - @$(MAKE) --no-print-directory -C ../stdme/ build_filelist - @$(MAKE) --no-print-directory -C ../allocator/ build_filelist - @$(MAKE) --no-print-directory -C ../ast/ build_filelist - @$(MAKE) --no-print-directory -C ../exec/ build_filelist - @$(MAKE) --no-print-directory -C ../line/ build_filelist - @$(MAKE) --no-print-directory -C ../parser/ build_filelist - @$(MAKE) --no-print-directory -C .. -f ./Minishell.mk build_filelist - @$(MAKE) --no-print-directory -f ./Test.mk build_filelist - -# phony -.PHONY: all bonus clean fclean re header footer build_filelist diff --git a/test/Test.mk b/test/Test.mk deleted file mode 100644 index b2a7c94c..00000000 --- a/test/Test.mk +++ /dev/null @@ -1,107 +0,0 @@ -# **************************************************************************** # -# # -# ::: :::::::: # -# Test.mk :+: :+: :+: # -# +:+ +:+ +:+ # -# By: maiboyer +#+ +:+ +#+ # -# +#+#+#+#+#+ +#+ # -# Created: 2024/04/28 17:28:30 by maiboyer #+# #+# # -# Updated: 2024/10/11 10:55:07 by maiboyer ### ########.fr # -# # -# **************************************************************************** # - -# Functions - -link_group = -Wl,--start-group $(1) -Wl,--end-group - -# Variables -ANAME = test -BUILD_DIR ?= $(shell realpath ../build/test) -NAME = test - -CFLAGS_ADDITIONAL += -DBONUS=1 - -export CFLAGS_ADDITIONAL -export CC -export BASE_PATH -export BUILD_DIR - -# Flags -CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -MMD -I../includes -I./output/include -I./stdme/output/include -rdynamic -Wl,-E -CFLAGS += $(CFLAGS_ADDITIONAL) - - -SRC_DIR = src -GEN_DIR = output - --include Filelist.$(ANAME).mk - -SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES))) -OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES))) -DEP = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES))) - -# Commands -CC ?= clang -RM = rm -rf - -# Objects - -# Colors -GREEN = \033[32m -GREY = \033[0;90m -RED = \033[0;31m -GOLD = \033[38;5;220m -END = \033[0m - -.PHONY: all bonus build_filelist re clean fclean - -LIBS_NAMES = me aq ast parser line exec test -LIBS_FILES = $(addprefix $(BUILD_DIR)/, $(addsuffix .a, $(addprefix lib, $(LIBS_NAMES)))) -LIBS_FLAGS = $(addprefix -l, $(LIBS_NAMES)) - -all: - @$(MAKE) -C ../stdme/ "LIB_NAME=$(shell realpath ../stdme)/" libme.a - @$(MAKE) -C ../allocator/ "LIB_NAME=$(shell realpath ../allocator)/" libaq.a - @$(MAKE) -C ../ast/ "LIB_NAME=$(shell realpath ../ast)/" libast.a - @$(MAKE) -C ../exec/ "LIB_NAME=$(shell realpath ../exec)/" libexec.a - @$(MAKE) -C ../line/ "LIB_NAME=$(shell realpath ../line)/" libline.a - @$(MAKE) -C ../parser/ "LIB_NAME=$(shell realpath ../parser)/" libparser.a - @$(MAKE) -f ./Test.mk $(NAME) - -bonus: all - -# Dependences for all -$(NAME): $(LIBS_FILES) - @echo -e '$(GREY) Linking \t$(END)$(GOLD)$(NAME)$(END)' - @$(CC) $(CFLAGS) -o $(NAME) -L$(BUILD_DIR) $(call link_group,$(LIBS_FLAGS)) - -lib$(ANAME).a: $(BUILD_DIR)/lib$(ANAME).a - -$(BUILD_DIR)/lib$(ANAME).a: $(OBJ) - @ar rcs $(BUILD_DIR)/lib$(ANAME).a $(OBJ) - - -# Creating the objects -$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c - @mkdir -p $(dir $@) - @echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)' - @$(CC) $(CFLAGS) -o $@ -c $< - -$(BUILD_DIR)/$(ANAME)/%.o: $(GEN_DIR)/%.c - @mkdir -p $(dir $@) - @echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)' - @$(CC) $(CFLAGS) -o $@ -c $< - -build_filelist: - @rm -f Filelist.$(ANAME).mk - @printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk - @tree $(SRC_DIR) -ifF | rg '$(SRC_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk - @echo "" >> Filelist.$(ANAME).mk - @printf '%-78s\\\n' "GEN_FILES =" >> Filelist.$(ANAME).mk - @tree $(GEN_DIR) -ifF | rg '$(GEN_DIR)/(.*)\.c$$' --replace '$$1' | sed -re 's/^(.*)_([0-9]+)$$/\1|\2/g' | sort -t'|' --key=1,1 --key=2,2n | sed -e's/|/_/' | xargs printf '%-78s\\\n' >> Filelist.$(ANAME).mk - @echo "" >> Filelist.$(ANAME).mk - @echo -e '$(GREY) Populating $(GREEN) Filelist.$(ANAME).mk$(END)' - -%.h: ; - --include $(DEP) diff --git a/test/src/main.c b/test/src/main.c deleted file mode 100644 index 282a5b85..00000000 --- a/test/src/main.c +++ /dev/null @@ -1,42 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* main.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: maiboyer +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/10/11 10:56:02 by maiboyer #+# #+# */ -/* Updated: 2024/10/12 17:52:50 by rparodi ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "me/convert/numbers_to_str.h" -#include "me/mem/mem.h" -#include "me/types.h" -#include -#include - -t_error _format_u64(t_num_str args, t_str *out); -//if (_format_u64((t_num_str){.value = tmp, .is_nonnegative = false, .base -//= "0123456789ABCDEF", .prefix = ""}, &str)) -// continue; - -int main(int argc, char *argv[]) -{ - t_usize i; - t_u64 tmp; - t_str str; - - (void)(argc--); - (void)(argv++); - i = 0; - while (i < (t_usize)argc) - { - tmp = atoll(argv[i++]); - if (u64_to_str(tmp, &str)) - continue ; - printf("%lu -> %s\n", tmp, str); - mem_free(str); - } - return (0); -}