mes.git
18 months agocore: Resurrect gcc support.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 08:48:31 +0000 (10:48 +0200)]
core: Resurrect gcc support.

* src/mes.c (MES_ARENA)[POSIX]: Default to 100000000.

18 months agoscaffold: Add proper includes.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 08:47:05 +0000 (10:47 +0200)]
scaffold: Add proper includes.

* scaffold/argv.c: Add proper includes.
* scaffold/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/mini-mes.c: Likewise.
* scaffold/tiny-mes.c: Likewise.

18 months agobuild: cc32: Silence warnings.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 08:41:16 +0000 (10:41 +0200)]
build: cc32: Silence warnings.

* build-aux/build-cc32.sh (CC32_CFLAGS): Silence warnings.

18 months agobuild: Resurrect i686-unknown-linux-gnu-gcc support.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 08:40:00 +0000 (10:40 +0200)]
build: Resurrect i686-unknown-linux-gnu-gcc support.

* build-aux/build-cc32.sh (CC32_CFLAGS): Add -fno-builtin.  Resurrects
  i686-unknown-linux-gnu-gcc.

18 months agomescc: Support verbose int types.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 10:02:16 +0000 (12:02 +0200)]
mescc: Support verbose int types.

* module/mescc/compile.scm (i386:type-alist): Support verbose int types.

18 months agobuild: Separate Mes and Guile modules.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 05:15:52 +0000 (07:15 +0200)]
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.

18 months agocore: typo: Remove trailing 1.
Jan Nieuwenhuizen [Sat, 21 Jul 2018 05:21:31 +0000 (07:21 +0200)]
core: typo: Remove trailing 1.

* include/alloca.h: typo: Remove trailing 1.

18 months agoAdd missing copyright header. Thanks, Mike!
Jan Nieuwenhuizen [Fri, 20 Jul 2018 04:40:51 +0000 (06:40 +0200)]
Add missing copyright header.  Thanks, Mike!

* guile/gc.c: Add missing copyright header.  Thanks, Mike!

18 months agoguix: mes: Updatee to 0.16.1.
Jan Nieuwenhuizen [Thu, 19 Jul 2018 16:46:59 +0000 (18:46 +0200)]
guix: mes: Updatee to 0.16.1.

* guix.scm (mes): Update to 0.16.1.
  (mes.git): Likewise.

18 months agoRelease 0.16.1 v0.16.1
Jan Nieuwenhuizen [Mon, 9 Jul 2018 14:44:06 +0000 (16:44 +0200)]
Release 0.16.1

* configure (VERSION): Bump to 0.16.1.

18 months agodoc: Release update.
Jan Nieuwenhuizen [Tue, 26 Jun 2018 20:22:56 +0000 (22:22 +0200)]
doc: Release update.

* BOOTSTRAP: Update.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* scaffold/tests/23-pointer.c: Add (janneke) to copyright line.
* doc/images/gcc-mesboot-graph.png: Update.
* doc/mes.texi (The Mes Bootstrap Process): Describe update.

18 months agobuild: setup-mes.sh: Cater for Debian/stretch too. Thanks, pdewacht!
Jan Nieuwenhuizen [Tue, 10 Jul 2018 19:57:56 +0000 (21:57 +0200)]
build: setup-mes.sh: Cater for Debian/stretch too.  Thanks, pdewacht!

* build-aux/setup-mes.sh: Cater for Debian/stretch too.  Thanks,
  pdewacht!

18 months agocore: Fix segfault on Debian/strectch. Thanks, pdewacht!
Jan Nieuwenhuizen [Tue, 10 Jul 2018 19:52:31 +0000 (21:52 +0200)]
core: Fix segfault on Debian/strectch.  Thanks, pdewacht!

* src/posix.c (execl_): Typo in initialization.  Fixes segfault on
  Debian/strectch.  Thanks, pdewacht!

18 months agodoc: Add html, pdf.
Jan Nieuwenhuizen [Mon, 9 Jul 2018 18:07:38 +0000 (20:07 +0200)]
doc: Add html, pdf.

* GNUmakefile (html, pdf): New target.
* .gitignore: Ignore html, pdf targets.

