-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_printf_typedefs.h
More file actions
113 lines (103 loc) · 2.39 KB
/
Copy path_printf_typedefs.h
File metadata and controls
113 lines (103 loc) · 2.39 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
#ifndef PRINTF_TYPEDEFS_H
#define PRINTF_TYPEDEFS_H
#include <inttypes.h> /* intmax_t */
#include <stdarg.h> /* va_list */
#include <stdbool.h> /* bool */
#include "buffer_object.h"
/**
* struct printf_flag_modifiers - printf flag modifiers.
* @alternate_form: '#' flag.
* @zero_padding: '0' flag.
* @left_adjust: '-' flag.
* @space: ' ' flag.
* @sign: '+' flag.
*/
struct printf_flag_modifiers
{
bool alternate_form, zero_padding, left_adjust, space, sign;
};
/**
* enum printf_int_length_modifiers - printf length modifiers.
* @PRINTF_CHAR: signed char or unsigned char.
* @PRINTF_SHORT: short or unsigned short.
* @PRINTF_LONG: long or unsigned long.
* @PRINTF_LLONG: long or unsigned long.
* @PRINTF_LDOUBLE: long double.
* @PRINTF_INTMAX_T: intmax_t or uintmax_t.
* @PRINTF_SIZE_T: size_t or ssize_t.
* @PRINTF_PTRDIFF_T: ptrdiff_t.
*/
enum printf_int_length_modifiers
{
PRINTF_CHAR = 1,
PRINTF_SHORT,
PRINTF_LONG,
PRINTF_LLONG,
PRINTF_LDOUBLE,
PRINTF_INTMAX_T,
PRINTF_SIZE_T,
PRINTF_PTRDIFF_T
};
/**
* enum integer_bases - valid radii for integers.
* @BASE02: base 2.
* @BASE08: base 8.
* @BASE10: base 10.
* @BASE16: base 16.
*/
enum integer_bases
{
BASE02 = 2U,
BASE08 = 8U,
BASE10 = 10U,
BASE16 = 16U
};
/**
* enum integer_alphabet_cases - symbols for integers > base10.
* @UPPER: uppercase A.
* @LOWER: lowercase a.
*/
enum integer_alphabet_cases
{
UPPER = 'A',
LOWER = 'a'
};
/**
* struct integer_modifiers - flags for integer types.
* @base: the radix of the number.
* @alphabet_case: case to use for numbers greater than base 10.
* @is_negative: flag to indicate signedness.
*/
typedef struct integer_modifiers
{
enum integer_bases base;
enum integer_alphabet_cases alphabet_case;
bool is_negative;
} integer_mods;
/**
* struct printf_modifiers - modifiers for `_printf` conversion.
* @flags: flags.
* @width: width.
* @precision: precision.
* @length: length.
* @int_mod: integer flags.
*/
typedef struct printf_modifiers
{
struct printf_flag_modifiers flags;
intmax_t width;
intmax_t precision;
enum printf_int_length_modifiers length;
integer_mods int_mod;
} modifiers;
/**
* struct format_funcs - formatting functions and their identifiers.
* @func: The handling function.
* @ch: The format identifier.
*/
typedef struct format_funcs
{
int (*func)(va_list args, char_arr *buffer, modifiers mods);
char ch;
} format_funcs;
#endif /* PRINTF_TYPEDEFS_H */