-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into init_makefile_libft
- Loading branch information
Showing
56 changed files
with
1,831 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* cub3d.h :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/08/14 18:13:07 by jteissie #+# #+# */ | ||
/* Updated: 2024/08/14 18:13:26 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#ifndef CUB3D_H | ||
# define CUB3D_H | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
**/*.out | ||
**/*.a | ||
**/*.o | ||
**/.vscode | ||
**/.gch | ||
**/main | ||
**/*.swp | ||
srcs/libftTester/ | ||
./libtest/ | ||
srcs/libft.h | ||
srcs/libft.h.gch | ||
srcs/libft.so | ||
srcs/Makefile | ||
srcs/libft.a | ||
libft-war-machine/* | ||
test_dump.c | ||
test_main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,4 @@ fclean: clean | |
|
||
re: fclean all | ||
|
||
.PHONY: all clean fclean re bonus | ||
.PHONY: all clean fclean re bonus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_atoi.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/22 19:28:31 by jteissie #+# #+# */ | ||
/* Updated: 2024/03/23 16:31:12 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int ft_atoi(const char *nptr) | ||
{ | ||
int i; | ||
int result; | ||
int minus; | ||
|
||
i = 0; | ||
result = 0; | ||
minus = 0; | ||
while (nptr[i] == ' ' || (nptr[i] >= 9 && nptr[i] <= 13)) | ||
i++; | ||
if (nptr[i] == '-' || nptr[i] == '+') | ||
{ | ||
if (nptr[i] == '-') | ||
minus = 1; | ||
i++; | ||
} | ||
while (nptr[i] >= '0' && nptr[i] <= '9') | ||
{ | ||
result = result * 10 + (nptr[i] - '0'); | ||
i++; | ||
} | ||
if (minus) | ||
result *= -1; | ||
return (result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_bzero.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 16:41:46 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/15 15:00:35 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_bzero(void *s, size_t n) | ||
{ | ||
unsigned int i; | ||
unsigned char *str; | ||
|
||
i = 0; | ||
str = s; | ||
while (i < n) | ||
{ | ||
str[i] = '\0'; | ||
i++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_calloc.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 17:05:28 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/22 15:40:09 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void *ft_calloc(size_t nmemb, size_t size) | ||
{ | ||
void *ptr; | ||
size_t total_size; | ||
|
||
total_size = size * nmemb; | ||
if (total_size < size && total_size != 0) | ||
return (NULL); | ||
ptr = malloc(total_size); | ||
if (!ptr) | ||
return (NULL); | ||
ft_memset(ptr, 0, total_size); | ||
return (ptr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_isalnum.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 16:31:49 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/22 14:57:58 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int ft_isalnum(int c) | ||
{ | ||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) | ||
return (1); | ||
if (c >= '0' && c <= '9') | ||
return (1); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_isalpha.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 16:42:26 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/22 14:58:03 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int ft_isalpha(int c) | ||
{ | ||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) | ||
return (1); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_isascii.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 17:06:25 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/22 14:58:10 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int ft_isascii(int c) | ||
{ | ||
if (c > 127 || c < 0) | ||
return (0); | ||
return (1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_isdigit.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 16:33:38 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/22 14:58:16 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int ft_isdigit(int c) | ||
{ | ||
if (c >= '0' && c <= '9') | ||
return (1); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_isprint.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 16:43:06 by jteissie #+# #+# */ | ||
/* Updated: 2024/03/24 18:13:36 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
int ft_isprint(int c) | ||
{ | ||
if (c >= 32 && c <= 126) | ||
return (c); | ||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_itoa.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/03/23 17:10:20 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/19 11:34:35 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_putnbr_array(char *str, int nb, int *index) | ||
{ | ||
long int number; | ||
|
||
number = nb; | ||
if (number < 0) | ||
{ | ||
str[0] = '-'; | ||
number *= -1; | ||
*index = *index + 1; | ||
} | ||
if (number > 9) | ||
{ | ||
ft_putnbr_array(str, number / 10, index); | ||
str[*index] = number % 10 + '0'; | ||
*index = *index + 1; | ||
return ; | ||
} | ||
str[*index] = number + '0'; | ||
*index = *index + 1; | ||
return ; | ||
} | ||
|
||
char *ft_itoa(int n) | ||
{ | ||
int digits; | ||
char *string; | ||
int digits_count; | ||
int i; | ||
|
||
digits = n; | ||
digits_count = 0; | ||
i = 0; | ||
if (n == 0) | ||
digits_count = 1; | ||
while (digits != 0) | ||
{ | ||
digits /= 10; | ||
digits_count++; | ||
} | ||
if (n < 0) | ||
digits_count++; | ||
string = malloc(sizeof(char) * (digits_count + 1)); | ||
if (!string) | ||
return (NULL); | ||
ft_putnbr_array(string, n, &i); | ||
string[i] = '\0'; | ||
return (string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_lstadd_back_bonus.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/05/18 14:45:13 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/20 14:08:42 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_lstadd_back(t_list **lst, t_list *new) | ||
{ | ||
t_list *last; | ||
|
||
if (lst == NULL || new == NULL) | ||
return ; | ||
if (*lst == NULL) | ||
*lst = new; | ||
else | ||
{ | ||
last = ft_lstlast(*lst); | ||
last->next = new; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_lstadd_front_bonus.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/05/17 16:46:06 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/20 16:40:39 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_lstadd_front(t_list **lst, t_list *new) | ||
{ | ||
new->next = *lst; | ||
*lst = new; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_lstclear_bonus.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/05/18 18:10:45 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/20 16:57:50 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_lstclear(t_list **lst, void (*del)(void *)) | ||
{ | ||
t_list *temp; | ||
|
||
while (*lst != NULL) | ||
{ | ||
temp = *lst; | ||
*lst = (*lst)->next; | ||
del(temp->content); | ||
free(temp); | ||
} | ||
lst = NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_lstdelone_bonus.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: jteissie <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/05/18 15:18:30 by jteissie #+# #+# */ | ||
/* Updated: 2024/05/20 15:32:18 by jteissie ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
void ft_lstdelone(t_list *lst, void (*del)(void *)) | ||
{ | ||
del(lst->content); | ||
free(lst); | ||
} |
Oops, something went wrong.