18 months agodoc: Remarks from Rutger.
Jan Nieuwenhuizen [Mon, 9 Jul 2018 17:59:54 +0000 (19:59 +0200)]
doc: Remarks from Rutger.

* doc/mes.texi: Remarks from Rutger.

18 months agodoc: Further work.
Jan Nieuwenhuizen [Fri, 29 Jun 2018 05:49:59 +0000 (07:49 +0200)]
doc: Further work.

* doc/images/gcc-mesboot-graph.png: New file.
* install.sh: Install it.
* doc/mes.texi (The Mes Bootstrap Process): Show it.
  (Bootstrapping): Add missing Mes direntry.
  (Running the Test Suites): Fix example.
  Fix typos.

18 months agobuild: Handle CFLAGS, CPPFLAGS for Debian.
Jan Nieuwenhuizen [Mon, 9 Jul 2018 09:49:49 +0000 (11:49 +0200)]
build: Handle CFLAGS, CPPFLAGS for Debian.

18 months agobuild: Have configure create a git archive.
Jan Nieuwenhuizen [Mon, 9 Jul 2018 07:57:15 +0000 (09:57 +0200)]
build: Have configure create a git archive.

* configure: Create git archive if necessary.

18 months agobuild: Use GNU style lower case directory configure variable naming.
Jan Nieuwenhuizen [Mon, 9 Jul 2018 08:46:28 +0000 (10:46 +0200)]
build: Use GNU style lower case directory configure variable naming.

* GNUmakefile: Use GNU style lower case directory configure variable naming.
* HACKING: Likewise.
* INSTALL: Likewise.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-cc32.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/export.make: Likewise.
* build-aux/setup-mes.sh: Likewise.
* build.sh: Likewise.
* check.sh: Likewise.
* configure: Likewise.
* doc/mes.texi: Likewise.
* install.sh: Likewise.
* scripts/mescc: Likewise.

18 months agobuild: Support Debian build, install.
Jan Nieuwenhuizen [Sat, 7 Jul 2018 15:31:06 +0000 (17:31 +0200)]
build: Support Debian build, install.

* scripts/mescc: Support Debian build, install.
* lib/libmes.c (fdgetc): Allow Nyacc/ungetc conflict.
* build-aux/export.make (ARCH): Export.
* build-aux/build-mes.sh: Disable full build for non-bootstrap
  x86-only.
* check.sh (total): Use bash to invoke build-aux/check-mescc.sh.
* build-aux/build-guile.sh (SCM_FILES): Support guile-2.0.
* module/mes/guile.scm (guile-2.0): Support guile-2.0.
* build-aux/build-mes.sh: Use bash.
* build-aux/setup-mes.sh: New file.

18 months agomescc: Be sure to exit upon system* failure.
Jan Nieuwenhuizen [Mon, 9 Jul 2018 07:25:38 +0000 (09:25 +0200)]
mescc: Be sure to exit upon system* failure.

* module/mescc/mescc.scm (assert-system*): New function.
  (M1->hex2, hex2->elf, M1->blood-elf): Use it.

18 months agobuild: Support $DESTDIR.
Jan Nieuwenhuizen [Fri, 29 Jun 2018 18:38:11 +0000 (20:38 +0200)]
build: Support $DESTDIR.

* build-aux/export.make: export DESTDIR.
* install.sh: Support $DESTDIR.

18 months agobuild: Build and install manual pages.
Jan Nieuwenhuizen [Thu, 28 Jun 2018 21:10:14 +0000 (23:10 +0200)]
build: Build and install manual pages.

* build-aux/export.make: New file.
* GNUmakefile (man): New target.
  (doc): Depend on man.
  include build-aux/export.make, remove exports.
* guix.scm (mes): Add dependency on help2man.
* configure: Check for help2man.
* install.sh: Install manual pages if built.

18 months agodoc: Initial version.
Jan Nieuwenhuizen [Wed, 27 Jun 2018 11:42:47 +0000 (13:42 +0200)]
doc: Initial version.

* doc/mes.texi: New file.
* doc/fdl-1.3.texi: New file.
* AUTHORS: Mention it.
* GNUmakefile (doc, info, install-info): New targets.
* install.sh: Install info if available.
* guix: (mes): Add texinfo to native-inputs.
* configure: Check for makeinfo.

