mes.git
3 months agobuild: Fix configure crashing when no compiler is present. master staging
Jan (janneke) Nieuwenhuizen [Sat, 14 May 2022 19:09:06 +0000 (21:09 +0200)]
build: Fix configure crashing when no compiler is present.

Reported by Andrius Štikonas <andrius@stikonas.eu> via IRC.

* configure (main): Cater for missing cc, actually set m2-planet when
found.

3 months agocore: Remove code duplication.
Gabriel Wicki [Tue, 10 May 2022 20:17:20 +0000 (22:17 +0200)]
core: Remove code duplication.

* src/gc.c (copy_news): Remove copy of copy_cell.
(gc_copy): Use copy_cell instead.

3 months agocore: Remove code duplication.
Gabriel Wicki [Tue, 10 May 2022 20:14:31 +0000 (22:14 +0200)]
core: Remove code duplication.

* src/gc.c (news_bytes): Remove copy of cell_bytes.
(gc_copy): Use cell_bytes instead.
* include/mes/mes.h (news_bytes): Remove prototype.

3 months agobuild: Add publish-local.
Jan (janneke) Nieuwenhuizen [Fri, 13 May 2022 05:51:04 +0000 (07:51 +0200)]
build: Add publish-local.

* build-aux/GNUmakefile.in (publish-local): New target.

3 months agodoc: Update `README'.
Jan (janneke) Nieuwenhuizen [Fri, 13 May 2022 05:51:17 +0000 (07:51 +0200)]
doc: Update `README'.

* README: Update to mention Further Reduced Binary Seed bootstrap.

3 months agoFix definition of S_ISUID.
Dor Askayo [Sat, 1 Jan 2022 18:38:38 +0000 (20:38 +0200)]
Fix definition of S_ISUID.

* include/sys/stat.h (S_ISUID: Append missing zero.

3 months agobuild: Fix --with-bootstrap build.
Jan (janneke) Nieuwenhuizen [Fri, 6 May 2022 10:25:16 +0000 (12:25 +0200)]
build: Fix --with-bootstrap build.

Reported by Vagrant Cascadian <vagrant@debian.org>.

* build-aux/build.sh.in: Before building mes using mescc, in bootstrap
mode, remove globals.o built for lib.

3 months agodoc: Post-release update.
Jan (janneke) Nieuwenhuizen [Sun, 1 May 2022 21:27:19 +0000 (23:27 +0200)]
doc: Post-release update.

* doc/announce/ANNOUNCE-0.24: Add gen-announce checksums.
* build-aux/GNUmakefile.in (--previous-version): Update to 0.24.  Add
bug-mes to release announce.

3 months agoguix: mes: Update to 0.24.
Jan (janneke) Nieuwenhuizen [Mon, 2 May 2022 16:54:33 +0000 (18:54 +0200)]
guix: mes: Update to 0.24.

* guix/git/mes.scm (mes)[source]: Update to 0.24.

3 months agobuild: Release 0.24. v0.24
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 14:14:55 +0000 (16:14 +0200)]
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.

3 months agodoc: Update `ROADMAP'.
Jan (janneke) Nieuwenhuizen [Sun, 1 May 2022 21:44:34 +0000 (23:44 +0200)]
doc: Update `ROADMAP'.

* ROADMAP (release 0.x, unsorted): Move done item...
(DONE): ...here.

3 months agodoc: Add `ANNOUNCE-0.24'.
Jan (janneke) Nieuwenhuizen [Sun, 1 May 2022 20:49:51 +0000 (22:49 +0200)]
doc: Add `ANNOUNCE-0.24'.

* doc/announce/ANNOUNCE-0.24: New file.

3 months agodoc: Update `NEWS'.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 14:02:01 +0000 (16:02 +0200)]
doc: Update `NEWS'.

* NEWS (Changes in 0.24 since 0.23): New section.

