aboutsummaryrefslogtreecommitdiffhomepage
path: root/std.h
blob: 86c86f530d9e499037e2eb4ed2d1106dec7f9f0f (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
typedef long size_t;

struct FILE;
typedef struct FILE FILE;

extern FILE* stdin;
extern FILE* stdout;
extern FILE* stderr;

int atoi(const char*);
void* calloc(size_t, size_t);
void exit(int);
int fclose(FILE*);
int fprintf(FILE*, const char*, ...);
char* fgets(char*, int, FILE*);
FILE* fopen(const char*, const char*);
int getchar(void);
int isalnum(int);
int isalpha(int);
int isdigit(int);
int isspace(int);
void* memcpy(void*, void*, size_t);
void* memmove(void*, void*, size_t);
int printf(const char*, ...);
int sprintf(char*, const char*, ...);
int strcmp(const char*, const char*);
size_t strlen(const char*);
int strncmp(const char*, const char*, size_t);
char* strstr(const char*, const char*);

#define NULL 0

#ifdef __ducc__

// System V Application Binary Interface
// AMD64 Architecture Processor Supplement
// (With LP64 and ILP32 Programming Models)
// Version 1.0
// Figure 3.34: va_list Type Declaration
struct __va_list__ {
    // unsigned int gp_offset;
    // unsigned int fp_offset;
    int gp_offset;
    int fp_offset;
    void* overflow_arg_area;
    void* reg_save_area;
};
// ducc currently does not support array type.
// typedef struct __va_list__ va_list[1];
typedef struct __va_list__* va_list;

// va_start() is currently implemented as a special form due to the limitation of #define macro.
void va_end(va_list args) {
}

#else

#include <stdarg.h>

#endif

int vfprintf(FILE*, const char*, va_list);