-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_type.h
243 lines (210 loc) · 6.35 KB
/
ft_type.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_type.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgalaup <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/25 16:30:05 by fgalaup #+# #+# */
/* Updated: 2021/05/06 17:29:22 by fgalaup ### ########lyon.fr */
/* */
/* ************************************************************************** */
#ifndef FT_TYPE_H
# define FT_TYPE_H
/*
** =============================================================================
** GENERIC
** =============================================================================
*/
/*
** Type Name: f_termination
** Description : This type contain ptr to the function call when malloc failure
** occure to terminating the programme.
*/
typedef void (*t_ftermination)(void *);
typedef t_ftermination t_term;
/*
** Enum Name: e_standard_file_descriptor
** Description : This Enum contain standard file descriptor identifier
** used by file libc function.
** Possible Value :
** - standard_input = 0 : Identifer for read file descriptor
** - standard_output = 1 : Identifer for write file descriptor
** - standard_error = 2 : Identifer for error write file descriptor
*/
enum e_standard_file_descriptor
{
standard_input = 0,
standard_output = 1,
standard_error = 2,
};
/*
** Type Name: t_boolean
** Description : This type contain a boolean value the posible value as contain
** in enumaration e_boolean
** Possible Value :
** - (TRUE) = 1 : The condition is true
** - (FALSE) = 0 : The condition is false
*/
enum e_boolean
{
FT_FALSE = 0,
FT_TRUE
};
typedef char t_boolean;
typedef t_boolean t_bool;
/*
** Type Name: t_byte
** Description : Better name for non char data
*/
typedef char t_byte;
/*
** Type Name: t_bytes
** Description : Better name for generic bytes array
*/
typedef t_byte* t_bytes;
/*
** =============================================================================
** LIST
** =============================================================================
*/
/*
** Type Name: t_list
** Description : This structure type store link of chained list.
** Vars :
** - (void*) content : The value of to store in the link of list.
** - (s_list*) next : The address of next element of the list.
*/
typedef struct s_list
{
void *content;
struct s_list *next;
} t_list;
/*
** Type Name: s_bidirectional_list
** Description : This structure type store link of double chained list.
** Vars :
** - (void*) content : The value of to store in the link of list.
** - (s_list*) next : The address of next element of the list.
** - (s_bidirectional_list*) prev : The address of prev element of the list.
*/
typedef struct s_bidirectional_list
{
void *content;
struct s_bidirectional_list *next;
struct s_bidirectional_list *prev;
} t_bidirectional_list;
typedef t_bidirectional_list*t_blst;
/*
** Type Name: t_bytes_array
** Description : This structure is usually contained in a list.
** The Structre store a non null (\0) terminated bytes array
** Vars :
** - (size) size : The size of array (number of element).
** - (byte*) array : The array.
*/
typedef struct s_bytes_array
{
int size;
char *array;
} t_bytes_array;
/*
** Type Name: t_associative
** Description : This structure is usually contained in a list.
** The Structre associate an element with key in associative list
** Vars :
** - (String) key : The key.
** - (void*) value : The value of to store in the link of associative list.
** NOTE : The is never free by a function of libft (Use static element)
*/
typedef struct s_associative
{
char *key;
void *value;
} t_associative;
typedef t_associative t_asso;
/*
** Type Name: t_node_binary
** Description : This structure describe node of binary tree.
** Vars :
** - (void*) value : The value of to store in the node of binary tree.
** - (t_node_binary*) right : the right branch of binary tree
** If null id the end dont have children node on this side.
** - (t_node_binary*) left : the left branch of binary tree
** - If null id the end dont have children node on this side.
*/
typedef struct s_node_binary
{
void *value;
struct s_node_binary *right;
struct s_node_binary *left;
} t_node_binary;
typedef t_node_binary t_bnode;
/*
** =============================================================================
** MATH
** =============================================================================
*/
/*
** Type Name: t_xy
** Description : This structure type store tow number representing vector,
** coordonee.
** Vars :
** - double x : The value for the axis of X-axis (abscissa).
** - double y : The value for the axis of Y-axis (???).
*/
typedef struct s_xy
{
double x;
double y;
} t_xy;
/*
** Type Name: t_xy
** Description : This structure type store tow number representing coordonee.
** Vars :
** - int x : The value for the axis of X-axis (abscissa).
** - int y : The value for the axis of Y-axis (???).
*/
typedef struct s_pos
{
int x;
int y;
} t_pos;
/*
** =============================================================================
** FILE
** =============================================================================
*/
/*
** Type Name: t_open_fd
** Description : This structure type store one file descriptor
** with non returned content.
** Vars :
** - (int) fd : The file desciptor (id).
** - (ssize) size : the size of unreturned content.
** - (char *) over : The unreturned content.
*/
typedef struct s_open_fd
{
int fd;
int size;
char *over;
} t_open_fd;
/*
** Enum Name: e_type
** Description : This Enum contain standard var size is
** used by overflow evaluator.
** Possible Value :
** - number_8 : Identifer for number of size 8 bits
** - number_16 : Identifer for number of size 16 bits
** - number_32 : Identifer for number of size 32 bits
** - ...
*/
enum e_type
{
number_8,
number_16,
number_32,
number_64
};
#endif