tcclib.h 2.5 KB

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