summaryrefslogtreecommitdiff
path: root/include/PR/xstdio.h
blob: a2541ab4a0877d40621fdd645af74f24dde140b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef PR_XSTDIO_H
#define PR_XSTDIO_H

#include "stdarg.h"

// IDO doesn't support long double types, improve portability for compilers supporting them
#ifdef __sgi
#define LONG_DOUBLE_TYPE double
#else
#define LONG_DOUBLE_TYPE long double
#endif

typedef struct {
    /* 0x00 */ union {
        long long ll;
        LONG_DOUBLE_TYPE ld;
    } v;
    /* 0x08 */ char* s;
    /* 0x0C */ int n0;
    /* 0x10 */ int nz0;
    /* 0x14 */ int n1;
    /* 0x18 */ int nz1;
    /* 0x1C */ int n2;
    /* 0x20 */ int nz2;
    /* 0x24 */ int prec;
    /* 0x28 */ int width;
    /* 0x2C */ size_t nchar;
    /* 0x30 */ unsigned int flags;
    /* 0x34 */ char qual;
} _Pft;

typedef void* (*PrintCallback)(void*, const char*, size_t);

#define FLAGS_SPACE (1 << 0)
#define FLAGS_PLUS  (1 << 1)
#define FLAGS_MINUS (1 << 2)
#define FLAGS_HASH  (1 << 3)
#define FLAGS_ZERO  (1 << 4)

int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap);
void _Litob(_Pft* args, char code);
void _Ldtob(_Pft* args, char code);

#endif