tcclib.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 putchar (int c);
  40. int printf(const char *format, ...);
  41. int fprintf(FILE *stream, const char *format, ...);
  42. int sprintf(char *str, const char *format, ...);
  43. int snprintf(char *str, size_t size, const char *format, ...);
  44. int asprintf(char **strp, const char *format, ...);
  45. int dprintf(int fd, const char *format, ...);
  46. int vprintf(const char *format, va_list ap);
  47. int vfprintf(FILE *stream, const char *format, va_list ap);
  48. int vsprintf(char *str, const char *format, va_list ap);
  49. int vsnprintf(char *str, size_t size, const char *format, va_list ap);
  50. int vasprintf(char **strp, const char *format, va_list ap);
  51. int vdprintf(int fd, const char *format, va_list ap);
  52. void perror(const char *s);
  53. /* string.h */
  54. char *strcat(char *dest, const char *src);
  55. char *strchr(const char *s, int c);
  56. char *strrchr(const char *s, int c);
  57. char *strcpy(char *dest, const char *src);
  58. void *memcpy(void *dest, const void *src, size_t n);
  59. void *memmove(void *dest, const void *src, size_t n);
  60. void *memset(void *s, int c, size_t n);
  61. char *strdup(const char *s);
  62. size_t strlen(const char *s);
  63. /* dlfcn.h */
  64. #define RTLD_LAZY 0x001
  65. #define RTLD_NOW 0x002
  66. #define RTLD_GLOBAL 0x100
  67. void *dlopen(const char *filename, int flag);
  68. const char *dlerror(void);
  69. void *dlsym(void *handle, char *symbol);
  70. int dlclose(void *handle);
  71. #endif /* _TCCLIB_H */