History

added std libs

bellard committed 25 years ago

Commit b536ac31 parent 507a2213 files · +31 −4Browse files

Unified · Split

3 files
  1. stdarg.h +11 −0
  2. stddef.h +9 −0
  3. tcclib.h +11 −4
stdarg.h+11−0
@@ -0,0 +1,11 @@
1+#ifndef _STDARG_H
2+#define _STDARG_H
3+
4+typedef char *va_list;
5+
6+/* only correct for i386 */
7+#define va_start(ap,last) ap=(char *)&(last);
8+#define va_arg(ap,type) (ap-=sizeof (type), *(type *)(ap))
9+#define va_end(ap)
10+
11+#endif
stddef.h+9−0
@@ -0,0 +1,9 @@
1+#ifndef _STDDEF_H
2+#define _STDDEF_H
3+
4+/* TCC include file */
5+#define NULL ((void *)0)
6+
7+typedef unsigned int size_t;
8+
9+#endif
tcclib.h+11−4
@@ -4,10 +4,8 @@ · 3 unmodified lines
44 * only for your convenience so that you do not need to put the whole
55 * glibc include files on your floppy disk
66 */
7−#define NULL 0
8−typedef unsigned int size_t;
9−typedef struct __FILE FILE;
10−typedef void *va_list;
7+#include <stddef.h>
8+#include <stdarg.h>
119
1210 /* stdlib.h */
1311 void *calloc(size_t nmemb, size_t size);
@@ -19,6 +17,7 @@ long int strtol(const char *nptr, char **endptr, int base); · 5 unmodified lines
1917 unsigned long int strtoul(const char *nptr, char **endptr, int base);
2018
2119 /* stdio.h */
20+typedef struct __FILE FILE;
2221 #define EOF (-1)
2322 FILE *fopen(const char *path, const char *mode);
2423 FILE *fdopen(int fildes, const char *mode);
@@ -47,6 +46,8 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap); · 22 unmodified lines
4746 int vasprintf(char **strp, const char *format, va_list ap);
4847 int vdprintf(int d, const char *format, va_list ap);
4948
49+void perror(const char *s);
50+
5051 /* string.h */
5152 char *strcat(char *dest, const char *src);
5253 char *strchr(const char *s, int c);
@@ -55,3 +56,9 @@ char *strcpy(char *dest, const char *src); · 2 unmodified lines
5556 void *memcpy(void *dest, const void *src, size_t n);
5657 void *memset(void *s, int c, size_t n);
5758 char *strdup(const char *s);
59+
60+/* dlfcn.h */
61+void *dlopen(const char *filename, int flag);
62+const char *dlerror(void);
63+void *dlsym(void *handle, char *symbol);
64+int dlclose(void *handle);

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