2 years agodoc: Update `README'.
Jan (janneke) Nieuwenhuizen [Sun, 3 Nov 2019 15:30:45 +0000 (16:30 +0100)]
doc: Update `README'.

* README: Mention Mes can be bootstrapped using M2-Planet.
Mention Full Source Bootstrap sponsoring by NlNet.

19 months agodoc: Update 'AUTHORS'.
Jan (janneke) Nieuwenhuizen [Sat, 2 Jan 2021 12:45:00 +0000 (13:45 +0100)]
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.

3 months agodoc: Update Guix bootstrap status.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 10:31:57 +0000 (12:31 +0200)]
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.

3 months agodoc: Update dependencies, add M2-Planet.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 09:12:48 +0000 (11:12 +0200)]
doc: Update dependencies, add M2-Planet.

* INSTALL (Other GNU/Linux): Update mescc-tools requirement, 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.

3 months agodoc: Use `guix shell' instead of `guix environment'.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 07:44:57 +0000 (09:44 +0200)]
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.  Add time-machine with working commit.

3 months agobuild: Simple signature check for dist and release.
Jan (janneke) Nieuwenhuizen [Mon, 2 May 2022 09:37:27 +0000 (11:37 +0200)]
build: Simple signature check for dist and release.

* build-aux/GNUmakefile.in (check-signature): New target.
(dist, release): Depend on it.

3 months agobuild: Add `sum-announce' target.
Jan (janneke) Nieuwenhuizen [Mon, 2 May 2022 09:24:06 +0000 (11:24 +0200)]
build: Add `sum-announce' target.

* build-aux/GNUmakefile.in (sum-announce): New target.
(release): Check signature on release commit.

3 months agoARM: build: Cater for M2-Planet.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 20:51:42 +0000 (22:51 +0200)]
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: Also allow kaem build for ARM.

3 months agoguix: m2-planet: Update to 1.9.0.
Jan (janneke) Nieuwenhuizen [Sun, 1 May 2022 11:58:48 +0000 (13:58 +0200)]
guix: m2-planet: Update to 1.9.0.

* guix/git/mes.scm (m2-planet)[source]: Update to 1.9.0.

3 months agobuild: Depend on M2-Planet-1.9.0.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 20:42:55 +0000 (22:42 +0200)]
build: Depend on M2-Planet-1.9.0.

* configure (main): Bump M2-Planet version to 1.8.0.

3 months agoguix: mescc-tools: Update to 1.4.0
Jan (janneke) Nieuwenhuizen [Sun, 1 May 2022 21:04:03 +0000 (23:04 +0200)]
guix: mescc-tools: Update to 1.4.0

* gnu/packages/mes.scm (m2-planet): Update to 1.4.0.
[native-inputs]: Add which.
[argument]: Remove patch-prefix stage.

3 months agobuild: Depend on mescc-tools 1.4.0.
Jan (janneke) Nieuwenhuizen [Mon, 2 May 2022 05:46:01 +0000 (07:46 +0200)]
build: Depend on mescc-tools 1.4.0.

* configure (main): Check for hex2, M1 1.4.0, and blood-elf 2.0.0.
* module/mescc/mescc.scm (M1->blood-elf): Use --little-endian with blood-elf call.
* 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,
simple.make: Likewise.

3 months agoguix: m2-planet: Update to 1.8.0.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 06:51:35 +0000 (08:51 +0200)]
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.

3 months agobuild: Depend on M2-Planet-1.8.0.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 08:17:23 +0000 (10:17 +0200)]
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.
* build-aux/build-scaffold.sh: Remove obsolete --exec_enable.

3 months agoguix: Update package inputs to new style.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 07:15:24 +0000 (09:15 +0200)]
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.

3 months agoMes C Library: memchr: Avoid compile warning.
Jan (janneke) Nieuwenhuizen [Sat, 30 Apr 2022 14:40:57 +0000 (16:40 +0200)]
Mes C Library: memchr: Avoid compile warning.

