Commit Graph

2199 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen 2bbf1579b2
build: Update mes-snarf.
* build-aux/snarf.sh: Support C-style annotations.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 07fb20f172
mescc: Mes C Library: Prepare for M2-Planet: setenv.
* lib/posix/setenv.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 938f154fdc
mescc: Mes C Library: Prepare for M2-Planet: getenv.
* lib/posix/getenv.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen e3763a312e
mescc: Mes C Library: Prepare for M2-Planet: ntoab.
* lib/mes/ntoab.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen cc6d0b10d4
mescc: Mes C Library: Prepare for M2-Planet: malloc.
* lib/stdlib/malloc.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen e6d06cc63a
mescc: Mes C Library: Prepare for M2-Planet: fdungetc.
* lib/mes/fdungetc.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen 2ab42f7d10
mescc: Mes C Library: Bugfix __ungetc_clear.
* lib/linux/_open3.c (_open3): Remove __ungetc_init ();
* lib/mes/mes_open.c (mes_open): Likewise.
* lib/mes/fdungetc.c (fdungetc): Likewise.
* lib/mes/fdgetc.c (__ungetc_p, __ungetc_clear, __ungetc_set): Call
__ungetc_init if buffer is uninitialized.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen b959a02a19
mescc: Mes C Library: Prepare for M2-Planet: fdgetc.
* lib/mes/fdgetc.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen 4181c4afdc
mescc: Mes C Library: Prepare for M2-Planet: abtol.
* lib/mes/abtol.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen c1d006ce17
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.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen 78e0b21570
mescc: Mes C Library: Prepare for M2-Planet: memcmp.
* lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 17b6ad893a
mescc: Mes C Library: Prepare for M2-Planet: memcpy.
* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 7ea8fc60b5
mescc: Mes C Library: Prepare for M2-Planet: memchr.
* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 586fb79985
mescc: Mes C Library: Prepare for M2-Planet: strncmp.
* lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen e4bb357e99
mescc: Mes C Library: Prepare for M2-Planet: strlen.
* lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 2a0799975b
mescc: Mes C Library: Prepare for M2-Planet: strcpy.
* lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 1d8c0a5f1c
mescc: Mes C Library: Prepare for M2-Planet: strcmp.
* lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 92f8f05a4b
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.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 4b65ece428
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.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen a2f76f9b16
mescc: Mes C Library: Add assert_msg.
* lib/mes/assert_msg.c: New file.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen ed2cd8ccfa
core: Prepare for M2-Planet: vector.c.
* src/vector.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen cd563a96e5
core: Prepare for M2-Planet: struct.c.
* src/struct.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 31ea016b94
core: Prepare for M2-Planet: string.c.
* src/string.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 96c8651733
core: Prepare for M2-Planet: reader.c.
* src/reader.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 64ef3b8fe9
core: Prepare for M2-Planet: posix.c.
* src/posix.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 6ae9b88237
core: Prepare for M2-Planet: module.c.
* src/module.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen b12e7e895a
core: Prepare for M2-Planet: math.c.
* src/math.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 9a4aea5e29
core: Prepare for M2-Planet: lib.c.
* src/lib.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen e29844e6a0
core: Prepare for M2-Planet: hash.c.
* src/hash.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 5b2e3d2422
core: Prepare for M2-Planet: gc.c.
* src/gc.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 802ce1569b
core: Prepare for M2-Planet: builtins.c.
* src/builtins.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 8040a57a06
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.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen a359b0bf9f
build: Run indent for M2.
* src/gc.c: Indented.
* src/string.c: Likewise.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen d72833502c
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:
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen f884f44e7c
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.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen a9370eb25a
build: simple.make.
* simple.make: New file.
* src/posix.c: Make sure to define EOF.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen d81acf49be
tests: Add gc.test.
* tests/gc.test: New file.
* build-aux/check-mes.sh (TESTS): Add it.
* scaffold/gc-test.scm: Remove.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen d2c8924316
mescc: Update to mescc-tools-1.0.0 option names.
* module/mescc/mescc.scm (M1->hex2):  Update to use --little-endian.
(hex2->elf): Likewise, and --base-address.
* module/mescc/mescc.scm (hex2->elf): Likewise, and remove
--exec_enable.
(M1->blood-elf): Add --little-endian.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen 5554dea204
build: Update to mescc-tools-1.0.0 option names.
* build-aux/build-scaffold.sh: Update to use --base-address and
--little-endian.
* doc/mes.texi (Regular Requirements): Bump mescc-tools to 1.0.1.
(Bootstrap Requirements): Likewise.  Bump nyacc to 1.00.2.
* INSTALL (Other GNU/Linux): Bump mescc-tools to 1.0.1.
(Prerequisites): Likewise.  bump nyacc to 1.00.2.
2022-05-01 22:58:21 +02:00
Jan (janneke) Nieuwenhuizen c9ca4a0c79
guix: mescc-tools: Update to 1.0.1.
* guix/git/mes.scm (mescc-tools)[source]: Update to 1.0.1.
2022-05-01 22:58:21 +02:00
Jan (janneke) Nieuwenhuizen 3539572f9c
Relicense imported LGPL v3+ files to GPL v3+.
Fixes https://savannah.nongnu.org/task/?16067.
Reported via savannah by Ineiev <ineiev@gnu.org>.

* mes/module/mes/lalr.scm,
module/mes/getopt-long.scm,
module/mes/optargs.scm: Change header to GNU Mes header with GPL v3.
2021-11-09 12:01:04 +01:00
Andrius Štikonas f553d84de2
doc: Migration to Libera Chat.
* BOOTSTRAP: Replace Freenode with Libera Chat.
* ROADMAP: Likewise.
* doc/mes.texi: Likewise.

Signed-off-by: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
2021-06-14 20:05:19 +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