From c3626fc59e04e465b802e47dea3ea86468485406 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Tue, 23 Jul 2024 22:04:11 +0000 Subject: [PATCH] Switched to Filelist..mk files --- .clangd | 9 ++ .gitignore | 1 + Filelist.sh.mk | 23 +++ Makefile | 26 ++-- Minishell.mk | 61 +++++--- allocator/Filelist.aq.mk | 19 +++ allocator/Makefile | 40 ++--- allocator/gen.list | 0 allocator/src.list | 17 -- ast/Filelist.ast.mk | 5 + ast/Makefile | 41 ++--- ast/gen.list | 0 ast/src.list | 3 - exec/Filelist.exec.mk | 3 + exec/Makefile | 38 ++--- exec/gen.list | 0 exec/src.list | 1 - gen.list | 9 -- line/Filelist.line.mk | 12 ++ line/Makefile | 43 ++--- line/gen.list | 0 line/src.list | 10 -- parser/{Filelist.mk => Filelist.gmr.mk} | 44 +++--- parser/Filelist.parser.mk | 20 +++ parser/Grammar.mk | 16 +- parser/Makefile | 9 +- parser/Parser.mk | 23 ++- src.list | 10 -- stdme/Filelist.me.mk | 147 ++++++++++++++++++ stdme/Makefile | 55 +++---- stdme/gen.list | 33 ---- .../convert/C__PREFIX___to_str.c__TEMPLATE__ | 2 +- stdme/input.toml | 9 ++ stdme/output/src/convert/i16_to_str.c | 2 +- stdme/output/src/convert/i32_to_str.c | 2 +- stdme/output/src/convert/i64_to_str.c | 2 +- stdme/output/src/convert/i8_to_str.c | 2 +- stdme/output/src/convert/u16_to_str.c | 2 +- stdme/output/src/convert/u32_to_str.c | 2 +- stdme/output/src/convert/u64_to_str.c | 2 +- stdme/output/src/convert/u8_to_str.c | 2 +- stdme/src.list | 110 ------------- 42 files changed, 456 insertions(+), 399 deletions(-) create mode 100644 Filelist.sh.mk create mode 100644 allocator/Filelist.aq.mk delete mode 100644 allocator/gen.list delete mode 100644 allocator/src.list create mode 100644 ast/Filelist.ast.mk delete mode 100644 ast/gen.list delete mode 100644 ast/src.list create mode 100644 exec/Filelist.exec.mk delete mode 100644 exec/gen.list delete mode 100644 exec/src.list delete mode 100644 gen.list create mode 100644 line/Filelist.line.mk delete mode 100644 line/gen.list delete mode 100644 line/src.list rename parser/{Filelist.mk => Filelist.gmr.mk} (100%) create mode 100644 parser/Filelist.parser.mk delete mode 100644 src.list create mode 100644 stdme/Filelist.me.mk delete mode 100644 stdme/gen.list delete mode 100644 stdme/src.list diff --git a/.clangd b/.clangd index c4d06340..2becfcff 100644 --- a/.clangd +++ b/.clangd @@ -14,6 +14,15 @@ CompileFlags: # Tweak the parse settings - "-I/home/maiboyer/Documents/ring-2/shcat/includes/" - "-I/home/maiboyer/Documents/ring-2/shcat/output/include/" - "-I/home/maiboyer/Documents/ring-2/shcat/generic_sources/header/" + - "-I/home/nixos/shcat/vendor/" + - "-I/home/nixos/shcat/stdme/include/" + - "-I/home/nixos/shcat/allocator/include/" + - "-I/home/nixos/shcat/stdme/vendor/" + - "-I/home/nixos/shcat/stdme/output/include/" + - "-I/home/nixos/shcat/stdme/generic_sources/header/" + - "-I/home/nixos/shcat/includes/" + - "-I/home/nixos/shcat/output/include/" + - "-I/home/nixos/shcat/generic_sources/header/" - "-I/home/maix/school/shcat/vendor/" - "-I/home/maix/school/shcat/stdme/include/" - "-I/home/maix/school/shcat/allocator/include/" diff --git a/.gitignore b/.gitignore index 518fe523..1ce7dd27 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,4 @@ parser/split_rust .tree-sitter-sh/src/parser.c .tree-sitter-sh/src/tree_sitter/ .tree-sitter-sh/src/node-types.json +.direnv diff --git a/Filelist.sh.mk b/Filelist.sh.mk new file mode 100644 index 00000000..1368e8cc --- /dev/null +++ b/Filelist.sh.mk @@ -0,0 +1,23 @@ +SRC_FILES = \ +env \ +ft_cmd \ +ft_echo \ +ft_exit \ +ft_pwd \ +main \ +node/node \ +operation/ft_classic_op \ +operation/ft_hard_op \ +signal_handler \ + +GEN_FILES = \ +src/hashmap/env/env \ +src/hashmap/env/env_iter \ +src/hashmap/env/env_utils \ +src/vec/ast/ast \ +src/vec/ast/ast_functions2 \ +src/vec/ast/ast_functions3 \ +src/vec/str/str \ +src/vec/str/str_functions2 \ +src/vec/str/str_functions3 \ + diff --git a/Makefile b/Makefile index 4bd904a2..8067dc57 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/07/17 17:05:25 by rparodi ### ########.fr # +# Updated: 2024/07/23 21:47:47 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -42,13 +42,13 @@ endif # All (make all) all: - @$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" - @$(MAKE) --no-print-directory -f./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) - @$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" + @$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" + @$(MAKE) --no-print-directory -f ./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" "" $(PMAKE) + @$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" bonus: @$(MAKE) --no-print-directory header "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" - @$(MAKE) --no-print-directory -f./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) bonus + @$(MAKE) --no-print-directory -f ./Minishell.mk "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" $(PMAKE) bonus @$(MAKE) --no-print-directory footer "BUILD_DIR=$(BUILD_DIR)" "BASE_PATH=$(shell pwd)" # Header @@ -107,8 +107,16 @@ re: header tokei: /bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh' -generate_filelist: - @/usr/bin/env zsh -c "tree -iFf --noreport $(SRC_DIR) | rg '^$(SRC_DIR)/(.*\.c)\$$' --replace '\$$1' | sort -u" > ./src.list - @/usr/bin/env zsh -c "tree -iFf --noreport $(GEN_DIR) | rg '^$(GEN_DIR)/(.*\.c)\$$' --replace '\$$1' | sort -u" > ./gen.list + +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/ -f ./Grammar.mk build_filelist + @$(MAKE) --no-print-directory -C ./parser/ -f ./Parser.mk build_filelist + @$(MAKE) --no-print-directory -f ./Minishell.mk build_filelist + # phony -.PHONY: all bonus clean fclean re header footer generate_filelist +.PHONY: all bonus clean fclean re header footer build_filelist diff --git a/Minishell.mk b/Minishell.mk index 84d85851..812754cf 100644 --- a/Minishell.mk +++ b/Minishell.mk @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/04/28 17:28:30 by maiboyer #+# #+# # -# Updated: 2024/07/11 17:14:34 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:54:12 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -15,27 +15,24 @@ link_group = -Wl,--start-group $(1) -Wl,--end-group # Variables - +ANAME = sh BUILD_DIR ?= $(shell realpath ./build/) +# TODO: ADD THIS WHEN FINISHING THIS: +# CFLAGS_ADDITIONAL = -DNVALGRIND + # Flags CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -g3 -MMD -I./includes -I./output/include -I./stdme/output/include -rdynamic -Wl,-E -# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -# Sources -# LIB = ./libft/ft_bzero.c \ -# ./libft/ft_calloc.c \ -# ./libft/ft_memset.c \ -# ./libft/ft_split.c \ -# ./libft/ft_strcmp.c \ -# ./libft/ft_strdup.c \ -# ./libft/ft_strlcpy.c \ -# ./libft/ft_strjoin.c \ -# ./libft/ft_strlen.c +CFLAGS += $(CFLAGS_ADDITIONAL) SRC_DIR = sources GEN_DIR = output -SRC = $(addprefix $(SRC_DIR)/,$(shell cat ./src.list)) $(addprefix $(GEN_DIR)/,$(shell cat ./gen.list)) +-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))) NAME = minishell # Commands @@ -43,7 +40,6 @@ CC ?= clang RM = rm -rf # Objects -OBJ = $(addprefix $(BUILD_DIR)/sh/,$(SRC:.c=.o)) # Colors GREEN = \033[32m @@ -52,20 +48,20 @@ RED = \033[0;31m GOLD = \033[38;5;220m END = \033[0m -.PHONY: all Bonus +.PHONY: all bonus build_filelist re clean fclean LIBS_NAMES = me gmr aq ast parser line exec 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)/" "BUILD_DIR=$(BUILD_DIR)" libme.a - @$(MAKE) -C ./allocator/ "LIB_NAME=$(shell realpath ./allocator)/" "BUILD_DIR=$(BUILD_DIR)" libaq.a - @$(MAKE) -C ./ast/ "LIB_NAME=$(shell realpath ./ast)/" "BUILD_DIR=$(BUILD_DIR)" libast.a - @$(MAKE) -C ./exec/ "LIB_NAME=$(shell realpath ./exec)/" "BUILD_DIR=$(BUILD_DIR)" libexec.a - @$(MAKE) -C ./line/ "LIB_NAME=$(shell realpath ./line)/" "BUILD_DIR=$(BUILD_DIR)" libline.a - @$(MAKE) -C ./parser/ -f./Grammar.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" libgmr.a - @$(MAKE) -C ./parser/ -f./Parser.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" libparser.a + @$(MAKE) -C ./stdme/ "LIB_NAME=$(shell realpath ./stdme)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libme.a + @$(MAKE) -C ./allocator/ "LIB_NAME=$(shell realpath ./allocator)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libaq.a + @$(MAKE) -C ./ast/ "LIB_NAME=$(shell realpath ./ast)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libast.a + @$(MAKE) -C ./exec/ "LIB_NAME=$(shell realpath ./exec)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libexec.a + @$(MAKE) -C ./line/ "LIB_NAME=$(shell realpath ./line)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libline.a + @$(MAKE) -C ./parser/ -f ./Grammar.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libgmr.a + @$(MAKE) -C ./parser/ -f ./Parser.mk "LIB_NAME=$(shell realpath ./parser)/" "BUILD_DIR=$(BUILD_DIR)" "CFLAGS_ADDITIONAL=$(CFLAGS_ADDITIONAL)" libparser.a @$(MAKE) -f./Minishell.mk $(NAME) @@ -83,9 +79,24 @@ $(NAME): $(OBJ) $(LIBS_FILES) @$(CC) $(CFLAGS) -o $(NAME) $(OBJ) -L$(BUILD_DIR) $(call link_group,$(LIBS_FLAGS)) # Creating the objects -$(BUILD_DIR)/sh/%.o: %.c +$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)' @$(CC) $(CFLAGS) -o $@ -c $< --include ${OBJ:.o=.d} +$(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)" + +-include $(DEP) diff --git a/allocator/Filelist.aq.mk b/allocator/Filelist.aq.mk new file mode 100644 index 00000000..63698d77 --- /dev/null +++ b/allocator/Filelist.aq.mk @@ -0,0 +1,19 @@ +SRC_FILES = \ +lc_alloc/functions1 \ +lc_alloc/functions2 \ +me_alloc/find_block \ +me_alloc/functions1 \ +me_alloc/functions2 \ +me_alloc/internals \ +me_alloc/merge_blocks \ +me_alloc/pages \ +me_alloc/realloc \ +vg/dummy_block \ +vg/dummy_mempool \ +vg/dummy_mempool_bis \ +vg/dummy_mem_status \ +vg/valgrind_block \ +vg/valgrind_mempool \ +vg/valgrind_mempool_bis \ +vg/valgrind_mem_status \ + diff --git a/allocator/Makefile b/allocator/Makefile index fe22df2a..dbe079d9 100644 --- a/allocator/Makefile +++ b/allocator/Makefile @@ -6,36 +6,34 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/07/11 18:33:48 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:52:17 by maiboyer ### ########.fr # # # # **************************************************************************** # +ANAME = aq + BUILD_DIR ?= ../build SRC_DIR = src INCLUDE_DIR = include output/include ../stdme/include LIBS_DIR = . -GENERIC_DIR = output/src -GENERIC_INCLUDE = output/include BASE_PATH ?= $(shell pwd) -NAME = libaq.a +NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -CFLAGS += $(CFLAGS_ADD) +CFLAGS += $(CFLAGS_ADDITIONAL) -BONUS_FILES = LIBS_NAME = SUBJECT_URL = -SRC_FILES = $(shell cat src.list) +-include Filelist.$(ANAME).mk SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) -OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/aq/,$(SRC_FILES))) -DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/aq/,$(SRC_FILES))) +OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) +DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME)) INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P)))) @@ -46,10 +44,6 @@ COL_GREEN = \033[32m COL_RESET = \033[0m COL_WHITE = \033[37m -# TODO: REMOVE FOR RENDU !!!!! -CFLAGS += -DPRINT_BACKTRACE - - .PHONY = all bonus clean re subject all: $(NAME) @@ -60,15 +54,10 @@ $(TARGET): $(OBJ) @echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)' @ar rcs $(BUILD_DIR)/$(NAME) $(OBJ) -$(BUILD_DIR)/aq/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ - -$(BUILD_DIR)/aq/%.o: $(GENERIC_DIR)/%.c - @mkdir -p $(dir $@) - @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ + @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ clean: @- $(foreach LIB,$(LIBS), \ @@ -91,8 +80,11 @@ subject: subject.txt subject.txt: @curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt -generate_filelist:: - @/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list - @/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list +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 + @echo -e "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)" -include $(DEPS) diff --git a/allocator/gen.list b/allocator/gen.list deleted file mode 100644 index e69de29b..00000000 diff --git a/allocator/src.list b/allocator/src.list deleted file mode 100644 index 9df69ea2..00000000 --- a/allocator/src.list +++ /dev/null @@ -1,17 +0,0 @@ -lc_alloc/functions1 -lc_alloc/functions2 -me_alloc/find_block -me_alloc/functions1 -me_alloc/functions2 -me_alloc/internals -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/valgrind_block -vg/valgrind_mem_status -vg/valgrind_mempool -vg/valgrind_mempool_bis diff --git a/ast/Filelist.ast.mk b/ast/Filelist.ast.mk new file mode 100644 index 00000000..1b4a9b29 --- /dev/null +++ b/ast/Filelist.ast.mk @@ -0,0 +1,5 @@ +SRC_FILES = \ +from_node \ +not_done_function \ +print_ast \ + diff --git a/ast/Makefile b/ast/Makefile index 76e5a1b7..d1d409fa 100644 --- a/ast/Makefile +++ b/ast/Makefile @@ -6,10 +6,12 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/07/14 10:18:27 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:52:27 by maiboyer ### ########.fr # # # # **************************************************************************** # +ANAME = ast + BUILD_DIR ?= ../build SRC_DIR = src INCLUDE_DIR = include output/include ../includes ../output/include/ ../stdme/output/include/ @@ -19,22 +21,19 @@ GENERIC_INCLUDE = output/include BASE_PATH ?= $(shell pwd) -NAME = libast.a +NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -CFLAGS += -O2 -BONUS_FILES = -LIBS_NAME = -SUBJECT_URL = +CFLAGS += $(CFLAGS_ADDITIONAL) -SRC_FILES = $(shell cat src.list) + +-include Filelist.$(ANAME).mk SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) -OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/ast/,$(SRC_FILES))) -DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/ast/,$(SRC_FILES))) +OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) +DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME)) INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P)))) @@ -45,10 +44,6 @@ COL_GREEN = \033[32m COL_BOLD = \033[1m COL_RESET = \033[0m -# TODO: REMOVE FOR RENDU !!!!! -CFLAGS += -DPRINT_BACKTRACE - - .PHONY = all bonus clean re subject all: $(NAME) @@ -59,15 +54,10 @@ $(TARGET): $(OBJ) @echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)' @ar rcs $(BUILD_DIR)/$(NAME) $(OBJ) -$(BUILD_DIR)/ast/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ - -$(BUILD_DIR)/ast/%.o: $(GENERIC_DIR)/%.c - @mkdir -p $(dir $@) - @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ + @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ clean: @- $(foreach LIB,$(LIBS), \ @@ -90,8 +80,11 @@ subject: subject.txt subject.txt: @curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt -generate_filelist:: - @/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list - @/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list +build_filelist: + @rm -f Filelist.$(ANAME).mk + @printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk + @tree src -ifF | rg 'src/(.*)\.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 "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)" -include $(DEPS) diff --git a/ast/gen.list b/ast/gen.list deleted file mode 100644 index e69de29b..00000000 diff --git a/ast/src.list b/ast/src.list deleted file mode 100644 index 096cf66f..00000000 --- a/ast/src.list +++ /dev/null @@ -1,3 +0,0 @@ -from_node -not_done_function -print_ast diff --git a/exec/Filelist.exec.mk b/exec/Filelist.exec.mk new file mode 100644 index 00000000..a0924157 --- /dev/null +++ b/exec/Filelist.exec.mk @@ -0,0 +1,3 @@ +SRC_FILES = \ +run_ast \ + diff --git a/exec/Makefile b/exec/Makefile index 2fddd2b2..d93d521a 100644 --- a/exec/Makefile +++ b/exec/Makefile @@ -6,34 +6,30 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/07/14 10:18:49 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:52:40 by maiboyer ### ########.fr # # # # **************************************************************************** # +ANAME = exec + BUILD_DIR ?= ../build SRC_DIR = src INCLUDE_DIR = include/ output/include/ ../includes/ ../output/include/ ../stdme/output/include/ LIBS_DIR = . -GENERIC_DIR = output/src -GENERIC_INCLUDE = output/include - BASE_PATH ?= $(shell pwd) -NAME = libexec.a +NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -BONUS_FILES = -LIBS_NAME = -SUBJECT_URL = +CFLAGS = $(CFLAGS_ADDITIONAL) -SRC_FILES = $(shell cat src.list) +-include Filelist.$(ANAME).mk SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) -OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/exec/,$(SRC_FILES))) -DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/exec/,$(SRC_FILES))) +OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) +DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME)) INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P)))) @@ -44,8 +40,6 @@ COL_GREEN = \033[32m COL_RESET = \033[0m COL_WHITE = \033[37m -# TODO: REMOVE FOR RENDU !!!!! -CFLAGS += -DPRINT_BACKTRACE .PHONY = all bonus clean re subject @@ -58,12 +52,7 @@ $(TARGET): $(OBJ) @echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)' @ar rcs $(BUILD_DIR)/$(NAME) $(OBJ) -$(BUILD_DIR)/exec/%.o: $(SRC_DIR)/%.c - @mkdir -p $(dir $@) - @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ - -$(BUILD_DIR)/exec/%.o: $(GENERIC_DIR)/%.c +$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ @@ -89,8 +78,11 @@ subject: subject.txt subject.txt: @curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt -generate_filelist:: - @/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list - @/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list +build_filelist: + @rm -f Filelist.$(ANAME).mk + @printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk + @tree src -ifF | rg 'src/(.*)\.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 "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)" -include $(DEPS) diff --git a/exec/gen.list b/exec/gen.list deleted file mode 100644 index e69de29b..00000000 diff --git a/exec/src.list b/exec/src.list deleted file mode 100644 index 10cfe6fb..00000000 --- a/exec/src.list +++ /dev/null @@ -1 +0,0 @@ -run_ast diff --git a/gen.list b/gen.list deleted file mode 100644 index 51f9a169..00000000 --- a/gen.list +++ /dev/null @@ -1,9 +0,0 @@ -src/hashmap/env/env.c -src/hashmap/env/env_iter.c -src/hashmap/env/env_utils.c -src/vec/ast/ast.c -src/vec/ast/ast_functions2.c -src/vec/ast/ast_functions3.c -src/vec/str/str.c -src/vec/str/str_functions2.c -src/vec/str/str_functions3.c diff --git a/line/Filelist.line.mk b/line/Filelist.line.mk new file mode 100644 index 00000000..b1a79d04 --- /dev/null +++ b/line/Filelist.line.mk @@ -0,0 +1,12 @@ +SRC_FILES = \ +line \ +line_edit_actions \ +line_edit_actions2 \ +line_editing \ +line_editing2 \ +line_edit_mode \ +line_globals \ +line_history \ +line_internals \ +line_no_tty \ + diff --git a/line/Makefile b/line/Makefile index 35893a78..31e424c9 100644 --- a/line/Makefile +++ b/line/Makefile @@ -6,35 +6,30 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/07/05 17:57:25 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:53:05 by maiboyer ### ########.fr # # # # **************************************************************************** # +ANAME = line + BUILD_DIR ?= ../build SRC_DIR = src INCLUDE_DIR = include output/include ../includes ../output/include/ LIBS_DIR = . -GENERIC_DIR = output/src -GENERIC_INCLUDE = output/include - BASE_PATH ?= $(shell pwd) -NAME = libline.a +NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -# CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -CFLAGS += -O2 -BONUS_FILES = -LIBS_NAME = -SUBJECT_URL = +CFLAGS = $(CFLAGS_ADDITIONAL) -SRC_FILES = $(shell cat src.list) +-include Filelist.$(ANAME).mk SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) -OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/line/,$(SRC_FILES))) -DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/line/,$(SRC_FILES))) +OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) +DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME)) INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P)))) @@ -45,10 +40,6 @@ COL_GREEN = \033[32m COL_BOLD = \033[1m COL_RESET = \033[0m -# TODO: REMOVE FOR RENDU !!!!! -CFLAGS += -DPRINT_BACKTRACE - - .PHONY = all bonus clean re subject all: $(NAME) @@ -59,15 +50,10 @@ $(TARGET): $(OBJ) @echo -e '$(COL_GRAY) Linking \t$(COL_GOLD)$(TARGET)$(COL_RESET)' @ar rcs $(BUILD_DIR)/$(NAME) $(OBJ) -$(BUILD_DIR)/line/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ - -$(BUILD_DIR)/line/%.o: $(GENERIC_DIR)/%.c - @mkdir -p $(dir $@) - @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ + @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ clean: @- $(foreach LIB,$(LIBS), \ @@ -90,8 +76,11 @@ subject: subject.txt subject.txt: @curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt -generate_filelist:: - @/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list - @/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list +build_filelist: + @rm -f Filelist.$(ANAME).mk + @printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk + @tree src -ifF | rg 'src/(.*)\.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 "$(COL_GRAY) Populating $(COL_GREEN) Filelist.$(ANAME).mk$(END)" -include $(DEPS) diff --git a/line/gen.list b/line/gen.list deleted file mode 100644 index e69de29b..00000000 diff --git a/line/src.list b/line/src.list deleted file mode 100644 index f62acba4..00000000 --- a/line/src.list +++ /dev/null @@ -1,10 +0,0 @@ -line -line_edit_actions -line_edit_actions2 -line_edit_mode -line_editing -line_editing2 -line_globals -line_history -line_internals -line_no_tty diff --git a/parser/Filelist.mk b/parser/Filelist.gmr.mk similarity index 100% rename from parser/Filelist.mk rename to parser/Filelist.gmr.mk index 2b8b91b5..09b9dc53 100644 --- a/parser/Filelist.mk +++ b/parser/Filelist.gmr.mk @@ -114,6 +114,28 @@ primary_state_ids/primary_state_ids_18 \ primary_state_ids/primary_state_ids_19 \ primary_state_ids/primary_state_ids_20 \ primary_state_ids/primary_state_ids_21 \ +small_parse_table_map/small_parse_table_map_0 \ +small_parse_table_map/small_parse_table_map_1 \ +small_parse_table_map/small_parse_table_map_2 \ +small_parse_table_map/small_parse_table_map_3 \ +small_parse_table_map/small_parse_table_map_4 \ +small_parse_table_map/small_parse_table_map_5 \ +small_parse_table_map/small_parse_table_map_6 \ +small_parse_table_map/small_parse_table_map_7 \ +small_parse_table_map/small_parse_table_map_8 \ +small_parse_table_map/small_parse_table_map_9 \ +small_parse_table_map/small_parse_table_map_10 \ +small_parse_table_map/small_parse_table_map_11 \ +small_parse_table_map/small_parse_table_map_12 \ +small_parse_table_map/small_parse_table_map_13 \ +small_parse_table_map/small_parse_table_map_14 \ +small_parse_table_map/small_parse_table_map_15 \ +small_parse_table_map/small_parse_table_map_16 \ +small_parse_table_map/small_parse_table_map_17 \ +small_parse_table_map/small_parse_table_map_18 \ +small_parse_table_map/small_parse_table_map_19 \ +small_parse_table_map/small_parse_table_map_20 \ +small_parse_table_map/small_parse_table_map_21 \ small_parse_table/small_parse_table_0 \ small_parse_table/small_parse_table_1 \ small_parse_table/small_parse_table_2 \ @@ -946,28 +968,6 @@ small_parse_table/small_parse_table_828 \ small_parse_table/small_parse_table_829 \ small_parse_table/small_parse_table_830 \ small_parse_table/small_parse_table_831 \ -small_parse_table_map/small_parse_table_map_0 \ -small_parse_table_map/small_parse_table_map_1 \ -small_parse_table_map/small_parse_table_map_2 \ -small_parse_table_map/small_parse_table_map_3 \ -small_parse_table_map/small_parse_table_map_4 \ -small_parse_table_map/small_parse_table_map_5 \ -small_parse_table_map/small_parse_table_map_6 \ -small_parse_table_map/small_parse_table_map_7 \ -small_parse_table_map/small_parse_table_map_8 \ -small_parse_table_map/small_parse_table_map_9 \ -small_parse_table_map/small_parse_table_map_10 \ -small_parse_table_map/small_parse_table_map_11 \ -small_parse_table_map/small_parse_table_map_12 \ -small_parse_table_map/small_parse_table_map_13 \ -small_parse_table_map/small_parse_table_map_14 \ -small_parse_table_map/small_parse_table_map_15 \ -small_parse_table_map/small_parse_table_map_16 \ -small_parse_table_map/small_parse_table_map_17 \ -small_parse_table_map/small_parse_table_map_18 \ -small_parse_table_map/small_parse_table_map_19 \ -small_parse_table_map/small_parse_table_map_20 \ -small_parse_table_map/small_parse_table_map_21 \ symbols_metadata/symbols_metadata_0 \ symbols_metadata/symbols_metadata_1 \ symbols_names/symbols_names_0 \ diff --git a/parser/Filelist.parser.mk b/parser/Filelist.parser.mk new file mode 100644 index 00000000..b733da6e --- /dev/null +++ b/parser/Filelist.parser.mk @@ -0,0 +1,20 @@ +SRC_FILES = \ +create_language \ +input \ +language \ +length \ +lex \ +lexer \ +lib \ +node \ +parser \ +point \ +reduce_action \ +scanner \ +stack \ +subtree \ +tree \ + +GEN_FILES = \ + \ + diff --git a/parser/Grammar.mk b/parser/Grammar.mk index 5d8d0e7e..7a126cc9 100644 --- a/parser/Grammar.mk +++ b/parser/Grammar.mk @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/06/30 18:45:33 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:53:40 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -23,13 +23,10 @@ LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= cc CFLAGS = -Wall -Wextra -Werror -MMD -I./includes -I../includes -I../output/include -I../tree-sitter-sh/src +CFLAGS += $(CFLAGS_ADDITIONAL) #CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -include ./Filelist.mk - -#SRC_FILES = parser -#scanner -#parser +-include Filelist.$(ANAME).mk SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) @@ -76,4 +73,11 @@ re: @$(MAKE) --no-print-directory fclean @$(MAKE) --no-print-directory all +build_filelist: + @rm -f Filelist.$(ANAME).mk + @printf '%-78s\\\n' "SRC_FILES =" > Filelist.$(ANAME).mk + @tree static -ifF | rg 'static/(.*)\.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)" + -include $(DEPS) diff --git a/parser/Makefile b/parser/Makefile index cd0140fd..bcf8995c 100644 --- a/parser/Makefile +++ b/parser/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/06/09 19:14:28 by maiboyer ### ########.fr # +# Updated: 2024/07/23 20:58:57 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -23,9 +23,8 @@ libgmr.a: @$(MAKE) --no-print-directory -f Grammar.mk "LIB_NAME=$(shell realpath .)/" "BUILD_DIR=$(shell realpath $(BUILD_DIR))" libgmr.a build_filelist: - @rm Filelist.mk - @printf '%-78s\\\n' "SRC_FILES =" > Filelist.mk - @tree static -ifF | rg 'static/(.*)\.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.mk - @echo "" >> Filelist.mk + @$(MAKE) --no-print-directory -f Parser.mk build_filelist + @$(MAKE) --no-print-directory -f Grammar.mk build_filelist + .PHONY: all bonus clean fclean re libparser.a libgmr.a build_filelist diff --git a/parser/Parser.mk b/parser/Parser.mk index 0a9534f9..a300efa3 100644 --- a/parser/Parser.mk +++ b/parser/Parser.mk @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/06/30 16:23:47 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:53:53 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -22,12 +22,16 @@ LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= cc CFLAGS = -Wall -Wextra -Werror -MMD -I./includes -I../includes -I../output/include -g3 -I$(SRC_DIR) +CFLAGS += $(CFLAGS_ADDITIONAL) #CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope SRC_FILES = lib GEN_FILES = -SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) $(addsuffix .c,$(addprefix $(GEN_DIR)/,$(GEN_FILES))) +# TODO: change from only lib.c to filelist +#-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))) $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(GEN_FILES))) DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES))) $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(GEN_FILES))) @@ -54,6 +58,11 @@ $(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)' @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ +$(BUILD_DIR)/$(ANAME)/%.o: $(GEN_DIR)/%.c + @mkdir -p $(dir $@) + @echo -e '$(GREY) Building\t$(END)$(GREEN)$<$(END)' + @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + clean: @- $(foreach LIB,$(LIBS), \ make clean LIB_NAME=$(LIB)/ BUILD_DIR=$(realpath $(BUILD_DIR)) -C $(LIB) --no-print-directory || true;\ @@ -72,4 +81,14 @@ re: @$(MAKE) --no-print-directory fclean @$(MAKE) --no-print-directory all +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)" + -include $(DEPS) diff --git a/src.list b/src.list deleted file mode 100644 index 5e3c4f24..00000000 --- a/src.list +++ /dev/null @@ -1,10 +0,0 @@ -env.c -ft_cmd.c -ft_echo.c -ft_exit.c -ft_pwd.c -main.c -node/node.c -operation/ft_classic_op.c -operation/ft_hard_op.c -signal_handler.c diff --git a/stdme/Filelist.me.mk b/stdme/Filelist.me.mk new file mode 100644 index 00000000..38f2a870 --- /dev/null +++ b/stdme/Filelist.me.mk @@ -0,0 +1,147 @@ +SRC_FILES = \ +blx/blx \ +blx/blx_create_fontsheet \ +blx/blx_handlers \ +blx/blx_keycode \ +blx/colors \ +blx/draw/draw \ +blx/draw/draw_sprite \ +blx/draw/draw_string \ +blx/inputs \ +blx/logic \ +blx/sprite/draw_image \ +blx/sprite/draw_pixel_onto \ +blx/sprite/draw_string \ +blx/sprite/free_image \ +blx/sprite/get_pixel \ +blx/sprite/new_image \ +blx/sprite/sprite_draw_onto_sprite \ +char/isalnum \ +char/isalpha \ +char/isascii \ +char/isdigit \ +char/islower \ +char/isprint \ +char/isspace \ +char/isupper \ +char/tolower \ +char/toupper \ +convert/numbers_to_str \ +fs/close \ +fs/fs_internal \ +fs/open \ +fs/putchar_fd \ +fs/putendl_fd \ +fs/putnbr_fd \ +fs/putstr_fd \ +fs/read \ +fs/read_to_vec \ +fs/write \ +gnl/get_next_line \ +hash/hasher \ +hash/hash_signed \ +hash/hash_str \ +hash/hash_unsigned \ +hash/sip/sip13 \ +hash/sip/sip_utils \ +hash/sip/sip_utils2 \ +img/qoi/qoi_decode \ +img/qoi/qoi_encode \ +img/qoi/qoi_fs \ +img/qoi/qoi_utils \ +mem/allocator \ +mem/mem_alloc \ +mem/mem_alloc_array \ +mem/mem_compare \ +mem/mem_copy \ +mem/mem_find \ +mem/mem_find_bytes \ +mem/mem_move \ +mem/mem_realloc \ +mem/mem_set \ +mem/mem_set_zero \ +num/u16/rotate \ +num/u32/rotate \ +num/u64/from_bytes \ +num/u64/rotate \ +num/u8/rotate \ +num/usize/rotate \ +num/usize/round_up \ +os/abort \ +os/exit \ +os/pipe \ +os/process \ +os/process_inner \ +os/process_inner2 \ +printf/callbacks \ +printf/formatter/char \ +printf/formatter/decimal \ +printf/formatter/hex \ +printf/formatter/oct \ +printf/formatter/ptr \ +printf/formatter/unsigned_decimal \ +printf/formatter/utils \ +printf/formatter/utils2 \ +printf/formatter/utils3 \ +printf/formatter/utils_numbers \ +printf/matchers \ +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 \ +str/str_find_rev_chr \ +str/str_find_str \ +str/str_iter \ +str/str_join \ +str/str_l_cat \ +str/str_l_copy \ +str/str_len \ +str/str_map \ +str/str_n_compare \ +str/str_n_find_str \ +str/str_split \ +str/str_substring \ +str/str_trim \ + +GEN_FILES = \ +convert/i16_to_str \ +convert/i32_to_str \ +convert/i64_to_str \ +convert/i8_to_str \ +convert/str_to_i16 \ +convert/str_to_i16_utils \ +convert/str_to_i32 \ +convert/str_to_i32_utils \ +convert/str_to_i64 \ +convert/str_to_i64_utils \ +convert/str_to_i8 \ +convert/str_to_i8_utils \ +convert/str_to_u16 \ +convert/str_to_u16_utils \ +convert/str_to_u32 \ +convert/str_to_u32_utils \ +convert/str_to_u64 \ +convert/str_to_u64_utils \ +convert/str_to_u8 \ +convert/str_to_u8_utils \ +convert/u16_to_str \ +convert/u32_to_str \ +convert/u64_to_str \ +convert/u8_to_str \ +vec/buf_str/buf_str \ +vec/buf_str/buf_str_functions2 \ +vec/buf_str/buf_str_functions3 \ +vec/str/str \ +vec/str/str_functions2 \ +vec/str/str_functions3 \ +vec/u8/u8 \ +vec/u8/u8_functions2 \ +vec/u8/u8_functions3 \ + diff --git a/stdme/Makefile b/stdme/Makefile index 8279ba83..94f74068 100644 --- a/stdme/Makefile +++ b/stdme/Makefile @@ -6,18 +6,18 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/07/03 22:39:36 by maiboyer ### ########.fr # +# Updated: 2024/07/23 21:49:24 by maiboyer ### ########.fr # # # # **************************************************************************** # +ANAME = me - -BUILD_DIR ?= build +BUILD_DIR ?= ../build SRC_DIR = src INCLUDE_DIR = include output/include ../allocator/include LIBS_DIR = . -GENERIC_DIR = output/src -GENERIC_INCLUDE = output/include +GEN_DIR = output/src +GEN_INCLUDE = output/include BASE_PATH ?= $(shell pwd) @@ -26,24 +26,16 @@ LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -#CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-return=runtime -fno-common -fsanitize-address-use-after-scope -BONUS_FILES = -LIBS_NAME = -SUBJECT_URL = +CFLAGS += $(CFLAGS_ADDITIONAL) -GENERIC_FILES = $(shell cat gen.list) -SRC_FILES = $(shell cat src.list) +-include ./Filelist.$(ANAME).mk + +SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(GEN_FILES)) $(addprefix $(GEN_DIR)/,$(GEN_FILES))) +OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES))) +DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/$(ANAME)/,$(SRC_FILES) $(GEN_FILES))) -BONUS = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(BONUS_FILES))) -SRC = $(addsuffix .c,$(addprefix $(SRC_DIR)/,$(SRC_FILES))) \ - $(addsuffix .c,$(addprefix $(GENERIC_DIR)/,$(GENERIC_FILES))) -BONUS_OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/me/,$(BONUS_FILES))) -OBJ = $(addsuffix .o,$(addprefix $(BUILD_DIR)/me/,$(SRC_FILES) )) \ - $(addsuffix .o,$(addprefix $(BUILD_DIR)/me/,$(GENERIC_FILES))) -DEPS = $(addsuffix .d,$(addprefix $(BUILD_DIR)/me/,$(SRC_FILES))) \ - $(addsuffix .d,$(addprefix $(BUILD_DIR)/me/,$(GENERIC_FILES))) LIBS = $(addprefix $(LIBS_DIR)/,$(LIBS_NAME)) -INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(GENERIC_INCLUDE) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P)))) +INCLUDES = $(addprefix -I,$(foreach P,$(INCLUDE_DIR) $(GEN_INCLUDE) $(LIBS) $(addsuffix /include,$(LIBS)) vendor $(addsuffix /vendor,$(LIBS)),$(realpath $(P)))) COL_GRAY = \033[90m COL_WHITE = \033[37m COL_GREEN = \033[32m @@ -51,9 +43,6 @@ COL_BOLD = \033[1m COL_RESET = \033[0m COL_GOLD = \033[93m -# TODO: REMOVE FOR RENDU !!!!! -CFLAGS += -DPRINT_BACKTRACE - .PHONY = all bonus clean re subject @@ -66,15 +55,15 @@ $(TARGET): $(OBJ) @#$(CC) $(INCLUDES) $(OBJ) $(CFLAGS) -o $(NAME) @ar rcs $(BUILD_DIR)/$(NAME) $(OBJ) -$(BUILD_DIR)/me/%.o: $(SRC_DIR)/%.c +$(BUILD_DIR)/$(ANAME)/%.o: $(SRC_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ + @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ -$(BUILD_DIR)/me/%.o: $(GENERIC_DIR)/%.c +$(BUILD_DIR)/$(ANAME)/%.o: $(GEN_DIR)/%.c @mkdir -p $(dir $@) @echo -e '$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)' - @$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@ + @$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ clean: @- $(foreach LIB,$(LIBS), \ @@ -101,8 +90,14 @@ subject: subject.txt subject.txt: @curl $(SUBJECT_URL) | pdftotext -layout -nopgbrk -q - subject.txt -generate_filelist:: - @/usr/bin/env zsh -c "tree -iFf --noreport output | rg '^output/src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./gen.list - @/usr/bin/env zsh -c "tree -iFf --noreport src | rg '^src/(.*)\.c\$$' --replace '\$$1' | sort -u" > ./src.list + +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 -include $(DEPS) diff --git a/stdme/gen.list b/stdme/gen.list deleted file mode 100644 index cf0ab2a3..00000000 --- a/stdme/gen.list +++ /dev/null @@ -1,33 +0,0 @@ -convert/i16_to_str -convert/i32_to_str -convert/i64_to_str -convert/i8_to_str -convert/str_to_i16 -convert/str_to_i16_utils -convert/str_to_i32 -convert/str_to_i32_utils -convert/str_to_i64 -convert/str_to_i64_utils -convert/str_to_i8 -convert/str_to_i8_utils -convert/str_to_u16 -convert/str_to_u16_utils -convert/str_to_u32 -convert/str_to_u32_utils -convert/str_to_u64 -convert/str_to_u64_utils -convert/str_to_u8 -convert/str_to_u8_utils -convert/u16_to_str -convert/u32_to_str -convert/u64_to_str -convert/u8_to_str -vec/buf_str/buf_str -vec/buf_str/buf_str_functions2 -vec/buf_str/buf_str_functions3 -vec/str/str -vec/str/str_functions2 -vec/str/str_functions3 -vec/u8/u8 -vec/u8/u8_functions2 -vec/u8/u8_functions3 diff --git a/stdme/generic_sources/src/convert/C__PREFIX___to_str.c__TEMPLATE__ b/stdme/generic_sources/src/convert/C__PREFIX___to_str.c__TEMPLATE__ index fbfacccf..5e13debf 100644 --- a/stdme/generic_sources/src/convert/C__PREFIX___to_str.c__TEMPLATE__ +++ b/stdme/generic_sources/src/convert/C__PREFIX___to_str.c__TEMPLATE__ @@ -26,7 +26,7 @@ t_error C__PREFIX___to_str_base_prefix(C__TYPE__ val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.C__FIELD__ = val; - is_nonnegative = val < 0; + is_nonnegative = val & C__NEG__BITMASK__; if (is_nonnegative) value.C__UFIELD__ = ~value.C__UFIELD__ + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/input.toml b/stdme/input.toml index fbd6fbf4..64e09626 100644 --- a/stdme/input.toml +++ b/stdme/input.toml @@ -44,6 +44,7 @@ replace.C__TYPE__ = "type" replace.C__PREFIX__ = "prefix" replace.C__FIELD__ = "type" replace.C__UFIELD__ = "type" +replace.C__NEG__BITMASK__ = "value" [[create.num_to_str]] @@ -53,6 +54,7 @@ replace.C__TYPE__ = "t_i64" replace.C__UFIELD__ = "u64" replace.C__FIELD__ = "i64" replace.C__PREFIX__ = "i64" +replace.C__NEG__BITMASK__ = "0x8000000000000000" [[create.num_to_str]] sources_output = "src/convert/" @@ -61,6 +63,7 @@ replace.C__TYPE__ = "t_u64" replace.C__UFIELD__ = "u64" replace.C__FIELD__ = "u64" replace.C__PREFIX__ = "u64" +replace.C__NEG__BITMASK__ = "0x0000000000000000" [[create.num_to_str]] sources_output = "src/convert/" @@ -69,6 +72,7 @@ replace.C__TYPE__ = "t_i32" replace.C__UFIELD__ = "u32" replace.C__FIELD__ = "i32" replace.C__PREFIX__ = "i32" +replace.C__NEG__BITMASK__ = "0x80000000" [[create.num_to_str]] sources_output = "src/convert/" @@ -77,6 +81,7 @@ replace.C__TYPE__ = "t_u32" replace.C__UFIELD__ = "u32" replace.C__FIELD__ = "u32" replace.C__PREFIX__ = "u32" +replace.C__NEG__BITMASK__ = "0x00000000" [[create.num_to_str]] sources_output = "src/convert/" @@ -85,6 +90,7 @@ replace.C__TYPE__ = "t_i16" replace.C__UFIELD__ = "u16" replace.C__FIELD__ = "i16" replace.C__PREFIX__ = "i16" +replace.C__NEG__BITMASK__ = "0x8000" [[create.num_to_str]] sources_output = "src/convert/" @@ -93,6 +99,7 @@ replace.C__TYPE__ = "t_u16" replace.C__UFIELD__ = "u16" replace.C__FIELD__ = "u16" replace.C__PREFIX__ = "u16" +replace.C__NEG__BITMASK__ = "0x0000" [[create.num_to_str]] sources_output = "src/convert/" @@ -101,6 +108,7 @@ replace.C__TYPE__ = "t_i8" replace.C__UFIELD__ = "u8" replace.C__FIELD__ = "i8" replace.C__PREFIX__ = "i8" +replace.C__NEG__BITMASK__ = "0x80" [[create.num_to_str]] sources_output = "src/convert/" @@ -109,6 +117,7 @@ replace.C__TYPE__ = "t_u8" replace.C__UFIELD__ = "u8" replace.C__FIELD__ = "u8" replace.C__PREFIX__ = "u8" +replace.C__NEG__BITMASK__ = "0x00" [[create.str_to_num]] sources_output = "src/convert/" diff --git a/stdme/output/src/convert/i16_to_str.c b/stdme/output/src/convert/i16_to_str.c index 0b023d2a..ff545236 100644 --- a/stdme/output/src/convert/i16_to_str.c +++ b/stdme/output/src/convert/i16_to_str.c @@ -26,7 +26,7 @@ t_error i16_to_str_base_prefix(t_i16 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.i16 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x8000; if (is_nonnegative) value.u16 = ~value.u16 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/i32_to_str.c b/stdme/output/src/convert/i32_to_str.c index 88e0f5fa..c05a7851 100644 --- a/stdme/output/src/convert/i32_to_str.c +++ b/stdme/output/src/convert/i32_to_str.c @@ -26,7 +26,7 @@ t_error i32_to_str_base_prefix(t_i32 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.i32 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x80000000; if (is_nonnegative) value.u32 = ~value.u32 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/i64_to_str.c b/stdme/output/src/convert/i64_to_str.c index 066ed270..400f2f45 100644 --- a/stdme/output/src/convert/i64_to_str.c +++ b/stdme/output/src/convert/i64_to_str.c @@ -26,7 +26,7 @@ t_error i64_to_str_base_prefix(t_i64 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.i64 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x8000000000000000; if (is_nonnegative) value.u64 = ~value.u64 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/i8_to_str.c b/stdme/output/src/convert/i8_to_str.c index c49530b4..d2c6c1e2 100644 --- a/stdme/output/src/convert/i8_to_str.c +++ b/stdme/output/src/convert/i8_to_str.c @@ -26,7 +26,7 @@ t_error i8_to_str_base_prefix(t_i8 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.i8 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x80; if (is_nonnegative) value.u8 = ~value.u8 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/u16_to_str.c b/stdme/output/src/convert/u16_to_str.c index 6e345ebf..ed1c6ad2 100644 --- a/stdme/output/src/convert/u16_to_str.c +++ b/stdme/output/src/convert/u16_to_str.c @@ -26,7 +26,7 @@ t_error u16_to_str_base_prefix(t_u16 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.u16 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x0000; if (is_nonnegative) value.u16 = ~value.u16 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/u32_to_str.c b/stdme/output/src/convert/u32_to_str.c index fe7f2ca2..8819342d 100644 --- a/stdme/output/src/convert/u32_to_str.c +++ b/stdme/output/src/convert/u32_to_str.c @@ -26,7 +26,7 @@ t_error u32_to_str_base_prefix(t_u32 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.u32 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x00000000; if (is_nonnegative) value.u32 = ~value.u32 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/u64_to_str.c b/stdme/output/src/convert/u64_to_str.c index e793dd22..0a4d02e4 100644 --- a/stdme/output/src/convert/u64_to_str.c +++ b/stdme/output/src/convert/u64_to_str.c @@ -26,7 +26,7 @@ t_error u64_to_str_base_prefix(t_u64 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.u64 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x0000000000000000; if (is_nonnegative) value.u64 = ~value.u64 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/output/src/convert/u8_to_str.c b/stdme/output/src/convert/u8_to_str.c index a945130c..aecdb68b 100644 --- a/stdme/output/src/convert/u8_to_str.c +++ b/stdme/output/src/convert/u8_to_str.c @@ -26,7 +26,7 @@ t_error u8_to_str_base_prefix(t_u8 val, t_str base, t_str prefix, if (out == NULL || base == NULL || prefix == NULL) return (ERROR); value.u8 = val; - is_nonnegative = val < 0; + is_nonnegative = val & 0x00; if (is_nonnegative) value.u8 = ~value.u8 + 1; return (_format_u64((t_num_str){.value = value.u64, \ diff --git a/stdme/src.list b/stdme/src.list deleted file mode 100644 index f8010c57..00000000 --- a/stdme/src.list +++ /dev/null @@ -1,110 +0,0 @@ -blx/blx -blx/blx_create_fontsheet -blx/blx_handlers -blx/blx_keycode -blx/colors -blx/draw/draw -blx/draw/draw_sprite -blx/draw/draw_string -blx/inputs -blx/logic -blx/sprite/draw_image -blx/sprite/draw_pixel_onto -blx/sprite/draw_string -blx/sprite/free_image -blx/sprite/get_pixel -blx/sprite/new_image -blx/sprite/sprite_draw_onto_sprite -char/isalnum -char/isalpha -char/isascii -char/isdigit -char/islower -char/isprint -char/isspace -char/isupper -char/tolower -char/toupper -convert/numbers_to_str -fs/close -fs/fs_internal -fs/open -fs/putchar_fd -fs/putendl_fd -fs/putnbr_fd -fs/putstr_fd -fs/read -fs/read_to_vec -fs/write -gnl/get_next_line -hash/hash_signed -hash/hash_str -hash/hash_unsigned -hash/hasher -hash/sip/sip13 -hash/sip/sip_utils -hash/sip/sip_utils2 -img/qoi/qoi_decode -img/qoi/qoi_encode -img/qoi/qoi_fs -img/qoi/qoi_utils -mem/allocator -mem/mem_alloc -mem/mem_alloc_array -mem/mem_compare -mem/mem_copy -mem/mem_find -mem/mem_find_bytes -mem/mem_move -mem/mem_realloc -mem/mem_set -mem/mem_set_zero -num/u16/rotate -num/u32/rotate -num/u64/from_bytes -num/u64/rotate -num/u8/rotate -num/usize/rotate -num/usize/round_up -os/abort -os/exit -os/pipe -os/process -os/process_inner -os/process_inner2 -printf/callbacks -printf/formatter/char -printf/formatter/decimal -printf/formatter/hex -printf/formatter/oct -printf/formatter/ptr -printf/formatter/unsigned_decimal -printf/formatter/utils -printf/formatter/utils2 -printf/formatter/utils3 -printf/formatter/utils_numbers -printf/matchers -printf/printf -printf/printf_fd -printf/printf_str -printf/vprintf -str/str_clone -str/str_compare -str/str_find_chr -str/str_find_rev_chr -str/str_find_str -str/str_iter -str/str_join -str/str_l_cat -str/str_l_copy -str/str_len -str/str_map -str/str_n_compare -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