forked from Monemax94/printf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
79 lines (63 loc) · 1.69 KB
/
main.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
78
79
#ifndef MAIN_H
#define MAIN_H
#include <stdlib.h>
#include <stdarg.h>
/**
* struct flags - struct containing flags to "turn on"
* when a flag specifier is passed to _printf()
* @plus: flag for the '+' character
* @space: flag for the ' ' character
* @hash: flag for the '#' character
*/
typedef struct flags
{
int plus;
int space;
int hash;
} flags_t;
/**
* struct printHandler - struct to choose the right function depending
* on the format specifier passed to _printf()
* @c: format specifier
* @f: pointer to the correct printing function
*/
typedef struct printHandler
{
char c;
int (*f)(va_list ap, flags_t *f);
} ph;
/* print_nums */
int print_int(va_list l, flags_t *f);
void print_number(int n);
int print_unsigned(va_list l, flags_t *f);
int count_digit(int i);
/* print_bases */
int print_hex(va_list l, flags_t *f);
int print_hex_big(va_list l, flags_t *f);
int print_binary(va_list l, flags_t *f);
int print_octal(va_list l, flags_t *f);
/* converter */
char *convert(unsigned long int num, int base, int lowercase);
/* _printf */
int _printf(const char *format, ...);
/* get_print */
int (*get_print(char s))(va_list, flags_t *);
/* get_flag */
int get_flag(char s, flags_t *f);
/* print_alpha */
int print_string(va_list l, flags_t *f);
int print_char(va_list l, flags_t *f);
/* write_funcs */
int _putchar(char c);
int _puts(char *str);
/* print_custom */
int print_rot13(va_list l, flags_t *f);
int print_rev(va_list l, flags_t *f);
int print_bigS(va_list l, flags_t *f);
/* print_address */
int print_address(va_list l, flags_t *f);
/* print_percent */
int print_percent(va_list l, flags_t *);
/* printlint */
int prinlint(va_list arguments, char *buf, unsigned int ibuf);
#endif