Commit graph

360 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 784838e368
hurd: Initial support.
This adds minimal Hurd support by implementing the _exit function.

* AUTHORS: Update.
* .gitignore: Ignore a.out, core, .config.
* include/sys/wait.h (W_EXITCODE): New define.
* lib/gnu/x86-mes-gcc/crt1.c: New file.
* lib/gnu/x86-mes-gcc/mini.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/_exit.c: New file.
* include/gnu/syscall.h: New file.
* include/gnu/hurd.h: New file.
* lib/gnu/_exit.c: New file.
* lib/gnu/exec-startup-get-data.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/proc-mark-exit.c: New file.
* lib/gnu/syscall.c: New file.
* lib/gnu/task-get-special-port.c: New file.
* lib/gnu/task-terminate.c: New file.
* lib/gnu/vm-statistics.c: New file.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add Hurd sources.
* build-aux/build.sh.in (CPPFLAGS): Add lib to includes, to find linux
crt1.c.
* build-aux/test-c.sh: Always use at least -l c+mini for GNU.
* lib/tests/scaffold/30-exit-42.exit: New file.
* lib/tests/scaffold/30-exit-42.c: New test.
* build-aux/check-mescc.sh (TESTS): Add it.
* lib/tests/scaffold/30-exit-0.c (main): Move from 00-exit-0.c; Rewrite,
use _exit.
* include/gnu/hurd-types.h: Import from GNU C Library.
* include/mach/mach-init.h: Likewise.
* lib/mach/mach-init.c: Likewise.
* lib/mach/mach_host_self.S: Likewise.
* lib/mach/mach_msg_trap.S: Likewise.
* lib/mach/mach_reply_port.S: Likewise.
* lib/mach/mach_task_self.S: Likewise.
* lib/mach/mach_thread_self.S: Likewise.
* lib/mach/msg.c: Likewise.
2019-12-13 21:52:29 +01:00
Jan Nieuwenhuizen 820c93097c
build: Generate ChangeLog reproducibly. Thanks, Timothy!
* build-aux/gitlog-to-changelog (git_dir_option): Avoid non-reproducible
localtime.
2019-12-13 21:52:29 +01:00
Jan Nieuwenhuizen d55ca711f1
build: Cater for bootstrap build.
* build-aux/build.sh.in: Build bin/mes.  Update scripts and users.
* build-aux/bootstrap.sh.in: Update.
* build-aux/install.sh.in: Install all built bin/mes-* flavours.
* configure: Drop SEED, support --bootstrap.
* configure.sh: Likewise.
2019-12-13 21:52:18 +01:00
Jan Nieuwenhuizen 093a8b0903
bootstrap: Build files only once.
* build-aux/bootstrap.sh.in: Build files only once.
2019-12-07 23:29:34 +01:00
Jan Nieuwenhuizen 82c85c24da
build: Support mescc-tools 0.5.2.
* configure: Remove version check for mescc-tools.
Check for stage0 architecture flag type.
* configure.sh: Likewise.
* build-aux/build-scaffold.sh: Add stage0 flag type indirection.
* module/mescc/mescc.scm (arch-get-architecture): Likewise.
2019-12-07 14:39:19 +01:00
Jan Nieuwenhuizen 1d03aeebbe
build: Add --with-bootstrap option.
* configure (main): Add --with-bootstrap option.
* build-aux/build.sh.in [--with-bootstrap]: After building mes with CC,
build mes with MesCC.
2019-12-08 15:32:51 +01:00
Jan Nieuwenhuizen a820a98139
build: Support toplevel lib and mes builds.
* build-aux/build.sh.in: Add missing libdir for gcc build.
* build-aux/config.sh.in: ...here.
* build-aux/build-mes.sh: Do not overwrite srcdest, V.
2019-12-05 10:02:14 +01:00
Jan Nieuwenhuizen 066143d820
bootstrap: Support srcdir builds.
* build-aux/bootstrap.sh.in (srcdest): Initialize.
* build-aux/build-lib.sh: Source config.sh.
* configure.sh: Support srcdir builds.
* build-aux/build.sh.in: Move setting of cflags to ...
* build-aux/cflags.sh: ... New file.
2019-12-05 08:30:30 +01:00
Jan Nieuwenhuizen 6b0ff3f322
configure: Honor CFLAGS, LDFLAGS.
* configure (cflags-list, ldflags-list): New function.
check-preprocess-header-c, check-compile-string-c,
check-link-string-c): Use them.  Be verbose when %verbose?.
(CFLAGS, LDFLAGS): Initialize to "-static -g".
2019-12-05 08:51:27 +01:00
Jan Nieuwenhuizen 0db1e888f9
build! Fixup clean without git: Clean cleaner.
* build-aux/GNUmakefile.in (clean): Clean cleaner.
2019-12-08 16:36:05 +01:00
Jan Nieuwenhuizen d6a3af7625
build: Remove git dependency.
* configure: Remove git dependency.
* build-aux/GNUmakefile.in (clean,distclean, maintainer-clean):
Implement without git.
* INSTALL: Update dependencies.
2019-12-04 18:49:39 +01:00
Jan Nieuwenhuizen 9c7d0ece4d
build: Use debug build (-g) by default.
* build-aux/build.sh.in (debug): Enable.
2019-12-02 18:26:55 +01:00
Jan Nieuwenhuizen 5c16b1ecc1
build: Honor user's CFLAGS, CPPFLAGS, LDFLAGS.
* build-aux/build.sh.in (AM_CFLAGS, AM_CPPFLAGS, AM_LDFLAGS): Rename
from CFLAGS, CPPFLAGS, LDFLAGS.  Export them.
* configure: Substitute them.
* configure.sh: Likewise.
* build-aux/cc.sh (compile, link): Use them.
* build-aux/config.make.in (CFLAGS, CPPFLAGS, LDFLAGS): Add
substitutable variables.
* build-aux/config.sh.in: Likewise.
* build-aux/export.make: Export them.
2019-12-02 18:26:08 +01:00
Jan Nieuwenhuizen 3de6450117
test: 90-abtod: Remove printf dependency. Fixes gcc.
* lib/tests/mes/90-abtod.stdout: Remove.
* lib/tests/mes/90-abtod.c (main): Remove printf.
2019-12-02 10:00:03 +01:00
Jan Nieuwenhuizen fbe178810f
Release 0.21.
* configure (VERSION): Update to 0.21.
(main): Likewise.
* build-aux/GNUmakefile.in: Likewise.
* configure.sh (VERSION): Likewise.
* guix/git/mes.scm (mes, mes.git): Likewise.
2019-11-10 08:31:38 +01:00
Jan Nieuwenhuizen ac9c18f8b8
doc: Release update.
* BLURB: Release update.
* HACKING: Remove roadmap.
* INSTALL: Release update.
* NEWS: Add 0.21 section.
* README: Release update.
* ROADMAP: New file.
* configure.sh: Release update.
* doc/announce/ANNOUNCE-0.21: New file.
* doc/mes.texi: Release update.
2019-11-04 19:59:13 +01:00
Jan Nieuwenhuizen 45427bc641
build: Add sensible NAME section for man pages. Thanks, Vagrant!
* build-aux/GNUmakefile.in (mes.1, mescc.1, mesar.1): Add sensible
--name section.  Fixes Debian lint error.  Reported by Vagrant
Cascadian.
2019-11-04 23:43:38 +01:00
Jan Nieuwenhuizen d663c3ded6
Revert "build: Mark lib/tests/dirent/90-readdir.c as XFAIL on x86_64-gcc."
This reverts commit dc0b41f83efa973b7a92c0c7a0ad1eb21a7c4c7a.
2019-11-09 11:10:31 +01:00
Jan Nieuwenhuizen b458314b4f
build: Mark lib/tests/dirent/90-readdir.c as XFAIL on x86_64-gcc.
* build-aux/check-mescc.sh (XFAIL_TESTS)[x86_64-gcc]: Add
lib/tests/dirent/90-readdir.c.
2019-10-30 09:33:54 +01:00
Jan Nieuwenhuizen 5bb1dc47da
Revert "build: Mark lib/tests/dirent/90-readdir.c as XFAIL on x86_64-mescc."
This reverts commit 17986224095ed72649fb2383f72c21f525977310.
2019-11-09 11:10:25 +01:00
Jan Nieuwenhuizen 70693696ce
build: Mark lib/tests/dirent/90-readdir.c as XFAIL on x86_64-mescc.
* build-aux/check-mescc.sh (XFAIL_TESTS)[x86_64-mescc]: Add
lib/tests/dirent/90-readdir.c.
2019-10-30 09:32:46 +01:00
Jan Nieuwenhuizen 66296abdc8
build: Better and friendlier tarball.
* build-aux/GNUmakefile.in (dist): Be friendly to Debian; avoid using
EPOCH.  Cater for file permission differences.
2019-10-24 13:19:28 +02:00
Jan Nieuwenhuizen 36ae666f05
build: bootstrap fixes.
* build-aux/config.sh.in (bootstrap): Set up for substitution.
* configure.sh (bootstrap): Substitute.
* build-aux/install.sh.in (_v): Robustify check for V.
(__exclude_go, __exclude_scm): Initialize.
2019-10-15 20:18:31 +02:00
Jan Nieuwenhuizen 8d49b40b13
check: Remove duplicate test.
* build-aux/check-boot.sh (TESTS): Remove duplicate test.
2019-10-03 22:17:50 +02:00
Jan Nieuwenhuizen 98b9ac8e98
mescc: Mes C Library: Support gcc-4.6.4: Add math stubs.
* lib/math/ceil.c: New file.
* lib/math/floor.c: New file.
* lib/stub/atan2.c: New file.
* lib/stub/cos.c: New file.
* lib/stub/exp.c: New file.
* lib/stub/log.c: New file.
* lib/stub/modf.c: New file.
* lib/stub/pow.c: New file.
* lib/stub/sin.c: New file.
* lib/stub/sqrt.c: New file.
* lib/libc+gnu.c: Include them.
* include/math.h (atan2, ceil, cos, exp, fabs, floor, log, modf, pow,
sin, sqrt): Declare.
* lib/math/fabs.c: Update.
* lib/stub/ldexp.c: Update.
2019-09-13 15:11:38 +02:00
Jan Nieuwenhuizen 6bb225b403
mescc: Mes C Library: Support gcc-4.6.4: Add fscanf, vfscanf.
* lib/stdio/vfscanf.c: New file.
* lib/stdio/fscanf.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add them.
* include/stdio.h (fscanf): Declare.
* include/stdarg.h (vfscanf): Declare.
* lib/stub/fscanf.c: Remove.
2019-09-06 19:04:50 +02:00
Jan Nieuwenhuizen a56918eaa2
mescc: Environment setup.
* scripts/mescc.in (MES_ARENA, MES_MAX_ARENA, MES_STACK): Reduce defaults.
* build-aux/check.sh.in (MES_ARENA): Likewise.  Export them.
* build-aux/bootstrap.sh.in (MES_STACK): Likewise.
(MES_PREFIX): Set default.
2019-09-06 23:24:23 +02:00
Danny Milosavljevic 01ae1994ed
Fix dtoab.
* lib/mes/dtoab.c (dtoab): Fix it.
* lib/tests/mes/90-dtoab.c (main): Fix test.
* build-aux/check-mescc.sh (XFAIL_TESTS: Remove it.
2019-08-27 00:43:37 +02:00
Jan Nieuwenhuizen 5c979a8ce1
mescc: Mes C Library: Support GNU Tar: Add getgrgid, getgrnam, setgrent stub.
* include/grp.h: New file.
* lib/stub/getgrgid.c: New file.
* lib/stub/getgrnam.c: New file.
* lib/stub/setgrent.c: New file.
* lib/libc+gnu.c: Include them.
2019-07-24 12:23:54 +02:00
Jan Nieuwenhuizen fe96cc37df
mescc: Mes C Library: Support GNU Awk: Add getpgid, getpgrp stubs.
* include/unistd.h (getpgid, getpgrp): Declare.
* lib/stub/getpgid.c: New file.
* lib/stub/getpgrp.c: New file.
* lib/libc+gnu.c: Include them.
2019-07-18 12:13:18 +02:00
Jan Nieuwenhuizen 0d3f1ed2ae
mescc: Mes C Library: Support GNU Tar: Add mktime stub, fix localtime stub.
* include/time.h (mktime): Declare.
* lib/stub/mktime.c: New stub.
* lib/libc+gnu.c: Include it.
* lib/stub/localtime.c (localtime): Return pointer to static struct
tm.  Avoids segfaults.
2019-07-15 11:58:21 +02:00
Jan Nieuwenhuizen b97c59ff21
mescc: Mes C Library: Support GNU Tar: Add creat, mknod.
* include/linux/x86_64/syscall.h (SYS_mknod): New macro.
* include/linux/x86/syscall.h (SYS_mknod): New macro.
* lib/linux/mknod.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it.
* include/sys/stat.h (mknod): Declare it.
* include/fcntl.h (creat): New macro.
2019-07-12 11:56:58 +02:00
Jan Nieuwenhuizen 8d45c6484f
mescc: Mes C Library: Support GNU Awk: Implement atof.
* lib/stdlib/atoi.c: Update.
* lib/stdlib/atof.c: Rename from stub/atof.c; Implement.
* lib/libc+gnu.c: Update include.
* lib/libg.c: Update include.
2019-07-03 11:22:57 +02:00
Jan Nieuwenhuizen f3154aabe4
mescc: Mes C Library: Support GNU Awk: Add dtoab, %f in vfprintf, vsnprintf.
* include/libmes.h (dtoab): Declare.
* lib/mes/ntoab.c (ntoab): Update.
* lib/mes/dtoab.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES, libc_tcc_SOURCES): Add
it.
* lib/tests/mes/90-dtoab.c: Test it.
* lib/tests/stdio/90-sprintf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it, against...
* lib/tests/mes/90-dtoab.stdout: ...baseline.
* lib/stdio/vfprintf.c (vfprintf): Support %f, even more naive support
for %e, %E, %g, %G.
* lib/stdio/vsnprintf.c (vsnprintf): Likewise.
2020-01-12 18:42:25 +01:00
Jan Nieuwenhuizen 742e88abd5
mescc: Mes C Library: Support GNU Awk: Add abtod, implementing strtod.
* include/libmes.h (abtod): Declare.
* lib/mes/abtod.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES, libc_tcc_SOURCES): Add
it.
* lib/mes/abtol.c: Update.
* lib/stdlib/strtod.c: Use it to implement; move from stub/strtod.
* lib/tests/mes/90-abtod.c: Test it.
* lib/tests/mes/90-abtod.stdout: Baseline.
* build-aux/check-mescc.sh (tests): Run it.
2019-06-25 12:51:44 +02:00
Jan Nieuwenhuizen 9faa38bee1
mescc: Mes C Library: Support GNU Awk: Add isgraph.
* lib/ctype/isgraph.c: New file.
* lib/libc+gnu.c: Include it.
* include/ctype.h: Add missing prototypes.
2019-06-16 11:25:37 +02:00
Jan Nieuwenhuizen 9be33485e2
mescc: Mes C Library: Support GNU Tar: Add readlink, symlink.
* lib/linux/gnu.c (readlink, symlink): New function.
* include/unistd.h (readlink, symlink): Declare.
* include/linux/x86/syscall.h (SYS_readlink, SYS_symlink): New macro.
* include/linux/x86_64/syscall.h (SYS_symlink, SYS_readlink): New
macro.
2019-06-13 01:07:19 +02:00
Jan Nieuwenhuizen 4e6a3ce846
mescc: Mes C Library: Support GNU Tar: Add execlp.
* lib/posix/execl.c (vexec): New function.
(execl): Use it.
* lib/posix/execlp.c: New file.
* build-aux/configure-lib.sh (libc_tcc_SOURCES): Add it.
* lib/libc+gnu.c: Include it.
* include/unistd.h (execlp): Declare.
* lib/tests/posix/90-execlp.c: New file.
* lib/tests/posix/90-execlp.stdout: New file.
* build-aux/check-mescc.sh: Test it.
2019-06-10 00:56:42 +02:00
Jan Nieuwenhuizen 396e96c056
mescc: Mes C Library: Add missing stubs.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add fscanf, rewind stubs.
* lib/stdio/freeopen.c: Remove.
2019-11-10 09:00:08 +01:00
Jan Nieuwenhuizen b3cac19d4c
build: Avoid tar --exclude=.
* build-aux/install.sh.in: Only use `tar --exclude=' if we also have .go
files compiled by Guile.
2019-09-20 19:33:29 +02:00
Jan Nieuwenhuizen f5aab3b878
build: Split-out build-source-lib.sh from build-lib.sh.
* build-aux/build-lib.sh: Remove building of source lib.
* build-aux/build-source-lib.sh: New file.
* build-aux/build.sh.in: Invoke it.
* build-aux/bootstrap.sh.in: Likewise.
2019-09-20 19:40:37 +02:00
Jan Nieuwenhuizen 74d2cdd45a
build: Honor configure's --includedir. Thanks, Vagrant!
Suggested by Vagrant Cascadian

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902174#84

* build-aux/install.sh.in: Install headers in $includedir.
* configure (includedir): Typo.
* configure.sh (includedir): Likewise.
2019-11-13 09:23:27 +01:00
Jan Nieuwenhuizen 4c862b1cc5
build: Create ascii signature.
* build-aux/GNUmakefile.in (sign): Create ascii signature.
2019-11-23 22:23:33 +01:00
Jan Nieuwenhuizen a76b87fab9
doc: Release update.
* BLURB: New file.
* AUTHORS: Update.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/images/gcc-mesboot-graph.dot: Update.
* doc/mes.texi: Update.
* simple.sh: Update.
* doc/announce/ANNOUNCE-0.20: New file.
2019-09-09 16:42:23 +02:00
Jan Nieuwenhuizen 99903dce06
build: Create ascii signature.
* build-aux/GNUmakefile.in (sign): Create ascii signature.
2019-09-09 16:41:46 +02:00
Jan Nieuwenhuizen f33de25b96
guix: Update packaging.
* build-aux/manifest.scm (string-append):
* guix/git/mes.scm (nyacc, git-file?): Remove.
(mescc-tools): Bump to 0.6.0.
(%source-dir): New variable.
(mes.git): Ues it.
* guix.scm: Rename from .guix.scm.
2019-09-09 16:04:16 +02:00
Jan Nieuwenhuizen 613bd96abe
build: Do not generate ChangeLog from tarball.
* configure (main): Set .git-for-build.
* build-aux/install.sh.in (DESTDIR): Use it as canary to skip
ChangeLog rebuild.
2019-09-09 16:04:16 +02:00
Jan Nieuwenhuizen 2cc6d5a012
build: Use mesar instead of ar.
* scripts/mesar.in: Rename from ar.in.  Update users.
* build-aux/build.sh.in (LIBS): Update.
* build-aux/check.sh.in (recheck): Likwise.
* build-aux/install.sh.in (DESTDIR): Likwise.
* configure (main): Likwise.
* configure.sh (mes_system): Likwise.
* .gitignore: Update.
2019-09-09 16:04:16 +02:00
Danny Milosavljevic 181d1e11ea
Inherit CFLAGS for mes.
* build-aux/check.sh.in: Inherit CFLAGS for mes.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic dadf07a484
Fix typo.
* build-aux/build.sh.in: Fix typo in "CFLAGS".
2019-09-09 16:04:14 +02:00
Jan Nieuwenhuizen 49aff4ec1c
ntoab: Use __mesabi_uldiv only for arm.
* lib/mes/ntoab.c (ntoab)[__MESC__ && __arm__]: Use __mesabi_uldiv.
* build-aux/check-mescc.sh (XFAIL_TESTS): 70-printf-simple.c and
70-printf.c now pass for x86_64 mescc.
2019-09-09 16:04:13 +02:00
Jan Nieuwenhuizen 39498d9233
test: Bump timeout.
* build-aux/test-c.sh: Bump timeout to 10s, __mesabi_uldiv can be slow.
2019-09-07 19:55:12 +02:00
Jan Nieuwenhuizen b8dace81c6
mescc: Mes C Library: Include mes/div.c for mescc builds.
* build-aux/configure-lib.sh (libmes_SOURCES): Add mes/div.c.
* simple.sh: Likewise.
2019-06-14 10:02:49 +02:00
Jan Nieuwenhuizen 1bb64ec48f
mescc: Mes C Library: Have write behave well with buffered reads.
* lib/mes/write.c: New file.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add it.
(libc_mini_shared_SOURCES): New variable.
(libc_mini_SOURCES, libmes_SOURCES): Use it.
(libmes_SOURCES): Add lib/linux/lseek.c, lib/posix/write.c.
(libc_tcc_SOURCES): Remove lib/linux/lseek.c.
* lib/posix/write.c (write): Correct for read buffer.
* lib/stdio/fwrite.c (fwrite): Remove read buffer correction.
* simple.sh: Update.
2019-07-28 13:01:37 +02:00
Jan Nieuwenhuizen ef29ade04b
mescc: Mes C Library: Add buffered read.
* lib/mes/__buffered_read.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Add it.  Also add memmove.c.
(libc_tcc_SOURCES): Remove memmove.c
* lib/linux/close.c (close): Clear read buffer.
* lib/linux/_open3.c (_open3): Likewise.
* lib/linux/lseek.c (lseek): Correct for read buffer.
* lib/stdio/fwrite.c (fwrite): Likewise.
* lib/posix/read.c (read): Call __buffered_read.
* lib/posix/write.c (write): Add FIXME note about buffered reads.
* simple.sh: Update.
2019-07-27 22:58:49 +02:00
Jan Nieuwenhuizen c7d86eb955
tests: Disable 70-extern.c for x86_64-gcc.
* build-aux/check-mescc.sh (XFAIL_TESTS)[x86_64-gcc]: Add
70-extern.c.
2019-06-10 23:13:50 +02:00
Jan Nieuwenhuizen 26891251a6
mescc: Do not dump variables with extern storage.
* lib/tests/scaffold/70-extern.stdout: New file.
* lib/tests/scaffold/70-extern.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it..
* module/mescc/M1.scm (global-string?, global-extern?): New function.
(info->M1): Dump strings first.  Skip extern symbols.
* module/mescc/info.scm (<global>): Add storage field.
(make-global): Add storage parameter.  Pass it.
* module/mescc/compile.scm (make-global-entry): Likewise.
(global->info): Likewise.
(init-declr->info): Likewise.
(decl->info): Pass storage.
2019-07-27 17:22:00 +02:00
Jan Nieuwenhuizen e8626841f3
build: ./pre-inst-env MES_PREFIX fixup.
* build-aux/pre-inst-env.in: Set MES_PREFIX to abs_top_srcdir.
* src/mes.c (open_boot): Cater for MES_PREFIX/mes and ${srcdest}.
2019-07-27 09:19:53 +02:00
Jan Nieuwenhuizen 72e3582322
build: Distribute crt*.c, libc+gnu.c for tcc, gcc bootstrap build.
* build-aux/build-lib.sh (libc_gnu_SOURCES): Build libc+gnu.c.  Copy
crt*.c, libc+gnu.c for distribution.
2019-07-26 18:36:07 +02:00
Jan Nieuwenhuizen 2e98d03699
build: Resurrect --with-cheating.
* build-aux/config.sh.in (SCHEME): New substitute.
* build-aux/config.make.in: Likewise.
* configure: Substitute them.
2019-07-20 18:56:58 +02:00
Jan Nieuwenhuizen 2611a64b2e
mescc: Add 70-struct-post.c test with fix.
* lib/tests/scaffold/70-struct-post.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
* module/mescc/compile.scm (expr->register): Use type size for rank
0 (WAS: 1).
2019-07-21 22:40:42 +02:00
Jan Nieuwenhuizen 2f77f506b1
mescc: Add 70-struct-short-enum-init.c test with fix.
* module/mescc/compile.scm (init->data): Respect type of size.
* lib/tests/scaffold/70-struct-short-enum-init.c: New file.
* lib/tests/scaffold/70-struct-short-enum-init.stdout: New file.
* build-aux/check-mescc.sh (TESTS): Add test.
2019-07-21 16:48:26 +02:00
Jan Nieuwenhuizen 8e01a68357
mescc: Add 70-array-in-struct-init.c test with fix.
* lib/tests/scaffold/70-array-in-struct-init.c: New file.
* lib/tests/scaffold/70-array-in-struct-init.stdout: New file.
* build-aux/check-mescc.sh (TESTS): Add test.
* module/mescc/compile.scm (array-init-element->data): Recurse for
elements instead of using init->data.  Support array fields.
2019-07-20 17:14:55 +02:00
Danny Milosavljevic 4b5d5017c4
Fix remainder handling.
* mes/module/mes/scm.mes (number->string): Fix remainder handling.
* build-aux/check-mescc.sh (XFAIL_TESTS): Remove
lib/tests/scaffold/60-math.c.
2019-07-05 15:52:04 +02:00
Jan Nieuwenhuizen 5d1a3e9eda
Revert "test: Disable 60-math.c test."
This reverts commit bbe6576a66a520d429bb3ec84120ffcce88480bf.
2019-07-09 22:01:24 +02:00
Jan Nieuwenhuizen 0e7ff7e82a
test: Disable 60-math.c test.
* build-aux/check-mescc.sh (TESTS): Remove
lib/tests/scaffold/60-math.c.
(BROKEN_TESTS): Add it.
2019-07-09 21:57:00 +02:00
Jan Nieuwenhuizen 9ac6528348
build: Resurrect bootstrap.sh.
* build-aux/connfigure-lib.sh: Split from build-lib.sh
* build-aux/build-lib.sh: Include it.
* build-aux/bootstrap.sh.in: New file.
* configure.sh: Substitute it.
2019-07-07 12:17:03 +02:00
Jan Nieuwenhuizen 479bf10878
build: Handle gcc with --pie-by-default.
This fixes upgrading to debian-hurd-20190220.img.

* build-aux/build.sh.in (CFLAGS): Add -static.  Fixes using gcc
compiled with --pie-by-default
* build-aux/check.sh.in (CFLAGS): Likewise.
* module/mescc.scm (parse-opts): Ignore -no-pie, -static.
2019-07-06 13:57:30 +02:00
Jan Nieuwenhuizen fca5f11dd4
test: Split-off broken 72-typedef-struct-def-local.
* lib/tests/scaffold/72-typedef-struct-def-local.c: New file.
* lib/tests/scaffold/72-typedef-struct-def.c: Remove local bit.
* build-aux/check-mescc.sh (TESTS): Add it.
(XFAIL_TESTS)[mescc]: Add lib/tests/scaffold/72-typedef-struct-def.c.
2019-07-08 09:04:01 +02:00
Jan Nieuwenhuizen babb1bb63e
test: Fix open-read test.
* build-aux/pre-inst-env.in (srcdir): Remove.
(abs_top_srcdir, abs_top_builddir): Export.
* lib/tests/posix/50-open-read.c (main): Use abs_top_srcdir.
2019-06-28 20:37:47 +02:00
Jan Nieuwenhuizen c83584f85f
test: Add open-read test.
* build-aux/test-c.sh: Support running by hand.
* lib/tests/posix/50-open-read.c: New test.
* lib/tests/posix/data/open-read: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
2019-06-26 21:55:44 +02:00
Jan Nieuwenhuizen e927a60648
test: Enable argv test, run tests with arguments.
* build-aux/check-mescc.sh (TESTS): Enable 54-argv.c
(XFAIL_TESTS): Remove it.
* build-aux/test-c.sh: Invoke test with options.
* lib/tests/scaffold/54-argc.c: Update.
2019-06-26 19:49:36 +02:00
Jan Nieuwenhuizen acb5608b70
mescc: Mes C library: Move common getcwd, open bits to posix.
* lib/linux/_getcwd.c: Rename from getcwd.c.
* lib/linux/_open3.c: Rename from open.c.
* lib/posix/getcwd.c: New file with bits from ../linux/getcwd.c.
* lib/posix/open.c: New file with bits ../linux/getcwd.c.
* build-aux/build-lib.sh (libc_SOURCES): Update.
2019-06-25 23:10:52 +02:00
Jan Nieuwenhuizen b562179c9c
mescc: Mes C Library: Move posix bits to read.
* lib/linux/_read.c: Rename from read.
* lib/posix/read.c: New file.
* build-aux/build-lib.sh (libc_SOURCES): Update.
* include/mes/lib.h (_read): Declare.
2019-06-25 01:58:15 +02:00
Jan Nieuwenhuizen 58864b181d
porting: Avoid failing in scaffold build.
* build-aux/build-scaffold.sh: Do not fail when using courage.
2019-06-25 21:45:46 +02:00
Jan Nieuwenhuizen 1ba8bf539a
build: Use bash if available to avoid dash problems.
* configure: Set SHELL to bash.
* configure.sh: Likewise.
* build-aux/test-suite.sh (TEST_LOGS):
* build-aux/export.make: Export SHELL.
* build-aux/config.sh.in (SHELL): New substitute, export.
* build-aux/config.make.in (SHELL): New substitute.
* build-aux/GNUmakefile.in (build, check, install, uninstall): Use
$SHELL to avoid dash problems.
* build-aux/check-mescc.sh: Likewise.
* build-aux/build.sh.in: Likewise.
* build-aux/check-mes.sh: Likewise.
* build-aux/check.sh.in: Likewise.
2019-06-25 21:40:43 +02:00
Jan Nieuwenhuizen dd0a0d779a
build: Improve --with-system-libc support.
* build-aux/build-lib.sh: Avoid building libc for --with-system-libc.
Make libmes richer.
build-aux/check-mescc.sh: Enable 50-malloc test.
* include/dirstream.h: Use HAVE_DIRSTREAM_H to cater for non-existing
dirstream.h.
* include/grp.h[SYSTEM_LIBC]: Typo.
* include/mes/lib.h (__brk, __call_at_exit)[SYSTEM_LIBC]: Declare.
* include/stdlib.h (comparison_fn_t)[SYSTEM_LIBC]: Declare.
* include/time.h (mktime): Return time_t.
* lib/posix/isatty.c [SYSTEM_LIBC]: Do not (re)declare termios.
* lib/stub/mktime.c (mktime): Return time_t.
* lib/tests/scaffold/41-ternary.c (main): Remove assumption that
locals are initialized.
* lib/tests/scaffold/70-stdarg.c: Cater for SYSTEM_LIBC.
* lib/tests/setjmp/80-setjmp.c: Declare jmp buf.
* lib/*/*.c: Add missing mes/lib.h, errno.h includes.
2019-06-25 19:05:58 +02:00
Jan Nieuwenhuizen fbe0b2eef8
porting: Add x86 scaffold: exit and write in assembly.
* lib/x86-mes-gcc/exit-42.S: New file.
* lib/x86-mes-gcc/hello-mes.S: New file.
* lib/x86-mes/elf32-0exit-42.hex2: New file.
* lib/x86-mes/elf32-0hello-mes.hex2: New file.
* lib/x86-mes/elf32-body-hello-mes.hex2: New file.
* lib/x86-mes/elf32-body-exit-42.hex2: Rewrite.
* lib/x86-mes/elf32-header.hex2: Fix copyright header.
* lib/x86-mes/elf32-0header.hex2: Likewise.
* lib/x86-mes/elf-0footer.hex2: Remove.
* build-aux/build-scaffold.sh: Build them.
* .dir-locals.el (asm-mode): Allow TABs.
* .gitignore: Reserve .S assembly sources, i.e. manual written
assembly.  Update build system.
* module/mescc/mescc.scm: Update.
* build-aux/build-lib.sh: Update.
* scripts/ar.in: Update.
2019-06-13 14:19:59 +02:00
Jan Nieuwenhuizen 502a203742
make check: Do not re-check unless recheck=true.
* build-aux/check-mescc.sh (recheck): New variable.
* build-aux/check.sh.in (recheck): New variable.
* build-aux/test-suite.sh (TEST_LOGS): Use it.
2019-06-10 11:39:31 +02:00
Jan Nieuwenhuizen 78b3c85f15
build: Cater for ARM.
* configure: Cater for ARM.
* configure.sh: Likewise
* build-aux/GNUmakefile.in: Likewise.
* build-aux/bootstrap.sh.in: Likewise.
* module/mescc.scm (parse-opts): Likewise.
* src/mes.c (mes_environment): Likewise.
* build-aux/build.sh.in: Likewise.
* build-aux/config.sh Likewise.
* build-aux/install.sh.in: Likewise.
* module/mes/guile.scm: Likewise.
* scripts/mescc.scm.in: Likewise.
* module/mescc/mescc.scm (arch-get): New function.
(arch-get-info): New function.
(arch-get-define): New function.
(arch-get-m1-options): New function.
(arch-get-Architecture): New function.
(mescc:preprocess c->info, E->info, M1->hex2, hex2->elf,
M1->blood-elf, arch-find): Use them.
2019-05-22 17:55:20 +02:00
Jan Nieuwenhuizen 5dc245e739
build: Simplify.
core: Make mes src/ c files separate compilation units.

* include/mes/constants.h: New file.
* include/mes/macros.h: New file.
* include/mes/mes.h: New file.
* src/gc.c: Update.
* src/hash.c: Update.
* src/lib.c: Update.
* src/math.c: Update.
* src/mes.c: Update.
* src/module.c: Update.
* src/posix.c: Update.
* src/reader.c: Update.
* src/string.c: Update.
* src/struct.c: Update.
* src/vector.c: Update.

    mes: Update datadir.

* src/mes.c (g_datadir): New global.
(open_boot): Rename from read_boot.
(read_boot): New function.
* mes/module/mes/boot-0.scm: Move from boot-0.scm.in
* configure: Update.
* configure.sh: Update.

    mescc: Create libraries from separate files.

* .gitignore: Update.
* build-aux/bootstrap-mes.sh: Remove.
* build-aux/bootstrap.sh.in: Remove.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build-scaffold.sh: New file.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-tcc.sh: Remove.
* build-aux/config.sh.in: New file.
* build-aux/config.sh: Remove.
* build-aux/install.sh.in: Update.
* build-aux/test-boot.sh: New file.
* build-aux/test-c.sh: New file.
* build-aux/test-driver: New file.
* build-aux/test-suite.sh: New file.
* build-aux/trace.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes.
* lib/linux/x86-mes-mescc/mini.c: Likewise.
* lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes.
* lib/linux/x86_64-mes-mescc/mini.c: Likewise.
* lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c.
* lib/linux/x86-mes-mescc/syscall.c: Likewise.
* lib/linux/x86_64-mes-gcc/syscall.c: Likewise.
* lib/linux/x86_64-mes-mescc/syscall.c: Likewise.
* lib/mes/mes_open.c: Include config.h.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* scaffold/gc-test.sh: New file.
* simple.sh: Update.
2019-06-08 15:36:22 +02:00
Jan Nieuwenhuizen 3ef5212238
test: Move scaffold/tests into lib.
* lib/tests/scaffold: Move from scaffold/tests.
* scaffold/tests: Remove.
* build-aux/check-mescc.sh: Update.
2019-06-08 15:34:44 +02:00
Danny Milosavljevic 44f44aa099
build: Make "GUILEC" compilation status output more verbose (print full path).
* build-aux/build-guile.sh: Make "GUILEC" compilation status output more
verbose (print full path).
2019-05-10 16:38:05 +02:00
Jan Nieuwenhuizen 35a69e77d1
build: Fix --disable-silent-rules. Thanks ng0!
* configure (main): Substitute V as string value.
* build-aux/trace.sh: Typo.  Fixes using V=0.
* build-aux/config.status.in (V): New substitute.
* build-aux/config.make.in (V): New substiute.
2019-05-29 16:55:57 +02:00
Jan Nieuwenhuizen 26e88603d4
mescc: Mes C Library: Use SYSTEM_LIBC [WAS: WITH_GLIBC].
Run: sed -i 's,WITH_GLIBC,SYSTEM_LIBC,g' $(git grep -l WITH_GLIBC)

* build-aux/config.sh: Update.
* include/alloca.h: Likewise.
* include/ar.h: Likewise.
* include/argz.h: Likewise.
* include/assert.h: Likewise.
* include/ctype.h: Likewise.
* include/dirent.h: Likewise.
* include/dirstream.h: Likewise.
* include/dlfcn.h: Likewise.
* include/endian.h: Likewise.
* include/errno.h: Likewise.
* include/fcntl.h: Likewise.
* include/features.h: Likewise.
* include/float.h: Likewise.
* include/getopt.h: Likewise.
* include/inttypes.h: Likewise.
* include/libgen.h: Likewise.
* include/limits.h: Likewise.
* include/linux/x86_64/syscall.h: Likewise.
* include/locale.h: Likewise.
* include/math.h: Likewise.
* include/memory.h: Likewise.
* include/mes/lib-mini.h: Likewise.
* include/pwd.h: Likewise.
* include/setjmp.h: Likewise.
* include/signal.h: Likewise.
* include/stdarg.h: Likewise.
* include/stdbool.h: Likewise.
* include/stddef.h: Likewise.
* include/stdint.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/stdnoreturn.h: Likewise.
* include/string.h: Likewise.
* include/strings.h: Likewise.
* include/sys/cdefs.h: Likewise.
* include/sys/dir.h: Likewise.
* include/sys/file.h: Likewise.
* include/sys/ioctl.h: Likewise.
* include/sys/mman.h: Likewise.
* include/sys/param.h: Likewise.
* include/sys/resource.h: Likewise.
* include/sys/select.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/time.h: Likewise.
* include/sys/timeb.h: Likewise.
* include/sys/times.h: Likewise.
* include/sys/types.h: Likewise.
* include/sys/ucontext.h: Likewise.
* include/sys/user.h: Likewise.
* include/sys/wait.h: Likewise.
* include/termio.h: Likewise.
* include/time.h: Likewise.
* include/unistd.h: Likewise.
* lib/libmes.c: Likewise.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* lib/tests/stdio/80-sscanf.c: Likewise.
* lib/tests/stdlib/50-malloc.c: Likewise.
* module/mescc/preprocess.scm: Likewise.
* scaffold/cons-mes.c: Likewise.
* scaffold/lib/stdlib/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/tests/61-array.c: Likewise.
* scaffold/tiny-mes.c: Likewise.
* simple.sh: Likewise.
* src/mes.c: Likewise.
2019-05-29 16:15:12 +02:00
Jan Nieuwenhuizen 0ef174897f
mescc: Use named --architecture switch for upcoming mescc-tools 0.6.
* module/mescc/mescc.scm (M1->hex2): Use named --architecture switch for
upcoming mescc-tools 0.6.
(hex2->elf): Likewise.
* build-aux/bootstrap-mes.sh: Likewise.
* build-aux/bootstrap.sh.in: Likewise.
* build-aux/config.sh: Likewise.
2019-05-25 16:01:39 +02:00
Jan Nieuwenhuizen a46c318bb8
mes: Grand indent: prepare.
* build-aux/indent.sh: New file.
* include/mes/builtins.h: Move from src/builtins.h.
* include/fcntl.h: Use // *INDENT-OFF* to prevent indent breakage.
* include/locale.h: Likewise.
* include/signal.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/user.h: Likewise.
* lib/linux/x86-mes-gcc/crt0.c: Likewise.
* lib/linux/x86-mes-gcc/crt1.c: Likewise.
* lib/linux/x86-mes-gcc/mes.c: Likewise.
* lib/linux/x86-mes-gcc/mini.c: Likewise.
* lib/linux/x86_64-mes-gcc/crt0.c: Likewise.
* lib/linux/x86_64-mes-gcc/crt1.c: Likewise.
* lib/linux/x86_64-mes-gcc/mes.c: Likewise.
* lib/linux/x86_64-mes-gcc/mini.c: Likewise.
* lib/x86_64-mes-gcc/setjmp.c: Likewise.
* src/mes.c: Likewise.
* src/reader.c: Likewise.
2019-05-13 01:07:32 +02:00
Jan (janneke) Nieuwenhuizen e0eee55bf3
build: Fix mescc installation on Debian.
* build-aux/pre-inst-env.in: Set bindir.
* scripts/mescc.in: Fix configure/prefix issues.
* mes/module/mes/boot-01.scm (integer->char): Remove.
(newline): Use "\n".
(%moduledir): Use string-append.
* mes/module/mes/boot-02.scm: Likewise.
* mes/module/mes/boot-0.scm: Likewise.
2019-05-15 23:26:52 +02:00
Jan (janneke) Nieuwenhuizen 9f4a4e47b2
build: Debian make check and install fixes.
* configure (main): Oops, typo: mandir uses --infodir.
* build-aux/check.sh.in: Run check-mescc.sh with bash.
* build-aux/config.sh (CFLAGS, CPPFLAGS, HEX2FLAGS, LDFLAGS, M1FLAGS):
unset.
* build-aux/install.sh.in: Use BASHOPTS to check for bash; on Debian
dash is used and has $SHELL=/bin/bash.  Use ${DESTDIR}@...
2019-05-15 15:18:38 +02:00
Jan Nieuwenhuizen e66f16aeb6
mes: Rename strings.c.
* src/string.c: Rename from src/strings.c.
* src/mes.c
* build-aux/snarf.sh: Update.
2019-05-14 08:37:05 +02:00
Jan Nieuwenhuizen 74b9879156
build: Do not install test binaries.
* build-aux/install.sh.in: Do not install test binaries.
2019-05-03 18:08:46 +02:00
Jan Nieuwenhuizen 48a0bf181d
build: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.
* build-aux/build-mes.sh: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.
* build-aux/build.sh.in: Likewise.
* build-aux/cc.sh (link): Likewise.
* build-aux/config.make.in (with_glibc_p): Likewise.
* build-aux/config.sh (libc): Likewise.
(CPPFLAGS): Likewise.
* build-aux/config.status.in (with_glibc_p): Likewise.
* build-aux/test.sh: Likewise.
* configure (main): Likewise.
* configure.sh (subst): Likewise.
(mes_arch): Likewise.
* include/libmes.h: Likewise.
* include/linux/x86_64/syscall.h: Likewise.
* lib/libmes.c: Likewise.
* lib/tests/stdio/70-printf-hello.c (main): Likewise.
* lib/tests/stdio/70-printf-simple.c (main): Likewise.
* lib/tests/stdio/80-sscanf.c (main): Likewise.
* lib/tests/stdlib/50-malloc.c: Likewise.
* module/mescc/preprocess.scm (c99-input->full-ast): Likewise.
* scaffold/cons-mes.c: Likewise.
* scaffold/lib/stdlib/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/tests/61-array.c (getenv): Likewise.
* scaffold/tiny-mes.c: Likewise.
* src/mes.c: Likewise.
2019-03-23 21:44:00 +01:00
Jan Nieuwenhuizen d93b19f41f
test: 50-getenv: Test PATH, allow to fail.
* lib/tests/posix/50-getenv.c (main): Test PATH.
* build-aux/check-mescc.sh (broken): Add 50-getenv.
2019-03-02 22:22:35 +01:00
Jan Nieuwenhuizen 86609119e3
test: Remove special characters from files.
* scaffold/tests/06-call-not-1.c: Rename from 06-call-!1.c.
* scaffold/tests/06-not-call-1.c: Rename from 06-!call-1.c.
* scaffold/tests/12-if-eq.c: Rename from 12-if-==.c.
* scaffold/tests/13-if-neq.c: Rename from 13-if-!=.c.
* scaffold/tests/15-if-not-f.c: Rename from 15-if-!f.c.
* scaffold/tests/21-char-array-simple.c: Rename from 21-char[]-simple.c.
* scaffold/tests/21-char-array.c: Rename from 21-char[].c.
* scaffold/tests/22-while-char-array.c: Rename from 22-while-char[].c.
* scaffold/tests/41-ternary.c: Rename from 41-?.c.
* scaffold/tests/7u-call-ternary.c: Rename from 7u-call-?.c.
* scaffold/tests/7u-ternary-expression.c: Rename from 7u-?-expression.c.
* build-aux/check-mescc.sh (tests): Update.
2019-02-25 23:41:20 +01:00
Jan Nieuwenhuizen da1c529bb4
build: Support building with Gash.
* build-aux/check-mes.sh: Replace unspported $((..)) by $(expr ...).
* build-aux/check-mescc.sh: Likewise.
* build-aux/check-tcc.sh: Likewise.
2019-02-25 18:37:18 +01:00
Jan Nieuwenhuizen 6eaba71161
build: Remove mini-mes.
* scaffold/mini-mes.c: Remove.
* build-aux/build-mes.sh: Remove commented build instructions.
* .gitignore: Remove pattern.
2019-02-18 07:21:54 +01:00
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 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 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 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 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 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 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 6b5ac57602
build: Simplify: cater for one compiler at a time.
* build-aux/build-cc.sh: Remove.
* build-aux/build-cc32.sh: Remove.
* build-aux/build-cc64.sh: Remove.
* build-aux/build-x86_64-mes.sh: Remove.
* build-aux/cc-mes.sh: Remove.
* build-aux/cc-x86_64-mes.sh: Remove.
* build-aux/cc32-mes.sh: Remove.
* build-aux/cc64-mes.sh: Remove.
* build-aux/test64.sh: Remove.
* build-aux/bootstrap-mes.sh: New file.
* build-aux/config.make.in: New file.
* build-aux/config.status.in: New file.
* build-aux/test-cc.sh: New file.
* .gitignore: Update.
* build-aux/GNUmakefile.in: Update.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-boot.sh: Update.
* build-aux/check-mes.sh: Update.
* build-aux/check-mescc.sh: Update.
* build-aux/check-tcc.sh: Update.
* build-aux/check.sh.in: Update.
* build-aux/config.sh: Update.
* build-aux/export.make: Update.
* build-aux/install.sh.in: Update.
* build-aux/pre-inst-env.in: Update.
* build-aux/test.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* module/mescc/i386/as.scm: Update.
* module/mescc/preprocess.scm: Update.
* module/mescc/x86_64/as.scm: Update.
* scripts/mescc.in: Update.
* tests/psyntax.test: Update.
2018-11-06 20:29:35 +01:00
Jan Nieuwenhuizen 3d528b0257
mescc: vsnprintf: Compliant implementation.
* lib/stdio/vsnprintf.c (vsnprintf): New, complient implementation,
replacing vsnprint.
* lib/stdio/vsprintf.c (vsnprint): Forward to vsnprint.
* lib/stdio/snprintf.c (snprintf): Likewise.
* scaffold/tests/9a-snprintf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-10-22 18:33:40 +02:00
Jan Nieuwenhuizen 5d8e44de2c
test: Add performance test.
* module/mes/test.scm (pass-if-timeout): New macro.
* tests/perform.test: New test.
* build-aux/check-mes.sh (tests): Run it.
2018-10-21 12:04:25 +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 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 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 8df367b3a2
build: factor-out snarfing.
* build-aux/snarf.sh: New file.
* build-aux/build-cc.sh: Use it.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-cc64.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-x86_64-mes.sh: Likewise.
* build-aux/snarf.sh: Likewise.
2018-10-15 13:48:50 +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 33f37f2747
build: x86_64 bootstrap build fixes and workaround.
* configure: Substitute @arch@ (WAS: ARCH).  Update users.
* configure.sh: Substitute @arch@.
* build-aux/build-mes.sh: Use $GUILE for x86_64 build.
* build-aux/install.sh.in: Install mes.S, mes.x86_64-mes-S too.
Prune *.E, *.out.
2018-10-10 22:16:44 +02:00
Jan Nieuwenhuizen a238986e43
build: Support make seed for x86_64.
* build-aux/GNUmakefile.in (seed): Support make seed for x86_64.
* build-aux/build-mes.sh[SEED]: Also build src/mes.S.
* build-aux/build-x86_64-mes.sh[SEED]: Also build src/mes.x86_64-mes.S.
2018-10-06 22:26:07 +02:00
Jan Nieuwenhuizen 1f359b07a8
core: Add vector test.
* scaffold/boot/11-vector.scm: New test.
* build-aux/check-boot.sh: Run it.
2018-10-06 07:13:04 +02:00
Jan Nieuwenhuizen 3dd4da895f
mescc: Support negative divide.
* module/mescc/i386/as.scm (i386:r0/r1, i386:r0%r1): Support
negative divide.
* module/mescc/x86_64/as.scm (x86_64:r0/r1, x86_64:r0%r1): Likewise.
* lib/x86-mes/x86.M1: Likewise.
* lib/x86_64-mes/x86_64.M1: Likewise.
* scaffold/tests/a0-math-divide-signed-negative.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-10-06 17:28:08 +02:00
Jan Nieuwenhuizen d862f1eceb
mescc: Support --align, off by default.
* scripts/mescc.in (parse-opts): Add --align.
* module/mescc/mescc.scm (mescc:compile): Support --align, off by
default.
* module/mescc/M1.scm (infos->M1): Add #:align parameter.
(M1:merge-infos): Likewise.  Keep types.
(info->M1): Likewise.  Make alignment switchable.
* module/mescc/compile.scm (r->ident):  Do not clobber.
(ident-add): Likewise.
(clean-info): Keep types.
* module/mescc/i386/as.scm (i386:r->byte-label): New instruction.
* lib/x86-mes/x86.M1: Add instructions.
* lib/x86_64-mes/x86_64.M1: Add instructions.
* module/mescc/x86_64/as.scm (x86_64:r->byte-label,
x86_64:r->word-label, x86_64:r->long-label): New instruction.
2018-10-06 15:56:14 +02:00
Jan Nieuwenhuizen 51085ba25c
mescc: Support 64-bit immediates.
* module/mescc/M1.scm (hex2:address8, hex2:immediate8): New function.
(info->M1): Support 64-bit.
* module/mescc/compile.scm (convert-r0): FIXME!
* module/mescc/x86_64/as.scm (x86_64:value->r, x86_64:r->local,
x86_64:label->arg, x86_64:label->r, x86_64:r+value,
x86_64:r-cmp-value, x86_64:r-long-mem-add, x86_64:r-and): Support
64-bit immediates.
* lib/x86_64-mes/x86_64.M1: Likewise.
* scaffold/tests/17-compare-unsigned-char-le.c: Test it.
* scaffold/tests/17-compare-unsigned-short-le.c: Test it.
* build-aux/check-mescc.sh (tests): Run them.
2018-10-06 14:51:57 +02:00
Jan Nieuwenhuizen be4f23fae6
mescc: Fix truncation of short.
* module/mescc/compile.scm (convert-r0): Typo.  Fixes truncation of
short.  Thanks, pdewacht!
* scaffold/tests/a0-call-trunc-char.c: New file.
* scaffold/tests/a0-call-trunc-short.c: New file.
* build-aux/check-mescc.sh: Add them.
2018-10-06 11:57:04 +02:00
Jan Nieuwenhuizen 6078fa5083
build: Split-off x86_mes-gcc build.
* build-aux/build-cc64.sh: New file.
* build-aux/build.sh.in[CC64]: Invoke it.
* build-aux/build-cc.sh: Remove x86_64-mes-gcc build.
* build-aux/GNUmakefile.in (x86_64-mes-gcc): New target.
* build-aux/build-x86_64-mes.sh: Build all scafffold files.
2018-10-06 07:08:20 +02:00
Jan Nieuwenhuizen fed5929f80
build: Oops, use MES_LIBS.
* build-aux/build-x86_64-mes.sh: Use MES_LIBS instead of the unused
MES64_LIBS.  Fixes build.  Thanks, pdewacht!
2018-10-05 22:12:48 +02:00
Jan Nieuwenhuizen f1d93da665
build: remove bashism.
* build-aux/trace.sh (trace): Remove bashism.  Thanks pdewacht!
2018-10-05 21:24:14 +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 a2502ac96c
build: Oops, set VERSION.
* build-aux/install.sh.in (VERSION): New substituted variable.
2018-10-04 23:10:56 +02:00
Jan Nieuwenhuizen 5484e0ffdf
build: Resurrect make seed.
* build-aux/GNUmakefile.in (seed): Resurrect.
* build-aux/build-x86_64-mes.sh: Build from seed.
2018-09-30 12:15:11 +02:00
Jan Nieuwenhuizen 7a8a2fc517
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64.
* module/mescc/as.scm: Support abstracted assembly.
* module/mescc/i386/as.scm: Rewrite.
* module/mescc/x86_64/as.scm: Implement.
* module/mescc/compile.scm: Refactor to abstracted assembly.
* module/mescc/M1.scm: Update for partial 64 bit support.
* module/mescc/bytevectors.scm (bytevector-u64-native-set!): New
procedure.
* module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length
also for faking double, long long, long double.
* module/mescc/info.scm:modified:
* module/mescc/x86_64/info.scm (x86_64:registers): New variable.
* lib/x86-mes/x86.M1: Update for new register scheme.
* lib/x86_64-mes/x86_64.M1: Implement.
* lib/x86-mes/setjmp.c: Implement.
* lib/x86_64-mes-gcc/setjmp.c: Implement.
* build-aux/build-cc.sh: Update for x86_64.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-x86_64-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test64.sh: Likewise.
* include/libmes.h: Likewise.
* include/setjmp.h: Likewise.
* include/signal.h: Likewise.
* include/stdarg.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/types.h: Likewise.
* include/sys/wait.h: Likewise.
* include/unistd.h: Likewise.
* lib/libc+gnu.c: Likewise.
* lib/libc+tcc.c: Likewise.
* lib/linux/gnu.c: Likewise.
* lib/linux/libc-mini.c: Likewise.
* lib/linux/libc.c: Likewise.
* lib/linux/tcc.c: Likewise.
* lib/linux/x86_64-mes-gcc/mes.c: Likewise.
* lib/linux/x86_64-mes/crt1.c: Likewise.
* lib/mes/abtol.c: Likewise.
* lib/posix/mktemp.c: Likewise.
* lib/posix/wait.c: Likewise.
* lib/stdio/fopen.c: Likewise.
* lib/stdio/fputc.c: Likewise.
* lib/stdio/fseek.c: Likewise.
* lib/stdio/printf.c: Likewise.
* lib/stdio/sprintf.c: Likewise.
* lib/stdio/vfprintf.c: Likewise.
* lib/stdio/vsprintf.c: Likewise.
* lib/stdio/vsscanf.c: Likewise.
* lib/stdlib/qsort.c: Likewise.
* lib/x86-mes-gcc/setjmp.c: Likewise.
* scaffold/tests/11-if-1.c: Likewise.
* scaffold/tests/15-if-!f.c: Likewise.
* scaffold/tests/16-if-t.c: Likewise.
* scaffold/tests/21-char[].c: Likewise.
* scaffold/tests/23-pointer.c: Likewise.
* scaffold/tests/32-compare.c: Likewise.
* scaffold/tests/33-and-or.c: Likewise.
* scaffold/tests/34-pre-post.c: Likewise.
* scaffold/tests/35-compare-char.c: Likewise.
* scaffold/tests/36-compare-arithmetic.c: Likewise.
* scaffold/tests/37-compare-assign.c: Likewise.
* scaffold/tests/38-compare-call.c: Likewise.
* scaffold/tests/40-if-else.c: Likewise.
* scaffold/tests/41-?.c: Likewise.
* scaffold/tests/42-goto-label.c: Likewise.
* scaffold/tests/43-for-do-while.c: Likewise.
* scaffold/tests/44-switch.c: Likewise.
* scaffold/tests/45-void-call.c: Likewise.
* scaffold/tests/46-function-static.c: Likewise.
* scaffold/tests/51-strcmp.c: Likewise.
* scaffold/tests/51-strncmp.c: Likewise.
* scaffold/tests/53-strcpy.c: Likewise.
* scaffold/tests/54-argv.c: Likewise.
* scaffold/tests/60-math.c: Likewise.
* scaffold/tests/61-array.c: Likewise.
* scaffold/tests/63-struct-cell.c: Likewise.
* scaffold/tests/64-make-cell.c: Likewise.
* scaffold/tests/65-read.c: Likewise.
* scaffold/tests/70-printf.c: Likewise.
* scaffold/tests/71-struct-array.c: Likewise.
* scaffold/tests/72-typedef-struct-def.c: Likewise.
* scaffold/tests/74-multi-line-string.c: Likewise.
* scaffold/tests/76-pointer-arithmetic.c: Likewise.
* scaffold/tests/79-int-array.c: Likewise.
* scaffold/tests/7a-struct-char-array.c: Likewise.
* scaffold/tests/7b-struct-int-array.c: Likewise.
* scaffold/tests/7i-struct-struct.c: Likewise.
* scaffold/tests/7k-for-each-elem.c: Likewise.
* scaffold/tests/7l-struct-any-size-array.c: Likewise.
* scaffold/tests/7o-struct-pre-post.c: Likewise.
* scaffold/tests/7q-bit-field.c: Likewise.
* scaffold/tests/7s-struct-short.c: Likewise.
* scaffold/tests/80-setjmp.c: Likewise.
* scaffold/tests/81-qsort.c: Likewise.
* scaffold/tests/85-sizeof.c: Likewise.
* scaffold/tests/87-sscanf.c: Likewise.
* scaffold/tests/90-strpbrk.c: Likewise.
* scaffold/tests/91-fseek.c: Likewise.
* scaffold/tests/95-signal.c: Likewise.
* scaffold/tests/97-fopen.c: Likewise.
* scaffold/tests/99-readdir.c: Likewise.
* scaffold/tests/t.c: Likewise.
* lib/linux/x86_64-mes/mes.c: New file.
* lib/linux/x86_64-mes/mini.c: New file.
* lib/x86_64-mes/setjmp.c: New file.
* scaffold/tests/06-!call-1.c: New file.
* scaffold/tests/06-call-2.c: New file.
* scaffold/tests/06-call-variable.c: New file.
* scaffold/tests/08-assign-global.c: New file.
* scaffold/tests/08-assign-negative.c: New file.
* scaffold/tests/17-compare-and-or.c: New file.
* scaffold/tests/17-compare-and.c: New file.
* scaffold/tests/17-compare-ge.c: New file.
* scaffold/tests/17-compare-gt.c: New file.
* scaffold/tests/17-compare-le.c: New file.
* scaffold/tests/17-compare-lt.c: New file.
* scaffold/tests/17-compare-or.c: New file.
* scaffold/tests/17-compare-unsigned-ge.c: New file.
* scaffold/tests/17-compare-unsigned-gt.c: New file.
* scaffold/tests/17-compare-unsigned-le.c: New file.
* scaffold/tests/17-compare-unsigned-lt.c: New file.
* scaffold/tests/21-char[]-simple.c: New file.
* scaffold/tests/23-global-pointer-init-null.c: New file.
* scaffold/tests/23-global-pointer-init.c: New file.
* scaffold/tests/23-global-pointer-pointer-ref.c: New file.
* scaffold/tests/23-global-pointer-ref.c: New file.
* scaffold/tests/23-pointer-sub.c: New file.
* scaffold/tests/31-oputs.c: New file.
* scaffold/tests/32-call-wrap.c: New file.
* scaffold/tests/38-compare-call-2.c: New file.
* scaffold/tests/38-compare-call-3.c: New file.
* scaffold/tests/51-pointer-sub.c: New file.
* scaffold/tests/54-argc.c: New file.
* scaffold/tests/63-struct-array-assign.c: New file.
* scaffold/tests/63-struct-array-compare.c: New file.
* scaffold/tests/63-struct-array.c: New file.
* scaffold/tests/63-struct-assign.c: New file.
* scaffold/tests/63-struct-function.c: New file.
* scaffold/tests/63-struct-local.c: New file.
* scaffold/tests/63-struct-pointer.c: New file.
* scaffold/tests/63-struct.c: New file.
* scaffold/tests/70-printf-hello.c: New file.
* scaffold/tests/70-printf-simple.c: New file.
* scaffold/tests/70-stdarg.c: New file.
* scaffold/tests/70-strchr.c: New file.
* scaffold/tests/73-union-hello.c: New file.
* scaffold/tests/76-pointer-arithmetic-pp.c: New file.
* scaffold/tests/79-int-array-simple.c: New file.
* scaffold/tests/7b-struct-int-array-hello.c: New file.
* scaffold/tests/7b-struct-int-array-pointer.c: New file.
* scaffold/tests/7i-struct-struct-simple.c: New file.
* scaffold/tests/7k-for-each-elem-simple.c: New file.
* scaffold/tests/7l-struct-any-size-array-simple.c: New file.
* scaffold/tests/7o-struct-pre-post-simple.c: New file.
* scaffold/tests/7q-bit-field-simple.c: New file.
* scaffold/tests/90-strspn.c: New file.
* scaffold/tests/06-call-string.c.: Rename from 31-eputs.c.
* scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c.
* scaffold/tests/48-global-static.c: Rename from 49-global-static.c.
* scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c.
* scaffold/tests/51-itoa.c:r Rename from 52-itoa.c.
* include/signal.h:(struct sigaction):
2018-08-15 18:26:55 +02:00
Jan Nieuwenhuizen 2fac924c33
mescc: x86_64 support: Add tests. 2018-08-15 17:19:50 +02:00
Jan Nieuwenhuizen 3e1a197ed1
mescc: Initial x86_64 support.
make all-go && MES=guile ./pre-inst-env scripts/mescc -m64 -c scaffold/main.c
2018-08-14 20:32:56 +02:00
Jan Nieuwenhuizen ee9081f3ec
mescc: Prepare for x86_64 support.
* module/mescc/info.scm (info): Add allocated, registers.
* module/mescc/i386/info.scm: New file.
* build-aux/build-guile.sh (SCM_FILES): Add it.
* module/mescc/compile.scm (c99-input->info): Add info parameter.
(c99-ast->info): Likewise.
(i386:type-alist): Remove.
(alloc-register, free-register): New function.
(expr->register*): Rename from expr->accu*.  Update callers.
(expr->accu): Rename from expr->accu.  Update callers.
* module/mescc/mescc.scm(%info): New variable.
* module/mescc/mescc.scm (c->ast): Use it.
(mescc:compile): Likewise.
(E->info): Likewise.
2018-08-14 12:35:24 +02:00
Jan Nieuwenhuizen b5a725256c
build: Oops, fix ./check.sh for bootstrap build.
* build-aux/config.sh (top_builddir): Set default to `.'.
2018-09-09 07:11:50 +02:00
Jan Nieuwenhuizen 738c009456
doc: Update bootstrap graph.
* doc/images/gcc-mesboot-graph.dot: Regenerate.
* build-aux/GNUmakefile.in (doc/mes.info): Oops change dependency to .png.
* doc/mes.texi (The Mes Bootstrap Process): Update image and wording.
2018-09-04 07:51:15 +02:00
Jan Nieuwenhuizen 5fb94529b9
Release 0.17.1.
* configure (VERSION): Update to 0.17.1.
(main): Likewise.
* configure.sh (VERSION): Likewise.
* build-aux/GNUmakefile.in (gen-announce): Likewise.
* guix/git/mes.scm (mes, mes.git): Likewise.
2018-09-03 19:57:22 +02:00
Jan Nieuwenhuizen d814eeda79
build: ALlow releasing from worktree.
* build-aux/GNUmakefile.in (COMMIT): Check for .git file.
2018-09-03 20:09:45 +02:00
Jan Nieuwenhuizen f22cc0c173
mescc: Mes C Library: Fix qsort to support duplicate entries.
* lib/stdlib/qsort.c (qpart): Handle dupes.
* scaffold/tests/81-qsort-dupes.c: New file.
* build-aux/check-mescc.sh (tests): Run it.
2018-08-27 22:37:12 +02:00
Jan Nieuwenhuizen fa4ba916ea
mescc: Mes C Library: Add closedir, opendir, readdir.
* include/dirent.h: New file.  Import from glibc-2.2.5.
* include/dirstream.h: Likewise.
* lib/dirent/__getdirentries.c: Likewise.
* lib/dirent/closedir.c: Likewise.
* lib/dirent/readdir.c (readdir): Likewise.
* lib/libc+gnu.c: Include them.
* include/linux/x86/syscall.h (SYS_getdents): New macro.
* include/linux/x86_64/syscall.h (SYS_getdents): Likewise.
* lib/linux/gnu.c (getdents): New function.
* include/limits.h (NAME_MAX): New macro.
* include/fcntl.h (O_DIRECTORY): New macro.
* scaffold/tests/readdir.dir: New directory.
* scaffold/tests/99-readdir.c: New file, use it.
* build-aux/check-mescc.sh (tests): Run it.
2018-08-26 18:34:53 +02:00
Jan Nieuwenhuizen 7ca72fefcd
mescc: Mes C Library: Move strncmp to own test.
* scaffold/tests/51-strcmp.c: Remove strncmp tests.
* scaffold/tests/51-strncmp.c: New file.
* build-aux/check-mescc.sh (tests): Add it.
2018-08-21 20:33:54 +02:00
Jan Nieuwenhuizen fe60c924dd
mescc: Add dir to include path.
* module/mescc/mescc.scm (preprocess): Add dir to include path.
(c->info): Likewise.
* scaffold/tests/08-assign.c: New file.
2018-08-15 19:11:54 +02:00
Jan Nieuwenhuizen 3f45b7f92b
check-mescc: c-mini 2018-08-16 21:04:36 +02:00
Jan Nieuwenhuizen 7a849284dc
test: Build initial scaffold tests without libc.
* scaffold/argv.c (strcmp): New function; support building without
libc.
* build-aux/build-cc.sh: Build initial scaffold tests without libc.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* scaffold/read.data: Rename from `mesmes'.
* scaffold/read.c: Rename from `m.c'; update.
2018-08-15 17:47:03 +02:00
Jan Nieuwenhuizen 6633331876
build: Cleanup trace output.
* build-aux/build-cc.sh: Cleanup trace output.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-guile.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-x86_64-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* build-aux/cc64-mes.sh: Likewise.
* build-aux/check-boot.sh: Likewise.
2018-08-15 12:28:08 +02:00
Jan Nieuwenhuizen 43f0c2d831
build: src/mes build fixes.
* build-aux/GNUmakefile.in (seed): Add dependency on gcc.
* build-aux/build-cc.sh: Copy result to src/mes.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build.sh.in: Remove copying of results.
2018-08-12 15:05:21 +02:00
Jan Nieuwenhuizen 9273a64098
mescc: Mes C Library: Cleanup start files.
* lib/linux/x86-mes-gcc/crt0.c: Split from lib/linux/crt0.c.
* lib/linux/x86-mes-gcc/crt1.c: Split from lib/linux/crt1.c.
* lib/linux/x86-mes-gcc/crti.c: Split from lib/linux/crti.c.
* lib/linux/x86-mes-gcc/crtn.c: Split from lib/linux/crtn.c.
* lib/linux/x86-mes/crt0.c: Split from lib/linux/crt0.c.
* lib/linux/x86-mes/crt1.c: Split from lib/linux/crt1.c.
* lib/linux/x86-mes/crti.c: Split from lib/linux/crti.c.
* lib/linux/x86-mes/crtn.c: Split from lib/linux/crtn.c.
* build-aux/build-cc.sh: Update.
* build-aux/build-cc32.sh: Update.
* build-aux/build-mes.sh: Update.
2018-08-12 08:45:04 +02:00
Jan Nieuwenhuizen fe055ba344
mescc: Mes C Library: Add x86_64 libc+gnu support.
* include/linux/x86/syscall.h: Move SYS_ defines from gnu.c.
* include/linux/x86_64/syscall.h: Add SYS_ defines for gnu.
* lib/linux/gnu.c: Update.
* lib/linux/gnu.c (signal)[__x86_64__]: Implement using rt_sigaction.
* lib/stdlib/abort.c: Support x86_64.
2018-08-11 19:04:01 +02:00
Jan Nieuwenhuizen 50dff52c99
mescc: Mes C Library: Add x86_64 libc+tcc support.
* include/linux/x86/syscall.h: Move SYS_ defines from tcc.c.
* include/linux/x86_64/syscall.h: Add SYS_ defines for tcc.
* lib/x86-mes-gcc/setjmp.c: Rename from lib/libc+tcc-gcc.c
* lib/x86-mes/setjmp.c: Rename from lib/libc+tcc-mes.c
* lib/linux/tcc.c: Update.
2018-08-11 18:39:48 +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