diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua index 3427826e6..68a506b26 100644 --- a/lang/cem/libcc.ansi/build.lua +++ b/lang/cem/libcc.ansi/build.lua @@ -45,6 +45,7 @@ for _, plat in ipairs(vars.plats) do "./core/misc/*.c", "./sys/malloc/*.c", "./sys/exit/*.c", + "./sys/stdio/*.c", "./assert/*.c", "./stdio/*.c", "./stdlib/*.c", @@ -60,7 +61,7 @@ for _, plat in ipairs(vars.plats) do "./sys/malloc/malloc.h", "./core/math/localmath.h", "./core/stdlib/ext_fmt.h", - "./stdio/loc_incl.h", + "./sys/stdio/loc_incl.h", "./time/loc_time.h", }, vars = { plat = plat } diff --git a/lang/cem/libcc.ansi/stdio/perror.c b/lang/cem/libcc.ansi/core/errno/perror.c similarity index 100% rename from lang/cem/libcc.ansi/stdio/perror.c rename to lang/cem/libcc.ansi/core/errno/perror.c diff --git a/lang/cem/libcc.ansi/stdio/fgetpos.c b/lang/cem/libcc.ansi/core/stdio/fgetpos.c similarity index 100% rename from lang/cem/libcc.ansi/stdio/fgetpos.c rename to lang/cem/libcc.ansi/core/stdio/fgetpos.c diff --git a/lang/cem/libcc.ansi/stdio/fsetpos.c b/lang/cem/libcc.ansi/core/stdio/fsetpos.c similarity index 100% rename from lang/cem/libcc.ansi/stdio/fsetpos.c rename to lang/cem/libcc.ansi/core/stdio/fsetpos.c diff --git a/lang/cem/libcc.ansi/stdio/gets.c b/lang/cem/libcc.ansi/core/stdio/gets.c similarity index 100% rename from lang/cem/libcc.ansi/stdio/gets.c rename to lang/cem/libcc.ansi/core/stdio/gets.c diff --git a/lang/cem/libcc.ansi/stdio/rewind.c b/lang/cem/libcc.ansi/core/stdio/rewind.c similarity index 89% rename from lang/cem/libcc.ansi/stdio/rewind.c rename to lang/cem/libcc.ansi/core/stdio/rewind.c index 41791a7d0..db2a5e2a4 100644 --- a/lang/cem/libcc.ansi/stdio/rewind.c +++ b/lang/cem/libcc.ansi/core/stdio/rewind.c @@ -4,7 +4,6 @@ /* $Id$ */ #include -#include "loc_incl.h" void rewind(FILE* stream) { diff --git a/lang/cem/libcc.ansi/headers/ack/config.h b/lang/cem/libcc.ansi/headers/ack/config.h index 593767d4c..c3daa68fe 100644 --- a/lang/cem/libcc.ansi/headers/ack/config.h +++ b/lang/cem/libcc.ansi/headers/ack/config.h @@ -34,4 +34,8 @@ #define ACKCONF_WANT_MALLOC 1 #endif +#ifndef ACKCONF_WANT_STDIO +#define ACKCONF_WANT_STDIO 1 +#endif + #endif diff --git a/lang/cem/libcc.ansi/headers/stddef.h b/lang/cem/libcc.ansi/headers/stddef.h index eb14ffb27..ab5707643 100644 --- a/lang/cem/libcc.ansi/headers/stddef.h +++ b/lang/cem/libcc.ansi/headers/stddef.h @@ -9,6 +9,7 @@ #ifndef _STDDEF_H #define _STDDEF_H +#include #include #define NULL 0 diff --git a/lang/cem/libcc.ansi/stdio/LIST b/lang/cem/libcc.ansi/stdio/LIST deleted file mode 100644 index a7ecf217d..000000000 --- a/lang/cem/libcc.ansi/stdio/LIST +++ /dev/null @@ -1,52 +0,0 @@ -loc_incl.h -tmpfile.c -tmpnam.c -rename.c -remove.c -fopen.c -freopen.c -setbuf.c -setvbuf.c -perror.c -fprintf.c -printf.c -sprintf.c -vfprintf.c -vprintf.c -vsprintf.c -doprnt.c -icompute.c -fscanf.c -scanf.c -sscanf.c -doscan.c -fgetc.c -fgets.c -getc.c -getchar.c -gets.c -putc.c -putchar.c -fputc.c -puts.c -fputs.c -ungetc.c -fread.c -fwrite.c -fgetpos.c -fsetpos.c -rewind.c -fseek.c -ftell.c -clearerr.c -feof.c -ferror.c -fileno.c -fltpr.c -ecvt.c -fillbuf.c -fclose.c -flushbuf.c -fflush.c -isatty.c -data.c diff --git a/lang/cem/libcc.ansi/stdio/Makefile b/lang/cem/libcc.ansi/stdio/Makefile deleted file mode 100644 index d0d501c05..000000000 --- a/lang/cem/libcc.ansi/stdio/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -clean: - rm -f tmpfile.o tmpnam.o rename.o remove.o fopen.o freopen.o \ - setbuf.o setvbuf.o perror.o fprintf.o printf.o sprintf.o \ - vfprintf.o vprintf.o vsprintf.o doprnt.o icompute.o \ - fscanf.o scanf.o sscanf.o doscan.o fgetc.o fgets.o getc.o \ - getchar.o gets.o putc.o putchar.o fputc.o puts.o fputs.o \ - ungetc.o fread.o fwrite.o fgetpos.o fsetpos.o rewind.o \ - fseek.o ftell.o clearerr.o feof.o ferror.o fileno.o \ - fltpr.o ecvt.o gcvt.o fillbuf.o fclose.o flushbuf.o \ - fflush.o isatty.o data.o OLIST diff --git a/lang/cem/libcc.ansi/stdio/remove.c b/lang/cem/libcc.ansi/stdlib/remove.c similarity index 100% rename from lang/cem/libcc.ansi/stdio/remove.c rename to lang/cem/libcc.ansi/stdlib/remove.c diff --git a/lang/cem/libcc.ansi/stdio/clearerr.c b/lang/cem/libcc.ansi/sys/stdio/clearerr.c similarity index 83% rename from lang/cem/libcc.ansi/stdio/clearerr.c rename to lang/cem/libcc.ansi/sys/stdio/clearerr.c index 8bfaaca79..df673423b 100644 --- a/lang/cem/libcc.ansi/stdio/clearerr.c +++ b/lang/cem/libcc.ansi/sys/stdio/clearerr.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + void(clearerr)(FILE* stream) { clearerr(stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/data.c b/lang/cem/libcc.ansi/sys/stdio/data.c similarity index 93% rename from lang/cem/libcc.ansi/stdio/data.c rename to lang/cem/libcc.ansi/sys/stdio/data.c index debff7771..ccf1664ce 100644 --- a/lang/cem/libcc.ansi/stdio/data.c +++ b/lang/cem/libcc.ansi/sys/stdio/data.c @@ -5,6 +5,8 @@ #include +#if ACKCONF_WANT_STDIO + struct __iobuf __stdin = { 0, 0, _IOREAD, 0, (unsigned char*)NULL, (unsigned char*)NULL, @@ -26,3 +28,5 @@ FILE* __iotab[FOPEN_MAX] = { &__stderr, 0 }; + +#endif diff --git a/lang/cem/libcc.ansi/stdio/doprnt.c b/lang/cem/libcc.ansi/sys/stdio/doprnt.c similarity index 99% rename from lang/cem/libcc.ansi/stdio/doprnt.c rename to lang/cem/libcc.ansi/sys/stdio/doprnt.c index 3e754801d..9f74c7659 100644 --- a/lang/cem/libcc.ansi/stdio/doprnt.c +++ b/lang/cem/libcc.ansi/sys/stdio/doprnt.c @@ -9,6 +9,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + /* gnum() is used to get the width and precision fields of a format. */ static const char* gnum(register const char* f, int* ip, va_list* app) @@ -393,3 +395,5 @@ int _doprnt(register const char* fmt, va_list ap, FILE* stream) } return nrchars; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/doscan.c b/lang/cem/libcc.ansi/sys/stdio/doscan.c similarity index 99% rename from lang/cem/libcc.ansi/stdio/doscan.c rename to lang/cem/libcc.ansi/sys/stdio/doscan.c index b53b4666f..3a1076bad 100644 --- a/lang/cem/libcc.ansi/stdio/doscan.c +++ b/lang/cem/libcc.ansi/sys/stdio/doscan.c @@ -9,6 +9,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + #if _EM_WSIZE == _EM_PSIZE #define set_pointer(flags) /* nothing */ #elif _EM_LSIZE == _EM_PSIZE @@ -540,3 +542,5 @@ int _doscan(register FILE* stream, const char* format, va_list ap) } return conv || (ic != EOF) ? done : EOF; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fclose.c b/lang/cem/libcc.ansi/sys/stdio/fclose.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/fclose.c rename to lang/cem/libcc.ansi/sys/stdio/fclose.c index 7ed925251..9a56b4cfe 100644 --- a/lang/cem/libcc.ansi/stdio/fclose.c +++ b/lang/cem/libcc.ansi/sys/stdio/fclose.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int fclose(FILE* fp) { register int i, retval = 0; @@ -30,3 +32,5 @@ int fclose(FILE* fp) free((void*)fp); return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fdopen.c b/lang/cem/libcc.ansi/sys/stdio/fdopen.c similarity index 97% rename from lang/cem/libcc.ansi/stdio/fdopen.c rename to lang/cem/libcc.ansi/sys/stdio/fdopen.c index d6b46bafe..084d39c14 100644 --- a/lang/cem/libcc.ansi/stdio/fdopen.c +++ b/lang/cem/libcc.ansi/sys/stdio/fdopen.c @@ -7,6 +7,8 @@ #include #include "../stdio/loc_incl.h" +#if ACKCONF_WANT_STDIO + FILE* fdopen(int fd, const char* mode) { register int i; @@ -63,3 +65,5 @@ FILE* fdopen(int fd, const char* mode) __iotab[i] = stream; return stream; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/feof.c b/lang/cem/libcc.ansi/sys/stdio/feof.c similarity index 80% rename from lang/cem/libcc.ansi/stdio/feof.c rename to lang/cem/libcc.ansi/sys/stdio/feof.c index 550792f36..71451ee0f 100644 --- a/lang/cem/libcc.ansi/stdio/feof.c +++ b/lang/cem/libcc.ansi/sys/stdio/feof.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(feof)(FILE* stream) { return feof(stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/ferror.c b/lang/cem/libcc.ansi/sys/stdio/ferror.c similarity index 82% rename from lang/cem/libcc.ansi/stdio/ferror.c rename to lang/cem/libcc.ansi/sys/stdio/ferror.c index d0271f0eb..f346ca791 100644 --- a/lang/cem/libcc.ansi/stdio/ferror.c +++ b/lang/cem/libcc.ansi/sys/stdio/ferror.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(ferror)(FILE* stream) { return ferror(stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fflush.c b/lang/cem/libcc.ansi/sys/stdio/fflush.c similarity index 98% rename from lang/cem/libcc.ansi/stdio/fflush.c rename to lang/cem/libcc.ansi/sys/stdio/fflush.c index 24baa6e70..f0f53bb25 100644 --- a/lang/cem/libcc.ansi/stdio/fflush.c +++ b/lang/cem/libcc.ansi/sys/stdio/fflush.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int fflush(FILE* stream) { int count, c1, i, retval = 0; @@ -86,3 +88,5 @@ void __register_stdio_cleanup(void) atexit(cleanup); } } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fgetc.c b/lang/cem/libcc.ansi/sys/stdio/fgetc.c similarity index 82% rename from lang/cem/libcc.ansi/stdio/fgetc.c rename to lang/cem/libcc.ansi/sys/stdio/fgetc.c index 08e7ca461..1b153c7f9 100644 --- a/lang/cem/libcc.ansi/stdio/fgetc.c +++ b/lang/cem/libcc.ansi/sys/stdio/fgetc.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int fgetc(FILE* stream) { return getc(stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fgets.c b/lang/cem/libcc.ansi/sys/stdio/fgets.c similarity index 92% rename from lang/cem/libcc.ansi/stdio/fgets.c rename to lang/cem/libcc.ansi/sys/stdio/fgets.c index 6f4890e0c..14ecc488a 100644 --- a/lang/cem/libcc.ansi/stdio/fgets.c +++ b/lang/cem/libcc.ansi/sys/stdio/fgets.c @@ -5,6 +5,8 @@ #include +#if ACKCONF_WANT_STDIO + char* fgets(char* s, register int n, register FILE* stream) { register int ch; @@ -30,3 +32,5 @@ char* fgets(char* s, register int n, register FILE* stream) *ptr = '\0'; return s; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fileno.c b/lang/cem/libcc.ansi/sys/stdio/fileno.c similarity index 81% rename from lang/cem/libcc.ansi/stdio/fileno.c rename to lang/cem/libcc.ansi/sys/stdio/fileno.c index eef38788a..e42608845 100644 --- a/lang/cem/libcc.ansi/stdio/fileno.c +++ b/lang/cem/libcc.ansi/sys/stdio/fileno.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(fileno)(FILE* stream) { return stream->_fd; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fillbuf.c b/lang/cem/libcc.ansi/sys/stdio/fillbuf.c similarity index 97% rename from lang/cem/libcc.ansi/stdio/fillbuf.c rename to lang/cem/libcc.ansi/sys/stdio/fillbuf.c index c323da4cd..75187edac 100644 --- a/lang/cem/libcc.ansi/stdio/fillbuf.c +++ b/lang/cem/libcc.ansi/sys/stdio/fillbuf.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int __fillbuf(register FILE* stream) { static unsigned char ch[FOPEN_MAX]; @@ -77,3 +79,5 @@ int __fillbuf(register FILE* stream) return *stream->_ptr++; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fltpr.c b/lang/cem/libcc.ansi/sys/stdio/fltpr.c similarity index 98% rename from lang/cem/libcc.ansi/stdio/fltpr.c rename to lang/cem/libcc.ansi/sys/stdio/fltpr.c index af1ca8728..3fdc80852 100644 --- a/lang/cem/libcc.ansi/stdio/fltpr.c +++ b/lang/cem/libcc.ansi/sys/stdio/fltpr.c @@ -7,7 +7,7 @@ #include #include "loc_incl.h" -#if ACKCONF_WANT_STDIO_FLOAT +#if ACKCONF_WANT_STDIO && ACKCONF_WANT_STDIO_FLOAT static char* _pfloat(long double r, register char* s, int n, int flags) diff --git a/lang/cem/libcc.ansi/stdio/flushbuf.c b/lang/cem/libcc.ansi/sys/stdio/flushbuf.c similarity index 98% rename from lang/cem/libcc.ansi/stdio/flushbuf.c rename to lang/cem/libcc.ansi/sys/stdio/flushbuf.c index 976d82a89..81325d3a6 100644 --- a/lang/cem/libcc.ansi/stdio/flushbuf.c +++ b/lang/cem/libcc.ansi/sys/stdio/flushbuf.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + static int do_write(int d, char* buf, int nbytes) { @@ -148,3 +150,5 @@ int __flushbuf(int c, FILE* stream) } return (unsigned char)c; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fopen.c b/lang/cem/libcc.ansi/sys/stdio/fopen.c similarity index 98% rename from lang/cem/libcc.ansi/stdio/fopen.c rename to lang/cem/libcc.ansi/sys/stdio/fopen.c index e3b935494..ce8c5634e 100644 --- a/lang/cem/libcc.ansi/stdio/fopen.c +++ b/lang/cem/libcc.ansi/sys/stdio/fopen.c @@ -10,6 +10,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + #define PMODE 0666 /* Since the O_CREAT flag is not available on all systems, we can't get it @@ -112,3 +114,5 @@ FILE* fopen(const char* name, const char* mode) __iotab[i] = stream; return stream; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fprintf.c b/lang/cem/libcc.ansi/sys/stdio/fprintf.c similarity index 90% rename from lang/cem/libcc.ansi/stdio/fprintf.c rename to lang/cem/libcc.ansi/sys/stdio/fprintf.c index cdcb16fee..3085bf96a 100644 --- a/lang/cem/libcc.ansi/stdio/fprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/fprintf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int fprintf(FILE* stream, const char* format, ...) { va_list ap; @@ -20,3 +22,5 @@ int fprintf(FILE* stream, const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fputc.c b/lang/cem/libcc.ansi/sys/stdio/fputc.c similarity index 81% rename from lang/cem/libcc.ansi/stdio/fputc.c rename to lang/cem/libcc.ansi/sys/stdio/fputc.c index a0ac05c82..cf67ca421 100644 --- a/lang/cem/libcc.ansi/stdio/fputc.c +++ b/lang/cem/libcc.ansi/sys/stdio/fputc.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int fputc(int c, FILE* stream) { return putc(c, stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fputs.c b/lang/cem/libcc.ansi/sys/stdio/fputs.c similarity index 88% rename from lang/cem/libcc.ansi/stdio/fputs.c rename to lang/cem/libcc.ansi/sys/stdio/fputs.c index 8b1f33397..5c4ea7caa 100644 --- a/lang/cem/libcc.ansi/stdio/fputs.c +++ b/lang/cem/libcc.ansi/sys/stdio/fputs.c @@ -5,6 +5,8 @@ #include +#if ACKCONF_WANT_STDIO + int fputs(register const char* s, register FILE* stream) { register int i = 0; @@ -17,3 +19,5 @@ int fputs(register const char* s, register FILE* stream) return i; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fread.c b/lang/cem/libcc.ansi/sys/stdio/fread.c similarity index 93% rename from lang/cem/libcc.ansi/stdio/fread.c rename to lang/cem/libcc.ansi/sys/stdio/fread.c index cf0806345..5bdcf41ac 100644 --- a/lang/cem/libcc.ansi/stdio/fread.c +++ b/lang/cem/libcc.ansi/sys/stdio/fread.c @@ -5,6 +5,8 @@ #include +#if ACKCONF_WANT_STDIO + size_t fread(void* ptr, size_t size, size_t nmemb, register FILE* stream) { @@ -29,3 +31,5 @@ fread(void* ptr, size_t size, size_t nmemb, register FILE* stream) return ndone; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/freopen.c b/lang/cem/libcc.ansi/sys/stdio/freopen.c similarity index 98% rename from lang/cem/libcc.ansi/stdio/freopen.c rename to lang/cem/libcc.ansi/sys/stdio/freopen.c index 3f4e0a169..255e04cb6 100644 --- a/lang/cem/libcc.ansi/stdio/freopen.c +++ b/lang/cem/libcc.ansi/sys/stdio/freopen.c @@ -9,6 +9,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + #define PMODE 0666 /* Do not "optimize" this file to use the open with O_CREAT if the file @@ -92,3 +94,5 @@ FILE* freopen(const char* name, const char* mode, FILE* stream) stream->_flags = flags; return stream; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fscanf.c b/lang/cem/libcc.ansi/sys/stdio/fscanf.c similarity index 90% rename from lang/cem/libcc.ansi/stdio/fscanf.c rename to lang/cem/libcc.ansi/sys/stdio/fscanf.c index 05e69af50..b06d47253 100644 --- a/lang/cem/libcc.ansi/stdio/fscanf.c +++ b/lang/cem/libcc.ansi/sys/stdio/fscanf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int fscanf(FILE* stream, const char* format, ...) { va_list ap; @@ -20,3 +22,5 @@ int fscanf(FILE* stream, const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fseek.c b/lang/cem/libcc.ansi/sys/stdio/fseek.c similarity index 96% rename from lang/cem/libcc.ansi/stdio/fseek.c rename to lang/cem/libcc.ansi/sys/stdio/fseek.c index 2ab275cdc..c1ecd5650 100644 --- a/lang/cem/libcc.ansi/stdio/fseek.c +++ b/lang/cem/libcc.ansi/sys/stdio/fseek.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int fseek(FILE* stream, long int offset, int whence) { int adjust = 0; @@ -38,3 +40,5 @@ int fseek(FILE* stream, long int offset, int whence) stream->_ptr = stream->_buf; return ((pos == -1) ? -1 : 0); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/ftell.c b/lang/cem/libcc.ansi/sys/stdio/ftell.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/ftell.c rename to lang/cem/libcc.ansi/sys/stdio/ftell.c index 1fcbca25f..8053a1de2 100644 --- a/lang/cem/libcc.ansi/stdio/ftell.c +++ b/lang/cem/libcc.ansi/sys/stdio/ftell.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + long ftell(FILE* stream) { long result; @@ -30,3 +32,5 @@ long ftell(FILE* stream) result += (long)adjust; return result; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/fwrite.c b/lang/cem/libcc.ansi/sys/stdio/fwrite.c similarity index 93% rename from lang/cem/libcc.ansi/stdio/fwrite.c rename to lang/cem/libcc.ansi/sys/stdio/fwrite.c index 325257174..02112e76a 100644 --- a/lang/cem/libcc.ansi/stdio/fwrite.c +++ b/lang/cem/libcc.ansi/sys/stdio/fwrite.c @@ -5,6 +5,8 @@ #include +#if ACKCONF_WANT_STDIO + size_t fwrite(const void* ptr, size_t size, size_t nmemb, register FILE* stream) @@ -28,3 +30,5 @@ fwrite(const void* ptr, size_t size, size_t nmemb, } return ndone; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/getc.c b/lang/cem/libcc.ansi/sys/stdio/getc.c similarity index 80% rename from lang/cem/libcc.ansi/stdio/getc.c rename to lang/cem/libcc.ansi/sys/stdio/getc.c index 20bdfa9f9..b69ecf9d6 100644 --- a/lang/cem/libcc.ansi/stdio/getc.c +++ b/lang/cem/libcc.ansi/sys/stdio/getc.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(getc)(FILE* stream) { return getc(stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/getchar.c b/lang/cem/libcc.ansi/sys/stdio/getchar.c similarity index 81% rename from lang/cem/libcc.ansi/stdio/getchar.c rename to lang/cem/libcc.ansi/sys/stdio/getchar.c index e76f15d40..79f6764ab 100644 --- a/lang/cem/libcc.ansi/stdio/getchar.c +++ b/lang/cem/libcc.ansi/sys/stdio/getchar.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(getchar)(void) { return getchar(); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/icompute.c b/lang/cem/libcc.ansi/sys/stdio/icompute.c similarity index 92% rename from lang/cem/libcc.ansi/stdio/icompute.c rename to lang/cem/libcc.ansi/sys/stdio/icompute.c index bc73f1ddb..9b48d51a4 100644 --- a/lang/cem/libcc.ansi/stdio/icompute.c +++ b/lang/cem/libcc.ansi/sys/stdio/icompute.c @@ -5,6 +5,8 @@ #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + /* This routine is used in doprnt.c as well as in tmpfile.c and tmpnam.c. */ char* _i_compute(unsigned long val, int base, char* s, int nrdigits) @@ -18,3 +20,5 @@ char* _i_compute(unsigned long val, int base, char* s, int nrdigits) *s++ = (c > 9 ? c - 10 + 'a' : c + '0'); return s; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/loc_incl.h b/lang/cem/libcc.ansi/sys/stdio/loc_incl.h similarity index 100% rename from lang/cem/libcc.ansi/stdio/loc_incl.h rename to lang/cem/libcc.ansi/sys/stdio/loc_incl.h diff --git a/lang/cem/libcc.ansi/stdio/printf.c b/lang/cem/libcc.ansi/sys/stdio/printf.c similarity index 90% rename from lang/cem/libcc.ansi/stdio/printf.c rename to lang/cem/libcc.ansi/sys/stdio/printf.c index d52d47525..6b118c859 100644 --- a/lang/cem/libcc.ansi/stdio/printf.c +++ b/lang/cem/libcc.ansi/sys/stdio/printf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int printf(const char* format, ...) { va_list ap; @@ -20,3 +22,5 @@ int printf(const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/putc.c b/lang/cem/libcc.ansi/sys/stdio/putc.c similarity index 81% rename from lang/cem/libcc.ansi/stdio/putc.c rename to lang/cem/libcc.ansi/sys/stdio/putc.c index ee47c72cc..ed8d1e519 100644 --- a/lang/cem/libcc.ansi/stdio/putc.c +++ b/lang/cem/libcc.ansi/sys/stdio/putc.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(putc)(int c, FILE* stream) { return putc(c, stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/putchar.c b/lang/cem/libcc.ansi/sys/stdio/putchar.c similarity index 83% rename from lang/cem/libcc.ansi/stdio/putchar.c rename to lang/cem/libcc.ansi/sys/stdio/putchar.c index ecf091f74..73f0e3a01 100644 --- a/lang/cem/libcc.ansi/stdio/putchar.c +++ b/lang/cem/libcc.ansi/sys/stdio/putchar.c @@ -5,7 +5,11 @@ #include +#if ACKCONF_WANT_STDIO + int(putchar)(int c) { return putchar(c); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/puts.c b/lang/cem/libcc.ansi/sys/stdio/puts.c similarity index 91% rename from lang/cem/libcc.ansi/stdio/puts.c rename to lang/cem/libcc.ansi/sys/stdio/puts.c index faa762426..3592e7cfe 100644 --- a/lang/cem/libcc.ansi/stdio/puts.c +++ b/lang/cem/libcc.ansi/sys/stdio/puts.c @@ -5,6 +5,8 @@ #include +#if ACKCONF_WANT_STDIO + int puts(register const char* s) { register FILE* file = stdout; @@ -21,3 +23,5 @@ int puts(register const char* s) return EOF; return i + 1; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/rename.c b/lang/cem/libcc.ansi/sys/stdio/rename.c similarity index 100% rename from lang/cem/libcc.ansi/stdio/rename.c rename to lang/cem/libcc.ansi/sys/stdio/rename.c diff --git a/lang/cem/libcc.ansi/stdio/scanf.c b/lang/cem/libcc.ansi/sys/stdio/scanf.c similarity index 90% rename from lang/cem/libcc.ansi/stdio/scanf.c rename to lang/cem/libcc.ansi/sys/stdio/scanf.c index c8c03c52b..d52788084 100644 --- a/lang/cem/libcc.ansi/stdio/scanf.c +++ b/lang/cem/libcc.ansi/sys/stdio/scanf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int scanf(const char* format, ...) { va_list ap; @@ -20,3 +22,5 @@ int scanf(const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/setbuf.c b/lang/cem/libcc.ansi/sys/stdio/setbuf.c similarity index 87% rename from lang/cem/libcc.ansi/stdio/setbuf.c rename to lang/cem/libcc.ansi/sys/stdio/setbuf.c index c906bc47a..5ac3e8ece 100644 --- a/lang/cem/libcc.ansi/stdio/setbuf.c +++ b/lang/cem/libcc.ansi/sys/stdio/setbuf.c @@ -6,7 +6,11 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + void setbuf(register FILE* stream, char* buf) { (void)setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), (size_t)BUFSIZ); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/setvbuf.c b/lang/cem/libcc.ansi/sys/stdio/setvbuf.c similarity index 96% rename from lang/cem/libcc.ansi/stdio/setvbuf.c rename to lang/cem/libcc.ansi/sys/stdio/setvbuf.c index 4650db03d..1dfc6a0be 100644 --- a/lang/cem/libcc.ansi/stdio/setvbuf.c +++ b/lang/cem/libcc.ansi/sys/stdio/setvbuf.c @@ -7,7 +7,7 @@ #include #include "loc_incl.h" -extern void (*_clean)(void); +#if ACKCONF_WANT_STDIO int setvbuf(register FILE* stream, char* buf, int mode, size_t size) { @@ -53,3 +53,5 @@ int setvbuf(register FILE* stream, char* buf, int mode, size_t size) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/snprintf.c b/lang/cem/libcc.ansi/sys/stdio/snprintf.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/snprintf.c rename to lang/cem/libcc.ansi/sys/stdio/snprintf.c index 603b0a3d1..4ee372faa 100644 --- a/lang/cem/libcc.ansi/stdio/snprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/snprintf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int snprintf(char* s, size_t len, const char* format, ...) { va_list ap; @@ -28,3 +30,5 @@ int snprintf(char* s, size_t len, const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/sprintf.c b/lang/cem/libcc.ansi/sys/stdio/sprintf.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/sprintf.c rename to lang/cem/libcc.ansi/sys/stdio/sprintf.c index 78349a3a5..3a116c0f4 100644 --- a/lang/cem/libcc.ansi/stdio/sprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/sprintf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int sprintf(char* s, const char* format, ...) { va_list ap; @@ -28,3 +30,5 @@ int sprintf(char* s, const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/sscanf.c b/lang/cem/libcc.ansi/sys/stdio/sscanf.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/sscanf.c rename to lang/cem/libcc.ansi/sys/stdio/sscanf.c index 723f6c231..bd39100bd 100644 --- a/lang/cem/libcc.ansi/stdio/sscanf.c +++ b/lang/cem/libcc.ansi/sys/stdio/sscanf.c @@ -8,6 +8,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int sscanf(const char* s, const char* format, ...) { va_list ap; @@ -28,3 +30,5 @@ int sscanf(const char* s, const char* format, ...) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/tmpfile.c b/lang/cem/libcc.ansi/sys/stdio/tmpfile.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/tmpfile.c rename to lang/cem/libcc.ansi/sys/stdio/tmpfile.c index cc525220d..e50fd0d35 100644 --- a/lang/cem/libcc.ansi/stdio/tmpfile.c +++ b/lang/cem/libcc.ansi/sys/stdio/tmpfile.c @@ -9,6 +9,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + FILE* tmpfile(void) { static char name_buffer[L_tmpnam] = "/tmp/tmp."; @@ -28,3 +30,5 @@ FILE* tmpfile(void) (void)remove(name_buffer); return file; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/tmpnam.c b/lang/cem/libcc.ansi/sys/stdio/tmpnam.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/tmpnam.c rename to lang/cem/libcc.ansi/sys/stdio/tmpnam.c index 02df608ba..89fb9a4e3 100644 --- a/lang/cem/libcc.ansi/stdio/tmpnam.c +++ b/lang/cem/libcc.ansi/sys/stdio/tmpnam.c @@ -9,6 +9,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + char* tmpnam(char* s) { static char name_buffer[L_tmpnam] = "/tmp/tmp."; @@ -30,3 +32,5 @@ char* tmpnam(char* s) else return name_buffer; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/ungetc.c b/lang/cem/libcc.ansi/sys/stdio/ungetc.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/ungetc.c rename to lang/cem/libcc.ansi/sys/stdio/ungetc.c index cf690a52a..a53cc1cf9 100644 --- a/lang/cem/libcc.ansi/stdio/ungetc.c +++ b/lang/cem/libcc.ansi/sys/stdio/ungetc.c @@ -6,6 +6,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int ungetc(int ch, FILE* stream) { unsigned char* p; @@ -25,3 +27,5 @@ int ungetc(int ch, FILE* stream) *p = (unsigned char)ch; return ch; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/vfprintf.c b/lang/cem/libcc.ansi/sys/stdio/vfprintf.c similarity index 87% rename from lang/cem/libcc.ansi/stdio/vfprintf.c rename to lang/cem/libcc.ansi/sys/stdio/vfprintf.c index fd896a720..02b473dd6 100644 --- a/lang/cem/libcc.ansi/stdio/vfprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/vfprintf.c @@ -7,7 +7,11 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int vfprintf(FILE* stream, const char* format, va_list arg) { return _doprnt(format, arg, stream); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/vprintf.c b/lang/cem/libcc.ansi/sys/stdio/vprintf.c similarity index 88% rename from lang/cem/libcc.ansi/stdio/vprintf.c rename to lang/cem/libcc.ansi/sys/stdio/vprintf.c index bf884e576..5cc6b837f 100644 --- a/lang/cem/libcc.ansi/stdio/vprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/vprintf.c @@ -7,7 +7,11 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int vprintf(const char* format, va_list arg) { return _doprnt(format, arg, stdout); } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/vsnprintf.c b/lang/cem/libcc.ansi/sys/stdio/vsnprintf.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/vsnprintf.c rename to lang/cem/libcc.ansi/sys/stdio/vsnprintf.c index 033e39d72..d973b8066 100644 --- a/lang/cem/libcc.ansi/stdio/vsnprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/vsnprintf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int vsnprintf(char* s, size_t len, const char* format, va_list arg) { int retval; @@ -23,3 +25,5 @@ int vsnprintf(char* s, size_t len, const char* format, va_list arg) return retval; } + +#endif diff --git a/lang/cem/libcc.ansi/stdio/vsprintf.c b/lang/cem/libcc.ansi/sys/stdio/vsprintf.c similarity index 94% rename from lang/cem/libcc.ansi/stdio/vsprintf.c rename to lang/cem/libcc.ansi/sys/stdio/vsprintf.c index b0cbc124c..00065bec0 100644 --- a/lang/cem/libcc.ansi/stdio/vsprintf.c +++ b/lang/cem/libcc.ansi/sys/stdio/vsprintf.c @@ -7,6 +7,8 @@ #include #include "loc_incl.h" +#if ACKCONF_WANT_STDIO + int vsprintf(char* s, const char* format, va_list arg) { int retval; @@ -23,3 +25,5 @@ int vsprintf(char* s, const char* format, va_list arg) return retval; } + +#endif