Jan (janneke) Nieuwenhuizen
673ca85c64
core: assq: Prepare for M2-Planet.
...
* src/mes.c (assq): Prepare for M2-Planet.
2020-07-16 19:01:43 +02:00
Jan (janneke) Nieuwenhuizen
4c83a3bc6b
core: eq_p: Prepare for M2-Planet.
...
* src/mes.c (eq_p): Prepare for M2-Planet.
2020-07-16 12:49:52 +02:00
Jan (janneke) Nieuwenhuizen
4297746e72
core: assoc_string: Prepare for M2-Planet.
...
src/mes.c (assoc_string): Prepare for M2-Planet.
2020-07-16 11:29:08 +02:00
Jan (janneke) Nieuwenhuizen
7cc2b1f2ec
build: Add pointer.sh.
...
* build-aux/pointer.sh: New script.
2020-07-14 08:13:47 +02:00
Jan (janneke) Nieuwenhuizen
f9a372de13
core: Prepare for pointer cells.
...
* include/mes/cc.h: Prepare for pointer-based cells.
* include/mes/macros.h[POINTER_CELLS]: Alternative set of macros.
* include/mes/mes.h (struct scm)[POINTER_CELLS]: Alternative definition.
* src/gc.c (copy_cell, copy_news): New function.
* include/mes/mes.h: Declare them.
2020-07-14 15:57:49 +02:00
Jan (janneke) Nieuwenhuizen
52c57da02f
core: gc: FRAME_SIZE.
...
* src/gc.c (gc_loop, gc_): Use FRAME_SIZE.
2020-06-22 19:26:55 +02:00
Jan (janneke) Nieuwenhuizen
c6670b46c3
core: gc: Fixes.
...
* src/gc.c (gc_init, gc_up_arena, gc_flip): Change to void function.
Fixes 0 returns.
(make_bytes): Use plain.
(make_string): Add 1 to length, for zero-terminated C strings.
(gc_copy): Use plain bytes length.
(gc_loop): Manually reformat.
2020-06-22 18:00:15 +02:00
Jan (janneke) Nieuwenhuizen
4613b070e4
core: Create symbols dynamically.
...
* include/mes/symbols.h: New file.
* include/mes/mes.hh: Include it.
* include/mes/constants.h: Remove symbol constants.
* src/symbols.c (init_symbols): Create symbols dynamically.
* build-aux/mes-snarf.scm (snarf-symbols): Update.
2020-06-16 15:59:26 +02:00
Jan (janneke) Nieuwenhuizen
94e40691ba
core: Remove CBYTES, CSTRING, NCBYTES macros.
...
* src/gc.c (cell_bytes, news_bytes): New function.
* include/mes/macros.h (CBYTES, CSTRING, NCBYTES): Remove. Update
users.
* include/mes/m2.h: Likewise.
2020-05-19 08:55:41 +02:00
Jan (janneke) Nieuwenhuizen
a25dff6837
core: Prepare for conversion to pointer cells.
...
* src/posix.c (execl_): Prepare for conversion to pointer cells.
2020-05-19 09:11:29 +02:00
Jan (janneke) Nieuwenhuizen
96809cadf1
core: Remove dead macros.
...
* include/mes/macros.h (CSTRING_STRUCT, START, LEN): Remove.
2020-05-19 08:49:55 +02:00
Jan (janneke) Nieuwenhuizen
781f4f0e6c
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.
2020-05-18 22:35:12 +02:00
Jan (janneke) Nieuwenhuizen
0f951cac5d
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.
2020-05-18 21:57:55 +02:00
Jan (janneke) Nieuwenhuizen
7932d4bad7
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.
2020-05-18 00:40:50 +02:00
Jan (janneke) Nieuwenhuizen
e0da734c8b
core: Refactor display.
2020-05-17 23:53:27 +02:00
Jan (janneke) Nieuwenhuizen
f746db72c5
core: Upcase register names.
...
* include/mes/mes.h (R0, R1, R2, R3, M0): Rename from lower case.
Update users.
2020-05-17 22:32:53 +02:00
Jan (janneke) Nieuwenhuizen
cadf047530
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.
2020-05-17 20:50:12 +02:00
Jan (janneke) Nieuwenhuizen
c8bfa1478d
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.
2020-05-17 20:42:48 +02:00
Jan (janneke) Nieuwenhuizen
efd9f75ce2
core: eval-apply: Fix formal_p.
...
* src/eval-apply.c (formal_p): Return boolean.
2020-05-31 15:03:10 +02:00
Jan (janneke) Nieuwenhuizen
c4dd954216
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.
2020-05-17 20:14:08 +02:00
Jan (janneke) Nieuwenhuizen
dd01e28e68
build: Update mes-snarf.
...
* build-aux/snarf.sh: Support C-style annotations.
2020-05-18 12:10:50 +02:00
Jan (janneke) Nieuwenhuizen
2012304dc8
mescc: Mes C Library: Prepare for M2-Planet: setenv.
...
* lib/posix/setenv.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:28:58 +02:00
Jan (janneke) Nieuwenhuizen
cf7fc8ec2b
mescc: Mes C Library: Prepare for M2-Planet: getenv.
...
* lib/posix/getenv.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:28:51 +02:00
Jan (janneke) Nieuwenhuizen
d49ea35044
mescc: Mes C Library: Prepare for M2-Planet: ntoab.
...
* lib/mes/ntoab.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:28:37 +02:00
Jan (janneke) Nieuwenhuizen
5dbae4a29b
mescc: Mes C Library: Prepare for M2-Planet: malloc.
...
* lib/stdlib/malloc.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:29:09 +02:00
Jan (janneke) Nieuwenhuizen
fac29c0e7b
mescc: Mes C Library: Prepare for M2-Planet: fdungetc.
...
* lib/mes/fdungetc.c: Rewrite C-constructs not supported by M2-Planet.
2020-05-17 19:28:28 +02:00
Jan (janneke) Nieuwenhuizen
04061cbba5
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.
2020-06-07 00:31:26 +02:00
Jan (janneke) Nieuwenhuizen
189b9d9e8c
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
11d6a9679d
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
902ed2524a
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
8e74d025f2
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
3b68e7de64
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
b20a388715
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
b4895d7495
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
99e24cd99a
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
8194ecfc0f
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
c117abe06a
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
0ca159041d
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
6a96134eba
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
cf22ba44ce
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
60929bf40e
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
2440143579
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
038884ec62
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
b65cb4861e
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
188d80ffc4
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
988217e232
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
f3f24e4100
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
7bc1d0cf9f
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
7d82ad9a85
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
948c6ef91d
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