Commit Graph

2026 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen d3c6460493
mescc: Mes C Library: Prepare for M2-Planet: memcmp.
* lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:51 +02:00
Jan (janneke) Nieuwenhuizen eb06e1f10f
mescc: Mes C Library: Prepare for M2-Planet: memcpy.
* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen 0f5f14895d
mescc: Mes C Library: Prepare for M2-Planet: memchr.
* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen fbfc7a5cca
mescc: Mes C Library: Prepare for M2-Planet: strncmp.
* lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen 9b0ec6af3a
mescc: Mes C Library: Prepare for M2-Planet: strlen.
* lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen 5b662c6724
mescc: Mes C Library: Prepare for M2-Planet: strcpy.
* lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen 8edd11fb27
mescc: Mes C Library: Prepare for M2-Planet: strcmp.
* lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen c3cd4846cb
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.
2021-05-02 12:54:50 +02:00
Jan (janneke) Nieuwenhuizen 117775787b
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.
2021-05-02 12:54:49 +02:00
Jan (janneke) Nieuwenhuizen 944d619a88
mescc: Mes C Library: Add assert_msg.
* lib/mes/assert_msg.c: New file.
2021-05-02 12:54:49 +02:00
Jan (janneke) Nieuwenhuizen 11def91051
core: Prepare for M2-Planet: vector.c.
* src/vector.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:49 +02:00
Jan (janneke) Nieuwenhuizen 25037cb3bc
core: Prepare for M2-Planet: struct.c.
* src/struct.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:49 +02:00
Jan (janneke) Nieuwenhuizen 5233c0d101
core: Prepare for M2-Planet: string.c.
* src/string.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:49 +02:00
Jan (janneke) Nieuwenhuizen edb1b7d2ad
core: Prepare for M2-Planet: reader.c.
* src/reader.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:49 +02:00
Jan (janneke) Nieuwenhuizen e08306758d
core: Prepare for M2-Planet: posix.c.
* src/posix.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:48 +02:00
Jan (janneke) Nieuwenhuizen c19dc9b702
core: Prepare for M2-Planet: module.c.
* src/module.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:48 +02:00
Jan (janneke) Nieuwenhuizen 86243e143c
core: Prepare for M2-Planet: math.c.
* src/math.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:46 +02:00
Jan (janneke) Nieuwenhuizen d3a2734098
core: Prepare for M2-Planet: lib.c.
* src/lib.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:26 +02:00
Jan (janneke) Nieuwenhuizen fa060b6d30
core: Prepare for M2-Planet: hash.c.
* src/hash.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:25 +02:00
Jan (janneke) Nieuwenhuizen 786e8eb2c5
core: Prepare for M2-Planet: gc.c.
* src/gc.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:25 +02:00
Jan (janneke) Nieuwenhuizen a07225bb6f
core: Prepare for M2-Planet: builtins.c.
* src/builtins.c: Rewrite C constructs not supported by M2-Planet.
2021-05-02 12:54:25 +02:00
Jan (janneke) Nieuwenhuizen 2f185a4f8d
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.
2021-05-02 12:54:25 +02:00
Jan (janneke) Nieuwenhuizen c07b8b2600
build: Run indent for M2.
* src/gc.c: Indented.
* src/string.c: Likewise.
2021-05-02 12:54:25 +02:00
Jan (janneke) Nieuwenhuizen f42debc398
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:
2021-05-02 12:54:25 +02:00
Jan (janneke) Nieuwenhuizen 7881be5b35
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.
2021-05-02 12:54:24 +02:00
Jan (janneke) Nieuwenhuizen 2158a30e37
build: simple.make.
* simple.make: New file.
* src/posix.c: Make sure to define EOF.
2021-05-02 12:54:24 +02:00
Jan (janneke) Nieuwenhuizen d4121efcd5
tests: Add gc.test.
* tests/gc.test: New file.
* build-aux/check-mes.sh (TESTS): Add it.
* scaffold/gc-test.scm: Remove.
2021-05-02 12:54:24 +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
Jan (janneke) Nieuwenhuizen 7ab9cfe864
mescc: Mes C Library: time.c: Use #if defined.
This helps resurrect the mes-0.19-based bootstrap.

* lib/linux/time.c: Use #if defined () instead of plain #if for possibly
undefined macros.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen 5bb568e455
mescc: Change --align to --align=functions, --align=globals.
This makes function alignment optional and disables function alignment
when using MesCC-Tools 0.5.2 (numbered architecture).

* module/mescc.scm (parse-opts): Make --align take a value.
* module/mescc/mescc.scm (mescc:compile, infos->hex2): Parse it and pass
it as renamed #:align keyword argument to ...
* module/mescc/M1.scm (infos->M1): ...here.  Rename parameter align? to
align, pass it to...
(info->M1): ...here.  Likewise.  Use it to make function alignment
optional.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen 3115261f2f
libtcc1: Compile float stubs conditionally.
* lib/libtcc1.c (__floatundidf, __floatundixf, __fixunsxfdi, __fixxfdi,
__fixsfdi, __fixunsdfdi, __fixunsdfsi, __floatdisf,
__floatdidf)[!(HAVE_FLOAT_STUB || HAVE_FLOAT)]: Remove.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen d9226ca678
libtcc1: Make float stubs weak.
* lib/libtcc1.c (__floatundidf, __floatundixf, __fixunsxfdi, __fixxfdi,
__fixsfdi, __fixunsdfdi, __fixunsdfsi, __floatdisf, __floatdidf): Add
__attribute__ ((weak)).
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen 1e102e1d46
mescc: Skip attributes on function definitions.
* module/mescc/preprocess.scm (ast-strip-attributes): New procedure.
(c99-input->ast): Use it.
2021-01-23 08:43:47 +01:00
Jan (janneke) Nieuwenhuizen 5eaf1c14ef
mescc: Mes C Library: Declare __mesabi_uldiv.
* include/mes/lib.h (__mesabi_uldiv): Add prototype.
2021-01-23 08:43:46 +01:00
Jan (janneke) Nieuwenhuizen b7dff2c2a4
mescc: Mes C Library: ARM: setjmp.c: Inline fake asm.
* lib/linux/arm-mes-gcc/_exit.c (longjmp, setjmp): Use inline fake asm.
2021-01-23 08:43:46 +01:00
Jan (janneke) Nieuwenhuizen 6703c33f96
mescc: Mes C Library: ARM: syscall.c: Inline fake asm.
* lib/linux/arm-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2,
__sys_call3, __sys_call4): Use inline fake asm.
2021-01-23 08:43:46 +01:00
Jan (janneke) Nieuwenhuizen e5ce69ec3f
mescc: Mes C Library: ARM: _write.c: Inline fake asm.
* lib/linux/arm-mes-gcc/_write.c (_write): Use inline fake asm.
2021-01-23 08:43:46 +01:00
Jan (janneke) Nieuwenhuizen 0667d1aa25
mescc: Mes C Library: ARM: _exit: Inline fake asm.
* lib/linux/arm-mes-gcc/_exit.c (_exit): Use inline fake asm.
2021-01-23 08:43:46 +01:00
Jan (janneke) Nieuwenhuizen 4e7a6057aa
mescc: Mes C Library: ARM: _start: Inline fake asm.
* lib/linux/arm-mes-gcc/crt1.c (_start): Use inline fake asm.
2021-01-23 08:43:46 +01:00