gnl integre au main
This commit is contained in:
BIN
builds/draw.o
Normal file
BIN
builds/draw.o
Normal file
Binary file not shown.
BIN
builds/fdf.o
Normal file
BIN
builds/fdf.o
Normal file
Binary file not shown.
BIN
builds/modifs.o
Normal file
BIN
builds/modifs.o
Normal file
Binary file not shown.
BIN
builds/parse.o
Normal file
BIN
builds/parse.o
Normal file
Binary file not shown.
@@ -6,6 +6,7 @@
|
||||
# include <unistd.h> // for sleep()
|
||||
# include <math.h> // for M_PI
|
||||
# include <stdio.h> // for printf()
|
||||
# include <fcntl.h> // for open
|
||||
|
||||
typedef struct s_fdf
|
||||
{
|
||||
|
||||
1
libft
1
libft
Submodule libft deleted from 26147eeeeb
939
libftt/Makefile
Normal file
939
libftt/Makefile
Normal file
@@ -0,0 +1,939 @@
|
||||
# - - - - - - - - - #
|
||||
# variables names #
|
||||
# - - - - - - - - - #
|
||||
|
||||
NAME = libft.a
|
||||
CC = gcc
|
||||
VPATH = srcs/ \
|
||||
srcs/ft_printf_files/
|
||||
|
||||
IDIR = ./includes
|
||||
_DEP = libft.h
|
||||
DEPS = $(_DEP:%.h=$(IDIR)/%.h)
|
||||
|
||||
CFLAGS = -I$(IDIR)
|
||||
CFLAGS += -Wall -Wextra -Werror -g3
|
||||
|
||||
SRCS = ft_memset.c \
|
||||
ft_bzero.c \
|
||||
ft_memcpy.c \
|
||||
ft_memccpy.c \
|
||||
ft_memmove.c \
|
||||
ft_memchr.c \
|
||||
ft_memcmp.c \
|
||||
ft_strlen.c \
|
||||
ft_isalpha.c \
|
||||
ft_isdigit.c \
|
||||
ft_isalnum.c \
|
||||
ft_isascii.c \
|
||||
ft_isprint.c \
|
||||
ft_toupper.c \
|
||||
ft_tolower.c \
|
||||
ft_strchr.c \
|
||||
ft_strrchr.c \
|
||||
ft_strchrset.c \
|
||||
ft_strncmp.c \
|
||||
ft_strlcpy.c \
|
||||
ft_strlcat.c \
|
||||
ft_strnstr.c \
|
||||
ft_atoi.c \
|
||||
ft_calloc.c \
|
||||
ft_strdup.c \
|
||||
\
|
||||
ft_substr.c \
|
||||
ft_strjoin.c \
|
||||
ft_strtrim.c \
|
||||
ft_split.c \
|
||||
ft_itoa.c \
|
||||
ft_utoa.c \
|
||||
ft_strmapi.c \
|
||||
ft_putchar_fd.c \
|
||||
ft_putstr_fd.c \
|
||||
ft_putendl_fd.c \
|
||||
ft_putnbr_fd.c \
|
||||
\
|
||||
ft_lstnew.c \
|
||||
ft_lstadd_front.c \
|
||||
ft_lstsize.c \
|
||||
ft_lstlast.c \
|
||||
ft_lstadd_back.c \
|
||||
ft_lstdelone.c \
|
||||
ft_lstclear.c \
|
||||
ft_lstiter.c \
|
||||
ft_lstmap.c \
|
||||
\
|
||||
ft_strcat.c \
|
||||
ft_strcmp.c \
|
||||
ft_strcpy.c \
|
||||
ft_strncat.c \
|
||||
ft_strncpy.c \
|
||||
ft_strstr.c \
|
||||
ft_strjoinfree.c \
|
||||
ft_strclr.c \
|
||||
ft_strdel.c \
|
||||
ft_strequ.c \
|
||||
ft_striter.c \
|
||||
ft_striteri.c \
|
||||
ft_strmap.c \
|
||||
ft_strnequ.c \
|
||||
ft_strnew.c \
|
||||
ft_memalloc.c \
|
||||
ft_memdel.c \
|
||||
ft_putchar.c \
|
||||
ft_putendl.c \
|
||||
ft_putnbr.c \
|
||||
ft_putnbrendl.c \
|
||||
ft_putnbrendl_fd.c \
|
||||
ft_putnbrbase.c \
|
||||
ft_putstr.c \
|
||||
ft_any.c \
|
||||
ft_atoibase.c \
|
||||
ft_convertbase.c \
|
||||
ft_convertbase_free.c \
|
||||
ft_foreach.c \
|
||||
ft_issort.c \
|
||||
ft_arraymap.c \
|
||||
ft_strmultisplit.c \
|
||||
\
|
||||
ft_gnl.c \
|
||||
ft_concat_free.c \
|
||||
\
|
||||
ft_printf.c \
|
||||
ft_next_word.c \
|
||||
ft_convert.c \
|
||||
ft_flag_transform.c \
|
||||
ft_flag_transform_bonus.c \
|
||||
ft_abs.c \
|
||||
ft_greater.c \
|
||||
ft_smaller.c \
|
||||
ft_sign.c
|
||||
|
||||
|
||||
ODIR = ./builds
|
||||
OBJS = $(SRCS:%.c=$(ODIR)/%.o)
|
||||
|
||||
|
||||
# - - - - - - - - - - - #
|
||||
# rules to execute #
|
||||
# - - - - - - - - - - - #
|
||||
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(ODIR):
|
||||
@printf "\033[35m"
|
||||
mkdir -p $(ODIR)
|
||||
@printf "\033[0m"
|
||||
|
||||
$(NAME): $(ODIR) $(OBJS) $(DEPS)
|
||||
@printf "\033[33m"
|
||||
ar -rc $@ $(OBJS)
|
||||
ranlib $@
|
||||
@printf "\033[0m"
|
||||
|
||||
$(ODIR)/%.o: %.c
|
||||
@printf "\033[36m"
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
@printf "\033[31m"
|
||||
/bin/rm -rf $(ODIR)
|
||||
@printf "\033[0m"
|
||||
|
||||
fclean: clean
|
||||
@printf "\033[31m"
|
||||
/bin/rm -f $(NAME)
|
||||
@printf "\033[0m"
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: clean fclean re all
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ------------------------------------------------------ #
|
||||
# explication complete etapes par etapes depuis le debut #
|
||||
# ------------------------------------------------------ #
|
||||
|
||||
## 1 - compiler avec gcc [25 gj]
|
||||
# compiler un programme [29 gj]
|
||||
# compiler en plusieurs fichiers [54 gj]
|
||||
# les .o : compiler et linker [102 gj]
|
||||
|
||||
## 2 - creer une librairie [135 gj]
|
||||
# ar rc [139 gj]
|
||||
# ar rc en plusieurs fois [164 gj]
|
||||
# ranlib [185 gj]
|
||||
|
||||
## 3 - fichiers .h [198 gj]
|
||||
# a quoi sert un header [202 gj]
|
||||
# ecrire un header [229 gj]
|
||||
# comment ca se compile [273 gj]
|
||||
|
||||
## 4 - ecrire un make file [305 gj]
|
||||
# basic makefile [309 gj]
|
||||
# makefile with subdirectories [462 gj]
|
||||
# makefile making another makefile [583 gj]
|
||||
# makefile for a library [690 gj]
|
||||
|
||||
## ----------------------
|
||||
## 1 - compiler avec gcc
|
||||
## ----------------------
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - -
|
||||
# compiler un programme qui contient un main
|
||||
# - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# quand on ecrit un programme il contient un main et les
|
||||
# fonctions dont le main a besoin (ex ft_putchar) :
|
||||
#
|
||||
# # #include <unistd.h>
|
||||
# #
|
||||
# # void ft_putchar(char c)
|
||||
# # {
|
||||
# # write(1, &c, 1);
|
||||
# # }
|
||||
# #
|
||||
# # int main()
|
||||
# # {
|
||||
# # ft_putchar('0');
|
||||
# # return (0);
|
||||
# # }
|
||||
#
|
||||
# on peut compiler ce fichier avec gcc en faisant :
|
||||
# gcc file.c
|
||||
# et ca sort un executable a.out
|
||||
# si on l'execute "./a.out" ca ecrit 0 dans la console
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# compiler un programme en plusieurs fichiers
|
||||
# - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
# on va vite vouloir mettre chaque fonctions utilisee
|
||||
# dans un fichier a part afin de mieux gerer les modules
|
||||
# d'un programme. donc si on sort ft_putchar du fichier :
|
||||
#
|
||||
# # int main()
|
||||
# # {
|
||||
# # ft_putchar('0');
|
||||
# # return (0);
|
||||
# # }
|
||||
#
|
||||
# et qu'on execute "gcc file.c" on va avoir une erreur
|
||||
# car file.c utilise ft_putchar mais gcc ne sait pas ce
|
||||
# que c'est, donc il faut faire deux choses :
|
||||
#
|
||||
# 1 - d'une part indiquer a main() que ft_putchar()
|
||||
# existe, en ecrivant au dessus non pas toute la fonction
|
||||
# (puisqu'on veut la mettre dans un fichier a part) mais
|
||||
# uniquement son prototype :
|
||||
#
|
||||
# # void ft_putchar(char c);
|
||||
#
|
||||
# 2 - et d'autre part qu'on rajoute le fichier contenant
|
||||
# la fonction ft_putchar a la compilation :
|
||||
#
|
||||
# [ft_putchar.c]
|
||||
# # #include <unistd.h>
|
||||
# #
|
||||
# # void ft_putchar(char c)
|
||||
# # {
|
||||
# # write(1, &c, 1);
|
||||
# # }
|
||||
#
|
||||
# [main.c]
|
||||
# # void ft_putchar(char c);
|
||||
# #
|
||||
# # int main()
|
||||
# # {
|
||||
# # ft_putchar('0');
|
||||
# # return (0);
|
||||
# # }
|
||||
#
|
||||
# si on compile les deux ca marche :
|
||||
# gcc main.c ft_putchar.c
|
||||
|
||||
# - - - - - - - - - - - - - - -
|
||||
# les .o : compiler et linker
|
||||
# - - - - - - - - - - - - - - -
|
||||
|
||||
# ca fonctionne mais gcc doit a chaque fois recompiler
|
||||
# ft_putchar.c alors qu'il n'est pas modifie, donc on peut
|
||||
# le compiler une bonne fois pour toute et l'ajouter a la
|
||||
# compilation finale quand on en a besoin sans que l'ordi
|
||||
# ait a tout retraduire dans son langage
|
||||
#
|
||||
# mais si on essaye de compiler ft_putchar seul
|
||||
#
|
||||
# # gcc ft_putchar.c
|
||||
#
|
||||
# ca nous donne une erreur car pour compiler, gcc a besoin
|
||||
# de trouver un main !
|
||||
#
|
||||
# on va donc utiliser l'option -c pour creer un fichier
|
||||
# objet .o qui est deja traduit en langue d'ordinateur
|
||||
# et pret a etre rajoute a la compilation :
|
||||
#
|
||||
# # gcc -c ft_putchar.c --> donne ft_putchar.o
|
||||
# # gcc -c main.c --> donne main.o
|
||||
#
|
||||
# cette etape qui consiste a transformer les fichiers en
|
||||
# objets .o s'appelle la compilation, il faut ensuite
|
||||
# linker les objets, ce qui avec gcc se fait simplement :
|
||||
#
|
||||
# # gcc main.o ft_putchar.o
|
||||
#
|
||||
# on va maintenant voir comment faire une libraire qui
|
||||
# contient tous nos fichiers objets
|
||||
|
||||
## ------------------------
|
||||
## 2 - creer une librairie
|
||||
## ------------------------
|
||||
|
||||
# - - - -
|
||||
# ar rc
|
||||
# - - - -
|
||||
|
||||
# pour mettre tous les fichiers .o dans un seul fichier .a
|
||||
# on utilise un programme d'archive ar avec les options rc
|
||||
# - r indique d'inserer les .o en remplacant si necessaire
|
||||
# - c de creer une nouvelle archive
|
||||
#
|
||||
# le nom de l'archive doit commencer par lib et
|
||||
# finir par .a :
|
||||
#
|
||||
# # ar rc libtest.a ft_putchar.o
|
||||
#
|
||||
# on obtient un fichier libtest.a qui contient les
|
||||
# fichiers objets .o
|
||||
#
|
||||
# on peut l'utiliser a la compilation de cette manniere :
|
||||
#
|
||||
# # gcc main.c -L. -ltest
|
||||
#
|
||||
# -L indique ou est la librairie (ici elle est dans le
|
||||
# dossier courant .)
|
||||
# -l indique son nom (TEST car on n'indique pas lib et .a)
|
||||
|
||||
# - - - - - - - - - - - - -
|
||||
# ar rc en plusieurs fois
|
||||
# - - - - - - - - - - - - -
|
||||
|
||||
# on n'est pas oblige de creer une librairie en une seule
|
||||
# fois, ce qui est bien pratique nottament pour les
|
||||
# makefiles, on verra ca apres.
|
||||
#
|
||||
# ca signifie que si notre librairie contient plusieurs
|
||||
# fonctions, par exmple la librairie libfruits.a contient
|
||||
# banane.o et orange.o, on peut creer la librairie
|
||||
# avec banane.o puis y ajouter orange.o, sans auncune
|
||||
# manipulation speciale :
|
||||
#
|
||||
# # ar rc libfruits.a banane.o
|
||||
# # ar rc libfruits.a orange.o
|
||||
#
|
||||
# revient au meme qu'ecrire :
|
||||
#
|
||||
# # ar rc libfruits.a banane.o orange.o
|
||||
|
||||
# - - - -
|
||||
# ranlib
|
||||
# - - - -
|
||||
|
||||
# ranlib creer un index du contenu de la librairie et le
|
||||
# place dedans, c'est utile des que la librairie est tres
|
||||
# grande afin que gcc sache acceder rapidement aux
|
||||
# fonctions dont il a besoin dedans
|
||||
#
|
||||
# # ranlib libtest.a
|
||||
#
|
||||
# ranlib s'utilise apres avoir creer la lib avec ar rc
|
||||
|
||||
## ----------------
|
||||
## 3 - fichiers .h
|
||||
## ----------------
|
||||
|
||||
# - - - - - - - - - - - -
|
||||
# a quoi sert un header
|
||||
# - - - - - - - - - - - -
|
||||
# si on utilise une librairie c'est parce qu'on peut avoir
|
||||
# souvent besoin des memes fonctions dans un programme
|
||||
# mais si a chaque fois qu'on utilise une fonction de la
|
||||
# librairie on doit ecrire son prototype, ca va poser deux
|
||||
# problemes :
|
||||
#
|
||||
# le prototype d'une seule fonction peut etre ecrit a
|
||||
# pleins d'endroits, donc si la fonction change un peu on
|
||||
# doit retrouver tous les emplacements des prototypes et
|
||||
# les modifier un par un
|
||||
#
|
||||
# et d'autre part, si on utilise pleins de fonctions dans
|
||||
# l'ecriture d'un programme on va devoir reecrire a chaque
|
||||
# fois son prototype et c'est tres relou
|
||||
#
|
||||
# afin d'eviter ca on ecrit tous les prototypes, ainsi que
|
||||
# les includes, et les structures, les defines, et autres,
|
||||
# dans un seul fichier pour tout un programme, ou dans le
|
||||
# cas present pour toute la librairie, et on l'inclus
|
||||
# systematiquement au debut d'un fichier contenant des
|
||||
# fonctions de la librairie, gcc s'occupera de l'expandre
|
||||
# a la precompilation
|
||||
#
|
||||
|
||||
# - - - - - - - - -
|
||||
# ecrire un header
|
||||
# - - - - - - - - -
|
||||
|
||||
# [ft_putchar.c]
|
||||
# # #include "libtest.h"
|
||||
# #
|
||||
# # void ft_putchar(char c)
|
||||
# # {
|
||||
# # write(1, &c, 1);
|
||||
# # }
|
||||
#
|
||||
# [main.c]
|
||||
# # #include "libtest.h"
|
||||
# #
|
||||
# # int main()
|
||||
# # {
|
||||
# # ft_putchar('0');
|
||||
# # return (0);
|
||||
# # }
|
||||
#
|
||||
# [libetest.h]
|
||||
# # # ifndef LIBTEST_H
|
||||
# # # define LIBTEST_H
|
||||
# #
|
||||
# # #include <unistd.h>
|
||||
# #
|
||||
# # void ft_putchar(char c);
|
||||
# #
|
||||
# # # endif
|
||||
#
|
||||
# en tete de chaque fichier de fonctions on ecrit
|
||||
# l'include de la librairie, comme un include classique,
|
||||
# precede d'un #, mais avec le nom de la librairie entre
|
||||
# guillemets et non pas entre signes comparateurs
|
||||
#
|
||||
# dans le fichier de la librairie on ajoute les includes
|
||||
# dont on peut avoir besoin pour que la librairie ou des
|
||||
# fonctions auont besoin, et les prototypes des fonctions
|
||||
#
|
||||
# on entoure toutes ces infos par une definition, afin
|
||||
# de proteger le .h d'etre expand plusieurs fois dans
|
||||
# un fichier
|
||||
|
||||
# - - - - - - - - - - - -
|
||||
# comment ca se compile
|
||||
# - - - - - - - - - - - -
|
||||
|
||||
# au moment de la compilation il faut indiquer a gcc ou
|
||||
# se trouve le fichier .h avec le flag -I
|
||||
#
|
||||
# par exemple pour l'architecture de dossier suivante :
|
||||
#
|
||||
# # file/
|
||||
# # main.c
|
||||
# # ft_putchar.c
|
||||
# # libtest.h
|
||||
#
|
||||
# il faut ecrire :
|
||||
#
|
||||
# # gcc main.c ft_putchar.c -I.
|
||||
#
|
||||
# et si la compilation utilise une librairie, par exemple
|
||||
# si on met la fonction ft_putchar.c dans une librairie :
|
||||
#
|
||||
# # gcc -c ft_putchar.c
|
||||
# # (donne ft_putchar.o)
|
||||
# # ar rc libtest.a ft_putchar.o
|
||||
#
|
||||
# on peut alors compiler avec la librairie .a et le
|
||||
# fichier .h :
|
||||
#
|
||||
# # gcc main.c -I. -L. -ltest -o test
|
||||
#
|
||||
# qui sort l'executable "test"
|
||||
|
||||
## ----------------------------------------------------
|
||||
## 4 - ecrire un make file pour aider a la compilation
|
||||
## ----------------------------------------------------
|
||||
|
||||
# - - - - - - - - -
|
||||
# makefile basique
|
||||
# - - - - - - - - -
|
||||
|
||||
# exemple for a basic makefile :
|
||||
#
|
||||
# [architecture]
|
||||
# # main.c
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # header.h
|
||||
# # libtest.a
|
||||
# # Makefile
|
||||
#
|
||||
# [Makefile]
|
||||
# # #-------------#
|
||||
# # # VARIABLES #
|
||||
# # #-------------#
|
||||
# # NAME = program_test
|
||||
# # CC = gcc
|
||||
# # CFLAGS = -I.
|
||||
# # LFLAGS = -L. -ltest
|
||||
# # DEPS = header.h
|
||||
# # SRCS = main.c \
|
||||
# # function01.c \
|
||||
# # function02.c
|
||||
# # ODIR = ./builds
|
||||
# # OBJS = $(SRCS:%.c=%.o)
|
||||
# #
|
||||
# # #---------#
|
||||
# # # RULES #
|
||||
# # #---------#
|
||||
# # all: $(ODIR) $(NAME)
|
||||
# # $(NAME): $(OBJS) $(DEPS)
|
||||
# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
|
||||
# # %.o: %.c
|
||||
# # $(CC) $(CFLAGS) -c -o $@ $<
|
||||
# # clean:
|
||||
# # /bin/rm -rf $(ODIR)
|
||||
# # fclean: clean
|
||||
# # /bin/rm -f $(NAME)
|
||||
# # re: fclean all
|
||||
# # .PHONY: all clean fclean re
|
||||
#
|
||||
# # prompt "make" execute the first rule ("all")
|
||||
#
|
||||
# [architecture]
|
||||
# # main.c
|
||||
# # main.o
|
||||
# # function01.c
|
||||
# # function01.o ++
|
||||
# # function02.c
|
||||
# # function02.o ++
|
||||
# # header.h
|
||||
# # libtest.a
|
||||
# # Makefile
|
||||
# # program_test ++
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# shape of a rule :
|
||||
#
|
||||
# target: prerequisites ...
|
||||
# recipe ...
|
||||
#
|
||||
# when a target is called, its execution depends of the
|
||||
# prerequisites, if they have been more recently modify
|
||||
# than the target the makefile execute the recipe
|
||||
#
|
||||
# to execute a rull you have to call it's name with make :
|
||||
# "make rule", and by default the first rule is execute
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# "automatic variables"
|
||||
#
|
||||
# $@ is the name of the target that called the rule
|
||||
# $< is the name of the first prerequisite
|
||||
# $^ is the name of all the prerequisites
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# $(SRCS:%.c=%.o)
|
||||
#
|
||||
# is a built-in function called a "substitute reference",
|
||||
# an abbreviation for the expansion function "patsubst" :
|
||||
#
|
||||
# $(patsubst pattern,replacement,text)
|
||||
# $(text:pattern=replacement)
|
||||
#
|
||||
# $() is a variable which expand in its value
|
||||
#
|
||||
# % match everything, the value of the first % in
|
||||
# "replacement" is replaced with the text matched by the
|
||||
# first % in "pattern", it only works for the firsts
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# all: $(ODIR) $(NAME)
|
||||
#
|
||||
# ALL depends on ODIR and NAME, so if ODIR doesn't exist
|
||||
# it will be created, and then NAME is called
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# $(NAME): $(OBJS) $(DEPS)
|
||||
# $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
|
||||
#
|
||||
# NAME depends on OBJS and DEPS, so if any .o or any .h
|
||||
# have more recent date of modification NAME will execute
|
||||
# only for them
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# %.o: %.c
|
||||
# $(CC) $(CFLAGS) -c -o $@ $<
|
||||
#
|
||||
# when $(OBJS) expand in the list of .o files at the call
|
||||
# of the NAME rule, each of them call the rule "%.o" wich
|
||||
# depends on the equivalent .c, so if one has been
|
||||
# modified since last execution of ALL, it's recompiled in
|
||||
# object file with use of automatic variables $@ and $<
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# #clean:
|
||||
# /bin/rm -rf $(ODIR)
|
||||
#
|
||||
# "make clean" suppress all the .o files
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# fclean: clean
|
||||
# /bin/rm -f $(NAME)
|
||||
#
|
||||
# "make fclean" call CLEAN and suppress the executable
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# re: fclean all
|
||||
#
|
||||
# "make fclean" basically rerun make
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# .PHONY: all clean fclean re
|
||||
#
|
||||
# a phony target is one that is not the name of a file
|
||||
# if a file called "clean" for instance exist, the rule
|
||||
# CLEAN will never be executed when prompt "make clean"
|
||||
# because it will be considered up to date, but if it's
|
||||
# declared to be phony it will be executed in any case
|
||||
|
||||
# - - - - - - - - - - - - - - -
|
||||
# makefile with subdirectories
|
||||
# - - - - - - - - - - - - - - -
|
||||
|
||||
# put the .o in a "builds/" directory
|
||||
#
|
||||
# have the .c in a "srcs/" directory
|
||||
#
|
||||
# have the .h in an "includes" directory
|
||||
#
|
||||
# have multiples .a files
|
||||
#
|
||||
# [architecture]
|
||||
# # srcs/
|
||||
# # main.c
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # includes/
|
||||
# # header01.h
|
||||
# # header02.h
|
||||
# # libtest.a
|
||||
# # liboption.a
|
||||
# # Makefile
|
||||
#
|
||||
# # #-------------#
|
||||
# # # VARIABLES #
|
||||
# # #-------------#
|
||||
# # NAME = program_test
|
||||
# # CC = gcc
|
||||
# # VPATH = srcs
|
||||
# #
|
||||
# # IDIR = includes
|
||||
# # _DEPS = header01.h \
|
||||
# # header02.h
|
||||
# # DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
|
||||
# #
|
||||
# # LDIR = ./
|
||||
# # _LIBS = libtest.a \
|
||||
# # liboption.a
|
||||
# # LIBS = $(_LIBS:lib%.a=%)
|
||||
# #
|
||||
# # SRCS = main.c \
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # ODIR = ./builds
|
||||
# # OBJS = $(SRCS:%.c=$(ODIR)/%.o)
|
||||
# #
|
||||
# # CFLAGS = -I$(IDIR)
|
||||
# # LFLAGS = -L$(LDIR) -l$(LIBS)
|
||||
# #
|
||||
# # #---------#
|
||||
# # # RULES #
|
||||
# # #---------#
|
||||
# # all: $(ODIR) $(NAME)
|
||||
# # $(NAME): $(OBJS) $(DEPS)
|
||||
# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
|
||||
# # $(ODIR):
|
||||
# # mkdir -p $@
|
||||
# # $(ODIR)/%.o: %.c
|
||||
# # $(CC) $(CFLAGS) -c -o $@ $<
|
||||
# # clean:
|
||||
# # /bin/rm -rf $(ODIR)
|
||||
# # fclean: clean
|
||||
# # /bin/rm -f $(NAME)
|
||||
# # re: fclean all
|
||||
# # .PHONY: all clean fclean re
|
||||
#
|
||||
# # prompt "make" execute the first rule ("all")
|
||||
#
|
||||
# [architecture]
|
||||
# # srcs/
|
||||
# # main.c
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # includes/
|
||||
# # header01.h
|
||||
# # header02.h
|
||||
# # builds/ ++
|
||||
# # main.o ++
|
||||
# # function01.o ++
|
||||
# # function02.o ++
|
||||
# # libtest.a
|
||||
# # liboption.a
|
||||
# # Makefile
|
||||
# # program_test ++
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# VPATH = srcs
|
||||
#
|
||||
# build-in variable VPATH is a list of directories where
|
||||
# makefile looks for files that it doesn't find in the
|
||||
# first place, so it let you easily put .c files into
|
||||
# subdirectories
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# LIBS = $(_LIBS:lib%.a=%)
|
||||
#
|
||||
# from "libtest.a" and "liboption.a" it creates "test"
|
||||
# and "option"
|
||||
#
|
||||
# as said, the value of the % in "replacement" is
|
||||
# replaced with the text matched by the % in "pattern"
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# OBJS = $(SRCS:%.c=$(ODIR)/%.o)
|
||||
#
|
||||
# creates the list of .o from the .c with addition of the
|
||||
# path directory "builds/main.o"
|
||||
#
|
||||
# it could be :
|
||||
# $(patsubst %.c,$(ODIR)/%.o,$(SRCS))
|
||||
# or :
|
||||
# $(addprefix $(ODIR)/, $(SRCS:.c=.o))
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# $(NAME): $(OBJS) $(DEPS)
|
||||
# $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
|
||||
#
|
||||
# NAME depends on OBJS and DEPS, so if any .o or any .h
|
||||
# have more recent date of modification NAME will execute
|
||||
# again only for them
|
||||
|
||||
# - - - - - - - - - - - - - - - - -
|
||||
# makefile making another makefile
|
||||
# - - - - - - - - - - - - - - - - -
|
||||
|
||||
# compiling a makefile with compiling another makefile in
|
||||
# a subdirectory wich contain the library used by the
|
||||
# roots makefile
|
||||
#
|
||||
# [architecture]
|
||||
# # srcs/
|
||||
# # main.c
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # includes/
|
||||
# # header01.h
|
||||
# # header02.h
|
||||
# # libtest/
|
||||
# # Makefile
|
||||
# # header_lib.h
|
||||
# # function_lib01.c
|
||||
# # function_lib02.c
|
||||
# # libtest.a
|
||||
# # Makefile
|
||||
#
|
||||
# # #-------------#
|
||||
# # # VARIABLES #
|
||||
# # #-------------#
|
||||
# # NAME = program_test
|
||||
# # CC = gcc
|
||||
# # VPATH = srcs
|
||||
# #
|
||||
# # IDIR = includes
|
||||
# # _DEPS = header01.h \
|
||||
# # header02.h
|
||||
# # DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
|
||||
# #
|
||||
# # LDIR = ./libtest/
|
||||
# # _LIBS = libtest.a \
|
||||
# # LIBS = $(_LIBS:lib%.a=%)
|
||||
# #
|
||||
# # SRCS = main.c \
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # ODIR = ./builds
|
||||
# # OBJS = $(SRCS:%.c=$(ODIR)/%.o)
|
||||
# #
|
||||
# # CFLAGS = -I$(IDIR)
|
||||
# # LFLAGS = -L$(LDIR) -l$(LIBS)
|
||||
# #
|
||||
# # #---------#
|
||||
# # # RULES #
|
||||
# # #---------#
|
||||
# # all: $(ODIR) $(NAME)
|
||||
# # $(NAME): $(OBJS) $(DEPS)
|
||||
# # make -C $(LDIR)
|
||||
# # $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
|
||||
# # $(ODIR):
|
||||
# # mkdir -p $@
|
||||
# # $(ODIR)/%.o: %.c
|
||||
# # $(CC) $(CFLAGS) -c -o $@ $<
|
||||
# # clean:
|
||||
# # make clean -C $(LDIR)
|
||||
# # /bin/rm -rf $(ODIR)
|
||||
# # fclean: clean
|
||||
# # make fclean -C $(LDIR)
|
||||
# # /bin/rm -f $(NAME)
|
||||
# # re: fclean all
|
||||
# # .PHONY: all clean fclean re
|
||||
#
|
||||
# # prompt "make" execute the first rule ("all")
|
||||
#
|
||||
# [archtecture]
|
||||
# # srcs/
|
||||
# # main.c
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # includes/
|
||||
# # header01.h
|
||||
# # header02.h
|
||||
# # builds/ ++
|
||||
# # main.o ++
|
||||
# # function01.o ++
|
||||
# # function02.o ++
|
||||
# # libtest/
|
||||
# # Makefile
|
||||
# # header_lib.h
|
||||
# # function_lib01.c
|
||||
# # function_lib02.c
|
||||
# # libtest.a
|
||||
# # Makefile
|
||||
# # program_test ++
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# make -C $(LDIR)
|
||||
#
|
||||
# make -C <path>
|
||||
#
|
||||
# the -C option says to makefile it should first go to the
|
||||
# path location and then do "make"
|
||||
#
|
||||
# it's similar to :
|
||||
#
|
||||
# rule:
|
||||
# cd $(LDIR) && make
|
||||
#
|
||||
|
||||
# - - - - - - - - - - - -
|
||||
# makefile for a library
|
||||
# - - - - - - - - - - - -
|
||||
|
||||
#
|
||||
# exemple of a makefile used not for a compilation into a
|
||||
# binary executable, but to create a library
|
||||
#
|
||||
# [architecture]
|
||||
# # srcs/
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # includes/
|
||||
# # header.h
|
||||
# # Makefile
|
||||
#
|
||||
# # #-------------#
|
||||
# # # VARIABLES #
|
||||
# # #-------------#
|
||||
# # NAME = libtest.a
|
||||
# # CC = gcc
|
||||
# # VPATH = srcs
|
||||
# #
|
||||
# # IDIR = includes
|
||||
# # _DEPS = header.h
|
||||
# # DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
|
||||
# #
|
||||
# # SRCS = function01.c \
|
||||
# # function02.c
|
||||
# # ODIR = ./builds
|
||||
# # OBJS = $(SRCS:%.c=$(ODIR)/%.o)
|
||||
# #
|
||||
# # CFLAGS = -I$(IDIR)
|
||||
# #
|
||||
# # #---------#
|
||||
# # # RULES #
|
||||
# # #---------#
|
||||
# # all: $(ODIR) $(NAME)
|
||||
# # $(NAME): $(OBJS) $(DEP)
|
||||
# # ar -rc $@ $(OBJS)
|
||||
# # @ranlib $@
|
||||
# # $(ODIR):
|
||||
# # mkdir -p $@
|
||||
# # $(ODIR)/%.o: %.c
|
||||
# # $(CC) $(CFLAGS) -c -o $@ $<
|
||||
# # clean:
|
||||
# # /bin/rm -rf $(ODIR)
|
||||
# # fclean: clean
|
||||
# # /bin/rm -f $(NAME)
|
||||
# # re: fclean all
|
||||
# # .PHONY: all clean fclean re
|
||||
#
|
||||
# # prompt "make" execute the first rule ("all")
|
||||
#
|
||||
# [archtecture]
|
||||
# # srcs/
|
||||
# # function01.c
|
||||
# # function02.c
|
||||
# # includes/
|
||||
# # header.h
|
||||
# # builds/
|
||||
# # function01.o
|
||||
# # function02.o
|
||||
# # libtest.a
|
||||
# # Makefile
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# NAME = libtest.a
|
||||
#
|
||||
# name is now the name of the library to be built
|
||||
#
|
||||
# -----
|
||||
#
|
||||
# @ranlib $@
|
||||
#
|
||||
# @ tells makefile not to show the line in prompt
|
||||
#
|
||||
|
||||
#
|
||||
# THE END
|
||||
# enjoy, futur me
|
||||
#
|
||||
BIN
libftt/builds/ft_abs.o
Normal file
BIN
libftt/builds/ft_abs.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_any.o
Normal file
BIN
libftt/builds/ft_any.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_arraymap.o
Normal file
BIN
libftt/builds/ft_arraymap.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_atoi.o
Normal file
BIN
libftt/builds/ft_atoi.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_atoibase.o
Normal file
BIN
libftt/builds/ft_atoibase.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_bzero.o
Normal file
BIN
libftt/builds/ft_bzero.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_calloc.o
Normal file
BIN
libftt/builds/ft_calloc.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_concat_free.o
Normal file
BIN
libftt/builds/ft_concat_free.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_convert.o
Normal file
BIN
libftt/builds/ft_convert.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_convertbase.o
Normal file
BIN
libftt/builds/ft_convertbase.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_convertbase_free.o
Normal file
BIN
libftt/builds/ft_convertbase_free.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_flag_transform.o
Normal file
BIN
libftt/builds/ft_flag_transform.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_flag_transform_bonus.o
Normal file
BIN
libftt/builds/ft_flag_transform_bonus.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_foreach.o
Normal file
BIN
libftt/builds/ft_foreach.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_gnl.o
Normal file
BIN
libftt/builds/ft_gnl.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_greater.o
Normal file
BIN
libftt/builds/ft_greater.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_isalnum.o
Normal file
BIN
libftt/builds/ft_isalnum.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_isalpha.o
Normal file
BIN
libftt/builds/ft_isalpha.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_isascii.o
Normal file
BIN
libftt/builds/ft_isascii.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_isdigit.o
Normal file
BIN
libftt/builds/ft_isdigit.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_isprint.o
Normal file
BIN
libftt/builds/ft_isprint.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_issort.o
Normal file
BIN
libftt/builds/ft_issort.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_itoa.o
Normal file
BIN
libftt/builds/ft_itoa.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstadd_back.o
Normal file
BIN
libftt/builds/ft_lstadd_back.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstadd_front.o
Normal file
BIN
libftt/builds/ft_lstadd_front.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstclear.o
Normal file
BIN
libftt/builds/ft_lstclear.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstdelone.o
Normal file
BIN
libftt/builds/ft_lstdelone.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstiter.o
Normal file
BIN
libftt/builds/ft_lstiter.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstlast.o
Normal file
BIN
libftt/builds/ft_lstlast.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstmap.o
Normal file
BIN
libftt/builds/ft_lstmap.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstnew.o
Normal file
BIN
libftt/builds/ft_lstnew.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_lstsize.o
Normal file
BIN
libftt/builds/ft_lstsize.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memalloc.o
Normal file
BIN
libftt/builds/ft_memalloc.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memccpy.o
Normal file
BIN
libftt/builds/ft_memccpy.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memchr.o
Normal file
BIN
libftt/builds/ft_memchr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memcmp.o
Normal file
BIN
libftt/builds/ft_memcmp.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memcpy.o
Normal file
BIN
libftt/builds/ft_memcpy.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memdel.o
Normal file
BIN
libftt/builds/ft_memdel.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memmove.o
Normal file
BIN
libftt/builds/ft_memmove.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_memset.o
Normal file
BIN
libftt/builds/ft_memset.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_next_word.o
Normal file
BIN
libftt/builds/ft_next_word.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_printf.o
Normal file
BIN
libftt/builds/ft_printf.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putchar.o
Normal file
BIN
libftt/builds/ft_putchar.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putchar_fd.o
Normal file
BIN
libftt/builds/ft_putchar_fd.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putendl.o
Normal file
BIN
libftt/builds/ft_putendl.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putendl_fd.o
Normal file
BIN
libftt/builds/ft_putendl_fd.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putnbr.o
Normal file
BIN
libftt/builds/ft_putnbr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putnbr_fd.o
Normal file
BIN
libftt/builds/ft_putnbr_fd.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putnbrbase.o
Normal file
BIN
libftt/builds/ft_putnbrbase.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putnbrendl.o
Normal file
BIN
libftt/builds/ft_putnbrendl.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putnbrendl_fd.o
Normal file
BIN
libftt/builds/ft_putnbrendl_fd.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putstr.o
Normal file
BIN
libftt/builds/ft_putstr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_putstr_fd.o
Normal file
BIN
libftt/builds/ft_putstr_fd.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_sign.o
Normal file
BIN
libftt/builds/ft_sign.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_smaller.o
Normal file
BIN
libftt/builds/ft_smaller.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_split.o
Normal file
BIN
libftt/builds/ft_split.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strcat.o
Normal file
BIN
libftt/builds/ft_strcat.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strchr.o
Normal file
BIN
libftt/builds/ft_strchr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strchrset.o
Normal file
BIN
libftt/builds/ft_strchrset.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strclr.o
Normal file
BIN
libftt/builds/ft_strclr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strcmp.o
Normal file
BIN
libftt/builds/ft_strcmp.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strcpy.o
Normal file
BIN
libftt/builds/ft_strcpy.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strdel.o
Normal file
BIN
libftt/builds/ft_strdel.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strdup.o
Normal file
BIN
libftt/builds/ft_strdup.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strequ.o
Normal file
BIN
libftt/builds/ft_strequ.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_striter.o
Normal file
BIN
libftt/builds/ft_striter.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_striteri.o
Normal file
BIN
libftt/builds/ft_striteri.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strjoin.o
Normal file
BIN
libftt/builds/ft_strjoin.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strjoinfree.o
Normal file
BIN
libftt/builds/ft_strjoinfree.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strlcat.o
Normal file
BIN
libftt/builds/ft_strlcat.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strlcpy.o
Normal file
BIN
libftt/builds/ft_strlcpy.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strlen.o
Normal file
BIN
libftt/builds/ft_strlen.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strmap.o
Normal file
BIN
libftt/builds/ft_strmap.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strmapi.o
Normal file
BIN
libftt/builds/ft_strmapi.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strmultisplit.o
Normal file
BIN
libftt/builds/ft_strmultisplit.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strncat.o
Normal file
BIN
libftt/builds/ft_strncat.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strncmp.o
Normal file
BIN
libftt/builds/ft_strncmp.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strncpy.o
Normal file
BIN
libftt/builds/ft_strncpy.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strnequ.o
Normal file
BIN
libftt/builds/ft_strnequ.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strnew.o
Normal file
BIN
libftt/builds/ft_strnew.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strnstr.o
Normal file
BIN
libftt/builds/ft_strnstr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strrchr.o
Normal file
BIN
libftt/builds/ft_strrchr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strstr.o
Normal file
BIN
libftt/builds/ft_strstr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_strtrim.o
Normal file
BIN
libftt/builds/ft_strtrim.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_substr.o
Normal file
BIN
libftt/builds/ft_substr.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_tolower.o
Normal file
BIN
libftt/builds/ft_tolower.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_toupper.o
Normal file
BIN
libftt/builds/ft_toupper.o
Normal file
Binary file not shown.
BIN
libftt/builds/ft_utoa.o
Normal file
BIN
libftt/builds/ft_utoa.o
Normal file
Binary file not shown.
31
libftt/includes/ft_get_next_line.h
Normal file
31
libftt/includes/ft_get_next_line.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* get_next_line.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/01/29 10:19:37 by hulamy #+# #+# */
|
||||
/* Updated: 2020/02/25 18:48:49 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef GET_NEXT_LINE_H
|
||||
# define GET_NEXT_LINE_H
|
||||
|
||||
# ifndef BUFFER_SIZE
|
||||
# define BUFFER_SIZE 1
|
||||
# endif
|
||||
|
||||
typedef struct s_gnlist
|
||||
{
|
||||
int lfd;
|
||||
char *str;
|
||||
struct s_gnlist *next;
|
||||
} t_gnlist;
|
||||
|
||||
int ft_gnl(const int fd, char **line);
|
||||
int multi_fd(int fd, t_gnlist **lst);
|
||||
int free_lst(t_gnlist **lst, int ret);
|
||||
|
||||
#endif
|
||||
62
libftt/includes/ft_printf.h
Normal file
62
libftt/includes/ft_printf.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_printf.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2020/02/27 12:07:47 by hulamy #+# #+# */
|
||||
/* Updated: 2020/03/12 20:35:10 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef FT_PRINTF_H
|
||||
# define FT_PRINTF_H
|
||||
# include <stdarg.h> // to use va_arg
|
||||
|
||||
/*
|
||||
** ft_printf.c
|
||||
*/
|
||||
|
||||
char *specifier(char *s);
|
||||
int ft_expand_star(int nbr, char **string);
|
||||
int ft_put_word(char *s, char *type, int size);
|
||||
char *convert_with_flags(char *s, va_list ap, char *type, int *size);
|
||||
int ft_printf(char *string, ...);
|
||||
|
||||
/*
|
||||
** ft_next_word.c
|
||||
*/
|
||||
|
||||
int width_precision(char *s);
|
||||
int word_length(char *s);
|
||||
char *next_word(char **s);
|
||||
|
||||
/*
|
||||
** ft_convert.c
|
||||
*/
|
||||
|
||||
char *conv_i(char c, long int i);
|
||||
char *conv_u(char c, unsigned long int i);
|
||||
char *ft_convert(va_list ap, char *type, char **s);
|
||||
|
||||
/*
|
||||
** ft_flag_transform.c
|
||||
*/
|
||||
|
||||
char *precision_int(char *print, int precision);
|
||||
char *ft_precision(char *s, char *print, char *type);
|
||||
char *width_flags(char *print, char *s, int width, int zero);
|
||||
char *ft_width(char *s, char *print, int *size, char *type);
|
||||
char *ft_flag_transform(char *s, char *print, char *type, int *size);
|
||||
|
||||
/*
|
||||
** ft_flag_transform_bonus.c
|
||||
*/
|
||||
|
||||
char *ft_plus(char *s, char *print, char *type);
|
||||
char *ft_sharp(char *s, char *print, char *type);
|
||||
char *ft_sharp_again(char *s, char *print, char *type);
|
||||
char *ft_space(char *s, char *print, char *type, int *size);
|
||||
|
||||
#endif
|
||||
169
libftt/includes/libft.h
Normal file
169
libftt/includes/libft.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* libft.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 14:45:53 by hulamy #+# #+# */
|
||||
/* Updated: 2020/02/27 18:06:10 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef LIBFT_H
|
||||
# define LIBFT_H
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include <stdlib.h>
|
||||
# include "ft_get_next_line.h"
|
||||
# include "ft_printf.h"
|
||||
# include <stdarg.h> // to use va_arg in ft_printf
|
||||
|
||||
void *ft_memset(void *b, int c, size_t len);
|
||||
void ft_bzero(void *s, size_t n);
|
||||
void *ft_memcpy(void *dst, const void *src, size_t n);
|
||||
void *ft_memccpy(void *dst, const void *src, int c, size_t n);
|
||||
void *ft_memmove(void *dst, const void *src, size_t len);
|
||||
void *ft_memchr(const void *s, int c, size_t n);
|
||||
int ft_memcmp(const void *s1, const void *s2, size_t n);
|
||||
size_t ft_strlen(const char *str);
|
||||
int ft_isalpha(int c);
|
||||
int ft_isdigit(int c);
|
||||
int ft_isalnum(int c);
|
||||
int ft_isascii(int c);
|
||||
int ft_isprint(int c);
|
||||
int ft_toupper(int c);
|
||||
int ft_tolower(int c);
|
||||
char *ft_strchr(const char *s, int c);
|
||||
char *ft_strrchr(const char *s, int c);
|
||||
char *ft_strchrset(const char *s, const char *set);
|
||||
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
||||
size_t ft_strlcpy(char *dst, const char *src, size_t size);
|
||||
size_t ft_strlcat(char *dst, const char *src, size_t size);
|
||||
char *ft_strnstr(const char *b, const char *l, size_t s);
|
||||
int ft_atoi(const char *str);
|
||||
void *ft_calloc(size_t count, size_t size);
|
||||
char *ft_strdup(const char *s1);
|
||||
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||
char *ft_strjoin(char const *s1, char const *s2);
|
||||
char *ft_strtrim(char const *s1, char const *set);
|
||||
char **ft_split(char const *s, char c);
|
||||
char *ft_itoa(long int n);
|
||||
char *ft_utoa(unsigned long int n);
|
||||
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
|
||||
void ft_putchar_fd(char c, int fd);
|
||||
void ft_putstr_fd(char *s, int fd);
|
||||
void ft_putendl_fd(char *s, int fd);
|
||||
void ft_putnbr_fd(int n, int fd);
|
||||
|
||||
typedef struct s_list
|
||||
{
|
||||
void *content;
|
||||
struct s_list *next;
|
||||
} t_list;
|
||||
|
||||
t_list *ft_lstnew(void *content);
|
||||
void ft_lstadd_front(t_list **alst, t_list *n);
|
||||
int ft_lstsize(t_list *lst);
|
||||
t_list *ft_lstlast(t_list *lst);
|
||||
void ft_lstadd_back(t_list **alst, t_list *n);
|
||||
void ft_lstdelone(t_list *lst, void (*del)(void *));
|
||||
void ft_lstclear(t_list **lst, void (*del)(void *));
|
||||
void ft_lstiter(t_list *lst, void (*f)(void *));
|
||||
t_list *ft_lstmap(t_list *l, void *(*f)(void*), void (*d)(void*));
|
||||
|
||||
char *ft_strcat(char *s1, const char *s2);
|
||||
int ft_strcmp(const char *s1, const char *s2);
|
||||
char *ft_strcpy(char *dst, const char *src);
|
||||
char *ft_strncat(char *s1, const char *s2, size_t n);
|
||||
char *ft_strncpy(char *dst, const char *src, size_t len);
|
||||
char *ft_strstr(const char *big, const char *little);
|
||||
void ft_strclr(char *s);
|
||||
void ft_strdel(char **as);
|
||||
int ft_strequ(char const *s1, char const *s2);
|
||||
void ft_striter(char *s, void (*f)(char *));
|
||||
void ft_striteri(char *s, void (*f)(unsigned int, char *));
|
||||
char *ft_strjoinfree(char *s1, char *s2);
|
||||
char *ft_strmap(char const *s, char (*f)(char));
|
||||
int ft_strnequ(char const *s1, char const *s2, size_t n);
|
||||
char *ft_strnew(size_t size);
|
||||
void *ft_memalloc(size_t size);
|
||||
void ft_memdel(void **ap);
|
||||
void ft_putchar(char c);
|
||||
void ft_putendl(char const *str);
|
||||
void ft_putnbr(int nbr);
|
||||
void ft_putstr(char const *str);
|
||||
void ft_putnbrbase(int nbr, char *base);
|
||||
int ft_atoibase(char *str, char *base);
|
||||
char *ft_convertbase(char *nbr, char *base_from, char *base_to);
|
||||
char *ft_convertbase_free(char *nbr, char *b_from, char *b_to);
|
||||
char **ft_strmultisplit(char *str, char *charset);
|
||||
int ft_any(char **tab, int (*f)(char*));
|
||||
void ft_foreach(int *tab, int length, void (*f)(int));
|
||||
int ft_issort(int *tab, int length, int (*f)(int, int));
|
||||
int *ft_arraymap(int *tab, int length, int(*f)(int));
|
||||
void ft_putnbrendl(int n);
|
||||
void ft_putnbrendl_fd(int n, int fd);
|
||||
int ft_get_next_line(const int fd, char **line);
|
||||
char *ft_concat_free(char *str1, char *str2);
|
||||
int ft_abs(int n);
|
||||
int ft_greater(int a, int b);
|
||||
int ft_smaller(int a, int b);
|
||||
int ft_sign(int i);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# include <stdarg.h> // to use va_arg
|
||||
|
||||
/*
|
||||
** ft_printf.c
|
||||
*/
|
||||
|
||||
char *specifier(char *s);
|
||||
int ft_expand_star(int nbr, char **string);
|
||||
int ft_put_word(char *s, char *type, int size);
|
||||
char *convert_with_flags(char *s, va_list ap, char *type, int *size);
|
||||
int ft_printf(char *string, ...);
|
||||
|
||||
/*
|
||||
** ft_next_word.c
|
||||
*/
|
||||
|
||||
int width_precision(char *s);
|
||||
int word_length(char *s);
|
||||
char *next_word(char **s);
|
||||
|
||||
/*
|
||||
** ft_convert.c
|
||||
*/
|
||||
|
||||
char *conv_i(char c, long int i);
|
||||
char *conv_u(char c, unsigned long int i);
|
||||
char *ft_convert(va_list ap, char *type, char **s);
|
||||
|
||||
/*
|
||||
** ft_flag_transform.c
|
||||
*/
|
||||
|
||||
char *precision_int(char *print, int precision);
|
||||
char *ft_precision(char *s, char *print, char *type);
|
||||
char *width_flags(char *print, char *s, int width, int zero);
|
||||
char *ft_width(char *s, char *print, int *size, char *type);
|
||||
char *ft_flag_transform(char *s, char *print, char *type, int *size);
|
||||
|
||||
/*
|
||||
** ft_flag_transform_bonus.c
|
||||
*/
|
||||
|
||||
char *ft_plus(char *s, char *print, char *type);
|
||||
char *ft_sharp(char *s, char *print, char *type);
|
||||
char *ft_sharp_again(char *s, char *print, char *type);
|
||||
char *ft_space(char *s, char *print, char *type, int *size);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user