39static inline int xprintf(
void (*func)(
const char *,
int,
void *),
void *arg,
const char *fmt, ...) {
47static inline int sprintf(
char *
buf,
const char *fmt, ...) {
55static inline int snprintf(
char *
buf,
size_t n,
const char *fmt, ...) {
63static inline int asprintf(
char **
out,
const char *fmt, ...) {
71static inline void writeToTTYCallback(
const char *str,
int len,
void *opaque) { syscall_write(1, str, len); }
72static inline int vprintf(
const char *fmt, va_list ap) {
return vxprintf(writeToTTYCallback, NULL, fmt, ap); }
73static inline int printf(
const char *fmt, ...) {
76 int ret = vprintf(fmt, ap);
84#include <EASTL/fixed_string.h>
85#include <EASTL/string.h>
97template <
int nodeCount,
bool bEnableOverflow = true>
98static inline void vfsprintf(eastl::fixed_string<char, nodeCount, bEnableOverflow> &str,
const char *fmt, va_list ap) {
101 [](
const char *str,
int len,
void *opaque) {
102 eastl::fixed_string<char, nodeCount, bEnableOverflow> *
out =
103 (eastl::fixed_string<char, nodeCount, bEnableOverflow> *)opaque;
104 out->append(str, len);
109template <
int nodeCount,
bool bEnableOverflow = true>
110static inline void fsprintf(eastl::fixed_string<char, nodeCount, bEnableOverflow> &str,
const char *fmt, ...) {
114 vfsprintf<nodeCount, bEnableOverflow>(str, fmt, ap);
128static inline eastl::string
vsprintf(
const char *fmt, va_list ap) {
131 [](
const char *str,
int len,
void *opaque) {
132 eastl::string *
ret = (eastl::string *)opaque;
133 ret->append(str, len);
139static inline eastl::string sprintf(
const char *fmt, ...) {
int vsprintf(char *buf, const char *fmt, va_list ap)
Prints a formatted string to a string.
Definition xprintf.c:730
int vxprintf(void(*func)(const char *, int, void *), void *opaque, const char *fmt, va_list ap)
Prints a formatted string to a callback.
Definition xprintf.c:318
int vasprintf(char **out, const char *fmt, va_list ap)
Prints a formatted string to a newly allocated string.
Definition xprintf.c:794
int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap)
Prints a formatted string to a length-limited string.
Definition xprintf.c:737
uint32_t out
Definition cpu.c:62
#define printf
Definition demo.c:35
static int ret
Definition syscalls.h:125
static const void * buf
Definition syscalls.h:114