* lib/string/memchr.c (memchr): Cast return to void*.

15 months agocore: Fix FRAME_SIZE conflict.
Jan (janneke) Nieuwenhuizen [Sun, 16 May 2021 11:27:12 +0000 (13:27 +0200)]
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.

15 months agocore: Resurrect gcc-10 support.
Jan (janneke) Nieuwenhuizen [Sun, 2 May 2021 12:58:23 +0000 (14:58 +0200)]
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.

15 months agoguix: m2-planet: Update to 1.7.0-32-gaa3472b.
Jan (janneke) Nieuwenhuizen [Sun, 2 May 2021 13:52:04 +0000 (15:52 +0200)]
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.

19 months agoscaffold: Add local-static-array.c.
Jan (janneke) Nieuwenhuizen [Sat, 9 Jan 2021 11:35:22 +0000 (12:35 +0100)]
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.

19 months agoscaffold: Add local-array.c.
Jan (janneke) Nieuwenhuizen [Sat, 9 Jan 2021 11:33:26 +0000 (12:33 +0100)]
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.

19 months agoscaffold: Add global-array.c.
Jan (janneke) Nieuwenhuizen [Sat, 9 Jan 2021 11:30:59 +0000 (12:30 +0100)]
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.

19 months agodoc: Add test hints to `HACKING'.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 10:58:36 +0000 (11:58 +0100)]
doc: Add test hints to `HACKING'.

* HACKING (TESTING): New section.

19 months agoRevert "Mes C Library: m2/execve.c: Remove specialization."
Jan (janneke) Nieuwenhuizen [Sat, 2 Jan 2021 09:00:35 +0000 (10:00 +0100)]
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 828c27a073896facdc3a3b24265ee69f0033f58f.

19 months agobootstrap: Update M2-Planet x86 definitions from 1.7.0-31-g358b6cf.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 18:07:22 +0000 (19:07 +0100)]
bootstrap: Update M2-Planet x86 definitions from 1.7.0-31-g358b6cf.

* lib/m2/x86/x86_defs.M1: Update.

19 months agoguix: m2-planet: Update to 1.7.0-31-g358b6cf.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 17:53:07 +0000 (18:53 +0100)]
guix: m2-planet: Update to 1.7.0-31-g358b6cf.

* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0-31-g358b6cf.

19 months agoRevert "Mes C Library: m2/getcwd.c: Remove specialization."
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 14:54:13 +0000 (15:54 +0100)]
Revert "Mes C Library: m2/getcwd.c: Remove specialization."

This reverts commit 37f44ce9453ef5589b1336c981360de16c154999.

19 months agocore: Move __getcwd_buf to Mes C Library.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 14:43:43 +0000 (15:43 +0100)]
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.

19 months agobootstrap: Support building with M2-Planet 1.4.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 10:40:51 +0000 (11:40 +0100)]
bootstrap: Support building with M2-Planet 1.4.

* lib/m2/x86/x86_defs.M1 (NOP): New define.

19 months agomescc: Only use signed division when numerator is signed.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 09:31:46 +0000 (10:31 +0100)]
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.

19 months agomescc: Use unsigned type for sizeof expression.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 09:30:48 +0000 (10:30 +0100)]
mescc: Use unsigned type for sizeof expression.

* module/mescc/compile.scm (ast->type): Use unsigned type for sizeof
expression.

19 months agomescc: Respect integer literal type suffixes.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 09:28:24 +0000 (10:28 +0100)]
mescc: Respect integer literal type suffixes.

* module/mescc/compile.scm (ast->type): Respect ULL, UL, U, LL, L suffix
on integer literals.

19 months agocore: Use unsigned constants.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 09:24:22 +0000 (10:24 +0100)]
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.

19 months agocore: Use size_t instead of long for gc sizes.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 08:47:22 +0000 (09:47 +0100)]
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.

