#ifndef UCX_PRINTF_H
#define UCX_PRINTF_H
#include "common.h"
#include "string.h"
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((__nonnull__(
1,
2,
3), __format__(printf,
3,
4)))
int cx_fprintf(
void *stream,
cx_write_func wfc,
char const *fmt,
...
);
__attribute__((__nonnull__))
int cx_vfprintf(
void *stream,
cx_write_func wfc,
char const *fmt,
va_list ap
);
__attribute__((__nonnull__(
1,
2), __format__(printf,
2,
3)))
cxmutstr cx_asprintf_a(
CxAllocator
const *allocator,
char const *fmt,
...
);
#define cx_asprintf(fmt, ...) \
cx_asprintf_a(cxDefaultAllocator, fmt,
__VA_ARGS__)
__attribute__((__nonnull__))
cxmutstr cx_vasprintf_a(
CxAllocator
const *allocator,
char const *fmt,
va_list ap
);
#define cx_vasprintf(fmt, ap) cx_vasprintf_a(cxDefaultAllocator, fmt, ap)
#define cx_bprintf(buffer, fmt, ...) cx_fprintf((CxBuffer*)buffer, \
(cx_write_func) cxBufferWrite, fmt,
__VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif