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
|
// stdio.h
struct FILE;
extern static stdin *FILE,
stdout *FILE,
stderr *FILE;
extern fn printf(fmt *const u8, ...) int;
extern fn fprintf(fp *FILE, fmt *const u8, ...) int;
extern fn sprintf(*u8, fmt *const u8, ...) int;
extern fn snprintf(*u8, usize, fmt *const u8, ...) int;
extern fn fopen(path *const u8, mode *const u8) *FILE;
extern fn fclose(*FILE) int;
extern fn fgetc(*FILE) int;
extern fn fputc(int, *FILE) int;
def SEEK_SET = 0;
extern fn fseek(*FILE, off c_long, whence int) int;
def EOF = -1;
// stdlib.h
extern fn abort() void;
extern fn exit(c int) void;
extern fn perror(s *const u8) void;
extern fn malloc(n usize) *void;
extern fn calloc(n usize, m usize) *void;
extern fn realloc(p *void, n usize) *void;
extern fn free(p *void) void;
extern fn realpath(path *const u8, resolved *u8) *u8;
def PATH_MAX = 4096;
// string.h
extern fn strlen(s *const u8) usize;
extern fn strcmp(a *const u8, b *const u8) int;
extern fn strncmp(a *const u8, b *const u8, usize) int;
extern fn memcmp(*const void, *const void, usize) int;
extern fn strcasecmp(a *const u8, b *const u8) int;
extern fn memcpy(*void, *const void, usize) *void;
extern fn memset(*const void, int, usize) *void;
extern fn strcpy(*u8, *const u8) *u8;
extern fn strerror(int) *const u8;
extern fn strstr(*const u8, *const u8) *const u8;
// ctype.h
extern fn tolower(int) int;
// errno.h
extern fn c_errno() int;
defmacro errno = c_errno();
|