19 months agocore: Avoid Floating point exception dividing negative numbers.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 08:46:20 +0000 (09:46 +0100)]
core: Avoid Floating point exception dividing negative numbers.

* src/posix.c (seconds_and_nanoseconds_to_long): Use unsigned division.

19 months agocore: Avoid Floating point exception dividing negative numbers.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 08:04:39 +0000 (09:04 +0100)]
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.

19 months agobootstrap: Use ./pre-inst-env mescc default.
Jan (janneke) Nieuwenhuizen [Fri, 1 Jan 2021 07:52:49 +0000 (08:52 +0100)]
bootstrap: Use ./pre-inst-env mescc default.

* configure.sh: When CC is mescc, M2-Planet or unset, use
"./pre-inst-env mescc" as default.

19 months agotests: string-join: Be noisy.
Jan (janneke) Nieuwenhuizen [Wed, 30 Dec 2020 17:45:18 +0000 (18:45 +0100)]
tests: string-join: Be noisy.

* scaffold/boot/50-string-join.scm ("string-join\n"): Avoid exit 0
without output.

2 years agomes: simple-format: Use core display.
Jan (janneke) Nieuwenhuizen [Sat, 16 Nov 2019 22:05:10 +0000 (23:05 +0100)]
mes: simple-format: Use core display.

* mes/module/mes/simple-format.mes: Do not import (mes display).

2 years agomes: Resurrect backtraces.
Jan (janneke) Nieuwenhuizen [Sun, 10 Nov 2019 15:08:13 +0000 (16:08 +0100)]
mes: Resurrect backtraces.

* mes/module/mes/catch.mes (%eh): Resurrect backtraces.
(display-frame): New function.
(display-backtrace): Use it.

2 years agocore: Add abort.
Jan (janneke) Nieuwenhuizen [Sun, 10 Nov 2019 15:04:25 +0000 (16:04 +0100)]
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.

19 months agomes: Remove PEG.
Jan (janneke) Nieuwenhuizen [Wed, 30 Dec 2020 16:28:21 +0000 (17:28 +0100)]
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.

19 months ago.dir-locals: Add test macro indentation.
Jan (janneke) Nieuwenhuizen [Wed, 30 Dec 2020 10:47:32 +0000 (11:47 +0100)]
.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.

19 months agomescc: Use (format (current-error-port) ...) instead of stderr.
Jan (janneke) Nieuwenhuizen [Wed, 30 Dec 2020 20:20:19 +0000 (21:20 +0100)]
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.

19 months agocore: Add gc-stats.
Jan (janneke) Nieuwenhuizen [Thu, 31 Dec 2020 09:34:07 +0000 (10:34 +0100)]
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.

19 months agocore: Avoid Floating point exception dividing negative numbers.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 21:39:31 +0000 (22:39 +0100)]
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.

19 months agoMes C Library: m2/execve.c: Remove specialization.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 18:13:02 +0000 (19:13 +0100)]
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.

19 months agoMes C Library: m2/getcwd.c: Remove specialization.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 17:52:37 +0000 (18:52 +0100)]
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.

19 months agoMes C Library: m2/ioctl.c: Remove specialization.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 17:41:45 +0000 (18:41 +0100)]
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.

19 months agoMes C Library: m2/ntoab.c: Remove specialization.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 14:39:33 +0000 (15:39 +0100)]
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.

19 months agobuild: Resurrect simple.sh.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 14:39:19 +0000 (15:39 +0100)]
build: Resurrect simple.sh.

* simple.sh: Do not attempt to build multiple C files with mescc.
Update for new and split C files.

19 months agoguix: m2-planet: Update to 1.7.0.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 10:28:13 +0000 (11:28 +0100)]
guix: m2-planet: Update to 1.7.0.

* guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0.
(native-inputs): Remove gcc-toolchain-7.
[arguments]: Add CC to make-flags.  Update sha256sum patch.

19 months agocore: Prepare for M2-Planet 1.7.0.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 12:38:38 +0000 (13:38 +0100)]
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.

