Commit Graph

1975 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 5912cbefbb
core: primitive-load: Force top level.
* src/eval-apply.c (eval_apply): Force toplevel for primitive load.
2019-11-15 16:14:23 +01:00
Jan Nieuwenhuizen 438d624f80
boot-module: first running! 2019-11-15 16:14:22 +01:00
Jan Nieuwenhuizen 0de228a0d6
HACK: flat-variable. 2019-11-15 16:14:22 +01:00
Jan Nieuwenhuizen 7f7b823175
display: <var> 2019-11-15 16:14:22 +01:00
Jan Nieuwenhuizen 6f3a967ef8
core: Replace special cell_boot_module with initial-module builtin.
* src/module.c (initial_module): New builtin.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
* include/mes/symbols.h (cell_boot_module): Remove.
* src/symbol.c (init_symbols_): Update.
(init_symbols): Likewise.
* src/eval-apply.c (eval_apply): Likewise.
(expand_variable_): Likewise.
* tests/macro.test (make-fluid): Likewise.
* mes/module/mes/fluids.mes (make-fluid):  Likewise.
2019-11-14 22:35:15 +01:00
Jan Nieuwenhuizen 3653c4aa82
core: Remove make_module_type, module_printer, module_variable, module_ref.
* src/module.c (make_module_type, module_printer, module_variable,
module_ref): Remove.
* include/mes/builtins.h: Remove declarations.
* src/builtins.c (mes_builtins): Remove registrations.
* src/eval-apply.c (assert_defined): Remove.
(set_env_x, eval_apply): Use lookup_variable and variable_ref.
* src/core.c (error): Likewise.
* mes/module/mes/boot-01.scm (defined?): Likewise.
* mes/module/mes/boot-02.scm (defined?): Likewise.
* mes/module/mes/boot-03.scm (defined?): Likewise.
* mes/module/mes/boot-0.scm (defined?): Likewise.
* scaffold/boot/53-closure-display.scm (guile): Likewise.
* scaffold/boot/60-let-syntax-expanded.scm (defined?): Likewise.
* src/mes.c (main): Use hash_table_printer for debugging.
2019-11-14 22:35:15 +01:00
Jan Nieuwenhuizen 244f389f36
core: Add lookup_variable_, lookup_variable, lookup_ref.
* src/variable.c (lookup_variable, lookup_ref): New builtins, and
(lookup_variable_): New function.
* include/mes/builtins.h: Declare them.
* include/mes/mes.h: Declare it.
* src/builtins.c (mes_builtins): Register them.
2019-11-14 22:18:40 +01:00
Jan Nieuwenhuizen 691b2a9555
core: Add hashq_set_handle_x.
* src/hash.c (hash_set_x_): Return handle instead of value.  Update
callers and and use it in ...
(hashq_set_handle_x): New function.
* include/mes/builtins.h: Declare it.
2019-11-14 11:47:39 +01:00
Jan Nieuwenhuizen 754a215dc2
WIP: variable 2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen 58b2c50415
Revert "display: <var>"
This reverts commit cb28b55f886dd8ebb50b2336d8dc440a953b2897.
2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen 64ef316840
display: <var> 2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen 95da4c77ad
mes: Add hash-for-each.
* mes/module/mes/scm.mes (hash-for-each): New function.
2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen 68535ec510
core: Add hash_clear!.
* src/hash.c (hash_clear_x): New builtin.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen d5e33652bb
core: Add hash-table?.
* include/mes/mes.h (scm_hash_table_type): New type.
* src/hash.c (make_hash_table_type): Rename from make_hash_type, and
initialize it.
* src/symbol.c (init_symbols): Add it to environment.
2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen 61dabc7aa4
core: Allow non-string hash keys.
This merely allows adding non-string keys to a hash table and puts them
non-string keys in bucket 0.  Efficiency is lost.  TODO: calculate a
proper hash.

