tccasm: support alternate .type syntaxes
[tinycc/miki.git] / include / tcclib.h
blob42f8f3f5780b28f5aa1fdb4a496730598f27bc4f
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 #ifndef _TCCLIB_H
8 #define _TCCLIB_H
10 #include <stddef.h>
11 #include <stdarg.h>
13 /* stdlib.h */
14 void *calloc(size_t nmemb, size_t size);
15 void *malloc(size_t size);
16 void free(void *ptr);
17 void *realloc(void *ptr, size_t size);
18 int atoi(const char *nptr);
19 long int strtol(const char *nptr, char **endptr, int base);
20 unsigned long int strtoul(const char *nptr, char **endptr, int base);
21 void exit(int);
23 /* stdio.h */
24 typedef struct __FILE FILE;
25 #define EOF (-1)
26 extern FILE *stdin;
27 extern FILE *stdout;
28 extern FILE *stderr;
29 FILE *fopen(const char *path, const char *mode);
30 FILE *fdopen(int fildes, const char *mode);
31 FILE *freopen(const char *path, const char *mode, FILE *stream);
32 int fclose(FILE *stream);
33 size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
34 size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
35 int fgetc(FILE *stream);
36 char *fgets(char *s, int size, FILE *stream);
37 int getc(FILE *stream);
38 int getchar(void);
39 char *gets(char *s);
40 int ungetc(int c, FILE *stream);
41 int fflush(FILE *stream);
43 int printf(const char *format, ...);
44 int fprintf(FILE *stream, const char *format, ...);
45 int sprintf(char *str, const char *format, ...);
46 int snprintf(char *str, size_t size, const char *format, ...);
47 int asprintf(char **strp, const char *format, ...);
48 int dprintf(int fd, const char *format, ...);
49 int vprintf(const char *format, va_list ap);
50 int vfprintf(FILE *stream, const char *format, va_list ap);
51 int vsprintf(char *str, const char *format, va_list ap);
52 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
53 int vasprintf(char **strp, const char *format, va_list ap);
54 int vdprintf(int fd, const char *format, va_list ap);
56 void perror(const char *s);
58 /* string.h */
59 char *strcat(char *dest, const char *src);
60 char *strchr(const char *s, int c);
61 char *strrchr(const char *s, int c);
62 char *strcpy(char *dest, const char *src);
63 void *memcpy(void *dest, const void *src, size_t n);
64 void *memmove(void *dest, const void *src, size_t n);
65 void *memset(void *s, int c, size_t n);
66 char *strdup(const char *s);
68 /* dlfcn.h */
69 #define RTLD_LAZY 0x001
70 #define RTLD_NOW 0x002
71 #define RTLD_GLOBAL 0x100
73 void *dlopen(const char *filename, int flag);
74 const char *dlerror(void);
75 void *dlsym(void *handle, char *symbol);
76 int dlclose(void *handle);
78 #endif /* _TCCLIB_H */