19 months agoguix: mescc-tools: Update to 0.5.1.
Jan Nieuwenhuizen [Tue, 26 Jun 2018 21:46:41 +0000 (23:46 +0200)]
guix: mescc-tools: Update to 0.5.1.

* guix.scm (mescc-tools): Update to 0.5.1.

19 months agoguix: Oops, fix nyacc-for-mes checksum. Thanks, pdewacht!
Jan Nieuwenhuizen [Tue, 26 Jun 2018 21:45:59 +0000 (23:45 +0200)]
guix: Oops, fix nyacc-for-mes checksum.  Thanks, pdewacht!

* guix.scm (nyacc-for-mes): Fix checksum.

19 months agoguix: Update mes to 0.16.
Jan Nieuwenhuizen [Tue, 26 Jun 2018 18:04:24 +0000 (20:04 +0200)]
guix: Update mes to 0.16.

* guix.scm (mes): Update to 0.16.
  (mes.git): Likewise.

19 months agoRelease 0.16. v0.16
Jan Nieuwenhuizen [Mon, 25 Jun 2018 17:27:19 +0000 (19:27 +0200)]
Release 0.16.

* configure (VERSION): Bump to 0.16.

19 months agodoc: Release update.
Jan Nieuwenhuizen [Sun, 24 Jun 2018 11:13:13 +0000 (13:13 +0200)]
doc: Release update.

* BOOTSTRAP: Update.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.16: New file.

19 months agocore: Fix compile warnings.
Jan Nieuwenhuizen [Tue, 26 Jun 2018 04:19:51 +0000 (06:19 +0200)]
core: Fix compile warnings.

* lib/libmes.c: Fix warning.
* src/posix.c (execl_): Fix warning, add debug printing.

19 months agocore: execl_: Allow 1000 arguments.
Jan Nieuwenhuizen [Tue, 26 Jun 2018 04:05:20 +0000 (06:05 +0200)]
core: execl_: Allow 1000 arguments.

* src/posix.c (execl_): Allow 1000 arguments.

19 months agomescc: Support binutils 2.10.1: strrchr: Stop at start of string.
Jan Nieuwenhuizen [Sun, 24 Jun 2018 15:25:46 +0000 (17:25 +0200)]
mescc: Support binutils 2.10.1: strrchr: Stop at start of string.

* lib/libc+tcc.c (strrchr): Stop at start of string.
* scaffold/tests/88-strrchr.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.

19 months agobuild: Support tcc, create tinycc-seed with tcc.
Jan Nieuwenhuizen [Sun, 24 Jun 2018 07:28:23 +0000 (09:28 +0200)]
build: Support tcc, create tinycc-seed with tcc.

* configure: check for tcc.
* build-aux/cc32-mes.sh: Rename from cc-mes-gcc.sh.  Support
  tcc.  Update users.
* build-aux/build-cc32-mes.sh: Rename from build-mes-gcc.sh.  Update users.
* GNUmakefile (mes-tcc): New target.
* .gitignore: Ignore mes-tcc arch output.
* lib/crt1.c (_start): Add "rm" constraint so satisfy tcc.
* lib/linux-gcc.c (_sys_call, _sys_call1 _sys_call2 _sys_call3): Likewise.

19 months agomescc: Support glibc-2.2.5: header tweaks.
Jan Nieuwenhuizen [Wed, 20 Jun 2018 22:27:27 +0000 (00:27 +0200)]
mescc: Support glibc-2.2.5: header tweaks.

* include/sys/types.h [__PTRDIFF_T]: Extra guard for ptrdiff_t.
  [__SIZE_T]: Extra guard for size_t.
* include/stdlib.h: Include alloca; remove alloca prototype,
* include/errno.h: Add E2BIG.

19 months agomescc: Support binutils 2.20.1: vfprint, vsprintf: %llx.
Jan Nieuwenhuizen [Sun, 24 Jun 2018 15:26:53 +0000 (17:26 +0200)]
mescc: Support binutils 2.20.1: vfprint, vsprintf: %llx.

* lib/libc+tcc.c (vfprintf, vsprintf): Handle %%llx.  Print error:
  should we skip another int, va_arg a long long?

