riscv64-asm.c: asm_emit_j: correct check of immediate
[tinycc.git] / tcclib.h
blob8d59e4c9abea953f22f5ad35bdfe4315c2816bdf
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);
42 int putchar (int c);
44 int printf(const char *format, ...);
45 int fprintf(FILE *stream, const char *format, ...);
46 int sprintf(char *str, const char *format, ...);
47 int snprintf(char *str, size_t size, const char *format, ...);
48 int asprintf(char **strp, const char *format, ...);
49 int dprintf(int fd, const char *format, ...);
50 int vprintf(const char *format, va_list ap);
51 int vfprintf(FILE *stream, const char *format, va_list ap);
52 int vsprintf(char *str, const char *format, va_list ap);
53 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
54 int vasprintf(char **strp, const char *format, va_list ap);
55 int vdprintf(int fd, const char *format, va_list ap);
57 void perror(const char *s);
59 /* string.h */
60 char *strcat(char *dest, const char *src);
61 char *strchr(const char *s, int c);
62 char *strrchr(const char *s, int c);
63 char *strcpy(char *dest, const char *src);
64 void *memcpy(void *dest, const void *src, size_t n);
65 void *memmove(void *dest, const void *src, size_t n);
66 void *memset(void *s, int c, size_t n);
67 char *strdup(const char *s);
68 size_t strlen(const char *s);
70 /* dlfcn.h */
71 #define RTLD_LAZY 0x001
72 #define RTLD_NOW 0x002
73 #define RTLD_GLOBAL 0x100
75 void *dlopen(const char *filename, int flag);
76 const char *dlerror(void);
77 void *dlsym(void *handle, char *symbol);
78 int dlclose(void *handle);
80 #endif /* _TCCLIB_H */