Jan Nieuwenhuizen
34cfd9b850
core: Throw instead of segfault on non-existing input file. WIP.
...
Reported by theruran.
* src/posix.c (open_input_file): Call error instead of failing silently.
2019-11-24 23:21:23 +01:00
Jan Nieuwenhuizen
99a971fe73
mes: compatibility: Move (mes pmatch) to (system base pmatch).
...
* mes/module/system/base/pmatch.scm: Move from mes/pmatch.scm. Update
users.
2019-11-17 16:20:12 +01:00
Jan Nieuwenhuizen
3e7bfca4c9
mes: compatibility: Make base.mes pure guile.
...
* mes/module/mes/type-0.mes (procedure?): New function. Rewrite
without `cond' from
* mes/module/mes/base.mes (procedure?): here; Remove.
2019-11-17 16:09:27 +01:00
Jan Nieuwenhuizen
b2098b3a76
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-17 12:25:49 +01:00
Jan Nieuwenhuizen
f200bfe054
doc: Update.
2019-11-17 12:25:49 +01:00
Jan Nieuwenhuizen
9532829d89
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-17 12:25:49 +01:00
Jan Nieuwenhuizen
cfceb07027
guix: Add m2-planet.
...
* guix/git/mes.scm (m2-planet): New variable.
2019-11-17 12:25:49 +01:00
Jan Nieuwenhuizen
997acf5ce2
bootstrap: Indent build messages.
...
* build-aux/bootstrap.sh.in: Indent build messages.
2019-11-17 12:25:48 +01:00
Jan Nieuwenhuizen
70e3c62637
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-17 12:25:48 +01:00
Jan Nieuwenhuizen
25e159d622
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-17 12:25:48 +01:00
Jan Nieuwenhuizen
630dd9a3d9
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-17 12:25:48 +01:00
Jan Nieuwenhuizen
9f876a9fcc
build: Update snarfer.
...
* build-aux/mes-snarf.scm (symbol->header): Update for pointer cells.
(snarf-symbols): Likewise.
(snarf-functions): Likewise.
2019-11-17 12:25:48 +01:00
Jan Nieuwenhuizen
522135342d
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-17 12:25:48 +01:00
Jan Nieuwenhuizen
60d65653b2
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-17 12:25:48 +01:00
Jan Nieuwenhuizen
02da290b21
core: gc: Abort upon broken heart failure.
...
* src/gc.c (gc_cellcpy, gc_loop): Abort upon broken heart failure.
2019-11-17 12:25:47 +01:00
Jan Nieuwenhuizen
fddbe47e08
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-17 12:25:47 +01:00
Jan Nieuwenhuizen
6c03bfe5a3
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-17 12:25:47 +01:00
Jan Nieuwenhuizen
b798746104
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-17 12:25:47 +01:00
Jan Nieuwenhuizen
4dfbb1f867
test/gc: Add three extra gc's.
...
* src/test/gc.c (test_gc): Add three extra gc's.
2019-11-17 12:25:47 +01:00
Jan Nieuwenhuizen
8e6c41f4e4
test/gc: struct.
...
* src/test/gc.c (test_struct): New function.
(main): Call it.
2019-11-17 12:25:47 +01:00
Jan Nieuwenhuizen
6f4d948cc4
test/gc: vector.
...
* src/test/gc.c (test_vector): New function.
(main): Call it.
(print_arena): New function.
(test_gc): Call it.
2019-11-17 12:25:47 +01:00
Jan Nieuwenhuizen
bae6557dab
test/gc: string.
...
* src/test/gc.c (test_string): New function.
(main): Call it.
2019-11-17 12:25:46 +01:00
Jan Nieuwenhuizen
b6ed1bc9ed
test/gc: list.
...
* src/test/gc.c (test_list): New function.
(main): Call it.
2019-11-17 12:25:46 +01:00
Jan Nieuwenhuizen
888fe1ac6c
test/gc: cons.
2019-11-17 12:25:46 +01:00
Jan Nieuwenhuizen
e350187cd3
test/gc: number.
...
* src/test/gc.c (test_number): New function.
(main): Call it.
2019-11-17 12:25:46 +01:00
Jan Nieuwenhuizen
c6d55bffeb
test/gc: empty.
...
* src/test/gc.c (test_empty): New function.
2019-11-17 12:25:46 +01:00
Jan Nieuwenhuizen
dd7573529d
core: eval-apply: Prepare for M2-Planet.
...
* src/eval-apply.c (apply_builtin): Split M2-Planet specific and CC
specifi part off to ..
* src/cc.c: New file, and
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* src/m2.c: New file.
* simple.make (MES_SOURCES, M2_SOURCES): Likewise.
2019-11-17 12:25:46 +01:00
Jan Nieuwenhuizen
9ea3f4ec61
core: display: Prepare for pointer cells, M2-Planet.
...
Rewrite C-constructs not supported by M2-Planet
if (foo) -> if (foo != 0)
if (!foo) -> if (foo == 0)
; -> 0;
// ... -> /* ... */
* src/display.c (display_helper): Use cell_ref.
2019-11-17 12:25:45 +01:00
Jan Nieuwenhuizen
2ea505a931
core: gc: Prepare for pointer cells, M2-Planet.
...
* include/mes/mes.h (cell_zero): Declare.
* src/gc.c (gc_init): Initialize it.
(gc_init_news): Likewise.
2019-11-17 12:25:45 +01:00
Jan Nieuwenhuizen
f1430fc845
core: Remove cell_call_with_current_continuation special.
...
* include/mes/symbols.h (cell_call_with_current_continuation): Remove.
* src/eval-apply.c (eval_apply): Update to use
cell_symbol_call_with_current_continuation.
* src/symbol.c (init_symbols_): Remove inititialization.
2019-11-17 12:25:45 +01:00
Jan Nieuwenhuizen
a950e6b948
core: Remove cell_begin special.
...
* include/mes/symbols.h (cell_begin): Remove.
* src/eval-apply.c (eval_apply): Update to use cell_symbol_begin.
* src/symbol.c (init_symbols_): Remove initialization.
2019-11-17 12:25:45 +01:00
Jan Nieuwenhuizen
5678640e04
core: Remove unused symbols.
...
* include/mes/symbols.h (cell_symbol_dot, cell_symbol_read_input_file,
cell_symbol_write, cell_symbol_display): Remove
* src/symbol.c (init_symbols_): Remove initializations.
2019-11-17 12:25:45 +01:00
Jan Nieuwenhuizen
84bd81f155
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-17 12:25:45 +01:00
Jan Nieuwenhuizen
9f66f648b7
boot: Add gc test.
...
* scaffold/boot/gc.test: New file.
* build-aux/check-boot.sh (TESTS): Add it.
* include/mes/symbols.h (cell_symbol_program): New symbol.
* src/symbol.c (init_symbols_): Initialize it.
* src/mes.c (main): Add it to environment.
2019-11-17 12:25:45 +01:00
Jan Nieuwenhuizen
b6bc836f5a
test/gc: Add gc inspection test.
...
* src/test/gc.c (main): New unit test.
* simple.make (test-gcc, test-m2): New target to build it.
* build-aux/pointer.sh: Add it.
2019-11-17 12:25:44 +01:00
Jan Nieuwenhuizen
6d30f93dfd
core: make_struct: Avoid creating garbage.
...
* src/struct.c (make_struct): Use STRUCT TYPE PRINTER FIELD0 ... FIELDN.
2019-11-17 12:25:44 +01:00
Jan Nieuwenhuizen
266d3b890c
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-17 12:25:44 +01:00
Jan Nieuwenhuizen
859325eedd
mescc: Mes C Library: Add M2-Planet support.
...
Mes can now be built with M2-Planet by running
kaem --verbose --strict
* include/linux/x86/syscall.h (SYS_getcwd, SYS_dup, SYS_dup2,
SYS_unlilnk, SYS_gettimeofday, SYS_clock_gettime, SYS_time): Move to
libc section. Add M2-Planet constants.
* include/m2/lib.h (struct timezone, struct timespec): struct timeval):
Define. Add M2-Planet flavor prototypes for mes libc.
* include/mes/m2.h: Remove macros.
* include/mes/mes.h (g_start_time, __gettimeofday_time,
__get_internal_run_time_ts): Declare.
* src/mes.c (init): Initialize them.
* src/posix.c: Use them.
* lib/linux/_getcwd.c: Support M2-Planet.
* lib/linux/access.c: Likewise.
* lib/linux/chmod.c: Likewise.
* lib/linux/clock_gettime.c: Likewise.
* lib/linux/dup.c: Likewise.
* lib/linux/dup2.c: Likewise.
* lib/linux/gettimeofday.c: Likewise.
* lib/linux/read.c: Likewise.
* lib/linux/unlink.c: Likewise.
* lib/mes/fdgetc.c: Likewise.
* lib/mes/fdputc.c: Likewise.
* lib/posix/getenv.c: Likewise.
* lib/posix/setenv.c: Likewise.
* lib/stdlib/realloc.c: Likewise.
* lib/string/memcmp.c: Likewise.
* lib/string/memcpy.c: Likewise.
* lib/m2/abtol.c: New file.
* lib/m2/chmod.c: New file.
* lib/m2/clock_gettime.c: New file.
* lib/m2/execv.c: New file.
* lib/m2/execve.c: New file.
* lib/m2/exit.c: New file.
* lib/m2/getcwd.c: New file.
* lib/m2/ioctl.c: New file.
* lib/m2/isatty.c: New file.
* lib/m2/ntoab.c: New file.
* lib/m2/strncmp.c: New file.
* lib/m2/time.c: New file.
* lib/m2/waitpid.c: New file.
* simple.make: Use them. Remove macro preprocessing for M2-Planet.
* kaem.run: New file.
2019-11-17 12:25:44 +01:00
Jan Nieuwenhuizen
edd07bfecf
core: posix: Prepare for M2-Planet.
...
* src/posix.c (access_p): Prepare for M2-Planet.
2019-11-17 12:25:44 +01:00
Jan Nieuwenhuizen
b4bab89d0a
mescc: Mes C Library: Add waitpid for M2-Planet.
...
* lib/m2/waitpid.c: New file.
2019-11-17 12:25:44 +01:00
Jan Nieuwenhuizen
7c8e423eae
mescc: Mes C Library: Add time for M2-Planet.
...
* lib/m2/time.c: New file.
2019-11-17 12:25:43 +01:00
Jan Nieuwenhuizen
3660297ef8
mescc: Mes C Library: Add ntoab for M2-Planet.
...
* lib/m2/ntoab.c: New file.
2019-11-17 12:25:43 +01:00
Jan Nieuwenhuizen
2202ab2599
mescc: Mes C Library: Add isatty for M2-Planet.
...
* lib/m2/isatty.c: New file.
2019-11-17 12:25:43 +01:00
Jan Nieuwenhuizen
3c3bb89c94
mescc: Mes C Library: Add ioctl for M2-Planet.
...
* lib/m2/ioctl.c: New file.
2019-11-17 12:25:43 +01:00
Jan Nieuwenhuizen
4355559473
mescc: Mes C Library: Add getcwd for M2-Planet.
...
* lib/m2/getcwd.c: New file.
2019-11-17 12:25:43 +01:00
Jan Nieuwenhuizen
05d5d6d1ee
mescc: Mes C Library: Add exit for M2-Planet.
...
* lib/m2/exit.c: New file.
2019-11-17 12:25:43 +01:00
Jan Nieuwenhuizen
05618820da
mescc: Mes C Library: Add execve for M2-Planet.
...
* lib/m2/execve.c: New file.
2019-11-17 12:25:42 +01:00
Jan Nieuwenhuizen
dda4ebcd21
mescc: Mes C Library: Add execv for M2-Planet.
...
* lib/m2/execv.c: New file.
2019-11-17 12:25:42 +01:00
Jan Nieuwenhuizen
81579b6066
mescc: Mes C Library: Add clock_gettime for M2-Planet.
...
* lib/m2/clock_gettime.c: New file.
2019-11-17 12:25:42 +01:00
Jan Nieuwenhuizen
065b90c82e
mescc: Mes C Library: Add chmod for M2-Planet.
...
* lib/m2/chmod.c: New file.
2019-11-17 12:25:42 +01:00