19 months agomescc: Support binutils 2.14: vfprint, vsprintf: %12.10d.
Jan Nieuwenhuizen [Wed, 20 Jun 2018 22:27:49 +0000 (00:27 +0200)]
mescc: Support binutils 2.14: vfprint, vsprintf: %12.10d.

* lib/libc+tcc.c (vfprintf, vsprintf): Handle %12.10d.
* scaffold/tests/70-printf.c: Test it.

19 months agomescc: Support gnu toolchain: libtcc1.
Jan Nieuwenhuizen [Tue, 19 Jun 2018 18:29:25 +0000 (20:29 +0200)]
mescc: Support gnu toolchain: libtcc1.

* lib/libtcc1.c: New file.
* lib/libc+tcc-gcc.c: Remove libtcc1 stubs.

19 months agomescc: Support binutils-2.20.1a: header tweaks.
Jan Nieuwenhuizen [Tue, 19 Jun 2018 18:23:38 +0000 (20:23 +0200)]
mescc: Support binutils-2.20.1a: header tweaks.

* include/signal.h: Include sys/types.h; remove type declaration copies.
* include/stdarg.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/unistd.h: Likewise.

19 months agomescc: Support Tinycc 0.9.27: Drop dlclose, dlopen.
Jan Nieuwenhuizen [Mon, 18 Jun 2018 20:56:06 +0000 (22:56 +0200)]
mescc: Support Tinycc 0.9.27: Drop dlclose, dlopen.

* lib/libc+tcc.c (dlclose, dlopen): Remove.
* include/dlfcn.h (RTLD_DEFAULT): Add.

19 months agocore: Resurrect dump-tiny.
Jan Nieuwenhuizen [Mon, 18 Jun 2018 20:55:23 +0000 (22:55 +0200)]
core: Resurrect dump-tiny.

* src/reader.c (dump): Resurrect dump-tiny.

19 months agocore: Resurrect loading of boot-0.32-mo.
Jan Nieuwenhuizen [Mon, 18 Jun 2018 16:55:59 +0000 (18:55 +0200)]
core: Resurrect loading of boot-0.32-mo.

19 months agomescc: Support binutils 2.25: fseek: Add debug printing.
Jan Nieuwenhuizen [Sun, 17 Jun 2018 12:17:39 +0000 (14:17 +0200)]
mescc: Support binutils 2.25: fseek: Add debug printing.

* lib/libc+tcc.c (fseek): Add debug printing.

19 months agomescc: Tinycc support: bcopy: Do not return void.
Jan Nieuwenhuizen [Sun, 17 Jun 2018 12:16:05 +0000 (14:16 +0200)]
mescc: Tinycc support: bcopy: Do not return void.

* lib/m4.c (bcopy): Do not return void.  Helps tcc.

19 months agomescc: Support binutils 2.25: memcmp: Support size 0.
Jan Nieuwenhuizen [Sun, 17 Jun 2018 08:18:59 +0000 (10:18 +0200)]
mescc: Support binutils 2.25: memcmp: Support size 0.

* lib/libc+tcc.c (memcmp): Support size 0.

19 months agomescc: Support binutils 2.25: vsscanf: Skip `l'.
Jan Nieuwenhuizen [Sun, 17 Jun 2018 07:26:34 +0000 (09:26 +0200)]
mescc: Support binutils 2.25: vsscanf: Skip `l'.

