Jan Nieuwenhuizen
750fef8dfb
core: Bump MAX_STRING to 524288
...
* src/strings.c (MAX_STRING): Bump to 524288.
(assert_max_string): New function.
(list_to_cstring, string_append, read_string): Use it.
* src/reader.c (reader_read_string): Use it.
2018-12-15 10:34:57 +01:00
Jan Nieuwenhuizen
1ab054002c
core: Add string-ref.
...
* src/strings.c (string_ref): New function.
* mes/module/mes/scm.mes (string-ref): Remove.
2018-11-16 00:15:50 +01:00
Jan Nieuwenhuizen
6af0b49f09
core: Add string-length.
...
* src/strings.c (string_length): New function.
* mes/module/mes/scm.mes (string-length): Remove.
2018-11-15 23:51:29 +01:00
Jan Nieuwenhuizen
819b32e61c
core: Add string-append.
...
* src/strings.c (string_append): New function.
* mes/module/mes/boot-0.scm.in (string-append): Remove.
* mes/module/mes/boot-03.scm (string-append): Remove.
* scaffold/boot/50-make-string.scm (string-append): Remove.
* scaffold/boot/50-string-append.scm (string-append): Remove.
* scaffold/boot/50-string-join.scm (string-append): Remove.
* scaffold/boot/51-module.scm (string-append): Remove.
* scaffold/boot/52-define-module.scm (string-append): Remove.
* tests/macro.test (string-append): Remove.
* scaffold/boot/17-string-append.scm: Move from 50-string-append.scm.
2018-11-15 23:09:56 +01:00
Jan Nieuwenhuizen
149f2a3e51
core: String as array of bytes.
...
* src/strings.c: New file.
* src/mes.c: Use it. Update users.
2018-11-11 16:25:36 +01:00
Jan Nieuwenhuizen
75655793d4
core: struct_set_: Oops typo.
...
* src/struct.c (struct_set_x_): Oops, remove indirection.
2018-11-14 08:16:58 +01:00
Jan Nieuwenhuizen
d2cba60eb4
core: read_string: Allow for gc.
...
* src/posix.c (read_char): Add optional port parameter.
(read_string): Allow for gc.
2018-11-11 10:17:50 +01:00
Jan Nieuwenhuizen
af328a444a
core: Add delete_file.
...
* src/posix.c (delete_file): New function.
2018-11-11 11:03:03 +01:00
Jan Nieuwenhuizen
35c8408df4
core: Add dup, dup2.
...
* src/posix.c (dup_, dup2_): New function.
2018-11-11 10:18:50 +01:00
Jan Nieuwenhuizen
7c63d3df47
core: Add getcwd.
...
* src/posix.c (getcwd_): New function.
2018-11-11 10:16:19 +01:00
Jan Nieuwenhuizen
7d2e0f1215
core: Support redirection of stderr.
...
* include/libmes-mini.h (g_stderr): New global.
* lib/mes/eputc.c (eputc): Use it.
* lib/mes/eputs.c (eputs): Likewise.
* lib/mes/oputc.c (oputc): Likewise.
* lib/mes/oputs.c (oputs): Likewise.
* src/lib.c (display_error_, write_error_): Likewise.
* src/posix.c (write_byte): Likewise.
* src/mes.c (mes_builtins): Likewise.
(main): Iniitalize g_stderr.
* src/posix.c (current_error_port, set_current_error_port): New
function.
* mes/module/mes/boot-0.scm.in (current-output-port,
current-error-port): Remove.
2018-11-11 10:04:03 +01:00
Jan Nieuwenhuizen
331a0c29e6
core: Assert g_free in alloc.
...
* src/mes.c (alloc): Assert g_free.
2018-11-11 10:01:49 +01:00
Jan Nieuwenhuizen
0e1d98963c
mes: read-string: Take optional port argument.
...
* src/posix.c (read_string): Take optional port argument.
* mes/module/mes/guile.mes (read-string): Remove.
2018-10-21 12:00:00 +02:00
Jan Nieuwenhuizen
d6660a5d83
core: eval_apply: Order gotos according to frequency.
...
* src/mes.c (eval_apply): Order gotos according to frequency.
2018-10-21 08:50:45 +02:00
Jan Nieuwenhuizen
fc78b41a10
Revert "core: eval_apply profile."
...
This reverts commit d61e6be0b18459a8e3c262eab448b428dc81937a.
2018-10-21 08:43:35 +02:00
Jan Nieuwenhuizen
a048a452e5
core: eval_apply profile.
...
* src/mes.c: Poor man's eval_apply profile.
2018-10-21 08:25:07 +02:00
Jan Nieuwenhuizen
9d1d85e041
core: Fix displaying of closure.
...
* src/lib.c (display_helper): Fix displaying of closure.
2018-10-20 20:01:45 +02:00
Jan Nieuwenhuizen
a233287c07
core: Set procedure in stack frame.
...
* src/mes.c (eval_apply): Set procedure in stack frame.
2018-10-20 18:27:13 +02:00
Jan Nieuwenhuizen
c2c361bf1a
core: Implement stack and frame.
...
* src/lib.c (frame_printer make_frame_type, make_frame,
make_stack_type, make_stack, stack_length, stack_ref): New function.
2018-10-20 18:23:20 +02:00
Jan Nieuwenhuizen
094bdac0bd
core: Support time functions.
...
* lib/linux/clock_gettime.c: New file, move from gnu.c.
* lib/linux/gettimeofday.c: New file, move from tcc.c.
* lib/linux/time.c: New file, move from tcc.c.
* lib/linux/libc.c: Include them.
* lib/linux/gnu.c (clock_gettime): Remove.
* lib/linux/tcc.c (time, gettimeofday): Remove.
* include/time.h (CLOCK_PROCESS_CPUTIME_ID): New define.
* src/posix.c (init_time, current_time, gettimeofday_,
seconds_and_nanoseconds_to_long, get_internal_run_time): New function.
* src/mes.c (scm_symbol_internal_time_units_per_second): New symbol.
(main): Call init_time.
2018-10-20 14:18:04 +02:00
Jan Nieuwenhuizen
ddb74e0a4a
core: Use hash table for symbols.
...
* src/mes.c (mes_symbols): Use hash table for symbols. Update users.
2018-10-18 18:50:09 +02:00
Jan Nieuwenhuizen
8e2a688a8c
core: Use assert before failure exit.
...
* src/mes.c (error): Use assert before failure exit. Helps debugging.
2018-10-19 23:01:59 +02:00
Jan Nieuwenhuizen
7efd949304
core: Add hashq_get_handle, hash, hash_ref, hash_set_x.
...
* src/mes.c (scm_symbol_hashq_table, scm_symbol_record_type,
scm_symbol_module, scm_symbol_buckets, scm_symbol_size): New symbols.
Update users.
* src/hash.c (hash_list_of_char): Rename from hashq_. Respect size,
update callers.
(hashq_, hash_ hash, hashq_get_handle, hash_ref, hash_set_x_,
hash_set_x): New function.
(hashq_ref): Do not return handle. Update callers.
2018-10-18 07:55:28 +02:00
Jan Nieuwenhuizen
67046e1b00
mes: Move pair? to core.
...
* src/lib.c (pair_p): New function. Gains 8% performance on MesCC.
2018-10-18 20:06:10 +02:00
Jan Nieuwenhuizen
5ed45a4e24
mes: Move assoc to core.
...
* mes/mes.c (assoc_string, assoc): New function.
* mes/module/mes/scm.mes (assoc): Remove. Gains 12% performance for
MesCC.
2018-10-19 22:38:19 +02:00
Jan Nieuwenhuizen
4e0e4c83d8
Revert "core: Add gc-debug for stack array."
...
This reverts commit f35084d1dbea889d107824e7596da1701c6b90ad.
2018-10-20 10:58:56 +02:00
Jan Nieuwenhuizen
e032f6c70f
core: Add gc-debug for stack array.
...
* src/gc.c (gc_debug): New function.
2018-10-19 21:23:17 +02:00
Jan Nieuwenhuizen
d73df09ab6
core: Use array-based stack.
...
* src/mes.c (STACK_SIZE)[MES_ARRAY_STACK]: New variable.
(g_stack_array): New variable.
(g_stack): Change type to SCM*.
(gc_push_frame)[MES_ARRAY_STACK]: Use g_stack_array, g_stack.
(gc_peek_frame): Likewise.
(gc_pop_frame): Likewise.
* src/gc.c (gc_check): Likewise.
(gc): Likewise.
2017-12-14 07:05:53 +01:00
Jan Nieuwenhuizen
a99f9c6df9
core: expand_variable: Remove weird exceptions: begin, if.
...
* src/mes.c (expand_variable_): Remove weird exceptions: begin, if.
2018-10-16 17:13:04 +02:00
Jan Nieuwenhuizen
b226a175f8
mes: Switch to srfi-9 based on structs.
...
* mes/module/srfi/srfi-9.mes: Swap symlink to srfi-9-struct.mes.
* mes/module/srfi/srfi-9/gnu.mes: Swap symlink to gnu-struct.mes.
* src/module.c (make_module_type): Update to match srfi-9-struct
records. Update users.
* src/hash.c (make_hashq_type): Likewise.
2018-10-15 20:42:10 +02:00
Jan Nieuwenhuizen
4ff9b36f26
mes: srfi-9: Add implementation based on struct.
...
* mes/module/srfi/srfi-9-struct.mes: New file.
* mes/module/srfi/srfi-9-vector.mes: Rename from srfi-9.mes
* mes/module/srfi/srfi-9.mes: Symlink to srfi-9-vector.mes.
* mes/module/srfi/srfi-9/gnu-struct.mes: Add srfi-9-struct
implementation.
* mes/module/srfi/srfi-9/gnu-vector.mes: Rename from gnu.mes.
* mes/module/srfi/srfi-9/gnu.mes: Symlink to gnu-vector.mes.
2018-10-15 16:57:00 +02:00
Jan Nieuwenhuizen
8c0a517edf
core: hashq-table: Refactor to be a record-like struct.
...
* src/hash.c (hash_table_printer): New function.
(make_hashq_type): New function.
* src/module.c (module_printer): Use it.
(make_module_type): New function.
(make_initial_module): Use them.
2018-10-15 15:45:41 +02:00
Jan Nieuwenhuizen
d472c4b6f2
core: Use hashq-table for macros.
...
* src/mes.c (lookup_macro_): Remove.
(macro_ref, get_macro, macro_set_x): New function. Update callers.
2018-10-15 14:13:51 +02:00
Jan Nieuwenhuizen
d552ef7c67
core: Add hashq-table type.
...
src/hash.c: New file.
src/module.c (char_hash, module_hash): Remove.
* src/module.c (make_initial_module): Use hash primitives.
(module_define_x): Likewise.
(module_variable): Likewise.
* build-aux/snarf.sh: Snarf it.
* src/mes.c: Include it.
2018-10-15 13:36:19 +02:00
Jan Nieuwenhuizen
bba17734d8
core: Add boot-module.
...
* src/mes.c (scm_symbol_boot_module): New symbol.
(eval_apply): Handle it.
(mes_symbols): Initialize it.
2018-10-15 10:44:47 +02:00
Jan Nieuwenhuizen
7da67941e2
core: Add module-define!
...
* src/module.c (module_define_x, module_printer): New function.
(make_initial_module): Use them.
* tests/srfi-0.test: Test it.
* src/mes.c (display_m0): Remove. Update callers.
* mes/module/mes/fluids.mes (make-fluid): Rewrite.
* tests/macro.test: Test it.
* mes/module/mes/boot-0.scm.in (module-define!): Remove.
* mes/module/mes/boot-02.scm: Likewise.
* module/mes/misc.scm (pk, warn): New function.
* build-aux/check-mes.sh (tests): Run tests.
2018-10-14 09:10:30 +02:00
Jan Nieuwenhuizen
16934697f7
core: Add module indirection for variable lookup.
...
* src/module.c (module_ref, module_variable): New function.
* src/mes.c: Thoughout: Use them.
(assq_ref_env): Remove.
* mes/module/mes/boot-0.scm.in (defined?): Use module-variable.
* mes/module/mes/boot-00.scm (defined?): Likewise.
* mes/module/mes/boot-01.scm (defined?): Likewise.
* mes/module/mes/boot-02.scm (defined?): Likewise.
* scaffold/boot/53-closure-display.scm: Likewise.
2018-10-14 08:30:18 +02:00
Jan Nieuwenhuizen
79c1fe0466
core: Add module type.
...
* src/module.c: New file.
* build-aux/snarf.sh: Snarf it.
* src/mes.c: Include it.
2018-10-14 08:15:22 +02:00
Jan Nieuwenhuizen
96ca5b4e4b
core: Add cstring_to_symbol.
...
* src/mes.c (make_symbol): Rename from lookup_symbol_. Update
callers.
(cstring_to_symbol): New function.
* src/reader.c (reader_read_identifier_or_number): Use it.
2018-10-14 07:38:51 +02:00
Jan Nieuwenhuizen
0068fe533d
core: Add struct type.
...
* src/struct.c: New file.
* build-aux/snarf.sh: Snarf it.
* src/mes.c: Include it.
2018-10-13 17:34:27 +02:00
Jan Nieuwenhuizen
2d882ee7bb
core: core:cdr: Support port type.
...
* src/mes.c (cdr_): Support port type.
* mes/module/mes/display.mes (display): Add space between fields.
2018-10-15 12:28:02 +02:00
Jan Nieuwenhuizen
a155a0a9a2
core: Support \xNN in reader. Fixes tcc-boot running on Mes.
...
* src/reader.c (reader_read_string): Support \xNN. Fixes Guix
bootstrap chain; i.e., compilation of gcc-2.95.3 using tcc-boot.
* tests/base.test ("reader: \\x08"): Test it.
* scaffold/tests/17-compare-char.c: Likewise, for mescc.
* build-aux/check-mescc.sh (tests): Run it.
2018-12-13 18:19:43 +01:00
Jan Nieuwenhuizen
183514d103
core: reader: Support 64 bit.
...
* src/reader.c (reader_read_identifier_or_number): Support 64 bit.
(reader_read_binary): Likewise.
(reader_read_octal): Likewise.
(reader_read_hex): Likewise.
2018-10-07 00:58:31 +02:00
Jan Nieuwenhuizen
f7e208dd7b
core: Avoid 64bit zero divide.
...
* src/math.c (divide): Avoid (64bit) 0 divide.
(modulo): Likewise.
2018-10-07 00:25:33 +02:00
Jan Nieuwenhuizen
d0a1cc5096
core: Use proper name for %compiler.
...
* src/mes.c (mes_symbols, bload_env): : Use proper name for %compiler.
2018-10-06 08:43:26 +02:00
Jan Nieuwenhuizen
e4e41a30b4
core: Resurrect MES_MINI for non-POSIX.
...
src/mes.c[MES_MINI,!POSIX]: Resurrect.
2018-10-06 07:25:39 +02:00
Jan Nieuwenhuizen
133013a3d2
core: Support x86_64.
...
* src/lib.c: Support x86_64.
* src/math.c: Likewise.
* src/mes.c: Likewise.
* src/reader.c: Likewise.
* src/vector.c Likewise.
2018-10-04 21:43:45 +02:00
Jan Nieuwenhuizen
bc094d0e1f
core: mes: Prepare for M2-Planet.
...
* src/mes.c (cal): Refactor to use if instead of switch.
(eval_apply): Likewise.
2018-08-12 16:53:21 +02:00
Jan Nieuwenhuizen
1e787637d8
core: lib: Prepare for M2-Planet.
...
* src/lib.c (display_helper): Refactor to use if instead of switch.
(memq): Likewise.
2018-08-12 16:41:07 +02:00
Jan Nieuwenhuizen
03ee240904
core: reader: Prepare for M2-Planet.
...
* src/reader.c (MAX_STRING): New define.
(read_input_file_env_): Remove dead code.
(reader_read_line_comment): Refactor to remove recursion.
(reader_read_line_sexp_): Refactor to use if instead of switch.
(reader_read_hash): Likewise.
(reader_read_character): Refactor: cache peekchar () value, make
M2-Planet friendly.
(reader_read_binary): Make M2-Planet friendly.
(reader_read_octal): Likewise.
(reader_read_hex): Likewise.
(reader_read_string): Refactor.
(dump): Make M2-Planet friendly.
2018-08-12 14:53:06 +02:00
Jan Nieuwenhuizen
5a6d8c21e0
mescc: Mes C Library: Add x86_64 libc support.
...
* include/linux/x86_64/syscall.h: New file.
* include/linux/x86/syscall.h: New file.
* lib/linux/x86_64-mes-gcc/mes.c: New file.
* lib/linux/x86-mes/mes.c: Rename from lib/linux/mes.c.
* lib/linux/x86-mes-gcc/mes.c: Rename from lib/linux/gcc.c.
* lib/linux/libc.c: Update includes.
(waitpid)[__x86_64__]: Use wait4.
* build-aux/build-cc.sh: Build libc too.
* lib/x86-mes/x86.M1 (mov____0x8(%ebp),%esi): New macro.
2018-08-11 11:42:30 +02:00
Jan Nieuwenhuizen
46e0641e9c
mescc: Mes C Library: Add x86_64 libc-mini support.
...
* lib/linux/x86-mes-gcc/mini.c: Rename from lib/linux/mini-gcc.c.
* lib/linux/x86-mes/mini.c: Rename from lib/linux/mini-mes.c.
* lib/linux/x86_64-mes-gcc/crt1.c: Rename from lib/linux/x86_64/crt1.c.
* lib/linux/x86_64-mes-gcc/mini.c: New file.
* build-aux/build-cc.sh: Build libc-mini, scaffold/main, scaffold/hello.
* build-aux/cc64.sh: New file.
2018-08-10 17:05:01 +02:00
Jan Nieuwenhuizen
f18e1fea36
build: Make build more autotools-like.
...
* build-aux/build.sh.in: Move from ./build.sh
* build-aux/check.sh.in: Likewise.
* build-aux/GNUmakefile.in: Likewise.
* build-aux/install.sh.in: Likewise.
* build-aux/uninstall.sh.in: Likewise.
* configure: Substitute them.
* configure.sh: Likewise.
* build-aux/build-cc.sh: Update: use ${srcdest} instead of ${top_builddest}.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/config.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build-aux/trace.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
* .gitignore: Likewise.
2018-07-25 08:14:13 +02:00
Jan Nieuwenhuizen
72cb975213
GNU Mes.
...
Throughout, make these changes
Copyright headers: GNU Mes
First mention of name: GNU Mes
Website: https://www.gnu.org/software/mes
Git: git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen
4203a427d0
build: Support --srcdir build.
...
* build-aux/config.sh: New file.
* build-aux/trace.sh: New file.
* build-aux/GNUmakefile.in: New file.
* configure: Support srcdir configure.
* GNUmakefile: Support srcdir build.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/mes-snarf.scm: Likewise.
* build-aux/pre-inst-env.in: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* check.sh: Likewise.
* install.sh: Likewise.
* module/mescc/mescc.scm: Likewise.
* scripts/mescc.in: Likewise.
* src/mes.c: Likewise.
2018-07-22 00:43:39 +02:00
Jan Nieuwenhuizen
87269a16f6
core: Document number->string INT-MIN failure with gcc-x86.
...
* src/mes.c (scm_symbol_arch, scm_symbol_compiler): New symbol.
(mes_symbols, bload_env): Add them.
(scm_symbol_gnuc, scm_symbol_mesc): Remove.
* scaffold/mini-mes.c: Likewise.
* module/mes/mes-0.scm (%arch, %compiler): New public variable.
* tests/srfi-13.test: Expect number->string INT-MIN to fail for
gcc-x86.
* HACKING (Bugs): Add it.
2018-07-21 15:20:01 +02:00
Jan Nieuwenhuizen
57cb608b6a
core: Resurrect gcc support.
...
* src/mes.c (MES_ARENA)[POSIX]: Default to 100000000.
2018-07-21 10:48:31 +02:00
Jan Nieuwenhuizen
542289a3c6
build: Separate Mes and Guile modules.
...
* scaffold/gc.scm: Move from guile/gc.scm.
* guile/: Remove.
* module/language/paren.mes: Remove.
* mes/module/mes/base.mes: Move from module/mes/.
* mes/module/mes/boot-0.scm: Likewise.
* mes/module/mes/boot-00.scm: Likewise.
* mes/module/mes/boot-01.scm: Likewise.
* mes/module/mes/boot-02.scm: Likewise.
* mes/module/mes/catch.mes: Likewise.
* mes/module/mes/display.mes: Likewise.
* mes/module/mes/fluids.mes: Likewise.
* mes/module/mes/getopt-long.mes: Likewise.
* mes/module/mes/guile.mes: Likewise.
* mes/module/mes/lalr.mes: Likewise.
* mes/module/mes/lalr.scm: Likewise.
* mes/module/mes/let.mes: Likewise.
* mes/module/mes/match.mes: Likewise.
* mes/module/mes/match.scm: Likewise.
* mes/module/mes/mescc.mes: Likewise.
* mes/module/mes/misc.mes: Likewise.
* mes/module/mes/module.mes: Likewise.
* mes/module/mes/optargs.mes: Likewise.
* mes/module/mes/optargs.scm: Likewise.
* mes/module/mes/peg.mes: Likewise.
* mes/module/mes/peg/cache.scm: Likewise.
* mes/module/mes/peg/codegen.scm: Likewise.
* mes/module/mes/peg/simplify-tree.scm: Likewise.
* mes/module/mes/peg/string-peg.scm: Likewise.
* mes/module/mes/peg/using-parsers.scm: Likewise.
* mes/module/mes/pmatch.mes: Likewise.
* mes/module/mes/pmatch.scm: Likewise.
* mes/module/mes/posix.mes: Likewise.
* mes/module/mes/pretty-print.mes: Likewise.
* mes/module/mes/pretty-print.scm: Likewise.
* mes/module/mes/psyntax-0.mes: Likewise.
* mes/module/mes/psyntax-1.mes: Likewise.
* mes/module/mes/psyntax.mes: Likewise.
* mes/module/mes/psyntax.pp: Likewise.
* mes/module/mes/psyntax.ss: Likewise.
* mes/module/mes/quasiquote.mes: Likewise.
* mes/module/mes/quasisyntax.mes: Likewise.
* mes/module/mes/quasisyntax.scm: Likewise.
* mes/module/mes/repl.mes: Likewise.
* mes/module/mes/scm.mes: Likewise.
* mes/module/mes/syntax.mes: Likewise.
* mes/module/mes/syntax.scm: Likewise.
* mes/module/mes/test.mes: Likewise.
* mes/module/mes/tiny-0.mes: Likewise.
* mes/module/mes/type-0.mes: Likewise.
* mes/module/mescc/M1.mes: Likewise.
* mes/module/mescc/as.mes: Likewise.
* mes/module/mescc/bytevectors.mes: Likewise.
* mes/module/mescc/compile.mes: Likewise.
* mes/module/mescc/i386/as.mes: Likewise.
* mes/module/mescc/info.mes: Likewise.
* mes/module/mescc/mescc.mes: Likewise.
* mes/module/mescc/preprocess.mes: Likewise.
* mes/module/nyacc/lalr.mes: Likewise.
* mes/module/nyacc/lang/c99/cpp.mes: Likewise.
* mes/module/nyacc/lang/c99/parser.mes: Likewise.
* mes/module/nyacc/lang/c99/pprint.mes: Likewise.
* mes/module/nyacc/lang/calc/parser.mes: Likewise.
* mes/module/nyacc/lang/util.mes: Likewise.
* mes/module/nyacc/lex.mes: Likewise.
* mes/module/nyacc/parse.mes: Likewise.
* mes/module/nyacc/util.mes: Likewise.
* mes/module/rnrs/arithmetic/bitwise.mes: Likewise.
* mes/module/srfi/srfi-0.mes: Likewise.
* mes/module/srfi/srfi-1.mes: Likewise.
* mes/module/srfi/srfi-1.scm: Likewise.
* mes/module/srfi/srfi-13.mes: Likewise.
* mes/module/srfi/srfi-14.mes: Likewise.
* mes/module/srfi/srfi-16.mes: Likewise.
* mes/module/srfi/srfi-16.scm: Likewise.
* mes/module/srfi/srfi-26.mes: Likewise.
* mes/module/srfi/srfi-26.scm: Likewise.
* mes/module/srfi/srfi-43.mes: Likewise.
* mes/module/srfi/srfi-8.mes: Likewise.
* mes/module/srfi/srfi-9.mes: Likewise.
* mes/module/srfi/srfi-9/gnu.mes: Likewise.
* mes/module/sxml/xpath.mes: Likewise.
* mes/module/sxml/xpath.scm: Likewise.
* module/mes/mes-0.scm: Likewise.
* build-aux/build-guile.sh: Update for new layout.
* build-aux/build-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* install.sh: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scripts/mescc: Likewise.
* src/mes.c: Likewise.
* tests/base.test-guile: Likewise.
* tests/boot.test: Likewise.
* tests/srfi-9.test: Likewise.
* mes/include: New symlink.
* mes/lib: New symlink.
* AUTHORS: Update file names.
2018-07-21 07:15:52 +02:00
Jan Nieuwenhuizen
f6d5578174
core: Fix segfault on Debian/strectch. Thanks, pdewacht!
...
* src/posix.c (execl_): Typo in initialization. Fixes segfault on
Debian/strectch. Thanks, pdewacht!
2018-07-12 22:30:00 +02:00
Jan Nieuwenhuizen
16f4adfbc2
core: Fix compile warnings.
...
* lib/libmes.c: Fix warning.
* src/posix.c (execl_): Fix warning, add debug printing.
2018-06-26 06:19:51 +02:00
Jan Nieuwenhuizen
7be16f51b3
core: execl_: Allow 1000 arguments.
...
* src/posix.c (execl_): Allow 1000 arguments.
2018-06-26 06:05:20 +02:00
Jan Nieuwenhuizen
a1334148ca
core: Resurrect dump-tiny.
...
* src/reader.c (dump): Resurrect dump-tiny.
2018-06-18 22:55:23 +02:00
Jan Nieuwenhuizen
8793e0dde3
core: Resurrect loading of boot-0.32-mo.
2018-06-18 18:55:59 +02:00
Jan Nieuwenhuizen
de964f3e1f
mescc: Support gcc-2.6.3.
...
* TODO
2018-06-02 11:41:06 +02:00
Jan Nieuwenhuizen
f1efaa0e93
mescc: Support binutils-2.5.1.
...
* include/stdint.h: #undef types before typedef'ing them.
* include/sys/types.h: Likewise.
* include/string.h (NULL): New define.
* include/stdio.h (BUFSIZ): New define.
2018-05-30 21:55:39 +02:00
Jan Nieuwenhuizen
272b522962
build: Use arch-dir.
...
* lib/x86-mes: Move from stage0.
* build-aux/build-cc.sh: Create libraries in lib/gcc. Update users.
* build-aux/build-mes.sh: Create libraries in lib/x86-mes. Update users.
* build-aux/build-mes-gcc.sh: Rename from build-mlibc.sh. Create
libraries in lib/x86-mes-gcc. Update callers.
* build-aux/cc-mes-gcc.sh: Rename from cc-mlibc.sh. Update callers.
2018-05-29 20:07:46 +02:00
Jan Nieuwenhuizen
2cda87257a
mlibc: Cleanup.
2018-05-29 18:15:22 +02:00
Jan Nieuwenhuizen
58a0b97991
core: Refactor boot-0 loading.
...
* src/mes.c (load_boot): New function.
(load_env): Use it.
2018-05-28 18:53:25 +02:00
Jan Nieuwenhuizen
4ee1c9595e
Revert "fork/exec: debug."
...
This reverts commit f0315ac0d9acd66a30dbb192334f443459b7ed16.
2018-05-25 11:21:26 +02:00
Jan Nieuwenhuizen
342195bbbd
fork/exec: debug.
2018-05-25 11:21:06 +02:00
Jan Nieuwenhuizen
e4d0298d1b
core: Support fork, waitpid, execve.
...
* stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define.
* lib/linux-gcc.c (fork, waitpid, execve): New function.
* lib/linux-mes.c (fork, waitpid, execve): New function.
* lib/libc.c (wait): New function.
* include/unistd.h (fork, execve): Declare.
* include/sys/wait.h (waitpid, wait): Declare.
* module/mes/posix.mes (search-path, execlp, system*, waitpid): New function.
* src/posix.c (primitive_fork, execl): New function.
2018-05-24 19:54:42 +02:00
Jan Nieuwenhuizen
c4abd50a53
core: Add logxor.
...
* src/math.c (logxor): New function.
* tests/math.test ("logxor"): Test it.
2018-05-16 22:30:08 +02:00
Jan Nieuwenhuizen
04860cca6b
core: reader: Support binary #b101.
...
* src/reader.c (reader_read_binary): New function.
(reader_read_hash): Use it.
* tests/scm.test ("binary"): Test it.
2018-05-16 22:32:59 +02:00
Jan Nieuwenhuizen
7b476693c2
core: Have core:eval expand macros.
...
* src/mes.c (core:eval-expand): Remove
(core:eval-expanded): New variable.
(eval_apply): Have core:eval expand macros; core:eval-expanded evals
expanded sexps.
2018-04-28 18:31:10 +02:00
Jan Nieuwenhuizen
1400489a94
Revert "core: Remove pmatch-car, pmatch-cdr hack."
...
This reverts commit be1e84624ea4a158173f34af923e3c4a3793412a.
2018-04-29 07:46:40 +02:00
Jan Nieuwenhuizen
c03449ac5a
core: Remove pmatch-car, pmatch-cdr hack.
...
* src/mes.c (scm_vm_eval_pmatch_car, scm_vm_eval_pmatch_cdr): Remove
(eval_apply): Remove cell_vm_eval_pmatch_car,
cell_vm_eval_pmatch_cdr hack.
(mes_symbols): Remove cell_symbol_pmatch_car, cell_symbol_pmatch_cdr.
* scaffold/mini-mes.c: Likewise.
* module/mes/guile.scm (mes): Remove pmatch-car, pmatch-cdr.
* module/mes/pmatch.scm (ppat): Use plain car, cdr.
2018-04-28 12:19:40 +02:00
Jan Nieuwenhuizen
99718a8b7a
core: Fixes for int-max, int-min.
...
* src/math.c (greater_p): Fix INT_MAX > 0.
(less_p): Fix INT_MIN < 0.
* tests/math.test ("< INT-MIN"): Test it.
("< INT-MAX"):
("> INT-MAX"):
("> INT-MAX 0"):
("> INT-MIN"):
* tests/srfi-13.test ("string->number INT-MAX"): Test it.
("string->number INT-MIN"):
("number->string INT-MAX"):
("number->string INT-MIN"):
* scaffold/tests/60-math.c (test): Test it.
2018-05-02 23:11:27 +02:00
Jan Nieuwenhuizen
6d3fee91b9
Revert "core: length: Check parameter."
...
This reverts commit 1f52ed35c66febcce16e06868e803a39be7eda41.
2018-04-30 20:47:05 +02:00
Jan Nieuwenhuizen
ec85612ac4
core: length: Check parameter.
...
* src/mes.c (length): Check parameter.
2018-04-30 19:31:00 +02:00
Jan Nieuwenhuizen
a937d18c38
build: Simplify, drop make.scm experiment.
...
* build.sh: Rewrite.
* build-aux/build-cc.sh: New file.
* build-aux/build-mes.sh: New file.
* build-aux/build-mlibc.sh: New file.
* build-aux/cc.sh: New file.
* build-aux/cc-mes.sh: New file.
* build-aux/cc-mlibc.sh: New file.
* install.sh: Update.
* make.scm: Remove.
* guile/guix/make.scm: Remove.
* guile/guix/records.scm: Remove.
* guile/guix/shell-utilsg.scm: Remove.
2018-04-29 18:38:57 +02:00
Jan Nieuwenhuizen
3e6319058a
core: Use length__.
...
* src/mes.c (check_formals): Use length__.
2018-04-30 21:17:10 +02:00
Jan Nieuwenhuizen
664289c50f
mes-snarf: Support running with Mes.
...
* build-aux/mes-snarf.scm: Support running with Mes.
2018-04-29 07:56:52 +02:00
Jan Nieuwenhuizen
41fe739463
core: reverse!: Handle empty list.
...
* src/mes.c (reverse_x_): Handle empty list.
* tests/scm.test ("reverse! ()"): Test it.
2018-04-29 18:14:01 +02:00
Jan Nieuwenhuizen
dc24a7f76f
core: Add string ports.
...
* src/mes.c (type_t): Add TPORT.
(scm_type_port): New symbol.
(PORT): New macro.
(MAKE_STRING_PORT): New macro.
(eval_apply): Handle string ports in primitive-load.
(mes_symbols): Add scm_type_port.
* src/posix.c (peekchar): Handle string ports.
(readchar): New function. Replace all getchar callers.
(unreadchar): Likewise.
* module/mes/type-0 (port?): New function.
* module/mes/guile.mes (with-input-from-file): Rewrite.
(open-input-string): Remove.
* module/mes/guile.scm (guile): Update cell types.
* src/gc.c (gc_loop): Support TPORT.
* src/lib.c (display_helper): Support TPORT.
* module/mes/display.mes (display): Support TPORT.
2018-04-29 17:48:38 +02:00
Jan Nieuwenhuizen
c20ef52f6f
mes: assq, assoc-ref: Handle non-A-LISTs.
...
* src/mes.c (assq): Return #f if A-LIST is not a list.
* module/mes/scm.mes (assoc): Likewise.
2018-04-29 16:17:07 +02:00
Jan Nieuwenhuizen
8911af4aa8
core: Use single definition rule for cell-type.
...
* src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation,
scm_type_function, scm_type_keyword, scm_type_macro,
scm_type_number, scm_type_pair, scm_type_ref, scm_type_special,
scm_type_string, scm_type_symbol, scm_type_values,
scm_type_variable, scm_type_vector): New symbol.
(mes_symbols): Add them.
* module/mes/type-0.mes (<cell:char>, <cell:char>, <cell:closure>,
<cell:continuation>, <cell:function>, <cell:keyword>, <cell:macro>,
<cell:number>, <cell:pair>, <cell:ref>, <cell:special>,
<cell:string>, <cell:symbol>, <cell:values>, <cell:variable>,
<cell:vector>, <cell:broken-heart): Remove.
* module/mes/boot-0.scm: Likewise.
* module/mes/boot-01.scm: Likewise.
* module/mes/boot-02.scm: Likewise.
* scaffold/boot/20-define-quote.scm: Likewise.
* scaffold/boot/37-closure-lambda.scm: Likewise.
* scaffold/boot/38-simple-format.scm: Likewise.
* scaffold/boot/4c-quasiquote.scm:
* scaffold/boot/4e-string-split.scm: Likewise.
* scaffold/boot/51-module.scm: Likewise.
* scaffold/boot/52-define-module.scm: Likewise.
* scaffold/boot/60-let-syntax.scm: Likewise.
* module/mes/guile.scm: Add some of them.
2018-04-29 13:22:02 +02:00
Jan Nieuwenhuizen
a56d5e3efe
core: Fix gc_up_arena for x86_64.
...
* src/gc.c (gc_): Fix gc_up_arena for x86_64.
2018-04-29 12:04:18 +02:00
Jan Nieuwenhuizen
865e72ae8a
core: Fix compile warnings.
...
* src/posix.c: Include sys/stat.h.
(chmod): Return cell_unspecified.
* include/stdlib.h: Typo.
2018-04-29 12:02:23 +02:00
Jan Nieuwenhuizen
2cc6f166db
core: Add chmod.
...
* src/posix.c (chmod_): New function.
2018-04-27 23:31:45 +02:00
Jan Nieuwenhuizen
e3b929aa87
core: jam-scaper/garbage-collector: Use only one arena.
...
* src/mes.c (ARENA_SIZE): Lower to 200000.
(MES_MAX_ARENA): Bump to 300000000.
(JAM_SIZE): New global.
(make_cell__): Remove ARENA assert.
(gc_init_cells): Alloc ARENA_SIZE + JAM_SIZE.
(mes_symbols): Do not init news.
(gc_init_news): Remove.
(main): Initialize JAM_SIZE, consider MES_JAM environment variable.
* src/gc.c (gc_init_news): Move from mes.c. Start at g_free.
(gc_flip): Do not flip to g_news, instead copy g_news to cells.
(gc_up_arena): Realloc to ARENA_SIZE + JAM_SIZE.
(gc_): Init news. Only up arena if g_news is safe.
2018-04-25 08:35:05 +02:00
Jan Nieuwenhuizen
18d143aa62
core: last_pair: Move to core.
...
* src/lib.c (last_pair): New function.
* module/mes/scm.mes (last-pair): Remove.
2018-04-24 07:00:35 +02:00
Jan Nieuwenhuizen
4fa6acc480
core: equal2_p: Add short-circuit and eliminate tail call.
...
* src/lib.c (equal2_p): Add short-circuit and eliminate tail call.
2018-04-24 06:59:18 +02:00
Jan Nieuwenhuizen
630718f134
mes: Guile-like command-line interface.
...
* module/mes/boot-0.scm (tty?): Guile-like command-line interface.
* scripts/repl.mes: Remove.
* scripts/mescc.mes: Update.
* tests/*.test: Update scripts.
* module/mes/repl.mes (repl): Add ,quit.
2018-04-22 11:51:28 +02:00
Jan Nieuwenhuizen
bb45012c39
mes: Add isatty?.
...
* src/posix.c (isatty_p): New function.
2018-04-22 11:48:38 +02:00
Jan Nieuwenhuizen
75444afc21
core: Compile minimal mes with MES_MINI=1.
...
* src/mes.c: Compile minimal mes with MES_MINI=1.
2018-04-10 21:43:19 +02:00
Jan Nieuwenhuizen
3f943c8cfa
core; reader_read_string: Support escaped characters.
...
* src/reader.c (reader_read_string): Support escaped characters.
2018-04-22 00:33:50 +02:00
Jan Nieuwenhuizen
6be49a294b
core: display_helper: Display escaped characters.
...
* src/lib.c (display_helper): Display escaped characters.
2018-04-21 23:58:28 +02:00
Jan Nieuwenhuizen
7ecec93a88
mes: Resurrect macros in repl.
...
* src/mes.c (scm_vm_begin_expand): Rename to core:begin-expand.
(eval_apply): Expose it.
* module/mes/repl.mes (repl): Use it to resurrect macros.
2018-04-21 17:30:14 +02:00
Jan Nieuwenhuizen
833fe991cb
core: Fixes for garbage collector/jam scraper.
...
* src/gc.c (gc_loop): Do not relocate car of TCLOSURE, TCONTINUATION.
Check for TBROKEN_HEART.
* src/mes.c (make_closure_): Set car to 0.
(check_apply): Check for TBROKEN_HEART. Fixes reporting artificial
out-of-memory error.
(eval_apply): Likewise.
* src/vector.c (vector_entry): Only copy TCHAR and TNUMBER.
2018-04-21 13:31:12 +02:00
Jan Nieuwenhuizen
0be441446e
core: drop global_p from variable.
...
* src/mes (struct scm): Remove field global_p.
(VARIABLE_GLOBAL_P): Remove.
(make_variable_): Remove global_p parameter. Update callers.
* src/lib.c (display_helper): Drop VARIABLE_GLOBAL_P support.
2018-04-21 13:19:54 +02:00