|
| 1 | +/* SPDX-License-Identifier: LGPL-3.0-or-later */ |
| 2 | +/* |
| 3 | + * Copyright(c) 2025 John Sanpe <sanpeqf@gmail.com> |
| 4 | + */ |
| 5 | + |
| 6 | +#ifndef _BFDEV_XPRINTF_H_ |
| 7 | +#define _BFDEV_XPRINTF_H_ |
| 8 | + |
| 9 | +#include <bfdev/config.h> |
| 10 | +#include <bfdev/types.h> |
| 11 | +#include <bfdev/stddef.h> |
| 12 | +#include <bfdev/stdarg.h> |
| 13 | + |
| 14 | +BFDEV_BEGIN_DECLS |
| 15 | + |
| 16 | +typedef struct bfdev_vxprintf bfdev_vxprintf_t; |
| 17 | + |
| 18 | +typedef void |
| 19 | +(*bfdev_vxprintf_write)(const char *buff, bfdev_size_t len, void *pdata); |
| 20 | + |
| 21 | +struct bfdev_vxprintf { |
| 22 | + bfdev_vxprintf_write write; |
| 23 | + void *pdata; |
| 24 | +}; |
| 25 | + |
| 26 | +extern __bfdev_printf(2, 0) bfdev_size_t |
| 27 | +bfdev_vxfprintf(bfdev_vxprintf_t *ctx, const char *fmt, bfdev_va_list args); |
| 28 | + |
| 29 | +extern __bfdev_printf(2, 3) bfdev_size_t |
| 30 | +bfdev_xfprintf(bfdev_vxprintf_t *ctx, const char *fmt, ...); |
| 31 | + |
| 32 | +extern __bfdev_printf(3, 0) bfdev_size_t |
| 33 | +bfdev_xnprintf(char *buff, bfdev_size_t size, const char *fmt, bfdev_va_list args); |
| 34 | + |
| 35 | +extern __bfdev_printf(3, 4) bfdev_size_t |
| 36 | +bfdev_xprintf(char *buff, bfdev_size_t size, const char *fmt, ...); |
| 37 | + |
| 38 | +BFDEV_END_DECLS |
| 39 | + |
| 40 | +#endif /* _BFDEV_XPRINTF_H_ */ |
0 commit comments