diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-01 21:51:51 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-01 21:58:05 +0200 |
| commit | 65c5d5157e890e9f9445a94fb2d7f660e5492d8e (patch) | |
| tree | 78613f26bdc531104c3e32d76ffcaf3c2f7013f5 /include | |
| parent | c128213daa677d548bfc2905496257fe4a4faf79 (diff) | |
| parent | a1675f56b35f5521a91851bae8ca650706374ae6 (diff) | |
| download | libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.tar.gz libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.tar.bz2 libft-65c5d5157e890e9f9445a94fb2d7f660e5492d8e.zip | |
Merge branch 'minishell'
Diffstat (limited to 'include')
| -rw-r--r-- | include/libft_ctype.h | 2 | ||||
| -rw-r--r-- | include/libft_ht.h | 42 | ||||
| -rw-r--r-- | include/libft_io.h | 2 | ||||
| -rw-r--r-- | include/libft_lst.h | 27 | ||||
| -rw-r--r-- | include/libft_mem.h | 2 | ||||
| -rw-r--r-- | include/libft_str.h | 3 | ||||
| -rw-r--r-- | include/libft_types.h | 2 | ||||
| -rw-r--r-- | include/libft_util.h | 20 | ||||
| -rw-r--r-- | include/libft_vec.h | 46 |
9 files changed, 119 insertions, 27 deletions
diff --git a/include/libft_ctype.h b/include/libft_ctype.h index ad42c64..61f4534 100644 --- a/include/libft_ctype.h +++ b/include/libft_ctype.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:35:31 by cacharle #+# #+# */ -/* Updated: 2020/02/10 05:18:30 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:08:52 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/include/libft_ht.h b/include/libft_ht.h index 62f2ee1..10c6fc7 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -6,28 +6,45 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */ -/* Updated: 2020/02/19 02:38:28 by cacharle ### ########.fr */ +/* Updated: 2020/04/01 17:59:35 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_HT_H # define LIBFT_HT_H +/* +** \file libft_ht.h +** \brief Hash table manipulation +*/ + # include "libft.h" # include "libft_lst.h" -typedef struct s_ftht_content +/* +** \brief Hash table entry, key/value pair +** \param key String key +** \param value Pointer to data +*/ + +typedef struct s_ftht_entry { char *key; void *value; -} t_ftht_content; +} t_ftht_entry; + +typedef t_ftlst* t_ftht_bucket; -typedef t_ftlst* t_ftht_entry; +/* +** \brief Hash table struct +** \param size Number of buckets +** \param buckets Bucket array +*/ typedef struct s_ftht { t_ftsize size; - t_ftht_entry *entries; + t_ftht_bucket *buckets; } t_ftht; typedef t_ftuint t_ftht_digest; @@ -35,22 +52,19 @@ typedef t_ftuint t_ftht_digest; t_ftht_digest ft_hthash(t_ftht *ht, char *key); t_ftht *ft_htnew(t_ftsize size); -void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)); -void ft_htdestroy_all(t_ftht *ht); -void ft_htdestroy_key(t_ftht *ht); +void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_entry*)); void *ft_htget(t_ftht *ht, char *key); -t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value, - void (*del)(t_ftht_content*)); +t_ftht_entry *ft_htset(t_ftht *ht, char *key, void *value, + void (*del)(t_ftht_entry*)); void ft_htdelone(t_ftht *ht, char *key, - void (*del)(t_ftht_content*)); -void ft_htdelone_key(t_ftht *ht, char *key); -t_ftht_content *ft_htcontent_new(char *key, void *value); + void (*del)(t_ftht_entry*)); +t_ftht_entry *ft_htentry_new(char *key, void *value); +void ft_htiter(t_ftht *ht, void (*f)(t_ftht_entry*)); /* ** internals */ -void ft_inter_htdelcontent_key(t_ftht_content *content); int ft_inter_htkey_cmp(const void *ref_key, const void *content); diff --git a/include/libft_io.h b/include/libft_io.h index 76bce17..418b230 100644 --- a/include/libft_io.h +++ b/include/libft_io.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:35:43 by cacharle #+# #+# */ -/* Updated: 2020/02/14 02:23:43 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:09:11 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/include/libft_lst.h b/include/libft_lst.h index a48c1aa..d7157a9 100644 --- a/include/libft_lst.h +++ b/include/libft_lst.h @@ -6,36 +6,47 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:39 by cacharle #+# #+# */ -/* Updated: 2020/02/17 03:05:36 by cacharle ### ########.fr */ +/* Updated: 2020/04/01 17:59:50 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_LST_H # define LIBFT_LST_H +/* +** \file libft_lst.h +** \brief Linked list Manipulation +*/ + # include <stdlib.h> # include "libft_types.h" # include "libft_algo.h" +/* +** \brief List struct +** \param data Pointer to node data +** \param next Pointer to next node or NULL if last node +*/ + typedef struct s_ftlst { - void *content; + void *data; struct s_ftlst *next; } t_ftlst; -typedef void (*t_ftdel_func)(void *); +typedef void (*t_ftdel_func)(void *); -t_ftlst *ft_lstnew(void const *content); -void ft_lstadd_front(t_ftlst **alst, t_ftlst *new); +t_ftlst *ft_lstnew(void const *data); int ft_lstsize(t_ftlst *lst); +void ft_lstpush_front(t_ftlst **alst, t_ftlst *new); +void ft_lstpush_back(t_ftlst **alst, t_ftlst *new); +void ft_lstpop_front(t_ftlst **lst, void (*del)(void *)); t_ftlst *ft_lstlast(t_ftlst *lst); -void ft_lstadd_back(t_ftlst **alst, t_ftlst *new); void ft_lstdelone(t_ftlst *lst, void (*del)(void *)); -void ft_lstclear(t_ftlst **lst, void (*del)(void *)); +void ft_lstdestroy(t_ftlst **lst, void (*del)(void *)); void ft_lstiter(t_ftlst *lst, void (*f)(void *)); t_ftlst *ft_lstmap(t_ftlst *lst, void *(*f)(void *), t_ftdel_func del); -void ft_lstpop_front(t_ftlst **lst, void (*del)(void *)); t_ftlst *ft_lstreverse_ret(t_ftlst *lst); void ft_lstreverse(t_ftlst **lst); void ft_lstremove_if(t_ftlst **lst, diff --git a/include/libft_mem.h b/include/libft_mem.h index fb52760..7ec7122 100644 --- a/include/libft_mem.h +++ b/include/libft_mem.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:35:57 by cacharle #+# #+# */ -/* Updated: 2020/02/13 03:11:09 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:17:48 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/include/libft_str.h b/include/libft_str.h index 1f665b5..d65c90f 100644 --- a/include/libft_str.h +++ b/include/libft_str.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:39:22 by cacharle #+# #+# */ -/* Updated: 2020/02/14 03:45:15 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:09:56 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -53,6 +53,7 @@ void ft_striter(char *s, void (*f)(char *)); void ft_striteri(char *s, void (*f)(unsigned int, char *)); char *ft_substr(char const *s, unsigned int start, size_t len); char *ft_strjoin(char const *s1, char const *s2); +char *ft_strjoin3(char const *s1, char const *s2, char const *s3); char *ft_strjoinf(char const *s1, char const *s2, t_ftstrjoinf_tag tag); char *ft_strtrim(char const *s1, char const *set); char **ft_split(char const *s, char c); diff --git a/include/libft_types.h b/include/libft_types.h index 20fe0f7..3987a80 100644 --- a/include/libft_types.h +++ b/include/libft_types.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:56 by cacharle #+# #+# */ -/* Updated: 2020/02/13 03:07:56 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:10:02 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/include/libft_util.h b/include/libft_util.h new file mode 100644 index 0000000..7a9e056 --- /dev/null +++ b/include/libft_util.h @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_util.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/27 17:51:36 by cacharle #+# #+# */ +/* Updated: 2020/02/27 17:52:16 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_UTIL_H +# define LIBFT_UTIL_H + +# include <stdlib.h> + +void *ft_split_destroy(char **strs); + +#endif diff --git a/include/libft_vec.h b/include/libft_vec.h new file mode 100644 index 0000000..62ec257 --- /dev/null +++ b/include/libft_vec.h @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_vec.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/01 18:57:16 by charles #+# #+# */ +/* Updated: 2020/04/01 19:40:53 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_VEC_H +# define LIBFT_VEC_H + +/* +** \file libft_vec.h +** \brief Vector manipulation +*/ + +# include <stdlib.h> +# include <stddef.h> +# include "libft_mem.h" + +/* +** \brief Vector struct +** \param data Underlying array +** \param capacity Size of the underlying array +** \param size Number of element in the vector +*/ + +typedef struct s_ftvec +{ + void **data; + size_t capacity; + size_t size; +} t_ftvec; + +t_ftvec *ft_vecnew(size_t capacity); +void ft_vecdestroy(t_ftvec *vec, void (*del)(void *elem)); +t_ftvec *ft_vecgrow(t_ftvec *vec); +t_ftvec *ft_vecpush(t_ftvec *vec, void *pushed); +void ft_vecpop(t_ftvec *vec, void (*del)(void *elem)); +void ft_veciter(t_ftvec *vec, void (*f)(void *elem)); + +#endif |
