update: removed more stuff

This commit is contained in:
Maieul BOYER 2024-10-12 17:59:23 +02:00
parent e00f6da311
commit d550ffab53
No known key found for this signature in database
12 changed files with 24 additions and 328 deletions

View file

@ -1,8 +1,8 @@
SRC_FILES = \ SRC_FILES = \
_env_norm_helper \
_helper_main \
env \ env \
_env_norm_helper \
ft_exit \ ft_exit \
_helper_main \
main \ main \
signal_handler \ signal_handler \

View file

@ -43,7 +43,6 @@ ifeq ($(shell uname), Darwin)
endif endif
endif endif
# TODO: ADD THIS WHEN FINISHING THIS:
CFLAGS_ADDITIONAL += -DNVALGRIND CFLAGS_ADDITIONAL += -DNVALGRIND
# TODO: REMOVE THIS WHEN FINISHING THIS: # TODO: REMOVE THIS WHEN FINISHING THIS:
@ -130,7 +129,6 @@ re: header
tokei: tokei:
/bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh' /bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh'
build_filelist: build_filelist:
@$(MAKE) --no-print-directory -C ./stdme/ build_filelist @$(MAKE) --no-print-directory -C ./stdme/ build_filelist
@$(MAKE) --no-print-directory -C ./allocator/ 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 ./line/ build_filelist
@$(MAKE) --no-print-directory -C ./parser/ build_filelist @$(MAKE) --no-print-directory -C ./parser/ build_filelist
@$(MAKE) --no-print-directory -f ./Minishell.mk build_filelist @$(MAKE) --no-print-directory -f ./Minishell.mk build_filelist
@$(MAKE) --no-print-directory -C test ./Test.mk build_filelist
# phony # phony
.PHONY: all bonus clean fclean re header footer build_filelist .PHONY: all bonus clean fclean re header footer build_filelist

View file

@ -9,11 +9,11 @@ me_alloc/merge_blocks \
me_alloc/pages \ me_alloc/pages \
me_alloc/realloc \ me_alloc/realloc \
vg/dummy_block \ vg/dummy_block \
vg/dummy_mem_status \
vg/dummy_mempool \ vg/dummy_mempool \
vg/dummy_mempool_bis \ vg/dummy_mempool_bis \
vg/dummy_mem_status \
vg/valgrind_block \ vg/valgrind_block \
vg/valgrind_mem_status \
vg/valgrind_mempool \ vg/valgrind_mempool \
vg/valgrind_mempool_bis \ vg/valgrind_mempool_bis \
vg/valgrind_mem_status \

View file

@ -1,19 +1,19 @@
SRC_FILES = \ SRC_FILES = \
_read_dir \
builtins/_debug \
builtins/cd \ builtins/cd \
builtins/_debug \
builtins/echo \ builtins/echo \
builtins/env \ builtins/env \
builtins/exit \ builtins/exit \
builtins/export \ builtins/export \
builtins/pwd \ builtins/pwd \
builtins/unset \ builtins/unset \
run_arithmetic/_get_op \ _read_dir \
run_arithmetic/_run_arith \
run_arithmetic/_to_ast_node \
run_arithmetic/arithmetic \ run_arithmetic/arithmetic \
run_arithmetic/arithmetic_operation \ run_arithmetic/arithmetic_operation \
run_arithmetic/_get_op \
run_arithmetic/operator_bis \ run_arithmetic/operator_bis \
run_arithmetic/_run_arith \
run_arithmetic/_to_ast_node \
run_ast/_ast_into_str \ run_ast/_ast_into_str \
run_ast/_ast_into_str2 \ run_ast/_ast_into_str2 \
run_ast/_ast_into_str3 \ run_ast/_ast_into_str3 \
@ -21,21 +21,21 @@ run_ast/_ast_into_str4 \
run_ast/_ast_into_str5 \ run_ast/_ast_into_str5 \
run_ast/_ast_into_str6 \ run_ast/_ast_into_str6 \
run_ast/_get_pid \ 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_builtins \
run_ast/run_builtins2 \ run_ast/run_builtins2 \
run_ast/run_cmd_sub \ run_ast/run_cmd_sub \
run_ast/run_command \ run_ast/run_command \
run_ast/_run_exit_code \
run_ast/run_expansion \ run_ast/run_expansion \
run_ast/run_expansion_builtin \ run_ast/run_expansion_builtin \
run_ast/_run_exp_operators \
run_ast/run_list \ run_ast/run_list \
run_ast/run_pipeline \ run_ast/run_pipeline \
run_ast/run_pipeline_helper \ run_ast/run_pipeline_helper \
run_ast/run_program \ run_ast/run_program \
run_ast/run_subshell \ run_ast/run_subshell \
run_ast/run_words \ run_ast/run_words \
run_ast/_spawn_cmd \
run_ast/_spawn_cmd_redir_fd \
run_ast/_spawn_cmd_redir_heredoc \

