-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printf.h
53 lines (48 loc) · 1.92 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ikotvits <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/02 16:59:07 by ikotvits #+# #+# */
/* Updated: 2018/05/02 16:59:08 by ikotvits ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_PRINTF_H
# define FT_PRINTF_H
# include <unistd.h>
# include <stdlib.h>
# include <locale.h>
# include <stdarg.h>
# include "libft.h"
# define BUFF_SIZE 100
# define N_STR "(null)"
# define SIZE(c) (c < 128) ? 1 : ((c < 2048) ? 2 : ((c < 65536) ? 3 : 4))
# define LEN(c) (c < 256) ? ((c < 128) ? 1 : 2) : ft_str_len(&c, s, 'c')
typedef struct s_pf
{
short flags;
int prec;
int width;
char type;
char size[3];
char buf[BUFF_SIZE];
int i;
int sum;
char sign;
} t_pf;
int ft_printf(const char *format, ...);
void ft_string(t_pf *s, va_list val);
void ft_char(t_pf *s, va_list val);
void ft_numb(t_pf *s, va_list val);
void ft_buf_print(t_pf *s);
void ft_manage_str(t_pf *s, int l);
void ft_buf_add_str(t_pf *s, unsigned char *str);
void ft_buf_add_numb(t_pf *s, unsigned char symbol);
void ft_unicode(t_pf *s, int uni);
void ft_manage_numb(t_pf *s, uintmax_t b, uintmax_t n);
void ft_mng_nb1(t_pf *s, uintmax_t n);
void ft_buf_add_char(t_pf *s, unsigned char c);
uintmax_t ft_pow(uintmax_t b, uintmax_t p);
#endif