* lib/libc+tcc.c (vsscanf): Skip `l'.

19 months agomescc: Debugging oops.
Jan Nieuwenhuizen [Sun, 17 Jun 2018 06:39:31 +0000 (08:39 +0200)]
mescc: Debugging oops.

* lib/libc.c (__mes_debug): Oops, wrong direction.

19 months agomescc: Support binutils 2.15a: fread: read ungetc'd chars too.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 18:51:16 +0000 (20:51 +0200)]
mescc: Support binutils 2.15a: fread: read ungetc'd chars too.

* lib/libmes.c (_ungetc_fd): New variable.
  (fdgetc): Use it.
  (_fdungetc_p): New function.
* lib/libc+tcc.c (_fungetc_p): New function.
* lib/libc+tcc.c (fread): Use it to read ungetc'd chars too.

19 months agomescc: Add another fopen test.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 14:12:51 +0000 (16:12 +0200)]
mescc: Add another fopen test.

* scaffold/tests/98-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Add it.
* AUTHORS: Mention it.

19 months agomescc: Add fopen test.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 13:18:27 +0000 (15:18 +0200)]
mescc: Add fopen test.

* scaffold/tests/97-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Run it.
* include/unistd.h (link): Declare.

19 months agomescc: Support binutils-2.14: fopen: Return 0 upon failure.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 08:54:59 +0000 (10:54 +0200)]
mescc: Support binutils-2.14: fopen: Return 0 upon failure.

* lib/libc+tcc.c (fopen): Return 0 upon failure.

19 months agomescc: Update elf32-header for linux-4.17.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 06:32:12 +0000 (08:32 +0200)]
mescc: Update elf32-header for linux-4.17.

Previously, our binaries showed this

    $ readelf -s scaffold/main.mes-out
    There are 2 program headers, starting at offset 64

    Program Headers:
      Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
      LOAD           0x000000 0x01000000 0x01000000 0x0557c 0x0557c RWE 0x1
      LOAD           0x000000 0x01000000 0x01000000 0x0557c 0x0557c RWE 0x1

     Section to Segment mapping:
      Segment Sections...
       00     .text .data
       01     .text .data

Linux-4.17 refuses to run this and says

    Uhuuh, elf segment at 0000000001000000 requested but the memory is mapped already
    Segmentation fault

* lib/x86-mes/elf32-header.hex2: Remove unused data program header.

19 months agobuild: make seed: Update mescc-tools-seed too.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 04:37:20 +0000 (06:37 +0200)]
build: make seed: Update mescc-tools-seed too.

19 months agoguix: mescc-tools: Update to 0.5.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 07:44:42 +0000 (09:44 +0200)]
guix: mescc-tools: Update to 0.5.

* guix.scm (mescc-tools): Update to 0.5.

19 months agoUpdate for mescc-tools-0.5.
Jan Nieuwenhuizen [Sat, 16 Jun 2018 04:38:05 +0000 (06:38 +0200)]
Update for mescc-tools-0.5.

* build-aux/build-mes.sh (HEX2FLAGS): Remove = from flags.
* build.sh (HEX2FLAGS): Likewise.
* module/mescc/mescc.scm (hex2->elf): Likewise.

19 months agoguix: Update mes to 0.15.
Jan Nieuwenhuizen [Mon, 11 Jun 2018 17:13:12 +0000 (19:13 +0200)]
guix: Update mes to 0.15.

* guix.scm (mes): Update to 0.15.
  (mes.git): Likewise.

19 months agoRelease 0.15.
Jan Nieuwenhuizen [Sun, 10 Jun 2018 19:10:54 +0000 (21:10 +0200)]
Release 0.15.

* configure (VERSION): Bump to 0.15.

20 months agodoc: Release udpate.
Jan Nieuwenhuizen [Wed, 23 May 2018 20:48:00 +0000 (22:48 +0200)]
doc: Release udpate.

* BOOTSTRAP: Update.
* HACKING: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.15: New file.

19 months agobuild: Resurrect non-bootstrap build.
Jan Nieuwenhuizen [Tue, 12 Jun 2018 05:05:33 +0000 (07:05 +0200)]
build: Resurrect non-bootstrap build.

* configure (parse-opts): Support mixing VAR=VALUE --prefix=PREFIX.
* guix.scm (mes): Remove setting PREFIX in make-flags.
* install.sh: Cater for Guix's setting read-only of scripts/diff.scm.

19 months agomescc: Support less-patched tcc/gcc: Add crti and crtn.
Jan Nieuwenhuizen [Sun, 10 Jun 2018 14:03:18 +0000 (16:03 +0200)]
mescc: Support less-patched tcc/gcc: Add crti and crtn.

* lib/crt0.c[__MESC__]: Support MesCC.
* lib/crti.c: New file.
* lib/crtn.c: New file.
* build-aux/build-mes-gcc.sh: Build them.

19 months agomescc: Refactor debug and stub printing.
Jan Nieuwenhuizen [Sun, 10 Jun 2018 12:07:19 +0000 (14:07 +0200)]
mescc: Refactor debug and stub printing.

* lib/libc.c (__mes_debug): New function.  Use it for debug printing
  and in stubs throughout.

19 months agomescc: Support binutils-2.30: fopen fix.
Jan Nieuwenhuizen [Sun, 10 Jun 2018 11:33:30 +0000 (13:33 +0200)]
mescc: Support binutils-2.30: fopen fix.

* lib/libc+tcc.c (fopen): Set O_APPEND for 'a'.

19 months agomescc: Support binutils-2.30.
Jan Nieuwenhuizen [Sat, 9 Jun 2018 15:58:47 +0000 (17:58 +0200)]
mescc: Support binutils-2.30.

* lib/binutils.c (raise, strdup): New function.
  (mbstowcs): New stub.
* include/fcntl.h (O_APPEND, FD_CLOEXEC): New define.

19 months agomescc: Support binutils-2.10.1: Stubs set errno to 0.
Jan Nieuwenhuizen [Sat, 9 Jun 2018 09:28:31 +0000 (11:28 +0200)]
mescc: Support binutils-2.10.1: Stubs set errno to 0.

19 months agomescc: Silence some stubs.
Jan Nieuwenhuizen [Sat, 9 Jun 2018 05:40:07 +0000 (07:40 +0200)]
mescc: Silence some stubs.

* lib/libc+tcc.c: [!NOISY_FLOATS, !NOISY_TIMES]: Silence stubs.
* lib/gcc.c: Likewise.
* lib/binutils.c: Likewise.

19 months agomescc: Add debug printing: fopen, fwrite.
Jan Nieuwenhuizen [Sun, 10 Jun 2018 05:51:56 +0000 (07:51 +0200)]
mescc: Add debug printing: fopen, fwrite.

* lib/libc+tcc.c (fopen, fwrite)[MESC_DEBUG]: Print debug info.

19 months agomescc: Support binutils-2.10.1: opentype `r+'.
Jan Nieuwenhuizen [Sun, 10 Jun 2018 05:51:10 +0000 (07:51 +0200)]
mescc: Support binutils-2.10.1: opentype `r+'.

* lib/libc+tcc.c (fopen): Support opentype `r+'.

