Merge branch 'maix/norminette'
This commit is contained in:
commit
9d8139e035
16 changed files with 2381 additions and 3513 deletions
|
|
@ -28,7 +28,7 @@ typedef struct s_node
|
||||||
struct s_node *childs;
|
struct s_node *childs;
|
||||||
} t_node;
|
} t_node;
|
||||||
|
|
||||||
t_node build_node(TSNode curr, t_const_str input);
|
t_node build_node(t_parse_node curr, t_const_str input);
|
||||||
t_str node_getstr(t_node *node);
|
t_str node_getstr(t_node *node);
|
||||||
void free_node(t_node t);
|
void free_node(t_node t);
|
||||||
|
|
||||||
|
|
|
||||||
24
includes/app/signal_handler.h
Normal file
24
includes/app/signal_handler.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* signal_handler.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/05/02 13:20:25 by maiboyer #+# #+# */
|
||||||
|
/* Updated: 2024/05/02 13:23:06 by maiboyer ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef SIGNAL_HANDLER_H
|
||||||
|
#define SIGNAL_HANDLER_H
|
||||||
|
|
||||||
|
#include "me/types.h"
|
||||||
|
#include <readline/readline.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
typedef t_i32 t_signal;
|
||||||
|
|
||||||
|
t_error install_signal(void);
|
||||||
|
|
||||||
|
#endif /* SIGNAL_HANDLER_H */
|
||||||
1
includes/gmr
Symbolic link
1
includes/gmr
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../parser/static/headers/
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
typedef struct s_parser
|
typedef struct s_parser
|
||||||
{
|
{
|
||||||
TSParser *parser;
|
t_first_parser *parser;
|
||||||
} t_parser;
|
} t_parser;
|
||||||
|
|
||||||
typedef struct s_utils
|
typedef struct s_utils
|
||||||
|
|
|
||||||
2320
parser/src/api.h
2320
parser/src/api.h
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +1,4 @@
|
||||||
<<<<<<< HEAD
|
|
||||||
#include "./api.h"
|
#include "./api.h"
|
||||||
=======
|
|
||||||
#include "./array.h"
|
|
||||||
#include "./parser.h"
|
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
@ -68,9 +63,9 @@ typedef struct {
|
||||||
Array(Heredoc) heredocs;
|
Array(Heredoc) heredocs;
|
||||||
} Scanner;
|
} Scanner;
|
||||||
|
|
||||||
static inline void advance(TSLexer *lexer) { lexer->advance(lexer, false); }
|
static inline void advance(t_lexer_data *lexer) { lexer->advance(lexer, false); }
|
||||||
|
|
||||||
static inline void skip(TSLexer *lexer) { lexer->advance(lexer, true); }
|
static inline void skip(t_lexer_data *lexer) { lexer->advance(lexer, true); }
|
||||||
|
|
||||||
static inline bool in_error_recovery(const bool *valid_symbols) { return valid_symbols[ERROR_RECOVERY]; }
|
static inline bool in_error_recovery(const bool *valid_symbols) { return valid_symbols[ERROR_RECOVERY]; }
|
||||||
|
|
||||||
|
|
@ -165,7 +160,7 @@ static void deserialize(Scanner *scanner, const char *buffer, unsigned length) {
|
||||||
* POSIX-mandated substitution, and assumes the default value for
|
* POSIX-mandated substitution, and assumes the default value for
|
||||||
* IFS.
|
* IFS.
|
||||||
*/
|
*/
|
||||||
static bool advance_word(TSLexer *lexer, String *unquoted_word) {
|
static bool advance_word(t_lexer_data *lexer, String *unquoted_word) {
|
||||||
bool empty = true;
|
bool empty = true;
|
||||||
|
|
||||||
int32_t quote = 0;
|
int32_t quote = 0;
|
||||||
|
|
@ -196,7 +191,7 @@ static bool advance_word(TSLexer *lexer, String *unquoted_word) {
|
||||||
return !empty;
|
return !empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool scan_bare_dollar(TSLexer *lexer) {
|
static inline bool scan_bare_dollar(t_lexer_data *lexer) {
|
||||||
while (iswspace(lexer->lookahead) && lexer->lookahead != '\n' && !lexer->eof(lexer)) {
|
while (iswspace(lexer->lookahead) && lexer->lookahead != '\n' && !lexer->eof(lexer)) {
|
||||||
skip(lexer);
|
skip(lexer);
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +206,7 @@ static inline bool scan_bare_dollar(TSLexer *lexer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool scan_heredoc_start(Heredoc *heredoc, TSLexer *lexer) {
|
static bool scan_heredoc_start(Heredoc *heredoc, t_lexer_data *lexer) {
|
||||||
while (iswspace(lexer->lookahead)) {
|
while (iswspace(lexer->lookahead)) {
|
||||||
skip(lexer);
|
skip(lexer);
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +222,7 @@ static bool scan_heredoc_start(Heredoc *heredoc, TSLexer *lexer) {
|
||||||
return found_delimiter;
|
return found_delimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool scan_heredoc_end_identifier(Heredoc *heredoc, TSLexer *lexer) {
|
static bool scan_heredoc_end_identifier(Heredoc *heredoc, t_lexer_data *lexer) {
|
||||||
reset_string(&heredoc->current_leading_word);
|
reset_string(&heredoc->current_leading_word);
|
||||||
// Scan the first 'n' characters on this line, to see if they match the
|
// Scan the first 'n' characters on this line, to see if they match the
|
||||||
// heredoc delimiter
|
// heredoc delimiter
|
||||||
|
|
@ -247,7 +242,7 @@ static bool scan_heredoc_end_identifier(Heredoc *heredoc, TSLexer *lexer) {
|
||||||
: strcmp(heredoc->current_leading_word.contents, heredoc->delimiter.contents) == 0;
|
: strcmp(heredoc->current_leading_word.contents, heredoc->delimiter.contents) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool scan_heredoc_content(Scanner *scanner, TSLexer *lexer, enum TokenType middle_type,
|
static bool scan_heredoc_content(Scanner *scanner, t_lexer_data *lexer, enum TokenType middle_type,
|
||||||
enum TokenType end_type) {
|
enum TokenType end_type) {
|
||||||
bool did_advance = false;
|
bool did_advance = false;
|
||||||
Heredoc *heredoc = array_back(&scanner->heredocs);
|
Heredoc *heredoc = array_back(&scanner->heredocs);
|
||||||
|
|
@ -350,7 +345,7 @@ static bool scan_heredoc_content(Scanner *scanner, TSLexer *lexer, enum TokenTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
|
static bool scan(Scanner *scanner, t_lexer_data *lexer, const bool *valid_symbols) {
|
||||||
if (valid_symbols[CONCAT] && !in_error_recovery(valid_symbols)) {
|
if (valid_symbols[CONCAT] && !in_error_recovery(valid_symbols)) {
|
||||||
if (!(lexer->lookahead == 0 || iswspace(lexer->lookahead) || lexer->lookahead == '>' ||
|
if (!(lexer->lookahead == 0 || iswspace(lexer->lookahead) || lexer->lookahead == '>' ||
|
||||||
lexer->lookahead == '<' || lexer->lookahead == ')' || lexer->lookahead == '(' ||
|
lexer->lookahead == '<' || lexer->lookahead == ')' || lexer->lookahead == '(' ||
|
||||||
|
|
@ -1194,7 +1189,7 @@ void *tree_sitter_bash_external_scanner_create() {
|
||||||
return scanner;
|
return scanner;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tree_sitter_bash_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
|
bool tree_sitter_bash_external_scanner_scan(void *payload, t_lexer_data *lexer, const bool *valid_symbols) {
|
||||||
Scanner *scanner = (Scanner *)payload;
|
Scanner *scanner = (Scanner *)payload;
|
||||||
return scan(scanner, lexer, valid_symbols);
|
return scan(scanner, lexer, valid_symbols);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
|
/* Created: 2024/03/29 11:35:51 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/04/30 22:03:14 by maiboyer ### ########.fr */
|
/* Updated: 2024/05/02 13:46:39 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../includes/minishell.h"
|
#include "../includes/minishell.h"
|
||||||
|
|
||||||
void ts_parser_delete(TSParser *self);
|
void ts_parser_delete(t_first_parser *self);
|
||||||
|
|
||||||
void ft_free(void *ptr)
|
void ft_free(void *ptr)
|
||||||
{
|
{
|
||||||
|
|
@ -48,6 +48,5 @@ void ft_exit(t_utils *maiboyerlpb, t_u8 exit_status)
|
||||||
{
|
{
|
||||||
if (maiboyerlpb != NULL)
|
if (maiboyerlpb != NULL)
|
||||||
ft_free_utils(maiboyerlpb);
|
ft_free_utils(maiboyerlpb);
|
||||||
printf("exit\n");
|
|
||||||
exit(exit_status);
|
exit(exit_status);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,23 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
|
/* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/05/01 10:36:58 by maiboyer ### ########.fr */
|
/* Updated: 2024/05/02 14:18:02 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../includes/minishell.h"
|
#include "../includes/minishell.h"
|
||||||
#include "app/node.h"
|
#include "app/node.h"
|
||||||
|
#include "app/signal_handler.h"
|
||||||
#include "me/string/str_len.h"
|
#include "me/string/str_len.h"
|
||||||
#include "parser/api.h"
|
#include "parser/api.h"
|
||||||
|
|
||||||
TSParser *ts_parser_new();
|
t_first_parser *ts_parser_new();
|
||||||
void ts_tree_delete(TSTree *);
|
void ts_tree_delete(t_first_tree *);
|
||||||
TSNode ts_tree_root_node(TSTree *);
|
t_parse_node ts_tree_root_node(t_first_tree *);
|
||||||
TSTree *ts_parser_parse_string(TSParser *, TSTree *oldtree, t_const_str input,
|
t_first_tree *ts_parser_parse_string(t_first_parser *, t_first_tree *oldtree,
|
||||||
t_usize len);
|
t_const_str input, t_usize len);
|
||||||
void ts_parser_delete(TSParser *self);
|
void ts_parser_delete(t_first_parser *self);
|
||||||
void ts_parser_set_language(TSParser *self, TSLanguage *lang);
|
void ts_parser_set_language(t_first_parser *self, t_language *lang);
|
||||||
|
|
||||||
void print_node_data(t_node *t, t_usize depth)
|
void print_node_data(t_node *t, t_usize depth)
|
||||||
{
|
{
|
||||||
|
|
@ -31,15 +32,15 @@ void print_node_data(t_node *t, t_usize depth)
|
||||||
while (idx++ < depth)
|
while (idx++ < depth)
|
||||||
printf("\t");
|
printf("\t");
|
||||||
idx = 0;
|
idx = 0;
|
||||||
printf("%s = %s\n", t->kind_str, node_getstr(t));
|
printf("%s(%llu) = %s\n", t->kind_str, t->kind, node_getstr(t));
|
||||||
while (idx < t->childs_count)
|
while (idx < t->childs_count)
|
||||||
print_node_data(&t->childs[idx++], depth + 1);
|
print_node_data(&t->childs[idx++], depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_node parse_to_nodes(TSParser *parser, t_const_str input)
|
t_node parse_to_nodes(t_first_parser *parser, t_const_str input)
|
||||||
{
|
{
|
||||||
TSTree *tree;
|
t_first_tree *tree;
|
||||||
TSNode node;
|
t_parse_node node;
|
||||||
t_node ret;
|
t_node ret;
|
||||||
|
|
||||||
tree = ts_parser_parse_string(parser, NULL, input, str_len(input));
|
tree = ts_parser_parse_string(parser, NULL, input, str_len(input));
|
||||||
|
|
@ -112,12 +113,12 @@ void ft_find_path(t_str arge[], t_utils *utils)
|
||||||
utils->path = ft_split(PATH_FILES, ':');
|
utils->path = ft_split(PATH_FILES, ':');
|
||||||
}
|
}
|
||||||
|
|
||||||
TSLanguage *tree_sitter_bash(void);
|
t_language *tree_sitter_bash(void);
|
||||||
|
|
||||||
t_parser create_myparser(void)
|
t_parser create_myparser(void)
|
||||||
{
|
{
|
||||||
TSLanguage *lang;
|
t_language *lang;
|
||||||
TSParser *parser;
|
t_first_parser *parser;
|
||||||
|
|
||||||
lang = tree_sitter_bash();
|
lang = tree_sitter_bash();
|
||||||
parser = ts_parser_new();
|
parser = ts_parser_new();
|
||||||
|
|
@ -137,9 +138,15 @@ t_i32 main(t_i32 argc, t_str argv[], t_str envp[])
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
(void)envp;
|
(void)envp;
|
||||||
|
if (install_signal())
|
||||||
|
return (1);
|
||||||
utils = (t_utils){};
|
utils = (t_utils){};
|
||||||
utils.parser = create_myparser();
|
utils.parser = create_myparser();
|
||||||
// ft_find_path(arge, &utils);
|
utils.name_shell = "\001\x1B[93m\002"
|
||||||
utils.name_shell = "42sh > ";
|
"42sh"
|
||||||
|
"\001\x1B[32m\002"
|
||||||
|
">"
|
||||||
|
"\001\x1B[0m\002"
|
||||||
|
"$ ";
|
||||||
ft_take_args(&utils);
|
ft_take_args(&utils);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,19 @@
|
||||||
#include "me/string/str_l_copy.h"
|
#include "me/string/str_l_copy.h"
|
||||||
#include "parser/api.h"
|
#include "parser/api.h"
|
||||||
|
|
||||||
t_node build_node(TSNode current, t_const_str input);
|
t_node build_node(t_parse_node current, t_const_str input);
|
||||||
TSNode ts_node_child(TSNode parent, t_usize idx);
|
t_parse_node ts_node_child(t_parse_node parent, t_usize idx);
|
||||||
TSSymbol ts_node_symbol(TSNode self);
|
t_symbol ts_node_symbol(t_parse_node self);
|
||||||
t_const_str ts_node_type(TSNode self);
|
t_const_str ts_node_type(t_parse_node self);
|
||||||
t_u32 ts_node_start_byte(TSNode self);
|
t_u32 ts_node_start_byte(t_parse_node self);
|
||||||
t_u32 ts_node_end_byte(TSNode self);
|
t_u32 ts_node_end_byte(t_parse_node self);
|
||||||
t_u32 ts_node_child_count(TSNode self);
|
t_u32 ts_node_child_count(t_parse_node self);
|
||||||
|
|
||||||
t_node *build_childs(TSNode parent, t_const_str input, t_usize count)
|
t_node *build_childs(t_parse_node parent, t_const_str input, t_usize count)
|
||||||
{
|
{
|
||||||
t_node *ret;
|
t_node *ret;
|
||||||
t_usize idx;
|
t_usize idx;
|
||||||
TSNode child;
|
t_parse_node child;
|
||||||
|
|
||||||
ret = mem_alloc_array(sizeof(*ret), count);
|
ret = mem_alloc_array(sizeof(*ret), count);
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
|
|
@ -43,7 +43,7 @@ t_node *build_childs(TSNode parent, t_const_str input, t_usize count)
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
t_node build_node(TSNode curr, t_const_str input)
|
t_node build_node(t_parse_node curr, t_const_str input)
|
||||||
{
|
{
|
||||||
t_node out;
|
t_node out;
|
||||||
|
|
||||||
|
|
|
||||||
66
sources/signal_handler.c
Normal file
66
sources/signal_handler.c
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* signal_handler.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/05/02 13:22:14 by maiboyer #+# #+# */
|
||||||
|
/* Updated: 2024/05/02 14:00:31 by maiboyer ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "app/signal_handler.h"
|
||||||
|
#include "me/types.h"
|
||||||
|
#include "readline/readline.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void sigint_handle(int sig, siginfo_t *info, void *ucontext)
|
||||||
|
{
|
||||||
|
static int count = 0;
|
||||||
|
(void)(sig);
|
||||||
|
(void)(info);
|
||||||
|
(void)(ucontext);
|
||||||
|
count++;
|
||||||
|
printf("\n");
|
||||||
|
rl_replace_line("", 0);
|
||||||
|
rl_on_new_line();
|
||||||
|
rl_redisplay();
|
||||||
|
if (count == 10)
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sigquit_handle(int sig, siginfo_t *info, void *ucontext)
|
||||||
|
{
|
||||||
|
static int count = 0;
|
||||||
|
(void)(sig);
|
||||||
|
(void)(info);
|
||||||
|
(void)(ucontext);
|
||||||
|
count++;
|
||||||
|
printf("\n");
|
||||||
|
rl_replace_line("", 0);
|
||||||
|
rl_on_new_line();
|
||||||
|
rl_redisplay();
|
||||||
|
if (count == 10)
|
||||||
|
{
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
t_error install_signal(void)
|
||||||
|
{
|
||||||
|
struct sigaction data;
|
||||||
|
|
||||||
|
data.sa_sigaction = sigint_handle;
|
||||||
|
data.sa_flags = SA_SIGINFO | SA_NOCLDWAIT;
|
||||||
|
if (sigaction(SIGINT, &data, NULL))
|
||||||
|
return (ERROR);
|
||||||
|
|
||||||
|
data.sa_sigaction = sigquit_handle;
|
||||||
|
if (sigaction(SIGQUIT, &data, NULL))
|
||||||
|
return (ERROR);
|
||||||
|
|
||||||
|
return (NO_ERROR);
|
||||||
|
}
|
||||||
1
src.list
1
src.list
|
|
@ -5,3 +5,4 @@ ft_pwd.c
|
||||||
main.c
|
main.c
|
||||||
node/create_node.c
|
node/create_node.c
|
||||||
node/node.c
|
node/node.c
|
||||||
|
signal_handler.c
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
use flake
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
|
# Created: 2023/11/03 13:20:01 by maiboyer #+# #+# #
|
||||||
# Updated: 2024/04/28 20:00:43 by maiboyer ### ########.fr #
|
# Updated: 2024/05/01 20:31:58 by maiboyer ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -52,23 +52,19 @@ all: $(NAME)
|
||||||
$(NAME): $(TARGET)
|
$(NAME): $(TARGET)
|
||||||
|
|
||||||
$(TARGET): $(OBJ)
|
$(TARGET): $(OBJ)
|
||||||
@printf \\n$(COL_GRAY)Building\ Output\ $(COL_WHITE)$(COL_BOLD)%-28s$(COL_RESET)\ \
|
@echo -e "$(COL_GRAY) Linking\t$(COL_GREEN)$(TARGET)$(COL_RESET)"
|
||||||
$(NAME)
|
|
||||||
@#$(CC) $(INCLUDES) $(OBJ) $(CFLAGS) -o $(NAME)
|
@#$(CC) $(INCLUDES) $(OBJ) $(CFLAGS) -o $(NAME)
|
||||||
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
|
@ar rcs $(BUILD_DIR)/$(NAME) $(OBJ)
|
||||||
@printf $(COL_GREEN)done$(COL_RESET)\\n
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@printf $(COL_GRAY)Building\ $(COL_BOLD)$(COL_WHITE)%-50s\ $(LIB_NAME)$<
|
@echo -e "$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)"
|
||||||
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
|
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
|
||||||
@printf $(COL_RESET)$(COL_GREEN)done$(COL_RESET)\\n
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: $(GENERIC_DIR)/%.c
|
$(BUILD_DIR)/%.o: $(GENERIC_DIR)/%.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
@printf $(COL_GRAY)Building\ $(COL_BOLD)$(COL_WHITE)%-50s\ $(LIB_NAME)$<
|
@echo -e "$(COL_GRAY) Building\t$(COL_GREEN)$<$(COL_RESET)"
|
||||||
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
|
@$(CC) $(CFLAGS) $(WERROR) $(INCLUDES) -c $< -o $@
|
||||||
@printf $(COL_RESET)$(COL_GREEN)done$(COL_RESET)\\n
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@- $(foreach LIB,$(LIBS), \
|
@- $(foreach LIB,$(LIBS), \
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/08 12:45:06 by maiboyer #+# #+# */
|
/* Created: 2023/11/08 12:45:06 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/04/28 19:42:10 by maiboyer ### ########.fr */
|
/* Updated: 2024/05/01 20:29:59 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -37,10 +37,10 @@ static void me_inner(t_u64 nb, t_str out, t_usize *idx)
|
||||||
void me_putnbr_fd(t_i32 n, t_file file)
|
void me_putnbr_fd(t_i32 n, t_file file)
|
||||||
{
|
{
|
||||||
t_usize idx;
|
t_usize idx;
|
||||||
t_u64 nb;
|
t_i64 nb;
|
||||||
char out[15];
|
char out[15];
|
||||||
|
|
||||||
nb = (t_u64)n;
|
nb = (t_i64)n;
|
||||||
idx = 0;
|
idx = 0;
|
||||||
if (nb < 0)
|
if (nb < 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/11/04 17:29:13 by maiboyer #+# #+# */
|
/* Created: 2023/11/04 17:29:13 by maiboyer #+# #+# */
|
||||||
/* Updated: 2024/04/28 19:42:46 by maiboyer ### ########.fr */
|
/* Updated: 2024/05/01 20:30:38 by maiboyer ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
char *str_find_rev_chr(t_const_str str, char chr)
|
char *str_find_rev_chr(t_const_str str, char chr)
|
||||||
{
|
{
|
||||||
t_usize index;
|
t_isize index;
|
||||||
|
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue