scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 392865a83653ffd582efd2c855cab9ac853cadc2
parent 777c75e345f724aa3a6830fdd340437bab46c65e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 20 Jun 2016 14:00:12 +0200

Install scc headers is a custom directory

It is going to be useful to have the standard headers in a known
directory which will not cause conflicts with the system headers.

Diffstat:
MMakefile | 3+++
Mcc1/cpp.c | 1+
Mconfig.mk | 7++++++-
Alibc/include/amd64-sysv/assert.h | 9+++++++++
Alibc/include/amd64-sysv/ctype.h | 20++++++++++++++++++++
Alibc/include/amd64-sysv/errno.h | 7+++++++
Alibc/include/amd64-sysv/signal.h | 8++++++++
Alibc/include/amd64-sysv/stdio.h | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibc/include/amd64-sysv/stdlib.h | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibc/include/amd64-sysv/string.h | 35+++++++++++++++++++++++++++++++++++
Alibc/include/i386-sysv/assert.h | 9+++++++++
Alibc/include/i386-sysv/ctype.h | 20++++++++++++++++++++
Alibc/include/i386-sysv/errno.h | 7+++++++
Alibc/include/i386-sysv/signal.h | 8++++++++
Alibc/include/i386-sysv/stdio.h | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibc/include/i386-sysv/stdlib.h | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibc/include/i386-sysv/string.h | 35+++++++++++++++++++++++++++++++++++
Alibc/include/qbe/assert.h | 9+++++++++
Alibc/include/qbe/ctype.h | 20++++++++++++++++++++
Alibc/include/qbe/errno.h | 7+++++++
Alibc/include/qbe/signal.h | 8++++++++
Alibc/include/qbe/stdio.h | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibc/include/qbe/stdlib.h | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibc/include/qbe/string.h | 35+++++++++++++++++++++++++++++++++++
Mlibc/include/z80/stdio.h | 1+
Mlibc/include/z80/stdlib.h | 1+
26 files changed, 654 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -35,9 +35,12 @@ $(ARCHS): install: all mkdir -p $(PREFIX)/libexec/scc/ mkdir -p $(PREFIX)/bin/ + mkdir -p $(PREFIX)/include/scc cp -f bin/cc* $(PREFIX)/libexec/scc/ cp -f bin/cc1 $(PREFIX)/bin/cpp cp -f bin/scc $(PREFIX)/bin/ + cp -fr libc/include/* $(PREFIX)/include/scc/ + find $(PREFIX)/include/scc/ -type f | xargs chmod 644 cd $(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc* cd $(PREFIX)/bin && chmod 755 cpp scc && strip cpp scc diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -472,6 +472,7 @@ include(void) char *file, *p, **bp; size_t filelen; static char *sysinclude[] = { + PREFIX "/include/scc/" ARCH "/", PREFIX"/include/", PREFIX"/local/include/", NULL diff --git a/config.mk b/config.mk @@ -17,7 +17,12 @@ MANPREFIX = ${PREFIX}/share/man # AR = ar # for Plan9 add -D_SUSV2_SOURCE -SCC_CFLAGS = -DNDEBUG -Iarch/$(ARCH) -DPREFIX=\"$(PREFIX)\" $(CFLAGS) +SCC_CFLAGS = -DARCH=\"$(ARCH)\" \ + -Iarch/$(ARCH) \ + -DPREFIX=\"$(PREFIX)\" \ + -DNDEBUG \ + $(CFLAGS) + SCC_LDFLAGS = $(LDFLAGS) .c.o: diff --git a/libc/include/amd64-sysv/assert.h b/libc/include/amd64-sysv/assert.h @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _ASSERT_H +#define _ASSERT_H + +#ifndef NDEBUG +#define assert(exp) __assert(#exp, __FILE__, __LINE__) +#endif + +#endif diff --git a/libc/include/amd64-sysv/ctype.h b/libc/include/amd64-sysv/ctype.h @@ -0,0 +1,20 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _CTYPE_H +#define _CTYPE_H + +int isalnum(int c); +int isalpha(int c); +int islower(int c); +int isupper(int c); +int isdigit(int c); +int isxdigit(int c); +int iscntrl(int c); +int isgraph(int c); +int isspace(int c); +int isblank(int c); +int isprint(int c); +int ispunct(int c); +int tolower(int c); +int toupper(int c); + +#endif diff --git a/libc/include/amd64-sysv/errno.h b/libc/include/amd64-sysv/errno.h @@ -0,0 +1,7 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _ERRNO_H +#define _ERRNO_H + +extern int errno; + +#endif diff --git a/libc/include/amd64-sysv/signal.h b/libc/include/amd64-sysv/signal.h @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _SIGNAL_H +#define _SIGNAL_H + +void ( *signal(int signum, void (*handler)(int)) ) (int); +int raise(int sig); + +#endif diff --git a/libc/include/amd64-sysv/stdio.h b/libc/include/amd64-sysv/stdio.h @@ -0,0 +1,79 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STDIO_H +#define _STDIO_H + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#define EOF -1 +#define BUFSIZ 512 +#define FILENAME_MAX 256 +#define FOPEN_MAX 16 +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 +#define L_tmpnam 256 +#define SEEK_CUR 0 +#define SEEK_END 1 +#define SEEK_SET 2 +#define TMP_MAX 25 + +typedef struct _FILE FILE; + +extern FILE *fopen(const char *, const char *mode); +extern FILE *freopen(const char *path, const char *mode, FILE *fp); +extern int fclose(FILE *fp); + +extern int fflush(FILE *fp); +extern void setbuf(FILE *fp, char *buf); +extern int setvbuf(FILE *fp, char *buf, size_t size); + +extern size_t fread(void *ptr, size_t size, size_t n, FILE *fp); +extern size_t fwrite(const void *ptr, size_t size, size n, FILE *fp); + +extern int fgetc(FILE *fp); +extern int getc(FILE *fp); +extern int getchar(void); + +extern int fputc(int c, FILE *fp); +extern int putc(int c, FILE *fp); +extern int putchar(int c); + +extern char *fgets(char *s, int size, FILE *fp); +extern char *gets(char *s); + +extern int fputs(char *s, FILE *fp); +extern int puts(char *s); + +extern int scanf(const char *fmt, ...); +extern int fscanf(FILE *fp, const char *fmt, ...); +extern int sscanf(char *s, const char *fmt, ...); + +extern int printf(const char *fmt, ...); +extern int fprintf(FILE *fp, const char *fmt, ...); +extern int sprintf(char *s, const char *fmt, ...); +extern int snprintf(char *s, size_t size, const char *fmt, ...); + +extern void perror(const char *s); + +extern long ftell(FILE *fp); +extern long fseek(FILE *fp); +extern void rewind(FILE *fp); + +extern void clearerr(FILE *fp); +extern int feof(FILE *fp); +extern int ferror(FILE *fp); + +extern int remove(const char *name); +extern int rename(const char *old, const char *new); +extern FILE *tmpfile(void); +extern FILE *tmpnam(char *s); + +extern FILE *stdin, *stdio, *stderr; +#endif diff --git a/libc/include/amd64-sysv/stdlib.h b/libc/include/amd64-sysv/stdlib.h @@ -0,0 +1,56 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STDLIB_H +#define _STDLIB_H + +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define RAND_MAX 32767 + +extern double atof(const char *ptr); +extern int atoi(const char *s); +extern long atol(const char *s); +extern long long atoll(const char *s); + +extern float strtof(const char *s, char **end); +extern double strtod(const char *s, char **end); +extern long double strtold(const char *s, char **end); + +extern long strtol(const char *s, char **end, int base); +extern long long strtoll(const char *s, char **end, int base); +extern unsigned long stroul(const char *s, char **end, int base); +extern unsigned long long stroull(const char *s, char **end, int base); + +extern void *calloc(size_t nitems, size_t size); +extern void free(void *ptr); +extern void *realloc(void *ptr, size_t size); + +extern void abort(void); +extern int atexit(void (*func)(void)); +extern void exit(int status); +extern char *getenv(const char *name); +extern int system(const char *cmd); + +extern void *bsearch(const void *key, + const void *base, size_t nitems, size_t size, + int (*cmp)(const void *, const void *)); +extern void qsort(void *base, size_t nitems, size_t size, + int (*cmp)(const void *, const void *)); + +extern void abs(int x); +/* div_t div(int num, int denom); */ +extern long labs(long int x); +/* ldiv_t ldiv(long int number, long int denom); + +extern int rand(void); +extern void srand(unsigned seed); + +#endif diff --git a/libc/include/amd64-sysv/string.h b/libc/include/amd64-sysv/string.h @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STRING_H +#define _STRING_H + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef _SIZET +typedef unsigned size_t; +#endif + +extern char *strcpy(char *dst, const char *src); +extern char *strncpy(char *dst, const char *src, size_t n); +extern char *strcat(char *dst, const char *src); +extern char *strncat(char *dst, const char *src, size_t n); +extern size_t strxfrm(char *dst, const *char *src, size_t n); +extern size_t strlen(const char *s); +extern int strcmp(const char *s1, const char *s2); +extern int strcoll(const char *s1, const char *s2); +extern char *strchr(const char *s, int c); +extern char *strrchr(const char *s, int c); +extern size_t strspn(const char *s, const char *accept); +extern size_t strcspn(const char *s, const char *reject); +extern size_t strpbrk(const char *s, const char *accept); +extern size_t strstr(const char *s, const char *sub); +extern char *strtok(const char *s, const char *delim); + +extern void *memset(void *s, int c, size_t n); +extern void *memcpy(void *dst, const void *src, size_t n); +extern void *memmove(void *dst, const void *src, size_t n); +extern int memcmp(const void *s1, const void *s2, size_t n); +extern coid *memchr(const void *s, int c, size_t n); + +#endif diff --git a/libc/include/i386-sysv/assert.h b/libc/include/i386-sysv/assert.h @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _ASSERT_H +#define _ASSERT_H + +#ifndef NDEBUG +#define assert(exp) __assert(#exp, __FILE__, __LINE__) +#endif + +#endif diff --git a/libc/include/i386-sysv/ctype.h b/libc/include/i386-sysv/ctype.h @@ -0,0 +1,20 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _CTYPE_H +#define _CTYPE_H + +int isalnum(int c); +int isalpha(int c); +int islower(int c); +int isupper(int c); +int isdigit(int c); +int isxdigit(int c); +int iscntrl(int c); +int isgraph(int c); +int isspace(int c); +int isblank(int c); +int isprint(int c); +int ispunct(int c); +int tolower(int c); +int toupper(int c); + +#endif diff --git a/libc/include/i386-sysv/errno.h b/libc/include/i386-sysv/errno.h @@ -0,0 +1,7 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _ERRNO_H +#define _ERRNO_H + +extern int errno; + +#endif diff --git a/libc/include/i386-sysv/signal.h b/libc/include/i386-sysv/signal.h @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _SIGNAL_H +#define _SIGNAL_H + +void ( *signal(int signum, void (*handler)(int)) ) (int); +int raise(int sig); + +#endif diff --git a/libc/include/i386-sysv/stdio.h b/libc/include/i386-sysv/stdio.h @@ -0,0 +1,79 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STDIO_H +#define _STDIO_H + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#define EOF -1 +#define BUFSIZ 512 +#define FILENAME_MAX 256 +#define FOPEN_MAX 16 +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 +#define L_tmpnam 256 +#define SEEK_CUR 0 +#define SEEK_END 1 +#define SEEK_SET 2 +#define TMP_MAX 25 + +typedef struct _FILE FILE; + +extern FILE *fopen(const char *, const char *mode); +extern FILE *freopen(const char *path, const char *mode, FILE *fp); +extern int fclose(FILE *fp); + +extern int fflush(FILE *fp); +extern void setbuf(FILE *fp, char *buf); +extern int setvbuf(FILE *fp, char *buf, size_t size); + +extern size_t fread(void *ptr, size_t size, size_t n, FILE *fp); +extern size_t fwrite(const void *ptr, size_t size, size n, FILE *fp); + +extern int fgetc(FILE *fp); +extern int getc(FILE *fp); +extern int getchar(void); + +extern int fputc(int c, FILE *fp); +extern int putc(int c, FILE *fp); +extern int putchar(int c); + +extern char *fgets(char *s, int size, FILE *fp); +extern char *gets(char *s); + +extern int fputs(char *s, FILE *fp); +extern int puts(char *s); + +extern int scanf(const char *fmt, ...); +extern int fscanf(FILE *fp, const char *fmt, ...); +extern int sscanf(char *s, const char *fmt, ...); + +extern int printf(const char *fmt, ...); +extern int fprintf(FILE *fp, const char *fmt, ...); +extern int sprintf(char *s, const char *fmt, ...); +extern int snprintf(char *s, size_t size, const char *fmt, ...); + +extern void perror(const char *s); + +extern long ftell(FILE *fp); +extern long fseek(FILE *fp); +extern void rewind(FILE *fp); + +extern void clearerr(FILE *fp); +extern int feof(FILE *fp); +extern int ferror(FILE *fp); + +extern int remove(const char *name); +extern int rename(const char *old, const char *new); +extern FILE *tmpfile(void); +extern FILE *tmpnam(char *s); + +extern FILE *stdin, *stdio, *stderr; +#endif diff --git a/libc/include/i386-sysv/stdlib.h b/libc/include/i386-sysv/stdlib.h @@ -0,0 +1,56 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STDLIB_H +#define _STDLIB_H + +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define RAND_MAX 32767 + +extern double atof(const char *ptr); +extern int atoi(const char *s); +extern long atol(const char *s); +extern long long atoll(const char *s); + +extern float strtof(const char *s, char **end); +extern double strtod(const char *s, char **end); +extern long double strtold(const char *s, char **end); + +extern long strtol(const char *s, char **end, int base); +extern long long strtoll(const char *s, char **end, int base); +extern unsigned long stroul(const char *s, char **end, int base); +extern unsigned long long stroull(const char *s, char **end, int base); + +extern void *calloc(size_t nitems, size_t size); +extern void free(void *ptr); +extern void *realloc(void *ptr, size_t size); + +extern void abort(void); +extern int atexit(void (*func)(void)); +extern void exit(int status); +extern char *getenv(const char *name); +extern int system(const char *cmd); + +extern void *bsearch(const void *key, + const void *base, size_t nitems, size_t size, + int (*cmp)(const void *, const void *)); +extern void qsort(void *base, size_t nitems, size_t size, + int (*cmp)(const void *, const void *)); + +extern void abs(int x); +/* div_t div(int num, int denom); */ +extern long labs(long int x); +/* ldiv_t ldiv(long int number, long int denom); + +extern int rand(void); +extern void srand(unsigned seed); + +#endif diff --git a/libc/include/i386-sysv/string.h b/libc/include/i386-sysv/string.h @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STRING_H +#define _STRING_H + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef _SIZET +typedef unsigned size_t; +#endif + +extern char *strcpy(char *dst, const char *src); +extern char *strncpy(char *dst, const char *src, size_t n); +extern char *strcat(char *dst, const char *src); +extern char *strncat(char *dst, const char *src, size_t n); +extern size_t strxfrm(char *dst, const *char *src, size_t n); +extern size_t strlen(const char *s); +extern int strcmp(const char *s1, const char *s2); +extern int strcoll(const char *s1, const char *s2); +extern char *strchr(const char *s, int c); +extern char *strrchr(const char *s, int c); +extern size_t strspn(const char *s, const char *accept); +extern size_t strcspn(const char *s, const char *reject); +extern size_t strpbrk(const char *s, const char *accept); +extern size_t strstr(const char *s, const char *sub); +extern char *strtok(const char *s, const char *delim); + +extern void *memset(void *s, int c, size_t n); +extern void *memcpy(void *dst, const void *src, size_t n); +extern void *memmove(void *dst, const void *src, size_t n); +extern int memcmp(const void *s1, const void *s2, size_t n); +extern coid *memchr(const void *s, int c, size_t n); + +#endif diff --git a/libc/include/qbe/assert.h b/libc/include/qbe/assert.h @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _ASSERT_H +#define _ASSERT_H + +#ifndef NDEBUG +#define assert(exp) __assert(#exp, __FILE__, __LINE__) +#endif + +#endif diff --git a/libc/include/qbe/ctype.h b/libc/include/qbe/ctype.h @@ -0,0 +1,20 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _CTYPE_H +#define _CTYPE_H + +int isalnum(int c); +int isalpha(int c); +int islower(int c); +int isupper(int c); +int isdigit(int c); +int isxdigit(int c); +int iscntrl(int c); +int isgraph(int c); +int isspace(int c); +int isblank(int c); +int isprint(int c); +int ispunct(int c); +int tolower(int c); +int toupper(int c); + +#endif diff --git a/libc/include/qbe/errno.h b/libc/include/qbe/errno.h @@ -0,0 +1,7 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _ERRNO_H +#define _ERRNO_H + +extern int errno; + +#endif diff --git a/libc/include/qbe/signal.h b/libc/include/qbe/signal.h @@ -0,0 +1,8 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _SIGNAL_H +#define _SIGNAL_H + +void ( *signal(int signum, void (*handler)(int)) ) (int); +int raise(int sig); + +#endif diff --git a/libc/include/qbe/stdio.h b/libc/include/qbe/stdio.h @@ -0,0 +1,79 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STDIO_H +#define _STDIO_H + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#define EOF -1 +#define BUFSIZ 512 +#define FILENAME_MAX 256 +#define FOPEN_MAX 16 +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 +#define L_tmpnam 256 +#define SEEK_CUR 0 +#define SEEK_END 1 +#define SEEK_SET 2 +#define TMP_MAX 25 + +typedef struct _FILE FILE; + +extern FILE *fopen(const char *, const char *mode); +extern FILE *freopen(const char *path, const char *mode, FILE *fp); +extern int fclose(FILE *fp); + +extern int fflush(FILE *fp); +extern void setbuf(FILE *fp, char *buf); +extern int setvbuf(FILE *fp, char *buf, size_t size); + +extern size_t fread(void *ptr, size_t size, size_t n, FILE *fp); +extern size_t fwrite(const void *ptr, size_t size, size n, FILE *fp); + +extern int fgetc(FILE *fp); +extern int getc(FILE *fp); +extern int getchar(void); + +extern int fputc(int c, FILE *fp); +extern int putc(int c, FILE *fp); +extern int putchar(int c); + +extern char *fgets(char *s, int size, FILE *fp); +extern char *gets(char *s); + +extern int fputs(char *s, FILE *fp); +extern int puts(char *s); + +extern int scanf(const char *fmt, ...); +extern int fscanf(FILE *fp, const char *fmt, ...); +extern int sscanf(char *s, const char *fmt, ...); + +extern int printf(const char *fmt, ...); +extern int fprintf(FILE *fp, const char *fmt, ...); +extern int sprintf(char *s, const char *fmt, ...); +extern int snprintf(char *s, size_t size, const char *fmt, ...); + +extern void perror(const char *s); + +extern long ftell(FILE *fp); +extern long fseek(FILE *fp); +extern void rewind(FILE *fp); + +extern void clearerr(FILE *fp); +extern int feof(FILE *fp); +extern int ferror(FILE *fp); + +extern int remove(const char *name); +extern int rename(const char *old, const char *new); +extern FILE *tmpfile(void); +extern FILE *tmpnam(char *s); + +extern FILE *stdin, *stdio, *stderr; +#endif diff --git a/libc/include/qbe/stdlib.h b/libc/include/qbe/stdlib.h @@ -0,0 +1,56 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STDLIB_H +#define _STDLIB_H + +#ifndef _SIZET +typedef unsigned long size_t; +#define _SIZET +#endif + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define RAND_MAX 32767 + +extern double atof(const char *ptr); +extern int atoi(const char *s); +extern long atol(const char *s); +extern long long atoll(const char *s); + +extern float strtof(const char *s, char **end); +extern double strtod(const char *s, char **end); +extern long double strtold(const char *s, char **end); + +extern long strtol(const char *s, char **end, int base); +extern long long strtoll(const char *s, char **end, int base); +extern unsigned long stroul(const char *s, char **end, int base); +extern unsigned long long stroull(const char *s, char **end, int base); + +extern void *calloc(size_t nitems, size_t size); +extern void free(void *ptr); +extern void *realloc(void *ptr, size_t size); + +extern void abort(void); +extern int atexit(void (*func)(void)); +extern void exit(int status); +extern char *getenv(const char *name); +extern int system(const char *cmd); + +extern void *bsearch(const void *key, + const void *base, size_t nitems, size_t size, + int (*cmp)(const void *, const void *)); +extern void qsort(void *base, size_t nitems, size_t size, + int (*cmp)(const void *, const void *)); + +extern void abs(int x); +/* div_t div(int num, int denom); */ +extern long labs(long int x); +/* ldiv_t ldiv(long int number, long int denom); + +extern int rand(void); +extern void srand(unsigned seed); + +#endif diff --git a/libc/include/qbe/string.h b/libc/include/qbe/string.h @@ -0,0 +1,35 @@ +/* See LICENSE file for copyright and license details. */ +#ifndef _STRING_H +#define _STRING_H + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifndef _SIZET +typedef unsigned size_t; +#endif + +extern char *strcpy(char *dst, const char *src); +extern char *strncpy(char *dst, const char *src, size_t n); +extern char *strcat(char *dst, const char *src); +extern char *strncat(char *dst, const char *src, size_t n); +extern size_t strxfrm(char *dst, const *char *src, size_t n); +extern size_t strlen(const char *s); +extern int strcmp(const char *s1, const char *s2); +extern int strcoll(const char *s1, const char *s2); +extern char *strchr(const char *s, int c); +extern char *strrchr(const char *s, int c); +extern size_t strspn(const char *s, const char *accept); +extern size_t strcspn(const char *s, const char *reject); +extern size_t strpbrk(const char *s, const char *accept); +extern size_t strstr(const char *s, const char *sub); +extern char *strtok(const char *s, const char *delim); + +extern void *memset(void *s, int c, size_t n); +extern void *memcpy(void *dst, const void *src, size_t n); +extern void *memmove(void *dst, const void *src, size_t n); +extern int memcmp(const void *s1, const void *s2, size_t n); +extern coid *memchr(const void *s, int c, size_t n); + +#endif diff --git a/libc/include/z80/stdio.h b/libc/include/z80/stdio.h @@ -8,6 +8,7 @@ #ifndef _SIZET typedef unsigned size_t; +#define _SIZET #endif #define EOF -1 diff --git a/libc/include/z80/stdlib.h b/libc/include/z80/stdlib.h @@ -4,6 +4,7 @@ #ifndef _SIZET typedef unsigned size_t; +#define _SIZET #endif #ifndef NULL