IO 更多...
结构体 | |
struct | tagMStrIOCallback |
IO回调的接口 更多... | |
宏定义 | |
#define | MSTR_COUNT_VA_ARGS_HELPER(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, N, ...) N |
#define | MSTR_COUNT_VA_ARGS(...) |
取得可变参数宏的参数个数 | |
#define | mstr_print(fmt, ...) ((void)(0)) |
写到 stdout (disable) | |
类型定义 | |
typedef mstr_result_t(* | MStrIOWrite) (void *ctx, const byte_t *data, usize_t len) |
写入数据 | |
typedef struct tagMStrIOCallback | MStrIOCallback |
IO回调的接口 | |
函数 | |
mstr_io_init (void *context, MStrIOCallback *obj, MStrIOWrite cb_write) | |
初始化IO的结构 | |
mstr_ioformat (MStrIOCallback *io, const char *fmt, usize_t fmt_place,...) | |
格式化字符串到指定io | |
mstr_iovformat (MStrIOCallback *io, const char *fmt, usize_t fmt_place, va_list *ap_ptr) | |
格式化字符串到指定io | |
MSTR_EXPORT_API (MStrIOCallback *) mstr_get_stdout(void) | |
取得stdout的内部handler | |
IO
#define MSTR_COUNT_VA_ARGS | ( | ... | ) |
取得可变参数宏的参数个数
#define MSTR_COUNT_VA_ARGS_HELPER | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9, | |||
_10, | |||
_11, | |||
_12, | |||
_13, | |||
_14, | |||
_15, | |||
_16, | |||
N, | |||
... | |||
) | N |
#define mstr_print | ( | fmt, | |
... | |||
) | ((void)(0)) |
写到 stdout (disable)
typedef struct tagMStrIOCallback MStrIOCallback |
IO回调的接口
typedef mstr_result_t(* MStrIOWrite) (void *ctx, const byte_t *data, usize_t len) |
写入数据
MSTR_EXPORT_API | ( | MStrIOCallback * | ) |
取得stdout的内部handler
mstr_io_init | ( | void * | context, |
MStrIOCallback * | obj, | ||
MStrIOWrite | cb_write | ||
) |
初始化IO的结构
[in] | context | 上下文 |
[in,out] | obj | IO结构对象 |
[in] | cb_write | 写入数据callback, 不可留NULL |
mstr_ioformat | ( | MStrIOCallback * | io, |
const char * | fmt, | ||
usize_t | fmt_place, | ||
... | |||
) |
格式化字符串到指定io
[in,out] | io | IO |
[in] | fmt | 格式化串 |
[in] | fmt_place | 预期fmt中使用的参数数目. 最大不超过16(MFMT_PLACE_MAX_NUM) |
mstr_iovformat | ( | MStrIOCallback * | io, |
const char * | fmt, | ||
usize_t | fmt_place, | ||
va_list * | ap_ptr | ||
) |
格式化字符串到指定io
[in,out] | io | IO |
[in] | fmt | 格式化串 |
[in] | fmt_place | 预期fmt中使用的参数数目. 最大不超过16(MFMT_PLACE_MAX_NUM) |
[in] | ap_ptr | &ap |