-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_format.h
77 lines (59 loc) · 3.17 KB
/
ft_format.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_format.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgalaup <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/03 14:58:32 by fgalaup #+# #+# */
/* Updated: 2021/04/19 11:04:15 by fgalaup ### ########lyon.fr */
/* */
/* ************************************************************************** */
#ifndef FT_FORMAT_H
# define FT_FORMAT_H
# include <stdarg.h>
# include "libft.h"
# include "ft_format_type.h"
# define PARSER_ERROR -20
# define PARSER_MALLOC_ARG 1
# define FORMATER_ERROR -30
# define FORMATER_ERROR_ARG_FORMAT 1
# define FORMATER_ERROR_STR_FORMAT 2
# define FORMATER_MALLOC_ADD_SEGMENT 3
# define MERGE_ERROR -40
# define FLAG_ERROR -50
# define FLAG_STAR_DOT 1
# define FLAG_STAR_FS 2
int ft_printf(const char *format, ...);
int ft_format(const char *format, va_list args, char **buffer);
int ft_format_parser(char *format, va_list args, t_list **format_segments);
int ft_format_parse_one(char *start, va_list args, t_format_arg *convert);
int ft_format_parse_flag(char *start, va_list args, t_list **flags);
t_ba *ft_format_convert(char *start, va_list args, t_list *flags);
int ft_format_formater(char *fmr, t_list *arg, t_list **seg);
t_ba *ft_format_inter_args(char *cursor);
void ft_format_params_clear(void *value);
void debug_parsed_args(t_list *value);
void debug_parsed_arg(t_format_arg *arg);
void converter_percent(va_list args, t_list *flags, t_ba *r);
void converter_char(va_list args, t_list *flags, t_ba *r);
void converter_string(va_list args, t_list *flags, t_ba *r);
void converter_pointer(va_list args, t_list *flags, t_ba *r);
void converter_integer(va_list args, t_list *flags, t_ba *r);
void converter_unsigned(va_list args, t_list *flags, t_ba *r);
void converter_hexa_upper(va_list args, t_list *flags, t_ba *r);
void converter_hexa_lower(va_list args, t_list *flags, t_ba *r);
void *flag_pars_zero(char **start, t_list **flags);
void *flag_pars_less(char **start, t_list **flags);
void *flag_pars_fs(char **start, t_list **flags);
void *flag_pars_dot(char **start, t_list **flags);
void *flag_pars_sharp(char **start, t_list **flags);
void *flag_pars_star(char **start, va_list args, t_list **flags);
char *insert_zero(char *str, size_t before, size_t after, size_t zero_l);
char *format_zero(char *indicator, char *converted, t_list *flags);
char *format_less(char *indicator, char *converted, t_list *flags);
char *format_fs(char *indicator, char *converted, t_list *flags);
char *format_dot(char *indicator, char *converted, t_list *flags);
char *format_sharp(char *indicator, char *converted, t_list *flags);
int format_star(va_list args, t_list **flags, int affected);
#endif