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 #ifndef UCX_PRINTF_H
38 #define UCX_PRINTF_H
39
40 #include "common.h"
41 #include "string.h"
42 #include <stdarg.h>
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48
49
50
51
52
53
54
55
56
57
58 __attribute__((__nonnull__(
1,
2,
3), __format__(printf,
3,
4)))
59 int cx_fprintf(
60 void *stream,
61 cx_write_func wfc,
62 char const *fmt,
63 ...
64 );
65
66
67
68
69
70
71
72
73
74
75
76
77 __attribute__((__nonnull__))
78 int cx_vfprintf(
79 void *stream,
80 cx_write_func wfc,
81 char const *fmt,
82 va_list ap
83 );
84
85
86
87
88
89
90
91
92
93
94
95
96
97 __attribute__((__nonnull__(
1,
2), __format__(printf,
2,
3)))
98 cxmutstr cx_asprintf_a(
99 CxAllocator
const *allocator,
100 char const *fmt,
101 ...
102 );
103
104
105
106
107
108
109
110
111
112
113
114
115 #define cx_asprintf(fmt, ...) \
116 cx_asprintf_a(cxDefaultAllocator, fmt,
__VA_ARGS__)
117
118
119
120
121
122
123
124
125
126
127
128
129
130 __attribute__((__nonnull__))
131 cxmutstr cx_vasprintf_a(
132 CxAllocator
const *allocator,
133 char const *fmt,
134 va_list ap
135 );
136
137
138
139
140
141
142
143
144
145
146
147
148 #define cx_vasprintf(fmt, ap) cx_vasprintf_a(cxDefaultAllocator, fmt, ap)
149
150
151
152
153
154
155
156
157
158
159 #define cx_bprintf(buffer, fmt, ...) cx_fprintf((CxBuffer*)buffer, \
160 (cx_write_func) cxBufferWrite, fmt,
__VA_ARGS__)
161
162 #ifdef __cplusplus
163 }
164 #endif
165
166 #endif
167