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
8+typedef unsigned int size_t;
9+typedef struct __FILE FILE;
10+typedef void *va_list;
11+
12+/* stdlib.h */
13+void *calloc(size_t nmemb, size_t size);
14+void *malloc(size_t size);
15+void free(void *ptr);
16+void *realloc(void *ptr, size_t size);
17+int atoi(const char *nptr);
18+long int strtol(const char *nptr, char **endptr, int base);
19+unsigned long int strtoul(const char *nptr, char **endptr, int base);
20+
21+/* stdio.h */
22+#define EOF (-1)
23+FILE *fopen(const char *path, const char *mode);
24+FILE *fdopen(int fildes, const char *mode);
25+FILE *freopen(const char *path, const char *mode, FILE *stream);
26+int fclose(FILE *stream);
27+size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
28+size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
29+int fgetc(FILE *stream);
30+char *fgets(char *s, int size, FILE *stream);
31+int getc(FILE *stream);
32+int getchar(void);
33+char *gets(char *s);
34+int ungetc(int c, FILE *stream);
35+int fflush(FILE *stream);
36+
37+int printf(const char *format, ...);
38+int fprintf(FILE *stream, const char *format, ...);
39+int sprintf(char *str, const char *format, ...);
40+int snprintf(char *str, size_t size, const char *format, ...);
41+int asprintf(char **strp, const char *format, ...);
42+int dprintf(int d, const char *format, ...);
43+int vprintf(const char *format, va_list ap);
44+int vfprintf(FILE *stream, const char *format, va_list ap);
45+int vsprintf(char *str, const char *format, va_list ap);
46+int vsnprintf(char *str, size_t size, const char *format, va_list ap);
47+int vasprintf(char **strp, const char *format, va_list ap);
48+int vdprintf(int d, const char *format, va_list ap);
49+
50+/* string.h */
51+char *strcat(char *dest, const char *src);
52+char *strchr(const char *s, int c);
53+char *strrchr(const char *s, int c);
54+char *strcpy(char *dest, const char *src);
55+void *memcpy(void *dest, const void *src, size_t n);
56+void *memset(void *s, int c, size_t n);
57+char *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