19 months agomescc: syscall: return only ever error -1, set errno.
Jan Nieuwenhuizen [Fri, 8 Jun 2018 05:17:51 +0000 (07:17 +0200)]
mescc: syscall: return only ever error -1, set errno.

19 months agomescc: Support gcc-2.95: Add getpwnam stub.
Jan Nieuwenhuizen [Thu, 7 Jun 2018 16:04:17 +0000 (18:04 +0200)]
mescc: Support gcc-2.95: Add getpwnam stub.

* lib/gcc.c (getpwnam): New stub.

19 months agomescc: Support gcc-3.0: Implement alarm, setitimer.
Jan Nieuwenhuizen [Thu, 7 Jun 2018 16:03:51 +0000 (18:03 +0200)]
mescc: Support gcc-3.0: Implement alarm, setitimer.

19 months agomescc: Support gcc-3.0: Implement atexit.
Jan Nieuwenhuizen [Thu, 7 Jun 2018 16:02:21 +0000 (18:02 +0200)]
mescc: Support gcc-3.0: Implement atexit.

19 months agomescc: Support gcc-3.0: Implement dup2, fcntl, getrusage.
Jan Nieuwenhuizen [Thu, 7 Jun 2018 06:02:32 +0000 (08:02 +0200)]
mescc: Support gcc-3.0: Implement dup2, fcntl, getrusage.

* include/sys/resource.h: New file.
* lib/linux+gnu.c (fcntl, dup2, getrusage): New function.
* lib/binutils.c (fcntl): Remove stub.

19 months agomescc: Support gcc-3.2: Implement getuid, getgid.
Jan Nieuwenhuizen [Thu, 7 Jun 2018 05:19:01 +0000 (07:19 +0200)]
mescc: Support gcc-3.2: Implement getuid, getgid.

* lib/linux+gnu.c (getuid, getdid): New function.
* lib/binutils.c (getuid, getdid): Remove stub.

19 months agomescc: Support gcc-3.2: Reset errno.
Jan Nieuwenhuizen [Thu, 7 Jun 2018 05:16:43 +0000 (07:16 +0200)]
mescc: Support gcc-3.2: Reset errno.

