-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibftprintf.h
More file actions
127 lines (115 loc) · 4.86 KB
/
libftprintf.h
File metadata and controls
127 lines (115 loc) · 4.86 KB
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
/* ************************************************************************** */
/* */
/* :::::::: */
/* libftprintf.h :+: :+: */
/* +:+ */
/* By: greed <greed@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2019/11/12 09:35:37 by greed #+# #+# */
/* Updated: 2019/11/21 13:32:23 by greed ######## odam.nl */
/* */
/* ************************************************************************** */
#ifndef LIBFTPRINTF_H
# define LIBFTPRINTF_H
# include <stdarg.h>
# include <stdio.h>
typedef struct s_conv
{
int left;
int hash;
int padzero;
int width;
int precision;
int numlen;
int size;
char type;
char sign;
int len;
char hassign;
char neg;
int count;
unsigned int u_numlen;
} t_conv;
typedef void (*t_cfunc)(t_conv *, va_list, int *);
typedef void (*t_lfunc)(t_conv *, va_list, int *);
int ft_printf(const char *input, ...);
void ft_putnbr_count_fd(int n, int fd, t_conv *conv, int *lv);
int ft_nbr_size(int num);
void ft_flag_check(const char **input, t_conv *conv);
void ft_find_type(const char **input, t_conv *conv);
void ft_flag_vars_set(t_conv *conv);
void ft_print_char(t_conv *conv, va_list a_list, int *lv);
void ft_print_string(t_conv *conv, va_list a_list, int *lv);
void ft_print_pointer(t_conv *conv, va_list a_list, int *lv);
void ft_print_int(t_conv *conv, va_list a_list, int *lv);
void ft_print_uint(t_conv *conv, va_list a_list, int *lv);
void ft_print_hex_lower(t_conv *conv, va_list a_list, int *lv);
void ft_print_hex_upper(t_conv *conv, va_list a_list, int *lv);
void ft_print_count(t_conv *conv, va_list a_list, int *lv);
void ft_print_percent(t_conv *conv, va_list a_list, int *lv);
void ft_pad_width(int width, int precision, int pad, int *lv);
void ft_putstr_c_fd(char *str, int fd, int n, int *lv);
void ft_putchar_c_fd(char c, int fd, int *lv);
void ft_precision_check(const char **input, t_conv *conv);
void ft_putnbr_c_fd(int n, int fd, t_conv *conv, int *lv);
void ft_conv_dec(t_conv *conv, va_list a_list, int *lv);
void ft_trunc_width(int n, int fd, t_conv *conv, int *lv);
void ft_print_sign(int fd, t_conv *conv, int *lv);
void ft_conv_int(t_conv *conv, int *num);
void ft_intres_c_fd(int num, int *lv);
void ft_print_uint(t_conv *conv, va_list a_list, int *lv);
unsigned int ft_uint_size(unsigned int num);
void ft_conv_uint(t_conv *conv, unsigned int num);
void ft_u_intres_c_fd(unsigned int num, int *lv);
void ft_print_x(t_conv *conv, va_list a_list, int *lv);
unsigned int ft_x_size(unsigned int num);
void ft_conv_x(t_conv *conv, unsigned int *num);
void ft_x_res_c_fd(unsigned int num, int *lv);
void ft_upx_res_c_fd(unsigned int num, int *lv);
void ft_print_up_x(t_conv *conv, va_list a_list, int *lv);
void ft_print_pct(t_conv *conv, va_list a_list, int *lv);
int ft_valid_arg(const char **input, t_conv *conv);
/*
** THIS IS STUFF FOR SIZE BONUS
*/
void ft_size_num(t_conv *conv, va_list a_list, int *lv);
/*
** Links for size
*/
void ft_uint_link(t_conv *conv, va_list a_list, int *lv);
void ft_int_link(t_conv *conv, va_list a_list, int *lv);
void ft_x_link(t_conv *conv, va_list a_list, int *lv);
void ft_up_x_link(t_conv *conv, va_list a_list, int *lv);
/*
** LL
*/
void ft_conv_ll_int(t_conv *conv, long long int num);
long long int ft_ll_nbr_size(long long int num);
void ft_llint_c_fd(long long int num, int *lv);
void ft_ll_num(t_conv *conv, va_list a_list, int *lv);
/*
** xX
*/
void ft_print_ll_x(t_conv *conv, va_list a_list, int *lv);
int ft_x_ll_size(unsigned long long num);
void ft_x_res_ll_c_fd(unsigned long long num, int *lv);
void ft_conv_ll_x(t_conv *conv, unsigned long long *num);
void ft_ll_x(t_conv *conv, va_list a_list, int *lv);
void ft_print_ll_up_x(t_conv *conv, va_list a_list, int *lv);
void ft_upx_res_ll_c_fd(unsigned long long num, int *lv);
/*
** LLU
*/
void ft_llu(t_conv *conv, va_list a_list, int *lv);
void ft_llu_num(t_conv *conv, va_list a_list, int *lv);
void ft_lluint_c_fd(unsigned long long num, int *lv);
int ft_llu_nbr_size(unsigned long long num);
void ft_conv_llu_int(t_conv *conv, unsigned long long num);
/*
** Pointers
*/
void ft_print_pointer(t_conv *conv, va_list a_list, int *lv);
unsigned long ft_ptr_size(unsigned long ptr);
void ft_conv_ptr(t_conv *conv, unsigned long ptr);
void ft_ptr_res_fd(unsigned long ptr, int *lv);
#endif