-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.h
56 lines (46 loc) · 2.04 KB
/
ft_printf.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hyeyukim <hyeyukim@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/06 10:37:38 by hyeyukim #+# #+# */
/* Updated: 2022/08/09 14:38:39 by hyeyukim ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_PRINTF_H
# define FT_PRINTF_H
# include <stdarg.h>
# define DEC "0123456789"
# define HDL "0123456789abcdef"
# define HDU "0123456789ABCDEF"
typedef struct s_option
{
unsigned char flag;
int width;
int precision;
int padding;
char *out;
int len;
} t_option;
typedef int (*t_fct)(t_option *, va_list);
int ft_printf(const char *format, ...);
int ft_max(int a, int b);
void init_option(t_option *opt);
int find_flag(const char c, unsigned char *flag);
int find_identifier(const char c);
int put_percent(t_option *opt, va_list ap);
int put_chr(t_option *opt, va_list ap);
int put_str(t_option *opt, va_list ap);
int put_nbr(t_option *opt, va_list ap);
int put_unbr(t_option *opt, va_list ap);
int put_ptr(t_option *opt, va_list ap);
int put_xunbr_lower(t_option *opt, va_list ap);
int put_xunbr_upper(t_option *opt, va_list ap);
int ft_nbrlen(long n, int base_len, t_option *opt);
int ft_unbrlen(unsigned long n, int base_len, t_option *opt);
void decide_nbr_sign(t_option *opt, long nbr, int nbr_len);
void decide_xunbr_hash(t_option *opt, int xunbr_len, int upper);
void unbrtostr(char *str_nbr, unsigned long nbr, int nbr_len, char *base);
#endif