19 months agomescc: Mes C Library: Prepare for M2-Planet 1.7.0.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 12:37:20 +0000 (13:37 +0100)]
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.

19 months agomescc: Mes C Library: isatty: Use fixed array size for M2-Planet.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 12:34:24 +0000 (13:34 +0100)]
mescc: Mes C Library: isatty: Use fixed array size for M2-Planet.

* lib/m2/isatty.c (struct ktermios)[c_cc]: Hardcode to size 19.

19 months agomescc: Mes C Library: Update M2-Planet macros.
Jan (janneke) Nieuwenhuizen [Tue, 29 Dec 2020 12:33:12 +0000 (13:33 +0100)]
mescc: Mes C Library: Update M2-Planet macros.

* lib/m2/x86/x86_defs.M1: Update from M2-Planet 1.7.0.

21 months agomes: compatibility: Move (mes pmatch) to (system base pmatch).
Jan (janneke) Nieuwenhuizen [Sun, 1 Nov 2020 15:20:12 +0000 (16:20 +0100)]
mes: compatibility: Move (mes pmatch) to (system base pmatch).

* mes/module/system/base/pmatch.scm: Move from mes/pmatch.scm.  Update
users.

21 months agomes: compatibility: Make base.mes pure guile.
Jan (janneke) Nieuwenhuizen [Sun, 1 Nov 2020 15:09:27 +0000 (16:09 +0100)]
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.

21 months agobuild: Cater for M2-Planet.
Jan (janneke) Nieuwenhuizen [Sun, 18 Oct 2020 21:15:11 +0000 (23:15 +0200)]
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.

21 months agoguix: Update M2-Planet to 1fc2aeab483208bd2ba117b21df3894c182470ec.
Jan (janneke) Nieuwenhuizen [Sun, 18 Oct 2020 21:29:15 +0000 (23:29 +0200)]
guix: Update M2-Planet to 1fc2aeab483208bd2ba117b21df3894c182470ec.

* guix/git/mes.scm (m2-planet): Update to 1fc2aeab483208bd2ba117b21df3894c182470ec.
(native-inputs): Add gcc-toolchain-7.
* lib/m2/x86/x86_defs.M1: Update from M2-Planet.

21 months agoguix: Add m2-planet.
Jan (janneke) Nieuwenhuizen [Sun, 18 Oct 2020 21:14:30 +0000 (23:14 +0200)]
guix: Add m2-planet.

* guix/git/mes.scm (m2-planet): New variable.

21 months agocore: Use casting functions.
Jan (janneke) Nieuwenhuizen [Sun, 18 Oct 2020 13:44:49 +0000 (15:44 +0200)]
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.

21 months agomescc: Mes C Library: Use casting functions.
Jan (janneke) Nieuwenhuizen [Sun, 18 Oct 2020 12:55:24 +0000 (14:55 +0200)]
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.

21 months agocore: Switch to pointer cells.
Jan (janneke) Nieuwenhuizen [Sun, 18 Oct 2020 09:34:32 +0000 (11:34 +0200)]
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.

22 months agobuild: Update snarfer.
Jan (janneke) Nieuwenhuizen [Sun, 27 Sep 2020 17:07:00 +0000 (19:07 +0200)]
build: Update snarfer.

* build-aux/mes-snarf.scm (symbol->header): Update for pointer cells.
(snarf-symbols): Likewise.
(snarf-functions): Likewise.

22 months agocore: Drop support for number based cells.
Jan (janneke) Nieuwenhuizen [Sun, 20 Sep 2020 09:32:38 +0000 (11:32 +0200)]
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.

22 months agocore: gc: Pointer cells: Drop cells->news->cells flipping.
Jan (janneke) Nieuwenhuizen [Sun, 20 Sep 2020 09:11:08 +0000 (11:11 +0200)]
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.