View file

@ -2,11 +2,11 @@ SRC_FILES = \
line \ line \
line_edit_actions \ line_edit_actions \
line_edit_actions2 \ line_edit_actions2 \
line_editing \
line_editing2 \
line_edit_mode \ line_edit_mode \
line_edit_mode_interal \ line_edit_mode_interal \
line_edit_mode_specific_key \ line_edit_mode_specific_key \
line_editing \
line_editing2 \
line_globals \ line_globals \
line_history \ line_history \
line_internals \ line_internals \

View file

@ -14,11 +14,11 @@ passes/paren_to_nquote \
passes/remove_whitespace \ passes/remove_whitespace \
passes/split_double_paren \ passes/split_double_paren \
passes/verify_invalid_tokens \ passes/verify_invalid_tokens \
tokenizer \
tokenizer_utils \
token_lifetime \ token_lifetime \
token_name \ token_name \
token_utils \ token_utils \
tokenizer \
tokenizer_utils \
ts_print \ ts_print \
yard/yard \ yard/yard \
yard/yard_cmd \ yard/yard_cmd \

View file

@ -18,10 +18,10 @@ fs/fs_internal \
fs/getters \ fs/getters \
fs/putfd \ fs/putfd \
gnl/get_next_line \ gnl/get_next_line \
hash/hasher \
hash/hash_signed \ hash/hash_signed \
hash/hash_str \ hash/hash_str \
hash/hash_unsigned \ hash/hash_unsigned \
hash/hasher \
hash/sip/sip13 \ hash/sip/sip13 \
hash/sip/sip_utils \ hash/sip/sip_utils \
hash/sip/sip_utils2 \ hash/sip/sip_utils2 \
@ -69,6 +69,10 @@ printf/printf \
printf/printf_fd \ printf/printf_fd \
printf/printf_str \ printf/printf_str \
printf/vprintf \ printf/vprintf \
string/mod \
string/string_insert \
string/string_remove \
string/string_reserve \
str/str_clone \ str/str_clone \
str/str_compare \ str/str_compare \
str/str_find_chr \ str/str_find_chr \
@ -85,10 +89,6 @@ str/str_n_find_str \
str/str_split \ str/str_split \
str/str_substring \ str/str_substring \
str/str_trim \ str/str_trim \
string/mod \
string/string_insert \
string/string_remove \
string/string_reserve \
GEN_FILES = \ GEN_FILES = \
convert/i16_to_str \ convert/i16_to_str \

1
test/.gitignore vendored
View file

@ -1 +0,0 @@
/test

View file

@ -1,6 +0,0 @@
SRC_FILES = \
main \
GEN_FILES = \
\

View file

@ -1,145 +0,0 @@
# **************************************************************************** #make
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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

View file

@ -1,107 +0,0 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Test.mk :+: :+: :+: #
# +:+ +:+ +:+ #
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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)

View file

@ -1,42 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <stdio.h>
#include <stdlib.h>
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);
}