* lib/linux-gcc.c (_sys_call, _sys_call1, _sys_call2, _sys_call3):
  Reset errno.
* lib/linux-mes.c (__sys_call, __sys_call1, __sys_call2 ,
  __sys_call3): Rename from _*.
   (_sys_call, _sys_call1, _sys_call2, _sys_call3): New function.
  Reset errno.

19 months agomescc: Support gcc-3.2: Implement integer strto*.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 20:39:57 +0000 (22:39 +0200)]
mescc: Support gcc-3.2: Implement integer strto*.

* lib/libc+tcc.c (strtoll, strtoul): Call strtoul.

19 months agomescc: Support gcc-3.2: Add getpid, signal.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 20:14:35 +0000 (22:14 +0200)]
mescc: Support gcc-3.2: Add getpid, signal.

* lib/linux+gnu.c (getpid, signal): New function.
* include/signal.h: Declare signal.
* include/unistd.h: Declare getpid.
* scaffold/tests/95-signal.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.

19 months agomescc: Support gcc-3.4.0: *printf: Support `%n'.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 17:29:32 +0000 (19:29 +0200)]
mescc: Support gcc-3.4.0: *printf: Support `%n'.

* lib/libc+tcc.c (vfprintf, vsprintf): Support `%n'.  For Gcc 3.4.0.
* scaffold/tests/70-printf.c: Test it.

19 months agomescc: Support gcc-3.4.0: alloca.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 17:44:29 +0000 (19:44 +0200)]
mescc: Support gcc-3.4.0: alloca.

* lib/alloca.c: New file.
* AUTHORS: Mention it.
* lib/libc+gnu.c: Add it.
* include/stdlib.h: Declare alloca.

19 months agomescc: Support gcc-3.4.0: unsetenv.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 17:43:32 +0000 (19:43 +0200)]
mescc: Support gcc-3.4.0: unsetenv.

* lib/gcc.c (unsetenv): New function.

19 months agomescc: Support gcc-3.2: Add __divdi3, __moddi3 stubs.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 15:02:01 +0000 (17:02 +0200)]
mescc: Support gcc-3.2: Add __divdi3, __moddi3 stubs.

* lib/gcc.c (__divdi3, __moddi3): New stubs.

19 months agomescc: Support gcc-3.2: puts with newline.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 13:55:03 +0000 (15:55 +0200)]
mescc: Support gcc-3.2: puts with newline.

* lib/libc-mini.c (oputs): Rename from puts.
  (puts): New function: Add newline.

19 months agomescc: Support binutils-2.10.1.
Jan Nieuwenhuizen [Wed, 6 Jun 2018 11:16:25 +0000 (13:16 +0200)]
mescc: Support binutils-2.10.1.

xx

19 months agomescc: Support glibc-1.06.4.
Jan Nieuwenhuizen [Sun, 3 Jun 2018 16:54:26 +0000 (18:54 +0200)]
mescc: Support glibc-1.06.4.

* lib/glibc.c: New file.
* lib/libc+gnu.c: Include it.

19 months agomescc: Support gcc-2.6.3.
Jan Nieuwenhuizen [Sat, 2 Jun 2018 09:41:06 +0000 (11:41 +0200)]
mescc: Support gcc-2.6.3.

* TODO

19 months agomescc: Support binutils-2.5.1.
Jan Nieuwenhuizen [Wed, 30 May 2018 19:55:39 +0000 (21:55 +0200)]
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.

19 months agotests: Remove tinycc-imported non-free grep test.
Jan Nieuwenhuizen [Fri, 1 Jun 2018 13:35:05 +0000 (15:35 +0200)]
tests: Remove tinycc-imported non-free grep test.

* scaffold/tinycc/46_grep.c: Remove.
* scaffold/tinycc/46_grep.expect: Remove.

19 months agomescc: Implement fflush, sscanf, vsscanf.
Jan Nieuwenhuizen [Wed, 30 May 2018 19:49:40 +0000 (21:49 +0200)]
mescc: Implement fflush, sscanf, vsscanf.

* lib/libc+tcc.c (vsscanf): New function.
  (sscanf): Use it.
  (fflush): Remove stub notice; we have no buffering.
* include/stdarg.h: Declare it.
* scaffold/tests/87-sscanf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.

19 months agobuild: Use arch-dir.
Jan Nieuwenhuizen [Tue, 29 May 2018 18:07:46 +0000 (20:07 +0200)]
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.

19 months agomlibc: Implement strstr.
Jan Nieuwenhuizen [Tue, 29 May 2018 17:35:20 +0000 (19:35 +0200)]
mlibc: Implement strstr.

* lib/libc+tcc.c (_memmem, memmem): New function.  Import from GNU
  LilyPond.
  (strstr): Implement using memmem.
* include/string.h (_memmem, memmem): Declare.
* AUTHORS: Add Han-Wen Nienhuys.

19 months agomlibc: Implement ftell, fseek.
Jan Nieuwenhuizen [Tue, 29 May 2018 17:33:32 +0000 (19:33 +0200)]
mlibc: Implement ftell, fseek.

* lib/libc+tcc.c (ftell, fseek): Implement.

19 months agomlibc: Cleanup.
Jan Nieuwenhuizen [Tue, 29 May 2018 16:15:22 +0000 (18:15 +0200)]
mlibc: Cleanup.

20 months agomescc: m4 support: WIP
Jan Nieuwenhuizen [Sun, 27 May 2018 08:28:30 +0000 (10:28 +0200)]
mescc: m4 support: WIP

19 months agocore: Refactor boot-0 loading.
Jan Nieuwenhuizen [Mon, 28 May 2018 16:53:25 +0000 (18:53 +0200)]
core: Refactor boot-0 loading.

* src/mes.c (load_boot): New function.
  (load_env): Use it.

20 months agomescc: Out of the box Geiser support.
Jan Nieuwenhuizen [Sat, 26 May 2018 18:54:51 +0000 (20:54 +0200)]
mescc: Out of the box Geiser support.

* .dir-locals.el: New file.  Out of the box Geiser support for mescc.

20 months agomescc: Posixify interface.
Jan Nieuwenhuizen [Fri, 25 May 2018 06:05:02 +0000 (08:05 +0200)]
mescc: Posixify interface.

* module/mescc/compile.mes: Move from language/c99/compiler.mes.
* module/mescc: New module..
* module/mescc/M1.scm: Move from mes/M1.mes.
* module/mescc/as.scm: Likewise.
* module/mescc/bytevectors.scm: Likewise.
* module/mescc/mescc.scm: New file.
* scripts/mescc: Update to new layout and posixy interface.
* GNUmakefile: Likewise.
* build-aux/build-cc.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-mlibc.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc-mlibc.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test.sh: Likewise.
* build.sh: Likewise.
* .gitignore: Update for posixy extensions.

20 months agomes: Add drop, drop-right.
Jan Nieuwenhuizen [Sat, 26 May 2018 18:47:33 +0000 (20:47 +0200)]
mes: Add drop, drop-right.

* module/srfi/srfi-1.mes (drop, drop-right): New function.

20 months agoRevert "fork/exec: debug."
Jan Nieuwenhuizen [Fri, 25 May 2018 09:21:26 +0000 (11:21 +0200)]
Revert "fork/exec: debug."

This reverts commit f0315ac0d9acd66a30dbb192334f443459b7ed16.

20 months agofork/exec: debug.
Jan Nieuwenhuizen [Fri, 25 May 2018 09:21:06 +0000 (11:21 +0200)]
fork/exec: debug.

20 months agocore: Support fork, waitpid, execve.
Jan Nieuwenhuizen [Thu, 24 May 2018 17:54:42 +0000 (19:54 +0200)]
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.

20 months agomescc: Oops, alignment.
Jan Nieuwenhuizen [Sun, 27 May 2018 06:20:00 +0000 (08:20 +0200)]
mescc: Oops, alignment.

* module/mes/M1.mes (object->M1): Oops, alignment: only add alignment
  when not aligned.

20 months agomescc: Add fopen.
Jeremiah Orians [Sat, 26 May 2018 20:33:00 +0000 (16:33 -0400)]
mescc: Add fopen.

* lib/libc+tcc.c (fopen)[!POSIX]: Remove stub.
* lib/libc.c (fopen)[!POSIX]: New function.
* AUTHORS: Add Jeremiah.