22 months agocore: gc: Abort upon broken heart failure.
Jan (janneke) Nieuwenhuizen [Sun, 20 Sep 2020 08:58:36 +0000 (10:58 +0200)]
core: gc: Abort upon broken heart failure.

* src/gc.c (gc_cellcpy, gc_loop): Abort upon broken heart failure.

22 months agocore: gc: Enable memory dump debugging.
Jan (janneke) Nieuwenhuizen [Sun, 20 Sep 2020 07:35:56 +0000 (09:35 +0200)]
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.

23 months agocore: gc: Add gc_dump_arena.
Jan (janneke) Nieuwenhuizen [Mon, 14 Sep 2020 12:53:56 +0000 (14:53 +0200)]
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.

23 months agocore: Pointer cells: Allow smaller memory footprint using cellcpy.
Jan (janneke) Nieuwenhuizen [Sun, 13 Sep 2020 16:20:52 +0000 (18:20 +0200)]
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.

23 months agotest/gc: Add three extra gc's.
Jan (janneke) Nieuwenhuizen [Mon, 17 Aug 2020 18:46:47 +0000 (20:46 +0200)]
test/gc: Add three extra gc's.

* src/test/gc.c (test_gc): Add three extra gc's.

2 years agotest/gc: struct.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 15:20:28 +0000 (17:20 +0200)]
test/gc: struct.

* src/test/gc.c (test_struct): New function.
(main): Call it.

2 years agotest/gc: vector.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 14:24:42 +0000 (16:24 +0200)]
test/gc: vector.

* src/test/gc.c (test_vector): New function.
(main): Call it.
(print_arena): New function.
(test_gc): Call it.

2 years agotest/gc: string.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 15:09:27 +0000 (17:09 +0200)]
test/gc: string.

* src/test/gc.c (test_string): New function.
(main): Call it.

2 years agotest/gc: list.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 10:02:22 +0000 (12:02 +0200)]
test/gc: list.

* src/test/gc.c (test_list): New function.
(main): Call it.

2 years agotest/gc: cons.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 10:00:18 +0000 (12:00 +0200)]
test/gc: cons.

2 years agotest/gc: number.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 09:56:02 +0000 (11:56 +0200)]
test/gc: number.

* src/test/gc.c (test_number): New function.
(main): Call it.

2 years agotest/gc: empty.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 09:22:30 +0000 (11:22 +0200)]
test/gc: empty.

* src/test/gc.c (test_empty): New function.

23 months agocore: eval-apply: Prepare for M2-Planet.
Jan (janneke) Nieuwenhuizen [Tue, 18 Aug 2020 21:01:53 +0000 (23:01 +0200)]
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.

23 months agocore: display: Prepare for pointer cells, M2-Planet.
Jan (janneke) Nieuwenhuizen [Tue, 18 Aug 2020 14:16:13 +0000 (16:16 +0200)]
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.

2 years agocore: gc: Prepare for pointer cells, M2-Planet.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 12:45:18 +0000 (14:45 +0200)]
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.

23 months agocore: Remove cell_call_with_current_continuation special.
Jan (janneke) Nieuwenhuizen [Tue, 18 Aug 2020 09:06:15 +0000 (11:06 +0200)]
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.

23 months agocore: Remove cell_begin special.
Jan (janneke) Nieuwenhuizen [Tue, 18 Aug 2020 08:40:55 +0000 (10:40 +0200)]
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.

23 months agocore: Remove unused symbols.
Jan (janneke) Nieuwenhuizen [Tue, 18 Aug 2020 08:33:56 +0000 (10:33 +0200)]
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.

23 months agocore: builtins: MES_MINI.
Jan (janneke) Nieuwenhuizen [Tue, 18 Aug 2020 07:36:19 +0000 (09:36 +0200)]
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.

2 years agoboot: Add gc test.
Jan (janneke) Nieuwenhuizen [Sun, 16 Aug 2020 15:36:55 +0000 (17:36 +0200)]
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.