Jan Nieuwenhuizen
4beba216bd
POINTER/haas define
2019-11-02 08:45:49 +01:00
Jan Nieuwenhuizen
a20787a73e
Revert "gc_dump_arena"
...
This reverts commit 4a553b0091
.
2019-11-02 08:45:43 +01:00
Jan Nieuwenhuizen
4a553b0091
gc_dump_arena
...
* src/gc.c (gc_dump_arena): New function.
2019-11-02 08:45:29 +01:00
Jan Nieuwenhuizen
ad28e32f21
M2: posix
2019-11-02 08:44:44 +01:00
Jan Nieuwenhuizen
f4ba4d2dda
M2 eval/apply: applybuiltin
2019-11-02 08:44:43 +01:00
Jan Nieuwenhuizen
df79ac1adc
core: display: Prepare for M2-Planet / pointer based cells.
...
!= 0 //, return.
* src/display.c:
2019-11-02 08:44:43 +01:00
Jan Nieuwenhuizen
09d7d844d2
core: gc: Prepare for pointer-based cells.
...
* include/mes/mes.h (cell_zero): Declare.
* src/gc.c (gc_init): Initialize it.
(gc_init_news): Likewise.
2019-11-02 08:44:41 +01:00
Jan Nieuwenhuizen
827c9b7e06
core: builtins: MES_MINI.
...
* include/mes/mes.h (g_mini): New global.
* src/mes.c (init): Initialize it with environment variable MES_MINI.
* src/builtins.c (mes_builtins): Register a minimal set of builtins
when g_mini.
2019-11-02 08:44:19 +01:00
Jan Nieuwenhuizen
f567cde3fc
core: make-vector: Move to core.
...
* src/vector.c (make_vector_): Rename from make_vector__. Add
parameter. Fix double allocation.
(make_vector): Rename from make_vector_. Use arity n. Update users.
2019-11-02 08:44:19 +01:00
Jan Nieuwenhuizen
dd810c5aec
core: Prepare for pointer-based cells. WIP
...
* 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.
2019-11-02 08:44:13 +01:00
Jan Nieuwenhuizen
32abbd1032
core: gc: FRAME_SIZE.
...
* src/gc.c (FRAME_SIZE): New constant.
(gc_loop, gc_): Use it.
2019-11-02 08:44:13 +01:00
Jan Nieuwenhuizen
79d0c92225
gc: do not return 0
2019-11-02 08:44:13 +01:00
Jan Nieuwenhuizen
ca58bec16f
core: GC fixes. non...Pointer-based? WIP
...
* src/gc.c (gc_init): ...
2019-11-02 08:44:10 +01:00
Jan Nieuwenhuizen
55bf150d70
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.
2019-11-02 08:40:30 +01:00
Jan Nieuwenhuizen
6b657ae84f
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.
2019-11-02 08:40:30 +01:00
Jan Nieuwenhuizen
7c7c4d772f
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.
2019-11-02 08:40:30 +01:00
Jan Nieuwenhuizen
d6c71a87d8
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.
2019-11-02 08:40:29 +01:00
Jan Nieuwenhuizen
bd993db866
core: Upcase register names.
...
* include/mes/mes.h (R0, R1, R2, R3, M0): Rename from lower case.
Update users.
2019-11-02 08:40:29 +01:00
Jan Nieuwenhuizen
05d55a1677
core: Split-out symbol.c.
...
* src/mes.c (init_symbol, mes_symbols): Move to ..
* src/symbol.c: New file.
* simple.make: Add it.
* src/eval.c (assert_defined): Likewise.
* include/mes/mes.h: Declare init_symbols.
2019-11-02 08:40:29 +01:00
Jan Nieuwenhuizen
949a6e33ee
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.
* simple.make: Add it.
* src/eval.c (assert_defined): Likewise.
2019-11-02 08:40:29 +01:00
Jan Nieuwenhuizen
938da0a91c
mescc: Mes C Library: Add assert_msg.
...
* lib/mes/assert_msg.c: New file.
2019-11-02 08:40:26 +01:00
Jan Nieuwenhuizen
ea4c39da65
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.
2019-10-26 19:40:58 +02:00
Jan Nieuwenhuizen
b7dbdc670f
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/build-mes.sh (mes_sources): Add it.
* build-aux/snarf.sh: Likewise.
* 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.
2019-10-26 19:40:57 +02:00
Jan Nieuwenhuizen
5dc245e739
build: Simplify.
...
core: Make mes src/ c files separate compilation units.
* include/mes/constants.h: New file.
* include/mes/macros.h: New file.
* include/mes/mes.h: New file.
* src/gc.c: Update.
* src/hash.c: Update.
* src/lib.c: Update.
* src/math.c: Update.
* src/mes.c: Update.
* src/module.c: Update.
* src/posix.c: Update.
* src/reader.c: Update.
* src/string.c: Update.
* src/struct.c: Update.
* src/vector.c: Update.
mes: Update datadir.
* src/mes.c (g_datadir): New global.
(open_boot): Rename from read_boot.
(read_boot): New function.
* mes/module/mes/boot-0.scm: Move from boot-0.scm.in
* configure: Update.
* configure.sh: Update.
mescc: Create libraries from separate files.
* .gitignore: Update.
* build-aux/bootstrap-mes.sh: Remove.
* build-aux/bootstrap.sh.in: Remove.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build-scaffold.sh: New file.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-tcc.sh: Remove.
* build-aux/config.sh.in: New file.
* build-aux/config.sh: Remove.
* build-aux/install.sh.in: Update.
* build-aux/test-boot.sh: New file.
* build-aux/test-c.sh: New file.
* build-aux/test-driver: New file.
* build-aux/test-suite.sh: New file.
* build-aux/trace.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes.
* lib/linux/x86-mes-mescc/mini.c: Likewise.
* lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes.
* lib/linux/x86_64-mes-mescc/mini.c: Likewise.
* lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c.
* lib/linux/x86-mes-mescc/syscall.c: Likewise.
* lib/linux/x86_64-mes-gcc/syscall.c: Likewise.
* lib/linux/x86_64-mes-mescc/syscall.c: Likewise.
* lib/mes/mes_open.c: Include config.h.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* scaffold/gc-test.sh: New file.
* simple.sh: Update.
2019-06-08 15:36:22 +02:00