Compare commits

..

209 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen 157c6da386 build: Release 0.24.
* configure (VERSION): Bump to 0.24.
* configure.sh (VERSION): Likewise.
* build-aux/GNUmakefile.in (gen-announce): Update previous-version to
0.23.
* mes/module/mes/repl.mes (welcome): Update copyright years.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 67263894f9 doc: Add `ANNOUNCE-0.24'.
* doc/announce/ANNOUNCE-0.24: New file.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 655dd267ca doc: Update `NEWS'.
* NEWS (Changes in 0.24 since 0.23): New section.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 48bcfadd3b doc: Update `README'.
* README: Mention Mes can be bootstrapped using M2-Planet.
Mention Full Source Bootstrap sponsoring by NlNet.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 7c138ebdbc doc: Update 'AUTHORS'.
* AUTHORS: Mention Jeremiah Orians as co-author on ELF heanders and
mention M2-Planet imports.  Mention bug fixes by W.J. van der Laan.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 0f6a03f5f2 doc: Update Guix bootstrap status.
* doc/mes.texi (Bootstrappable Builds): Add reference to Guix.
(Reduced Binary Seed Bootstrap): Add node and section header.
(Scheme-only Bootsrap): New section.
(Full Source Bootstrap): Add node and section header.  Some updates.
(Stage0): Add node and section header.
(M2-Planet): New section.
(The Mes Bootstrap Process): Fix typos, update to current Guix reduced
binary seed bootstrap status.
* doc/images/gcc-mesboot-graph.dot: Regenerate.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 293b9eb5da doc: Update dependencies, add M2-Planet.
* INSTALL (Other GNU/Linux): Mention M2-Planet.
(Prerequisites): Likewise.
* doc/mes.texi (Regular Requirements): Likewise.  Rename to...
(Requirements): ...this.
(Bootstrap Requirements): Likewise.
(Building from Git): Mention dependencies on GNU Texinfo, GNU help2man,
graphviz, and perl.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen c471939a74 doc: Use `guix shell' instead of `guix environment'.
* HACKING (SETUP): Use `guix shell' instead of `guix environment'.
* INSTALL (Guix): Likewise.
* PORTING (Setup environment): Likewise.
* doc/mes.texi (Building from Git): Likewise.
* simple.sh: Likewise.
* guix.scm: Likewise.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen a9f79c34ec ARM: build: Cater for M2-Planet.
* include/linux/arm/syscall.h: Add support for M2-Planet.
* lib/linux/arm-mes-m2/_exit.c,
lib/linux/arm-mes-m2/_write.c,
lib/linux/arm-mes-m2/crt1.M1,
lib/linux/arm-mes-m2/crt1.c,
lib/linux/arm-mes-m2/syscall.c,
lib/m2/arm/ELF-arm.hex2,
lib/m2/arm/arm_defs.M1: New files.
* build-aux/build.sh.in: Remove cpu restriction for kaem build.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 44e5a39756 guix: m2-planet: Update to 1.9.0.
* guix/git/mes.scm (m2-planet)[source]: Update to 1.9.0.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 173b0e615e build: Depend on M2-Planet-1.9.0.
* configure (main): Bump M2-Planet version to 1.8.0.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 542a8a4a66 guix: mescc-tools: Update to 1.3.
* gnu/packages/mes.scm (m2-planet): Update to 1.3.
[native-inputs]: Add which.
[argument]: Remove patch-prefix stage.
2022-05-01 23:07:20 +02:00
Jan (janneke) Nieuwenhuizen 1ed5254df4
guix: m2-planet: Update to 1.8.0.
* guix/git/mes.scm (m2-planet)[source]: Update to 1.8.0.
[arguments]: Remove patch-prefix stage.
[home-page]: Fix.
2022-05-01 22:58:49 +02:00
Jan (janneke) Nieuwenhuizen a8bc7b4b0f
build: Depend on M2-Planet-1.8.0.
* configure (main): Bump M2-Planet version to 1.8.0.
* kaem.run,
scaffold/argv.kaem,
scaffold/global-array.kaem,
scaffold/hello.kaem,
scaffold/local-array.kaem,
scaffold/local-static-array.kaem,
scaffold/main.kaem,
scaffold/read.kaem:: Use M2-Planet --bootstrap-mode.
2022-05-01 22:58:49 +02:00
Jan (janneke) Nieuwenhuizen fab12946f1
guix: Update package inputs to new style.
* guix/git/mes.scm (m2-planet)[native-inputs]: Use simple list.
* guix/git/mes.scm (nyacc-0.99): Likewise.
[inputs]: Use simple list.
(nyacc): Likewise.
(mes)[propagated-inputs]: Use simple list.
[native-inputs]: Use list instead of alist.
[native-search-paths]: New field.
2022-05-01 22:58:49 +02:00
Jan (janneke) Nieuwenhuizen 030b9b3575
Mes C Library: memchr: Avoid compile warning.
* lib/string/memchr.c (memchr): Cast return to void*.
2022-05-01 22:58:49 +02:00
Jan (janneke) Nieuwenhuizen 21d774c40e
core: Fix FRAME_SIZE conflict.
This avoids conflicting with FRAME_SIZE from signal.h.

* include/mes/constants.h (FRAME_SIZE): Rename to...
(GC_FRAME_SIZE): ...this.
(FRAME_PROCEDURE): Rename to...
(GC_FRAME_PROCEDURE): ...this.
* src/eval-apply.c (eval_apply): Update accordingly.
* src/gc.c (gc_push_frame, gc_peek_frame, gc_pop_frame): Update accordingly.
* src/stack.c (make_frame, make_stack): Update accordingly.
2022-05-01 22:58:49 +02:00
Jan (janneke) Nieuwenhuizen 273e37dfb0
core: Resurrect gcc-10 support.
* include/mes/mes.h (g_datadir, g_debug, g_buf, g_continuations,
g_symbols, g_symbol_max, g_mini, R0, R1, R2, R3, M0, g_macros, g_ports,
ARENA_SIZE, MAX_ARENA_SIZE, STACK_SIZE, JAM_SIZE, GC_SAFETY, MAX_STRING,
g_arena, cell_arena, cell_zero, g_free, g_symbol, g_stack_array,
g_cells, g_news, g_stack, gc_count, gc_start_time, gc_end_time, gc_time,
__execl_c_argv, __open_boot_buf, __open_boot_file_name, __setenv_buf,
__reader_read_char_buf, g_start_time, __gettimeofday_time,
__get_internal_run_time_ts): Declare extern.
* include/mes/symbols.h ( cell_nil, cell_f, cell_t, cell_dot,
cell_arrow, cell_undefined, cell_unspecified, cell_closure,
cell_circular, cell_vm_apply, cell_vm_apply2, cell_vm_begin,
cell_vm_begin_eval, cell_vm_begin_expand, cell_vm_begin_expand_eval,
cell_vm_begin_expand_macro, cell_vm_begin_expand_primitive_load,
cell_vm_begin_primitive_load, cell_vm_begin_read_input_file,
cell_vm_call_with_current_continuation2, cell_vm_call_with_values2,
cell_vm_eval, cell_vm_eval2, cell_vm_eval_check_func,
cell_vm_eval_define, cell_vm_eval_macro_expand_eval,
cell_vm_eval_macro_expand_expand, cell_vm_eval_pmatch_car,
cell_vm_eval_pmatch_cdr, cell_vm_eval_set_x, cell_vm_evlis,
cell_vm_evlis2, cell_vm_evlis3, cell_vm_if, cell_vm_if_expr,
cell_vm_macro_expand, cell_vm_macro_expand_car,
cell_vm_macro_expand_cdr, cell_vm_macro_expand_define,
cell_vm_macro_expand_define_macro, cell_vm_macro_expand_lambda,
cell_vm_macro_expand_set_x, cell_vm_return, cell_symbol_lambda,
cell_symbol_begin, cell_symbol_if, cell_symbol_quote,
cell_symbol_define, cell_symbol_define_macro, cell_symbol_quasiquote,
cell_symbol_unquote, cell_symbol_unquote_splicing, cell_symbol_syntax,
cell_symbol_quasisyntax, cell_symbol_unsyntax,
cell_symbol_unsyntax_splicing, cell_symbol_set_x, cell_symbol_sc_expand,
cell_symbol_macro_expand, cell_symbol_portable_macro_expand,
cell_symbol_sc_expander_alist, cell_symbol_call_with_values,
cell_symbol_call_with_current_continuation, cell_symbol_boot_module,
cell_symbol_current_module, cell_symbol_primitive_load, cell_symbol_car,
cell_symbol_cdr, cell_symbol_not_a_number, cell_symbol_not_a_pair,
cell_symbol_system_error, cell_symbol_throw,
cell_symbol_unbound_variable, cell_symbol_wrong_number_of_args,
cell_symbol_wrong_type_arg, cell_symbol_buckets, cell_symbol_builtin,
cell_symbol_frame, cell_symbol_hashq_table, cell_symbol_module,
cell_symbol_procedure, cell_symbol_record_type, cell_symbol_size,
cell_symbol_stack, cell_symbol_argv, cell_symbol_mes_datadir,
cell_symbol_mes_version, cell_symbol_internal_time_units_per_second,
cell_symbol_compiler, cell_symbol_arch, cell_symbol_pmatch_car,
cell_symbol_pmatch_cdr, cell_type_bytes, cell_type_char,
cell_type_closure, cell_type_continuation, cell_type_function,
cell_type_keyword, cell_type_macro, cell_type_number, cell_type_pair,
cell_type_port, cell_type_ref, cell_type_special, cell_type_string,
cell_type_struct, cell_type_symbol, cell_type_values,
cell_type_variable, cell_type_vector, cell_type_broken_heart,
cell_symbol_program, cell_symbol_test): Likewise.
* src/globals.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen d578bee8e5
guix: m2-planet: Update to 1.7.0-32-gaa3472b.
This adds support for skipping "extern".

* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0-32-gaa3472b.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen 9e4d62b15d
scaffold: Add local-static-array.c.
GCC gives

    12:35:54 janneke@dundal:~/src/mes/wip-m2 [env]
    $ gcc scaffold/local-static-array.c
    12:36:01 janneke@dundal:~/src/mes/wip-m2 [env]
    $ ./a.out
    hello local static
    hello local static
    12:36:04 janneke@dundal:~/src/mes/wip-m2 [env]

M2-Planet gives

    12:36:04 janneke@dundal:~/src/mes/wip-m2 [env]
    $ kaem --verbose --strict --file scaffold/local-static-array.kaem
     +> M2-Planet --debug --architecture x86 -f lib/mes/globals.c -f lib/linux/x86-mes-m2/mini.c -f lib/mes/mini-write.c -f lib/string/strlen.c -f lib/string/strcpy.c -f lib/mes/eputs.c -f scaffold/local-static-array.c -o scaffold/local-static-array.M1
    scaffold/local-static-array.c:29:static is not a defined symbol
    Subprocess error 256
    ABORTING HARD
    [1]12:36:07 janneke@dundal:~/src/mes/wip-m2 [env]

* scaffold/local-static-array.c: New file.
* scaffold/local-static-array.kaem: New file.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen 1739234cc5
scaffold: Add local-array.c.
GCC gives

    12:32:06 janneke@dundal:~/src/mes/wip-m2 [env]
    $ gcc scaffold/local-array.c
    12:34:27 janneke@dundal:~/src/mes/wip-m2 [env]
    $ ./a.out
    hello local
    12:34:31 janneke@dundal:~/src/mes/wip-m2 [env]

M2-Planet gives

    12:34:31 janneke@dundal:~/src/mes/wip-m2 [env]
    $ kaem --verbose --strict --file scaffold/local-array.kaem
     +> M2-Planet --debug --architecture x86 -f lib/mes/globals.c -f lib/linux/x86-mes-m2/mini.c -f lib/mes/mini-write.c -f lib/string/strlen.c -f lib/string/strcpy.c -f lib/mes/eputs.c -f scaffold/local-array.c -o scaffold/local-array.M1
    scaffold/local-array.c:29:ERROR in collect_local
    Missing ;
    Subprocess error 256
    ABORTING HARD
    [1]12:34:42 janneke@dundal:~/src/mes/wip-m2 [env]

* scaffold/local-array.c: New file.
* scaffold/local-array.kaem: New file.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen 1117e3cb98
scaffold: Add global-array.c.
GCC gives

    12:30:45 janneke@dundal:~/src/mes/wip-m2 [env]
    $ gcc scaffold/global-array.c
    12:31:53 janneke@dundal:~/src/mes/wip-m2 [env]
    $ ./a.out
    hello global
    12:31:54 janneke@dundal:~/src/mes/wip-m2 [env]