* src/hash.c (hash_): Allow non-string keys in bucket 0.
2019-11-14 07:33:06 +01:00
Jan Nieuwenhuizen 2d00477ffa
mes: Resurrect cell:type-name.
* mes/module/mes/type-0.mes (cell:type-name): Resurrect.
2019-11-14 07:33:05 +01:00
Jan Nieuwenhuizen ee9bf7ded4
Revert "mes: Add hash-for-each. WIP! split me: fixup hash/make-hash table hacks."
This reverts commit ef63ad04f8.
2019-11-14 07:33:05 +01:00
Jan Nieuwenhuizen a3672f2c8b
mes: Add hash-for-each. WIP! split me: fixup hash/make-hash table hacks.
* mes/module/mes/scm.mes (hash-for-each): New function.
* mes/module/mes/type-0.mes (cell:type-name): Resurrect.
* src/hash.c (hash_): Hack: allow non-string keys.
(make_hash_table_type): Rename from make_hash_type.  WIP
(hash_table_p): New function.
(hash_clear_x): New function.
* src/module.c (make_module_type): Rewrite.
(module_p): x
(get_pre_modules_obarray): x
2019-11-14 07:33:01 +01:00
Jan Nieuwenhuizen ae712265f5
mes: Add hash-fold.
* mes/module/mes/scm.mes (hash-fold): New function.
2019-11-13 08:04:14 +01:00
Jan Nieuwenhuizen ecd12eed8f
core: Add hash-map->list.
* src/hash.c (hash_map_to_list): New function.
* src/builtins.c (mes_builtins): Update.
* include/mes/builtins.h: Update.
2019-11-13 08:04:14 +01:00
Jan Nieuwenhuizen 4df3aaeb95
struct debug 2019-11-13 08:04:03 +01:00
Jan Nieuwenhuizen a22b00e095
core: variable: Guile interface compliancy. WIP
* src/lib.c (assert_variable):
* src/gc.c (make_variable): Move from
* src/eval-apply.c (make_variable): here; Remove.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
* mes/module/mes/scm.mes (make-undefined-variable): New function.
* src/variable.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* kaem.run: Likewise.
* simple.make (LIBMES_SOURCES): Likewise.
* build-aux/snarf.sh (srcdest): Likewise.
2019-11-10 19:36:16 +01:00
Jan Nieuwenhuizen bbe38389ff
core: Use exceptions instead of asserts. WIP
* src/lib.c (assert_num, assert_struct): New function.
* src/struct.c (struct_ref_): Use them.
2019-11-10 19:36:16 +01:00
Jan Nieuwenhuizen 45a23dc541
mes: Resurrect backtraces.
* mes/module/mes/catch.mes (%eh): Resurrect backtraces.
(display-frame): New function.
(display-backtrace): Use it.
2019-11-10 19:36:15 +01:00
Jan Nieuwenhuizen ebd7aa09a7
core: Add abort.
* build-aux/configure-lib.sh (libmes_SOURCES): Add abort.c.
* src/posix.c (abort_): New function: use it.
* include/mes/builtins.h: Declare it.
* kaem.run: Add it.
* simple.make (M2_SOURCES): Likewise.
2019-11-10 19:36:10 +01:00
Jan Nieuwenhuizen f37f4755aa
mes: hash: Guile interface compliancy.
* mes/module/mes/scm.mes (hashq-get-handle, hashq-ref, hash-ref): New
function.
* src/hash.c (hashq_get_handle_): Rename from hashq_get_handle.
Update users.
(hashq_ref_): Likewise.
(hash_ref_): Likewise.
2019-11-10 18:51:31 +01:00
Jan Nieuwenhuizen caea76c528
hash-table: use erro iso assert... 2019-11-10 18:51:31 +01:00
Jan Nieuwenhuizen f8159357d8
core: WIP exceptions 2019-11-10 18:51:31 +01:00
Jan Nieuwenhuizen 7d5ea4dbf2
mes: srfi-9: Guile interface compliancy.
* tests/srfi-9.test: Convert to bootstrap test, do not use
mes-use-module.
* mes/module/srfi/srfi-9-vector.mes: Resurrect.
2019-11-10 18:51:31 +01:00
Jan Nieuwenhuizen 48d497141e
mes: srfi-9: Guile interface compliancy.
* mes/module/srfi/srfi-9-struct.mes (record-type-name): Rename from
record-type.  Update users.
(record-type-descriptor): New function.
* mes/module/srfi/srfi-9/gnu-struct.mes (set-field): Update.
* tests/srfi-9.test ("make-record-type", "record-constructor",
"record?", "record-predicate", "zero?", "zero-one", "zero-one-set!",
"record-type-descriptor", "record-type-name", "record-type-fields"):
New test.
2019-11-10 18:51:31 +01:00
Jan Nieuwenhuizen 9c63722d0c
mes: srfi-9: Guile interface compliancy.
* mes/module/srfi/srfi-9-struct.mes (record-type-fields): Rename from
record-field-names.  Update users.
* mes/module/srfi/srfi-9-vector.mes (record-type-fields): Likewise.
* mes/module/srfi/srfi-9/gnu-struct.mes (set-field): Update.
2019-11-10 18:51:31 +01:00
Jan Nieuwenhuizen a065b1a505
core: make-hash-table: Fix optional argument.
* src/hash.c (make_hash_table): Fix optional argument.
* src/builtins.c (mes_builtins): Update arity.
2019-11-10 18:51:30 +01:00
Jan Nieuwenhuizen 796be3546e
mes: srfi-9: Guile interface compliancy.
* mes/module/srfi/srfi-9-struct.mes (record-accessor): Rename from
record-getter.  Update users.
* mes/module/srfi/srfi-9-vector.mes (record-modifier): Rename from
record-setter.  Update users.
* mes/module/srfi/srfi-9/gnu-struct.mes: Update.
2019-11-10 18:51:30 +01:00
Jan Nieuwenhuizen 6b0714cfcd
mes: srfi-9: Guile interface compliancy.
* mes/module/srfi/srfi-9-struct.mes (record-constructor): Remove name
argument, make field-names optional.  Update users.
* mes/module/srfi/srfi-9-vector.mes: Likewise.
* mes/module/srfi/srfi-9/gnu-struct.mes: Update.
2019-11-10 18:51:30 +01:00
Jan Nieuwenhuizen e6839a2b43
build: Cater for M2-Planet. WIP
* configure: Drop MES_SEED, support M2-Planet.
* kaem.run: Also build bin/mes.
* build-aux/bootstrap.sh.in: Run kaem bootstrap.
* build-aux/build.sh.in: Run kaem bootstrap.  Build bin/mes.  Update
scripts and users.
* build-aux/install.sh.in: Install all built bin/mes-* flavours.
2019-11-10 18:51:19 +01:00
Jan Nieuwenhuizen b63d27a4b5
doc: Update. 2019-11-10 18:51:19 +01:00
Jan Nieuwenhuizen abb658da43
guix: Update M2-Planet to 1fc2aeab483208bd2ba117b21df3894c182470ec.
* guix/git/mes.scm (m2-planet): Update to 1fc2aeab483208bd2ba117b21df3894c182470ec.
* lib/m2/x86/x86_defs.M1: Update from M2-Planet.
2019-11-10 18:51:18 +01:00
Jan Nieuwenhuizen f183b51400
guix: Add m2-planet.
* guix/git/mes.scm (m2-planet): New variable.
2019-11-10 18:51:18 +01:00
Jan Nieuwenhuizen 707a3b4bae
bootstrap: Indent build messages.
* build-aux/bootstrap.sh.in: Indent build messages.
2019-11-10 18:51:18 +01:00
Jan Nieuwenhuizen 632557e3d4
core: Use casting functions.
Silence all casting errors by using casting functions.

