Commit Graph

2187 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen 6a678f1a4a
mescc: Mes C Library: Prepare for M2-Planet: fdgetc.
* lib/mes/fdgetc.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:28:04 +02:00
Jan (janneke) Nieuwenhuizen 2a93f9e022
mescc: Mes C Library: Prepare for M2-Planet: abtol.
* lib/mes/abtol.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:27:53 +02:00
Jan (janneke) Nieuwenhuizen c81b53673c
mescc: Mes C Library: memcmp: bugfix.
* lib/string/memcmp.c (memcmp): Bugfix.
* lib/tests/string/50-memcmp.c: Test it.
* build-aux/check-mescc.sh (TESTS): Add it.
2020-06-06 22:37:30 +02:00
Jan (janneke) Nieuwenhuizen 84193f34b3
mescc: Mes C Library: Prepare for M2-Planet: memcmp.
* lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:29:29 +02:00
Jan (janneke) Nieuwenhuizen 846ff93e80
mescc: Mes C Library: Prepare for M2-Planet: memcpy.
* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:29:36 +02:00
Jan (janneke) Nieuwenhuizen ae0b698da1
mescc: Mes C Library: Prepare for M2-Planet: memchr.
* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:29:18 +02:00
Jan (janneke) Nieuwenhuizen 0e21175420
mescc: Mes C Library: Prepare for M2-Planet: strncmp.
* lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:44:02 +02:00
Jan (janneke) Nieuwenhuizen c9c211ce3a
mescc: Mes C Library: Prepare for M2-Planet: strlen.
* lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:30:04 +02:00
Jan (janneke) Nieuwenhuizen bf9ae12327
mescc: Mes C Library: Prepare for M2-Planet: strcpy.
* lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:29:57 +02:00
Jan (janneke) Nieuwenhuizen 6b3e433e7a
mescc: Mes C Library: Prepare for M2-Planet: strcmp.
* lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:29:44 +02:00
Jan (janneke) Nieuwenhuizen 21d575edbf
mescc: Mes C Library: Prepare for M2-Planet: __assert_fail.
Rewrite C-constructs not supported by M2-Planet, such as

    foo ? bar : baz;       -> if (foo) bar; else baz;
    static char foo[1024]  -> __func_buf = malloc (1024); ... char *foo = __func_buf;
    *foo                   -> foo[0]
    foo++                  -> foo = foo + 1   TODO: pointer arithmetic
    foo += 1;              -> foo = foo + 1
    for (int foo = ;       -> int foo; for (foo=
    if (foo)               -> if (foo != 0)
    if (!foo)              -> if (foo == 0)
    ;                      -> 0;

* lib/mes/__assert_fail.c: Rewrite C-constructs not supported by
M2-Planet.
2020-05-17 19:27:27 +02:00
Jan (janneke) Nieuwenhuizen d98f132faf
core: Use assert_msg.
* src/mes.c: Use assert_msg instead of assert.
* src/gc.c: Likewise.
* src/hash.c: Likewise.
* src/lib.c: Likewise.
* src/math.c: Likewise.
* src/module.c: Likewise.
* src/posix.c: Likewise.
* src/reader.c: Likewise.
* src/string.c: Likewise.
* src/struct.c: Likewise.
* src/vector.c: Likewise.
* simple.make (LIB_SOURCES): Add lib/mes/assert_msg.c.
2020-05-17 16:07:04 +02:00
Jan (janneke) Nieuwenhuizen 294d01d4f5
mescc: Mes C Library: Add assert_msg.
* lib/mes/assert_msg.c: New file.
2020-04-19 15:57:06 +02:00
Jan (janneke) Nieuwenhuizen d88a2f6f1e
core: Prepare for M2-Planet: vector.c.
* src/vector.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:40:25 +02:00
Jan (janneke) Nieuwenhuizen 8613c109d7
core: Prepare for M2-Planet: struct.c.
* src/struct.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:39:12 +02:00
Jan (janneke) Nieuwenhuizen 3324631f6a
core: Prepare for M2-Planet: string.c.
* src/string.c: Rewrite C constructs not supported by M2-Planet.
2020-04-20 19:47:18 +02:00
Jan (janneke) Nieuwenhuizen 6ad7ec595b
core: Prepare for M2-Planet: reader.c.
* src/reader.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:29:40 +02:00
Jan (janneke) Nieuwenhuizen 8881ecc8b9
core: Prepare for M2-Planet: posix.c.
* src/posix.c: Rewrite C constructs not supported by M2-Planet.
2020-04-20 19:47:10 +02:00
Jan (janneke) Nieuwenhuizen 1555844f9e
core: Prepare for M2-Planet: module.c.
* src/module.c: Rewrite C constructs not supported by M2-Planet.
2020-04-20 19:47:04 +02:00
Jan (janneke) Nieuwenhuizen e9a0a5b2b0
core: Prepare for M2-Planet: math.c.
* src/math.c: Rewrite C constructs not supported by M2-Planet.
2020-04-20 19:46:55 +02:00
Jan (janneke) Nieuwenhuizen a8022bf53c
core: Prepare for M2-Planet: lib.c.
* src/lib.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:25:32 +02:00
Jan (janneke) Nieuwenhuizen ce52894d29
core: Prepare for M2-Planet: hash.c.
* src/hash.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:24:43 +02:00
Jan (janneke) Nieuwenhuizen bca6f3f390
core: Prepare for M2-Planet: gc.c.
* src/gc.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:23:47 +02:00
Jan (janneke) Nieuwenhuizen 81e8ac66eb
core: Prepare for M2-Planet: builtins.c.
* src/builtins.c: Rewrite C constructs not supported by M2-Planet.
2020-04-19 13:21:58 +02:00
Jan (janneke) Nieuwenhuizen 010e73994e
core: Prepare for M2-Planet: mes.c.
Rewrite C-constructs not supported by M2-Planet, such as

    foo ? bar : baz;       -> if (foo) bar; else baz;
    static char foo[1024]  -> __func_buf = malloc (1024); ... char *foo = __func_buf;
    *foo                   -> foo[0]
    foo++                  -> foo = foo + 1   TODO: pointer arithmetic
    foo += 1;              -> foo = foo + 1
    for (int foo = ;       -> int foo; for (foo=
    if (foo)               -> if (foo != 0)
    if (!foo)              -> if (foo == 0)
    ;                      -> 0;
    // ...                 -> /* ... */

* src/mes.c: Rewrite C constructs not supported by M2-Planet.
* include/mes/mes.h (__execl_c_argv, __getcwd_buf, __open_boot_buf,
__open_boot_file_name, __setenv_buf, __reader_read_char_buf): Declare
buffers.
(init): Initialize them.
* include/mes/macros.h(__M2_PLANET__): Temporary M2 macros.
2020-04-19 13:18:09 +02:00
Jan (janneke) Nieuwenhuizen 2b130e4fb2
build: Run indent for M2.
* src/gc.c: Indented.
* src/string.c: Likewise.
2020-04-19 11:36:18 +02:00
Jan (janneke) Nieuwenhuizen ea06cb0566
build: mes-snarf.scm: Resurrect.
* build-aux/mes-snarf.scm (snarf-functions): Strip whitespace from
parameter list.
(function->source): Use function-scm-name, add (function1_t).
* build-aux/snarf.sh: Resurrect, combined dump to s, h, c.
* include/mes/builtins.h:
2020-04-20 18:53:28 +02:00
Jan (janneke) Nieuwenhuizen 06c1b960c7
core: Split-out builtins.c.
* src/mes.c make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin_function, builtin_p, builtin_printer,
init_builtin, mes_builtins): Move to ..
* src/builtins.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* build-aux/snarf.sh: Likewise.
* build-aux/build-mes.sh (mes_sources): Remove.  Include
configure-lib.sh
* include/mes/builtins.h: Remove constants.
* include/mes/mes.h: Add prototypes.
* include/mes/constants.h (cell_symbol_test): Rename from cell_test.
* simple.make: New file.
2020-04-19 10:49:48 +02:00
Jan (janneke) Nieuwenhuizen 61e98c3522
build: simple.make.
* simple.make: New file.
* src/posix.c: Make sure to define EOF.
2020-04-22 08:05:37 +02:00
Jan (janneke) Nieuwenhuizen 49dfdb4890
tests: Add gc.test.
* tests/gc.test: New file.
* build-aux/check-mes.sh (TESTS): Add it.
* scaffold/gc-test.scm: Remove.
2020-04-25 16:39:43 +02:00
Vagrant Cascadian 35892ae074
configure: Add no-op for "disable-option-checking" option.
This is a standard option supported in autoconf.

In Debian systems using recent versions of debhelper this argument is be
passed to configure by default.  See <https://bugs.debian.org/942813>
for more information.

* configure (parse-opts): Ignore disable-option-checking.
2021-05-08 10:46:41 +02:00
W. J. van der Laan 191d822e95
mescc: Make -m64 work again.
* module/mescc/mescc.scm (arch-get-machine): Make that -m64 on the command
line, which sets machine to "64", returns "64" and not "32".
2021-05-07 07:55:25 +02:00
W. J. van der Laan be4514c4de
lib/tests: Pass int to va_arg instead of char.
* lib/tests/scaffold/70-stdarg.c (stdarg1, stdarg2, stdarg3): Pass int
to va_arg instead of char to avoid gcc trap "warning: 'char’ is promoted
to ‘int’ when passed through ‘...’ [enabled by default] (so you should
pass ‘int’ not ‘char’ to ‘va_arg’) if this code is reached, the program
will abort".
2021-05-02 16:56:29 +02:00
W. J. van der Laan d7b2e0ab9b
mes: Prevent out-of-bounds access for stack frame 0.
* src/lib.c (make_frame): Add a check to prevent reads outside of the
stack when trying to determine the procedure for stack frame 0.
2021-05-02 16:45:32 +02:00
W. J. van der Laan c480c7e602
mescc: Pass --64 to bloodelf for 64 bit machines.
* module/mescc/mescc.scm (M1->blood-elf): Pass --64 argument to bloodelf
for 64-bit machines.  This makes it able to generate the correct ELF
format.
2021-05-02 16:45:24 +02:00
Jan (janneke) Nieuwenhuizen 0a9c8f92cb
configure: Do not use GUILD_OPTIMIZE=-O1 for Guile-2.
This is a follow-up to

    a0560aff67
    configure: Use GUILD_OPTIMIZE=-O1 for Guile-3.

and fixes using Guile-2.0.x, which does not support -O1.

Reported by W. J. van der Laan <laanwj@protonmail.com>.

* configure (main): Check for Guile > 2.9.x to set optimization.
2021-05-02 16:43:41 +02:00
Jan (janneke) Nieuwenhuizen 6c1ff75c5a
mescc: Mes C Library: crt: Support more than 255 command line parameters.
Reported by Paul Dersey <pdersey@gmail.com>.

* lib/freebsd/x86-mes-gcc/crt1.c (_start): Use mov instead of movzbl for
argc.
* lib/linux/x86-mes-gcc/crt0.c (_start): Likewise.
* lib/linux/x86-mes-gcc/crt1.c (_start): Likewise.
* lib/freebsd/x86-mes-mescc/crt1.c (_start): Likewise.
* lib/linux/x86-mes-mescc/crt1.c (_start): Likewise.
2021-05-02 14:22:21 +02:00
Jan (janneke) Nieuwenhuizen dfa8e6e9d5
mescc: Mes C Library: malloc.c: Move unix-variant to lib/linux.
* lib/stdlib/malloc.c: Move to...
lib/linux/malloc.c: ...here.
* build-aux/configure-lib.sh (libc_SOURCES): Move malloc.c...
[linux]: ...here.
2021-05-02 13:13:13 +02:00
Jan (janneke) Nieuwenhuizen 3a5a7d1e56
mescc: Support --bootstrap build on ARM.
The ARM port added the `-marm' option to mescc, where previously only
-m32' (the default) and `-m64' were supported.

Reported by Vagrant Cascadian <vagrant@reproducible-builds.org>.

* module/mescc/mescc.scm (arch-get-machine): When machine is "arm",
return "32".
* build-aux/build-mes.sh (LIBS)[mescc]: Add -lmescc.
2021-05-01 16:10:49 +02:00
W. J. van der Laan ce80c24ae4
mes: Make logand work correctly.
* src/math.c (logand): Start from -1 instead of 0, so that the bitwise AND-ed
result is the intersection of bit sets instead of always 0.
* tests/math.test ("logand", "logand 3"): Test it.

Co-authored-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2021-04-21 08:31:37 +02:00
Jan (janneke) Nieuwenhuizen 2a31c8742d
doc: Post-release update.
* README: Update wording.
* doc/announce/ANNOUNCE-0.23: Likewise.  Add gen-announce checksums.
2021-03-14 12:22:40 +01:00
Jan (janneke) Nieuwenhuizen 918868e4fb
guix: mes: Update to 0.23.
* guix/git/mes.scm (mes)[source]: Update to 0.23.
2021-03-14 12:07:23 +01:00
Jan (janneke) Nieuwenhuizen ee9f407abb
build: Release 0.23.
* configure (VERSION): Bump to 0.23.
(main): Update mes requirement to 0.22.
* configure.sh (VERSION): Likewise.
2021-03-14 12:06:31 +01:00
Jan (janneke) Nieuwenhuizen 8135a7784f
doc: Fix broken link in 'README'.
Reported by Arkadiusz.Ryś <Arkadiusz.Rys@protonmail.com>.

* README: Fix m2-planet link.
2021-03-14 12:06:31 +01:00
Jan (janneke) Nieuwenhuizen a1196c87b5
doc: Release update.
* ROADMAP (release 0.x, unsorted): Rewrite, move done items ...
(DONE): ...here.
* build-aux/GNUmakefile.in: Update release process.
(gen-announce): Remove trailing '-'.
* NEWS (Changes in 0.23 since 0.22): Add section.
* README: Add armhf-linux, aarch64-linux, NLNet sponsoring, remove
confusing references to mes-m2 fork.
* doc/announce/ANNOUNCE-0.23: New file.
* mes/module/mes/repl.mes: Update copyright years.
* doc/mes.texi (Porting GNU Mes): Mention that armhf-linux is supported.
(Regular Requirements): Update.
* INSTALL (Other GNU/Linux): Likewise.
2021-03-14 12:06:31 +01:00
Danny Milosavljevic 2e9b02043b
libtcc1: Fix integer division, modulo and shifting procedures.
* lib/libtcc1.c (__divdi3): Make parameters integer.
(__moddi3): Make parameters integer.
(__udivdi3): Use unsigned division.
(__umoddi3): Use unsigned modulo.
(__lshrdi3): Add comment.
(__ashrdi3): Add comment.
2021-03-14 11:05:00 +01:00
Danny Milosavljevic 27b06c6ddb
mescc: Mes C Library: Make malloc align the blocks it gives out.
* include/stddef.h (max_align_t): Add typedef for max_align_t.
* lib/stdlib/malloc.c (malloc): Align the blocks it gives out to multiples
of max_align_t.
2021-01-23 08:43:48 +01:00
Jan (janneke) Nieuwenhuizen 87c3dca401
tests: Update to bin/mes for standalone run.
* tests/base.test,
tests/boot.test,
tests/macro.test,
tests/perform.test,
tests/quasiquote.test,
tests/read.test,
tests/scm.test,
tests/srfi-0.test: Default to bin/mes.
2021-01-23 08:43:48 +01:00
Jan (janneke) Nieuwenhuizen 323337a29a
mescc: Mes C Library: div.c: Use only for ARM.
* build-aux/configure-lib.sh (libmescc_SOURCES): Remove div.c unless
ARM.
2021-01-23 08:43:48 +01:00
Jan (janneke) Nieuwenhuizen 381e8bd6e0
mescc: Mes C Library: feof: Bugfix for ARM.
* lib/stdio/feof.c (feof): Use int to compare with EOF.
2021-01-23 08:43:47 +01:00