#ifndef _PRINTF_H_
#define _PRINTF_H_
#include <stdio.h>
#include <wchar.h>
#include <xlocale.h>
#include <Availability.h>
#ifdef __GNUC__
#define __XPRINTF_ATTR(x) __attribute__(x)
#else
#define __XPRINTF_ATTR(x)
#endif
#define __PRINTFMAXARG 2
struct printf_info {
void *context;
locale_t loc;
wchar_t vsep;
int prec;
int width;
wchar_t spec;
wchar_t pad;
wchar_t signchar;
unsigned is_long_double :1;
unsigned is_char :1;
unsigned is_short :1;
unsigned is_long :1;
unsigned alt :1;
unsigned space :1;
unsigned left :1;
unsigned showsign :1;
unsigned group :1;
unsigned extra :1;
unsigned wide :1;
unsigned is_quad :1;
unsigned is_intmax :1;
unsigned is_ptrdiff :1;
unsigned is_size :1;
unsigned is_vec :1;
int sofar;
unsigned get_width;
unsigned get_prec;
const char *begin;
const char *end;
void *arg[__PRINTFMAXARG];
};
enum {
PA_INT = (1 << 0),
PA_CHAR = (1 << 1),
PA_WCHAR = (1 << 2),
PA_STRING = (1 << 3),
PA_WSTRING = (1 << 4),
PA_POINTER = (1 << 5),
PA_FLOAT = (1 << 6),
PA_DOUBLE = (1 << 7),
PA_VECTOR = (1 << 8),
};
#define PA_FLAG_MASK 0xff0000
#define PA_FLAG_LONG_LONG (1 << 16)
#define PA_FLAG_LONG (1 << 17)
#define PA_FLAG_SHORT (1 << 18)
#define PA_FLAG_PTR (1 << 19)
#define PA_FLAG_QUAD (1 << 20)
#define PA_FLAG_INTMAX (1 << 21)
#define PA_FLAG_SIZE (1 << 22)
#define PA_FLAG_PTRDIFF (1 << 23)
#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
typedef int printf_arginfo_function(const struct printf_info *__info,
size_t __n, int *__argtypes);
typedef int printf_function(FILE *__stream,
const struct printf_info *__info, const void *const *__args);
struct _printf_domain;
typedef struct _printf_domain *printf_domain_t;
__BEGIN_DECLS
printf_domain_t copy_printf_domain(printf_domain_t __domain)
__XPRINTF_ATTR((__nonnull__(1)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
void free_printf_domain(printf_domain_t __domain)
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
printf_domain_t new_printf_domain(void)
__XPRINTF_ATTR((__malloc__))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int register_printf_domain_function(printf_domain_t __domain,
int __spec, printf_function *__render,
printf_arginfo_function *__arginfo, void *__context)
__XPRINTF_ATTR((__nonnull__(1)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int register_printf_domain_render_std(printf_domain_t __domain,
const char *__specs)
__XPRINTF_ATTR((__nonnull__(1)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int asxprintf(char ** __restrict __ret,
printf_domain_t __restrict __domain, locale_t __restrict __loc,
const char * __restrict __format, ...)
__XPRINTF_ATTR((__nonnull__(1, 2, 4)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int dxprintf(int __fd, printf_domain_t __restrict __domain,
locale_t __restrict __loc, const char * __restrict __format, ...)
__XPRINTF_ATTR((__nonnull__(2, 4)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int fxprintf(FILE * __restrict __stream,
printf_domain_t __restrict __domain, locale_t __restrict __loc,
const char * __restrict __format, ...)
__XPRINTF_ATTR((__nonnull__(1, 2, 4)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int sxprintf(char * __restrict __str, size_t __size,
printf_domain_t __restrict __domain, locale_t __restrict __loc,
const char * __restrict __format, ...)
__XPRINTF_ATTR((__nonnull__(1, 3, 5)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int xprintf(printf_domain_t __restrict __domain,
locale_t __restrict __loc, const char * __restrict __format, ...)
__XPRINTF_ATTR((__nonnull__(1, 3)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vasxprintf(char ** __restrict __ret,
printf_domain_t __restrict __domain, locale_t __restrict __loc,
const char * __restrict __format, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 2, 4)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vdxprintf(int __fd, printf_domain_t __restrict __domain,
locale_t __restrict __loc, const char * __restrict __format,
va_list __ap)
__XPRINTF_ATTR((__nonnull__(2, 4)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vfxprintf(FILE * __restrict __stream,
printf_domain_t __restrict __domain, locale_t __restrict __loc,
const char * __restrict __format, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 2, 4)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vsxprintf(char * __restrict __str, size_t __size,
printf_domain_t __restrict __domain, locale_t __restrict __loc,
const char * __restrict __format, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 3, 5)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vxprintf(printf_domain_t __restrict __domain,
locale_t __restrict __loc, const char * __restrict __format,
va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 3)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
__END_DECLS
struct _printf_compiled;
typedef struct _printf_compiled *printf_comp_t;
__BEGIN_DECLS
void free_printf_comp(printf_comp_t __pc)
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
printf_comp_t new_printf_comp(printf_domain_t __restrict __domain,
locale_t __restrict __loc, const char * __restrict __fmt)
__XPRINTF_ATTR((__nonnull__(1, 3)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int asxprintf_exec(char ** __restrict __ret,
printf_comp_t __restrict __pc, ...)
__XPRINTF_ATTR((__nonnull__(1, 2)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int dxprintf_exec(int __fd, printf_comp_t __restrict __pc, ...)
__XPRINTF_ATTR((__nonnull__(2)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int fxprintf_exec(FILE * __restrict __stream,
printf_comp_t __restrict __pc, ...)
__XPRINTF_ATTR((__nonnull__(1, 2)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int sxprintf_exec(char * __restrict __str, size_t __size,
printf_comp_t __restrict __pc, ...)
__XPRINTF_ATTR((__nonnull__(1, 3)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int xprintf_exec(printf_comp_t __restrict __pc, ...)
__XPRINTF_ATTR((__nonnull__(1)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vasxprintf_exec(char ** __restrict __ret,
printf_comp_t __restrict __pc, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 2)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vdxprintf_exec(int __fd, printf_comp_t __restrict __pc,
va_list __ap)
__XPRINTF_ATTR((__nonnull__(2)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vfxprintf_exec(FILE * __restrict __stream,
printf_comp_t __restrict __pc, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 2)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vsxprintf_exec(char * __restrict __str, size_t __size,
printf_comp_t __restrict __pc, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1, 3)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
int vxprintf_exec(printf_comp_t __restrict __pc, va_list __ap)
__XPRINTF_ATTR((__nonnull__(1)))
__OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0);
__END_DECLS
#endif