* src/cc.c (cast_charp_to_scmp, cast_charp_to_scmpp,
cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function.
* src/m2.c (cast_charp_to_scmp, cast_charp_to_scmpp,
cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function.
* include/mes/mes.h: Declare them.
(struct scm): Add car_value, cdr_value, function.
(g_continuations): Change to long.
* src/mes.c: Silence all casting errors by using casting functions.
2019-11-10 18:51:18 +01:00
Jan Nieuwenhuizen 397af07475
mescc: Mes C Library: Use casting functions.
Silence all casting errors by using casting functions.

* lib/mes/cast.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES): Add it.
* lib/m2/cast.c: New file.
* kaem.run: Add it.
* simple.make: Add them both.
* include/mes/lib.h: Add cast prototypes.
* include/m2/lib.h: Likewise.
* lib/linux/_getcwd.c (_getcwd): Use them.
* lib/linux/access.c (access): Likewise.
* lib/linux/brk.c (brk): Likewise.
* lib/linux/chmod.c (chmod): Likewise.
* lib/linux/clock_gettime.c (clock_gettime): Likewise.
* lib/linux/gettimeofday.c (gettimeofday): Likewise.
* lib/linux/unlink.c (unlink): Likewise.
* lib/mes/fdputc.c (fdputc): Likewise.
* lib/stdio/putchar.c (putchar): Likewise.
* lib/stdlib/malloc.c (malloc): Likewise.
2019-11-10 18:51:18 +01:00
Jan Nieuwenhuizen 7138b54159
core: Switch to pointer cells.
Run

   build-aux/pointer.sh

* include/mes/macros.h: Remove.
* src/*.c: Update.
* include/mes/*.h: Update.
* simple.make: Update.
* kaem.run: Update.
2019-11-10 18:51:11 +01:00
Jan Nieuwenhuizen b00b6fa468
build: Update snarfer.
* build-aux/mes-snarf.scm (symbol->header): Update for pointer cells.
(snarf-symbols): Likewise.
(snarf-functions): Likewise.
2019-11-10 18:49:37 +01:00
Jan Nieuwenhuizen 0ec619e6d1
core: Drop support for number based cells.
This removes the POINTER_CELLS define and all its references.

* simple.make (CFLAGS): Remove -D POINTER_CELLS.
* include/mes/mes.h: Remove #define POINTER_CELLS.
* include/mes/cc.h: Remove !POINTER_CELLS branches.
* include/mes/macros.h: Likewise.
* src/gc.c: Likewise.
* src/symbol.c: Likewise.
* src/test/gc.c: Likewise.
2019-11-10 18:44:57 +01:00
Jan Nieuwenhuizen 44fbc25d82
core: gc: Pointer cells: Drop cells->news->cells flipping.
* src/gc.c (gc_init): Undo doubling of initial memory.
(gc_init_news)[!GC_NOFLIP]: Remove.
(gc_)[!GC_NOFLIP]: Remove symbol relocation.
(gc)[!GC_NOFLIP]: Remove second gc.
2019-11-10 18:44:57 +01:00
Jan Nieuwenhuizen c1daf6ab90
core: gc: Abort upon broken heart failure.
* src/gc.c (gc_cellcpy, gc_loop): Abort upon broken heart failure.
2019-11-10 18:44:57 +01:00
Jan Nieuwenhuizen 6cd1a56c36
core: gc: Enable memory dump debugging.
* src/gc.c (gc): If MES_DUMP is set, dump arena.  [POINTER_CELLS &&
!GC_NOFLIP]: Run gc_ twice to enable comparing memory dumps.
2019-11-10 18:44:57 +01:00
Jan Nieuwenhuizen 99bedd15ea
core: gc: Add gc_dump_arena.
* src/gc.c (dumpc, dumps, gc_dump_register, gc_dump_state,
gc_dump_stack, gc_dump_arena): New function.
2019-11-10 18:44:56 +01:00
Jan Nieuwenhuizen c70deb52ea
core: Pointer cells: Allow smaller memory footprint using cellcpy.
* src/gc.c (gc_init)[GC_NOFLIP]: Do not use double sized arena.
(gc_cellcpy): New function.
* src/gc.c (gc_flip): Use it, do not flip.
(gc_init_news)[GC_NOFLIP]: Update.
2019-11-10 18:44:56 +01:00
Jan Nieuwenhuizen aae2ea4c9c
test/gc: Add three extra gc's.
* src/test/gc.c (test_gc): Add three extra gc's.
2019-11-10 18:44:56 +01:00