M2-Planet gives

    12:31:54 janneke@dundal:~/src/mes/wip-m2 [env]
    $ kaem --verbose --strict --file scaffold/global-array.kaem
     +> M2-Planet --debug --architecture x86 -f lib/mes/globals.c -f lib/linux/x86-mes-m2/mini.c -f lib/mes/mini-write.c -f lib/string/strlen.c -f lib/string/strcpy.c -f lib/mes/eputs.c -f scaffold/global-array.c -o scaffold/global-array.M1
    scaffold/global-array.c:20:Received [ in program
    Subprocess error 256
    ABORTING HARD
    [1]12:32:06 janneke@dundal:~/src/mes/wip-m2 [env]

* scaffold/global-array.c: New file.
* scaffold/global-array.kaem: New file.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen 9c0ff7b123
doc: Add test hints to `HACKING'.
* HACKING (TESTING): New section.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen 8fe33921a3
Revert "Mes C Library: m2/execve.c: Remove specialization."
This fixes

    gcc-lib/libc+gnu.c: At top level:
    gcc-lib/libc+gnu.c:2694:1: error: conflicting types for ‘execve’
     execve (char const *file_name, char **argv, char **env)
     ^~~~~~
    In file included from gcc-lib/libc+gnu.c:492:0:
    include/unistd.h:66:5: note: previous declaration of ‘execve’ was here
     int execve (char const *file, char *const argv[], char *const env[]);
         ^~~~~~

This reverts commit 828c27a073.
2022-05-01 22:58:48 +02:00
Jan (janneke) Nieuwenhuizen e34355f290
bootstrap: Update M2-Planet x86 definitions from 1.7.0-31-g358b6cf.
* lib/m2/x86/x86_defs.M1: Update.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen 41223ffbf4
guix: m2-planet: Update to 1.7.0-31-g358b6cf.
* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0-31-g358b6cf.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen 3073642e4b
Revert "Mes C Library: m2/getcwd.c: Remove specialization."
This reverts commit 37f44ce945.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen 60b9e0785c
core: Move __getcwd_buf to Mes C Library.
* include/mes/mes.h (__getcwd_buf): Move to..
* lib/posix/getcwd.c (__getcwd_buf): ...here.
(getcwd): Refactor.
* src/posix.c (getcwd_): Do not use __getcwd_buf.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen ba188efc8d
bootstrap: Support building with M2-Planet 1.4.
* lib/m2/x86/x86_defs.M1 (NOP): New define.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen 92deedf55c
mescc: Only use signed division when numerator is signed.
Currently, sign-extension (CLTD vs XOR EDX) and signed division (IDIV vs
DIV) selected by setting "signed?".  See, module/mescc/x86/as.scm.
Possibly we need a signed? based on numerator and denominator, and
add a extend-sign? based on the signedness of the numerator?

* module/mescc/compile.scm (expr->register): Base "signed?" strictly on
signedness of numerator.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen 42845aadf6
mescc: Use unsigned type for sizeof expression.
* module/mescc/compile.scm (ast->type): Use unsigned type for sizeof
expression.
2022-05-01 22:58:47 +02:00
Jan (janneke) Nieuwenhuizen ae3c72dac5
mescc: Respect integer literal type suffixes.
* module/mescc/compile.scm (ast->type): Respect ULL, UL, U, LL, L suffix
on integer literals.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen 7a438c4757
core: Use unsigned constants.
* src/gc.c (FRAME_SIZE, M2_CELL_SIZE): Declare unsigned.
(gc_init): Use unsigned suffixes for divisions.
* src/posix.c (TIME_UNITS_PER_SECOND): Declare unsigned.
(UL1000000000): New constant.
(seconds_and_nanoseconds_to_long): Use it.
* src/gc.c (U10, U100): New constants.
(gc_init): Use them.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen 58dce4d34a
core: Use size_t instead of long for gc sizes.
* include/mes/mes.h (ARENA_SIZE, MAX_ARENA_SIZE, STACK_SIZE, JAM_SIZE,
GC_SAFETY, MAX_STRING): Use size_t instead of long.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen f612861cd8
core: Avoid Floating point exception dividing negative numbers.
* src/posix.c (seconds_and_nanoseconds_to_long): Use unsigned division.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen 9dde43c320
core: Avoid Floating point exception dividing negative numbers.
This fixes

    kaem --verbose --strict
    bin/mes-m2 -c '(display (modulo -1 -1))'

* src/math.c (modulo): Use unsigned division.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen 734d69c491
bootstrap: Use ./pre-inst-env mescc default.
* configure.sh: When CC is mescc, M2-Planet or unset, use
"./pre-inst-env mescc" as default.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen cfa43e2a17
tests: string-join: Be noisy.
* scaffold/boot/50-string-join.scm ("string-join\n"): Avoid exit 0
without output.
2022-05-01 22:58:46 +02:00
Jan (janneke) Nieuwenhuizen b4a57cbbf1
mes: simple-format: Use core display.
* mes/module/mes/simple-format.mes: Do not import (mes display).
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen c4e40b8a7a
mes: Resurrect backtraces.
* mes/module/mes/catch.mes (%eh): Resurrect backtraces.
(display-frame): New function.
(display-backtrace): Use it.
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen 4222d4b45d
core: Add abort.
* lib/stub/__raise.c: New file.
* kaem.run: Use it.
* src/posix.c (__raise)[SYSTEM_LIBC]: New macro.
 (abort_): New function: possibly use it.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen fe753c4a40
mes: Remove PEG.
PEG is not used and mostly broken.

* mes/module/mes/peg.mes,
mes/module/mes/peg/cache.scm,
mes/module/mes/peg/codegen.scm,
mes/module/mes/peg/simplify-tree.scm,
mes/module/mes/peg/string-peg.scm,
mes/module/mes/peg/using-parsers.scm,
tests/peg.test: Remove.
* AUTHORS: Remove mention.
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen 717aed496f
.dir-locals: Add test macro indentation.
* .dir-locals.el (scheme-mode): Add indentation for pass-if,
pass-if-not, pass-if-eq, pass-if-equal, expect-fail, pass-if-timeout.
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen 4d49b6af6d
mescc: Use (format (current-error-port) ...) instead of stderr.
* module/mescc/M1.scm: Use (format (current-error-port) ...) instead of
stderr.
* module/mescc/compile.scm: Likewise.
* module/mescc/mescc.scm: Likewise.
* module/mescc/preprocess.scm: Likewise.
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen bb9edf4605
core: Add gc-stats.
* include/mes/mes.h (gc_start_time, gc_end_time, gc_time): New
variables.
* src/mes.c (init): Initialize them.
* src/gc.c: Use them.
* src/gc.c (gc_stats): New function.
* include/mes/builtins.h: Declare it.
* src/builtins.c (mes_builtins): Register it.
* tests/gc.test: Use it.
2022-05-01 22:58:45 +02:00
Jan (janneke) Nieuwenhuizen 7fc1614048
core: Avoid Floating point exception dividing negative numbers.
This fixes

    kaem --verbose --strict
    bin/mes-m2 -c '(display (/ -1 1))'

* src/math.c (divide): Use signed division.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen 2408220f2c
Mes C Library: m2/execve.c: Remove specialization.
* lib/linux/execve.c (execve): Cater for M2-Planet.
* lib/m2/execve.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen b63faffee0
Mes C Library: m2/getcwd.c: Remove specialization.
* lib/posix/getcwd.c (getcwd): Cater for M2-Planet.
* lib/m2/getcwd.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen eb4bdaa729
Mes C Library: m2/ioctl.c: Remove specialization.
* lib/stub/ioctl.c (ioctl3): Move to...
* lib/stub/ioctl3.c: ...new file.
* lib/m2/ioctl3.c: Move to...
* lib/linux/ioctl3.c: ...here.
* include/mes/lib.h (ioctl3): Declare it.
* lib/m2/isatty.c (isatty): Use it.
* build-aux/configure-lib.sh (libc_SOURCES): Include it; move
lib/linux/ioctl.c to ...
(libc_gnu_SOURCES): ... here.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES): Likewise.
* simple.sh (compiler): Likewise.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen 268a4dd7e3
Mes C Library: m2/ntoab.c: Remove specialization.
* lib/mes/ntoab.c (__mesabi_uldiv)[__M2_PLANET__ || !(__MESC__ &&
__arm__)]:  New function.
* lib/mes/ntoab.c (ntoab): Use it to cater for M2-Planet.
* lib/m2/ntoab.c: Remove.
* kaem.run: Update accordingly.
* simple.make (M2_SOURCES, (M2_TODO): Likewise.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen c84f88e446
build: Resurrect simple.sh.
* simple.sh: Do not attempt to build multiple C files with mescc.
Update for new and split C files.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen d667aab5bc
guix: m2-planet: Update to 1.7.0.
* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0.
[arguments]: Add CC to make-flags.  Update sha256sum patch.
2022-05-01 22:58:44 +02:00
Jan (janneke) Nieuwenhuizen 81a5f2afdb
guix: mescc-tools: Update to 1.1.0.
* guix/git/mes.scm (mescc-tools)[source]: Update to 1.1.0.
[arguments]: Update sha256sum patch.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen 6ac30c68d6
core: Prepare for M2-Planet 1.7.0.
* src/eval-apply.c (expand_variable_, apply_builtin): Declare variables
at toplevel.
* src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise.
* src/hash.c (hash_table_printer): Likewise.
* src/lib.c (equal2_p): Likewise.
* src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply,
logand, logior, logxor): Likewise.
* src/posix.c (current_input_port, execl_): Likewise.
* src/reader.c (reader_read_string): Likewise.
* src/stack.c (make_stack): Likewise.
* src/string.c (list_to_cstring, bytes_to_list, string_append):
Likewise.
* src/struct.c (make_struct): Likewise.
* src/vector.c (vector_to_list): Likewise.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen b40bc2e745
mescc: Mes C Library: Prepare for M2-Planet 1.7.0.
* lib/m2/ntoab.c (ntoab): Declare variables at toplevel.
* lib/mes/abtol.c (abtol): Likewise.
* lib/posix/getenv.c (getenv): Likewise.
* lib/posix/setenv.c (setenv): Likewise.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen 29064b8b2d
mescc: Mes C Library: isatty: Use fixed array size for M2-Planet.
* lib/m2/isatty.c (struct ktermios)[c_cc]: Hardcode to size 19.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen fed4444f96
mescc: Mes C Library: Update M2-Planet macros.
* lib/m2/x86/x86_defs.M1: Update from M2-Planet 1.7.0.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen 4110e82d58
mes: compatibility: Move (mes pmatch) to (system base pmatch).
* mes/module/system/base/pmatch.scm: Move from mes/pmatch.scm.  Update
users.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen 36e13334d7
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.
2022-05-01 22:58:43 +02:00
Jan (janneke) Nieuwenhuizen 99506b4dbc
build: Cater for M2-Planet.
* 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: Set stage0_cpu.  On x86, run kaem bootstrap.
Build bin/mes.  Update scripts and users.
* build-aux/install.sh.in: Install all built bin/mes-* flavours.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen a47e65e01c
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.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen 446ff8b055
guix: Add m2-planet.
* guix/git/mes.scm (m2-planet): New variable.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen f259412985
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.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen 14aedd5623
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/linux/malloc.c (malloc): Likewise.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen 35a82d5515
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.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen 59cd14e982
build: Update snarfer.
* build-aux/mes-snarf.scm (symbol->header): Update for pointer cells.
(snarf-symbols): Likewise.
(snarf-functions): Likewise.
2022-05-01 22:58:42 +02:00
Jan (janneke) Nieuwenhuizen ebb608ef85
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.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen a781708fda
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.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen 61ea06d2b3
core: gc: Abort upon broken heart failure.
* src/gc.c (gc_cellcpy, gc_loop): Abort upon broken heart failure.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen ebec3ce34c
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.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen 366ad5c816
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.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen 0026738794
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.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen 3032affd25
test/gc: Add three extra gc's.
* src/test/gc.c (test_gc): Add three extra gc's.
2022-05-01 22:58:41 +02:00
Jan (janneke) Nieuwenhuizen 31c20fb81b
test/gc: struct.
* src/test/gc.c (test_struct): New function.
(main): Call it.
2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen 6c3ff27de6
test/gc: vector.
* src/test/gc.c (test_vector): New function.
(main): Call it.
(print_arena): New function.
(test_gc): Call it.
2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen e79f898515
test/gc: string.
* src/test/gc.c (test_string): New function.
(main): Call it.
2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen 58f959ae8e
test/gc: list.
* src/test/gc.c (test_list): New function.
(main): Call it.
2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen 0c6c5fcc17
test/gc: cons. 2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen a50da8f059
test/gc: number.
* src/test/gc.c (test_number): New function.
(main): Call it.
2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen c3dacad7da
test/gc: empty.
* src/test/gc.c (test_empty): New function.
2022-05-01 22:58:40 +02:00
Jan (janneke) Nieuwenhuizen 669c376273
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen f76a12ae37
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen e4b24c27b1
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen d363f1fee3
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen 84dad8ec52
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen 43a8fa8cb1
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen ad5b1f5932
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.
2022-05-01 22:58:39 +02:00
Jan (janneke) Nieuwenhuizen 885e7d3948
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.
2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen 335c00147e
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.
2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen 41ce6dcce8
core: make_struct: Avoid creating garbage.
* src/struct.c (make_struct): Use STRUCT TYPE PRINTER FIELD0 ... FIELDN.
2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen e898234863
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.
2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen a626ae9a05
kaem.run 2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen 764f4fd170
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.
2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen 671ba4b21a
core: posix: Prepare for M2-Planet.
* src/posix.c (access_p): Prepare for M2-Planet.
2022-05-01 22:58:38 +02:00
Jan (janneke) Nieuwenhuizen 3034323fd8
mescc: Mes C Library: Add waitpid for M2-Planet.
* lib/m2/waitpid.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen 893d866d55
mescc: Mes C Library: Add time for M2-Planet.
* lib/m2/time.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen 7ded6103fc
mescc: Mes C Library: Add ntoab for M2-Planet.
* lib/m2/ntoab.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen 3a6e0dd9b0
mescc: Mes C Library: Add isatty for M2-Planet.
* lib/m2/isatty.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen 928c691145
mescc: Mes C Library: Add ioctl for M2-Planet.
* lib/m2/ioctl.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen fa4a212917
mescc: Mes C Library: Add getcwd for M2-Planet.
* lib/m2/getcwd.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen 59d6623ee6
mescc: Mes C Library: Add exit for M2-Planet.
* lib/m2/exit.c: New file.
2022-05-01 22:58:37 +02:00
Jan (janneke) Nieuwenhuizen c8ff5817be
mescc: Mes C Library: Add execve for M2-Planet.
* lib/m2/execve.c: New file.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen a3fd2c6dac
mescc: Mes C Library: Add execv for M2-Planet.
* lib/m2/execv.c: New file.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen ec7e0b30ac
mescc: Mes C Library: Add clock_gettime for M2-Planet.
* lib/m2/clock_gettime.c: New file.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen 41f1548636
mescc: Mes C Library: Add chmod for M2-Planet.
* lib/m2/chmod.c: New file.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen 4f173b7ceb
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.
* simple.make: Use them.  Remove macro preprocessing for M2-Planet.
* kaem.run: New file.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen d306a02c00
mescc: Mes C Library: Prepare for M2-Planet: realloc.
* lib/stdlib/realloc.c (realloc): Prepare for M2-Planet.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen f33bc20bc7
mescc: Mes C Library: Prepare for M2-Planet: fdputc.
* lib/mes/fdputc.c (fdputc): Prepare for M2-Planet.
2022-05-01 22:58:36 +02:00
Jan (janneke) Nieuwenhuizen 6e0ff69fc8
mescc: Mes C Library: Prepare for M2-Planet: unlink.
* lib/linux/unlink.c (unlink): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen e9eed6c996
mescc: Mes C Library: Prepare for M2-Planet: read.
* lib/linux/read.c (read): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen 11a2d8f60c
mescc: Mes C Library: Prepare for M2-Planet: gettimeofday.
* lib/linux/gettimeofday.c (gettimeofday): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen b1af20c691
mescc: Mes C Library: Prepare for M2-Planet: dup2.
* lib/linux/dup2.c (dup2): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen e1c5d7ef7a
mescc: Mes C Library: Prepare for M2-Planet: dup.
* lib/linux/dup.c (dup): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen 35db5aeefe
mescc: Mes C Library: Prepare for M2-Planet: clock_gettime.
* lib/linux/clock_gettime.c (clock_gettime): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen 640ba776e7
mescc: Mes C Library: Prepare for M2-Planet: chmod.
* lib/linux/chmod.c (chmod): Prepare for M2-Planet.
2022-05-01 22:58:35 +02:00
Jan (janneke) Nieuwenhuizen 8133ac3553
mescc: Mes C Library: Prepare for M2-Planet: access.
* lib/linux/access.c (access): Prepare for M2-Planet.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen 0a6df87427
mescc: Mes C Library: Prepare for M2-Planet: _getcwd.
* lib/linux/_getcwd.c (_getcwd): Prepare for M2-Planet.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen 08d198413a
core: Split-out stack.c
* src/lib.c (exit_, frame_printer, make_frame_type, make_frame,
make_stack_type, make_stack, stack_length, stack_ref_): Move to ..
* src/posix.c (exit_): Here and to ..
* src/core.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make (LIBMES_SOURCES): Likewise.
* build-aux/snarf.sh: Likewise.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen 05f1662c86
core: Split-out core.c.
* src/mes.c (assoc_string, car, cdr, list, null_p, eq_p, values, acons,
length__, length, error, append2, append_reverse, reverse_x_, assq,
assoc): Move to ...
* src/core.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make (MES_SOURCES): Likewise.
* build-aux/snarf.sh: Likewise.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen d20b96cd9c
mescc: Mes C Library: Bugfix __ungetc_clear.
* lib/m2/mes_open.c (mes_open): Remove __ungetc_init ();
* lib/m2/open.c (open): Likewise.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen 4f2d6302bd
kaem: scaffold/read.kaem.
* .gitignore: Update.
* include/linux/x86/syscall.h: Update for M2-Planet.
* lib/linux/brk.c (brk): Remove cast for M2-Planet.
* lib/linux/x86-mes-m2/syscall.c: New file.
* lib/m2/malloc.c: New file.
* lib/string/memset.c (memset): Update for M2-Planet.
* scaffold/read.c: Update for M2-Planet.
* scaffold/kaem.read: New file.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen 37ae5dc1fd
kaem: scaffold/argv.kaem.
* scaffold/argv.c (strcmp): Remove.
(main): Update.
* scaffold/argv.kaem: New file.
lib/x86-mes/x86.M1 (mov____%edi,%ebp, mov____%esp,%edi): New macro.
2022-05-01 22:58:34 +02:00
Jan (janneke) Nieuwenhuizen 92ab4b0f3a
kaem: scaffold/hello.kaem.
* include/m2/lib.h: New file.
* scaffold/hello.kaem: New file.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen aa8be292a8
kaem: scaffold/main.kaem.
* lib/linux/x86-mes-m2/crt1.c,
lib/linux/x86-mes-m2/crt1.M1,
lib/linux/x86-mes-m2/_exit.c,
lib/linux/x86-mes-m2/_write.c: New files.
* lib/m2/x86/x86_defs.M1: New file.  Import from stage0.
* lib/m2/x86/ELF-x86.hex2: New file.  Import from M2-Planet.
* scaffold/main.c: Update for M2-Planet.
* scaffold/main.kaem: New file.
* .gitignore: Update.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen 237333857f
core: Prepare for M2-Planet: if (foo).
Rewrite C-constructs not supported by M2-Planet

    if (foo)              -> if (foo != 0)

* src/posix.c: Rewrite C-constructs not supported by M2-Planet.
(current_input_port): Likewise.
* src/display.c (display_helper): : Likewise.
* src/eval-apply.c (expand_variable_): : Likewise.
(eval_apply): : Likewise.
* src/mes.c (open_boot): : Likewise.
* src/reader.c (reader_read_identifier_or_number): : Likewise.
* src/symbols.c (init_symbol): : Likewise.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen 05417d7659
core: Outline hashq_get_handle, hash_set_x_.
* src/hash.c (hashq_ref): Use hashq_get_handle.
(hashq_set_x_): Enable.
(hash_set_x): Use it.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen b5d5e6bc94
core: Prepare for M2-Planet: continue.
Rewrite C-constructs not supported by M2-Planet

    continue              -> goto LABEL

* src/eval-apply.c (eval_apply): Add label: begin_expand_while.  Use it
instead of continue.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen 497b37dd42
core: Prepare for M2-Planet: VALUE/TYPE indirections.
Rewrite C-constructs not supported by M2-Planet

    VALUE (CAR (foo))           -> SCM a = CAR (foo); VALUE (a)
    TYPE (CAR (foo))            -> SCM t = CAR (foo); TYPE (a)

* src/builtins.c (builtin_function): Use VALUE indirections.
(builtin_printer): Likewise.
* src/eval-apply.c (apply_builtin): Likewise.
(get_macro): Likewise.
(expand_variable_): Likewise.
(eval_apply): Likewise.
* src/hash.c (hashq_get_handle): Likewise.
(hashq_ref): Likewise.
(hash_ref): Likewise.
(hash_set_x): Likewise.
(hash_table_printer): Likewise.
* src/math.c (greater_p): Likewise.
(less_p): Likewise.
(is_p): Likewise.
(minus): Likewise.
(plus): Likewise.
(divide): Likewise.
(multiply): Likewise.
(logand): Likewise.
(logior): Likewise.
(logxor): Likewise.
* src/posix.c (current_input_port): Likewise.
(set_current_output_port): Likewise.
* src/reader.c (reader_read_list): Likewise.
(reader_read_character): Likewise.
(reader_read_string): Likewise.
* src/string.c (list_to_cstring): Likewise.
(read_string): Likewise.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen 201aef922a
core: Prepare for M2-Planet: M2_CELL_SIZE.
* src/gc.c (M2_CELL_SIZE): Hack for missing pointer arithmetic in
M2-Planet.
(gc_init, alloc, make_cell, gc_up_arena, gc_copy, gc_loop, gc_): Use it.
2022-05-01 22:58:33 +02:00
Jan (janneke) Nieuwenhuizen 858793a953
core: Use unique assert_msg.
* src/mes.c (error): Use unique assert_msg.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen 167c5d840b
core: read_string: Prepare for M2-Planet.
* src/string.c (read_string): Prepare for M2-Planet.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen 46d932581e
core: string_equal_p: Prepare for M2-Planet.
* src/string.c (string_equal_p): Prepare for M2-Planet.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen ef0291470d
core: reader_read_block_comment: Prepare for M2-Planet.
* src/reader.c (reader_read_block_comment): Prepare for M2-Planet.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen b320959731
core: reader_eat_whitespace: Prepare for M2-Planet.
* src/reader.c (reader_eat_whitespace): Prepare for M2-Planet.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen 28d5cb4865
core: reader_read_sexp_: Prepare for M2-Planet.
* src/reader.c (reader_read_sexp_): Prepare for M2-Planet.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen 4c64362805
core: reader_read_identifier_or_number: Prepare for M2-Planet.
* src/reader.c (reader_read_identifier_or_number): Prepare for M2-Planet.
2022-05-01 22:58:32 +02:00
Jan (janneke) Nieuwenhuizen cd2e932d80
core: open_output_file: Prepare for M2-Planet.
* src/posix.c (open_output_file): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen f427a9a54d
core: current_input_port: Prepare for M2-Planet.
* src/posix.c (current_input_port): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen 0c97f67f28
core: write_byte: Prepare for M2-Planet.
* src/posix.c (write_byte): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen bf44b167d4
core: read_char: Prepare for M2-Planet.
* src/posix.c (read_char): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen 972aa5d856
core: last_pair: Prepare for M2-Planet.
* src/lib.c (last_pair): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen 1af450321a
core: memq: Prepare for M2-Planet.
* src/lib.c (memq): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen 9d5a4a78cc
core: xassq: Prepare for M2-Planet.
* src/lib.c (xassq): Prepare for M2-Planet.
2022-05-01 22:58:31 +02:00
Jan (janneke) Nieuwenhuizen a2f69f721f
core: hash_cstring: Prepare for M2-Planet.
* src/hash.c (hash_cstring): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen 520dadc60b
core: eval_apply: Prepare for M2-Planet.
* src/eval-apply.c (eval_apply): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen 6e093bd6e4
core: apply_builtin: Prepare for M2-Planet.
* src/eval-apply.c (apply_builtin): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen 817430837c
core: formal_p: Prepare for M2-Planet.
* src/eval-apply.c (formal_p): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen 4e92422bdf
core: builtin_p: Prepare for M2-Planet.
* src/builtins.c (builtin_p): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen bdd84ac5c6
core: assoc: Prepare for M2-Planet.
* src/mes.c (assoc): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen 7ad95740b5
core: assq: Prepare for M2-Planet.
* src/mes.c (assq): Prepare for M2-Planet.
2022-05-01 22:58:30 +02:00
Jan (janneke) Nieuwenhuizen 59ab9a2444
core: eq_p: Prepare for M2-Planet.
* src/mes.c (eq_p): Prepare for M2-Planet.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 998644fcb6
core: assoc_string: Prepare for M2-Planet.
src/mes.c (assoc_string): Prepare for M2-Planet.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 3001645d26
build: Add pointer.sh.
* build-aux/pointer.sh: New script.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 5d499cb531
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.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 3a270ca346
core: gc: FRAME_SIZE.
* src/gc.c (gc_loop, gc_): Use FRAME_SIZE.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 2044609309
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.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen e0fe761ee8
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.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 888aaddf2f
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.
2022-05-01 22:58:29 +02:00
Jan (janneke) Nieuwenhuizen 989478f522
core: Prepare for conversion to pointer cells.
* src/posix.c (execl_): Prepare for conversion to pointer cells.
2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen 214630c2f8
core: Remove dead macros.
* include/mes/macros.h (CSTRING_STRUCT, START, LEN): Remove.
2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen 7baa9d7d08
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.
2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen 30b580915e
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.
2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen a65ac3154b
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.
2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen 723b25a2ac
core: Refactor display. 2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen 6d761e812b
core: Upcase register names.
* include/mes/mes.h (R0, R1, R2, R3, M0): Rename from lower case.
Update users.
2022-05-01 22:58:28 +02:00
Jan (janneke) Nieuwenhuizen b56ba5d954
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.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 45a25ee36f
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.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 8c95e3da56
core: eval-apply: Fix formal_p.
* src/eval-apply.c (formal_p): Return boolean.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 530b7e2260
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.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 2bbf1579b2
build: Update mes-snarf.
* build-aux/snarf.sh: Support C-style annotations.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 07fb20f172
mescc: Mes C Library: Prepare for M2-Planet: setenv.
* lib/posix/setenv.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen 938f154fdc
mescc: Mes C Library: Prepare for M2-Planet: getenv.
* lib/posix/getenv.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:27 +02:00
Jan (janneke) Nieuwenhuizen e3763a312e
mescc: Mes C Library: Prepare for M2-Planet: ntoab.
* lib/mes/ntoab.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen cc6d0b10d4
mescc: Mes C Library: Prepare for M2-Planet: malloc.
* lib/stdlib/malloc.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen e6d06cc63a
mescc: Mes C Library: Prepare for M2-Planet: fdungetc.
* lib/mes/fdungetc.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen 2ab42f7d10
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.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen b959a02a19
mescc: Mes C Library: Prepare for M2-Planet: fdgetc.
* lib/mes/fdgetc.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen 4181c4afdc
mescc: Mes C Library: Prepare for M2-Planet: abtol.
* lib/mes/abtol.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen c1d006ce17
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.
2022-05-01 22:58:26 +02:00
Jan (janneke) Nieuwenhuizen 78e0b21570
mescc: Mes C Library: Prepare for M2-Planet: memcmp.
* lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 17b6ad893a
mescc: Mes C Library: Prepare for M2-Planet: memcpy.
* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 7ea8fc60b5
mescc: Mes C Library: Prepare for M2-Planet: memchr.
* lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 586fb79985
mescc: Mes C Library: Prepare for M2-Planet: strncmp.
* lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen e4bb357e99
mescc: Mes C Library: Prepare for M2-Planet: strlen.
* lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 2a0799975b
mescc: Mes C Library: Prepare for M2-Planet: strcpy.
* lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 1d8c0a5f1c
mescc: Mes C Library: Prepare for M2-Planet: strcmp.
* lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet.
2022-05-01 22:58:25 +02:00
Jan (janneke) Nieuwenhuizen 92f8f05a4b
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.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 4b65ece428
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.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen a2f76f9b16
mescc: Mes C Library: Add assert_msg.
* lib/mes/assert_msg.c: New file.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen ed2cd8ccfa
core: Prepare for M2-Planet: vector.c.
* src/vector.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen cd563a96e5
core: Prepare for M2-Planet: struct.c.
* src/struct.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 31ea016b94
core: Prepare for M2-Planet: string.c.
* src/string.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 96c8651733
core: Prepare for M2-Planet: reader.c.
* src/reader.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:24 +02:00
Jan (janneke) Nieuwenhuizen 64ef3b8fe9
core: Prepare for M2-Planet: posix.c.
* src/posix.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 6ae9b88237
core: Prepare for M2-Planet: module.c.
* src/module.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen b12e7e895a
core: Prepare for M2-Planet: math.c.
* src/math.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 9a4aea5e29
core: Prepare for M2-Planet: lib.c.
* src/lib.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen e29844e6a0
core: Prepare for M2-Planet: hash.c.
* src/hash.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 5b2e3d2422
core: Prepare for M2-Planet: gc.c.
* src/gc.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 802ce1569b
core: Prepare for M2-Planet: builtins.c.
* src/builtins.c: Rewrite C constructs not supported by M2-Planet.
2022-05-01 22:58:23 +02:00
Jan (janneke) Nieuwenhuizen 8040a57a06
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.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen a359b0bf9f
build: Run indent for M2.
* src/gc.c: Indented.
* src/string.c: Likewise.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen d72833502c
build: mes-snarf.scm: Resurrect.
* build-aux/mes-snarf.scm (snarf-functions): Strip whitespace from
parameter list.
(function->source): Use function-scm-name, add (function1_t).
* build-aux/snarf.sh: Resurrect, combined dump to s, h, c.
* include/mes/builtins.h:
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen f884f44e7c
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/configure-lib.sh (mes_SOURCES): Add it.
* build-aux/snarf.sh: Likewise.
* build-aux/build-mes.sh (mes_sources): Remove.  Include
configure-lib.sh
* 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.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen a9370eb25a
build: simple.make.
* simple.make: New file.
* src/posix.c: Make sure to define EOF.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen d81acf49be
tests: Add gc.test.
* tests/gc.test: New file.
* build-aux/check-mes.sh (TESTS): Add it.
* scaffold/gc-test.scm: Remove.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen d2c8924316
mescc: Update to mescc-tools-1.0.0 option names.
* module/mescc/mescc.scm (M1->hex2):  Update to use --little-endian.
(hex2->elf): Likewise, and --base-address.
* module/mescc/mescc.scm (hex2->elf): Likewise, and remove
--exec_enable.
(M1->blood-elf): Add --little-endian.
2022-05-01 22:58:22 +02:00
Jan (janneke) Nieuwenhuizen 5554dea204
build: Update to mescc-tools-1.0.0 option names.
* build-aux/build-scaffold.sh: Update to use --base-address and
--little-endian.
* doc/mes.texi (Regular Requirements): Bump mescc-tools to 1.0.1.
(Bootstrap Requirements): Likewise.  Bump nyacc to 1.00.2.
* INSTALL (Other GNU/Linux): Bump mescc-tools to 1.0.1.
(Prerequisites): Likewise.  bump nyacc to 1.00.2.
2022-05-01 22:58:21 +02:00
Jan (janneke) Nieuwenhuizen c9ca4a0c79
guix: mescc-tools: Update to 1.0.1.
* guix/git/mes.scm (mescc-tools)[source]: Update to 1.0.1.
2022-05-01 22:58:21 +02:00
122 changed files with 673 additions and 1463 deletions

19
.gitignore vendored
View File

@ -1,21 +1,3 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2016,2017,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
# GNU Mes is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# GNU Mes is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*-
*~
.#*
@ -135,7 +117,6 @@
/doc/images/gcc-mesboot-graph.pdf
/doc/web/
/config.sh
/include/arch
/include/mes/config.h
/gcc-lib
/mescc-lib

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

35
HACKING
View File

@ -5,8 +5,7 @@
guix shell #64 bit + 32bit
CC=i686-unknown-linux-gnu-gcc ./configure
CC=arm-unknown-linux-gnueabihf-gcc ./configure
CC=arm-unknown-linux-gnu-gcc ./configure
or
./configure
@ -130,30 +129,30 @@ x/s *((char **)($rsp+8))
** C parser/compiler
*** [[https://savannah.gnu.org/projects/nyacc][nyacc]]
*** PEG: [[https://piumarta.com/software/peg/][parse C using PEG]]
*** PEG: [[http://piumarta.com/software/peg/][parse C using PEG]]
*** [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
*** [[https://www.t3x.org/subc/index.html][Sub C]]
*** [[http://www.t3x.org/subc/index.html][Sub C]]
*** [[https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE][C intepreter in LISP/Scheme/Python]]
** C assembler/linker
*** [[https://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
*** [[http://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
*** ELF
7f 45 4c 46
*** [[https://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
*** [[https://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
*** [[http://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
*** [[http://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
** SC - c as s-expressions
sc: https://sph.mn/content/3d3
sc: http://sph.mn/content/3d3
** RNRS
*** [[https://www.scheme-reports.org/][Scheme Reports]]
*** [[http://www.scheme-reports.org/][Scheme Reports]]
*** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf][Scheme - Report on Scheme]]
*** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf][RRS - Revised Report on Scheme]]
** tiny schemes
https://forum.osdev.org/viewtopic.php?f=15&t=19937
http://forum.osdev.org/viewtopic.php?f=15&t=19937
https://www.stripedgazelle.org/joey/dreamos.html
https://armpit.sourceforge.net/
https://common-lisp.net/project/movitz/movitz.html
http://www.stripedgazelle.org/joey/dreamos.html
http://armpit.sourceforge.net/
http://common-lisp.net/project/movitz/movitz.html
<civodul> janneke: https://github.com/namin/inc looks interesting [15:18]
** Orians Jeremiah
@ -170,13 +169,13 @@ https://common-lisp.net/project/movitz/movitz.html
<janneke> OriansJ: i looked a few times and saw 'LISP empty', so thanks for
the pointer! [00:24]
<civodul> OriansJ, janneke: from that page, there's also:
https://web.archive.org/web/20160604035203fw_/https://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html
https://web.archive.org/web/20160604035203fw_/http://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html
** C4/C500
https://web.archive.org/web/20160604041431/https://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c
https://web.archive.org/web/20160604041431/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c
https://github.com/rswier/c4/blob/master/c4.c
** Compilers for free
https://codon.com/compilers-for-free
http://codon.com/compilers-for-free
** Small lisps
*** [[https://www.mirrorservice.org/sites/www.bitsavers.org/bits/TI/Explorer/zeta-c/][ZETA-C]]
** Small C compilers
@ -188,10 +187,10 @@ simple as possible.
*** pcc
*** early GCC?
https://miyuki.github.io/2017/10/04/gcc-archaeology-1.html
*** [[https://tack.sourceforge.net/][ack]]
*** [[http://tack.sourceforge.net/][ack]]
<rain1> it may be possible to compile like this: mes |> ack |> pcc |> tcc |>
gcc 4.7.4 |> gcc later version... up to modern
*** [[https://web.archive.org/web/20160402225843/https://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]]
*** [[https://web.archive.org/web/20160402225843/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]]
** rain1's Bootstrapping Wiki: https://bootstrapping.miraheze.org/wiki/Main_Page
** rain1's hex86
https://notabug.org/rain1/hex86/src/master/tests/hex0b3.hex86

View File

@ -26,8 +26,8 @@ similar way.
#+END_SRC
*** Other GNU/Linux
- [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.4.0 is known to work.
- [[https://github.com/oriansj/m2-planet][M2-Planet]] (optional), 1.9.0 is known to work.
- [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.0.1 is known to work.
- [[https://github.com/oriansj/m2-planet][M2-Planet]] (optional), 1.8.0 is known to work.
- [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 1.00.2 is known to work.
- GNU Gcc, 7.5.0 is known to work.
- GNU Guile, version 3.0.4 is know to work.
@ -79,8 +79,8 @@ The bootstrap build is part of Guix, see
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm
** Prerequisites
- [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.4.0 is known to work.
- [[https://github.com/oriansj/m2-planet][M2-Planet]], 1.9.0 is known to work.
- [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.0.1 is known to work.
- [[https://github.com/oriansj/m2-planet][M2-Planet]], 1.8.0 is known to work.
- [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 1.00.2 is known to work.
** Build it

42
NEWS
View File

@ -2,7 +2,7 @@
#+TITLE: GNU Mes NEWS history of user-visible changes
#+STARTUP: content hidestars
Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -10,32 +10,6 @@ Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <jan
Please send Mes bug reports to bug-mes@gnu.org.
* Changes in 0.24.2 since 0.24.1
** Build
*** A number of compile warnings have been fixed.
*** The `simple.make' and `simple.sh' builds have been resurrected.
** MesCC
*** Some assembly defines were added for building TinyCC for x86_64.
*** `__assert_fail' has been updated to use the standard signature.
** Noteworthy bug fixes
*** A bootstrap build without M2-Planet is now supported again.
*** `gettimeofday' no longer segfaults in the M2-Planet build.
*** `stat64' and friends are now used on 32bit platforms.
This fixes https://debbugs.gnu.org/41264, and should also fix
https://debbugs.gnu.org/49985,
https://debbugs.gnu.org/53415,
https://debbugs.gnu.org/53416.
*** The Mes C Library now supports uppercase hex conversions.
* Changes in 0.24.1 since 0.24
** Build
*** Support M2-Planet bootstrap for ARM.
** MesCC
*** The Mes C Library now supports bootstrapping ARM.
** Noteworthy bug fixes
*** The definition of S_ISUID was fixed.
*** Unsigned modulo has been fixed for ARM.
*** A bug with abtol has been fixed.
*** Workarounds for building with gcc-12.2.0 have been added.
* Changes in 0.24 since 0.23
** Core
*** Mes and Mes C Library can now be built with M2-Planet.
@ -50,20 +24,6 @@ Next to `U', also support `ULL', `UL', `L', and `LL'.
*** Development build support with Guile-2 was resurrected.
*** The logand procedure now works correctly.
*** The 64bit build was resurrected.
* Changes in 0.23.1 since 0.23
** Build: Move to libera.chat.
** Core
*** Mes and Mes C Library can now support ARM bootstrap.
** MesCC
*** MesCC now supports ARM bootstrap.
** Noteworthy bug fixes
*** Stack frame 0 does not perform out of bounds access.
*** MesCC's -m64 works again.
*** Guile-2 support has been resurrected.
*** logand has been fixed.
*** Mes C Library now supports more than 255 command line parameters.
* Changes in 0.23 since 0.22
** Core
*** Mes and Mes C Library can now be built with GCC 10.x.

View File

@ -22,7 +22,7 @@ to your config.scm and run guix system reconfigure.
For example (note: ARM is no longer a 'port', see HACKING)
#+BEGIN_SRC bash
guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git guile gzip help2man make mescc-tools nyacc openssh-sans-x pkg-config sed tar texinfo
guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain@7 grep git guile@2.2 gzip help2man make mescc-tools nyacc openssh-sans-x pkg-config sed tar texinfo
#+END_SRC
** Try it

8
README
View File

@ -6,8 +6,8 @@
[[https://www.gnu.org/software/mes][GNU Mes]] is a Scheme interpreter and C compiler for bootstrapping the GNU
System. Since version 0.22 it has again helped to halve the size of
opaque, uninspectable binary seeds that are currently being used in the
[[https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25][Further Reduced Binary Seed bootstrap]] of [[https://www.gnu.org/software/guix][GNU Guix]]. The final goal is to
help create a full-source bootstrap as part of the [[https://bootstrappable.org][bootstrappable builds]]
[[https://guix.gnu.org/blog/2019/guix-reduces-bootstrap-seed-by-50/][Reduced Binary Seed bootstrap]] of [[https://www.gnu.org/software/guix][GNU Guix]]. The final goal is to help
create a full source bootstrap as part of the [[http://bootstrappable.org][bootstrappable builds]]
effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
@ -25,7 +25,7 @@ Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes is inspired by The Maxwell Equations of Software: [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf][LISP-1.5]] -- John
Mes is inspired by The Maxwell Equations of Software: [[http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf][LISP-1.5]] -- John
McCarthy page 13, GNU Guix's source/binary packaging transparency and
Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]] ~500 byte self-hosting hex assembler.
@ -76,7 +76,7 @@ General Public Licence version 3 or later. See the file [[file:COPYING][COPYING
[7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
[8] https://www.nongnu.org/nyacc
[9] https://gitlab.com/janneke/tinycc
[10] [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf]]
[10] [[http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf]]
[11] https://savannah.nongnu.org/projects/stage0
[12] https://nlnet.nl/project/GNUMes
[13] https://nlnet.nl/project/GNUMes-arm

14
ROADMAP
View File

@ -1,7 +1,7 @@
-*- org -*-
#+TITLE: Tentative GNU Mes Road Map
Copyright © 2016,2017,2018,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -23,15 +23,13 @@ on Libera Chat!
* TODO
** release 0.x, unsorted
- Full Guile module support.
- Run Gash and Gash-Utils on Mes.
- Remove Guile as a dependency for the Guix Full Source Bootstrap.
- Integrate Full Source bootstrap for ARM on GNU Guix;
see branch wip-aarch64-bootstrap.
- Integrate Reduced Binary Seed bootstrap for ARM on GNU Guix;
see branch wip-arm-bootstrap.
- Introduce the Reduced Binary Seed bootstrap to NixOS (Debian,
Arch, Gentoo, ...?).
- Full Source Bootstrap:
+ compile mes.c using M2-Planet; see branch wip-m2,
+ integrate into GNU Guix; see branch wip-full-source-bootstrap.
- Full Guile-compatible module support; see branch wip-module.
- RISC-V support: Mes C Library and MesCC.
- AArch64 support: Mes C Library and MesCC.
@ -66,10 +64,6 @@ on Libera Chat!
https://srfi.schemers.org/srfi-72/srfi-72.html, or
+ ... drop it?
* DONE
- 0.24: Full Source Bootstrap:
+ integrate into GNU Guix; see branch wip-full-source-bootstrap.
- 0.23 Full Source Bootstrap:
+ compile mes.c using M2-Planet; see branch wip-m2,
- GNU Mes now supports building Tiny CC on ARM.
- Merge the Scheme-only bootstrap which uses Gash and Gash Core
Utilities to remove from bootstrap-binary seed : Awk, Bash, Core

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -85,26 +85,17 @@ PHONY_TARGETS:=\
.PHONY: $(PHONY_TARGETS)
X86_ARCH_HEADERS = $(wildcard $(scrdest)include/linux/x86/*.h)
ARCH_HEADERS = $(X86_ARCH_HEADERS:$(srcdest)include/linux/x86/%=include/arch/%)
default: all
all: doc
doc: build
build: | $(ARCH_HEADERS)
build:
$(SHELL) build.sh
src/${program_prefix}mes: build
include/arch/%.h: $(srcdest)include/$(mes_kernel)/$(mes_cpu)/%.h | arch-dir
cp -f $< $@
arch-dir:
mkdir -p include/arch
clean:
rm -f *.o *.s bin/mes bin/mes-gcc bin/mes-mescc
rm -f mes.{aux,cp,cps,fn,info,log,tmp,toc,vr,vrs}
@ -270,16 +261,6 @@ WEB_IMAGES:=\
web: info $(WEB_IMAGES)
GENDOCS_TEMPLATE_DIR=doc build-aux/gendocs.sh -I doc -s ${srcdest}doc/mes.texi -o doc/web/manual --email bug-mes@gnu.org mes "GNU Mes manual"
SITE = /srv/mes.org
publish: web
rsync -P -v . $(SITE)/
rsync -P -v . $(SITE)/manual/
rsync -P -rvz doc/web/manual/ $(SITE)/manual/
LOCAL_SITE = $(HOME)/src/web/mes
publish-local: web
$(MAKE) publish SITE=$(LOCAL_SITE)
### dist
COMMIT=$(shell test -e ${srcdest}.git && (cd ${srcdir} && git describe --dirty 2>/dev/null) || cat ${srcdest}.tarball-version)
TARBALL_VERSION=$(COMMIT:v%=%)
@ -301,10 +282,7 @@ GIT_LS_FILES:=find
MTIME:=0
endif
check-signature:
git show HEAD --show-signature |grep 'gpg: Good signature'
dist: check-signature $(TARBALL)
dist: $(TARBALL)
sign-dist: $(TARBALL)
gpg -a --output $(TARBALL).sig --detach-sig $(TARBALL)
@ -357,28 +335,22 @@ tag:
# 1. Tag for release
# make tag VERSION=0.23
# 2. Create signed tarball
# ./configure
# make sign-dist
# 3. Update Guix package description
# make release
# - make release
# 4. Finish announcement
# - make sum-announce
# - Update doc/announce/ANNOUNCE-0.23
# - doc: Post-release update.
# - build-aux/GNUMakefile.in: gen-announce: update previous-version
# 5. Verify
# - Update package in Guix master.
# - If applicable, verify bootstrap.
# 6. Upload to ftp.gnu.org
# 7. Update web
# - make publish-local
# - Update ~/src/web/mes/index.html
# - Upload: cvs ci
# 8. Create blog post
# 7. Create blog post
# cp doc/announce/ANNOUNCE-0.23 ~/src/web/joyofsource.com/posts/announce-0.23.md
# fix urls and all
# 9. Send mail
# 8. Send mail
# To: info-gnu@gnu.org
# Cc: bug-mes@gnu.org
# Cc: guix-devel@gnu.org
# Cc: bootstrappable@freelists.org
# Cc: rb-general@lists.reproducible-builds.org
@ -386,7 +358,7 @@ tag:
guix-build:
./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL)
release: check-signature update-hash
release: update-hash
git commit -m 'guix: mes: Update to $(VERSION).' \
-m '* guix/git/mes.scm (mes)[source]: Update to $(VERSION).' \
guix/git/mes.scm
@ -398,20 +370,13 @@ gen-announce:
$(GEN_ANNOUNCE) \
--release-type=beta \
--package-name=mes \
--previous-version='0.24.1' \
--previous-version='0.23 ' \
--current-version=$(VERSION) \
--gpg-key-id=$(GPG_KEY_ID) \
--url-directory=https://ftp.gnu.org/gnu/mes \
--news=NEWS \
> doc/announce/ANNOUNCE-$(VERSION)
sum-announce:
sed -i \
-e "s, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(PACKAGE)-$(VERSION).tar.gz, $(shell sha256sum $(PACKAGE)-$(VERSION).tar.gz)," \
-e "s, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(PACKAGE)-$(VERSION).tar.gz, $(shell sha1sum $(PACKAGE)-$(VERSION).tar.gz)," \
-e "s, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(PACKAGE)-$(VERSION).tar.gz, $(shell md5sum $(PACKAGE)-$(VERSION).tar.gz)," \
doc/announce/ANNOUNCE-$(VERSION)
installdirs: mkinstalldirs
mkdir -p\
$(DESTDIR)$(bindir)\

View File

@ -50,7 +50,7 @@ srcdest=../${srcdest}
ln -sf ${srcdest}mes .
ln -sf ${srcdest}module .
ln -sf ${srcdest}src .
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
AM_CFLAGS="-L ${srcdest}lib"
mkdir -p $mes_cpu-mes
@ -108,7 +108,7 @@ $AR crD $mes_cpu-mes/libc+tcc.a $objects
cd ..
srcdest=
AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu"
AM_CFLAGS="-L ${srcdest}lib"
objects=

View File

@ -64,6 +64,16 @@ if test -e libc+tcc.s; then
cp libc+tcc.s $mes_cpu-mes
fi
if $courageous; then
exit 0
fi
archive libc+gnu.a $libc_gnu_SOURCES
cp libc+gnu.a $mes_cpu-mes
if test -e libc+gnu.s; then
cp libc+gnu.s $mes_cpu-mes
fi
archive libtcc1.a $libtcc1_SOURCES
cp libtcc1.a $mes_cpu-mes
if test -e libtcc1.s; then
@ -75,13 +85,3 @@ cp libgetopt.a $mes_cpu-mes
if test -e libgetopt.s; then
cp libgetopt.s $mes_cpu-mes
fi
if $courageous; then
exit 0
fi
archive libc+gnu.a $libc_gnu_SOURCES
cp libc+gnu.a $mes_cpu-mes
if test -e libc+gnu.s; then
cp libc+gnu.s $mes_cpu-mes
fi

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -29,7 +29,6 @@ fi
. ./config.sh
. ${srcdest}build-aux/trace.sh
. ${srcdest}build-aux/cflags.sh
if $courageous; then
set +e
@ -43,6 +42,25 @@ else
}
fi
case "$mes_cpu" in
arm)
stage0_arch=40
stage0_cpu=armv7l
;;
x86_64)
stage0_arch=2
stage0_cpu=amd64
;;
x86)
stage0_arch=1
stage0_cpu=x86
;;
*)
stage0_arch=1
stage0_cpu=$mes_cpu
;;
esac
trace "CCLD ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/exit-42.S" $CC\
-nostdlib\
-g\
@ -66,6 +84,7 @@ trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.h
--base-address 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\
--exec_enable\
-o 0exit-42
trace "TEST 0exit-42"
@ -80,6 +99,7 @@ trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\
--exec_enable\
-o body-exit-42
trace "TEST body-exit-42"
@ -105,6 +125,7 @@ trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes
--base-address 0x1000000\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\
--exec_enable\
-o 0hello-mes
trace "TEST 0hello-mes"
@ -119,6 +140,7 @@ trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\
-f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\
--exec_enable\
-o body-hello-mes
trace "TEST body-hello-mes"

View File

@ -38,6 +38,25 @@ set -u
. ./config.sh
. ${srcdest}build-aux/cflags.sh
case "$mes_cpu" in
arm)
stage0_arch=40
stage0_cpu=armv7l
;;
x86_64)
stage0_arch=2
stage0_cpu=amd64
;;
x86)
stage0_arch=1
stage0_cpu=x86
;;
*)
stage0_arch=1
stage0_cpu=$mes_cpu
;;
esac
if $courageous; then
echo "Applying courage"
set +e
@ -66,8 +85,9 @@ fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I include
-I ${srcdest}include
-I ../include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test $mes_kernel = gnu; then
AM_CPPFLAGS="$AM_CPPFLAGS
@ -92,17 +112,16 @@ fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I ${srcdest}include
-I ../include
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
if test "$compiler" != bootstrap; then
${SHELL} ${srcdest}build-aux/build-mes.sh
fi
)
if test -n "$M2_PLANET" && (test "$mes_cpu" == "x86" \
|| test "$mes_cpu" == "arm"); then
if test -n "$M2_PLANET"; then
(
. ${srcdest}build-aux/trace.sh
if [ -z "$V" -o "$V" = 0 ]; then
@ -136,9 +155,9 @@ fi
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}lib
-I ${srcdest}include
-I ../include
-I include
-I ${srcdest}include
-I ${srcdest}include/$mes_kernel/$mes_cpu
"
compiler=mescc
AR=${MESAR-"${srcdest}pre-inst-env mesar"}
@ -150,7 +169,6 @@ fi
${SHELL} ${srcdest}build-aux/build-lib.sh
${SHELL} ${srcdest}build-aux/build-source-lib.sh
if $bootstrap; then
rm -f globals.* # FIXME: avoid name clash with globals from lib
${SHELL} ${srcdest}build-aux/build-mes.sh
cp -f bin/mes-mescc ../bin
cp -f bin/mes ../bin

View File

@ -1,5 +1,5 @@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -16,25 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
case "$mes_cpu" in
arm)
stage0_arch=40
stage0_cpu=armv7l
;;
x86_64)
stage0_arch=2
stage0_cpu=amd64
;;
x86)
stage0_arch=1
stage0_cpu=x86
;;
*)
stage0_arch=1
stage0_cpu=$mes_cpu
;;
esac
AM_CPPFLAGS="
-D HAVE_CONFIG_H=1
-I ${srcdest}include

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -117,7 +117,6 @@ lib/tests/scaffold/54-argv.c
lib/tests/scaffold/55-char-array.c
lib/tests/scaffold/60-math.c
lib/tests/scaffold/60-math-itoa.c
lib/tests/scaffold/60-math-modulo.c
lib/tests/scaffold/61-array.c
lib/tests/scaffold/62-array.c
lib/tests/scaffold/63-struct.c

View File

@ -1,7 +1,7 @@
#! @SHELL@
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -99,7 +99,6 @@ mkdir -p $DESTDIR$includedir
mkdir -p $DESTDIR$libdir
mkdir -p $DESTDIR$pkgdatadir
tar -cf- -C ${srcdir}/include . | tar -${v}xf- -C $DESTDIR$includedir
tar -cf- -C include . | tar -${v}xf- -C $DESTDIR$includedir
tar -cf- -C ${srcdir}/lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
tar -cf- -C ${srcdir}/lib $mes_kernel/$mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir
if test -z "$srcdest"; then

22
configure vendored
View File

@ -4,7 +4,7 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
!#
;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Vagrant Cascadian <vagrant@reproducible-builds.org>
;;;
;;; configure: This file is part of GNU Mes.
@ -37,7 +37,7 @@ MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)'
(define PACKAGE "mes")
(define PACKAGE-NAME "GNU Mes")
(define PACKAGE-BUGREPORT "bug-mes@gnu.org")
(define VERSION "0.24.2")
(define VERSION "0.24")
(cond-expand
(guile)
@ -454,11 +454,11 @@ Some influential environment variables:
(deps (fold (lambda (program results)
(cons (check-program-version program) results))
'()
(list (make-dep "hex2" #:version '(1 4 0))
(make-dep "M1" #:version '(1 4 0))
(make-dep "blood-elf" #:version '(2 0 0))
(make-dep "kaem" #:version '(1 0 0) #:optional? #t)
(list (make-dep "kaem" #:version '(0 6) #:optional? #t)
(make-dep "M2-Planet" #:version '(1 9 0) #:optional? #t)
(make-dep "hex2")
(make-dep "M1")
(make-dep "blood-elf")
(make-dep "diff" #:optional? #t)
(make-dep "guile" #:version '(2 0) #:commands '("guile-3.0" "guile-3" "guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t)
(make-dep "mes" #:version '(0 22) #:optional? #t)
@ -494,7 +494,6 @@ Some influential environment variables:
(file-name "cc" deps)
(file-name "cc-v" deps)
(file-name "mescc" deps)))
(m2-planet (file-name "M2-Planet" deps))
(deps (if cc
(cons* (check-header-c cc (make-dep "limits.h"))
(check-header-c cc (make-dep "stdio.h" #:optional? #t))
@ -630,7 +629,7 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
("@AR@" . ,(or (file-name "ar" deps) ""))
("@BASH@" . ,bash)
("@CC@" . ,(or cc ""))
("@CC@" . ,cc)
("@DIFF@" . ,(or (file-name "diff" deps) (string-append abs-top-builddir "/pre-inst-env diff.scm")))
("@DOT@" . ,(or (file-name "dot" deps) ""))
("@GIT@" . ,(or (file-name "git" deps) ""))
@ -707,13 +706,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
#define MES_VERSION \"" VERSION "\"
")))))
(substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make"))
(let ((arch-dir (string-append srcdest "include/" mes-kernel "/" mes-cpu)))
(define (copy-header file-name)
(system* "cp" "-f" "-v"
(string-append arch-dir "/" file-name)
(string-append "include/arch/" file-name)))
(system* "mkdir" "-p" "include/arch")
(for-each copy-header '("kernel-stat.h" "syscall.h")))
(let ((make (and=> (file-name "make" deps) basename)))
(display (string-append "

View File

@ -1,7 +1,7 @@
#! /bin/sh
# GNU Mes --- Maxwell Equations of Software
# Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
# Copyright © 2018,2019,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
#
# This file is part of GNU Mes.
#
@ -20,7 +20,7 @@
set -e
VERSION=0.24.2
VERSION=0.24
srcdir=${srcdir-$(dirname $0)}
srcdest=
if test "$srcdir" != "."; then
@ -77,8 +77,8 @@ GUILE=${GUILE-$(command -v guile)} || true
HEX2=${HEX2-$(command -v hex2)}
LDPFLAGS=${LDFLAGS-}
M1=${M1-$(command -v M1)}
M2_PLANET=${M2_PLANET-$(command -v M2-Planet)} || true
KAEM=${KAEM-$(command -v kaem)} || true
M2_PLANET=${M1-$(command -v M2-Planet)}
KAEM=${KAEM-$(command -v kaem)}
MES_FOR_BUILD=${MES_FOR_BUILD-$(command -v mes || command -v guile || echo mes)}
GIT=${GIT-$(command -v git)} || true
PERL=${PERL-$(command -v perl)} || true
@ -271,10 +271,6 @@ cat >> include/mes/config.h <<EOF
#define MES_VERSION "$VERSION"
EOF
mkdir -p include/arch
cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/kernel-stat.h include/arch
cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/syscall.h include/arch
cat <<EOF
GNU Mes is configured for
compiler: $compiler

View File

@ -10,15 +10,12 @@ Mes has now been ported to M2-Planet and can be bootstrapped using
stage0-posix[0], starting from the 357-byte hex0 binary of the
bootstrap-seeds[1], as was promised at FOSDEM'21[2].
Work to integrate this so-called "Full Source Bootstrap" is happening on
the wip-full-source-bootstrap[3] branch.
We are exciteda that the NlNet Foundation[4] is again sponsoring this
work!
What's next?
Work to integrate this so-called "Full Source Bootstrap" is happening on
the wip-full-source-bootstrap[3] branch. Also, full Guile compatible
module support, and RICS-V support.
Enjoy!
* About
@ -63,8 +60,11 @@ Enjoy!
Here are the SHA1 and SHA256 checksums:
f6681aa02edc6729af43f1d7c46ae1a97cbc1c92 mes-0.24.tar.gz
828be15e02c103df8a248232491fba10d763724d6ec10f08a2e0e1d249bd9902 mes-0.24.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.tar.gz
The SHA256 checksum is base64 encoded, instead of the
hexadecimal encoding that most checksum tools default to.
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file

View File

@ -1,115 +0,0 @@
Subject: GNU Mes 0.24.1 released
<#secure method=pgpmime mode=sign>
We are happy to announce the release of GNU Mes 0.24.1, representing 23
commits over five months by four people.
Mes now supports the stage0-posix and M2-Planet Full Source bootstrap on
Aarch64 for ARM. Because stage0-posix does not support ARM yet, the Mes
ARM bootstrap is currently prototyped on Aarch64.
We are excited that the NlNet Foundation[4] is again sponsoring this
work!
What's next?
Work to prototype this so-called "Full Source Bootstrap" for ARM on
Aarch64 is happening on the wip-aarch64-bootstrap[3] branch. Also, full
Guile compatible module support, and RISC-V support.
Enjoy!
* About
GNU Mes[5] is a Scheme interpreter and C compiler for bootstrapping
the GNU System. Since version 0.22 it has again helped to halve the
size of opaque, uninspectable binary seeds that are currently being
used in the Reduced Binary Seed bootstrap[6] of GNU Guix[7]. The
final goal is to help create a full source bootstrap as part of the
bootstrappable builds[8] effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
compiler written in Scheme and these are mutual self-hosting. Mes can
now be bootstrapped from M2-Planet[9] and Mescc-Tools[10].
Mes has a Garbage Collector, a library of loadable Scheme modules--
notably Dominique Boucher's LALR[11], Pre-R6RS portable
syntax-case[12] with R7RS ellipsis, Matt Wette's Nyacc[13] --and test
suite, just enough to support a REPL and a C99 compiler: mescc.
Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[14] that
is self-hosting. Using this tcc and the Mes C library we now have a
Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes is inspired by The Maxwell Equations of Software: LISP-1.5[15] --
John McCarthy page 13, GNU Guix's source/binary packaging transparency
and Jeremiah Orians's stage0[16] 357-byte self-hosting hex assembler.
* Download
git clone git://git.savannah.gnu.org/mes.git
Here are the compressed sources and a GPG detached signature[*]:
https://ftp.gnu.org/gnu/mes/mes-0.24.1.tar.gz
https://ftp.gnu.org/gnu/mes/mes-0.24.1.tar.gz.sig
Use a mirror for higher download bandwidth:
https://ftpmirror.gnu.org/mes/mes-0.24.1.tar.gz
https://ftpmirror.gnu.org/mes/mes-0.24.1.tar.gz.sig
Here are the SHA1 and SHA256 checksums:
bceaaaf1cafaa31ccb1ee1247ce2dd651a2f67be mes-0.24.1.tar.gz
35120ceb0676632e58973355b9f86dff9cc717ed65ed2a17ff5272c59f2a0535 mes-0.24.1.tar.gz
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file
and the corresponding tarball. Then, run a command like this:
gpg --verify mes-0.24.1.tar.gz.sig
If that command fails because you don't have the required public key,
or that public key has expired, try the following commands to update
or refresh it, and then rerun the 'gpg --verify' command.
gpg --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
* Get informed, get involved
See https://bootstrappable.org
Join #bootstrappable on irc.libera.chat
* NEWS
* Changes in 0.24.1 since 0.24
** Build
*** Support M2-Planet bootstrap for ARM.
** MesCC
*** The Mes C Library now supports bootstrapping ARM.
** Noteworthy bug fixes
*** The definition of S_ISUID was fixed.
*** Unsigned modulo has been fixed for ARM.
*** A bug with abtol has been fixed.
*** Workarounds for building with gcc-12.2.0 have been added.
* Links
[0] https://github.com/oriansj/stage0-posix
[1] https://github.com/oriansj/bootstrap-seeds
[2] https://archive.fosdem.org/2021/schedule/event/gnumes/
[3] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-aarch64-bootstrap
[4] https://nlnet.nl/project/GNUMes-ARM_RISC-V
[5] https://www.gnu.org/software/mes
[6] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25
[7] https://www.gnu.org/software/guix
[8] https://bootstrappable.org
[9] https://github.com/oriansj/m2-planet
[10] https://savannah.nongnu.org/projects/mescc-tools
[11] https://github.com/schemeway/lalr-scm
[12] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
[13] https://www.nongnu.org/nyacc
[14] https://gitlab.com/janneke/tinycc
[15] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
[16] https://savannah.nongnu.org/projects/stage0

View File

@ -1,117 +0,0 @@
Subject: GNU Mes 0.24.2 released
<#secure method=pgpmime mode=sign>
We are happy to announce the release of GNU Mes 0.24.2, representing 25
commits over nine months by four people.
This release should fix the long standing `stat64' bug #41264[0].
We are very grateful that the NLnet Foundation[1] is sponsoring this
work!
What's next?
Work to prototype this so-called "Full Source Bootstrap" for ARM on
Aarch64 is happening on the wip-aarch64-bootstrap[2] branch. Also, full
Guile compatible module support, and RISC-V support.
Enjoy!
* About
GNU Mes[3] is a Scheme interpreter and C compiler for bootstrapping
the GNU System. Since version 0.22 it has again helped to halve the
size of opaque, uninspectable binary seeds that are currently being
used in the Reduced Binary Seed bootstrap[4] of GNU Guix[5]. The
final goal is to help create a full source bootstrap as part of the
bootstrappable builds[6] effort for UNIX-like operating systems.
The Scheme interpreter is written in ~5,000 LOC of simple C, and the C
compiler written in Scheme and these are mutual self-hosting. Mes can
now be bootstrapped from M2-Planet[7] and Mescc-Tools[8].
Mes has a Garbage Collector, a library of loadable Scheme modules--
notably Dominique Boucher's LALR[9], Pre-R6RS portable
syntax-case[10] with R7RS ellipsis, Matt Wette's Nyacc[11] --and test
suite, just enough to support a REPL and a C99 compiler: mescc.
Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[12] that
is self-hosting. Using this tcc and the Mes C library we now have a
Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5,
binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for
i686-linux, x86_64-linux, armhf-linux and aarch64-linux.
Mes is inspired by The Maxwell Equations of Software: LISP-1.5[13] --
John McCarthy page 13, GNU Guix's source/binary packaging transparency
and Jeremiah Orians's stage0[14] 357-byte self-hosting hex assembler.
* Download
git clone git://git.savannah.gnu.org/mes.git
Here are the compressed sources and a GPG detached signature[*]:
https://ftp.gnu.org/gnu/mes/mes-0.24.2.tar.gz
https://ftp.gnu.org/gnu/mes/mes-0.24.2.tar.gz.sig
Use a mirror for higher download bandwidth:
https://ftpmirror.gnu.org/mes/mes-0.24.2.tar.gz
https://ftpmirror.gnu.org/mes/mes-0.24.2.tar.gz.sig
Here are the SHA1 and SHA256 checksums:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file
and the corresponding tarball. Then, run a command like this:
gpg --verify mes-0.24.2.tar.gz.sig
If that command fails because you don't have the required public key,
or that public key has expired, try the following commands to update
or refresh it, and then rerun the 'gpg --verify' command.
gpg --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273
* Get informed, get involved
See https://bootstrappable.org
Join #bootstrappable on irc.libera.chat
* NEWS
* Changes in 0.24.2 since 0.24.1
** Build
*** A number of compile warnings have been fixed.
*** The `simple.make' and `simple.sh' builds have been resurrected.
** MesCC
*** Some assembly defines were added for building TinyCC for x86_64.
*** `__assert_fail' has been updated to use the standard signature.
** Noteworthy bug fixes
*** A bootstrap build without M2-Planet is now supported again.
*** `gettimeofday' no longer segfaults in the M2-Planet build.
*** `stat64' and friends are now used on 32bit platforms.
This fixes https://debbugs.gnu.org/41264, and should also fix
https://debbugs.gnu.org/49985,
https://debbugs.gnu.org/53415,
https://debbugs.gnu.org/53416.
*** The Mes C Library now supports uppercase hex conversions.
* Links
[0] https://debbugs.gnu.org/41264
[1] https://nlnet.nl/project/GNUMes-ARM_RISC-V
[2] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-aarch64-bootstrap
[3] https://www.gnu.org/software/mes
[4] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25
[5] https://www.gnu.org/software/guix
[6] https://bootstrappable.org
[7] https://github.com/oriansj/m2-planet
[8] https://savannah.nongnu.org/projects/mescc-tools
[9] https://github.com/schemeway/lalr-scm
[10] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
[11] https://www.nongnu.org/nyacc
[12] https://gitlab.com/janneke/tinycc
[13] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
[14] https://github.com/oriansj/stage0-posix

View File

@ -6,7 +6,7 @@
@display
Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
@uref{https://fsf.org/}
@uref{http://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -414,7 +414,7 @@ The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
@uref{https://www.gnu.org/copyleft/}.
@uref{http://www.gnu.org/copyleft/}.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this

View File

@ -204,7 +204,7 @@ Freedom 1.
@section Reproducible Builds
The current Reproducible Builds effort incubated in the Debian
project@footnote{@url{https://debian.org, The Debian Project}} and was
project@footnote{@url{http://debian.org, The Debian Project}} and was
organized by Lunar. Quoting the Reproducible Builds
website@footnote{@url{https://reproducible-builds.org/,Reproducible
Builds}}
@ -365,7 +365,7 @@ Most computers work pretty well so apparently there is not a pressing
need to inspect and study all of these codes. At the same time it is
tricky to fully trust@footnote{ Ken Thompson's 1984 Turing award
acceptance speech
@url{https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf,
@url{http://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf,
Reflections on Trusting Tust}.} a computer that was bootstrapped in this
way.
@ -461,7 +461,7 @@ and mescc-tools can be removed.
As fate would have it, I stumbled upon this
@url{https://queue.acm.org/detail.cfm?id=1039523, interview with Alan
Kay}, where he shares a revelation he had when reading John McCarthy's
@url{https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf,
@url{http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf,
LISP-1.5} manual:
@quotation
@ -553,19 +553,19 @@ in the Mes source tree for additional details.
GNU Mes depends on the following packages:
@itemize
@item @url{https://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or
@item @url{http://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or
later, including 2.2.x and 3.0.x,
@item @url{https://www.gnu.org/software/make/, GNU Make}.
@item @url{http://www.gnu.org/software/make/, GNU Make}.
@item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2,
@item @url{https://gcc.gnu.org, GCC's gcc}, version 2.95.3 or later, including 10.2.0,
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0,
@item @url{http://gcc.gnu.org, GCC's gcc}, version 2.95.3 or later, including 10.2.0,
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.0.1 or later,
@end itemize
The following dependencies are optional:
@itemize
Support for building the bootstrap @file{bin/mes-m2} depends on
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0.
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.8.0.
@end itemize
@cindex Guile, compatibility
@ -594,8 +594,8 @@ Bootstrapping Mes depends on the following packages:
@itemize
@item a POSIX-compatible shell
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0,
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0.
@item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.0.1 or later,
@item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.8.0.
@item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2,
@end itemize
@ -693,7 +693,7 @@ responsibility.
The Reduced Binary Seed bootstrap currently adopted by Guix@footnote{See
@file{gnu/packages/commencement.scm} in the @var{master} branch in Guix
git
@url{https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}.
@url{http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}.
In its intiial form it is only available for x86-linux and armhf-linux.
Currently, it goes like this:
@ -749,7 +749,7 @@ Currently, it goes like this:
Here's a generated dependency diagram to for the initial bootstrap gcc
that builds the rest of Guix.
@image{images/gcc-mesboot-graph,6in,,Reference graph of the gcc-core-mesboot0}
@image{images/gcc-mesboot-graph,2in,,Reference graph of the gcc-core-mesboot0}
Work is ongoing to remove these binary seeds that were intentionally
injected by our own doing as temporary shortcut
@ -935,7 +935,7 @@ The @var{option}s can be among the following:
align @var{symbol}, the default is @code{functions}; other valid values
are: @code{globals}.
@item --base-address=ADDRESS
@item --base-address=ADRRESS
use BaseAddress ADDRESS [0x1000000]
@item -c
@ -1155,8 +1155,8 @@ Porting MesCC:
The Perfect Setup to hack on Mes is basically the perfect setup used
for Guile hacking (@pxref{Using Guile in Emacs,,, guile, Guile Reference
Manual}). First, you need more than an editor, you need
@url{https://www.gnu.org/software/emacs, Emacs}, empowered by the
wonderful @url{https://nongnu.org/geiser/, Geiser}.
@url{http://www.gnu.org/software/emacs, Emacs}, empowered by the
wonderful @url{http://nongnu.org/geiser/, Geiser}.
Geiser allows for interactive and incremental development from within
Emacs: code compilation and evaluation from within buffers, access to
@ -1181,7 +1181,7 @@ Scheme code in Mes is written in a purely functional style.
@cindex coding style
When writing Scheme code, we follow common wisdom among Scheme
programmers. In general, we follow the
@url{https://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp
@url{http://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp
Style Rules}. This document happens to describe the conventions mostly
used in Guiles code too. It is very thoughtful and well written, so
please do read it.

View File

@ -30,7 +30,7 @@
;;
;; To use as the basis for a development environment, run:
;;
;; guix time-machine --commit=ffb616b69dced25b840f2e5178062072d89623eb -- shell
;; guix shell
;;
;;; Code:

View File

@ -54,7 +54,7 @@
(define-public mescc-tools
(package
(name "mescc-tools")
(version "1.4.0")
(version "1.3")
(source (origin
(method git-fetch)
(uri (git-reference
@ -64,7 +64,7 @@
(file-name (git-file-name name version))
(sha256
(base32
"0z2ni2qn2np1walcaqlxz8sinzb78d4hiq9glddzf26wxc226hs4"))))
"1mx68mavh39mfpa0vjxv0y057alcp5p2xy2j6wmz5gxy795h0vpa"))))
(build-system gnu-build-system)
(supported-systems
'("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux"))
@ -183,13 +183,13 @@ extensive examples, including parsers for the Javascript and C99 languages.")
(define-public mes
(package
(name "mes")
(version #!mes!# "0.24.2")
(version #!mes!# "0.23")
(source (origin
(method url-fetch)
(uri (string-append
"https://ftp.gnu.org/pub/gnu/mes/mes-" version ".tar.gz"))
(sha256
(base32 #!mes!# "0vp8v88zszh1imm3dvdfi3m8cywshdj7xcrsq4cgmss69s2y1nkx"))))
(base32 #!mes!# "0mnryfkl0dwbr5gxp16j5s95gw7z1vm1fqa1pxabp0aiar1hw53s"))))
(build-system gnu-build-system)
(supported-systems '("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux"))
(propagated-inputs (list mescc-tools nyacc))
@ -238,7 +238,7 @@ Guile.")
(license gpl3+)))
(define-public mes.git
(let ((version #!mes!# "0.24.2")
(let ((version #!mes!# "0.23")
(revision "0")
(commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ))))
(package

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -27,9 +27,8 @@
#undef __MES_ASSERT_H
#include_next <assert.h>
#else // ! SYSTEM_LIBC
#define assert(x) ((x) ? (void)0 : __assert_fail (#x, 0, 0, 0))
void __assert_fail (char const *s, char const *file, unsigned line,
char const *function);
#define assert(x) ((x) ? (void)0 : __assert_fail (#x))
void __assert_fail (char *s);
#endif // ! SYSTEM_LIBC
#endif // __MES_ASSERT_H

View File

@ -1,79 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LINUX_ARM_KERNEL_STAT_H
#define __MES_LINUX_ARM_KERNEL_STAT_H 1
// https://github.com/torvalds/linux/blob/master/arch/arm/include/uapi/asm/stat.h
#include <arch/syscall.h>
#if __SIZEOF_LONG_LONG__ != 8
// *INDENT-OFF*
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned long st_rdev;
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime;
unsigned long st_atime_usec;
unsigned long st_mtime;
unsigned long st_mtime_usec;
unsigned long st_ctime;
unsigned long st_ctime_usec;
unsigned long __pad0;
unsigned long __pad1;
};
#else // __SIZEOF_LONG_LONG__ == 8
struct stat
{
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned int st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
#endif // __SIZEOF_LONG_LONG__ == 8
#endif // __MES_LINUX_ARM_KERNEL_STAT_H

View File

@ -109,23 +109,4 @@
#define SYS_readlink 0x55
#define SYS_mknod 0x0e
#if __SIZEOF_LONG_LONG__ == 8
#define SYS_stat64 0xc3
#define SYS_lstat64 0xc4
#define SYS_fstat64 0xc5
#define SYS_fcntl64 0xdd
#define SYS_getdents64 0xdc
#undef SYS_stat
#define SYS_stat SYS_stat64
#undef SYS_lstat
#define SYS_lstat SYS_lstat64
#undef SYS_fstat
#define SYS_fstat SYS_fstat64
#endif // __SIZEOF_LONG_LONG__ == 8
#endif /* __MES_LINUX_ARM_SYSCALL_H */

View File

@ -1,47 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LINUX_M2_KERNEL_STAT_H
#define __LINUX_M2_KERNEL_STAT_H
/* https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h */
/* *INDENT-OFF* */
struct stat
{
unsigned st_dev;
unsigned st_ino;
char st_mode[2];
char st_nlink[2];
char st_uid[2];
char st_gid[2];
unsigned st_rdev;
unsigned st_size;
unsigned st_blksize;
unsigned st_blocks;
unsigned st_atime;
unsigned st_atime_usec;
unsigned st_mtime;
unsigned st_mtime_usec;
unsigned st_ctime;
unsigned st_ctime_usec;
unsigned __pad0;
unsigned __pad1;
};
#endif /* __LINUX_M2_KERNEL_STAT_H */

View File

@ -1,79 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LINUX_X86_KERNEL_STAT_H
#define __MES_LINUX_X86_KERNEL_STAT_H 1
// https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h
#include <arch/syscall.h>
#if __SIZEOF_LONG_LONG__ != 8
// *INDENT-OFF*
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned long st_rdev;
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime;
unsigned long st_atime_usec;
unsigned long st_mtime;
unsigned long st_mtime_usec;
unsigned long st_ctime;
unsigned long st_ctime_usec;
unsigned long __pad0;
unsigned long __pad1;
};
#else // __SIZEOF_LONG_LONG__ == 8
struct stat
{
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned int st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
#endif // __SIZEOF_LONG_LONG__ == 8
#endif // __MES_LINUX_X86_KERNEL_STAT_H

View File

@ -75,6 +75,7 @@
#define SYS_stat 0x6a
/* libc+gnu */
#define SYS_chdir 0x0c
#define SYS_link 0x09
#define SYS_getpid 0x14
@ -111,23 +112,4 @@
#define SYS_readlink 0x55
#define SYS_mknod 0x0e
#if __SIZEOF_LONG_LONG__ == 8
#define SYS_stat64 0xc3
#define SYS_lstat64 0xc4
#define SYS_fstat64 0xc5
#define SYS_fcntl64 0xdd
#define SYS_getdents64 0xdc
#undef SYS_stat
#define SYS_stat SYS_stat64
#undef SYS_lstat
#define SYS_lstat SYS_lstat64
#undef SYS_fstat
#define SYS_fstat SYS_fstat64
#endif // __SIZEOF_LONG_LONG__ == 8
#endif /* __MES_LINUX_X86_SYSCALL_H */

View File

@ -1,51 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_LINUX_X86_64_KERNEL_STAT_H
#define __MES_LINUX_X86_64_KERNEL_STAT_H 1
// https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h
// *INDENT-OFF*
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned long st_nlink;
unsigned int st_mode;
unsigned int st_uid;
unsigned int st_gid;
unsigned int __pad0;
unsigned long st_rdev;
unsigned long st_size;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long st_blksize;
long st_blocks;
unsigned long __pad1;
unsigned long __pad2;
unsigned long __pad3;
unsigned long __pad4;
};
#endif // __MES_LINUX_X86_64_KERNEL_STAT_H

View File

@ -1,138 +0,0 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __M2_TYPES_H
#define __M2_TYPES_H 1
/*
#ifndef __MES_CLOCK_T
#define __MES_CLOCK_T
#undef clock_t
typedef long clock_t;
#endif
*/
#ifndef __MES_DEV_T
#define __MES_DEV_T
#undef dev_t
typedef long dev_t;
#endif
/*
#if !defined (__MES_FILE_T) && ! defined (_FILE_T)
#define __MES_FILE_T
#define _FILE_T
typedef long FILE;
#endif
*/
#ifndef __MES_GID_T
#define __MES_GID_T
#undef gid_t
typedef unsigned gid_t;
#endif
#ifndef __MES_INO_T
#define __MES_INO_T
#undef ino_t
typedef unsigned ino_t;
#endif
#if __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_INO64_T
#define __MES_INO64_T
#undef ino64_t
typedef unsigned ino64_t;
#endif
#endif // __SIZEOF_LONG_LONG__ == 8
#if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined)
#define __MES_INTPTR_T
#define __intptr_t_defined
#undef intptr_t
typedef long intptr_t;
#undef uintptr_t
typedef unsigned uintptr_t;
#endif
#ifndef __MES_OFF_T
#define __MES_OFF_T
#undef off_t
typedef long off_t;
#endif
#if __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_OFF64_T
#define __MES_OFF64_T
#undef off64_t
typedef unsigned off64_t;
#endif
#endif // __SIZEOF_LONG_LONG__ == 8
#ifndef __MES_PID_T
#define __MES_PID_T
#undef pid_t
typedef int pid_t;
#endif
#ifndef __PTRDIFF_T
#define __PTRDIFF_T
#ifndef __MES_PTRDIFF_T
#define __MES_PTRDIFF_T
#undef ptrdiff_t
typedef long ptrdiff_t;
#endif
#endif
#ifndef __MES_SIGVAL_T
#define __MES_SIGVAL_T
#undef clock_t
typedef long sigval_t;
#endif
#ifndef __SIZE_T
#define __SIZE_T
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
typedef unsigned size_t;
#endif
#endif
#ifndef __MES_SSIZE_T
#define __MES_SSIZE_T
#undef ssize_t
typedef long ssize_t;
#endif
#ifndef __MES_UID_T
#define __MES_UID_T
#undef uid_t
typedef unsigned uid_t;
#endif
#ifndef __WCHAR_T
#define __WCHAR_T
#ifndef __MES_WCHAR_T
#define __MES_WCHAR_T
#undef wchar_t
typedef int wchar_t;
#endif
#endif
#endif // __M2_TYPES_H

View File

@ -67,8 +67,7 @@ extern void (*__call_at_exit) (void);
#define __FILEDES_MAX 512
#if !SYSTEM_LIBC
void __assert_fail (char const *s, char const *file, unsigned line,
char const *function);
void __assert_fail (char *s);
ssize_t __buffered_read (int filedes, void *buffer, size_t size);
size_t __buffered_read_clear (int filedes);
void _exit (int code);

View File

@ -153,6 +153,7 @@ struct scm *vector_ref_ (struct scm *x, long i);
struct scm *vector_set_x_ (struct scm *x, long i, struct scm *e);
FUNCTION builtin_function (struct scm *builtin);
char *cell_bytes (struct scm *x);
char *news_bytes (struct scm *x);
int peekchar ();
int readchar ();
int unreadchar ();

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2022 Dor Askayo <dor.askayo@gmail.com>
*
* This file is part of GNU Mes.
*
@ -19,7 +18,7 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MES_SYS_STAT_H
#define __MES_SYS_STAT_H 1
#define __MES_SYS_STAT_H 1lei
#if SYSTEM_LIBC
#undef __MES_SYS_STAT_H
@ -29,13 +28,60 @@
#include <time.h>
#include <sys/types.h>
#include <arch/kernel-stat.h>
#ifndef __MES_MODE_T
#define __MES_MODE_T
typedef int mode_t;
#endif
// *INDENT-OFF*
#if __i386__ || __arm__
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned long st_rdev;
long st_size; /* Linux: unsigned long; glibc: off_t (i.e. signed) */
unsigned long st_blksize;
unsigned long st_blocks;
time_t st_atime; /* Linux: unsigned long; glibc: time_t */
unsigned long st_atime_usec;
time_t st_mtime; /* Linux: unsigned long; glibc: time_t */
unsigned long st_mtime_usec;
time_t st_ctime; /* Linux: unsigned long; glibc: time_t */
unsigned long st_ctime_usec;
unsigned long __foo0;
unsigned long __foo1;
};
#elif __x86_64__
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned long st_rdev;
long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
time_t st_atime;
unsigned long st_atime_usec;
time_t st_mtime;
unsigned long st_mtime_usec;
time_t st_ctime;
unsigned long st_ctime_usec;
unsigned long __foo0;
unsigned long __foo1;
};
#endif
// *INDENT-ON*
int chmod (char const *file_name, mode_t mode);
int fstat (int filedes, struct stat *buf);
int mkdir (char const *file_name, mode_t mode);
@ -61,7 +107,7 @@ int stat (char const *file_name, struct stat *buf);
#define S_IWUSR 00200
#define S_IRUSR 00400
#define S_ISUID 04000
#define S_ISUID 0400
#define S_ISGID 02000
#define S_IXGRP 00010
#define S_IXOTH 00001

View File

@ -20,7 +20,7 @@
# kaem --verbose --strict
mes_cpu=${mes_cpu:-x86}
stage0_cpu=${stage0_cpu:-x86}
stage0_cpu=${mes_cpu:-x86}
mkdir -p m2
@ -53,7 +53,6 @@ M2-Planet \
-f lib/mes/fdputc.c \
-f lib/mes/eputc.c \
\
-f include/m2/types.h \
-f include/mes/mes.h \
-f include/mes/builtins.h \
-f include/mes/constants.h \
@ -82,8 +81,6 @@ M2-Planet \
-f lib/mes/fdungetc.c \
-f lib/posix/setenv.c \
-f lib/linux/access.c \
-f include/linux/m2/kernel-stat.h \
-f include/sys/stat.h \
-f lib/m2/chmod.c \
-f lib/linux/ioctl3.c \
-f lib/m2/isatty.c \
@ -121,11 +118,11 @@ M2-Planet \
-f src/vector.c \
-o m2/mes.M1
blood-elf --little-endian -f m2/mes.M1 -o m2/mes.blood-elf-M1
blood-elf -f m2/mes.M1 -o m2/mes.blood-elf-M1
M1 \
--LittleEndian \
--architecture ${stage0_cpu} \
--little-endian \
-f lib/m2/${mes_cpu}/${mes_cpu}_defs.M1 \
-f lib/${mes_cpu}-mes/${mes_cpu}.M1 \
-f lib/linux/${mes_cpu}-mes-m2/crt1.M1 \
@ -135,9 +132,10 @@ M1 \
mkdir -p bin
hex2 \
--LittleEndian \
--architecture ${stage0_cpu} \
--little-endian \
--base-address 0x1000000 \
--BaseAddress 0x1000000 \
--exec_enable \
-f lib/m2/${mes_cpu}/ELF-${mes_cpu}.hex2 \
-f m2/mes.hex2 \
-o bin/mes-m2

View File

@ -1,5 +1,5 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright © 2017,2018,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
###
### This file is part of GNU Mes.
@ -91,7 +91,6 @@ DEFINE mov____%r0,(%r1) 000081e5
DEFINE mov____%r1,%r0 0100a0e1
DEFINE mov____%r1,%r2 0120a0e1
DEFINE mov____%esp,%r0 0d00a0e1
DEFINE mov____%esp,%r3 0d30a0e1
# e59f9004 ldr r9, [pc, #4] ; <L1>
# e5890000 str r0, [r9]

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2023 Rick Masters <grick23@gmail.com>
*
* This file is part of GNU Mes.
*

View File

@ -24,5 +24,5 @@
int
isxdigit (int c)
{
return isdigit (c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
return isdigit (c) || (c >= 'a' && c <= 'f');
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
char *
_getcwd (char *buffer, size_t size)

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
access (char const *file_name, int how)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
long
brk (void *addr)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
chdir (char const *file_name)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
dup (int old)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
dup2 (int old, int new)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
execve (char const *file_name, char *const argv[], char *const env[])

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <stdarg.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
fork ()

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
fsync (int filedes)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/types.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
gid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
uid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
gid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
pid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
pid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/resource.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/time.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
uid_t

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <stdarg.h>
#include <sys/ioctl.h>

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
link (char const *old_name, char const *new_name)

View File

@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <stdio.h>
#include <sys/types.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
#include <sys/time.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <mes/lib.h>
#include <fcntl.h>
@ -27,7 +27,7 @@ ssize_t
read (int filedes, void *buffer, size_t size)
{
long long_filedes = filedes;
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, (long) buffer, (long) size);
ssize_t bytes = _sys_call3 (SYS_read, long_filedes, buffer, size);
if (__mes_debug () > 4)
{
if (bytes == 1)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
ssize_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
rmdir (char const *file_name)

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/time.h>
#include <unistd.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
#include <signal.h>
@ -36,7 +36,7 @@ sighandler_t
signal (int signum, sighandler_t action)
{
#if __i386__
return (sighandler_t) _sys_call2 (SYS_signal, signum, (long) action);
return _sys_call2 (SYS_signal, signum, action);
#else
static struct sigaction setup_action = { 0 };
static struct sigaction old = { 0 };

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <signal.h>
#include <unistd.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/stat.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <unistd.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,11 +19,17 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
/* Linux' SYS_time syscall is a compatibility shim for SYS_gettimeofday.
Therefore, prefer SYS_gettimeofday. */
#if defined (SYS_gettimeofday)
#include <sys/time.h>
time_t
time (time_t * result)
{
@ -35,3 +41,31 @@ time (time_t * result)
*result = tv.tv_sec;
return tv.tv_sec;
}
#elif defined (SYS_time)
time_t
time (time_t * result)
{
return _sys_call1 (SYS_time, (long) result);
}
#else
#warning there is no time
#include <mes/lib.h>
time_t
time (time_t * result)
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("time stub\n");
stub = 1;
if (result)
*result = 0;
return 0;
}
#endif

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
unlink (char const *file_name)

View File

@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/types.h>
pid_t

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,7 +19,7 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
int
execve (char const *file_name, char **argv, char **env)

View File

@ -18,8 +18,6 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <mes/lib.h>
#include <fcntl.h>
#include <stdarg.h>

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,19 +19,16 @@
*/
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <time.h>
char *__tv;
long
time (long* result)
{
int r;
if (__tv == 0)
__tv = malloc (sizeof (struct timeval));
struct timeval *tv = __tv;
r = _sys_call2 (SYS_gettimeofday, tv, 0);
struct timeval tv;
struct timezone tz;
r = _sys_call2 (SYS_gettimeofday, tv, tz);
if (r != 0)
return -1;
if (result != 0)

View File

@ -20,7 +20,7 @@
#include <mes/lib.h>
#include <linux/syscall.h>
#include <arch/syscall.h>
#include <syscall.h>
#include <sys/types.h>
int

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -19,30 +19,14 @@
*/
#include <mes/lib.h>
#include <assert.h>
void
__assert_fail (char const *msg, char const *file, unsigned line,
char const *function)
__assert_fail (char *s)
{
if (file && file[0])
{
eputs (file);
eputs (":");
}
if (line)
{
eputs (itoa (line));
eputs (":");
}
if (function && function[0])
{
eputs (function);
eputs (":");
}
eputs ("assert fail: ");
eputs (msg);
eputs (s);
eputs ("\n");
char *fail = 0;
char *fail = s;
fail = 0;
fail[0] = 0;
}

View File

@ -1,7 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2022,2023 Rick Masters <grick23@gmail.com>
*
* This file is part of GNU Mes.
*
@ -43,15 +42,8 @@ abtol (char const **p, int base)
while (isnumber (s[0], base) != 0)
{
i = i * base;
if (s[0] >= 'a')
if (s[0] > '9')
m = 'a' - 10;
else
{
if (s[0] >= 'A')
m = 'A' - 10;
else
m = '0';
}
i = i + s[0] - m;
s = s + 1;
}

View File

@ -1,7 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jeremiah Orians <jeremiah@pdp10.guru>
* Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -20,12 +20,11 @@
*/
#include <mes/lib.h>
#include <assert.h>
#include <stdlib.h>
void
assert_msg (int bool, char *msg)
{
if (bool == 0)
__assert_fail (msg, 0, 0, 0);
__assert_fail (msg);
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
#if __M2_PLANET__ || (!(__MESC__ && __arm__) && !(__TINYC__ && __arm__ && BOOTSTRAP))
#if __M2_PLANET__ || !(__MESC__ && __arm__)
size_t
__mesabi_uldiv (size_t a, size_t b, size_t *remainder)
{

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -22,7 +22,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
int
vfscanf (FILE * stream, char const *template, va_list ap)
@ -77,7 +76,7 @@ vfscanf (FILE * stream, char const *template, va_list ap)
ungetc (p, stream);
*q = 0;
q = buf;
*d = abtol ((char const**)&q, 10);
*d = abtol (&q, 10);
count++;
break;
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -30,6 +30,6 @@ mbstowcs (wchar_t * wstring, char const *string, size_t size)
if (__mes_debug () && !stub)
eputs ("mbstowcs stub\n");
stub = 1;
strcpy ((char*)wstring, string);
strcpy (wstring, string);
return strlen (string);
}

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -29,12 +29,7 @@ int
main (int argc, char const *argv[])
{
eputs ("test:getenv\n");
#if __GNUC__ > 11
char* file_name = malloc (PATH_MAX);
#else
// FIXME: gcc-12.2.0 fails open using this
char file_name[PATH_MAX];
#endif
char *srcdir = getenv ("abs_top_srcdir");
if (! srcdir) // for running by hand
srcdir = ".";

Some files were not shown because too many files have changed in this diff Show More