Jan Nieuwenhuizen [Fri, 4 May 2018 18:40:04 +0000 (20:40 +0200)]
mescc: Handle (Skip) global static.
* module/language/c99/compiler.mes (decl->info): Handle (Skip) global
static.
* scaffold/tests/48-global-static.c: Test it.
Jan Nieuwenhuizen [Fri, 4 May 2018 11:58:27 +0000 (13:58 +0200)]
mescc: Support functions in expression.
* module/language/c99/info.scm (<function>): New type.
* module/language/c99/compiler.mes (ast->type): Support function.
(expr->type-size): Likewise.
(expr->type): Likewise.
(expr->accu*): Likewise.
(function->info): Create <function>.
* module/mes/M1.mes (object->M1): Grok <function>.
* scaffold/tests/47-function-expression.c: Test it.
* build-aux/check-mescc.sh: Add it.
Jan Nieuwenhuizen [Fri, 4 May 2018 18:45:27 +0000 (20:45 +0200)]
mescc: Support function-static variables.
* module/language/c99/info.scm (make): Add statics field.
(<global>): Add name and function fields. Update callers.
(global->string): New function.
* module/mes/M1.mes (object->M1): Update.
* module/language/c99/compiler.mes (clone): Add statics field.
(ident->accu): For <global>, use global in text (WAS: name).
(ident-address->accu): Likewise.
(ident-address->base): Likewise.
(decl-local->info): New function.
(decl->info): New function.
(ast->info): Use them.
(function->info): Keep globals in object (WAS: global:value only).
* scaffold/tests/46-function-static.c: Test it.
Jan Nieuwenhuizen [Sun, 20 May 2018 11:04:20 +0000 (13:04 +0200)]
mes: Add unfold.
* module/srfi/srfi-1.mes (unfold): New function.
Jan Nieuwenhuizen [Sun, 20 May 2018 11:18:36 +0000 (13:18 +0200)]
mes: Add const.
* module/mes/scm.mes (const): New function.
* tests/scm.test ("const"): Test it.
Jan Nieuwenhuizen [Wed, 16 May 2018 20:30:08 +0000 (22:30 +0200)]
core: Add logxor.
* src/math.c (logxor): New function.
* tests/math.test ("logxor"): Test it.
Jan Nieuwenhuizen [Wed, 16 May 2018 21:31:39 +0000 (23:31 +0200)]
mes: string-join: Support optional delimiter, support grammar.
* module/srfi/srfi-13.mes (string-join): Support optional infix and
grammar.
* tests/srfi-13.test ("string-join"): Test it.
Jan Nieuwenhuizen [Wed, 16 May 2018 20:32:59 +0000 (22:32 +0200)]
core: reader: Support binary #b101.
* src/reader.c (reader_read_binary): New function.
(reader_read_hash): Use it.
* tests/scm.test ("binary"): Test it.
Jan Nieuwenhuizen [Fri, 4 May 2018 10:44:05 +0000 (12:44 +0200)]
mes: Support srfi-9-gnu.
* module/srfi/srfi-9/gnu.mes: New file. Support srfi-9-gnu.
* tests/srfi-9.test: Test it.
* tests/srfi-9.test-guile:
Jan Nieuwenhuizen [Sat, 28 Apr 2018 16:31:10 +0000 (18:31 +0200)]
core: Have core:eval expand macros.
* src/mes.c (core:eval-expand): Remove
(core:eval-expanded): New variable.
(eval_apply): Have core:eval expand macros; core:eval-expanded evals
expanded sexps.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 05:46:40 +0000 (07:46 +0200)]
Revert "core: Remove pmatch-car, pmatch-cdr hack."
This reverts commit
be1e84624ea4a158173f34af923e3c4a3793412a.
Jan Nieuwenhuizen [Sat, 28 Apr 2018 10:19:40 +0000 (12:19 +0200)]
core: Remove pmatch-car, pmatch-cdr hack.
* src/mes.c (scm_vm_eval_pmatch_car, scm_vm_eval_pmatch_cdr): Remove
(eval_apply): Remove cell_vm_eval_pmatch_car,
cell_vm_eval_pmatch_cdr hack.
(mes_symbols): Remove cell_symbol_pmatch_car, cell_symbol_pmatch_cdr.
* scaffold/mini-mes.c: Likewise.
* module/mes/guile.scm (mes): Remove pmatch-car, pmatch-cdr.
* module/mes/pmatch.scm (ppat): Use plain car, cdr.
Jan Nieuwenhuizen [Wed, 23 May 2018 18:28:43 +0000 (20:28 +0200)]
build: Do not assume /bin/sh, basename/dirname.
* install.sh: Do not assume /bin/sh, basename/dirname.
* scripts/diff.scm: Likewise.
Jan Nieuwenhuizen [Wed, 23 May 2018 11:37:55 +0000 (13:37 +0200)]
build: Build mini-libc and libc+tcc-gcc too.
* include/getopt.h[__GNUC__ && POSIX]: Only use include_next.
* lib/libc+tcc-gcc.c[POSIX](longjmp, setjmp, __udivdi3, __umoddi3):
Remove.
* build-aux/build-cc.sh: Build mini-libc-gcc and libc+tcc-gcc too.
* build-aux/build-mlibc.sh: Build mini-libc-gcc too.
Jan Nieuwenhuizen [Wed, 23 May 2018 07:24:52 +0000 (09:24 +0200)]
boot: Bugfix for diff on mes.
* scripts/diff.scm (diff-files): Rename from diff; Avoids name clash
with module to allow using -e '(<module>)' hack.
Jan Nieuwenhuizen [Wed, 23 May 2018 04:54:33 +0000 (06:54 +0200)]
build: Install naive diff.
* scripts/diff.scm: Move from build-aux.
* install.sh: Install it.
* build-aux/tests.sh: Update location.
Jan Nieuwenhuizen [Sun, 20 May 2018 22:06:39 +0000 (00:06 +0200)]
build: Update configure.
* configure: Update.
Jan Nieuwenhuizen [Wed, 2 May 2018 20:52:31 +0000 (22:52 +0200)]
mes: Remove debugging.
* module/mes/module.mes (mes-load-module-env): Remove debugging.
Jan Nieuwenhuizen [Thu, 10 May 2018 14:35:49 +0000 (16:35 +0200)]
build: Use ../mes-seed/refresh.sh, ../tinycc-seed/refresh.sh.
* GNUmakefile (seed): Use ../mes-seed/refresh.sh, ../tinycc-seed/refresh.sh.
Jan Nieuwenhuizen [Fri, 4 May 2018 08:12:34 +0000 (10:12 +0200)]
mescc: Guile fixes.
* scripts/mescc: Set GODIR. Add module as expression to Mes
invokation. Remove explicit (second) call to main.
Jan Nieuwenhuizen [Fri, 18 May 2018 16:34:58 +0000 (18:34 +0200)]
test: Use diff -ub for tinycc tests.
* build-aux/diff.scm: Support -b.
* build-aux/test.sh: Use it.
Jan Nieuwenhuizen [Fri, 4 May 2018 19:24:39 +0000 (21:24 +0200)]
check: Also test with i686-unknown-linux-gnu-gcc.
* check.sh (CC32): New variable.
* build-aux/test.sh: Also test with CC32.o
Jan Nieuwenhuizen [Sun, 6 May 2018 06:46:32 +0000 (08:46 +0200)]
build: configure: Handle VAR=VALUE. Update help.
* configure: Handle VAR=VALUE. Update help.
Jan Nieuwenhuizen [Thu, 3 May 2018 18:32:06 +0000 (20:32 +0200)]
build: Fixes for Debian and /bin/sh == dash.
* build.sh: Use separate export stanzas. Use command -v (WAS: type
-p). Fixes sh, /bin/sh == dash.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-mlibc.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* check.sh: Likewise.
* install.sh: Likewise.
* scripts/mescc: Likewise.
Jan Nieuwenhuizen [Thu, 3 May 2018 07:30:03 +0000 (09:30 +0200)]
build: Rebuild after build from seed.
* build-aux/build-mes.sh: Rebuild after build from seed.
Jan Nieuwenhuizen [Thu, 3 May 2018 07:01:00 +0000 (09:01 +0200)]
mescc: Use file-name as global prefix.
* module/mes/M1.mes (object->M1): Add file-name parameter.
Jan Nieuwenhuizen [Wed, 2 May 2018 21:11:27 +0000 (23:11 +0200)]
core: Fixes for int-max, int-min.
* src/math.c (greater_p): Fix INT_MAX > 0.
(less_p): Fix INT_MIN < 0.
* tests/math.test ("< INT-MIN"): Test it.
("< INT-MAX"):
("> INT-MAX"):
("> INT-MAX 0"):
("> INT-MIN"):
* tests/srfi-13.test ("string->number INT-MAX"): Test it.
("string->number INT-MIN"):
("number->string INT-MAX"):
("number->string INT-MIN"):
* scaffold/tests/60-math.c (test): Test it.
Jan Nieuwenhuizen [Wed, 2 May 2018 13:53:37 +0000 (15:53 +0200)]
mescc: Fix dumping of strings > M1_STRING_MAX.
* module/mes/M1.mes (object->M1): Skip opening quote.
Jan Nieuwenhuizen [Mon, 30 Apr 2018 18:47:05 +0000 (20:47 +0200)]
Revert "core: length: Check parameter."
This reverts commit
1f52ed35c66febcce16e06868e803a39be7eda41.
Jan Nieuwenhuizen [Mon, 30 Apr 2018 17:31:00 +0000 (19:31 +0200)]
core: length: Check parameter.
* src/mes.c (length): Check parameter.
Jan Nieuwenhuizen [Tue, 1 May 2018 14:50:29 +0000 (16:50 +0200)]
test: enable all tests, use expect count, add tinycc tests.
* build-aux/check-mescc.sh (tests): Add tinycc tests.
* build-aux/diff.scm: Naive diff for tinycc tests.
* build-aux/test.sh: Run diff when .expect found.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:38:57 +0000 (18:38 +0200)]
build: Simplify, drop make.scm experiment.
* build.sh: Rewrite.
* build-aux/build-cc.sh: New file.
* build-aux/build-mes.sh: New file.
* build-aux/build-mlibc.sh: New file.
* build-aux/cc.sh: New file.
* build-aux/cc-mes.sh: New file.
* build-aux/cc-mlibc.sh: New file.
* install.sh: Update.
* make.scm: Remove.
* guile/guix/make.scm: Remove.
* guile/guix/records.scm: Remove.
* guile/guix/shell-utilsg.scm: Remove.
Jan Nieuwenhuizen [Mon, 30 Apr 2018 19:17:10 +0000 (21:17 +0200)]
core: Use length__.
* src/mes.c (check_formals): Use length__.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 05:56:52 +0000 (07:56 +0200)]
mes-snarf: Support running with Mes.
* build-aux/mes-snarf.scm: Support running with Mes.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 17:06:11 +0000 (19:06 +0200)]
mes: Support -C and -L for Guile compatibility.
* module/mes/boot-0.scm): Support -C and -L for Guile compatibility.
Signed-off-by: Jan Nieuwenhuizen <janneke@gnu.org>
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:37:00 +0000 (18:37 +0200)]
mes: Support -e,--main option.
* module/mes/boot-0.scm: Support -e,--main option.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:35:22 +0000 (18:35 +0200)]
mes: Upgrade Guile module support.
* module/mes/boot-0.scm (define-module): New macro with minimal Guile support.
(use-modules): New macro.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 21:31:22 +0000 (23:31 +0200)]
mes: Add srfi-8.
* module/srfi/srfi-8.mes: New file.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:34:21 +0000 (18:34 +0200)]
mes: string-join: Handle empty list.
* module/mes/boot-0.scm (string-join): Handle empty list.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:33:14 +0000 (18:33 +0200)]
mes: Add basename.
* module/mes/posix.mes (basename): New function.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:32:35 +0000 (18:32 +0200)]
mes: Add delete-duplicates.
* module/srfi/srfi-1.mes (delete-duplicates): New function.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:29:26 +0000 (18:29 +0200)]
mes: filter-map: Handle two lists.
* module/srfi/srfi-1.mes (filter-map): Handle two lists, add error
when called with three or more.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:27:29 +0000 (18:27 +0200)]
mes: Add string-replace.
* module/srfi/srfi-13.mes (string-replace): New function.
* tests/srfi-13.test ("string-replace"): Test it.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:26:46 +0000 (18:26 +0200)]
mes: Add string-map.
* module/srfi/srfi-13.mes (string-map): New function.
* tests/srfi-13.test ("string-map"): Test it.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:24:29 +0000 (18:24 +0200)]
mes: Add string-trim, string-trim-right, string-trim-both.
* module/srfi/srfi-13.mes (string-trim, string-trimn-right,
string-trim-both): New function.
* tests/srfi-13.test ("string-trim"): Test it.
("string-trim-right"):
("string-trim-both"):
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:21:52 +0000 (18:21 +0200)]
mes: Add string-contains.
* module/srfi/srfi-13.mes (string-contains): New function.
* tests/srfi-13.test ("string-contains"): Test it.
("string-contains not"):
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:15:04 +0000 (18:15 +0200)]
mes: string-drop: Error on negative droppings.
* module/srfi/srfi-13.mes (string-drop, string-take,
string-drop-right): Error on negative droppings.
* tests/srfi-13.test ("string-drop"): Test it.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 16:14:01 +0000 (18:14 +0200)]
core: reverse!: Handle empty list.
* src/mes.c (reverse_x_): Handle empty list.
* tests/scm.test ("reverse! ()"): Test it.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 15:48:38 +0000 (17:48 +0200)]
core: Add string ports.
* src/mes.c (type_t): Add TPORT.
(scm_type_port): New symbol.
(PORT): New macro.
(MAKE_STRING_PORT): New macro.
(eval_apply): Handle string ports in primitive-load.
(mes_symbols): Add scm_type_port.
* src/posix.c (peekchar): Handle string ports.
(readchar): New function. Replace all getchar callers.
(unreadchar): Likewise.
* module/mes/type-0 (port?): New function.
* module/mes/guile.mes (with-input-from-file): Rewrite.
(open-input-string): Remove.
* module/mes/guile.scm (guile): Update cell types.
* src/gc.c (gc_loop): Support TPORT.
* src/lib.c (display_helper): Support TPORT.
* module/mes/display.mes (display): Support TPORT.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 14:17:07 +0000 (16:17 +0200)]
mes: assq, assoc-ref: Handle non-A-LISTs.
* src/mes.c (assq): Return #f if A-LIST is not a list.
* module/mes/scm.mes (assoc): Likewise.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 11:22:02 +0000 (13:22 +0200)]
core: Use single definition rule for cell-type.
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
scm_type_function, scm_type_keyword, scm_type_macro,
scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
scm_type_string, scm_type_symbol, scm_type_values,
scm_type_variable, scm_type_vector): New symbol.
(mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
<cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
<cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
<cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
<cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 10:04:18 +0000 (12:04 +0200)]
core: Fix gc_up_arena for x86_64.
* src/gc.c (gc_): Fix gc_up_arena for x86_64.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 10:02:23 +0000 (12:02 +0200)]
core: Fix compile warnings.
* src/posix.c: Include sys/stat.h.
(chmod): Return cell_unspecified.
* include/stdlib.h: Typo.
Jan Nieuwenhuizen [Sun, 29 Apr 2018 10:01:25 +0000 (12:01 +0200)]
mlibc: Declare chmod.
* include/sys/stat.h (mode_t, chmod): Declare.
Jan Nieuwenhuizen [Sat, 28 Apr 2018 10:59:29 +0000 (12:59 +0200)]
guix: Update mes to 0.13.
* guix.scm (mes): Update to 0.13.
(mes.git): Likewise.
Jan Nieuwenhuizen [Fri, 27 Apr 2018 21:57:42 +0000 (23:57 +0200)]
Release 0.13.
* configure (VERSION): Bump to 0.13.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 22:45:00 +0000 (00:45 +0200)]
doc: Release udpate.
* BOOTSTRAP: Update.
* HACKING: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.13: New file.
Jan Nieuwenhuizen [Fri, 27 Apr 2018 21:47:31 +0000 (23:47 +0200)]
mescc: Merge mescc.mes and mescc.scm.
* scripts/mescc: New file.
* scripts/mescc.mes: Remove.
* guile/mescc.scm: Remove.
* guile/guix/make.scm (CC.mescc): Update.
* install.sh (TINYCC_SEED): Update.
* make.scm (bootstrap?): Update.
* test.sh (MES): Update.
* check-boot.sh: Use $GUILE to allow running without Guile.
Jan Nieuwenhuizen [Fri, 27 Apr 2018 21:31:45 +0000 (23:31 +0200)]
core: Add chmod.
* src/posix.c (chmod_): New function.
Jan Nieuwenhuizen [Wed, 25 Apr 2018 06:35:05 +0000 (08:35 +0200)]
core: jam-scaper/garbage-collector: Use only one arena.
* src/mes.c (ARENA_SIZE): Lower to 200000.
(MES_MAX_ARENA): Bump to
300000000.
(JAM_SIZE): New global.
(make_cell__): Remove ARENA assert.
(gc_init_cells): Alloc ARENA_SIZE + JAM_SIZE.
(mes_symbols): Do not init news.
(gc_init_news): Remove.
(main): Initialize JAM_SIZE, consider MES_JAM environment variable.
* src/gc.c (gc_init_news): Move from mes.c. Start at g_free.
(gc_flip): Do not flip to g_news, instead copy g_news to cells.
(gc_up_arena): Realloc to ARENA_SIZE + JAM_SIZE.
(gc_): Init news. Only up arena if g_news is safe.
Jan Nieuwenhuizen [Tue, 24 Apr 2018 05:26:27 +0000 (07:26 +0200)]
mescc: Create less garbage when dumping M1.
* module/mes/M1.mes (display-join): New function.
* (object->M1): Use it.
Jan Nieuwenhuizen [Tue, 24 Apr 2018 05:00:35 +0000 (07:00 +0200)]
core: last_pair: Move to core.
* src/lib.c (last_pair): New function.
* module/mes/scm.mes (last-pair): Remove.
Jan Nieuwenhuizen [Tue, 24 Apr 2018 04:59:18 +0000 (06:59 +0200)]
core: equal2_p: Add short-circuit and eliminate tail call.
* src/lib.c (equal2_p): Add short-circuit and eliminate tail call.
Jan Nieuwenhuizen [Mon, 23 Apr 2018 04:56:35 +0000 (06:56 +0200)]
mescc: Use display for dumping M1.
* module/mes/M1.mes (object->M1): Use display for dumping M1.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:51:28 +0000 (11:51 +0200)]
mes: Guile-like command-line interface.
* module/mes/boot-0.scm (tty?): Guile-like command-line interface.
* scripts/repl.mes: Remove.
* scripts/mescc.mes: Update.
* tests/*.test: Update scripts.
* module/mes/repl.mes (repl): Add ,quit.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:49:30 +0000 (11:49 +0200)]
mes: getopt-long: Support stop-at-first-non-option.
* module/mes/getopt-long.scm (process-options): Fix parsing `-'. Add
parameter: stop-at-first-non-option.
(getopt-long): Add keyword parameter #:stop-at-first-non-option.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:48:38 +0000 (11:48 +0200)]
mes: Add isatty?.
* src/posix.c (isatty_p): New function.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:47:44 +0000 (11:47 +0200)]
mlibc: Add isatty.
* lib/libc.c (isatty): New function.
* include/unistd.h: Declare it.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 09:42:47 +0000 (11:42 +0200)]
mlibc: Add ioctl.
* stage0/x86.M1 (SYS_ioctl): New define.
* lib/linux-mes.c (ioctl): New syscall.
* lib/linux-gcc.c (ioctl): New syscall.
* include/sys/ioctl.h: New file.
Jan Nieuwenhuizen [Tue, 10 Apr 2018 19:43:19 +0000 (21:43 +0200)]
core: Compile minimal mes with MES_MINI=1.
* src/mes.c: Compile minimal mes with MES_MINI=1.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 22:33:50 +0000 (00:33 +0200)]
core; reader_read_string: Support escaped characters.
* src/reader.c (reader_read_string): Support escaped characters.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 14:38:55 +0000 (16:38 +0200)]
Revert "mescc: Use core:write."
This reverts commit
d88e31dfec3158a830c32f9f732b052cfccac6eb.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 21:58:37 +0000 (23:58 +0200)]
mescc: Use core:write.
* scripts/mescc.mes (source->ast): Use core:write.
Jan Nieuwenhuizen [Sun, 22 Apr 2018 18:08:38 +0000 (20:08 +0200)]
mes: display: Display escaped characters.
* module/mes/display.mes (display): Display escaped characters.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 21:58:28 +0000 (23:58 +0200)]
core: display_helper: Display escaped characters.
* src/lib.c (display_helper): Display escaped characters.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 15:30:14 +0000 (17:30 +0200)]
mes: Resurrect macros in repl.
* src/mes.c (scm_vm_begin_expand): Rename to core:begin-expand.
(eval_apply): Expose it.
* module/mes/repl.mes (repl): Use it to resurrect macros.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 11:31:12 +0000 (13:31 +0200)]
core: Fixes for garbage collector/jam scraper.
* src/gc.c (gc_loop): Do not relocate car of TCLOSURE, TCONTINUATION.
Check for TBROKEN_HEART.
* src/mes.c (make_closure_): Set car to 0.
(check_apply): Check for TBROKEN_HEART. Fixes reporting artificial
out-of-memory error.
(eval_apply): Likewise.
* src/vector.c (vector_entry): Only copy TCHAR and TNUMBER.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 11:19:54 +0000 (13:19 +0200)]
core: drop global_p from variable.
* src/mes (struct scm): Remove field global_p.
(VARIABLE_GLOBAL_P): Remove.
(make_variable_): Remove global_p parameter. Update callers.
* src/lib.c (display_helper): Drop VARIABLE_GLOBAL_P support.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 06:54:14 +0000 (08:54 +0200)]
core: Reenable full printing of lists.
* src/lib.c (display_helper): Reenable full printing of lists.
Jan Nieuwenhuizen [Fri, 20 Apr 2018 12:38:24 +0000 (14:38 +0200)]
core: append2, append_reverse, reverse, reverse!: Create less garbage.
* src/mes.c (append_reverse): New function.
(reverse_x_): New function.
(append2): Use them to create less garbage.
* module/mes/scm.mes (reverse): Create less garbage.
* module/srfi/srfi-1.mes (reverse!): Rewrite, use core:reverse!.
(append-reverse): Remove.
Jan Nieuwenhuizen [Fri, 20 Apr 2018 11:22:47 +0000 (13:22 +0200)]
core: vector_to_list: Create less garbage.
* src/vector.c (vector_to_list): Create less garbage.
Jan Nieuwenhuizen [Fri, 20 Apr 2018 11:06:00 +0000 (13:06 +0200)]
core: Optimize vector-map, vector-for-each.
* module/srfi/srfi-43.mes (vector-map): Optimize.
(vector-for-each): Optimize.
* tests/srfi-43.test: New file.
* tests/srfi-43.test-guile: New file.
* check.sh (tests): Add it.
* make.scm (mes-tests): Add it.
Jan Nieuwenhuizen [Wed, 18 Apr 2018 17:35:25 +0000 (19:35 +0200)]
Revert "build-32.sh"
This reverts commit
ace8b6f1b52de58c9ab404ed13234f397dac6bdc.
Jan Nieuwenhuizen [Mon, 16 Apr 2018 18:25:31 +0000 (20:25 +0200)]
build-32.sh
Jan Nieuwenhuizen [Sat, 14 Apr 2018 06:15:49 +0000 (08:15 +0200)]
core: Cleanup make_cell, remove tmp cells.
* src/mes.c (make_cell__): New function.
(make_cell_): Use it.
(length__): New function.
(tmp, tmp_num, tmp_num2, tmp_num_, tmp_num2_, make_tmps): Remove.
Update callers to use make_cell__ directly.
* src/vector.c (make_vector__): New function.
(make_vector_): Use it.
Jan Nieuwenhuizen [Sat, 21 Apr 2018 11:42:16 +0000 (13:42 +0200)]
Revert "mlibc: Use memmove in realloc."
This reverts commit
f47a21e3cb4814c4a30d10ff59e5c947441725e9.
Jan Nieuwenhuizen [Sun, 15 Apr 2018 06:13:36 +0000 (08:13 +0200)]
mlibc: Use memmove in realloc.
* src/libc.c (memmove): New function.
(realloc): Use it.
* src/libc+tcc.c (memmove): Remove.
Jan Nieuwenhuizen [Sun, 15 Apr 2018 06:04:09 +0000 (08:04 +0200)]
mes: Add char-whitespace?
* module/srfi/srfi-14.mes (char-whitespace?): New function.
Jan Nieuwenhuizen [Sat, 14 Apr 2018 20:06:28 +0000 (22:06 +0200)]
mes: Move base-0.mes int boot-0.scm.
* module/mes/boot-02.scm: New file, rename from boot-0.scm.
* module/mes/boot-0.scm: Add base-0.mes.
* module/mes/base-0.mes: Remove.
Jan Nieuwenhuizen [Fri, 13 Apr 2018 06:18:19 +0000 (08:18 +0200)]
mes: Unify mlibc-gcc and mes builds.
* make.scm (bin.gcc): Remove stray slash.
* src/mes.c: Unify mlibc-gcc and mes builds.
(gc_init_cells):
(gc_init_news):
(bload_env):
* src/reader.c (reader_read_character):
(reader_read_string):
Jan Nieuwenhuizen [Thu, 12 Apr 2018 19:33:38 +0000 (21:33 +0200)]
core: Remove local variables from gc.
* src/gc.c (gl_loop): Remove local variables.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 05:08:09 +0000 (07:08 +0200)]
core: Listen to MES_SAFETY environment variable.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 05:07:24 +0000 (07:07 +0200)]
core: Remove local variables from eval/apply.
* src/mes.c (eval_apply): Move all variables to global scope.
Jan Nieuwenhuizen [Thu, 12 Apr 2018 05:06:40 +0000 (07:06 +0200)]
core: Remove MesCC reminder.
Jan Nieuwenhuizen [Wed, 11 Apr 2018 18:46:06 +0000 (20:46 +0200)]
core: Update default memory settings.
* src/mes.c (MAX_ARENA_SIZE)[__MESC__]: Set to maximum
172100000.
Jan Nieuwenhuizen [Mon, 9 Apr 2018 05:12:38 +0000 (07:12 +0200)]
core: Tune debug printing.
* src/mes.c: Tune debug printing.
* src/gc.c: Likewise.
* module/mes/guile.mes: Likewise.
* HACKING: Describe it.
Jan Nieuwenhuizen [Mon, 9 Apr 2018 06:41:30 +0000 (08:41 +0200)]
core: Rewrite reader to create less garbage.
* src/reader.c (reader_read_line_comment): Rename from read_line_comment.
(reader_identifier_p): New function.
(reader_end_of_word_p): New function.
(reader_read_identifier_or_number): New function.
(reader_read_sexp_): Rewrite. Update callers.
(reader_read_list): Rewrite.
(reader_lookup_): Remove.
Jan Nieuwenhuizen [Tue, 10 Apr 2018 19:51:15 +0000 (21:51 +0200)]
core: Add isspace.
* include/ctype.h (isspace): Declare.
* lib/libc.c (isspace): New function.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 21:14:45 +0000 (23:14 +0200)]
core: Rewrite string reader.
* src/reader.c (reader_read_string): Rewrite, create much less
garbage.
(append_char): Remove.
Jan Nieuwenhuizen [Sun, 8 Apr 2018 15:01:59 +0000 (17:01 +0200)]
install: Fix prefix confusion.
* install.sh: Substitute @PREFIX@ with MES_PREFIX.
* scripts/mescc.mes: Grok PREFIX as MES_PREFIX.