nes-proj/arch/cpu/arm/common/dbg-io/strformat.h

28 lines
1.3 KiB
C
Raw Normal View History

2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
#ifndef STRFORMAT_H_
#define STRFORMAT_H_
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
#include <stdarg.h>
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
#define STRFORMAT_OK 0
#define STRFORMAT_FAILED 1
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
typedef unsigned int StrFormatResult;
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
/* The data argument may only be considered valid during the function call */
typedef StrFormatResult (*StrFormatWrite)(void *user_data, const char *data, unsigned int len);
2017-11-22 00:58:50 +00:00
typedef struct _StrFormatContext {
StrFormatWrite write_str;
void *user_data;
} StrFormatContext;
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
int format_str(const StrFormatContext *ctxt, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2,3)));
int
format_str_v(const StrFormatContext *ctxt, const char *format, va_list ap);
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/
#endif /* STRFORMAT_H_ */
2017-11-22 00:53:42 +00:00
/*---------------------------------------------------------------------------*/