Jan Nieuwenhuizen
06e9dd4bce
mescc: Mes C Library: Support make: Implement clock_gettime, time.
...
* include/linux/x86/syscall.h (SYS_time, SYS_clock_gettime,
SYS_gettimeofday): New macro.
* include/linux/x86_64/syscall.h (SYS_time, SYS_clock_gettime,
SYS_gettimeofday): New macro.
* lib/linux/tcc.c (gettimeofday, time): New function.
* lib/linux/gnu.c (clock_gettime): New function.
* include/time.h: Declare it.
* lib/stub/gettimeofday.c: Remove.
* lib/stub/time.c: Remove.
2018-08-27 00:34:13 +02:00
Jan Nieuwenhuizen
e9d9e80980
mescc: Mes C Library: Explode libc+tcc.c.
...
* include/libmes.h: Add declarations.
* include/string.h: Likewise.
* lib/ctype/islower.c: New file, explode from lib/libc+tcc.c.
* lib/ctype/isupper.c: Likewise.
* lib/ctype/tolower.c: Likewise.
* lib/ctype/toupper.c: Likewise.
* lib/mes/search-path.c: Likewise.
* lib/posix/execvp.c: Likewise.
* lib/stdio/fclose.c: Likewise.
* lib/stdio/fdopen.c: Likewise.
* lib/stdio/ferror.c: Likewise.
* lib/stdio/fflush.c: Likewise.
* lib/stdio/fopen.c: Likewise.
* lib/stdio/fprintf.c: Likewise.
* lib/stdio/fread.c: Likewise.
* lib/stdio/fseek.c: Likewise.
* lib/stdio/ftell.c: Likewise.
* lib/stdio/fwrite.c: Likewise.
* lib/stdio/printf.c: Likewise.
* lib/stdio/remove.c: Likewise.
* lib/stdio/snprintf.c: Likewise.
* lib/stdio/sprintf.c: Likewise.
* lib/stdio/sscanf.c: Likewise.
* lib/stdio/vfprintf.c: Likewise.
* lib/stdio/vprintf.c: Likewise.
* lib/stdio/vsnprintf.c: Likewise.
* lib/stdio/vsprintf.c: Likewise.
* lib/stdio/vsscanf.c: Likewise.
* lib/stdlib/calloc.c: Likewise.
* lib/stdlib/qsort.c: Likewise.
* lib/stdlib/strtof.c: Likewise.
* lib/stdlib/strtol.c: Likewise.
* lib/stdlib/strtold.c: Likewise.
* lib/stdlib/strtoll.c: Likewise.
* lib/stdlib/strtoul.c: Likewise.
* lib/stdlib/strtoull.c: Likewise.
* lib/string/memcmp.c: Likewise.
* lib/string/memmem.c: Likewise.
* lib/string/memmove.c: Likewise.
* lib/string/memset.c: Likewise.
* lib/string/strcat.c: Likewise.
* lib/string/strchr.c: Likewise.
* lib/string/strlwr.c: Likewise.
* lib/string/strncpy.c: Likewise.
* lib/string/strrchr.c: Likewise.
* lib/string/strstr.c: Likewise.
* lib/string/strupr.c: Likewise.
* lib/stub/gettimeofday.c: Likewise.
* lib/stub/ldexp.c: Likewise.
* lib/stub/localtime.c: Likewise.
* lib/stub/mprotect.c: Likewise.
* lib/stub/sigaction.c: Likewise.
* lib/stub/sigemptyset.c: Likewise.
* lib/stub/strtod.c: Likewise.
* lib/stub/time.c: Likewise.
* lib/libc+tcc.c: Include explodings.
2018-08-22 07:23:27 +02:00
Jan Nieuwenhuizen
a08baf2d48
mescc: Mes C Library: Explode libmes.c.
...
* include/libmes.h: Add declarations.
* lib/abtol.c: New file, explode from lib/libmes.c.
* lib/ctype/isdigit.c: Likewise.
* lib/ctype/isnumber.c: Likewise.
* lib/ctype/isspace.c: Likewise.
* lib/ctype/isxdigit.c: Likewise.
* lib/mes/abtol.c: Likewise.
* lib/mes/eputc.c: Likewise.
* lib/mes/eputs.c: Likewise.
* lib/mes/fdgetc.c: Likewise.
* lib/mes/fdputc.c: Likewise.
* lib/mes/fdputs.c: Likewise.
* lib/mes/fdungetc.c: Likewise.
* lib/mes/itoa.c: Likewise.
* lib/mes/ltoab.c: Likewise.
* lib/mes/ntoab.c: Likewise.
* lib/mes/utoa.c: Likewise.
* lib/stdlib/atoi.c: Likewise.
* lib/libmes.c: Include explodings.
2018-08-16 11:43:27 +02:00
Jan Nieuwenhuizen
50dff52c99
mescc: Mes C Library: Add x86_64 libc+tcc support.
...
* include/linux/x86/syscall.h: Move SYS_ defines from tcc.c.
* include/linux/x86_64/syscall.h: Add SYS_ defines for tcc.
* lib/x86-mes-gcc/setjmp.c: Rename from lib/libc+tcc-gcc.c
* lib/x86-mes/setjmp.c: Rename from lib/libc+tcc-mes.c
* lib/linux/tcc.c: Update.
2018-08-11 18:39:48 +02:00
Jan Nieuwenhuizen
72cb975213
GNU Mes.
...
Throughout, make these changes
Copyright headers: GNU Mes
First mention of name: GNU Mes
Website: https://www.gnu.org/software/mes
Git: git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen
573896cc1c
core: Prepare for the Hurd.
...
* lib/linux/libc.c: Move from lib/linux.c.
* lib/linux/gcc.c: Move from lib/linux-gcc.c.
* lib/linux/gnu.c: Move from lib/linux+gnu.c.
* lib/linux/libc.c: Move from lib/linux.c.
* lib/linux/mes.c: Move from lib/linux-mes.c.
* lib/linux/mini-gcc.c: Move from lib/linux-mini-gcc.c.
* lib/linux/mini-mes.c: Move from lib/linux-mini-mes.c.
* lib/linux/tcc.c: Move from lib/linux+tcc.c.
* lib/linux/crt0.c: Move from lib/crt0.c.
* lib/linux/crt1.c: Move from lib/crt1.c.
* lib/linux/crti.c: Move from lib/crti.c.
* lib/linux/crtn.c: Move from lib/crtn.c.
* build-aux/build-cc.sh: Update for new layout.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* lib/string/argz-count.c: New file taken from GNU C Library,
relicensed.
* lib/string/argz-extract.c: New file taken from GNU C Library,
relicensed.
* include/argz.h: New file.
* lib/string/memcpy.c: New file, extract from libc.
* lib/assert/assert.c: Likewise.
2018-06-30 13:11:03 +02:00
Jan Nieuwenhuizen
59c56ac72d
mescc: fwrite: Increase debug tracing threshold.
...
* lib/libc+tcc.c (fwrite): Increase debug tracing threshold.
2018-07-21 11:16:29 +02:00
Jan Nieuwenhuizen
50d7036e03
mescc: Support binutils 2.10.1: strrchr: Stop at start of string.
...
* lib/libc+tcc.c (strrchr): Stop at start of string.
* scaffold/tests/88-strrchr.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-06-24 17:25:46 +02:00
Jan Nieuwenhuizen
41a6585295
mescc: Support binutils 2.20.1: vfprint, vsprintf: %llx.
...
* lib/libc+tcc.c (vfprintf, vsprintf): Handle %%llx. Print error:
should we skip another int, va_arg a long long?
2018-06-24 17:26:53 +02:00
Jan Nieuwenhuizen
2551eef953
mescc: Support binutils 2.14: vfprint, vsprintf: %12.10d.
...
* lib/libc+tcc.c (vfprintf, vsprintf): Handle %12.10d.
* scaffold/tests/70-printf.c: Test it.
2018-06-21 00:27:49 +02:00
Jan Nieuwenhuizen
63bf9bb2f7
mescc: Support Tinycc 0.9.27: Drop dlclose, dlopen.
...
* lib/libc+tcc.c (dlclose, dlopen): Remove.
* include/dlfcn.h (RTLD_DEFAULT): Add.
2018-06-18 22:56:06 +02:00
Jan Nieuwenhuizen
22a22c1de8
mescc: Support binutils 2.25: fseek: Add debug printing.
...
* lib/libc+tcc.c (fseek): Add debug printing.
2018-06-17 14:17:39 +02:00
Jan Nieuwenhuizen
c6ae0f41a3
mescc: Support binutils 2.25: memcmp: Support size 0.
...
* lib/libc+tcc.c (memcmp): Support size 0.
2018-06-17 10:18:59 +02:00
Jan Nieuwenhuizen
0639e3faf1
mescc: Support binutils 2.25: vsscanf: Skip `l'.
...
* lib/libc+tcc.c (vsscanf): Skip `l'.
2018-06-17 09:26:34 +02:00
Jan Nieuwenhuizen
a9215931e8
mescc: Support binutils 2.15a: fread: read ungetc'd chars too.
...
* lib/libmes.c (_ungetc_fd): New variable.
(fdgetc): Use it.
(_fdungetc_p): New function.
* lib/libc+tcc.c (_fungetc_p): New function.
* lib/libc+tcc.c (fread): Use it to read ungetc'd chars too.
2018-06-16 20:51:16 +02:00
Jan Nieuwenhuizen
65d530f4ec
mescc: Support binutils-2.14: fopen: Return 0 upon failure.
...
* lib/libc+tcc.c (fopen): Return 0 upon failure.
2018-06-16 10:54:59 +02:00
Jan Nieuwenhuizen
c2c3554884
mescc: Refactor debug and stub printing.
...
* lib/libc.c (__mes_debug): New function. Use it for debug printing
and in stubs throughout.
2018-06-10 14:07:19 +02:00
Jan Nieuwenhuizen
18194b1ae4
mescc: Support binutils-2.30: fopen fix.
...
* lib/libc+tcc.c (fopen): Set O_APPEND for 'a'.
2018-06-10 13:33:30 +02:00
Jan Nieuwenhuizen
53dd76ffc0
mescc: Support binutils-2.10.1: Stubs set errno to 0.
2018-06-09 11:28:31 +02:00
Jan Nieuwenhuizen
bb3353a272
mescc: Silence some stubs.
...
* lib/libc+tcc.c: [!NOISY_FLOATS, !NOISY_TIMES]: Silence stubs.
* lib/gcc.c: Likewise.
* lib/binutils.c: Likewise.
2018-06-09 07:40:07 +02:00
Jan Nieuwenhuizen
a744fd9ba4
mescc: Add debug printing: fopen, fwrite.
...
* lib/libc+tcc.c (fopen, fwrite)[MESC_DEBUG]: Print debug info.
2018-06-10 07:51:56 +02:00
Jan Nieuwenhuizen
3ba5b23dab
mescc: Support binutils-2.10.1: opentype `r+'.
...
* lib/libc+tcc.c (fopen): Support opentype `r+'.
2018-06-10 07:51:10 +02:00
Jan Nieuwenhuizen
cc466662b9
mescc: Support gcc-3.2: Implement integer strto*.
...
* lib/libc+tcc.c (strtoll, strtoul): Call strtoul.
2018-06-06 22:39:57 +02:00
Jan Nieuwenhuizen
7c4a6a88ed
mescc: Support gcc-3.4.0: *printf: Support `%n'.
...
* lib/libc+tcc.c (vfprintf, vsprintf): Support `%n'. For Gcc 3.4.0.
* scaffold/tests/70-printf.c: Test it.
2018-06-06 19:29:32 +02:00
Jan Nieuwenhuizen
635dfd03a2
mescc: Support glibc-1.06.4.
...
* lib/glibc.c: New file.
* lib/libc+gnu.c: Include it.
2018-06-03 18:54:26 +02:00
Jan Nieuwenhuizen
de964f3e1f
mescc: Support gcc-2.6.3.
...
* TODO
2018-06-02 11:41:06 +02:00
Jan Nieuwenhuizen
f1efaa0e93
mescc: Support binutils-2.5.1.
...
* include/stdint.h: #undef types before typedef'ing them.
* include/sys/types.h: Likewise.
* include/string.h (NULL): New define.
* include/stdio.h (BUFSIZ): New define.
2018-05-30 21:55:39 +02:00
Jan Nieuwenhuizen
a3a3654d54
mescc: Implement fflush, sscanf, vsscanf.
...
* lib/libc+tcc.c (vsscanf): New function.
(sscanf): Use it.
(fflush): Remove stub notice; we have no buffering.
* include/stdarg.h: Declare it.
* scaffold/tests/87-sscanf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-30 21:49:40 +02:00
Jan Nieuwenhuizen
272b522962
build: Use arch-dir.
...
* lib/x86-mes: Move from stage0.
* build-aux/build-cc.sh: Create libraries in lib/gcc. Update users.
* build-aux/build-mes.sh: Create libraries in lib/x86-mes. Update users.
* build-aux/build-mes-gcc.sh: Rename from build-mlibc.sh. Create
libraries in lib/x86-mes-gcc. Update callers.
* build-aux/cc-mes-gcc.sh: Rename from cc-mlibc.sh. Update callers.
2018-05-29 20:07:46 +02:00
Jan Nieuwenhuizen
9f90960392
mlibc: Implement strstr.
...
* lib/libc+tcc.c (_memmem, memmem): New function. Import from GNU
LilyPond.
(strstr): Implement using memmem.
* include/string.h (_memmem, memmem): Declare.
* AUTHORS: Add Han-Wen Nienhuys.
2018-05-29 19:35:20 +02:00
Jan Nieuwenhuizen
26e1876d12
mlibc: Implement ftell, fseek.
...
* lib/libc+tcc.c (ftell, fseek): Implement.
2018-05-29 19:33:32 +02:00
Jan Nieuwenhuizen
559699969c
mescc: m4 support: WIP
2018-05-27 10:28:30 +02:00
Jeremiah Orians
43a74e382a
mescc: Add fopen.
...
* lib/libc+tcc.c (fopen)[!POSIX]: Remove stub.
* lib/libc.c (fopen)[!POSIX]: New function.
* AUTHORS: Add Jeremiah.
2018-05-26 16:33:00 -04:00
Jan Nieuwenhuizen
948fbf9743
mescc: Tinycc support: strncpy.
...
* lib/libc+tcc.c (strncpy): New function.
* scaffold/tests/86-strncpy.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
* build-aux/cc-mlibc.sh (LIBC): Acknowlegde.
* build-aux/test.sh (LIBC): Export it.
2018-05-20 10:55:44 +02:00
Jan Nieuwenhuizen
cfda148e1e
mescc: Tinycc support: Minimal float support.
...
* lib/libc+tcc.c (ldexp, strtod, strtof, strtold): New stub.
* include/math.h (ldexp): Declare.
* include/stdlib.h (strtod, strtof, strtold): Declare.
* module/mes/scm.mes (string->number): Minimal float support.
(inexact->exact): New function.
* tests/math.test ("string->number"): Test it.
* module/language/c99/compiler.mes (ast->type): Handle float type.
(type->info): Likewise.
(cstring->int): Rename from cstring->number. Update callers.
(cstring->float): New function.
(expr->accu): Use it.
2018-05-18 15:28:05 +02:00
Jan Nieuwenhuizen
7cad0671f3
Revert "mlibc: Use memmove in realloc."
...
This reverts commit f47a21e3cb4814c4a30d10ff59e5c947441725e9.
2018-04-21 13:42:16 +02:00
Jan Nieuwenhuizen
1270c767cd
mlibc: Use memmove in realloc.
...
* src/libc.c (memmove): New function.
(realloc): Use it.
* src/libc+tcc.c (memmove): Remove.
2018-04-15 08:13:36 +02:00
Jan Nieuwenhuizen
ad135d3752
doc: Release udpate.
...
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.
2017-11-21 19:22:26 +01:00
Jan Nieuwenhuizen
05c33b052a
mlibc: Tinycc support: qsort.
...
* lib/libc+tcc.c (qswap, qpart): New function
(qsort): Implement.
* scaffold/tests/81-qsort.c: Test it.
* make.scm ("81-qsort"): Build it.
2017-12-04 19:01:39 +01:00
Jan Nieuwenhuizen
808af5001f
mlibc: New library layout; remove duplication.
...
* lib/libc+tcc-gcc.c: New file: Libc bits for GCC from libc-mes+tcc.c.
* lib/libc+tcc-mes.c: New file: Libc bits for MesCC from libc-mes+tcc.c.
* lib/libc+tcc.c: New file: Libc bits from libc-mes+tcc.c.
* lib/libc.c: New file: Merged from libc-mes.c, libc-gcc.c.
(abtoi): New function: Rename from _atoi.
* lib/linux+tcc-gcc.c: New file: Linux bits from libc-gcc+tcc.c.
* lib/linux+tcc-mes.c: New file: Linux bits from libc-mes+tcc.c.
* lib/linux-gcc.c: New file: Linux bits from libc-gcc.c.
* lib/linux-mes.c: New file: Linux bits from libc-mes.c.
* lib/mini-libc-gcc.c: New file.
* lib/mini-libc.c: New file: Libc bits from mini-libc-mes.c.
* lib/mini-linux-gcc.c: New file.
* lib/mini-linux-mes.c: New file: Linux bits from mini-libc-mes.c.
* lib/libc-gcc.c: Remove duplication using include now.
* lib/libc-mes.c: Likewise.
* lib/mini-libc-mes.c: Likewise.
* include/stdio.h (puts)[POSIX]: Remomve macro.
(fputc, fputs)[!POSIX]: New macro.
(fputc, fputs): Remove declaration.
* scaffold/tests/7j-strtoull.c (strtoull, test): Use abtoi.
* src/lib.c (fputs)[__MESC__]: Remove define.
* guile/guix/make.scm: Update for new library layout.
* make.scm: Likewise.
* build.sh: Likewise.
* install.sh: Likewise.
2017-12-03 13:56:21 +01:00