src/cx/printf.h

changeset 1180
4c3a69b9723a
parent 1112
22dc2163fffd
equal deleted inserted replaced
1179:ca4c6f590a08 1180:4c3a69b9723a
54 54
55 55
56 /** 56 /**
57 * The maximum string length that fits into stack memory. 57 * The maximum string length that fits into stack memory.
58 */ 58 */
59 cx_attr_export
59 extern const unsigned cx_printf_sbo_size; 60 extern const unsigned cx_printf_sbo_size;
60 61
61 /** 62 /**
62 * A @c fprintf like function which writes the output to a stream by 63 * A @c fprintf like function which writes the output to a stream by
63 * using a write_func. 64 * using a write_func.
69 * @return the total number of bytes written or an error code from stdlib printf implementation 70 * @return the total number of bytes written or an error code from stdlib printf implementation
70 */ 71 */
71 cx_attr_nonnull_arg(1, 2, 3) 72 cx_attr_nonnull_arg(1, 2, 3)
72 cx_attr_printf(3, 4) 73 cx_attr_printf(3, 4)
73 cx_attr_cstr_arg(3) 74 cx_attr_cstr_arg(3)
75 cx_attr_export
74 int cx_fprintf( 76 int cx_fprintf(
75 void *stream, 77 void *stream,
76 cx_write_func wfc, 78 cx_write_func wfc,
77 const char *fmt, 79 const char *fmt,
78 ... 80 ...
89 * @return the total number of bytes written or an error code from stdlib printf implementation 91 * @return the total number of bytes written or an error code from stdlib printf implementation
90 * @see cx_fprintf() 92 * @see cx_fprintf()
91 */ 93 */
92 cx_attr_nonnull 94 cx_attr_nonnull
93 cx_attr_cstr_arg(3) 95 cx_attr_cstr_arg(3)
96 cx_attr_export
94 int cx_vfprintf( 97 int cx_vfprintf(
95 void *stream, 98 void *stream,
96 cx_write_func wfc, 99 cx_write_func wfc,
97 const char *fmt, 100 const char *fmt,
98 va_list ap 101 va_list ap
113 * @see cx_strfree_a() 116 * @see cx_strfree_a()
114 */ 117 */
115 cx_attr_nonnull_arg(1, 2) 118 cx_attr_nonnull_arg(1, 2)
116 cx_attr_printf(2, 3) 119 cx_attr_printf(2, 3)
117 cx_attr_cstr_arg(2) 120 cx_attr_cstr_arg(2)
121 cx_attr_export
118 cxmutstr cx_asprintf_a( 122 cxmutstr cx_asprintf_a(
119 const CxAllocator *allocator, 123 const CxAllocator *allocator,
120 const char *fmt, 124 const char *fmt,
121 ... 125 ...
122 ); 126 );
151 * @return the formatted string 155 * @return the formatted string
152 * @see cx_asprintf_a() 156 * @see cx_asprintf_a()
153 */ 157 */
154 cx_attr_nonnull 158 cx_attr_nonnull
155 cx_attr_cstr_arg(2) 159 cx_attr_cstr_arg(2)
160 cx_attr_export
156 cxmutstr cx_vasprintf_a( 161 cxmutstr cx_vasprintf_a(
157 const CxAllocator *allocator, 162 const CxAllocator *allocator,
158 const char *fmt, 163 const char *fmt,
159 va_list ap 164 va_list ap
160 ); 165 );
220 * @return the length of produced string or an error code from stdlib printf implementation 225 * @return the length of produced string or an error code from stdlib printf implementation
221 */ 226 */
222 cx_attr_nonnull_arg(1, 2, 3, 4) 227 cx_attr_nonnull_arg(1, 2, 3, 4)
223 cx_attr_printf(4, 5) 228 cx_attr_printf(4, 5)
224 cx_attr_cstr_arg(4) 229 cx_attr_cstr_arg(4)
230 cx_attr_export
225 int cx_sprintf_a( 231 int cx_sprintf_a(
226 CxAllocator *alloc, 232 CxAllocator *alloc,
227 char **str, 233 char **str,
228 size_t *len, 234 size_t *len,
229 const char *fmt, 235 const char *fmt,
264 */ 270 */
265 cx_attr_nonnull 271 cx_attr_nonnull
266 cx_attr_cstr_arg(4) 272 cx_attr_cstr_arg(4)
267 cx_attr_access_rw(2) 273 cx_attr_access_rw(2)
268 cx_attr_access_rw(3) 274 cx_attr_access_rw(3)
275 cx_attr_export
269 int cx_vsprintf_a( 276 int cx_vsprintf_a(
270 CxAllocator *alloc, 277 CxAllocator *alloc,
271 char **str, 278 char **str,
272 size_t *len, 279 size_t *len,
273 const char *fmt, 280 const char *fmt,
322 cx_attr_printf(5, 6) 329 cx_attr_printf(5, 6)
323 cx_attr_cstr_arg(5) 330 cx_attr_cstr_arg(5)
324 cx_attr_access_rw(2) 331 cx_attr_access_rw(2)
325 cx_attr_access_rw(3) 332 cx_attr_access_rw(3)
326 cx_attr_access_rw(4) 333 cx_attr_access_rw(4)
334 cx_attr_export
327 int cx_sprintf_sa( 335 int cx_sprintf_sa(
328 CxAllocator *alloc, 336 CxAllocator *alloc,
329 char *buf, 337 char *buf,
330 size_t *len, 338 size_t *len,
331 char **str, 339 char **str,
376 * @param ap argument list 384 * @param ap argument list
377 * @return the length of produced string or an error code from stdlib printf implementation 385 * @return the length of produced string or an error code from stdlib printf implementation
378 */ 386 */
379 cx_attr_nonnull 387 cx_attr_nonnull
380 cx_attr_cstr_arg(5) 388 cx_attr_cstr_arg(5)
389 cx_attr_export
381 int cx_vsprintf_sa( 390 int cx_vsprintf_sa(
382 CxAllocator *alloc, 391 CxAllocator *alloc,
383 char *buf, 392 char *buf,
384 size_t *len, 393 size_t *len,
385 char **str, 394 char **str,

mercurial