Jan (janneke) Nieuwenhuizen
|
8d35e811b4
|
core: Prepare for conversion to pointer cells.
* src/posix.c (execl_): Prepare for conversion to pointer cells.
|
2021-05-02 16:34:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
c196ed9f08
|
core: Remove dead macros.
* include/mes/macros.h (CSTRING_STRUCT, START, LEN): Remove.
|
2021-05-02 16:34:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
2f7c5b2fc0
|
core: Remove macros from cell creation: make_char .. make_string.
* src/gc.c (make_char, make_continuation, make_macro, make_number,
make_ref, make_string0, make_string_port): New function.
(make_string): Move from string.c.
* include/mes/macros.h (MAKE_CHAR, MAKE_CONTINUATION, MAKE_MACRO,
MAKE_NUMBER, MAKE_REF, MAKE_STRING0, MAKE_STRING_PORT): Remove macro.
Update users.
* include/mes/m2.h: Likewise.
|
2021-05-02 16:34:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
d03bd99795
|
core: Remove macros from cell creation: make_bytes.
* src/gc.c (bytes_cells, make_bytes): Move from string.c.
* include/mes/macros.h (MAKE_BYTES0, NAME_SYMBOL): Remove.
* include/mes/m2.h: Likewise.
|
2021-05-02 16:34:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
72318b3b77
|
core: Remove core:make-cell.
* src/gc.c (alloc, make_cell, cons): Move from mes.c
* src/mes.c: (make_cell_): Remove.
* src/lib.c (char_to_integer, integer_to_char): New function.
* src/builtins.c (mes_builtins): Add them; remove make_cell_.
* mes/module/mes/type-0.mes (char->integer, integer->char): Remove.
|
2021-05-02 16:34:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
94f335542c
|
core: Refactor display.
|
2021-05-02 16:34:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
4362b5ef28
|
core: Upcase register names.
* include/mes/mes.h (R0, R1, R2, R3, M0): Rename from lower case.
Update users.
|
2021-05-02 16:34:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
3338bf681d
|
core: Split-out symbol.c.
* src/mes.c (init_symbol, mes_symbols): Move to ..
* src/symbol.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* include/mes/mes.h: Declare init_symbols.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
c96a6b8f47
|
core: Split-out display.c.
* src/lib.c (display_helper, display_, display_error_, display_port_,
write_, write_error_, write_port_, fdisplay_): Move to ..
* src/display.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
7f8b106778
|
core: eval-apply: Fix formal_p.
* src/eval-apply.c (formal_p): Return boolean.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
16c50434e2
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
45acbfce31
|
build: Update mes-snarf.
* build-aux/snarf.sh: Support C-style annotations.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
dfdda6254d
|
mescc: Mes C Library: Prepare for M2-Planet: setenv.
* lib/posix/setenv.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
c4ec4c8e7f
|
mescc: Mes C Library: Prepare for M2-Planet: getenv.
* lib/posix/getenv.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 16:34:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
3d7fe1b1ae
|
mescc: Mes C Library: Prepare for M2-Planet: ntoab.
* lib/mes/ntoab.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 16:34:45 +02:00 |
Jan (janneke) Nieuwenhuizen
|
b0ee789770
|
mescc: Mes C Library: Prepare for M2-Planet: malloc.
* lib/stdlib/malloc.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 16:34:45 +02:00 |
Jan (janneke) Nieuwenhuizen
|
0414e1fb78
|
mescc: Mes C Library: Prepare for M2-Planet: fdungetc.
* lib/mes/fdungetc.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 16:34:45 +02:00 |
Jan (janneke) Nieuwenhuizen
|
9ea7f9e266
|
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.
|
2021-05-02 16:34:45 +02:00 |
Jan (janneke) Nieuwenhuizen
|
7f5252e5a0
|
mescc: Mes C Library: Prepare for M2-Planet: fdgetc.
* lib/mes/fdgetc.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 16:34:40 +02:00 |
Jan (janneke) Nieuwenhuizen
|
470c17fc65
|
mescc: Mes C Library: Prepare for M2-Planet: abtol.
* lib/mes/abtol.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:49 +02:00 |
Jan (janneke) Nieuwenhuizen
|
1b7e0d9213
|
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.
|
2021-05-02 14:22:49 +02:00 |
Jan (janneke) Nieuwenhuizen
|
faa3914fab
|
mescc: Mes C Library: Prepare for M2-Planet: memcmp.
* lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:49 +02:00 |
Jan (janneke) Nieuwenhuizen
|
514c98bcd1
|
mescc: Mes C Library: Prepare for M2-Planet: memcpy.
* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:49 +02:00 |
Jan (janneke) Nieuwenhuizen
|
5aed79b3e5
|
mescc: Mes C Library: Prepare for M2-Planet: memchr.
* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:49 +02:00 |
Jan (janneke) Nieuwenhuizen
|
097e662084
|
mescc: Mes C Library: Prepare for M2-Planet: strncmp.
* lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:49 +02:00 |
Jan (janneke) Nieuwenhuizen
|
db39cc020d
|
mescc: Mes C Library: Prepare for M2-Planet: strlen.
* lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
8a9abcb57f
|
mescc: Mes C Library: Prepare for M2-Planet: strcpy.
* lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
3acda6c35b
|
mescc: Mes C Library: Prepare for M2-Planet: strcmp.
* lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet.
|
2021-05-02 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
fcc4e67414
|
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 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
0d1ce7d62a
|
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 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
c7a34c6e11
|
mescc: Mes C Library: Add assert_msg.
* lib/mes/assert_msg.c: New file.
|
2021-05-02 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
8dbe69607c
|
core: Prepare for M2-Planet: vector.c.
* src/vector.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:48 +02:00 |
Jan (janneke) Nieuwenhuizen
|
076fdd2b57
|
core: Prepare for M2-Planet: struct.c.
* src/struct.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
381f49d377
|
core: Prepare for M2-Planet: string.c.
* src/string.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
62b2860e75
|
core: Prepare for M2-Planet: reader.c.
* src/reader.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
4204ee3add
|
core: Prepare for M2-Planet: posix.c.
* src/posix.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
1af2a7ea29
|
core: Prepare for M2-Planet: module.c.
* src/module.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
a144b555b1
|
core: Prepare for M2-Planet: math.c.
* src/math.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:47 +02:00 |
Jan (janneke) Nieuwenhuizen
|
89535f874f
|
core: Prepare for M2-Planet: lib.c.
* src/lib.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
cff0716ea1
|
core: Prepare for M2-Planet: hash.c.
* src/hash.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
7495477301
|
core: Prepare for M2-Planet: gc.c.
* src/gc.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
c5cbde0174
|
core: Prepare for M2-Planet: builtins.c.
* src/builtins.c: Rewrite C constructs not supported by M2-Planet.
|
2021-05-02 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
218ff65837
|
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 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
9e60dcd2ce
|
build: Run indent for M2.
* src/gc.c: Indented.
* src/string.c: Likewise.
|
2021-05-02 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
129e66a95d
|
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 14:22:46 +02:00 |
Jan (janneke) Nieuwenhuizen
|
4b8c7fee9c
|
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 14:22:45 +02:00 |
Jan (janneke) Nieuwenhuizen
|
4818c2f490
|
build: simple.make.
* simple.make: New file.
* src/posix.c: Make sure to define EOF.
|
2021-05-02 14:22:45 +02:00 |
Jan (janneke) Nieuwenhuizen
|
5ac7cdccb3
|
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 14:22:45 +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 |