History

tcclib sample

bellard committed 25 years ago

Commit aca44291 parent 97364931 file · +57 −0Browse files

Unified · Split

tcclib.h+57−0
@@ -0,0 +1,57 @@
1/* Simple libc header for TCC
2 *
3 * Add any function you want from the libc there. This file is here
4 * only for your convenience so that you do not need to put the whole
5 * glibc include files on your floppy disk
6 */
7#define NULL 0
8typedef unsigned int size_t;
9typedef struct __FILE FILE;
10typedef void *va_list;
11
12/* stdlib.h */
13void *calloc(size_t nmemb, size_t size);
14void *malloc(size_t size);
15void free(void *ptr);
16void *realloc(void *ptr, size_t size);
17int atoi(const char *nptr);
18long int strtol(const char *nptr, char **endptr, int base);
19unsigned long int strtoul(const char *nptr, char **endptr, int base);
20
21/* stdio.h */
22#define EOF (-1)
23FILE *fopen(const char *path, const char *mode);
24FILE *fdopen(int fildes, const char *mode);
25FILE *freopen(const char *path, const char *mode, FILE *stream);
26int fclose(FILE *stream);
27size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
28size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
29int fgetc(FILE *stream);
30char *fgets(char *s, int size, FILE *stream);
31int getc(FILE *stream);
32int getchar(void);
33char *gets(char *s);
34int ungetc(int c, FILE *stream);
35int fflush(FILE *stream);
36
37int printf(const char *format, ...);
38int fprintf(FILE *stream, const char *format, ...);
39int sprintf(char *str, const char *format, ...);
40int snprintf(char *str, size_t size, const char *format, ...);
41int asprintf(char **strp, const char *format, ...);
42int dprintf(int d, const char *format, ...);
43int vprintf(const char *format, va_list ap);
44int vfprintf(FILE *stream, const char *format, va_list ap);
45int vsprintf(char *str, const char *format, va_list ap);
46int vsnprintf(char *str, size_t size, const char *format, va_list ap);
47int vasprintf(char **strp, const char *format, va_list ap);
48int vdprintf(int d, const char *format, va_list ap);
49
50/* string.h */
51char *strcat(char *dest, const char *src);
52char *strchr(const char *s, int c);
53char *strrchr(const char *s, int c);
54char *strcpy(char *dest, const char *src);
55void *memcpy(void *dest, const void *src, size_t n);
56void *memset(void *s, int c, size_t n);
57char *strdup(const char *s);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t