Commit Graph

1767 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 3480813038
mescc: Mes C Library: Populate with function tests from scaffold.
* .gitignore: Update.
* build-aux/bootstrap.sh.in: Update.
* build-aux/build-mes.sh: Update.
* build-aux/check-mescc.sh: Update.
* lib/tests/assert/50-assert.c: Move from scaffold/tests/50-assert.c.
* lib/tests/dirent/90-readdir.c: Move from scaffold/tests/99-readdir.c.
* lib/tests/dirent/readdir.dir: Move from scaffold/tests/readdir.dir.
* lib/tests/io/90-stat.c: Move from scaffold/tests/92-stat.c.
* lib/tests/mes/30-oputs.c: Move from scaffold/tests/31-oputs.c.
* lib/tests/mes/50-itoa.c: Move from scaffold/tests/51-itoa.c.
* lib/tests/posix/90-unsetenv.c: Move from scaffold/tests/94-unsetenv.c.
* lib/tests/setjmp/80-setjmp.c: Move from scaffold/tests/80-setjmp.c.
* lib/tests/signal/90-signal.c: Move from scaffold/tests/95-signal.c.
* lib/tests/stdio/70-printf-hello.c: Move from scaffold/tests/70-printf-hello.c.
* lib/tests/stdio/70-printf-simple.c: Move from scaffold/tests/70-printf-simple.c.
* lib/tests/stdio/70-printf.c: Move from scaffold/tests/70-printf.c.
* lib/tests/stdio/80-sscanf.c: Move from scaffold/tests/87-sscanf.c.
* lib/tests/stdio/90-fopen-append.c: Move from scaffold/tests/98-fopen.c.
* lib/tests/stdio/90-fopen.c: Move from scaffold/tests/97-fopen.c.
* lib/tests/stdio/90-fread-fwrite.c: Move from scaffold/tests/93-fread-fwrite.c.
* lib/tests/stdio/90-fseek.c: Move from scaffold/tests/91-fseek.c.
* lib/tests/stdlib/50-getenv.c: Move from lib/tests/stdlib/getenv.c.
* lib/tests/stdlib/50-malloc.c: Move from lib/tests/stdlib/malloc.c.
* lib/tests/stdlib/70-strtoull.c: Move from scaffold/tests/7j-strtoull.c.
* lib/tests/stdlib/80-qsort-dupes.c: Move from scaffold/tests/81-qsort-dupes.c.
* lib/tests/stdlib/80-qsort.c: Move from scaffold/tests/81-qsort.c.
* lib/tests/stdlib/90-strtol.c: Move from scaffold/tests/96-strto.c.
* lib/tests/string/30-strlen.c: Move from scaffold/tests/30-strlen.c.
* lib/tests/string/50-strcmp.c: Move from scaffold/tests/51-strcmp.c.
* lib/tests/string/50-strcpy.c: Move from scaffold/tests/53-strcpy.c.
* lib/tests/string/50-strncmp.c: Move from scaffold/tests/51-strncmp.c.
* lib/tests/string/70-strchr.c: Move from scaffold/tests/70-strchr.c.
* lib/tests/string/80-strncpy.c: Move from scaffold/tests/86-strncpy.c.
* lib/tests/string/80-strrchr.c: Move from scaffold/tests/88-strrchr.c.
* lib/tests/string/90-snprintf.c: Move from scaffold/tests/9a-snprintf.c.
* lib/tests/string/90-strpbrk.c: Move from scaffold/tests/90-strpbrk.c.
* lib/tests/string/90-strspn.c: Move from scaffold/tests/90-strspn.c.
2019-02-24 17:51:53 +01:00
Jan Nieuwenhuizen a3d87214ea
mescc: Mes C Library: Start test suite.
TODO: move strict libc tests from scaffold/test/* here.

* lib/tests/stdlib/getenv.c: New file.
* lib/tests/stdlib/malloc.c: Move from scaffold.
* build-aux/bootstrap.sh.in: Built them.
* build-aux/build-mes.sh: Likewise.
2019-02-24 09:39:00 +01:00
Jan Nieuwenhuizen a9bf3bfb12
mes: Remove stray debugging newline output.
* mes/module/mes/guile.mes (open-input-file): Move debugging newline
into debug clause.
2019-02-24 10:49:56 +01:00
Jan Nieuwenhuizen 9ab1e5cbef
mescc: Mes C Library: Fix brk return type compare.
* lib/stdlib/malloc.c (malloc): Fix brk return type compare.
2019-02-24 09:11:55 +01:00
Jan Nieuwenhuizen 3cc45d7137
core: Rename load_env to read_boot.
* src/mes.c (read_boot): Rename from load_env; Update users.
(open_boot): Rename from load_boot; Update users.
2019-02-24 07:44:59 +01:00
Jan Nieuwenhuizen d3e694c529
core: Initialize g_buf dynamically, add MES_STRING_MAX override.
* src/mes.c (g_buf, MAX_STRING): Move from strings.c.
(gc_init_cells): Initialize g_buf dynamically.
(main): Add environment override MES_MAX_STRING for MAX_STRING.
* doc/mes.texi (Environment Variables): Document it.
2019-02-10 06:56:06 +01:00
Jan Nieuwenhuizen f43af6acc3
mes-snarf: rewrite for development-time snarfing
* build-aux/mes-snarf.scm (%gcc?): Remove.
(symbol->header): Produce code for src/builtins.h.
(symbol->source, symbol->names, function->environment): Remove.
(snarf-symbols): Rewrite, snarf from init_symbol (...).
(function->source): Produce code to be manually put into
(main): Remove --mes option.
2019-02-03 20:59:51 +01:00
Jan Nieuwenhuizen b3dc822bff
core: Resurrect POSIX build. Thanks, gio!
* lib/libmes.c[POSIX]: Define and initialize g_stdin, g_stdout and
g_stderr that were moved to crt1 for non-POSIX builds.
* src/mes.c[POSIX]: Remove struct-initialisation exceptions.
2019-02-15 09:28:46 +01:00
Jan Nieuwenhuizen 99ac7b59c4
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run

    cat src/*.i

and move the into

    src/mes.c:mes_builtins ()

and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do

    cat src/*.h > src/builtins.h

* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 09:55:16 +01:00
Jan Nieuwenhuizen 04556c5636
core: Remove struct definitions for cells, drop snarfing for symbols.
* src/mes.c (init_symbol): New function.
(mes_symbols): Use it.
(scm_nil, ... scm_test): Remove.
2019-01-04 08:07:48 +01:00
Jan Nieuwenhuizen df27830846
mes: Add take-while.
* mes/module/srfi/srfi-1.mes (take-while): New function.
2018-12-27 16:36:22 +01:00
Jan Nieuwenhuizen 3e41363232
mescc: Enhance POSIX command-line support, e.g. -DFOO=1.
* module/mescc.scm (unclump-single): New function.
(main): Use it to support -DFOO=bar, and equivalent.
2018-12-26 14:14:02 +01:00
Jan Nieuwenhuizen d52357cb71
build: Support running out-of-tree.
* build-aux/pre-inst-env.in (MES_PREFIX): Use absolute name.
2018-12-27 16:36:39 +01:00
Jan Nieuwenhuizen 8e8e2fd6d3
core: Remove string debugging.
* src/strings.c (make_bytes, make_string, string_equal_p,
symbol_to_string, symbol_to_keyword, make_symbol): Remove string
debugging.
2018-12-27 16:48:45 +01:00
Jan Nieuwenhuizen 00289fb651
core: Remove --dump, --load.
* mes/module/mes/boot-0.scm.in (tty?): Remove --dump, --load.
* src/mes.c (bload_env): Remove.
* src/reader.c (dump): Remove.
2018-12-27 16:47:56 +01:00
Jan Nieuwenhuizen bc9de4ce0c
doc: Post-release update.
* doc/announce/ANNOUNCE-0.19: Update.
2018-12-16 19:35:48 +01:00
Jan Nieuwenhuizen b2056c105d
Release 0.19.
* configure (VERSION): Update to 0.19.
(main): Likewise.
* configure.sh (VERSION): Likewise.
* guix/git/mes.scm (mes, mes.git): Likewise.
2018-12-16 14:51:18 +01:00
Jan Nieuwenhuizen 32dcd3a575
doc: Release update.
* AUTHORS: Update.
* HACKING: Update.
* NEWS: Update.
* doc/mes.guix: Update.
* scripts/mescc.in: Update.
* mes/module/mes/boot-0.scm.in: Update.
* doc/announce/ANNOUNCE-0.19: New file.
2018-10-20 09:53:44 +02:00
Jan Nieuwenhuizen e90aed9d1b
mes: assq-ref, assoc-ref: Support alist == #f.
* mes/module/mes/scm.mes (assq-ref): Support alist == #f.
(assoc-ref): Likewise.
2018-12-15 12:56:15 +01:00
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 47d9996079
mescc: Support Bash: Add getppid.
* lib/linux/gnu.c (getppid): New function.
* include/linux/x86/syscall.h (SYS_getppid): New macro.
* include/linux/x86_64/syscall.h (SYS_getppid): New macro.
2018-12-14 18:48:03 +01:00
Jan Nieuwenhuizen 7f6ca031f9
mescc: Support bash: Add sigdelset stub.
* lib/stub/sigdelset.c (sigdelset): New stub.
* lib/libc+gnu.c: Include it.
2018-12-14 18:46:44 +01:00
Jan Nieuwenhuizen 5f14a46422
mescc: getcwd: Support getcwd (0, 0) GNU extension.
* lib/linux/libc.c (_getcwd): Rename from getcwd.
(_getcwd): New function.  Support getcwd (0, 0) GNU extension.
2018-12-07 20:18:01 +01:00
Jan Nieuwenhuizen 0a32045caf
mescc: Replace \r in comments.
* module/mescc/compile.scm (ast->comment): Replace \r in comments.
2018-12-02 07:26:07 +01:00
Jan Nieuwenhuizen 8f8852ccff
build: Support building with Gash.
* build-aux/install.sh: Replace variables with substitution.
* build-aux/bootstrap.sh: New file.
* configure: Substitute it.
* configure.sh: Likewise.  Be friendly to Gash.
* .gitignore: Ignore it.
2018-11-24 21:07:31 +01:00
Jan Nieuwenhuizen 6b841a0cab
mescc: Run without shell.
* mes/module/mescc.mes: New file.
* module/mescc.scm: Include it.
* scripts/mescc.scm.in: New file.
* scripts/mescc.in: Use it; Make pure shell.
* configure: Substitute it.
* configure.sh: Substitute it.
* build-aux/install.sh.in: Install it.
2018-11-25 13:21:03 +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 2e97dc1250
mescc: Move mecmp to libc.
* lib/libc.c: Include mecmp.c.
* lib/libc+tcc.c: Remove mecmp.c include.
2018-11-25 16:09:31 +01:00
Jan Nieuwenhuizen 3e87e9de3c
mescc: Move memchr to libc.
* lib/libc.c: Include memchr.c.
2018-11-16 00:01:18 +01:00
Jan Nieuwenhuizen c9a3fe68ec
test: Use write instead of display.
* module/mes/test.scm (seq?, sequal?, seq2?, sless?, sequal2?): Use
write for expected, actual.
2018-11-15 17:10:03 +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 0be3bea141
mes: Remove copy of make-string.
* mes/module/mes/guile.mes (make-string): Remove copy.
2018-11-14 08:19:01 +01:00
Jan Nieuwenhuizen 614bfeb3b8
mescc: Compile fixes.
* include/libmes-mini.h[WITH_GLIBC]: Do not declare strlen, write, types.
2018-11-14 13:07:59 +01:00
Jan Nieuwenhuizen e27e7af055
mes: Oops, %moduledir debug info.
* mes/module/mes/boot-0.scm.in: Oops, %moduledir debug info.
2018-11-11 14:47:14 +01:00
Jan Nieuwenhuizen 17aeba8dc7
build: configure: Support Mes.
* configure: Support Mes.
2018-11-11 10:38:02 +01:00
Jan Nieuwenhuizen fb8a6f3408
mes; Add read-line.
* mes/module/mes/guile.mes (read-line): New function.
2018-11-11 16:57:58 +01:00
Jan Nieuwenhuizen c61c6866b5
mes: dirname: Fix for absolute file names.
* mes/module/mes/guile.mes (dirname): Fix absolute files.
2018-11-11 10:15:12 +01:00
Jan Nieuwenhuizen e0a2d540f4
mes: Add file-exists?.
* mes/module/mes/guile.mes (file-exists?): New function.
2018-11-11 10:14:50 +01:00
Jan Nieuwenhuizen e95c5742be
mes: Add with-error-to-file.
* mes/module/mes/guile.mes (with-error-to-file): New function.
2018-11-11 10:14:10 +01:00
Jan Nieuwenhuizen 9da1fd92b6
mes: Add string-downcase, string-upcase, string-tokenize.
* mes/module/srfi/srfi-13.mes (string-downcase, string-upcase,
string-tokenize): New function.
2018-11-11 10:00:04 +01:00
Jan Nieuwenhuizen 9543962ece
mes: Add char-downcase, char-upcase.
* mes/module/srfi/srfi-14.mes (char-downcase, char-upcase): New
function.
2018-11-11 10:10:43 +01:00
Jan Nieuwenhuizen b7f5e1a8f9
mes: Add char-set:digit, char-set:lower-case, char-set:upper-case.
* mes/module/srfi/srfi-14.mes (char-set:digit, char-set:lower-case,
char-set:upper-case): New variable.
2018-11-11 10:09:41 +01:00
Jan Nieuwenhuizen b9534cb287
mes: Add char-set-adjoin, char-set-complement.
* mes/module/srfi/srfi-14.mes (char-set-adjoin, char-set-complement):
New function.
2018-11-11 10:08:03 +01:00
Jan Nieuwenhuizen 1f1fa33eaa
mes: system*: Support redirection.
* mes/module/mes/posix.mes (system*): Support redirection.
2018-11-11 10:00:50 +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