42sh 1.0.0
Create a shell in C
Loading...
Searching...
No Matches
myprintf.h
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2023
3** my_printf
4** File description:
5** The header of all formats and flags
6*/
13#include "../my.h"
14
15#ifndef MYPRINTF_H_
16 #define MYPRINTF_H_
17
18 #define FORMATAGE "-+ #0"
19 #define WIDTH "0123456789"
20 #define PRECISION "."
21 #define NUMBERS "0123456789"
22
23typedef struct formating_s {
24 int fd;
25 int id_ft;
26 int id_wd;
27 int id_prc;
28 int id_nb;
29 int id_sp;
30 int nb_format;
31 char final_format[10];
32 char next_chara;
33 va_list *liste;
34 int index_user;
35 int id_us;
36 char flag;
38
39typedef struct flags_s {
40 char *str;
41 int index_flag;
42} flags_t;
43
44typedef struct user_s {
45 char const *str;
46 int total_len;
47 int i;
48} user_t;
49
50/* Round functions */
51void round_a(char *float_nb, int precision, char last_char, int i);
52void round_biga(char *float_nb, int precision, char last_char, int i);
53
54/* Find functions */
55formating_t *find_first(user_t *user, int *i,
56 formating_t *formating);
57formating_t *find_width(user_t *user, int *i,
58 formating_t *formating);
59formating_t *find_precision(user_t *user, int *i,
60 formating_t *formating);
61formating_t *find_numbers(user_t *user, int *i,
62 formating_t *formating);
63formating_t *find_specifier(user_t *user, int *i,
64 formating_t *formating);
65
66/* Format functions */
67void format_first(user_t *user, flags_t *flags,
68 formating_t *formating, int *copy);
69void format_width(user_t *user, flags_t *flags,
70 formating_t *formating, int *copy);
71void format_precision(user_t *user, flags_t *flags,
72 formating_t *formating, int *copy);
73void format_numbers(user_t *user, flags_t *flags,
74 formating_t *formating, int *copy);
75void format_specifier(user_t *user, flags_t *flags,
76 formating_t *formating, int *copy);
77void my_show_formating(formating_t *formating);
78
79void format_plus_double(char *str_finale, formating_t *formating, double nb);
80void format_moins_double(char *str_finale, formating_t *formating, double nb);
81void format_esp_double(char *str_finale, formating_t *formating, double nb);
82void format_hash_double(char *str_finale, formating_t *formating, double nb);
83void format_zero_double(char *str_finale, formating_t *formating, double nb);
84void format_it_double(char *str_finale,
85 formating_t *formating, double partie_d);
86void precise_it_double(char *str_finale,
87 formating_t *formating, double partie_d);
88
89void format_plus_int(char *str_finale,
90 formating_t *formating, size_t nb);
91void format_moins_int(char *str_finale,
92 formating_t *formating, size_t nb);
93void format_esp_int(char *str_finale,
94 formating_t *formating, size_t nb);
95void format_hash_int(char *str_finale,
96 formating_t *formating, size_t nb);
97void format_zero_int(char *str_finale,
98 formating_t *formating, size_t nb);
99void format_it_int(char *str_finale,
100 formating_t *formating, size_t nb);
101void precise_it_int(char *str_finale,
102 formating_t *formating, size_t nb);
103
104void format_plus_char(char *str_finale, formating_t *formating, char c);
105void format_moins_char(char *str_finale, formating_t *formating, char c);
106void format_esp_char(char *str_finale, formating_t *formating, char c);
107void format_hash_char(char *str_finale, formating_t *formating, char c);
108void format_zero_char(char *str_finale, formating_t *formating, char c);
109void format_it_char(char *str_finale,
110 formating_t *formating, char c);
111
112void format_plus_str(char *str_finale, formating_t *formating);
113void format_moins_str(char *str_finale, formating_t *formating);
114void format_esp_str(char *str_finale, formating_t *formating);
115void format_hash_str(char *str_finale, formating_t *formating);
116void format_zero_str(char *str_finale, formating_t *formating);
117void format_it_str(char *str_finale,
118 formating_t *formating);
119
120/* Specify functions */
121char *specify_it_int(formating_t *formating, size_t temp);
122char *specify_it_base(formating_t *formating, size_t temp, char *);
123
124/* Flag functions */
125int flag_c(va_list list, formating_t *);
126int flag_s(va_list list, formating_t *);
127int flag_d(va_list list, formating_t *);
128int flag_i(va_list list, formating_t *);
129int flag_p(va_list list, formating_t *);
130int flag_o(va_list list, formating_t *);
131int flag_u(va_list list, formating_t *);
132int flag_x(va_list list, formating_t *);
133int flag_bigx(va_list list, formating_t *);
134int flag_e(va_list list, formating_t *);
135int flag_bige(va_list list, formating_t *);
136int flag_f(va_list list, formating_t *);
137int flag_bigf(va_list list, formating_t *);
138int flag_g(va_list list, formating_t *);
139int flag_bigg(va_list list, formating_t *);
140int flag_a(va_list list, formating_t *);
141int flag_biga(va_list list, formating_t *);
142int flag_n(va_list list, formating_t *, int len);
143int flag_m(va_list list, formating_t *);
144int flag_b(va_list list, formating_t *);
145int flag_bigs(va_list list, formating_t *);
146int flag_bigd(va_list list, formating_t *);
147int flag_percent(va_list list, formating_t *);
148
149extern int (*FLAGS[])(va_list, formating_t *);
150
151#endif /* MYPRINTF_H_ */
The header file of the libmy.
Definition myprintf.h:39
Definition myprintf.h:23
Definition myprintf.h:44