mes-0.24.2/.dir-locals.el0000644000000000000000000001211014372371517011707 0ustar ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2018,2019,2020 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; ;;; GNU Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see . ;; The GNU project defaults. These are also the GNU Emacs defaults. ;; Re-asserting theme here, however, as a courtesy for setups that use ;; a global override. ( ;; For writing GNU C code, see ;; https://www.gnu.org/prep/standards/html_node/Writing-C.html (c-mode . ((c-file-style . "gnu") (indent-tabs-mode . nil))) (makefile-mode . ((indent-tabs-mode . t))) (asm-mode . ((indent-tabs-mode . t))) (nil . ((indent-tabs-mode . nil) (fill-column . 72))) (scheme-mode . ((geiser-active-implementations . (guile)) ;; Guile syntax (eval . (put 'pass-if 'scheme-indent-function 1)) (eval . (put 'pass-if-not 'scheme-indent-function 1)) (eval . (put 'pass-if-eq 'scheme-indent-function 2)) (eval . (put 'pass-if-equal 'scheme-indent-function 2)) (eval . (put 'expect-fail 'scheme-indent-function 2)) (eval . (put 'pass-if-timeout 'scheme-indent-function 2)) ;; Guix package (eval . (put 'package 'scheme-indent-function 0)) (eval . (put 'origin 'scheme-indent-function 0)) ;; Guix 'modify-phases' and its keywords. (eval . (put 'modify-phases 'scheme-indent-function 1)) (eval . (put 'replace 'scheme-indent-function 1)) (eval . (put 'add-before 'scheme-indent-function 2)) (eval . (put 'add-after 'scheme-indent-function 2)) ;; Guix utils (eval . (put 'substitute* 'scheme-indent-function 1)) (eval . (progn (defun prefix-dir-locals-dir (elt) (concat (locate-dominating-file buffer-file-name ".dir-locals.el") elt)) (mapcar (lambda (dir) (add-to-list 'geiser-guile-load-path dir)) (mapcar #'prefix-dir-locals-dir '("scripts" "module"))))))) (texinfo-mode . ((indent-tabs-mode . nil) (fill-column . 72))) (nil . ((eval . (progn (let ((top (locate-dominating-file default-directory ".dir-locals.el")))) (defun guile--manual-look-up (id mod) (message "guile--manual-look-up id=%s => %s mod=%s" id (symbol-name id) mod) (let ((info-lookup-other-window-flag geiser-guile-manual-lookup-other-window-p)) (info-lookup-symbol (symbol-name id) 'scheme-mode)) (when geiser-guile-manual-lookup-other-window-p (switch-to-buffer-other-window "*info*")) (search-forward (format "%s" id) nil t)) (add-hook 'before-save-hook 'delete-trailing-whitespace nil t) (defun guix-switch-profile (&optional profile) "reset Emacs' environment by snarfing PROFILE/etc/profile" (defun matches-in-string (regexp string) "return a list of matches of REGEXP in STRING." (let ((matches)) (save-match-data (string-match "^" "") (while (string-match regexp string (match-end 0)) (push (or (match-string 1 string) (match-string 0 string)) matches))) matches)) (interactive "fprofile: ") (let* ((output (shell-command-to-string (concat "GUIX_PROFILE= /bin/sh -x " profile "/etc/profile"))) (exports (matches-in-string "^[+] export \\(.*\\)" output))) (mapcar (lambda (line) (apply #'setenv (split-string line "="))) exports ))) (defun shell-args-to-string (&rest args) (shell-command-to-string (mapconcat 'identity args " "))) (defun as (string &optional arch) (let* ((arch (or arch "--64")) (asm (subst-char-in-string ?_ ?\s string)) (foo (message "asm:%S" asm)) (result (shell-args-to-string "as" arch (concat "<(echo '" asm "')"))) (disassembly (shell-args-to-string "objdump" "-d" "a.out")) (foo (message "disassembly: %S" disassembly)) (match (string-match "^ 0:[\t]\\([^\t]*\\)" disassembly)) (code (match-string 1 disassembly)) (code (apply 'concat (split-string code " " t)))) (insert " ") (insert code))) (defun as-32 (point mark) (interactive "r") (let* ((string (buffer-substring point mark)) (code (as string "--32"))) (insert " ") (insert code))) (defun as-64 (point mark) (interactive "r") (let* ((string (buffer-substring point mark)) (code (as string "--64"))) (insert " ") (insert code)))))))) mes-0.24.2/.gitignore0000644000000000000000000000464114372371517011260 0ustar # GNU Mes --- Maxwell Equations of Software # Copyright © 2016,2017,2019,2020,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . *- *~ .#* *.E *.s *.blood-elf *.blood-elf-M1 *.blood-elf-hex2 *.gcc *.gcc-o *.gcc-out *.gcc-stdout *.go *.guile *.guile-log *.log *.trs *.mes-gcc *.mes-gcc-o *.mes-gcc-out *.mes-gcc-out *.mes-gcc-stdout *.mes-o *.mes-out *.mes-stdout *.mes-tcc *.mes-tcc-o *.mes-tcc-out *.mes-tcc-out *.mes-tcc-stdout *.mini-M1 *.mini-guile *.mini-hex2 *.a *.o *.h.m2 *.c.m2 *.seed-out *.stderr *.stdout *.x86-out /TAGS /lib/x86-mes/0exit-42 /lib/x86-mes/exit-42 /lib/tests/*/[0-9a][0-9a-z]-* !/lib/tests/*/*.c !/lib/tests/*/*.exit !/lib/tests/*/*.stdout /scaffold/*.M1 /scaffold/*.m2 /scaffold/*.hex2 /scaffold/argv /scaffold/hello /scaffold/main /scaffold/micro-mes /scaffold/read /scaffold/tiny-mes /scaffold/argv-m2 /scaffold/hello-m2 /scaffold/main-m2 /scaffold/micro-mes-m2 /scaffold/read-m2 /scaffold/tiny-mes-m2 /.config.make /.store /.tarball-version ? ?.mes \#*# /doc/fosdem/fosdem.aux /doc/fosdem/fosdem.log /doc/fosdem/fosdem.nav /doc/fosdem/fosdem.out /doc/fosdem/fosdem.snm /doc/fosdem/fosdem.tex /doc/fosdem/fosdem.toc /doc/fosdem/fosdem.*vrb /doc/mes.1 /doc/mes.info /doc/mes.pdf /doc/mesar.1 /doc/mescc.1 /doc/version.texi /mes.aux /mes.cp /mes.cps /mes.fn /mes.info /mes.tmp /mes.toc /mes.vr /mes.vrs /config.status /pre-inst-env /bootstrap.sh /build.sh /check.sh /install.sh /uninstall.sh /mes/module/mes/boot-0.scm /scripts/mesar /scripts/mescc.scm /scripts/mescc /doc/images/gcc-mesboot-graph.png /GNUmakefile /pre-inst-env /doc/images/gcc-mesboot-graph.eps /doc/images/gcc-mesboot-graph.pdf /doc/web/ /config.sh /include/arch /include/mes/config.h /gcc-lib /mescc-lib /bin /0exit-42 /0hello-mes /body-exit-42 /body-hello-mes /exit-42 /hello-mes core /.config a.out mes-0.24.2/AUTHORS0000644000000000000000000000421714372371517010337 0ustar -*- org -*- #+TITLE: GNU Mes Authors Jan (janneke) Nieuwenhuizen Main author All files except the imported files listed below Danny Milosavljevic ARM port lib/mes/div.c Additions and fixes throughout Jeremiah Orians lib/stdio/fopen.c (first simple version of fopen) scaffold/tests/98-fopen.c Initial work on elf headers: lib/linux/x86-mes/elf32-header.hex2 and similar Han-Wen Nienhuys lib/string/memmem.c (_memmem, memmem) Peter de Wachter Small fixes and additions to lib/x86-mes/x86.M1 lib/x86_64-mes/x86_64.M1 include/stdint.h module/mescc/compile.mes rain1 scaffold/tests/90-goto-var.c scaffold/tests/91-goto-array.c Nathalie Kopaczewski Fast long devision lib/div.c (__mesabi_log2i) W. J. van der Laan Bugfixes for logand, 64bit build, and va_arg List of imported files D A Gwyn lib/alloca.c Included verbatim from gnulib build-aux/gitlog-to-changelog Portable hygienic pattern matcher mes/module/mes/match.scm Portable LALR(1) parser generator mes/module/mes/lalr.scm Portable syntax-case from Chez Scheme; patches from Guile mes/module/mes/psyntax.ss mes/module/mes/psyntax.pp [generated] Getopt-long from Guile module/mes/getopt-long.scm Optargs from Guile mes/module/mes/optargs.scm Pmatch from Guile mes/module/system/base/pmatch.scm Pretty-print from Guile mes/module/mes/pretty-print.scm Srfi-1 bits from Guile mes/module/srfi/srfi-1.scm Srfi-16 from Guile mes/module/srfi/srfi-16.scm Srfi-26 from Guile mes/module/srfi/srfi-26.scm GNU FDL in texinfo from GNU doc/fdl-1.3.texi Hurd and Mach support from GNU C Library include/gnu/hurd-types.h include/mach/mach-init.h lib/mach/msg.c lib/mach/mach-init.c lib/mach/*.S M2-Planet dependencies lib/m2/x86/x86_defs.M1 lib/m2/x86/ELF-x86.hex2 * legalese Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. mes-0.24.2/BLURB0000644000000000000000000000230514372371517010054 0ustar GNU Mes is a Scheme interpreter and C compiler for bootstrapping the GNU system. GNU Mes was created to address the security concerns that arise from bootstrapping an operating system using binary blobs, which is common practice for all software distributions. Mes is a Scheme interpreter written in a simple subset of C and a C compiler written in Scheme and comes with a small, bootstrappable C library. The Mes bootstrap has halved the size of opaque, uninspectable binaries that were needed to bootstrap GNU Guix, a functional GNU/Linux distribution that focusses on user freedom, reproducibility and security. That reduction was achieved by replacing GNU Binutils, GNU GCC and the GNU C Library with Mes. The final goal is to help create a full source bootstrap for UNIX-like operating systems. After three years of volunteer work funding will enable us to make another big step forward and reach an important new milestone. GNU Mes - https://gnu.org/software/mes GNU Guix - https://gnu.org/software/guix Bootstrappable Builds - https://bootstrappable.org Reproducible Builds - https://reproducible-builds.org Reduced Binary Seed bootstrap - https://guix.gnu.org/blog/2019/guix-reduces-bootstrap-seed-by-50/ mes-0.24.2/BOOTSTRAP0000644000000000000000000001466714372371517010601 0ustar -*- org -*- #+TITLE: bootstrappable.org project Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. * What? ** Full source bootstrapping for the GNU System A package in GNU Guix is uniquely identified by the hash of its source code, its dependencies, and its build recipe. Every package can be built from source, except for the bootstrap binaries. *** From the GNU Guix manual The distribution is fully “bootstrapped” and “self-contained”: each package is built based solely on other packages in the distribution. The root of this dependency graph is a small set of “bootstrap binaries”, provided by the ‘(gnu packages bootstrap)’ module. For more information on bootstrapping, *note Bootstrapping::. **** Guix v1.0 bootstrap binary seed $ du -schx $(readlink $(guix build bootstrap-tarballs)/*) 2.1M /gnu/store/9623n4bq6iq5c8cwwdq99qb7d0xj93ym-binutils-static-stripped-tarball-2.28.1/binutils-static-stripped-2.28.1-x86_64-linux.tar.xz 18M /gnu/store/437xwygmmwwpkddcyy1qvjcv4hak89pb-gcc-stripped-tarball-5.5.0/gcc-stripped-5.5.0-x86_64-linux.tar.xz 1.8M /gnu/store/55ccx18a0d1x5y6a575jf1yr0ywizvdg-glibc-stripped-tarball-2.26.105-g0890d5379c/glibc-stripped-2.26.105-g0890d5379c-x86_64-linux.tar.xz 5.7M /gnu/store/bqf0ajclbvnbm0a46819f30804y3ilx0-guile-static-stripped-tarball-2.2.3/guile-static-stripped-2.2.3-x86_64-linux.tar.xz 5.8M /gnu/store/j8yzjmh9sy4gbdfwjrhw46zca43aah6x-static-binaries-tarball-0/static-binaries-0-x86_64-linux.tar.xz 33M total $ for i in $(readlink $(guix build bootstrap-tarballs)/*);\ do sudo tar xf $i; done $ du -schx * 130M bin 13M include 54M lib 51M libexec 5.2M share 252M total **** Guix Reduced Binary Seed bootstrap binary seed $ du -schx $(readlink $(guix build bootstrap-tarballs)/*) 5.7M /gnu/store/9f8gi8raqfx9j3l9d00qrrc0jg3r1kyj-guile-static-stripped-tarball-2.2.6/guile-static-stripped-2.2.6-x86_64-linux.tar.xz 80K /gnu/store/b6rjl52hibhmvyw4dg8678pwryhla0h2-linux-libre-headers-stripped-tarball-4.19.56/linux-libre-headers-stripped-4.19.56-x86_64-linux.tar.xz 12K /gnu/store/d7zlxsjcnqilmvqwx7scija9x9bjw8cw-mescc-tools-static-stripped-tarball-0.5.2-0.bb062b0/mescc-tools-static-stripped-0.5.2-0.bb062b0-x86_64-linux.tar.xz 428K /gnu/store/n7zc4kpi8ny6jlfaikkzxlwhc5fvr1vr-mes-minimal-stripped-tarball-0.19/mes-minimal-stripped-0.19-x86_64-linux.tar.xz 6.0M /gnu/store/nv4djwlrljfqmynqr2cqvfwz0ydx7kxb-static-binaries-tarball-0/static-binaries-0-x86_64-linux.tar.xz 13M total $ for i in $(readlink $(guix build bootstrap-tarballs)/*);\ do sudo tar xf $i; done Password: $ du -schx * 93M bin 700K include 38M lib 14M share 145M total **** Guix Scheme-only bootstrap binary seed $ du -schx $(readlink $(~/src/guix/wip-bootstrap/pre-inst-env guix build bootstrap-tarballs)/*) 5.7M /gnu/store/1mq2pcd2h7g54xpi2jrgj6ibbi4lgi3c-guile-static-stripped-tarball-2.2.6/guile-static-stripped-2.2.6-x86_64-linux.tar.xz 80K /gnu/store/bl1r2bpk6fam8r2gjvr5mvr48i3dm2hn-linux-libre-headers-stripped-tarball-4.19.56/linux-libre-headers-stripped-4.19.56-x86_64-linux.tar.xz 12K /gnu/store/w0dlz486dhb8aiq8pxm5akllz628fqin-mescc-tools-static-stripped-tarball-0.5.2-0.bb062b0/mescc-tools-static-stripped-0.5.2-0.bb062b0-x86_64-linux.tar.xz 428K /gnu/store/15j6l18q44ymlrh1cfp4s4hc9835xic5-mes-minimal-stripped-tarball-0.19/mes-minimal-stripped-0.19-x86_64-linux.tar.xz 6.2M total $ for i in $(readlink $(~/src/guix/wip-bootstrap/pre-inst-env guix build bootstrap-tarballs)/*);\ do sudo tar xf $i; done $ du -schx * 4.9M bin 700K include 38M lib 14M share 57M total * Why? ** Reproducibility is essential to Software Freedom Reproducible builds are a set of software development practices that create a verifiable path from human readable source code to the binary code used by computers. *** What about the bootstrap binaries and the compilers? We have the sources: they always lead to bitwise-same binary, but what about the bootstrap binaries and compilers? *** The current way out: Ignore the problem ``recipe for yogurt: add yogurt to milk'' *** New solution: Full source bootstrapping path * How? ** Software: MesCC-tools, M2-Planet, GNU Mes and MesCC ** MesCC-tools https://savannah.gnu.org/projects/mescc-tools *** hex.0: ~500 byte well-documented, self-hosting hex assembler This 500 byte program is written in ASCII hex. When converted byte-for-byte from ASCCI to binary we have the only binary seed that our full source bootstrap path needs. We bless this simple and easily verifyable binary and consider it to be source. *** hex1: next level hex assembler written in hex.0 *** M0: a macro assembler written in hex.1 *** M1: a macro assembler written in M0 *** hex2: a hex2 linker written in M0 *** M2-Planet: a self-hosting M2 (C-with-structs) transpiler written in M1 *** GNU Mes: A Scheme interpreter written in C, with cpp transformed into M2 *** MesCC: A C compiler written in Scheme *** tcc-boot: a patched version of TinyCC ** GNU Mes and MesCC https://www.gnu.org/software/mes *** mes.c: a Scheme interpreter in ~5,000LOC of simple C *** mescc: a C compiler written in Scheme (uses Nyacc C99 parser in Scheme) *** mes.M2: this Scheme interpreter in bootstrappable M2 ** TinyCC https://gitlab.com/janneke/tinycc * TODO ** merge scheme-only bootstrap into Guix. ** reduced binary seed bootstrap into NixOS, Debian. ** remove or upstream patches from tcc-boot ** prepare src/mes.c for M2-Planet transpiler. ** ARM, the Hurd ** fix bootstrap-loops: (Nyacc?, mes.M2, psyntax.pp?) ** make GNU gcc (8.0?) bootstrappable again, remove [need for] tcc stage * DONE ** reduced binary seed bootstrap into Guix. ** replace Guix bootstrap for x86_64. ** replace Guix bootstrap for x86. ** add full source gcc-4.7 package build. ** bootstrap gcc+glibc-built binutils-20.1, gcc-4.1.0. ** have tcc-boot compile gnutools triplet: binutils-2.14, gcc-2.95.3, glibc-2.2.5. ** have tcc-boot's mes-tcc compile a fully functional tcc ** hex.0, hex.1, M0 ** M1, hex2_linker in simple C ** M2-Planet is now self-hosting, written in M2 ** mes+mescc are mutual self-hosting ** patched tcc compiled with mes+mescc ** during development we run mescc on Guile (mes is ~30 times slower) ** tcc compiled with gcc is known to compile gcc * Contact ** bug-mes@gnu.org ** #bootstrappable, #guix on libera.chat ** bootstrappable.org mes-0.24.2/COPYING0000644000000000000000000010451514372371517010324 0ustar GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . mes-0.24.2/ChangeLog0000644000000000000000000202371714372371517011051 0ustar 2023-02-13 Jan (janneke) Nieuwenhuizen build: Release 0.24.2. * configure (VERSION): Bump to 0.24.2. * configure.sh (VERSION): Likewise. * src/symbol.c (MES_VERSION): Likewise. * mes/module/mes/repl.mes (welcome): Update copyright years. build: Update release procedure. * build-aux/GNUmakefile.in: Add `./configure' stage before creating tarball. doc: Update `ROADMAP'. * ROADMAP (release 0.x, unsorted): Add Guile module support, Gash on Mes, Guile as a Guix FSB dependency. doc: Add `ANNOUNCE-0.24.2'. * doc/announce/ANNOUNCE-0.24.2: New file. doc: Update `NEWS'. * NEWS (Changes in 0.24.2 since 0.24.1): New section. 2023-02-12 Jan (janneke) Nieuwenhuizen lib: Fix compile warnings. * lib/linux/read.c (read): Add casts. * lib/linux/signal.c (signal): Likewise. * lib/stdio/vfscanf.c: Include stdlib.h. (vfscanf): Add cast. * lib/stdlib/mbstowcs.c (mbstowcs): Add cast. 2023-01-31 R. Masters lib: Support uppercase hex conversions. Uppercase hex number conversions fail for abtol, strtol, strtoul, strtoull, atoi, and abtod. The following patch fixes it. This allows tcc to handle assembly language, which is necessary to build the Fiwix kernel as part of the kernel bootstrapping in progress for the live-bootstrap project. * lib/ctype/isxdigit.c (isxdigit): Also allow A-F. * lib/mes/abtol.c (abtol): Also cater for A-F. 2023-01-24 Jan (janneke) Nieuwenhuizen lib/m2: time: Fix segfault by allocating timeval struct. Suggested by Meghan Denny . * lib/m2/time.c (__tv): New global variable. (time): Use it to allocate timeval struct. 2022-10-30 Jan (janneke) Nieuwenhuizen doc: Use HTTPS. * COPYING: Replace by new version (which uses HTTPS). * HACKING, README, doc/fdl-1.3.texi, doc/mes.texi: Use HTTPS. 2022-10-16 Jan (janneke) Nieuwenhuizen doc: Update `HACKING'. * HACKING (SETUP): Update arm triplet. 2022-10-19 Jan (janneke) Nieuwenhuizen mescc: Fix Guile warnings. * module/mescc/mescc.scm (GUILE-with-output-to-file): Remove.n (with-output-to-file): Rename to... (with-output-to-file*): ...this. (mescc:preprocess, mescc:compile, infos->hex2): Update callers. 2022-10-29 Jan (janneke) Nieuwenhuizen lib: stat: Use SYS_stat64 for 32bit platforms. This fixes . * include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64, SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]: New defines. (SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them. * include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64, SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]: New defines. (SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them. * include/sys/stat.h (struct stat): Move definition to... * include/linux/arm/kernel-stat.h, include/linux/m2/kernel-stat.h, include/linux/x86/kernel-stat.h, include/linux/x86_64/kernel-stat.h: These new files. * include/gnu/x86/kernel-stat.h: New file. * configure (main): Copy include///*.h to include/. * configure.sh: Likewise. * .gitignore: Ignore them. Add copyright header. * build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New variables. (build): Use them. (include/arch/%.h, arch-dir): New targets. * build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace include// with built ../include. * build-aux/build.sh.in (AM_CPPFLAGS): Likewise. * build-aux/install.sh.in: Also install built include. * include/m2/types.h: New file. * kaem.run: Use it. * simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to include/arch. 2022-10-26 Jan (janneke) Nieuwenhuizen lib: __assert_fail: Update to standard. * lib/mes/__assert_fail.c (__assert_fail): Add file, line, function parameters. * include/assert.h (assert): Update caller. (__assert_fail): Update prototype. * include/mes/lib.h (__assert_fail): Likewise. * lib/mes/assert_msg.c (assert_msg): Likewise. Include assert.h. 2022-05-05 Jan (janneke) Nieuwenhuizen time.c: include sys/time for gettimeofday. * lib/linux/time.c: Include . 2022-05-04 Jan (janneke) Nieuwenhuizen lib: linux/time: Remove SYS_time specialization. * lib/linux/time.c (time)[SYS_time]: Remove specialization. [!SYS_time && !SYS_gettimeofday]: Remove fallback. 2022-05-03 Jan (janneke) Nieuwenhuizen simple.sh: Resurrect. * simple.sh: Add src/globals.c, lib/stub/__raise.c. Use lib/linux/malloc.c instead of lib/stdlib/malloc.c. simple.make: Resurrect. * simple.make (M2_PLANET_FLAGS): Add --bootstrap-mode. (M2_SOURCES): Add lib/mes/globals.c. Use lib/mes/mini-write.c instead of lib/mes/write.c. Use lib/m2/malloc.c instead of lib/stdlib/malloc.c. (GCC_SOURCES): Add lib/mes/globals.c (check-mescc): Set LIBRARY_PATH. (m2): New target. (m2/mes-m2.M1): Use it. (m2/mes-m2.blood-elf.M1): Likewise. 2022-05-10 Gabriel Wicki core: Simplify math expressions. * src/gc.c (gc_up_arena): Use division instead of shift. (gc_flip): Simplify (free-news) * 1.5. 2022-05-07 Jan (janneke) Nieuwenhuizen scaffold: Remove obsolete malloc. * scaffold/lib/stdlib/malloc.c: Remove. 2022-09-22 Ekaitz Zarraga doc: Fix typos. * doc/mes.texi (Invoking mescc): Fix typo. * module/mescc.scm (parse-opts): Likewise. 2022-09-21 Ekaitz Zarraga mescc: Add X86_64 assembly defines for TinyCC compilation. * lib/x86_64-mes/x86_64.M1 ( mov____%si,(%rdi), mov____%sil,(%rdi), mov____(%rax),%si, mov____(%rax),%sil): New defines. 2022-10-18 Jan (janneke) Nieuwenhuizen build: When courageous, do build libgetopt and libtcc1. * build-aux/build-lib.sh: Move building of libc+gnu and courageous exit down. 2022-10-17 Jan (janneke) Nieuwenhuizen build: Support bootstrap build without kaem/M2-Planet. * configure.sh (M2_PLANET): Typo. Allow check to fail. (KAEM): Allow check to fail. 2022-10-16 Jan (janneke) Nieuwenhuizen guix: mes: Update to 0.24.1. * guix/git/mes.scm (mes)[source]: Update to 0.24.1. doc: Enlarge guix graph bootstrap image. * doc/mes.texi (The Mes Bootstrap Process): Use 6in width. doc: Typo. * doc/announce/ANNOUNCE-0.24.1: Typo. doc: Typo. * doc/announce/ANNOUNCE-0.24.1 (Subject): Typo. doc: Post-release update. * doc/announce/ANNOUNCE-0.24.1 (Subject): Update Add gen-announce checksums by running `make sum-announce'. * build-aux/GNUmakefile.in (--previous-version): Update to 0.24.1. guix: mes: Update to 0.24.1. * guix/git/mes.scm (mes)[source]: Update to 0.24.1. 2022-10-15 Jan (janneke) Nieuwenhuizen build: Release 0.24.1. * configure (VERSION): Bump to 0.24.1. * configure.sh (VERSION): Likewise. doc: Update `ROADMAP'. * ROADMAP (release 0.x, unsorted): Add Full Source bootstrap and wip-aarch64-bootstrap branch. Move DONE item... (DONE): ...here. doc: Add ANNOUNCE-0.24.1. * doc/announce/ANNOUNCE-0.24 (Subject): New file. doc: Update `NEWS'. * NEWS (Changes in 0.24.1 since 0.24): New section. 2022-09-15 Jan (janneke) Nieuwenhuizen lib/test: Cater for gcc-12.2.0. These inexplicably avoid segfaults with gcc-12.2.0. * lib/tests/posix/50-open-read.c (main)[__GNUC__ > 11]: Use malloc instead of local allocated string. * lib/tests/scaffold/7i-struct-struct.c (main)[__GNUC__ > 11]: Initialize all fields of struct. * lib/tests/scaffold/t.c (main): Likewise. 2022-06-01 Jan (janneke) Nieuwenhuizen doc: Update `PORTING'. * PORTING (Setup environment): Update guile, gcc-toolchain, pin nyacc@1.00.2. 2022-10-07 Rick Masters lib: abtol: Fix number digits in hex number conversion. After a letter based digit, number based digits are off. * lib/mes/abtol.c (abtol): Reset "m" for number based digit. * lib/tests/stdlib/70-strtoull.c (main): Test it. * lib/tests/stdlib/90-strtol.c (main): Likewise. 2022-09-13 Jan (janneke) Nieuwenhuizen ARM: Use explicit remainder in __mesabi_uldiv call. This inexplicably fixes a segfault in tcc-boot0. * module/mescc/armv4/as.scm (armv4:r0/r1): Instead of using "push 0", use explicit slot for remainder. 2022-09-12 Jan (janneke) Nieuwenhuizen ARM: Fix unsigned modulo. * lib/arm-mes/arm.M1 (mov____%esp,%r3): New macro. * module/mescc/armv4/as.scm (armv4:r0%r1): Use it to avoid overwriting %r0 before caling __mesabi_uldiv. 2022-09-11 Jan (janneke) Nieuwenhuizen test: Add 60-math-modulo.c. * lib/tests/scaffold/60-math-modulo.c: New test. * build-aux/check-mescc.sh (mes_tests): Add it. 2022-09-13 Jan (janneke) Nieuwenhuizen ARM: ntoab: Do not include __mesabi_uldiv for bootstrap tcc. * lib/mes/ntoab.c (__mesabi_uldiv): Exclude for tinycc arm bootstrap. 2022-05-21 Jan (janneke) Nieuwenhuizen build: Also use stage0_cpu detection in bootstrap.sh build. * build-aux/build-scaffold.sh: Include cflags.sh. (stage0_cpu): Move to... * build-aux/cflags.sh (stage0_cpu): ...here. * build-aux/build.sh.in (stage0_cpu): Remove. 2022-05-03 Jan (janneke) Nieuwenhuizen kaem: Fix version. * src/symbol.c (MES_VERSION): Update to 0.24. 2022-05-14 Jan (janneke) Nieuwenhuizen build: Fix configure crashing when no compiler is present. Reported by Andrius Štikonas via IRC. * configure (main): Cater for missing cc, actually set m2-planet when found. 2022-05-13 Gabriel Wicki core: Remove code duplication. * src/gc.c (copy_news): Remove copy of copy_cell. (gc_copy): Use copy_cell instead. core: Remove code duplication. * src/gc.c (news_bytes): Remove copy of cell_bytes. (gc_copy): Use cell_bytes instead. * include/mes/mes.h (news_bytes): Remove prototype. 2022-05-13 Jan (janneke) Nieuwenhuizen build: Add publish-local. * build-aux/GNUmakefile.in (publish-local): New target. doc: Update `README'. * README: Update to mention Further Reduced Binary Seed bootstrap. 2022-05-09 Dor Askayo Fix definition of S_ISUID. * include/sys/stat.h (S_ISUID: Append missing zero. 2022-05-06 Jan (janneke) Nieuwenhuizen build: Fix --with-bootstrap build. Reported by Vagrant Cascadian . * build-aux/build.sh.in: Before building mes using mescc, in bootstrap mode, remove globals.o built for lib. 2022-05-06 Jan (janneke) Nieuwenhuizen doc: Post-release update. * doc/announce/ANNOUNCE-0.24: Add gen-announce checksums. * build-aux/GNUmakefile.in (--previous-version): Update to 0.24. Add bug-mes to release announce. 2022-05-02 Jan (janneke) Nieuwenhuizen guix: mes: Update to 0.24. * guix/git/mes.scm (mes)[source]: Update to 0.24. 2022-04-30 Jan (janneke) Nieuwenhuizen build: Release 0.24. * configure (VERSION): Bump to 0.24. * configure.sh (VERSION): Likewise. * build-aux/GNUmakefile.in (gen-announce): Update previous-version to 0.23. * mes/module/mes/repl.mes (welcome): Update copyright years. 2022-05-01 Jan (janneke) Nieuwenhuizen doc: Update `ROADMAP'. * ROADMAP (release 0.x, unsorted): Move done item... (DONE): ...here. doc: Add `ANNOUNCE-0.24'. * doc/announce/ANNOUNCE-0.24: New file. 2022-04-30 Jan (janneke) Nieuwenhuizen doc: Update `NEWS'. * NEWS (Changes in 0.24 since 0.23): New section. 2019-11-03 Jan (janneke) Nieuwenhuizen doc: Update `README'. * README: Mention Mes can be bootstrapped using M2-Planet. Mention Full Source Bootstrap sponsoring by NlNet. 2021-01-02 Jan (janneke) Nieuwenhuizen doc: Update 'AUTHORS'. * AUTHORS: Mention Jeremiah Orians as co-author on ELF heanders and mention M2-Planet imports. Mention bug fixes by W.J. van der Laan. 2022-04-30 Jan (janneke) Nieuwenhuizen doc: Update Guix bootstrap status. * doc/mes.texi (Bootstrappable Builds): Add reference to Guix. (Reduced Binary Seed Bootstrap): Add node and section header. (Scheme-only Bootsrap): New section. (Full Source Bootstrap): Add node and section header. Some updates. (Stage0): Add node and section header. (M2-Planet): New section. (The Mes Bootstrap Process): Fix typos, update to current Guix reduced binary seed bootstrap status. * doc/images/gcc-mesboot-graph.dot: Regenerate. doc: Update dependencies, add M2-Planet. * INSTALL (Other GNU/Linux): Update mescc-tools requirement, mention M2-Planet. (Prerequisites): Likewise. * doc/mes.texi (Regular Requirements): Likewise. Rename to... (Requirements): ...this. (Bootstrap Requirements): Likewise. (Building from Git): Mention dependencies on GNU Texinfo, GNU help2man, graphviz, and perl. doc: Use `guix shell' instead of `guix environment'. * HACKING (SETUP): Use `guix shell' instead of `guix environment'. * INSTALL (Guix): Likewise. * PORTING (Setup environment): Likewise. * doc/mes.texi (Building from Git): Likewise. * simple.sh: Likewise. * guix.scm: Likewise. Add time-machine with working commit. 2022-05-02 Jan (janneke) Nieuwenhuizen build: Simple signature check for dist and release. * build-aux/GNUmakefile.in (check-signature): New target. (dist, release): Depend on it. build: Add `sum-announce' target. * build-aux/GNUmakefile.in (sum-announce): New target. (release): Check signature on release commit. 2022-04-30 Jan (janneke) Nieuwenhuizen ARM: build: Cater for M2-Planet. * include/linux/arm/syscall.h: Add support for M2-Planet. * lib/linux/arm-mes-m2/_exit.c, lib/linux/arm-mes-m2/_write.c, lib/linux/arm-mes-m2/crt1.M1, lib/linux/arm-mes-m2/crt1.c, lib/linux/arm-mes-m2/syscall.c, lib/m2/arm/ELF-arm.hex2, lib/m2/arm/arm_defs.M1: New files. * build-aux/build.sh.in: Also allow kaem build for ARM. 2022-05-01 Jan (janneke) Nieuwenhuizen guix: m2-planet: Update to 1.9.0. * guix/git/mes.scm (m2-planet)[source]: Update to 1.9.0. 2022-04-30 Jan (janneke) Nieuwenhuizen build: Depend on M2-Planet-1.9.0. * configure (main): Bump M2-Planet version to 1.8.0. 2022-05-01 Jan (janneke) Nieuwenhuizen guix: mescc-tools: Update to 1.4.0 * gnu/packages/mes.scm (m2-planet): Update to 1.4.0. [native-inputs]: Add which. [argument]: Remove patch-prefix stage. 2022-05-02 Jan (janneke) Nieuwenhuizen build: Depend on mescc-tools 1.4.0. * configure (main): Check for hex2, M1 1.4.0, and blood-elf 2.0.0. * module/mescc/mescc.scm (M1->blood-elf): Use --little-endian with blood-elf call. * kaem.run, scaffold/argv.kaem, scaffold/global-array.kaem, scaffold/hello.kaem, scaffold/local-array.kaem, scaffold/local-static-array.kaem, scaffold/main.kaem, scaffold/read.kaem, simple.make: Likewise. 2022-04-30 Jan (janneke) Nieuwenhuizen guix: m2-planet: Update to 1.8.0. * guix/git/mes.scm (m2-planet)[source]: Update to 1.8.0. [arguments]: Remove patch-prefix stage. [home-page]: Fix. build: Depend on M2-Planet-1.8.0. * configure (main): Bump M2-Planet version to 1.8.0. * kaem.run, scaffold/argv.kaem, scaffold/global-array.kaem, scaffold/hello.kaem, scaffold/local-array.kaem, scaffold/local-static-array.kaem, scaffold/main.kaem, scaffold/read.kaem:: Use M2-Planet --bootstrap-mode. * build-aux/build-scaffold.sh: Remove obsolete --exec_enable. guix: Update package inputs to new style. * guix/git/mes.scm (m2-planet)[native-inputs]: Use simple list. * guix/git/mes.scm (nyacc-0.99): Likewise. [inputs]: Use simple list. (nyacc): Likewise. (mes)[propagated-inputs]: Use simple list. [native-inputs]: Use list instead of alist. [native-search-paths]: New field. Mes C Library: memchr: Avoid compile warning. * lib/string/memchr.c (memchr): Cast return to void*. 2021-05-16 Jan (janneke) Nieuwenhuizen core: Fix FRAME_SIZE conflict. This avoids conflicting with FRAME_SIZE from signal.h. * include/mes/constants.h (FRAME_SIZE): Rename to... (GC_FRAME_SIZE): ...this. (FRAME_PROCEDURE): Rename to... (GC_FRAME_PROCEDURE): ...this. * src/eval-apply.c (eval_apply): Update accordingly. * src/gc.c (gc_push_frame, gc_peek_frame, gc_pop_frame): Update accordingly. * src/stack.c (make_frame, make_stack): Update accordingly. 2021-05-02 Jan (janneke) Nieuwenhuizen core: Resurrect gcc-10 support. * include/mes/mes.h (g_datadir, g_debug, g_buf, g_continuations, g_symbols, g_symbol_max, g_mini, R0, R1, R2, R3, M0, g_macros, g_ports, ARENA_SIZE, MAX_ARENA_SIZE, STACK_SIZE, JAM_SIZE, GC_SAFETY, MAX_STRING, g_arena, cell_arena, cell_zero, g_free, g_symbol, g_stack_array, g_cells, g_news, g_stack, gc_count, gc_start_time, gc_end_time, gc_time, __execl_c_argv, __open_boot_buf, __open_boot_file_name, __setenv_buf, __reader_read_char_buf, g_start_time, __gettimeofday_time, __get_internal_run_time_ts): Declare extern. * include/mes/symbols.h ( cell_nil, cell_f, cell_t, cell_dot, cell_arrow, cell_undefined, cell_unspecified, cell_closure, cell_circular, cell_vm_apply, cell_vm_apply2, cell_vm_begin, cell_vm_begin_eval, cell_vm_begin_expand, cell_vm_begin_expand_eval, cell_vm_begin_expand_macro, cell_vm_begin_expand_primitive_load, cell_vm_begin_primitive_load, cell_vm_begin_read_input_file, cell_vm_call_with_current_continuation2, cell_vm_call_with_values2, cell_vm_eval, cell_vm_eval2, cell_vm_eval_check_func, cell_vm_eval_define, cell_vm_eval_macro_expand_eval, cell_vm_eval_macro_expand_expand, cell_vm_eval_pmatch_car, cell_vm_eval_pmatch_cdr, cell_vm_eval_set_x, cell_vm_evlis, cell_vm_evlis2, cell_vm_evlis3, cell_vm_if, cell_vm_if_expr, cell_vm_macro_expand, cell_vm_macro_expand_car, cell_vm_macro_expand_cdr, cell_vm_macro_expand_define, cell_vm_macro_expand_define_macro, cell_vm_macro_expand_lambda, cell_vm_macro_expand_set_x, cell_vm_return, cell_symbol_lambda, cell_symbol_begin, cell_symbol_if, cell_symbol_quote, cell_symbol_define, cell_symbol_define_macro, cell_symbol_quasiquote, cell_symbol_unquote, cell_symbol_unquote_splicing, cell_symbol_syntax, cell_symbol_quasisyntax, cell_symbol_unsyntax, cell_symbol_unsyntax_splicing, cell_symbol_set_x, cell_symbol_sc_expand, cell_symbol_macro_expand, cell_symbol_portable_macro_expand, cell_symbol_sc_expander_alist, cell_symbol_call_with_values, cell_symbol_call_with_current_continuation, cell_symbol_boot_module, cell_symbol_current_module, cell_symbol_primitive_load, cell_symbol_car, cell_symbol_cdr, cell_symbol_not_a_number, cell_symbol_not_a_pair, cell_symbol_system_error, cell_symbol_throw, cell_symbol_unbound_variable, cell_symbol_wrong_number_of_args, cell_symbol_wrong_type_arg, cell_symbol_buckets, cell_symbol_builtin, cell_symbol_frame, cell_symbol_hashq_table, cell_symbol_module, cell_symbol_procedure, cell_symbol_record_type, cell_symbol_size, cell_symbol_stack, cell_symbol_argv, cell_symbol_mes_datadir, cell_symbol_mes_version, cell_symbol_internal_time_units_per_second, cell_symbol_compiler, cell_symbol_arch, cell_symbol_pmatch_car, cell_symbol_pmatch_cdr, cell_type_bytes, cell_type_char, cell_type_closure, cell_type_continuation, cell_type_function, cell_type_keyword, cell_type_macro, cell_type_number, cell_type_pair, cell_type_port, cell_type_ref, cell_type_special, cell_type_string, cell_type_struct, cell_type_symbol, cell_type_values, cell_type_variable, cell_type_vector, cell_type_broken_heart, cell_symbol_program, cell_symbol_test): Likewise. * src/globals.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. 2021-05-02 Jan (janneke) Nieuwenhuizen guix: m2-planet: Update to 1.7.0-32-gaa3472b. This adds support for skipping "extern". * guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0-32-gaa3472b. 2021-01-09 Jan (janneke) Nieuwenhuizen scaffold: Add local-static-array.c. GCC gives 12:35:54 janneke@dundal:~/src/mes/wip-m2 [env] $ gcc scaffold/local-static-array.c 12:36:01 janneke@dundal:~/src/mes/wip-m2 [env] $ ./a.out hello local static hello local static 12:36:04 janneke@dundal:~/src/mes/wip-m2 [env] M2-Planet gives 12:36:04 janneke@dundal:~/src/mes/wip-m2 [env] $ kaem --verbose --strict --file scaffold/local-static-array.kaem +> M2-Planet --debug --architecture x86 -f lib/mes/globals.c -f lib/linux/x86-mes-m2/mini.c -f lib/mes/mini-write.c -f lib/string/strlen.c -f lib/string/strcpy.c -f lib/mes/eputs.c -f scaffold/local-static-array.c -o scaffold/local-static-array.M1 scaffold/local-static-array.c:29:static is not a defined symbol Subprocess error 256 ABORTING HARD [1]12:36:07 janneke@dundal:~/src/mes/wip-m2 [env] * scaffold/local-static-array.c: New file. * scaffold/local-static-array.kaem: New file. 2021-01-09 Jan (janneke) Nieuwenhuizen scaffold: Add local-array.c. GCC gives 12:32:06 janneke@dundal:~/src/mes/wip-m2 [env] $ gcc scaffold/local-array.c 12:34:27 janneke@dundal:~/src/mes/wip-m2 [env] $ ./a.out hello local 12:34:31 janneke@dundal:~/src/mes/wip-m2 [env] M2-Planet gives 12:34:31 janneke@dundal:~/src/mes/wip-m2 [env] $ kaem --verbose --strict --file scaffold/local-array.kaem +> M2-Planet --debug --architecture x86 -f lib/mes/globals.c -f lib/linux/x86-mes-m2/mini.c -f lib/mes/mini-write.c -f lib/string/strlen.c -f lib/string/strcpy.c -f lib/mes/eputs.c -f scaffold/local-array.c -o scaffold/local-array.M1 scaffold/local-array.c:29:ERROR in collect_local Missing ; Subprocess error 256 ABORTING HARD [1]12:34:42 janneke@dundal:~/src/mes/wip-m2 [env] * scaffold/local-array.c: New file. * scaffold/local-array.kaem: New file. 2021-01-09 Jan (janneke) Nieuwenhuizen scaffold: Add global-array.c. GCC gives 12:30:45 janneke@dundal:~/src/mes/wip-m2 [env] $ gcc scaffold/global-array.c 12:31:53 janneke@dundal:~/src/mes/wip-m2 [env] $ ./a.out hello global 12:31:54 janneke@dundal:~/src/mes/wip-m2 [env] M2-Planet gives 12:31:54 janneke@dundal:~/src/mes/wip-m2 [env] $ kaem --verbose --strict --file scaffold/global-array.kaem +> M2-Planet --debug --architecture x86 -f lib/mes/globals.c -f lib/linux/x86-mes-m2/mini.c -f lib/mes/mini-write.c -f lib/string/strlen.c -f lib/string/strcpy.c -f lib/mes/eputs.c -f scaffold/global-array.c -o scaffold/global-array.M1 scaffold/global-array.c:20:Received [ in program Subprocess error 256 ABORTING HARD [1]12:32:06 janneke@dundal:~/src/mes/wip-m2 [env] * scaffold/global-array.c: New file. * scaffold/global-array.kaem: New file. 2021-01-01 Jan (janneke) Nieuwenhuizen doc: Add test hints to `HACKING'. * HACKING (TESTING): New section. 2021-01-02 Jan (janneke) Nieuwenhuizen Revert "Mes C Library: m2/execve.c: Remove specialization." This fixes gcc-lib/libc+gnu.c: At top level: gcc-lib/libc+gnu.c:2694:1: error: conflicting types for ‘execve’ execve (char const *file_name, char **argv, char **env) ^~~~~~ In file included from gcc-lib/libc+gnu.c:492:0: include/unistd.h:66:5: note: previous declaration of ‘execve’ was here int execve (char const *file, char *const argv[], char *const env[]); ^~~~~~ This reverts commit 828c27a073896facdc3a3b24265ee69f0033f58f. 2021-01-01 Jan (janneke) Nieuwenhuizen bootstrap: Update M2-Planet x86 definitions from 1.7.0-31-g358b6cf. * lib/m2/x86/x86_defs.M1: Update. guix: m2-planet: Update to 1.7.0-31-g358b6cf. * guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0-31-g358b6cf. Revert "Mes C Library: m2/getcwd.c: Remove specialization." This reverts commit 37f44ce9453ef5589b1336c981360de16c154999. core: Move __getcwd_buf to Mes C Library. * include/mes/mes.h (__getcwd_buf): Move to.. * lib/posix/getcwd.c (__getcwd_buf): ...here. (getcwd): Refactor. * src/posix.c (getcwd_): Do not use __getcwd_buf. bootstrap: Support building with M2-Planet 1.4. * lib/m2/x86/x86_defs.M1 (NOP): New define. 2021-01-01 Jan (janneke) Nieuwenhuizen mescc: Only use signed division when numerator is signed. Currently, sign-extension (CLTD vs XOR EDX) and signed division (IDIV vs DIV) selected by setting "signed?". See, module/mescc/x86/as.scm. Possibly we need a signed? based on numerator and denominator, and add a extend-sign? based on the signedness of the numerator? * module/mescc/compile.scm (expr->register): Base "signed?" strictly on signedness of numerator. 2021-01-01 Jan (janneke) Nieuwenhuizen mescc: Use unsigned type for sizeof expression. * module/mescc/compile.scm (ast->type): Use unsigned type for sizeof expression. mescc: Respect integer literal type suffixes. * module/mescc/compile.scm (ast->type): Respect ULL, UL, U, LL, L suffix on integer literals. core: Use unsigned constants. * src/gc.c (FRAME_SIZE, M2_CELL_SIZE): Declare unsigned. (gc_init): Use unsigned suffixes for divisions. * src/posix.c (TIME_UNITS_PER_SECOND): Declare unsigned. (UL1000000000): New constant. (seconds_and_nanoseconds_to_long): Use it. * src/gc.c (U10, U100): New constants. (gc_init): Use them. core: Use size_t instead of long for gc sizes. * include/mes/mes.h (ARENA_SIZE, MAX_ARENA_SIZE, STACK_SIZE, JAM_SIZE, GC_SAFETY, MAX_STRING): Use size_t instead of long. core: Avoid Floating point exception dividing negative numbers. * src/posix.c (seconds_and_nanoseconds_to_long): Use unsigned division. 2021-01-01 Jan (janneke) Nieuwenhuizen core: Avoid Floating point exception dividing negative numbers. This fixes kaem --verbose --strict bin/mes-m2 -c '(display (modulo -1 -1))' * src/math.c (modulo): Use unsigned division. 2021-01-01 Jan (janneke) Nieuwenhuizen bootstrap: Use ./pre-inst-env mescc default. * configure.sh: When CC is mescc, M2-Planet or unset, use "./pre-inst-env mescc" as default. 2020-12-30 Jan (janneke) Nieuwenhuizen tests: string-join: Be noisy. * scaffold/boot/50-string-join.scm ("string-join\n"): Avoid exit 0 without output. 2019-11-16 Jan (janneke) Nieuwenhuizen mes: simple-format: Use core display. * mes/module/mes/simple-format.mes: Do not import (mes display). 2019-11-10 Jan (janneke) Nieuwenhuizen mes: Resurrect backtraces. * mes/module/mes/catch.mes (%eh): Resurrect backtraces. (display-frame): New function. (display-backtrace): Use it. core: Add abort. * lib/stub/__raise.c: New file. * kaem.run: Use it. * src/posix.c (__raise)[SYSTEM_LIBC]: New macro. (abort_): New function: possibly use it. * include/mes/builtins.h: Declare it. * src/builtins.c (mes_builtins): Register it. 2020-12-30 Jan (janneke) Nieuwenhuizen mes: Remove PEG. PEG is not used and mostly broken. * mes/module/mes/peg.mes, mes/module/mes/peg/cache.scm, mes/module/mes/peg/codegen.scm, mes/module/mes/peg/simplify-tree.scm, mes/module/mes/peg/string-peg.scm, mes/module/mes/peg/using-parsers.scm, tests/peg.test: Remove. * AUTHORS: Remove mention. 2020-12-30 Jan (janneke) Nieuwenhuizen .dir-locals: Add test macro indentation. * .dir-locals.el (scheme-mode): Add indentation for pass-if, pass-if-not, pass-if-eq, pass-if-equal, expect-fail, pass-if-timeout. mescc: Use (format (current-error-port) ...) instead of stderr. * module/mescc/M1.scm: Use (format (current-error-port) ...) instead of stderr. * module/mescc/compile.scm: Likewise. * module/mescc/mescc.scm: Likewise. * module/mescc/preprocess.scm: Likewise. 2020-12-31 Jan (janneke) Nieuwenhuizen core: Add gc-stats. * include/mes/mes.h (gc_start_time, gc_end_time, gc_time): New variables. * src/mes.c (init): Initialize them. * src/gc.c: Use them. * src/gc.c (gc_stats): New function. * include/mes/builtins.h: Declare it. * src/builtins.c (mes_builtins): Register it. * tests/gc.test: Use it. 2020-12-29 Jan (janneke) Nieuwenhuizen core: Avoid Floating point exception dividing negative numbers. This fixes kaem --verbose --strict bin/mes-m2 -c '(display (/ -1 1))' * src/math.c (divide): Use signed division. 2020-12-29 Jan (janneke) Nieuwenhuizen Mes C Library: m2/execve.c: Remove specialization. * lib/linux/execve.c (execve): Cater for M2-Planet. * lib/m2/execve.c: Remove. * kaem.run: Update accordingly. * simple.make (M2_SOURCES): Likewise. Mes C Library: m2/getcwd.c: Remove specialization. * lib/posix/getcwd.c (getcwd): Cater for M2-Planet. * lib/m2/getcwd.c: Remove. * kaem.run: Update accordingly. * simple.make (M2_SOURCES): Likewise. Mes C Library: m2/ioctl.c: Remove specialization. * lib/stub/ioctl.c (ioctl3): Move to... * lib/stub/ioctl3.c: ...new file. * lib/m2/ioctl3.c: Move to... * lib/linux/ioctl3.c: ...here. * include/mes/lib.h (ioctl3): Declare it. * lib/m2/isatty.c (isatty): Use it. * build-aux/configure-lib.sh (libc_SOURCES): Include it; move lib/linux/ioctl.c to ... (libc_gnu_SOURCES): ... here. * kaem.run: Update accordingly. * simple.make (M2_SOURCES): Likewise. * simple.sh (compiler): Likewise. Mes C Library: m2/ntoab.c: Remove specialization. * lib/mes/ntoab.c (__mesabi_uldiv)[__M2_PLANET__ || !(__MESC__ && __arm__)]: New function. * lib/mes/ntoab.c (ntoab): Use it to cater for M2-Planet. * lib/m2/ntoab.c: Remove. * kaem.run: Update accordingly. * simple.make (M2_SOURCES, (M2_TODO): Likewise. build: Resurrect simple.sh. * simple.sh: Do not attempt to build multiple C files with mescc. Update for new and split C files. guix: m2-planet: Update to 1.7.0. * guix/git/mes.scm (m2-planet)[source]: Update to 1.7.0. (native-inputs): Remove gcc-toolchain-7. [arguments]: Add CC to make-flags. Update sha256sum patch. core: Prepare for M2-Planet 1.7.0. * src/eval-apply.c (expand_variable_, apply_builtin): Declare variables at toplevel. * src/gc.c (gc_cellcpy, gc_loop, gc_dump_arena): Likewise. * src/hash.c (hash_table_printer): Likewise. * src/lib.c (equal2_p): Likewise. * src/math.c (greater_p, less_p, is_p, minus, plus, divide, multiply, logand, logior, logxor): Likewise. * src/posix.c (current_input_port, execl_): Likewise. * src/reader.c (reader_read_string): Likewise. * src/stack.c (make_stack): Likewise. * src/string.c (list_to_cstring, bytes_to_list, string_append): Likewise. * src/struct.c (make_struct): Likewise. * src/vector.c (vector_to_list): Likewise. mescc: Mes C Library: Prepare for M2-Planet 1.7.0. * lib/m2/ntoab.c (ntoab): Declare variables at toplevel. * lib/mes/abtol.c (abtol): Likewise. * lib/posix/getenv.c (getenv): Likewise. * lib/posix/setenv.c (setenv): Likewise. mescc: Mes C Library: isatty: Use fixed array size for M2-Planet. * lib/m2/isatty.c (struct ktermios)[c_cc]: Hardcode to size 19. mescc: Mes C Library: Update M2-Planet macros. * lib/m2/x86/x86_defs.M1: Update from M2-Planet 1.7.0. 2020-11-01 Jan (janneke) Nieuwenhuizen mes: compatibility: Move (mes pmatch) to (system base pmatch). * mes/module/system/base/pmatch.scm: Move from mes/pmatch.scm. Update users. mes: compatibility: Make base.mes pure guile. * mes/module/mes/type-0.mes (procedure?): New function. Rewrite without `cond' from * mes/module/mes/base.mes (procedure?): here; Remove. 2020-10-18 Jan (janneke) Nieuwenhuizen build: Cater for M2-Planet. * configure: Drop MES_SEED, support M2-Planet. * kaem.run: Also build bin/mes. * build-aux/bootstrap.sh.in: Run kaem bootstrap. * build-aux/build.sh.in: Set stage0_cpu. On x86, run kaem bootstrap. Build bin/mes. Update scripts and users. * build-aux/install.sh.in: Install all built bin/mes-* flavours. guix: Update M2-Planet to 1fc2aeab483208bd2ba117b21df3894c182470ec. * guix/git/mes.scm (m2-planet): Update to 1fc2aeab483208bd2ba117b21df3894c182470ec. (native-inputs): Add gcc-toolchain-7. * lib/m2/x86/x86_defs.M1: Update from M2-Planet. guix: Add m2-planet. * guix/git/mes.scm (m2-planet): New variable. 2020-10-18 Jan (janneke) Nieuwenhuizen core: Use casting functions. Silence all casting errors by using casting functions. * src/cc.c (cast_charp_to_scmp, cast_charp_to_scmpp, cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function. * src/m2.c (cast_charp_to_scmp, cast_charp_to_scmpp, cast_voidp_to_charp, cast_scmp_to_long, cast_scmp_to_charp): New function. * include/mes/mes.h: Declare them. (struct scm): Add car_value, cdr_value, function. (g_continuations): Change to long. * src/mes.c: Silence all casting errors by using casting functions. 2020-10-18 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Use casting functions. Silence all casting errors by using casting functions. * lib/mes/cast.c: New file. * build-aux/configure-lib.sh (libmes_SOURCES): Add it. * lib/m2/cast.c: New file. * kaem.run: Add it. * simple.make: Add them both. * include/mes/lib.h: Add cast prototypes. * include/m2/lib.h: Likewise. * lib/linux/_getcwd.c (_getcwd): Use them. * lib/linux/access.c (access): Likewise. * lib/linux/brk.c (brk): Likewise. * lib/linux/chmod.c (chmod): Likewise. * lib/linux/clock_gettime.c (clock_gettime): Likewise. * lib/linux/gettimeofday.c (gettimeofday): Likewise. * lib/linux/unlink.c (unlink): Likewise. * lib/mes/fdputc.c (fdputc): Likewise. * lib/stdio/putchar.c (putchar): Likewise. * lib/linux/malloc.c (malloc): Likewise. 2020-10-18 Jan (janneke) Nieuwenhuizen core: Switch to pointer cells. Run build-aux/pointer.sh * include/mes/macros.h: Remove. * src/*.c: Update. * include/mes/*.h: Update. * simple.make: Update. * kaem.run: Update. 2020-09-27 Jan (janneke) Nieuwenhuizen build: Update snarfer. * build-aux/mes-snarf.scm (symbol->header): Update for pointer cells. (snarf-symbols): Likewise. (snarf-functions): Likewise. 2020-09-20 Jan (janneke) Nieuwenhuizen core: Drop support for number based cells. This removes the POINTER_CELLS define and all its references. * simple.make (CFLAGS): Remove -D POINTER_CELLS. * include/mes/mes.h: Remove #define POINTER_CELLS. * include/mes/cc.h: Remove !POINTER_CELLS branches. * include/mes/macros.h: Likewise. * src/gc.c: Likewise. * src/symbol.c: Likewise. * src/test/gc.c: Likewise. 2020-09-20 Jan (janneke) Nieuwenhuizen core: gc: Pointer cells: Drop cells->news->cells flipping. * src/gc.c (gc_init): Undo doubling of initial memory. (gc_init_news)[!GC_NOFLIP]: Remove. (gc_)[!GC_NOFLIP]: Remove symbol relocation. (gc)[!GC_NOFLIP]: Remove second gc. core: gc: Abort upon broken heart failure. * src/gc.c (gc_cellcpy, gc_loop): Abort upon broken heart failure. core: gc: Enable memory dump debugging. * src/gc.c (gc): If MES_DUMP is set, dump arena. [POINTER_CELLS && !GC_NOFLIP]: Run gc_ twice to enable comparing memory dumps. 2020-09-14 Jan (janneke) Nieuwenhuizen core: gc: Add gc_dump_arena. * src/gc.c (dumpc, dumps, gc_dump_register, gc_dump_state, gc_dump_stack, gc_dump_arena): New function. 2020-09-13 Jan (janneke) Nieuwenhuizen core: Pointer cells: Allow smaller memory footprint using cellcpy. * src/gc.c (gc_init)[GC_NOFLIP]: Do not use double sized arena. (gc_cellcpy): New function. * src/gc.c (gc_flip): Use it, do not flip. (gc_init_news)[GC_NOFLIP]: Update. 2020-08-17 Jan (janneke) Nieuwenhuizen test/gc: Add three extra gc's. * src/test/gc.c (test_gc): Add three extra gc's. 2020-08-16 Jan (janneke) Nieuwenhuizen test/gc: struct. * src/test/gc.c (test_struct): New function. (main): Call it. test/gc: vector. * src/test/gc.c (test_vector): New function. (main): Call it. (print_arena): New function. (test_gc): Call it. test/gc: string. * src/test/gc.c (test_string): New function. (main): Call it. test/gc: list. * src/test/gc.c (test_list): New function. (main): Call it. test/gc: cons. test/gc: number. * src/test/gc.c (test_number): New function. (main): Call it. test/gc: empty. * src/test/gc.c (test_empty): New function. 2020-08-18 Jan (janneke) Nieuwenhuizen core: eval-apply: Prepare for M2-Planet. * src/eval-apply.c (apply_builtin): Split M2-Planet specific and CC specifi part off to .. * src/cc.c: New file, and * build-aux/configure-lib.sh (mes_SOURCES): Add it. * src/m2.c: New file. * simple.make (MES_SOURCES, M2_SOURCES): Likewise. 2020-08-18 Jan (janneke) Nieuwenhuizen core: display: Prepare for pointer cells, M2-Planet. Rewrite C-constructs not supported by M2-Planet if (foo) -> if (foo != 0) if (!foo) -> if (foo == 0) ; -> 0; // ... -> /* ... */ * src/display.c (display_helper): Use cell_ref. 2020-08-16 Jan (janneke) Nieuwenhuizen core: gc: Prepare for pointer cells, M2-Planet. * include/mes/mes.h (cell_zero): Declare. * src/gc.c (gc_init): Initialize it. (gc_init_news): Likewise. 2020-08-18 Jan (janneke) Nieuwenhuizen core: Remove cell_call_with_current_continuation special. * include/mes/symbols.h (cell_call_with_current_continuation): Remove. * src/eval-apply.c (eval_apply): Update to use cell_symbol_call_with_current_continuation. * src/symbol.c (init_symbols_): Remove inititialization. core: Remove cell_begin special. * include/mes/symbols.h (cell_begin): Remove. * src/eval-apply.c (eval_apply): Update to use cell_symbol_begin. * src/symbol.c (init_symbols_): Remove initialization. core: Remove unused symbols. * include/mes/symbols.h (cell_symbol_dot, cell_symbol_read_input_file, cell_symbol_write, cell_symbol_display): Remove * src/symbol.c (init_symbols_): Remove initializations. core: builtins: MES_MINI. * include/mes/mes.h (g_mini): New global. * src/mes.c (init): Initialize it with environment variable MES_MINI. * src/builtins.c (mes_builtins): Register a minimal set of builtins when g_mini. 2020-08-16 Jan (janneke) Nieuwenhuizen boot: Add gc test. * scaffold/boot/gc.test: New file. * build-aux/check-boot.sh (TESTS): Add it. * include/mes/symbols.h (cell_symbol_program): New symbol. * src/symbol.c (init_symbols_): Initialize it. * src/mes.c (main): Add it to environment. test/gc: Add gc inspection test. * src/test/gc.c (main): New unit test. * simple.make (test-gcc, test-m2): New target to build it. * build-aux/pointer.sh: Add it. core: make_struct: Avoid creating garbage. * src/struct.c (make_struct): Use STRUCT TYPE PRINTER FIELD0 ... FIELDN. core: make-vector: Move to core. * src/vector.c (make_vector_): Rename from make_vector__. Add parameter. Fix double allocation. (make_vector): Rename from make_vector_. Use arity n. Update users. 2020-08-09 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Add M2-Planet support. Mes can now be built with M2-Planet by running kaem --verbose --strict * include/linux/x86/syscall.h (SYS_getcwd, SYS_dup, SYS_dup2, SYS_unlilnk, SYS_gettimeofday, SYS_clock_gettime, SYS_time): Move to libc section. Add M2-Planet constants. * include/m2/lib.h (struct timezone, struct timespec): struct timeval): Define. Add M2-Planet flavor prototypes for mes libc. * include/mes/m2.h: Remove macros. * include/mes/mes.h (g_start_time, __gettimeofday_time, __get_internal_run_time_ts): Declare. * src/mes.c (init): Initialize them. * src/posix.c: Use them. * lib/linux/_getcwd.c: Support M2-Planet. * lib/linux/access.c: Likewise. * lib/linux/chmod.c: Likewise. * lib/linux/clock_gettime.c: Likewise. * lib/linux/dup.c: Likewise. * lib/linux/dup2.c: Likewise. * lib/linux/gettimeofday.c: Likewise. * lib/linux/read.c: Likewise. * lib/linux/unlink.c: Likewise. * lib/mes/fdgetc.c: Likewise. * lib/mes/fdputc.c: Likewise. * lib/posix/getenv.c: Likewise. * lib/posix/setenv.c: Likewise. * lib/stdlib/realloc.c: Likewise. * lib/string/memcmp.c: Likewise. * lib/string/memcpy.c: Likewise. * lib/m2/abtol.c: New file. * lib/m2/chmod.c: New file. * lib/m2/clock_gettime.c: New file. * lib/m2/execv.c: New file. * lib/m2/execve.c: New file. * lib/m2/exit.c: New file. * lib/m2/getcwd.c: New file. * lib/m2/ioctl.c: New file. * lib/m2/isatty.c: New file. * lib/m2/ntoab.c: New file. * lib/m2/strncmp.c: New file. * lib/m2/time.c: New file. * lib/m2/waitpid.c: New file. * simple.make: Use them. Remove macro preprocessing for M2-Planet. * kaem.run: New file. 2020-08-22 Jan (janneke) Nieuwenhuizen core: posix: Prepare for M2-Planet. * src/posix.c (access_p): Prepare for M2-Planet. 2020-07-25 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Add waitpid for M2-Planet. * lib/m2/waitpid.c: New file. mescc: Mes C Library: Add time for M2-Planet. * lib/m2/time.c: New file. mescc: Mes C Library: Add ntoab for M2-Planet. * lib/m2/ntoab.c: New file. mescc: Mes C Library: Add isatty for M2-Planet. * lib/m2/isatty.c: New file. mescc: Mes C Library: Add ioctl for M2-Planet. * lib/m2/ioctl.c: New file. mescc: Mes C Library: Add getcwd for M2-Planet. * lib/m2/getcwd.c: New file. mescc: Mes C Library: Add exit for M2-Planet. * lib/m2/exit.c: New file. mescc: Mes C Library: Add execve for M2-Planet. * lib/m2/execve.c: New file. mescc: Mes C Library: Add execv for M2-Planet. * lib/m2/execv.c: New file. mescc: Mes C Library: Add clock_gettime for M2-Planet. * lib/m2/clock_gettime.c: New file. mescc: Mes C Library: Add chmod for M2-Planet. * lib/m2/chmod.c: New file. 2020-07-25 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Add M2-Planet support. Mes can now be built with M2-Planet by running kaem --verbose --strict * include/linux/x86/syscall.h (SYS_getcwd, SYS_dup, SYS_dup2, SYS_unlilnk, SYS_gettimeofday, SYS_clock_gettime, SYS_time): Move to libc section. Add M2-Planet constants. * include/m2/lib.h (struct timezone, struct timespec): struct timeval): Define. Add M2-Planet flavor prototypes for mes libc. * include/mes/m2.h: Remove macros. * include/mes/mes.h (g_start_time, __gettimeofday_time, __get_internal_run_time_ts): Declare. * src/mes.c (init): Initialize them. * src/posix.c: Use them. * simple.make: Use them. Remove macro preprocessing for M2-Planet. * kaem.run: New file. 2020-07-25 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Prepare for M2-Planet: realloc. * lib/stdlib/realloc.c (realloc): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: fdputc. * lib/mes/fdputc.c (fdputc): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: unlink. * lib/linux/unlink.c (unlink): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: read. * lib/linux/read.c (read): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: gettimeofday. * lib/linux/gettimeofday.c (gettimeofday): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: dup2. * lib/linux/dup2.c (dup2): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: dup. * lib/linux/dup.c (dup): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: clock_gettime. * lib/linux/clock_gettime.c (clock_gettime): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: chmod. * lib/linux/chmod.c (chmod): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: access. * lib/linux/access.c (access): Prepare for M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: _getcwd. * lib/linux/_getcwd.c (_getcwd): Prepare for M2-Planet. 2020-07-19 Jan (janneke) Nieuwenhuizen core: Split-out stack.c * src/lib.c (exit_, frame_printer, make_frame_type, make_frame, make_stack_type, make_stack, stack_length, stack_ref_): Move to .. * src/posix.c (exit_): Here and to .. * src/core.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. * simple.make (LIBMES_SOURCES): Likewise. * build-aux/snarf.sh: Likewise. * include/mes/builtins.h: Update. * src/builtins.c (mes_builtins): Update. core: Split-out core.c. * src/mes.c (assoc_string, car, cdr, list, null_p, eq_p, values, acons, length__, length, error, append2, append_reverse, reverse_x_, assq, assoc): Move to ... * src/core.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. * simple.make (MES_SOURCES): Likewise. * build-aux/snarf.sh: Likewise. * include/mes/builtins.h: Update. * src/builtins.c (mes_builtins): Update. 2020-08-01 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Bugfix __ungetc_clear. * lib/m2/mes_open.c (mes_open): Remove __ungetc_init (); * lib/m2/open.c (open): Likewise. 2020-07-15 Jan (janneke) Nieuwenhuizen kaem: scaffold/read.kaem. * .gitignore: Update. * include/linux/x86/syscall.h: Update for M2-Planet. * lib/linux/brk.c (brk): Remove cast for M2-Planet. * lib/linux/x86-mes-m2/syscall.c: New file. * lib/m2/malloc.c: New file. * lib/string/memset.c (memset): Update for M2-Planet. * scaffold/read.c: Update for M2-Planet. * scaffold/kaem.read: New file. kaem: scaffold/argv.kaem. * scaffold/argv.c (strcmp): Remove. (main): Update. * scaffold/argv.kaem: New file. lib/x86-mes/x86.M1 (mov____%edi,%ebp, mov____%esp,%edi): New macro. kaem: scaffold/hello.kaem. * include/m2/lib.h: New file. * scaffold/hello.kaem: New file. kaem: scaffold/main.kaem. * lib/linux/x86-mes-m2/crt1.c, lib/linux/x86-mes-m2/crt1.M1, lib/linux/x86-mes-m2/_exit.c, lib/linux/x86-mes-m2/_write.c: New files. * lib/m2/x86/x86_defs.M1: New file. Import from stage0. * lib/m2/x86/ELF-x86.hex2: New file. Import from M2-Planet. * scaffold/main.c: Update for M2-Planet. * scaffold/main.kaem: New file. * .gitignore: Update. 2020-07-18 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: if (foo). Rewrite C-constructs not supported by M2-Planet if (foo) -> if (foo != 0) * src/posix.c: Rewrite C-constructs not supported by M2-Planet. (current_input_port): Likewise. * src/display.c (display_helper): : Likewise. * src/eval-apply.c (expand_variable_): : Likewise. (eval_apply): : Likewise. * src/mes.c (open_boot): : Likewise. * src/reader.c (reader_read_identifier_or_number): : Likewise. * src/symbols.c (init_symbol): : Likewise. 2020-07-17 Jan (janneke) Nieuwenhuizen core: Outline hashq_get_handle, hash_set_x_. * src/hash.c (hashq_ref): Use hashq_get_handle. (hashq_set_x_): Enable. (hash_set_x): Use it. 2020-07-18 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: continue. Rewrite C-constructs not supported by M2-Planet continue -> goto LABEL * src/eval-apply.c (eval_apply): Add label: begin_expand_while. Use it instead of continue. 2020-07-17 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: VALUE/TYPE indirections. Rewrite C-constructs not supported by M2-Planet VALUE (CAR (foo)) -> SCM a = CAR (foo); VALUE (a) TYPE (CAR (foo)) -> SCM t = CAR (foo); TYPE (a) * src/builtins.c (builtin_function): Use VALUE indirections. (builtin_printer): Likewise. * src/eval-apply.c (apply_builtin): Likewise. (get_macro): Likewise. (expand_variable_): Likewise. (eval_apply): Likewise. * src/hash.c (hashq_get_handle): Likewise. (hashq_ref): Likewise. (hash_ref): Likewise. (hash_set_x): Likewise. (hash_table_printer): Likewise. * src/math.c (greater_p): Likewise. (less_p): Likewise. (is_p): Likewise. (minus): Likewise. (plus): Likewise. (divide): Likewise. (multiply): Likewise. (logand): Likewise. (logior): Likewise. (logxor): Likewise. * src/posix.c (current_input_port): Likewise. (set_current_output_port): Likewise. * src/reader.c (reader_read_list): Likewise. (reader_read_character): Likewise. (reader_read_string): Likewise. * src/string.c (list_to_cstring): Likewise. (read_string): Likewise. 2020-07-16 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: M2_CELL_SIZE. * src/gc.c (M2_CELL_SIZE): Hack for missing pointer arithmetic in M2-Planet. (gc_init, alloc, make_cell, gc_up_arena, gc_copy, gc_loop, gc_): Use it. 2020-07-18 Jan (janneke) Nieuwenhuizen core: Use unique assert_msg. * src/mes.c (error): Use unique assert_msg. 2020-07-16 Jan (janneke) Nieuwenhuizen core: read_string: Prepare for M2-Planet. * src/string.c (read_string): Prepare for M2-Planet. core: string_equal_p: Prepare for M2-Planet. * src/string.c (string_equal_p): Prepare for M2-Planet. core: reader_read_block_comment: Prepare for M2-Planet. * src/reader.c (reader_read_block_comment): Prepare for M2-Planet. core: reader_eat_whitespace: Prepare for M2-Planet. * src/reader.c (reader_eat_whitespace): Prepare for M2-Planet. core: reader_read_sexp_: Prepare for M2-Planet. * src/reader.c (reader_read_sexp_): Prepare for M2-Planet. core: reader_read_identifier_or_number: Prepare for M2-Planet. * src/reader.c (reader_read_identifier_or_number): Prepare for M2-Planet. core: open_output_file: Prepare for M2-Planet. * src/posix.c (open_output_file): Prepare for M2-Planet. core: current_input_port: Prepare for M2-Planet. * src/posix.c (current_input_port): Prepare for M2-Planet. core: write_byte: Prepare for M2-Planet. * src/posix.c (write_byte): Prepare for M2-Planet. core: read_char: Prepare for M2-Planet. * src/posix.c (read_char): Prepare for M2-Planet. core: last_pair: Prepare for M2-Planet. * src/lib.c (last_pair): Prepare for M2-Planet. core: memq: Prepare for M2-Planet. * src/lib.c (memq): Prepare for M2-Planet. core: xassq: Prepare for M2-Planet. * src/lib.c (xassq): Prepare for M2-Planet. core: hash_cstring: Prepare for M2-Planet. * src/hash.c (hash_cstring): Prepare for M2-Planet. core: eval_apply: Prepare for M2-Planet. * src/eval-apply.c (eval_apply): Prepare for M2-Planet. core: apply_builtin: Prepare for M2-Planet. * src/eval-apply.c (apply_builtin): Prepare for M2-Planet. core: formal_p: Prepare for M2-Planet. * src/eval-apply.c (formal_p): Prepare for M2-Planet. core: builtin_p: Prepare for M2-Planet. * src/builtins.c (builtin_p): Prepare for M2-Planet. core: assoc: Prepare for M2-Planet. * src/mes.c (assoc): Prepare for M2-Planet. core: assq: Prepare for M2-Planet. * src/mes.c (assq): Prepare for M2-Planet. core: eq_p: Prepare for M2-Planet. * src/mes.c (eq_p): Prepare for M2-Planet. core: assoc_string: Prepare for M2-Planet. src/mes.c (assoc_string): Prepare for M2-Planet. 2020-07-14 Jan (janneke) Nieuwenhuizen build: Add pointer.sh. * build-aux/pointer.sh: New script. core: Prepare for pointer cells. * include/mes/cc.h: Prepare for pointer-based cells. * include/mes/macros.h[POINTER_CELLS]: Alternative set of macros. * include/mes/mes.h (struct scm)[POINTER_CELLS]: Alternative definition. * src/gc.c (copy_cell, copy_news): New function. * include/mes/mes.h: Declare them. 2020-06-22 Jan (janneke) Nieuwenhuizen core: gc: FRAME_SIZE. * src/gc.c (gc_loop, gc_): Use FRAME_SIZE. core: gc: Fixes. * src/gc.c (gc_init, gc_up_arena, gc_flip): Change to void function. Fixes 0 returns. (make_bytes): Use plain. (make_string): Add 1 to length, for zero-terminated C strings. (gc_copy): Use plain bytes length. (gc_loop): Manually reformat. 2020-06-16 Jan (janneke) Nieuwenhuizen core: Create symbols dynamically. * include/mes/symbols.h: New file. * include/mes/mes.hh: Include it. * include/mes/constants.h: Remove symbol constants. * src/symbols.c (init_symbols): Create symbols dynamically. * build-aux/mes-snarf.scm (snarf-symbols): Update. 2020-05-19 Jan (janneke) Nieuwenhuizen core: Remove CBYTES, CSTRING, NCBYTES macros. * src/gc.c (cell_bytes, news_bytes): New function. * include/mes/macros.h (CBYTES, CSTRING, NCBYTES): Remove. Update users. * include/mes/m2.h: Likewise. core: Prepare for conversion to pointer cells. * src/posix.c (execl_): Prepare for conversion to pointer cells. core: Remove dead macros. * include/mes/macros.h (CSTRING_STRUCT, START, LEN): Remove. 2020-05-18 Jan (janneke) Nieuwenhuizen core: Remove macros from cell creation: make_char .. make_string. * src/gc.c (make_char, make_continuation, make_macro, make_number, make_ref, make_string0, make_string_port): New function. (make_string): Move from string.c. * include/mes/macros.h (MAKE_CHAR, MAKE_CONTINUATION, MAKE_MACRO, MAKE_NUMBER, MAKE_REF, MAKE_STRING0, MAKE_STRING_PORT): Remove macro. Update users. * include/mes/m2.h: Likewise. core: Remove macros from cell creation: make_bytes. * src/gc.c (bytes_cells, make_bytes): Move from string.c. * include/mes/macros.h (MAKE_BYTES0, NAME_SYMBOL): Remove. * include/mes/m2.h: Likewise. 2020-05-17 Jan (janneke) Nieuwenhuizen core: Remove core:make-cell. * src/gc.c (alloc, make_cell, cons): Move from mes.c * src/mes.c: (make_cell_): Remove. * src/lib.c (char_to_integer, integer_to_char): New function. * src/builtins.c (mes_builtins): Add them; remove make_cell_. * mes/module/mes/type-0.mes (char->integer, integer->char): Remove. core: Refactor display. core: Upcase register names. * include/mes/mes.h (R0, R1, R2, R3, M0): Rename from lower case. Update users. core: Split-out symbol.c. * src/mes.c (init_symbol, mes_symbols): Move to .. * src/symbol.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. * simple.make: Likewise. * include/mes/mes.h: Declare init_symbols. core: Split-out display.c. * src/lib.c (display_helper, display_, display_error_, display_port_, write_, write_error_, write_port_, fdisplay_): Move to .. * src/display.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. * simple.make: Likewise. 2020-05-31 Jan (janneke) Nieuwenhuizen core: eval-apply: Fix formal_p. * src/eval-apply.c (formal_p): Return boolean. 2020-05-17 Jan (janneke) Nieuwenhuizen core: Split-out eval-apply.c. * src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x, set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle, get_macro, macro_set_x, push_cc, add_formals, formal_p, expand_variable_, expand_variable, apply_builtin, eval_apply, apply): Move to .. * src/eval-apply.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. * simple.make: Likewise. * src/eval.c (assert_defined): Likewise. 2020-05-18 Jan (janneke) Nieuwenhuizen build: Update mes-snarf. * build-aux/snarf.sh: Support C-style annotations. 2020-05-17 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Prepare for M2-Planet: setenv. * lib/posix/setenv.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: getenv. * lib/posix/getenv.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: ntoab. * lib/mes/ntoab.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: malloc. * lib/stdlib/malloc.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: fdungetc. * lib/mes/fdungetc.c: Rewrite C-constructs not supported by M2-Planet. 2020-06-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Bugfix __ungetc_clear. * lib/linux/_open3.c (_open3): Remove __ungetc_init (); * lib/mes/mes_open.c (mes_open): Likewise. * lib/mes/fdungetc.c (fdungetc): Likewise. * lib/mes/fdgetc.c (__ungetc_p, __ungetc_clear, __ungetc_set): Call __ungetc_init if buffer is uninitialized. 2020-05-17 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Prepare for M2-Planet: fdgetc. * lib/mes/fdgetc.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: abtol. * lib/mes/abtol.c: Rewrite C-constructs not supported by M2-Planet. 2020-06-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: memcmp: bugfix. * lib/string/memcmp.c (memcmp): Bugfix. * lib/tests/string/50-memcmp.c: Test it. * build-aux/check-mescc.sh (TESTS): Add it. 2020-05-17 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Prepare for M2-Planet: memcmp. * lib/string/memcmp.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: memcpy. * lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: memchr. * lib/string/memchr.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: strncmp. * lib/string/strncmp.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: strlen. * lib/string/strlen.c: : Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: strcpy. * lib/string/strcpy.c: Rewrite C-constructs not supported by M2-Planet. mescc: Mes C Library: Prepare for M2-Planet: strcmp. * lib/string/strcmp.c: Rewrite C-constructs not supported by M2-Planet. 2020-05-17 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Prepare for M2-Planet: __assert_fail. Rewrite C-constructs not supported by M2-Planet, such as foo ? bar : baz; -> if (foo) bar; else baz; static char foo[1024] -> __func_buf = malloc (1024); ... char *foo = __func_buf; *foo -> foo[0] foo++ -> foo = foo + 1 TODO: pointer arithmetic foo += 1; -> foo = foo + 1 for (int foo = ; -> int foo; for (foo= if (foo) -> if (foo != 0) if (!foo) -> if (foo == 0) ; -> 0; * lib/mes/__assert_fail.c: Rewrite C-constructs not supported by M2-Planet. 2020-05-17 Jan (janneke) Nieuwenhuizen core: Use assert_msg. * src/mes.c: Use assert_msg instead of assert. * src/gc.c: Likewise. * src/hash.c: Likewise. * src/lib.c: Likewise. * src/math.c: Likewise. * src/module.c: Likewise. * src/posix.c: Likewise. * src/reader.c: Likewise. * src/string.c: Likewise. * src/struct.c: Likewise. * src/vector.c: Likewise. * simple.make (LIB_SOURCES): Add lib/mes/assert_msg.c. 2020-04-19 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Add assert_msg. * lib/mes/assert_msg.c: New file. core: Prepare for M2-Planet: vector.c. * src/vector.c: Rewrite C constructs not supported by M2-Planet. core: Prepare for M2-Planet: struct.c. * src/struct.c: Rewrite C constructs not supported by M2-Planet. 2020-04-20 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: string.c. * src/string.c: Rewrite C constructs not supported by M2-Planet. 2020-04-19 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: reader.c. * src/reader.c: Rewrite C constructs not supported by M2-Planet. 2020-04-20 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: posix.c. * src/posix.c: Rewrite C constructs not supported by M2-Planet. core: Prepare for M2-Planet: module.c. * src/module.c: Rewrite C constructs not supported by M2-Planet. core: Prepare for M2-Planet: math.c. * src/math.c: Rewrite C constructs not supported by M2-Planet. 2020-04-19 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: lib.c. * src/lib.c: Rewrite C constructs not supported by M2-Planet. core: Prepare for M2-Planet: hash.c. * src/hash.c: Rewrite C constructs not supported by M2-Planet. core: Prepare for M2-Planet: gc.c. * src/gc.c: Rewrite C constructs not supported by M2-Planet. core: Prepare for M2-Planet: builtins.c. * src/builtins.c: Rewrite C constructs not supported by M2-Planet. 2020-04-19 Jan (janneke) Nieuwenhuizen core: Prepare for M2-Planet: mes.c. Rewrite C-constructs not supported by M2-Planet, such as foo ? bar : baz; -> if (foo) bar; else baz; static char foo[1024] -> __func_buf = malloc (1024); ... char *foo = __func_buf; *foo -> foo[0] foo++ -> foo = foo + 1 TODO: pointer arithmetic foo += 1; -> foo = foo + 1 for (int foo = ; -> int foo; for (foo= if (foo) -> if (foo != 0) if (!foo) -> if (foo == 0) ; -> 0; // ... -> /* ... */ * src/mes.c: Rewrite C constructs not supported by M2-Planet. * include/mes/mes.h (__execl_c_argv, __getcwd_buf, __open_boot_buf, __open_boot_file_name, __setenv_buf, __reader_read_char_buf): Declare buffers. (init): Initialize them. * include/mes/macros.h(__M2_PLANET__): Temporary M2 macros. 2020-04-19 Jan (janneke) Nieuwenhuizen build: Run indent for M2. * src/gc.c: Indented. * src/string.c: Likewise. 2020-04-20 Jan (janneke) Nieuwenhuizen build: mes-snarf.scm: Resurrect. * build-aux/mes-snarf.scm (snarf-functions): Strip whitespace from parameter list. (function->source): Use function-scm-name, add (function1_t). * build-aux/snarf.sh: Resurrect, combined dump to s, h, c. * include/mes/builtins.h: 2020-04-19 Jan (janneke) Nieuwenhuizen core: Split-out builtins.c. * src/mes.c make_builtin_type, make_builtin, builtin_name, builtin_arity, builtin_function, builtin_p, builtin_printer, init_builtin, mes_builtins): Move to .. * src/builtins.c: New file. * build-aux/configure-lib.sh (mes_SOURCES): Add it. * build-aux/snarf.sh: Likewise. * build-aux/build-mes.sh (mes_sources): Remove. Include configure-lib.sh * include/mes/builtins.h: Remove constants. * include/mes/mes.h: Add prototypes. * include/mes/constants.h (cell_symbol_test): Rename from cell_test. * simple.make: New file. 2020-04-22 Jan (janneke) Nieuwenhuizen build: simple.make. * simple.make: New file. * src/posix.c: Make sure to define EOF. 2020-04-25 Jan (janneke) Nieuwenhuizen tests: Add gc.test. * tests/gc.test: New file. * build-aux/check-mes.sh (TESTS): Add it. * scaffold/gc-test.scm: Remove. 2020-12-29 Jan (janneke) Nieuwenhuizen guix: mescc-tools: Update to 1.1.0. * guix/git/mes.scm (mescc-tools)[source]: Update to 1.1.0. [arguments]: Update sha256sum patch. 2022-05-02 Jan (janneke) Nieuwenhuizen build: Depend on mescc-tools 1.0.0. * configure (main): Check for hex2, M1, and blood-elf version 1.0.0. 2021-10-10 Jan (janneke) Nieuwenhuizen mescc: Update to mescc-tools-1.0.0 option names. * module/mescc/mescc.scm (M1->hex2): Update to use --little-endian. (hex2->elf): Likewise, and --base-address. * module/mescc/mescc.scm (hex2->elf): Likewise, and remove --exec_enable. build: Update to mescc-tools-1.0.0 option names. * build-aux/build-scaffold.sh: Update to use --base-address and --little-endian. * doc/mes.texi (Regular Requirements): Bump mescc-tools to 1.0.1. (Bootstrap Requirements): Likewise. Bump nyacc to 1.00.2. * INSTALL (Other GNU/Linux): Bump mescc-tools to 1.0.1. (Prerequisites): Likewise. bump nyacc to 1.00.2. guix: mescc-tools: Update to 1.0.1. * guix/git/mes.scm (mescc-tools)[source]: Update to 1.0.1. 2021-11-09 Jan (janneke) Nieuwenhuizen Relicense imported LGPL v3+ files to GPL v3+. Fixes https://savannah.nongnu.org/task/?16067. Reported via savannah by Ineiev . * mes/module/mes/lalr.scm, module/mes/getopt-long.scm, module/mes/optargs.scm: Change header to GNU Mes header with GPL v3. 2021-06-14 Andrius Štikonas doc: Migration to Libera Chat. * BOOTSTRAP: Replace Freenode with Libera Chat. * ROADMAP: Likewise. * doc/mes.texi: Likewise. 2021-05-08 Vagrant Cascadian configure: Add no-op for "disable-option-checking" option. This is a standard option supported in autoconf. In Debian systems using recent versions of debhelper this argument is be passed to configure by default. See for more information. * configure (parse-opts): Ignore disable-option-checking. 2021-05-07 W. J. van der Laan mescc: Make -m64 work again. * module/mescc/mescc.scm (arch-get-machine): Make that -m64 on the command line, which sets machine to "64", returns "64" and not "32". 2021-05-02 W. J. van der Laan lib/tests: Pass int to va_arg instead of char. * lib/tests/scaffold/70-stdarg.c (stdarg1, stdarg2, stdarg3): Pass int to va_arg instead of char to avoid gcc trap "warning: 'char’ is promoted to ‘int’ when passed through ‘...’ [enabled by default] (so you should pass ‘int’ not ‘char’ to ‘va_arg’) if this code is reached, the program will abort". mes: Prevent out-of-bounds access for stack frame 0. * src/lib.c (make_frame): Add a check to prevent reads outside of the stack when trying to determine the procedure for stack frame 0. mescc: Pass --64 to bloodelf for 64 bit machines. * module/mescc/mescc.scm (M1->blood-elf): Pass --64 argument to bloodelf for 64-bit machines. This makes it able to generate the correct ELF format. 2021-05-02 Jan (janneke) Nieuwenhuizen configure: Do not use GUILD_OPTIMIZE=-O1 for Guile-2. This is a follow-up to a0560aff676b0fe8d7d50b365a75ed158347eb3a configure: Use GUILD_OPTIMIZE=-O1 for Guile-3. and fixes using Guile-2.0.x, which does not support -O1. Reported by W. J. van der Laan . * configure (main): Check for Guile > 2.9.x to set optimization. 2021-05-02 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: crt: Support more than 255 command line parameters. Reported by Paul Dersey . * lib/freebsd/x86-mes-gcc/crt1.c (_start): Use mov instead of movzbl for argc. * lib/linux/x86-mes-gcc/crt0.c (_start): Likewise. * lib/linux/x86-mes-gcc/crt1.c (_start): Likewise. * lib/freebsd/x86-mes-mescc/crt1.c (_start): Likewise. * lib/linux/x86-mes-mescc/crt1.c (_start): Likewise. 2021-05-02 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: malloc.c: Move unix-variant to lib/linux. * lib/stdlib/malloc.c: Move to... lib/linux/malloc.c: ...here. * build-aux/configure-lib.sh (libc_SOURCES): Move malloc.c... [linux]: ...here. 2021-05-01 Jan (janneke) Nieuwenhuizen mescc: Support --bootstrap build on ARM. The ARM port added the `-marm' option to mescc, where previously only -m32' (the default) and `-m64' were supported. Reported by Vagrant Cascadian . * module/mescc/mescc.scm (arch-get-machine): When machine is "arm", return "32". * build-aux/build-mes.sh (LIBS)[mescc]: Add -lmescc. 2021-04-21 W. J. van der Laan Jan (janneke) Nieuwenhuizen mes: Make logand work correctly. * src/math.c (logand): Start from -1 instead of 0, so that the bitwise AND-ed result is the intersection of bit sets instead of always 0. * tests/math.test ("logand", "logand 3"): Test it. 2021-03-14 Jan (janneke) Nieuwenhuizen doc: Post-release update. * README: Update wording. * doc/announce/ANNOUNCE-0.23: Likewise. Add gen-announce checksums. guix: mes: Update to 0.23. * guix/git/mes.scm (mes)[source]: Update to 0.23. build: Release 0.23. * configure (VERSION): Bump to 0.23. (main): Update mes requirement to 0.22. * configure.sh (VERSION): Likewise. 2021-03-14 Jan (janneke) Nieuwenhuizen doc: Fix broken link in 'README'. Reported by Arkadiusz.Ryś . * README: Fix m2-planet link. 2021-03-14 Jan (janneke) Nieuwenhuizen doc: Release update. * ROADMAP (release 0.x, unsorted): Rewrite, move done items ... (DONE): ...here. * build-aux/GNUmakefile.in: Update release process. (gen-announce): Remove trailing '-'. * NEWS (Changes in 0.23 since 0.22): Add section. * README: Add armhf-linux, aarch64-linux, NLNet sponsoring, remove confusing references to mes-m2 fork. * doc/announce/ANNOUNCE-0.23: New file. * mes/module/mes/repl.mes: Update copyright years. * doc/mes.texi (Porting GNU Mes): Mention that armhf-linux is supported. (Regular Requirements): Update. * INSTALL (Other GNU/Linux): Likewise. 2021-03-14 Danny Milosavljevic libtcc1: Fix integer division, modulo and shifting procedures. * lib/libtcc1.c (__divdi3): Make parameters integer. (__moddi3): Make parameters integer. (__udivdi3): Use unsigned division. (__umoddi3): Use unsigned modulo. (__lshrdi3): Add comment. (__ashrdi3): Add comment. 2021-01-23 Danny Milosavljevic mescc: Mes C Library: Make malloc align the blocks it gives out. * include/stddef.h (max_align_t): Add typedef for max_align_t. * lib/stdlib/malloc.c (malloc): Align the blocks it gives out to multiples of max_align_t. 2021-01-23 Jan (janneke) Nieuwenhuizen tests: Update to bin/mes for standalone run. * tests/base.test, tests/boot.test, tests/macro.test, tests/perform.test, tests/quasiquote.test, tests/read.test, tests/scm.test, tests/srfi-0.test: Default to bin/mes. mescc: Mes C Library: div.c: Use only for ARM. * build-aux/configure-lib.sh (libmescc_SOURCES): Remove div.c unless ARM. mescc: Mes C Library: feof: Bugfix for ARM. * lib/stdio/feof.c (feof): Use int to compare with EOF. 2021-01-23 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: time.c: Use #if defined. This helps resurrect the mes-0.19-based bootstrap. * lib/linux/time.c: Use #if defined () instead of plain #if for possibly undefined macros. 2021-01-23 Jan (janneke) Nieuwenhuizen mescc: Change --align to --align=functions, --align=globals. This makes function alignment optional and disables function alignment when using MesCC-Tools 0.5.2 (numbered architecture). * module/mescc.scm (parse-opts): Make --align take a value. * module/mescc/mescc.scm (mescc:compile, infos->hex2): Parse it and pass it as renamed #:align keyword argument to ... * module/mescc/M1.scm (infos->M1): ...here. Rename parameter align? to align, pass it to... (info->M1): ...here. Likewise. Use it to make function alignment optional. 2021-01-23 Jan (janneke) Nieuwenhuizen libtcc1: Compile float stubs conditionally. * lib/libtcc1.c (__floatundidf, __floatundixf, __fixunsxfdi, __fixxfdi, __fixsfdi, __fixunsdfdi, __fixunsdfsi, __floatdisf, __floatdidf)[!(HAVE_FLOAT_STUB || HAVE_FLOAT)]: Remove. libtcc1: Make float stubs weak. * lib/libtcc1.c (__floatundidf, __floatundixf, __fixunsxfdi, __fixxfdi, __fixsfdi, __fixunsdfdi, __fixunsdfsi, __floatdisf, __floatdidf): Add __attribute__ ((weak)). mescc: Skip attributes on function definitions. * module/mescc/preprocess.scm (ast-strip-attributes): New procedure. (c99-input->ast): Use it. mescc: Mes C Library: Declare __mesabi_uldiv. * include/mes/lib.h (__mesabi_uldiv): Add prototype. mescc: Mes C Library: ARM: setjmp.c: Inline fake asm. * lib/linux/arm-mes-gcc/_exit.c (longjmp, setjmp): Use inline fake asm. mescc: Mes C Library: ARM: syscall.c: Inline fake asm. * lib/linux/arm-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4): Use inline fake asm. mescc: Mes C Library: ARM: _write.c: Inline fake asm. * lib/linux/arm-mes-gcc/_write.c (_write): Use inline fake asm. mescc: Mes C Library: ARM: _exit: Inline fake asm. * lib/linux/arm-mes-gcc/_exit.c (_exit): Use inline fake asm. mescc: Mes C Library: ARM: _start: Inline fake asm. * lib/linux/arm-mes-gcc/crt1.c (_start): Use inline fake asm. tests: Add 70-or-argument.c. * lib/tests/scaffold/70-or-argument.c: New file. * build-aux/check-mescc.sh (tcc_tests): Add it. tests: Add 70-function-modulo.c. * lib/tests/scaffold/70-function-modulo.c: New file. * build-aux/check-mescc.sh (tcc_tests): Add it. tests: 70-strchr.c: Rewrite for TinyCC. * lib/tests/string/70-strchr.c (main): Use char* hello for comparison. Allows for duplication of "hello" string. 2021-01-23 Jan (janneke) Nieuwenhuizen test: scaffold/54-argv.c: Support running with TinyCC. This fixes running as lib/tests/scaffold/54-argv-i686-unknown-linux-gnu-tcc. * lib/tests/scaffold/54-argv.c (main): Compare only first 26 characters of argv[0]. 2021-01-23 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Split _exit.c, _write.c from mini.c. * lib/freebsd/x86-mes-gcc/mini.c: Split into... * lib/freebsd/x86-mes-gcc/_exit.c: ...this, and... * lib/freebsd/x86-mes-gcc/_write.c: ...this. * lib/freebsd/x86-mes-mescc/mini.c: Slpit into... * lib/freebsd/x86-mes-mescc/_exit.c: ...this, and... * lib/freebsd/x86-mes-mescc/_write.c: ...this. * lib/gnu/x86-mes-gcc/mini.c: Split into... * lib/gnu/x86-mes-gcc/_exit.c: ...this, and... * lib/gnu/x86-mes-gcc/_write.c: ...this. * lib/linux/arm-mes-gcc/mini.c: Split into... * lib/linux/arm-mes-gcc/_exit.c: ...this, and... * lib/linux/arm-mes-gcc/_write.c: ...this. * lib/linux/arm-mes-mescc/mini.c: Split into... * lib/linux/arm-mes-mescc/_exit.c: ...this, and... * lib/linux/arm-mes-mescc/_write.c: ...this. * build-aux/configure-lib.sh (libc_mini_shared_SOURCES): Replace mini.c with add _exit.c, _write.c. * simple.sh: Update accordingly. 2021-01-23 Danny Milosavljevic mescc: define int64_t and uint64_t only if it's possible to define them as exactly 64 bits. * include/stdint.h[__SIZEOF_LONG_LONG__ != 8]: Remove typedefs for int64_t, uint16_t. 2021-01-23 Jan (janneke) Nieuwenhuizen mescc: Add __SIZEOF defines for int, long, long long. * module/mescc/mescc.scm (arch-get-define): Rename to... (arch-get-defines): ...this. Return a list of defines: Also adding __SIZEOF_INT__, __SIZEOF_LONG__, and add __SIZEOF_LONG_LONG__ if it's >=8. (mescc:preprocess, c->info): Update callers. * include/stdint.h[!__SIZEOF_LONG_LONG__]: Remove typedefs for int64_t, uint16_t. ARM: Add fake asm for setjmp.c. * lib/arm-mes-gcc/setjmp.c (longjmp, setjmp)[__TINYC__]: Add fake asm. ARM: Add fake asm for syscall.c. * lib/linux/arm-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4) [__TINYC__]: Add fake asm. ARM: Add fake asm for mini.c. * lib/linux/arm-mes-gcc/mini.c (_exit, _write)[__TINYC__]: Add fake asm. ARM: Add fake asm for crt1.c. * lib/linux/arm-mes-gcc/crt1.c (_start)[__TINYC__]: Use fake asm. mescc: Mes C Library: Support ARM tcc: Add crti.c, crtn.c. * lib/linux/arm-mes-gcc/crti.c: New file. * lib/linux/arm-mes-gcc/crtn.c: New file. ARM: libtcc1: Add div.c, __memcpy, __memmove, __memset. * build-aux/configure-lib.sh (libtcc1_SOURCES)[arm]: Add div.c, __memcpy, __memmove, __memset. * build-aux/build-source-lib.sh: Generate libtcc1. mescc: Mes C Library: Support ARM tcc: Add __memset. * lib/string/__memset.c: New file. * include/mes/lib.h (__memset): Add prototype. mescc: Mes C Library: Support ARM tcc: Add __memmove. * lib/string/__memmove.c: New file. * include/mes/lib.h (__memmove): Add prototype. mescc: Mes C Library: Support ARM tcc: Add __memcpy. * lib/string/__memcpy.c: New file. * include/mes/lib.h (__memcpy): Add prototype. mescc: Mes C Library: abort: Avoid __raise for TinyCC. * lib/stdlib/abort.c: Use "raise" instead of __raise. doc: Update 'AUTHORS'. * AUTHORS: Add Natalie Kopaczewski. test: Split-off scaffold/60-math-itoa.c. * lib/tests/scaffold/60-math.c (main): Move itoa tests to... * lib/tests/scaffold/60-math-itoa.c: ...this new file. * build-aux/check-mescc.sh (mes_tests): Add it. test: Split-off 36-compare-arithmetic-negative.c. * lib/tests/scaffold/36-compare-arithmetic.c (main): Move negative divisions to... * lib/tests/scaffold/36-compare-arithmetic-negative.c: ...new file here. * build-aux/check-mescc.sh (mes_tests): Add it. test: ARM: 08-assign.c: Avoid assembly for tcc. * lib/tests/scaffold/08-assign.c (main)[__arm__ && __TINYC__]: Avoid assembly. test: Split-off 50-strcmp-itoa.c * lib/tests/string/50-strcmp.c (main): Move itoa tests to... * lib/tests/string/50-strcmp-itoa.c: ...this new file. * build-aux/check-mescc.sh (mes_tests): Add it. ARM: libtcc1: Add __divsi3, __modsi3, __udivsi3, __umodsi3. * lib/libtcc1.c (__divsi3, __modsi3, __udivsi3, __umodsi3): New functions. ARM: libtcc1: Add stubs __floatundidf, __fixunsdfdi, __fixunsdfsi. * lib/libtcc1.c (__floatdisf, __floatdidf)[__arm__]: New stubs. libtcc1: Add stubs __floatundidf, __fixunsdfdi, __fixunsdfsi. * lib/libtcc1.c (__floatundidf, __fixunsdfdi, __fixunsdfsi): New stubs. ARM: libtcc1: Add support for TinyCC. * lib/libtcc1.c: (__udivdi3, __umoddi3, __lshrdi3, __ashldi3, __fixunsxfdi)[__arm__ && __TINYC__]: Use __mesabi functions. libtcc1: Remove mesabi dependencies for TinyCC. * lib/libtcc1.c (__divdi3, __moddi3, __udivdi3, __umoddi3, __lshrdi3, __ashldi3, __ashrdi3, __floatundixf, __fixunsxfdi, __fixxfdi, __fixsfdi)[__TINYC__]: No stub printing. mescc: Mes C Library: div: Avoid __raise for TinyCC. * lib/mes/div.c (__raise)[__TINYC__]: New macro. mescc: Mes C Library: Add __mesabi_umod, __mesabi_udiv. * lib/mes/div.c (__mesabi_umod, __mesabi_udiv): New functions. * include/mes/lib.h: Add prototypes. 2021-01-23 Danny Milosavljevic ARM: Implement long division. * lib/mes/div.c (__mesabi_log2i): New procedure. (__mesabi_uldiv1): New procedure. (__mesabi_uldiv): Use it. Co-Authored-By: Nathalie Kopaczewski 2021-01-23 Danny Milosavljevic ARM: Special-case setjmp struct for gcc with mes libc. * include/setjmp.h (__jmp_buf): Special-case setjmp struct for gcc with mes libc. 2021-01-23 Jan (janneke) Nieuwenhuizen tests: Add 70-ternary-arithmetic-argument.c. * lib/tests/scaffold/70-ternary-arithmetic-argument.c: New file. * build-aux/check-mescc.sh (tcc_tests, xfail_tests): Add it. 2021-01-23 Danny Milosavljevic ARM: Speed up __mesabi_uldiv for powers-of-two divisors. * lib/mes/div.c (__mesabi_uldiv): Speed up division for powers-of-two divisors. 2021-01-23 Jan (janneke) Nieuwenhuizen ARM: Revert to 4 byte types only. * module/mescc/armv4/info.scm (armv4:type-alist): Use size 4 for long longs too. 2021-01-23 Paul Dersey Mes C Library: stdlib/qsort.c: Fix qswap segfault. * stdlib/qsort.c (qswap): Remove hard coded buffer size. Allow swapping of objects of arbitrary size. 2021-01-23 Jan (janneke) Nieuwenhuizen doc: Update to bug-mes@gnu.org. * doc/mes.texi (Submitting Patches): Use bug-gnu instead of guix-patches, guix-devel. build: Update guix package version too. * guix/git/mes.scm (mes, mes.git)[version]: Mark fields. * build-aux/GNUmakefile.in (update-hash): Update mes version too. (release): Remove gen-announce, guix-build dependencies. mescc: Update -g help text. * module/mescc.scm (parse-opts): Remove TODO, mention call stack. bootstrap: Resurrect. * build-aux/bootstrap.sh.in (AM_CFLAGS): Use -L ${srcdest}lib. Build libmescc.a and use it to link mes. mescc: Make sure includedir, libdir are set. * scripts/mescc.in (prefix): New variable. build: Make mescc more verbose on V=2, V=3. * build-aux/cflags.sh (AM_CFLAGS): Add -v, -v -v for V=2, V=3 respectively. 2020-12-29 Jan (janneke) Nieuwenhuizen guix: Switch to guile-3.0-latest. * guix/git/mes.scm (nyacc)[inputs]: New field. (mes)[inputs]: Update to guile-latest. 2020-12-13 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: ntoab: Use unsigned base. This fixes 60-math, 60-math-itoa, 70-printf-simple, 70-printf. * lib/mes/ntoab.c (ntoab): Use unsigned base. * include/mes/lib.h: Update prototype. 2020-10-07 Jan (janneke) Nieuwenhuizen configure: Use GUILD_OPTIMIZE=-O1 for Guile-3. * configure (main): Set guild_optimize to "-O1" for Guile-3. * build-aux/config.make.in (GUILD_OPTIMIZE): New variable. * build-aux/export.make (GUILD_OPTIMIZE): Export if set. * build-aux/config.sh.in (GUILD_OPTIMIZE): New variable. * build-aux/build-guile.sh: Use it. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Use signed division for x86, x86_64 when appropriate. This fixes 36-compare-arithmetic.c * module/mescc/i386/as.scm (i386:r0/r1, i386:r0%r1): Do not reset signed?. * module/mescc/x86_64/as.scm (x86_64:r0/r1, x86_64:r0%r1): Likewise. * lib/tests/scaffold/36-compare-arithmetic.c (main): Use unique exit value per failure. 2020-10-06 Jan (janneke) Nieuwenhuizen build: Bump MESCC_STACK. This fixes running ./pre-inst-env mescc ... * scripts/mescc.in (MES_STACK): Bump to 6000000. 2020-10-06 Jan (janneke) Nieuwenhuizen guix: nyacc: Update to 1.00.2. * guix/git/mes.scm (nyacc): Rename to... (nyacc-0.99): ...this. (nyacc): New variable. 2020-10-06 Jan (janneke) Nieuwenhuizen Revert "guix: nyacc: Update to 1.03.0." This does not work yet, sorry for the noise. This reverts commit 70b2942286ecc0b40798ac4e1fdaa9cd56a48aaf. 2020-10-06 Jan (janneke) Nieuwenhuizen guix: nyacc: Update to 1.03.0. * guix/git/mes.scm (nyacc): Rename to... (nyacc-0.99): ...this. (nyacc): New variable. (mes): Update to guile-3.0. build: Support guile-3.0. * configure (main): Prefer guile-3. build: Support make check TESTS=... XFAIL=... for mescc tests. * build-aux/config.sh.in (TESTS, XFAIL_TESTS): Export. * build-aux/export.make (TESTS, XFAIL_TESTS): Export if set. * build-aux/check-mescc.sh (TESTS, XFAIL_TESTS): Allow user override. 2020-10-06 Jan (janneke) Nieuwenhuizen mes: Support for gcc-10. Fixes . Reported by Vagrant Cascadian . * src/string.c (MAX_STRING): Remove duplicate definition. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Support gcc-10. See . Reported by Vagrant Cascadian . * include/setjmp.h (jmp_buf): Remove. * include/errno.h (errno): Mark extern. * include/mes/lib-mini.h (environ, errno, __stdin, __stdout, __stderr): Likewise. * lib/mes/globals.c: New file; define them. * build-aux/configure-lib.sh (libc_mini_shared_SOURCES, libmescc_SOURCES): Add it. * build-aux/test-c.sh: Always use -l c-mini as a minimum. 2020-10-06 Jan (janneke) Nieuwenhuizen build: Resurrect running mescc from elsewhere. After setting-up a buld environment, running something like ~/src/mes/wip/pre-inst-env mescc -v -v ~/src/mes/wip/scaffold/main.c works again. TODO: Make this less complex. * The mescc-lib (and gcc-lib) build directories do not help; these were introduced to support `wip-autotools'. * We used to opt for short *PATH variables: "." rather than /gnu/store/.... or /home/janneke/src/mes/master to avoid filling the MES arena. XXX Has this been solved? * In the Guix bootstrap, we run module/mescc.scm directly $MES -e '(mescc)' module/mescc.scm ...so that's why these overrides started to appear in multiple places. * build-aux/pre-inst-env.in (MES_UNINSTALLED): New variable. * scripts/mescc.in (includedir,libdir): Use it to override these. * module/mescc/mescc.scm (arch-find): Use it to add -messc. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: x86_64: Add syscall-internal. This resurrects the x86_64 build. * lib/linux/x86_64-mes-gcc/syscall-internal.c (__sys_call_internal), lib/linux/x86_64-mes-mescc/syscall-internal.c: New file. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: x86_64: Introduce __sys_call and friends. This prepares for x86_64 syscall-internal. * lib/linux/x86_64-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4): New functions, copied from ... (_sys_call, _sys_call1, _sys_call2, _sys_call3, _sys_call4): ... these. Use them, handle errno only. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: x86: Use long for syscalls. The Linux signature uses long, also this allows for making _sys_call and friends architecture-independent. * lib/linux/x86-mes-mescc/syscall-internal.c (__sys_call_internal, __sys_call2_internal): Use long. Update callers. * lib/linux/x86-mes-mescc/syscall.c (__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4, _sys_call, _sys_call1, _sys_call2, _sys_call3, _sys_call4): Likewise. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Mes C Library: Remove redundant prototypes. * lib/linux/x86-mes-gcc/syscall.c(__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4): Remove prototype. mescc: Mes C Library: Whitespace fixes. * lib/linux/signal.c (signal): Whitespace fixes. * lib/linux/time.c (time): Likewise. 2020-10-06 Danny Milosavljevic command line: Support "mescc --print-libgcc-file-name". * module/mescc.scm (parse-opts): Add "--print-libgcc-file-name". Distinguish between gcc and mescc; select LIBS accordingly. * build-aux/check.sh.in: Distinguish between gcc and mescc; add MES_CHECKING_BUILTIN_LIBS. * build-aux/test-c.sh: Use it to select LIBS accordingly. Make "raise" available for gcc use. * build-aux/configure-lib.sh (libc_tcc_SOURCES): Move lib/posix/raise.c, lib/linux/getpid.c, lib/linux/kill.c to... (libc_SOURCES): ...here. build: Use libgcc.a instead of libmescc.a for gcc. div: Remove libgcc-compatible API. * lib/mes/div.c (__aeabi_idiv): Delete procedure. (__aeabi_idivmod): Delete procedure. (__aeabi_uidivmod): Delete procedure. (__aeabi_uidiv): Delete procedure. Revert syscall split (of commit 55d38162be9ebd5b90b2550d0331a030c446c001); just copy the two syscalls I need for __raise instead. * lib/linux/arm-mes-gcc/syscall-internal.c (__sys_call_internal): New procedure. (__sys_call2_internal): New procedure. (__raise): Use them. (__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to... * lib/linux/arm-mes-gcc/syscall.c: ...here. * lib/linux/arm-mes-mescc/syscall-internal.c (__sys_call_internal): New procedure. (__sys_call2_internal): New procedure. (__raise): Use them. (__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to... * lib/linux/arm-mes-mescc/syscall.c: ...here. * lib/linux/x86-mes-gcc/syscall-internal.c (__sys_call_internal): New procedure. (__sys_call2_internal): New procedure. (__raise): Use them. (__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to... * lib/linux/x86-mes-gcc/syscall.c: ...here. * lib/linux/x86-mes-mescc/syscall-internal.c (__sys_call_internal): New procedure. (__sys_call2_internal): New procedure. (__raise): Use them. (__sys_call, __sys_call2, __sys_call3, __sys_call4, __sys_call6): Move to... * lib/linux/x86-mes-mescc/syscall.c: ...here. div: Add comment about __aeabi_idiv. * lib/mes/div.c (__aeabi_idiv): Add comment. div: Move __aeabi_idiv to __GNUC__; introduce __mesabi_idiv. * lib/mes/div.c (__aeabi_idiv): Move for conditional compilation. (__mesabi_idiv): New procedure. * module/mescc/armv4/as.scm (armv4:r0/r1): Use __mesabi_idiv. build: Make raise available in libc+tcc for libgcc. * build-aux/configure-lib.sh (libc_gnu_SOURCES): Remove raise, getpid, kill. (libc_tcc_SOURCES): Add raise, getpid, kill. 2020-10-06 Jan (janneke) Nieuwenhuizen mescc: Add signed char. * module/mescc/armv4/info.scm (armv4:type-alist): Add signed char. * module/mescc/i386/info.scm (i386:type-alist): Likewise. * module/mescc/x86_64/info.scm (x86_64:type-alist): Likewise. ARM: Add missing instruction. * lib/arm-mes/arm.M1: Add missing define. ARM: as: Fix ldrsb_ typo. (armv4:byte-r0-mem->r1-mem): : Add missing "_" to ldrsb_. ARM: as: Fix strh__ typo. * module/mescc/armv4/as.scm (armv4:word-r0-mem->r1-mem): Add missing "_" to strh__. mescc: Do not crash when attemting to link files without extension. * module/mescc/mescc.scm (replace-suffix): Add ELSE clause to IF for base; add IF for old-suffix. doc: Fix typos in `HACKING`. * HACKING (SETUP): Typos. 2020-08-24 Jan (janneke) Nieuwenhuizen ARM: as: Guile compile fix. * module/mescc/armv4/as.scm (optimize-immediate): Do not unquote compare functions (and numbers). 2020-08-22 Danny Milosavljevic test: Make 7l-struct-any-size-array-simple compatible with default ARM gcc. * lib/tests/scaffold/7l-struct-any-size-array-simple.c: Make "signed" explicit in signed char types. test: Make 7r-sign-extend compatible with default ARM gcc. * lib/tests/scaffold/7r-sign-extend.c: Make "signed" explicit in signed char types. build: Fixup cleaning of armv4. * build-aux/GNUmakefile.in (clean): Clean armv4 go files. 2020-06-19 Danny Milosavljevic ARM: Support comparing 32 bit values. * lib/arm-mes/arm.M1 (cmp____$i32,%r0): New macro. (cmp____$i32,%r1): New macro. (cmp____$i32,%r2): New macro. ARM: Handle signed values in r-byte-mem-add, r-word-mem-add. * lib/arm-mes/arm.M1 (ldrb___%r0,(%r1)): Delete macro. (ldrh___%r0,(%r0)): Delete macro. (ldrsh__%r0,(%r0)): New macro. (ldrh___%r0,(%r1)): Delete macro. (ldrsh__%r0,(%r1)): New macro. (ldrh___%r1,(%r1)): Delete macro. (ldrsh__%r1,(%r1)): New macro. (ldrh___%r2,(%r2)): Delete macro. (ldrsh__%r2,(%r2)): New macro. (ldrh___%r3,(%r3)): Delete macro. (ldrsh__%r3,(%r3)): New macro. (ldrsb__%r0,(%r1)): New macro. * module/mescc/armv4/as.scm (armv4:r-byte-mem-add): Use ldrsb. (armv4:r-word-mem-add): Use ldrsh, add____$i32,(%r0). (armv4:word-mem->r): Use ldrsh. 2020-06-16 Danny Milosavljevic ntoab: Simplify LONG_MIN case. * lib/mes/ntoab.c (ntoab): Simplify LONG_MIN case. Co-Authored-By: Nathalie Kopaczewski 2020-06-16 Danny Milosavljevic ARM: Factor out optimize-immediate. * module/mescc/armv4/as.scm (optimize-immediate): New macro. (immediate->r0): Use it. (armv4:value->r): Use it. (armv4:local->r): Use it. (armv4:r->local+n): Use it. (armv4:r-byte-mem-add): Use it. (armv4:r-word-mem-add): Use it. (armv4:local-ptr->r): Use it. (armv4:r+value): Use it. (armv4:r-cmp-value): Use it. (armv4:r0+value): Use it. (armv4:byte-r->local+n): Use it. (armv4:word-r->local+n): Use it. ARM: Avoid using (abs INT_MIN) and (- INT_MIN). * module/mescc/armv4/as.scm (immediate->r0): Inline abs. (armv4:value->r): Inline abs. (armv4:local->r): Inline abs. (armv4:r->local+n): Inline abs. (armv4:r-byte-mem-add): Inline abs. (armv4:r-word-mem-add): Inline abs. (armv4:local-ptr->r): Inline abs. (armv4:r+value): Inline abs. (armv4:r-cmp-value): Inline abs. (armv4:r0+value): Inline abs. (armv4:byte-r->local+n): Inline abs. (armv4:word-r->local+n): Inline abs. build-aux: Increase test timeout to 20 s. 2020-06-15 Danny Milosavljevic ntoab: Handle LONG_MIN case. * lib/mes/ntoab.c (ntoab): Handle LONG_MIN case. * lib/tests/scaffold/60-math.c (main): Add test for INT_MIN and hex. 2020-06-14 Danny Milosavljevic core: Fix unreadchar on string port when unreading EOF. * src/posix.c (unreadchar): Fix on string port when unreading EOF. 2020-06-13 Danny Milosavljevic Add ARM gcc scaffold assembly. * lib/linux/arm-mes-gcc/exit-42.S: New file. * lib/linux/arm-mes-gcc/hello-mes.S: New file. mescc: Add modules for armv4. * mes/module/mescc/armv4/as.mes: New file. * mes/module/mescc/armv4/info.mes: New file. * mes/module/mescc/mescc.mes: Use them. 2020-06-12 Danny Milosavljevic Implement setjmp for ARM mescc. * include/setjmp.h: Add ARM case. * lib/arm-mes-mescc/setjmp.c: New file. 2020-06-10 Danny Milosavljevic test: Test signed division. * lib/tests/scaffold/36-compare-arithmetic.c (main): Test signed division. ldiv: Work around missing struct return feature. * lib/mes/div.c (__mesabi_ldiv): Remove return type. (__mesabi_imod): Adapt call site. (__aeabi_idiv): Adapt call site and move it to conditional compilation. (__aeabi_idivmod): Adapt call site. 2020-06-10 Jan Nieuwenhuizen guix: mescc-tools: Update to 0.7.0, adding ARM support. This brings arm-linux-gnueabihf, aarch64-linux-gnu support. * guix/git/mes.scm (mescc-tools): Update to 0.7.0. 2020-06-10 Jan (janneke) Nieuwenhuizen dir-locals.el: Add indentation for Guix keywords. * .dir-locals.el (scheme-mode): Add indentation rules for Guix package definitions. 2020-06-10 Danny Milosavljevic mescc: Mes C Library: Hang at the end if necessary. * lib/linux/arm-mes-mescc/crt1.c (_start): Hang at the end if necessary. Add ARM backend. * build-aux/build-guile.sh: Add ARM backend. * lib/arm-mes/arm.M1: New file. * module/mescc/armv4/as.scm: New file. * module/mescc/armv4/info.scm: New file. * module/mescc/mescc.scm: Use it. * module/mescc/M1.scm (info->M1): Support ARM symbolic instructions, including little endian instructions. Align functions. 2020-06-07 Jan Nieuwenhuizen doc: Post-release update. * NEWS: Add v0.22 hash. * doc/announce/ANNOUNCE-0.22: Add gen-announce checksums; update NEWS, typos. 2020-06-04 Jan Nieuwenhuizen ARM: Mes C Library: Support gcc-sans-libc. * lib/linux/arm-mes-gcc/crt1.c: New file. * lib/linux/arm-mes-gcc/mini.c: New file. * lib/arm-mes-gcc/setjmp.c: New file. Co-Authored-By: Danny Milosavljevic 2020-06-04 Jan Nieuwenhuizen guix: mes: Add armhf-linux, aarch64-linux support. * guix/git/mes.scm (mes): Add armhf-linux, aarch64-linux support. 2020-06-03 Danny Milosavljevic ntoab: Make sure not to get stuck on base 1. * lib/mes/ntoab.c (ntoab): Make sure not to get stuck on base 1. mescc: Mes C Library: Add crt1, mini. * lib/linux/arm-mes-mescc/crt1.c: New file. * lib/linux/arm-mes-mescc/mini.c: New file. ARM: Mes C Library: Add comment. * lib/linux/time.c: Add comment. 2020-06-03 Jan Nieuwenhuizen ARM: Mes C Library: Add compile stub for time. * lib/linux/time.c (time)[SYS_gettimeofday]: Implement using gettimeofday. (time)[!SYS_time && !SYS_gettimeofday]: Compile stub. 2020-06-03 Danny Milosavljevic Add ARM syscall numbers. * include/linux/arm/syscall.h: New file. 2020-06-02 Danny Milosavljevic waitpid: Support ARM. * lib/linux/waitpid.c (waitpid): Support ARM. Add ARM linker support files. * lib/linux/arm-mes/elf32-0exit-42.hex2, lib/linux/arm-mes/elf32-0header.hex2, lib/linux/arm-mes/elf32-0hello-mes.hex2, lib/linux/arm-mes/elf32-body-exit-42.hex2, lib/linux/arm-mes/elf32-body-hello-mes.hex2, lib/linux/arm-mes/elf32-footer-single-main.hex2, lib/linux/arm-mes/elf32-header.hex2: New files. Raise SIGABRT on abort(). * lib/stdlib/abort.c (abort): Raise SIGABRT. Introduce libmescc.a; Put division by integer in there; split syscalls' errno off. * build-aux/configure-lib.sh (libmescc_SOURCES): Add lib/mes/div.c, lib/linux/*/syscall-internal.c. * build-aux/build-lib.sh: Add libmescc.a. * build-aux/build-mes.sh: On gcc, add "-lmescc". * build-aux/test-c.sh: Add "-lmescc". * build-aux/check.sh.in: Add mescc to LIBS. * module/mescc/mescc.scm (mescc:link): Add "mescc". * module/mescc.scm (mescc:main): Update documentation of "-nodefaultlibs" and "-nostdlib". * lib/mes/div.c (ldiv): Rename to... (__mesabi_ldiv): ...this. Avoid assert. (__mesabi_div0): Avoid assert. (__aeabi_idivmod): New procedure. (__aeabi_idiv): New procedure. (__aeabi_uidivmod): New procedure. (__aeabi_uidiv): New procedure. * lib/linux/x86-mes-gcc/syscall.c (__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4): Move to... * lib/linux/x86-mes-gcc/syscall-internal.c: ...here. (__raise): New procedure. * lib/linux/x86-mes-mescc/syscall.c (__sys_call, __sys_call1, __sys_call2, __sys_call3, __sys_call4): Move to... * lib/linux/x86-mes-mescc/syscall-internal.c: ...here. (__raise): New procedure. * lib/linux/arm-mes-gcc/syscall.c: New file. * lib/linux/arm-mes-gcc/syscall-internal.c: New file. * lib/linux/arm-mes-mescc/syscall.c: New file. * lib/linux/arm-mes-mescc/syscall-internal.c: New file. * lib/gnu/syscall.c (__syscall, __syscall2, __syscall_get, __syscall_put): Move to... * lib/gnu/syscall-internal.c: ...here. Prepare header files for ARMv4. * include/fcntl.h (O_DIRECTORY): Add ARM case. * include/signal.h (struct sigaction): Add uapi case. * include/stdint.h: Add ARM case. * include/sys/stat.h (struct stat): Add ARM case. Support and pass "-marm". * build-aux/cflags.sh, build-aux/check.sh.in: Pass "-marm" for ARM. * module/mescc/mescc.scm: Accept it. Prepare tests for ARMv4. * lib/tests/io/90-stat.c, lib/tests/scaffold/76-pointer-arithmetic.c, lib/tests/scaffold/7k-for-each-elem.c, lib/tests/scaffold/85-sizeof.c: Prepare tests for ARMv4. 2020-01-20 Jan Nieuwenhuizen Release 0.22. * configure (VERSION): Update to 0.22. (main): Likewise. * build-aux/GNUmakefile.in: Likewise. * configure.sh (VERSION): Likewise. * guix/git/mes.scm (mes, mes.git): Likewise. build: Update release process. * build-aux/GNUmakefile.in: Update documentation. (sign-dist): Rename from `sign'. * configure: Remove version check for Guix; support GUIX=guix ./configure. doc: Release update. * BOOTSTRAP: Release update. * HACKING: Likewise. * INSTALL: Likewise. * NEWS: Likewise. * PORTING: Likewise. * README: Likewise. * ROADMAP: Likewise. * doc/mes.texi: Likewise. * doc/announce/ANNOUNCE-0.22: New file. 2020-01-20 Jan Nieuwenhuizen mescc: Mes C Library: Fix execlp, execvp for file names with slash. Reported by mid-kid. * lib/posix/execlp.c (execlp): Do not use search_path when file name contains a slash (WAS: when file name starts with slash). * lib/posix/execvp.c (execvp): Likewise. 2020-01-20 Jan Nieuwenhuizen build: Support bootstrapping using build.sh. * build-aux/build.sh.in: Oops, use $compiler = bootstrap concept does not exist yet. Gash cp does not support -p; drop it. * configure.sh: Oops, set bootstrap to `true' instead of yes. mescc: Mes C Library: lseek: Be careful clearing read buffer. * lib/linux/lseek.c (_lseek): New function. * lib/linux/lseek.c (lseek): Use it to check if we should reset read buffer. * lib/mes/__buffered_read.c (__read_buffer_max): New variable. (__buffered_read_init): Add environment override: MES_READ_BUFFER. (__buffered_read): Use it. build: Have configure respect GUILE_LOAD_PATH for mes to find Nyacc. * configure: Substitute GUILE_LOAD_PATH from %load-path. * configure.sh: Likewise. * build-aux/config.make.in: Add GUILE_LOAD_PATH as subtitution variable. * build-aux/config.sh.in: Likewise. * mes/module/mes/guile.mes (%load-path): New variable. 2020-01-20 Jan Nieuwenhuizen build: Have configure prefer $CC over gcc; tcc over gcc, gcc over cc. Reported by Vagrant Cascadian. * configure (string->version): Prefer for most-dotted string. Fixes makeinfo version. (check-program-version): Prefer displaying of command, if single word. (main): Check for $CC --version, $CC -v. Prefer $CC over gcc; tcc over gcc, gcc over cc. 2020-01-20 Jan Nieuwenhuizen mescc: Opt for reproducible builds with Guile and Mes. * module/mescc/compile.scm (mes-or-reproducible?): New variable. (ast->comment): Use it. * module/mescc/preprocess.scm (mes-or-reproducible?): New variable. (c99-input->full-ast): Use it. 2020-01-20 Jan Nieuwenhuizen build: Resurrect compiling with TinyCC. ./configure CC=tcc --host=i686-unknown-linux-gnu --with-courage * configure: Cater for tcc. 2019-12-17 Jan Nieuwenhuizen build: Cater for FreeBSD. * build-aux/bootstrap.sh.in: Add test ! -e -o to satisfy FreeBSD test. Fixes skipping over all compilations. * build-aux/cc.sh (compile): Likewise. freebsd: Initial x86 scaffold. * lib/freebsd/x86-mes-gcc/crt1.c: New file. * lib/freebsd/x86-mes-gcc/exit-42.S: New file. * lib/freebsd/x86-mes-gcc/hello-mes.S: New file. * lib/freebsd/x86-mes-gcc/mini.c: New file. * lib/freebsd/x86-mes-mescc/crt1.c: New file. * lib/freebsd/x86-mes-mescc/mini.c: New file. * lib/freebsd/x86-mes/elf32-0exit-42.hex2: New file. * lib/freebsd/x86-mes/elf32-0header.hex2: New file. * lib/freebsd/x86-mes/elf32-0hello-mes.hex2: New file. * lib/freebsd/x86-mes/elf32-body-exit-42.hex2: New file. * lib/freebsd/x86-mes/elf32-body-hello-mes.hex2: New file. * lib/freebsd/x86-mes/elf32-footer-single-main.hex2: New file. * lib/freebsd/x86-mes/elf32-header.hex2: New file. freebsd: Initial configure support. * configure: Initial FreeBSD configure support. * configure.sh: Likewise. Run without bash. build: Prepare for kernel variants. * configure: Fix detection of Arch, FreeBSD. * lib/linux/x86-mes-gcc/exit-42.S: Move from ... * lib/x86-mes-gcc/exit-42.S: ... here. * lib/linux/x86-mes-gcc/hello-mes.S: Move from ... * lib/x86-mes-gcc/hello-mes.S: ... here. * lib/linux/x86-mes-mescc/exit-42.S: Move from ... * lib/x86-mes-mescc/exit-42.S: ... here. * lib/linux/x86-mes-mescc/hello-mes.S: Move from ... * lib/x86-mes-mescc/hello-mes.S: ... here. * lib/linux/x86-mes/elf32-0exit-42.hex2: Move from ... * lib/x86-mes/elf32-0exit-42.hex2: ... here. * lib/linux/x86-mes/elf32-0header.hex2: Move from ... * lib/x86-mes/elf32-0header.hex2: ... here. * lib/linux/x86-mes/elf32-0hello-mes.hex2: Move from ... * lib/x86-mes/elf32-0hello-mes.hex2: ... here. * lib/linux/x86-mes/elf32-body-exit-42.hex2: Move from ... * lib/x86-mes/elf32-body-exit-42.hex2: ... here. * lib/linux/x86-mes/elf32-body-hello-mes.hex2: Move from ... * lib/x86-mes/elf32-body-hello-mes.hex2: ... here. * lib/linux/x86-mes/elf32-footer-single-main.hex2: Move from ... * lib/x86-mes/elf32-footer-single-main.hex2: ... here. * lib/linux/x86-mes/elf32-header.hex2: Move from ... * lib/x86-mes/elf32-header.hex2: ... here. * lib/linux/x86_64-mes-gcc/exit-42.S: Move from ... * lib/x86_64-mes-gcc/exit-42.S: ... here. * lib/linux/x86_64-mes-gcc/hello-mes.S: Move from ... * lib/x86_64-mes-gcc/hello-mes.S: ... here. * lib/linux/x86_64-mes-mescc/exit-42.S: Move from ... * lib/x86_64-mes-mescc/exit-42.S: ... here. * lib/linux/x86_64-mes-mescc/hello-mes.S: Move from ... * lib/x86_64-mes-mescc/hello-mes.S: ... here. * lib/linux/x86_64-mes/elf64-0exit-42.hex2: Move from ... * lib/x86_64-mes/elf64-0exit-42.hex2: ... here. * lib/linux/x86_64-mes/elf64-0header.hex2: Move from ... * lib/x86_64-mes/elf64-0header.hex2: ... here. * lib/linux/x86_64-mes/elf64-0hello-mes.hex2: Move from ... * lib/x86_64-mes/elf64-0hello-mes.hex2: ... here. * lib/linux/x86_64-mes/elf64-body-exit-42.hex2: Move from ... * lib/x86_64-mes/elf64-body-exit-42.hex2: ... here. * lib/linux/x86_64-mes/elf64-body-hello-mes.hex2: Move from ... * lib/x86_64-mes/elf64-body-hello-mes.hex2: ... here. * lib/linux/x86_64-mes/elf64-footer-single-main.hex2: Move from ... * lib/x86_64-mes/elf64-footer-single-main.hex2: ... here. * lib/linux/x86_64-mes/elf64-header.hex2: Move from ... * lib/x86_64-mes/elf64-header.hex2: ... here. * module/mescc.scm (parse-opts): Support --kernel. * module/mescc/mescc.scm (kernel-find): New function. * module/mescc/mescc.scm (hex2->elf): Use it to find kernel-specific ELF snippets. * build-aux/install.sh.in: Install it. 2019-12-13 Jan Nieuwenhuizen mescc: Mes C Library: Add ioctl3 stub. mescc: Mes C Library: Fix access stub. * lib/stub/access.c (access): Use _open3 to give more meaningful behaviour. Fixes hanging of mes. hurd: Fixes for upgrade to debian-hurd-20190220.img. * include/mach/mach-init.h (__mach_host_self, __mach_task_self): Remove macro magic. (mach_host_self, mach_task_self): Remove macro magic; declare as function. * lib/mach/mach-init.c (mach_host_self, mach_task_self): New function. (mach_init): Use them. * lib/gnu/hurd-start.c (_hurd_start): Use mach_task_self (). * lib/gnu/_exit.c (_exit): Likewise. hurd: Add malloc. * include/gnu/syscall.h (__vm_allocate): New value. (__vm_allocate): Declare. * lib/gnu/malloc.c: New file. * lib/stdlib/malloc.c[__GNU__]: Disable. See FIXME. * lib/gnu/vm-allocate.c: New file. * build-aux/configure-lib.sh (libc_SOURCES): Add it. hurd: Add open. * include/fcntl.h (O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_APPEND, O_TRUNC)[__GNU__]: Specialize for GNU. * lib/gnu/dir-lookup.c: New file. * lib/stdio/fopen.c (fopen): Use O_RDONLY. * lib/tests/posix/50-open-read.c (main): Likewise. * lib/tests/stdio/90-fseek.c (main): Likewise. * include/gnu/syscall.h (SYS__dir_lookup): New value. * lib/gnu/_open3.c: New file. * build-aux/configure-lib.sh (libc_SOURCES): Build them. hurd: Add argv and environ. * include/gnu/hurd.h (struct hurd_startup_data): Add argp, envp. * lib/gnu/hurd-start.c (__argv, __env): Define them. * lib/gnu/exec-startup-get-data.c (mach_startup_info2hurd_startup_data): Set them. * lib/gnu/x86-mes-gcc/crt1.c (_start): Use them. * build-aux/configure-lib.sh (libc_mini_SOURCES): Add argz-extract.c. * include/argz.h: Build fix. * lib/string/argz-count.c: Likewise. * lib/string/argz-extract.c: Likewise. hurd: Add stubs for missing libc+tcc functions. * lib/stub/close.c: New file. * lib/stub/rmdir.c: New file. * lib/stub/stat.c: New file. * build-aux/configure-lib.sh (libc_tcc_SOURCES)[gnu]: Add them. hurd: Add stubs for missing libc functions. * lib/stub/_getcwd.c: New file. * lib/stub/_getcwd.c: New file. * lib/stub/_open3.c: New file. * lib/stub/access.c: New file. * lib/stub/brk.c: New file. * lib/stub/chmod.c: New file. * lib/stub/clock_gettime.c: New file. * lib/stub/dup.c: New file. * lib/stub/dup2.c: New file. * lib/stub/execve.c: New file. * lib/stub/fork.c: New file. * lib/stub/gettimeofday.c: New file. * lib/stub/ioctl.c: New file. * lib/stub/time.c: New file. * lib/stub/unlink.c: New file. * lib/stub/waitpid.c: New file. * build-aux/configure-lib.sh (libc_SOURCES)[gnu]: Add them. hurd: Add stubs for missing libmes functions. * lib/stub/lseek.c: New file. * build-aux/configure-lib.sh (libmes_SOURCES)[gnu]: Add it. hurd: Add _read. * include/gnu/hurd.h (fd_read): Declare. * include/gnu/syscall.h (SYS__io_read): New value. * lib/gnu/_read.c: New file. * lib/gnu/fd-read.c: New file. * lib/gnu/io-read.c: New file. * build-aux/configure-lib.sh (libc_SOURCES): Add _read sources. hurd: Add _write. * include/gnu/syscall.h (SYS__io_write): Add enum field. (_hurd_dtable, _hurd_dtable_size): Declare variable. (fd_get, fd_write, __io_write, __syscall_put): Declare. * lib/gnu/hurd-start.c (_hurd_dtable, _hurd_dtable_size): Define variable. * lib/gnu/_write.c: New file. * lib/gnu/fd-get.c (fd_get): New file. * lib/gnu/fd-write.c (fd_write): New file. * lib/gnu/io-write.c: New file. * lib/gnu/syscall.c (__syscall_put): New function. * build-aux/cofnigure-lib.sh (libc_mini_SOURCES): Add write sources. * lib/tests/mes/30-oputs.c (main): Update. * lib/tests/mes/30-oputs.stdout: New file. * lib/tests/mes/30-eputs.c: New test. * lib/tests/mes/30-eputs.stderr: New file. * build-aux/check-mescc.sh (TESTS): Add it. 2019-12-13 Jan Nieuwenhuizen 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 Jan Nieuwenhuizen build: Generate ChangeLog reproducibly. Thanks, Timothy! * build-aux/gitlog-to-changelog (git_dir_option): Avoid non-reproducible localtime. build: Make guild optional for bootstrap builds. * configure: Use `true' for guild when it is not available. build: Clean-out .gitignore. .gitignore: Remove obsolete cross build patterns. 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-08 Jan Nieuwenhuizen build: Oops, have configure honor --host. This allows ./configure --host=i686-unknown-linux-gnu instead of CC=i686-unknown-linux-gnu-gcc ./configure * configure (main): Honor --host. 2019-12-08 Jan Nieuwenhuizen bootstrap: Default to mesar for mescc build. * configure.sh: Default to mesar for mescc build. bootstrap: Fix configure.sh's host detection. * configure.sh: Avoid setting host="" and not running $CC. mescc: Add mes 0.19 compatibility. * mes/module/mes/boot-0.scm (%datadir): Cater for %datadir not being set. 2019-12-07 Jan Nieuwenhuizen bootstrap: Build files only once. * build-aux/bootstrap.sh.in: Build files only once. 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-06 Jan Nieuwenhuizen mescc: Fix for compiling handwritten .S assembly. * module/mescc/mescc.scm (mescc:compile): Handle .S. (mescc:link): Likewise. build: Add mescc scaffold for regular build. * lib/x86-mes-mescc/exit-42.S: New file. * lib/x86-mes-mescc/hello-mes.S: New file. * lib/x86_64-mes-mescc/exit-42.S: New file. * lib/x86_64-mes-mescc/hello-mes.S: New file. 2019-12-08 Jan Nieuwenhuizen 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-05 Jan Nieuwenhuizen 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. 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. 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-08 Jan Nieuwenhuizen build! Fixup clean without git: Clean cleaner. * build-aux/GNUmakefile.in (clean): Clean cleaner. 2019-12-07 Vagrant Cascadian Fix build without git on "wip" branch. --=-=-= Content-Type: text/plain In the "wip" branch, the attempt to build without git was a bit overly aggressive in the purging of GIT. live well, vagrant From 73bb68e86318a6bc0fe191db663be97f94556956 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Sat, 7 Dec 2019 19:59:00 +0100 Subject: [PATCH] Fix build without git Commit "1863c0d843a5fe4e94e8cb923cc0896f30fceeeb" removed the substitution of @GIT@ when, resulting in the GIT variable being set to "@GIT@" rather than "" when git is not installed. 2019-12-04 Jan Nieuwenhuizen build: Fix configure host detection for Arch. Thanks, Jelle! * configure (main): Grok `CPU-pc-linux-gnu'. build: Successfully check for Nyacc 0.99.0. * configure (gulp-pipe): New function. (check-program-version): Use it to correctly detect Nyacc. (gulp-pipe*): Rewrite to use it. build: Remove git dependency. * configure: Remove git dependency. * build-aux/GNUmakefile.in (clean,distclean, maintainer-clean): Implement without git. * INSTALL: Update dependencies. 2019-12-03 Jan Nieuwenhuizen core: Remove MES_PKGDATADIR. * configure: Do not add MES_PKGDATADIR to config.h. * configure.sh: Likewise. * simple.sh: Likewise. * src/mes.c (open_boot): Do not use MES_PKGDATADIR; rely on MES_PREFIX or cwd. 2019-12-02 Jan Nieuwenhuizen mescc: Ignore -fno-stack-protector. * module/mescc.scm (parse-opts): Ignore it. build: Use debug build (-g) by default. * build-aux/build.sh.in (debug): Enable. 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. 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-01 Jan Nieuwenhuizen test: 90-readdir: Remove qsort dependency. Fixes tmpfs failures. * lib/tests/dirent/90-readdir.c (check_seen): New function. (main): Use it instead of qsort. (qsort_strcmp): Remove. 2019-11-24 Jan Nieuwenhuizen core: Throw instead of segfault on non-existing input file. Reported by theruran. * src/posix.c (open_input_file): Call error instead of failing silently. 2019-06-11 Vagrant Cascadian boot-0: Fix spelling of "evaluate" 2019-11-24 Jan Nieuwenhuizen mescc: Honor --includedir, --libdir. * guix/git/mes.scm (mes): * module/mescc.scm (%includedir, %libdir): New variable. (mescc:main): Add them to options. * module/mescc/mescc.scm (mescc:preprocess, c->info): Add %includedir. (arch-find): Use %libdir instead of prefix-file. (prefix-file): Remove. * scripts/mescc.scm.in (%includedir, %libdir): Initialize from and set in environment. xx * module/mescc/mescc.scm : 2019-11-24 Jan Nieuwenhuizen doc: Post-release update. * NEWS: Typo. * doc/announce/ANNOUNCE-0.21: Add checksums. 2019-11-10 Jan Nieuwenhuizen 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-04 Jan Nieuwenhuizen 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-23 Jan Nieuwenhuizen mescc: Mes C Library: vfprintf: Support --with-system-libc. * include/stdarg.h (va_arg8)[SYSTEM_LIBC]: Define. mescc: Mes C Library: Support gcc-4.6.4: Fix ctime stub. * lib/stub/ctime.c (ctime): Fix stub to avoid segfault upon use. mescc: Mes C Library: Fix isatty for x86_64. * lib/linux/ioctl.c (ioctl3): New function. * include/sys/ioctl.h: Declare it. * lib/posix/isatty.c (__tcgetattr): Use it. 2019-11-09 Jan Nieuwenhuizen build: Prefer /bin/bash if available. Thanks, Vagrant! Ensure the configure script uses /bin/bash, otherwise on systems with /bin -> /usr/bin it results in /bin/bash being embedded in various scripts. Inspired by https://salsa.debian.org/debian/mes/blob/debian/master/debian/patches/force-use-of-bin-bash * configure: Prefer /bin/bash, /bin/sh if available. Helps reproducibility on Debian. 2019-11-04 Jan Nieuwenhuizen build: Update script help and usage. * doc/mes.texi (Invoking mesar): New section. * mes/module/mes/boot-0.scm: Add one line help description. * module/mescc.scm (parse-opts): Likewise. * scripts/diff.scm (main): Add -h,--help, -v,--version. * scripts/mesar.in: Likewise. build: Use unversioned doc directory. Thanks, Vagrant! * configure (docdir): Drop version. Fixes Debian lint error. * configure.sh (docdir): Likewise. 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-09 Jan Nieuwenhuizen Revert "build: Mark lib/tests/dirent/90-readdir.c as XFAIL on x86_64-gcc." This reverts commit dc0b41f83efa973b7a92c0c7a0ad1eb21a7c4c7a. 2019-10-30 Jan Nieuwenhuizen 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-11-09 Jan Nieuwenhuizen Revert "build: Mark lib/tests/dirent/90-readdir.c as XFAIL on x86_64-mescc." This reverts commit 17986224095ed72649fb2383f72c21f525977310. 2019-10-30 Jan Nieuwenhuizen 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-24 Jan Nieuwenhuizen build: Better and friendlier tarball. * build-aux/GNUmakefile.in (dist): Be friendly to Debian; avoid using EPOCH. Cater for file permission differences. 2019-10-15 Jan Nieuwenhuizen 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-10 Jan Nieuwenhuizen mes: Fix -c, --command. * mes/module/mes/boot-0.scm: Prepend 'begin to expr list. 2019-10-03 Jan Nieuwenhuizen check: Remove duplicate test. * build-aux/check-boot.sh (TESTS): Remove duplicate test. 2019-09-20 Jan Nieuwenhuizen mescc: Mes C Library: Support gcc-4.6.4: vfprintf, vsnprintf: pad with space. * lib/stdio/vfprintf.c (vfprintf): pad with space. * lib/stdio/vsnprintf.c (vsnprintf): pad with space. 2019-09-13 Jan Nieuwenhuizen 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-06 Jan Nieuwenhuizen 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-04 Jan Nieuwenhuizen mescc: Mes C Libray: Fix off_t. * include/sys/types.h (off_t): Drop unsigned. 2019-09-06 Jan Nieuwenhuizen 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-08-26 Danny Milosavljevic Add missing #include. * lib/stdlib/mbstowcs.c: Add missing #include. 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 Danny Milosavljevic va_align: Fix compiler warning. Follow-up to 49b0cd7d2e6952044d7436260d6ba950e40ee05f. * include/stdarg.h: Fix compiler warning. 2019-08-27 Danny Milosavljevic Add missing #include. * lib/tests/mes/90-abtod.c (main): Add missing #include. Fix variable argument list traversal for doubles. * include/stdarg.h (va_align): New macro. (va_arg8): New macro. * lib/stdio/vfprintf.c (vfprintf): Use it. * lib/stdio/vsnprintf.c (vsnprintf): Use it. 2019-08-24 Jan Nieuwenhuizen 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-09-01 Jan Nieuwenhuizen mescc: Mes C Library: vfprintf, vsnprintf: Pad floats with space. * lib/stdio/vfprintf.c (vfprintf): Pad floats with space. * lib/stdio/vsnprintf.c (vsnprintf): Pad floats with space. * lib/tests/stdio/90-sprintf.c: Test it. 2019-08-01 Jan Nieuwenhuizen mescc: Mes C Library: vsscanf: Increase count for scanned float. * lib/stdio/vsscanf.c (vsscanf): Increase count for scanned float. 2019-07-31 Jan Nieuwenhuizen mescc: Mes C Library: Support GNU Tar: Fix getpwnam, getpwuid stubs. * lib/stub/getpwnam.c (getpwnam): Return pointer to static struct passwd. * lib/stub/getpwuid.c (getpwuid): Likewise. 2019-07-24 Jan Nieuwenhuizen 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-21 Jan Nieuwenhuizen mescc: Mes C Library: Support GNU Awk: Add wchar_t. * include/sys/types.h (wchar_t): New typedef. 2019-07-18 Jan Nieuwenhuizen 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-15 Jan Nieuwenhuizen 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-12 Jan Nieuwenhuizen 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-09 Jan Nieuwenhuizen mescc: Mes C Library: Support GNU Tar: Add missing defines. * include/errno.h (ENXIO): New macro. * include/sys/stat.h (S_IFIFO, S_ISFIFO): New macro. 2019-07-06 Jan Nieuwenhuizen mescc: Mes C Library: Support GNU Bash: Add struct winsize. * include/termio.h (struct winsize): New type. 2019-07-03 Jan Nieuwenhuizen 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. 2020-01-12 Jan Nieuwenhuizen 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. 2019-06-25 Jan Nieuwenhuizen 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-22 Jan Nieuwenhuizen mescc: Mes C Library: Support GNU Awk: vsscanf: Support %f. * lib/stdio/vsscanf.c (vsscanf): Support %f. 2019-06-19 Jan Nieuwenhuizen mescc: Mes C Library: Support GNU Awk: Do not flush std files. * lib/stdio/fflush.c (fflush): Do not flush std files. 2019-06-16 Jan Nieuwenhuizen 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-12 Jan Nieuwenhuizen 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-09 Jan Nieuwenhuizen 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-12 Jan Nieuwenhuizen mescc: Mes C Library: Fix compile warnings. * include/stdlib.h (abort): Add prototype. 2019-11-10 Jan Nieuwenhuizen 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-09-20 Jan Nieuwenhuizen build: Avoid tar --exclude=. * build-aux/install.sh.in: Only use `tar --exclude=' if we also have .go files compiled by Guile. 2019-09-16 Jan Nieuwenhuizen build: mesar: Remove bashisms. * scripts/mesar.in: Remove bashisms. 2019-10-01 Jan Nieuwenhuizen configure.sh: Cleanup argument parsing. Thanks, Timothy! * configure.sh: Cleanup argument parsing. 2019-09-16 Jan Nieuwenhuizen configure.sh: Remove bashisms. * configure.sh: Remove bashisms. Fixes running with Gash 0.1. 2019-09-16 Jan Nieuwenhuizen Revert "nyacc: 0.86.0 compatibility stub. WIP" This reverts commit 0183cc1c42437fda27196e27b490285a61d47f59. While it works to run Nyacc 0.86.0, it breaks running Nyacc 0.93 and up. This would need more thought and work, adding a nyacc-compat directory or so. Seems not worth the effort right now. 2019-09-16 Jan Nieuwenhuizen nyacc: 0.86.0 compatibility stub. WIP * mes/module/nyacc/lang/c99/util.scm: 0.86.0 compatibility stub. 2019-09-20 Jan Nieuwenhuizen 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-11-13 Jan Nieuwenhuizen 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-23 Jan Nieuwenhuizen build: Create ascii signature. * build-aux/GNUmakefile.in (sign): Create ascii signature. 2019-09-09 Jan Nieuwenhuizen doc: Post-release update. * doc/announce/ANNOUNCE-0.20: Update. * guix/git/mes.scm (mes): Update. Release 0.20. * configure (VERSION): Update to 0.20. (main): Likewise. * configure.sh (VERSION): Likewise. * guix/git/mes.scm (mes, mes.git): Likewise. 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. guix: Update mescc-tools to 0.6.1. * guix/git/mes.scm (mescc-tools): Update to 0.6.1. * configure: Check for mescc-tools versions 0.6 or higher. build: Create ascii signature. * build-aux/GNUmakefile.in (sign): Create ascii signature. guix: Update Nyacc to 0.99. * guix/git/mes.scm (nyacc): Update to 0.99. doc: Add PORTING. * PORTING: New file. doc: Typos. Thanks, dddddd. * doc/announce/ANNOUNCE-0.11: Typo. * doc/announce/ANNOUNCE-0.12: Typo. * doc/announce/ANNOUNCE-0.13: Typo. * doc/announce/ANNOUNCE-0.14: Typo. mescc: Remove dead code. Thanks Mark Weaver. * module/mescc/compile.scm (field-size): Remove dead function. 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. 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. 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. getopt: Remove old FSF address, thanks Vagrant. * lib/posix/getopt.c: Remove old FSF address. 2019-09-09 Danny Milosavljevic Add missing #include. * lib/tests/scaffold/55-char-array.c: Add missing #include. Add missing #include. * lib/tests/io/90-stat.c: Add missing #include. Add missing #include. * lib/posix/getcwd.c: Add missing #include. 2019-09-09 Jan Nieuwenhuizen signal: Use SA_RESTORER on x86-64. * lib/linux/signal.c (signal)[x86_64]: Avoid segfault by setting SA_RESTORER flag. 2019-09-09 Danny Milosavljevic signal: Add comment on why we don't use the restorer. * lib/linux/signal.c: Add comment on why we don't use the restorer. signal: Remove SA_SIGINFO. * lib/linux/signal.c (signal): Remove SA_SIGINFO. signal: Don't use custom restorer. * lib/linux/signal.c (signal): Don't use custom restorer. signal: Use SA_SIGINFO (like glibc). * lib/linux/signal.c (_restorer): Rename to... (_restorer_for_siginfo): ...this. (signal): Use it. Use SA_SIGINFO. signal: Make sure that the signal mask is actually unsigned long. * lib/linux/signal.c (signal): Make sure that the signal mask is actually unsigned long. 2019-09-09 Danny Milosavljevic Delete "__sigmask". Follow-up to 6d95b89759d3c598fc84194429ae8c57249daa1a * lib/linux/signal.c (__sigmask): Delete definition. 2019-09-09 Danny Milosavljevic Fix "struct sigaction" structure for rt_sigaction. * include/signal.h (sigset_t): Increase size. * lib/linux/signal.c (signal): Use new sigset_t. Inherit CFLAGS for mes. * build-aux/check.sh.in: Inherit CFLAGS for mes. Fix typo. * build-aux/build.sh.in: Fix typo in "CFLAGS". tests: Fail early on nonexistent file. * lib/tests/io/90-stat.c (main): Fail early on nonexistent file. open: Check flags, and use _open2 if applicable. * lib/linux/open.c (open): Check flags; use _open2. ldiv: Make rem < 0 if a < 0. * lib/mes/div.c (ldiv): Make rem < 0 if a < 0. ldiv: Handle a == LONG_MIN. * lib/mes/div.c (ldiv): Handle a == LONG_MIN. 2019-09-09 Jan Nieuwenhuizen 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-07-01 Danny Milosavljevic Fix ntoab. Follow-up to b5b19304b59fefbed923b146ec8c8d495556fa76. * lib/mes/ntoab.c (ntoab): Fix non-MESC case. 2019-06-18 Danny Milosavljevic signal: Define "_restorer" everywhere except on i386. * lib/linux/signal.c: Define "_restorer" everywhere except on i386. Clarify our data type choices in "struct stat". * include/sys/stat.h: Clarify our data type choices in "struct stat". 2019-09-07 Jan Nieuwenhuizen test: Bump timeout. * build-aux/test-c.sh: Bump timeout to 10s, __mesabi_uldiv can be slow. 2019-06-14 Danny Milosavljevic ntoab: Use __mesabi_uldiv only on __MESC__. * lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv only on __MESC__. 2019-06-14 Jan Nieuwenhuizen 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-13 Danny Milosavljevic ntoab: Include "assert.h". * lib/mes/ntoab.c: #include "assert.h". mescc: Mes C Library: Use __mesabi_uldiv. * lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv. mescc: Mes C Library: Add integer division algorithm. * lib/mes/div.c: New file. 2019-07-28 Jan Nieuwenhuizen 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-27 Jan Nieuwenhuizen 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-06-10 Jan Nieuwenhuizen tests: Disable 70-extern.c for x86_64-gcc. * build-aux/check-mescc.sh (XFAIL_TESTS)[x86_64-gcc]: Add 70-extern.c. 2019-05-30 Danny Milosavljevic mescc: Put char's ASCII code into register, not char. * module/mescc/compile.scm (expr-register): Put char's ASCII code into register, not char. 2019-06-09 Jan Nieuwenhuizen mes: Update to Nyacc 0.93. * mes/module/nyacc/lang/c99/util.mes: New file. * mes/module/nyacc/lang/c99/parser.mes: Use it. * module/mescc/compile.scm (ast->info): Update for Nyacc 0.93.0. * module/mescc/preprocess.scm (need-progress): Likewise. (ast-strip-comment): Likewise. 2019-08-02 Jan Nieuwenhuizen mes: string->number: Support #x-prefixed hex numbers. * mes/module/mes/scm.mes (string->number): Support "#x"-prefix. * tests/math.test ("string->number #hex"): Test it. 2019-07-27 Jan Nieuwenhuizen 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 (): 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. 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}. mescc: Be silent. * module/mescc/M1.scm (infos->M1, info->M1): Add verbose?. Move debugging into verbose? > 1. * module/mescc/compile.scm (c99-input->info, c99-ast->info): Likewise. (mescc:trace-verbose): Rename from mescc:trace. (mescc:trace): New function. * module/mescc.scm (mescc:main): Likewise. * module/mescc/mescc.scm (mescc:preprocess, c->ast mescc:compile, c->info, E->info): Likewise. * module/mescc/preprocess.scm (c99-input->full-ast, c99-input->ast): Likewise. 2019-07-26 Jan Nieuwenhuizen mescc: Add // to include path. * module/mescc/preprocess.scm (c99-input->full-ast): Add // to include path. * module/mescc/compile.scm (c99-input->info): Pass arch. * module/mescc/mescc.scm (mescc:preprocess): Likewise. (c->info): Likewise. (c->ast): Likewise. mescc: Add 70-function-destruct-declare.c test. * module/mescc/compile.scm (init-declr->info): Do not attempt to re-calculate function type. (ftn-declr:get-type): Remove. * lib/tests/scaffold/70-function-destruct-declare.c: New file. * build-aux/check-mescc.sh (TESTS): Add it. mescc: Resurrect --write. * module/mescc/mescc.scm (mescc:preprocess): Pass pretty-print/write to c->ast. 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. build: Uniquify config macros. * configure (main): Rename VERSION to MES_VERSION, pkgdatadir to MES_PKGDATADIR. Update users. * configure.sh (mes_system): Likewise. * src/mes.c (mes_symbols): Update. (open_boot): Update. * scaffold/cons-mes.c (main): Update. * simple.sh: Update. 2019-07-20 Jan Nieuwenhuizen build: Resurrect --with-cheating. * build-aux/config.sh.in (SCHEME): New substitute. * build-aux/config.make.in: Likewise. * configure: Substitute them. 2019-07-23 Jan Nieuwenhuizen mescc: Support tcc: libtcc1 build fixes. * lib/libtcc1.c: Support building without long long, float support. 2019-06-01 Jan Nieuwenhuizen mescc: Mes C Library: Avoid type/size_t conflicts. * include/alloca.h: Remove typedefs, include sys/types.h. * include/stdint.h: Likewise. * include/string.h: Likewise. 2019-07-17 Jan Nieuwenhuizen mescc: Support tcc: Add intptr_t, uintptr_t. * include/sys/types.h (intptr_t, uintptr_t): Add typedef. 2019-07-21 Jan Nieuwenhuizen 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). 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-20 Jan Nieuwenhuizen 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-19 Jan Nieuwenhuizen mes: Remove broken copy of simple-format. * mes/module/mes/simple-format.mes: New file. * mes/module/mes/guile.mes: Use it. (with-output-to-string, simple-format): Remove broken copies. * mes/module/mes/display.mes (with-output-to-string, simple-format, format): Remove. 2019-07-05 Danny Milosavljevic 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-09 Jan Nieuwenhuizen Revert "test: Disable 60-math.c test." This reverts commit bbe6576a66a520d429bb3ec84120ffcce88480bf. 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-07 Jan Nieuwenhuizen 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-08 Jan Nieuwenhuizen mescc: Use basename of input as default output name. * module/mescc/mescc.scm (mescc:preprocess, mescc:compile, mescc:assemble, M1->hex2): Use basename of input as default output name. 2019-07-06 Jan Nieuwenhuizen 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-08 Jan Nieuwenhuizen 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-06-28 Jan Nieuwenhuizen 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-26 Jan Nieuwenhuizen 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. 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-25 Jan Nieuwenhuizen 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-24 Jan Nieuwenhuizen 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 Jan Nieuwenhuizen porting: Avoid failing in scaffold build. * build-aux/build-scaffold.sh: Do not fail when using courage. 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. test: Oops, uncomment some commented-out tests. * lib/tests/scaffold/55-char-array.c: Uncomment. * lib/tests/scaffold/72-typedef-struct-def.c: Likewise. 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-23 Jan Nieuwenhuizen porting: Add x86_64 scaffold: exit and write in assembly. * lib/x86_64-mes-gcc/exit-42.S: New file. * lib/x86_64-mes-gcc/hello-mes.S: New file. * lib/x86_64-mes/elf64-0exit-42.hex2: New file. * lib/x86_64-mes/elf64-0hello-mes.hex2: New file. * lib/x86_64-mes/elf64-body-exit-42.hex2: Rewrite.. * lib/x86_64-mes/elf64-body-hello-mes.hex2: * lib/x86_64-mes/elf64-0header.hex2: Fix copyright header. * lib/x86_64-mes/elf64-header.hex2: Likewise. * lib/x86_64-mes/elf-0footer.hex2: Remove. 2019-06-13 Jan Nieuwenhuizen 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-10 Jan Nieuwenhuizen 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-05-22 Jan Nieuwenhuizen 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-06-10 Jan Nieuwenhuizen mescc: Drop $@-workaround. * scripts/mescc.in: Drop $@-workaround. 2019-06-08 Jan Nieuwenhuizen 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 Jan Nieuwenhuizen test: Move scaffold/tests into lib. * lib/tests/scaffold: Move from scaffold/tests. * scaffold/tests: Remove. * build-aux/check-mescc.sh: Update. 2019-05-10 Danny Milosavljevic 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-29 Jan Nieuwenhuizen 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. mescc: Use a.out as default executable name. * module/mescc/mescc.scm (hex2->elf): Use a.out as default executable name. mescc: Robustify against empty `V' in environment. * module/mescc.scm: Robustify against empty V in environment. 2019-05-28 Jan Nieuwenhuizen mescc: Fix -dumpmachine to respect -m bits selection. * module/mescc.scm (parse-opts): Fix -dumpmachine to respect -m bits selection. Also display kernel. 2019-05-29 Jan Nieuwenhuizen mescc: Support single-dash options on Mes too. * scripts/mescc.in[MES]: Add -- as separator, fixes using single-dash options on Mes too. mescc: Ignore -fnobuiltin, -nostdinc for GCC compatibility. * module/mescc.scm (parse-opts): Add -fnobuiltin, -nostdinc. (mescc:main): Ignore them. 2019-05-27 Jan Nieuwenhuizen test: Resurrect running boot tests on Guile. * module/mes/guile.scm (keyword->string): New function. * scaffold/boot/43-or.scm (foo): Add quoting. * scaffold/boot/45-pass-if.scm (pass-if): Likewise. * scaffold/boot/46-report.scm (pass-if): Likewise. * scaffold/boot/47-pass-if-eq.scm (pass-if): Likewise. * scaffold/boot/48-let.scm (map): Rename from map1. * scaffold/boot/60-let-syntax-expanded.scm: Some work. 2019-05-26 Jan Nieuwenhuizen mescc: Mes C Library: Fix compile warnings. * lib/stdio/fputc.c (fputc): Oops, stream is a long. * lib/stdlib/malloc.c (malloc): Cast to char *. FIXME * lib/string/memchr.c (memchr): Cast to void *. * lib/string/memcmp.c (memcmp): Add const cast. mescc: Mes C Library: Fixes for x86_64 crt1.c * lib/linux/x86_64-mes/crt1.c (_start): Write only 4 bytes to int variables __stdin, __stdout, __stderr. 2019-05-29 Jan Nieuwenhuizen test: Move srfi-1 for-each and map tests to tests/srfi-1.test. This fixes: `make check MES=guile'. * tests/srfi-1.test ("map 1,2", "map 2,1", "for-each 1,2", for-each 2,1"): Move from scm.test. * tests/scm.test ("map 1,2", "map 2,1", "for-each 1,2", for-each 2,1"): Remove. 2019-05-29 Jan Nieuwenhuizen 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-27 Jan Nieuwenhuizen mes: Bugfix for search-path. Fixes running MesCC on Guile. * module/mescc/mescc.scm (arch-find): Also look in cwd. * mes/module/mes/posix.mes (search-path): Do not look in cwd. 2019-05-25 Jan Nieuwenhuizen 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-27 Jan Nieuwenhuizen mes: Identify 64-bit bug when compiled with MesCC. * src/math.c (divide): Add divide-by-zero error. (modulo): Likewise. * module/mes/guile.scm (%compiler): New variable. * module/mescc/M1.scm (mesc?): New variable. (hex2:immediate8): Use it to avoid divide-by-zero error. * HACKING (Bugs): Add it. mes: Make debug levels 4 and 5 usable. * HACKING: Update debug policy. * lib/linux/read.c (read): Print read in level 5. * src/mes.c (eval_apply): Print module in level 6. (main): Likewise. Remove redundant module printing. * src/gc.c (gc): Print symbols in level 6. 2019-05-18 Jan Nieuwenhuizen mes: Run build-aux/indent.sh. * src/mes.c: Re-indent. * src: Likewise. * include: Likewise. * lib: Likewise. * scaffold: Likewise. 2019-05-12 Jan Nieuwenhuizen 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-15 Jan (janneke) Nieuwenhuizen mes: Support -c EXPR. * mes/module/mes/boot-0.scm.in: Support -c EXPR. mes: Support optional port on read. * mes/module/mes/scm.mes (read): Support optional port on read. 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. 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-14 Jan Nieuwenhuizen mes: Rename strings.c. * src/string.c: Rename from src/strings.c. * src/mes.c * build-aux/snarf.sh: Update. 2019-05-12 Jan Nieuwenhuizen mescc: Mes C Library: Use mes_open to avoid open trickery. * include/mes/lib.h (mes_open): Declare. * lib/libmes.c[WITH_GLIBC]: Remove open undefine. (mes_open)[!WITH_GLIBC]: New function. * src/mes.c (open_boot): Use mes_open. * src/posix.c (open_input_file): Likewise. (open_output_file): Likewise. mescc: Mes C Library: Remove dead code. * lib/glibc.c: Remove. * lib/abtol.c: Remove. mescc: Mes C Library: Explode linux/tcc.c. * lib/linux/close.c: New file. * lib/linux/lseek.c: New file. * lib/linux/rmdir.c: New file. * lib/linux/stat.c: New file. * lib/linux/tcc.c: Include them. (close, lseek, rmdir, stat): Remove. mescc: Mes C Library: Explode linux/libc.c. * lib/linux/access.c: New file. * lib/linux/brk.c: New file. * lib/linux/chmod.c: New file. * lib/linux/dup.c: New file. * lib/linux/dup2.c: New file. * lib/linux/execve.c: New file. * lib/linux/fork.c: New file. * lib/linux/fsync.c: New file. * lib/linux/getcwd.c: New file. * lib/linux/ioctl.c: New file. * lib/linux/libc.c: New file. * lib/linux/open.c: New file. * lib/linux/read.c: New file. * lib/linux/unlink.c: New file. * lib/linux/waitpid.c: New file. * lib/linux/libc.c: Include them. (access, brk, chmod, dup, dup2, execve, fork, fsync, getcwd, ioctl, libc, open, read, unlink, waitpid): Remove. 2019-05-11 Jan Nieuwenhuizen mescc: Mes C Library: Explode linux/gnu.c. * lib/linux/chdir.c: New file. * lib/linux/fcntl.c: New file. * lib/linux/fstat.c: New file. * lib/linux/getdents.c: New file. * lib/linux/getegid.c: New file. * lib/linux/geteuid.c: New file. * lib/linux/getgid.c: New file. * lib/linux/getpid.c: New file. * lib/linux/getppid.c: New file. * lib/linux/getrusage.c: New file. * lib/linux/getuid.c: New file. * lib/linux/kill.c: New file. * lib/linux/link.c: New file. * lib/linux/lstat.c: New file. * lib/linux/mkdir.c: New file. * lib/linux/nanosleep.c: New file. * lib/linux/pipe.c: New file. * lib/linux/rename.c: New file. * lib/linux/setgid.c: New file. * lib/linux/settimer.c: New file. * lib/linux/setuid.c: New file. * lib/linux/signal.c: New file. * lib/linux/sigprogmask.c: New file. * lib/linux/gnu.c: Include them. (chdir, fcntl, fstat, getdents, getegid, geteuid, getgid, getpid, getppid, getrusage, getuid, kill, link, lstat, mkdir, munmap, nanosleep, pipe, rename, setgid, settimer, setuid, signal, sigprogmask): Remove. 2019-05-09 Jan Nieuwenhuizen mescc: Mes C Library: Explode libc-mini.c. * lib/posix/write.c: New file. * lib/linux/libc-mini.c: Include it. (write): Remove. * lib/tests/mes/30-oputs.c: Remove dead code. 2019-05-07 Jan Nieuwenhuizen mescc: Mes C Library: Cleanup includes. * include/mes/lib-mini.h: Move from include/libmes-mini.h. Update users. * include/mes/lib.h: Move from include/libmes.h. Update users. 2019-05-05 Jan Nieuwenhuizen mescc: Support -nodefaultlibs, -nostartfiles, -nostdlib. * module/mescc.scm (parse-opts): Parse -nodefaultlibs, -nostartfiles, -nostdlib. * module/mescc/mescc.scm (mescc:link): Handle -nodefaultlibs, -nostdlib. (hex2->elf): Handle -nostartfiles, -nostdlib. 2019-05-03 Jan Nieuwenhuizen build: Do not install test binaries. * build-aux/install.sh.in: Do not install test binaries. 2019-05-05 Jan Nieuwenhuizen mes: m2: Move force-output to Scheme. * mes/module/mes/posix.mes (force-output): New function. * src/posix.c (force_output): Remove. * src/mes.c (mes_builtins): Remove adding of force-output. 2019-03-23 Jan Nieuwenhuizen build: M2-Planet first-aid, simplest build script possible. * simple.sh: New file. 2019-03-27 Jan Nieuwenhuizen .dir-locals.el: Assert default GNU settings. * .dir-locals.el: Assert default GNU settings. Fix typo in stage0 copyright headers. * lib/x86-mes/elf-0footer.hex2: Fix typo. * lib/x86-mes/elf32-0header.hex2: Fix typo. * lib/x86-mes/elf32-body-exit-42.hex2: Fix typo. * lib/x86-mes/elf32-footer-single-main.hex2: Fix typo. * lib/x86-mes/elf32-header.hex2: Fix typo. * lib/x86_64-mes/elf-0footer.hex2: Fix typo. * lib/x86_64-mes/elf64-0header.hex2: Fix typo. * lib/x86_64-mes/elf64-body-exit-42.hex2: Fix typo. * lib/x86_64-mes/elf64-footer-single-main.hex2: Fix typo. * lib/x86_64-mes/elf64-header.hex2: Fix typo. 2019-03-16 Jan Nieuwenhuizen mescc: Mes C Library: Fix ungetc. * include/sys/resource.h (OPEN_MAX, RLIMIT_NOFILE): New macro. * lib/libc.c: Add memset.c include. * lib/libc+tcc.c: Remove memset.c include. * lib/linux/tcc.c (close): * lib/mes/fdgetc.c (__ungetc_buf): New global. (_ungetc_pos, _ungetc_fd, _ungetc_buf): Remove. Update users. * scaffold/tests/65-read.c: Update. 2019-03-23 Jan Nieuwenhuizen 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-03 Jan Nieuwenhuizen mescc: Mes C Library: Fix compile warnings. * include/libmes.h (dtoab, itoa, ltoa, ntoab, ultoa, utoa): Return char* (WAS: char const*). * lib/*/*c: Update, add missing includes. 2019-03-02 Jan Nieuwenhuizen mescc: Mes C Library: Fix isatty. * lib/posix/isatty.c (isatty): Test ioctl == 0. * mes/module/mes/boot-0.scm.in: Update: no tty?: read from stdin. 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. mes: Support map and for-each with lists of unequal length. * mes/module/mes/base.mes (map): Support lists of unequal length. * mes/module/mes/scm.mes (for-each): Likewise. * module/mescc/compile.scm (expr->register): Fix compile warning. * tests/scm.test ("map 1,2", "map 2,1", "for-each 1,2", "for-each 2,1": Test it. mescc: Mes C Library: Use __ as global internal prefix. * include/libmes-mini.h (g_stdin, g_stdout, g_stderr): Rename to __stdin, __stdout, __stderr. Update users. 2019-02-28 Jan Nieuwenhuizen mescc: ctype.h: Add missing prototypes. * include/ctype.h: Add missing prototypes. mescc: Mes C Library: Bugfix for tcc-compiled exit assembly. * lib/linux/x86-mes-gcc/mini.c (_exit): Add clobbered registers %eax, %ebx. Fixes always exit 1. 2019-02-25 Jan Nieuwenhuizen 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. 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-18 Jan Nieuwenhuizen build: Configure: remove temp files. * configure (gulp-pipe*): Remove .error. (check-header-c): Remove .config.c. (check-compile-c): Likewise. (check-link-c): Likewise. build: Remove mini-mes. * scaffold/mini-mes.c: Remove. * build-aux/build-mes.sh: Remove commented build instructions. * .gitignore: Remove pattern. 2019-02-24 Jan Nieuwenhuizen mescc: Mes C Library: Initialize streams in crt1. * lib/linux/x86-mes-gcc/crt1.c: Initialize streams. * lib/linux/x86-mes/crt1.c: Likewise. * lib/linux/x86_64-mes-gcc/crt1.c: Likewise. * lib/linux/x86_64-mes/crt1.c: Likewise. * src/mes.c (main): Remove initialization of streams. 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 Jan Nieuwenhuizen 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 Jan Nieuwenhuizen mes: Remove stray debugging newline output. * mes/module/mes/guile.mes (open-input-file): Move debugging newline into debug clause. mescc: Mes C Library: Fix brk return type compare. * lib/stdlib/malloc.c (malloc): Fix brk return type compare. core: Rename load_env to read_boot. * src/mes.c (read_boot): Rename from load_env; Update users. (open_boot): Rename from load_boot; Update users. 2019-02-10 Jan Nieuwenhuizen core: Initialize g_buf dynamically, add MES_STRING_MAX override. * src/mes.c (g_buf, MAX_STRING): Move from strings.c. (gc_init_cells): Initialize g_buf dynamically. (main): Add environment override MES_MAX_STRING for MAX_STRING. * doc/mes.texi (Environment Variables): Document it. 2019-02-03 Jan Nieuwenhuizen 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-15 Jan Nieuwenhuizen core: Resurrect POSIX build. Thanks, gio! * lib/libmes.c[POSIX]: Define and initialize g_stdin, g_stdout and g_stderr that were moved to crt1 for non-POSIX builds. * src/mes.c[POSIX]: Remove struct-initialisation exceptions. 2019-01-04 Jan Nieuwenhuizen 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 . (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 Jan Nieuwenhuizen core: Remove struct definitions for cells, drop snarfing for symbols. * src/mes.c (init_symbol): New function. (mes_symbols): Use it. (scm_nil, ... scm_test): Remove. 2018-12-27 Jan Nieuwenhuizen mes: Add take-while. * mes/module/srfi/srfi-1.mes (take-while): New function. 2018-12-26 Jan Nieuwenhuizen mescc: Enhance POSIX command-line support, e.g. -DFOO=1. * module/mescc.scm (unclump-single): New function. (main): Use it to support -DFOO=bar, and equivalent. 2018-12-27 Jan Nieuwenhuizen build: Support running out-of-tree. * build-aux/pre-inst-env.in (MES_PREFIX): Use absolute name. core: Remove string debugging. * src/strings.c (make_bytes, make_string, string_equal_p, symbol_to_string, symbol_to_keyword, make_symbol): Remove string debugging. core: Remove --dump, --load. * mes/module/mes/boot-0.scm.in (tty?): Remove --dump, --load. * src/mes.c (bload_env): Remove. * src/reader.c (dump): Remove. 2018-12-16 Jan Nieuwenhuizen doc: Post-release update. * doc/announce/ANNOUNCE-0.19: Update. Release 0.19. * configure (VERSION): Update to 0.19. (main): Likewise. * configure.sh (VERSION): Likewise. * guix/git/mes.scm (mes, mes.git): Likewise. 2018-10-20 Jan Nieuwenhuizen 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-12-15 Jan Nieuwenhuizen mes: assq-ref, assoc-ref: Support alist == #f. * mes/module/mes/scm.mes (assq-ref): Support alist == #f. (assoc-ref): Likewise. core: Bump MAX_STRING to 524288 * src/strings.c (MAX_STRING): Bump to 524288. (assert_max_string): New function. (list_to_cstring, string_append, read_string): Use it. * src/reader.c (reader_read_string): Use it. 2018-12-14 Jan Nieuwenhuizen mescc: Support Bash: Add getppid. * lib/linux/gnu.c (getppid): New function. * include/linux/x86/syscall.h (SYS_getppid): New macro. * include/linux/x86_64/syscall.h (SYS_getppid): New macro. mescc: Support bash: Add sigdelset stub. * lib/stub/sigdelset.c (sigdelset): New stub. * lib/libc+gnu.c: Include it. 2018-12-07 Jan Nieuwenhuizen mescc: getcwd: Support getcwd (0, 0) GNU extension. * lib/linux/libc.c (_getcwd): Rename from getcwd. (_getcwd): New function. Support getcwd (0, 0) GNU extension. 2018-12-02 Jan Nieuwenhuizen mescc: Replace \r in comments. * module/mescc/compile.scm (ast->comment): Replace \r in comments. 2018-11-24 Jan Nieuwenhuizen 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-25 Jan Nieuwenhuizen 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-15 Jan Nieuwenhuizen core: Add string-ref. * src/strings.c (string_ref): New function. * mes/module/mes/scm.mes (string-ref): Remove. core: Add string-length. * src/strings.c (string_length): New function. * mes/module/mes/scm.mes (string-length): Remove. 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-11 Jan Nieuwenhuizen core: String as array of bytes. * src/strings.c: New file. * src/mes.c: Use it. Update users. 2018-11-25 Jan Nieuwenhuizen mescc: Move mecmp to libc. * lib/libc.c: Include mecmp.c. * lib/libc+tcc.c: Remove mecmp.c include. 2018-11-15 Jan Nieuwenhuizen mescc: Move memchr to libc. * lib/libc.c: Include memchr.c. test: Use write instead of display. * module/mes/test.scm (seq?, sequal?, seq2?, sless?, sequal2?): Use write for expected, actual. 2018-11-14 Jan Nieuwenhuizen core: struct_set_: Oops typo. * src/struct.c (struct_set_x_): Oops, remove indirection. mes: Remove copy of make-string. * mes/module/mes/guile.mes (make-string): Remove copy. mescc: Compile fixes. * include/libmes-mini.h[WITH_GLIBC]: Do not declare strlen, write, types. 2018-11-11 Jan Nieuwenhuizen mes: Oops, %moduledir debug info. * mes/module/mes/boot-0.scm.in: Oops, %moduledir debug info. build: configure: Support Mes. * configure: Support Mes. mes; Add read-line. * mes/module/mes/guile.mes (read-line): New function. mes: dirname: Fix for absolute file names. * mes/module/mes/guile.mes (dirname): Fix absolute files. mes: Add file-exists?. * mes/module/mes/guile.mes (file-exists?): New function. mes: Add with-error-to-file. * mes/module/mes/guile.mes (with-error-to-file): New function. mes: Add string-downcase, string-upcase, string-tokenize. * mes/module/srfi/srfi-13.mes (string-downcase, string-upcase, string-tokenize): New function. mes: Add char-downcase, char-upcase. * mes/module/srfi/srfi-14.mes (char-downcase, char-upcase): New function. mes: Add char-set:digit, char-set:lower-case, char-set:upper-case. * mes/module/srfi/srfi-14.mes (char-set:digit, char-set:lower-case, char-set:upper-case): New variable. mes: Add char-set-adjoin, char-set-complement. * mes/module/srfi/srfi-14.mes (char-set-adjoin, char-set-complement): New function. mes: system*: Support redirection. * mes/module/mes/posix.mes (system*): Support redirection. core: read_string: Allow for gc. * src/posix.c (read_char): Add optional port parameter. (read_string): Allow for gc. core: Add delete_file. * src/posix.c (delete_file): New function. core: Add dup, dup2. * src/posix.c (dup_, dup2_): New function. core: Add getcwd. * src/posix.c (getcwd_): New function. core: Support redirection of stderr. * include/libmes-mini.h (g_stderr): New global. * lib/mes/eputc.c (eputc): Use it. * lib/mes/eputs.c (eputs): Likewise. * lib/mes/oputc.c (oputc): Likewise. * lib/mes/oputs.c (oputs): Likewise. * src/lib.c (display_error_, write_error_): Likewise. * src/posix.c (write_byte): Likewise. * src/mes.c (mes_builtins): Likewise. (main): Iniitalize g_stderr. * src/posix.c (current_error_port, set_current_error_port): New function. * mes/module/mes/boot-0.scm.in (current-output-port, current-error-port): Remove. core: Assert g_free in alloc. * src/mes.c (alloc): Assert g_free. mescc: unlink: Move to libc. * lib/linux/libc.c (unlink): New function. * lib/linux/tcc.c (unlink): Remove. mescc: dup, dup2: Move to libc. * lib/linux/libc.c (dup, dup2): New function. * lib/linux/gnu.c (dup, dup2): Remove. mescc: getcwd: Move to libc. * lib/linux/libc.c (getcwd): New function. * lib/linux/tcc.c (getcwd): Remove. 2018-11-10 Jan Nieuwenhuizen mescc: Support GNU make with POSIX. * include/linux/x86/syscall.h (SYS_sigprocmask): New macro. * include/linux/x86_64/syscall.h (SYS_rt_sigprocmask): New macro. * include/signal.h (SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK): New macro. (sigprocmask): Declare. * lib/linux/gnu.c (sigprocmask): New function. 2018-11-09 Jan Nieuwenhuizen mescc: Support GNU Bash. * include/errno.h (EACCES, ENOSPC, ESPIPE): New macro. * include/linux/x86/syscall.h (SYS_setuid, SYS_geteuid, SYS_getegid, SYS_setgid): New macro. * include/linux/x86_64/syscall.h: Likewise. * include/stdint.h (LLONG_MIN, LLONG_MAX, SIZE_MAX): New macro. * include/sys/stat.h (S_ISUID, S_ISGID, S_IXGRP, S_IXOTH, S_IRGRP, S_IROTH, S_IWGRP, S_IWOTH, S_IRWXG, S_IRWXO): New macro. * include/termio.h: New file. * include/unistd.h (_POSIX_VERSION): New macro. * lib/linux/gnu.c (geteuid, getegid, setuid, setgid): New function. * lib/string/memchr.c: New file. * lib/stub/getpwuid.c: New file. * lib/stub/rand.c: New file. * lib/stub/ttyname.c: New file. * include/string.h (memchr): Declare. * include/unistd.h (geteuid, getegid, setuid, setgid): Declare. 2018-11-06 Jan Nieuwenhuizen 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-09 Jan Nieuwenhuizen mescc: Add missing define. * lib/x86-mes/x86.M1: Add missing define. 2018-11-08 Jan Nieuwenhuizen mescc: Exit if library cannot be found. * module/mescc/mescc.scm (arch-find): Exit upon failure. mescc: Accept -O, --std, -x. * scripts/mescc.in (parse-opts): Accept -O, --std, -x. mescc: Support -dumpmachine. * scripts/mescc.in (parse-opts): Support -dumpmachine. 2018-10-22 Jan Nieuwenhuizen 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-21 Jan Nieuwenhuizen 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. mes: Add ceil, floor, round, inexact->exact. * mes/module/mes/scm.mes (ceil, floor, round, inexact->exact, exact->inexact): New function. mes: read-string: Take optional port argument. * src/posix.c (read_string): Take optional port argument. * mes/module/mes/guile.mes (read-string): Remove. core: eval_apply: Order gotos according to frequency. * src/mes.c (eval_apply): Order gotos according to frequency. Revert "core: eval_apply profile." This reverts commit d61e6be0b18459a8e3c262eab448b428dc81937a. core: eval_apply profile. * src/mes.c: Poor man's eval_apply profile. 2018-10-20 Jan Nieuwenhuizen core: Fix displaying of closure. * src/lib.c (display_helper): Fix displaying of closure. mes: Print backtrace upon exception. * mes/module/mes/catch.mes (display-backtrace, frame-function): New function. (%eh): Use them. core: Set procedure in stack frame. * src/mes.c (eval_apply): Set procedure in stack frame. core: Implement stack and frame. * src/lib.c (frame_printer make_frame_type, make_frame, make_stack_type, make_stack, stack_length, stack_ref): New function. core: Support time functions. * lib/linux/clock_gettime.c: New file, move from gnu.c. * lib/linux/gettimeofday.c: New file, move from tcc.c. * lib/linux/time.c: New file, move from tcc.c. * lib/linux/libc.c: Include them. * lib/linux/gnu.c (clock_gettime): Remove. * lib/linux/tcc.c (time, gettimeofday): Remove. * include/time.h (CLOCK_PROCESS_CPUTIME_ID): New define. * src/posix.c (init_time, current_time, gettimeofday_, seconds_and_nanoseconds_to_long, get_internal_run_time): New function. * src/mes.c (scm_symbol_internal_time_units_per_second): New symbol. (main): Call init_time. 2018-10-18 Jan Nieuwenhuizen core: Use hash table for symbols. * src/mes.c (mes_symbols): Use hash table for symbols. Update users. 2018-10-19 Jan Nieuwenhuizen core: Use assert before failure exit. * src/mes.c (error): Use assert before failure exit. Helps debugging. 2018-10-18 Jan Nieuwenhuizen core: Add hashq_get_handle, hash, hash_ref, hash_set_x. * src/mes.c (scm_symbol_hashq_table, scm_symbol_record_type, scm_symbol_module, scm_symbol_buckets, scm_symbol_size): New symbols. Update users. * src/hash.c (hash_list_of_char): Rename from hashq_. Respect size, update callers. (hashq_, hash_ hash, hashq_get_handle, hash_ref, hash_set_x_, hash_set_x): New function. (hashq_ref): Do not return handle. Update callers. mes: Move pair? to core. * src/lib.c (pair_p): New function. Gains 8% performance on MesCC. 2018-10-19 Jan Nieuwenhuizen mes: Move assoc to core. * mes/mes.c (assoc_string, assoc): New function. * mes/module/mes/scm.mes (assoc): Remove. Gains 12% performance for MesCC. 2018-10-20 Jan Nieuwenhuizen Revert "core: Add gc-debug for stack array." This reverts commit f35084d1dbea889d107824e7596da1701c6b90ad. 2018-10-19 Jan Nieuwenhuizen core: Add gc-debug for stack array. * src/gc.c (gc_debug): New function. scaffold: Resurrect mini-mes. * src/mini-mes.c: Resurrect. 2017-12-14 Jan Nieuwenhuizen core: Use array-based stack. * src/mes.c (STACK_SIZE)[MES_ARRAY_STACK]: New variable. (g_stack_array): New variable. (g_stack): Change type to SCM*. (gc_push_frame)[MES_ARRAY_STACK]: Use g_stack_array, g_stack. (gc_peek_frame): Likewise. (gc_pop_frame): Likewise. * src/gc.c (gc_check): Likewise. (gc): Likewise. 2018-10-17 Jan Nieuwenhuizen mes: Resurrect Guile-1.8 support. * module/mes/mes-0.scm: Resurrect Guile-1.8 support. 2018-10-16 Jan Nieuwenhuizen core: expand_variable: Remove weird exceptions: begin, if. * src/mes.c (expand_variable_): Remove weird exceptions: begin, if. 2018-10-15 Jan Nieuwenhuizen mes: Switch to srfi-9 based on structs. * mes/module/srfi/srfi-9.mes: Swap symlink to srfi-9-struct.mes. * mes/module/srfi/srfi-9/gnu.mes: Swap symlink to gnu-struct.mes. * src/module.c (make_module_type): Update to match srfi-9-struct records. Update users. * src/hash.c (make_hashq_type): Likewise. mes: srfi-9: Add implementation based on struct. * mes/module/srfi/srfi-9-struct.mes: New file. * mes/module/srfi/srfi-9-vector.mes: Rename from srfi-9.mes * mes/module/srfi/srfi-9.mes: Symlink to srfi-9-vector.mes. * mes/module/srfi/srfi-9/gnu-struct.mes: Add srfi-9-struct implementation. * mes/module/srfi/srfi-9/gnu-vector.mes: Rename from gnu.mes. * mes/module/srfi/srfi-9/gnu.mes: Symlink to gnu-vector.mes. core: hashq-table: Refactor to be a record-like struct. * src/hash.c (hash_table_printer): New function. (make_hashq_type): New function. * src/module.c (module_printer): Use it. (make_module_type): New function. (make_initial_module): Use them. mescc: Mes C Library: oputs: New function. * lib/mes/oputc.c: New file. * lib/libmes.c: Include it. * include/libmes.h: Declare it. core: Use hashq-table for macros. * src/mes.c (lookup_macro_): Remove. (macro_ref, get_macro, macro_set_x): New function. Update callers. 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. core: Add boot-module. * src/mes.c (scm_symbol_boot_module): New symbol. (eval_apply): Handle it. (mes_symbols): Initialize it. 2018-10-14 Jan Nieuwenhuizen 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. core: Add module indirection for variable lookup. * src/module.c (module_ref, module_variable): New function. * src/mes.c: Thoughout: Use them. (assq_ref_env): Remove. * mes/module/mes/boot-0.scm.in (defined?): Use module-variable. * mes/module/mes/boot-00.scm (defined?): Likewise. * mes/module/mes/boot-01.scm (defined?): Likewise. * mes/module/mes/boot-02.scm (defined?): Likewise. * scaffold/boot/53-closure-display.scm: Likewise. core: Add module type. * src/module.c: New file. * build-aux/snarf.sh: Snarf it. * src/mes.c: Include it. 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-13 Jan Nieuwenhuizen core: Add struct type. * src/struct.c: New file. * build-aux/snarf.sh: Snarf it. * src/mes.c: Include it. 2018-10-15 Jan Nieuwenhuizen 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. core: core:cdr: Support port type. * src/mes.c (cdr_): Support port type. * mes/module/mes/display.mes (display): Add space between fields. mes: with-fluids: Fix reset. * mes/module/mes/fluids.mes (with-fluids): Fix reset. * tests/fluids.test (report): Remove Mes failure expectation. 2018-10-19 Jan Nieuwenhuizen mescc: Recognize U integer suffix. * module/mescc/compile.scm (cstring->int): Recognize U integer suffix. Thanks, Peter de Wachter! 2018-10-16 Peter De Wachter mescc: Add INTn_MIN/MAX defines to stdint.h. * include/stdint.h: Add INTn_MIN/MAX defines. Move integere size defines from limits.h * include/limits.h: Include it. 2018-10-16 Peter De Wachter mescc: Allow superfluous parentheses in function declarations. E.g.: int (f)(); This is obscure but valid C. It occurs in the csmith headers (thanks to macro shenanigans). * module/mescc/compile.scm (fctn-defn:get-name, fctn-defn:get-statement): Allow superfluous parentheses in function declarations. 2018-10-16 Peter De Wachter mescc: Implement unary plus operator. * module/mescc/compile.scm (ast->type, expr->register, try-expr->number):): Implement unary plus operator. mescc: Add missing assembly defines. * lib/x86-mes/x86.M1: Add missing assembly defines. * lib/x86_64-mes/x86_64.M1: Likewise. mescc: Delete duplicate assembly defines. * lib/x86-mes/x86.M1: Delete duplicate assembly defines. * lib/x86_64-mes/x86_64.M1: Likewise. 2018-10-16 Peter De Wachter mescc: Exit with non-zero exit code when subprocess fails. system* returns the result of waitpid. So, suppose that a subprocess fails with exit code 1. Then the waitpid return value will be 256. And exit(256) is equivalent to exit(0). Modified-by: Jan Nieuwenhuizen * mes/module/mes/posix.mes (status:exit-val): New function. * module/mescc/mescc.scm (assert-system*): Use it. 2018-10-12 Jan Nieuwenhuizen mescc: Oops typo. * module/mescc/M1.scm (hex2:immediate8): Typo. 2018-12-13 Jan Nieuwenhuizen 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-11-18 Jan Nieuwenhuizen build: configure: Make dot optional. * configure: Make dot optional. 2018-10-11 Jan Nieuwenhuizen build: Oops, remove stray lib/linux/x86_64-mes/crt1. * lib/linux/x86_64-mes/crt1: Remove. 2018-10-10 Jan Nieuwenhuizen 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-08 Jan Nieuwenhuizen doc: Release update. mescc: Oops, delete wrong line of assembly. * lib/x86-mes/x86.M1 (movzbl_%bx,%ebx): Delete wrong line. Thanks, pdewacht! 2018-10-07 Jan Nieuwenhuizen admin: Release update. * doc/announce/ANNOUNCE-0.18: New file. * guix/git/mes.scm (mes): Update hash. 2018-10-04 Jan Nieuwenhuizen Release 0.18. * configure (VERSION): Update to 0.18. (main): Likewise. * configure.sh (VERSION): Likewise. * guix/git/mes.scm (mes, mes.git): Likewise. * guix/mescc-tools-boot.patch: New file. 2018-09-05 Jan Nieuwenhuizen doc: Release update. * BOOTSTRAP: Update. * HACKING: Update. * NEWS: Update. * README: Update. * doc/mes.texi (Submitting Patches): Fix misquoting, misattribution. 2018-10-07 Jan Nieuwenhuizen mescc: Another attempt at divide. * module/mescc/i386/as.scm (i386:r0/r1): Never be signed. Use div for unsigned. (i386:r0%r1): Likewise. * module/mescc/x86_64/as.scm (x86_64:r0/r1): Likewise. (x86_64:r0%r1): Likewise. * lib/x86-mes/x86.M1: Add div. * lib/x86_64-mes/x86_64.M1: Likewise. tests: Expect srfi-13 failure, MesCC more resembles Gcc. * tests/srfi-13.test (report): Expect INT-MIN failure for x86. 2018-10-06 Jan Nieuwenhuizen core: reader: Support 64 bit. * src/reader.c (reader_read_identifier_or_number): Support 64 bit. (reader_read_binary): Likewise. (reader_read_octal): Likewise. (reader_read_hex): Likewise. mescc: Mes C Library: Fix execve on x86_64. * include/linux/x86_64/syscall.h (SYS_execve): Typo. Fixes execve on x86_64. 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. mes: Support fold-right 3. * mes/module/srfi/srfi-1.mes (fold-right): Support fold-right 3. * tests/srfi-1.test ("fold-right-3"): Test it. mescc: Nyacc comment escapes. * module/mescc/compile.scm (ast->comment): Nyacc comment escapes. mescc: Fix clobbering of struct by value assign. * module/mescc/x86_64/as.scm (long-r0->r1-mem): New instruction. * module/mescc/i386/as.scm: Likewise. * lib/x86_64-mes/x86_64.M1: Support it. * module/mescc/compile.scm (r0->r1-mem*n-): Fix clobbering. core: Add vector test. * scaffold/boot/11-vector.scm: New test. * build-aux/check-boot.sh: Run it. mescc: Fix obnoxious assignment ERROR message. * module/mescc/compile.scm (expression->register): Fix assignment ERROR message. core: Avoid 64bit zero divide. * src/math.c (divide): Avoid (64bit) 0 divide. (modulo): Likewise. 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. 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. Revert "mescc: Make globals at least reg-size." This reverts commit 30544316c35ed4a2472f2029beb27e007d913792. mescc: Make globals at least reg-size. * module/mescc/compile.scm (global->info): Make globals at least reg-size. 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. core: Use proper name for %compiler. * src/mes.c (mes_symbols, bload_env): : Use proper name for %compiler. core: Resurrect MES_MINI for non-POSIX. src/mes.c[MES_MINI,!POSIX]: Resurrect. mescc: Mes C Library: Add ultoa. * lib/mes/ultoa.c: New file. * lib/libmes.c: Include it. * include/libmes.h: Declare ultoa. mescc: Mes C Library: Add ltoa. * lib/mes/ltoa.c: New file. * lib/libmes.c: Include it. * include/libmes.h: Declare ltoa. 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. 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-05 Jan Nieuwenhuizen 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! build: remove bashism. * build-aux/trace.sh (trace): Remove bashism. Thanks pdewacht! 2018-10-04 Jan Nieuwenhuizen 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. build: Oops, set VERSION. * build-aux/install.sh.in (VERSION): New substituted variable. 2018-09-30 Jan Nieuwenhuizen build: Resurrect make seed. * build-aux/GNUmakefile.in (seed): Resurrect. * build-aux/build-x86_64-mes.sh: Build from seed. 2018-08-15 Jan Nieuwenhuizen 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): mescc: x86_64 support: Add tests. 2018-08-14 Jan Nieuwenhuizen mescc: Initial x86_64 support. make all-go && MES=guile ./pre-inst-env scripts/mescc -m64 -c scaffold/main.c 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-09-16 Jan Nieuwenhuizen emacs: Add disassembly helpers. * .dir-locals.el (as-32, as-64): Add disassembly helpers. 2018-09-11 Jan Nieuwenhuizen guix: nyacc-for-mes: Update to 0.86.0. * guix/git/mes.scm (nyacc-for-mes): Update to 0.86.0 plus fix binary literals. mescc: Support gcc-3.0: Locale header fix. * include/locale.h (LC_ALL, LC_NUMERIC): Numbers, not strings. (LC_COLLATE, LC_CTYPE): New macro. 2018-09-09 Jan Nieuwenhuizen build: Oops, fix ./check.sh for bootstrap build. * build-aux/config.sh (top_builddir): Set default to `.'. 2018-09-05 Jan Nieuwenhuizen guix: nyacc-for-mes: Update to 0.85.3. * guix/git/mes.scm (nyacc-for-mes): Update to 0.85.3. mes: Support Nyacc 0.85.3: Integrate progress. * mes/module/nyacc/lang/sx-util.mes: New file. * mes/module/nyacc/version.mes: New file. * mes/module/nyacc/lang/c99/cpp.mes (nyacc): Include them. * mes/module/nyacc/lang/c99/parser.mes (nyacc): Include them. * module/mescc/preprocess.scm (need-progress): New function. (progress): New function. (insert-progress-monitors): Use them to Integrate progress. mes: Support Nyacc 0.85.3: Add char-set-copy. * mes/module/srfi/srfi-14.mes (char-set-copy): New function> 2018-09-04 Jan Nieuwenhuizen 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. guix: Update hash. * guix/git/mes.scm (mes): Update hash. 2018-09-03 Jan Nieuwenhuizen 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-08-09 Jan Nieuwenhuizen doc: Release update. * HACKING (prefix): Update. * INSTALL (http): Update. * NEWS: Update. * README (C-compiler): Update. * doc/announce/ANNOUNCE-0.17: Update. 2018-09-03 Jan Nieuwenhuizen build: ALlow releasing from worktree. * build-aux/GNUmakefile.in (COMMIT): Check for .git file. 2018-09-01 Jan Nieuwenhuizen mescc: Mes C Library: Do not redefine size_t. * include/stddef.h: Do not redefine size_t. 2018-08-27 Jan Nieuwenhuizen mescc: Mes C Library: Support make 3.80: Add setlocale, sigaddset. * include/limits.h (ULONG_MAX): New macro. * include/locale.h (LC_ALL, LC_NUMERIC): New macro. * lib/stub/setlocale.c: New file. * lib/stub/sigaddset.c: New file. * lib/libc+gnu.c: Include them. 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-26 Jan Nieuwenhuizen mescc: Mes C Library: Support make: Implement clock_gettime, time. * include/linux/x86/syscall.h (SYS_time, SYS_clock_gettime, SYS_gettimeofday): New macro. * include/linux/x86_64/syscall.h (SYS_time, SYS_clock_gettime, SYS_gettimeofday): New macro. * lib/linux/tcc.c (gettimeofday, time): New function. * lib/linux/gnu.c (clock_gettime): New function. * include/time.h: Declare it. * lib/stub/gettimeofday.c: Remove. * lib/stub/time.c: Remove. mescc: Mes C Library: Support make: Support main with envp. * lib/linux/x86-mes-gcc/crt1.c (_start): Also push envp. * lib/linux/x86-mes/crt1.c (_start): Also push envp. * lib/linux/x86_64-mes-gcc/crt1.c (_start): Also mov environment,%rdx. mescc: Mes C Library: Support make: Add chdir, getlogin, setvbuf, sigblock. * lib/stub/getlogin.c: New file. * lib/stub/setvbuf.c: New file. * lib/stub/sigblock.c: New file. * lib/libc+gnu.c: Include them. * include/linux/x86/syscall.h (SYS_chdir): New macro. * include/linux/x86_64/syscall.h (SYS_chdir): New macro. * include/stdio.h (_IOFBF, _IOLBF, _IONBF): New macro. * include/errno.h (ENOEXEC, ECHILD): New macro. * include/sys/wait.h (WNOHANG): New macro. * lib/linux/gnu.c (chdir): New function. * include/ar.h: New file. mescc: Mes C Library: Support diffutils: Add execl. * include/limits.h (CHAR_MAX): New macro. * lib/posix/execl.c: New file. * include/unistd.h: Declare it. 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-21 Jan Nieuwenhuizen 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-19 Jan Nieuwenhuizen test: Cleanup includes. * scaffold/tests/30-strlen.c: Include only libmes-mini.h * scaffold/tests/31-eputs.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. mescc: Cleanup includes. * include/libmes-mini.h: New file. * include/libmes.h: Use it. 2018-08-15 Jan Nieuwenhuizen 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-16 Jan Nieuwenhuizen check-mescc: c-mini 2018-08-24 Jan Nieuwenhuizen mescc: Mes C Library: Explode libc+gnu.c. * modified: include/math.h: Add declarations. * lib/posix/getopt.c: Rename from lib/getopt.c. * lib/gcc.c: Remove. * lib/m4.c: Remove. * lib/ctype/isalnum.c: New file, explode from libc+gnu.c. * lib/ctype/isalpha.c: Likewise. * lib/ctype/isascii.c: Likewise. * lib/ctype/iscntrl.c: Likewise. * lib/ctype/isnumber.c: Likewise. * lib/ctype/isprint.c: Likewise. * lib/ctype/ispunct.c: Likewise. * lib/math/fabs.c: Likewise. * lib/posix/alarm.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/raise.c: Likewise. * lib/posix/sbrk.c: Likewise. * lib/posix/sleep.c: Likewise. * lib/posix/unsetenv.c: Likewise. * lib/stdio/clearerr.c: Likewise. * lib/stdio/fdgets.c: Likewise. * lib/stdio/feof.c: Likewise. * lib/stdio/fgets.c: Likewise. * lib/stdio/fileno.c: Likewise. * lib/stdio/freeopen.c: Likewise. * lib/stdio/freopen.c: Likewise. * lib/stdio/perror.c: Likewise. * lib/stdlib/__exit.c: Likewise. * lib/stdlib/abs.c: Likewise. * lib/stdlib/atexit.c: Likewise. * lib/stdlib/atol.c: Likewise. * lib/stdlib/bsearch.c: Likewise. * lib/stdlib/mbstowcs.c: Likewise. * lib/string/bcmp.c: Likewise. * lib/string/bcopy.c: Likewise. * lib/string/bzero.c: Likewise. * lib/string/index.c: Likewise. * lib/string/rindex.c: Likewise. * lib/string/strcspn.c: Likewise. * lib/string/strdup.c: Likewise. * lib/string/strerror.c: Likewise. * lib/string/strncat.c: Likewise. * lib/string/strpbrk.c: Likewise. * lib/string/strspn.c: Likewise. * lib/stub/__cleanup.c: Likewise. * lib/stub/atof.c: Likewise. * lib/stub/chown.c: Likewise. * lib/stub/ctime.c: Likewise. * lib/stub/fpurge.c: Likewise. * lib/stub/freadahead.c: Likewise. * lib/stub/frexp.c: Likewise. * lib/stub/fscanf.c: Likewise. * lib/stub/getpwnam.c: Likewise. * lib/stub/gmtime.c: Likewise. * lib/stub/pclose.c: Likewise. * lib/stub/popen.c: Likewise. * lib/stub/rewind.c: Likewise. * lib/stub/setbuf.c: Likewise. * lib/stub/sigsetmask.c: Likewise. * lib/stub/strftime.c: Likewise. * lib/stub/sys_siglist.c: Likewise. * lib/stub/system.c: Likewise. * lib/stub/times.c: Likewise. * lib/stub/umask.c: Likewise. * lib/stub/utime.c: Likewise. * lib/libc+gnu.c: Include explodings. * lib/libg.c: Likewise. * lib/libgetopt.c: Include explodings. 2018-08-22 Jan Nieuwenhuizen mescc: Mes C Library: Explode libc+tcc.c. * include/libmes.h: Add declarations. * include/string.h: Likewise. * lib/ctype/islower.c: New file, explode from lib/libc+tcc.c. * lib/ctype/isupper.c: Likewise. * lib/ctype/tolower.c: Likewise. * lib/ctype/toupper.c: Likewise. * lib/mes/search-path.c: Likewise. * lib/posix/execvp.c: Likewise. * lib/stdio/fclose.c: Likewise. * lib/stdio/fdopen.c: Likewise. * lib/stdio/ferror.c: Likewise. * lib/stdio/fflush.c: Likewise. * lib/stdio/fopen.c: Likewise. * lib/stdio/fprintf.c: Likewise. * lib/stdio/fread.c: Likewise. * lib/stdio/fseek.c: Likewise. * lib/stdio/ftell.c: Likewise. * lib/stdio/fwrite.c: Likewise. * lib/stdio/printf.c: Likewise. * lib/stdio/remove.c: Likewise. * lib/stdio/snprintf.c: Likewise. * lib/stdio/sprintf.c: Likewise. * lib/stdio/sscanf.c: Likewise. * lib/stdio/vfprintf.c: Likewise. * lib/stdio/vprintf.c: Likewise. * lib/stdio/vsnprintf.c: Likewise. * lib/stdio/vsprintf.c: Likewise. * lib/stdio/vsscanf.c: Likewise. * lib/stdlib/calloc.c: Likewise. * lib/stdlib/qsort.c: Likewise. * lib/stdlib/strtof.c: Likewise. * lib/stdlib/strtol.c: Likewise. * lib/stdlib/strtold.c: Likewise. * lib/stdlib/strtoll.c: Likewise. * lib/stdlib/strtoul.c: Likewise. * lib/stdlib/strtoull.c: Likewise. * lib/string/memcmp.c: Likewise. * lib/string/memmem.c: Likewise. * lib/string/memmove.c: Likewise. * lib/string/memset.c: Likewise. * lib/string/strcat.c: Likewise. * lib/string/strchr.c: Likewise. * lib/string/strlwr.c: Likewise. * lib/string/strncpy.c: Likewise. * lib/string/strrchr.c: Likewise. * lib/string/strstr.c: Likewise. * lib/string/strupr.c: Likewise. * lib/stub/gettimeofday.c: Likewise. * lib/stub/ldexp.c: Likewise. * lib/stub/localtime.c: Likewise. * lib/stub/mprotect.c: Likewise. * lib/stub/sigaction.c: Likewise. * lib/stub/sigemptyset.c: Likewise. * lib/stub/strtod.c: Likewise. * lib/stub/time.c: Likewise. * lib/libc+tcc.c: Include explodings. 2018-08-16 Jan Nieuwenhuizen mescc: Mes C Library: Explode libmes.c. * include/libmes.h: Add declarations. * lib/abtol.c: New file, explode from lib/libmes.c. * lib/ctype/isdigit.c: Likewise. * lib/ctype/isnumber.c: Likewise. * lib/ctype/isspace.c: Likewise. * lib/ctype/isxdigit.c: Likewise. * lib/mes/abtol.c: Likewise. * lib/mes/eputc.c: Likewise. * lib/mes/eputs.c: Likewise. * lib/mes/fdgetc.c: Likewise. * lib/mes/fdputc.c: Likewise. * lib/mes/fdputs.c: Likewise. * lib/mes/fdungetc.c: Likewise. * lib/mes/itoa.c: Likewise. * lib/mes/ltoab.c: Likewise. * lib/mes/ntoab.c: Likewise. * lib/mes/utoa.c: Likewise. * lib/stdlib/atoi.c: Likewise. * lib/libmes.c: Include explodings. mescc: Mes C Library: Explode libc-mini.c. * include/libmes.h: Add declarations. * lib/mes/eputs.c: New file, explode from lib/libc-mini.c. * lib/mes/oputs.c: Likewise. * lib/stdlib/exit.c: Likewise. * lib/stdlib/puts.c: Likewise. * lib/string/strlen.c: Likewise. * lib/libc-mini.c: Include explodings. mescc: Mes C Library: Explode libc.c. * lib/libc.c: New file, explode from lib/libc.c. * lib/posix/execv.c: Likewise. * lib/posix/isatty.c: Likewise. * lib/posix/wait.c: Likewise. * lib/stdio/fgetc.c: Likewise. * lib/stdio/fputc.c: Likewise. * lib/stdio/fputs.c: Likewise. * lib/stdio/getc.c: Likewise. * lib/stdio/getchar.c: Likewise. * lib/stdio/putc.c: Likewise. * lib/stdio/putchar.c: Likewise. * lib/stdio/ungetc.c: Likewise. * lib/stdlib/free.c: Likewise. * lib/stdlib/getenv.c: Likewise. * lib/stdlib/realloc.c: Likewise. * lib/stdlib/setenv.c: Likewise. * lib/string/strcmp.c: Likewise. * lib/string/strcpy.c: Likewise. * lib/string/strncmp.c: Likewise. * lib/libc.c: Include explodings. 2018-08-15 Jan Nieuwenhuizen 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. test: Remove 30-test.i indirection. * include/30-test.i: Remove. * scaffold/tests/30-strlen.c: Remove 30-test.i indirection. * scaffold/tests/31-eputs.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/50-assert.c: Likewise. * scaffold/tests/51-strcmp.c: Likewise. * scaffold/tests/52-itoa.c: Likewise. * scaffold/tests/53-strcpy.c: Likewise. * scaffold/tests/60-math.c: Likewise. * scaffold/tests/63-struct-cell.c: Likewise. * scaffold/tests/64-make-cell.c: Likewise. * scaffold/tests/65-read.c: Likewise. * scaffold/tests/66-local-char-array.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/73-union.c: Likewise. * scaffold/tests/74-multi-line-string.c: Likewise. * scaffold/tests/75-struct-union.c: Likewise. * scaffold/tests/76-pointer-arithmetic.c: Likewise. * scaffold/tests/77-pointer-assign.c: Likewise. * scaffold/tests/78-union-struct.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/7c-dynarray.c: Likewise. * scaffold/tests/7d-cast-char.c: Likewise. * scaffold/tests/7e-struct-array-access.c: Likewise. * scaffold/tests/7f-struct-pointer-arithmetic.c: Likewise. * scaffold/tests/7g-struct-byte-word-field.c: Likewise. * scaffold/tests/7h-struct-assign.c: Likewise. * scaffold/tests/7i-struct-struct.c: Likewise. * scaffold/tests/7j-strtoull.c: Likewise. * scaffold/tests/7k-for-each-elem.c: Likewise. * scaffold/tests/7l-struct-any-size-array.c: Likewise. * scaffold/tests/7m-struct-char-array-assign.c: Likewise. * scaffold/tests/7n-struct-struct-array.c: Likewise. * scaffold/tests/80-setjmp.c: Likewise. * scaffold/tests/81-qsort.c: Likewise. * scaffold/tests/86-strncpy.c: Likewise. * scaffold/tests/87-sscanf.c: Likewise. test: Remove 00-test.i indirection. * include/00-test.i: Remove. * scaffold/tests/01-return-0.c: Remove 00-test.i indirection. * scaffold/tests/02-return-1.c: Likewise. * scaffold/tests/03-call.c: Likewise. * scaffold/tests/04-call-0.c: Likewise. * scaffold/tests/05-call-1.c: Likewise. * scaffold/tests/06-call-!1.c: Likewise. * scaffold/tests/10-if-0.c: Likewise. * scaffold/tests/11-if-1.c: Likewise. * scaffold/tests/12-if-==.c: Likewise. * scaffold/tests/13-if-!=.c: Likewise. * scaffold/tests/14-if-goto.c: Likewise. * scaffold/tests/15-if-!f.c: Likewise. * scaffold/tests/16-if-t.c: Likewise. * scaffold/tests/20-while.c: Likewise. * scaffold/tests/21-char[].c: Likewise. * scaffold/tests/22-while-char[].c: Likewise. * scaffold/tests/23-pointer.c: Likewise. 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. mescc: Support -l none (linking without libc). * module/mescc/mescc.scm (mescc:link): Support -l none. 2018-08-14 Jan Nieuwenhuizen mescc: Support -o-. * module/mescc/mescc.scm (GUILE-with-output-to-file): New variable. (with-output-to-file): Use it in redefined function. build: Update dir-locals for new layout. * .dir-locals.el: Update to new layout. 2018-08-12 Jan Nieuwenhuizen mescc: Mes C Library: Support oputs for POSIX. * lib/libmes.c (oputs)[POSIX]: New function. core: mes: Prepare for M2-Planet. * src/mes.c (cal): Refactor to use if instead of switch. (eval_apply): Likewise. core: lib: Prepare for M2-Planet. * src/lib.c (display_helper): Refactor to use if instead of switch. (memq): Likewise. core: reader: Prepare for M2-Planet. * src/reader.c (MAX_STRING): New define. (read_input_file_env_): Remove dead code. (reader_read_line_comment): Refactor to remove recursion. (reader_read_line_sexp_): Refactor to use if instead of switch. (reader_read_hash): Likewise. (reader_read_character): Refactor: cache peekchar () value, make M2-Planet friendly. (reader_read_binary): Make M2-Planet friendly. (reader_read_octal): Likewise. (reader_read_hex): Likewise. (reader_read_string): Refactor. (dump): Make M2-Planet friendly. 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. 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-11 Jan Nieuwenhuizen 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. 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. 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-10 Jan Nieuwenhuizen 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. mescc: Add objdump'able x86_64-mes scaffold. * lib/x86_64-mes/elf64-header.hex2: New file. * lib/x86_64-mes/elf64-footer-single-main.hex2: New file. * build-aux/build-x86_64-mes.sh: Enable second, objdump'able exit-42 scaffold test. mescc: Initial x86_64-mes scaffold. * build-aux/GNUmakefile.in (x86_64-mes): New target. * .gitignore: Ignore x86 and x86_64 out files. * build-aux/build-mes.sh: Resurrect three initial exit42 scaffold tests. * build-aux/build-x86_64-mes.sh: New file. Add initial exit42 scaffold test. * lib/x86-mes/elf32-0header.hex2: Fix comment. * lib/x86-mes/elf32-header.hex2: Likewise. * lib/x86_64-mes/elf-0footer.hex2: New file. * lib/x86_64-mes/elf64-0header.hex2: New file. * lib/x86_64-mes/elf64-body-exit-42.hex2: New file. * lib/x86_64-mes/exit-42.c: New file. 2018-08-12 Jan Nieuwenhuizen build: seed: Oops, copy TCC seed after it's been regenerated. * build-aux/GNUmakefile.in (seed): Oops, copy TCC seed after it's been regenerated. 2018-08-10 Jan Nieuwenhuizen build: Fix mescc man page generation. * build-aux/GNUmakefile.in (doc/mescc.1): Reverse dependencies; generate page for mescc. 2018-08-23 Jan Nieuwenhuizen build: Fixes for make check. * build-aux/config.sh (srcdir): Initialize if unset. * build-aux/test.sh (DIFF): Do not fail if unset. 2018-08-09 Jan Nieuwenhuizen guix: Update to 0.17. * guix/git/mes.scm (mes): Update to 0.17. 2018-07-22 Jan Nieuwenhuizen Release 0.17. * configure (VERSION): Update to 0.17. doc: Release update. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * README: Update. * doc/announce/ANNOUNCE-0.17: New file. 2018-08-09 Jan Nieuwenhuizen build: Non-bootstrap install fixes. * configure (main): Fix default bindir. * build-aux/GNUmakefile.in (PHONY_TARGETS): Remove src/mes. Fixes re-build upon install. * build-aux/install.sh.in: Fix tar arguments for scaffold files. Expand install directories. check: Do not fail if partial test prerequisites fail. * build-aux/check-tcc.sh: Pass if no test directory found. * build-aux/check.sh.in (TINYCC_PREFIX): Rename from TCC_PREFIX. Pass if partial tests prerequisites fail. check: Fix 4f-string-split.scm for Guile. * module/mes/guile.scm (core:car, core:make-cell): New function. Fixes scaffold/boot/4f-string-split.scm. build: configure: Oops, substitute @prefix@. * build-aux/pre-inst-env.in (MES_PREFIX): Respect pre-set value. * configure (main): Oops, substitute @prefix@. * configure.sh (subst): Likewise. 2018-07-28 Jan Nieuwenhuizen build: web: New target. * README: Add bug-mes@gnu.org * NEWS: Likewise. * doc/mes.texi: Likewise. * build-aux/gendocs.sh: New file, from gnulib. * doc/gendocs_template: New file, from gnulib. * build-aux/GNUmakefile.in (web): New target. Remove fosdem talk. * doc/fosdem/GuixSD.png: Remove. * doc/fosdem/LISP-1-5-page-13-bottom.png: Remove. * doc/fosdem/LISP-1.5-page-13-bottom.png: Remove. * doc/fosdem/LISP-1.5-page-13.pdf: Remove. * doc/fosdem/LISP-1.5-page-13.png: Remove. * doc/fosdem/README: Remove. * doc/fosdem/beamercolorthemeX.sty: Remove. * doc/fosdem/beamerthemeX.sty: Remove. * doc/fosdem/bootstrap-graph.png: Remove. * doc/fosdem/egg.jpeg: Remove. * doc/fosdem/egg.png: Remove. * doc/fosdem/egg.xcf: Remove. * doc/fosdem/fosdem.org: Remove. * doc/fosdem/fosdem.pdf: Remove. * doc/fosdem/fsb-logo-guile-guix-gnu.png: Remove. * doc/fosdem/fsb-logo-guile-guix-gnu.xcf: Remove. * doc/fosdem/fsb-logo-guile-guix-mes.png: Remove. * doc/fosdem/fsb-logo-guile-guix-mes.xcf: Remove. * doc/fosdem/fsb-logo.png: Remove. * doc/fosdem/guix-build-bootstrap-tarballs.log: Remove. * doc/fosdem/mes.png: Remove. * doc/fosdem/mes.xcf: Remove. 2018-07-26 Jan Nieuwenhuizen build: Remove tinycc/test2 import. * scaffold/tinycc/: Remove. * build-aux/check-mescc.sh: Remove tinycc testing. * build-aux/check-tcc.sh: New file. * build-aux/check.sh.in: Use it. * build-aux/config.sh: Update. * build-aux/export.make: Update. Add missing copyright headers and READMEs. * ChangeLog: Add copyright header. * build-aux/GNUmakefile.in (generate-ChangeLog): Append it as copyright footer. * BOOTSTRAP: Add copyright header. * scaffold/boot/2f-define-second-lambda.scm: Likewise. * scaffold/boot/39-global-define-override.scm: Likewise. * scaffold/boot/3a-global-define-lambda-override.scm: Likewise. * scaffold/boot/4f-string-split.scm: Likewise. * scaffold/boot/numbers.scm: Likewise. * scaffold/gc.scm: Likewise. * scaffold/b-0.mes: Remove. * doc/GNU-EVAL-APPLY: Remove. * doc/announce/README: New file. * doc/announce/ANNOUNCE: Move from doc/ANNOUNCE. * doc/announce/ANNOUNCE-0.10: Likewise. * doc/announce/ANNOUNCE-0.11: Likewise. * doc/announce/ANNOUNCE-0.12: Likewise. * doc/announce/ANNOUNCE-0.13: Likewise. * doc/announce/ANNOUNCE-0.14: Likewise. * doc/announce/ANNOUNCE-0.15: Likewise. * doc/announce/ANNOUNCE-0.16: Likewise. * doc/announce/ANNOUNCE-0.3: Likewise. * doc/announce/ANNOUNCE-0.4: Likewise. * doc/announce/ANNOUNCE-0.5: Likewise. * doc/announce/ANNOUNCE-0.6: Likewise. * doc/announce/ANNOUNCE-0.7: Likewise. * doc/announce/ANNOUNCE-0.8: Likewise. * doc/announce/ANNOUNCE-0.9: Likewise. * doc/announce/ANNOUNCE-2: Likewise. * doc/announce/UPDATE-0.13: Likewise. * doc/fosdem/README: New file. * doc/fosdem/fosdem.org: Add legalese. * doc/fosdem/fosdem.pdf: Regenerate. * doc/images/README: New file. * mes/module/mes/psyntax.pp.header: New file. * mes/module/mes/psyntax.pp: Add it to generated file. 2018-07-25 Jan Nieuwenhuizen build: Make build more autotools-like. * build-aux/build.sh.in: Move from ./build.sh * build-aux/check.sh.in: Likewise. * build-aux/GNUmakefile.in: Likewise. * build-aux/install.sh.in: Likewise. * build-aux/uninstall.sh.in: Likewise. * configure: Substitute them. * configure.sh: Likewise. * build-aux/build-cc.sh: Update: use ${srcdest} instead of ${top_builddest}. * build-aux/build-cc32.sh: Likewise. * build-aux/build-guile.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/cc-mes.sh: Likewise. * build-aux/cc.sh: Likewise. * build-aux/cc32-mes.sh: Likewise. * build-aux/check-boot.sh: Likewise. * build-aux/check-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/config.sh: Likewise. * build-aux/export.make: Likewise. * build-aux/mes-snarf.scm: Likewise. * build-aux/pre-inst-env.in: Likewise. * build-aux/test.sh: Likewise. * build-aux/trace.sh: Likewise. * module/mescc/mescc.scm: Likewise. * scripts/mescc.in: Likewise. * src/mes.c: Likewise. * .gitignore: Likewise. 2018-07-23 Jan Nieuwenhuizen build: Support all `Standard targets' for users. * GNUmakefile (distclean mostlyclean, maintainer-clean, html, dvi, ps, install-dvi, install-ps, install-html, installcheck): New target. (install-info): Remove fake target. * configure (parse-opts): Add --srcdir. xx 2018-07-23 Jan Nieuwenhuizen Add taken-from-Binutils and copyright line to alloca.c * lib/stdlib/alloca.c: Add `taken from binutils' and copyright line to alloca.c for minor changes. 2018-07-26 Jan Nieuwenhuizen Relicense some taken-from-GNU Guile LGPLv3+ files to GPLv3+. * mes/module/mes/pmatch.scm: Relicense to GPLv3+. * mes/module/sxml/xpath.scm: 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. 2018-07-23 Jan Nieuwenhuizen Relicense some taken-from-GNU Guile LGPLv2+ files to GPLv3+. * mes/module/mes/pretty-print.scm: Relicense to GPLv3+. * mes/module/mes/psyntax.ss: Likewise. * mes/module/srfi/srfi-1.scm: Likewise. * mes/module/srfi/srfi-16.scm: Likewise. * mes/module/srfi/srfi-26.scm: Likewise. * module/mes/getopt-long.scm: Likewise. Add missing copyright headers. * .dir-locals.el: Add copyright header. * AUTHORS: Likewise. * HACKING: Likewise. * INSTALL: Likewise. * README: Likewise. * build-aux/export.make: Likewise. * build-aux/setup-mes.sh: Likewise. * configure.sh: Likewise. * install.sh: Likewise. * scaffold/tests/90-goto-var.c: Likewise. * scaffold/tests/91-goto-array.c: Likewise. * tests/read.test: Likewise. * uninstall.sh: Likewise. * doc/fosdem/beamercolorthemeX.sty: * doc/fosdem/beamerthemeX.sty: * doc/fosdem/html.sty: Remove. * doc/fosdem/README: New file. * doc/images/README: New file. 2018-07-22 Jan Nieuwenhuizen GNU Mes. Throughout, make these changes Copyright headers: GNU Mes First mention of name: GNU Mes Website: https://www.gnu.org/software/mes Git: git://git.savannah.gnu.org/mes.git 2018-07-22 Jan Nieuwenhuizen build: Support uninstall. * uninstall.sh: New file. * GNUmakefile (uninstall): Use it in new target. build: Generate gcc-mesboot-graph from .dot. * doc/images/gcc-mesboot-graph.dot: New file. * doc/images/gcc-mesboot-graph.png: Remove. * GNUmakefile (${top_builddest}doc/images/gcc-mesboot-graph.png): New target. * configure (det): Add check. * build-aux/export.make: Export it. * doc/mes.texi (The Mes Bootstrap Process): Describe new recipe. * guix/git/mes.scm (mes): Add graphvis dependency. 2018-07-22 Jan Nieuwenhuizen guix: Refactor package setup. Next to the convenient environment setup and package build from git guix environment -l .guix.scm guix build -f .guix.scm we can now also build other included packages GUIX_PACKAGE_PATH=guix guix build mes@0.17 GUIX_PACKAGE_PATH=guix guix build nyacc@0.80.42 * guix/git/mes.scm: Move from .guix.scm, make a module. * .guix.scm: Move from guix.scm, use it. * build-aux/manifest.scm: Update location. * build-aux/pre-inst-env.in: Support it. * configure: Check for guix. * build-aux/export.make: Export GUIX. * GNUmakefile (update-hash): New target. 2018-07-22 Jan Nieuwenhuizen build: Respect --docdir. * configure: Respect --docdir. 2018-07-21 Jan Nieuwenhuizen build: Support --srcdir build. * build-aux/config.sh: New file. * build-aux/trace.sh: New file. * build-aux/GNUmakefile.in: New file. * configure: Support srcdir configure. * GNUmakefile: Support srcdir build. * build-aux/build-cc.sh: Likewise. * build-aux/build-cc32.sh: Likewise. * build-aux/build-guile.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/cc-mes.sh: Likewise. * build-aux/cc.sh: Likewise. * build-aux/cc32-mes.sh: Likewise. * build-aux/check-mes.sh: Likewise. * build-aux/check-mescc.sh: Likewise. * build-aux/export.make: Likewise. * build-aux/mes-snarf.scm: Likewise. * build-aux/pre-inst-env.in: Likewise. * build-aux/test.sh: Likewise. * build.sh: Likewise. * check.sh: Likewise. * install.sh: Likewise. * module/mescc/mescc.scm: Likewise. * scripts/mescc.in: Likewise. * src/mes.c: Likewise. 2018-06-30 Jan Nieuwenhuizen core: Prepare for the Hurd. * lib/linux/libc.c: Move from lib/linux.c. * lib/linux/gcc.c: Move from lib/linux-gcc.c. * lib/linux/gnu.c: Move from lib/linux+gnu.c. * lib/linux/libc.c: Move from lib/linux.c. * lib/linux/mes.c: Move from lib/linux-mes.c. * lib/linux/mini-gcc.c: Move from lib/linux-mini-gcc.c. * lib/linux/mini-mes.c: Move from lib/linux-mini-mes.c. * lib/linux/tcc.c: Move from lib/linux+tcc.c. * lib/linux/crt0.c: Move from lib/crt0.c. * lib/linux/crt1.c: Move from lib/crt1.c. * lib/linux/crti.c: Move from lib/crti.c. * lib/linux/crtn.c: Move from lib/crtn.c. * build-aux/build-cc.sh: Update for new layout. * build-aux/build-cc32.sh: Likewise. * build-aux/build-mes.sh: Likewise. * build-aux/cc-mes.sh: Likewise. * build-aux/cc32-mes.sh: Likewise. * lib/string/argz-count.c: New file taken from GNU C Library, relicensed. * lib/string/argz-extract.c: New file taken from GNU C Library, relicensed. * include/argz.h: New file. * lib/string/memcpy.c: New file, extract from libc. * lib/assert/assert.c: Likewise. 2018-07-21 Jan Nieuwenhuizen build: Install ChangeLog. * ChangeLog: New file. * install.sh: Regenerate it, install it. build: Refactor configure. * configure: Refactor. 2018-07-21 Jan Nieuwenhuizen build: Prepare for autoconfiscation. Make build system more in alignment with how autotools work. This will make transition easier. * mes/module/mes/boot-0.scm.in: Update from module/mes/boot-0.scm. * scripts/mescc.in: Update from scripts/mescc. * build-aux/pre-inst-env.in: New file. * build-aux/cc-mes.sh: Use pre-inst-env. * configure: Substitute new .in files. * install.sh: Do not substitute mescc, boot-0.scm. 2018-07-21 Jan Nieuwenhuizen core: Document number->string INT-MIN failure with gcc-x86. * src/mes.c (scm_symbol_arch, scm_symbol_compiler): New symbol. (mes_symbols, bload_env): Add them. (scm_symbol_gnuc, scm_symbol_mesc): Remove. * scaffold/mini-mes.c: Likewise. * module/mes/mes-0.scm (%arch, %compiler): New public variable. * tests/srfi-13.test: Expect number->string INT-MIN to fail for gcc-x86. * HACKING (Bugs): Add it. build: Refactor mes tests. * build-aux/check-mes.sh: New file. * check.sh: Invoke it for Guile and Mes. * .gitignore: Ignore new guile logs. * mes/module/mes/boot-0.scm: Ignore some standard Guile options. * module/mes/test.scm: Make a module. * tests/base.test: Use it. Make a module, support invoking with Guile or Mes alike. * tests/boot.test: Likewise. * tests/catch.test: Likewise. * tests/closure.test: Likewise. * tests/cwv.test: Likewise. * tests/display.test: Likewise. * tests/fluids.test: Likewise. * tests/getopt-long.test: Likewise. * tests/guile.test: Likewise. * tests/let-syntax.test: Likewise. * tests/let.test: Likewise. * tests/match.test: Likewise. * tests/math.test: Likewise. * tests/module.test: Likewise. * tests/optargs.test: Likewise. * tests/peg.test: Likewise. * tests/pmatch.test: Likewise. * tests/psyntax.test: Likewise. * tests/quasiquote.test: Likewise. * tests/read.test: Likewise. * tests/scm.test: Likewise. * tests/srfi-13.test: Likewise. * tests/srfi-14.test: Likewise. * tests/srfi-16.test: Likewise. * tests/srfi-1.test: Likewise. * tests/srfi-43.test: Likewise. * tests/srfi-9.test: Likewise. * tests/syntax.test: Likewise. * tests/vector.test: Likewise. * tests/base.test-guile: Remove. * tests/boot.test-guile: Remove. * tests/catch.test-guile: Remove. * tests/closure.test-guile: Remove. * tests/cwv.test-guile: Remove. * tests/display.test-guile: Remove. * tests/fluids.test-guile: Remove. * tests/getopt-long.test-guile: Remove. * tests/guile.test-guile: Remove. * tests/let-syntax.test-guile: Remove. * tests/let.test-guile: Remove. * tests/match.test-guile: Remove. * tests/math.test-guile: Remove. * tests/module.test-guile: Remove. * tests/optargs.test-guile: Remove. * tests/peg.test-guile: Remove. * tests/pmatch.test-guile: Remove. * tests/psyntax.test-guile: Remove. * tests/quasiquote.test-guile: Remove. * tests/read.test-guile: Remove. * tests/scm.test-guile: Remove. * tests/srfi-13.test-guile: Remove. * tests/srfi-14.test-guile: Remove. * tests/srfi-16.test-guile: Remove. * tests/srfi-1.test-guile: Remove. * tests/srfi-43.test-guile: Remove. * tests/srfi-9.test-guile: Remove. * tests/syntax.test-guile: Remove. * tests/vector.test-guile: Remove. build: all-go: Support V=0,1,2. * build-aux/build-guile.sh: Support V=0,1,2. build: Fix for handling missing makeinfo. * configure (main): Update MAKEINFO. mescc: fwrite: Increase debug tracing threshold. * lib/libc+tcc.c (fwrite): Increase debug tracing threshold. mescc: Add proper includes. * include/libmes.h (__mes_debug): Declare. * lib/libtcc1.c: Add proper includes. * lib/linux+gnu.c: Likewise. * lib/m4.c: Likewise. core: Resurrect gcc support. * src/mes.c (MES_ARENA)[POSIX]: Default to 100000000. 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. build: cc32: Silence warnings. * build-aux/build-cc32.sh (CC32_CFLAGS): Silence warnings. build: Resurrect i686-unknown-linux-gnu-gcc support. * build-aux/build-cc32.sh (CC32_CFLAGS): Add -fno-builtin. Resurrects i686-unknown-linux-gnu-gcc. mescc: Support verbose int types. * module/mescc/compile.scm (i386:type-alist): Support verbose int types. 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. core: typo: Remove trailing 1. * include/alloca.h: typo: Remove trailing 1. 2018-07-20 Jan Nieuwenhuizen Add missing copyright header. Thanks, Mike! * guile/gc.c: Add missing copyright header. Thanks, Mike! 2018-07-19 Jan Nieuwenhuizen guix: mes: Updatee to 0.16.1. * guix.scm (mes): Update to 0.16.1. (mes.git): Likewise. 2018-07-12 Jan Nieuwenhuizen Release 0.16.1 * configure (VERSION): Bump to 0.16.1. 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. build: setup-mes.sh: Cater for Debian/stretch too. Thanks, pdewacht! * build-aux/setup-mes.sh: Cater for Debian/stretch too. Thanks, pdewacht! core: Fix segfault on Debian/strectch. Thanks, pdewacht! * src/posix.c (execl_): Typo in initialization. Fixes segfault on Debian/strectch. Thanks, pdewacht! doc: Add html, pdf. * GNUmakefile (html, pdf): New target. * .gitignore: Ignore html, pdf targets. doc: Remarks from Rutger. * doc/mes.texi: Remarks from Rutger. 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. build: Handle CFLAGS, CPPFLAGS for Debian. build: Have configure create a git archive. * configure: Create git archive if necessary. 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. 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. 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. build: Support $DESTDIR. * build-aux/export.make: export DESTDIR. * install.sh: Support $DESTDIR. 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. 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. 2018-06-26 Jan Nieuwenhuizen guix: mescc-tools: Update to 0.5.1. * guix.scm (mescc-tools): Update to 0.5.1. guix: Oops, fix nyacc-for-mes checksum. Thanks, pdewacht! * guix.scm (nyacc-for-mes): Fix checksum. guix: Update mes to 0.16. * guix.scm (mes): Update to 0.16. (mes.git): Likewise. 2018-06-25 Jan Nieuwenhuizen Release 0.16. * configure (VERSION): Bump to 0.16. 2018-06-24 Jan Nieuwenhuizen doc: Release update. * BOOTSTRAP: Update. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.16: New file. 2018-06-26 Jan Nieuwenhuizen core: Fix compile warnings. * lib/libmes.c: Fix warning. * src/posix.c (execl_): Fix warning, add debug printing. core: execl_: Allow 1000 arguments. * src/posix.c (execl_): Allow 1000 arguments. 2018-06-24 Jan Nieuwenhuizen 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. 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. 2018-06-20 Jan Nieuwenhuizen 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. 2018-06-24 Jan Nieuwenhuizen 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? 2018-06-20 Jan Nieuwenhuizen 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. 2018-06-19 Jan Nieuwenhuizen mescc: Support gnu toolchain: libtcc1. * lib/libtcc1.c: New file. * lib/libc+tcc-gcc.c: Remove libtcc1 stubs. 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. 2018-06-18 Jan Nieuwenhuizen mescc: Support Tinycc 0.9.27: Drop dlclose, dlopen. * lib/libc+tcc.c (dlclose, dlopen): Remove. * include/dlfcn.h (RTLD_DEFAULT): Add. core: Resurrect dump-tiny. * src/reader.c (dump): Resurrect dump-tiny. core: Resurrect loading of boot-0.32-mo. 2018-06-17 Jan Nieuwenhuizen mescc: Support binutils 2.25: fseek: Add debug printing. * lib/libc+tcc.c (fseek): Add debug printing. mescc: Tinycc support: bcopy: Do not return void. * lib/m4.c (bcopy): Do not return void. Helps tcc. mescc: Support binutils 2.25: memcmp: Support size 0. * lib/libc+tcc.c (memcmp): Support size 0. mescc: Support binutils 2.25: vsscanf: Skip `l'. * lib/libc+tcc.c (vsscanf): Skip `l'. mescc: Debugging oops. * lib/libc.c (__mes_debug): Oops, wrong direction. 2018-06-16 Jan Nieuwenhuizen 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. mescc: Add another fopen test. * scaffold/tests/98-fopen.c: New file. * build-aux/check-mescc.sh (tests): Add it. * AUTHORS: Mention it. mescc: Add fopen test. * scaffold/tests/97-fopen.c: New file. * build-aux/check-mescc.sh (tests): Run it. * include/unistd.h (link): Declare. mescc: Support binutils-2.14: fopen: Return 0 upon failure. * lib/libc+tcc.c (fopen): Return 0 upon failure. 2018-06-16 Jan Nieuwenhuizen 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. 2018-06-16 Jan Nieuwenhuizen build: make seed: Update mescc-tools-seed too. guix: mescc-tools: Update to 0.5. * guix.scm (mescc-tools): Update to 0.5. 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. 2018-06-11 Jan Nieuwenhuizen guix: Update mes to 0.15. * guix.scm (mes): Update to 0.15. (mes.git): Likewise. 2018-06-10 Jan Nieuwenhuizen Release 0.15. * configure (VERSION): Bump to 0.15. 2018-05-23 Jan Nieuwenhuizen doc: Release udpate. * BOOTSTRAP: Update. * HACKING: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.15: New file. 2018-06-12 Jan Nieuwenhuizen 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. 2018-06-10 Jan Nieuwenhuizen 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. mescc: Refactor debug and stub printing. * lib/libc.c (__mes_debug): New function. Use it for debug printing and in stubs throughout. mescc: Support binutils-2.30: fopen fix. * lib/libc+tcc.c (fopen): Set O_APPEND for 'a'. 2018-06-09 Jan Nieuwenhuizen mescc: Support binutils-2.30. * lib/binutils.c (raise, strdup): New function. (mbstowcs): New stub. * include/fcntl.h (O_APPEND, FD_CLOEXEC): New define. mescc: Support binutils-2.10.1: Stubs set errno to 0. mescc: Silence some stubs. * lib/libc+tcc.c: [!NOISY_FLOATS, !NOISY_TIMES]: Silence stubs. * lib/gcc.c: Likewise. * lib/binutils.c: Likewise. 2018-06-10 Jan Nieuwenhuizen mescc: Add debug printing: fopen, fwrite. * lib/libc+tcc.c (fopen, fwrite)[MESC_DEBUG]: Print debug info. mescc: Support binutils-2.10.1: opentype `r+'. * lib/libc+tcc.c (fopen): Support opentype `r+'. 2018-06-08 Jan Nieuwenhuizen mescc: syscall: return only ever error -1, set errno. 2018-06-07 Jan Nieuwenhuizen mescc: Support gcc-2.95: Add getpwnam stub. * lib/gcc.c (getpwnam): New stub. mescc: Support gcc-3.0: Implement alarm, setitimer. mescc: Support gcc-3.0: Implement atexit. 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. mescc: Support gcc-3.2: Implement getuid, getgid. * lib/linux+gnu.c (getuid, getdid): New function. * lib/binutils.c (getuid, getdid): Remove stub. 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. 2018-06-06 Jan Nieuwenhuizen mescc: Support gcc-3.2: Implement integer strto*. * lib/libc+tcc.c (strtoll, strtoul): Call strtoul. 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. 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. 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. mescc: Support gcc-3.4.0: unsetenv. * lib/gcc.c (unsetenv): New function. mescc: Support gcc-3.2: Add __divdi3, __moddi3 stubs. * lib/gcc.c (__divdi3, __moddi3): New stubs. mescc: Support gcc-3.2: puts with newline. * lib/libc-mini.c (oputs): Rename from puts. (puts): New function: Add newline. mescc: Support binutils-2.10.1. xx 2018-06-03 Jan Nieuwenhuizen mescc: Support glibc-1.06.4. * lib/glibc.c: New file. * lib/libc+gnu.c: Include it. 2018-06-02 Jan Nieuwenhuizen mescc: Support gcc-2.6.3. * TODO 2018-05-30 Jan Nieuwenhuizen mescc: Support binutils-2.5.1. * include/stdint.h: #undef types before typedef'ing them. * include/sys/types.h: Likewise. * include/string.h (NULL): New define. * include/stdio.h (BUFSIZ): New define. 2018-06-01 Jan Nieuwenhuizen tests: Remove tinycc-imported non-free grep test. * scaffold/tinycc/46_grep.c: Remove. * scaffold/tinycc/46_grep.expect: Remove. 2018-05-30 Jan Nieuwenhuizen 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. 2018-05-29 Jan Nieuwenhuizen 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. 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. mlibc: Implement ftell, fseek. * lib/libc+tcc.c (ftell, fseek): Implement. mlibc: Cleanup. 2018-05-27 Jan Nieuwenhuizen mescc: m4 support: WIP 2018-05-28 Jan Nieuwenhuizen core: Refactor boot-0 loading. * src/mes.c (load_boot): New function. (load_env): Use it. 2018-05-26 Jan Nieuwenhuizen mescc: Out of the box Geiser support. * .dir-locals.el: New file. Out of the box Geiser support for mescc. 2018-05-25 Jan Nieuwenhuizen 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. 2018-05-26 Jan Nieuwenhuizen mes: Add drop, drop-right. * module/srfi/srfi-1.mes (drop, drop-right): New function. 2018-05-25 Jan Nieuwenhuizen Revert "fork/exec: debug." This reverts commit f0315ac0d9acd66a30dbb192334f443459b7ed16. fork/exec: debug. 2018-05-24 Jan Nieuwenhuizen core: Support fork, waitpid, execve. * stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define. * lib/linux-gcc.c (fork, waitpid, execve): New function. * lib/linux-mes.c (fork, waitpid, execve): New function. * lib/libc.c (wait): New function. * include/unistd.h (fork, execve): Declare. * include/sys/wait.h (waitpid, wait): Declare. * module/mes/posix.mes (search-path, execlp, system*, waitpid): New function. * src/posix.c (primitive_fork, execl): New function. 2018-05-27 Jan Nieuwenhuizen mescc: Oops, alignment. * module/mes/M1.mes (object->M1): Oops, alignment: only add alignment when not aligned. 2018-05-26 Jeremiah Orians mescc: Add fopen. * lib/libc+tcc.c (fopen)[!POSIX]: Remove stub. * lib/libc.c (fopen)[!POSIX]: New function. * AUTHORS: Add Jeremiah. 2018-05-27 Jan Nieuwenhuizen build: Remove function declarations from M1. * module/language/c99/compiler.mes (info->object): Remove function declarations. build: Check for mes-seed, tinycc-seed. * configure: Check for guile-tools, mes-seed, tinycc-seed. Bugfix: Add cwd to load path. 2018-05-22 Jan Nieuwenhuizen guix: mes: Update to 0.14. * guix.scm (mes): Update to 0.14. (mes.git): Likewise. 2018-05-23 Jan Nieuwenhuizen guix: Add nyacc-for-mes. * guix.scm (nyacc-for-mes): New variable. 2018-05-20 Jan Nieuwenhuizen Release 0.14. * configure (VERSION): Bump to 0.14. 2018-05-19 Jan Nieuwenhuizen doc: Release udpate. * BOOTSTRAP: Update. * HACKING: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.14: New file. 2018-05-22 Jan Nieuwenhuizen mescc: Tinycc support: Handle short struct initializer. * module/language/c99/compiler.mes (array-init-element->data): Handle short struct initializer. 2018-05-21 Jan Nieuwenhuizen mescc: Align global data. * module/mes/M1.mes (object->M1): Align globals. 2018-05-20 Jan Nieuwenhuizen mescc: Tinycc support: strncpy. * lib/libc+tcc.c (strncpy): New function. * scaffold/tests/86-strncpy.c: Test it. * build-aux/check-mescc.sh (tests): Run it. * build-aux/cc-mlibc.sh (LIBC): Acknowlegde. * build-aux/test.sh (LIBC): Export it. 2018-05-21 Jan Nieuwenhuizen tinycc: Add stubs: __fixdfdi, __fixxfdi, __fixsfdi. * lib/libc+tcc-gcc.c (__fixdfdi, __fixxfdi, __fixsfdi): New stub. 2018-05-20 Jan Nieuwenhuizen tinycc: Add stubs: __floatundixf __fixunsxfdi. * lib/libc+tcc-gcc.c (__floatundixf, __fixunsxfdi): New stub. mescc: Tinycc support: workaround for tcc; this breaks: Structured type with char or short on heap. * module/language/c99/compiler.mes (int->bv): Always use 32bit byte vector. 2018-05-19 Jan Nieuwenhuizen mescc: Tinycc support: Structured type with char or short on heap. * module/language/c99/compiler.mes (int->bv): New function. (init->data): Use it. Add parameter. Update callers. (array-init->data): Add type parmeter. (array-init-element->data): Likewise. * module/mes/bytevectors.mes (bytevector-u8-set!): New function. * module/mes/bytevectors.scm (mes): Export it. * module/mes/as.mes (int->bv8): New function. 2018-05-20 Jan Nieuwenhuizen mescc: Fix size ERROR message. * module/language/c99/compiler.mes (expr->accu): Fix size ERROR message. mescc: Fix itoa. * lib/libc.c (itoa): Use function-static buffer. Increase to 12 to handle INT_MIN. (itoab): Likewise. 2018-05-19 Jan Nieuwenhuizen mescc: Tinycc support: Export nested struct definitions. * module/language/c99/compiler.mes (struct-field): Support nested, named and anonymous enums. (field->info): New function. (type->info): Use it to reap nestedly defined enums, structs, unions. (decl->info): Likewise. * scaffold/tests/t.c: Test it. mescc: Tinycc support: Unsigned comparison. * stage0/x86.M1 (ja32, jae32, jb32, jbe32): New macro. * module/mes/as-i386.mes (i386:jump-a, i386:jump-ae, i386:jump-b, i386:jump-be): Use it in new function. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (test-jump-label->info): Use them to support unsigned comparison. * scaffold/tests/7s-unsigned-compare.c: Test it. * build-aux/check-mescc.sh (tests): Run it. 2018-05-18 Jan Nieuwenhuizen mescc: Tinycc support: Char and short sign extend. * module/mes/as-i386.mes (i386:accu*n->local, i386:byte-accu->local+n, i386:word-accu->local+n): Remove. (i386:byte-accu, i386:signed-byte-accu, i386:word-accu, i386:signed-word-accu): New function. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (accu->local+n-text): Simplify. (mem->accu, convert-accu): New function. (expr->accu): Use them. * stage0/x86.M1 (mov____%al,0x32(%ebp), mov____%al,0x8(%ebp), mov____%ax,0x32(%ebp), mov____%ax,0x8(%ebp), movzbl_0x32(%ebp),%eax, movzbl_0x8(%ebp),%eax, movzwl_0x32(%ebp),%eax, movzwl_0x8(%ebp),%eax): Deprecate. * scaffold/tests/7r-sign-extend.c: Test it. * build-aux/check-mescc.sh (tests): Run it. 2018-05-21 Jan Nieuwenhuizen mes: string->number: Support upper case hex. * module/mes/scm.mes (string->number): Support upper case hex. 2018-05-18 Jan Nieuwenhuizen mescc: Tinycc support: Minimal float support. * lib/libc+tcc.c (ldexp, strtod, strtof, strtold): New stub. * include/math.h (ldexp): Declare. * include/stdlib.h (strtod, strtof, strtold): Declare. * module/mes/scm.mes (string->number): Minimal float support. (inexact->exact): New function. * tests/math.test ("string->number"): Test it. * module/language/c99/compiler.mes (ast->type): Handle float type. (type->info): Likewise. (cstring->int): Rename from cstring->number. Update callers. (cstring->float): New function. (expr->accu): Use it. 2018-05-17 Jan Nieuwenhuizen mescc: Tinycc support: Switch with heterogeneous body, non-last default. * module/language/c99/compiler.mes (switch->info): New function. (ast->info): Use it for switch. (clause->info, statements->clauses): Remove. * scaffold/tests/44-switch.c (default_first): Test it. 2018-05-20 Jan Nieuwenhuizen mes: Support fold 3. * module/srfi/srfi-1.mes (fold): Support fold 3. 2018-05-14 Jan Nieuwenhuizen mescc: Tinycc support: Compound strings as function argument. * module/language/c99/compiler.mes (expr->accu): Handle compound strings as function argument. * module/mes/M1.mes (object->M1): Call error when string not found. * scaffold/tests/t.c: Test it. mescc: Tinycc support: Update some tests. mescc: Tinycc support: Add __lshrdi3, __ashldi3, __ashrdi3. * lib/libc+tcc-gcc.c (__lshrdi3, __ashldi3, __ashrdi3): New function. mescc: Tinycc support: Fix sizeof interesting expressions. * module/language/c99/compiler.mes (ast->type): Return type for sizeof-expr, sizeof-type. * scaffold/tests/85-sizeof.c: Test it. 2018-05-13 Jan Nieuwenhuizen mescc: Tinycc support: Support bit-fields. * module/language/c99/compiler.mes (struct->fields): Support bit-fields. (ast->type): (field-field): (field-offset): (expr->accu*): (expr->accu): (struct-field): (->size): * module/language/c99/info.scm (): New type. * stage0/x86.M1 (and____$i32,%eax, and____(%edx),%eax, mov____(%edx),%eax, or____(%edx),%eax): New macro. * module/mes/as-i386.mes (i386:base-mem->accu): Use it. (i386:accu-and, i386:accu-and-base-mem, i386:accu-or-base-mem): New function. * module/mes/as-i386.scm: Export them. * scaffold/tests/7q-bit-field.c: Test it. * build-aux/check-mescc.sh (tests): Run it. 2018-05-12 Jan Nieuwenhuizen mescc: Tinycc support: Anonymous string array. * module/language/c99/compiler.mes (global->info): Anonymous string array. (local->info): Likewise. (array-init->string): Support array of char. (init-local): Likewise. (->size): Fix for array. * scaffold/tests/4a-char-array.c: Test it. * build-aux/check-mescc.sh (tests): Run it. mescc: Tinycc support: sizeof: Bugfix for c-array. * module/language/c99/compiler.mes (->size): Bugfix for c-array. * scaffold/tests/85-sizeof.c: Test it. 2018-05-11 Jan Nieuwenhuizen mescc: Tinycc support: Implement ((struct foo*)p)->bar. * module/language/c99/compiler.mes (expr->accu*): * scaffold/tests/7p-struct-cast.c: Test it. * build-aux/check-mescc.sh (tests): Run it. 2018-05-13 Jan Nieuwenhuizen mescc: Tinycc support: Implement (foo--)->bar and permutations. * module/language/c99/info.scm (clone): Add post field. (make): Handle post parameter. * module/language/c99/compiler.mes (clone): Handle post parameter. (expr->accu*): Set it to support foo--/foo--. (expr->accu): Read it to support foo--/foo--. * scaffold/tests/7o-struct-pre-post.c: Test it. * build-aux/check-mescc.sh: Run it. 2018-05-11 Jan Nieuwenhuizen mescc: Tinycc support: Function addresses. mescc: Tinycc support: Numeric constant expressions. mescc: Tinycc support: Function variables. mescc: Tinycc support: Pointer typedefs. mescc: Tinycc support: Array typedefs. mescc: Tinycc support: Sizeof struct destruct. mescc: Tinycc support: Anonymous union initialization. mescc: Tinycc support: Fix for ?-operator. mescc: Tinycc support: Valued function assign. 2018-05-10 Jan Nieuwenhuizen mescc: Refactor type system: WIP * module/language/c99/compiler.mes (): WIP * module/language/c99/info.scm (): WIP mescc: Refactor type system: struct/enum fields: (name . ). * module/language/c99/compiler.mes (struct-field): Refactor. (field:name): Update. (field:pointer): Update. (field:size): Update. (field:type): Remove. (->size): New function. 2018-05-09 Jan Nieuwenhuizen mescc: Refactor type system: introduce , , . * module/language/c99/info.scm (, , ): New type. * module/language/c99/compiler.mes (ast->): New function. (ast-type): Use it. 2018-05-05 Jan Nieuwenhuizen mescc: Refactor variable declaration. * module/language/c99/compiler.mes (decl->info): Refactor. 2018-05-04 Jan Nieuwenhuizen mescc: Handle sizeof expression. * module/language/c99/compiler.mes (expr->accu): Handle sizeof expression. * scaffold/tests/85-sizeof.c: Test it. mescc: Handle struct field lists. * module/language/c99/compiler.mes (struct-field): Return list of fields. Update callers. * scaffold/tests/84-struct-field-list.c: Test it. * build-aux/check-mescc.sh (tests): Add it. mescc: Support heterogeneous variable init. * module/language/c99/compiler.mes (decl->info): Support heterogeneous variable init. * scaffold/tests/83-heterogenoous-init.c: Test it. * build-aux/check-mescc.sh (tests): Add it. mescc: Handle (Skip) global static. * module/language/c99/compiler.mes (decl->info): Handle (Skip) global static. * scaffold/tests/48-global-static.c: Test it. mescc: Support functions in expression. * module/language/c99/info.scm (): New type. * module/language/c99/compiler.mes (ast->type): Support function. (expr->type-size): Likewise. (expr->type): Likewise. (expr->accu*): Likewise. (function->info): Create . * module/mes/M1.mes (object->M1): Grok . * scaffold/tests/47-function-expression.c: Test it. * build-aux/check-mescc.sh: Add it. mescc: Support function-static variables. * module/language/c99/info.scm (make): Add statics field. (): Add name and function fields. Update callers. (global->string): New function. * module/mes/M1.mes (object->M1): Update. * module/language/c99/compiler.mes (clone): Add statics field. (ident->accu): For , use global in text (WAS: name). (ident-address->accu): Likewise. (ident-address->base): Likewise. (decl-local->info): New function. (decl->info): New function. (ast->info): Use them. (function->info): Keep globals in object (WAS: global:value only). * scaffold/tests/46-function-static.c: Test it. 2018-05-20 Jan Nieuwenhuizen mes: Add unfold. * module/srfi/srfi-1.mes (unfold): New function. mes: Add const. * module/mes/scm.mes (const): New function. * tests/scm.test ("const"): Test it. 2018-05-16 Jan Nieuwenhuizen core: Add logxor. * src/math.c (logxor): New function. * tests/math.test ("logxor"): Test it. mes: string-join: Support optional delimiter, support grammar. * module/srfi/srfi-13.mes (string-join): Support optional infix and grammar. * tests/srfi-13.test ("string-join"): Test it. core: reader: Support binary #b101. * src/reader.c (reader_read_binary): New function. (reader_read_hash): Use it. * tests/scm.test ("binary"): Test it. 2018-05-04 Jan Nieuwenhuizen mes: Support srfi-9-gnu. * module/srfi/srfi-9/gnu.mes: New file. Support srfi-9-gnu. * tests/srfi-9.test: Test it. * tests/srfi-9.test-guile: 2018-04-28 Jan Nieuwenhuizen core: Have core:eval expand macros. * src/mes.c (core:eval-expand): Remove (core:eval-expanded): New variable. (eval_apply): Have core:eval expand macros; core:eval-expanded evals expanded sexps. 2018-04-29 Jan Nieuwenhuizen Revert "core: Remove pmatch-car, pmatch-cdr hack." This reverts commit be1e84624ea4a158173f34af923e3c4a3793412a. 2018-04-28 Jan Nieuwenhuizen core: Remove pmatch-car, pmatch-cdr hack. * src/mes.c (scm_vm_eval_pmatch_car, scm_vm_eval_pmatch_cdr): Remove (eval_apply): Remove cell_vm_eval_pmatch_car, cell_vm_eval_pmatch_cdr hack. (mes_symbols): Remove cell_symbol_pmatch_car, cell_symbol_pmatch_cdr. * scaffold/mini-mes.c: Likewise. * module/mes/guile.scm (mes): Remove pmatch-car, pmatch-cdr. * module/mes/pmatch.scm (ppat): Use plain car, cdr. 2018-05-23 Jan Nieuwenhuizen build: Do not assume /bin/sh, basename/dirname. * install.sh: Do not assume /bin/sh, basename/dirname. * scripts/diff.scm: Likewise. build: Build mini-libc and libc+tcc-gcc too. * include/getopt.h[__GNUC__ && POSIX]: Only use include_next. * lib/libc+tcc-gcc.c[POSIX](longjmp, setjmp, __udivdi3, __umoddi3): Remove. * build-aux/build-cc.sh: Build mini-libc-gcc and libc+tcc-gcc too. * build-aux/build-mlibc.sh: Build mini-libc-gcc too. boot: Bugfix for diff on mes. * scripts/diff.scm (diff-files): Rename from diff; Avoids name clash with module to allow using -e '()' hack. build: Install naive diff. * scripts/diff.scm: Move from build-aux. * install.sh: Install it. * build-aux/tests.sh: Update location. 2018-05-20 Jan Nieuwenhuizen build: Update configure. * configure: Update. 2018-05-02 Jan Nieuwenhuizen mes: Remove debugging. * module/mes/module.mes (mes-load-module-env): Remove debugging. 2018-05-10 Jan Nieuwenhuizen build: Use ../mes-seed/refresh.sh, ../tinycc-seed/refresh.sh. * GNUmakefile (seed): Use ../mes-seed/refresh.sh, ../tinycc-seed/refresh.sh. 2018-05-04 Jan Nieuwenhuizen mescc: Guile fixes. * scripts/mescc: Set GODIR. Add module as expression to Mes invokation. Remove explicit (second) call to main. 2018-05-18 Jan Nieuwenhuizen test: Use diff -ub for tinycc tests. * build-aux/diff.scm: Support -b. * build-aux/test.sh: Use it. 2018-05-04 Jan Nieuwenhuizen check: Also test with i686-unknown-linux-gnu-gcc. * check.sh (CC32): New variable. * build-aux/test.sh: Also test with CC32.o 2018-05-06 Jan Nieuwenhuizen build: configure: Handle VAR=VALUE. Update help. * configure: Handle VAR=VALUE. Update help. 2018-05-03 Jan Nieuwenhuizen build: Fixes for Debian and /bin/sh == dash. * build.sh: Use separate export stanzas. Use command -v (WAS: type -p). Fixes sh, /bin/sh == dash. * 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/check-mescc.sh: Likewise. * check.sh: Likewise. * install.sh: Likewise. * scripts/mescc: Likewise. build: Rebuild after build from seed. * build-aux/build-mes.sh: Rebuild after build from seed. mescc: Use file-name as global prefix. * module/mes/M1.mes (object->M1): Add file-name parameter. 2018-05-02 Jan Nieuwenhuizen core: Fixes for int-max, int-min. * src/math.c (greater_p): Fix INT_MAX > 0. (less_p): Fix INT_MIN < 0. * tests/math.test ("< INT-MIN"): Test it. ("< INT-MAX"): ("> INT-MAX"): ("> INT-MAX 0"): ("> INT-MIN"): * tests/srfi-13.test ("string->number INT-MAX"): Test it. ("string->number INT-MIN"): ("number->string INT-MAX"): ("number->string INT-MIN"): * scaffold/tests/60-math.c (test): Test it. mescc: Fix dumping of strings > M1_STRING_MAX. * module/mes/M1.mes (object->M1): Skip opening quote. 2018-04-30 Jan Nieuwenhuizen Revert "core: length: Check parameter." This reverts commit 1f52ed35c66febcce16e06868e803a39be7eda41. core: length: Check parameter. * src/mes.c (length): Check parameter. 2018-05-01 Jan Nieuwenhuizen test: enable all tests, use expect count, add tinycc tests. * build-aux/check-mescc.sh (tests): Add tinycc tests. * build-aux/diff.scm: Naive diff for tinycc tests. * build-aux/test.sh: Run diff when .expect found. 2018-04-29 Jan Nieuwenhuizen build: Simplify, drop make.scm experiment. * build.sh: Rewrite. * build-aux/build-cc.sh: New file. * build-aux/build-mes.sh: New file. * build-aux/build-mlibc.sh: New file. * build-aux/cc.sh: New file. * build-aux/cc-mes.sh: New file. * build-aux/cc-mlibc.sh: New file. * install.sh: Update. * make.scm: Remove. * guile/guix/make.scm: Remove. * guile/guix/records.scm: Remove. * guile/guix/shell-utilsg.scm: Remove. 2018-04-30 Jan Nieuwenhuizen core: Use length__. * src/mes.c (check_formals): Use length__. 2018-04-29 Jan Nieuwenhuizen mes-snarf: Support running with Mes. * build-aux/mes-snarf.scm: Support running with Mes. mes: Support -C and -L for Guile compatibility. * module/mes/boot-0.scm): Support -C and -L for Guile compatibility. mes: Support -e,--main option. * module/mes/boot-0.scm: Support -e,--main option. mes: Upgrade Guile module support. * module/mes/boot-0.scm (define-module): New macro with minimal Guile support. (use-modules): New macro. mes: Add srfi-8. * module/srfi/srfi-8.mes: New file. mes: string-join: Handle empty list. * module/mes/boot-0.scm (string-join): Handle empty list. mes: Add basename. * module/mes/posix.mes (basename): New function. mes: Add delete-duplicates. * module/srfi/srfi-1.mes (delete-duplicates): New function. mes: filter-map: Handle two lists. * module/srfi/srfi-1.mes (filter-map): Handle two lists, add error when called with three or more. mes: Add string-replace. * module/srfi/srfi-13.mes (string-replace): New function. * tests/srfi-13.test ("string-replace"): Test it. mes: Add string-map. * module/srfi/srfi-13.mes (string-map): New function. * tests/srfi-13.test ("string-map"): Test it. mes: Add string-trim, string-trim-right, string-trim-both. * module/srfi/srfi-13.mes (string-trim, string-trimn-right, string-trim-both): New function. * tests/srfi-13.test ("string-trim"): Test it. ("string-trim-right"): ("string-trim-both"): mes: Add string-contains. * module/srfi/srfi-13.mes (string-contains): New function. * tests/srfi-13.test ("string-contains"): Test it. ("string-contains not"): mes: string-drop: Error on negative droppings. * module/srfi/srfi-13.mes (string-drop, string-take, string-drop-right): Error on negative droppings. * tests/srfi-13.test ("string-drop"): Test it. core: reverse!: Handle empty list. * src/mes.c (reverse_x_): Handle empty list. * tests/scm.test ("reverse! ()"): Test it. core: Add string ports. * src/mes.c (type_t): Add TPORT. (scm_type_port): New symbol. (PORT): New macro. (MAKE_STRING_PORT): New macro. (eval_apply): Handle string ports in primitive-load. (mes_symbols): Add scm_type_port. * src/posix.c (peekchar): Handle string ports. (readchar): New function. Replace all getchar callers. (unreadchar): Likewise. * module/mes/type-0 (port?): New function. * module/mes/guile.mes (with-input-from-file): Rewrite. (open-input-string): Remove. * module/mes/guile.scm (guile): Update cell types. * src/gc.c (gc_loop): Support TPORT. * src/lib.c (display_helper): Support TPORT. * module/mes/display.mes (display): Support TPORT. mes: assq, assoc-ref: Handle non-A-LISTs. * src/mes.c (assq): Return #f if A-LIST is not a list. * module/mes/scm.mes (assoc): Likewise. core: Use single definition rule for cell-type. * src/mes.c (scm_type_char, scm_type_closure, scm_type_continuation, scm_type_function, scm_type_keyword, scm_type_macro, scm_type_number, scm_type_pair, scm_type_ref, scm_type_special, scm_type_string, scm_type_symbol, scm_type_values, scm_type_variable, scm_type_vector): New symbol. (mes_symbols): Add them. * module/mes/type-0.mes (, , , , , , , , , , , , , , , , guix: Update mes to 0.13. * guix.scm (mes): Update to 0.13. (mes.git): Likewise. 2018-04-27 Jan Nieuwenhuizen Release 0.13. * configure (VERSION): Bump to 0.13. 2018-04-21 Jan Nieuwenhuizen doc: Release udpate. * BOOTSTRAP: Update. * HACKING: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.13: New file. 2018-04-27 Jan Nieuwenhuizen mescc: Merge mescc.mes and mescc.scm. * scripts/mescc: New file. * scripts/mescc.mes: Remove. * guile/mescc.scm: Remove. * guile/guix/make.scm (CC.mescc): Update. * install.sh (TINYCC_SEED): Update. * make.scm (bootstrap?): Update. * test.sh (MES): Update. * check-boot.sh: Use $GUILE to allow running without Guile. core: Add chmod. * src/posix.c (chmod_): New function. 2018-04-25 Jan Nieuwenhuizen core: jam-scaper/garbage-collector: Use only one arena. * src/mes.c (ARENA_SIZE): Lower to 200000. (MES_MAX_ARENA): Bump to 300000000. (JAM_SIZE): New global. (make_cell__): Remove ARENA assert. (gc_init_cells): Alloc ARENA_SIZE + JAM_SIZE. (mes_symbols): Do not init news. (gc_init_news): Remove. (main): Initialize JAM_SIZE, consider MES_JAM environment variable. * src/gc.c (gc_init_news): Move from mes.c. Start at g_free. (gc_flip): Do not flip to g_news, instead copy g_news to cells. (gc_up_arena): Realloc to ARENA_SIZE + JAM_SIZE. (gc_): Init news. Only up arena if g_news is safe. 2018-04-24 Jan Nieuwenhuizen mescc: Create less garbage when dumping M1. * module/mes/M1.mes (display-join): New function. * (object->M1): Use it. core: last_pair: Move to core. * src/lib.c (last_pair): New function. * module/mes/scm.mes (last-pair): Remove. core: equal2_p: Add short-circuit and eliminate tail call. * src/lib.c (equal2_p): Add short-circuit and eliminate tail call. 2018-04-23 Jan Nieuwenhuizen mescc: Use display for dumping M1. * module/mes/M1.mes (object->M1): Use display for dumping M1. 2018-04-22 Jan Nieuwenhuizen mes: Guile-like command-line interface. * module/mes/boot-0.scm (tty?): Guile-like command-line interface. * scripts/repl.mes: Remove. * scripts/mescc.mes: Update. * tests/*.test: Update scripts. * module/mes/repl.mes (repl): Add ,quit. mes: getopt-long: Support stop-at-first-non-option. * module/mes/getopt-long.scm (process-options): Fix parsing `-'. Add parameter: stop-at-first-non-option. (getopt-long): Add keyword parameter #:stop-at-first-non-option. mes: Add isatty?. * src/posix.c (isatty_p): New function. mlibc: Add isatty. * lib/libc.c (isatty): New function. * include/unistd.h: Declare it. mlibc: Add ioctl. * stage0/x86.M1 (SYS_ioctl): New define. * lib/linux-mes.c (ioctl): New syscall. * lib/linux-gcc.c (ioctl): New syscall. * include/sys/ioctl.h: New file. 2018-04-10 Jan Nieuwenhuizen core: Compile minimal mes with MES_MINI=1. * src/mes.c: Compile minimal mes with MES_MINI=1. 2018-04-21 Jan Nieuwenhuizen core; reader_read_string: Support escaped characters. * src/reader.c (reader_read_string): Support escaped characters. 2018-04-22 Jan Nieuwenhuizen Revert "mescc: Use core:write." This reverts commit d88e31dfec3158a830c32f9f732b052cfccac6eb. 2018-04-21 Jan Nieuwenhuizen mescc: Use core:write. * scripts/mescc.mes (source->ast): Use core:write. 2018-04-22 Jan Nieuwenhuizen mes: display: Display escaped characters. * module/mes/display.mes (display): Display escaped characters. 2018-04-21 Jan Nieuwenhuizen core: display_helper: Display escaped characters. * src/lib.c (display_helper): Display escaped characters. mes: Resurrect macros in repl. * src/mes.c (scm_vm_begin_expand): Rename to core:begin-expand. (eval_apply): Expose it. * module/mes/repl.mes (repl): Use it to resurrect macros. core: Fixes for garbage collector/jam scraper. * src/gc.c (gc_loop): Do not relocate car of TCLOSURE, TCONTINUATION. Check for TBROKEN_HEART. * src/mes.c (make_closure_): Set car to 0. (check_apply): Check for TBROKEN_HEART. Fixes reporting artificial out-of-memory error. (eval_apply): Likewise. * src/vector.c (vector_entry): Only copy TCHAR and TNUMBER. core: drop global_p from variable. * src/mes (struct scm): Remove field global_p. (VARIABLE_GLOBAL_P): Remove. (make_variable_): Remove global_p parameter. Update callers. * src/lib.c (display_helper): Drop VARIABLE_GLOBAL_P support. core: Reenable full printing of lists. * src/lib.c (display_helper): Reenable full printing of lists. 2018-04-20 Jan Nieuwenhuizen core: append2, append_reverse, reverse, reverse!: Create less garbage. * src/mes.c (append_reverse): New function. (reverse_x_): New function. (append2): Use them to create less garbage. * module/mes/scm.mes (reverse): Create less garbage. * module/srfi/srfi-1.mes (reverse!): Rewrite, use core:reverse!. (append-reverse): Remove. core: vector_to_list: Create less garbage. * src/vector.c (vector_to_list): Create less garbage. core: Optimize vector-map, vector-for-each. * module/srfi/srfi-43.mes (vector-map): Optimize. (vector-for-each): Optimize. * tests/srfi-43.test: New file. * tests/srfi-43.test-guile: New file. * check.sh (tests): Add it. * make.scm (mes-tests): Add it. 2018-04-18 Jan Nieuwenhuizen Revert "build-32.sh" This reverts commit ace8b6f1b52de58c9ab404ed13234f397dac6bdc. 2018-04-16 Jan Nieuwenhuizen build-32.sh 2018-04-14 Jan Nieuwenhuizen core: Cleanup make_cell, remove tmp cells. * src/mes.c (make_cell__): New function. (make_cell_): Use it. (length__): New function. (tmp, tmp_num, tmp_num2, tmp_num_, tmp_num2_, make_tmps): Remove. Update callers to use make_cell__ directly. * src/vector.c (make_vector__): New function. (make_vector_): Use it. 2018-04-21 Jan Nieuwenhuizen Revert "mlibc: Use memmove in realloc." This reverts commit f47a21e3cb4814c4a30d10ff59e5c947441725e9. 2018-04-15 Jan Nieuwenhuizen mlibc: Use memmove in realloc. * src/libc.c (memmove): New function. (realloc): Use it. * src/libc+tcc.c (memmove): Remove. mes: Add char-whitespace? * module/srfi/srfi-14.mes (char-whitespace?): New function. 2018-04-14 Jan Nieuwenhuizen mes: Move base-0.mes int boot-0.scm. * module/mes/boot-02.scm: New file, rename from boot-0.scm. * module/mes/boot-0.scm: Add base-0.mes. * module/mes/base-0.mes: Remove. 2018-04-13 Jan Nieuwenhuizen mes: Unify mlibc-gcc and mes builds. * make.scm (bin.gcc): Remove stray slash. * src/mes.c: Unify mlibc-gcc and mes builds. (gc_init_cells): (gc_init_news): (bload_env): * src/reader.c (reader_read_character): (reader_read_string): 2018-04-12 Jan Nieuwenhuizen core: Remove local variables from gc. * src/gc.c (gl_loop): Remove local variables. core: Listen to MES_SAFETY environment variable. core: Remove local variables from eval/apply. * src/mes.c (eval_apply): Move all variables to global scope. core: Remove MesCC reminder. 2018-04-11 Jan Nieuwenhuizen core: Update default memory settings. * src/mes.c (MAX_ARENA_SIZE)[__MESC__]: Set to maximum 172100000. 2018-04-09 Jan Nieuwenhuizen core: Tune debug printing. * src/mes.c: Tune debug printing. * src/gc.c: Likewise. * module/mes/guile.mes: Likewise. * HACKING: Describe it. core: Rewrite reader to create less garbage. * src/reader.c (reader_read_line_comment): Rename from read_line_comment. (reader_identifier_p): New function. (reader_end_of_word_p): New function. (reader_read_identifier_or_number): New function. (reader_read_sexp_): Rewrite. Update callers. (reader_read_list): Rewrite. (reader_lookup_): Remove. 2018-04-10 Jan Nieuwenhuizen core: Add isspace. * include/ctype.h (isspace): Declare. * lib/libc.c (isspace): New function. 2018-04-08 Jan Nieuwenhuizen core: Rewrite string reader. * src/reader.c (reader_read_string): Rewrite, create much less garbage. (append_char): Remove. install: Fix prefix confusion. * install.sh: Substitute @PREFIX@ with MES_PREFIX. * scripts/mescc.mes: Grok PREFIX as MES_PREFIX. guix.scm: Update mes to 0.12. * guix.scm (mes, mes.git): Update to 0.12. 2018-04-06 Jan Nieuwenhuizen Release 0.12. * configure (VERSION): Bump to 0.12. 2017-11-21 Jan Nieuwenhuizen doc: Release udpate. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.12: New file. * throughout: (janneke) coming out. 2018-04-08 Jan Nieuwenhuizen guix.scm: Update mescc-tools to 0.4. * guix.scm (mescc-tools): Update to 0.4. core: Workaround for mescc. * src/mes.c (eval_apply)[__MESC__]: Add reminder for macro_p, global_p. 2018-04-07 Jan Nieuwenhuizen build: Remove scripts/mes symlink. mes: Add string-fold, string-fold-right. * module/srfi/srfi-13.mes (string-fold, string-fold-right): New function. * tests/srfi-13.test ("string-fold"): Test it. ("string-fold-right"): Test it. mes: Allow tick as part of identifier. * src/reader.c (reader_read_sexp_): Do not treat tick as special. mescc: Remove debugging. * module/language/c99/compiler.mes: Remove debugging. mescc: No comments in M1 when running on Mes. * module/language/c99/compiler.mes (ast-comment): If mes?, return nil. mescc: Trace globals. * module/language/c99/compiler.mes (mescc:trace): New function. Use throughout. Revert "core: Add member." This reverts commit 921686a0a3b06281f1804d04e6d4a0344dda507a. core: Add member. * src/lib.c (member): New function. * module/mes/scm.mes (member): Remove. mescc: trace M1 dumping. * module/language/c99/compiler.mes (info->object): Add tracing. * module/mes/M1.mes (object->M1): Add tracing. Revert "guix: Update nyacc to 0.83.31." This reverts commit 624b85d6b1dd876542f7ad342d6beb8a92408397. guix: Update nyacc to 0.83.31. * guix.scm (nyacc): Update to 0.83.31. mescc: Have Nyacc trace functions while parsing. * guile/mescc.scm (main): Set NYACC_TRACE. * scripts/mescc.mes (main): Set NYACC_TRACE. mes: Add setenv. * src/posix.c (setenv_): New function. * tests/base.test ("setenv, getenv"): Test it. core: Add setenv. * lib/libc.c (setenv): New function. * include/stdlib.h (setenv): Declare it. * scaffold/tests/61-array.c (test): Test it. 2018-04-05 Jan Nieuwenhuizen guix: Add manifest. * build-aux/manifest.scm: New file. guix: Update Nyacc to 0.80.42. * guix.scm (nyacc): Update to 0.80.42. 2018-04-06 Jan Nieuwenhuizen mescc: Also print `parsing: input' when using -E. * module/language/c99/compiler.mes (c99-input->ast): Print `parsing: input'. (c99-input->info): Remove that. 2018-04-05 Jan Nieuwenhuizen core: Cleanup reader. * src/reader.c (reader_read_sexp_): Rename from reader_read_word_. Cleanup. (read_hash): Cleanup. mes: Cleanup formatting. core: Add equal2?. * src/lib.c (equal2_p): New function. * module/mes/base.mes (equal2?): Remove. core: Add memq. * lib/mes.c (memq): New function. * module/mes/scm.mes (memq): Remove. mes: Remove duplicate memq. * module/mes/base-0.mes (memq): Remove. 2017-12-09 Jan Nieuwenhuizen mes: Single environment lookup for variables, SICP chapter 3. * src/mes.c (t): Add TVARIABLE. (scm_vm_eval_deref): New vm special. (make_vref_): New internal function. (eval_apply): WIP: replace symbols with their variable reference. * src/gc.c (gc_loop): Handle TVARIABLE. * src/lib.c (display_helper): Handle TVARIABLE. * module/mes/type-0.mes (): New variable. (cell:type-alist): Add it. (variable?): New function. * module/mes/display.mes (display): Handle . 2018-04-03 Jan Nieuwenhuizen core: Remove override hook for read-input-file. * src/reader.c (read_input_file_env): Remove override hook for read-input-file. 2018-03-04 Jan Nieuwenhuizen mes: Iterative recursive macro expand. * src/mes.c (eval_apply): Iterative recursive macro expand. * src/posix.c (set_current_input_port): Return previous port. * module/mes/catch.mes (%eh): Use core:display. * module/mes/display.mes (display-cut, display-cut2): Move macro definitions to toplevel. 2018-04-04 Jan Nieuwenhuizen guix: records.scm: update from upstream. * guile/guix/records.scm: Update from upstream. 2018-01-25 Jan Nieuwenhuizen mes: Add incremental test suite. * check-boot.sh: New file. * check.sh: Invoke it. * module/srfi/srfi-16.mes: New file. * scaffold/boot/00-zero.scm: New file. * scaffold/boot/01-true.scm: New file. * scaffold/boot/02-symbol.scm: New file. * scaffold/boot/03-string.scm: New file. * scaffold/boot/04-cons.scm: New file. * scaffold/boot/04-quote.scm: New file. * scaffold/boot/05-list.scm: New file. * scaffold/boot/06-tick.scm: New file. * scaffold/boot/07-if.scm: New file. * scaffold/boot/08-if-if.scm: New file. * scaffold/boot/10-cons.scm: New file. * scaffold/boot/11-list.scm: New file. * scaffold/boot/12-car.scm: New file. * scaffold/boot/13-cdr.scm: New file. * scaffold/boot/14-exit.scm: New file. * scaffold/boot/15-display.scm: New file. * scaffold/boot/16-if-eq-quote.scm: New file. * scaffold/boot/20-define-quote.scm: New file. * scaffold/boot/20-define-quoted.scm: New file. * scaffold/boot/20-define.scm: New file. * scaffold/boot/21-define-procedure.scm: New file. * scaffold/boot/22-define-procedure-2.scm: New file. * scaffold/boot/23-begin.scm: New file. * scaffold/boot/24-begin-define.scm: New file. * scaffold/boot/25-begin-define-2.scm: New file. * scaffold/boot/26-begin-define-later.scm: New file. * scaffold/boot/26-define-define.scm: New file. * scaffold/boot/27-lambda-define.scm: New file. * scaffold/boot/28-define-define.scm: New file. * scaffold/boot/29-lambda-define.scm: New file. * scaffold/boot/2a-lambda-lambda.scm: New file. * scaffold/boot/2b-define-lambda.scm: New file. * scaffold/boot/2c-define-lambda-recurse.scm: New file. * scaffold/boot/2d-define-lambda-set.scm: New file. * scaffold/boot/2e-define-second.scm: New file. * scaffold/boot/30-capture.scm: New file. * scaffold/boot/31-capture-define.scm: New file. * scaffold/boot/32-capture-modify-close.scm: New file. * scaffold/boot/33-procedure-override-close.scm: New file. * scaffold/boot/34-cdr-override-close.scm: New file. * scaffold/boot/35-closure-modify.scm: New file. * scaffold/boot/36-closure-override.scm: New file. * scaffold/boot/37-closure-lambda.scm: New file. * scaffold/boot/38-simple-format.scm: New file. * scaffold/boot/40-define-macro.scm: New file. * scaffold/boot/41-when.scm: New file. * scaffold/boot/42-if-when.scm: New file. * scaffold/boot/43-or.scm: New file. * scaffold/boot/44-or-if.scm: New file. * scaffold/boot/45-pass-if.scm: New file. * scaffold/boot/46-report.scm: New file. * scaffold/boot/47-pass-if-eq.scm: New file. * scaffold/boot/48-let.scm: New file. * scaffold/boot/49-macro-override.scm: New file. * scaffold/boot/4a-define-macro-define-macro.scm: New file. * scaffold/boot/4b-define-macro-define.scm: New file. * scaffold/boot/4c-quasiquote.scm: New file. * scaffold/boot/50-primitive-load.scm: New file. * scaffold/boot/51-module.scm: New file. * scaffold/boot/52-define-module.scm: New file. * scaffold/boot/53-closure-display.scm: New file. * scaffold/boot/60-let-syntax.scm: New file. * scaffold/boot/closure.scm: New file. * scaffold/boot/compose.scm: New file. * scaffold/boot/data/bar.mes: New file. * scaffold/boot/data/i.scm: New file. * scaffold/boot/data/module.mes: New file. * scaffold/boot/foo.scm: New file. * scaffold/boot/lambda-star.scm: New file. * scaffold/boot/vector.scm: New file. * tests/boot.test: New file. * tests/boot.test-guile: New file. * tests/srfi-16.test: New file. * tests/srfi-16.test-guile: New file. 2018-02-03 Jan Nieuwenhuizen mes: Boot from MES_BOOT, boot-0.scm. * src/mes.c (load_env): Softcode loading of boot-0.scm from environment variabl MES_BOOT. * module/mes/boot-00.scm: New file. * module/mes/boot-01.scm: New file. * module/mes/boot-0.scm: Rename from read-0.mes. * module/mes/module.mes: New file. 2018-03-04 Jan Nieuwenhuizen build: Add -fno-stack-protector for debian. * guile/guix/make.scm (%C32-FLAGS): Add -fno-stack-protector. 2018-01-06 Jan Nieuwenhuizen mes: reader: reader_ prefix; read/write char/string in core. * src/posix.c (peek_char, read_char, read_string, unread_char, write_char): New function. * src/reader.c: Use reader_ prefix. r# bootstrappable.org 2018-01-25 Jan Nieuwenhuizen mes: More informative error reporting for number asserts. * src/math.c (assert_number): New function. Update assert () users. 2018-01-27 Jan Nieuwenhuizen guile: Resurrect eval/apply in scheme. * guile/mes.mes (eval-expand): Short-circuit make-closure. * guile/mes.scm (environment): Update. 2018-02-03 Jan Nieuwenhuizen mes: simple-format: support ~A, ~S. * module/mes/display.scm (simple-format): support ~A, ~S. 2018-01-22 Jan Nieuwenhuizen core: Display and write string and char compliance. * src/lib.c (display_helper): Display and write char and string compliance. 2018-02-03 Jan Nieuwenhuizen mes: display: Support keyword. * src/lib.c (display_helper): Support keyword. 2018-01-12 Jan Nieuwenhuizen mes: display: vector. * src/lib.c (display_helper): Display vector. 2018-01-14 Jan Nieuwenhuizen mes: display: closure names. * src/lib.c (display_helper): Display closure names. 2018-01-07 Jan Nieuwenhuizen mes: Rename make-vector to core:make-vector. * src/vector.c (make_vector_): Rename from make_vector. Update callers. mes: Better error reporting. * src/lib.c (write_error_): New function. * src/mes.c (error, check_apply): Use it. (append2, set_car_x): Upon error, call error (WAS: assert). Revert "mes: un-defmacro optargs. WIP" This reverts commit 5da527c540dc0e1481a010899233b4e806fe37da. 2018-01-06 Jan Nieuwenhuizen mes: un-defmacro optargs. WIP mes: Test optargs without pmatch. * tests/optargs.test: Remove pmatch. mes: Add define-macro*. * module/mes/optargs.mes (define-macro*): New macro. 2018-01-05 Jan Nieuwenhuizen mes: Evaluate test of COND only once. * module/mes/base-0.mes (cond): Evaluate test of COND only once. Fixes cond tests with side effects (Nyacc). * tests/base.test ("cond side effect"): Test it. 2018-01-04 Jan Nieuwenhuizen mes: #\page is whitespace. * module/srfi/srfi-14.mes (char-set:whitespace): Add #\page. mes: # is not a character. * module/mes/display.mes (display): * module/mes/type-0.mes (char?): -1 is not a character. (eof-object?): New function. * tests/base.test ("#"): Test it. * module/mes/scm.mes (eof-object?): Remove. (unread-char): Return character (WAS: integer). mes: open-input-string: peek fix. * module/mes/guile.mes (open-input-string): Return actual tell. * tests/guile.test ("open-input-string peek"): Test it. mes: with-input-from-string: peek fix. * module/mes/guile.mes (with-input-from-string): Return actual tell. * tests/guile.test ("with-input-from-string peek"): Test it. 2018-01-03 Jan Nieuwenhuizen mescc: Resurrect guile-1.8. * guile/mescc.scm: Use GUILE_LOAD_COMPILED_PATH instead of -C. [guile]: Include syncase. * module/language/c99/compiler.scm [guile]: Stub pretty-print-c99. Set stack to unlimited. * module/language/c99/info.scm [guile]: Include (ice-9 syncase). * module/mes/as-i386.scm [guile]: Likewise. * module/mes/guile.scm [guile]: Add compose, export it. mes: Add string-drop-right. * module/srfi/srfi-13.mes (string-drop-right): New function. 2018-01-02 Jan Nieuwenhuizen mescc: cleanups. * guile/mescc.scm: Cleanups. * module/language/c99/compiler.mes: * module/language/c99/compiler.scm: * module/language/c99/info.mes: * module/language/c99/info.scm: * module/mes/getopt-long.mes: * module/mes/optargs.mes: * module/mes/optargs.scm: * module/mes/repl.mes: * module/mes/scm.mes: * scripts/mescc.mes: nyacc cpp-debugging, tests mes: getopt-long: fix multi-opt and unclumping. * module/mes/getopt-long.scm (remove-if-not): Remove. (option-spec): Add value field. Update users. (expand-clumped-singles): Simplify, fix. (process-options): To get an option's value, use value instead of value-policy. Fixes multi-opt. * tests/getopt-long.test: New file. * make.scm (mes-tests): Add it. * check.sh (tests): Add it. * tests/getopt-long.test-guile: New symlink. guix: back to 0.80.41 for tinycc. guix.scm (nyacc): New variable. 2018-01-01 Jan Nieuwenhuizen mes: Support equal? with arbitrary number of arguments. * module/mes/base.mes (equal2?): Rename from equal?. (equal?): Implement. mescc: Use records for mes too. * module/language/c99/info.mes: Use info.scm records, remove simplistic list data structures. mescc.mes: Use write for preprocessing output. * scripts/mescc.mes (source->ast): Use core:write instead of pretty-print. mes: Add write, core:write. * src/lib.c (display_helper, fdisplay_): Add parameter, write_p. Update callers. When write_p: write quoted strings. (write_, write_port_): New function. * module/mes/read-0.mes (write): New function. mes: gc_safety. check-mescc.sh: run with mes. * src/build.sh: * src/check-mescc.sh: Run with mes. mes: Add string-null?. * module/srfi/srfi-13.mes (string-null?): New function. mes: Add dirname. * module/mes/guile.mes (dirname): New function. 2018-01-01 Jan Nieuwenhuizen test: Add syntax tests. * tests/syntax.test: New file. * tests/syntax.test-guile: New file. fixup: 1b0696f9 (Jan Nieuwenhuizen 2018-01-01 15:53:13 +0100 40) , (lambda () 2017-12-17 Jan Nieuwenhuizen Revert "mes: use array-based stack. WIP: will not survice gc." This reverts commit 7fb653f68c2dbf8bc83cce4bd138439c600b538f. 2017-12-14 Jan Nieuwenhuizen mes: use array-based stack. WIP: will not survice gc. * src/mes.c (STACK_SIZE)[MES_ARRAY_STACK]: New variable. (g_stack_array): New variable. (g_stack): Change type to SCM*. * (gc_push_frame)[MES_ARRAY_STACK]: Use g_stack_array, g_stack. (gc_peek_frame): Likewise. (gc_pop_frame): Likewise. * src/gc.c (gc_check): Likewise. (gc): Likewise. 2017-12-12 Jan Nieuwenhuizen mes: Fix assq to improve performance. * src/mes.c (assq): Special case eq_p to improve performance. 2017-12-11 Jan Nieuwenhuizen mes: Reimplement records. * module/srfi/srfi-9.mes (define-record-type): New macro. * AUTHORS: Update. * module/mes/record-0.mes: Remove. * module/mes/record.mes: Remove. * module/srfi/srfi-9-psyntax.mes: Remove. * module/srfi/srfi-9.scm: Remove. * make.scm: Remove them. mes: Fix display of closure. * module/mes/display.mes (display): Drop extra ( at start of *closure*, *circ*. * src/lib.c (display_helper): Likewise. 2017-12-09 Jan Nieuwenhuizen mes: Resurrect define, define-macro in C core. * make.scm (bin.gcc, bin.mescc): Use MES_C_READER=1. * src/mes.c (scm_symbol_define, scm_symbol_define_macro): New symbol. (scm_vm_eval_define): New special. (scm_symbol_c_define): New symbol. (MAKE_MACRO): New define. (eval_apply)[MES_C_DEFINE]: Handle define, define-macro. (mes_symbols): Define %c-define for use in read-0.mes. * module/mes/read-0.mes: Do not implement full scheme define if %c-define. * module/mes/quasiquote.mes (sexp:define, env:define, env:macro): New function. (define-macro): New macro. FIXME * module/mes/psyntax.mes (define): New macro. FIXME 2017-12-10 Jan Nieuwenhuizen mes: Fix initial display. * module/mes/read-0.mes (display): Fix. 2017-12-11 Jan Nieuwenhuizen mes: Fix compile warning in reader. * src/reader.c[MES_C_READER]: Declare read_block_comment, read_hash. Fixes compile warning. 2017-12-09 Jan Nieuwenhuizen mescc: Allow invoking git mescc.mes from elsewhere. * src/mes.c (load_env): Look in MES_PREFIX too. Add debug printing. * scripts/mescc.mes: Consider MES_PREFIX. * guile/mescc.scm (%prefix): Consider MES_PREFIX. * module/mes/base-0.mes (string->list): New function, move from type-0.mes. (%moduledir): Consider MES_PREFIX. * module/mes/type-0.mes (string->list): Remove. mescc: Output performance hacks: use core:display. * src/lib.c (display_): Write to g_stdout (WAS: STDOUT). * module/mes/guile.scm (guile): Declare and export core:display core:display-error. * module/mes/M1.mes (object->M1): Use core:display and string-append instead of format. * module/mes/guile.mes (with-input-from-string): Add debugging. (open-input-string): Likewise. (read-string): Likewise. Re-implement. (drain-input): Use read-string. mes: Nyacc support: substring/copy, substring/shared. * module/srfi/srfi-13.mes (substring/copy, substring/shared): Define to substring. mes: Nyacc support: Read old characters. * src/reader.c (read_character)[MES_C_READER]: Support reading old characters: #\bel, #\bs, #\vt. mes: resurrect running MesCC: handle \t in strings. * src/reader.c (read-string): Handle \t. Fixex M1 output. mescc: Use small, bootstrappable syntax rather than huge psyntax seed. * module/nyacc/lex.mes (mes): Use syntax (WAS: psyntax). * module/mes/pmatch.mes (mes): Likewise. * module/nyacc/lang/c99/parser.mes (srfi-9): Use syntax (WAS: srfi-9-psyntax). mes: Fix for pmatch on bootstrappable syntax-rules. * module/mes/pmatch.scm (ppat): Do not use let. * tests/pmatch.test ("pmatch nyacc minimal", "pmatch nyacc"): Test it. 2017-12-05 Jan Nieuwenhuizen mlibc: M4 support: robustify headers, add sys/signal.h. * include/errno.h (ERANGE): New define. * include/stdarg.h (size_t): Undefine before typedef. * include/stdint.h: Likewise. * include/stdio.h: Likewise. * include/stdlib.h: Likewise. * include/sys/types.h: Likewise. * include/string.h: Likewise. (ssize_t): Undefine before typedef. * include/unistd.h: Likewise. (off_t): Undefine before typedef. * include/sys/stat.h (struct stat): New stub. * include/sys/signal.h: New file. 2017-12-04 Jan Nieuwenhuizen mescc: M4 support: scaffold/tests/82-define.c. * scaffold/tests/82-define.c: New file; inspired by M4. Thanks, Ricardo! * make.scm ("82-define"): Build it. * check-mescc.sh: Add 82-define. mlibc: Tinycc support: Avoid hex. * include/00-test.i (main)[__TINYC__]: Do not use $0x. mlibc: Tinycc support: qsort. * lib/libc+tcc.c (qswap, qpart): New function (qsort): Implement. * scaffold/tests/81-qsort.c: Test it. * make.scm ("81-qsort"): Build it. 2017-12-03 Jan Nieuwenhuizen mescc: scaffold: misc cleanups. * scaffold/tests/44-switch.c (swits): More case labels. * scaffold/tests/60-math.c: Discriminate return values. * scaffold/tests/77-pointer-assign.c (memset)[__TINYC__]: Remove. * scaffold/tests/79-int-array.c (test): Discriminate return values. mlibc: Tinycc support: __udivdi3, __umoddi3. * lib/libc+tcc-gcc.c (__udivdi3, __umoddi3): Fix signature, do not crash on simple integer devisions. mescc: Tinycc support: Respect word size better. * stage0/x86.M1 (movzwl_0x32(%ebp),%eax,movzwl_0x8(%ebp),%eax): New define. * module/mes/as-i386.mes (i386:push-word-local-de-ref, i386:word-local->accu): New function. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (push-local-de-ref): Respect word size. (ident->accu): Likewise. mlibc: New library layout; remove duplication. * lib/libc+tcc-gcc.c: New file: Libc bits for GCC from libc-mes+tcc.c. * lib/libc+tcc-mes.c: New file: Libc bits for MesCC from libc-mes+tcc.c. * lib/libc+tcc.c: New file: Libc bits from libc-mes+tcc.c. * lib/libc.c: New file: Merged from libc-mes.c, libc-gcc.c. (abtoi): New function: Rename from _atoi. * lib/linux+tcc-gcc.c: New file: Linux bits from libc-gcc+tcc.c. * lib/linux+tcc-mes.c: New file: Linux bits from libc-mes+tcc.c. * lib/linux-gcc.c: New file: Linux bits from libc-gcc.c. * lib/linux-mes.c: New file: Linux bits from libc-mes.c. * lib/mini-libc-gcc.c: New file. * lib/mini-libc.c: New file: Libc bits from mini-libc-mes.c. * lib/mini-linux-gcc.c: New file. * lib/mini-linux-mes.c: New file: Linux bits from mini-libc-mes.c. * lib/libc-gcc.c: Remove duplication using include now. * lib/libc-mes.c: Likewise. * lib/mini-libc-mes.c: Likewise. * include/stdio.h (puts)[POSIX]: Remomve macro. (fputc, fputs)[!POSIX]: New macro. (fputc, fputs): Remove declaration. * scaffold/tests/7j-strtoull.c (strtoull, test): Use abtoi. * src/lib.c (fputs)[__MESC__]: Remove define. * guile/guix/make.scm: Update for new library layout. * make.scm: Likewise. * build.sh: Likewise. * install.sh: Likewise. mlibc: Tinycc support: itoab, for debugging. * lib/libc-gcc.c (itoab): New function. * lib/libc-mes.c (itoab): New function. 2017-12-02 Jan Nieuwenhuizen mescc: prefix string labels with _. * module/mes/M1.mes (object->M1): Prefix string lables with _. mescc: prefix local labels with _. * module/language/c99/compiler.mes (expr->accu): prefix local labels with _. bootstrap: Update build script. * build.sh: Add blood-elf, use -o. mlibc: Mescc-tools support: fix for [v]fprintf. * lib/libc-mes+tcc.c (vfprintf): Bugfix: print to fd. 2017-11-29 Jan Nieuwenhuizen mes: resurrect full reader in C core. * module/mes/read-0.mes (defined?): New function. (eat-whitespace, read-env, read-word, read-block-comment, read-line-comment, read-list, read-character, read-hex, read-octal, reader:read-string, lookup, read-hash, read-word): Only define if not %c-reader. * module/mes/base-0.mes (defined?): Remove. * src/mes.c[MES_C_READER]: Set ARENA_SIZE=10000000. (scm_symbol_quasiquote scm_symbol_unquote, scm_symbol_unquote_splicing, scm_symbol_syntax, scm_symbol_quasisyntax, scm_symbol_unsyntax, scm_symbol_unsyntax_splicing): New symbol. (scm_symbol_c_reader): New symbol. (MAKE_KEYWORD)[MES_C_READER]: New define. (mes_symbols): Define %c_reader. * src/reader.c (read_word_)[MES_C_READER]: Extend to full Scheme reader. (eat_whitespace)[MES_C_READER]: Likewise. (read_block_comment, read_hash, read_word, read_character, read_octal, read_hex, append_char, read_string)[MES_C_READER]: Likewise. * make.scm (bin.gcc,bin.mescc): Define MES_C_READER=1. 2017-11-27 Jan Nieuwenhuizen mescc: Mescc-tools support: char foo[BAR] = {'a', 'b', 'c'}. * stage0/x86.M1 (mov____%al,0x8(%ebp), mov____%al,0x32(%ebp), mov____%ax,0x8(%ebp), mov____%ax,0x32(%ebp)): New define. * module/mes/as-i386.mes (i386:accu->local+n,i386:byte-accu->local+n, i386:word-accu->local+n): New function. * module/language/c99/compiler.mes (accu->local+n): New function. (initzer->data): Return char as single byte. (decl->info): Support char foo[BAR] = {'a', 'b', 'c'}. * scaffold/tests/66-local-char-array.c: Test it. * make.scm (add-scaffold-test): Build it. 2017-11-26 Jan Nieuwenhuizen mlibc: Mescc-tools support: chmod. * stage0/x86.M1 (SYS_chmod): New define. * lib/libc-gcc.c (chmod): New function. * lib/libc-mes.c (chmod): New function. mlibc: GNU Gcc support: setjmp, longjmp. * stage0/x86.M1 (jmp____*%ebx): New macro. (mov____0x8(%ebp),%ebp): New macro. (mov____0x8(%ebp),%esp): New macro. * include/setjmp.h (jmp_buf): Redefine as struct. * lib/libc-mes+tcc.c (longjmp, setjmp): Implement. * scaffold/tests/80-setjmp.c: Test it. * make.scm ("80-setjmp"): Build it. * .gitignore: Ignore *.tcc-guile. 2017-11-25 Jan Nieuwenhuizen mlibc: GNU Gcc support: ferror. * lib/libc-mes+tcc.c (ferror): New function. * include/stdio.h (ferror): Declare it. 2017-11-24 Jan Nieuwenhuizen bootstrap: Add bootstrap build scripts. * build.sh: New file. * check-mescc.sh: New file. * check.sh: New file. * install.sh: New File. 2017-11-23 Jan Nieuwenhuizen remove obsolete Nyacc link. * guile/nyacc: Remove. 2017-11-22 Jan Nieuwenhuizen build: mlib/include to include, move mlib to lib. * include: Move from mlib/include. * lib: Move from mlib. * BOOTSTRAP: Update. * HACKING: Update. * guile/guix/make.scm: Update. * make.scm: Update. * module/language/c99/compiler.mes: Update. 2017-11-21 Jan Nieuwenhuizen mes: Resurrect running mes tests tests/*.test with Guile. * tests/tests/base.test-guile: New file to resurrect running Mes test with Guile. * tests/catch.test-guile: Symlink for same purpose. * tests/closure.test-guile: Likewise. * tests/cwv.test-guile: Likewise. * tests/display.test-guile: Likewise. * tests/fluids.test-guile: Likewise. * tests/guile.test-guile: Likewise. * tests/let-syntax.test-guile: Likewise. * tests/let.test-guile: Likewise. * tests/match.test-guile: Likewise. * tests/math.test-guile: Likewise. * tests/module.test-guile: Likewise. * tests/optargs.test-guile: Likewise. * tests/peg.test-guile: Likewise. * tests/pmatch.test-guile: Likewise. * tests/psyntax.test-guile: Likewise. * tests/quasiquote.test-guile: Likewise. * tests/read.test-guile: Likewise. * tests/record.test-guile: Likewise. * tests/scm.test-guile: Likewise. * tests/srfi-1.test-guile: Likewise. * tests/srfi-13.test-guile: Likewise. * tests/srfi-14.test-guile: Likewise. * tests/vector.test-guile: Likewise. * make.scm (add-guile-test): New function. Use it to run running tests/*.test-guile. 2017-11-20 Jan Nieuwenhuizen mes: resurrect running MesCC: handle \t in strings. * module/mes/read-0.mes (reader:read-string): Handle \t. Fixex M1 output. mes: Nyacc support: with-fluids. * module/mes/fluids.mes (with-fluids): New macro. * tests/fluids.test ("with-fluids"): Test it. mes: resurrect running MesCC: update info interface. * module/language/c99/info.mes (type?, global?, local?): New function. (make-global): Remove name parameter. * module/nyacc/lang/c99/pprint.mes: New file. 2017-12-17 Jan Nieuwenhuizen mes: Add last. * module/srfi/srfi-1.mes (last): New funcion. 2017-11-20 Jan Nieuwenhuizen mes: Add reverse-list->string. * module/srfi/srfi-13.mes (reverse-list->string): New function. bootstrap: Unbundle necessary M1 sources. * mlibc/crt1.M1: Remove. * mlibc/libc-mes.M1: Remove. * src/mes.M1: Remove. 2017-11-19 Jan Nieuwenhuizen mlibc: Mescc-tools support: fix fgetc. * mlibc/libc-mes.c (fgetc): Fix from completely fubar. mlibc: Mescc-tools support: strtol: partly implement stub. * mlibc/libc-mes+tcc.c (strtol): Partly implement stub. mlibc: Mescc-tools support: getopt, getopt_long. * mlibc/getopt.c: Move to ANSI C. Remove GETOPT_COMPAT and non-POSIXLY_CORRECT options. * mlibc/include/getopt.h: New file. * mlibc/libc-gcc+tcc.c: Include getopt.c. * mlibc/libc-mes+tcc.c: Likewise. mlibc: Mescc-tools support: import getopt_long. * mlibc/getopt.c: Import from gcc-2.0. Revert "mescc: Grok char foo[] parameter." This reverts commit c4cc75105db48b550cd515751b766b2e7a88ddc3. mescc: Grok char foo[] parameter. * module/language/c99/compiler.mes (function->text+data): Grok char foo[] parameter. mescc: Grok char *const foo[]; * module/language/c99/compiler.mes (ast-strip-const): Grok char *const argv[]; mlibc: Mescc-tools support: endianness. * mlibc/include/endian.h: New file. * mlibc/include/ctype.h[!(__GNUC__ && POSIX)]: Include it. * mlibc/include/stdlib.h: Likewise. * mlibc/include/sys/types.h: Likewise. mlibc: Mescc-tools support: exit stati. * mlibc/include/stdlib.h (EXIT_FAILURE, EXIT_SUCCESS): New define. 2017-11-18 Jan Nieuwenhuizen mescc: cleanup obsolete Nyacc 0.7x compatibility. * module/language/c99/compiler.mes (ast-type->type, ast->type expr->accu, struct-field, decl->info,): Remove obsolete Nyacc 0.7x patterns. guix: Release update. * guix.scm (mes): Update commit, hash and version. Add 'make-git-source-writable stage. Release 0.11. * configure (VERSION): Bump to 0.11. 2017-11-11 Jan Nieuwenhuizen doc: Release udpate. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.11: New file. 2017-11-18 Jan Nieuwenhuizen build: fix for 07-include, thanks rain1! * make.scm (add-scaffold-test): New keyword parameter: includes. ("07-include"): Use it. build: support gcc -m32, thanks rain1! * guile/guix/make.scm (%CC32): fallback to %CC. (%C32-FLAGS): Add -m32, to suppor gcc -m32. (LINK.gcc): Use it. 2017-11-18 Jan Nieuwenhuizen bootstrap: Update necessary M1 sources. M1 -f stage0/x86.M1 -f mlibc/crt1.M1 --LittleEndian --Architecture=1 > mlibc/crt1.hex2 M1 -f stage0/x86.M1 -f mlibc/mini-libc-mes.M1 --LittleEndian --Architecture=1 > mlibc/libc-mes.hex2 M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2 hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f mlibc/crt1.hex2 -f mlibc/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes exec_enable src/mes-mes * mlibc/libc-mes.M1: Update. * src/mes.M1: Udate. 2017-11-18 Jan Nieuwenhuizen mescc: Tinycc support: test #include. * scaffold/tests/exit-42.i: New file. * scaffold/tests/07-include.c: New file. * make.scm ("07-include"): Build it. 2017-11-17 Jan Nieuwenhuizen mescc: Tinycc support: struct struct array. Support struct foo { struct bar baz[N]; struct bar bla*[M]; }; * module/language/c99/compiler.mes (expr->accu): * scaffold/tests/7n-struct-struct-array.c: Test it. * make.scm (add-scaffold-test): Build it. 2017-11-16 Jan Nieuwenhuizen mlibc: Tinycc support: support, most syscalls stubbed. * mlibc/libc-gcc.c (exit, write)[__TINYC__]: tcc-compatible gcc-style asm implementation. (read,open,access,brk,fsync)[__TINYC__]: Stub body. * mlibc/libc-gcc+tcc.c (close,unlink, lseek, getcwd)[__TINYC__]: Stub body. * mlibc/libc-mes+tcc.c: Support tinycc. * mlibc/include/00-test.i (main) [__TINYC__]: Support tcc. mescc: Tinycc support: empty for. * module/language/c99/compiler.mes (test-jump-label->info): Handle empty expression. * make.scm (add-tcc-test "45_empty_for"): Test it. tinycc: scaffold/main.c: running mes-tcc compiled binary #6. * scaffold/main.c (main): Use variable, if, argc, ++, +=, function call to return 42. 2017-11-15 Jan Nieuwenhuizen tinycc: scaffold/main.c: running mes-tcc compiled binary #5. * scaffold/main.c (main): Use function call and variable to return 42. 2017-11-14 Jan Nieuwenhuizen tinycc: scaffold/main.c: running mes-tcc compiled binary #4. * scaffold/main.c (main): Use variables to return 42. mescc: Tinycc support: workaround lack of long long support. * module/language/c99/compiler.mes (i386:type-alist): Use size=4 for long long as a workaround. 2017-11-11 Jan Nieuwenhuizen mescc: refactor expr->accu, expr->accu*, fixes nontrivial struct by value assign. * module/language/c99/compiler.mes: (pke): New function. (expr->number): Rename from p-expr->number. Update callers. (decl->info, init-declr->pointer, struct-field): Several pointeryness fixes. (expr->accu*, expr->accu): Remove special-casing for foo.bar, foo->bar, foo[bar]. Fixes struct by value assign for non-trival expressions. (accu->ident, ident-address->accu, ident->accu): (base->ident-address, ident->base): Remove. * scaffold/tests/7k-for-each-elem.c (test): Test it. * scaffold/tests/7c-dynarray.c (test): Test it. * scaffold/tests/7m-struct-char-array-assign.c: Test it. * make.scm (add-scaffold-test): Build it. mlibc: errno.h: declare errno without extern. * mlibc/include/errno.h: drop extern. Fixes tcc compile. guix: nyacc: Update to 0.82.4. * guix.scm (nyacc): Update to 0.82.4. 2017-09-10 Jan Nieuwenhuizen guix: Release update. * guix.scm (mes): Update commit, hash and version. Release 0.10. * configure (VERSION): Bump to 0.10. doc: Release udpate. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * doc/ANNOUNCE-0.10: New file. * BOOTSTRAP: New file. * make.scm: Install them. 2017-09-10 Jan Nieuwenhuizen bootstrap: Include necessary M1 sources. M1 -f stage0/x86.M1 -f mlibc/crt1.M1 --LittleEndian --Architecture=1 > mlibc/crt1.hex2 M1 -f stage0/x86.M1 -f mlibc/mini-libc-mes.M1 --LittleEndian --Architecture=1 > mlibc/libc-mes.hex2 M1 -f stage0/x86.M1 -f src/mes.M1 --LittleEndian --Architecture=1 > src/mes.hex2 hex2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000 -f stage0/elf32-header.hex2 -f mlibc/crt1.hex2 -f mlibc/libc-mes.hex2 -f src/mes.hex2 -f stage0/elf32-footer-single-main.hex2 > src/mes-mes exec_enable src/mes-mes * mlibc/crt1.M1: New File. * mlibc/libc-mes.M1: New File. * src/mes.M1: New File. 2017-09-10 Jan Nieuwenhuizen guix: Bump Nyacc to 0.82.0. * guix.scm (nyacc): Bump to 0.82.0. mescc: Support Nyacc-0.81.0. * module/language/c99/compiler.mes (ast->info): Handle asm-expr from Nyacc 0.81.0. 2017-09-03 Jan Nieuwenhuizen tinycc: scaffold/main.c: running tcc-compiled binary #3. * scaffold/main.c (main): Remove asm. 2017-09-10 Jan Nieuwenhuizen mescc: Tinycc support: struct by value assign. * module/language/c99/compiler.mes (expr->accu): warn for unsupported sizes. * scaffold/tests/7h-struct-assign.c (test): Test it. 2017-09-02 Jan Nieuwenhuizen tinycc: scaffold/main.c: running tcc-compiled binary #2. * scaffold/main.c (main)[__i386__]: Rename from _start. 2017-09-10 Jan Nieuwenhuizen build: compile crt1.c, libc-mesc.c and .c separately. * mlibc/crt1.c: New file. * mlibc/libc-mes.c (_start): Remove. * mlibc/libc-gcc.c (_start): Remove. * make.scm (LINK.hex2, bin.mescc): Move from guile/guix/make.scm. * guile/guix/make.scm (LINK.hex2, bin.mescc): Remove. 2017-09-03 Jan Nieuwenhuizen mescc: Tinycc support: refactor _start. * mlibc/libc-mes.c (_start): Refactor. (_env): Remove. * stage0/x86.M1: 2017-08-19 Jan Nieuwenhuizen tinycc: scaffold/main.c: first running tcc-compiled binary. * scaffold/main.c (_start): Exit 42 using asm. 2017-08-27 Jan Nieuwenhuizen mescc: Tinycc support: fix *--p = 'x'. * module/language/c99/compiler.mes (expr->accu): Respect size in *--p = 'x'. * scaffold/tests/23-pointer.c (test): Test it. mescc: Tinycc support: initializer arithmetic. * module/language/c99/compiler.mes (p-expr->bool): New function (p-expr->number): Support bitwise-and, bitwise-not, cast, cond-expr. core: Add logand, lognot. * src/math.c (logand, lognot): New function. mescc: Tinycc support: array of struct of any size. * module/language/c99/compiler.mes (accu*value): New function (expr->accu*): Use it to support array of struct of any size. * scaffold/tests/7l-struct-any-size-array.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: stdint.h: declare size_t. * mlibc/include/stdint.h (size_t)[!__MES_SIZE_T]: Declare. 2017-08-26 Jan Nieuwenhuizen mescc: Tinycc support: pointer arithmetic with pointer-variable. * module/language/c99/compiler.mes (expr->accu): pointer arithmetic with pointer-variable. * scaffold/tests/76-pointer-arithmetic.c (test): Test it. * mlibc/include/stdarg.h (va_start): Update for fixed pointer arithmetic. 2017-08-25 Jan Nieuwenhuizen mescc: Tinycc support: pointer arithmetic with &variable. * module/language/c99/compiler.mes (expr->pointer): Handle ref. * scaffold/tests/76-pointer-arithmetic.c: Test it. 2017-08-23 Jan Nieuwenhuizen mescc: Tinycc support: pointer arithmetic with variable. * module/language/c99/compiler.mes (expr->accu): Support pointer arithmetic with variable: p + i, p - i, p += i, p -= i. * scaffold/tests/76-pointer-arithmetic.c (test): Test it. mescc: Tinycc support: handle pointerness, siziness for cast foo*. * module/language/c99/compiler.mes (expr->pointer): Support cast foo*. (expr->size): Likewise. * scaffold/tests/7k-for-each-elem.c: Test it * make.scm (add-scaffold-test): Build it. 2017-08-19 Jan Nieuwenhuizen mescc: Tinycc support: strtoull. * mlibc/include/mlibc.h (_atoi): Declare. * mlibc/include/ctype.h (isxdigit): Declare. * mlibc/libc-gcc.c (isxdigit, _atoi): New function. (atoi): Use it. * mlibc/libc-mes.c (isxdigit, _atoi): New function. (atoi): Use it. * scaffold/tests/7j-strtoull.c (test): Test it. * make.scm (add-scaffold-test): Build it. 2017-08-12 Jan Nieuwenhuizen mescc: Tinycc support: snprintf. * mlibc/include/stdarg.h (vsprintf): Declare. * mlibc/libc-gcc.c (vsprintf): New function. (sprintf): Use it. * mlibc/libc-mes+tcc.c (snprintf): Implement. * mlibc/libc-mes.c (vsprintf): New function (sprintf): Use it. 2017-08-10 Jan Nieuwenhuizen mescc: Tinycc support: struct.struct. * module/language/c99/compiler.mes (field:name): (field:pointer): (field:size): (field:type): (field-field): (field-offset): (struct-field): Support struct.struct. * scaffold/tests/7i-struct-struct.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Fix compile warnings. * mlibc/include/stdio.h (fdputs): Declare. * mlibc/libc-gcc.c (malloc): (memcpy): Fix compile warning. mescc: Tinycc support: --*p, ++*p. * module/language/c99/compiler.mes (expr->accu): Remove specific --/++. (expr->accu*): Support p, *p. * scaffold/tests/76-pointer-arithmetic.c (test): Test it. 2017-08-08 Jan Nieuwenhuizen mescc: Tinycc support: word array assignment. * stage0/x86.M1 (movzwl_(%eax),%eax): New define. * module/mes/as-i386.mes (i386:word-mem->accu): New function. * module/mes/as-i386.scm: Export it. * module/language/c99/compiler.mes (expr->accu): word array assignment. (expr->accu*): word array assignment. * scaffold/tests/7a-struct-char-array.c (test): Test it. 2017-08-07 Jan Nieuwenhuizen mescc: Tinycc support: struct char array assignment. * module/language/c99/compiler.mes (expr->accu): struct char array assignment. * scaffold/tests/7a-struct-char-array.c (test): Test it. 2017-08-06 Jan Nieuwenhuizen mescc: Tinycc support: struct assign by value. * module/language/c99/compiler.mes (base->ident): Remove. (accu->ident): Use them to support assign of size >4 by value. * scaffold/tests/7h-struct-assign.c: Test it. * make.scm (add-scaffold-test): Build it. * module/mes/as-i386.mes (i386:base->local): Remove. (i386:accu*n->local): (i386:accu*n->label): New functions. * module/mes/as-i386.scm: Export them. * stage0/x86.M1: (mov____%ebx,0x32): (mov____%ebx,0x32(%ebp)): (mov____%ebx,0x8(%ebp)): (mov____%ebx,0x8(%edx)): (mov____%ecx,0x32(%ebp)): (mov____%ecx,0x8(%ebp)): (mov____0x32(%eax),%ebx): (mov____0x32(%eax),%ecx): (mov____0x8(%eax),%ebx): New define. mescc: Tinycc support: eputc. * mlibc/include/stdio.h (eputc): Declare. * mlibc/libc-gcc.c (eputc): * mlibc/libc-mes.c (eputc): New function. mescc: Move simple main to scaffold. * scaffold/main.c (main): Move from doc/examples/main.c * make.scm: Build it. * README: Update. * guile/mescc.scm (main): * scripts/mescc.mes (main): Remove fallback doc/examples/main.c mescc: Tinycc support: byte and word struct fields. * stage0/x86.M1 (mov____%al,0x8(%edx)): (mov____%ax,(%edx)): (mov____%ax,0x32(%edx)): (mov____%ax,0x8(%edx)): (movzbl_0x32(%eax),%eax): (movzbl_0x8(%eax),%eax): (movzwl_0x32(%eax),%eax): (movzwl_0x8(%eax),%eax): New define. * module/mes/as-i386.mes (i386:word-accu->base-mem): (i386:byte-accu->base-mem+n): (i386:word-accu->base-mem+n): (i386:byte-mem+n->accu): (i386:word-mem+n->accu): New function. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (struct-field): Use actual size for simple types (WAS: 4). (decl->info): (expr->accu): Respect byte and word struct field sizes. * scaffold/tests/7g-struct-byte-word-field.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: eputs as function for gcc. * mlibc/libc-gcc.c (eputs)[POSIX]: New function. * mlibc/include/stdio.h (eputs)[POSIX]: Remove define. 2017-08-05 Jan Nieuwenhuizen mescc: Tinycc support: fixes for foo.bar[baz]. * module/language/c99/compiler.mes (expr->accu, expr->accu*): fixes for foo.bar[baz]. * scaffold/tests/7c-dynarray.c: Test it. mescc: Tinycc support: fixes for foo->bar[baz]. * module/language/c99/compiler.mes (expr->accu, expr->accu*): fixes for foo->bar[baz]. (expr->pointer): Support i-sel. (p-expr->type): Support add, sub, de-ref, ref-to. * scaffold/tests/7f-struct-pointer-arithmetic.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: foo.bar[baz], foo->bar[baz] for typedef'd struct bar. * module/language/c99/compiler.mes (expr->accu): foo.bar[baz], foo->bar[baz] for typedef'd struct bar. * scaffold/tests/7c-dynarray.c: Test it. 2017-08-04 Jan Nieuwenhuizen mescc: Tinycc support: foo[index]->bar for array bar. * module/language/c99/compiler.mes (expr->accu*): foo[index]->bar for array bar. * scaffold/tests/7e-struct-array-access.c: Test it. * make.scm (add-scaffold-test): Build it. 2017-08-04 Jan Nieuwenhuizen Revert "mescc: Tinycc support: workaround for nyacc "\0" bug." This reverts commit b160540e221dbeb96908823b5a3504bdbfd7f751. Fixed by: https://lists.gnu.org/archive/html/guile-user/2017-08/msg00007.html 2017-08-04 Jan Nieuwenhuizen guix: use nyacc 0.80.41. * guix.scm (nyacc): use 0.80.41. mescc: Tinycc support: ((unsigned char*)str)[i]. * module/language/c99/compiler.mes (expr->accu*): Consider size of expr array deref. * scaffold/tests/7d-cast-char.c: Test it. mescc: Tinycc support: ((unsigned char*)str)[0]. * module/language/c99/compiler.mes (expr->accu): Consider size of expr array deref. * stage0/x86.M1 (movzbl_0x32(%ebp),%eax): New define. * scaffold/tests/7d-cast-char.c: Test it. mescc: Tinycc support: define __linux__. * module/language/c99/compiler.mes (c99-input->full-ast): Add "__linux__=1" to cpp-defs. 2017-08-01 Jan Nieuwenhuizen mescc: Tinycc support: strcat. * mlibc/libc-mes+tcc.c (strcat): Implement. mescc: Tinycc support: vsnprintf. * module/language/c99/compiler.mes (ast-type->type): Support *p++ in test. * mlibc/libc-mes+tcc.c (vsnprintf): Implement. mescc: Tinycc support: support foo.bar[baz], foo->bar[baz] for struct bar. * module/language/c99/compiler.mes (struct-field): Use negative pointer for struct array fields. (expr->accu): support: support foo.bar[baz], foo->bar[baz] for struct bar. * scaffold/tests/7c-dynarray.c: Test it. mescc: drop naive realloc. * mlibc/libc-gcc.c (free, memcpy): Move from libc-mes+tcc.c. (realloc): Use realloc from libc-mes+tcc.c * mlibc/libc-gcc+tcc.c (free, memcpy, realloc): Remove. * mlibc/libc-mes+tcc.c (free, memcpy, realloc): Remove. * scaffold/tests/79-int-array.c (test): Update. * scaffold/tests/7a-struct-char-array.c (test): Update. 2017-07-31 Jan Nieuwenhuizen mescc: Tinycc support: ((foo*) p) + n. * module/language/c99/compiler.mes init-declr->pointer, expr->pointer, expr->size): support: ((foo*) p) + n. (expr->accu*): Consider field size for foo.bar[baz]. * scaffold/tests/7b-struct-int-array.c: Test it. * make.scm (add-scaffold-test): Build it. 2017-07-30 Jan Nieuwenhuizen mescc: Tinycc support: field size of foo.bar[baz], foo->bar[baz]. Inspired by a patch from rain1 for foo->bar[baz]. * module/language/c99/compiler.mes (expr->accu): (expr->accu*): Consider field size for foo.bar[baz]. * scaffold/tests/7a-struct-char-array.c: Test it. * make.scm (add-scaffold-test): Build it. 2017-07-30 Jan Nieuwenhuizen mescc: Tinycc support: fwrite. * mlibc/libc-mes+tcc.c (fwrite): Implement. mescc: Tinycc support: fclose. * mlibc/libc-mes+tcc.c (fclose): Implement. 2017-07-30 rain1 mescc: Tinycc support: fgetc. * mlibc/libc-mes.c (fgetc): Implement. mescc: Tinycc support: fprintf. * mlibc/libc-mes+tcc.c (fprintf): Implement. mescc: allow complicated enums expressions. * module/language/c99/compiler.mes (p-expr->number): Support lshift, rshift, ash. (enum-def-list->constants): Refactor using p-expr->number. mescc: support \x00 strings in M1. * module/mes/M1.mes (object->m1): Support \x00 strings. 2017-07-30 Jan Nieuwenhuizen mescc: Tinycc support: memmove. * mlibc/libc-mes+tcc.c (memmove): Implement. mescc: Tinycc support: strrchr. * mlibc/libc-mes+tcc.c (strrchr): Implement. mescc: Tinycc support: strchr. * mlibc/libc-mes+tcc.c (strchr): Implement. 2017-07-27 Jan Nieuwenhuizen mescc: Tinycc support: noisy stubs. * mlibc/libc-mes+tcc.c: Noisy stubs. 2017-07-30 Jan Nieuwenhuizen mescc: Tinycc support: int foo[bar] = {baz,...}. * scaffold/tests/79-int-array.c: Test it. * make.scm (add-scaffold-test): Build it. * module/language/c99/compiler.mes (init-declr->count): New function. (decl->info): Support int foo[bar] = {baz,...}. 2017-07-29 Jan Nieuwenhuizen mescc: Tinycc support: union.struct. * module/language/c99/compiler.mes (decl->info): Support struct inside union. * scaffold/tests/78-union-struct.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: fix accu value after comparison. * stage0/x86.M1 (setg___%al,, setge__%al, setl___%al, setle__%al): New defines. * module/mes/as-i386.mes (i386:g?->accu, i386:ge?->accu, i386:l?->accu, i386:le?->accu, i386:jumpl, i386:jumple): New functions. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (expr->accu): Use them to fix accu value after comparisons. (test-jump-label->info): Update comparison jumps. mescc: Tinycc support: memcmp. * mlibc/libc-mes+tcc.c (memcmp): Implement. mescc: Tinycc support: bugfix *++foo,*--foo. * module/language/c99/compiler.mes (c99-input->full-ast): Pre-define NULL. (expr->pointer, expr->size): Handle pre/post-inc/dec. mescc: Tinycc support: uniquify strings per compilation unit. * module/mes/M1.mes (object->M1): Add file-name to string id. 2017-07-28 Jan Nieuwenhuizen mescc: Tinycc support: foo.bar = foo.baz = bla. * module/language/c99/compiler.mes (expr->base*): New function. (expr->accu): Use it to have value in accu for assignments. * scaffold/tests/77-pointer-assign.c (test): Test it. * stage0/x86.M1 (mov____%ecx,(%edx), mov___(%eax),%ecx): New define. * module/mes/as-i386.mes (accu-mem->base->mem): New function. (i386:byte-base->accu-mem+n): (i386:byte-base->accu-mem): (i386:base-mem->accu-mem): (i386:base->accu-mem): (i386:value->accu-mem+n): (i386:value->accu-mem): (i386:accu->base-mem+n): (i386:byte-accu->base-mem): (i386:accu->base-mem): Rename from accu-address, base-address. Update callers. * module/mes/as-i386.scm (mes): Update exports. mescc: Tinycc support: workaround for nyacc "\0" bug. * module/language/c99/compiler.mes (fix-null): Replace "\nul" with "\0". (initzer->data): Use it. (expr->global): Use it. mescc: Tinycc support: bugfix foo % bar. * stage0/x86.M1 (mov____%edx,%ebx): Typo (idiv___%ebx): Replace div____%ebx. * module/mes/as-i386.mes (i386:accu/base): Update. (i386:accu%base): Update. 2017-07-29 Jan Nieuwenhuizen mescc: Tinycc support: fix foo[bar]->baz. * module/language/c99/compiler.mes (expr->accu*): Lose one indirection. * scaffold/tests/72-typedef-struct-def.c: Test it. 2017-07-28 Jan Nieuwenhuizen mescc: Tinycc support: foo *bar[baz]. * module/language/c99/compiler.mes (decl->info): Support foo *bar[baz]. * module/language/c99/compiler.mes (push-global): Support push of -2, -1. Change signature to take info. Update callers. (push-global-address): Change signature to take info. Update callers. mescc: Tinycc support: bugfix foo[bar] = baz, with foo*[]. * module/language/c99/compiler.mes (expr->accu): Support size for more expressions. (expr->pointer): (expr->size): Support more expressions. * scaffold/tests/77-pointer-assign.c (add0): Test it. mescc: Tinycc support: bugfix *foo = bar. * module/language/c99/compiler.mes (base->ident-address): Typo, fixes (non-char*)*x = y. * scaffold/tests/77-pointer-assign.c (test): Test it. mescc: Tinycc support: bugfix *(cast)foo = bar. * module/language/c99/compiler.mes (expr->accu): Thinko for de-ref assign. * stage0/x86.M1: Fix typos. * module/mes/as-i386.mes: Update for typos. * scaffold/tests/77-pointer-assign.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: pointer arithmetic. * module/language/c99/compiler.mes (ident->size, expr->size): New function. (expr->accu): Use them for ++,--,add, sub. (i386:type-alist): Set void size to 1. * scaffold/tests/71-struct-array.c (test): * scaffold/tests/76-pointer-arithmetic.c: Test it. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: compile tcc with TCC_IS_NATIVE. * mlibc/include/string.h (strcat): Declare. * mlibc/libc-mes+tcc.c (dlclose, dlopen, mprotect, sigaction, sigemptyset, strcat, vfprintf): Move from libc-gcc+tcc.c. * mlibc/libc-gcc+tcc.c: Remove them. * module/language/c99/compiler.mes (c99-input->full-ast): Define __i386__=1. (i386:type-alist): Parse `long long int', `unsigned short int', `unsigned long long int'. (struct-field): Support void**. (init-declr->name): (init-declr->pointer): Support function declaration. 2017-07-27 Jan Nieuwenhuizen mlibc: Tinycc support: gcc -nostdinc -nostdlib. * mlibc/libc-gcc+tcc.c: New file. * mlibc/include/dlfcn.h: * mlibc/include/errno.h: * mlibc/include/signal.h: * mlibc/include/sys/mman.h: * mlibc/include/sys/time.h: Add tcc declarations. mescc: Tinycc support: malloc,memcpy. * mlibc/libc-mes.c (malloc): Rewrite. * mlibc/libc-mes+tcc.c (memcpy): Implement. build: support libc-mes+tcc. mescc: Tinycc support: memset. * mlibc/libc-mes+tcc.c (memset): Implement. 2017-08-26 Jan Nieuwenhuizen mescc: bump default maximum for M1-strings to 80. * module/mes/M1.mes (object->M1): bump default maximum for M1-strings to 80. 2017-07-26 Jan Nieuwenhuizen mescc: Tinycc support: oops, use new realloc. * mlibc/libc-mes.c (realloc): Disable naive realloc for libc-mes+tcc.c. mescc: Bugfix: output M1-strings if possible. * module/mes/M1.mes (object->M1): Typo. Also disallow \return in M1-strings. guix: Release update. * guix.scm (mes): Update commit, hash and version. Release 0.9. * configure (VERSION): Bump to 0.9. doc: Release udpate. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.9: New file. * make.scm: Install it. * guix.scm (mescc-tools): Bump to 0.2. build: Install and installed-run fixes. * guile/mescc.scm (%datadir,%docdir,%moduledir,%version): Remove. * scripts/mescc.mes: Likewise. * module/language/c99/compiler.mes: Likewise. (%prefix): Prefer environment setting. (c99-input->full-ast): Remove unnecessary includes. Remove unnecessary defines. * make.scm (%scm-files): Add mes/guile.scm. (src/mes.gcc, src/mes.mlibc-gcc, src/mes.guile): Update MODULEDIR, add -I src. * src/mes.c (load_env): Use temporary variable for MODULEDIR concatenation. (bload_env): Likewise. mescc: Tinycc support: calloc,malloc,realloc. * mlibc/libc-mes+tcc.c (calloc,malloc,realloc): New function. mescc: Tinycc support: bugfix struct.array. * module/language/c99/compiler.mes (struct-field): Update pointer info. (field:name,field:pointer,field:size,field:type): Rely on pointer info. (field:pointer): New function. (expr->accu): Use it. * scaffold/tests/71-struct-array.c (test): Test it. mescc: Tinycc support: bugfix struct pointer. * module/language/c99/compiler.mes (decl->info): Only set non-pointer struct to -1. * scaffold/tests/23-pointer.c (test): Test it. mescc: Tinycc support: more function stack space. * module/mes/as-i386.mes (function-locals): Increase local space from 64 (16 vars) to 2*1025 + 80 (20 vars). mescc: Tinycc support: bugfix for char **pp = *p. * module/language/c99/compiler.mes (ptr-declr->pointer): Grok ***. (decl->info): Bugfix for char **pp = *p, cleanup. * mlibc/libc-mes.c (getenv): Update for bugfix. * scaffold/tests/23-pointer.c (test): Test it. mescc: Tinycc support: execvp stub. * mlibc/include/unistd.h (execvp): Declare. * mlibc/libc-mes+tcc.c (execvp): Add stub. mescc: Tinycc support: remove stub. * mlibc/include/stdio.h (remove): Declare. * mlibc/libc-mes+tcc.c (remove): Add stub. mescc: Tinycc support: fread stub. * mlibc/include/stdio.h (fread): Declare. * mlibc/libc-mes+tcc.c (fread): Add stub. mescc: Tinycc support: ftell stub. * mlibc/include/stdio.h (ftell): Declare. * mlibc/libc-mes+tcc.c (ftell): Add stub. mescc: Tinycc support: fseek stub. * mlibc/include/stdio.h (fseek): Declare. * mlibc/libc-mes+tcc.c (fseek): Add stub. mescc: Tinycc support: fopen stub. * mlibc/include/stdio.h (fopen): Declare. * mlibc/libc-mes+tcc.c (fopen): Add stub. mescc: Tinycc support: strstr stub. * mlibc/include/string.h (strstr): Declare. * mlibc/libc-mes+tcc.c (strstr): Add stub. mescc: Tinycc support: sscanf stub. * mlibc/include/stdio.h (sscanf): Declare. * mlibc/libc-mes+tcc.c (sscanf): Add stub. mescc: Tinycc support: longjmp, setjump stub. * mlibc/include/stdarg.h (longjmp, setjmp): Declare. * mlibc/libc-mes+tcc.c (longjmp, setjmp): Add stub. mescc: Tinycc support: function parameters. * module/language/c99/compiler.mes (.name): Handle function parameters. mescc: Tinycc support: fflush stub. * mlibc/include/stdio.h (fflush): Declare. * mlibc/libc-mes+tcc.c (fflush): Add stub. mescc: Tinycc support: vnsprintf stub. * mlibc/include/stdarg.h (vnsprintf): Declare. * mlibc/libc-mes+tcc.c (vnsprintf): Add stub. mescc: Tinycc support: jump 32. * module/mes/as-i386.mes (i386:jump-byte-z): Use jne32 (was: jne8). mescc: Tinycc support: free stub. * mlibc/include/stdlib.h (free): Declare. * mlibc/libc-mes+tcc.c (free): Add stub. mescc: Tinycc support: strrchr stub. * mlibc/include/string.h (strrchr): Declare. * mlibc/libc-mes+tcc.c (strrchr): Add stub. mescc: Tinycc support: strtoll stub. * mlibc/include/stdlib.h (strtoll): Declare. * mlibc/libc-mes+tcc.c (strtoll): Add stub. mescc: Tinycc support: strtoull stub. * mlibc/include/stdlib.h (strtoull): Declare. * mlibc/libc-mes+tcc.c (strtoull): Add stub. mescc: Tinycc support: strtol stub. * mlibc/include/stdlib.h (strtol): Declare. * mlibc/libc-mes+tcc.c (strtol): Add stub. mescc: Tinycc support: lseek. * mlibc/include/unistd.h (lseek): Declare. * stage0/x86.M1 (SYS_lseek): New define. * mlibc/libc-mes+tcc.c (lseek): New function. mescc: Tinycc support: fclose stub. * mlibc/include/stdio.h (fclose): Declare. * mlibc/libc-mes+tcc.c (fclose): Add stub. mescc: Tinycc support: fdopen stub. * mlibc/include/stdio.h (fdopen): Declare. * mlibc/libc-mes+tcc.c (fdopen): Add stub. mescc: Tinycc support: unlink. * mlibc/include/unistd.h (unlink): Declare. * stage0/x86.M1 (SYS_unlink): New define. * mlibc/libc-mes+tcc.c (unlink): New function. mescc: Tinycc support: fwrite stub. * mlibc/include/stdio.h (fwrite): Declare. * mlibc/libc-mes+tcc.c (fwrite): Add stub. mescc: Tinycc support: qsort stub. * mlibc/include/stdlib.h (qsort): Declare. * mlibc/libc-mes+tcc.c (qsort): Add stub. mescc: Tinycc support: getcwd. * mlibc/include/unistd.h (getcwd): Declare. * stage0/x86.M1 (SYS_getcwd): New define. * mlibc/libc-mes+tcc.c (getcwd): New function. mescc: Tinycc support: strchr stub. * mlibc/include/string.h (strchr): Declare. * mlibc/libc-mes+tcc.c (strchr): Add stub. mescc: Tinycc support: fprintf stub. * mlibc/include/stdio.h (fprintf): Declare. * mlibc/libc-mes+tcc.c (fprintf): Add stub. mescc: Tinycc support: localtime stub. * mlibc/include/time.h (localtime): Declare. * mlibc/libc-mes+tcc.c (localtime): Add stub. mescc: Tinycc support: time stub. * mlibc/include/time.h (time): Declare. * mlibc/libc-mes+tcc.c (time): Add stub. mescc: Tinycc support: snprintf stub. * mlibc/include/stdio.h (snprintf): Declare. * mlibc/libc-mes+tcc.c (snprintf): Add stub. mescc: Tinycc support: strtoul stub. * mlibc/include/stdlib.h (strtoul): Declare. * mlibc/libc-mes+tcc.c (strtoul): Add stub. mescc: Tinycc support: memmove stub. * mlibc/include/string.h (memcmp): Declare. * mlibc/libc-mes+tcc.c (memcmp): Add stub. mescc: Tinycc support: memset stub. * mlibc/include/string.h (memset): Declare. * mlibc/libc-mes+tcc.c (memset): Add stub. mescc: Tinycc support: memmove stub. * mlibc/include/string.h (memmove): Declare. * mlibc/libc-mes+tcc.c (memmove): Add stub. mescc: Tinycc support: memcpy stub. * mlibc/include/string.h (memcpy): Declare. * mlibc/libc-mes+tcc.c (memcpy): Add stub. mescc: Tinycc support: close. * stage0/x86.M1 (SYS_close): New define. * mlibc/include/unistd.h (close): Declare. * mlibc/libc-mes+tcc.c: New file. * make.scm: Build and install it. mescc: Tinycc support: arithmetic in initializes. * module/language/c99/compiler.mes (p-expr->number): Handle bitwise-or, constants. (initzer-data): Refactor, use p-expr->number. mescc: Tinycc support: multi-byte [local] offsets. * stage0/x86.M1: Add 32bit variants for all 8bit instructions. * module/mes/as-i386.mes: Use them, switch on size. mescc: Naming fix. * stage0/x86.M1 (je8): Rename from jne8. * module/mes/as-i386.mes (i386:jump-byte-z): Update. mescc: Tinycc support: remove warnings for foo (void), foo (...). * module/language/c99/compiler.mes (.name, .type): Expect foo (void), foo (...). mescc: Tinycc support: multiple statements in default case. * module/language/c99/compiler.mes (clause->info): Support multiple statements in default case. mescc: Tinycc support: array[]. * module/language/c99/compiler.mes (p-expr->number): New function. (struct-field, decl->info): Use it to support const expressions in array size. mescc: Use "tag" for tag namespace. * module/language/c99/compiler.mes: Use "tag" for tag namespace (WAS: "struct"). Move enums to "tag" namespace. mescc: Guile eval.c support: headers. * mlibc/include/signal.h (sigset_t): New type. * mlibc/include/float.h: New file. * mlibc/include/stddef.h: New file. * mlibc/include/sys/select.h: New file. mescc: Non-Guix support. Thanks rain1! * mlibc/include: Neutralize include guards before #include_next. Fixes compiling tinycc on Debian GNU/Linux. mescc: Tinycc support: sizeof (struct.field). * module/language/c99/compiler.mes (expr->accu): Support sizeof (struct.field). mescc: Tinycc support: struct.union. * module/language/c99/compiler.mes (struct-field): Add struct tag to struct/union types. (field-type, field-size, field-offset, field-field, ast-type->type): Ascertain struct tag with type. * (expr->accu*): Do not add struct tag. * scaffold/tests/75-struct-union.c: Test it. * scaffold/tests/71-struct-array.c: Update. mescc: Tinycc support: sizeof ("foo"). * module/language/c99/compiler.mes (expr->accu): Support sizeof (string). mescc: Tinycc support: struct foo {int bar; int baz} = {0}. * module/language/c99/compiler.mes (decl->info): struct foo {int bar; int baz} = {0}. * scaffold/tests/72-typedef-struct-def.c (test): mescc: Tinycc support: generalize neg. * module/language/c99/compiler.mes (expr->accu): Generalize neg. mescc: Tinycc support: >>=, <<=. * module/language/c99/compiler.mes (expr->accu): Support >>= <<=. mescc: Bugfix non-char* *x x[] test. * module/language/c99/compiler.mes (expr->pointer): New function. (test-jump-label->info): Use it to fix non char* while (*x | x[i]). mescc: Tinycc support: foo[i].bar.baz. * module/language/c99/compiler.mes (init-declr->pointer): Use -1 for array. (expr->accu): Implement foo[i].bar.baz. * scaffold/tests/72-typedef-struct-def.c (test): Test it. mescc: Tinycc support: *global =. * module/language/c99/compiler.mes (base->ident-address): Support *global = ... * scaffold/tests/74-multi-line-string.c: Test it. mescc: Tinycc support: anonymous union. * module/language/c99/compiler.mes (field:name): New function. (decl->info): Use it. (struct-field): Support anonymous union. (field:size): Update. (field-field): Update. (field-offset): Update. mescc: Tinycc support: declare struct tm. * mlibc/include/time.h (struct tm): New type. mescc: Tinycc support: ignore [ULL], UL, LL, L. * module/language/c99/compiler.mes (cstring->number): Drop suffix. mescc: Tinycc support: ~, ^=. * module/mes/as-i386.mes (i386:accu-not): New function. (i386:accu-negate): Rename from i386:accu-not. * module/mes/as-i386.scm (mes): Export them. * module/language/c99/compiler.mes (expr->accu): Support ~, ^=. * scaffold/tests/60-math.c (test): Test it. * stage0/x86.M1 (not____%eax): New define. mescc: Tinycc support: struct.struct. * module/language/c99/compiler.mes (expr->accu): Support &*, bar.foo.i, p->foo.i, p->pf->i (*pp)->foo.i, [slightly modified] offsetof. * scaffold/tests/72-typedef-struct-def.c (test): Test them. mescc: Tinycc support: ***parameter. * module/language/c99/compiler.mes (.name): Support ***parameter. mescc: Tinycc support: bitwise-or initializer. * module/language/c99/compiler.mes (initzer->value): New function. (initzer->data): Use it to support bitwise-or initializer. * scaffold/tests/74-multi-line-string.c (test): Test it. mescc: Tinycc support: char*[] in function. * module/language/c99/compiler.mes (c99-input->full-ast): Add NULL. (decl->info): Support char* [] in function scope. * scaffold/tests/71-struct-array.c (test) Test it. mescc: Tinycc support: more list initializers. * module/language/c99/compiler.mes (init-declr->name): Handle array, pointer array. (init-declr->pointer): Likewise. (decl->info): Generalize list initializers, add pointer variant. FIXME: AST-rewriting? mescc: Tinycc support: headers. * mlibc/include/string.h (ssize_t): New type. * mlibc/include/unistd.h (ssize_t): New type. mescc: Tinycc support: sizeof struct field. * module/language/c99/compiler.mes (expr->accu): Sizeof struct field. * scaffold/tests/72-typedef-struct-def.c (test): Test it. mescc: Tinycc support: sizeof typename. * module/language/c99/compiler.mes (expr->accu): Sizeof typename. mescc: Tinycc support: pre/post-inc/dec more. * module/language/c99/compiler.mes (expr-add): New function. (expr->pointer): New function. (expr->accu): Use it to support broader pre/post-inc/dec.. * scaffold/tests/72-typedef-struct-def.c (test): Test it. mescc: Tinycc support: comma operator. * module/language/c99/compiler.mes (expr->accu): Handle comma operator. * scaffold/tests/74-multi-line-string.c (test): Test it. mescc: Tinycc support: assign pointer to struct field. * module/language/c99/compiler.mes (expr->accu, expr->accu*): Support pointer field selection. * scaffold/tests/72-typedef-struct-def.c (test): Test it. mescc: Tinycc support: multi-line strings. * module/language/c99/compiler.mes (initzer->data, expr->global): Handle multi-line strings. * scaffold/tests/74-multi-line-string.c: New file. * make.scm (add-scaffold-test): Build it. mescc: Tinycc support: union. * scaffold/tests/73-union.c: New file. * module/language/c99/compiler.mes (union->type-entry): New function. (decl->info): Support unions. mescc: Tinycc support: struct. * scaffold/tests/72-typedef-struct-def.c: New file. * module/language/c99/compiler.mes (decl->info): Struct support for tinycc. mescc: Refactor decl. * module/mes/as-i386.mes (i386:mem->base, i386:nop): New functions. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes: * stage0/x86.M1 (nop,mov____(%edx),%edx,movzbl_(%edx),%edx): New defines. * scaffold/tests/23-pointer.c: New file. * scaffold/tests/t.c: New file. * make.scm: Build them. * module/language/c99/compiler.mes (init-declr->name): Handle array. (init-declr->pointer): Likewise. (ident->accu): Simplify. (ident->base): Simplify. (ident-address->base): Typo. (expr->accu): Simplify. (decl->info): Simplify. * mlibc/libc-mes.c (getenv): Remove superfluous statement. mescc: Use records for Guile: . * module/language/c99/info.scm (): New record. * module/language/c99/compiler.mes (make-local-entry): Rename from make-local. Update callers. (local-var?): Rename from local?. Update callers. * module/language/c99/info.mes (make-local, local:type, local:pointer, local:id): Move from compiler.mes. mescc: Use records for Guile: . * module/language/c99/info.scm (): New record. * module/language/c99/compiler.mes (make-global-entry): Rename from make-global. Update callers. * module/language/c99/info.mes (make-global, global:type, global:pointer, global:value): Move from compiler.mes. mescc: Use records for Guile: . * module/language/c99/info.scm (): New record. * module/language/c99/compiler.mes (make-type-entry): Rename from make-type. Update-callers. * module/language/c99/info.mes (make-type, type:type, type:size, type:pointer, type:description): Move from compiler.mes. mescc: Use records for Guile: . * module/language/c99/info.scm (): Make immutable record. Update users. mescc: Use records for Guile: preparation. * module/language/c99/info.mes: New file. * module/mes/M1.mes: Use it. * scripts/mescc.mes: Use it. * module/language/c99/compiler.mes: Use it. (, , , , , , , , , , make, info?, .info, .types, .constants, .functions, .globals, .locals, .function, .text, .break, .continue): Remove. * module/language/c99/info.scm: New file. * module/language/c99/compiler.scm: Use it. * guile/mescc.scm: Use it. * module/mes/M1.scm: Use it. mescc: Refactor decl. * module/language/c99/compiler.mes (decl->info, ptr-declr->pointer): New function. (ast->info): Use decl->info. guix: Update build. * guix.scm (mes): Do not strip. Fixes mes binary. build: support Guix. * guile/guix/make.scm (link-or-cp): New function. (assert-link, store): Use it. build: Add make install. * guile/guix/make.scm (method-cp, install, install-target?): New functions. * make.scm: Use them. build: Add target list. * GNUmakefile (%): Handle all targets. * make.scm (main): Show and implement target list. build: Ignore some files. .gitignore: Update for make.scm. build: Bugfix for store. * guile/guix/make.scm (store): Add each store file only once. build: Resurrect guile-2.0. Thanks rain1! * module/mes/guile.scm: New file. * module/mes/elf.scm: Include it. * module/mes/bytevectors.scm: : Include it. * module/mes/as.scm: Include it. * module/mes/as-i386.scm: Include it. * module/mes/M1.scm: Include it. * module/language/c99/compiler.scm: Include it. * make.scm: Update. 2017-07-26 Jan Nieuwenhuizen build: Non-Guix build robustifications. Thanks, rain1! Fix typo in configure, gracefully switch between M0 vs M1, skip CC32/i686-unknown-linux-gnu-gcc targets if not available, esp. for non-Guix usage. * configure (M1): Declare missing variable. * make.scm (main): all-go, clean-go: New targets. * GNUmakefile (PHONY_TARGETS): Add them. (.config.make): New target. * guile/guix/make.scm (%CC32): Set to #f if not found. (bin.gcc): Skip if CC not set. (check-target?, add-target): Skip if target is not set. 2017-07-26 Jan Nieuwenhuizen build: Fix snarf dependencies. * guile/guix/make.scm (compile.gcc compile.mescc bin.mescc m1-asm): Accept and forward dependencies. * make.scm (gcc-snarf-targets): Remove explicit defaults. build: Use released M0 intead of M1. 2017-07-26 Jan Nieuwenhuizen mescc: Import tinycc test suite. * make.scm (check-scaffold-tinycc): New target. * guile/guix/make.scm (): Add baseline field. (method-check): Handle baseline. * scaffold/tinycc/00_assignment.c: New file. * scaffold/tinycc/00_assignment.expect: New file. * scaffold/tinycc/01_comment.c: New file. * scaffold/tinycc/01_comment.expect: New file. * scaffold/tinycc/02_printf.c: New file. * scaffold/tinycc/02_printf.expect: New file. * scaffold/tinycc/03_struct.c: New file. * scaffold/tinycc/03_struct.expect: New file. * scaffold/tinycc/04_for.c: New file. * scaffold/tinycc/04_for.expect: New file. * scaffold/tinycc/05_array.c: New file. * scaffold/tinycc/05_array.expect: New file. * scaffold/tinycc/06_case.c: New file. * scaffold/tinycc/06_case.expect: New file. * scaffold/tinycc/07_function.c: New file. * scaffold/tinycc/07_function.expect: New file. * scaffold/tinycc/08_while.c: New file. * scaffold/tinycc/08_while.expect: New file. * scaffold/tinycc/09_do_while.c: New file. * scaffold/tinycc/09_do_while.expect: New file. * scaffold/tinycc/10_pointer.c: New file. * scaffold/tinycc/10_pointer.expect: New file. * scaffold/tinycc/11_precedence.c: New file. * scaffold/tinycc/11_precedence.expect: New file. * scaffold/tinycc/12_hashdefine.c: New file. * scaffold/tinycc/12_hashdefine.expect: New file. * scaffold/tinycc/13_integer_literals.c: New file. * scaffold/tinycc/13_integer_literals.expect: New file. * scaffold/tinycc/14_if.c: New file. * scaffold/tinycc/14_if.expect: New file. * scaffold/tinycc/15_recursion.c: New file. * scaffold/tinycc/15_recursion.expect: New file. * scaffold/tinycc/16_nesting.c: New file. * scaffold/tinycc/16_nesting.expect: New file. * scaffold/tinycc/17_enum.c: New file. * scaffold/tinycc/17_enum.expect: New file. * scaffold/tinycc/18_include.h: New file. * scaffold/tinycc/18_include.c: New file. * scaffold/tinycc/18_include.expect: New file. * scaffold/tinycc/19_pointer_arithmetic.c: New file. * scaffold/tinycc/19_pointer_arithmetic.expect: New file. * scaffold/tinycc/20_pointer_comparison.c: New file. * scaffold/tinycc/20_pointer_comparison.expect: New file. * scaffold/tinycc/21_char_array.c: New file. * scaffold/tinycc/21_char_array.expect: New file. * scaffold/tinycc/22_floating_point.c: New file. * scaffold/tinycc/22_floating_point.expect: New file. * scaffold/tinycc/23_type_coercion.c: New file. * scaffold/tinycc/23_type_coercion.expect: New file. * scaffold/tinycc/24_math_library.c: New file. * scaffold/tinycc/24_math_library.expect: New file. * scaffold/tinycc/25_quicksort.c: New file. * scaffold/tinycc/25_quicksort.expect: New file. * scaffold/tinycc/26_character_constants.c: New file. * scaffold/tinycc/26_character_constants.expect: New file. * scaffold/tinycc/27_sizeof.c: New file. * scaffold/tinycc/27_sizeof.expect: New file. * scaffold/tinycc/28_strings.c: New file. * scaffold/tinycc/28_strings.expect: New file. * scaffold/tinycc/29_array_address.c: New file. * scaffold/tinycc/29_array_address.expect: New file. * scaffold/tinycc/30_hanoi.c: New file. * scaffold/tinycc/30_hanoi.expect: New file. * scaffold/tinycc/31_args.c: New file. * scaffold/tinycc/31_args.expect: New file. * scaffold/tinycc/32_led.c: New file. * scaffold/tinycc/32_led.expect: New file. * scaffold/tinycc/33_ternary_op.c: New file. * scaffold/tinycc/33_ternary_op.expect: New file. * scaffold/tinycc/34_array_assignment.c: New file. * scaffold/tinycc/34_array_assignment.expect: New file. * scaffold/tinycc/35_sizeof.c: New file. * scaffold/tinycc/35_sizeof.expect: New file. * scaffold/tinycc/36_array_initialisers.c: New file. * scaffold/tinycc/36_array_initialisers.expect: New file. * scaffold/tinycc/37_sprintf.c: New file. * scaffold/tinycc/37_sprintf.expect: New file. * scaffold/tinycc/38_multiple_array_index.c: New file. * scaffold/tinycc/38_multiple_array_index.expect: New file. * scaffold/tinycc/39_typedef.c: New file. * scaffold/tinycc/39_typedef.expect: New file. * scaffold/tinycc/40_stdio.c: New file. * scaffold/tinycc/40_stdio.expect: New file. * scaffold/tinycc/41_hashif.c: New file. * scaffold/tinycc/41_hashif.expect: New file. * scaffold/tinycc/42_function_pointer.c: New file. * scaffold/tinycc/42_function_pointer.expect: New file. * scaffold/tinycc/43_void_param.c: New file. * scaffold/tinycc/43_void_param.expect: New file. * scaffold/tinycc/44_scoped_declarations.c: New file. * scaffold/tinycc/44_scoped_declarations.expect: New file. * scaffold/tinycc/45_empty_for.c: New file. * scaffold/tinycc/45_empty_for.expect: New file. * scaffold/tinycc/46_grep.c: New file. * scaffold/tinycc/46_grep.expect: New file. * scaffold/tinycc/47_switch_return.c: New file. * scaffold/tinycc/47_switch_return.expect: New file. * scaffold/tinycc/48_nested_break.c: New file. * scaffold/tinycc/48_nested_break.expect: New file. * scaffold/tinycc/49_bracket_evaluation.c: New file. * scaffold/tinycc/49_bracket_evaluation.expect: New file. * scaffold/tinycc/50_logical_second_arg.c: New file. * scaffold/tinycc/50_logical_second_arg.expect: New file. * scaffold/tinycc/51_static.c: New file. * scaffold/tinycc/51_static.expect: New file. * scaffold/tinycc/52_unnamed_enum.c: New file. * scaffold/tinycc/52_unnamed_enum.expect: New file. * scaffold/tinycc/54_goto.c: New file. * scaffold/tinycc/54_goto.expect: New file. * scaffold/tinycc/55_lshift_type.c: New file. * scaffold/tinycc/55_lshift_type.expect: New file. * scaffold/tinycc/56_btype_excess-1.c: New file. * scaffold/tinycc/56_btype_excess-1.expect: New file. * scaffold/tinycc/57_btype_excess-2.c: New file. * scaffold/tinycc/57_btype_excess-2.expect: New file. * scaffold/tinycc/58_function_redefinition.c: New file. * scaffold/tinycc/58_function_redefinition.expect: New file. * scaffold/tinycc/59_function_array.c: New file. * scaffold/tinycc/59_function_array.expect: New file. * scaffold/tinycc/60_enum_redefinition.c: New file. * scaffold/tinycc/60_enum_redefinition.expect: New file. * scaffold/tinycc/61_undefined_enum.c: New file. * scaffold/tinycc/61_undefined_enum.expect: New file. * scaffold/tinycc/62_enumerator_redefinition.c: New file. * scaffold/tinycc/62_enumerator_redefinition.expect: New file. * scaffold/tinycc/63_local_enumerator_redefinition.c: New file. * scaffold/tinycc/63_local_enumerator_redefinition.expect: New file. * scaffold/tinycc/64_macro_nesting.c: New file. * scaffold/tinycc/64_macro_nesting.expect: New file. * scaffold/tinycc/67_macro_concat.c: New file. * scaffold/tinycc/67_macro_concat.expect: New file. * scaffold/tinycc/70_floating_point_literals.c: New file. * scaffold/tinycc/70_floating_point_literals.expect: New file. * scaffold/tinycc/71_macro_empty_arg.c: New file. * scaffold/tinycc/71_macro_empty_arg.expect: New file. * scaffold/tinycc/72_long_long_constant.c: New file. * scaffold/tinycc/72_long_long_constant.expect: New file. * scaffold/tinycc/73_arm64.c: New file. * scaffold/tinycc/73_arm64.expect: New file. * scaffold/tinycc/74_nocode_wanted.c: New file. * scaffold/tinycc/74_nocode_wanted.expect: New file. * scaffold/tinycc/75_array_in_struct_init.c: New file. * scaffold/tinycc/75_array_in_struct_init.expect: New file. * scaffold/tinycc/76_dollars_in_identifiers.c: New file. * scaffold/tinycc/76_dollars_in_identifiers.expect: New file. * scaffold/tinycc/77_push_pop_macro.c: New file. * scaffold/tinycc/77_push_pop_macro.expect: New file. * scaffold/tinycc/78_vla_label.c: New file. * scaffold/tinycc/78_vla_label.expect: New file. * scaffold/tinycc/79_vla_continue.c: New file. * scaffold/tinycc/79_vla_continue.expect: New file. * scaffold/tinycc/80_flexarray.c: New file. * scaffold/tinycc/80_flexarray.expect: New file. * scaffold/tinycc/81_types.c: New file. * scaffold/tinycc/81_types.expect: New file. * scaffold/tinycc/82_attribs_position.c: New file. * scaffold/tinycc/82_attribs_position.expect: New file. * scaffold/tinycc/83_utf8_in_identifiers.c: New file. * scaffold/tinycc/83_utf8_in_identifiers.expect: New file. * scaffold/tinycc/84_hex-float.c: New file. * scaffold/tinycc/84_hex-float.expect: New file. * scaffold/tinycc/85_asm-outside-function.c: New file. * scaffold/tinycc/85_asm-outside-function.expect: New file. * scaffold/tinycc/86_memory-model.c: New file. * scaffold/tinycc/86_memory-model.expect: New file. * scaffold/tinycc/87_dead_code.c: New file. * scaffold/tinycc/87_dead_code.expect: New file. * scaffold/tinycc/88_codeopt.c: New file. * scaffold/tinycc/88_codeopt.expect: New file. * scaffold/tinycc/89_nocode_wanted.c: New file. * scaffold/tinycc/89_nocode_wanted.expect: New file. * scaffold/tinycc/90_struct-init.c: New file. * scaffold/tinycc/90_struct-init.expect: New file. * scaffold/tinycc/91_ptr_longlong_arith32.c: New file. * scaffold/tinycc/91_ptr_longlong_arith32.expect: New file. * scaffold/tinycc/92_enum_bitfield.c: New file. * scaffold/tinycc/92_enum_bitfield.expect: New file. * scaffold/tinycc/93_integer_promotion.c: New file. * scaffold/tinycc/93_integer_promotion.expect: New file. * scaffold/tinycc/COPYING: New file. * scaffold/tinycc/LICENSE: New file. include 2017-07-09 Jan Nieuwenhuizen test: Split-up Mescc scaffold test. * make.scm (check-scaffold, check-scaffold-tests): New targets. * mlibc/include/00-test.i: New file. * mlibc/include/30-test.i: New file. * mlibc/mini-libc-mes.c (puts): New function. * scaffold/tests/00-exit-0.c: : New file. * scaffold/tests/01-return-0.c: : New file. * scaffold/tests/02-return-1.c: : New file. * scaffold/tests/03-call.c: : New file. * scaffold/tests/04-call-0.c: : New file. * scaffold/tests/05-call-1.c: : New file. * scaffold/tests/06-call-!1.c: : New file. * scaffold/tests/10-if-0.c: : New file. * scaffold/tests/11-if-1.c: : New file. * scaffold/tests/12-if-==.c: : New file. * scaffold/tests/13-if-!=.c: : New file. * scaffold/tests/14-if-goto.c: : New file. * scaffold/tests/15-if-!f.c: : New file. * scaffold/tests/16-if-t.c: : New file. * scaffold/tests/20-while.c: : New file. * scaffold/tests/21-char[].c: : New file. * scaffold/tests/22-while-char[].c: : New file. * scaffold/tests/30-strlen.c: : New file. * scaffold/tests/31-eputs.c: : New file. * scaffold/tests/32-compare.c: : New file. * scaffold/tests/33-and-or.c: : New file. * scaffold/tests/34-pre-post.c: : New file. * scaffold/tests/35-compare-char.c: : New file. * scaffold/tests/36-compare-arithmetic.c: : New file. * scaffold/tests/37-compare-assign.c: : New file. * scaffold/tests/38-compare-call.c: : New file. * scaffold/tests/40-if-else.c: : New file. * scaffold/tests/41-?.c: : New file. * scaffold/tests/42-goto-label.c: : New file. * scaffold/tests/43-for-do-while.c: : New file. * scaffold/tests/44-switch.c: : New file. * scaffold/tests/45-void-call.c: : New file. * scaffold/tests/50-assert.c: : New file. * scaffold/tests/51-strcmp.c: : New file. * scaffold/tests/52-itoa.c: : New file. * scaffold/tests/53-strcpy.c: : New file. * scaffold/tests/54-argv.c: : New file. * scaffold/tests/60-math.c: : New file. * scaffold/tests/61-array.c: : New file. * scaffold/tests/63-struct-cell.c: : New file. * scaffold/tests/64-make-cell.c: : New file. * scaffold/tests/65-read.c: : New file. * scaffold/tests/66-struct-array.c: : New file. * scaffold/t.c: Remove. * scaffold/t-tcc.c: Remove. mescc: Avoid warnings in recursve functions. * module/language/c99/compiler.mes (expr->accu): Avoid warnings in recursve functions. mescc: undefine __GNUC__. * module/language/c99/compiler.mes (c99-input->full-ast): Remove __GNUC__=0. Should help compiling pcc, libguile/eval.c. 2017-07-05 Jan Nieuwenhuizen mescc: Support stdarg. * mlibc/include/stdarg.h (va_list): New type. (va_start, va_arg, va_end, va_copy): New macro. (vprintf): New declaration. * mlibc/libc-mes.c (vprintf): New function. (printf): Rewrite using vprintf. * module/language/c99/compiler.mes (expr->accu, expr->accu*): Handle any array. Limitation: element size must be 4/sizeof (expression). (make-type): Add value pointer to type. (type:type, type:size, type:pointer, type:description): New functions. (ast->info): Handle typedef with pointer. 2017-07-02 Jan Nieuwenhuizen build: Remove make. * GNUmakefile: trivial convenience-frontend to ./make.scm * make/*.make: Remove. * */*.make: Remove. 2017-07-02 Jan Nieuwenhuizen mescc: Produce M1 output instead of hex2. Use: ./make.scm [TARGET] ./make.scm check * stage0/x86.M1: New file. * mlibc/mini-libc-mes.c (exit, write): Use M1 instead of .byte. * mlibc/libc-mes.c (_start, exit, read, write, open, access, brk, fsync, printf): Use M1 instead of .byte. * module/mes/as-i386.mes: Use M1. * module/mes/make.scm: New file. * make.scm: New file. * guile/guix/records.scm: New File. * guile/guix/shell-utils.scm: New file. * module/mes/M1.mes: Rename from hex2.mes. * module/mes/M1.scm: Rename from hex2.scm. * scripts/mescc.mes: Update callers. * guile/mescc.scm: Update callers. 2017-06-18 Jan Nieuwenhuizen mescc: Add headers for guile:eval.c. * mlibc/include/alloca.h: New file. * mlibc/include/stdint.h: New file. * mlibc/include/inttypes.h: Remove definitionss, include stdint.h. mescc: Add headers for 8cc. * mlibc/include/libgen.h: New file. * mlibc/include/locale.hh: New file. * mlibc/include/stdbool.h: New file. * mlibc/include/stdnoreturn.h: New file. * mlibc/include/time.h: Add time_t. 2017-06-27 Jan Nieuwenhuizen guix: Add missing module. * guix.scm: Use (guix download). Fixes compilation with mescc-tools included. 2017-06-26 Jan Nieuwenhuizen guix: Add mescc-tools. * guix.scm (mescc-tools): New variable. Fixes using guix.scm. Thanks paroneayea! 2017-06-25 Jan Nieuwenhuizen Release 0.8. * configure (VERSION): Bump. build: Release update. * configure (main): Make hex2 required. * guix.scm (mes): Add mescc-tools to propagated-inputs. Update commit, hash. 2017-06-08 Jan Nieuwenhuizen doc: Release update. * NEWS: Update. * INSTALL: Update. * HACKING: Update. * doc/ANNOUNCE-0.8: New file. 2017-06-25 Jan Nieuwenhuizen mescc: Remove ELF creation, handled by hex2 now. * module/language/c99/compiler.scm (make-global, global:type, global:pointer, global:value): Move from elf-util.mes * module/mes/as.mes: New file. * module/mes/as-i386.mes: Use it. * module/mes/as-i386.scm: Use it. * module/mes/elf-util.mes: Remove. * module/mes/elf.mes (elf32-addr, elf32-half, elf32-off, elf32-word, make-elf, write-any, object->elf): Remove (hex2->elf): New function with dummy implementation. * module/mes/elf.scm: Update exports. * module/mes/hex2.mes (object->elf): New function. * module/mes/hex2.scm: Export it. mescc: Produce object files in hex2 format, remove hex3. * GNUmakefile (HEX2_FLAGS): New variable. * make/mescc-guile.make ($(OUT)/$(TARGET)): Use HEX2 for linking. * make/mescc-mes.make ($(OUT)/$(TARGET)): Likewise. * guile/mescc.scm (main): Remove hex3 support. * scripts/mescc.mes (main): Likewise. * stage0/elf32-0header.hex2: New file, merging of elf32.hex and elf32-header.hex2. * stage0/elf-0footer.hex2: New file. * stage0/elf32-header.hex2: Rename from elf32-header-exit-42.hex2, repurpose as generic debug heder. * stage0/elf32-footer-single-main.hex2: Rename from elf32-footer-exit-42.hex2, repurpose as generic debug footer for single-main source. * stage0/exit-42.c: New file. * stage0/stage0.make ($(OUT)/0exit-42): Test 0header, 0footer. ($(OUT)/exit-42.guile): Test generic debug header, footer. * stage0/elf32.hex2: Remove. 2017-06-23 Jan Nieuwenhuizen build: Add stage0 hex2 test. * configure (HEX2): Check for hex2 from MESCC_tools. * INSTALL: Mention it. * GNUmakefile (SUBDIRS): Add stage0. * make/check-cc.make: New file. * make/check.make: Remove CC-not-empty guard. * scaffold/scaffold.make: Update CC check targets. 2017-06-21 Jan Nieuwenhuizen stage0: Move to-be-generated part of body to footer. * stage0/elf32-footer-exit-42.hex2: Add ELF_str, ELF_sym from body. * stage0/elf32-body-exit-42.hex2: Remove ELF_str, ELF_sym. 2017-06-19 Jan Nieuwenhuizen stage0: Leverage label>base in stage0 gdb header. * stage0/elf32-header-exit-42.hex2: Replace calculated addresses with label>base. * stage0/elf32-body-exit-42.hex2: Likewise. stage0: Move stage0's section-headers before text. * stage0/elf32-header-exit-42.hex2: Add section-headers. * stage0/elf32-body-exit-42.hex2: Update. * stage0/elf32-footer-exit-42.hex2: Remove section-headers. 2017-06-18 Jan Nieuwenhuizen stage0: Add stage0 hex2 gdb header and footer example. * stage0/elf32-header-exit-42.hex2: New file. * stage0/elf32-footer-exit-42.hex2: New file. 2017-06-13 Jan Nieuwenhuizen mescc: Remove jump calculation, use labels: rename jumps. * module/mes/as-i386.mes (i386:jump, i386:jump-byte-z, i386:jump-g, i386:jump-ge, i386:jump-nc, i386:jump-ncz, i386:jump-nz, i386:jump-z): Rename from i386:jump-label*. * module/mes/as-i386.scm (mes): Update exports. * module/language/c99/compiler.mes (ast->info): Update callers. mescc: Remove jump calculation, use labels: remove offset-jumps. * module/mes/as-i386.mes (i386:XXjump, i386:Xjump, i386:Xjump-c, i386:Xjump-cz, i386:Xjump-g, i386:Xjump-ge, i386:Xjump-l, i386:Xjump-le, i386:Xjump-nc, i386:Xjump-ncz, i386:Xjump-ncz", i386:Xjump-nz, i386:Xjump-z, i386:jump, i386:jump-byte-nz, i386:jump-byte-z, i386:jump-c, i386:jump-cz, i386:jump-le, i386:jump-nc, i386:jump-ncz, i386:jump-nz, i386:jump-z, i386:test-jump-z): Remove. * module/mes/as-i386.scm: Remove export. 2017-06-12 Jan Nieuwenhuizen mescc: Remove jump calculation, use labels: cleanup. * module/language/c99/compiler.mes (test->jump->info): Remove. 2017-06-13 Jan Nieuwenhuizen mescc: Remove jump calculation, use labels: switch. * module/language/c99/compiler.mes (expr->accu): Refactor (switch ...). (clause->info): Refactor. 2017-06-12 Jan Nieuwenhuizen mescc: Remove jump calculation, use labels: and, or. * module/language/c99/compiler.mes (expr->accu): Refactor (and ...), (or ...). mescc: Remove jump calculation, use labels: if. * module/language/c99/compiler.mes (ast->info): Refactor (if ...) using test-jump-label->info. mescc: Remove jump calculation, use labels: for. * module/language/c99/compiler.mes (ast->info): Refactor (for ...) using test-jump-label->info. mescc: Remove jump calculation, use labels: do while. * module/language/c99/compiler.mes (ast->info): Refactor (do-while ...) using test-jump-label->info. mescc: Remove jump calculation, use labels: ?. * module/language/c99/compiler.mes (ast->info): Refactor (cond-expr ...) using test-jump-label->info. mescc: Support continue in while. * module/language/c99/compiler.mes (make): Add continue field. (.continue): New function. (clone): Support continue field. (ast->info): Support continue. * scaffold/t.c (test): Test it. mescc: Remove jump calculation, use labels: while. * module/language/c99/compiler.mes (ast->info): Refactor (while ...) using test-jump-label->info. mescc: Remove jump calculation, use labels: prepare. * module/language/c99/compiler.mes (test-jump-label->info): New function. * module/mes/as-i386.mes (i386:jump-label-z,i386:jump-label-byte-z, i386:jump-label-g, i386:jump-label-ge,i386:jump-label-nz): New functions. * module/mes/as-i386.scm: Export them. mescc: Remove duplication of string globals. * module/language/c99/compiler.mes (expr->global): Curry-in globals. Update callers. (initzer->global): Likewise. 2017-06-11 Jan Nieuwenhuizen mescc: Unify labels. * module/language/c99/compiler.mes: Use (#:address label) (#local label) (#:relative label) thoughout. * module/mes/elf-util.mes (add-s:-prefix, drop-s:-prefix): Remove. (function->text): Update. * module/mes/hex2.mes (write-hex2): Update. mescc: Write object files in hex2 or hex3 format. * stage0/elf32.hex2: New file. * module/mes/hex2.mes: New file. * module/mes/hex2.scm: New file. * module/language/c99/compiler.mes: Eradicate object lamdas. (current-eval, dec-xhex, function:-object->text, object->elf, object->objects, merge-objects, alist-add): Remove. * module/mes/elf.mes (object->elf): New function, move from compiler.mes. * module/mes/elf.scm: Export it. * guile/mescc.scm (parse-opts): Add -g. (main): Use it. * scripts/mescc.mes: Likewise. * scripts/mescc-guile.make (MESCC.scm, MESLD.scm): Add -g flag. * scripts/mescc-mes.make (MESCC.mes, MESLD.mes): Likewise. * scaffold/m.c: Add proper includes. * scaffold/argv.c: New file. * scaffold/hello.c: Simplify. * scaffold/micro-mes.c: Add proper includes. * scaffold/t.c: Add proper includes. 2017-06-12 Jan Nieuwenhuizen core: %moduledir ends with /. * make/install.make (MODULEDIR): Append /. (install): Remove /. * src/mes.c (load_env, bload_env): Update. 2017-06-11 Jan Nieuwenhuizen mescc: Put _start at top of mlibc. * mlibc/libc-mes.c (_start): Move to top. * mlibc/mini-libc-mes.c (_start): Likewise. * module/mes/elf-util.mes (function-prefix): Update for _start == 0. (function-offset): Likewise. mes: Add list-index. * module/srfi/srfi-1.scm (list-index): New function. 2017-06-08 Jan Nieuwenhuizen build: Bugfix add prepocess dependency on snarfing mes. * src/src.make ($(OUT)/$(DIR)/mes.guile-E, $(OUT)/$(DIR)/mes.mes-E): Depend on mes snarfing. 2017-06-20 Jan Nieuwenhuizen test: Support for non-Guix[SD]: cater for missing CC/CC32 compilers. * make/check.make: Skip if CC is not set. * make/check-mlibc.make: New file. * scaffold/scaffold.make: Use it for mlibc targets. * tinycc/tinycc.make: Skip mlibc targets if CC32 not set. mescc: Support for non-Guix[SD] builds. * module/language/c99/compiler.mes (c99-input->full-ast): Cater for C_INCLUDE_PATH not set. Fixes non-Guix[SD] builds. build: Support for non-Guix[SD]: make CC/CC32 optional in configure too. * configure (optional): New global. (BUILD_TRIPLET): Use Guile value. (check-version): Add keyword argument #:optional. (main): Make CC optional (--with-courage). Only check for stdio.h, limits.h if CC is found. Make CC32 check optional. * scripts/scripts.make: Skip if CC is not set. 2017-06-05 Jan Nieuwenhuizen mescc: Bugfix for merging objects. * mlibc/libc-mes.c (main): Declare. * mlibc/mini-libc-mes.c (g_stdin): Define. (main): Declare. * module/language/c99/compiler.mes (alist-add): Thinko. Fixes merging objects when first declares function of next. 2017-06-03 Jan Nieuwenhuizen guix hash: 0fvzr1ai2rmi46zdi5b2bdjb6s8ip78mkmsk02yxl46rajmp2pb1 Release 0.7. * configure (VERSION): Bump. doc: Release update. * AUTHORS: Remove module/nyacc. * HACKING: Release uppdate. * NEWS: Release uppdate. * doc/ANNOUNCE-0.7: New file. guix: mes.git: Add git hash to version. * guix.scm (mes.git): Add git hash to version. mescc: move include into share/mlibc, allows installing alongside gcc. * mlibc: Rename from libc. * HACKING: Update for name change. * make/bin.make: Likewise. * make/mescc-guile.make: Likewise. * make/mescc-mes.make: Likewise. * scaffold/scaffold.make: Likewise. * make/install.make: Likewise. (install): Install mlibc into share/mlibc. 2017-06-02 Jan Nieuwenhuizen mescc: Handle any const, by ignoring. * module/language/c99/compiler.mes (ast-strip-const): New function. (c99-input->ast): Use it. (type->size, type->description, ast->info): Remove const handling. 2017-05-31 Jan Nieuwenhuizen mescc: Support array in struct. * module/language/c99/compiler.mes: (field:size, field-offset): New functions. Update callers, use them throughout. (ast->info): Support declaration of struct and typedef'ed struct variable with array fields. (expr->accu, expr->accu*): Support foo.bar[baz], foo->bar[baz]. * scaffold/t-tcc.c: Test it. 2017-05-28 Jan Nieuwenhuizen build: Skip gcc, mlibc, guile or mes builds using CC=, CC32=, GUILE= or MES=. * GNUmakefile (build-scripts): New target (HELP_TOP): Mention it. * configure (main): Write GUILE_FOR_BUILD. * make/bin-mlibc.make: Skip if CC32 is not set. * make/bin.make: Skip if CC is not set. * make/install.make (install): Only install $(OUT)/mes.mes if MES_BOOTSTRAP is set. * make/mescc-guile.make: Skip if GUILE is not set. * make/mescc-mes.make: Skip if MES is not set. * HACKING: write something about core: Always include reader.c, drop binary read-0-32.mo dependency. * module/language/c99/compiler.mes (c99-input->full-ast): Remove obsolete __NYACC__ and MES_FULL defines. * src/mes.c [!MES_FULL]: Include reader-mes.h. (mes_builtins) [!MES_FULL]: Include reader.mes.i, reader.me.environment.i. [!MES_FULL]: Include reader.c. (main) [!MES_FULL]: By default call load_env, only call bload_env when --load is supplied. WAS: Always bload read-0-32.mo. * src/reader.c (__end_of__mes_): Remove. (dump): Remove option of dumping tiny test program. * make/mescc-mes.make ($(OUT)/$(TARGET), mescc.mes-ccompile, mescc.mes.c-compile-E): Depend on $(OUT)/mes, scripts/mes. * src/src.make (mes.guile): Remove module/mes/read-32-0 dependency. Do not build $(OUT)/mes.mes. * module/module.make (module/mes/read-0.mo, module/mes/read-0-32.mo, module/mes/tiny-0-32.mo): Remove targets. (CLEAN): Do not add them. Neither install $(OUT)/mes.mes. * .gitignore: Remove exceptions for them. * make/install.make (install): Do not install them. * HACKING: Update info about creating module/mes/read-32-0.mo. * scaffold/mini-mes.c: Remove. * scaffold/tiny-mes.c: Remove. * scaffold/cons-mes.c: Remove. * scaffold/scaffold.make (tiny-mes.libc, tiny-mes.guile, tiny-mes.mes, mini-mes.libc, mini-mes.guile, mini-mes.mes): Reemove targets. 2017-05-27 Jan Nieuwenhuizen mescc: Add missing builtins. * module/language/c99/compiler.mes (i386:type-alist): Add missing builtins. TODO: identify and handle unsigned. 2017-05-25 Jan Nieuwenhuizen mescc: Support typedef and many TCC declaration variants. * module/language/c99/compiler.mes (ast->info): Register typedefs in types. (enum-def-list->constants): Support addition and substraction in enum field values. (get-type): New function. Use throughout. mescc: Handle comments anywhere. * module/language/c99/compiler.mes (c99-input->full-ast): Rename from c99-input->full-ast. (ast-strip-comment, c99-input->ast): New functions. (ast->info): Remove comment exceptions. mescc: Support anonymous enums. * module/language/c99/compiler.mes (enum-def-list->constants): New function. (ast->info): Support anonymous enum. 2017-05-23 Jan Nieuwenhuizen mescc: C99 header files and declaraions. * libc/include/assert.h (assert_fail): * libc/include/stdio.h: +int eputs (char const* s); +int fputs (char const* s); +int puts (char const* s); +int putchar (int c); +int fputc (int c, int fd); +int getchar (); * libc/include/stdlib.h: +char* getenv (char const* s) +int atoi (char const *s); +int *malloc (size_t); +int *realloc (int *p, int size); * libc/include/unistd.h (access): * src/lib.c (display_helper): * src/mes.c (read_input_file_env): * src/posix.c: Include unistd.h. guix: Update from Guix. * guix.scm (mes): Update from Guix. 2017-05-22 Jan Nieuwenhuizen build: Use separate preprocessing stage for mescc. * make/mescc-guile.make (mescc.scm-c-preprocess, (mescc.scm-compile-E): New defines. [!MESC_DIRECT]Compile .o via separate preprocessed .E stage. mescc: support -E. * guile/mescc.scm (parse-opts): Add -E. (source->ast): New function. (main): Use it. * scripts/mescc.mes (parse-opts): Add -E. (source->ast): New function. (main): Use it. 2017-05-21 Jan Nieuwenhuizen mescc: Refactor mlibc compilation. * libc/libc-mes.c: New file. Contents from module/mes/libc.mes, module/mes/libc-i386.mes. * libc/libc-gcc.c: Rename from libc/mlibc.c, include libc/mstart.c * libc/mstart.c: Remove. * module/mes/libc-i386.mes: Remove. * module/mes/libc-i386.scm: Remove. * module/mes/libc.mes: Remove. * module/mes/libc.scm: Remove. * GNUmakefile (CFLAGS): Include libc-gcc.c (WAS: mlibc.c). * make/bin-mlibc.make (C_FLAGS): Remove start.c include. * make/mescc-guile.make: Rewrite using compile, link. * make/mescc-mes.make: Likewise. * scaffold/m.c: Update. 2017-05-17 Jan Nieuwenhuizen mescc: support -c, -o. * module/language/c99/compiler.mes: Throughout: quote lambda's. (current-eval): New function. Thanks Andy! (object->list): New function. Update callers. (c99-input->info): Dump a.o. (initzer->non-const, function:object->list): New functions. (info:object->list): New function. (c99-input->elf): Call it. * module/mes/as-i386: Throughout: quote lambda's. * scripts/mescc.mes (main): Rewrite. * guile/mescc.scm (main): Likewise. 2017-05-23 Jan Nieuwenhuizen mes: Bugifx for number->string radix > 10. * module/mes/scm.mes (number->string): Bugfix for `10' -> hex/radix > 10. 2017-05-21 Jan Nieuwenhuizen mes: Simplify read-string. * module/mes/guile.mes (read-string): Simplify, probably fix even. mescc: Remove LALR C frontend prototype. * module/language/c/compiler.mes: Remove. * module/language/c/lexer.mes: Remove. * module/language/c/parser.mes: Remove. mes: Add negate. * module/mes/scm.mes (negate): New function. 2017-05-19 Jan Nieuwenhuizen core: Add current-output-port, open-output-file, set-current-output-port. * libc/include/fcntl.h: Declare it. Add some fcntl defines. * libc/include/stdio.h: Remove fcntl defines, Declare g_stdout. * module/language/c99/compiler.mes (c99-input->ast): Define O_WRONLY, O_RDWR. * module/mes/guile.mes (with-output-to-file, with-output-to-port): New functions. * src/posix.c (current_output_port, open_output_file, set_current_output_port): New functions. * libc/mlibc.c (open): Add optional mode parameter. * module/mes/libc-i386.mes (i386:open): Forward third parameter. * scaffold/mini-mes.c (main): Init g_stdout. * src/mes.c (main): Likewise. mes: Support octal numbers in reader. * module/mes/read-0.mes (read-octal): New function. (read-word): Use it. * tests/read.test: Test it. 2017-05-18 Jan Nieuwenhuizen mes: Add getopt-long. * module/mes/getopt-long.scm: New file, imported from Guile-1.8, * module/mes/getopt-long.mes: Include it. * AUTHORS: Mention it. mes: Add string-rindex. * module/srfi/srfi-13.mes (string-rindex): New function. mes: Support predicate with string-index. * module/srfi/srfi-13.mes (string-index): Support predicate. mes: Add string-suffix? * module/mes/scm.mes (string-prefix?): Refactor. (string-suffix?): New function. 2017-05-27 Jeremiah Orians Purging binary blobs * mes.mes: Remove. * module/mes/read-0-32.mo: Remove. 2017-05-15 Jan Nieuwenhuizen doc: Update. * AUTHORS: Remove module/nyacc. 2017-05-14 Jan Nieuwenhuizen doc: typo guix hash: 0qqywk3siyhf08v7xac08lqldklrqfndlp495wgy6ii9fn93197k 2016-12-25 Jan Nieuwenhuizen Release 0.6. * configure (VERSION): Bump. 2017-05-06 Jan Nieuwenhuizen doc: Release update. * NEWS: Update. 2017-05-04 Jan Nieuwenhuizen test: Run 33/55 tests of ../tinycc/tests/test2 if avaiable. * make/check-tinycc.make: New file. * tinycc/tinycc.make: New file. * GNUmakefile (SUBDIRS): Add tinycc. 2017-05-14 Jan Nieuwenhuizen build: Support i686, support development for arm. * configure (CC32): Accept arm-* as 32 bit compiler. (check-compile-header-c, check-header-c): New functions. (parse-opts): New option: --with-courage. (main): Check for platform, stdio.h, limits.h. 2017-05-08 Jan Nieuwenhuizen mescc: Minimal support for short. * module/language/c99/compiler.mes (i386:type-alist): Add short. mescc: Add strcpy. * libc/include/string.h (strcpy): Declare. * libc/mlibc.c (strcpy): New function. * module/mes/libc.mes (strcpy): New function. (libc): Add it. * scaffold/t.c (string_test): Test it. mescc: Enhance sizeof support. * module/language/c99/compiler.mes (expr->accu): Support sizeof (simple-type), sizeof (var). mescc: Support void return. * module/language/c99/compiler.mes (ast-info): Support `return'. 2017-05-07 Jan Nieuwenhuizen nyacc: Unbundle. * configure (check-version): Use keyword parameters, add #:command parameter. (main): Check for Nyacc. * INSTALL: Mention Nyacc as dependency. * make/guile.make (all-go): Compile in guile dir. * module/module.make (SCM_FILES): Remove Nyacc filters. * module/nyacc/BUGS: Remove. * module/nyacc/ChangeLog: Remove. * module/nyacc/README: Remove. * module/nyacc/README.nyacc: Remove. * module/nyacc/bison.scm: Remove. * module/nyacc/export.scm: Remove. * module/nyacc/import.scm: Remove. * module/nyacc/lalr.scm: Remove. * module/nyacc/lalr2.scm: Remove. * module/nyacc/lang/c99/README: Remove. * module/nyacc/lang/c99/body.scm: Remove. * module/nyacc/lang/c99/cpp.scm: Remove. * module/nyacc/lang/c99/cppmach.scm: Remove. * module/nyacc/lang/c99/mach.d/c99act.scm: Remove. * module/nyacc/lang/c99/mach.d/c99tab.scm: Remove. * module/nyacc/lang/c99/mach.d/c99xact.scm: Remove. * module/nyacc/lang/c99/mach.d/c99xtab.scm: Remove. * module/nyacc/lang/c99/mach.d/cppact.scm: Remove. * module/nyacc/lang/c99/mach.d/cpptab.scm: Remove. * module/nyacc/lang/c99/mach.scm: Remove. * module/nyacc/lang/c99/parser.scm: Remove. * module/nyacc/lang/c99/pprint.scm: Remove. * module/nyacc/lang/c99/util1.scm: Remove. * module/nyacc/lang/c99/util2.scm: Remove. * module/nyacc/lang/c99/xparser.scm: Remove. * module/nyacc/lang/calc/parser.scm: Remove. * module/nyacc/lang/util.scm: Remove. * module/nyacc/lex.scm: Remove. * module/nyacc/parse.scm: Remove. * module/nyacc/util.scm: Remove. mes: Consider GUILE_LOAD_PATH for include-from-path. * module/mes/guile.scm (include-from-path): New macro. mescc: Bugfixes for local char[]. * module/language/c99/compiler.mes (push-ident): Cater for local arrays. (expr->accu): Avoid post-inc/post-dec twice on rhs of assignment. Fix size lookup for local char arrayns. 2017-05-06 Jan Nieuwenhuizen nyacc: Update to 0.78. mes: Add srfi-16 to Nyacc Guile support. * module/mes/guile.mes: Include srfi-16 for Nyacc. mes: Basic support for string-index. * module/srfi/srfi-13.mes (string-index): New function. * tests/srfi-13.test ("string-index"): Test it. mes: Support #\cr short form in reader. * module/mes/read-0.mes (read-character): Support #\cr short form for #\return. * module/mes/read-0-32.mo: Regenerate. mes: Support case-lambda. * module/srfi/srfi-16.scm: New file. * AUTHORS: Mention it. * module/srfi/srfi-16.mes: New file. mescc: Enhance enum support. * module/language/c99/compiler.mes (ast->info): Support enum variable declaration. Respect field value overrides. mescc: Support binary constants. * module/language/c99/compiler.mes (cstring->number): Support binary 0bxxx values. * scaffold/t.c (math_test): Test it. mescc: Support ==, != as expression value. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (expr->accu): Set accu to 0/1 for eq, ne. * module/mes/as-i386.mes (i386:nz->accu, i386:z->accu, i386:accu<->stack): New functions. * scaffold/t.c (math_test): Test it. mescc: Support &, ^. * module/mes/as-i386.mes (i386:accu-and-base, i386:accu-xor-base): New functions. * module/mes/as-i386.scm: Export them. * module/language/c99/compiler.mes (expr->accu): Support bitwise-and, bitwise-xor. mescc: Support struct pointers. * module/language/c99/compiler.mes (expr->accu): Support &struct.field, struct->field. (ast->info): Support struct *foo = &bar; * scaffold/t.c (struct_test): Test it. mescc: Support struct definition with variable declaration. * module/language/c99/compiler.mes (ast->info): Support `struct foo {} bar;'. mescc: Support void functions. * module/language/c99/compiler.mes (function->info): Add return if missing. Fixes calling void functions (and functions where return is missing). * scaffold/t.c (void_func): Test it. mescc: Bugfix for break in switch not in compound. * module/language/c99/compiler.mes (clause->jump-info): Rename from case->jump-info. (statements->clauses): New function. (ast->info): Use it. Fixes switch statement with break in a case outside of a compound. * scaffold/t.c (swits): Test it. 2017-05-05 Jan Nieuwenhuizen mescc: Enhance [int/pointer] array support. * module/language/c99/compiler.mes (p-expr->type): Handle array-ref with any index. (ast->info): Support plain array declerations. (expr->accu): For size == 4, assume value in accu. Fixes int/pointer arrays. * scaffold/t.c: Test it. 2017-05-04 Jan Nieuwenhuizen mescc: Enhance struct support. * module/language/c99/compiler.mes (expr->accu): Remove struct scm hardcoding. (p-expr->type): New function. (ast->info): Support struct variable declaration without initializer. Set struct type for all struct declarations. 2017-05-03 Jan Nieuwenhuizen mescc: Fix itoa for negative numbers, using workaround. * module/mes/libc.mes (itoa): Avoid `sign = x < 0;' FIXME, todo. * scaffold/t.c (test): Test it. 2017-05-02 Jan Nieuwenhuizen mescc: Support regular C99 compile, headers + mlibc. * libc/include/assert.h: New file. * libc/include/ctype.h: New file. * libc/include/errno.h: New file. * libc/include/fcntl.h: New file. * libc/include/limits.h: New file. * libc/include/mlibc.h: New file. * libc/include/stdio.h: New file. * libc/include/stdlib: New file. * libc/include/string.h: New file. * libc/include/unistd.h: New file. * libc/mlibc.c: Remove declarations. * make/bin.make (INCLUDES): Factor out standard includes. * make/bin-mlibc.make: New file. * scaffold/scaffold.make: Use it. * src/src.make: Use it. * module/language/c99/compiler.mes (ast-info): Handle more function declarations. * scaffold/cons-mes.c: Remove mlibc definitionsa and mlibc.c include. Instead include . * scaffold/hello.c: Likewise. * scaffold/m.c: Likewise. * scaffold/malloc.c: Likewise. * scaffold/micro-mes.c: Likewise. * scaffold/mini-mes.c: Likewise. * scaffold/t.c: Likewise. * scaffold/tiny-mes.c: Likewise. * src/gc.c: Likewise. * src/lib.c: Likewise. * src/math.c: Likewise. * src/mes.c: Likewise. * src/posix.c: Likewise. * src/reader.c: Likewise. 2017-05-03 Jan Nieuwenhuizen mescc: Support list of initializers. * module/language/c99/compiler.mes (ast->info): Support list of initializers. 2017-05-02 Jan Nieuwenhuizen mescc: Basic printf support. * module/mes/libc-i386.mes (i386:va-arg): New function. * module/mes/libc-i386.scm (mes): Export it. * module/mes/libc.mes (printf): New function. (libc): Add it. * libc/include/stdio.h: New file. * module/language/c99/compiler.mes (c99-input->ast): Add libc/include to include path. (ast-info): Handle (skip) ellipsis in function declaration. guix: Update from Guix. * guix.scm: Use version from Guix. * make/install.make (update-hash): Update version for new Guix meme. make: Recompile .go too when included mes is touched. * build-aux/compile-all.scm (scm->mes): New function. (file-needs-compilation?): Use it to hackishly respect (include-[from-path] "<>.mes") 2017-05-05 Jan Nieuwenhuizen build: Resolve MODULEDIR confusion. Fixes mes installation. * make/install.make (GUILEDIR): New variable. Was MODULEDIR. (MODULEDIR): Mes' module dir. * guile/mescc.scm: Update. * src/mes.c (load_env, bload_env): Update. 2017-05-02 Jan Nieuwenhuizen guix hash: 01m8n7zk4f1ryd61dj589zarx09vbi7fc5f8m1x5zfk6r7l0zja2 guix.scm: Remove erroneous system restriction. * guix.scm (mes): Remove second erroneous system restriction. 2017-04-27 Jan Nieuwenhuizen Release 0.5. * configure (VERSION): Bump. bootstrap: Regenerate. * module/mes/read-0-32.mo: Regenerate. doc: Release update. * AUTHORS: Mention Nyacc and GuixSD. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.5 New file. * HACKING: Add pointers, update TODO/DONE. 2017-04-25 Jan Nieuwenhuizen bootstrap: Regenerate. * mes.mes: Regenerate. 2017-04-24 Jan Nieuwenhuizen mescc: Parse mlibc early, show progress. * module/mes/libc.mes (_start, strlen, getchar, assert_fail, ungetc, putchar, fputc, eputs, fputs, puts, strcmp, itoa, isdigit, atoi, malloc, realloc, strncmp, c:getenv): Change to function, add progress. Update callers. * module/language/c99/compiler.mes (c99-input->info): Compile libc separately. * guile/mescc.scm: Update progress. * scripts/mescc.mes: Update progress. 2017-04-25 Jan Nieuwenhuizen bootstrap: Regenerate. * mes.mes: Regenerate. 2017-04-24 Jan Nieuwenhuizen core: Set argv for mescc too. * src/mes.c (main)[!__MESC__]: Remove branch. bootstrap: Regenerate. * mes.mes: Regenerate. 2017-04-23 Jan Nieuwenhuizen mescc: Avoid duplication of globals. * module/language/c99/compiler.mes (globals:add-string): New function. (expr->arg): Use it to avoid globals duplication. (expr->accu): Do not pre-add globals. mescc: Fix global creation in AND/OR clause. * module/language/c99/compiler.mes (test->jump->info): Retain globals created in AND/OR test. 2017-04-17 Jan Nieuwenhuizen core: Move some debugging to MES_DEBUG=2. * module/mes/base-0.mes (load): Add ;;;. * src/gc.c (gc_flip): Test on g_debug > 1. (gc): Likewise. * src/mes.c (mes_builtins): Likewise. (main): Likewise. * src/reader.c (dump): Likewise. mescc: Add atoi. * libc/mlibc.c (atoi): New function. * module/mes/libc.mes (atoi): New function. (libc): Add it. mescc: Add getenv. * module/mes/libc-i386.mes (i386:_start): Push environment pointer. * module/mes/libc.mes (g_environment): New global. (_env): New function. (_start): Use it to set g_environment. (getenv): New function. * lib/mlibc.c (strncmp): New function. (getenv): Implement. * lib/mstart.c (_start): Set g_environment. * module/mes/libc.mes (strncmp): New function. (libc): Add it. * scaffold/t.c: (array_ref): Test it. mescc: Support pointer arrays and some arithmetic. * module/language/c99/compiler.mes (.name): Support **; handle type size. (.statements): Likewise. (push-local-de-ref): Likewise. (push-ident-de-ref): Likewise. (expr->arg): Likewise. (ident->accu): Likewise. (base->ident-address): Likewise. (ident-add): Likewise. (expr->accu): Likewise. (decl->type): Likewise. (formal->text): Likewise. (int->global, ident-address->accu, ident-address->base): New functions. (ast->info): Support *, *[] ** declarations. (push-local-de-de-ref, push-ident-de-de-ref): New functions. * module/mes/as-i386.mes (i386:push-byte-local-de-ref): Rename from i386:push-local-de-ref. Update callers. (i386:push-local-de-ref, i386:push-byte-local-de-de-ref, i386:accu-mem-add): New functions. * module/mes/as-i386.scm (mes): Export them. * scaffold/t.c (array_test): Test it. 2017-04-25 Jan Nieuwenhuizen bootstrap: Regenerate. * mes.mes: Regenerate. * module/mes/read-0-32.mo: Regenerate. 2017-04-16 Jan Nieuwenhuizen Add access? * libc/mlibc.c (access): New function. * module/mes/libc-i386.mes (i386:access): New function. (i386:libc): Add it. * src/posix.c (access_p): New function. * module/mes/posix.mes: New file. * module/mes/base-0.mes (mes): Include it. * module/mes/read-0-32.mo: Regenerate. 2017-04-25 Jan Nieuwenhuizen bootstrap: Regenerate * module/mes/read-0-32.mo: Regenerate. 2017-04-12 Jan Nieuwenhuizen build: Refactor. * GNUmakefile (OUT,QUIET,SUBDIRS): New variables. include make/common.make * .gitignore: Remove toplevel targets. * build-aux/compile-all.scm: Import from GNU Guix. * configure (gulp-pipe): Check exit status. Actually test for CC, CC32. * make/bin.make: New file. * make/check.make: New file. * make/clean.make: New file. * make/common.make: New file. * make/compile.make: New file. * make/guile.make: New file. * make/mescc-guile.make: New file. * make/mescc-mes.make: New file. * make/reset.make: New file. * lib/mlibc.c: Rename from top. * lib/start.c: Rename from top. * module/module.make: New file. * scaffold/scaffold.make: New file. * scripts/scripts.make: New file. * src/mes.c: Rename from top. * src/src.make: New file. * src/mes.c: Rename from top. * src/gc..c: Rename from top. * src/lib.c: Rename from top. * src/posix.c: Rename from top. * src/reader.c: Rename from top. * src/vector.c: Rename from top. * tests/tests.make: New file. 2017-04-15 Jan Nieuwenhuizen Remove gc scaffolding. * tests/gc-0.test: Remove. * tests/gc-1.test: Remove. * tests/gc-2.test: Remove. * tests/gc-2a.test: Remove. * tests/gc-3.test: Remove. * tests/gc-4.test: Remove. * tests/gc-5.test: Remove. * tests/gc-6.test: Remove. * tests/gc.test:Remove. mescc: Add fsync. * module/mes/libc-i386.mes (i386:fsync): New function. (i386:libc): Export it. * mlibc.c (fsync): New function. 2017-04-10 Jan Nieuwenhuizen core/mini-mes: Merge merge mes.c and mini-mes.c. * mes.c: * scaffold/mini-mes.c: * gc.c: * GNUmakefile: mescc: Allow usage of const by ignoring. * module/language/c99/compiler.mes (ast->info): Support const declarations (by ignoring them). * lib.c (display_helper)[!__GNUC__]: Remove branch. * posix.c (write_byte)[!__GNUC__]: Likewise. HACKING: Removed __MESC__ workarounds. * HACKING: Update pointer. mescc: Support break in while. * module/language/c99/compiler.mes (make): Add break field. (.break): New function. (clone): Support break field. (ast->info): Support break. * scaffold/t.c (test): Test it. * scaffold/mini-mes.c (lookup_symbol_): Use it; remove goto workaround. 2017-04-09 Jan Nieuwenhuizen mescc: Refactor switch. * module/language/c99/compiler.mes (case->jump-info): Refactor. Support multiple case statements. * scaffold/t.c (swits): Test it. * lib.c (display_helper)[__NYACC__]: Remove branch. 2017-04-08 Jan Nieuwenhuizen mini-mes: Merge with mes.c: lib.c, math.c, posix.c. * mes.c: Include math.c after posix.c. (assert_defined, check_formals, check_apply, load_env, bload_env): Move from lib.c * scaffold/mini-mes.c: Include mini-lib.h, lib.c., mini-math.h, math.c, mini-posix.h, posix.c. (greater_p, less_p, is_p, minus, plus, divide, modulo, multiply, logior, ash): Remove. (ungetchar, peekchar, peek_byte, read_byte, write_byte, string_to_cstring, getenv_, open_input_file, current_input_port, set_current_input_port, force_output): Remove. (mes_builtins): include mini-lib.i, mini-lib.environment.i. mini-math.i, mini-math.environment.i mini-posix.i, mini-posix.environment.i. * GNUmakefile (guile-mini-mes): Add dependencies. mescc: Refactor assignment. * module/language/c99/compiler.mes (expr->accu): Refactor assignment. Support multiple operators. * scaffold/t.c (math_test): Test it. * scaffold/mini-mes.c (minus, divide, modulo, multiply, logior)[!__GNUC__]: Remove branch. 2017-04-07 Jan Nieuwenhuizen mescc: Factor-out array-ref. * module/language/c99/compiler.mes: Factor-out array-ref. mescc: Refactor expr->base. * module/language/c99/compiler.mes (expr->base): Rename from expr->+base. Use throughout. mescc: Refactor binary operators. * module/language/c99/compiler.mes (binop->accu): Rename from compare->accu. Update callers. (expr->accu): Use it for binary operators. * scaffold/t.c (math_test): Test it. mescc: Factor-out append-text. * module/language/c99/compiler.mes: Use append-text throughout. mescc: Factor-out wrap-as. * module/language/c99/compiler.mes (wrap-as): Rename from wrap. Use throughout. mescc: Refactor comparisons. * module/language/c99/compiler.mes (compare->accu, append-text, wrap): New functions. (expr->accu): Use them to implement construct like 1 == inc (0). * scaffold/t.c (math_test): Test them. 2017-04-06 Jan Nieuwenhuizen HACKING: Removed gc.c, vector.c mescc workarounds. * HACKING: Update pointer and recipe. mescc: Refactor array ref. * module/language/c99/compiler.mes (expr->accu, expr->accu*): Remove duplication, use expression as array index. * scaffold/t.c (struct_test): Test it. * vector.c (vector_length, list_to_vector)[!__GNUC__]: Remove branch. mescc: Refactor expressions. * module/language/c99/compiler.mes (expr->accu, ast->info): Remove duplication, separate concerns. 2017-04-05 Jan Nieuwenhuizen mescc: Refactor pre/post inc/dec. * module/language/c99/compiler.mes: Refactor pre/post inc/dec. bootstrap: Regenerate. * mes-mini-mes: Regenerate. * module/mes/read-0-32.mes: Regenerate. mescc: function call. * module/language/c99/compiler.mes (expr->accu): Move function call from ast->info. mescc: Support expression as lhs array index. * module/language/c99/compiler.mes (expr->accu): Treat array index as expression. * scaffold/t.c (struct_test): Test it. * gc.c (gc_copy)[!__GNUC__]: Remove branch. * vector.c (list_to_vector)[!__GNUC__]: Likewise. 2017-04-04 Jan Nieuwenhuizen mescc: Remove duplication. * module/language/c99/compiler.mes (expr->arg): Use expr->accu for most expressions. scripts: Support --help, --version. * guile/mescc.scm: Support --help, --version. * scripts/mescc.mes: Likewise. * scripts/repl.mes: Likewise. 2017-04-03 Jan Nieuwenhuizen scm: Do not quote list of strings. * module/mes/display.mes (display): Check value of write?, fixes quoting display string. mescc: Do not return ELF text. * module/language/c99/compiler.mes (info->exe): Do not return ELF text. 2017-04-02 Jan Nieuwenhuizen build: Update Guix build and install. * guix.scm (%source-dir): New variable. (git-file?): New function. (mes): Use them to simplify building/installing from git. * make/install.make (READMES): Add INSTALL, README. * (install): Install mescc.scm and read-0-32.mo. bootstrap: Regenerate. * mes-mini-mes: First self-hosting binary. HACKING: scripts/mescc.mes scaffold/mini-mes runs. * HACKING: Update pointer and recipe. mini-mes: Fix for assq. * scaffold/mini-mes.c (assq): Use eq_p iso ==. Fixes tests/display.test ("write alarm"). core: Use 0.25% safety region. * gc.c (gc_up_arena): Up GC_SAFETY too. * scripts/repl.mes: Remove MES_ARENA override. bootstrap: Regenerate. * module/mes/read-0-32.mo: Regenerate. core: Remove append. * lib.c (append): Remove. * scaffold/mini-mes.c (append): Remove. * module/mes/base-0.mes (append): New function. * module/mes/read-0.mo: Regenerate. * module/mes/read-0-32.mo: Regenerate. test: Add test for append-map. * tests/srfi-1.test ("append-map"): New test. 2017-04-01 Jan Nieuwenhuizen core: Check gc free harder. * gc.c (gc_check): New fuction. * mes.c (eval_apply): Use it. mescc: Fix by value assignment from array-of struct entry. * module/language/c99/compiler.mes (expr->accu): Fix by value assignment from array-of struct entry. * scaffold/t.c (struct_test): Test it. * vector.c (make_vector, list_to_vector, vector_to_list): Use it; remove workarounds. * gc.c (gc_copy): Likewise. core: Fix flush for _POSIX_SOURCE. * posix.c (write_byte, force_output)[_POSIX_SOURCE]: Use FILE* functions. Fixes repl.mes. core: Increase MAX_ARENA_SIZE and GC safety. * mes.c (MAX_ARENA_SIZE): Double to 40000000. (GC_SAFETY): Set to 10000 cells (WAS: 1000). * scaffold/mini-mes.c (MAX_ARENA_SIZE, GC_SAFETY): Likewise. * gc.c (gc)[MES_DEBUG]: Also print safety area. HACKING: scripts/mescc.mes scaffold/t.c runs. core: Increase GC safety. * mes.c (GC_SAFETY): Set to 1000 cells (WAS: 100). * scaffold/mini-mes.c (GC_SAFETY): Likewise. HACKING: scripts/mescc.mes scaffold/tiny-mes.c runs. HACKING: scripts/mescc.mes scaffold/cons-mes.c runs. test: Add nyacc cpp match tests; two fail. * tests/match.test ("match nyacc 0", "match nyacc 1"): New tests. ("match nyacc simple", "match nyacc tkl0"): New tests; FAIL with Mes. (report): Set failure expectation to 2 for Mes. * HACKING: Add to bugs. scm: Support test failure expectation. * module/mes/test.mes (result): Take second argument to mean expected failure count. 2017-04-02 Jan Nieuwenhuizen scm: Evaluate arguments of OR only once. * module/mes/base.mes (or): Evaluate arguments only once. * module/mes/read-0.mes (or): Likewise. * tests/base.test ("or only once"): Test it. * module/mes/read-0-32.mo: Regenerate. 2017-04-01 Jan Nieuwenhuizen scm: Have char-set-contains? strictly return boolean. * module/srfi/srfi-14.mes (char-set-contains?): Return #t rather than memq result. scm: Fix bug in assq-set! * module/mes/scm.mes (assq-set!): Bugfix. 2017-04-02 Jan Nieuwenhuizen scm: Add c????r. * module/mes/base-0.mes (caar, cadr, cdar, cddr, map): Remove. Update callers. * module/mes/base.mes (): Remove. * module/mes/base.mes (cadadr, cddadr, cdddar): New function. 2017-03-31 Jan Nieuwenhuizen scm: Add access? * module/mes/guile.mes (access?): New dummy function. Fixes Nyacc's #include. 2017-03-29 Jan Nieuwenhuizen doc: Add Roamdmap. * HACKING: Add roadmap. 2017-04-01 Jan Nieuwenhuizen scm: Add open-input-string, read-string. * module/mes/guile.mes (open-input-string, read-string): New functions. * tests/guile.test: New file. * GNUmakefile (TESTS): Add it. 2017-04-02 Jan Nieuwenhuizen build: Cleanup, use gcc-specific snarfing. * .gitignore: Ignore *.o-32, mes-mini-mes. * scripts/nyacc-calc.mes: Remove. * scripts/nyacc.mes: Remove. * scripts/paren.mes: Remove. * make/install.make (install): Remove them. p* module/mes/mes-0.mes: Remove. * module/mes/loop-0.mes: Remove. * build-aux/mes-snarf.scm (main): Add --mini option. * GNUmakefile (mini-mes): Use it. 2017-03-27 Jan Nieuwenhuizen core: Fix error message when macro is missing. * mes.c (scm_vm_eval_check_func): New symbol. (eval_apply): In eval, evaluate car before evlis. Fixes error message when macro match is missing in (match ... (car x)). (mes_symbols): Add cell_call_with_values, cell_current_module to environment. * scaffold/mini-mes.c (eval_apply): Likewise. 2017-03-29 Jan Nieuwenhuizen test: Add pmatch tests. * tests/pmatch.test: New file. * GNUmakefile (TESTS): Add it. 2017-03-28 Jan Nieuwenhuizen nyacc: prefix globals. 2017-03-27 Jan Nieuwenhuizen scm: Bugfix display of named characters: add port. * module/mes/display.mes (display): Typo, add port. nyacc: Add missing (mes pmatch) include. * module/nyacc/lang/c99/cpp.mes (mes): Include (mes pmatch). 2017-04-01 Jan Nieuwenhuizen nyacc: Use pmatch rather than match for cpp. * module/nyacc/lang/c99/cpp.scm (nyacc lang c99 cpp): Import (system base pmatch) rather than (ice-9 match). (rtokl->string): Rewrite using pmatch. 2017-03-27 Jan Nieuwenhuizen scm: Bugfix drain-input. * module/mes/guile.mes (drain-input): Bugfix: return string. scm: Add assoc-set! * module/mes/scm.mes (assoc-set!): New function. * tests/scm.test ("assoc-set!", "assoc-set! new"): New tests. 2017-03-26 Jan Nieuwenhuizen scm: Add compose. * module/mes/scm.mes (compose): New function. * tests/scm.test ("compose"): New test. scm: Support reading negative hex numbers. * module/mes/read-0.mes (read-hex): Support negative hex numbers. * tests/math.test ("#x-10"): New test. * tests/read.test: Add test. scm: Support map4. * module/mes/base-0.mes (map): Remove. Update callers. * module/mes/base.mes (map): Support map4. nyacc: Add simple split-cppdef for Mes. * module/nyacc/lang/c99/body.scm: Add non-regexp split-cppdef for Mes. scm: Add with-throw-handler hack. * module/mes/catch.mes (with-throw-handler): Add hack for Nyacc 0.75 scm: Add list->char-set. * module/srfi/srfi-14.mes (list->char-set): New function. * tests/srfi-14.test ("list->char-set!"): Test it. 2017-03-26 Jan Nieuwenhuizen mini-mes: Debugging to stderr. * scaffold/mini-mes.c (error, bload_env, main): Send debug info to stderr. throw/catch dinges: URG 2017-03-26 Jan Nieuwenhuizen scripts: Allow running with any mes. * scripts/mescc.mes: Run $MES if set, default to ../scripts/mes. * scripts/repl.mes: Likewise. mini-mes: Include and enable gc. * scaffold/mini-mes.c: Set MES_GC=1. (ARENA_SIZE)[MES_GC]: Reduce to 10,000 cells (WAS: 1,000,000,000 chars). (g_news): New global. (NTYPE, NCAR, NVALUE, NLENGTH, NCDR, NVECTOR): New macros. (mes_symbols)[MES_GC]: Call gc_init_news. (mes_builtins): Include gc.i, gc.environment.i. 2017-04-01 Jan Nieuwenhuizen mini-mes: Workarounds for gc.c. * gc.c (gc_copy)[!__GNUC__]: Avoid by value assignment from array-of struct entry. * scaffold/mini-mes.c (gc_init_cells): Workarounds. 2017-03-26 Jan Nieuwenhuizen core: Prepare gc.c for mescc, non-POSIX_SOURCE. * mes.c (NLENGTH, NVALUE, NVECTOR): New macros. (mes_builtins): Add comment on .i include order. * module/language/c99/compiler.mes (mescc): Add define _POSIX_SOURCE=0. * gc.c (gc_up_arena, gc_flip, gc_loop, gc)[!_POSIX_SOURCE]: Use eputs rather than fprintf. (gc_loop): Use CAR, TYPE, NVECTOR rather than .car, .type, .vector. * gc.c (gc_up_arena)[!_POSIX_SOURCE]: Add non-POSIX mlib.c implementation. mescc: Bugfix for realloc. * module/mes/libc.mes (realloc): Thinko. 2017-03-25 Jan Nieuwenhuizen mescc: Bugfix for neg. * module/language/c99/compiler.mes (expr->accu): Fix neg. * scaffold/t.c (math_test): Test it. * scaffold/mini-mes.c (ash): Remove workaround. mescc: Support rshift, have guile-mini-mes pass math test. * module/mes/as-i386.mes (i386:accu>>base): New function. * module/mes/as-i386.scm (mes): Export it. * module/language/c99/compiler.mes (expr->accu): Support rshift. * scaffold/t.c (math_test): Test it. * scaffold/mini-mes.c (ash): Use it. 2017-03-26 Jan Nieuwenhuizen test: Enable vector read test. * tests/read.test: Enable vector read test. 2017-03-25 Jan Nieuwenhuizen mini-mes: Support vectors. * scaffold/mini-mes.c (REF, MAKE_REF): New macro. Include vector.h, vector.c. (mes_builtins): Include vector.i, vector.environment.i. mini-mes: Workarounds for vector.c. * vector.c (make_vector, vector_set_x, list_to_vector)[!__GNUC__]: Avoid by value assignment from array-of struct entry. core: prepare vector.c for mescc. * vector.c (make_vector, vector_set_x, vector_to_list): Use REF, VALUE rather than .ref, .value. mini-mes: Fully remove reader from core. * scaffold/mini-mes.c (lookup_): Remove. * mes.c: Likewise. * reader.c (lookup_): Enable. * mlib.c (putc): New function. * module/mes/libc.mes (putc): New function. 2017-03-24 Jan Nieuwenhuizen mescc: Support bitwise or. * module/mes/as-i386.mes (i386:accu-or-base): New function. * module/mes/as-i386.scm: Export it. * module/language/c99/compiler.mes (expr->accu): Use it; support bitwise or. * scaffold/t.c (math_test): Test it. * scaffold/mini-mes.c (logior): Use it. mescc: Lshift support non-fixed shift value. * module/mes/as-i386.mes (i386:accu<accu): Use it. * scaffold/t.c (math_test): Test it. mescc: Use signed integer comparison. * module/language/c99/compiler.mes (test->jump->info): * module/mes/as-i386.mes (i386:Xjump-le, i386:Xjump-g, i386:Xjump-l, i386:Xjump-ge): New functions. * module/mes/as-i386.scm: Export them. * scaffold/t.c (math_test): Test them. * tests/scm.test ("iota -1"): Enable for mesc. 2017-03-26 Jan Nieuwenhuizen mescc: Run module/base-0.mes. * gc.c: New file. * vector.c: New file. * mes.c: Remove vector and gc functions, include vector.c, gc.c. * GNUmakefile (mes.o): Add gc, vector dependencies. * scaffold/mini-mes.c (eval_apply): Support primitive-load through read_input_file. (getenv_, open_input_file, current_input_port, set_current_input_port force_output, exit_, values, arity_, xassq, is_p, minus, plus, divide, modulo multiply, logior, ash): New function. (mes_symbols): Add symbols %gnuc, %mesc. * scaffold/mini-mes.c (): New functions. * scaffold/b-0.mes: New file. * scaffold/t-0.mes: New file. test: Allow running with any mes. * test/base.test: Run $MES if set, default to ../scripts/mes. * tests/base.test: Likewise. * tests/catch.test: Likewise. * tests/closure.test: Likewise. * tests/cwv.test: Likewise. * tests/display.test: Likewise. * tests/fluids.test: Likewise. * tests/gc-0.test: Likewise. * tests/gc-1.test: Likewise. * tests/gc-2.test: Likewise. * tests/gc-2a.test: Likewise. * tests/gc-3.test: Likewise. * tests/gc-4.test: Likewise. * tests/gc-5.test: Likewise. * tests/gc-6.test: Likewise. * tests/gc.test: Likewise. * tests/let-syntax.test: Likewise. * tests/let.test: Likewise. * tests/match.test: Likewise. * tests/math.test: Likewise. * tests/module.test: Likewise. * tests/optargs.test: Likewise. * tests/peg.test: Likewise. * tests/psyntax.test: Likewise. * tests/quasiquote.test: Likewise. * tests/read.test: Likewise. * tests/record.test: Likewise. * tests/scm.test: Likewise. * tests/srfi-1.test: Likewise. * tests/srfi-13.test: Likewise. * tests/srfi-14.test: Likewise. * tests/vector.test: Likewise. 2017-04-02 Jan Nieuwenhuizen scm+test: Factor-out math and vector. * module/mes/base-0.mes (quotient): Remove. * module/mes/scm.mes (quotient): Add. * tests/scm.test: Remove arithmetic/math tests. * tests/math.test: New file. * GNUmakefile (TESTS): Add it 2017-03-23 Jan Nieuwenhuizen mescc: Have ungetc remember 2 positions. * doc/examples/t.c (read_test): Test it. * doc/examples/mini-mes.c: * mlibc.c (getchar, ungetc): Support 2 ungetc positions. * module/mes/libc.mes (getchar, ungetc): Likewise. 2017-04-02 Jan Nieuwenhuizen mescc: Add brk, naive malloc. * scaffold/mini-mes.c (gc_init_cells): Use malloc to init g_cells. * scaffold/malloc.c: New file. * GNUmakefile (malloc, guile-malloc): New targets. * module/mes/libc-i386.mes (i386:brk): New function. (i386:libc): Add it. * mlibc.c (brk): New function. (malloc): Use it. (realloc): New function. * module/mes/libc.mes (malloc, realloc): New functions. 2017-03-23 Jan Nieuwenhuizen mescc: Struct fixes. * module/language/c99/compiler.mes (expr->arg, expr->accu, ast->info): Fixes for struct assignment. 2017-03-22 Jan Nieuwenhuizen mescc: Add missing defines. * module/language/c99/compiler.mes (mescc): Set STDIN, STDOUT, STDERR, INT_MIN, INT_MAX. mini-mes: Update display_. * doc/examples/mini-mes.c (display_): Add separator, nicer recursion. * mes.c (display_): Update. mescc: Struct by value assignment fixes. * module/language/c99/compiler.mes (ast->info): Remove g_function hardcoding, fix struct assignment. * doc/examples/t.c (struct_test): Test it. mescc: Fix struct field comparison. * module/language/c99/compiler.mes (expr->accu, ast->info): Some push/pop fixes, fixes struct field comparisons. * doc/examples/t.c (struct_test): Test it. mescc: Run full scheme reader read-0.mes. * lib.c (load_env)[MINI_MES]: Load full reader, module/mes/read-0.mes. * GNUmakefile (module/mes/read-0-32.mo): Update dependency. * module/mes/mini-0.mes: Remove. * doc/examples/t.c (struct_test): * module/mes/read-0-32.mo: New file: bootstrap binary reader. mescc: Mini-mes (gcc-compiled) runs read-0.mes. * module/language/c99/compiler.mes (expr->accu): Add mul. (test->jump->info): Add le, ge. (ast->info): Support int and char* initialization at top level. * module/mes/as-i386.mes (i386:accu*base, i386:Xjump-cz, i386:Xjump-ncz): New function. * module/mes/as-i386.scm: Export them. * doc/examples/t.c (test): Test them. * module/mes/libc.mes (ungetc): New function. (getchar): Support it. (assert_fail, isdigit): New functions. (libc): Export them. * module/mes/mini-0.mes: Load full reader. * mlibc.c (ungetc): New function. (getchar): Support it. (assert_fail, isdigit): New functions. * mes.c (list length error lookup_ getchar ungetchar peekchar peek_byte read_byte unread_byte greater_p less_p): Move functions needed to run read-0.mes into core. * doc/examples/mini-mes.c: Likewise. * lib.c (length, error): Comment-out. * math.c (greater_p, less_p): Comment-out. * posix.c: (getchar, ungetchar, peekchar, peek_byte, read_byte, unread_byte): Comment-out. * reader.c (lookup_): Comment-out. 2017-03-19 Jan Nieuwenhuizen mescc: Cleanup mini-mes build and test. * GNUmakefile (guile-cons-mes guile-m guile-main guile-micro-mes guile-mini-mes guile-t guile-tiny-mes): New targets. (clean): Clean them. * .gitignore: Ignore them. * HACKING: Update. * scaffold/tiny-mes.c (bload_env): Read module/mes/tiny-0-32.mo. * scaffold/cons-mes.c (simple_bload_env): Likewise. * lib.c (dump)[MES_TINY]: Write crafted dump: module/mes/tiny-0-32.mo. (load_env): Read module/mes/mini-0.mes. (bload_env): Read module/mes/read-0-32.mo. * module/mes/mini-0.mes: New file. * module/mes/tiny-0.mes : New file. 2017-04-02 Jan Nieuwenhuizen mescc: Refactor libc. * GNUmakefile (mini-mes): Add include. * mlibc.c: New file: libc bits for GNUC -nostdlib. * mstart.c: New file: _start for GNUC -nostdlib. * scaffold/cons-mes.c: Remove GNUC libc bits. * scaffold/m.c: Likewise. * scaffold/mini-mes.c: Likewise. * scaffold/t.c: Likewise. * scaffold/tiny-mes.c: Litkewise. * module/language/c99/compiler.mes (libc, i386:libc): Remove. * module/language/c99/compiler.scm * module/mes/libc-i386.mes: Remove assembly bits. (_start): New function. * module/mes/libc-i386.scm: Export it, remove assembly exports. * module/mes/as-i386.mes: New file: assembly bits from libc-i386.mes. * module/mes/as-i386.scm: New file: export them. * module/mes/libc.mes (libc,_start): New functions from compiler.mes. * module/mes/libc.scm: Export them. 2017-03-19 Jan Nieuwenhuizen mescc: Refactor ret. * module/mes/libc-i386.mes (i386:ret): Refactor. * module/language/c99/compiler.mes (ast->info): Use it. 2017-03-18 Jan Nieuwenhuizen mescc: Cache text generation. * module/mes/elf-util.mes (functions->text): Add cache. mescc: Refactor function-offset. * module/mes/elf-util.mes (function-offset): Recurse down. Factor 5 speedup on mini-mes.c. mescc: Cache data-offset too. * module/mes/elf-util.mes (data-offset): Add cache. mescc: Support assignment with comparison. * module/language/c99/compiler.mes (expr->accu): Handle assignment -> accu. * doc/examples/t.c (test): Test it. * doc/examples/mini-mes.c (eval_apply): Use it. mescc: Support assignment test. * module/language/c99/compiler.mes (test->jump->info): Handle assignment. * doc/examples/t.c (test): Test it. 2017-03-17 Jan Nieuwenhuizen mescc: Fix simple value tests. * module/language/c99/compiler.mes (test->jump->info): Test accu before jumping. Fixes simple value tests. mescc: Struct by value. * build-aux/mes-snarf.scm (symbol->names, function->header, function->environment): Remove struct by value assignment workarounds. * module/language/c99/compiler.mes (ast->info): Remove struct by value assignment debug printing. mescc: Support generic initializer. * module/language/c99/compiler.mes (ast->info): Support generic declaration using initializer. Supports struct field initializer. * doc/examples/t.c (struct_test): Test it. * doc/examples/mini-mes.c (call_lambda, eval_apply, write_byte, display_): Use it. (call_lambda): (eval_apply, list_of_char_equal_p): Use it. mescc: Remove last hardcodings for identifiers. * module/language/c99/compiler.mes (ident->accu, ident->base): Use local:ptr, type->size to remove hard coding of functionx, c1. (expr->accu): Use type->size to remove hard coding of size byte. (decl->type): Also handle typename, bail out if type not found. (type->size): Print identifier and and bail out if type not found. (formal:ptr): New function. (formals->locals): Use it to set pointer value of parameter. WAS: 0. (ast->info): Remove functionx hardcoding. (getchar): Rename c1 to c. * doc/examples/t.c: Test it. mescc: Support function call with enum value. * doc/examples/mini-mes.c: Remove debug printing. * module/language/c99/compiler.mes (push-global, push-local, push-global-address, push-local-address, push-local-de-ref): Return list of lambda. (push-ident): Support push constant. Fixes mini-mes, cstring_to_list. * doc/examples/t.c (test): Test it. 2017-03-13 Jan Nieuwenhuizen mescc: Fix d-sel comparisons. * module/language/c99/compiler.mes (ast->info): Save base while computing accu. Fix comparison using d-sel in second argument. * doc/examples/t.c: Test it. * doc/examples/mini-mes.c (assq): Use it. mescc: Fix for character array s[0]. * module/language/c99/compiler.mes (expr->arg, expr->accu, ast->info): Use type size to calculate index. * doc/examples/t.c: Test it. * doc/examples/mini-mes.c (cstring_to_list): Simplify. 2017-03-12 Jan Nieuwenhuizen mescc: Support mini-mes running scheme program with builtins. Mini-mes, compiled with either gcc or mescc, now runs a memory dump of this mini-0.mes program (begin (write-byte (make-cell 0 0 65)) (write-byte (make-cell 0 0 66)) (write-byte (make-cell 0 0 67)) (write-byte (make-cell 0 0 10)) #f) when read and dumped by (gcc-compiled) mes-32. * build-aux/mes-snarf.scm: FIXES ..collapse? * module/language/c99/compiler.mes (ast->info): Bail out on unhandled declarations. Was: verbosely skip. 2017-03-12 Jan Nieuwenhuizen mescc: Support [for] itoa. * module/mes/libc-i386.mes (i386:accu%base): New function. * module/mes/libc-i386.scm: Export it. * module/language/c99/compiler.mes (expr->accu): Use it to support mod. * doc/examples/t.c (itoa): New function. (test): Test it. * doc/examples/mini-mes.c (itoa)[!__GNUC__]: New function. mescc: Support do .. while. * module/language/c99/compiler.mes (ast->info): Support do-while. * doc/examples/t.c (test): Test it. 2017-03-10 Jan Nieuwenhuizen core+mini-mes: Replace manual snippets by snarfed includes. * build-aux/mes-snarf.scm (symbol->source, function->header, function->source, function->environment): Add workarounds to avoid struct-copy initializers. * GNUmakefile (mini-mes): Snarf symbols and functions. * scaffold/mini-mes.c: Include mini-mes.h, mini-mes.symbols.h, mini-mes.symbols.i, mini-mes.i, mini-mes.environment.i. Add snarfable symbol/special definitions. (type_t): Prefix all types with `T', update users. (assert_defined, gc_push_frame, gc_peek_frame, gc_init_cells): Mark as internal. * mes.c (type_t): Prefix all types with `T', update users. * scaffold/mini-mes.c (eq_p, type_, car_, cdr_, list_of_char_equal_p, lookup_macro, write_byte): New functions (from mes.c). (assq): Add debugging, workaround. 2017-03-05 Matt Wette nyacc: removed start from lalr-spec -- not needed 2017-03-04 Matt Wette nyacc: working javascript interpreter in guile 2017-03-03 Matt Wette nyacc: lex fixes for char-lit 2017-03-02 Matt Wette nyacc: cleaned up documentation 2017-03-01 Matt Wette nyacc: working on C99 UG as a memo 2017-02-28 Matt Wette nyacc: new release 0.76.5 nyacc: fixed bug in pretty-print-c99 wrt i-sel 2017-02-25 Matt Wette nyacc: merge from 0.76.4 2017-02-24 Matt Wette nyacc: new release 0.76.4 2017-02-23 Matt Wette nyacc: new release 0.76.3 nyacc: more bugs in cpp tokl->string nyacc: new release 0.76.2 nyacc: fixed more CPP issues 2017-02-22 Matt Wette nyacc: new release 0.76.1 nyacc: fixed C99 CPP to deal with numbers correctly 2017-02-20 Matt Wette nyacc: merge master 0.76.0 2017-02-19 Matt Wette nyacc: new release 0.76.0 nyacc: worked c99/util2.scm udecl->mspec nyacc: new release 0.75.6 nyacc: fixed some c99/util2 items 2017-02-17 Matt Wette nyacc: merged in 0.75.5 from master and inc version nyacc: new release 0.75.5 nyacc: new release 0.74.4 nyacc: minor cpp fixes 2017-02-16 Matt Wette nyacc: merge from 0.75.3 nyacc: new release 0.75.3 nyacc: new release 0.75.2 nyacc: new release 0.75.1 nyacc: new release 0.74.0 nyacc: I think cpp is working now 2017-02-15 Matt Wette nyacc: working cpp now, I hope 2017-02-12 Matt Wette nyacc: CPP not yet working for file mode 2017-02-11 Matt Wette nyacc: working on cpp issues 2017-02-05 Matt Wette nyacc: C99 CPP for code is better 2017-01-20 Matt Wette nyacc: starting to work on reframing 2017-01-19 Matt Wette nyacc: more CPP fixes 2017-01-17 Matt Wette nyacc: redesign lang/c99/cppbocy.scm:scan-cpp-input 2017-03-10 Jan Nieuwenhuizen mescc: Support goto in while body. * module/language/c99/compiler.mes (ast->info): Support goto in while body. * doc/examples/t.c (test): Test it. 2017-03-09 Jan Nieuwenhuizen core+mini-mes: Move function name to struct function. * module/language/c99/compiler.mes (expr->arg): Handle char arguments. * doc/examples/cons-mes.c (struct function): Add name field. * doc/examples/mini-mes.c: Likewise. (mes_builtins): Update. * mes.c: Likewise. * build-aux/mes-snarf.scm: Update. 2017-03-09 Jan Nieuwenhuizen mescc: Support strings in struct initialization. * module/mes/elf-util.mes (add-s:-prefix, drop-s:-prefix): New functions. * module/mes/elf-util.scm: Export them. * module/language/c99/compiler.mes (string->global): Add `s:' prefix to global strings. Update users. (expr->arg): Update. (expr->accu): Handle string expressions. (initzer->global): New function. (struct-field): Handle string field. * doc/examples/t.c: Test it. * doc/examples/mini-mes.c: Use it. dun! 2017-03-07 Jan Nieuwenhuizen mescc: Display sexps better. * module/mes/elf.mes (make-elf): Only display data sections smaller than 200 bytes. * doc/examples/mini-mes.c (simple_bload_env): Read mini-0-32.mes. * doc/examples/cons-mes.c (display_): Support symbols and specials. * doc/examples/tiny-mes.c: Likewise. * lib.c: * mes.c: 2017-03-06 Jan Nieuwenhuizen mescc: Compile all of mini-mes. * module/language/c99/compiler.mes (case->jump-info): Support single statement. * module/mes/elf-util.mes (function-prefix): Workaround for reversed functions. FIXME! * module/mes/elf.mes: * scaffold/mini-mes.c (type_t): Rename FUNCTION to TFUNCTION for Nyacc. Add missing symbols. (eval_apply): Uncomment most. * scaffold/tiny-mes.c: * scaffold/cons-mes.c: Remove cruft. 2017-03-02 Jan Nieuwenhuizen mescc: Support struct assignment. * module/mes/libc-i386.mes (i386:base-address->accu-address, i386:accu+n, i386:base+n): New functions. * module/mes/libc-i386.scm: Export them. * module/language/c99/compiler.mes (ast->info): Use them. * doc/examples/t.c: Test them. * doc/examples/cons-mes.c: Drop workarounds. * doc/examples/mini-mes.c: Likewise. * mes.c: mescc: Fix add, sub, lshift. * module/language/c99/compiler.mes (expr->accu): Fix add, sub, lshift. * doc/examples/t.c: Test them. * doc/examples/cons-mes.c: * doc/examples/mini-mes.c: 2017-02-27 Jan Nieuwenhuizen mescc: Support any expression as arg. * module/language/c99/compiler.mes (expr->arg): Also push parameter, always return info. (ast->info): Loop over args. Fixes using function calls in arguments. * module/mes/libc-i386.mes (i386:push-arg): Remove. (i386:call, i386:call-accu): Remove arguments parameter. * doc/examples/t.c: Test it. 2017-03-02 Jan Nieuwenhuizen mescc: Rename expr->accu*. * module/language/c99/compiler.mes (expr->accu*): Rename from expr->accuX. 2017-04-02 Jan Nieuwenhuizen mescc: Fixes for goto. * module/mes/libc-i386.mes (XXjump): New function. * module/mes/libc-i386.scm: Export it. * module/language/c99/compiler.mes (case->jump-info, ast->info): Use it. * scaffold/t.c: Test it. * GNUmakefile (cons-mes): New target. * scaffold/cons-mes.c: New file. * scaffold/mini-mes.c: 2017-02-24 Jan Nieuwenhuizen mescc: Mini-mes runs (cons 0 1) dump. * module/mes/libc-i386.mes (i386:Xjump-z, i386:Xjump-c, i386:Xjump-nc): New functions. * module/mes/libc-i386.scm: Export them. * module/language/c99/compiler.mes (case->jump-info, test-jump->info, ast->info): Use them. * doc/examples/t.c: Test it. * doc/examples/mini-mes.c: Run it. 2017-01-29 Jan Nieuwenhuizen mescc: Run mini-mes. * .gitignore: Ignore tiny-mes and tiny .mo's. * doc/examples/tiny-mes.c: Simplify. * doc/examples/mini-mes.c: Use simplifications from tiny-mes. * doc/examples/t.c (read_test, struct_test): New functions. (test): Add tests for arena, g_cells globals. * module/mes/elf-util.mes (dec->hex): New function. (lambda/label->list): Add text-address parameter. Update callers. * module/language/c99/compiler.mes (make, info, clone): Add init field. (.init): New function. (ident->accu): Add exceptions for globals. * module/mes/elf-util.scm: Export it. * module/mes/libc-i386.mes (i386:accu->base-ref, i386:byte-accu->base-ref, i386:accu->base-ref+n, i386:accu->global-ref, i386:global-ref->accu, i386:global-ref->base, i386:global-add, i386:global->accu):, i386:local-ref->accu, i386:local-ptr->accu, i386:local-ptr->base): New functions. * module/mes/libc-i386.scm: Export them. 2017-01-22 Jan Nieuwenhuizen doc: Add gdb assembly debugging info. * HACKING: Add gdb assembly debugging info. 2017-01-21 Jan Nieuwenhuizen doc: Add fosdem talk. * .gitignore: Ignore beamer/tex stuff. * doc/fosdem/fosdem.org: New file. * doc/fosdem/GuixSD.png: New file. * doc/fosdem/LISP-1-5-page-13-bottom.png: New file. * doc/fosdem/LISP-1.5-page-13-bottom.png: New file. * doc/fosdem/LISP-1.5-page-13.pdf: New file. * doc/fosdem/LISP-1.5-page-13.png: New file. * doc/fosdem/beamercolorthemeX.sty: New file. * doc/fosdem/beamerthemeX.sty: New file. * doc/fosdem/bootstrap-graph.png: New file. * doc/fosdem/egg.jpeg: New file. * doc/fosdem/egg.png: New file. * doc/fosdem/egg.xcf: New file. * doc/fosdem/fosdem.pdf: New file. * doc/fosdem/fsb-logo-guile-guix-gnu.png: New file. * doc/fosdem/fsb-logo-guile-guix-gnu.xcf: New file. * doc/fosdem/fsb-logo-guile-guix-mes.png: New file. * doc/fosdem/fsb-logo-guile-guix-mes.xcf: New file. * doc/fosdem/fsb-logo.png: New file. * doc/fosdem/guix-build-bootstrap-tarballs.log: New file. * doc/fosdem/html.sty: New file. * doc/fosdem/mes.png: New file. * doc/fosdem/mes.xcf: New file. mescc: bugfix: arg as function call. * module/language/c99/compiler.mes (expr->arg): 2017-01-18 Jan Nieuwenhuizen mini-mes: gcc: run (cons 0 1). 2017-01-15 Matt Wette nyacc: new release 0.74.3 nyacc: CPP working better now 2017-01-14 Matt Wette nyacc: something working nyacc: still debugginug 2017-01-12 Matt Wette nyacc: working # and ## I think, but lots of debug output too 2017-01-11 Matt Wette nyacc: exceptions worked on.. still need to fix # nyacc: new release 0.74.2 nyacc: fixed C99 use of 'defined XYZ' (no parens) nyacc: merged master nyacc: working on fixes 2017-01-10 Jan Nieuwenhuizen mescc: Read and display sexp dumped by mes. * lib.c (dump)[MES_HACK]: Dump small hello-world sexp, to be handled by * doc/examples/tiny-mes.c (display_): New function. * module/mes/libc-i386.mes (i386:accu->base, i386:mem->accu, i386:mem+n->accu): New functions. * module/mes/libc-i386.scm: Export them. * GNUmakefile (mes-32): New target. 2017-01-17 Jan Nieuwenhuizen mescc: Support global pointer assignments. * module/mes/libc-i386.mes (base->accu-ref, local-ref->base): New functions. * module/mes/libc-i386.scm: Export them. * module/language/c99/compiler.mes (base->ident-ref, ident-ref->base): New functions. mescc: Add data as loadable ELF section. * module/mes/elf.mes (make-elf): Add data as loadable section too. mescc: Support switch. * module/language/c99/compiler.mes (case->jump-info): New function. (ast->info): Use it. * doc/examples/t.c (swits): Test it. 2017-01-10 Jan Nieuwenhuizen mescc: Handle enums. * module/language/c99/compiler.mes (, ): New slots for info. (make, clone): Add them. (.types, .constants): New accessors. mescc: Update for. * module/language/c99/compiler.mes (ast->info): Rewrite for to use test->jump->info. 2017-01-17 Jan Nieuwenhuizen scm: Add string-delete. * module/srfi/srfi-13.mes (string-delete): New function. 2017-04-02 Jan Nieuwenhuizen mescc: Add open/read C-tests. * scaffold/m.c: New file. * scaffold/tiny-mes.c: New file. * GNUmakefile (m, tiny-mes): New targets. * scaffold/micro-mes.c: Update gcc-libc bits. * scaffold/mini-mes.c: Likewise. 2017-01-10 Jan Nieuwenhuizen mescc: Support ?. * module/language/c99/compiler.mes (ast->info): Support cond-expr. * scaffold/t.c (test): Test it. mescc: Support open, read. * module/mes/libc-i386.mes (i386:write): Fix comment. (i386:open, i386:read): New functions. * module/mes/libc-i386.scm: Export them. * module/language/c99/compiler.mes (i386:libc): Add them. (getchar, putchar): New libc functions. (libc): Add them. mescc: Support globals. * module/language/c99/compiler.mes (write-any): Catch writing of procedure and give more debug information. (ref-local, ref-global): Remove. (push-global-ref, push-global, push-ident-ref): New functions. (push-ident): New function. (expr->arg): Use them. (ident->accu, ident->accu, accu->ident, value->ident, ident->base): Take info parameter, also handle globals. (ident-address->accu, ident->global, cstring->number): New functions. (ast->info): Update. * module/mes/libc-i386.mes (i386:ret-local): Remove. (i386:push-global-ref): Rename from i386:ref-global. (i386:push-local): Rename from i386:ref-local. (i386:value->local): Rename from i386:local-assign. (i386:push-global, i386:push-local-ref, i386:value->global, i386:local-address->accu): New functions. * module/mes/libc-i386.scm: Export them. 2017-01-09 Jan Nieuwenhuizen mescc: Small ELF tweaks allowing debugging with gdb. * module/mes/elf.mes (make-elf): Change note section to comment. Fixes readelf. Add SHF-ALLOC to .text and .data. 2017-01-08 Jan Nieuwenhuizen mescc: Handle && in if and while. * scaffold/t.c (test): Add strcmp tests. * module/language/c99/compiler.mes (expr->arg): (test->jump->info): New function. (ast->info): Use it. * module/mes/libc-i386.mes (i386:global->accu): (i386:base-mem->accu): Rename from i386:mem->accu. (i386:byte-base-mem->accu): Rename from i386:base-mem->accu. (i386:accu-not, i386:global->accu, i386:xor-accu): New functions. * module/mes/libc-i386.scm: Export them. 2017-01-07 Jan Nieuwenhuizen mescc: Proper support for i++,++i,i--,--i. * module/language/c99/compiler.mes (ast->info): Bugfix: locals. Add i--, --i. Properly support i++, ++i. * module/mes/libc-i386.mes (i386:function-locals): Support 8 local vars. * scaffold/t.c (test): Test it. 2017-04-02 Jan Nieuwenhuizen mescc: Beginning of expression and test template. * scaffold/t.c: New file. * GNUmakefile (mescc-check, t-check): New targets. * module/language/c99/compiler.mes (write-any): Catch weirdness. (make): Add slot. (.function): New accessor. (clone): Handle it. (function->info): Set it. (ast->info): Make tests generic in if, for, while. Add goto, label, !, ==, !=, -, &&. * module/mes/elf-util.mes (lambda/label->list): New function. (text->list): Use it. (functions->text, function-prefix): New function. (function-offset): Use it. (label-offset): New function. * module/mes/elf-util.scm (mes): Export them. * module/mes/elf.mes (make-elf): Use text->list. * module/mes/libc-i386.mes (eputs, puts): Remove. (i386:byte-base-sub): Rename from sub-byte-base. (i386:byte-jump-z): Rename from i386:Xjump-byte-z. (i386:byte-mem->accu): Rename from i386:Xmem-byte->accu. (i386:byte-mem->base): Rename from i386:Xmem-byte->base. (i386:accu->local, i386:accu-non-zero?, i386:accu-zero?, i386:base-sub, i386:byte-sub-base, i386:jump-c, i386:jump-cz, i386:jump-nc, i386:jump-ncz, i386:byte-mem->base, i386:sub-base, i386:test-accu, i386:test-base, i386:test-jump-z, i386:value->base, i386:xor-zf): New functions. 2017-01-05 Jan Nieuwenhuizen mescc: Have micro-mes use strcmp to print help. * doc/examples/micro-mes.c (main): Add --help. * module/language/c99/compiler.mes (info?): New function. (expr->accu): Handle function call and sub. (ast->info): Handle if not, and, de-ref, eq, sub, return f (). * module/mes/libc-i386.mes (i386:accu-zero?, i386:Xmem-byte->accu, i386:Xmem-byte->base, i386:jump-byte-nz, i386:jump-byte-z, i386:test-byte-base, i386:Xjump-byte-z, i386:sub-byte-base): New functions. * module/mes/libc-i386.scm: Export them. mescc: Compile specific for loop. * module/language/c99/compiler.mes (ast->info): Handle for, pre-inc. * GNUmakefile (main): New target. * doc/examples/main.c: (exit, write, strlen,puts)[__GNUC__]: New functions; import from micro-mes.c (_start): New function. 2017-01-04 Jan Nieuwenhuizen mescc: Refactor compiler. * module/language/c99/compiler.mes (make, clone): Lightweight functional GOOPS-like list-based info structure. (make-text+globals+locals): Remove. (ast->info): Rename from statement->text+globals+locals, refactor. Update callers. (function->info): Rename from function->globals, refactor. Update callers. (ast-list->info): New function. 2017-01-07 Jan Nieuwenhuizen scm: Fix psyntax/keyword/optargs interaction bug. * module/mes/psyntax-0.mes (self-evaluating?): Add keyword?. * module/mes/pmatch.mes (mes): Add missing psyntax dependency. * module/mes/optargs.scm (rest-arg->keyword-binding-list): Make error messages non-constant. * tests/optargs.test ("clone "): New test. 2017-01-03 Jan Nieuwenhuizen mescc: Compile file supplied on command line. * scripts/mecc.mes: Pass (command-line) to main. nyacc: Add cpp to c99 mes module. * module/nyacc/lang/c99/parser.mes: Include (nyacc lang c99 cpp). mescc: Rename symbols to globals. * module/language/c99/compiler.mes: mescc: Have micro-mes use if not to segfault. * module/language/c99/compiler.mes (write-any): Check explicitly on number?, report error otherwise. (statement->text+symbols+locals): Remove statement-offset. Handle compounds. Handle very specific if. (function->symbols): Remove unused text-offset. * doc/examples/micro-mes.c (main): If argc > 1 print argv1. Fixes segfault :-) * module/mes/elf-util.mes (symbols->text): Loop rather than map, feed text-offset. * module/mes/libc-i386.mes (i386:local-test, i386:jump-le): New functions. * module/mes/libc-i386.scm: Export them. mescc: Have micro-mes print argv. * module/language/c99/compiler.mes (expr->arg): Bugfix argv: Use size=4 (int). (statement->text+symbols+locals): Bugfixes: array-ref, initialize with immediate, initialize with local. (formals->locals): Bugfix: formals counted down from -1 [WAS: down to -1]. * module/mes/libc-i386.mes (i386:call): Reverse args pushes to match formals index changes. (i386:write): Update for changed formals push order. (i386:mem->accu, i386:value->accu): New functions. * module/mes/libc-i386.scm (mes): Export them. * doc/examples/micro-mes.c (eputs, puts, fputs): Make identical with mescc's implementations. (main): Print argv[0] and (unconditionally; crash if not given) argv[1]. mescc: Have micro-mes print argc. * module/language/c99/compiler.mes (accu->ident): New function. (statement->text+symbols+locals): Use it to implement initialization with immediate, local. (_start): Call main with argc,argv [WAS: 0,0]. * module/mes/libc-i386.mes (i386:push-accu, i386:accu->local): New functions. * module/mes/libc-i386.scm: Export them. * doc/examples/micro-mes.c (main): Return argc as exit status. mescc: Support literal .byte in asm (). * module/language/c99/compiler.mes (expr->arg): Handle array-ref (int only). (byte->hex, asm->hex): New functions. (statement->text+symbols+locals): Use it to implement asm (). mescc: Remove data section from disassembly. * module/mes/elf.mes (make-elf): Remove executable bit from data. 2017-01-02 Jan Nieuwenhuizen mescc: Formals, local variables. * module/language/c99/compiler.mes (statement->text+symbols+locals): Rename from statement->text+symbols. Handle locals. (formals->text): Add proper function preamble. (formals->locals): Add formals as locals. (expr->accu, ident->accu, ident->base, ident-ref, global-ref): New functions. (strlen, eputs, fputs, puts): New functions. (libc): New variable. (i386:libc): Rename from libc. Remove eputs and puts. * module/mes/libc-i386.mes (i386:eputs, i386:puts: Remove. (i386:call, i386:ret): Handle locals as argument. (i386:function-locals, i386:function-preamble, i386:jump, i386:local->accu, i386:local-add, i386:local-assign, i386:local->base, i386:ref-global, i386:ref-local, i386:ret-local, i386:mem-byte->accu, i386:test-jump, i386:write): New functions. * module/mes/libc-i386.scm: Export them. mescc: Nicer functions/parameters. * module/mes/libc-i386.mes (eputs, exit, puts): Save stack pointer, fill parameter registers from stack. * module/language/c99/compiler.mes (formal->text): Fill parameter registers from stack memory. (formals->text): Save stack pointer. mini-mes: Parse with Nyacc. * doc/examples/mini-mes.c: Parse with Nyacc. 2017-04-02 Jan Nieuwenhuizen mescc: Scaffolding of Nyacc compile experiments. * scaffold/micro-mes.c: New file. * scaffold/mini-mes.c: New file. * GNUmakefile (mini-mes, micro-mes): New targets. * .gitignore: Ignore them. mescc: Nyacc updates, factor-out elf-util. * module/mes/bytevectors.mes * module/mes/elf-util.mes: New file. * module/mes/elf.mes: Use it. (make-elf): Generate symbol-table string-table. * module/mes/elf-util.scm: New file. * module/mes/elf.scm: Use it. * module/language/c99/compiler.mes: Include it. * module/language/c99/compiler.scm: Include it. * module/mes/libc-i386.mes (call, eputs, exit, puts): New functions. * module/mes/libc-i386.scm: Export them. 2016-12-31 Jan Nieuwenhuizen mescc: Use Nyacc frontend. * module/language/c99/compiler.mes: New file. * module/language/c99/compiler.scm: Include it. * module/mes/elf.mes: Move (mes-use-module) into cond-expand. * module/mes/elf.scm: New file. * module/mes/libc-i386.scm: New file. * module/nyacc/lang/c99/parser.mes: Add missing module includes. * module/nyacc/lang/util.mes: Add missing module include. * scripts/mescc.mes: Use Nyacc. * guile/mescc.scm: New file. * GNUmakefile (guile-mescc): Run it. 2017-01-03 Jan Nieuwenhuizen scm: Avoid xpath's shadowing of filter. * module/sxml/xpath.scm (xpath:filter): Rename from filter. Fixes shadowing of core filter. 2017-01-09 Matt Wette nyacc: fixes didn't get in in 0.74.0 nyacc: ugh. fixes did not take, why? 2017-01-08 Matt Wette nyacc: new release 0.74.0 nyacc: minor fixes nyacc: lots of C99/CPP fixes. now more robust for code mode nyacc: lots of fixes to make CPP more robust; now need to test 2017-01-06 Matt Wette nyacc: updates for cpp-ok/not-ok 2017-01-02 Matt Wette nyacc: fixed c99/CPP bug: need to skip space before lparen nyacc: have something working for in-place include 2017-01-01 Matt Wette nyacc: working on cpp-include fix 2016-12-31 Matt Wette nyacc: creating fixes for 0.73.0 2016-12-26 Matt Wette nyacc: new release 0.73.0 nyacc: misc updates; see ChangeLog 2016-12-03 Matt Wette nyacc: multiple fixes 2016-08-09 Matt Wette nyacc: starting devel on 0.72.0 2016-12-26 Jan Nieuwenhuizen nyacc: Move README.nyacc. * module/nyacc/README.nyacc: Moved from README.nyacc. nyacc: Add README.nyacc. * README.nyacc: New file. 2016-12-25 Jan Nieuwenhuizen tests: Move (ice-9 syncase) into cond-expand. * tests/psyntax.mes: Move (ice-9 syncase) into cond-expand. Fixes guile-2 deprecation messages. 2017-03-26 Jan Nieuwenhuizen nyacc: Move (ice-9 syncase) into cond-expand. * module/nyacc/lalr.scm: Move (ice-9 syncase) into cond-expand. Fixes guile-2 deprecation messages. * module/nyacc/lang/c99/cpp.scm: Likewise. * module/nyacc/lang/c99/parser.scm: Likewise. * module/nyacc/lex.scm: Likewise. 2017-01-04 Jan Nieuwenhuizen core: Move GNUisms inside #if. * mes.c: Move GNUisms inside #if, add Nyacc #ifs. (tmp_num2, tmp_num3): Remove. (make_tmps): Update. (g_free): Make simple int. Update users. * lib.c: Update users. * build-aux/mes-snarf.scm (GCC?): New switch to enable GNU extensions. 2017-01-22 Jan Nieuwenhuizen repl: Fix expand in repl. * module/mes/repl.mes (repl): Fix expand. Remove sc-expand. 2017-01-03 Jan Nieuwenhuizen scm: Error throws rather than hard exit. * module/mes/read-0.mes (read-character, read-string): Call error. * module/mes/scm.mes (error): Call core:error instead of exit. (syntax-error): Likewise. * module/mes/repl.mes (repl): Move read into catch. 2016-12-28 Jan Nieuwenhuizen repl: Use exception handling. * module/mes/repl.mes (repl): Use catch to prevent exit upon error. core: Throw exceptions rather than asserts. * lib.c (error): Throw instead of assert. (check_formals, check_apply): Update. * mes.c (scm_symbol_unbound_variable, scm_symbol_not_a_pair, scm_symbol_system_error, scm_symbol_wrong_number_of_args, scm_symbol_wrong_type_arg, scm_symbol_unbound_variable): New symbols. (car, cdr, set_cdr_x, set_env_x, eval_apply, gc_up_arena): Update. core+scm: Implement exception handling. * mes.c (scm_symbol_throw): New symbol. * module/mes/catch.scm (catch, throw): Implement [WAS: syntactic sugar]. (make-exception, exception?, exception-key, exception-args): Remove. * tests/catch.test ("catch", "catch 22"): Add tests. * module/mes/base-0.scm: Include it. Revert "core: Display me debuggor CPS+CC." This reverts commit 6c327b5bdceae6fc59ac8cce4aed99ea0a491846. 2016-12-28 Jan Nieuwenhuizen core: Display me debuggor CPS+CC. Having display in the core is handy for debugging. This is a courtesy commit intended to prevent bitrot. * GNUmakefile (mes.o): Depend on display. * mes.c: Include display. * display.c: New file. 2016-12-28 Jan Nieuwenhuizen core: Add continuations, call/cc. * mes.c (type_t): Add CONTINUATION. (scm_t): Add continuation; (scm_call_with_current_continuation): New symbol. (scm_symbol_call_with_current_continuation): New special. (g_continuations): New global (CONTINUATION): New field accessor. (MAKE_CONTINUATION): New make_cell helper. (car_): Update. (eval_apply): Implement call/cc. * module/mes/display.mes (display): Handle continuations. * module/mes/type-0.mes (): New type. (cell-type-alist): Add it. (continuation?): New function. * tests/base.test ("call/cc"): New test. core: Rewrite eval_apply in continuation passing style. * mes.c (scm_vm_evlis, scm_vm_evlis2, scm_vm_evlis3, scm_vm_apply, scm_vm_apply2, scm_vm_eval, scm_vm_eval_set_x, scm_vm_eval_macro, scm_vm_eval2, scm_vm_macro_expand, scm_vm_begin, scm_vm_begin_read_input_file, scm_vm_begin2, scm_vm_if, scm_vm_if_expr, scm_vm_call_with_values, scm_vm_call_with_values2, scm_vm_return): New specials. (scm_vm_eval_car, scm_vm_eval_cdr, scm_vm_eval_cons, scm_vm_eval_null_p)[PRIMITIVE-EVAL]: New specials. (eval_apply_t, g_target): Remove. (push_cc): New function. (eval_apply): Rewrite. (vm_call, eval_env, apply_env, eval_env, macro_expand_env, begin_env, call_with_values_env): Remove. * posix.c (stderr_): Update. * reader.c (read_input_file_env): Update. * module/mes/base-0.mes: Update. 2017-01-04 Jan Nieuwenhuizen Support radix for string->number, number->string. * module/mes/scm.mes (string->number, number->string): Support radix. Add string-take, string-drop. * module/srfi/srfi-13.mes (string-take, string-drop): New functions. core: Stderr_ also print numbers. * posix.c (stderr_): Handle numbers. Bugfixes bytevectors. * math.c (modulo): Modulo of negative value correctly. * module/mes/bytevectors.mes (bytevector-u32-native-set!): (bytevector-u16-native-set!): Use ash instead of quotient. Append-map: handle multiple list. * module/srfi/srfi-1.mes (append-map): Add optional rest argument. core: Move GNUisms inside #if. * mes.c: Move GNUisms inside #if, add Nyacc #ifs. (tmp_num2, tmp_num3): Remove. (make_tmps): Update. (g_free): Make simple int. Update users. * lib.c: Update users. * build-aux/mes-snarf.scm (GCC?): New switch to enable GNU extensions. Add drain-input. * module/mes/guile.mes (drain-input): New function. Bugfix for reading #\*eof* character. * module/mes/read-0.mes (read-character): Bugfix for #\*eof*. core: Expose command line. * mes.c (scm_symbol_argv): New symbol (main): Use it to add argv to environment. * module/mes/base.mes (command-line): New function. Include srfi-13 in base. * module/mes/base-0.mes: Include srfi-13. Add filter-map. * module/srfi/srfi-1.mes (filter-map): New function. Add srfi-1:iota. * module/srfi/srfi-1.mes (iota,srf-1:iota): New function. Add pretty-print from Guile. * module/mes/pretty-print.scm: Import. * module/mes/pretty-print.mes: Include it. * AUTHORS: Mention it. Add make-string, object->string. * module/mes/guile.mes (make-string, object->string): New functions. Add list-set!, string-set! * module/mes/scm.mes (list-set!, string-set!): New functions. Fix core:car, core:cdr for specials. * mes.c (car_, cdr_): Return special. Fixes string->list, returning nil. * tests/scm.test ("string-length", "string->list"): New tests. core: Add continuation on stack. * mes.c (r3): New stack variable. (mes_g_stack): Initialize it. (gc_push_frame): Add it. (gc_peek_frame): Set it. core: Uniformize calling of apply. * mes.c (eval_apply): Have apply take one argument, like all other vm functions: r1; cons of function f and argument list x. Sorry John. (r2): Repurpose as save/load register. Update users. (r3): Remove. (vm_call): Remove p2. Update callers. core: Refactor stack handling. * mes.c (gc_pop_frame, gc_push_frame): New Functions. (gc_frame, gc_stack): Remove. (vm_call): Update callers. * lib.c (dump, bload_env): Update callers. Add simple-format. * module/mes/display.mes (simple-format, format): New functions. Display: If possible, show name of closure. * module/mes/display.mes (display): Lookup closure's name and display it. 2016-12-25 Jan Nieuwenhuizen Update documentation. * doc/ANNOUNCE-0.4: New file. * NEWS: Typo. guix hash: 1jpm8m8y2dqsl3sc6flf8da4rpdrqh6zgr2mghzjw0lg34v1r21j Release 0.4. * configure (VERSION): Bump. Remove hardcoded duplication of version. * GNUmakefile (CPPFLAGS): Include VERSION. * mes.c (main): Use it. Add --dump and --load to --help. (scm_symbol_mes_prefix, scm_symbol_mes_version): New sybols. (mes_symbols): Use them to set prefix and version. * module/mes/base-0.mes (effective-version): Use %version. * module/mes/repl.mes (welcome): Likewise. 2016-12-24 Jan Nieuwenhuizen Update documentation. * HACKING: Update status, some ideas where to go next. * NEWS: Update status. * README: Update. * doc/ANNOUNCE: Move from top. * doc/ANNOUNCE-2: Likewise. * doc/ANNOUNCE-0.3: New file. make: Install nyacc scripts too. * make/install.make (install): Add scripts/nyacc.mes, scripts/nyacc-calc.mes. 2016-12-25 Jan Nieuwenhuizen Revert "core: Display me debuggor." This reverts commit 53ec23a0edcfdcb7dd4e32277e5a24e0a8fab5dd. 2016-12-25 Jan Nieuwenhuizen core: Display me debuggor. Having display in the core is handy for debugging. This is a courtesy commit intended to prevent bitrot. * GNUmakefile (mes.o): Depend on display. * mes.c: Include display. * display.c: New file. 2016-12-25 Jan Nieuwenhuizen Revert "core: FAT_C_READER: Show your speed." This reverts commit 5a9b9ac36bd33e497272b287ab1f0db715e01d38. 2016-12-25 Jan Nieuwenhuizen core: FAT_C_READER: Show your speed. scripts/nyacc.mes runs in 4s rather than 18s with fat C reader. This is a courtesy commit intended to prevent bitrot. * mes.c (quasiquote, unquote, unquote_splicing, syntax, quasisyntax, unsyntax, unsyntax_splicing): Add symbols. * reader.c (char_eof, char_nul, char_alarm, char_backspace, char_tab, char_newline, char_vtab, char_page, char_return, char_space)[FAT_C_READER]: New global variables. (make_keyword, read_block_comment, read_character, read_hex, append_char, read_string, fat_c_lookup_, fat_c_eat_whitespace, fat_c_read_word): New functions. (eat_whitespace_, read_word_, lookup_)[FAT_C_READER]: Add hook. 2016-12-24 Jan Nieuwenhuizen Refactor reader. * module/mes/read-0.mes (read-hash): New function. (read-word): Use it. (eat-whitespace): Rewrite. (display): Minimal implementation through core. * lib.c (stderr_): Support printing of strings while booting. core: Remove c3+r abbreviatons. * lib.c (caaar, caadr, caddr, cdadr, cadar, cddar, cdddr, cadddr): Remove. * mes.c: Rewrite callers * module/mes/read-0.mes: Rewrite callers. * module/mes/base.mes (caaar, caadr, caddr, cdadr, cadar, cddar, cdddr, cadddr): New function. core: Move dump, load, bload to lib.c. * lib.c (dump, load, bload): Move from mes.c * mes.c (dump, load, bload): Remove. core: Add getenv, verbose module loading on MES_DEBUG. * mes.c (MAKE_REF, MAKE_STRING): Oops, remove stray semicolon. * posix.c (getenv_): New function. * module/mes/base-0.mes (load): Use it to switch on MES_DEBUG=1. (mes-use-module): Remove commented-out code. core: Add some error checking. * lib.c (length): Return -1 for non-proper lists. (error): New function. (assert_defined): Use it. (check_formals, check_apply): New functions. * mes.c (car, cdr, set_cdr_x, set_env_x, eval_apply): Add error check. * srfi/srfi-1.mes (member): New function. * tests/srfi-1.tests ("member"): New test. core: Move reader and posix functions from mes.c * mes.c (getchar, ungetchar, peekchar, peek_byte, read_byte, unread_byte, write_byte, read_input_file_env_, read_input_file_env): Remove. * posix.c (getchar, ungetchar, peekchar, peek_byte, read_byte, unread_byte, write_byte): Move from mes.c. * reader (read_input_file_env_, read_input_file_env): Move from mes.c. core: Remove unused symbols. * mes.c (scm_symbol_noexpand, scm_symbol_syntax, scm_symbol_quasisyntax, scm_symbol_unsyntax, scm_symbol_unsyntax_splicing, scm_symbol_quasiquote, scm_symbol_unquote, scm_symbol_unquote_splicing, scm_symbol_define, scm_symbol_define_macro): Remove. Add write, add display test, some fixes. * mes.c (write_byte): Rename from write_char. * module/mes/display.mes (display): Fixes for write: char, closure, procedure. (write-char, write, with-output-to-string): New functions. * tests/read.test: Include base-0 to see some output. * tests/display.test: New file. * GNUmakefile (TESTS): Add it. core: Remove display. * posix.c (stderr_): New function. * display.c: Remove. * mes.c: Remove includes. Use stderr_ instead of display_. (gc_loop): Preserve function's name. (arity_): New function. * GNUmakefile (mes.o): Remove dependency on display. * module/mes/read-0.mes: Use core:stderr instead of display, newline. (newline): New function. * module/mes/base-0.mes: Use core:stderr instead of display. Include (mes display). * module/mes/display.mes: New file. * lib.c (assert_defined): Move from mes.c. (string_to_cstring): Move from posix.c * build-aux/mes-snarf.scm (function-environment): Initialize function name with scheme string. Import srfi-26 from Guile. * module/srfi/srfi-26.scm: Import. * module/srfi/srfi-26.mes: Include it. * AUTHORS: Mention it. 2016-12-23 Jan Nieuwenhuizen core: Remove symbol_to_list, char_to_integer, integer_to_char. * mes.c (symbol_to_list, char_to_integer, integer_to_char): Remove * module/mes/read-0.mes (symbol->list, integer->char, symbol->keyword): New function. (read-word): Use symbol->keyword. * module/mes/type-0.mes (char->integer): New function. * module/mes/scm.mes (keyword->symbol): New function. core: Remove string.c. * string.c: Remove. * mes.c (eval_apply): Remove caller. * GNUmakefile (mes.o): Remove dependency on string. * module/mes/psyntax-0.mes (eval): Handle "noexpand". * module/mes/type-0.mes (string->symbol, symbol->list, symbol->string): New function. core: Remove number_to_string. * string.c (number_to_string): Remove. * module/mes/scm.mes (number->string): New function. core: Remove substring. * string.c (substring): Remove. * module/mes/scm.mes (substring): New function. core: Remove string_length. * module/mes/scm.mes (string-length): New function. core: Remove list_to_string. * string.c (list_to_string): Remove. * module/mes/read-0.mes (list->string): New function. * module/mes/scm.mes (list->string): Remove. core: Remove string-append. * string.c (string_append): Remove. * module/mes/type-0.mes (string-append): New function. * module/mes/base-0.mes: Include type-0 without using string-append. core: Remove string. * string.c (string): Remove. * module/mes/type-0.mes (string): New function. Add exit. * lib.c (exit_): Rename from builtin_exit. * module/mes/scm.mes (list): Remove. core: Remove last_pair, list_ref, string_ref. * lib.c (last_pair, list_ref): Remove. * string.c (string_ref): Remove. * module/mes/type-0.mes (string->list): New function. * module/mes/scm.mes (string-ref): New function. core: Make closure real type. * display.c (display_helper): * mes.c (type_t): Add CLOSURE. (scm_t): Add closure. (CLOSURE): New macro. (eval_apply:apply): Update. (eval_apply:eval): Remove closure special-casing. (gc_loop): Handle CLOSURE. * module/mes/read-0.mes: Update types. * module/mes/type-0.mes: Update types. * display.c (display): Update. * module/mes/fluids.mes (env:escape-closure): Check for '*closure. core: Remove quote, quasiquote, quasisyntax. * mes.c (quote, quasiquote, quasisyntax): Remove. core: Remove make_lambda. * mes.c (make_lambda): Remove. core: Remove type.c. * module/mes/type-0.mes: Resurrect. * module/mes/base-0.mes: Include it. * module/mes/read-0.mes (not, pair?, atom?): New functions. * type.c: Remove. * mes.c: Remove callers. * GNUmakefile (mes.o): Remove dependency on type. core: Remove gc_show. * mes.c (gc_show): Remove. core: Remove add_environment. * mes.c (add_environment): Remove. Update callers. (scm_symbol_dot): New global. core: Remove make_string. * mes.c (MAKE_STRING): New macro. (make_string): Remove. Update callers. * string.c: Update callers. core: Remove make_ref. * mes.c (MAKE_REF): New macro. (make_ref): Remove. Update callers. core: Remove make_char. * mes.c (MAKE_CHAR): New macro. (make_char): Remove. Update callers. * reader.c (peek_char, read_char, unread_char): Remove. * module/mes/scm.mes (peek-char, read-char, unread-char): New function. core: Remove make_number. * mes.c (MAKE_NUMBER): New macro. (tmp_num_, tmp_num_2): New function. (make_number): Remove. Update callers. Remove make_function. * mes.c (make_function): Remove. core: Remove make_keyword. * mes.c (make_keyword): Remove. * module/mes/read-0.mes (): New global. (read-word): Use it with make_cell instead fo make-keyword. * strting.c (symbol_to_keyword): Use make_cell instead of make_keyword. core: Remove make_macro. * module/mes/read-0.mes (): New global. (env:macro): Use it with make_cell instead of make_macro. * mes.c (make_macro): Remove. * type.c (car_): Rename from mes_car. (cdr_): Rename from mes_cdr. core: Simplify lookup. * reader.c (lookup_): Rename from lookup. Remove all lookups except for numbers and symbols. Update callers. * mes.c (make_symbol_): Rename from internal_make_symbol. Update callers. * module/mes/read-0.mes (lookup): New function. (read-word): Remove all lookup calls, except for numbers and symbols. Remove lookup-char. * reader.c (lookup_char): Remove. * module/mes/read-0.mes (lookup-char): Remove. (read-word): Rewrite using quote. core: Cleanup symbol initialization and lookup. * build-aux/mes-snarf.scm (symbol->names): New function (function->environment): Initialize symbol. (generate-includes): Also write .symbol-names.i. * mes.c (mes_symbols): Include it. Remove internal_lookup_symbol. * display.c (display): Handle display of nil in symbol list. * reader.c (internal_lookup_symbol): Remove name-fu. 2016-12-22 Jan Nieuwenhuizen core: Remove most of reader. * reader.c (append_char, read_block_comment, read_character, read_hex, read_string): Remove. (eat_whitespace, read_word)[READER]: Remove. * mes.c (list_to_symbol): New function. * module/mes/read-0.mes (list->symbol, read-character, read-hex, read-string): New functions. 2016-12-25 Jan Nieuwenhuizen Refactor reader. * module/mes/read-0.mes (eat-whitespace): More efficient ordering/peeking. * module/mes/read-0.mes (read-word): Handle tab. 2016-12-22 Jan Nieuwenhuizen core: Disable reader. * mes.c (READER): Switch off. * module/mes/read-0.mes (eat-whitespace): Handle #;. core: Do some tail call elimination. * mes.c (eval_apply): Use goto instead of return. core: One big eval_apply. * mes.c (eval_apply): New function. (eval_apply_t): New type. (g_target): New global. (vm_evlis, vm_apply_env, vm_eval_env, vm_expand_macro_env, vm_begin_env, vm_if_env, vm_call_with_values_env): Remove. Update callers. (macro_expand_env): Rename from expand_macro_env. * guile/mes.mes: Update callers. * module/mes/base-0.mes: Likewise. * module/mes/mes-0.mes: Likewise. * module/mes/psyntax-1.mes: Likewise. * module/mes/repl.mes: Likewise. core: Remove vm_call_lambda. * mes.c (vm_call_lambda): Remove. (call_lambda): Use begin_env. Support PEG from Guile. * module/mes/peg.mes: New file. * module/mes/peg/cache.scm: New file. * module/mes/peg/codegen.scm: New file. * module/mes/peg/simplify-tree.scm: New file. * module/mes/peg/string-peg.scm: New file. * module/mes/peg/using-parsers.scm: New file. * tests/peg.test: New file. * GNUmakefile (TESTS): Add it. Support pmatch from Guile. * module/mes/pmatch.scm: New file. * module/mes/pmatch.mes: New file. * AUTHORS: Mention it. Use include-from-path for psyntax.pp. * module/mes/psyntax.pp: Rename from module/mes/psyntax-pp.mes. * module/mes/psyntax.mes: Update. * AUTHORS: Update. Use include-from-path for upstream. * module/mes/lalr.scm: Rename from module/mes/lalr.upstream.mes. * module/mes/lalr.mes: Update. * module/mes/match.scm: Rename from module/mes/match.upstream.mes. * module/mes/match.mes: Update. * module/mes/optargs.scm: Rename from module/mes/optargs.upstream.mes. * module/mes/optargs.mes: Update. * module/mes/quasisyntax.scm: Rename from module/mes/quasisyntax.upstream.mes. * module/mes/quasisyntax.mes: Update. * module/srfi/srfi-1.scm: Rename from module/srfi/srfi-1.upstream.mes. * module/srfi/srfi-1.mes: Update. * module/srfi/srfi-9.scm: Rename from module/srfi/srfi-9.upstream.mes. * module/srfi/srfi-9.mes: Update. * AUTHORS: Update. 2016-12-11 Jan Nieuwenhuizen Add string-copy, string=, string=?, char?, char<=?, char>=?. * module/srfi/srfi-13.mes: New file. * module/mes/scm.mes (char?, char<=?, char>=?): New function. * module/srfi/srfi-13.mes: New file. * tests/srfi-13.test: New file. * string.c (string_to_symbol): Handle "". 2016-12-22 Jan Nieuwenhuizen core: Remove quasiquote, quasisyntax. * quasiquote.c: Remove. * mes.c: Remove callers. * GNUmakefile (mes.o): Remove dependency on quasiquote. core: Disable quasiquote. * mes.c (QUASIQUOTE): Switch off. * tests/read.test: Remove quasiquote tests. Refactor quasiquote. * module/mes/quasiquote.mes (quasiquote): Refactor. * tests/quasiquote.test: Add tests. core: Bugfix append with one argument. * mes.c (append): Handle one argument. * tests/base.test ("append", "append 0" ... "append 5"): New tests. core: Do macro expansion only once. * mes.c (vm_eval_env): I will expand this macro only once. 2016-12-21 Jan Nieuwenhuizen Add psyntax-based quasisyntax. * module/mes/quasisyntax.upstream.mes: Import from Guile. * AUTHORS: Mention it. * module/mes/quasisyntax.mes: New file. * module/mes/psyntax.mes: Include it. core: Remove define. * base-0.mes (cons*): Refactor. * module/mes/read-0.mes: Implement define, define-macro using macros. * define.c: Remove. * mes.c: Remove callers. * GNUmakefile (mes.o): Remove dependency on define. 2016-12-18 Jan Nieuwenhuizen nyacc: Support enhanced Guile-1.8. * module/nyacc/lalr.scm: Export process-spec, reserved?. Use optargs, syncase. * module/nyacc/lex.scm: Use optargs, syncase. * module/nyacc/parse.scm: Use optargs. * module/nyacc/util.scm: Use optargs. * module/nyacc/lang/util.scm: Use optargs. * module/nyacc/lang/c99/cpp.scm: Use syncase. * module/nyacc/lang/c99/parser.scm: Use optargs, syncase. 2016-12-19 Jan Nieuwenhuizen Nyacc example scripts: support Guile-1.8. 2016-12-18 Jan Nieuwenhuizen Add Nyacc example scripts. * guile/nyacc-calc.scm: New file. * guile/nyacc.scm: New file. * scripts/nyacc-calc.mes: New file. * scripts/nyacc.mes: New file. * GNUmakefile (mes-check, guile-check): Run them. nyacc: Add mes modules. * module/nyacc/lang/c99/cpp.mes * module/nyacc/lang/c99/parser.mes * module/nyacc/lang/calc/parser.mes * module/nyacc/lang/util.mes * module/nyacc/lex.mes * module/nyacc/parse.mes * module/nyacc/util.mes nyacc: Use standard \return rather than \cr. 2016-12-17 Jan Nieuwenhuizen Import Nyacc 0.72.0. * module/nyacc: Import module/nyacc. 2016-12-19 Jan Nieuwenhuizen Import psyntax from Guile-1.8: R7RS with-ellipsis. * GNUmakefile (psyntax-import): New target. * module/mes/psyntax.ss: Import. * module/mes/psyntax-pp.mes: Import. * NEWS: Mention it. 2016-12-11 Jan Nieuwenhuizen Prepare for psyntax-6.3..7.3 support. * module/mes/psyntax-0.mes (ormap): New function. (eval): New function. (remprop): New function. ($sc-put-cte, $make-environment, environment?, syntax->list, syntax->vector, literal-identifier=?, $syntax-dispatch, eval-when): New variable. 2016-12-20 Jan Nieuwenhuizen Add abs. * module/mes/scm.mes (abs): New function. core: Bugfix unread_byte. * mes.c (unread_byte): Return SCM value instead of stray int. Add ash. * math.c (ash): New function. * tests/scm.test (ash, ash -1): New tests. Support (sxml xpath) for Nyacc c99. * module/sxml/xpath.mes: New file. * module/sxml/xpath.upstream.mes: Import from Guile. * AUTHORS: Mention it. Partial (rnrs arithmetic bitwise) support for Nyacc c99. * module/rnrs/arithmetic/bitwise.mes: New file. Nicer closure and builtin procedure display. * display.c (display): Show closure as procedure with formal parameters. Display ariry as fake parameters with builtin. Add string->number. * module/mes/scm.mes (string->number): New function. Add unless. * module/mes/scm.mes (unless): New syntax. Add iota. * module/mes/scm.mes: (iota): New function. * tests/scm.test (iota, iota 0, iota -1): New tests. Partial srfi-43 support for Nyacc. * module/srfi/srfi-43.mes: New file. Partial srfi-14 support for Nyacc. * module/srfi/srfi-14.mes: New file. * tests/srfi-14.test: New file. * GNUmakefile (TESTS): Add it. Add delete, delq, vector-copy. * module/mes/scm.mes (filter, delete, delq, vector-copy): New functions. Add negative?, positive?, zero?, 1+ 1-. * module/mes/scm.mes (negative?, positive?, zero?, 1+, 1-): New functions. Add missing srfi-1 functions for Nyacc. * module/srfi/srfi-1.scm (fold, fold-right, remove, append-reverse, remove!): New functions. * tests/srfi-1.test: New file. * GNUmakefile (TESTS): Add it. * module/srfi/srfi-1.upstream.mes: Import bits from Guile-1.8. * AUTHORS: Mention it. Add even?, odd?. * module/mes/scm.mes (even?, odd?): New function. Bugfix: for-each with two lists. * module/mes/scm.mes (for-each): Fix for two lists. Always return *unspecified*. Add and=>. * module/mes/base.scm (and=>): New function. Add eqv?. * module/mes/base.scm (eqv?): New function. 2016-12-19 Jan Nieuwenhuizen Closure is not a pair. * module/mes/base.mes (closure_p, mes_car, mes_cdr): New function. (pair_p): Closure is not a pair. * NEWS: Mention it. * psyntax-0.mes (self-evaluating?): Add closure?. Bugfix: support map^3. * module/mes/base-0.scm (map): Support third list, add more visible error when used with 4 or more list. 2016-12-16 Jan Nieuwenhuizen Resurrect quasisyntax support. * mes.c (the_unsyntaxers): New symbol. (mes_builtins)[QUASISYNTAX]: Initialize it, add to environment. * quasiquote.c (add_unsyntaxers): Use it. (vm_eval_quasisyntax): New function. (eval_quasisyntax): Use it. 2016-12-18 Jan Nieuwenhuizen Add psyntax-based srfi-9. * module/srfi/srfi-9-psyntax.mes: New file. Add support for including Guile files. * module/mes/guile.mes: New file. * module/mes/pretty-print.mes: New file. Support include and include-from-path. * module/mes/base-0.mes (include, include-from-path): New function. Support backslash in string. * reader.c (read_string): Handle '\\'. * tests/read.test: Add it. Support #\alarm, #\vtab. * mes.c (char_alarm): New variable. (char_vtab): Rename from char_vt. * reader.c (read_character): Add alarm, update vtab. * display.c (display): Likewise. * module/language/c/lexer.mes (read-string): Use vtab. Support non-nested #| |# comment. * module/mes/read-0.mes (read-word, read-block-comment): Implement #|. * reader.c (read_word, read_block_comment)[READER]: Likewise. * tests/read.test: Test it. * NEWS: Mention it. Support #; comment. * module/mes/read-0.mes (read-word): Implement #;. * reader.c (read_word)[READER]: Likewise. * tests/read.test: Test it. * NEWS: Mention it. 2016-12-17 Jan Nieuwenhuizen Minimal syntactic exception support. * module/mes/catch.mes: New file. * tests/catch.test: New file. * GNUmakefile (TEST): Add it. Minimal syntactic fluids support. * module/mes/fluids.mes: New file. * tests/fluids.test: New file. * GNUmakefile (TESTS): Add it. Add string-prefix?, symbol-prefix, symbol-append. * module/mes/scm.mes (string-prefix?, symbol-prefix, symbol-append): New function, Add list-head, list-tail. * module/mes/scm (list-head, list-tail): New function. core: Bugfix number-based-cells: allow displaying (current-module). * display.c (display): Handle cell_symbol_quote as symbol. 2016-12-21 Jan Nieuwenhuizen Make guile switchable in GNUmakefile. * GNUmakefile (GUILE): New variable. Update users. * guile/mes-0.scm (mes?, guile-1.8?, guile-2?): New variables. * module/mes/base.mes (guile?): Remove. * module/mes/base-0.mes (effective-version, mes?, guile?, guile-1.8?, guile-2?): New variables. * tests/cwv.test: Support Guile 1.8. 2016-12-17 Jan Nieuwenhuizen Resurrect guile-mescc with guile-2.1.5. * scripts/include.mes: Grep all files. * GNUmakefile (mescc.cat): Update for mes-use-module; list all toplevel inputs. * module/language/c/lexer.mes: Use (system base lalr). * module/language/c/parser.mes: Likewise. * module/language/c/compiler.mes: Likewise. Remove encoding on output port. * scripts/mescc.mes: Remove BROKEN comment. 2016-12-25 Jan Nieuwenhuizen optargs guile 2016-12-16 Jan Nieuwenhuizen Support Guile optargs. * module/mes/optargs.upstream.mes: Import latest non-syntax-case version from Guile. * AUTHORS: Add it. * module/mes/optargs.scm: New file. * tests/optargs.test: New file. * GNUmakefile (TESTS): Add it. * NEWS: Update. Support => in cond. * module/mes/base-0.mes (cond): Support =>. * module/mes/rea-0.mes (cond): Update. * NEWS: Update. core: Support keywords. * display.c (display): Handle keyword. * mes.c (type_t): Add KEYWORD. (eq_p): Handle it. (make_keyword): New function. * reader.c (lookup): Use it. * type.c (keyword_p): New function. * NEWS: Update. Handle form-feed. * module/mes/read-0.mes (eat-whitespace, read-word): Handle form-feed. * reader.c (eat_whitespace, read_word): Likewise. 2016-12-14 Jan Nieuwenhuizen core: Make symbols constants. * mes.c (apply_env,eval_env): Rewrite using switch. * build-aux/mes-snarf.scm (symbol->header): Define constants. (symbol->source): Only update g_free and init cells. 2016-12-13 Jan Nieuwenhuizen Extend Scheme reader, reduce C reader dependency. * mes.c (bload_env): Mark as internal. (load_env): Likewise. Load Scheme reader from source. Remove dumping. (dump): New function. * (vm_begin_env): Allow for gc while read_input_file_env. (mes_builtins): Add *dot*. (read_input_file_env)[!READER]: Invoke read-input-file. * module/mes/read-0.mes (read-env): New function. (read-word): Support quasisyntax. Remove usage of ' thoughout. * module/mes/repl.mes (repl): Use read instead of read-env. * guile/mes.scm (environment): Add *dot*. * guile/reader.mes: Update. * NEWS: Update. Silence garbage collector. * GNUmakefile: unexport MES_DEBUG. Update README. * README: Add a paragraph with current status. 2016-12-12 Jan Nieuwenhuizen guix hash: 0nbdjvmsyarp4vfg3r9hhhnabv11z1b7isw4g09x3kjd0r1lx0mh Release 0.3. * configure (VERSION): Bump to 0.3. * mes.c (main): Likewise. * module/mes/repl.mes: Likewise. Update Mes in Guile. * guile/mes.scm: Update for guile-2.2. * guile/mes.mes: Update from module/mes/mes-0.mes. * guile/reader.mes: Update from module/mes/read-0.mes. Resurrect Mes in Guile. * guile/mes.mes: New file, from the archives. * guile/mes.scm: Updates. Avoid garbage returns. * posix.c (set-current-input-port): Return current-input-port. (force_output): Return scm_unspecified. Update documentation. * README: Add make targets. * INSTALL: Add guix. * HACKING: Add info on sc. core: Resurrect QUASIQUOTE=0. * mes.c (mes_builtins) [!QUASIQUOTE]: Do not add unquoters. * module/mes/base-0.mes (push!, pop!, load, mes-use-module): Rewrite without quasiquote. * module/mes/quasiquote.mes (quasiquote): Rewrite using if, and. * module/srfi/srfi-0 (cond-expand): Rewrite without quasiquote. Add loadable modules. * module/mes/base-0.mes (mes-use-module): Implement. * module/mes: Update users. * HACKING: Update. * NEWS: Update. * configure (main): Use shell expansion for prefix. * make/install.make (install): Substitute prefix. Use syntax rather than psyntax. * module/language/c/parser.mes: Switch to syntax. * module/language/paren.mes: Likewise * scripts/mescc.mes: Likewise * scripts/paren.mes: Likewise * scripts/repl.mes: Likewise * tests/let-syntax.test: Likewise * tests/match.test: Likewise * tests/record.test: Likewise Resurrect syntax.mes. * module/mes/syntax.mes: New file. * AUTHORS: List it. core: use FIXED_PRIMITIVES rather than environment cache. * cache.c: Remove. * define.c: Remove callers. * mes.c: Likewise. (vm_eval_env) [FIXED_PRIMITIVES]: Hardcode car, cdr, cons, null_p. * GNUmakefile: Update. core: Set max arena size. * mes.c (MAX_ARENA_SIZE): New global. (gc): Use it. core: Make arena size configurable. * mes.c (main): Read MES_ARENA. * scripts/repl.mes: Set MES_ARENA to 5000000 if not already set. Fixes repl startup. core: Grow gc arena gradually. * mes.c: (gc_up_arena): New function. (gc): Use it when possible. (gc_init_cells, gc_init_news): New function. (mes_symbols): Use them. core: gc bugfixes. * mes.c (make_tmps): New function. (make_symbols, gc): Use it. (vm_call_with_values_env): New vm function. (call-with-values): Call it. (eval_env): Do not call eval_env inline. * define.c (vm_define_env): Use r2 rather than local name. (g_symbols): Rename from symbols. core: Split-off cache, display, reader. * mes.c: Remove cache, display, reader functions. * cache.c: New file. * display.c: New file. * reader.c: New file. Add reader in Scheme. * module/mes/read-0.mes: New file. * mes.c (char_to_integer, integer_to_char, null_p): Move to core. (peek_byte, read_byte, unread_byte): New function. (main): --dump, --load: New option. * lib.c (char_to_integer, integer_to_char): Remove. * NEWS: Update. core: Cleanup cells. * mes.c: Use accessors rather than g_cell[] access throughout. core: Add function indirection. * mes.c (functions): New array. (scm_t): Change function pointer to index. (make_cell): Handle function. (call): Update for function change. (display_): Likewise. (make_function): New function. * build-aux/mes-snarf.scm (function->source): Update declarations. (function->environment): New function. core: Number based cells. * mes.c (scm_t): Change car, string, ref, cdr, macro, vector into g_cell index [WAS]: scm_t pointer. * define.c: Update. * lib.c: Update. * math.c: Update. * posix.c: Update. * quasiquote.c: Update. * string.c: Update. * type.c: Update. * build-aux/mes-snarf.mes Update. * tests/gc-4.test: New test. * tests/gc-5.test: New test. * tests/gc-6.test: New test. core: Integrate garbage collector/jam scraper. * mes.c (r0, r1, r2, r3, stack): New globals. (gc_loop): Handle MACRO and SCM. (gc_copy): Handle FUNCTION, allow for pre-allocated SCM and SYMBOL. (assq): Flag any BROKEN_HEARTs. (vm_call): New function. Enables moving C stack to GC stack. (evlis_env, apply_env, eval_env, expand_macro_env, begin_env, if_env): Use vm_call-indirection. (call_lambda): New function. (vm_apply_env): Rename from apply_env. Remove parameters, instead use r1, r2 and r0. (vm_evlis_env, vm_eval_env, vm_expand_macro_env, vm_begin_env, vm_if_env): Likewise. (acons): New function. (mes_environment) [!MES_FULL, MES_MINI]: Add cpp switches to create minimally filled environment, for debugging. (main): Print free value at exit. * define.c (define_env): Use vm_call-indirection. (vm_define_env): Rename from define_env. * quasiquote.c (eval_quasiquote): Use vm_call-indirection. (vm_eval_quasiquote): Rename from eval_quasiquote. * tests/gc-2.test: New test. tests/gc-2a.test: New test. tests/gc-3.test: New test. Add sicp garbage example: tests/gc-1.test. core: Make using GC in switchable, set to off; on dumps core. core: Add garbage collector/jam collector experiment. * mes.c (gc, gc_loop, gc_copy, gc_move, gc_relocate_car, gc_relocate_cdr, gc_flip): New function. * tests/gc-0.test: New file. Add mes gc test setup. * tests/gc.test: New file. guix hash: 09axqivywpw0l9lm7pk1ncp6690vfv658z731z674ih73yqs5qma Release 0.2. * configure (VERSION): Bump to 0.2. * mes.c (main): Likewise. * module/mes/repl.mes: Likewise. Update NEWS. test: Run psyntax before record. * GNUmakefile (TESTS): Run psyntax before record. test: Add psyntax closure tests. * tests/closure.test (closure 7, closure 8, closure 9): New test. core: Show more info on apply error. * mes.c (apply_env): Be more specific about what cannot be applied. test: Add toplevel begin define test. * tests/base.test (top begin define): New test. core: Bugfix: report name of undefined variable. * mes.c (assert_defined): Add variable as parmeter, print it. Update callers. core: Use switch in display_helper. *mes (display_helper): Use switch. core: Refactor eval. * mes.c (eval_env): Rename from builtin_eval, Update callers. Use switch. core: One SCM type for function. * mes.c (function_t): New struct. (type): One type for function. (call): Refactor. * build-aux/mes-snarf.mes: Use arity annotation. WAS: args. Update annotations. core: Cleanup macro expansion. * mes.c (builtin_eval): Call expand_macro_env after handling primitives. (expand_macro_env): Include syntax-case expansion, remove skipping of primitives. (sc_expand_env): Remove. core: Factor-out assert_defined. * mes.c (assert_defined): New function. (set_env_x): Use it. (builtin_eval): Use it. Implement load. * mes.c (symbol_primitive_load): New symbol. (builtin_eval): Use it to implement primitive-load. * module/mes/base-0.mes (push!, pop!): New macro. (load): New macro. * tests/data/load.scm: New file. * tests/base.test (load): New test. posix: Implement open-input-file. * posix.c: New file. * mes.c: Include posix.environment.h, posix.environment.i, posix.environment.c. (read_input_file_env): Rename from read_file_env. Update callers. (load_env): Rename from load_file_env. Update callers. * GNUmakefile (mes.o): Add posix.c, posix.environment.h, posix.environment.i dependencies. core: Support switching of input stream. * mes.c (g_stdin): New global. (getchar): New function, use g_stdin. (ungetchar): Use g_stdin. (main): Initialize g_stdin to stdin. Update documentation wrt syntax-case. * HACKING: Update wrt syntax-case. * NEWS: Likewise. * README: Likewise. * guix.scm: Likewise. Update AUTHORS. * AUTHORS: Include information on lalr, match and psyntax. Finalize psyntax integration. * mes.c (sc_expand_env): Exclude primitives, expand native macros. (symbol_expand_macro): New symbol. * module/mes/psyntax-0.mes (properties-alist): New function. * module/mes/psyntax-1.mes: Set expand-macro. (define-syntax, syntax-rules, let-syntax): Remove macro. * module/language/c/parser.mes: Use psyntax modules, remove syntax module. * module/language/paren.mes: Likewise. * scripts/repl.mes: Likewise. * tests/match.test: Likewise. * tests/record.test: Likewise. * tests/psyntax.test (define-syntax swap!): Add test. * module/mes/let-syntax.mes: Remove. * module/mes/syntax.mes: Remove. core: Quoted internals are symbols. * mes.c (begin_env): Rename from begin. Update callers. (scm_begin, scm_if, scm_define, scm_set_x): Rename from symbol_*. (symbol_begin, symbol_define, symbol_if, scm_lambda, scm_set_x): New symbols. (mes_environment): Add them to environment, SYMBOL->SCM. * define.c (define_env): Rename from define. Update callers. * build-aux/mes-snarf.scm: Shadow internals (SCM) by their symbol. test: More values, call-with-values tests. * tests/cwv.test: New file. * GNUmakefile (TESTS): Add it. * tests/scm.test: Remove value and call-with-values tests. psyntax: More tests. * tests/psyntax.test: Add tests. core: Fix quasisyntax reading. * mes.c (readword): Avoid unspecified behaviour in comma list. test: Add new macros. * module/mes/test.mes (pass-if-equal, expect-fail): New macros. repl: Add sc-expand meta command, include syntax-case. * module/mes/repl.mes (,sc-expand): New meta command. * scripts/repl.mes: Include psyntax-0, psyntax-1, psyntax. Not used as basis for match yet. Add syntax-case based syntax-rules. * module/mes/psyntax-1.mes (syntax-rules): New syntax transformer, based on syntax-case. (define-syntax-rule): New macro. (let-syntax): New macro, for syntax-case. * tests/let-syntax.test: Switch to syntax-case. * tests/psyntax.test: Add syntax-rules and syntax-rule test. Bugfix include.mes: skip commented modules. * scripts/include.mes: Make regexp more strict. Initial psyntax integration. * mes.c (sc_expand_env): New function. (builtin_eval): Use it. * module/mes/psyntax-0.mes: New file. * module/mes/psyntax-1.mes: New file. * tests/psyntax.test: New file. * GNUmakefile (TESTS): Add it. psyntax: Add missing (interaction-environment) to eval. * module/mes/psyntax.mes: Add (interaction-environment) to eval. 2016-12-12 Jan Nieuwenhuizen Import psyntax from Guile-1.3a. * module/mes/psyntax.mes: New file. * module/mes/psyntax.ss: New file. commit 230c435383087a1e6ad60d9c98d3ec75dd2c3e49 Author: Mikael Djurfeldt Date: Tue Aug 19 01:28:50 1997 +0000 * syncase.scm: New file: Guile-adaption for syntax-case macros. psyntax.pp, psyntax.ss: Syntax-case macros, portable version 2 by R. Kent Dybvig, Oscar Waddell, Bob Hieb and Carl Bruggeman 2016-12-12 Jan Nieuwenhuizen Exit upon error. * module/mes/scm.mes (error): Add exit 1. Mescc: avoid `if'. * module/language/c/lexer.mes (keywords): Produce `If'. * module/language/c/parser.mes (c-parser): Use `If.' core: Add compile time switch for quasisyntax. * mes.c [QUASISYNTAX]: New switch. Default off. (builtin_eval) [QUASISYNTAX]: Handle syntax, unsyntax, quasisyntax. * quasiquote.c (syntax, unsyntax, unsyntax_splicing, eval_quasisyntax, add_unsyntaxers) [QUASISYNTAX]: Available only. More error handling on apply_env. * mes.c (apply_env): Assert if applying *unspecified*. Bugfix assq_ref_cache for running without environment cache. * mes.c (assq_ref_cache) [!ENV_CACHE]: Return *undefined* if nothing found. Error handling on failing set!. * mes.c (set_env_x): Produce error message [WAS: dump core]. Simplify toplevel read. * mes.c (read_file_env): Rename from read_file. (load_file_env): New function. (main): Use it. boot: fix ignored. * module/mes/loop-0.mes: Wrap read-file in begin. * module/mes/mes-0.mes: Remove ignored. Implement apply with multiple arguments. * module/mes/base-0.mes (apply): Handle multiple arguments. * tests/base.test: (apply, apply 1, apply 2): New test. Fix values. * mes.c (call): Respect any other non-value arguments. * tests/scm.test (values, values 2, values 3, call-with-values): New test. Define garbage collector/jam collector primitives. * mes.c (make_cell): New primitive alongside make_vector for allocation. (cons, make_char, make_macro, make_number, make_ref, internal_make_symbol, make_vector): Use it. Implement strings and symbols as list of characters [WAS: c-string]. * mes.c (scm_t): Add string field. (make_string, internal_lookup_symbol, internal_make_symbol, make_symbol, lookup, readword): Take scm*. Update callers. (display_helper): Support string field. (append_char): New function. (readstring): Use it. Produce scm*. (cstring_to_list): New function. (add_environment, internal_make_symbol): Use it. (list_of_char_equal_p): New function. (internal_lookup_symbol): Use it. * lib.c (list_ref): New function. * string.c (string_ref): Use it. (string, string_append, string_length, substring, number_to_string, string_to_symbol, symbol_to_string): Update to list-of-characters implementation. Environment cache bugfix for define. * define.c (define): Invalidate cache. Fixes vector test. * GNUmakefile (mes-check, guile-check): Use set -e. Fixes skipping over errors. 2016-12-12 Jan Nieuwenhuizen Introduce reference type, use vectors of SCM. * mes.c (type): Add REF. (scm_t): Add ref, change vector to *scm_t. Update users. (alloc): New function. (cons, make_char, make_macro, make_number, make_string, internal_make_symbol, make_vector): Use it. (make_ref): New function. (vector_entry): New function. (make_vector, list_to_vector, vector_set_x): Use it. (vector_ref): Dereference REF entry. (display_helper): Handle REF. * lib.c (vector_to_list): Handle REF. * type.c (ref_p): New function. * tests/vector.test (vector list): New test. Bugfix vector-ref. * mes.c (vector-ref): Make copies of simple values. Fixes lalr. * tests/vector.test (vector-set! 3): New test. 2016-12-12 Jan Nieuwenhuizen Guile gc experiment: remove global scan variable. Guile gc experiment: add garbage collection. Guile gc experiment: add lists and display. * guile/gc.scm (gc-nil, gc-null?, gc-list, gc-display, make-symbol): New function. Guile gc experiment: add pairs. * guile/gc.scm (cell-type, cell-index, gc-cons, gc-car, gc-cdr): New function. Guile gc experiment. guile/gc.scm: New file. Revert "Speedup boot eval/apply." This reverts commit 6326b3103156fd79cd7bebbb351194626cc8a64b. Speedup boot eval/apply. * module/mes/mes-0.scm (apply-env, evlis, eval-expand, eval-quasiquote): use IF iso COND: factor 3. (apply-env): Use lambda iso let: another 30%. guix hash: 115jycdz8i1r5sj2fsjqcrh456mayxzaykb8cxxxc3wxfkj8nagf 2016-11-20 Jan Nieuwenhuizen Release 0.1. * configure (VERSION): Bump to 0.1. * mes.c (main): Likewise. * module/mes/repl.mes: Likewise. Documentation update. * HACKING: Target is R6RS-like, at least having syntax-case. * README: Likewise. * guix.scm: Likewise. 2016-10-23 Jan Nieuwenhuizen Avoid gratuitous consing with begin and quasiquote. * mes.c (apply_env, main): Call begin rather than eval with cons'ed symbol begin. * module/mes/mes-0.mes (apply-env): Likewise. * quasiquote.c (add_unquoters): cons global unquoters rather than creating it fresh. * module/mes/mes-0.mes (add-unquoters): Likewise. 2016-10-22 Jan Nieuwenhuizen Remove dead code. * mes.c (mes_environment): Remove dead code. Move other post-boot and derived functions to lib.c. * mes.c (c*r, length, last_pair, builtin_list, vector_to_list, integer_to_char, char_to_integer, builtin_exit): Move to lib.c. * lib.c: New file. * GNUmakefile (mes.o): Depend on lib snarf output. Move strings to string.c. * mes.c (string, string_append, list_to_string, string_length, string_ref, substring, number_to_string, string_to_symbol, symbol_to_string): Move to string.c * string.c: New file. * GNUmakefile (mes.o): Depend on string snarf output. Move arithmetic functions to math.c. * mes.c (greater_p, less_p, is_p, minus, divide, modulo, multiply, logior): Move to math.c. * math.c: New file. * GNUmakefile (mes.o): Depend on math snarf output. Move define, define-macro to define.c. * mes.c (define, define-macro): Move to define.c * define.c: New file. * GNUmakefile (mes.o): Depend on define snarf output. Move quasiquote to quasiquote.c. * mes.c (unquote, unquote_splicing, syntax, unsyntax, unsyntax_splicing, eval_quasiquote, eval_quasisyntax, add_unquoters, add_unsyntaxers): Move to quasiquote.c * quasiquote.c: New file. * GNUmakefile (mes.o): Depend on quasiquote snarf output. Move optional type predicates to type.c. * mes.c (char_p, macro_p, number_p, pair_p, string_p, symbol_p, vector_p, builtin_p, boolean_p): Move to type.c * type.c: New file. * GNUmakefile (mes.o): Depend on type snarf output. * module/mes/loop-0.mes (cond, map, let, or, and not, evlis-env, apply-env, eval-expand, uquote, add-unquoters, eval, expand-macro-env, eval-begin-env, eval-if-env, sexp:define, env:define, env:macro): Move to mes-0.mes. * module/mes/mes-0.mes: New file. * module/mes/type-0.mes: New file. * scripts/include.mes: If BOOT, also include mes-0.mes. If TYPE0, also include type-0.mes. 2016-12-12 Jan Nieuwenhuizen Update NEWS. * NEWS: Note specials fix and booting with smaller core. 2016-10-21 Jan Nieuwenhuizen Generate C header and includes using snarfing. * mes.c: Move specific renames and n-args to alist annotation. * build-aux/mes-snarf.scm: New file. * GNUmakefile (mes.environment.h): Use it. (mes.h): Remove. (clean): Update. (mes.o): New dependency rule. * .gitignore: Update. 2016-10-22 Jan Nieuwenhuizen Revert "Flip sign of cached symbols: only search cache if symbol is cached." This reverts commit cef058be0d6ef5322f74e644bbcd96f1725c6327. 2016-10-21 Jan Nieuwenhuizen Flip sign of cached symbols: only search cache if symbol is cached. * mes.c (cache_save): Flip sign when caching and invalidating. (cache_invalidate): Flip sign when invalidating. 2016-10-20 Jan Nieuwenhuizen named let-fu FIXME 2016-10-21 Jan Nieuwenhuizen boot: fix builtin? tests. * tests/scm.test: Test primitives, not eval. Environment cache heuristicts. * mes.c (ENV_HEAD): New define. (assq_ref_cache): Use it. boot: support apply. * module/mes/loop-0.mes (eval-env): Add clause for apply-env. boot: Remove label support from Scheme. * module/mes/loop-0.scm (apply-env): Remove label clause. boot: vector support. * mes.c (make_vector): Change to scm interface. (temp_number): New global. (list_to_vector): Use it. * module/mes/scm.mes (c:make-vector): New function. * tests/scm.test: Remove vector tests. * tests/vector.test: New file. * GNUmakefile (TESTS): Add it. Avoid let* in scm.mes. * module/mes/scm.mes (case, max, min): Avoid let*. 2016-10-20 Jan Nieuwenhuizen loop-0: define and, let and cache-invalidate-range. boot: support quasiquote in eval. * module/mes/loop-0.mes (eval-env): Add quasiquote support. 2016-10-18 Jan Nieuwenhuizen Remove evcon from loop-0. * module/mes/loop-0.mes (loop-0): Handle define-macro. (cond): New macro. (eval-env-expand): Remove 'cond clause. (evcon): Remove. 2016-10-20 Jan Nieuwenhuizen Switch fat-c/boot using environment variable BOOT. * GNUmakefile: check for BOOT, set CFLAGS. * mes.c: Remove hardcoded BOOT define. * scripts/include.mes: include loop-0 when BOOT is set. 2016-10-16 Jan Nieuwenhuizen Implement eval/apply in Scheme. * module/mes/loop-0.mes: New file. * module/mes/mes.mes: Remove 2016-10-20 Jan Nieuwenhuizen Reduce eval/apply in core, extend in Scheme. * mes.c (eval_env_)[BOOT]: Rename from eval_env. Remove define, defin-macro. (eval_env): New function. (make_macro): Swap parameter ordering. (apply_env)[BOOT]: Support label. 2016-10-19 Jan Nieuwenhuizen Avoid adding top of environment to cache. * mes.c (assq_ref_cache): Only consider caching symbols deeper than 4*CACHE_SIZE depth. 50% speedup. Implement environment cache. * mes.c (cache_save, cache_lookup, cache_invalidate, cache_invalidate_range): Implement cache for environment. (assq_ref_cache): New function, perform cached lookups. (builtin_eval,lookup_macro): Use it. (set_cdr_x): Invalidate cache. (set_x): Likewise. (apply_env): Likewise. 2016-10-20 Jan Nieuwenhuizen Introduce SCM type for special symbols. * GNUmakefile (mes.h): Also export SCM to symbols.i * mes.c: Introduce SCM type for special symbols. (builtin_eval): Rename from eval_env. Update callers. * module/mes/base-0.mes (eval): Remove. * module/mes/repl.mes (repl): Use eval. Remove static primitives hack. * mes.c (internal_primitive_p, internal_p, lookup_primitive, mes_primitives): Remove. 2016-10-19 Jan Nieuwenhuizen Refactor primitives lookup. * mes.c (lookup_primitive_): Rename from internal_lookup_primitive, use scm-compatible signature. (lookup): Update caller. (eval_env): Check for builtins first. 2016-10-18 Jan Nieuwenhuizen Remove unused symbol. * mes.c (symbol_cond): Remove. Add report to closure test. * tests/closure.test: Add report. Remove dead code from let.mes. * module/mes/let.mes (simple-let, named-let, let): Remove dead code. Avoid cons* in base. * module/mes/base-0.mes (cond, simple-let, let): Rewrite without cons*. * module/mes/base.mes (or): Likewise. Differentiate apply asserts. * mes.c (apply_env): Split bool assert into bool, number and string. Add display tag for builtin procedures. * mes.c (display_helper): Show builtin functions as #. 2016-10-17 Jan Nieuwenhuizen Remove macro expansion from apply. mes.c (apply_env): Remove macro expansion. 2016-10-18 Jan Nieuwenhuizen Add paredit workaround in scripts. * scripts/elf.mes: Add paredit parsing comment. * scripts/repl.mes: Likewise. make tests standalone executable. * tests/closure.test: Add shebang and boot-0 include. * tests/let-syntax.test: Likewise. * tests/let.test: Likewise. * tests/match.test: Likewise. * tests/quasiquote.test: Likewise. * tests/record.test: Likewise. * tests/scm.test: Likewise. * GNUmakefile (mes-check): Run tests by exec'ing. make clean: remove symbols.i. * GNUmakefile (clean): remove symbols.i. Update documentation. * HACKING: Describe (mes-use-modules). * NEWS: Update. Add --help, --version. * mes.c (main): Handle --help, --version. * scripts/include.mes: Handle --help. * scripts/elf.mes: Pass any arguments on to mes. * scripts/mescc.mes: Likewise. * scripts/paren.mes: Likewise. * scripts/repl.mes: Likewise. guix hash: 0g6lcms2hv1i8hdkfh2xz0g7jmsayisr7bcwkp47blkbapqpzpsf Update guix hash. * make/install.make (update-hash): New target. * guix.scm: Prepare for update. 2016-10-16 Jan Nieuwenhuizen Add installation instructions. * INSTALL: New file. Add guix.scm package recipe. * guix.scm: New file. 2016-10-15 Jan Nieuwenhuizen Prepare for 0.1 release: update READMEs. * NEWS: New file. * AUTHORS: Add info about files taken from Scheme48. * HACKING: Update with info from TODO. * TODO: Remove. 2016-10-16 Jan Nieuwenhuizen Prepare for 0.1 release: make install. * make/install.make (install): Install documentation. Prepare for 0.1 release: installable scripts. * scripts/mes: New symlink. * scripts/elf.mes: Use it. * scripts/mescc.mes: Likewise, read all mes modules with include.mes. * scripts/paren.mes: Likewise. * scripts/repl.mes: Likewise. 2016-10-15 Jan Nieuwenhuizen Prepare for 0.1 release: gnu-build-system. * configure: New file. * make/install.make: New file. * .gitignore: Ignore generated files. * build-aux/gitlog-to-changelog: New file. 2016-10-12 Jan Nieuwenhuizen Prepare for 0.1 release: new directory structure. * scripts/elf.mes: New file. * scripts/include.mes: New file. * scripts/mescc.mes: New file. * scripts/paren.mes: New file. * scripts/repl.mes: New file. * doc/examples/main.c: Move from ./main.c. * module/mes/base-0.mes: Move from ./base0.mes. * module/mes/base.mes: Move from top. * module/mes/elf.mes: Likewise. * module/mes/let-syntax.mes: Likewise. * module/mes/let.mes: Likewise. * module/mes/mes.mes: Likewise. * module/mes/quasiquote.mes: Likewise. * module/mes/repl.mes: Likewise. * module/mes/scm.mes: Likewise. * module/mes/syntax.mes: Likewise. * module/mes/lalr-0.mes: Move from lib/lalr.mes. * module/mes/lalr.mes: Move from lib/lalr.scm. * module/mes/match.mes: Move from lib/match.scm. * module/mes/record-0.mes: Move from lib/record.mes. * module/mes/record.mes: Move from lib/record.scm. * module/mes/test.mes: Move flom lib/. * module/rnrs/bytevectors.mes: Move from lib/rnrs. * module/srfi/srfi-0.mes: Move from lib/srfi. * module/srfi/srfi-1.mes: Likewise. * module/srfi/srfi-9.mes: Likewise. * module/language/c/lexer.mes: Move from ./c-lexer.scm. * module/language/c/parser.mes: Move from ./mescc.scm. * module/language/c/compiler.mes: New file, split from parser.mes. * module/language/paren.mes: Move from ./paren.scm. * module/mes/libc-i386.mes: New file, split from elf.mes. * tests/base.test: Move from test/. * tests/closure.test: Likewise. * tests/let-syntax.test: Likewise. * tests/let.test: Likewise. * tests/match.test: Likewise. * tests/quasiquote.test: Likewise. * tests/record.test: Likewise. * tests/scm.test: Likewise. * hello.S: Remove. * hello.c: Remove. * loop2.mes: Remove. * test/foo.test: Remove. 2016-10-15 Jan Nieuwenhuizen Remove evcon (Sorry John). * mes.c (evcon): Remove, remove callers. * base0-if.mes (cond): Rename from disabled-cond. Support quasisyntax. * mes.c (eval_quasisyntax, add_unsyntaxers): New functions. (eval_env): Use them. 2016-10-16 Jan Nieuwenhuizen Add REPL. * mes.c (expand_macro_env, force_output): New function. Use STRING_MAX for string buffers throughout. (eval_env, eval_begin_env): Rename from eval, eval_begin. Update callers. * repl.mes: New file. * base.mes (list?): Move from scm.mes. * scm.mes (eval, apply, primitive-eval, expand-macro): New function. * GNUmakefile: New repl target. 2016-10-12 Jan Nieuwenhuizen Avoid 90% of cdr'ing environment, assuming static primitives. * mes.c (internal_primitive_p)[STATIC_PRIMITIVES: New function. (lookup_macro)[STATIC_PRIMITIVES]: Use it. (internal_lookup_primitive)[STATIC_PRIMITIVES]: New function. (lookup)[STATIC_PRIMITIVES]: Use it. (mes_primitives)[STATIC_PRIMITIVES]: New function. (main): Use it. * base0-if.mes (disabled-cond): Rename from xcond. * GNUmakefile: Add commented profiling CFLAGS. 2016-10-16 Jan Nieuwenhuizen Do not use quasiquote in base0. * base0.scm (defined?): Rewrite without quasiquote. 2016-10-12 Jan Nieuwenhuizen Add procedure? to base. * base.mes (procedure?): Move from scm.mes. 2016-10-08 Jan Nieuwenhuizen speedup: use ->car etc. 2016-10-11 Jan Nieuwenhuizen Avoid out-of-spec strncat usage. mes.c (readword): Use character assignment instead of strncat. Fixes Valgrind nit. Discern between primitive atoms and symbols. * mes.c (internal_symbol_p): New function. (eval): Use it. 2016-10-10 Jan Nieuwenhuizen resurrect mescc. cleanup and doc update. syntax.mes: silence syntax error. test/scm.test: update. 2016-10-11 Jan Nieuwenhuizen test/match.test: pass. 2016-10-10 Jan Nieuwenhuizen lib/match: ugly hygiene hack. FIXME. let-syntax.mes: implement. 2016-10-08 Jan Nieuwenhuizen speedup: use ->car etc. use IF as primitive, drop using cond/evcon only option. c++ type-safety. assq: use while instead of recursion. mes.c: uniquify symbols. mes-check: separate target. 2016-09-25 Jan Nieuwenhuizen Updates to README, TODO. 2016-08-14 Jan Nieuwenhuizen mescc.scm: compile simple, well-behaved for-loop. elf.mes: for loop. mescc.scm: print two strings. 2016-08-13 Jan Nieuwenhuizen mescc.scm: first a.out produced from main.c. lib/match.scm: import. lib/srfi/srfi-1.scm: add append-map, filter, find. elf.mes: make-elf. elf.mes: use elf32-* remove set!. elf.mes: remove text-free, softcode data-offset. elf.mes: put marker in note section. Revert "elf.mes: drop .note section." This reverts commit b2b5b73b91308407ec82a5ba658aca025512c542. elf.mes: drop .note section. elf.mes: softcode more. mes.c: implement string->list. elf.mes: compute text-free, text-offset. lib/rnrs/bytevectors.scm: minimal rnrs bytevectors. elf.mes: separate-out text, text-free and data sections. 2016-08-12 Jan Nieuwenhuizen resurrect guile-mescc, use write-int and (current-error-port) iso `2'. 2016-09-25 Jan Nieuwenhuizen Revert "mes.c: use single malloc with arena." This reverts commit 38c364faeff430a5ee28f402d24b073f6bf9a548. 2016-08-12 Jan Nieuwenhuizen mes.c: use single malloc with arena. elf.mes: a.out runs. elf.mes: error-free header, no program yet. elf.mes: readelf -h a.out shows some info. mescc/elf.mes: write minimal ELF header. mes.c: display, newline: take optional port; add write-char, read hex #xXX. remove debug output to stdout. 2016-07-27 Jan Nieuwenhuizen syntax-if.mes: TODO. Use IF iso COND as primitive; keep COND primitive as option. let.scm: cleanups. 2016-07-26 Jan Nieuwenhuizen macro hax0rz Revert "lib/lalr-debug.scm" This reverts commit 084d1bea33d45f0653cdc6bef44dc295faef6b72. lib/lalr-debug.scm quasiquote.mes: disable, too slow. 2016-07-25 Jan Nieuwenhuizen split-up test suite, implement quasiquote in scheme. 2016-07-26 Jan Nieuwenhuizen hello.c, hello.S: hello world target for C compiler. 2016-07-24 Jan Nieuwenhuizen mescc: mes parses simplest main with lalr. scm.mes: add port-location dummies. mes.c: add set-cdr, substring, string-ref. mes.c: support whitespace characters. mescc.scm: parse simple main.c. TODO/HACKING: update: lalr/paren.scm runs. mes.c: when reading `EOF', defer read control to program. mes.c, scm.c: add read-char, peek-char, char=?, char-alphabetic?. scm.mes: add list-ref. mes.c: add logior. scm.mes: add expt. scm.mes: remainder. scm.mes: implement do. scm.mes: add max, min. <=, >=: take multiple arguments. mes.c: add quotient and modulo. mes.c: less_p, greater_p, is_p: take multiple arguments. mes.c: display_helper fix for vector. scm.mes: make-vector: fix fill. paren.scm revert mes.c: fix apply. fix for-each. lalr paren test 2016-10-18 Jan Nieuwenhuizen ADD .gitignore. lib/lalr.scm 2016-07-24 Jan Nieuwenhuizen mes.c: grok #\tab. 2016-07-23 Jan Nieuwenhuizen mes.c: add syntax, quasisyntax to reader.... srfi-9 records! mes.c: refactor begin and closures. Fixes bugs/top.mes. bugs/top.mes: document toplevel begin bug; probable reason for record/syntax-case failure. check: resurrect guile-check. mes.c: remove hacks trying to get records up....WIP srfi-9 lib/record.scm: import. lib/srfi/srfi-0.scm: add. mes.c: barf on unknown symbols. syntax.mes: update from scheme48-1.1. Add header to syntax.mes MERGE scm.mes: add last-pair. test.mes: enable vector tests for mes. 2016-07-22 Jan Nieuwenhuizen scm.mes: add assq-set!, assq-ref. Update documentation, remove old bug files, move bugs into bugs/. mes.c: add new macro type, junk *macro* hack. mes.c: store actual environment with closures. fix closure 5 2016-07-19 Jan Nieuwenhuizen mes.c: store enviroment depth in closures. Fixes c1, c3 and more. mes.c: move begin_env into eval, decruft. 2016-07-18 Jan Nieuwenhuizen fix some tests. test: hack: show expected/actual remove booting into mes (would need VM), boot.mes; rewrite test.mes. c0.mes, c1.mes: update. 2016-07-17 Jan Nieuwenhuizen unquoting fix. no closuring in macro body... add equal?, member, for-each. closures: mostly supported... syntax.mes: more debugging. mes.c: single-statement body lambda closures. c0.mes: simpler bug. TODO: update closure.mes: document mes closure bug. mes.c: add boolean_p. mes.c: fix symbol? for nil. test.mes: disable call-with-values test, prints too much debugging. mes.c: evcon: support clause without cdr. Fixes or. add simple <=, >= and list?. scm.mes: and: bugfix, return #f for (and #f 1 2 3). syntax.mes: use cond iso if. rode harink hax0rz..ugh + next name? test in macro.mes. mes.c: another macro clue-bat in apply. now macro.mes equals guile -s macro.mes. mes.c: begin_env: bugfix, keep going in body after set! mes.c: bugfix for eval_quasiquote: stay in quasiquote mode after next quote. 2016-07-16 Jan Nieuwenhuizen guile runs macro-based mes:define-syntax, mes runs but yields *undefined*. support define-macro inside eval (i.e., inside define-macro) mes.c: move define, define-macro into begin_env, remove loop. fixes inner defines. define-syntax... 2016-10-18 Jan Nieuwenhuizen syntax... 2016-07-16 Jan Nieuwenhuizen implement variable-argument and, or. implement let loop. cleanup let, let*, letrec implement unquote-splicing, cleanup some macros update macro, fix andmap. add scheme apply, rename apply-> apply_env. syntax.mes: experiments... support cond without match, define-macro x (lambda)). 2016-07-11 Jan Nieuwenhuizen *unspecified* harder. add number->string, string->symbol, symbol->string. add procedure? add variable argument append. +,-,*,/: take n arguments. add call-with-values, values. add memq/memv. rename assoc to assq. add vectors. 2016-07-10 Jan Nieuwenhuizen add length. remove disabled code. add chars. add strings. TODO: new file. add begin. add letrec. fix for set! inside lambda. add not, if. add +,/,*,=. loop2.mes: separate from scm.mes. ignore add set!. 2016-07-09 Jan Nieuwenhuizen snarf scm functions and environment. eval: disarm lambda. map: support two lists. add simple map. fix evlis argumuent execution order. add let*. reader: handle whitespace and comments inside lists. move mes language additions to scm.mes. hack to print (current-module). mes.c, mes.mes: support quasiquote, unquote. boot.mes: generate from mes.mes, scm.mes, test.mes. 2016-07-08 Jan Nieuwenhuizen mes.c: support `.' and add let. boot.mes: support macros, add and, or. 2016-05-29 Jan Nieuwenhuizen boot.mes: boostrap into mes. 2016-07-09 Jan Nieuwenhuizen Leave pure LISP. * GNUmakefile: New file. * mes.c: Lots of work. * mes.mes: New file, split-off from mes.scm. (builtin, number): New function. (apply): Use them. * mes.test: New file. * scm.mes: New file, split-off from mes.scm. Add LISP interpreter in C. mes.c: New file. 2016-05-28 Jan Nieuwenhuizen Add Guile version of John McCarthy's Maxwell Equations of Software. * .gitignore: New file. * AUTHORS: Idem. * COPYING: Idem. * README: Idem. * mes.scm: Idem. 2016-05-15 Jan Nieuwenhuizen Initial. -*- org -*- #+TITLE: ChangeLog Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Normally a ChangeLog is generated at "make dist" time and available in source tarballs. mes-0.24.2/HACKING0000644000000000000000000002067314372371517010262 0ustar -*- org -*- #+TITLE: Hacking GNU Mes * SETUP guix shell #64 bit + 32bit CC=i686-unknown-linux-gnu-gcc ./configure CC=arm-unknown-linux-gnueabihf-gcc ./configure or ./configure The 64bit bootstrap is not supported; MesCC needs work to be able to compile a functional tinycc. * BUILD GNU Guile can be used as a replacement for Mes. It's faster and has much better error handling. #+BEGIN_SRC bash make MES=guile make check MES=guile #+END_SRC Configure to compile with Tiny CC #+BEGIN_SRC bash ./configure CC=tcc --host=i686-unknown-linux-gnu --with-courage #+END_SRC * DEBUG MES_DEBUG= mes ** Levels 1) Informational: - MODULEDIR - included SCM modules and sources - result of program - gc stats at exit 2) opened files 3) runtime gc stats 4) detailed info - parsed, expanded program - list of builtins - list of symbol - opened input strings - gc details 5) lots of data - usage of opened input strings - bytes read 6) globals * TESTING ** make check recheck=true TESTS="tests/base lib/tests/scaffold/t.c" ** mescc *** To skip MES tests, in "./check.sh", comment-out check-boot.sh, check-mes.sh. *** Running individual tests #+BEGIN_SRC bash cd gcc-lib V=2 CC=i686-unknown-linux-gnu-gcc ../pre-inst-env test-c.sh ../lib/tests/scaffold/t.c #+END_SRC #+BEGIN_SRC bash cd mescc-lib V=2 CC=mescc ../pre-inst-env test-c.sh ../lib/tests/scaffold/t.c #+END_SRC * Bugs ** mes: performance, Mes is now 2-10x slower than Guile. ** mes/mescc lack support for fork/exec on the Hurd. ** mes: gcc-x86_64 compiled mes segfaults with small arena, or gc_up_arena. ** mes: gcc-x86 compiled, tests/srfi-13.test number->string INT-MIN fails: test: number->string INT-MIN: fail expected: -2147483648 actual: -./,),(-*,( ** tcc: tcc-built lib/libc+tcc.c segfaults with mes, with tcc. ** mes: remove pmatch-car/pmatch-cdr hack. ** mescc: softcode stack frame size, now hardcoded and very large ** mes+mescc: parse tcc.c->tcc.E works, compile tcc.E -> tcc.M1 segfaults. time GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH ../mes/scripts/mescc -E -o tcc.E -I . -I ../mes/lib -I ../mes/include -D 'CONFIG_TCCDIR="usr/lib/tcc"' -D 'CONFIG_TCC_CRTPREFIX="usr/lib:{B}/lib:."' -D 'CONFIG_TCC_ELFINTERP="/gnu/store/70jxsnpffkl7fdb7qv398n8yi1a3w5nx-glibc-2.26.105-g0890d5379c/lib/ld-linux.so.2"' -D 'CONFIG_TCC_LIBPATHS="/home/janneke/src/tinycc/usr/lib:{B}/lib:."' -D 'CONFIG_TCC_SYSINCLUDEPATHS="../mes/include:usr/include:{B}/include"' -D CONFIG_USE_LIBGCC=1 -D 'TCC_LIBGCC="/home/janneke/src/tinycc/usr/lib/libc+tcc-gcc.mlibc-o"' -D CONFIG_TCC_STATIC=1 -D ONE_SOURCE=yes -D TCC_TARGET_I386=1 -D BOOTSTRAP=1 tcc.c time GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH MES_ARENA=200000000 ../mes/scripts/mescc -c -o tcc.M1 tcc.E ** mescc: 64 bit compiled mes loses top 4 bytes *** 64 bit mescc-compiled mes: #x100000000 => 0 (modulo 1 #x100000000) => divide-by-zero *** 64 bit gcc-compiled mes: #x100000000 => 0 (modulo 1 #x100000000) => 1 ** mescc: 7n-struct-struct-array.c: struct file f = {"first.h"}; ** test/match.test ("nyacc-simple"): hygiene problem in match * OLD: Booting from LISP-1.5 into Mes Mes started out experimenting with booting from a hex-coded minimal LISP-1.5 (prototype in mes.c), into an almost-RRS Scheme. When EOF is read, the LISP-1.5 machine calls loop2 from loop2.mes, which reads the rest of stdin and takes over control. The functions readenv, eval and apply-env in mes.mes introduced define, define-macro quasiquote and macro expansion. While this works, it's amazingly slow. We implemented a full reader in mes.c, which makes running mes:apply-env mes:eval somewhat bearable, still over 1000x slower than running mes.c. Bootstrapping has been removed and mes.c implements enough of RRS to run a macro-based define-syntax and syntax-rules. loop.mes and mes.mes are unused and lagging behind. Probably it's not worth considering this route without a VM. GNU Epsilon is taking the more usual VM-route to provide multiple personas. While that sounds neat, Lisp/Scheme, bootstrapping and trusted binaries are probably not in scope as there is no mention of such things; only ML is mentioned while Guile is used for bootstrapping. * Assorted ideas and info ** Using GDB on assembly/a.out info registers p/x $eax p/x $edx set disassemble-next-line on gdb-display-disassembly-buffer b *0x804a79d ** Create memory dump with 32 bit Gcc compiled Mes make out/i686-unknown-linux-gnu-mes out/i686-unknown-linux-gnu-mes --dump < module/mes/read-0.mes > module/mes/read-0-32.mo x/s *((char **)($rsp+8)) ** C parser/compiler *** [[https://savannah.gnu.org/projects/nyacc][nyacc]] *** PEG: [[https://piumarta.com/software/peg/][parse C using PEG]] *** [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]] *** [[https://www.t3x.org/subc/index.html][Sub C]] *** [[https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE][C intepreter in LISP/Scheme/Python]] ** C assembler/linker *** [[https://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]] *** ELF 7f 45 4c 46 *** [[https://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]] *** [[https://www.cirosantilli.com/elf-hello-world/][Elf hello world]] ** SC - c as s-expressions sc: https://sph.mn/content/3d3 ** RNRS *** [[https://www.scheme-reports.org/][Scheme Reports]] *** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf][Scheme - Report on Scheme]] *** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf][RRS - Revised Report on Scheme]] ** tiny schemes https://forum.osdev.org/viewtopic.php?f=15&t=19937 https://www.stripedgazelle.org/joey/dreamos.html https://armpit.sourceforge.net/ https://common-lisp.net/project/movitz/movitz.html janneke: https://github.com/namin/inc looks interesting [15:18] ** Orians Jeremiah janneke: also, if you look at https://github.com/oriansj/stage0/tree/master/stage2/High_level_prototypes [the garbage collected lisp I implemented], if there are any pieces I could add to finish off your mes lisp bootstrap just let me know because I would be more than happy to do that :D OriansJ: that's what I'm hoping for, that our efforts can be complementary and we can work together *** lfam (~lfam@2601:47:4180:2ffb:7c05:17de:cf5f:23ef) has quit: Ping timeout: 246 seconds [00:22] exciting times! [00:23] OriansJ: i looked a few times and saw 'LISP empty', so thanks for the pointer! [00:24] OriansJ, janneke: from that page, there's also: https://web.archive.org/web/20160604035203fw_/https://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html ** C4/C500 https://web.archive.org/web/20160604041431/https://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c https://github.com/rswier/c4/blob/master/c4.c ** Compilers for free https://codon.com/compilers-for-free ** Small lisps *** [[https://www.mirrorservice.org/sites/www.bitsavers.org/bits/TI/Explorer/zeta-c/][ZETA-C]] ** Small C compilers *** tinycc *** [[https://github.com/rui314/8cc][8cc]] -- a C11 compiler, but simple 8cc is a compiler for the C programming language. It's intended to support all C11 language features while keeping the code as small and simple as possible. *** pcc *** early GCC? https://miyuki.github.io/2017/10/04/gcc-archaeology-1.html *** [[https://tack.sourceforge.net/][ack]] it may be possible to compile like this: mes |> ack |> pcc |> tcc |> gcc 4.7.4 |> gcc later version... up to modern *** [[https://web.archive.org/web/20160402225843/https://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]] ** rain1's Bootstrapping Wiki: https://bootstrapping.miraheze.org/wiki/Main_Page ** rain1's hex86 https://notabug.org/rain1/hex86/src/master/tests/hex0b3.hex86 ** janneke, have you ever tried testing mescc with csmith? [10:55] ** e.g. as described here https://jamey.thesharps.us/2016/07/15/testing-strategies-for-corrode/ ("Randomized testing with Csmith and C-Reduce") [10:58] ** linux syscalls: https://fedora.juszkiewicz.com.pl/syscalls.html * legalese Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. mes-0.24.2/INSTALL0000644000000000000000000000533214372371517010317 0ustar -*- org -*- #+TITLE: Building and Installing GNU Mes Copyright © 2016,2017,2018,2019,2021,2022 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Mes can be built in two modes: as a regulare package build or as a bootstrap package. After bootstrapping Mes it can be used to bootstrap TinyCC (tcc) in a similar way. * Get it git clone [[git://git.savannah.gnu.org][git://git.savannah.gnu.org/mes.git]] * Regular build ** Prerequisites *** Guix #+BEGIN_SRC bash guix shell #64 bit + 32bit guix shell --system=i686-linux #32 bit only guix shell --system=armhf-linux #32 bit only #+END_SRC *** Other GNU/Linux - [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.4.0 is known to work. - [[https://github.com/oriansj/m2-planet][M2-Planet]] (optional), 1.9.0 is known to work. - [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 1.00.2 is known to work. - GNU Gcc, 7.5.0 is known to work. - GNU Guile, version 3.0.4 is know to work. - SH, /bin/sh, GNU Bash 5.0.16 is known to work. - GNU coreutils - sed, GNU sed 4.8 is known to work. ** Build it #+BEGIN_SRC bash ./configure make #+END_SRC If you get something like #+BEGIN_SRC bash mes.c:(.text+0x8da0): undefined reference to `__stack_chk_fail' #+END_SRC then your compiler inserts stack protection code. The Mes C Library does not support that. Turn it off lik this #+BEGIN_SRC bash ./configure CFLAGS=-fno-stack-protector #+END_SRC ** Check it #+BEGIN_SRC bash make check #+END_SRC ** Install it #+BEGIN_SRC bash make install #+END_SRC * Guix it #+BEGIN_SRC bash guix build -f guix.scm #+END_SRC * Bootstrap build The bootstrap build is part of Guix, see https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm ** Prerequisites - [[https://savannah.gnu.org/projects/mescc-tools/][mescc-tools]], 1.4.0 is known to work. - [[https://github.com/oriansj/m2-planet][M2-Planet]], 1.9.0 is known to work. - [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 1.00.2 is known to work. ** Build it #+BEGIN_SRC bash sh configure.sh [--prefix=] sh bootstrap.sh #+END_SRC ** Check it #+BEGIN_SRC bash sh check.sh #+END_SRC ** Install it #+BEGIN_SRC bash sh install.sh #+END_SRC * Regular build and bootstrap combine To build mes.c using MesCC, configure using --with-bootstrap: #+BEGIN_SRC bash ./configure --with-bootstrap make #+END_SRC This creates bin/mes-gcc and bin/mes-mescc. mes-0.24.2/NEWS0000644000000000000000000007345114372371517007774 0ustar -*- org -*- #+TITLE: GNU Mes NEWS – history of user-visible changes #+STARTUP: content hidestars Copyright © 2016,2017,2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Please send Mes bug reports to bug-mes@gnu.org. * Changes in 0.24.2 since 0.24.1 ** Build *** A number of compile warnings have been fixed. *** The `simple.make' and `simple.sh' builds have been resurrected. ** MesCC *** Some assembly defines were added for building TinyCC for x86_64. *** `__assert_fail' has been updated to use the standard signature. ** Noteworthy bug fixes *** A bootstrap build without M2-Planet is now supported again. *** `gettimeofday' no longer segfaults in the M2-Planet build. *** `stat64' and friends are now used on 32bit platforms. This fixes https://debbugs.gnu.org/41264, and should also fix https://debbugs.gnu.org/49985, https://debbugs.gnu.org/53415, https://debbugs.gnu.org/53416. *** The Mes C Library now supports uppercase hex conversions. * Changes in 0.24.1 since 0.24 ** Build *** Support M2-Planet bootstrap for ARM. ** MesCC *** The Mes C Library now supports bootstrapping ARM. ** Noteworthy bug fixes *** The definition of S_ISUID was fixed. *** Unsigned modulo has been fixed for ARM. *** A bug with abtol has been fixed. *** Workarounds for building with gcc-12.2.0 have been added. * Changes in 0.24 since 0.23 ** Core *** Mes and Mes C Library can now be built with M2-Planet. *** Mes now supports the --bootstrap build on ARM. ** MesCC *** MesCC now supports the integer suffixes: Next to `U', also support `ULL', `UL', `L', and `LL'. ** Noteworthy bug fixes *** MesCC now uses the unsigned type for sizeof. *** MesCC now only uses signed division if numerator is signed. *** The Mes C library now supports an argv bigger than 255. *** Development build support with Guile-2 was resurrected. *** The logand procedure now works correctly. *** The 64bit build was resurrected. * Changes in 0.23.1 since 0.23 ** Build: Move to libera.chat. ** Core *** Mes and Mes C Library can now support ARM bootstrap. ** MesCC *** MesCC now supports ARM bootstrap. ** Noteworthy bug fixes *** Stack frame 0 does not perform out of bounds access. *** MesCC's -m64 works again. *** Guile-2 support has been resurrected. *** logand has been fixed. *** Mes C Library now supports more than 255 command line parameters. * Changes in 0.23 since 0.22 ** Core *** Mes and Mes C Library can now be built with GCC 10.x. ** MesCC *** The Mes C Library now supports an armhf-linux bootstrap. *** MesCC now supports ARM. *** mini.c library was split into _exit.c, and _write.c. *** When building with GCC, -lgcc is now used. *** MesCC now has it's own support library libmescc.a (-lmescc). *** MesCC now requires mescc-tools-0.7.0 or later for ARM. *** MesCC can be now built with nyacc-1.00.2: note that nyacc-1.03.0 is not (backwards) compatible. *** MesCC can be built with Guile 3.0.x: See https://bugs.gnu.org/43831; use guild compile -O1 with Guile 3.0.x. *** MesCC now raises SIGABRT on abort, if supported. ** Noteworthy bug fixes *** unreadchar on EOF is now a no-op. *** malloc now aligns the blocks it gives out to max_align_t. * Changes in 0.22 since 0.21 ** Core *** Mes now builds reproducibly with MesCC, cross distribution Using --with-bootstrap on x86, a bin/mes-mescc is compiled with mes+mescc, that shall have sha256sum 722790ed261954eb53cf2cd2906c89c7589ef72b66171bbe2a9dce0f0af20232 bin/mes-mescc v0.22 9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb bin/mes-mescc v0.21 only differing in the version number string. This has been verified on GNU Guix, Debian GNU/Linux and NixOS. *** Mes now builds reproducibly with Guile+MesCC vs Mes+MesCC. *** Mes now builds reproducibly with Tiny CC-built MesCC. *** configure now respects the user's CFLAGS, CPPFLAGS and LDFLAGS. *** Mes now supports mescc-tools 0.5.2 next to 0.6.1. This allows introducing the Scheme-only bootstrap without updating or adding new bootstrap binary seeds into GNU Guix. *** Mes now runs when configured --with-courage on the Hurd: GNU debian 0.9 GNU-Mach 1.8+git20170609-486/Hurd-0.9 i686-AT386 GNU Note that mescc does not run; fork and exec are not yet implemented. *** Mes now configures --with-courage on x86-FreeBSD 12.1 The initial ELF scaffold tests: exit-42.S, 0exit-42.hex2, body-exit-42.hex2, hello-mes.S, 0hello-mes.hex2, body-hello-mes.hex2 pass. *** configure now has a --with-bootstrap option. This adds the reproducible bootstrap build of bin/mes-mescc, using mes+mescc. *** configure prefers $CC over gcc; tcc over gcc, gcc over cc. *** Mes now prints an error when attempting to read a file that does not exist. *** Mes no longer depends on GIT. ** Noteworthy bug fixes *** Several annoying build problems were fixed, for non-Guix systems. *** A bug with buffered-read was fixed. This means that bash-2.05 can now build glibc-2.2.5; notably it now successfully executes make-syscall.sh. *** A bug with execlp, execvp for file names containing a slash was fixed. This should allow make-3.80 running scripts that have "#! ./move-if-change". * Changes in 0.21 since 0.20 ** Core *** Mes can now be bootstrapped with Gash and Gash Core Utils. *** Mes now supports a Scheme-only bootstrap. *** Mes now supports -c EXPR. ** MesCC *** Mes C Library now supports bootstrapping GNU Awk, GNU Bash, GNU SED, and GNU Tar. *** Mes C Library now has limited float support in vfprintf, vsnprintf, vsscanf. **** 7 new functions abtod, atof, creat, dtoab, execlp, isgraph, mknod, readlink, strtod, symlink. **** 5 new stubs getgrgid, getgrnam, getpgid, getpgrp, mktime, setgrent. ** Noteworthy bug fixes *** A bug with `mes -c EXPR' has been fixed. *** The REPL now works again on x86_64. *** --with-system-libc now works again. * Changes in 0.20 since 0.19 ** Core *** The build system has been simplified, again. Mes now builds ootb on Debian. *** Mes now supports -c EXPR. ** Divide by zero is now flagged. ** Language *** 1 new function: take-while. ** MesCC *** The C libraries have been exploded into one function per file. *** MesCC now has enhanced POSIX/gcc comand line support, e.g. -DFOO=1, -nodefaultlibs, -nostartfiles, -nostdlib. *** The archiver is now called `mesar'. *** MesCC now supports Nyacc-0.99. *** MesCC now depends on MesCC-Tools 0.6.0. *** 1 new function __mesabi_uldiv. ** Noteworthy bug fixes *** map and for-each now support lists with unequal length. *** interger division has been fixed. *** isatty now looks at terminfo. *** signal now uses sigaction correctly for non-x86. *** string->number now support #x hex-prefix. *** ungetc now has a buffer per file handle. * Changes in 0.19 since 0.18 ** Core *** The build system has been simplified. *** Mes now prints a backtrace upon error. *** Performance has been improved 2-8 times, making Mes 2-10 times slower than Guile. *** Mes now supports a module type and uses a `boot-module'. *** Mes now supports a hash_table type. *** Mes now supports a struct type. *** Mes now supports building a %bootstrap-mes seed from Guix. ** Language *** Records are now implemented using struct (WAS: vector). *** 44 new functions ceil, char-downcase, char-set-adjoin, char-set-complement, char-upcase, current-time, delete-file, dup, dup2, file-exists?, floor, frame-printer, get-internal-run-time, getcwd, gettimeofday, hash, hash-ref, hash-set!, hash-table-printer, hashq, hashq-get-handle, hashq-ref, hashq-set, inexact->exact, make-hash-table, make-stack, make-struct, module-define!, module-printer, module-ref, module-variable, read-line, round, stack-length, stack-ref, string-downcase, string-tokenize, string-upcase, struct-length, struct-ref, struct-set! struct-vtable, struct-vtable, with-error-to-file. ** MesCC *** Assembly defines have been cleaned-up: duplicates deleted, missing added, wrong fixed. *** MesCC now supports compiling GNU Bash and GNU Tar. **** 6 New functions getegid, geteuid, getppid, setgid, setuid, sigdelset, sigprocmask. **** 22 New macros EACCES, ENOSPC, ESPIPE, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, LLONG_MAX, LLONG_MIN, SIZE_MAX SYS_getegid, SYS_geteuid, SYS_setgid SYS_setuid, S_IRGRP, S_IROTH, S_IRWXG, S_IRWXO S_ISGID, S_ISUID, S_IWGRP, S_IWOTH, S_IXGRP, S_IXOTH, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, _POSIX_VERSION. ** Noteworthy bug fixes *** Mes now supports characters #\xNN. *** Mes now supports assq-ref and assoc-ref with alist == #f. *** Mes now support \xNN in strings. Fixes using Nyacc-0.86.0. *** MesCC now supports the unary plus operator. *** MesCC now supports the `U' integer suffix. *** MesCC now comes with INTnn_MIN/MAX, UINTnn defines in stdint.h. *** MesCC now always exits non-zero when assembler or linker fail. * Changes in 0.18 since 0.17.1 ** Core *** Mes/MesCC now supports x86_64. *** Mes/MesCC now brings a Reduced Binary Seed bootstrap to GuixSD. ** Language *** fold-right now supports 3 lists. ** MesCC *** MesCC now supports x86_64 (also as cross build), using -m 64. *** Mes C Library now has better support for bootstrapping gcc-3.0. *** Mes C test suite now has 178 tests; 74 tests were added. *** MesCC has been refactored to support use an abstracted assembly language. *** MesCC now uses Nyacc 0.86.0. ** Noteworthy bug fixes *** scaffold/tests/7s-struct-short.c has been fixed. * Changes in 0.17.1 since 0.17 ** MesCC *** Mes C Library has now been exploded into a separate C file per function. *** Mes C Library now bootstraps glibc-2.16.0, binutils-2.20.1, gcc-4.7.4. *** Mes C Library now supports compiling make-3.82. *** Mes C Library now supports compiling diffutils-2.7. *** Mes C Library now supports x86_64. **** 7 new functions chdir, clock_gettime, closedir, execl, opendir, readdir, time. **** 5 new stubs getlogin, setlocale, setvbuf, sigaddset, sigblock. ** Noteworthy bug fixes *** qsort can now handle lists with duplicate entries. * Changes in 0.17 since 0.16.1 ** Core *** GNU Mes is now an official GNU package. *** MesCC is now installed as a regular Guile package. *** Support --srcdir build. *** Support all standard GNU make targets. ** MesCC *** Mes C Lib now bootstraps glibc-2.2.5, binutils-2.20.1, gcc-4.7.4. * Changes in 0.16.1 since 0.16 ** Core *** Mes now builds out of the box on Debian buster/testing. *** Mes now comes with a generic build recipe: build-aux/setup-mes.sh. *** Mes now comes with INFO documentation. ** MesCC *** MesCC now exits if spawning BLOOD_ELF, M1, or HEX2 fails. * Changes in 0.16 since 0.15 ** Core *** Support building with tcc, including Mes C Lib in-line assembly. *** core:execl now supports 1000 arguments. ** MesCC *** Mes C Lib now bootstraps glibc-2.2.5, binutils-2.20.1, gcc-4.1.0. *** MesCC binaries now run on Linux 4.17 too, i.e. survive Linus' new `sane mmap limits.' *** MesCC now runs with mescc-tools 0.5 (no = in long options). **** 3 new C test 88-strrchrc, 97-fopen.c, 98-fopen.c. ** Noteworthy bug fixes *** strrchr now stops when it reaches start of string. *** fopen now return 0 upon failure. Supports binutils' hack: fd=-2 means `cached'. *** vfprintf, vsprintf now support precision and width on integers strings better. *** fread now produces ungetc'd chars too. *** memcmp now supports comparing 0 bytes, supporting binutils. *** The unused ELF header data section, identical to the text section, has been removed. * Changes in 0.15 since 0.14 ** Core *** Support fork, exec, waitpid. *** Boot-0 loading has been refactored. *** MesCC now has out of the box Geiser support. ** Language *** 2 new functions drop, drop-right. ** MesCC *** MesCC and Mes C Lib can now build binutils-2.30, gcc-2.95.3 and glibc-2.2.5. *** MesCC now provides dummy crti.o, crtn.o so that tcc needs not be patched for those. *** Mes C Lib now supports compiling glibc-2.2.25. *** Mes C Lib now supports compiling gcc-2.95.3 *** Mes C Lib now supports compiling binutils-2.30. *** Mes C Lib now supports compiling m4-1.4. *** Mes C Lib has been split into archs: gcc, x86-mes-gcc and x86-mes. *** MesCC now has a posixy command line interface. **** 70 new functions abs, access, alarm, alloca, atexit, atol, bcmp, bcopy, brk, bzero, chmod, clearerr, close, dup, dup2, execve, fabs, fcntl, fdgets, feof, fgets, fileno, fork, freopen, fscanf, fstat, fsync, getcwd, getgid, getpid, getrusage, getuid, index, ioctl, isalnum, isalpha, isascii, iscntrl, isprint, ispunct, kill, link, lseek, lstat, mkdir, mktemp, nanosleep, open, perror, pipe, raise, read, rename, rindex, rmdir, sbrk, sbrk, setitimer, signal, sleep, stat, strcspn, strdup, strerror, strncat, strpbrk, strspn, unlink, unsetenv, waitpid. **** 23 new stubs abort, atof, bsearch, bsearch, chown, ctime, fpurge, freadahead, frexp, getpwnam, gmtime, mbstowcs, pclose, popen, rewind, setbuf, sigsetmask, strftime, sys_siglist, system, times, umask, utime. **** 10 new C tests 51-strcmp.c, 70-printf.c, 87-sscanf.c, 90-strpbrk.c, 91-fseek.c, 92-stat.c, 93-fread-fwrite.c, 94-unsetenv.c, 95-signal.c, 96-strto.c. * Changes in 0.14 since 0.13 ** Core *** Bootstrapped Mes+MesCC now compiles a tcc that is self-hosting and only slightly patched. *** The reader now supports binary numbers (previously: read as decimal). *** String port support has been moved to C. *** The build has been simplified, the Make-in-Scheme experiment has been removed. *** 2 new functions chmod, logxor. ** Language *** Mes now supports define-immutable-record-type and single set-field from srfi-9 gnu. *** 12 new functions basename, chmod, const, delete-duplicates, logxor, string-contains, string-map, string-replace, string-trim, string-trim-both, string-trim-right, unfold. ** MesCC *** MesCC now supports standalone usage of nestedly defined enums, structs and unions. *** MesCC now supports comparison of unsigned and promotion of signed/unsigned -> unsigned. *** MesCC now supports sign extension for char, short. *** MesCC now has stubbing for floats; compiling works, data is fu. *** MesCC now has full suport for switch case, e.g. with default as first clause. *** MesCC now supports destruction of casted expressions: ((struct foo*)p)->bar. *** MesCC now has full support for pre/post, e.g.: (foo--)->bar and permutations. *** MesCC now supports sizeof any expression or type. *** MesCC now supports initialization of anonymous unions. *** MesCC now supports bit fields. *** MesCC now supports valued functions in expressions: destruction and dereferencing. *** MesCC now supports function-static variables. *** MesCC now supports initializer lists in structs and unions. *** MesCC now has full support for heterogeneous variable declarations, e.g.: char p, *x = "foo", buf[3]; **** 4 new functions __lshrdi3, __ashldi3, __ashrdi3, strncpy. **** 9 new mlibc stubs __fixdfdi, __fixsfdi, __fixunsxfdi, __fixxfdi, __floatundixf, ldexp, strtod, strtof, strtold. * Changes in 0.13 since 0.12 ** Core *** Bootstrapped Mes+MesCC can now compile a patched tcc in ~1h45' (~25,000 LOC). *** MesCC scripts for Mes and Guile are now merged; executable is: `mescc'. *** Mes now uses only one arena for stop-and-copy; doubles available size. *** Mes now has a Guile-like command-line interface (mes.repl has been removed). *** Mes now boots into a full Scheme by default. *** Mes can now be compiled (MES_MINI=1) to boot into a minimal Scheme (~2000 cells). *** Mes now creates less garbage in the reader and in append2, append_reverse, reverse, reverse!, vector-for-each, vector-to-list, vector-map. *** 5 new functions append-reverse, chmod, ioctl, isatty, isspace, last_pair, reverse!. ** Language *** 3 new functions char-whitespace?, chmod, isatty? ** Noteworthy bug fixes *** Two bugs in the jam scraper/garbage collector have been fixed. *** equal2_p now uses tail call elimination. *** Escaped characters in strings are now read and write'd correctly. *** The repl now expands macros again. * Changes in 0.12 since 0.11 ** Core *** Mes can now run Nyacc (0.80.42) to compile itself in ~4min (~3000 LOC). *** Mes now recursively expands global variables per top level statement. *** Mes now recursively expands macros per top level statement. *** Mes now boots from MES_BOOT (default: module/mes/boot-0.scm). *** Mes now has a full Scheme reader in C again. This gives a 10x-20x performance improvement and increases the bootstrap footprint by 160 LOC. *** Mes reader now supports older abbreviated character forms #\bel, #\bs, #\ht and #\vt. *** 3 new functions equal2?, memq, core:write. ** Language *** Mes now has an incremental Scheme semantics test suite with 71 small tests. *** Variable names can now have ticks. *** Mes now evaluates expresions of COND only once. *** srfi-9 records have been reimplemented. *** #\page is now whitespace. *** # is no longer a character. *** 2 new macros define-macro*, with-fluids. *** 9 new functions dirname, last, reverse-list->string, setenv, string-drop-right, string-fold, string-fold-right, string-null?, write. ** MesCC **** 9 new functions chmod, getopt_long, ferror, itoab, longjmp, qsort, setenv, setjmp, strtol. **** 2 new header files endian.h, sys/signal.h. * Changes in 0.11 since 0.10 ** MesCC *** MesCC now compiles a mes-tcc that fails 41/69 of mescc's C tests. *** MesCC's libc can now be compiled with tcc (syscall support: write). *** MesCC now compiles a less-patched tcc: -214/+458 lines [WAS: -333/+747]. *** MesCC now supports empty for. *** MesCC has been greatly refactored, 500/3000 lines have been removed. *** MesCC now supports complex [struct] by value assign foo.bar, foo->bar, foo[bar]. *** MesCC now depends on Nyacc 0.82.4. * Changes in 0.10 since 0.9 ** Core *** 2 new functions logand, lognot. *** Mes now includes M1 sources for full source bootstrapping up to tcc. ** Mescc *** Mescc now depends on Nyacc 0.81.0. *** Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out. *** Mescc now supports several (as used my tinycc) struct by value assignments. *** Mescc now has _start in a separate crt1.c. *** Mescc now supports initializer arithmetic. *** Mescc now supports arrays of struct of arbitrary size. *** Mescc now supports pointer arithmetic. *** Mescc now defines __i386__, __linux__. *** Mescc now supports --*p, ++*p. *** Mescc now supports int foo[bar] = {baz,...}. *** Mescc now supports \x00 in strings in M1. *** Mescc now supports complex enum expressions. Thanks, rain1! *** Mescc now supports short. *** Mescc now supports foo.bar = foo.baz = bla. *** Mescc now supports foo = bar < baz and comparison permutations. *** Mescc now supports (anonymous) structs in unions. *** Mescc now writes M1 strings if possible. **** 2 improved mlibc functions malloc, realloc. **** 13 new mlibc functions fclose, fgetc, fprintf, fwrite, memcpy, memmove, memset, snprintf, strcat, strchr, strrchr, strtoull, vnsprintf. **** 15 new tinycc-support tests 76-pointer-arithmetic.c, 77-pointer-assign.c, 78-union-struct.c, 79-int-array.c, 7a-struct-char-array.c, 7b-struct-int-array.c, 7c-dynarray.c, 7d-cast-char.c, 7e-struct-array-access.c, 7f-struct-pointer-arithmetic.c, 7g-struct-byte-word-field.c, 7h-struct-assign.c, 7i-struct-struct.c, 7j-strtoull.c, 7k-for-each-elem.c. ** Noteworthy bug fixes *** Mescc has many fixes for foo.bar[baz], foo[bar].baz with ./-> permutations. *** Many bugs and limitations in mescc have been fixed and removed. * Changes in 0.9 since 0.8 ** Core *** Mes now builds better in non-Guix[SD] legacy distros/environments. Thanks, rain1! ** Mescc *** Mescc now compiles a modified tinycc into a running [mostly segfaulting] mes-tcc. https://gitlab.com/janneke/tinycc branch wip-mescc. *** Mescc now supports locals stack frame larger than 1 byte offset. *** Mescc now supports incomplete struct initializers {0}. *** Mescc now supports >>=, <<=, ^=, ~. *** Mescc now supports the comma operator. *** Mescc now supports mullti-line string initializers. *** Mescc now supports unions. *** Mescc now supports arrays in structs. *** Mescc now supports structs in structs. *** Mescc now builds and runs with Guile-2.0 (legacy distro support, Guile-2.2 recommended). *** Mescc has been refactored to use records. *** Mescc now bundles tinycc's test2 test suite, passes one more test [34/55 pass]. *** Mescc now has an incremental test suite consisting of 56 tests. *** Mescc now supports stdarg variable argument lists. *** Mescc now has __GNUC__ unset, #f (WAS: 0). *** Mescc now depends on Nyacc 0.80.3. *** Mescc now depends on M1 from [[https://github.com/oriansj/mescc-tools][mescc-tools]] v0.2. *** Mescc now compiles to M1 object files. **** 7 new mlibc functions calloc, close, getcwd, lseek, sprintf, unlink, vprintf. **** 31 new mlibc stubs execvp, fclose, fdopen, fflush, fopen, fprintf, fread, free, fseek, ftell, fwrite, localtime, longjmp, memcpy, memmove, memmove, memset, qsort, remove, setjump, snprintf, sscanf, strchr, strrchr, strstr, strtol, strtoll, strtoul, strtoull, time, vnsprintf. **** 10 new header files alloca.h, float.h, libgen.h, locale.h, stdbool.h, stddef.h, stdint.h, stdnoreturn.h, sys/select.h, sys/wait.h. ** Noteworthy bug fixes *** Many bugs and limitations in mescc have been fixed and removed. * Changes in 0.8 since 0.7 ** Mescc *** Mescc now has experimental annotation support for hex2. *** Mescc now depends on the hex2 linker from [[https://github.com/oriansj/mescc-tools][mescc-tools]]. Direct ELF output support has been removed. ELF symbol and string table creation has been removed. *** Mescc has been simplified by leveraging use labels in hex2 output. *** Mescc now supports continue in loops. *** Mescc now compiles to hex2 object files. ** Language *** 1 new function list-index. * Changes in 0.7 since 0.6 ** Core *** The minimal C reader is now always included; dependencies on i686-unknown-linux-gnu-gcc and binary read-0-32.mo have been dropped, these are now optional. ** Language *** Mes reader now supports octal numbers #oXXX. *** 10 new functions current-output-port, getopt-long, negate, open-output-file, option-ref, set-current-output-port, string-rindex, string-suffix?, with-ouwith-output-to-file, with-output-to-port. ** Mescc *** Mescc can now be installed and used alongside a gcc installation. *** Mescc can now handle const anywhere. *** Mescc now supports array fields in structs. *** Mescc now supports forward declarations and typedef. *** Mescc can now handle comments anywhere. *** Mescc now supports addition and substraction for enum field values. *** Mescc now supports anonymous enums. *** Mescc now supports all C99 header files needed to compile tcc.c. *** build: C sources are now preprocessed separately, then compiled and linked. *** build: mlibc and C sources are now compiled separately and then linked. *** mlibc has been moved from Scheme snippets into C. *** Mescc now supports -c, -D, -E, -I and -o options. **** open now supports optional third mode parameter. ** Noteworthy bug fixes *** string-index now supports function predicate. *** number->string for radix > 10 now produces `a' instead of `:'. * Changes in 0.6 since 0.5 ** Core *** configure, build now supports x86 and development for arm with-courage. ** Language *** Nyacc has been unbundled and is now a dependency. *** Mes now supports case-lambda. *** Mes reader now supports abbreviated form for return character #\cr. *** 1 new function string-index. ** Mescc *** Mescc can be used on regular C sources, like tinycc's tests/test2 suite. *** make check passes 33/55 of tinycc's test suite etest/test2 tests. *** Mescc now recognizes `short' as a type. *** Mescc now supports sizeof (), sizeof(). *** Mescc now respects enum field initializers and supports enum variables. *** Mescc now supports binary constants . *** Mescc now supports assignments from ==, != boolean expressions . *** Mescc now supports &, ^. *** Mescc now supports struct pointers. *** Mescc now supports struct definition with immediatete variable declaration. *** Mescc now supports calling (returning correctly from) void functions. *** Mescc now handles case statements breaks without compound correctly. *** Mescc now has better [int/pointer] array support. *** Mescc now has better support for simple (non-array-)structs. *** Mescc now supports multiple declarations in one statement like: int a,b; **** 2 new mlibc functions printf, strcpy. ** Noteworthy bug fixes *** Installed mes and mes.repl now also run outside of source tree again. * Changes in 0.5 since 0.4 ** Core *** Support compilation with Mescc. *** Support compilation with -nostdinc, -nostdlib using mlibc. *** Support call-with-current-continuation. *** Support exception handling, catch/throw. *** Give sensible error message when a macro is missing. ** Language *** Map now supports 4 lists. *** The reader supports negative hex numbers. *** 24 new functions access?, assoc-set! c????r, compose, list->char-set, open-input-string, read-string, string-delete, with-throw-handler. ** Mescc *** Mescc can be used separately as a Nyacc-based C compiler backend for Guile. *** Switch to Nyacc frontend, update Nyacc to 0.76.5. *** Mescc now has a test suite, scaffold/t.c. *** Mescc now includes a minimal C library libc/mlib.c libc/mstart.c. *** Mescc can now compile mes.c. ** Noteworthy bug fixes *** The build system (configure, make) has been refactored. *** Support map-4. *** Evaluate arguments of OR only once. *** Fix assq-set! *** Fix ,expand in the REPL. * Changes in 0.4 since 0.3 ** Core *** Improved performance. Macros are now memoized; after expansion and before eval'ing the expanded form, their input s-expression is replaced by the expansion. This yields a nice performance improvement which finally allowed moving all non-essential bits from the C-core into Scheme...including the reader. The Scheme reader is much, much slower than the previous C version, making Mes--again-- feel slow. Think of that as a feature. *** Bootstrap with minimal reader in C. The C-reader needs only support reading of words and lists (s-expressions), line-comments to read the initial [[file:module/mes/read-0.mes][Scheme reader]] which then takes over and handles reading of quoting, characters, strings, block-comments. *** Reduced size. Total C size: ~1500LOC. The main Mes evaluator is now ~1000LOC including cell creation and garbage collector. This code is able to execute a Scheme program that has been loaded into memory. Another ~500LOC is spent to load a minimal Scheme program and to dump it, to provide a small posix interface, math functions and do some error reporting. *** Programs can be dumped and loaded using --dump and --load. ** Language *** Minimal syntactic exception support for Nyacc. *** Minimal syntactic fluids support for Nyacc. *** Keywords are now supported. *** Cond now supports =>. *** Guile's optargs: lambda* and define* are now supported. *** #;-comments are now supported. *** Non-nested #| |#-comments are now supported. *** Quasisyntax is now supported. *** R7RS syntax-rules with custom ellipsis, with-ellipsis are now supported. *** 9 new [partial] modules (mes fluids), (mes nyacc), (mes optargs), (mes pmatch), (mes peg), (srfi srfi-13), (srfi srfi-9-psyntax), (srfi srfi-26), (srfi srfi-43), (rnrs arithmetic bitwise), (sxml xpath) *** 36 new functions 1+, 1-, abs, and=>, append-reverse, ash, char<=?, char=?, char>?, even?, filter, delete, delq, vector-copy, fold, fold-right, getenv, iota, keyword->symbol list-head, list-tail, negative?, odd?, positive?, remove!, remove, string->number, string-copy, string-prefix?, string=, string=?, symbol->keyword symbol-append, symbol-prefix?, unless, write, zero?. ** Noteworthy bug fixes *** Macros are now memoized. *** An error is reported when using a wrong number of arguments with a call. *** Cond now evaluates its test clauses only once. *** Append can also handle one argument. *** For-each now supports 2 list arguments. *** Map now supports 3 list arguments. *** Backslash in string is supported. *** Closure is not a pair. *** All standard characters are supported. *** Mescc now also runs in Guile. * Changes in 0.3 since 0.2 ** Core *** Number-based rather than pointer-based cells. *** Garbage collector aka Jam scraper. A variant on SICP's stop and copy Garbage Colletor (Jam Scraper?) algorithm has been implemented. *** The reader has been moved to Scheme. ** Language *** Simple loadable modules. *** Srfi-9 and match use handwritten syntax-rules (mes-use-module (mes syntax)). *** Optional syntax-case using psyntax (mes-use-module (mes psyntax)). ** Noteworthy bug fixes *** Srfi-0 has been fixed. * Changes in 0.2 since 0.1 ** Core *** Names of symbols and strings are list of characters [WAS: c-string]. *** Sc-expand from pre-R6RS's psyntax has been integrated. *** Undefined variable error now shows the name of the undefined variable. *** There is now only one SCM type for builtin functions. *** Macro expansion has been cleaned-up. ** Language *** Mes now provides a subset of R6RS. *** Mes now provides syntax-case. *** Mes now provides `load'. ** Noteworthy bug fixes *** Using values as second parameter of builtin function yields first value. *** Quoted internals (e.g. 'if 'lambda) are now symbols. *** Syntax error now exits. *** Make+Bash voodoo has been replaced by build-aux/mes-snarf.scm. *** Apply now accepts multiple list arguments. *** Apply of character, inernal, number, string is an error. *** Quasisyntax reading * Changes in 0.1 (since progress report #2) ** Core *** expand_macro is now a separate function. *** A smaller core can now compiled using BOOT=1. The smaller core does not provide define, define-macro, or quasiquote; these are provided from a Scheme version of implemented eval/apply. ** Language *** Mes now provides a subset of R5RS. *** Mes now provides let-syntax. *** Mes now provides match. *** Mes now provides quasisyntax, unsyntax and unsyntax-splicing. ** User interface *** Mes now provides a REPL, run: scripts/repl.mes *** Mes compiler can be run as a script: scripts/mescc.mes doc/examples/main.c *** Macro expansion can be inspected in the REPL, e.g.: ,expand (and 0 1) ** Noteworthy bug fixes *** Performance: scripts/mescc.mes now takes 2s to compile main.c (was 1'20"). *** Symbols are now truly unique. * '(), #t, #f are no longer symbols. mes-0.24.2/PORTING0000644000000000000000000000547514372371517010343 0ustar #+COMMENT: -*- org -*- #+TITLE: Porting GNU Mes * Porting GNU Mes to ARM The ARM port can be found in wip-arm on savannah. For development, we use Guix's qemu-binfmt-service-type. ** Guix Setup, see [[info:guix#Virtualization%20Services][Virtualization Services]]. Add something like #+BEGIN_SRC scheme (service qemu-binfmt-service-type (qemu-binfmt-configuration (platforms (lookup-qemu-platforms "arm")) (guix-support? #t))) #+END_SRC to your config.scm and run guix system reconfigure. ** Setup environment For example (note: ARM is no longer a 'port', see HACKING) #+BEGIN_SRC bash guix shell --system=armhf-linux --pure bash coreutils diffutils findutils gawk gcc-toolchain grep git guile gzip help2man make mescc-tools nyacc openssh-sans-x pkg-config sed tar texinfo #+END_SRC ** Try it #+BEGIN_SRC bash CC=gnu-triplet-gcc ./configure --with-courage --with-system-libc ./simple.sh #+END_SRC some failures are expected. ** Build it #+BEGIN_SRC bash ./configure --with-courage --with-system-libc make MES=guile make check #+END_SRC expect many failures. Non-system-libc, i.e. using the Mes C Library is currently WIP. * Porting GNU Mes to x86_64 The x86_64 port is almost done, only a few bugs remain. The Guix bootstrap for x86_64 uses x86 mes and that is not expected to change. * Porting GNU Mes to GNU/Hurd The Hurd port can be found in wip-hurd on savannah. For development, we use a Debian GNU/Hurd vm. * Porting GNU Mes to FreeBSD The FreeBSD port can be found in wip-freebsd on savannah. * Porting the Reduced Binary Seed bootstrap to NixOS The NixOS port of the Reduced Binary Seed bootstrap lives on the mes-bootstrap branch in https://github.com/xwvvvvwx/nixpkgs * Porting the Reduced Binary Seed bootstrap to Debian GNU/Linux To port the Reduced Binary Seed bootstrap to a traditional distribution such as Debian, two things need to happen: the bootstrap must be ported and the distribution build process needs to change to start from a only binary seed. The porting aspect is probably easiest: we start by packaging GNU Mes as a regular package. Having Mes built as a regular package, we can then build a bootstrap Mes. This bootstrap Mes can be used to build tinycc, and so on. Once we have shown that the Debian base system can be bootstrapped from a Reduced Binary seed, thus significantly reducing the Trusted Computing Base (TCB), strategic decisions about the build process can start. * Legalese Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]> Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. mes-0.24.2/README0000644000000000000000000001003014372371517010135 0ustar #+COMMENT: -*- org -*- #+TITLE: About GNU Mes #+SUBTITLE: Maxwell Equations of Software [[https://www.gnu.org/software/mes][GNU Mes]] is a Scheme interpreter and C compiler for bootstrapping the GNU System. Since version 0.22 it has again helped to halve the size of opaque, uninspectable binary seeds that are currently being used in the [[https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25][Further Reduced Binary Seed bootstrap]] of [[https://www.gnu.org/software/guix][GNU Guix]]. The final goal is to help create a full-source bootstrap as part of the [[https://bootstrappable.org][bootstrappable builds]] effort for UNIX-like operating systems. The Scheme interpreter is written in ~5,000 LOC of simple C, and the C compiler written in Scheme and these are mutual self-hosting. Mes can now be bootstrapped from [[https://github.com/oriansj/m2-planet][M2-Planet]] and [[https://savannah.nongnu.org/projects/mescc-tools][Mescc-Tools]]. Mes has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's [[https://github.com/schemeway/lalr-scm][LALR]], Pre-R6RS [[https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html][portable syntax-case]] with R7RS ellipsis, Matt Wette's [[https://www.nongnu.org/nyacc][Nyacc]] --and test suite, just enough to support a REPL and a C99 compiler: mescc. Mes + MesCC + Mes C Library can build a [[https://gitlab.com/janneke/tinycc][bootstrappable TinyCC]] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux, x86_64-linux, armhf-linux and aarch64-linux. Mes is inspired by The Maxwell Equations of Software: [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf][LISP-1.5]] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's [[https://github.com/oriansj/stage0][stage0]] ~500 byte self-hosting hex assembler. We are very grateful to NLNet for sponsoring the [[https://nlnet.nl/project/GNUMes][Reduced Binary Seed bootstrap]], the [[https://nlnet.nl/project/GNUMes-arm][ARM port]], and the [[https://nlnet.nl/project/GNUMes-ARM_RISC-V][Full Source Bootstrap.]] GNU Mes is free software, it is distributed under the terms of the GNU General Public Licence version 3 or later. See the file [[file:COPYING][COPYING]]. * Get it #+BEGIN_SRC bash git clone git://git.savannah.gnu.org/mes.git #+END_SRC * Build it (see [[file:INSTALL][INSTALL]] for full instructions) #+BEGIN_SRC bash ./configure make all make check #+END_SRC * REPL it #+BEGIN_SRC bash ./pre-inst-env mes #+END_SRC * MesCC compiler #+BEGIN_SRC bash ./pre-inst-env mescc -c scaffold/main.c #+END_SRC * Bugs Please send Mes bug reports to [[mailto:bug-mes@gnu.org][bug-mes@gnu.org]]. * Links [0] https://www.gnu.org/software/mes [1] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25 [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/m2-planet [5] https://savannah.nongnu.org/projects/mescc-tools [6] https://github.com/schemeway/lalr-scm [7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [8] https://www.nongnu.org/nyacc [9] https://gitlab.com/janneke/tinycc [10] [[https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf]] [11] https://savannah.nongnu.org/projects/stage0 [12] https://nlnet.nl/project/GNUMes [13] https://nlnet.nl/project/GNUMes-arm [14] https://nlnet.nl/project/GNUMes-ARM_RISC-V * Legalese Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]> Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. mes-0.24.2/ROADMAP0000644000000000000000000001232714372371517010276 0ustar -*- org -*- #+TITLE: Tentative GNU Mes Road Map Copyright © 2016,2017,2018,2019,2020,2022,2023 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. The goals of the GNU Mes project are two-fold: - to bootstrap the GNU System purely from source, without using any binary seeds. - to aid the Reproducible-Builds.org effort; demonstrate the impact and importance of GNU and Software Freedom. Since its inception, the project has gone a long way towards that goal. Below is a list of items we want for version "1.0" of GNU Mes. You're welcome to discuss this road map on bug-mes@gnu.org or #bootstrappable on Libera Chat! * TODO ** release 0.x, unsorted - Full Guile module support. - Run Gash and Gash-Utils on Mes. - Remove Guile as a dependency for the Guix Full Source Bootstrap. - Integrate Full Source bootstrap for ARM on GNU Guix; see branch wip-aarch64-bootstrap. - Integrate Reduced Binary Seed bootstrap for ARM on GNU Guix; see branch wip-arm-bootstrap. - Introduce the Reduced Binary Seed bootstrap to NixOS (Debian, Arch, Gentoo, ...?). - Full Guile-compatible module support; see branch wip-module. - RISC-V support: Mes C Library and MesCC. - AArch64 support: Mes C Library and MesCC. - Simplify eval-apply and other core functionality + See https://github.com/oriansj/mes-m2 fork/rewrite of mes. - Support native x86_64 bootstrap. - Simplify MesCC ``MesCC should optimize ease of convincing us of its correctness''. - Switch to Autotools for development build (bootstrap builds use kaem.run and bootstrap.sh); see branch wip-auto. ** after release 1.0 - Build Guix packages using Mes: run or simplify (guix build utils), (guix build gnu-build-system). - Build Guix packages without guix-daemon. See Ludovic's initrd build work. - Bootstrap support for the Hurd. Most needed now are fork and exec. - Replace the initial gcc-2.95.3 with gcc-4.6.4. - FreeBSD, *BSD? - Tiny CC: + remove or upstream patches from tcc-boot, + build 0.9.27 directly instead of via 0.9.26; see tinycc branch wip-bootstrappable@0.9.27 - Skip Tiny CC: Build gcc using MesCC. - Better garbage collector. - mes/mescc: proper docstrings, api reference documentation. - mes/mescc: bootstrap a minimal Guile? + libguile/{eval,init,list,strings,values,..}. + ice-9/eval.scm - syntax-case bootstrap problem + resolve portable syntax-case bootstrap, or + get full source syntax-case up (Andre van Tonder?) https://srfi.schemers.org/srfi-72/srfi-72.html, or + ... drop it? * DONE - 0.24: Full Source Bootstrap: + integrate into GNU Guix; see branch wip-full-source-bootstrap. - 0.23 Full Source Bootstrap: + compile mes.c using M2-Planet; see branch wip-m2, - GNU Mes now supports building Tiny CC on ARM. - Merge the Scheme-only bootstrap which uses Gash and Gash Core Utilities to remove from bootstrap-binary seed : Awk, Bash, Core Utilities, Grep, Gzip, Sed, Tar. - 0.22 GNU Mes now builds reproducibly cross-platform, runs on the Hurd and has better support for other distributions and kernels. - 0.21 GNU Mes now supports a Scheme-only bootstrap and is packaged in Debian GNU/Linux. - 0.20 GNU Mes brings the Reduced Binary Source bootstrap to Guix. - 0.19 GNU Mes now compiles TinyCC in ~8min and supports building Bash and GNU Tar. - 0.18 GNU Mes now supports GuixSD bootstrap (x86,x86_64) and has native x86_64 support. - 0.17.1 GNU Mes now allows removing glibc, binutils and gcc from the GuixSD bootstrap. - 0.17 GNU Mes is now an official GNU project and bootstraps gcc-4.7.4. - 0.16.1 Mes now has info docs and installs ootb on Debian buster/testing. - 0.16 Mes Lib C now bootstraps glibc-2.2.5, binutils-2.20.1, gcc-4.1.0. - 0.15: MesCC now has a libc+gnu that supports compiling binutils-2.14, gcc-2.95.3 and glibc-2.2.5. - 0.14: Mes+MesCC now compiles a slightly patched self-hosting tcc. - 0.13: Mes+MesCC now compiles a modified, functional tcc.c (~25,000LOC) in 1h30'. - 0.12: Mes+MesCC now compiles mes.c (~3000LOC) in ~4min. - 0.11: MesCC now compiles a mes-tcc that passes 26/69 of mescc's C tests. - 0.10: Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out. - 0.9: Mescc now writes M1 macro assembly files and compiles tcc. - 0.8: Mescc now writes object files in stage0's labeled hex2 format. - 0.7: Mescc supports -E, -c, -o options, include more complete set of header files, enough to work on compiling tinycc's tcc.c albeit a somewhat modified version. - 0.6: Work with unmodified, unbundled Nyacc; compile 33/55 tinycc's tests/test2 suite. - 0.5: Mutual self-hosting Scheme interpreter and C compiler: mes.c and mescc, Support call-with-current-continuation, refactor catch/throw - 0.4: Support Nyacc, Gcc-compiled Mes compiles minimal main.c using nyacc - 0.3: Garbage collector - 0.2: Support psyntax - 0.1: Mes eval/apply feature complete; support syntax-rules, compile main.c using LALR, dump ELF mes-0.24.2/build-aux/GNUmakefile.in0000644000000000000000000002762014372371517013643 0ustar # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . SHELL=@BASH@ srcdest=@srcdest@ srcdir=@srcdir@ abs_top_srcdir=@abs_top_srcdir@ abs_top_builddir=@abs_top_builddir@ GUILE_FLAGS:=--no-auto-compile -L . -L module -C . -C module cleaning-p:=$(filter clean%, $(MAKECMDGOALS))$(filter %clean, $(MAKECMDGOALS)) ifndef cleaning-p include .config.make ifneq ($(prefix),) prefix-arg=--prefix=$(prefix) endif ifneq ($(build),) build-arg=--build=$(build) endif ifneq ($(host),) host-arg=--host=$(host) endif ifeq ($(mes_libc),system) --with-system-libc=system endif .config.make: ${srcdir}/configure $(prefix_arg) $(host-arg) $(build-arg) $(with-system-libc) endif PHONY_TARGETS:=\ TAGS\ all-go\ all\ build\ check\ clean-go\ clean\ default\ dist\ distclean\ doc\ dvi\ gcc\ generate-ChangeLog\ help\ html\ info\ install-dvi\ install-html\ install-pdf\ install-ps\ install-strip\ install\ installcheck\ installdirs\ maintainer-clean\ man\ mes-gcc\ mes-tcc\ mes\ mostlyclean\ pdf\ ps\ sign-dist\ uninstall\ web\ # .PHONY: $(PHONY_TARGETS) X86_ARCH_HEADERS = $(wildcard $(scrdest)include/linux/x86/*.h) ARCH_HEADERS = $(X86_ARCH_HEADERS:$(srcdest)include/linux/x86/%=include/arch/%) default: all all: doc doc: build build: | $(ARCH_HEADERS) $(SHELL) build.sh src/${program_prefix}mes: build include/arch/%.h: $(srcdest)include/$(mes_kernel)/$(mes_cpu)/%.h | arch-dir cp -f $< $@ arch-dir: mkdir -p include/arch clean: rm -f *.o *.s bin/mes bin/mes-gcc bin/mes-mescc rm -f mes.{aux,cp,cps,fn,info,log,tmp,toc,vr,vrs} rm -f .log build.log rm -f 0exit-42 0hello-mes exit-42 body-exit-42 body-hello-mes hello-mes rm -f build-aux/mes-snarf.go rm -f module/mescc.go rm -f module/mes/*.go module/mescc/*.go rm -f module/mescc/armv4/*.go rm -f module/mescc/i386/*.go rm -f module/mescc/x86_64/*.go rm -rf gcc-lib/*.o gcc-lib/*.s gcc-lib/*.a gcc-lib/*-mes rm -f gcc-lib/libc+gnu.c rm -f gcc-lib/.log gcc-lib/build.log rm -rf mescc-lib/*.o mescc-lib/*.s mescc-lib/*.a mescc-lib/*-mes rm -f mescc-lib/libc+gnu.c rm -f mescc-lib/.log mescc-lib/build.log rm -rf mescc/bin rm -f scaffold/boot/*.log scaffold/boot/*.trs rm -f test-suite.log tests/*.log tests/*.trs rm -f scaffold/*.s scaffold/*.o rm -f doc/images/gcc-mesboot-graph.{eps,pdf,png} rm -f doc/mes.1 doc/mesar.1 doc/mescc.1 rm -f .config .config.E .config.o distclean: clean rm -f GNUmakefile bootstrap.sh build.sh check.sh install.sh uninstall.sh rm -f include/mes/config.h rm -f .config.make config.sh mescc-lib/config.sh gcc-lib/config.sh rm -f scripts/mesar scripts/mescc scripts/mescc.scm scripts/m2-merge rm -f TAGS mostlyclean: clean maintainer-clean: distclean rm -f doc/mes.info rm -f doc/version.texi TAGS: etags ${srcdest}lib/*.c ${srcdest}lib/*/*.c ${srcdest}src/*.c ${srcdest}include/*.h ${srcdest}include/*/*.h ${srcdest}include/sys/*.h all-go: ${srcdest}build-aux/build-guile.sh clean-go: rm -f $(shell find . -name '*.go') check: $(SHELL) check.sh check-mescc: $(SHELL) pre-inst-env build-aux/check-mescc.sh # Mes does not feature post-install checks yet, so we're great! installcheck: true install: $(SHELL) install.sh uninstall: $(SHELL) uninstall.sh doc/version.texi: ${srcdest}doc/mes.texi GNUmakefile @mkdir -p $(@D) (set `LANG= date -r $< +'%d %B %Y'`;\ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > $@ doc: doc/version.texi ifdef MAKEINFO doc: info else $(warning skipping info: no makeinfo) endif ifdef HELP2MAN doc: man else $(warning skipping man: no help2man) endif info: doc/mes.info doc/mes.info: ${srcdest}doc/mes.texi doc/version.texi ${srcdest}doc/images/gcc-mesboot-graph.png GNUmakefile $(MAKEINFO) -o $@ -I doc -I doc $< doc/images/%.eps: ${srcdest}doc/images/%.dot ifdef DOT $(DOT) -T eps $< > $@ else touch $@ endif doc/images/%.pdf: ${srcdest}doc/images/%.dot ifdef DOT $(DOT) -T pdf $< > $@ else touch $@ endif doc/images/%.png: ${srcdest}doc/images/%.dot ifdef DOT $(DOT) -T png $< > $@ else touch $@ $(warning info: graphvis missing: no images) endif man: doc/mes.1 doc/mescc.1 doc/mesar.1 # disable builtin-rules %.o: %.s %.s: %.S %.o: %.S %.o: %.c %: %.S %: %.o %: %.c doc/mes.1: src/${program_prefix}mes | build MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \ --name="Scheme interpreter for bootstrapping the GNU system" \ $( $@ doc/mescc.1: scripts/mescc src/${program_prefix}mes | build MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \ --name="C99 compiler in Scheme for bootstrapping the GNU system" \ $( $@ doc/mesar.1: scripts/mescc src/${program_prefix}mes | build MES_ARENA=10000000 ./pre-inst-env $(HELP2MAN) \ --name="Archiver for MesCC" \ $( $@ html: doc/html/index.html doc/html/index.html: ${srcdest}doc/mes.texi doc/version.texi doc/images/gcc-mesboot-graph.png $(MAKEINFO) --html -o $(@D) -I ${srcdest}doc -I doc $< dvi: doc/mes.dvi doc/mes.dvi: ${srcdest}doc/mes.texi $(MAKEINFO) --dvi -I ${srcdest}doc -I doc -o doc/mes.dvi $< pdf: doc/mes.pdf doc/mes.pdf: ${srcdest}doc/mes.texi $(MAKEINFO) --pdf -I ${srcdest}doc -I doc -o doc/mes.pdf $< ps: doc/mes.ps doc/mes.ps: ${srcdest}doc/mes.texi $(MAKEINFO) --ps -I ${srcdest}doc -I doc -o doc/mes.ps $< WEB_IMAGES:=\ doc/images/gcc-mesboot-graph.eps\ doc/images/gcc-mesboot-graph.pdf\ doc/images/gcc-mesboot-graph.png web: info $(WEB_IMAGES) GENDOCS_TEMPLATE_DIR=doc build-aux/gendocs.sh -I doc -s ${srcdest}doc/mes.texi -o doc/web/manual --email bug-mes@gnu.org mes "GNU Mes manual" SITE = /srv/mes.org publish: web rsync -P -v . $(SITE)/ rsync -P -v . $(SITE)/manual/ rsync -P -rvz doc/web/manual/ $(SITE)/manual/ LOCAL_SITE = $(HOME)/src/web/mes publish-local: web $(MAKE) publish SITE=$(LOCAL_SITE) ### dist COMMIT=$(shell test -e ${srcdest}.git && (cd ${srcdir} && git describe --dirty 2>/dev/null) || cat ${srcdest}.tarball-version) TARBALL_VERSION=$(COMMIT:v%=%) TARBALL_DIR:=$(PACKAGE)-$(TARBALL_VERSION) TARBALL:=$(TARBALL_DIR).tar.gz # Be friendly to Debian; avoid using EPOCH MTIME=$(shell git show HEAD --format=%ct --no-patch 2>/dev/null) # Reproducible tarball TAR_FLAGS=--sort=name --mtime=@$(MTIME) --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s .tarball-version: echo $(COMMIT) > $@ GIT_ARCHIVE_HEAD:=git archive HEAD -- GIT_LS_FILES:=git ls-files ifeq ($(wildcard .git),) GIT_ARCHIVE_HEAD:=tar -cf- GIT_LS_FILES:=find MTIME:=0 endif check-signature: git show HEAD --show-signature |grep 'gpg: Good signature' dist: check-signature $(TARBALL) sign-dist: $(TARBALL) gpg -a --output $(TARBALL).sig --detach-sig $(TARBALL) git checkout ChangeLog tree-clean-p: test ! -d .git || git diff --exit-code > /dev/null test ! -d .git || git diff --cached --exit-code > /dev/null @echo commit:$(COMMIT) generate-ChangeLog: $(PERL) ${srcdest}build-aux/gitlog-to-changelog --srcdir=${srcdir} > $@ cat ChangeLog >> generate-ChangeLog mv generate-ChangeLog ChangeLog $(TARBALL): .tarball-version | generate-ChangeLog ($(GIT_LS_FILES) \ --exclude=$(TARBALL_DIR); \ echo $^ | tr ' ' '\n') \ | tar $(TAR_FLAGS) \ --transform=s,^,$(TARBALL_DIR)/,S -T- -cf- \ | gzip -c --no-name > $@ git checkout ChangeLog ifdef GUIX update-hash: $(TARBALL) $(GUIX) download file://$(PWD)/$< sed -i \ -e 's,version #!mes!# "[^"]*"),version #!mes!# "$(VERSION)"),' \ -e 's,(base32 #!mes!# "[^"]*"),(base32 #!mes!# "$(shell $(GUIX) hash $<)"),' \ guix/git/mes.scm else $(warning update-hash: no guix) endif tag: git tag -s v$(VERSION) -m "GNU Mes $(VERSION)." # Release process # 0. Prepare git, see history: # - doc: Release update (NEWS, etc.) # - Generate announcement # + touch mes-0.23.tar.gz # + make gen-announce VERSION=0.23 # + Update and commit doc/announce/ANNOUNCE-0.23, # using xxx (32,40) for checksums # - create "Release 0.23" commit (see Release 0.22). # + configure # + configure.sh # 1. Tag for release # make tag VERSION=0.23 # 2. Create signed tarball # ./configure # make sign-dist # 3. Update Guix package description # make release # 4. Finish announcement # - make sum-announce # - doc: Post-release update. # - build-aux/GNUMakefile.in: gen-announce: update previous-version # 5. Verify # - Update package in Guix master. # - If applicable, verify bootstrap. # 6. Upload to ftp.gnu.org # 7. Update web # - make publish-local # - Update ~/src/web/mes/index.html # - Upload: cvs ci # 8. Create blog post # cp doc/announce/ANNOUNCE-0.23 ~/src/web/joyofsource.com/posts/announce-0.23.md # fix urls and all # 9. Send mail # To: info-gnu@gnu.org # Cc: bug-mes@gnu.org # Cc: guix-devel@gnu.org # Cc: bootstrappable@freelists.org # Cc: rb-general@lists.reproducible-builds.org guix-build: ./pre-inst-env $(GUIX) build mes@$(VERSION) --with-source=$(TARBALL) release: check-signature update-hash git commit -m 'guix: mes: Update to $(VERSION).' \ -m '* guix/git/mes.scm (mes)[source]: Update to $(VERSION).' \ guix/git/mes.scm GPG_KEY_ID:=1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 GEN_ANNOUNCE=$(GNULIB)/build-aux/announce-gen GNULIB=../../gnulib gen-announce: $(GEN_ANNOUNCE) \ --release-type=beta \ --package-name=mes \ --previous-version='0.24.1' \ --current-version=$(VERSION) \ --gpg-key-id=$(GPG_KEY_ID) \ --url-directory=https://ftp.gnu.org/gnu/mes \ --news=NEWS \ > doc/announce/ANNOUNCE-$(VERSION) sum-announce: sed -i \ -e "s, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(PACKAGE)-$(VERSION).tar.gz, $(shell sha256sum $(PACKAGE)-$(VERSION).tar.gz)," \ -e "s, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(PACKAGE)-$(VERSION).tar.gz, $(shell sha1sum $(PACKAGE)-$(VERSION).tar.gz)," \ -e "s, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $(PACKAGE)-$(VERSION).tar.gz, $(shell md5sum $(PACKAGE)-$(VERSION).tar.gz)," \ doc/announce/ANNOUNCE-$(VERSION) installdirs: mkinstalldirs mkdir -p\ $(DESTDIR)$(bindir)\ $(DESTDIR)$(datadir)\ $(DESTDIR)$(libdir)\ $(DESTDIR)$(infodir)\ $(DESTDIR)$(mandir) install-dvi: dvi mkdir -p $(DESTDIR)${docdir} cp doc/mes.dvi $(DESTDIR)${docdir} install-html: html mkdir -p $(DESTDIR)${docdir} tar -cf- -C doc html | tar -xf- -C $(DESTDIR)${docdir} install-pdf: pdf mkdir -p $(DESTDIR)${docdir} cp doc/mes.pdf $(DESTDIR)${docdir} install-ps: ps mkdir -p $(DESTDIR)${docdir} cp doc/mes.ps $(DESTDIR)${docdir} # We do not strip binaries, binutils' strip corrupts M1+hex2-generated ELFs install-strip: install define HELP_TOP Usage: make [OPTION]... [TARGET]... Main and non-standard targets: all update everything all-go update .go files dist update $(TARBALL) doc update documentation check run unit tests clean run git clean -dfx clean-go clean .go files info update info documentation install install in $(prefix) install-info install info docs in $(prefix)/share/info release dist and tag uninstall uninstall from $(prefix) endef export HELP_TOP help: @echo "$$HELP_TOP" include ${srcdest}build-aux/export.make mes-0.24.2/build-aux/bootstrap.sh.in0000644000000000000000000000734314372371517014142 0ustar #! @SHELL@ # GNU Mes --- Maxwell Equations of Software # Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . if test "$V" = 1 -o "$V" = 2; then set -x fi LANG= MES_ARENA=${MES_ARENA-20000000} export MES_ARENA MES_MAX_ARENA=${MES_MAX_ARENA-${MES_ARENA}} export MES_MAX_ARENA MES_STACK=${MES_STACK-5000000} export MES_STACK MES_PREFIX=${MES_PREFIX-$PWD} . ./config.sh . ${srcdest}build-aux/configure-lib.sh . ${srcdest}build-aux/cflags.sh if test -n "@M2_PLANET@"; then echo " KAEM kaem.run" kaem --strict --verbose fi CPPFLAGS="-D HAVE_CONFIG_H=1 -I include" libdir=$PWD/lib export libdir mkdir -p mescc-lib cp config.sh mescc-lib/config.sh cd mescc-lib srcdest=../${srcdest} ln -sf ${srcdest}mes . ln -sf ${srcdest}module . ln -sf ${srcdest}src . AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include" AM_CFLAGS="-L ${srcdest}lib" mkdir -p $mes_cpu-mes $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c cp crt1.o $mes_cpu-mes cp crt1.s $mes_cpu-mes objects= for c in $libc_mini_SOURCES; do o=$(basename $c .c).o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c fi objects="$objects $o" done echo " AR $mes_cpu-mes/libc-mini.a" $AR crD $mes_cpu-mes/libc-mini.a $objects objects= for c in $libmescc_SOURCES; do o=$(basename $c .c).o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c fi objects="$objects $o" done echo " AR $mes_cpu-mes/libmescc.a" $AR crD $mes_cpu-mes/libmescc.a $objects objects= for c in $libc_SOURCES; do o=$(basename $c .c).o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c fi objects="$objects $o" done echo " AR $mes_cpu-mes/libc.a" $AR crD $mes_cpu-mes/libc.a $objects objects= for c in $libc_tcc_SOURCES; do o=$(basename $c .c).o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c fi objects="$objects $o" done echo " AR $mes_cpu-mes/libc+tcc.a" $AR crD $mes_cpu-mes/libc+tcc.a $objects cd .. srcdest= AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include" AM_CFLAGS="-L ${srcdest}lib" objects= for c in $mes_SOURCES; do o=$(basename $c .c).o if test ! -e $o -o ${srcdest}$c -nt $o; then echo " CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c fi objects="$objects $o" done echo " CCLD bin/mes-mescc" mkdir -p bin $CC $AM_CFLAGS -nostdlib -o bin/mes-mescc -L mescc-lib mescc-lib/crt1.o $objects -lc -lmescc cp bin/mes-mescc bin/mes ( mkdir -p gcc-lib cp config.sh gcc-lib cd gcc-lib compiler=gcc if test -z "$srcdest"; then srcdest=../ srcdir=../ fi @SHELL@ ${srcdest}build-aux/build-source-lib.sh ) mes-0.24.2/build-aux/build-guile.sh0000755000000000000000000000333614372371517013723 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e . ./config.sh . ${srcdest}build-aux/trace.sh GUILE_AUTO_COMPILE=0 SCM_FILES=" module/mes/getopt-long.scm module/mes/guile.scm module/mes/misc.scm module/mes/test.scm module/mescc/M1.scm module/mescc/as.scm module/mescc/bytevectors.scm module/mescc/compile.scm module/mescc/armv4/as.scm module/mescc/armv4/info.scm module/mescc/i386/as.scm module/mescc/i386/info.scm module/mescc/x86_64/as.scm module/mescc/x86_64/info.scm module/mescc/info.scm module/mescc.scm module/mescc/mescc.scm module/mescc/preprocess.scm " SCRIPTS=" build-aux/mes-snarf.scm " export host=$($GUILE -c "(display %host-type)") abs=$srcdest if [ "$GUILE_EFFECTIVE_VERSION" = "2.0" ]; then srcdest=$abs_top_srcdir/ fi for i in $SCM_FILES $SCRIPTS; do b=$(basename $i) go=${i%%.scm}.go f=${srcdest}$i if test $f -nt $go; then trace "GUILEC $f" $GUILD compile $GUILD_OPTIMIZE -L ${srcdest}module -L ${srcdest}build-aux -L ${srcdest}scripts -o $go $f fi done mes-0.24.2/build-aux/build-lib.sh0000755000000000000000000000416214372371517013362 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2019 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . . ./config.sh . ${srcdest}build-aux/configure-lib.sh . ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/cc.sh trap 'test -f .log && cat .log' EXIT mkdir -p $mes_cpu-mes compile lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c cp crt1.o $mes_cpu-mes if test -e crt1.s; then cp crt1.s $mes_cpu-mes fi archive libc-mini.a $libc_mini_SOURCES cp libc-mini.a $mes_cpu-mes if test -e libc-mini.s; then cp libc-mini.s $mes_cpu-mes fi archive libmes.a $libmes_SOURCES cp libmes.a $mes_cpu-mes if test -e libmes.s; then cp libmes.s $mes_cpu-mes fi archive libmescc.a $libmescc_SOURCES cp libmescc.a $mes_cpu-mes if test -e libmescc.s; then cp libmescc.s $mes_cpu-mes fi if test $mes_libc = mes; then archive libc.a $libc_SOURCES cp libc.a $mes_cpu-mes if test -e libc.s; then cp libc.s $mes_cpu-mes fi fi archive libc+tcc.a $libc_tcc_SOURCES cp libc+tcc.a $mes_cpu-mes if test -e libc+tcc.s; then cp libc+tcc.s $mes_cpu-mes fi archive libtcc1.a $libtcc1_SOURCES cp libtcc1.a $mes_cpu-mes if test -e libtcc1.s; then cp libtcc1.s $mes_cpu-mes fi archive libgetopt.a lib/posix/getopt.c cp libgetopt.a $mes_cpu-mes if test -e libgetopt.s; then cp libgetopt.s $mes_cpu-mes fi if $courageous; then exit 0 fi archive libc+gnu.a $libc_gnu_SOURCES cp libc+gnu.a $mes_cpu-mes if test -e libc+gnu.s; then cp libc+gnu.s $mes_cpu-mes fi mes-0.24.2/build-aux/build-mes.sh0000755000000000000000000000270214372371517013376 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2019,2021 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e set -u V=${V-} if [ "$V" = 2 ]; then set -x fi . ./config.sh . ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/cc.sh . ${srcdest}build-aux/configure-lib.sh trap 'test -f .log && cat .log' EXIT for c in $mes_SOURCES; do compile $c done if test $mes_libc = system; then LIBS=-lmes fi if [ "$compiler" = "gcc" ] then # Make it possible to resolve raise(), required by libgcc.a, provided in # libc.a. The final command line has to have "-lc -lgcc -lc". # See . LIBS="${LIBS} -lgcc -lc" fi if [ "$compiler" = "mescc" ]; then LIBS="${LIBS} -lc -lmescc" fi link bin/mes-$compiler cp bin/mes-$compiler bin/mes mes-0.24.2/build-aux/build-scaffold.sh0000755000000000000000000000750214372371517014376 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e set -u V=${V-1} if [ "$V" = 2 ]; then set -x fi . ./config.sh . ${srcdest}build-aux/trace.sh . ${srcdest}build-aux/cflags.sh if $courageous; then set +e set_min_e () { echo "Applying courage" } set_min_e else set_min_e () { set -e } fi trace "CCLD ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/exit-42.S" $CC\ -nostdlib\ -g\ ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/exit-42.S\ -o exit-42 trace "TEST exit-42" { set +e; ./exit-42; r=$?; set_min_e; } [ $r != 42 ] && echo " => $r" [ $r = 42 ] if $numbered_arch; then stage0_cpu_flag="--Architecture $stage0_arch"; else stage0_cpu_flag="--architecture $stage0_cpu"; fi trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2" $HEX2\ --little-endian\ $stage0_cpu_flag\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0exit-42.hex2\ -o 0exit-42 trace "TEST 0exit-42" { set +e; ./0exit-42; r=$?; set_min_e; } [ $r != 42 ] && echo " => $r" [ $r = 42 ] trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2" $HEX2\ --little-endian\ $stage0_cpu_flag\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-exit-42.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\ -o body-exit-42 trace "TEST body-exit-42" { set +e; ./body-exit-42; r=$?; set_min_e; } [ $r != 42 ] && echo " => $r" [ $r = 42 ] ### FIXME: c&p from exit-42 trace "CCLD ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/hello-mes.S" $CC\ -nostdlib\ -g\ ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/hello-mes.S\ -o hello-mes trace "TEST hello-mes" { set +e; ./hello-mes; r=$?; set_min_e; } [ $r != 0 ] && echo " => $r" [ $r = 0 ] trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2" $HEX2\ --little-endian\ $stage0_cpu_flag\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-0hello-mes.hex2\ -o 0hello-mes trace "TEST 0hello-mes" { set +e; ./0hello-mes; r=$?; set_min_e; } [ $r != 0 ] && echo " => $r" [ $r = 0 ] trace "HEX2 ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2" $HEX2\ --little-endian\ $stage0_cpu_flag\ --base-address 0x1000000\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-header.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-body-hello-mes.hex2\ -f ${srcdest}lib/$mes_kernel/$mes_cpu-mes/elf$mes_bits-footer-single-main.hex2\ -o body-hello-mes trace "TEST body-hello-mes" { set +e; ./body-hello-mes; r=$?; set_min_e; } [ $r != 0 ] && echo " => $r" [ $r = 0 ] mes-0.24.2/build-aux/build-source-lib.sh0000644000000000000000000000337414372371517014661 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2019 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e if test "$V" = 2; then set -x fi set -u srcdest=${srcdest-} . ${srcdest}build-aux/configure-lib.sh mkdir -p $mes_cpu-mes cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt*.c $mes_cpu-mes rm -f libc+gnu.c cat > libc+gnu.c <> libc+gnu.c cat ${srcdest}$c >> libc+gnu.c echo >> libc+gnu.c done cp libc+gnu.c $mes_cpu-mes rm -f libtcc1.c cat > libtcc1.c <> libtcc1.c cat ${srcdest}$c >> libtcc1.c echo >> libtcc1.c done cp libtcc1.c $mes_cpu-mes cp ${srcdest}lib/posix/getopt.c $mes_cpu-mes/libgetopt.c mes-0.24.2/build-aux/build.sh.in0000644000000000000000000000763414372371517013227 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e if test "$1" = "help"; then cat < # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . objects= compile () { c=${srcdest}$1 b=$(basename $c .c) o=$b.o objects="$objects $o" if test ! -e $o -o $c -nt $o; then trace "CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o $c $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o $c fi } archive () { archive=$1 shift sources="$@" objects= for c in $sources; do b=$(basename $c .c) o=$b.o compile $c done trace "AR $archive" $AR crD $archive $objects objects= } link () { out=$1 d=$(dirname $out) mkdir -p $d if test $mes_libc = system; then crt1= else crt1=crt1.o fi trace "CCLD $out" $CC $AM_CFLAGS $CFLAGS $AM_LDFLAGS $LDFLAGS -o $out $crt1 $objects $LIBS objects= } mes-0.24.2/build-aux/cflags.sh0000644000000000000000000000333614372371517012755 0ustar # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . case "$mes_cpu" in arm) stage0_arch=40 stage0_cpu=armv7l ;; x86_64) stage0_arch=2 stage0_cpu=amd64 ;; x86) stage0_arch=1 stage0_cpu=x86 ;; *) stage0_arch=1 stage0_cpu=$mes_cpu ;; esac AM_CPPFLAGS=" -D HAVE_CONFIG_H=1 -I ${srcdest}include -I ${srcdest}include/$mes_kernel/$mes_cpu " if test $mes_kernel = gnu; then AM_CPPFLAGS="$AM_CPPFLAGS -I /usr/include " fi AM_CFLAGS= if test "$V" = 2; then AM_CFLAGS="$AM_CFLAGS -v" elif test "$V" = 3; then AM_CFLAGS="$AM_CFLAGS -v -v" fi if test $mes_libc = mes; then AM_CFLAGS="$AM_CFLAGS -static -nostdinc -nostdlib -fno-builtin " fi AM_LDFLAGS=" -L . " if test $mes_libc = mes; then AM_LDFLAGS="$AM_LDFLAGS -static -nostdlib " fi LIBS=-lc if test $mes_cpu = arm; then AM_CFLAGS="$AM_CFLAGS -marm " fi export AM_CFLAGS CFLAGS export AM_CPPFLAGS CPPFLAGS export AM_LDFLAGS LDFLAGS export LIBS mes-0.24.2/build-aux/check-boot.sh0000755000000000000000000000677414372371517013550 0ustar #! /bin/bash # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e . ./config.sh set -u TESTS=" scaffold/boot/00-zero.scm scaffold/boot/01-true.scm scaffold/boot/02-symbol.scm scaffold/boot/03-string.scm scaffold/boot/04-quote.scm scaffold/boot/05-list.scm scaffold/boot/06-tick.scm scaffold/boot/07-if.scm scaffold/boot/08-if-if.scm scaffold/boot/10-cons.scm scaffold/boot/11-list.scm scaffold/boot/11-vector.scm scaffold/boot/12-car.scm scaffold/boot/13-cdr.scm scaffold/boot/14-exit.scm scaffold/boot/15-display.scm scaffold/boot/16-if-eq-quote.scm scaffold/boot/17-memq.scm scaffold/boot/17-memq-keyword.scm scaffold/boot/17-string-equal.scm scaffold/boot/17-equal2.scm scaffold/boot/17-string-append.scm scaffold/boot/17-open-input-string.scm scaffold/boot/20-define.scm scaffold/boot/20-define-quoted.scm scaffold/boot/20-define-quote.scm scaffold/boot/21-define-procedure.scm scaffold/boot/22-define-procedure-2.scm scaffold/boot/23-begin.scm scaffold/boot/24-begin-define.scm scaffold/boot/25-begin-define-2.scm scaffold/boot/26-begin-define-later.scm scaffold/boot/27-lambda-define.scm scaffold/boot/28-define-define.scm scaffold/boot/29-lambda-define.scm scaffold/boot/2a-lambda-lambda.scm scaffold/boot/2b-define-lambda.scm scaffold/boot/2c-define-lambda-recurse.scm scaffold/boot/2d-define-lambda-set.scm scaffold/boot/2d-compose.scm scaffold/boot/2e-define-first.scm scaffold/boot/2f-define-second.scm scaffold/boot/2f-define-second-lambda.scm scaffold/boot/2g-vector.scm scaffold/boot/30-capture.scm scaffold/boot/31-capture-define.scm scaffold/boot/32-capture-modify-close.scm scaffold/boot/33-procedure-override-close.scm scaffold/boot/34-cdr-override-close.scm scaffold/boot/35-closure-modify.scm scaffold/boot/36-closure-override.scm scaffold/boot/37-closure-lambda.scm scaffold/boot/38-simple-format.scm scaffold/boot/39-global-define-override.scm scaffold/boot/3a-global-define-lambda-override.scm scaffold/boot/40-define-macro.scm scaffold/boot/41-when.scm scaffold/boot/42-if-when.scm scaffold/boot/43-or.scm scaffold/boot/44-or-if.scm scaffold/boot/45-pass-if.scm scaffold/boot/46-report.scm scaffold/boot/47-pass-if-eq.scm scaffold/boot/48-let.scm scaffold/boot/49-macro-override.scm scaffold/boot/4a-define-macro-define-macro.scm scaffold/boot/4b-define-macro-define.scm scaffold/boot/4c-quasiquote.scm scaffold/boot/4d-let-map.scm scaffold/boot/4e-let-global.scm scaffold/boot/4f-string-split.scm scaffold/boot/50-keyword.scm scaffold/boot/50-make-string.scm scaffold/boot/50-string-join.scm scaffold/boot/50-primitive-load.scm scaffold/boot/53-closure-display.scm scaffold/boot/60-let-syntax.scm scaffold/boot/call-cc.scm scaffold/boot/gc.scm scaffold/boot/memory.scm scaffold/boot/numbers.scm " XFAIL_TESTS= test_ext=.scm log_compiler="${SHELL} ${srcdest}build-aux/test-boot.sh" . ${srcdest}build-aux/test-suite.sh mes-0.24.2/build-aux/check-mes.sh0000755000000000000000000000266714372371517013366 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e . ./config.sh set -u TESTS=" tests/boot.test tests/read.test tests/srfi-0.test tests/macro.test tests/gc.test tests/perform.test tests/base.test tests/quasiquote.test tests/let.test tests/closure.test tests/scm.test tests/display.test tests/cwv.test tests/math.test tests/vector.test tests/srfi-1.test tests/srfi-9.test tests/srfi-13.test tests/srfi-14.test tests/srfi-43.test tests/optargs.test tests/fluids.test tests/catch.test tests/getopt-long.test tests/guile.test tests/syntax.test tests/let-syntax.test tests/pmatch.test tests/posix.test tests/match.test tests/psyntax.test " XFAIL_TESTS= test_ext=.test log_compiler=${SHELL} . ${srcdest}build-aux/test-suite.sh mes-0.24.2/build-aux/check-mescc.sh0000755000000000000000000002335314372371517013667 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2017,2018,2019,2020,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e . ./config.sh set -u mes_tests=" lib/tests/scaffold/t.c lib/tests/scaffold/01-return-0.c lib/tests/scaffold/02-return-1.c lib/tests/scaffold/03-call.c lib/tests/scaffold/04-call-0.c lib/tests/scaffold/05-call-1.c lib/tests/scaffold/06-call-not-1.c lib/tests/scaffold/06-not-call-1.c lib/tests/scaffold/06-call-2.c lib/tests/scaffold/06-call-string.c lib/tests/scaffold/06-call-variable.c lib/tests/scaffold/06-return-void.c lib/tests/scaffold/07-include.c lib/tests/scaffold/08-assign.c lib/tests/scaffold/08-assign-negative.c lib/tests/scaffold/08-assign-global.c lib/tests/scaffold/10-if-0.c lib/tests/scaffold/11-if-1.c lib/tests/scaffold/12-if-eq.c lib/tests/scaffold/13-if-neq.c lib/tests/scaffold/14-if-goto.c lib/tests/scaffold/15-if-not-f.c lib/tests/scaffold/16-if-t.c lib/tests/scaffold/17-compare-char.c lib/tests/scaffold/17-compare-ge.c lib/tests/scaffold/17-compare-gt.c lib/tests/scaffold/17-compare-le.c lib/tests/scaffold/17-compare-lt.c lib/tests/scaffold/17-compare-unsigned-ge.c lib/tests/scaffold/17-compare-unsigned-gt.c lib/tests/scaffold/17-compare-unsigned-le.c lib/tests/scaffold/17-compare-unsigned-lt.c lib/tests/scaffold/17-compare-unsigned-char-le.c lib/tests/scaffold/17-compare-unsigned-short-le.c lib/tests/scaffold/17-compare-unsigned-long-le.c lib/tests/scaffold/17-compare-and.c lib/tests/scaffold/17-compare-or.c lib/tests/scaffold/17-compare-and-or.c lib/tests/scaffold/17-compare-assign.c lib/tests/scaffold/17-compare-call.c lib/tests/scaffold/18-assign-shadow.c lib/tests/scaffold/20-while.c lib/tests/scaffold/21-char-array-simple.c lib/tests/scaffold/21-char-array.c lib/tests/scaffold/22-while-char-array.c lib/tests/scaffold/23-global-pointer-init-null.c lib/tests/scaffold/23-global-pointer-init.c lib/tests/scaffold/23-global-pointer-ref.c lib/tests/scaffold/23-global-pointer-pointer-ref.c lib/tests/scaffold/23-pointer-sub.c lib/tests/scaffold/23-pointer.c lib/tests/mes/30-oputs.c lib/tests/mes/30-eputs.c lib/tests/string/30-strlen.c lib/tests/scaffold/30-exit-0.c lib/tests/scaffold/30-exit-42.c lib/tests/scaffold/32-call-wrap.c lib/tests/scaffold/32-compare.c lib/tests/scaffold/33-and-or.c lib/tests/scaffold/34-pre-post.c lib/tests/scaffold/35-compare-char.c lib/tests/scaffold/36-compare-arithmetic.c lib/tests/scaffold/36-compare-arithmetic-negative.c lib/tests/scaffold/37-compare-assign.c lib/tests/scaffold/38-compare-call-2.c lib/tests/scaffold/38-compare-call-3.c lib/tests/scaffold/38-compare-call.c lib/tests/scaffold/40-if-else.c lib/tests/scaffold/41-ternary.c lib/tests/scaffold/42-goto-label.c lib/tests/scaffold/43-for-do-while.c lib/tests/scaffold/44-switch.c lib/tests/scaffold/44-switch-fallthrough.c lib/tests/scaffold/44-switch-body-fallthrough.c lib/tests/scaffold/45-void-call.c lib/tests/scaffold/46-function-static.c lib/tests/scaffold/47-function-expression.c lib/tests/scaffold/48-global-static.c lib/tests/assert/50-assert.c lib/tests/mes/50-itoa.c lib/tests/posix/50-getenv.c lib/tests/stdlib/50-malloc.c lib/tests/string/50-memcmp.c lib/tests/string/50-strcmp.c lib/tests/string/50-strcmp-itoa.c lib/tests/string/50-strcpy.c lib/tests/string/50-strncmp.c lib/tests/posix/50-open-read.c lib/tests/scaffold/51-pointer-sub.c lib/tests/scaffold/54-argc.c lib/tests/scaffold/54-argv.c lib/tests/scaffold/55-char-array.c lib/tests/scaffold/60-math.c lib/tests/scaffold/60-math-itoa.c lib/tests/scaffold/60-math-modulo.c lib/tests/scaffold/61-array.c lib/tests/scaffold/62-array.c lib/tests/scaffold/63-struct.c lib/tests/scaffold/63-struct-pointer.c lib/tests/scaffold/63-struct-local.c lib/tests/scaffold/63-struct-function.c lib/tests/scaffold/63-struct-assign.c lib/tests/scaffold/63-struct-array.c lib/tests/scaffold/63-struct-array-assign.c lib/tests/scaffold/63-struct-array-compare.c lib/tests/scaffold/63-struct-cell.c lib/tests/scaffold/64-make-cell.c lib/tests/scaffold/65-read.c lib/tests/scaffold/66-local-char-array.c " tcc_tests=" lib/tests/scaffold/70-stdarg.c lib/tests/stdio/70-printf-hello.c lib/tests/stdio/70-printf-simple.c lib/tests/stdio/70-printf.c lib/tests/stdlib/70-strtoull.c lib/tests/string/70-strchr.c lib/tests/scaffold/71-struct-array.c lib/tests/scaffold/72-typedef-struct-def.c lib/tests/scaffold/72-typedef-struct-def-local.c lib/tests/scaffold/73-union-hello.c lib/tests/scaffold/73-union.c lib/tests/scaffold/74-multi-line-string.c lib/tests/scaffold/75-struct-union.c lib/tests/scaffold/76-pointer-arithmetic-pp.c lib/tests/scaffold/76-pointer-arithmetic.c lib/tests/scaffold/77-pointer-assign.c lib/tests/scaffold/78-union-struct.c lib/tests/scaffold/79-int-array-simple.c lib/tests/scaffold/79-int-array.c lib/tests/scaffold/7a-struct-char-array.c lib/tests/scaffold/7b-struct-int-array-hello.c lib/tests/scaffold/7b-struct-int-array-pointer.c lib/tests/scaffold/7b-struct-int-array.c lib/tests/scaffold/7c-dynarray.c lib/tests/scaffold/7d-cast-char.c lib/tests/scaffold/7e-struct-array-access.c lib/tests/scaffold/7f-struct-pointer-arithmetic.c lib/tests/scaffold/7g-struct-byte-word-field.c lib/tests/scaffold/7h-struct-assign.c lib/tests/scaffold/7i-struct-struct-simple.c lib/tests/scaffold/7i-struct-struct.c lib/tests/scaffold/7k-empty-for.c lib/tests/scaffold/7k-for-each-elem-simple.c lib/tests/scaffold/7k-for-each-elem.c lib/tests/scaffold/7l-struct-any-size-array-simple.c lib/tests/scaffold/7l-struct-any-size-array.c lib/tests/scaffold/7m-struct-char-array-assign.c lib/tests/scaffold/7n-struct-struct-array.c lib/tests/scaffold/7o-struct-pre-post-simple.c lib/tests/scaffold/7o-struct-pre-post.c lib/tests/scaffold/7p-struct-cast.c lib/tests/scaffold/7q-bit-field-simple.c lib/tests/scaffold/7q-bit-field.c lib/tests/scaffold/7r-sign-extend.c lib/tests/scaffold/7s-struct-short.c lib/tests/scaffold/7s-unsigned-compare.c lib/tests/scaffold/7t-function-destruct.c lib/tests/scaffold/7u-double.c lib/tests/scaffold/7u-long-long.c lib/tests/scaffold/7u-ternary-expression.c lib/tests/scaffold/7u-call-ternary.c lib/tests/scaffold/7u-inc-byte-word.c lib/tests/scaffold/7u-struct-func.c lib/tests/scaffold/7u-struct-size10.c lib/tests/scaffold/7u-vstack.c lib/tests/scaffold/70-array-in-struct-init.c lib/tests/scaffold/70-struct-short-enum-init.c lib/tests/scaffold/70-struct-post.c lib/tests/scaffold/70-extern.c lib/tests/scaffold/70-ternary-arithmetic-argument.c lib/tests/scaffold/70-function-modulo.c lib/tests/scaffold/70-or-argument.c lib/tests/setjmp/80-setjmp.c lib/tests/stdio/80-sscanf.c lib/tests/stdlib/80-qsort.c lib/tests/stdlib/80-qsort-dupes.c lib/tests/string/80-strncpy.c lib/tests/string/80-strrchr.c lib/tests/scaffold/82-define.c lib/tests/scaffold/83-heterogenoous-init.c lib/tests/scaffold/84-struct-field-list.c lib/tests/scaffold/85-sizeof.c " gnu_tests=" lib/tests/dirent/90-readdir.c lib/tests/io/90-stat.c lib/tests/mes/90-abtod.c lib/tests/mes/90-dtoab.c lib/tests/posix/90-execlp.c lib/tests/posix/90-unsetenv.c lib/tests/signal/90-signal.c lib/tests/stdio/90-fopen.c lib/tests/stdio/90-fopen-append.c lib/tests/stdio/90-fread-fwrite.c lib/tests/stdio/90-fseek.c lib/tests/stdio/90-sprintf.c lib/tests/stdlib/90-strtol.c lib/tests/string/90-snprintf.c lib/tests/string/90-strpbrk.c lib/tests/string/90-strspn.c lib/tests/scaffold/90-goto-var.c lib/tests/scaffold/91-goto-array.c lib/tests/scaffold/a0-call-trunc-char.c lib/tests/scaffold/a0-call-trunc-short.c lib/tests/scaffold/a0-call-trunc-int.c lib/tests/scaffold/a0-math-divide-signed-negative.c lib/tests/scaffold/a1-global-no-align.c lib/tests/scaffold/a1-global-no-clobber.c " xfail_tests=" lib/tests/stdio/90-sprintf.c " if test $compiler = mescc; then xfail_tests="$xfail_tests lib/tests/scaffold/17-compare-unsigned-char-le.c lib/tests/scaffold/17-compare-unsigned-short-le.c lib/tests/scaffold/66-local-char-array.c lib/tests/scaffold/72-typedef-struct-def-local.c lib/tests/scaffold/70-ternary-arithmetic-argument.c lib/tests/mes/90-abtod.c lib/tests/mes/90-dtoab.c lib/tests/scaffold/90-goto-var.c lib/tests/scaffold/91-goto-array.c " if test $mes_cpu = x86; then xfail_tests="$xfail_tests " fi if test $mes_cpu = x86_64; then xfail_tests="$xfail_tests lib/tests/scaffold/a0-call-trunc-int.c " fi fi if test $mes_cpu = x86_64; then xfail_tests="$xfail_tests lib/tests/stdio/70-printf-stdarg.c " fi if test $compiler = gcc; then xfail_tests="$xfail_tests " if test $mes_cpu = x86; then xfail_tests="$xfail_tests lib/tests/mes/90-dtoab.c " fi if test $mes_cpu = x86_64; then xfail_tests="$xfail_tests lib/tests/stdio/70-printf-hello.c lib/tests/stdio/70-printf-simple.c lib/tests/stdio/70-printf.c lib/tests/scaffold/70-extern.c lib/tests/stdio/80-sscanf.c lib/tests/posix/90-execlp.c lib/tests/string/90-snprintf.c " fi fi # Allow for make check TESTS=lib/tests/setjmp/80-setjmp.c if test -n "$bootstrap"; then TESTS="${TESTS-$mes_tests$tcc_tests}" else TESTS="${TESTS-$mes_tests$tcc_test$gnu_tests}" fi # Allow for make check xfail_tests=lib/tests/setjmp/80-setjmp.c XFAIL_TESTS="${XFAIL_TESTS-$xfail_tests}" recheck=${recheck-false} test_ext=.c log_compiler="${SHELL} ${srcdest}build-aux/test-c.sh" . ${srcdest}build-aux/test-suite.sh mes-0.24.2/build-aux/check.sh.in0000644000000000000000000000433614372371517013201 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e MES_ARENA=${MES_ARENA-20000000} export MES_ARENA MES_MAX_ARENA=${MES_MAX_ARENA-${MES_ARENA}} export MES_MAX_ARENA MES_STACK=${MES_STACK-5000000} export MES_STACK . ./config.sh if $courageous; then echo "Applying courage" set +e fi CFLAGS= if test $mes_cpu = arm; then CFLAGS="-marm" fi if test $mes_libc = mes; then CFLAGS="${CFLAGS} -static -nostdinc -nostdlib -fno-builtin " fi CPPFLAGS=" -D HAVE_CONFIG_H=1 -I ../include -I ${srcdir}/include -I ${srcdir}/include/$mes_kernel/$mes_cpu " LIBS= LDFLAGS= if test $mes_libc = mes; then LDFLAGS=" -nostdlib " LIBS=-lc fi export CFLAGS export CPPFLAGS export LDFLAGS #export LIBS recheck=${recheck-false} export recheck ./pre-inst-env ${SHELL} ${srcdest}build-aux/check-boot.sh ./pre-inst-env ${SHELL} ${srcdest}build-aux/check-mes.sh if test $compiler = gcc; then ( cd gcc-lib srcdest=$srcdir/../ srcdir=../$srcdir MES_CHECKING_BUILTIN_LIBS="-l gcc" export MES_CHECKING_BUILTIN_LIBS ../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh ) fi ( cd mescc-lib srcdest=$srcdir/../ srcdir=../$srcdir compiler=mescc mes_lib=mes CFLAGS=" -nostdinc -nostdlib -fno-builtin " LDFLAGS=" -nostdlib " MES_CHECKING_BUILTIN_LIBS="-l mescc" export MES_CHECKING_BUILTIN_LIBS AR="${srcdest}pre-inst-env mesar" CC="${srcdest}pre-inst-env mescc" ../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh ) mes-0.24.2/build-aux/config.make.in0000644000000000000000000000401114372371517013662 0ustar # GNU Mes --- Maxwell Equations of Software # Copyright © 2018 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . AR:=@AR@ BASH:=@BASH@ BLOOD_ELF:=@BLOOD_ELF@ CC:=@CC@ CFLAGS:=@CFLAGS@ CPPFLAGS:=@CPPFLAGS@ DIFF:=@DIFF@ DOT:=@DOT@ GIT:=@GIT@ GUILD:=@GUILD@ GUILD_OPTIMIZE:=@GUILD_OPTIMIZE@ GUILE:=@GUILE@ GUILE_EFFECTIVE_VERSION:=@GUILE_EFFECTIVE_VERSION@ GUILE_LOAD_PATH:=@GUILE_LOAD_PATH@ GUIX:=@GUIX@ HELP2MAN:=@HELP2MAN@ HEX2:=@HEX2@ LDFLAGS:=@LDFLAGS@ MAKEINFO:=@MAKEINFO@ M1:=@M1@ MES_FOR_BUILD:=@MES_FOR_BUILD@ NYACC:=@NYACC@ PACKAGE:=@PACKAGE@ PACKAGE_NAME:=@PACKAGE_NAME@ PACKAGE_BUGREPORT:=@PACKAGE_BUGREPORT@ PERL:=@PERL@ SCHEME:=@SCHEME@ SHELL:=@SHELL@ VERSION:=@VERSION@ V:=@V@ colors:=@colors@ abs_top_builddir:=@abs_top_builddir@ abs_top_srcdir:=@abs_top_srcdir@ arch:=@arch@ build:=@build@ host:=@host@ bootstrap:=@bootstrap@ compiler:=@compiler@ courageous:=@courageous@ mes_system:=@mes_system@ mes_cpu:=@mes_cpu@ mes_bits:=@mes_bits@ mes_libc:=@mes_libc@ mes_kernel:=@mes_kernel@ prefix:=@prefix@ bindir:=@bindir@ datadir:=@datadir@ docdir:=@docdir@ guile_site_ccache_dir:=@guile_site_ccache_dir@ guile_site_dir:=@guile_site_dir@ includedir:=@includedir@ infodir:=@infodir@ libdir:=@libdir@ mandir:=@mandir@ moduledir:=@moduledir@ with_glibc_p:=@with_glibc_p@ program_prefix:=@program_prefix@ srcdest:=@srcdest@ srcdir:=@srcdir@ sysconfdir:=@sysconfdir@ top_builddir:=@top_builddir@ mes-0.24.2/build-aux/config.sh.in0000644000000000000000000000527114372371517013370 0ustar # GNU Mes --- Maxwell Equations of Software # Copyright © 2018 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . config_sh=1 AR=${AR-"@AR@"} BASH="@BASH@" BLOOD_ELF="@BLOOD_ELF@" CC=${CC-"@CC@"} CFLAGS=${CFLAGS-"@CFLAGS@"} CPPFLAGS=${CPPFLAGS-"@CPPFLAGS@"} DIFF=${DIFF-@DIFF@} DOT="@DOT@" GIT="@GIT@" GUILD="@GUILD@" GUILD_OPTIMIZE="${GUILD_OPTIMIZE-@GUILD_OPTIMIZE@}" GUILE="@GUILE@" GUILE_EFFECTIVE_VERSION="@GUILE_EFFECTIVE_VERSION@" GUILE_LOAD_PATH="@GUILE_LOAD_PATH@" GUIX="@GUIX@" HELP2MAN="@HELP2MAN@" HEX2="@HEX2@" LDFLAGS=${LDFLAGS-"@LDFLAGS@"} KAEM="@KAEM@" MAKEINFO="@MAKEINFO@" M1="@M1@" M2_PLANET="@M2_PLANET@" MES_FOR_BUILD="@MES_FOR_BUILD@" NYACC="@NYACC@" PACKAGE="@PACKAGE@" PACKAGE_NAME="@PACKAGE_NAME@" PACKAGE_BUGREPORT="@PACKAGE_BUGREPORT@" PERL="@PERL@" #SCHEME="@SCHEME@" SHELL="@SHELL@" TINYCC_PREFIX="@TINYCC_PREFIX@" VERSION="@VERSION@" V=${V-"@V@"} colors=${colors-@colors@} abs_top_builddir="@abs_top_builddir@" abs_top_srcdir="@abs_top_srcdir@" arch="@arch@" build="@build@" host="@host@" numbered_arch=${numbered_arch-"@numbered_arch@"} bootstrap=${bootstrap-@bootstrap@} compiler=${compiler-@compiler@} courageous=${courageous-@courageous@} mes_system=@mes_system@ mes_cpu=@mes_cpu@ mes_bits=@mes_bits@ mes_libc=@mes_libc@ mes_kernel=@mes_kernel@ prefix="@prefix@" bindir="@bindir@" datadir="@datadir@" pkgdatadir="@pkgdatadir@" docdir="@docdir@" guile_site_ccache_dir="@guile_site_ccache_dir@" guile_site_dir="@guile_site_dir@" includedir="@includedir@" infodir="@infodir@" libdir="@libdir@" mandir="@mandir@" moduledir="@moduledir@" with_glibc_p="@with_glibc_p@" program_prefix="@program_prefix@" srcdest=${srcdest-"@srcdest@"} srcdir=${srcdir-"@srcdir@"} sysconfdir="@sysconfdir@" top_builddir="@top_builddir@" MES_PREFIX=${MES_PREFIX-$abs_top_srcdir} export PACKAGE export PACKAGE_NAME export PACKAGE_BUGREPORT export AR export CC export DIFF export SHELL export V export colors export compiler export courageous export mes_cpu export srcdest export srcdir export stage0_cpu export GUILE_AUTO_COMPILE export MES_PREFIX export TESTS export XFAIL_TESTS mes-0.24.2/build-aux/configure-lib.sh0000644000000000000000000002057014372371517014242 0ustar #! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2019,2020,2021 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . set -e set -u V=${V-1} if [ "$V" = 2 ]; then set -x fi . ./config.sh libc_mini_shared_SOURCES=" lib/mes/eputs.c lib/mes/oputs.c " if test $mes_libc = mes; then libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES lib/mes/globals.c lib/stdlib/exit.c lib/$mes_kernel/$mes_cpu-mes-$compiler/_exit.c lib/$mes_kernel/$mes_cpu-mes-$compiler/_write.c lib/stdlib/puts.c lib/string/strlen.c " if test $mes_kernel = gnu; then libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES lib/gnu/_exit.c lib/gnu/exec-startup-get-data.c lib/gnu/fd-get.c lib/gnu/fd-write.c lib/gnu/io-write.c lib/gnu/_write.c lib/gnu/hurd-start.c lib/gnu/proc-mark-exit.c lib/gnu/syscall.c lib/gnu/task-get-special-port.c lib/gnu/task-terminate.c lib/gnu/vm-statistics.c lib/mach/mach-init.c lib/mach/mach_host_self.S lib/mach/mach_msg_trap.S lib/mach/mach_reply_port.S lib/mach/mach_task_self.S lib/mach/mach_thread_self.S lib/mach/msg.c lib/string/argz-extract.c " fi fi libc_mini_SOURCES="$libc_mini_shared_SOURCES" if test $mes_libc = mes; then libc_mini_SOURCES="$libc_mini_SOURCES lib/mes/mini-write.c " fi libmescc_SOURCES=" lib/mes/globals.c lib/linux/$mes_cpu-mes-$compiler/syscall-internal.c " if test $mes_cpu = arm; then libmescc_SOURCES="$libmescc_SOURCES lib/mes/div.c " fi libmes_SOURCES=" $libc_mini_shared_SOURCES lib/ctype/isnumber.c lib/mes/abtol.c lib/mes/cast.c lib/mes/eputc.c lib/mes/fdgetc.c lib/mes/fdputc.c lib/mes/fdputs.c lib/mes/fdungetc.c lib/mes/itoa.c lib/mes/ltoa.c lib/mes/ltoab.c lib/mes/mes_open.c lib/mes/ntoab.c lib/mes/oputc.c lib/mes/ultoa.c lib/mes/utoa.c lib/stub/__raise.c " if test $mes_libc = mes; then libmes_SOURCES="$libmes_SOURCES lib/ctype/isdigit.c lib/ctype/isspace.c lib/ctype/isxdigit.c lib/mes/assert_msg.c lib/posix/write.c lib/stdlib/atoi.c " if test $mes_kernel = gnu; then libmes_SOURCES="$libmes_SOURCES lib/stub/lseek.c " fi if test $mes_kernel = linux; then libmes_SOURCES="$libmes_SOURCES lib/linux/lseek.c " fi else libmes_SOURCES="$libmes_SOURCES lib/mes/abtod.c lib/mes/dtoab.c " fi libc_SOURCES=" $libmes_SOURCES lib/mes/__assert_fail.c lib/mes/__buffered_read.c lib/mes/__mes_debug.c lib/posix/execv.c lib/posix/getcwd.c lib/posix/getenv.c lib/posix/isatty.c lib/posix/open.c lib/posix/buffered-read.c lib/posix/setenv.c lib/posix/wait.c lib/stdio/fgetc.c lib/stdio/fputc.c lib/stdio/fputs.c lib/stdio/getc.c lib/stdio/getchar.c lib/stdio/putc.c lib/stdio/putchar.c lib/stdio/ungetc.c lib/stdlib/free.c lib/stdlib/realloc.c lib/string/memchr.c lib/string/memcmp.c lib/string/memcpy.c lib/string/memmove.c lib/string/memset.c lib/string/strcmp.c lib/string/strcpy.c lib/string/strncmp.c lib/posix/raise.c " if test $mes_kernel = gnu; then libc_SOURCES="$libc_SOURCES lib/gnu/_open3.c lib/gnu/_read.c lib/gnu/dir-lookup.c lib/gnu/fd-read.c lib/gnu/io-read.c lib/gnu/malloc.c lib/gnu/vm-allocate.c lib/stub/access.c lib/stub/brk.c lib/stub/chmod.c lib/stub/clock_gettime.c lib/stub/dup2.c lib/stub/dup.c lib/stub/execve.c lib/stub/fork.c lib/stub/_getcwd.c lib/stub/gettimeofday.c lib/stub/ioctl3.c lib/stub/time.c lib/stub/unlink.c lib/stub/waitpid.c " fi if test $mes_kernel = linux; then libc_SOURCES="$libc_SOURCES lib/linux/access.c lib/linux/brk.c lib/linux/chmod.c lib/linux/clock_gettime.c lib/linux/dup.c lib/linux/dup2.c lib/linux/execve.c lib/linux/fork.c lib/linux/fsync.c lib/linux/_getcwd.c lib/linux/gettimeofday.c lib/linux/ioctl3.c lib/linux/_open3.c lib/linux/malloc.c lib/linux/_read.c lib/linux/time.c lib/linux/unlink.c lib/linux/waitpid.c lib/linux/$mes_cpu-mes-$compiler/syscall.c lib/linux/getpid.c lib/linux/kill.c " fi libtcc1_SOURCES=" lib/libtcc1.c " if test $mes_cpu = arm; then libtcc1_SOURCES="$libtcc1_SOURCES lib/mes/div.c lib/string/__memcpy.c lib/string/__memmove.c lib/string/__memset.c " fi libc_tcc_SOURCES=" $libc_SOURCES lib/ctype/islower.c lib/ctype/isupper.c lib/ctype/tolower.c lib/ctype/toupper.c lib/mes/abtod.c lib/mes/dtoab.c lib/mes/search-path.c lib/posix/execvp.c lib/stdio/fclose.c lib/stdio/fdopen.c lib/stdio/ferror.c lib/stdio/fflush.c lib/stdio/fopen.c lib/stdio/fprintf.c lib/stdio/fread.c lib/stdio/fseek.c lib/stdio/ftell.c lib/stdio/fwrite.c lib/stdio/printf.c lib/stdio/remove.c lib/stdio/snprintf.c lib/stdio/sprintf.c lib/stdio/sscanf.c lib/stdio/vfprintf.c lib/stdio/vprintf.c lib/stdio/vsnprintf.c lib/stdio/vsprintf.c lib/stdio/vsscanf.c lib/stdlib/calloc.c lib/stdlib/qsort.c lib/stdlib/strtod.c lib/stdlib/strtof.c lib/stdlib/strtol.c lib/stdlib/strtold.c lib/stdlib/strtoll.c lib/stdlib/strtoul.c lib/stdlib/strtoull.c lib/string/memmem.c lib/string/strcat.c lib/string/strchr.c lib/string/strlwr.c lib/string/strncpy.c lib/string/strrchr.c lib/string/strstr.c lib/string/strupr.c lib/stub/sigaction.c lib/stub/ldexp.c lib/stub/mprotect.c lib/stub/localtime.c lib/stub/sigemptyset.c lib/$mes_cpu-mes-$compiler/setjmp.c " if test $mes_kernel = linux; then libc_tcc_SOURCES="$libc_tcc_SOURCES lib/linux/close.c lib/linux/rmdir.c lib/linux/stat.c " fi if test $mes_kernel = gnu; then libc_tcc_SOURCES="$libc_tcc_SOURCES lib/stub/close.c lib/stub/rmdir.c lib/stub/stat.c " fi libc_gnu_SOURCES=" $libc_tcc_SOURCES lib/ctype/isalnum.c lib/ctype/isalpha.c lib/ctype/isascii.c lib/ctype/iscntrl.c lib/ctype/isgraph.c lib/ctype/isprint.c lib/ctype/ispunct.c lib/dirent/__getdirentries.c lib/dirent/closedir.c lib/dirent/opendir.c lib/dirent/readdir.c lib/math/ceil.c lib/math/fabs.c lib/math/floor.c lib/mes/fdgets.c lib/posix/alarm.c lib/posix/execl.c lib/posix/execlp.c lib/posix/mktemp.c lib/posix/sbrk.c lib/posix/sleep.c lib/posix/unsetenv.c lib/stdio/clearerr.c lib/stdio/feof.c lib/stdio/fgets.c lib/stdio/fileno.c lib/stdio/freopen.c lib/stdio/fscanf.c lib/stdio/perror.c lib/stdio/vfscanf.c lib/stdlib/__exit.c lib/stdlib/abort.c lib/stdlib/abs.c lib/stdlib/alloca.c lib/stdlib/atexit.c lib/stdlib/atof.c lib/stdlib/atol.c lib/stdlib/mbstowcs.c lib/string/bcmp.c lib/string/bcopy.c lib/string/bzero.c lib/string/index.c lib/string/rindex.c lib/string/strcspn.c lib/string/strdup.c lib/string/strerror.c lib/string/strncat.c lib/string/strpbrk.c lib/string/strspn.c lib/stub/__cleanup.c lib/stub/atan2.c lib/stub/bsearch.c lib/stub/chown.c lib/stub/cos.c lib/stub/ctime.c lib/stub/exp.c lib/stub/fpurge.c lib/stub/freadahead.c lib/stub/frexp.c lib/stub/getgrgid.c lib/stub/getgrnam.c lib/stub/getlogin.c lib/stub/getpgid.c lib/stub/getpgrp.c lib/stub/getpwnam.c lib/stub/getpwuid.c lib/stub/gmtime.c lib/stub/log.c lib/stub/mktime.c lib/stub/modf.c lib/stub/pclose.c lib/stub/popen.c lib/stub/pow.c lib/stub/rand.c lib/stub/rewind.c lib/stub/setbuf.c lib/stub/setgrent.c lib/stub/setlocale.c lib/stub/setvbuf.c lib/stub/sigaddset.c lib/stub/sigblock.c lib/stub/sigdelset.c lib/stub/sigsetmask.c lib/stub/sin.c lib/stub/sqrt.c lib/stub/strftime.c lib/stub/sys_siglist.c lib/stub/system.c lib/stub/times.c lib/stub/ttyname.c lib/stub/umask.c lib/stub/utime.c " if test $mes_kernel = linux; then libc_gnu_SOURCES="$libc_gnu_SOURCES lib/linux/chdir.c lib/linux/fcntl.c lib/linux/fstat.c lib/linux/getdents.c lib/linux/getegid.c lib/linux/geteuid.c lib/linux/getgid.c lib/linux/getppid.c lib/linux/getrusage.c lib/linux/getuid.c lib/linux/ioctl.c lib/linux/link.c lib/linux/lstat.c lib/linux/mkdir.c lib/linux/mknod.c lib/linux/nanosleep.c lib/linux/pipe.c lib/linux/readlink.c lib/linux/rename.c lib/linux/setgid.c lib/linux/settimer.c lib/linux/setuid.c lib/linux/signal.c lib/linux/sigprogmask.c lib/linux/symlink.c " fi mes_SOURCES=" src/builtins.c src/cc.c src/core.c src/display.c src/eval-apply.c src/gc.c src/globals.c src/hash.c src/lib.c src/math.c src/mes.c src/module.c src/posix.c src/reader.c src/stack.c src/string.c src/struct.c src/symbol.c src/vector.c " mes-0.24.2/build-aux/export.make0000644000000000000000000000454214372371517013342 0ustar # GNU Mes --- Maxwell Equations of Software # Copyright © 2018 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . export PACKAGE export PACKAGE_NAME export PACKAGE_BUGREPORT export VERSION export abs_top_builddir export abs_top_srcdir export top_builddir export config.make export srcdest export srcdir export prefix export datadir export docdir export bindir export guile_site_ccache_dir export guile_site_dir export infodir export libdir export mandir export moduledir export sysconfdir export bootstrap export compiler export courageous export mes_system export mes_cpu export mes_bits export mes_libc export mes_kernel export stage0_cpu ifdef V export V endif ifdef DESTDIR export DESTDIR endif ifdef CC export CC endif ifdef BLOOD_ELF export BLOOD_ELF endif ifdef DOT export DOT endif ifdef M1 export M1 endif ifdef MES export MES endif ifdef MES_FOR_BUILD export MES_FOR_BUILD endif ifdef MESCC export MESCC endif ifdef HEX2 export HEX2 endif ifdef HELP2MAN export HELP2MAN endif ifdef GUILE export GUILE endif ifdef GUILD export GUILD endif ifdef GUIX export GUIX endif ifdef PERL export PERL endif ifdef SCHEME export SCHEME endif ifdef SHELL export SHELL endif ifdef GUILD_OPTIMIZE export GUILD_OPTIMIZE endif ifdef GUILE_LOAD_PATH export GUILE_LOAD_PATH endif ifdef GUILE_LOAD_COMPILED_PATH export GUILE_LOAD_COMPILED_PATH endif ifdef AM_CFLAGS export AM_CFLAGS endif ifdef AM_CPPFLAGS export AM_CPPFLAGS endif ifdef AM_LDFLAGS export AM_LDFLAGS endif ifdef CFLAGS export CFLAGS endif ifdef CPPFLAGS export CPPFLAGS endif ifdef LDFLAGS export LDFLAGS endif ifdef HEX2FLAGS export HEX2FLAGS endif ifdef M1FLAGS export M1FLAGS endif ifdef TESTS export TESTS endif ifdef XFAIL_TESTS export XFAIL_TESTS endif mes-0.24.2/build-aux/gendocs.sh0000755000000000000000000004142514372371517013144 0ustar #!/bin/sh -e # gendocs.sh -- generate a GNU manual in many formats. This script is # mentioned in maintain.texi. See the help message below for usage details. scriptversion=2018-03-06.19 # Copyright 2003-2018 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Original author: Mohit Agarwal. # Send bug reports and any other correspondence to bug-gnulib@gnu.org. # # The latest version of this script, and the companion template, is # available from the Gnulib repository: # # https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh # https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template # TODO: # - image importing was only implemented for HTML generated by # makeinfo. But it should be simple enough to adjust. # - images are not imported in the source tarball. All the needed # formats (PDF, PNG, etc.) should be included. prog=`basename "$0"` srcdir=`pwd` scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh" templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template" : ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="} : ${MAKEINFO="makeinfo"} : ${TEXI2DVI="texi2dvi"} : ${DOCBOOK2HTML="docbook2html"} : ${DOCBOOK2PDF="docbook2pdf"} : ${DOCBOOK2TXT="docbook2txt"} : ${GENDOCS_TEMPLATE_DIR="."} : ${PERL='perl'} : ${TEXI2HTML="texi2html"} unset CDPATH unset use_texi2html MANUAL_TITLE= PACKAGE= EMAIL=webmasters@gnu.org # please override with --email commonarg= # passed to all makeinfo/texi2html invcations. dirargs= # passed to all tools (-I dir). dirs= # -I directories. htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual" default_htmlarg=true infoarg=--no-split generate_ascii=true generate_html=true generate_info=true generate_tex=true outdir=manual source_extra= split=node srcfile= texarg="-t @finalout" version="gendocs.sh $scriptversion Copyright 2018 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE Generate output in various formats from PACKAGE.texinfo (or .texi or .txi) source. See the GNU Maintainers document for a more extensive discussion: https://www.gnu.org/prep/maintain_toc.html Options: --email ADR use ADR as contact in generated web pages; always give this. -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi} -o OUTDIR write files into OUTDIR, instead of manual/. -I DIR append DIR to the Texinfo search path. --common ARG pass ARG in all invocations. --html ARG pass ARG to makeinfo or texi2html for HTML targets, instead of '$htmlarg'. --info ARG pass ARG to makeinfo for Info, instead of --no-split. --no-ascii skip generating the plain text output. --no-html skip generating the html output. --no-info skip generating the info output. --no-tex skip generating the dvi and pdf output. --source ARG include ARG in tar archive of sources. --split HOW make split HTML by node, section, chapter; default node. --tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout. --texi2html use texi2html to make HTML target, with all split versions. --docbook convert through DocBook too (xml, txt, html, pdf). --help display this help and exit successfully. --version display version information and exit successfully. Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\" Typical sequence: cd PACKAGESOURCE/doc wget \"$scripturl\" wget \"$templateurl\" $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\" Output will be in a new subdirectory \"manual\" (by default; use -o OUTDIR to override). Move all the new files into your web CVS tree, as explained in the Web Pages node of maintain.texi. Please use the --email ADDRESS option so your own bug-reporting address will be used in the generated HTML pages. MANUAL-TITLE is included as part of the HTML of the overall manual/index.html file. It should include the name of the package being documented. manual/index.html is created by substitution from the file $GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the generic template for your own purposes.) If you have several manuals, you'll need to run this script several times with different MANUAL values, specifying a different output directory with -o each time. Then write (by hand) an overall index.html with links to them all. If a manual's Texinfo sources are spread across several directories, first copy or symlink all Texinfo sources into a single directory. (Part of the script's work is to make a tar.gz of the sources.) As implied above, by default monolithic Info files are generated. If you want split Info, or other Info options, use --info to override. You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML, and PERL to control the programs that get executed, and GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is looked for. With --docbook, the environment variables DOCBOOK2HTML, DOCBOOK2PDF, and DOCBOOK2TXT are also consulted. By default, makeinfo and texi2dvi are run in the default (English) locale, since that's the language of most Texinfo manuals. If you happen to have a non-English manual and non-English web site, see the SETLANG setting in the source. Email bug reports or enhancement requests to bug-gnulib@gnu.org. " while test $# -gt 0; do case $1 in -s) shift; srcfile=$1;; -o) shift; outdir=$1;; -I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";; --common) shift; commonarg=$1;; --docbook) docbook=yes;; --email) shift; EMAIL=$1;; --html) shift; default_htmlarg=false; htmlarg=$1;; --info) shift; infoarg=$1;; --no-ascii) generate_ascii=false;; --no-html) generate_ascii=false;; --no-info) generate_info=false;; --no-tex) generate_tex=false;; --source) shift; source_extra=$1;; --split) shift; split=$1;; --tex) shift; texarg=$1;; --texi2html) use_texi2html=1;; --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; -*) echo "$0: Unknown option \`$1'." >&2 echo "$0: Try \`--help' for more information." >&2 exit 1;; *) if test -z "$PACKAGE"; then PACKAGE=$1 elif test -z "$MANUAL_TITLE"; then MANUAL_TITLE=$1 else echo "$0: extra non-option argument \`$1'." >&2 exit 1 fi;; esac shift done # makeinfo uses the dirargs, but texi2dvi doesn't. commonarg=" $dirargs $commonarg" # For most of the following, the base name is just $PACKAGE base=$PACKAGE if $default_htmlarg && test -n "$use_texi2html"; then # The legacy texi2html doesn't support TOP_NODE_UP_URL htmlarg="--css-ref=/software/gnulib/manual.css" fi if test -n "$srcfile"; then # but here, we use the basename of $srcfile base=`basename "$srcfile"` case $base in *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;; esac PACKAGE=$base elif test -s "$srcdir/$PACKAGE.texinfo"; then srcfile=$srcdir/$PACKAGE.texinfo elif test -s "$srcdir/$PACKAGE.texi"; then srcfile=$srcdir/$PACKAGE.texi elif test -s "$srcdir/$PACKAGE.txi"; then srcfile=$srcdir/$PACKAGE.txi else echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2 exit 1 fi if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2 echo "$0: it is available from $templateurl." >&2 exit 1 fi # Function to return size of $1 in something resembling kilobytes. calcsize() { size=`ls -ksl $1 | awk '{print $1}'` echo $size } # copy_images OUTDIR HTML-FILE... # ------------------------------- # Copy all the images needed by the HTML-FILEs into OUTDIR. # Look for them in . and the -I directories; this is simpler than what # makeinfo supports with -I, but hopefully it will suffice. copy_images() { local odir odir=$1 shift $PERL -n -e " BEGIN { \$me = '$prog'; \$odir = '$odir'; @dirs = qw(. $dirs); } " -e ' /<img src="(.*?)"/g && ++$need{$1}; END { #print "$me: @{[keys %need]}\n"; # for debugging, show images found. FILE: for my $f (keys %need) { for my $d (@dirs) { if (-f "$d/$f") { use File::Basename; my $dest = dirname ("$odir/$f"); # use File::Path; -d $dest || mkpath ($dest) || die "$me: cannot mkdir $dest: $!\n"; # use File::Copy; copy ("$d/$f", $dest) || die "$me: cannot copy $d/$f to $dest: $!\n"; next FILE; } } die "$me: $ARGV: cannot find image $f\n"; } } ' -- "$@" || exit 1 } case $outdir in /*) abs_outdir=$outdir;; *) abs_outdir=$srcdir/$outdir;; esac echo "Making output for $srcfile" echo " in `pwd`" mkdir -p "$outdir/" # if $generate_info; then cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\"" echo "Generating info... ($cmd)" rm -f $PACKAGE.info* # get rid of any strays eval "$cmd" tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info* ls -l "$outdir/$PACKAGE.info.tar.gz" info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"` # do not mv the info files, there's no point in having them available # separately on the web. fi # end info # if $generate_tex; then cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\"" printf "\nGenerating dvi... ($cmd)\n" eval "$cmd" # compress/finish dvi: gzip -f -9 $PACKAGE.dvi dvi_gz_size=`calcsize $PACKAGE.dvi.gz` mv $PACKAGE.dvi.gz "$outdir/" ls -l "$outdir/$PACKAGE.dvi.gz" cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\"" printf "\nGenerating pdf... ($cmd)\n" eval "$cmd" pdf_size=`calcsize $PACKAGE.pdf` mv $PACKAGE.pdf "$outdir/" ls -l "$outdir/$PACKAGE.pdf" fi # end tex (dvi + pdf) # if $generate_ascii; then opt="-o $PACKAGE.txt --no-split --no-headers $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" printf "\nGenerating ascii... ($cmd)\n" eval "$cmd" ascii_size=`calcsize $PACKAGE.txt` gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz" ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"` mv $PACKAGE.txt "$outdir/" ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz" fi # if $generate_html; then # Split HTML at level $1. Used for texi2html. html_split() { opt="--split=$1 --node-files $commonarg $htmlarg" cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\"" printf "\nGenerating html by $1... ($cmd)\n" eval "$cmd" split_html_dir=$PACKAGE.html ( cd ${split_html_dir} || exit 1 ln -sf ${PACKAGE}.html index.html tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html ) eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"` rm -f "$outdir"/html_$1/*.html mkdir -p "$outdir/html_$1/" mv ${split_html_dir}/*.html "$outdir/html_$1/" rmdir ${split_html_dir} } if test -z "$use_texi2html"; then opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" printf "\nGenerating monolithic html... ($cmd)\n" rm -rf $PACKAGE.html # in case a directory is left over eval "$cmd" html_mono_size=`calcsize $PACKAGE.html` gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz" html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"` copy_images "$outdir/" $PACKAGE.html mv $PACKAGE.html "$outdir/" ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz" # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option, # it just always split by node. So if we're splitting by node anyway, # leave it out. if test "x$split" = xnode; then split_arg= else split_arg=--split=$split fi # opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" printf "\nGenerating html by $split... ($cmd)\n" eval "$cmd" split_html_dir=$PACKAGE.html copy_images $split_html_dir/ $split_html_dir/*.html ( cd $split_html_dir || exit 1 tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- * ) eval \ html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"` rm -rf "$outdir/html_$split/" mv $split_html_dir "$outdir/html_$split/" du -s "$outdir/html_$split/" ls -l "$outdir/$PACKAGE.html_$split.tar.gz" else # use texi2html: opt="--output $PACKAGE.html $commonarg $htmlarg" cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\"" printf "\nGenerating monolithic html with texi2html... ($cmd)\n" rm -rf $PACKAGE.html # in case a directory is left over eval "$cmd" html_mono_size=`calcsize $PACKAGE.html` gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz" html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"` mv $PACKAGE.html "$outdir/" html_split node html_split chapter html_split section fi fi # end html # printf "\nMaking .tar.gz for sources...\n" d=`dirname $srcfile` ( cd "$d" srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles ls -l "$abs_outdir/$PACKAGE.texi.tar.gz" ) texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"` # # Do everything again through docbook. if test -n "$docbook"; then opt="-o - --docbook $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml" printf "\nGenerating docbook XML... ($cmd)\n" eval "$cmd" docbook_xml_size=`calcsize $PACKAGE-db.xml` gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz" docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"` mv $PACKAGE-db.xml "$outdir/" split_html_db_dir=html_node_db opt="$commonarg -o $split_html_db_dir" cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\"" printf "\nGenerating docbook HTML... ($cmd)\n" eval "$cmd" ( cd ${split_html_db_dir} || exit 1 tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html ) html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"` rm -f "$outdir"/html_node_db/*.html mkdir -p "$outdir/html_node_db" mv ${split_html_db_dir}/*.html "$outdir/html_node_db/" rmdir ${split_html_db_dir} cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\"" printf "\nGenerating docbook ASCII... ($cmd)\n" eval "$cmd" docbook_ascii_size=`calcsize $PACKAGE-db.txt` mv $PACKAGE-db.txt "$outdir/" cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\"" printf "\nGenerating docbook PDF... ($cmd)\n" eval "$cmd" docbook_pdf_size=`calcsize $PACKAGE-db.pdf` mv $PACKAGE-db.pdf "$outdir/" fi # printf "\nMaking index.html for $PACKAGE...\n" if test -z "$use_texi2html"; then CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\ /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d" else # should take account of --split here. CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d" fi curdate=`$SETLANG date '+%B %d, %Y'` sed \ -e "s!%%TITLE%%!$MANUAL_TITLE!g" \ -e "s!%%EMAIL%%!$EMAIL!g" \ -e "s!%%PACKAGE%%!$PACKAGE!g" \ -e "s!%%DATE%%!$curdate!g" \ -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \ -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \ -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \ -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \ -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \ -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \ -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \ -e "s!%%PDF_SIZE%%!$pdf_size!g" \ -e "s!%%ASCII_SIZE%%!$ascii_size!g" \ -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \ -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \ -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \ -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \ -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \ -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \ -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \ -e "s,%%SCRIPTURL%%,$scripturl,g" \ -e "s!%%SCRIPTNAME%%!$prog!g" \ -e "$CONDS" \ $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html" echo "Done, see $outdir/ subdirectory for new files." # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/gitlog-to-changelog������������������������������������������������������������0000755�0000000�0000000�00000036440�14372371517�014744� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������eval '(exit $?0)' && eval 'exec perl -wS "$0" "$@"' & eval 'exec perl -wS "$0" $argv:q' if 0; # Convert git log output to ChangeLog format. my $VERSION = '2019-12-08 20:13'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook # do its job. Otherwise, update this string manually. # Copyright (C) 2008-2016 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Written by Jim Meyering use strict; use warnings; use Getopt::Long; use POSIX qw(strftime); (my $ME = $0) =~ s|.*/||; # use File::Coda; # http://meyering.net/code/Coda/ END { defined fileno STDOUT or return; close STDOUT and return; warn "$ME: failed to close standard output: $!\n"; $? ||= 1; } sub usage ($) { my ($exit_code) = @_; my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); if ($exit_code != 0) { print $STREAM "Try '$ME --help' for more information.\n"; } else { print $STREAM <<EOF; Usage: $ME [OPTIONS] [ARGS] Convert git log output to ChangeLog format. If present, any ARGS are passed to "git log". To avoid ARGS being parsed as options to $ME, they may be preceded by '--'. OPTIONS: --amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that makes a change to SHA1's commit log text or metadata. --append-dot append a dot to the first line of each commit message if there is no other punctuation or blank at the end. --no-cluster never cluster commit messages under the same date/author header; the default is to cluster adjacent commit messages if their headers are the same and neither commit message contains multiple paragraphs. --srcdir=DIR the root of the source tree, from which the .git/ directory can be derived. --since=DATE convert only the logs since DATE; the default is to convert all log entries. --until=DATE convert only the logs older than DATE. --ignore-matching=PAT ignore commit messages whose first lines match PAT. --ignore-line=PAT ignore lines of commit messages that match PAT. --format=FMT set format string for commit subject and body; see 'man git-log' for the list of format metacharacters; the default is '%s%n%b%n' --strip-tab remove one additional leading TAB from commit message lines. --strip-cherry-pick remove data inserted by "git cherry-pick"; this includes the "cherry picked from commit ..." line, and the possible final "Conflicts:" paragraph. --help display this help and exit --version output version information and exit EXAMPLE: $ME --since=2008-01-01 > ChangeLog $ME -- -n 5 foo > last-5-commits-to-branch-foo SPECIAL SYNTAX: The following types of strings are interpreted specially when they appear at the beginning of a log message line. They are not copied to the output. Copyright-paperwork-exempt: Yes Append the "(tiny change)" notation to the usual "date name email" ChangeLog header to mark a change that does not require a copyright assignment. Co-authored-by: Joe User <user\@example.com> List the specified name and email address on a second ChangeLog header, denoting a co-author. Signed-off-by: Joe User <user\@example.com> These lines are simply elided. In a FILE specified via --amend, comment lines (starting with "#") are ignored. FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on a line) referring to a commit in the current project, and CODE refers to one or more consecutive lines of Perl code. Pairs must be separated by one or more blank line. Here is sample input for use with --amend=FILE, from coreutils: 3a169f4c5d9159283548178668d2fae6fced3030 # fix typo in title: s/all tile types/all file types/ 1379ed974f1fa39b12e2ffab18b3f7a607082202 # Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself. # Change the author to be Paul. Note the escaped "@": s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>, EOF } exit $exit_code; } # If the string $S is a well-behaved file name, simply return it. # If it contains white space, quotes, etc., quote it, and return the new string. sub shell_quote($) { my ($s) = @_; if ($s =~ m![^\w+/.,-]!) { # Convert each single quote to '\'' $s =~ s/\'/\'\\\'\'/g; # Then single quote the string. $s = "'$s'"; } return $s; } sub quoted_cmd(@) { return join (' ', map {shell_quote $_} @_); } # Parse file F. # Comment lines (starting with "#") are ignored. # F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 # (alone on a line) referring to a commit in the current project, and # CODE refers to one or more consecutive lines of Perl code. # Pairs must be separated by one or more blank line. sub parse_amend_file($) { my ($f) = @_; open F, '<', $f or die "$ME: $f: failed to open for reading: $!\n"; my $fail; my $h = {}; my $in_code = 0; my $sha; while (defined (my $line = <F>)) { $line =~ /^\#/ and next; chomp $line; $line eq '' and $in_code = 0, next; if (!$in_code) { $line =~ /^([0-9a-fA-F]{40})$/ or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"), $fail = 1, next; $sha = lc $1; $in_code = 1; exists $h->{$sha} and (warn "$ME: $f:$.: duplicate SHA1\n"), $fail = 1, next; } else { $h->{$sha} ||= ''; $h->{$sha} .= "$line\n"; } } close F; $fail and exit 1; return $h; } # git_dir_option $SRCDIR # # From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR # is undef). Return as a list (0 or 1 element). sub git_dir_option($) { my ($srcdir) = @_; my @res = (); if (defined $srcdir) { my $qdir = shell_quote $srcdir; my $cmd = "cd $qdir && git rev-parse --show-toplevel"; my $qcmd = shell_quote $cmd; my $git_dir = qx($cmd); defined $git_dir or die "$ME: cannot run $qcmd: $!\n"; $? == 0 or die "$ME: $qcmd had unexpected exit code or signal ($?)\n"; chomp $git_dir; push @res, "--git-dir=$git_dir/.git"; } @res; } { my $since_date; my $until_date; my $format_string = '%s%n%b%n'; my $amend_file; my $append_dot = 0; my $cluster = 1; my $ignore_matching; my $ignore_line; my $strip_tab = 0; my $strip_cherry_pick = 0; my $srcdir; GetOptions ( help => sub { usage 0 }, version => sub { print "$ME version $VERSION\n"; exit }, 'since=s' => \$since_date, 'until=s' => \$until_date, 'format=s' => \$format_string, 'amend=s' => \$amend_file, 'append-dot' => \$append_dot, 'cluster!' => \$cluster, 'ignore-matching=s' => \$ignore_matching, 'ignore-line=s' => \$ignore_line, 'strip-tab' => \$strip_tab, 'strip-cherry-pick' => \$strip_cherry_pick, 'srcdir=s' => \$srcdir, ) or usage 1; defined $since_date and unshift @ARGV, "--since=$since_date"; defined $until_date and unshift @ARGV, "--until=$until_date"; # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/) # that makes a correction in the log or attribution of that commit. my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {}; my @cmd = ('git', git_dir_option $srcdir, qw(log --log-size), '--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV); open PIPE, '-|', @cmd or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n" . "(Is your Git too old? Version 1.5.1 or later is required.)\n"); my $prev_multi_paragraph; my $prev_date_line = ''; my @prev_coauthors = (); my @skipshas = (); while (1) { defined (my $in = <PIPE>) or last; $in =~ /^log size (\d+)$/ or die "$ME:$.: Invalid line (expected log size):\n$in"; my $log_nbytes = $1; my $log; my $n_read = read PIPE, $log, $log_nbytes; $n_read == $log_nbytes or die "$ME:$.: unexpected EOF\n"; # Extract leading hash. my ($sha, $rest) = split ':', $log, 2; defined $sha or die "$ME:$.: malformed log entry\n"; $sha =~ /^[0-9a-fA-F]{40}$/ or die "$ME:$.: invalid SHA1: $sha\n"; my $skipflag = 0; if (@skipshas) { foreach(@skipshas) { if ($sha =~ /^$_/) { $skipflag = $_; last; } } } # If this commit's log requires any transformation, do it now. my $code = $amend_code->{$sha}; if (defined $code) { eval 'use Safe'; my $s = new Safe; # Put the unpreprocessed entry into "$_". $_ = $rest; # Let $code operate on it, safely. my $r = $s->reval("$code") or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n"; # Note that we've used this entry. delete $amend_code->{$sha}; # Update $rest upon success. $rest = $_; } # Remove lines inserted by "git cherry-pick". if ($strip_cherry_pick) { $rest =~ s/^\s*Conflicts:\n.*//sm; $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; } my @line = split /[ \t]*\n/, $rest; my $author_line = shift @line; defined $author_line or die "$ME:$.: unexpected EOF\n"; $author_line =~ /^(\d+) (.*>)$/ or die "$ME:$.: Invalid line " . "(expected date/author/email):\n$author_line\n"; # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog # `(tiny change)' annotation. my $tiny = (grep (/^(?:Copyright-paperwork-exempt|Tiny-change):\s+[Yy]es$/, @line) ? ' (tiny change)' : ''); my $date_line = sprintf "%s %s$tiny\n", strftime ("%Y-%m-%d", gmtime ($1)), $2; my @coauthors = grep /^Co-authored-by:.*$/, @line; # Omit meta-data lines we've already interpreted. @line = grep !/^(?:Signed-off-by:[ ].*>$ |Co-authored-by:[ ] |Copyright-paperwork-exempt:[ ] |Tiny-change:[ ] )/x, @line; # Remove leading and trailing blank lines. if (@line) { while ($line[0] =~ /^\s*$/) { shift @line; } while ($line[$#line] =~ /^\s*$/) { pop @line; } } # Handle Emacs gitmerge.el "skipped" commits. # Yes, this should be controlled by an option. So sue me. if ( grep /^(; )?Merge from /, @line ) { my $found = 0; foreach (@line) { if (grep /^The following commit.*skipped:$/, $_) { $found = 1; ## Reset at each merge to reduce chance of false matches. @skipshas = (); next; } if ($found && $_ =~ /^([0-9a-fA-F]{7,}) [^ ]/) { push ( @skipshas, $1 ); } } } # Ignore commits that match the --ignore-matching pattern, if specified. if (defined $ignore_matching && @line && $line[0] =~ /$ignore_matching/) { $skipflag = 1; } elsif ($skipflag) { ## Perhaps only warn if a pattern matches more than once? warn "$ME: warning: skipping $sha due to $skipflag\n"; } if (! $skipflag) { if (defined $ignore_line && @line) { @line = grep ! /$ignore_line/, @line; while ($line[$#line] =~ /^\s*$/) { pop @line; } } # Record whether there are two or more paragraphs. my $multi_paragraph = grep /^\s*$/, @line; # Format 'Co-authored-by: A U Thor <email@example.com>' lines in # standard multi-author ChangeLog format. for (@coauthors) { s/^Co-authored-by:\s*/\t /; s/\s*</ </; /<.*?@.*\..*>/ or warn "$ME: warning: missing email address for " . substr ($_, 5) . "\n"; } # If clustering of commit messages has been disabled, if this header # would be different from the previous date/name/etc. header, # or if this or the previous entry consists of two or more paragraphs, # then print the header. if ( ! $cluster || $date_line ne $prev_date_line || "@coauthors" ne "@prev_coauthors" || $multi_paragraph || $prev_multi_paragraph) { $prev_date_line eq '' or print "\n"; print $date_line; @coauthors and print join ("\n", @coauthors), "\n"; } $prev_date_line = $date_line; @prev_coauthors = @coauthors; $prev_multi_paragraph = $multi_paragraph; # If there were any lines if (@line == 0) { warn "$ME: warning: empty commit message:\n $date_line\n"; } else { if ($append_dot) { # If the first line of the message has enough room, then if (length $line[0] < 72) { # append a dot if there is no other punctuation or blank # at the end. $line[0] =~ /[[:punct:]\s]$/ or $line[0] .= '.'; } } # Remove one additional leading TAB from each line. $strip_tab and map { s/^\t// } @line; # Prefix each non-empty line with a TAB. @line = map { length $_ ? "\t$_" : '' } @line; print "\n", join ("\n", @line), "\n"; } } defined ($in = <PIPE>) or last; $in ne "\n" and die "$ME:$.: unexpected line:\n$in"; } close PIPE or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n"; # FIXME-someday: include $PROCESS_STATUS in the diagnostic # Complain about any unused entry in the --amend=F specified file. my $fail = 0; foreach my $sha (keys %$amend_code) { warn "$ME:$amend_file: unused entry: $sha\n"; $fail = 1; } exit $fail; } # Local Variables: # mode: perl # indent-tabs-mode: nil # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "my $VERSION = '" # time-stamp-format: "%:y-%02m-%02d %02H:%02M" # time-stamp-time-zone: "UTC0" # time-stamp-end: "'; # UTC" # End: ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/indent.sh����������������������������������������������������������������������0000755�0000000�0000000�00000001611�14372371517�012774� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. for i in $(find . -name '*.c' -o -name '*.h' -o -name '*.i'); do indent $i --no-tabs --line-length 110 --honour-newlines; done �����������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/install.sh.in������������������������������������������������������������������0000644�0000000�0000000�00000007454�14372371517�013576� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! @SHELL@ # GNU Mes --- Maxwell Equations of Software # Copyright © 2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. set -e . ./config.sh v= _v= if test "$V" = 2; then set -x fi if test -n "$V"; then if test "$V" -gt 0; then v=v _v=-v fi fi set -u # Use bash or lose if pipes fail if test -n "$BASHOPTS"; then set -o pipefail fi DESTDIR=${DESTDIR-} mkdir -p ${DESTDIR}${bindir} cp $_v bin/mes ${DESTDIR}${bindir}/mes if test -f bin/mes-gcc; then cp $_v bin/mes-gcc ${DESTDIR}${bindir}/mes-gcc fi if test -f bin/mes-m2; then cp $_v bin/mes-m2 ${DESTDIR}${bindir}/mes-m2 fi if test -f bin/mes-mescc; then cp $_v bin/mes-mescc ${DESTDIR}${bindir}/mes-mescc fi cp $_v scripts/mesar ${DESTDIR}${bindir}/mesar cp $_v scripts/mescc.scm ${DESTDIR}${bindir}/mescc.scm cp $_v scripts/mescc ${DESTDIR}${bindir}/mescc sed \ -e "s,^#! /bin/sh,#! ${SHELL}," \ scripts/diff.scm > ${DESTDIR}${bindir}/diff.scm chmod +x ${DESTDIR}${bindir}/diff.scm mkdir -p ${DESTDIR}${docdir} if test -n "${PERL}"\ && test -n "${GIT}"\ && ${PERL} -v > /dev/null\ && ! test -f .git-for-build; then ${PERL} ${srcdest}build-aux/gitlog-to-changelog --srcdir=. > ChangeLog+ fi cp\ AUTHORS\ BOOTSTRAP\ COPYING\ HACKING\ NEWS\ README\ ROADMAP\ ${DESTDIR}${docdir} if test -f ChangeLog+; then cp $_v ChangeLog+ ${DESTDIR}${docdir}/ChangeLog rm -f ChangeLog+ else cp $_v ChangeLog ${DESTDIR}${docdir} fi __exclude_go= __exclude_scm= if test -f module/mescc.go; then __exclude_go=--exclude='*.go' __exclude_scm=--exclude='*.scm' fi mkdir -p $DESTDIR$includedir mkdir -p $DESTDIR$libdir mkdir -p $DESTDIR$pkgdatadir tar -cf- -C ${srcdir}/include . | tar -${v}xf- -C $DESTDIR$includedir tar -cf- -C include . | tar -${v}xf- -C $DESTDIR$includedir tar -cf- -C ${srcdir}/lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir tar -cf- -C ${srcdir}/lib $mes_kernel/$mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir if test -z "$srcdest"; then tar -cf- $__exclude_go module | tar -${v}xf- -C $DESTDIR$pkgdatadir else tar -cf- -C ${srcdest} module | tar -${v}xf- -C $DESTDIR$pkgdatadir fi tar -cf- -C ${srcdest}mes module | tar -${v}xf- -C $DESTDIR$pkgdatadir if test -d gcc-lib/$mes_cpu-mes; then tar -cf- -C gcc-lib/$mes_cpu-mes . | tar -${v}xf- -C $DESTDIR$libdir fi if test -d mescc-lib/$mes_cpu-mes; then tar -cf- -C mescc-lib $mes_cpu-mes | tar -${v}xf- -C $DESTDIR$libdir fi mkdir -p ${DESTDIR}${guile_site_dir} mkdir -p ${DESTDIR}${guile_site_ccache_dir} tar -cf- -C ${srcdest}module $__exclude_go . | tar -${v}xf- -C ${DESTDIR}${guile_site_dir} tar -cf- -C module $__exclude_scm . | tar -${v}xf- -C ${DESTDIR}${guile_site_ccache_dir} if test -f doc/mes.info; then mkdir -p ${DESTDIR}${infodir} tar -cf- doc/mes.info* doc/images | tar -${v}xf- --strip-components=1 -C ${DESTDIR}${infodir} install-info --info-dir=${DESTDIR}${infodir} doc/mes.info fi if test -f doc/mes.1; then mkdir -p ${DESTDIR}${mandir}/man1 cp $_v doc/mes.1 ${DESTDIR}${mandir}/man1/ fi if test -f doc/mescc.1; then mkdir -p ${DESTDIR}${mandir}/man1 cp $_v doc/mescc.1 ${DESTDIR}${mandir}/man1/ fi ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/manifest.scm�������������������������������������������������������������������0000644�0000000�0000000�00000002007�14372371517�013466� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; This file is part of GNU Mes. ;;; ;;; GNU Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. (use-modules (guix packages)) (define %source-dir (dirname (dirname (current-filename)))) (add-to-load-path (string-append %source-dir "/guix")) (use-modules (git mes)) (packages->manifest (map cadr (package-direct-inputs mes))) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/mes-snarf.scm������������������������������������������������������������������0000755�0000000�0000000�00000021271�14372371517�013562� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # -*-scheme-*- exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes-snarf)' -s "$0" "$@" !# ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; ;;; mes-snarf.scm: This file is part of GNU Mes. ;;; ;;; GNU Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. (define-module (mes-snarf) #:use-module (srfi srfi-1) #:use-module (srfi srfi-8) #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (ice-9 rdelim) #:export (main)) (cond-expand (mes (define %scheme "mes")) (guile-2 (define %scheme "guile") (define-macro (mes-use-module . rest) #t)) (guile (use-modules (ice-9 syncase)) (define %scheme "guile") (define-macro (mes-use-module . rest) #t))) (mes-use-module (mes guile)) (mes-use-module (srfi srfi-1)) (mes-use-module (srfi srfi-8)) (mes-use-module (srfi srfi-9)) (mes-use-module (srfi srfi-26)) (when (and=> (getenv "V") (lambda (v) (> (string->number v) 1))) (format (current-error-port) "mes-snarf[~a]...\n" %scheme)) (define (char->char from to char) (if (eq? char from) to char)) (define (string-replace-char string from to) (string-map (cut char->char from to <>) string)) (define (string-replace-suffix string from to) (if (string-suffix? from string) (string-replace string to (- (string-length string) (string-length from))) string)) (define (string-replace-string string from to) (cond ((string-contains string from) => (lambda (i) (string-replace string to i (+ i (string-length from))))) (else string))) (define %gcc? #t) (define-record-type <file> (make-file name content) file? (name file.name) (content file.content)) (define-record-type <function> (make-function name formals annotation) function? (name function.name) (formals function.formals) (annotation function.annotation)) (define (function-scm-name f) (or (assoc-ref (function.annotation f) 'name) (let ((name ((compose identity (cut string-replace-char <> #\_ #\-) (cut string-replace-string <> "_to_" "->") (cut string-replace-suffix <> "_x" "!") (cut string-replace-suffix <> "_x_" "!-") (cut string-replace-suffix <> "_p" "?")) (function.name f)))) (if (not (string-suffix? "-" name)) name (string-append "core:" (string-drop-right name 1)))))) (define %builtin-prefix% "scm_") (define (function-builtin-name f) (string-append %builtin-prefix% (function.name f))) (define %cell-prefix% "cell_") (define (function-cell-name f) (string-append %cell-prefix% (function.name f))) (define %start 1) (define (symbol->header s i) (string-append (format #f "// CONSTANT ~a ~a\n" s i) (format #f "#define ~a ~a\n" s i))) (define (symbol->header s i) (let ((c (string-upcase s))) (string-append (format #f "\n// CONSTANT ~a ~a\n" c i) (format #f "#define ~a ~a\n" c i) (format #f "struct scm *~a; /* ~a */\n" s i)))) (define (function->header f i) (let* ((arity (or (assoc-ref (function.annotation f) 'arity) (if (string-null? (function.formals f)) 0 (length (string-split (function.formals f) #\,))))) (n (if (eq? arity 'n) -1 arity))) (format #f "struct scm *~a (~a);\n" (function.name f) (function.formals f)))) (define (function->source f i) (let* ((arity (or (assoc-ref (function.annotation f) 'arity) (if (string-null? (function.formals f)) 0 (length (string-split (function.formals f) #\,))))) (n (if (eq? arity 'n) -1 arity))) (format #f " a = init_builtin (builtin_type, ~s, ~a, &~a, a);\n" (function-scm-name f) n (function.name f)))) (define (disjoin . predicates) (lambda (. arguments) (any (cut apply <> arguments) predicates))) (define (snarf-symbols string) (let* ((lines (string-split string #\newline)) (symbols (filter (cut string-contains <> " = init_symbol (") lines))) (define (line->symbol line) ((compose string-trim-both (lambda (s) (string-take s (string-index s #\=)))) line)) (map line->symbol symbols))) (define (string-split-string string sep) (cond ((string-contains string sep) => (lambda (i) (list (string-take string i) (string-drop string (+ i (string-length sep)))))) (else (list string #f)))) (define (snarf-functions string) (let ((lines (string-split string #\newline))) (filter-map (lambda (line previous) (receive (function rest) (apply values (string-split-string line " ")) (and function (or (equal? (string-trim previous) "struct scm*") (equal? (string-trim previous) "struct scm *")) (not (string-null? function)) (not (string-prefix? "#" function)) (not (string-prefix? "/" function)) rest (receive (parameter-list annotation) (apply values (string-split-string rest " /*:")) (let* ((parameters (string-trim-both parameter-list)) (parameters (string-drop parameters 1)) (parameters (string-drop-right parameters 1)) (annotation (if (string? annotation) (string-trim-both annotation) annotation)) (annotation (if (and (string? annotation) (string-suffix? "*/" annotation)) (string-drop-right annotation 2) annotation)) (formals (if (string-null? parameters) '() (string-split parameters #\,))) (formals (map string-trim formals))) (and parameters (let* ((non-SCM (filter (negate (cut string-prefix? "struct scm" <>)) formals))) (and (null? non-SCM) (let ((annotation (and annotation (with-input-from-string annotation read)))) (make-function function parameters annotation)))))))))) lines (cons "\n" lines)))) (define (content? f) ((compose not string-null? file.content) f)) (define (internal? f) ((compose (cut assoc-ref <> 'internal) function.annotation) f)) (define (no-environment? f) ((compose (cut assoc-ref <> 'no-environment) function.annotation) f)) (define (generate-includes file-name) (let* ((srcdest (or (getenv "srcdest") "")) (string (with-input-from-file (string-append srcdest file-name) read-string)) (functions (snarf-functions string)) (functions (delete-duplicates functions (lambda (a b) (equal? (function.name a) (function.name b))))) (functions (filter (negate internal?) functions)) (symbols (snarf-symbols string)) (base-name (basename file-name ".c")) (dir (string-append (dirname file-name))) (base-name (string-append dir "/" base-name)) (base-name (if %gcc? base-name (string-append base-name ".mes"))) (header (make-file (string-append base-name ".h") (string-join (map function->header functions (iota (length functions) (+ %start (length symbols)))) ""))) (source (make-file (string-append base-name ".i") (string-join (map function->source (filter (negate no-environment?) functions) (iota (length functions) (+ (length symbols) %start))) ""))) (symbols.h (make-file (string-append base-name ".symbols.h") (string-join (map symbol->header symbols (iota (length symbols) %start)) "")))) (list header source symbols.h))) (define (file-write file) (system* "mkdir" "-p" (dirname (file.name file))) (with-output-to-file (file.name file) (lambda () (display (file.content file))))) (define (main args) (let* ((files (cdr args)) (files (append-map generate-includes files))) (for-each file-write (filter content? files)))) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/pointer.sh���������������������������������������������������������������������0000755�0000000�0000000�00000010533�14372371517�013176� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh set -x ptr_once='s,([^N])(MACRO|NAME|VALUE) \(([^()]*)\),\1\3->\L\2,' ptr_once='s,([^N])(BYTES|CAR|CDR|CLOSURE|CONTINUATION|LENGTH|MACRO|NAME|PORT|REF|STRING|STRUCT|TYPE|VALUE|VARIABLE|VECTOR) \(([^()]*)\),\1\3->\L\2,' n_once='s,N(TYPE|CAR|CDR|LENGTH|VALUE|VECTOR) \(([^()]*)\),\2->\L\1,' ncbytes='s,NC(BYTES) \(([^()]*)\),news_\L\1 (\2),' cbytes='s,([^N])C(BYTES) \(([^()]*)\),\1cell_\L\2 (\3),' cstring='s,C(STRING) \(([^()]*)\),cell_bytes (STRING (\2)),' struct='s,SCM,struct scm *,g' struct_scm_p='s,struct scm\* ?,struct scm *,g' sed -ri \ -e 's,POINTER_CELLS=0,POINTER_CELLS=1', \ -e 's,#define POINTER_CELLS 0,#define POINTER_CELLS 1', \ -e "$ncbytes" \ -e "$cbytes" \ -e "$cstring" \ \ -e "$ncbytes" \ -e "$cbytes" \ -e "$cstring" \ \ -e "$ptr_once" \ -e "$ptr_once" \ -e "$ptr_once" \ -e 's,->\<struct\>,->structure,g' \ -e "$struct" \ -e "$struct_scm_p" \ \ -e "$n_once" \ -e "$n_once" \ \ -e 's,CAR \(([^()]*)\),\1->cdr,' \ -e 's,CAAR \(([^()]*)\),\1->car->car,' \ -e 's,CADR \(([^()]*)\),\1->cdr->car,' \ -e 's,CDAR \(([^()]*)\),\1->car->cdr,' \ -e 's,CDDR \(([^()]*)\),\1->cdr->cdr,' \ -e 's,CADAR \(([^()]*)\),\1->car->cdr->car,' \ -e 's,CADDR \(([^()]*)\),\1->cdr->cdr->car,' \ -e 's,CDADR \(([^()]*)\),\1->cdr->car->cdr,' \ -e 's,CDDDR \(([^()]*)\),\1->cdr->cdr->cdr,' \ -e 's,CDDAR \(([^()]*)\),\1->car->cdr->cdr,' \ -e 's,CDADAR \(([^()]*)\),\1->cdr->car->cdr->car,' \ \ include/mes/builtins.h \ include/mes/mes.h \ include/mes/symbols.h \ include/mes/builtins.h \ include/m2/lib.h \ src/builtins.c \ src/cc.c \ src/core.c \ src/display.c \ src/eval-apply.c \ src/gc.c \ src/hash.c \ src/lib.c \ src/m2.c \ src/math.c \ src/mes.c \ src/module.c \ src/posix.c \ src/reader.c \ src/stack.c \ src/string.c \ src/struct.c \ src/symbol.c \ src/vector.c \ src/test/gc.c \ simple.make \ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/pre-inst-env.in����������������������������������������������������������������0000644�0000000�0000000�00000003523�14372371517�014037� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! @BASH@ # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. abs_top_srcdir="@abs_top_srcdir@" export abs_top_srcdir abs_top_builddir="@abs_top_builddir@" export abs_top_builddir prefix=${prefix-@prefix@} export prefix program_prefix=${program_prefix-@program_prefix@} MES_PREFIX=${MES_PREFIX-${abs_top_srcdir}} export MES_PREFIX GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/scripts:$abs_top_builddir/module${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" GUILE_LOAD_PATH="$abs_top_srcdir/module:$abs_top_srcdir/mes:$abs_top_srcdir/guix${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH" if [ -n "$srcdest" ]; then GUILE_LOAD_PATH="${srcdest}module:${srcdest}mes:$GUILE_LOAD_PATH" fi export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH PATH="$abs_top_builddir/scripts:$abs_top_builddir/scripts:$abs_top_builddir/bin:$abs_top_builddir/build-aux:$PATH" export PATH MES=${MES-${abs_top_builddir}/bin/${program_prefix}mes} export MES bindir=${abs_top_builddir}/scripts export bindir GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH" export GUIX_PACKAGE_PATH MES_UNINSTALLED=1 export MES_UNINSTALLED LANG= LC_ALL= exec "$@" �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/setup-mes.sh�������������������������������������������������������������������0000644�0000000�0000000�00000005106�14372371517�013435� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. set -e if [ -n "$BUILD_DEBUG" ]; then set -x fi mkdir -p src cd src for GUILE_EFFECTIVE_VERSION in 2.2 2.0; do if sudo apt-get install --no-install-recommends guile-$GUILE_EFFECTIVE_VERSION-dev; then break fi done guile_site_dir=/usr/local/share/guile/site/$GUILE_EFFECTIVE_VERSION guile_site_ccache_dir=/usr/local/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache GUILE_LOAD_PATH=$guile_site_dir GUILE_LOAD_COMPILED_PATH=$guile_site_ccache_dir export GUILE_LOAD_PATH export GUILE_LOAD_COMPILED_PATH sudo apt-get install --no-install-recommends build-essential ca-certificates help2man texinfo # Nice to have sudo apt-get install --no-install-recommends gcc-i686-linux-gnu || true echo checking for M1 if ! command -v M1; then if sudo apt-get install mescc-tools; then echo yay else wget -O mescc-tools-Release_0.5.1.tar.gz https://github.com/oriansj/mescc-tools/archive/Release_0.5.1.tar.gz tar xf mescc-tools-Release_0.5.1.tar.gz cd mescc-tools-Release_0.5.1 make make check sudo make install cd .. fi fi echo checking for Nyacc if ! guile -c '(use-modules (nyacc lalr)) (display *nyacc-version*) (newline)'; then if sudo apt-get install --no-install-recommends nyacc; then echo yay else wget -O nyacc-v0.80.43.tar.gz https://gitlab.com/janneke/nyacc/-/archive/v0.80.43/nyacc-v0.80.43.tar.gz tar xf nyacc-v0.80.43.tar.gz cd nyacc-v0.80.43 ./configure --prefix=/usr/local make make check sudo make install cd .. fi fi echo checking for mes if ! command -v mes; then sudo apt-get install --no-install-recommends git git clone git://git.savannah.gnu.org/mes.git cd mes git checkout wip-gnu ./configure make make check make install fi ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/snarf.sh�����������������������������������������������������������������������0000755�0000000�0000000�00000005005�14372371517�012625� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. set -e srcdest=${srcdest-./} . ${srcdest}config.sh . ${srcdest}build-aux/trace.sh trace "SNARF$snarf builtins.c" ${srcdest}build-aux/mes-snarf.scm src/builtins.c trace "SNARF$snarf core.c" ${srcdest}build-aux/mes-snarf.scm src/core.c trace "SNARF$snarf display.c" ${srcdest}build-aux/mes-snarf.scm src/display.c trace "SNARF$snarf eval-apply.c" ${srcdest}build-aux/mes-snarf.scm src/eval-apply.c trace "SNARF$snarf gc.c" ${srcdest}build-aux/mes-snarf.scm src/gc.c trace "SNARF$snarf hash.c" ${srcdest}build-aux/mes-snarf.scm src/hash.c trace "SNARF$snarf lib.c" ${srcdest}build-aux/mes-snarf.scm src/lib.c trace "SNARF$snarf math.c" ${srcdest}build-aux/mes-snarf.scm src/math.c trace "SNARF$snarf mes.c" ${srcdest}build-aux/mes-snarf.scm src/mes.c trace "SNARF$snarf module.c" ${srcdest}build-aux/mes-snarf.scm src/module.c trace "SNARF$snarf posix.c" ${srcdest}build-aux/mes-snarf.scm src/posix.c trace "SNARF$snarf reader.c" ${srcdest}build-aux/mes-snarf.scm src/reader.c trace "SNARF$snarf stack.c" ${srcdest}build-aux/mes-snarf.scm src/stack.c trace "SNARF$snarf strings.c" ${srcdest}build-aux/mes-snarf.scm src/string.c trace "SNARF$snarf struct.c" ${srcdest}build-aux/mes-snarf.scm src/struct.c trace "SNARF$snarf symbol.c" ${srcdest}build-aux/mes-snarf.scm src/symbol.c trace "SNARF$snarf vector.c" ${srcdest}build-aux/mes-snarf.scm src/vector.c for i in src/*.symbols.h; do n=$(basename $i .symbols.h) echo "/* src/$n.c */" cat $i mv $i $(basename $i .symbols.h).s done > s for i in src/*.h; do n=$(basename $i .h) echo "/* src/$n.c */" cat $i done > h for i in src/*.i; do n=$(basename $i .i) echo " /* src/$n.c */" cat $i done > c ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/test-boot.sh�������������������������������������������������������������������0000755�0000000�0000000�00000002304�14372371517�013433� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. set -e if [ "$V" = 2 ]; then set -x fi t=${1-scaffold/boot/00-zero.scm} b=$(basename "$t" .scm) if [ "$(basename $MES)" = guile ]; then $MES -L ${srcdest}module -C module -L . -c '(begin (use-modules (mes guile)) (include-from-path "'"$t"'"))' elif [ -z "${b/5[0-9]-*/}" ]; then cat "$t" | MES_BOOT=boot-00.scm $MES elif [ -z "${b/6[0-9]-*/}" ]; then cat "$t" | MES_BOOT=boot-01.scm $MES else MES_BOOT=$t $MES; fi ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/test-c.sh����������������������������������������������������������������������0000755�0000000�0000000�00000004654�14372371517�012724� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. set -e if test -z "$config_sh"; then . ./config.sh fi if [ "$V" = 2 ]; then set -x fi t=${1-lib/tests/scaffold/t.c} b=$(dirname "$t")/$(basename "$t" .c) o="$b" o=lib/tests/${b#*lib/tests/} if [ "$o" = "$b" ]; then o=./$(basename "$t" .c) fi rm -f "$o" CC=${CC-gcc} i=$(basename "$t" .c) if [ -z "${MES_CHECKING_BUILTIN_LIBS}" ] then MES_CHECKING_BUILTIN_LIBS="`${CC} --print-libgcc-file-name`" fi if [ -z "${i/[012][0-9]-*/}" ]; then LIBS="${MES_CHECKING_BUILTIN_LIBS} -l c-mini" elif [ -z "${i/[34][0-9]-*/}" ]; then LIBS="-l c-mini ${MES_CHECKING_BUILTIN_LIBS} -l c-mini" elif [ -z "${i/[78][0-9a-z]-*/}" ]; then LIBS="-l c+tcc ${MES_CHECKING_BUILTIN_LIBS} -l c+tcc" elif [ -z "${i/9[0-9a-z]-*/}" ]; then LIBS="-l c+gnu ${MES_CHECKING_BUILTIN_LIBS} -l c+gnu" else # Make it possible to resolve raise(), required by libgcc.a, provided # in libc.a. The final command line has to have "-lc -lgcc -lc". # See <https://www.openwall.com/lists/musl/2018/05/09/1>. LIBS="-l c ${MES_CHECKING_BUILTIN_LIBS} -l c" fi if test $mes_kernel = gnu\ && test -z "$LIBS"; then LIBS="-l c-mini -l mescc" fi if test $mes_libc = system; then crt1= LIBS='-l mes -l mescc' else crt1=crt1.o fi $CC -g -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o "$o".o "$t" $CC -g $AM_CFLAGS $CFLAGS $AM_LDFLAGS $LDFLAGS -L . -o "$o" $crt1 "$o".o $LIBS set +e timeout 20 "$o" -s --long file0 file1 > "$o".1 2> "$o".2 r=$? set -e if [ -f "$b".exit ]; then e=$(cat "$b".exit) else e=0 fi [ $r = $e ] || exit 1 if [ -f "$b".stdout ]; then $DIFF -ub "$b".stdout "$o".1 fi if [ -f "$b".stderr ]; then $DIFF -ub "$b".stderr "$o".2 fi ������������������������������������������������������������������������������������mes-0.24.2/build-aux/test-driver��������������������������������������������������������������������0000755�0000000�0000000�00000011041�14372371517�013350� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to <bug-automake@gnu.org> or send patches to # <automake-patches@gnu.org>. # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <<END Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory. END } test_name= # Used for reporting. log_file= # Where to save the output of the test script. trs_file= # Where to save the metadata of the test run. expect_failure=no color_tests=no enable_hard_errors=yes while test $# -gt 0; do case $1 in --help) print_usage; exit $?;; --version) echo "test-driver $scriptversion"; exit $?;; --test-name) test_name=$2; shift;; --log-file) log_file=$2; shift;; --trs-file) trs_file=$2; shift;; --color-tests) color_tests=$2; shift;; --expect-failure) expect_failure=$2; shift;; --enable-hard-errors) enable_hard_errors=$2; shift;; --) shift; break;; -*) usage_error "invalid option: '$1'";; *) break;; esac shift done missing_opts= test x"$test_name" = x && missing_opts="$missing_opts --test-name" test x"$log_file" = x && missing_opts="$missing_opts --log-file" test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" if test x"$missing_opts" != x; then usage_error "the following mandatory options are missing:$missing_opts" fi if test $# -eq 0; then usage_error "missing argument" fi if test $color_tests = yes; then # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. red='' # Red. grn='' # Green. lgn='' # Light green. blu='' # Blue. mgn='' # Magenta. std='' # No color. else red= grn= lgn= blu= mgn= std= fi do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' trap "st=129; $do_exit" 1 trap "st=130; $do_exit" 2 trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 # Test script is run here. "$@" >$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/test-suite.sh������������������������������������������������������������������0000644�0000000�0000000�00000010020�14372371517�013610� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2011-2018 Free Software Foundation, Inc. # Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. # Adapted from GNU Automake TEST_SUITE_LOG=test-suite.log dry_run=false create_global_log=cat subdir=$(basename $(pwd)) TEST_LOGS= for t in $TESTS; do b=$(dirname $t)/$(basename $t $test_ext) TEST_LOGS="$TEST_LOGS $b.log" if test -e $b.log \ && test -e $b.trs\ && ! $recheck; then echo `grep :test-result $b.trs | cut -d' ' -f 2`: $b continue fi d=$(dirname $t) case " `echo $XFAIL_TESTS` " in *[\ \ ]$t[\ \ ]*) fail=yes;; *) fail=no;; esac mkdir -p $d ${SHELL} ${srcdest}build-aux/test-driver\ --test-name $t \ --log-file $b.log\ --trs-file $b.trs\ --color-tests $colors\ --enable-hard-errors no\ --expect-failure $fail\ -- $log_compiler\ ${srcdest}$t done if test $colors = yes; then red='' grn='' lgn='' blu='' mgn='' brg='' std='' else mgn= red= grn= lgn= blu= brg= std= fi bases="$TEST_LOGS" bases=`for i in $bases; do echo $i; done | sed 's/\.log$//'` bases=`echo $bases` ws='[ ]' results=`for b in $bases; do echo $b.trs; done` test -n "$results" || results=/dev/null all=` grep "^$ws*:test-result:" $results | wc -l` pass=` grep "^$ws*:test-result:$ws*PASS" $results | wc -l` fail=` grep "^$ws*:test-result:$ws*FAIL" $results | wc -l` skip=` grep "^$ws*:test-result:$ws*SKIP" $results | wc -l` xfail=`grep "^$ws*:test-result:$ws*XFAIL" $results | wc -l` xpass=`grep "^$ws*:test-result:$ws*XPASS" $results | wc -l` error=`grep "^$ws*:test-result:$ws*ERROR" $results | wc -l` if test `expr $fail + $xpass + $error` -eq 0; then success=true else success=false fi br='==================='; br=$br$br$br$br result_count () { if test x"$1" = x"--maybe-color"; then maybe_colorize=yes elif test x"$1" = x"--no-color"; then maybe_colorize=no else echo "$@: invalid 'result_count' usage" >&2; exit 4 fi shift desc=$1 count=$2 if test $maybe_colorize = yes && test $count -gt 0; then color_start=$3 color_end=$std else color_start= color_end= fi echo "${color_start}# $desc $count${color_end}" } create_testsuite_report () { result_count $1 "TOTAL:" $all "$brg" result_count $1 "PASS: " $pass "$grn" result_count $1 "SKIP: " $skip "$blu" result_count $1 "XFAIL:" $xfail "$lgn" result_count $1 "FAIL: " $fail "$red" result_count $1 "XPASS:" $xpass "$red" result_count $1 "ERROR:" $error "$mgn" } { echo "${PACKAGE}: ${subdir}/${TEST_SUITE_LOG}" create_testsuite_report --no-color echo echo for b in $bases; do echo $b; done\ | $create_global_log } >${TEST_SUITE_LOG}.tmp || exit 1 mv ${TEST_SUITE_LOG}.tmp ${TEST_SUITE_LOG} if $success; then col="$grn" else col="$red" test x"$V" = x0 || cat ${TEST_SUITE_LOG} fi echo "${col}$br${std}" echo "${col}Testsuite summary for ${PACKAGE_NAME}${std}" echo "${col}$br${std}" create_testsuite_report --maybe-color echo "$col$br$std" if $success; then :; else echo "${col}See ${subdir}/${TEST_SUITE_LOG}${std}" if test -n "${PACKAGE_BUGREPORT}"; then echo "${col}Please report to ${PACKAGE_BUGREPORT}${std}" fi echo "$col$br$std" fi $success || exit 1 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/trace.sh�����������������������������������������������������������������������0000644�0000000�0000000�00000002444�14372371517�012613� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# GNU Mes --- Maxwell Equations of Software # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. LOG= if [ -z "$V" -o "$V" = 0 ]; then trace () { echo " $1" shift echo "$@" >> build.log eval "$@ $LOG" cat .log 1>&2 cat .log >> build.log } LOG=" >.log 2>&1" fi if [ "$V" = 1 ]; then trace () { shift echo "$@" echo "$@" >> build.log eval "$@ $LOG" cat .log 1>&2 cat .log >> build.log } LOG=" >.log 2>&1" fi if [ "$V" = 2 ]; then set -x trace () { shift echo "$@" >> build.log eval "$@" } fi ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/build-aux/uninstall.sh.in����������������������������������������������������������������0000644�0000000�0000000�00000004674�14372371517�014142� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. #set -e . ./config.sh v= _v= if test "$V" = 2; then set -x fi if test "$V" -gt 0; then v=v _v=-v fi set -u rm ${DESTDIR}${bindir}/mes rm ${DESTDIR}${bindir}/ar rm ${DESTDIR}${bindir}/mescc rm ${DESTDIR}${bindir}/mescc.scm rm ${DESTDIR}${bindir}/diff.scm rmdir ${DESTDIR}${bindir} || : rm -r ${DESTDIR}${libdir}/$mes_cpu-mes rm ${DESTDIR}${libdir}/libc-mini.a rm ${DESTDIR}${libdir}/libmes.a if cmp gcc-lib/libc.a ${DESTDIR}${libdir}/libc.a; then rm ${DESTDIR}${libdir}/libc.a fi if cmp gcc-lib/libtcc1.a ${DESTDIR}${libdir}/libtcc1.a; then rm ${DESTDIR}${libdir}/libtcc1.a fi rm ${DESTDIR}${libdir}/libc+tcc.a rm ${DESTDIR}${libdir}/libc+gnu.a rm -r ${DESTDIR}${includedir}/mes rm $(grep -lr _MES_ ${DESTDIR}${includedir}) rmdir ${DESTDIR}${includedir}/linux/x86 rmdir ${DESTDIR}${includedir}/linux/x86_64 rmdir ${DESTDIR}${includedir}/linux rmdir -p ${DESTDIR}${includedir}/sys for i in\ AUTHORS\ BOOTSTRAP\ COPYING\ ChangeLog\ HACKING\ INSTALL\ NEWS\ README\ ;do rm ${DESTDIR}${docdir}/$i || :; done rm -r ${DESTDIR}${pkgdatadir} rm -r ${DESTDIR}${guile_site_ccache_dir}/mes rm -r ${DESTDIR}${guile_site_ccache_dir}/mescc rm -r ${DESTDIR}${guile_site_dir}/mes rm ${DESTDIR}${guile_site_dir}/mescc.scm rm -r ${DESTDIR}${guile_site_dir}/mescc rm ${DESTDIR}${infodir}/dir rm ${DESTDIR}${infodir}/mes.info* rm ${DESTDIR}${infodir}/images/gcc-mesboot* rm ${DESTDIR}${infodir}/images/README rm ${DESTDIR}${mandir}/man1/mes.1 rm ${DESTDIR}${mandir}/man1/mescc.1 rmdir -p ${DESTDIR}${docdir} rmdir -p ${DESTDIR}${infodir}/images rmdir -p ${DESTDIR}${guile_site_dir} rmdir -p ${DESTDIR}${guile_site_ccache_dir} rmdir -p ${DESTDIR}${mandir}/man1 true ��������������������������������������������������������������������mes-0.24.2/configure��������������������������������������������������������������������������������0000755�0000000�0000000�00000100126�14372371517�011172� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # -*-scheme-*- MES_ARENA=100000000 exec ${SCHEME-guile} -L . --no-auto-compile -e '(configure)' -s "$0" ${1+"$@"} !# ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018,2019,2020,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Vagrant Cascadian <vagrant@reproducible-builds.org> ;;; ;;; configure: This file is part of GNU Mes. ;;; ;;; GNU Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. (define-module (configure) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-26) #:use-module (ice-9 getopt-long) #:use-module (ice-9 optargs) #:use-module (ice-9 popen) #:use-module (ice-9 rdelim) #:export (main)) (define *shell* "sh") (define PACKAGE "mes") (define PACKAGE-NAME "GNU Mes") (define PACKAGE-BUGREPORT "bug-mes@gnu.org") (define VERSION "0.24.2") (cond-expand (guile) (mes (mes-use-module (srfi srfi-1)) (mes-use-module (srfi srfi-9)) (mes-use-module (srfi srfi-9 gnu)) (mes-use-module (srfi srfi-26)) (mes-use-module (mes getopt-long)) (mes-use-module (mes guile)) (mes-use-module (mes misc)) (mes-use-module (mes optargs)) (define %host-type "x86_64-unknown-linux-gnu") (define OPEN_READ "r") (define (canonicalize-path o) (if (string-prefix? "/" o) o (string-append (getcwd) "/" o))) (define (sort lst less) lst) (define (close-pipe o) 0) (define (open-pipe* OPEN_READ . commands) (let ((fake-pipe ".pipe")) (with-output-to-file fake-pipe (lambda _ (let ((status (apply system* (append commands)))) (set! close-pipe (lambda _ status))))) (open-input-file fake-pipe))))) (define* (PATH-search-path name #:key (default name) warn?) (or (search-path (string-split (getenv "PATH") #\:) name) (and (and warn? (format (current-error-port) "warning: not found: ~a\n" name)) default))) ;;; Utility (define (logf port string . rest) (apply format (cons* port string rest)) (force-output port) #t) (define (stderr string . rest) (apply logf (cons* (current-error-port) string rest))) (define (stdout string . rest) (apply logf (cons* (current-output-port) string rest))) (define %verbose? #f) (define (verbose string . rest) (if %verbose? (apply stderr (cons string rest)))) (define (gulp-pipe command) (let* ((err (current-error-port)) (foo (set-current-error-port (open-output-file ".error"))) (port (open-pipe command "r")) (output (read-string port)) (status (close-pipe port)) (error (with-input-from-file ".error" read-string))) (when (file-exists? ".error") (delete-file ".error")) (set-current-error-port err) (verbose "command[~a]: ~s => ~a [~a]\n" status command output error) (if (not (zero? status)) "" (string-trim-right (string-append output error))))) (define (gulp-pipe* . command) (gulp-pipe (string-join command))) (define (tuple< a b) (cond ((and (null? a) (null? b)) #t) ((null? a) (not (null? b))) ((null? b) #f) ((and (not (< (car a) (car b))) (not (< (car b) (car a)))) (tuple< (cdr a) (cdr b))) (else (< (car a) (car b))))) (define (tuple<= a b) (or (equal? a b) (tuple< a b))) (define (conjoin . predicates) (lambda (. arguments) (every (cut apply <> arguments) predicates))) (define (char->char from to char) (if (eq? char from) to char)) (define (string-replace-char string from to) (string-map (cut char->char from to <>) string)) (define (string-replace-string string from to) (cond ((string-contains string from) => (lambda (i) (string-replace string to i (+ i (string-length from))))) (else string))) (define (string-replace-string/all string from to) (or (and=> (string-contains string from) (lambda (i) (string-append (substring string 0 i) to (string-replace-string/all (substring string (+ i (string-length from))) from to)))) string)) ;;; Configure (define-immutable-record-type <dependency> (make-dependency name version-expected optional? version-option commands file-name data version-found) dependency? (name dependency-name) (version-expected dependency-version-expected) (optional? dependency-optional?) (version-option dependency-version-option) (commands dependency-commands) (file-name dependency-file-name) (data dependency-data) (version-found dependency-version-found)) (define* (make-dep name #:key (version '()) optional? (version-option "--version") (commands (list name)) file-name data) (let* ((env-var (getenv (name->shell-name name))) (commands (if env-var (cons env-var commands) commands))) (make-dependency name version optional? version-option commands file-name data #f))) (define (find-dep name deps) (find (compose (cut equal? <> name) dependency-name) deps)) (define (file-name name deps) (and=> (find-dep name deps) dependency-file-name)) (define (variable-name dependency) (and=> (dependency-name dependency) name->shell-name)) (define (name->shell-name name) (string-upcase (string-replace-char name #\- #\_))) (define (->string o) (cond ((number? o) (number->string o)) ((string? o) o) (else (format #f "~a" o)))) (define (version->string version) (and version (string-join (map ->string version) "."))) (define (string->version string) (let ((split (string-tokenize string (char-set-adjoin char-set:digit #\.)))) (and (pair? split) (let* ((version (sort split (lambda (a b) (let ((len-a (length (string-split a #\.))) (len-b (length (string-split b #\.)))) (cond ((> len-a len-b) #t) ((< len-a len-b) #f) (else (> (string-length a) (string-length b)))))))) (version (car version)) (version (string-tokenize version (char-set-complement (char-set #\.))))) (map string->number version))))) (define (check-program-version dependency) (let ((name (dependency-name dependency)) (expected (dependency-version-expected dependency)) (version-option (dependency-version-option dependency)) (commands (dependency-commands dependency))) (let loop ((commands commands)) (if (or (null? commands) (not (car commands))) dependency (let ((command (car commands))) (stdout "checking for ~a~a... " (if (string-index command #\space) name command) (if (null? expected) "" (format #f " [~a]" (version->string expected)))) (let* ((output (gulp-pipe (string-append command " " (if version-option version-option "")))) (actual (string->version output)) (pass? (and actual (tuple< expected actual))) (dependency (set-field dependency (dependency-version-found) actual))) (stdout "~a ~a\n" (if pass? (if (pair? actual) "" "yes") (if actual " no, found" "no")) (or (version->string actual) "")) (if pass? (let ((file-name (or (PATH-search-path command) (dependency-file-name dependency)))) (set-field dependency (dependency-file-name) file-name)) (loop (cdr commands))))))))) (define (check-file dependency) (stdout "checking for ~a... " (dependency-name dependency)) (let ((file-name (and (file-exists? (dependency-file-name dependency)) (dependency-file-name dependency)))) (stdout "~a\n" (or file-name "")) (set-field dependency (dependency-file-name) file-name))) (define* (check-header-c cc dependency #:optional (check check-preprocess-header-c)) (let ((name (dependency-name dependency))) (stderr "checking for ~a..." name) (let ((result (check cc name))) (when (file-exists? ".config.c") (delete-file ".config.c")) (stderr " ~a\n" (if result "yes" "no")) (if result (set-field dependency (dependency-file-name) name) dependency)))) (define* (check-compile-c cc dependency #:optional (check check-compile-string-c)) (let ((name (dependency-name dependency))) (stderr "checking for ~a..." name) (let ((result (check cc (dependency-data dependency)))) (when (file-exists? ".config.c") (delete-file ".config.c")) (stderr " ~a\n" (if result "yes" "no")) (if result (set-field dependency (dependency-file-name) name) dependency)))) (define* (check-link-c cc dependency #:optional (check check-link-string-c)) (let ((name (dependency-name dependency))) (stderr "checking for ~a..." name) (let ((result (check cc (dependency-data dependency)))) (when (file-exists? ".config.c") (delete-file ".config.c")) (stderr " ~a\n" (if result "yes" "no")) (if result (set-field dependency (dependency-file-name) name) dependency)))) (define (cflags-list) (let ((cflags (getenv "CFLAGS"))) (if cflags (list cflags) '()))) (define (ldflags-list) (let ((ldflags (getenv "LDFLAGS"))) (if ldflags (list ldflags) '()))) (define (check-preprocess-header-c cc header) (with-output-to-file ".config.c" (cut format #t "#include \"~a\"" header)) (let ((test (lambda _ (apply system* `(,cc "-E" "-o" ".config.E" ,@(cflags-list) ".config.c"))))) (zero? (if %verbose? (test) (with-error-to-file "/dev/null" test))))) (define (check-compile-string-c cc string) (with-output-to-file ".config.c" (cut display string)) (let ((test (lambda _ (apply system* `(,cc "-std=gnu99" "-c" "-o" ".config.o" ,@(cflags-list) ".config.c"))))) (zero? (if %verbose? (test) (with-error-to-file "/dev/null" test))))) (define (check-link-string-c cc string) (with-output-to-file ".config.c" (cut display string)) (let ((test (lambda _ (apply system* `(,cc "-std=gnu99" "-o" ".config" ,@(cflags-list) ,@(ldflags-list) ".config.c"))))) (zero? (if %verbose? (test) (with-error-to-file "/dev/null" test))))) (define (parse-opts args) (let* ((option-spec '((build (value #t)) (host (value #t)) (prefix (value #t)) (program-prefix (value #t)) (bindir (value #t)) (datadir (value #t)) (docdir (value #t)) (includedir (value #t)) (libdir (value #t)) (srcdir (value #t)) (sysconfdir (value #t)) (mes) (help (single-char #\h)) (verbose (single-char #\v)) (with-bootstrap) (with-cheating) (with-courage) (infodir (value #t)) (mandir (value #t)) (disable-colors) (enable-colors) (disable-silent-rules) (enable-silent-rules) (with-system-libc) (enable-fast-install) ; Ignored for Guix (disable-dependency-tracking) ; Ignored for Debian (disable-maintainer-mode) ; Ignored for Debian (disable-option-checking) ; Ignored for Debian (libexecdir (value #t)) ; Ignored for Debian (localstatedir (value #t)) ; Ignored for Debian (mandir (value #t)) ; Ignored for Debian (runstatedir (value #t))))) ; Ignored for Debian (getopt-long args option-spec))) (define* (print-help #:optional (port (current-output-port))) (format port "\ `configure' configures ~a ~a to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE] To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Options: -h, --help display this help --build=BUILD configure for building on BUILD [guessed] --colors no colorized output --disable-silent-rules verbose build output [V=1] --host=HOST cross-compile to build programs to run on HOST [BUILD] -v, --verbose be verbose --with-bootstrap After building mes with CC, build mes with MesCC --with-courage Assert that even if this platform is unsupported, you will be courageous and port GNU Mes to it (see \"Porting GNU Mes\" in the manual.) --with-cheating cheat using Guile instead of Mes --with-system-libc use system libc Installation directories: --prefix=DIR install in prefix DIR [~a] --bindir=DIR user executables [PREFIX/bin] --includedir=DIR C header files [PREFIX/include] --infodir=DIR info documentation [PREFIX/share/info] --libdir=DIR object code libraries [EPREFIX/lib] --mandir=DIR man pages [PREFIX/share/man] Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names Ignored for Guix: --enable-fast-install Ignored for Debian: --disable-dependency-tracking --disable-maintainer-mode --libexecdir=DIR --localstatedir=DIR --runstatedir=DIR Some influential environment variables: CC C compiler command CFLAGS C compiler flags CPPFLAGS C preprocessor flags LDFLAGS C linker flags GUILE guile command GUILD guild command GUILD_OPTIMIZE guild compile optimization GUILE_LOAD_PATH guile load path; where to find Nyacc MES_FOR_BUILD build system MES [can be mes or guile] " PACKAGE VERSION (getenv "prefix"))) (define (main args) (let* ((options (parse-opts args)) (build-type (option-ref options 'build %host-type)) (host-type (option-ref options 'host build-type)) (prefix "/usr/local") (prefix (option-ref options 'prefix prefix)) (program-prefix (option-ref options 'program-prefix "")) (program-suffix (option-ref options 'program-suffix "")) (infodir (option-ref options 'infodir "${prefix}/share/info")) (mandir (option-ref options 'mandir "${prefix}/share/man")) (sysconfdir (option-ref options 'sysconfdir "${prefix}/etc")) (bindir (option-ref options 'bindir "${prefix}/bin")) (datadir (option-ref options 'datadir "${prefix}/share")) (docdir (option-ref options 'docdir "${datadir}/doc/mes")) (includedir (option-ref options 'includedir "${prefix}/include")) (libdir (option-ref options 'libdir "${prefix}/lib")) (pkgdatadir (string-append datadir "/mes")) (guile-load-path (if (and (pair? %load-path) (equal? (car %load-path) ".")) (cdr %load-path) %load-path)) (guile-effective-version (effective-version)) (guile-site-dir (if (equal? prefix ".") (canonicalize-path ".") (string-append prefix "/share/guile/site/" guile-effective-version))) (guile-site-ccache-dir (if (equal? prefix ".") (canonicalize-path ".") (string-append prefix "/lib/guile/" guile-effective-version "/site-ccache"))) (srcdir (dirname (car (command-line)))) (srcdest (if (equal? srcdir ".") "" (string-append srcdir "/"))) (abs-top-srcdir (canonicalize-path srcdir)) (abs-top-builddir (canonicalize-path (getcwd))) (top-builddir (if (equal? srcdir ".") "." abs-top-builddir)) (with-bootstrap? (option-ref options 'with-bootstrap #f)) (with-cheating? (option-ref options 'with-cheating #f)) (with-courage? (option-ref options 'with-courage #f)) (disable-colors? (option-ref options 'disable-colors #f)) (enable-colors? (option-ref options 'enable-colors #f)) (disable-silent-rules? (option-ref options 'disable-silent-rules #f)) (enable-silent-rules? (option-ref options 'enable-silent-rules #f)) (with-system-libc? (option-ref options 'with-system-libc #f)) (vars (filter (cut string-index <> #\=) (option-ref options '() '()))) (help? (option-ref options 'help #f)) (mes? (option-ref options 'mes #f))) (when help? (print-help) (exit 0)) (set! %verbose? (option-ref options 'verbose #f)) (when %verbose? (stderr "configure args=~s\n" args)) (for-each (lambda (v) (apply setenv (string-split v #\=))) vars) (let* ((cross? (not (equal? host-type build-type))) (gcc (if cross? (string-append host-type "-" "gcc") "gcc")) (tcc (if cross? (string-append host-type "-" "tcc") "tcc")) (mescc (if cross? (string-append host-type "-" "mescc") "mescc")) (deps (fold (lambda (program results) (cons (check-program-version program) results)) '() (list (make-dep "hex2" #:version '(1 4 0)) (make-dep "M1" #:version '(1 4 0)) (make-dep "blood-elf" #:version '(2 0 0)) (make-dep "kaem" #:version '(1 0 0) #:optional? #t) (make-dep "M2-Planet" #:version '(1 9 0) #:optional? #t) (make-dep "diff" #:optional? #t) (make-dep "guile" #:version '(2 0) #:commands '("guile-3.0" "guile-3" "guile-2.2" "guile-2.0" "guile-2" "guile") #:optional? #t) (make-dep "mes" #:version '(0 22) #:optional? #t) (make-dep "guix" #:version '() #:optional? #t) (make-dep "ar" #:version '(2 10) #:optional? #t) (make-dep "sh" #:optional? #t) (make-dep "bash" #:version '(2 0) #:optional? #t) (make-dep "guild" #:version '(2 0) #:commands '("guild" "guile-tools" "true")) (make-dep "CC" #:commands `(,(getenv "CC")) #:optional? #t) (make-dep "CC-v" #:commands `(,(getenv "CC")) #:optional? #t #:version-option "-v") (make-dep "cc" #:commands '("cc") #:optional? #t) (make-dep "gcc" #:commands `(,gcc "gcc") #:optional? #t) (make-dep "mescc" #:commands `(,mescc "mescc") #:optional? #t) (make-dep "tcc" #:commands `(,tcc "tcc") #:optional? #t #:version-option "-v") (make-dep "cc-v" #:commands '("cc") #:optional? #t #:version-option "-v") (make-dep "make" #:optional? #t #:commands '("gmake" "make")) (make-dep "makeinfo" #:version '(6) #:optional? #t) (make-dep "dot" #:version-option "-V" #:optional? #t) (make-dep "help2man" #:version '(1 47) #:optional? #t) (make-dep "perl" #:version '(5) #:optional? #t)))) (guile (file-name "guile" deps)) ;; See https://bugs.gnu.org/43831; use -O1 with Guile-3 (guild-optimize (let ((guile-version (and=> (find-dep "guile" deps) dependency-version-found))) (and guile-version (tuple< '(2 9) guile-version) "-O1"))) (deps (if guile (cons (check-program-version (make-dep "nyacc" #:version '(0 99 0) #:commands (list (string-append guile " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) #:file-name #t #:version-option #f)) deps) deps)) (guile (or guile "guile")) (cc (or (file-name "CC" deps) (file-name "CC-v" deps) (file-name "tcc" deps) (file-name "gcc" deps) (file-name "cc" deps) (file-name "cc-v" deps) (file-name "mescc" deps))) (m2-planet (file-name "M2-Planet" deps)) (deps (if cc (cons* (check-header-c cc (make-dep "limits.h")) (check-header-c cc (make-dep "stdio.h" #:optional? #t)) deps) deps)) (missing (filter (conjoin (negate dependency-file-name) (negate dependency-optional?)) deps)) (deps (if cc (cons (check-compile-c cc (make-dep "cc is GNU C" #:data "#if !defined (__GNUC__) #error no gnuc #endif ")) deps) deps)) (gcc? (file-name "cc is GNU C" deps)) (deps (if cc (cons (check-compile-c cc (make-dep "cc is Mes C" #:data "#if !defined (__MESC__) #error no mesc #endif ")) deps) deps)) (mescc? (file-name "cc is Mes C" deps)) (deps (if cc (cons (check-compile-c cc (make-dep "cc is Tiny C" #:data "#if !defined (__TINYC__) #error no tinycc #endif ")) deps) deps)) (tcc? (file-name "cc is Tiny C" deps)) (deps (if cc (cons (check-link-c cc (make-dep "whether cc can create executables" #:data "int main () {return 0;}")) deps) deps)) (system-libc? (and with-system-libc? (file-name "if cc can create executables" deps))) (host-type (or (and cc (let ((dump (gulp-pipe* cc "-dumpmachine"))) (and (not (string-null? dump)) dump))) host-type)) (host-type-list (string-split host-type #\-)) (mes-cpu (car host-type-list)) (mes-cpu (cond ((member mes-cpu '("i386" "i486" "i586" "i686")) "x86") ((member mes-cpu '("arm" "armv4" "armv7l")) "arm") (else mes-cpu))) (mes-bits (if (member mes-cpu '("x86_64")) "64" "32")) (mes-libc (if system-libc? "system" "mes")) (mes-kernel (car (filter (compose not (cut member <> '("pc" "portbld" "unknown"))) (cdr host-type-list)))) (mes-kernel (if (string-prefix? "freebsd" mes-kernel) "freebsd" mes-kernel)) (mes-compiler (cond (gcc? "gcc") (tcc? "gcc") (mescc? "mescc") (else "bootstrap"))) (mes-system (string-join (list mes-cpu mes-kernel "mes") "-")) (bash (or (and (file-exists? "/bin/bash") "/bin/bash") (file-name "bash" deps) "")) (shell (or (and (file-exists? "/bin/bash") "/bin/bash") (file-name "bash" deps) (and (file-exists? "/bin/sh") "/bin/sh") (file-name "sh" deps) "sh")) (hex2 (file-name "hex2" deps)) (numbered-arch? (begin (stdout "checking for stage0 architecture flag... ") (let ((numbered? (and hex2 (string-contains (gulp-pipe (string-append hex2 " --help 2>&1" )) "--Architecture 12345")))) (stdout (if numbered? "numbered\n" "named\n")) numbered?)))) (define* (substitute file-name pairs #:key (target (if (string-suffix? ".in" file-name) (string-drop-right file-name 3) file-name))) (system* "mkdir" "-p" (dirname target)) (with-output-to-file target (lambda _ (let ((in (open-input-file file-name))) (let loop ((line (read-line in 'concat))) (when (not (eof-object? line)) (display (fold (lambda (o result) (string-replace-string/all result (car o) (cdr o))) line pairs)) (loop (read-line in 'concat)))))))) (when (and (not (member mes-system '("arm-linux-mes" "x86-linux-mes" "x86_64-linux-mes"))) (not with-courage?)) (stderr "platform not supported: ~a See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) (exit 1)) (when (pair? missing) (stderr "\nMissing dependencies: ~a\n" (string-join (map dependency-name missing))) (exit 1)) (let ((pairs `(("@PACKAGE@" . ,PACKAGE) ("@PACKAGE_NAME@" . ,PACKAGE-NAME) ("@PACKAGE_BUGREPORT@" . ,PACKAGE-BUGREPORT) ("@VERSION@" . ,VERSION) ("@build@" . ,build-type) ("@host@" . ,host-type) ("@bootstrap@" . ,(if with-bootstrap? "true" "false")) ("@courageous@" . ,(if with-courage? "true" "false")) ("@compiler@" . ,mes-compiler) ("@mes_bits@" . ,mes-bits) ("@mes_kernel@" . ,mes-kernel) ("@mes_cpu@" . ,mes-cpu) ("@mes_libc@" . ,mes-libc) ("@mes_system@" . ,mes-system) ("@abs_top_srcdir@" . ,abs-top-srcdir) ("@abs_top_builddir@" . ,abs-top-builddir) ("@top_builddir@" . ,top-builddir) ("@srcdest@" . ,srcdest) ("@srcdir@" . ,srcdir) ("@prefix@" . ,prefix) ("@program_prefix@" . ,program-prefix) ("@bindir@" . ,bindir) ("@datadir@" . ,datadir) ("@pkgdatadir@" . ,pkgdatadir) ("@docdir@" . ,docdir) ("@guile_site_ccache_dir@" . ,guile-site-ccache-dir) ("@guile_site_dir@" . ,guile-site-dir) ("@infodir@" . ,infodir) ("@includedir@" . ,includedir) ("@libdir@" . ,libdir) ("@mandir@" . ,mandir) ("@sysconfdir@" . ,sysconfdir) ("@colors@" . ,(if disable-colors? "no" "yes")) ("@V@" . ,(if disable-silent-rules? "1" "0")) ("@AR@" . ,(or (file-name "ar" deps) "")) ("@BASH@" . ,bash) ("@CC@" . ,(or cc "")) ("@DIFF@" . ,(or (file-name "diff" deps) (string-append abs-top-builddir "/pre-inst-env diff.scm"))) ("@DOT@" . ,(or (file-name "dot" deps) "")) ("@GIT@" . ,(or (file-name "git" deps) "")) ("@GUILD_OPTIMIZE@" . ,(or (getenv "GUILD_OPTIMIZE") guild-optimize "")) ("@GUILE@" . ,guile) ("@GUILE_EFFECTIVE_VERSION@" . ,(effective-version)) ("@GUILE_LOAD_PATH@" . ,(string-join guile-load-path ":")) ("@GUIX@" . ,(or (file-name "guix" deps) "")) ("@HELP2MAN@" . ,(or (file-name "help2man" deps) "")) ("@KAEM@" . ,(or (file-name "kaem" deps) "")) ("@M2_PLANET@" . ,(or (file-name "M2-Planet" deps) "")) ("@MAKEINFO@" . ,(or (file-name "makeinfo" deps) "")) ("@MES_FOR_BUILD@" . ,(or (file-name "mes" deps) guile)) ("@PERL@" . ,(or (file-name "perl" deps) "")) ("#SCHEME=\"@SCHEME@\"" . ,(if with-cheating? (string-append "\nSCHEME=\"" guile "\"") "")) ("@SCHEME@" . ,(if with-cheating? guile "")) ("@SHELL@" . ,shell) ("@CFLAGS@" . ,(or (getenv "CFLAGS") "-static -g")) ("@CPPFLAGS@" . ,(or (getenv "CPPFLAGS") "")) ("@LDFLAGS@" . ,(or (getenv "LDFLAGS") "-static -g")) ("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") "")) ("@M1FLAGS@" . ,(or (getenv "M1FLAGS") "")) ("@numbered_arch@" . ,(if numbered-arch? "true" "false")) ,@(map (lambda (o) (cons (string-append "@" (variable-name o) "@") (or (format #f "~a" (dependency-file-name o)) ""))) deps)))) (unless (or cc m2-planet) (format (current-error-port) "must supply C compiler or M2-Planet\n") (exit 2)) (for-each (lambda (o) (let* ((src (string-append srcdest o)) (target (string-drop-right o 3)) (target (if (not (string-prefix? "build-aux/" target)) target (string-drop target (string-length "build-aux/"))))) (substitute src pairs #:target target))) '( "build-aux/GNUmakefile.in" "build-aux/config.sh.in" "build-aux/build.sh.in" "build-aux/check.sh.in" "build-aux/install.sh.in" "build-aux/pre-inst-env.in" "build-aux/uninstall.sh.in" "scripts/mesar.in" "scripts/mescc.scm.in" "scripts/mescc.in" )) (chmod "pre-inst-env" #o755) (chmod "scripts/mesar" #o755) (chmod "scripts/mescc" #o755) (chmod "scripts/mescc.scm" #o755) (chmod "build.sh" #o755) (chmod "check.sh" #o755) (chmod "install.sh" #o755) (chmod "uninstall.sh" #o755) (system* "mkdir" "-p" "include/mes") (let ((pkgdatadir (gulp-pipe* "sh" "-c" (string-append "prefix=" prefix ";datadir=" datadir ";echo ${datadir}/mes")))) (with-output-to-file "include/mes/config.h" (lambda _ (if system-libc? (display "#define SYSTEM_LIBC 1 ") (display "#undef SYSTEM_LIBC ")) (display (string-append " #define MES_VERSION \"" VERSION "\" "))))) (substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make")) (let ((arch-dir (string-append srcdest "include/" mes-kernel "/" mes-cpu))) (define (copy-header file-name) (system* "cp" "-f" "-v" (string-append arch-dir "/" file-name) (string-append "include/arch/" file-name))) (system* "mkdir" "-p" "include/arch") (for-each copy-header '("kernel-stat.h" "syscall.h"))) (let ((make (and=> (file-name "make" deps) basename))) (display (string-append " GNU Mes is configured for compiler: " mes-compiler " cpu: " mes-cpu " bits: " mes-bits " libc: " mes-libc " kernel: " mes-kernel " system: " mes-system " tools: " (if numbered-arch? "numbered" "named") " arch bootstrap: " (if with-bootstrap? "yes" "no") " courageous: " (if with-courage? "yes" "no") " Run: " (or make "./build.sh") " to build mes " (or make "./build.sh") " help for help on other targets\n")))))) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/configure.sh�����������������������������������������������������������������������������0000755�0000000�0000000�00000020057�14372371517�011607� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#! /bin/sh # GNU Mes --- Maxwell Equations of Software # Copyright © 2018,2019,2021,2022,2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. set -e VERSION=0.24.2 srcdir=${srcdir-$(dirname $0)} srcdest= if test "$srcdir" != "."; then srcdest=$srcdir/ fi . ${srcdest}build-aux/trace.sh # parse arguments while [ $# -gt 0 ]; do case $1 in (--with-courage) courageous=true ;; (--with-system-libc) mes_libc=system ;; (--build=*) build=${1#--build=} host=${host-$build} ;; (--host=*) host=${1#--host=} ;; (--prefix=*) prefix=${1#--prefix=} ;; (--program-prefix=*) program_prefix=${1#--program-prefix=} ;; esac shift done prefix=${prefix-/usr/local} mes_libc=${mes_libc-mes} courageous=${courageous-false} BASH=${BASH-$(command -v bash || command -v sh)} BLOOD_ELF=${BLOOD_ELF-$(command -v blood-elf)} CC=${CC-$(command -v gcc)} || true CFLAGS=${CFLAGS-} CPPFLAGS=${CPPFLAGS-} DIFF=${DIFF-$(command -v diff || echo $PWD/pre-inst-env diff.scm)} GUILD=${GUILD-$(command -v guild)} || true GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} || true if test ! "$GUILD"; then if test "$GUILE_TOOLS"; then GUILD=$GUILE_TOOLS else GUILD=true fi fi GUILE=${GUILE-$(command -v guile)} || true HEX2=${HEX2-$(command -v hex2)} LDPFLAGS=${LDFLAGS-} M1=${M1-$(command -v M1)} M2_PLANET=${M2_PLANET-$(command -v M2-Planet)} || true KAEM=${KAEM-$(command -v kaem)} || true MES_FOR_BUILD=${MES_FOR_BUILD-$(command -v mes || command -v guile || echo mes)} GIT=${GIT-$(command -v git)} || true PERL=${PERL-$(command -v perl)} || true SHELL=${BASH-$SHELL} if test "$srcdir" = .; then top_builddir=. else srcdest=${srcdest} top_builddir=$PWD fi abs_top_srcdir=${abs_top_srcdir-$(cd ${srcdir} && pwd)} abs_top_builddir=$PWD if test -z "$GUILE" -o "$GUILE" = true; then GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-2.2} else GUILE_EFFECTIVE_VERSION=${GUILE_EFFECTIVE_VERSION-$(guile -c '(display (effective-version))')} fi numbered_arch=false mes_tools=named if ( $HEX2 --help 2>&1 ) | grep -q "\-\-Architecture 12345"; then numbered_arch=true mes_tools=numbered fi bindir=$(eval echo ${bindir-$prefix/bin}) datadir=$(eval echo ${datadir-$prefix/share}) docdir=$(eval echo ${docdir-$datadir/doc/mes}) infodir=$(eval echo ${infodir-$datadir/info}) includedir=$(eval echo ${includedir-$prefix/include}) libdir=$(eval echo ${libdir-$prefix/lib}) pkgdatadir=$(eval echo ${pkgdatadir-$datadir/mes}) mandir=$(eval echo ${mandir-$datadir/man}) guile_site_dir=$(eval echo ${guile_site_dir-$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION}) guile_site_ccache_dir=$(eval echo ${guile_site_ccache_dir-$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache}) subst () { echo "creating $2" sed \ -e s,"@PACKAGE@,$PACKAGE,"\ -e s,"@PACKAGE_NAME@,$PACKAGE_NAME,"\ -e s,"@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,"\ -e s,"@VERSION@,$VERSION,"\ -e s,"@bootstrap@,true,"\ -e s,"@build@,$build,"\ -e s,"@host@,$host,"\ -e s,"@compiler@,$compiler,"\ -e s,"@courageous@,$courageous,"\ -e s,"@mes_bits@,$mes_bits,"\ -e s,"@mes_kernel@,$mes_kernel,"\ -e s,"@mes_cpu@,$mes_cpu,"\ -e s,"@mes_libc@,$mes_libc,"\ -e s,"@mes_system@,$mes_system,"\ -e s,"@abs_top_srcdir@,$abs_top_srcdir,"\ -e s,"@abs_top_builddir@,$abs_top_builddir,"\ -e s,"@top_builddir@,$top_builddir,"\ -e s,"@srcdest@,$srcdest,"\ -e s,"@srcdir@,$srcdir,"\ -e s,"@prefix@,$prefix,"\ -e s,"@program_prefix@,$program_prefix,"\ -e s,"@bindir@,$bindir,"\ -e s,"@datadir@,$datadir,"\ -e s,"@docdir@,$docdir,"\ -e s,"@guile_site_dir@,$guile_site_dir,"\ -e s,"@guile_site_ccache_dir@,$guile_site_ccache_dir,"\ -e s,"@infodir@,$infodir,"\ -e s,"@includedir@,$includedir,"\ -e s,"@libdir@,$libdir,"\ -e s,"@mandir@,$mandir,"\ -e s,"@pkgdatadir@,$pkgdatadir,"\ -e s,"@sysconfdir@,$sysconfdir,"\ -e s,"@GUILE_EFFECTIVE_VERSION@,$GUILE_EFFECTIVE_VERSION,"\ -e s,"@GUILE_LOAD_PATH@,$GUILE_LOAD_PATH,"\ -e s,"@V@,$V,"\ -e s,"@AR@,$AR,"\ -e s,"@BASH@,$BASH,"\ -e s,"@BLOOD_ELF@,$BLOOD_ELF,"\ -e s,"@CC@,$CC,"\ -e s,"@DIFF@,$DIFF,"\ -e s,"@GIT@,$GIT,"\ -e s,"@GUILD@,$GUILD,"\ -e s,"@GUILE@,$GUILE,"\ -e s,"@PERL@,$PERL,"\ -e s,"@CFLAGS@,$CFLAGS,"\ -e s,"@HEX2@,$HEX2,"\ -e s,"@HEX2FLAGS@,$HEX2FLAGS,"\ -e s,"@M1@,$M1,"\ -e s,"@M1FLAGS@,$M1FLAGS,"\ -e s,"@M2_PLANET@,$M2_PLANET,"\ -e s,"@KAEM@,$KAEM,"\ -e s,"@MES_FOR_BUILD@,$MES_FOR_BUILD,"\ -e s,"@numbered_arch@,$numbered_arch,"\ -e s,"@SHELL@,$SHELL,"\ $1 > $2 } host=${host-$($CC -dumpmachine 2>/dev/null)} if test -z "$host$host_type"; then mes_cpu=${arch-$(get_machine || uname -m)} else mes_cpu=${host%%-*} fi if test "$mes_cpu" = i386\ || test "$mes_cpu" = i486\ || test "$mes_cpu" = i586\ || test "$mes_cpu" = i686; then mes_cpu=x86 fi if test "$mes_cpu" = armv4\ || test "$arch" = armv7l; then mes_cpu=arm fi if test "$mes_cpu" = amd64; then mes_cpu=x86_64 fi case "$host" in *linux-gnu|*linux) mes_kernel=linux;; *gnu) mes_kernel=gnu;; *freebsd*) mes_kernel=frreebsd;; *) mes_kernel=linux;; esac case "$mes_cpu" in x86_64) mes_bits=64;; *) mes_bits=32;; esac # if $CC --version | grep gcc; then compiler=gcc elif $CC --version | grep tcc; then compiler=gcc else compiler=mescc if ! $CC --version; then CC="$PWD/pre-inst-env mescc" fi if test "$CC" = "M2-Planet"; then CC="$PWD/pre-inst-env mescc" fi AR=${AR-$PWD/pre-inst-env mesar} fi AR=${AR-$(command -v ar)} || true mes_system=$mes_cpu-$mes_kernel-mes mkdir -p scripts subst ${srcdest}build-aux/GNUmakefile.in GNUmakefile subst ${srcdest}build-aux/config.sh.in config.sh subst ${srcdest}build-aux/bootstrap.sh.in bootstrap.sh chmod +x bootstrap.sh subst ${srcdest}build-aux/build.sh.in build.sh chmod +x build.sh subst ${srcdest}build-aux/check.sh.in check.sh chmod +x check.sh subst ${srcdest}build-aux/install.sh.in install.sh chmod +x install.sh subst ${srcdest}build-aux/pre-inst-env.in pre-inst-env chmod +x pre-inst-env subst ${srcdest}scripts/mesar.in scripts/mesar chmod +x scripts/mesar subst ${srcdest}scripts/mescc.scm.in scripts/mescc.scm chmod +x scripts/mescc.scm subst ${srcdest}scripts/mescc.in scripts/mescc chmod +x scripts/mescc subst ${srcdest}build-aux/uninstall.sh.in uninstall.sh chmod +x uninstall.sh mkdir -p include/mes rm -f include/mes/config.h if test $mes_libc = system; then cat >> include/mes/config.h <<EOF #define SYSTEM_LIBC 1 EOF else cat >> include/mes/config.h <<EOF #undef SYSTEM_LIBC EOF fi cat >> include/mes/config.h <<EOF #define MES_VERSION "$VERSION" EOF mkdir -p include/arch cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/kernel-stat.h include/arch cp -f -v ${srcdest}include/${mes_kernel}/${mes_cpu}/syscall.h include/arch cat <<EOF GNU Mes is configured for compiler: $compiler cpu: $mes_cpu bits: $mes_bits libc: $mes_libc kernel: $mes_kernel system: $mes_system tools: $mes_tools arch courageous: $courageous bootstrap: yes Run: sh bootstrap.sh to bootstrap build mes sh check.sh to check mes sh install.sh to install mes EOF ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE��������������������������������������������������������������������0000644�0000000�0000000�00000003335�14372371517�012773� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: on bootstrapping: introducing Mes Date: Sun, 19 Jun 2016 13:08:02 +0200 Hi, I have a minimal LISP-1.5-resembling interpreter in C that now can also interpret itself https://gitlab.com/janneke/mes It was inspired by the seemingly often ignored bootstrapping question made so painfully visible by GuixSD and by OriansJ with their self hosting hex assembler project. As a next step after a hex assembler I was thinking of getting Scheme up and running and use that to create a tiny C compiler, probably using PEG. For that I think we need define-syntax, which I had a peek at and still scares the all-sorts-of-things out of me :-) I searched for minimal Lisp/Scheme to get that going and found an article called the Maxwell Equations of Software 1) with a pointer to the 1962 LISP 1.5 paper by John McCarthy 2). First I `implemented' Mes/LISP-1.5: the bottom half of page 13 and the necessary helper procedures defined on pages 8-12 using Guile, removing all but the primitives needed to run LISP-1.5/Mes (I think): car, cdr, cond, cons, define, eq?, '()/nil, null?, pair? and quote. I cheated with read, and with display and newline for debugging. Then I translated the program into C and got rid of read by using getchar/ungetchar. It's been great fun and now I'm kind of stuck a bit at the point of implementing macros. I have a simplistic version in C but want to remove that again --I like the idea of having the absolute minimal LISP interpreter in C-- and only introduce macros after having bootstrapped into the LISP/Mes domain. Greetings, Jan 1) http://www.michaelnielsen.org/ddi/lisp-as-the-maxwells-equations-of-software/ 2) http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.10���������������������������������������������������������������0000644�0000000�0000000�00000007702�14372371517�013351� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.10 released I am pleased to announce the release of Mes 0.10, representing 82 commits over 6 weeks. Mescc now compiles a bootstrappable-modified TinyCC into a mes-tcc that in turn can successfully compile a trivial C program. * About Mes[0] aims to create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. This C prototype will be rewritten in stage0[3] M1 assembly (or possibly stage2 slow-LISP, or ...). The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], Pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler (mescc.mes). The simple C compiler can compile a modified TinyCC[8] that is starting to work! A gcc-compiled tcc is known[9] to compile GCC. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0 ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.10 -O mes-0.10.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.10 since 0.9 ** Core *** 2 new functions logand, lognot. ** Mescc *** Mes now includes M1 sources for full source bootstrapping up to tcc. *** Mescc now depends on Nyacc 0.81.0. *** Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out. *** Mescc now supports several (as used my tinycc) struct by value assignments. *** Mescc now has _start in a separate crt1.c. *** Mescc now supports initializer arithmetic. *** Mescc now supports arrays of struct of arbitrary size. *** Mescc now supports pointer arithmetic. *** Mescc now defines __i386__, __linux__. *** Mescc now supports --*p, ++*p. *** Mescc now supports int foo[bar] = {baz,...}. *** Mescc now supports \x00 in strings in M1. *** Mescc now supports complex enum expressions. Thanks, rain1! *** Mescc now supports short. *** Mescc now supports foo.bar = foo.baz = bla. *** Mescc now supports foo = bar < baz and comparison permutations. *** Mescc now supports (anonymous) structs in unions. *** Mescc now writes M1 strings if possible. **** 2 improved mlibc functions malloc, realloc. **** 13 new mlibc functions fclose, fgetc, fprintf, fwrite, memcpy, memmove, memset, snprintf, strcat, strchr, strrchr, strtoull, vnsprintf. **** 15 new tinycc-support tests 76-pointer-arithmetic.c, 77-pointer-assign.c, 78-union-struct.c, 79-int-array.c, 7a-struct-char-array.c, 7b-struct-int-array.c, 7c-dynarray.c, 7d-cast-char.c, 7e-struct-array-access.c, 7f-struct-pointer-arithmetic.c, 7g-struct-byte-word-field.c, 7h-struct-assign.c, 7i-struct-struct.c, 7j-strtoull.c, 7k-for-each-elem.c. ** Noteworthy bug fixes *** Mescc has many fixes for foo.bar[baz], foo[bar].baz with ./-> permutations. *** Many bugs and limitations in mescc have been fixed and removed. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/stage0 [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf ��������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.11���������������������������������������������������������������0000644�0000000�0000000�00000005576�14372371517�013361� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.11 released I am pleased to announce the release of Mes 0.11, representing 16 commits over 10 weeks. MesCC now compiles a less heavily patched TinyCC into a mes-tcc that in turn passes 41/69 of mescc's C tests. When mes-tcc passes all 69 tests, this almost-full-source-bootstrapped version of TinyCC should be able to compile itself. An unpatched, GNU Gcc-compiled tcc is known to compile GNU Gcc. * About Mes[0] aims to create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. This C prototype will be rewritten in stage0[3] M1 assembly (or compiled by M2-Planet or stage2 slow-LISP, or ...). The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], Pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler MesCC (mescc.mes). MesCC can compile a modified TinyCC[8] that is close to being self-hosting. A GNU Gcc-compiled tcc is known[9] to compile GCC. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0 ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.11 -O mes-0.11.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.11 since 0.10 ** MesCC *** MesCC now compiles a mes-tcc that passes 41/69 of mescc's C tests. *** MesCC's libc can now be compiled with tcc (syscall support: write). *** MesCC now compiles a less-patched tcc: -214/+458 lines [WAS: -333/+747]. *** MesCC now supports empty for. *** MesCC has been greatly refactored, 500/3000 lines have been removed. *** MesCC now supports complex [struct] by value assign foo.bar, foo->bar, foo[bar]. *** MesCC now depends on Nyacc 0.82.4. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/stage0 [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf ����������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.12���������������������������������������������������������������0000644�0000000�0000000�00000007660�14372371517�013356� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.12 released I am pleased to announce the release of Mes 0.12, representing 120 commits over 20 weeks. MesCC is prototyped running on Guile and can now run on Mes. Performance of Mes running MesCC has been improved by a factor of 100; mes.c (~3000 LOC) now compiles in ~4min. Many fixes and enhancements make that now also TinyCC parses (~1.5h) and compiles (~20min) with Mes+MesCC (Guile+MesCC takes ~2min). Special thanks go to Ricardo Wurmus for sharing the recursive macro expand perspective and starting work on that, to Han-Wen Nienhuys for his sharp `Ah, so you skipped SICP chapter 3' remark and to rain1 for their continuous help on #bootstrapping and their `let's only expand global variables' insight. * About Mes[0] aims to create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. This C prototype will be simplified to be transpiled by M2-Planet[3]. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler MesCC (mescc.mes). MesCC can compile a modified TinyCC[8] that is close to being self-hosting. A GNU Gcc-compiled tcc is known[9] to compile GCC. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.12 -O mes-0.12.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.12 since 0.11 ** Core *** Mes can now run Nyacc (0.80.42) to compile itself in ~4min (~3000 LOC). *** Mes now recursively expands global variables per top level statement. *** Mes now recursively expands macros per top level statement. *** Mes now boots from MES_BOOT (default: module/mes/boot-0.scm). *** Mes now has a full Scheme reader in C again. This gives a 10x-20x performance improvement and increases the bootstrap footprint by 160 LOC. *** Mes reader now supports older abbreviated character forms #\bel, #\bs, #\ht and #\vt. *** 3 new functions equal2?, memq, core:write. ** Language *** Mes now has an incremental Scheme semantics test suite with 71 small tests. *** Variable names can now have ticks. *** Mes now evaluates expresions of COND only once. *** srfi-9 records have been reimplemented. *** #\page is now whitespace. *** #<eof> is no longer a character. *** 2 new macros define-macro*, with-fluids. *** 9 new functions dirname, last, reverse-list->string, setenv, string-drop-right, string-fold, string-fold-right, string-null?, write. ** MesCC **** 9 new functions chmod, getopt_long, ferror, itoab, longjmp, qsort, setenv, setjmp, strtol. **** 2 new header files endian.h, sys/signal.h. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/m2-planet [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://github.com/oriansj/stage0 ��������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.13���������������������������������������������������������������0000644�0000000�0000000�00000006547�14372371517�013362� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.13 released I am pleased to announce the release of Mes 0.13, representing 45 commits over 3 weeks. MesCC can now compile a functional tcc when running on Mes (in ~1h45') or on Guile (in ~3min). This means that we are getting very close to a full source bootstrap of tcc: it is now built without gcc, glibc or guile; using only MesCC-tools and Mes sources and corresponding ascii/binary seeds. * About Mes[0] aims to help create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting Scheme interpreter prototype in C and a Nyacc-based C compiler in Scheme. This C prototype is being simplified to be transpiled by M2-Planet[3]. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler MesCC. Mes+MesCC can compile a modified TinyCC[8] that is close to being self-hosting. A GNU Gcc-compiled tcc is known[9] to compile GCC. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/-/archive/v0.13/mes-0.13.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.13 since 0.12 ** Core *** Bootstrapped Mes+MesCC can now compile a patched tcc in ~2h30' (~25,000 LOC). *** MesCC scripts for Mes and Guile are now merged; executable is: `mescc'. *** Mes now uses only one arena for stop-and-copy; doubles available size. *** Mes now has a Guile-like command-line interface (mes.repl has been removed). *** Mes now boots into a full Scheme by default. *** Mes can now be compiled (MES_MINI=1) to boot into a minimal Scheme (~2000 cells). *** Mes now creates less garbage in the reader and in append2, append_reverse, reverse, reverse!, vector-for-each, vector-to-list, vector-map. *** 5 new functions append-reverse, chmod, ioctl, isatty, isspace, last_pair, reverse!. ** Language *** 3 new functions char-whitespace?, chmod, isatty? ** Noteworthy bug fixes *** Two bugs in the jam scraper/garbage collector have been fixed. *** equal2_p now uses tail call elimination. *** Escaped characters in strings are now read and write'd correctly. *** The repl now expands macros again. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/m2-planet [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://github.com/oriansj/stage0 ���������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.14���������������������������������������������������������������0000644�0000000�0000000�00000010466�14372371517�013356� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.14 released I am pleased to announce the release of Mes 0.14, representing 98 commits over 4 weeks. Mes+MesCC now compiles a self-hosting TinyCC that has only been slightly patched. This means that we can now build a tcc that depends only on a 1MB ASCII M1 seed. GuixSD currently uses a ~250MB binary seed to build gcc. Next targets are: build gcc using this almost full-source bootstrapped tcc, and reduce the 1MB ASCII M1 seed to ~100KB of M2 source, which is a restricted subset of C. Packages are available from Guix's wip-bootstrap branch. * About Mes[0] aims to help create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting Scheme interpreter prototype in C and a Nyacc-based C compiler in Scheme. This C prototype is being simplified to be transpiled by M2-Planet[3]. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler MesCC. Mes+MesCC can compile an only slightly patched TinyCC[8] that is self-hosting. A GNU Gcc-compiled tcc is known[9] to compile GCC. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/-/archive/v0.14/mes-0.14.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.14 since 0.13 ** Core *** Bootstrapped Mes+MesCC now compiles a tcc that is self-hosting and only slightly patched. *** The reader now supports binary numbers (previously: read as decimal). *** String port support has been moved to C. *** The build has been simplified, the Make-in-Scheme experiment has been removed. *** 2 new functions chmod, logxor. ** Language *** Mes now supports define-immutable-record-type and single set-field from srfi-9 gnu. *** 12 new functions basename, chmod, const, delete-duplicates, logxor, string-contains, string-map, string-replace, string-trim, string-trim-both, string-trim-right, unfold. ** MesCC *** MesCC now supports standalone usage of nestedly defined enums, structs and unions. *** MesCC now supports comparison of unsigned and promotion of signed/unsigned -> unsigned. *** MesCC now supports sign extension for char, short. *** MesCC now has stubbing for floats; compiling works, data is fu. *** MesCC now has full suport for switch case, e.g. with default as first clause. *** MesCC now supports destruction of casted expressions: ((struct foo*)p)->bar. *** MesCC now has full support for pre/post, e.g.: (foo--)->bar and permutations. *** MesCC now supports sizeof any expression or type. *** MesCC now supports initialization of anonymous unions. *** MesCC now supports bit fields. *** MesCC now supports valued functions in expressions: destruction and dereferencing. *** MesCC now supports function-static variables. *** MesCC now supports initializer lists in structs and unions. *** MesCC now has full support for heterogeneous variable declarations, e.g.: char p, *x = "foo", buf[3]; **** 4 new functions __lshrdi3, __ashldi3, __ashrdi3, strncpy. **** 9 new mlibc stubs __fixdfdi, __fixsfdi, __fixunsxfdi, __fixxfdi, __floatundixf, ldexp, strtod, strtof, strtold. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/m2-planet [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://github.com/oriansj/stage0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.15���������������������������������������������������������������0000644�0000000�0000000�00000010532�14372371517�013351� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.15 released I am pleased to announce the release of Mes 0.15, representing 45 commits over 3 weeks. The GNU toolchain is getting bootstrapped! As of 0.14, Mes+MesCC compiles a self-hosting TinyCC. Using the 0.15 Mes C library, this TinyCC can build the GNU tools triplet: binutils-2.14, gcc-2.95.3, glibc-2.2.5. This means that we can build a GNU toolchain that depends only on a critical 1MB ASCII M1 seed. GuixSD currently uses a ~250MB binary seed to build gcc. Next targets are: upstream the Mes bootstrap to GuixSD, build a Gcc-4.7 and Glibc-2.23, bootstrap utilities like bison, flex, grep, sed..., replace GuixSD's bootstrap for x86 and reduce the 1MB ASCII M1 seed to ~5000 LOC/~100KB of M2 source, which is a restricted subset of C. Packages are available from Guix's wip-bootstrap branch. * About Mes[0] aims to help create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting Scheme interpreter prototype in C and a Nyacc-based C compiler in Scheme. This C prototype is being simplified to be transpiled by M2-Planet[3]. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler MesCC. Mes+MesCC can compile an only slightly patched TinyCC[8] that is self-hosting. Using the Mes C library, this tcc can now build the GNU tools triplet: binutils-2.14, gcc-2.95.3, glibc-2.2.5. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[9] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[10] ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/-/archive/v0.15/mes-0.15.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.15 since 0.14 ** Core *** Support fork, exec, waitpid. *** Boot-0 loading has been refactored. *** MesCC now has out of the box Geiser support. ** Language *** 2 new functions drop, drop-right. ** MesCC *** MesCC and Mes Lib C can now build binutils-2.30, gcc-2.95.3 and glibc-2.2.5. *** MesCC now provides dummy crti.o, crtn.o so that tcc needs not be patched for those. *** Mes Lib C now supports compiling glibc-2.2.25. *** Mes Lib C now supports compiling gcc-2.95.3 *** Mes Lib C now supports compiling binutils-2.30. *** Mes Lib C now supports compiling m4-1.4. *** Mes Lib C has been split into archs: gcc, x86-mes-gcc and x86-mes. *** MesCC now has a posixy command line interface. **** 70 new functions abs, access, alarm, alloca, atexit, atol, bcmp, bcopy, brk, bzero, chmod, clearerr, close, dup, dup2, execve, fabs, fcntl, fdgets, feof, fgets, fileno, fork, freopen, fscanf, fstat, fsync, getcwd, getgid, getpid, getrusage, getuid, index, ioctl, isalnum, isalpha, isascii, iscntrl, isprint, ispunct, kill, link, lseek, lstat, mkdir, mktemp, nanosleep, open, perror, pipe, raise, read, rename, rindex, rmdir, sbrk, sbrk, setitimer, signal, sleep, stat, strcspn, strdup, strerror, strncat, strpbrk, strspn, unlink, unsetenv, waitpid. **** 23 new stubs abort, atof, bsearch, bsearch, chown, ctime, fpurge, freadahead, frexp, getpwnam, gmtime, mbstowcs, pclose, popen, rewind, setbuf, sigsetmask, strftime, sys_siglist, system, times, umask, utime. **** 10 new C tests 51-strcmp.c, 70-printf.c, 87-sscanf.c, 90-strpbrk.c, 91-fseek.c, 92-stat.c, 93-fread-fwrite.c, 94-unsetenv.c, 95-signal.c, 96-strto.c. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/m2-planet [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [10] https://github.com/oriansj/stage0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.16���������������������������������������������������������������0000644�0000000�0000000�00000007500�14372371517�013353� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.16 released I am pleased to announce the release of Mes 0.16, representing 27 commits over 2 weeks. A most annoying ELF header bug was fixed that suddenly had all Mes binaries segfault before entering `_start' on Linux 4.17 and later. We now have binutils-2.20.1 and gcc-4.1.0, both compiled with gcc-2.95.3 and glibc-2.2.5. This reduced-binary-seed bootstrap still depends on these bootstrap binaries: BOOTSTRAP-GUILE, flex, bash, bzip2, coreutils, diffutils, gawk, grep, gzip, make, sed, tar, on the small binary seeds: tinycc-seed, mescc-seed and on the mes.M1 ASCII seed. Next targets: - build a Gcc 4.7 and Glibc 2.23 - upstream the x86 Mes bootstrap to GuixSD - reduce the 1MB ASCII M1 seed to ~5000 LOC/~100KB of M2 source - revive Gash: a posix shell for Guile to reduce the bootstrap binary dependencies - and/or otherwise reduce the bootstrap binary dependencies Packages are available from Guix's wip-bootstrap branch. * About Mes[0] aims to help create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] effort. It currently consists of a mutual self-hosting Scheme interpreter prototype written in C and a Nyacc-based C compiler written in Scheme. This C prototype is being simplified[3] to be transpiled by M2-Planet[4]. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[5], Pre-R6RS portable syntax-case[6] with R7RS ellipsis, Matt Wette's Nyacc[7], Guile's PEG[8] --and test suite just barely enough to support a simple REPL and simple C-compiler: MesCC. Mes+MesCC can compile an only lighty patched TinyCC[9] that is self-hosting. Using this tcc and the Mes C library we now have a reduced-binary-seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-4.1.0. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~500 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/-/archive/v0.16/mes-0.16.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Get informed, get involved Join #bootstrappable on irc.freenode.net. * Changes in 0.16 since 0.15 ** Core *** Support building with tcc, including Mes Lib C in-line assembly. *** core:execl now supports 1000 arguments. ** MesCC *** Mes Lib C now bootstraps glibc-2.2.5, binutils-2.20.1, gcc-4.1.0. *** MesCC binaries now run on Linux 4.17 too, i.e. survive Linus' new `sane mmap limits.' *** MesCC now runs with mescc-tools 0.5 (no = in long options). **** 3 new C test 88-strrchrc, 97-fopen.c, 98-fopen.c. ** Noteworthy bug fixes *** strrchr now stops when it reaches start of string. *** fopen now return 0 upon failure. Supports binutils' hack: fd=-2 means `cached'. *** vfprintf, vsprintf now support precision and width on integers strings better. *** fread now produces ungetc'd chars too. *** memcmp now supports comparing 0 bytes, supporting binutils. *** The unused ELF header data section, identical to the text section, has been removed. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/mes-m2 [4] https://github.com/oriansj/m2-planet [5] https://github.com/schemeway/lalr-scm [6] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [7] https://www.nongnu.org/nyacc [8] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [9] https://gitlab.com/janneke/tinycc [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://github.com/oriansj/stage0 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.17���������������������������������������������������������������0000644�0000000�0000000�00000010041�14372371517�013346� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: GNU Mes 0.17 released <#secure method=pgpmime mode=sign> We are delighted to announce the release of GNU Mes 0.17, representing 64 commits over 6 weeks. Mes is now an official GNU package and we have bootstrapped gcc-4.7.4 for x86-linux with a reduced binary seed (i.e., without regular toolchain). Next targets: - upstream the x86 Mes bootstrap to GuixSD - create a x86_64 Mes C Lib, see if that is is enough to bootstrap x86_64 - reduce the 1MB ASCII M1 seed to ~5000 LOC/~100KB of M2 source - create a plan for Geesh and Gash and use them to reduce the bootstrap binary dependencies - and/or otherwise reduce the bootstrap binary dependencies Packages are available from Guix's wip-bootstrap branch. * About GNU Mes[0] aims to help create full source bootstrapping for GNU/Linux distributions such as GuixSD[1] as part of the bootstrappable builds[2] effort. It consists of a mutual self-hosting Scheme interpreter written in ~5,000 LOC of simple C and a Nyacc-based C compiler written in Scheme. This mes.c is being simplified[3] to be transpiled by M2-Planet[4]. The Scheme interpreter (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[5], Pre-R6RS portable syntax-case[6] with R7RS ellipsis, Matt Wette's Nyacc[7] --and test suite just barely enough to support a simple REPL and simple C-compiler: MesCC. Mes+MesCC can compile an only lightly patched TinyCC[8] that is self-hosting. Using this tcc and the Mes C library we now have a reduced-binary-seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-4.7.4. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[9] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[10] ~500 byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.17.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.17.tar.gz.sig Use a mirror for higher download bandwidth: https://www.gnu.org/order/ftp.html Here are the MD5 and SHA1 checksums: 93ca82612e203fd667dfbdfb83c06549 mes-0.17.tar.gz d38ec93ab6dc2c92a5c5e96fef7f9295972772c2 mes-0.17.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.17.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] from a git checkout by running guix package -f .guix.scm * Get informed, get involved Join #bootstrappable on irc.freenode.net. * Changes in 0.17 since 0.16.1 ** Core *** GNU Mes is now an official GNU package. *** MesCC is now installed as a regular Guile package. *** Support --srcdir build. *** Support all standard GNU make targets. ** MesCC *** Mes C Lib now bootstraps glibc-2.2.5, binutils-2.20.1, gcc-4.7.4. * Changes in 0.16.1 since 0.16 ** Core *** Mes now builds out of the box on Debian buster/testing. *** Mes now comes with a generic build recipe: build-aux/setup-mes.sh. *** Mes now comes with INFO documentation. ** MesCC *** MesCC now exits if spawning BLOOD_ELF, M1, or HEX2 fails. Greetings, janneke [0] https://www.gnu.org/software/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/mes-m2 [4] https://github.com/oriansj/m2-planet [5] https://github.com/schemeway/lalr-scm [6] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [7] https://www.nongnu.org/nyacc [8] https://gitlab.com/janneke/tinycc [9] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [10] https://github.com/oriansj/stage0 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.18���������������������������������������������������������������0000644�0000000�0000000�00000011735�14372371517�013362� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.18 released <#secure method=pgpmime mode=sign> We are pleased to announce the release of GNU Mes 0.18, representing 83 commits over 8 weeks. Mes is now bringing a Reduced Binary Seed bootstrap to GuixSD; the size of bootstrap binaries has been halved and no regular toolchain binaries are used as binary seeds (i686-linux and x86_64-linux only). MesCC has been refactored to use an abstracted assembly language and can now (cross-)build x86_64 binaries. Next targets: - reduce the 1MB ASCII M1 seed to ~5000 LOC/~100KB of M2 source - revive Gash/Geesh and use it to decimate the remaining bootstrap binary seeds - and/or otherwise reduce the bootstrap binaries - ARM, the Hurd? Packages are available from Guix's core-updates-next branch. * About GNU Mes[0] brings a Reduced Binary Seed bootstrap[1] to GuixSD[2] and potentially to any other interested GNU/Linux distribution, and aims to help create a full source bootstrap as part of the bootstrappable builds[3] effort. It consists of a mutual self-hosting Scheme interpreter written in ~5,000 LOC of simple C and a Nyacc-based C compiler written in Scheme. This mes.c is being simplified[4] to be transpiled by M2-Planet[5]. The Scheme interpreter (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[6], Pre-R6RS [portable syntax-case[7] with R7RS ellipsis, Matt Wette's Nyacc[8] --and test suite just barely enough to support a simple REPL and simple C-compiler: MesCC. Mes+MesCC can compile an only lightly patched TinyCC[9] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap GuixSD for i686-linux and x86_64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~500 byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.18.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.18.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.18.tar.gz https://ftpmirror.gnu.org/mes/mes-0.18.tar.gz.sig Here are the MD5 and SHA1 checksums: f9f901f175fbc8a5a3d90c9c551ccc8c mes-0.18.tar.gz 4f7612731a745ebb806548186453d55e0d0bf217 mes-0.18.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.18.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] from a git checkout by running guix package -f .guix.scm * Get informed, get involved Join #bootstrappable on irc.freenode.net. * Changes in 0.18 since 0.17.1 ** Core *** Mes/MesCC now supports x86_64. *** Mes/MesCC now brings a Reduced Binary Seed bootstrap to GuixSD. ** Language *** fold-right now supports 3 lists. ** MesCC *** MesCC now supports x86_64 (also as cross build), using -m 64. *** Mes C Library now has better support for bootstrapping gcc-3.0. *** Mes C test suite now has 178 tests; 74 tests were added. *** MesCC has been refactored to support use an abstracted assembly language. *** MesCC now uses Nyacc 0.86.0. ** Noteworthy bug fixes *** scaffold/tests/7s-struct-short.c has been fixed. * Changes in 0.17.1 since 0.17 ** MesCC *** Mes C Library has now been exploded into a separate C file per function. *** Mes C Library now bootstraps glibc-2.16.0, binutils-2.20.1, gcc-4.7.4. *** Mes C Library now supports compiling make-3.82. *** Mes C Library now supports compiling diffutils-2.7. *** Mes C Library now supports x86_64. **** 7 new functions chdir, clock_gettime, closedir, execl, opendir, readdir, time. **** 5 new stubs getlogin, setlocale, setvbuf, sigaddset, sigblock. ** Noteworthy bug fixes *** qsort can now handle lists with duplicate entries. Greetings, janneke [0] https://www.gnu.org/software/mes [1] http://joyofsource.com/reduced-binary-seed-bootstrap.html [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/mes-m2 [5] https://github.com/oriansj/m2-planet [6] https://github.com/schemeway/lalr-scm [7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [8] https://www.nongnu.org/nyacc [9] https://gitlab.com/janneke/tinycc [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://github.com/oriansj/stage0 �����������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.19���������������������������������������������������������������0000644�0000000�0000000�00000014405�14372371517�013360� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.19 released <#secure method=pgpmime mode=sign> We are pleased to announce the release of GNU Mes 0.19, representing 100 commits over 10 weeks. Mes has now brought the Reduced Binary Seed bootstrap to Guix (bootstrap a GNU/Linux system without binary GNU toolchain or equivalent) and work is ongoing to audit and verify this bootstrap path in NixOS. This release introduces strings as byte-array, hash-tables and native structs. While that does increase the footprint somewhat, it fixes our performance issue; tinycc is now compiled in ~8min (WAS: ~1h30). Next targets: - translate mes.c into unsnarfed mes.M2 - use Gash to remove bash, coreutils&co, grep, sed, tar from the Guix bootstrap binaries - replace the NixOS bootstrap - use dietlibc, uClibc, ... for bootstrapping GNU (bash, binutils, gcc, tar) and remove Mes C lib+gnu? - bootstrap gcc-3.x or 4.x directly, drop initial gcc-2.95.3 target? - have M1+hex2 create gcc/tcc-usable object files? archives? - Debian? - ARM, the Hurd? Packages are available from Guix's core-updates branch. * About GNU Mes[0] brings a Reduced Binary Seed bootstrap[1] to Guix[2] and potentially to any other interested GNU/Linux distribution, and aims to help create a full source bootstrap as part of the bootstrappable builds[3] effort. It consists of a mutual self-hosting Scheme interpreter written in ~5,000 LOC of simple C and a Nyacc-based C compiler written in Scheme. This mes.c is being simplified[4] to be transpiled by M2-Planet[5]. The Scheme interpreter (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[6], Pre-R6RS [portable syntax-case[7] with R7RS ellipsis, Matt Wette's Nyacc[8] --and test suite just barely enough to support a simple REPL and simple C-compiler: MesCC. Mes+MesCC can compile an only lightly patched TinyCC[9] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux and x86_64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~500 byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.19.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.19.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.19.tar.gz https://ftpmirror.gnu.org/mes/mes-0.19.tar.gz.sig Here are the MD5 and SHA1 checksums: 99e134df87adc5fc5fd2c04941929c23 mes-0.19.tar.gz c9781b3b6a814acc985c2ac68caa111a56583bca mes-0.19.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.19.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. Mes runs from the source tree and can also be built, packaged and installed in Guix from a git checkout by running guix package -f .guix.scm * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.freenode.net. * Changes in 0.19 since 0.18 ** Core *** The build system has been simplified. *** Mes now prints a backtrace upon error. *** Performance has been improved 2-8 times, making Mes 2-10 times slower than Guile. *** Mes now supports a module type and uses a `boot-module'. *** Mes now supports a hash_table type. *** Mes now supports a struct type. *** Mes now supports building a %bootstrap-mes seed from Guix. ** Language *** Records are now implemented using struct (WAS: vector). *** 44 new functions ceil, char-downcase, char-set-adjoin, char-set-complement, char-upcase, current-time, delete-file, dup, dup2, file-exists?, floor, frame-printer, get-internal-run-time, getcwd, gettimeofday, hash, hash-ref, hash-set!, hash-table-printer, hashq, hashq-get-handle, hashq-ref, hashq-set, inexact->exact, make-hash-table, make-stack, make-struct, module-define!, module-printer, module-ref, module-variable, read-line, round, stack-length, stack-ref, string-downcase, string-tokenize, string-upcase, struct-length, struct-ref, struct-set! struct-vtable, struct-vtable, with-error-to-file. ** MesCC *** Assembly defines have been cleaned-up: duplicates deleted, missing added, wrong fixed. *** MesCC now supports compiling GNU Bash and GNU Tar. **** 6 New functions getegid, geteuid, getppid, setgid, setuid, sigdelset, sigprocmask. **** 22 New macros EACCES, ENOSPC, ESPIPE, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, LLONG_MAX, LLONG_MIN, SIZE_MAX SYS_getegid, SYS_geteuid, SYS_setgid SYS_setuid, S_IRGRP, S_IROTH, S_IRWXG, S_IRWXO S_ISGID, S_ISUID, S_IWGRP, S_IWOTH, S_IXGRP, S_IXOTH, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, _POSIX_VERSION. ** Noteworthy bug fixes *** Mes now supports characters #\xNN. *** Mes now supports assq-ref and assoc-ref with alist == #f. *** Mes now supports \xNN in strings. This allows using Nyacc-0.86.0. *** MesCC now supports the unary plus operator. *** MesCC now supports the `U' integer suffix. *** MesCC now comes with INTnn_MIN/MAX, UINTnn defines in stdint.h. *** MesCC now always exits non-zero when assembler or linker fail. Greetings, janneke [0] https://www.gnu.org/software/mes [1] http://joyofsource.com/reduced-binary-seed-bootstrap.html [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/mes-m2 [5] https://github.com/oriansj/m2-planet [6] https://github.com/schemeway/lalr-scm [7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [8] https://www.nongnu.org/nyacc [9] https://gitlab.com/janneke/tinycc [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://github.com/oriansj/stage0 �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.20���������������������������������������������������������������0000644�0000000�0000000�00000011320�14372371517�013341� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.20 released <#secure method=pgpmime mode=sign> We are pleased to announce the release of GNU Mes 0.20, representing 147 commits over 38 weeks. Mes has now brought the Reduced Binary Seed bootstrap to Guix (bootstrap a GNU/Linux system without binary GNU toolchain or equivalent). It should land in Guix master any day now: a big thank you to everyone who helped, notably Ludovic and Mark. This release is a step towards the upcoming Scheme-only bootstrap and bringing Mes into NixOS and Debian. This effort is now sponsored by NLnet[12]. Next targets: - ARM support - Reduced Binary Seed bootstrap for ARM - Scheme-only bootstrap: use Guile and Gash to remove bash, coreutils&co, grep, sed, etc. from the Guix bootstrap binaries - mes-m2: port Mes.c to M2-Planet - Introduce Reduced Binaries Seed bootstrap to NixOS - Debian? - Hurd Packages are available in Guix master. * About GNU Mes[0] brings a Reduced Binary Seed bootstrap[1] to GNU Guix[2] and potentially to any other interested GNU/Linux distribution, and aims to help create a full source bootstrap as part of the bootstrappable builds[3] effort. It consists of a mutual self-hosting Scheme interpreter written in ~5,000 LOC of simple C and a Nyacc-based C compiler written in Scheme. This mes.c is being simplified[4] to be transpiled by M2-Planet[5]. The Scheme interpreter (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[6], Pre-R6RS [portable syntax-case[7] with R7RS ellipsis, Matt Wette's Nyacc[8] --and test suite just barely enough to support a simple REPL and simple C-compiler: MesCC. Mes+MesCC can compile an only lightly patched TinyCC[9] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux and x86_64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~500 byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.20.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.20.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.20.tar.gz https://ftpmirror.gnu.org/mes/mes-0.20.tar.gz.sig Here are the MD5 and SHA1 checksums: df839a83e4a2ad6c2a4accc5bf17b1a7 mes-0.20.tar.gz 38d4cb3fa28fa1f5fc57fea9e046d4d8052bbb8c mes-0.20.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.20.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.freenode.net. * Changes in 0.20 since 0.19 ** Core *** The build system has been simplified, again. Mes now builds ootb on Debian. *** Mes now supports -c EXPR. ** Divide by zero is now flagged. ** Language *** 1 new function: take-while. ** MesCC *** The C libraries have been exploded into one function per file. *** MesCC now has enhanced POSIX/gcc comand line support, e.g. -DFOO=1, -nodefaultlibs, -nostartfiles, -nostdlib. *** The archiver is now called `mesar'. *** MesCC now supports Nyacc-0.99. *** MesCC now depends on MesCC-Tools 0.6.0. *** 1 new function __mesabi_uldiv. ** Noteworthy bug fixes *** interger division has been fixed. *** isatty now looks at terminfo. *** signal now uses sigaction correctly for non-x86. *** string->number now support #x hex-prefix. *** ungetc now has a buffer per file handle. Greetings, janneke and Danny. [0] https://www.gnu.org/software/mes [1] http://joyofsource.com/reduced-binary-seed-bootstrap.html [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/mes-m2 [5] https://github.com/oriansj/m2-planet [6] https://github.com/schemeway/lalr-scm [7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [8] https://www.nongnu.org/nyacc [9] https://gitlab.com/janneke/tinycc [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://savannah.nongnu.org/projects/stage0 [12] https://nlnet.nl/project/GNUMes ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.21���������������������������������������������������������������0000644�0000000�0000000�00000011726�14372371517�013354� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.21 released <#secure method=pgpmime mode=sign> We are pleased to announce the release of GNU Mes 0.21, representing 54 commits over 10 weeks. Mes has now brought the Reduced Binary Seed bootstrap to Guix (bootstrap a GNU/Linux system without binary GNU toolchain or equivalent). See https://guix.gnu.org/blog/2019/guix-reduces-bootstrap-seed-by-50/ This release supports a Scheme-only bootstrap: Mes can now be built with Gash and the experimental Gash Core Utils instead of using GNU Awk, GNU Bash, the GNU Core Utilities, GNU Grep, GNU Gzip, GNU Make, GNU SED, and GNU Tar. Also, the Mes C Library now supports bootstrapping those. Finally, this release brings Mes as a package to Debian GNU/Linux. We are excited that the Nlnet Foundation[12] is now sponsoring this work! Next targets: - Introduce the Reduced Binaries Seed bootstrap to NixOS (Debian, Gentoo, ...?) - Scheme-only bootstrap: use Guile, Gash and Gash Core Utils to remove awk, bash, core utilities, grep, gzip, make, sed, tar, etc. from the Guix bootstrap binaries - ARM support - Full Source Bootstrap: compile Mes.c using M2-Planet - Reduced Binary Seed bootstrap for ARM - the Hurd Packages are available in Guix master. * About GNU Mes[0] brings a Reduced Binary Seed bootstrap[1] to GNU Guix[2]. This bootstrap has halved the size of opaque, uninspectable binaries that were needed to bootstrap Guix 1.0. The final goal is to help create a full source bootstrap as part of the bootstrappable builds[3] effort for any interested UNIX-like operating system. Mes consists of a mutual self-hosting Scheme interpreter written in ~5,000 LOC of simple C, and a C compiler written in Scheme. This mes.c is being simplified[4] to be transpiled by M2-Planet[5]. The Scheme interpreter has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[6], Pre-R6RS [portable syntax-case[7] with R7RS ellipsis, Matt Wette's Nyacc[8] --and test suite, just enough to support a REPL and a C99 compiler: MesCC. Mes+MesCC can compile an only lightly patched TinyCC[9] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux and x86_64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~500 byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.21.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.21.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.21.tar.gz https://ftpmirror.gnu.org/mes/mes-0.21.tar.gz.sig Here are the MD5 and SHA1 checksums: dea43529d2d84fb4b9d81bdd9efcc715 mes-0.21.tar.gz 35721a81feeab6e0d5913b8bf78f18951edbb964 mes-0.21.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.21.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.freenode.net. * Changes in 0.21 since 0.20 ** Core *** Mes can now be bootstrapped with Gash and Gash Core Utils. *** Mes now supports a Scheme-only bootstrap. *** Mes now supports -c EXPR. ** MesCC *** Mes C Library now supports bootstrapping GNU Awk, GNU Bash, GNU SED, and GNU Tar. *** Mes C Library now has limited float support in vfprintf, vsnprintf, vsscanf. **** 7 new functions abtod, atof, creat, dtoab, execlp, isgraph, mknod, readlink, strtod, symlink. **** 5 new stubs getgrgid, getgrnam, getpgid, getpgrp, mktime, setgrent. ** Noteworthy bug fixes *** A bug with `mes -c EXPR' has been fixed. *** The REPL now works again on x86_64. *** --with-system-libc now works again. Greetings, janneke and Danny. [0] https://www.gnu.org/software/mes [1] https://guix.gnu.org/blog/2019/guix-reduces-bootstrap-seed-by-50/ [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/mes-m2 [5] https://github.com/oriansj/m2-planet [6] https://github.com/schemeway/lalr-scm [7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [8] https://www.nongnu.org/nyacc [9] https://gitlab.com/janneke/tinycc [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://savannah.nongnu.org/projects/stage0 [12] https://nlnet.nl/project/GNUMes ������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.22���������������������������������������������������������������0000644�0000000�0000000�00000015462�14372371517�013356� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.22 released <#secure method=pgpmime mode=sign> We are pleased to announce the release of GNU Mes 0.22, representing 57 commits over 8 weeks. Mes can now be built reproducibly by mes+mescc or guile+mescc across distributions such as GNU Guix, Debian GNU/Linux and NixOS. Also, many build issues were fixed. A big thank you to reproducible-builds.org, Vagrant Cascadian, Jelle van der Waa, Hannes Mehnert and David Terry! Mes now runs on the Hurd--mescc does not run yet, many system calls are missing, especially fork/exec--and initial scaffolding support for creating FreeBSD binaries was added. This release better supports bringing the Scheme-only bootstrap to Guix: it no longer requires an update to the Guix bootstrap seed. The Scheme-only bootstrap means that Mes can now be built with Gash and the experimental Gash Core Utils instead of using GNU Awk, GNU Bash, the GNU Core Utilities, GNU Grep, GNU Gzip, GNU Make, GNU Sed, and GNU Tar. Also, the Mes C Library now supports bootstrapping those. We are excited that the Nlnet Foundation[12] is now sponsoring this work! Next targets: - Introduce the Reduced Binaries Seed bootstrap to NixOS (Debian, Arch, Gentoo, ...?) - Merge the Scheme-only bootstrap, the wip-bootstrap branch (using Guile, Gash and Gash Core Utils to remove awk, bash, core utilities, grep, gzip, make, sed, tar, etc. from the Guix bootstrap binaries) into Guix core-updates. - ARM support - Full Source Bootstrap: compile Mes.c using M2-Planet - Add full Guile module support - Reduced Binary Seed bootstrap for ARM - Support mescc on the Hurd (fork/exec, ...) Packages are available in Guix master; the cross-distro reproducible is built using guix build --system=i686-linux mes-rb5 * About GNU Mes[0] is a Scheme interpreter and C compiler for bootstrapping the GNU System. Since version 0.22 it has again helped to halve the size of opaque, uninspectable binary seeds that are currently being used in the Reduced Binary Seed bootstrap[1] of GNU Guix[2]. The final goal is to help create a full source bootstrap as part of the bootstrappable builds[3] effort for UNIX-like operating systems. The Scheme interpreter is written in ~5,000 LOC of simple C, and the C compiler written in Scheme and these are mutual self-hosting. This mes.c is being simplified[4] to be transpiled by M2-Planet[5]. Mes has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[6], Pre-R6RS [portable syntax-case[7] with R7RS ellipsis, Matt Wette's Nyacc[8] --and test suite just enough to support a REPL and a C99 compiler: MesCC. Mes+MesCC can compile an only lightly patched TinyCC[9] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux and x86_64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[11] ~500 byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.22.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.22.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.22.tar.gz https://ftpmirror.gnu.org/mes/mes-0.22.tar.gz.sig Here are the MD5 and SHA1 checksums: 450c3043ad68ce942c1233282c9fa7e7 mes-0.22.tar.gz a318150059a2bcff6b58e765e203c05d0dfaccee mes-0.22.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.22.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.freenode.net. * Changes in 0.22 since 0.21 ** Core *** Mes now builds reproducibly with MesCC, cross distribution Using --with-bootstrap on x86, a bin/mes-mescc is compiled with mes+mescc, that shall have sha256sum 722790ed261954eb53cf2cd2906c89c7589ef72b66171bbe2a9dce0f0af20232 bin/mes-mescc v0.22 9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb bin/mes-mescc v0.21 only differing in the version number string. This has been verified on GNU Guix, Debian GNU/Linux and NixOS. *** Mes now builds reproducibly with Guile+MesCC vs Mes+MesCC. *** Mes now builds reproducibly with Tiny CC-built MesCC. *** configure now respects the user's CFLAGS, CPPFLAGS and LDFLAGS. *** Mes now supports mescc-tools 0.5.2 next to 0.6.1. This allows introducing the Scheme-only bootstrap without updating or adding new bootstrap binary seeds into GNU Guix. *** Mes now runs when configured --with-courage on the Hurd: GNU debian 0.9 GNU-Mach 1.8+git20170609-486/Hurd-0.9 i686-AT386 GNU Note that mescc does not run; fork and exec are not yet implemented. *** Mes now configures --with-courage on x86-FreeBSD 12.1 The initial ELF scaffold tests: exit-42.S, 0exit-42.hex2, body-exit-42.hex2, hello-mes.S, 0hello-mes.hex2, body-hello-mes.hex2 pass. *** configure now has a --with-bootstrap option. This adds the reproducible bootstrap build of bin/mes-mescc, using mes+mescc. *** configure prefers $CC over gcc; tcc over gcc, gcc over cc. *** Mes now prints an error when attempting to read a file that does not exist. *** Mes no longer depends on GIT. ** Noteworthy bug fixes *** Several annoying build problems were fixed, for non-Guix systems. *** A bug with buffered-read was fixed. This means that bash-2.05 can now build glibc-2.2.5; notably it now successfully executes make-syscall.sh. *** A bug with execlp, execvp for file names containing a slash was fixed. This should allow make-3.80 running scripts that have "#! ./move-if-change". Greetings, janneke and Danny. [0] https://www.gnu.org/software/mes [1] https://guix.gnu.org/blog/2019/guix-reduces-bootstrap-seed-by-50/ [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/mes-m2 [5] https://github.com/oriansj/m2-planet [6] https://github.com/schemeway/lalr-scm [7] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [8] https://www.nongnu.org/nyacc [9] https://gitlab.com/janneke/tinycc [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [11] https://savannah.nongnu.org/projects/stage0 [12] https://nlnet.nl/project/GNUMes ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.23���������������������������������������������������������������0000644�0000000�0000000�00000011247�14372371517�013354� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.23 released <#secure method=pgpmime mode=sign> We are happy to announce the release of GNU Mes 0.23, representing 125 commits over one year by four people. Mes was ported to ARM and can now be used in the GNU Guix Reduced Binary Seed bootstrap as described here https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25/ and now also for armhf-linux and aarch-linux. Work to integrate this into Guix is ongoing: tinycc and gcc-core-2.95.3 have been built. We are excited that the Nlnet Foundation is now sponsoring this work! Enjoy, Janneke and Danny. * About GNU Mes[0] is a Scheme interpreter and C compiler for bootstrapping the GNU System. Since version 0.22 it has again helped to halve the size of opaque, uninspectable binary seeds that are currently being used in the Reduced Binary Seed bootstrap[1] of GNU Guix[2]. The final goal is to help create a full source bootstrap as part of the bootstrappable builds[3] effort for UNIX-like operating systems. The Scheme interpreter is written in ~5,000 LOC of simple C, and the C compiler written in Scheme and these are mutual self-hosting. This mes.c is now being simplified to be transpiled by M2-Planet[4]. Mes has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[5], Pre-R6RS portable syntax-case[6] with R7RS ellipsis, Matt Wette's Nyacc[7] --and test suite, just enough to support a REPL and a C99 compiler: mescc. Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[8] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux, x86_64-linux, armhf-linux and aarch64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[9] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[10] ~500 byte self-hosting hex assembler. We are very grateful to NLNet for sponsoring the Reduced Binary Seed bootstrap[11] and the ARM port[12]. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.23.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.23.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.23.tar.gz https://ftpmirror.gnu.org/mes/mes-0.23.tar.gz.sig Here are the MD5 and SHA1 checksums: e9a0ae6e2c3842cf57fccb54909463ba mes-0.23.tar.gz 0560879358e5a980f7374844c495c92014b47878 mes-0.23.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.23.tar.gz.sig If that command fails because you don't have the required public key, then run this command to import it: gpg --keyserver keys.gnupg.net --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 and rerun the 'gpg --verify' command. * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.freenode.net. * NEWS * Changes in 0.23 since 0.22 ** Core *** Mes and Mes C Library can now be built with GCC 10.x. ** MesCC *** The Mes C Library now supports an armhf-linux bootstrap. *** MesCC now supports ARM. *** mini.c library was split into _exit.c, and _write.c. *** When building with GCC, -lgcc is now used. *** MesCC now has it's own support library libmescc.a (-lmescc). *** MesCC now requires mescc-tools-0.7.0 or later for ARM. *** MesCC can be now built with nyacc-1.00.2: note that nyacc-1.03.0 is not (backwards) compatible. *** MesCC can be built with Guile 3.0.x: See https://bugs.gnu.org/43831; use guild compile -O1 with Guile 3.0.x. *** MesCC now raises SIGABRT on abort, if supported. ** Noteworthy bug fixes *** unreadchar on EOF is now a no-op. *** malloc now aligns the blocks it gives out to max_align_t. [0] https://www.gnu.org/software/mes [1] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25 [2] https://www.gnu.org/software/guix [3] https://bootstrappable.org [4] https://github.com/oriansj/m2-planet [5] https://github.com/schemeway/lalr-scm [6] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [7] https://www.nongnu.org/nyacc [8] https://gitlab.com/janneke/tinycc [9] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [10] https://savannah.nongnu.org/projects/stage0 [11] https://nlnet.nl/project/GNUMes [12] https://nlnet.nl/project/GNUMes-arm ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.24���������������������������������������������������������������0000644�0000000�0000000�00000011356�14372371517�013356� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.24 released <#secure method=pgpmime mode=sign> We are thrilled to announce the release of GNU Mes 0.24, representing 222 commits over one year by four people. Mes has now been ported to M2-Planet and can be bootstrapped using stage0-posix[0], starting from the 357-byte hex0 binary of the bootstrap-seeds[1], as was promised at FOSDEM'21[2]. We are exciteda that the NlNet Foundation[4] is again sponsoring this work! What's next? Work to integrate this so-called "Full Source Bootstrap" is happening on the wip-full-source-bootstrap[3] branch. Also, full Guile compatible module support, and RICS-V support. Enjoy! * About GNU Mes[5] is a Scheme interpreter and C compiler for bootstrapping the GNU System. Since version 0.22 it has again helped to halve the size of opaque, uninspectable binary seeds that are currently being used in the Reduced Binary Seed bootstrap[6] of GNU Guix[7]. The final goal is to help create a full source bootstrap as part of the bootstrappable builds[8] effort for UNIX-like operating systems. The Scheme interpreter is written in ~5,000 LOC of simple C, and the C compiler written in Scheme and these are mutual self-hosting. Mes can now be bootstrapped from M2-Planet[9] and Mescc-Tools[10]. Mes has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[11], Pre-R6RS portable syntax-case[12] with R7RS ellipsis, Matt Wette's Nyacc[13] --and test suite, just enough to support a REPL and a C99 compiler: mescc. Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[14] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux, x86_64-linux, armhf-linux and aarch64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[15] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[16] 357-byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.24.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.24.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.24.tar.gz https://ftpmirror.gnu.org/mes/mes-0.24.tar.gz.sig Here are the SHA1 and SHA256 checksums: f6681aa02edc6729af43f1d7c46ae1a97cbc1c92 mes-0.24.tar.gz 828be15e02c103df8a248232491fba10d763724d6ec10f08a2e0e1d249bd9902 mes-0.24.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.24.tar.gz.sig If that command fails because you don't have the required public key, or that public key has expired, try the following commands to update or refresh it, and then rerun the 'gpg --verify' command. gpg --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.libera.chat * NEWS * Changes in 0.24 since 0.23 ** Core *** Mes and Mes C Library can now be built with M2-Planet. *** Mes now supports the --bootstrap build on ARM. ** MesCC *** MesCC now supports the integer suffixes: Next to `U', also support `ULL', `UL', `L', and `LL'. ** Noteworthy bug fixes *** MesCC now uses the unsigned type for sizeof. *** MesCC now only uses signed division if numerator is signed. *** The Mes C library now supports an argv bigger than 255. *** Development build support with Guile-2 was resurrected. *** The logand procedure now works correctly. *** The 64bit build was resurrected. * Links [0] https://github.com/oriansj/stage0-posix [1] https://github.com/oriansj/bootstrap-seeds [2] https://archive.fosdem.org/2021/schedule/event/gnumes/ [3] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-full-source-bootstrap [4] https://nlnet.nl/project/GNUMes-ARM_RISC-V [5] https://www.gnu.org/software/mes [6] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25 [7] https://www.gnu.org/software/guix [8] https://bootstrappable.org [9] https://github.com/oriansj/m2-planet [10] https://savannah.nongnu.org/projects/mescc-tools [11] https://github.com/schemeway/lalr-scm [12] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [13] https://www.nongnu.org/nyacc [14] https://gitlab.com/janneke/tinycc [15] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [16] https://savannah.nongnu.org/projects/stage0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.24.1�������������������������������������������������������������0000644�0000000�0000000�00000011037�14372371517�013511� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.24.1 released <#secure method=pgpmime mode=sign> We are happy to announce the release of GNU Mes 0.24.1, representing 23 commits over five months by four people. Mes now supports the stage0-posix and M2-Planet Full Source bootstrap on Aarch64 for ARM. Because stage0-posix does not support ARM yet, the Mes ARM bootstrap is currently prototyped on Aarch64. We are excited that the NlNet Foundation[4] is again sponsoring this work! What's next? Work to prototype this so-called "Full Source Bootstrap" for ARM on Aarch64 is happening on the wip-aarch64-bootstrap[3] branch. Also, full Guile compatible module support, and RISC-V support. Enjoy! * About GNU Mes[5] is a Scheme interpreter and C compiler for bootstrapping the GNU System. Since version 0.22 it has again helped to halve the size of opaque, uninspectable binary seeds that are currently being used in the Reduced Binary Seed bootstrap[6] of GNU Guix[7]. The final goal is to help create a full source bootstrap as part of the bootstrappable builds[8] effort for UNIX-like operating systems. The Scheme interpreter is written in ~5,000 LOC of simple C, and the C compiler written in Scheme and these are mutual self-hosting. Mes can now be bootstrapped from M2-Planet[9] and Mescc-Tools[10]. Mes has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[11], Pre-R6RS portable syntax-case[12] with R7RS ellipsis, Matt Wette's Nyacc[13] --and test suite, just enough to support a REPL and a C99 compiler: mescc. Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[14] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux, x86_64-linux, armhf-linux and aarch64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[15] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[16] 357-byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.24.1.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.24.1.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.24.1.tar.gz https://ftpmirror.gnu.org/mes/mes-0.24.1.tar.gz.sig Here are the SHA1 and SHA256 checksums: bceaaaf1cafaa31ccb1ee1247ce2dd651a2f67be mes-0.24.1.tar.gz 35120ceb0676632e58973355b9f86dff9cc717ed65ed2a17ff5272c59f2a0535 mes-0.24.1.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.24.1.tar.gz.sig If that command fails because you don't have the required public key, or that public key has expired, try the following commands to update or refresh it, and then rerun the 'gpg --verify' command. gpg --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.libera.chat * NEWS * Changes in 0.24.1 since 0.24 ** Build *** Support M2-Planet bootstrap for ARM. ** MesCC *** The Mes C Library now supports bootstrapping ARM. ** Noteworthy bug fixes *** The definition of S_ISUID was fixed. *** Unsigned modulo has been fixed for ARM. *** A bug with abtol has been fixed. *** Workarounds for building with gcc-12.2.0 have been added. * Links [0] https://github.com/oriansj/stage0-posix [1] https://github.com/oriansj/bootstrap-seeds [2] https://archive.fosdem.org/2021/schedule/event/gnumes/ [3] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-aarch64-bootstrap [4] https://nlnet.nl/project/GNUMes-ARM_RISC-V [5] https://www.gnu.org/software/mes [6] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25 [7] https://www.gnu.org/software/guix [8] https://bootstrappable.org [9] https://github.com/oriansj/m2-planet [10] https://savannah.nongnu.org/projects/mescc-tools [11] https://github.com/schemeway/lalr-scm [12] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [13] https://www.nongnu.org/nyacc [14] https://gitlab.com/janneke/tinycc [15] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [16] https://savannah.nongnu.org/projects/stage0 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.24.2�������������������������������������������������������������0000644�0000000�0000000�00000011237�14372371517�013514� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� Subject: GNU Mes 0.24.2 released <#secure method=pgpmime mode=sign> We are happy to announce the release of GNU Mes 0.24.2, representing 25 commits over nine months by four people. This release should fix the long standing `stat64' bug #41264[0]. We are very grateful that the NLnet Foundation[1] is sponsoring this work! What's next? Work to prototype this so-called "Full Source Bootstrap" for ARM on Aarch64 is happening on the wip-aarch64-bootstrap[2] branch. Also, full Guile compatible module support, and RISC-V support. Enjoy! * About GNU Mes[3] is a Scheme interpreter and C compiler for bootstrapping the GNU System. Since version 0.22 it has again helped to halve the size of opaque, uninspectable binary seeds that are currently being used in the Reduced Binary Seed bootstrap[4] of GNU Guix[5]. The final goal is to help create a full source bootstrap as part of the bootstrappable builds[6] effort for UNIX-like operating systems. The Scheme interpreter is written in ~5,000 LOC of simple C, and the C compiler written in Scheme and these are mutual self-hosting. Mes can now be bootstrapped from M2-Planet[7] and Mescc-Tools[8]. Mes has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[9], Pre-R6RS portable syntax-case[10] with R7RS ellipsis, Matt Wette's Nyacc[11] --and test suite, just enough to support a REPL and a C99 compiler: mescc. Mes + MesCC + Mes C Library can build a bootstrappable TinyCC[12] that is self-hosting. Using this tcc and the Mes C library we now have a Reduced Binary Seed bootstrap for the gnutools triplet: glibc-2.2.5, binutils-2.20.1, gcc-2.95.3. This is enough to bootstrap Guix for i686-linux, x86_64-linux, armhf-linux and aarch64-linux. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[13] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0[14] 357-byte self-hosting hex assembler. * Download git clone git://git.savannah.gnu.org/mes.git Here are the compressed sources and a GPG detached signature[*]: https://ftp.gnu.org/gnu/mes/mes-0.24.2.tar.gz https://ftp.gnu.org/gnu/mes/mes-0.24.2.tar.gz.sig Use a mirror for higher download bandwidth: https://ftpmirror.gnu.org/mes/mes-0.24.2.tar.gz https://ftpmirror.gnu.org/mes/mes-0.24.2.tar.gz.sig Here are the SHA1 and SHA256 checksums: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mes-0.24.2.tar.gz [*] Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify mes-0.24.2.tar.gz.sig If that command fails because you don't have the required public key, or that public key has expired, try the following commands to update or refresh it, and then rerun the 'gpg --verify' command. gpg --recv-keys 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 * Get informed, get involved See https://bootstrappable.org Join #bootstrappable on irc.libera.chat * NEWS * Changes in 0.24.2 since 0.24.1 ** Build *** A number of compile warnings have been fixed. *** The `simple.make' and `simple.sh' builds have been resurrected. ** MesCC *** Some assembly defines were added for building TinyCC for x86_64. *** `__assert_fail' has been updated to use the standard signature. ** Noteworthy bug fixes *** A bootstrap build without M2-Planet is now supported again. *** `gettimeofday' no longer segfaults in the M2-Planet build. *** `stat64' and friends are now used on 32bit platforms. This fixes https://debbugs.gnu.org/41264, and should also fix https://debbugs.gnu.org/49985, https://debbugs.gnu.org/53415, https://debbugs.gnu.org/53416. *** The Mes C Library now supports uppercase hex conversions. * Links [0] https://debbugs.gnu.org/41264 [1] https://nlnet.nl/project/GNUMes-ARM_RISC-V [2] https://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-aarch64-bootstrap [3] https://www.gnu.org/software/mes [4] https://guix.gnu.org/blog/2020/guix-further-reduces-bootstrap-seed-to-25 [5] https://www.gnu.org/software/guix [6] https://bootstrappable.org [7] https://github.com/oriansj/m2-planet [8] https://savannah.nongnu.org/projects/mescc-tools [9] https://github.com/schemeway/lalr-scm [10] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [11] https://www.nongnu.org/nyacc [12] https://gitlab.com/janneke/tinycc [13] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [14] https://github.com/oriansj/stage0-posix �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.3����������������������������������������������������������������0000644�0000000�0000000�00000007325�14372371517�013274� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: on bootstrapping: first Mes 0.3 released I am pleased to announce the first release of Mes: 0.3, representing 152 commits over 3 months since the second status report[1]. * About Mes aims to create an entirely source-based bootstrapping path. The target is to [have GuixSD] boostrap from a minimal, easily inspectable binary --that should be readable as source-- into something close to R6RS Scheme. As bootstrapping is presumably easiest and probably most fun with Scheme, the next step for Mes is mescc: a C compiler/linker to boostrap into GNU Gcc and GNU Guile, possibly via Tiny-CC. It currently has an interpreter written in C (mes) with Garbage Collector (Jam Scraper), a library of loadable Scheme modules with test suite just barely enough to support a simple REPL (repl.mes) and a proof-of-concept c-compiler (mescc.mes) that produces an elf from the simplest of C files. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[2] -- John McCarthy page 13 * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.3 -O mes-0.3.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.3 since 0.2 ** Core *** Number-based rather than pointer-based cells. *** Garbage collector aka Jam scraper. A variant on SICP's stop and copy Garbage Collector (Jam Scraper?) algorithm has been implemented. *** The reader has been moved to Scheme. ** Language *** Simple loadable modules. *** Srfi-9 and match use handwritten syntax-rules (mes-use-module (mes syntax)). *** Optional syntax-case using psyntax (mes-use-module (mes psyntax)). ** Noteworthy bug fixes *** Srfi-0 has been fixed. * Changes in 0.2 since 0.1 ** Core *** Names of symbols and strings are list of characters [WAS: c-string]. *** Sc-expand from pre-R6RS's psyntax has been integrated. *** Undefined variable error now shows the name of the undefined variable. *** There is now only one SCM type for builtin functions. *** Macro expansion has been cleaned-up. ** Language *** Mes now provides a subset of R6RS. *** Mes now provides syntax-case. *** Mes now provides `load'. ** Noteworthy bug fixes *** Using values as second parameter of builtin function yields first value. *** Quoted internals (e.g. 'if 'lambda) are now symbols. *** Syntax error now exits. *** Make+Bash voodoo has been replaced by build-aux/mes-snarf.scm. *** Apply now accepts multiple list arguments. *** Apply of character, inernal, number, string is an error. *** Quasisyntax reading * Changes in 0.1 (since progress report #2) ** Core *** expand_macro is now a separate function. *** A smaller core can now compiled using BOOT=1. The smaller core does not provide define, define-macro, or quasiquote; these are provided from a Scheme version of implemented eval/apply. ** Language *** Mes now provides a subset of R5RS. *** Mes now provides let-syntax. *** Mes now provides match. *** Mes now provides quasisyntax, unsyntax and unsyntax-splicing. ** User interface *** Mes now provides a REPL, run: scripts/repl.mes *** Mes compiler can be run as a script: scripts/mescc.mes doc/examples/main.c *** Macro expansion can be inspected in the REPL, e.g.: ,expand (and 0 1) ** Noteworthy bug fixes *** Performance: scripts/mescc.mes now takes 2s to compile main.c (was 1'20"). *** Symbols are now truly unique. * '(), #t, #f are no longer symbols. Greetings, Jan [1] https://lists.nongnu.org/archive/html/guile-user/2016-09/msg00061.html [2] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.4����������������������������������������������������������������0000644�0000000�0000000�00000010564�14372371517�013274� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.4 released I am pleased to announce the release of Mes 0.4, representing 115 commits over barely two weeks. It now runs Nyacc and PEG and has much reduced core. * About Mes aims to create an entirely source-based bootstrapping path. The target is to [have GuixSD] boostrap from a minimal, easily inspectable binary --that should be readable as source-- into something close to R6RS Scheme. As bootstrapping is presumably easiest and probably most fun with Scheme, the next step for Mes is mescc: a C compiler/linker to boostrap into GNU Gcc and GNU Guile, possibly via Tiny-CC. It currently has an interpreter written in C (mes) with Garbage Collector (Jam Scraper), a library of loadable Scheme modules-- notably Dominique Boucher's LALR[1], Pre-R6RS portable syntax-case[2] with R7RS ellipsis, Nyacc[3] and Guile's PEG[4] --and test suite just barely enough to support a simple REPL (repl.mes) and a proof-of-concept C-compiler (mescc.mes) that produces an elf from the simplest of C files. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[5] -- John McCarthy page 13 * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.4 -O mes-0.4.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.4 since 0.3 ** Core *** Improved performance. Macros are now memoized; after expansion and before eval'ing the expanded form, their input s-expression is replaced by the expansion. This yields a nice performance improvement which finally allowed moving all non-essential bits from the C-core into Scheme...including the reader. The Scheme reader is much, much slower than the previous C version, making Mes--again-- feel slow. Think of that as a feature. *** Bootstrap with minimal reader in C. The C-reader needs only support reading of words and lists (s-expressions), line-comments to read the initial Scheme reader which then takes over and handles reading of quoting, characters, strings, block-comments. *** Reduced size. Total C size: ~1500LOC. The main Mes evaluator is now ~1000LOC including cell creation and garbage collector. This code is able to execute a Scheme program that has been loaded into memory. Another ~500LOC is spent to load a minimal Scheme program and to dump it, to provide a small posix interface, math functions and do some error reporting. *** Programs can be dumped and loaded using --dump and --load. ** Language *** Minimal syntactic exception support for Nyacc. *** Minimal syntactic fluids support for Nyacc. *** Keywords are now supported. *** Cond now supports =>. *** Guile's optargs: lambda* and define* are now supported. *** #;-comments are now supported. *** Non-nested #| |#-comments are now supported. *** Quasisyntax is now supported. *** R7RS syntax-rules with custom ellipsis, with-ellipsis are now supported. *** 9 new [partial] modules (mes fluids), (mes nyacc), (mes optargs), (mes pmatch), (mes peg), (srfi srfi-13), (srfi srfi-9-psyntax), (srfi srfi-26), (srfi srfi-43), (rnrs arithmetic bitwise), (sxml xpath) *** 36 new functions 1+, 1-, abs, and=>, append-reverse, ash, char<=?, char<?, char>=?, char>?, even?, filter, delete, delq, vector-copy, fold, fold-right, getenv, iota, keyword->symbol list-head, list-tail, negative?, odd?, positive?, remove!, remove, string->number, string-copy, string-prefix?, string=, string=?, symbol->keyword symbol-append, symbol-prefix?, unless, write, zero?. ** Noteworthy bug fixes *** Macros are now memoized. *** An error is reported when using a wrong number of arguments with a call. *** Cond now evaluates its test clauses only once. *** Append can also handle one argument. *** For-each now supports 2 list arguments. *** Map now supports 3 list arguments. *** Backslash in string is supported. *** Closure is not a pair. *** All standard characters are supported. *** Mescc now also runs in Guile. Greetings, Jan [1] https://github.com/schemeway/lalr-scm [2] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [3] https://www.nongnu.org/nyacc/ [4] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [5] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf ��������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.5����������������������������������������������������������������0000644�0000000�0000000�00000006111�14372371517�013266� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.5 released I am pleased to announce the release of Mes 0.5, representing 250 commits over 4 months. Mes is now self-hosting, or rather it features a mutual self-hosting Scheme interpreter and C compiler: mes.c and mescc; a Nyacc-based C compiler backend that also works separately with Guile. * About Mes aims to create full source bootstrapping for GuixSD: an entirely source-based bootstrap path. The target is to [have GuixSD] boostrap from a minimal, easily inspectable binary --that should be readable as source-- into something close to R6RS Scheme. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[1], Pre-R6RS portable syntax-case[2] with R7RS ellipsis, Matt Wette's Nyacc[3] Guile's PEG[4] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler (mescc.mes) that can produce the second initial ELF binary from binary from mes.c, in only about 2h30'. Mes was inspired by The Maxwell Equations of Software: LISP-1.5[5] -- John McCarthy page 13, GNU Guix's[6] source/binary packaging transparency and Jeremiah Orians's stage0[7] bootstrap project. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.5 -O mes-0.5.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.5 since 0.4 ** Core *** Support compilation with Mescc. *** Support compilation with -nostdinc, -nostdlib using mlibc. *** Support call-with-current-continuation. *** Support exception handling, catch/throw. *** Give sensible error message when a macro is missing. ** Language *** Map now supports 4 lists. *** The reader supports negative hex numbers. *** 24 new functions access?, assoc-set! c????r, compose, list->char-set, open-input-string, read-string, string-delete, with-throw-handler. ** Mescc *** Mescc can be used separately as a Nyacc-based C compiler backend for Guile. *** Switch to Nyacc frontend, update Nyacc to 0.76.5. *** Mescc now has a test suite, scaffold/t.c. *** Mescc now includes a minimal C library: libc/mlib.c libc/mstart.c. *** Mescc can now compile mes.c. ** Noteworthy bug fixes *** The build system (configure, make) has been refactored. *** Support map-4. *** Evaluate arguments of OR only once. *** Fix assq-set! *** Fix ,expand in the REPL. Greetings, janneke [1] https://github.com/schemeway/lalr-scm [2] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [3] https://www.nongnu.org/nyacc/ [4] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [5] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [6] https://www.gnu.org/software/guix/ [7] https://github.com/oriansj/stage0 �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.6����������������������������������������������������������������0000644�0000000�0000000�00000006651�14372371517�013300� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.6 released I am pleased to announce the release of Mes 0.6, representing 32 commits over 24 days. Mescc now works with vanilla Nyacc 0.78.3 (thanks Matt!), Nyacc has been unbundled and Mescc compiles 33/55 of tinycc test2 tests. * About Mes aims to create full source bootstrapping for GuixSD: an entirely source-based bootstrap path. The target is to [have GuixSD] boostrap from a minimal, easily inspectable binary --that should be readable as source-- into something close to R6RS Scheme. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[1], Pre-R6RS portable syntax-case[2] with R7RS ellipsis, Matt Wette's Nyacc[3] Guile's PEG[4] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler (mescc.mes) that can produce the second initial ELF binary from binary from mes.c, in only about 2h30'. Mes was inspired by The Maxwell Equations of Software: LISP-1.5[5] -- John McCarthy page 13, GNU Guix's[6] source/binary packaging transparency and Jeremiah Orians's stage0[7] bootstrap project. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.6 -O mes-0.6.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.6 since 0.5 ** Core *** configure, build now supports x86 and development for arm with-courage. ** Language *** Nyacc has been unbundled and is now a dependency. *** Mes now supports case-lambda. *** Mes reader now supports abbreviated form for return character #\cr. *** 1 new function string-index. ** Mescc *** Mescc can be used on regular C sources, like tinycc's tests/test2 suite. *** make check passes 33/55 of tinycc's test suite etest/test2 tests. *** Mescc now recognizes `short' as a type. *** Mescc now supports sizeof (<identifier>), sizeof(<expression>). *** Mescc now respects enum field initializers and supports enum variables. *** Mescc now supports binary constants . *** Mescc now supports assignments from ==, != boolean expressions . *** Mescc now supports &, ^. *** Mescc now supports struct pointers. *** Mescc now supports struct definition with immediatete variable declaration. *** Mescc now supports calling (returning correctly from) void functions. *** Mescc now handles case statements breaks without compound correctly. *** Mescc now has better [int/pointer] array support. *** Mescc now has better support for simple (non-array-)structs. *** Mescc now supports multiple declarations in one statement like: int a,b; **** 2 new mlibc functions printf, strcpy. ** Noteworthy bug fixes *** Installed mes and mes.repl now also run outside of source tree again. Greetings, janneke [1] https://github.com/schemeway/lalr-scm [2] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [3] https://www.nongnu.org/nyacc/ [4] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [5] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [6] https://www.gnu.org/software/guix/ [7] https://github.com/oriansj/stage0 ���������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.7����������������������������������������������������������������0000644�0000000�0000000�00000006771�14372371517�013304� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.7 released I am pleased to announce the release of Mes 0.7, representing 32 commits over 4 weeks. Mescc now behaves more like a regular C compiler: supporting -E, -c, -o options and with a more complete set of header files [stubs]; enough to work on compiling tinycc's tcc.c albeit a somewhat modified version[8]. * About Mes aims to create full source bootstrapping for GuixSD: an entirely source-based bootstrap path. The target is to [have GuixSD] boostrap from a minimal, easily inspectable binary --that should be readable as source-- into something close to R6RS Scheme. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[1], Pre-R6RS portable syntax-case[2] with R7RS ellipsis, Matt Wette's Nyacc[3] Guile's PEG[4] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler (mescc.mes) that can produce the second initial ELF binary from binary from mes.c, in only about 2h30'. Mes was inspired by The Maxwell Equations of Software: LISP-1.5[5] -- John McCarthy page 13, GNU Guix's[6] source/binary packaging transparency and Jeremiah Orians's stage0[7] bootstrap project. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.7 -O mes-0.7.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.7 since 0.6 ** Core *** The minimal C reader is now always included; dependencies on i686-unknown-linux-gnu-gcc and binary read-0-32.mo have been dropped, these are now optional. ** Language *** Mes reader now supports octal numbers #oXXX. *** 10 new functions current-output-port, getopt-long, negate, open-output-file, option-ref, set-current-output-port, string-rindex, string-suffix?, with-ouwith-output-to-file, with-output-to-port. ** Mescc *** Mescc can now be installed and used alongside a gcc installation. *** Mescc can now handle const anywhere. *** Mescc now supports array fields in structs. *** Mescc now supports forward declarations and typedef. *** Mescc can now handle comments anywhere. *** Mescc now supports addition and substraction for enum field values. *** Mescc now supports anonymous enums. *** Mescc now supports all C99 header files needed to compile tcc.c. *** build: C sources are now preprocessed separately, then compiled and linked. *** build: mlibc and C sources are now compiled separately and then linked. *** mlibc has been moved from Scheme snippets into C. *** Mescc now supports -c, -D, -E, -I and -o options. **** open now supports optional third mode parameter. ** Noteworthy bug fixes *** string-index now supports function predicate. *** number->string for radix > 10 now produces `a' instead of `:'. Greetings, janneke [1] https://github.com/schemeway/lalr-scm [2] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [3] https://www.nongnu.org/nyacc/ [4] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [5] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [6] https://www.gnu.org/software/guix/ [7] https://github.com/oriansj/stage0 [8] https://gitlab.com/janneke/tinycc �������mes-0.24.2/doc/announce/ANNOUNCE-0.8����������������������������������������������������������������0000644�0000000�0000000�00000005270�14372371517�013276� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.8 released I am pleased to announce the release of Mes 0.8, representing 34 commits over 3 weeks. Mescc now produces object files in the hex2 ascii output format compatible with the stage0 linker. Special thanks to Jeremiah Orians for support with MESCC_Tools and hex2, more goodness to follow soon! * About Mes aims to create full source bootstrapping for GuixSD: an entirely source-based bootstrap path. The target is to [have GuixSD] boostrap from a minimal, easily inspectable binary --that should be readable as source-- into something close to R6RS Scheme. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[1], Pre-R6RS portable syntax-case[2] with R7RS ellipsis, Matt Wette's Nyacc[3] Guile's PEG[4] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler (mescc.mes) that can produce the second initial ELF binary from binary from mes.c, in only about 2h30'. Mes was inspired by The Maxwell Equations of Software: LISP-1.5[5] -- John McCarthy page 13, GNU Guix's[6] source/binary packaging transparency and Jeremiah Orians's stage0[7] bootstrap project. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.8 -O mes-0.8.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.8 since 0.7 ** Mescc *** Mescc now depends on the hex2 linker from MESCC_Tools[9]. Direct ELF output support has been removed. ELF symbol and string table creation has been removed. *** Mescc now has experimental annotation support for hex2. *** Mescc has experimental annotation support for hex2. *** Mescc has been simplified by leveraging use labels in hex2 output. *** Mescc now supports continue in loops. *** Mescc now compiles to hex2 object files. ** Language *** 1 new function list-index. Greetings, janneke [1] https://github.com/schemeway/lalr-scm [2] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [3] https://www.nongnu.org/nyacc/ [4] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [5] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf [6] https://www.gnu.org/software/guix/ [7] https://github.com/oriansj/stage0 [8] https://gitlab.com/janneke/tinycc [9] https://github.com/oriansj/MESCC_Tools ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-0.9����������������������������������������������������������������0000644�0000000�0000000�00000007720�14372371517�013301� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: Mes 0.9 released I am pleased to announce the release of Mes 0.9, representing 107 commits over 5 weeks. Mescc now compiles to a surprisingly readable stage0 M1 macro assembler output format. Mescc now compiles a modified TinyCC into a running [mostly segfaulting] executable. This is a major milestone as tcc can compile GCC. * About Mes[0] aims to create full source bootstrapping for GuixSD[1] as part of the bootstrappable builds[2] project. It currently consists of a mutual self-hosting [close to Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in [Guile] Scheme. This C prototype will be rewritten in stage0[3] M1 assembly (or possibly stage2 slow-LISP, or ...). The Scheme interpreter prototype (mes.c) has a Garbage Collector, a library of loadable Scheme modules-- notably Dominique Boucher's LALR[4], Pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely enough to support a simple REPL (repl.mes) and simple C-compiler (mescc.mes). The simple C compiler can compile a modified TinyCC[8]. This needs more work. A gcc-compiled tcc is known[9] to compile GCC. Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] -- John McCarthy page 13, GNU Guix's source/binary packaging transparency and Jeremiah Orians's stage0 ~300 byte self-hosting hex assembler. * Download git clone https://gitlab.com/janneke/mes wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.9 -O mes-0.9.tar.gz Mes runs from the source tree and can also be built, packaged and installed in Guix[SD] by the usual guix package -f guix.scm * Changes in 0.9 since 0.8 ** Core *** Mes now builds better in non-Guix[SD] legacy distros/environments. Thanks, rain1! ** Mescc *** Mescc now compiles a modified tinycc into a running [mostly segfaulting] tcc.mes. https://gitlab.com/janneke/tinycc branch wip-mescc. *** Mescc now supports locals stack frame larger than 1 byte offset. *** Mescc now supports incomplete struct initializers {0}. *** Mescc now supports >>=, <<=, ^=, ~. *** Mescc now supports the comma operator. *** Mescc now supports mullti-line string initializers. *** Mescc now supports unions. *** Mescc now supports arrays in structs. *** Mescc now supports structs in structs. *** Mescc has been refactored to use records. *** Mescc now builds and runs with Guile-2.0 (legacy distro support, not recommended). *** Mescc now bundles tinycc's test2 test suite, passes one more test [34/55 pass]. *** Mescc now has an incremental test suite consisting of 56 tests. *** Mescc now supports stdarg variable argument lists. *** Mescc now has __GNUC__ unset, #f (WAS: 0). *** Mescc now depends on Nyacc 0.80.3. *** Mescc now depends on M1 from MESCC_Tools v0.2. *** Mescc now compiles to M1 object files. **** 7 new mlibc functions calloc, close, getcwd, lseek, sprintf, unlink, vprintf. **** 31 new mlibc stubs execvp, fclose, fdopen, fflush, fopen, fprintf, fread, free, fseek, ftell, fwrite, localtime, longjmp, memcpy, memmove, memmove, memset, qsort, remove, setjump, snprintf, sscanf, strchr, strrchr, strstr, strtol, strtoll, strtoul, strtoull, time, vnsprintf. **** 10 new header files alloca.h, float.h, libgen.h, locale.h, stdbool.h, stddef.h, stdint.h, stdnoreturn.h, sys/select.h, sys/wait.h. Greetings, janneke [0] https://gitlab.com/janneke/mes [1] https://www.gnu.org/software/guix [2] http://bootstrappable.org [3] https://github.com/oriansj/stage0 [4] https://github.com/schemeway/lalr-scm [5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html [6] https://www.nongnu.org/nyacc/ [7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html [8] https://gitlab.com/janneke/tinycc [9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html [10] http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf ������������������������������������������������mes-0.24.2/doc/announce/ANNOUNCE-2������������������������������������������������������������������0000644�0000000�0000000�00000006722�14372371517�013135� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: on bootstrapping: 2nd status report on Mes Date: Sun, 25 Sep 2016 13:52:11 +0200 Hi! In June I announced[0] Mes as a project that seeks to reduce the size of/ dependency on bootstrap binaries, esp. for a system like GuixSD The strategy was to create a minimal trusted binary (prototyped in C but eventually to be hand-crafted in assembly/hex) that interpets a minimal LISP. Then using this minimal but already convenient LISP, extend it into Scheme and write a tiny C compiler/linker. Last time I had a minimal LISP-1.5-resembling interpreter in 900 lines of C that could interpret itself and an extension layer written in LISP providing a minimal Scheme environment. I was stuck on adding macros in LISP and had a broken macro implentation in C that I wanted to remove. Also I hoped to greatly reduce the size of the C part. New status[1] * Provide Scheme primitives directly in 1400 lines of C * Remove LISP-1.5 staging * closures clue-bat, fixing bugs in begin, lambda, lexical scoping etc. ... learned a lot! * quasiquote, unquote, unquote-splicing (in C, too slow in Scheme) * define-macro (in C) * define-syntax, syntax-rules (in Scheme, using define-macro) * all primitives needed to run LALR (strings, vectors, records, some srfi bits; mostly in Scheme) * test suite with 97 tests that run with Mes and also with Guile * minimal and partial ANSI C parser for hello world * minimal and simplistic 32 bit elf c-ast->elf generator Mes can now create a running 32-bit elf binary from this hello world C source with a simplistic for loop int main () { int i; puts ("Hi Mes!\n"); for (i = 0; i < 4; ++i) puts (" Hello, world!\n"); return 1; } It takes Mes 1'20" to compile this program, Guile takes 0.5 seconds. * cannot get psyntax.pp hooked-up or running * do not understand syntax stuff [well enough] to implement in C -> no let-syntax, no MATCH -> no syntax-case, no PEG parser In theory the bootstrapping problem I set out to solve seems to be cracked. The remaining problem is reduced to `just work': implementing a minimal C compiler in Scheme. Questions here: I'm not convinced yet that this is a meaningful project...aaand I really not want to tackle this without having MATCH, which Mes does not have yet. Of the possible directions that I see 0 write the C compiler in Scheme without match 1 rewrite match without let-syntax 2 grok+write let-syntax/syntax-case using define-macro, some bits in C 3 run and hook-up psyntax.pp...BUT that would probably require: 4 address performance problem, possibly by 5 rewrite Mes into a VM-based solution none I find really attractive. Option 5, a VM is proven to work but that's quite a change of direction. Looking at other VM-based projects (e.g. GNU Epsilon[2]) I fear that this must result in a much larger code base in C, throwing out the minimal trusted binary idea. The other puzzles and work 0, 2 or 3 still need to be done. However, diving into syntax-macro or eval work (2 or 3) most probably needs the performance issue addressed. And if it turns out that a big VM solution is needed, that may still invalidate this project after having done even more work. Help! :-) Ideas? Greetings, Jan [0] https://lists.gnu.org/archive/html/guile-user/2016-06/msg00061.html [1] https://gitlab.com/janneke/mes [2] http://git.savannah.gnu.org/cgit/epsilon.git ����������������������������������������������mes-0.24.2/doc/announce/README����������������������������������������������������������������������0000644�0000000�0000000�00000000710�14372371517�012514� 0����������������������������������������������������������������������������������������������������ustar �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� -*- org -*- #+TITLE: GNU Mes Announcements Copyright © 2016, 2017, 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. Files are emails sent to public mailing lists. The notice above applies to these files too.��������������������������������������������������������mes-0.24.2/doc/announce/UPDATE-0.13�����������������������������������������������������������������0000644�0000000�0000000�00000007034�14372371517�013126� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Subject: wip-bootstrap updated I've updated the wip-bootstrap branch[0] for Mes[1] 0.13. It has new mes-boot and tcc-boot packages. mes-boot is a bootstrap version of Mes; it only depends on mescc-tools and a previously compiled mes.M1 seed. Likewise, tcc-boot depends on a precompiled tcc-seed. Also, tcc-boot uses a heavily patched version of the tcc sources. Mes 0.13 is the first release that can bootstrap a fairly functional tcc-boot. This bootstrapped tcc passes 67/68 C tests that were created for MesCC. It can compile a version if itself where float, long long and bitfield are patched out...but linking fails. This amazing compiler can now be played with by doing something like --8<---------------cut here---------------start------------->8--- git checkout wip-bootstrap make ./pre-inst-env guix build tcc-boot # may take ~2h ./pre-inst-env guix environment --ad-hoc tcc-boot mes-tcc --help #duck and run --8<---------------cut here---------------end--------------->8--- The next big effort will be to make this mes-tcc fully functional and integrate this with GuixSD. To give you a taste of that, here's latest bug I'm currently looking at (pretty printed comments are only added when Guile runs MesCC, the problem is in LEA) --8<---------------cut here---------------start------------->8--- $ diff -u ../mes-seed/mes.M1 src/mes.M1 --- ../mes-seed/mes.M1 2018-05-01 18:49:37.312162270 +0200 +++ src/mes.M1 2018-05-01 19:49:40.774770406 +0200 @@ -35805,12 +33091,11 @@ call32 %strcpy add____$i8,%esp !0x8 test___%eax,%eax - # strcpy(buf + strlen(buf), "/mes/"); - push___$i32 &_string_reader_read_list_266 + push___$i32 &_string_reader_read_list_265 mov____%ebp,%eax - add____$i32,%eax %0x-200 + add____$i32,%eax %0x-800 push___%eax - lea____0x32(%ebp),%eax %0x-200 + lea____0x32(%ebp),%eax %0x-800 push___%eax call32 %strlen add____$i8,%esp !0x4 --8<---------------cut here---------------end--------------->8--- We also need to remove some shortcuts that we took, most notably: mes-seed[3]. This seed consists of 1MB of M1 code. mes.M1 is produced by compiling mes.c using MesCC, the C compiler written in (Guile) Scheme that comes with Mes. Although that's really terrible, it's probably a big step forward: currently GuixSD uses ~250MB of binary seed: the bootstrap binaries. The plan is to replace the mes.M1 seed with mes.M2 and compile this new mes.M2 seed using the brand new M2-Planet[2]. M2 is basically simple C with structs, without preprocessor. This will reduce the seed size by a factor of 10 while making it much more readable. An excerpt of the TODO I keep in Mes' BOOTSTRAP document --8<---------------cut here---------------start------------->8--- * TODO ** have tcc-boot's mes-tcc compile a fully functional tcc *** mescc: fix unknown bug. *** mescc: support function-static. *** mescc: support/grok global static. *** mescc: support unsigned comparison, arithmetic. *** mescc: support long long (do we need long long to get long long in tcc)? *** mescc: support bitfield (do we need bitfield to get bitfield in tcc)? *** mescc: support float (do we need float to get float in tcc)? ** have bootstrapped tcc compile gcc-4.7 ** remove or upstream patches from tcc-boot ** prepare src/mes.c for M2-Planet[2] transpiler ** integrate with GuixSD ** x86_64, arm, the Hurd --8<---------------cut here---------------end--------------->8--- Greetings, janneke [0] http://git.savannah.gnu.org/cgit/guix.git/log/?h=wip-bootstrap [1] https://gitlab.com/janneke/mes [2] https://github.com/oriansj/m2-planet [3] https://gitlab.com/janneke/mes-seed ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/fdl-1.3.texi�������������������������������������������������������������������������0000644�0000000�0000000�00000055611�14372371517�011777� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@c The GNU Free Documentation License. @center Version 1.3, 3 November 2008 @c This file is intended to be included within another document, @c hence no sectioning command or @node. @display Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. @uref{https://fsf.org/} Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display @enumerate 0 @item PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document @dfn{free} in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of ``copyleft'', which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. @item APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The ``Document'', below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as ``you''. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A ``Modified Version'' of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A ``Secondary Section'' is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The ``Invariant Sections'' are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The ``Cover Texts'' are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A ``Transparent'' copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not ``Transparent'' is called ``Opaque''. Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, La@TeX{} input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The ``Title Page'' means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, ``Title Page'' means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The ``publisher'' means any person or entity that distributes copies of the Document to the public. A section ``Entitled XYZ'' means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as ``Acknowledgements'', ``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' of such a section when you modify the Document means that it remains a section ``Entitled XYZ'' according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. @item VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. @item COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. @item MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: @enumerate A @item Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. @item List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. @item State on the Title page the name of the publisher of the Modified Version, as the publisher. @item Preserve all the copyright notices of the Document. @item Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. @item Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. @item Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. @item Include an unaltered copy of this License. @item Preserve the section Entitled ``History'', Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled ``History'' in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. @item Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the ``History'' section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. @item For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. @item Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. @item Delete any section Entitled ``Endorsements''. Such a section may not be included in the Modified Version. @item Do not retitle any existing section to be Entitled ``Endorsements'' or to conflict in title with any Invariant Section. @item Preserve any Warranty Disclaimers. @end enumerate If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled ``Endorsements'', provided it contains nothing but endorsements of your Modified Version by various parties---for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. @item COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled ``History'' in the various original documents, forming one section Entitled ``History''; likewise combine any sections Entitled ``Acknowledgements'', and any sections Entitled ``Dedications''. You must delete all sections Entitled ``Endorsements.'' @item COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. @item AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an ``aggregate'' if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. @item TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled ``Acknowledgements'', ``Dedications'', or ``History'', the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. @item TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. @item FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See @uref{https://www.gnu.org/copyleft/}. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License ``or any later version'' applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. @item RELICENSING ``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A ``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the site means any set of copyrightable works thus published on the MMC site. ``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. ``Incorporate'' means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is ``eligible for relicensing'' if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. @end enumerate @page @heading ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: @smallexample @group Copyright (C) @var{year} @var{your name}. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end group @end smallexample If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the ``with@dots{}Texts.''@: line with this: @smallexample @group with the Invariant Sections being @var{list their titles}, with the Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. @end group @end smallexample If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. @c Local Variables: @c ispell-local-pdict: "ispell-dict" @c End: �����������������������������������������������������������������������������������������������������������������������mes-0.24.2/doc/gendocs_template���������������������������������������������������������������������0000644�0000000�0000000�00000006702�14372371517�013275� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!--#include virtual="/server/header.html" --> <!-- Parent-Version: 1.77 --> <title>%%TITLE%% - GNU Project - Free Software Foundation

%%TITLE%%

Free Software Foundation
last updated %%DATE%%

This manual (%%PACKAGE%%) is available in the following formats:

You can buy printed copies of some manuals (among other items) from the Free Software Foundation; this helps support FSF activities.

(This page generated by the %%SCRIPTNAME%% script.)

mes-0.24.2/doc/images/README0000644000000000000000000000121314372371517012152 0ustar -*- org -*- #+TITLE: GNU Mes images Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. gcc-mesboot-graph.dot This graph is generated from Guix wip-bootstrap, doing: ~/src/guix/core-updates/pre-inst-env guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-mesboot)' > doc/images/gcc-mesboot-graph.dot dot -T png doc/images/gcc-mesboot-graph.dot > doc/images/gcc-mesboot-graph.png mes-0.24.2/doc/images/gcc-mesboot-graph.dot0000644000000000000000000004027214372371517015313 0ustar digraph "Guix bag" { "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" [label = "gcc-core-mesboot0@2.95.3", shape = box, fontname = sans]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red]; "/gnu/store/3va8hfvfyp6dbwqk3036kb25wbp0f81z-gcc-core-mesboot0-2.95.3.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" [label = "binutils-mesboot0@2.14", shape = box, fontname = sans]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = cyan3]; "/gnu/store/8ghnzf9idpmva8l4n8fyvvgqlln4rddi-binutils-mesboot0-2.14.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = cyan3]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" [label = "bash-mesboot0@2.05b", shape = box, fontname = sans]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod]; "/gnu/store/yx5dz5gi00q8h5i138h59j1jmbhr3qa4-bash-mesboot0-2.05b.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [label = "make-mesboot0@3.80", shape = box, fontname = sans]; "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = magenta]; "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = magenta]; "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = magenta]; "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = magenta]; "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = magenta]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [label = "tcc-boot0@0.9.26-1103-g6e62e0e", shape = box, fontname = sans]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [color = darkseagreen]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = darkseagreen]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkseagreen]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen]; "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" [label = "mes-boot@0.22", shape = box, fontname = sans]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [color = peachpuff4]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [color = peachpuff4]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = peachpuff4]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = peachpuff4]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = peachpuff4]; "/gnu/store/iny72b5k1f531xv7fr2i31j4gqknjv2l-mes-boot-0.22.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = peachpuff4]; "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" [label = "bootstrap-mes-rewired@0.19", shape = box, fontname = sans]; "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [color = cyan3]; "/gnu/store/xdhz4v7icrfwdbq1j5j052id8l04arms-bootstrap-mes-rewired-0.19.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = cyan3]; "/gnu/store/r7bbw2ywmgqp6m5a1hp0fs4lhc51w3sq-bootstrap-mes-0.drv" [label = "bootstrap-mes@0", shape = box, fontname = sans]; "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [label = "gash-boot@0.2.0", shape = box, fontname = sans]; "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkviolet]; "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkviolet]; "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [label = "bootar@1a", shape = box, fontname = sans]; "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [label = "guile-bootstrap@2.0", shape = box, fontname = sans]; "/gnu/store/a6nbjivhxp65wqj5s8rz0fnmwzqxmhry-bootstrap-mescc-tools-0.5.2.drv" [label = "bootstrap-mescc-tools@0.5.2", shape = box, fontname = sans]; "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [label = "gash-utils-boot@0.1.0", shape = box, fontname = sans]; "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [label = "bzip2-mesboot@1.0.8", shape = box, fontname = sans]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = blue]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = blue]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = blue]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" [label = "gzip-mesboot@1.2.4", shape = box, fontname = sans]; "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = red]; "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = red]; "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = red]; "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = red]; "/gnu/store/qyphha8i1pylf10pm76400kq5d07zsvr-gzip-mesboot-1.2.4.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = red]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" [label = "patch-mesboot@2.5.9", shape = box, fontname = sans]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkseagreen]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkseagreen]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkseagreen]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkseagreen]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkseagreen]; "/gnu/store/vn42sjmbh0zr9wn9lnbsdrxlh1zihx50-patch-mesboot-2.5.9.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkseagreen]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" [label = "sed-mesboot0@1.18", shape = box, fontname = sans]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = darkgoldenrod]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = darkgoldenrod]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = darkgoldenrod]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = darkgoldenrod]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = darkgoldenrod]; "/gnu/store/16w6l2c80hh98kfykal9hpbm93cscbcg-sed-mesboot0-1.18.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = darkgoldenrod]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" [label = "tcc-boot@0.9.27", shape = box, fontname = sans]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/yy8bxckakx5f4rpvqfggrfy21y7bn53g-bzip2-mesboot-1.0.8.drv" [color = blue]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/hlm2wxhh0irfjnds4i86imdqi13iwj81-make-mesboot0-3.80.drv" [color = blue]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/0izhx7j1n6lcpcbvy9i9pyjkzjpbxrcj-tcc-boot0-0.9.26-1103-g6e62e0e.drv" [color = blue]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/jrf5jckbwk949npav1p62vgcg95lr4mx-gash-boot-0.2.0.drv" [color = blue]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/yl8gsvanaj8wgngmgc4an06g5ybadad2-gash-utils-boot-0.1.0.drv" [color = blue]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/w77kjhmj4c4sncndnh0kvf0jfpwpradm-bootar-1a.drv" [color = blue]; "/gnu/store/h1m81zsyi3l4yd9r7pd3ffanb61pszxy-tcc-boot-0.9.27.drv" -> "/gnu/store/qs4086i9b9q0b74l4wjqgzbdc3c0f58f-guile-bootstrap-2.0.drv" [color = blue]; } mes-0.24.2/doc/mes.texi0000644000000000000000000012356414372371517011522 0ustar \input texinfo @c -*- mode: texinfo; -*- @c %**start of header @setfilename mes.info @documentencoding UTF-8 @settitle GNU Mes Reference Manual @c %**end of header @include version.texi @c Identifier of the OpenPGP key used to sign tarballs and such. @set OPENPGP-SIGNING-KEY-ID 1A858392E331EAFDB8C27FFBF3C1A0D9C1D65273 @copying Copyright @copyright{} 2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''. @end copying @dircategory Bootstrapping @direntry * Mes: (mes). A system bootstrap worthy of GNU. * mes: (mes)Invoking mes. Running Mes, a minimalist Guile lookalike. * mescc: (mes)Invoking mescc. Running the MesCC bootstrap compiler. @end direntry @titlepage @title GNU Mes Reference Manual @subtitle Full Source Bootstrapping for the GNU system @author Jan (janneke) Nieuwenhuizen @page @vskip 0pt plus 1filll Edition @value{EDITION} @* @value{UPDATED} @* @insertcopying @end titlepage @contents @c ********************************************************************* @node Top @top GNU Mes This document describes GNU Mes version @value{VERSION}, a bootstrappable Scheme interpreter and C compiler written for bootstrapping the GNU system. @menu * Introduction:: What is Mes about? * Installation:: Installing Mes. * Bootstrapping:: Would you strap my boots? * Contributing:: Your help needed! * Acknowledgments:: Thanks! * Resources:: * GNU Free Documentation License:: The license of this manual. * Concept Index:: Concepts. * Programming Index:: Data types, functions, and variables. @detailmenu --- The Detailed Node Listing --- Software Freedom * Reproducible Builds:: Reproducibility and free software. * Bootstrappable Builds:: The freedom to build a software without binary seed. * Reduced Binary Seed Bootstrap:: Guix reduces bootstrap binaries with 50%. * Scheme-only Bootsrap:: Guix reduced bootstrap binaries to 25%. * Full Source Bootstrap:: A bootstrap worthy of GNU. * LISP as Maxwell's Equations of Software:: Auditable elegance. Full Source Bootstrap * Stage0:: The Magical Self-Hosting Hex Assembler. * M2-Planet:: A Sub-C bootstrap compiler. Installation * Requirements:: Software needed to build and run Mes. * Bootstrap Requirements:: Software needed to bootstrap Mes. * Running the Test Suites:: Testing Mes. Bootstrapping * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * Invoking mes:: Running Mes, a minimalist Guile lookalike. * Invoking mescc:: Running the MesCC bootstrap compiler. * Invoking mesar:: Invoking mes * Environment Variables:: If the bits won't change, change their habitat. Invoking mescc * MesCC Environment Variables:: There's no NIX like POSIX. Contributing * Building from Git:: The latest and greatest. * Running Mes From the Source Tree:: Hacker tricks. * Porting GNU Mes:: Teach Mes about your platform. * The Perfect Setup:: The right tools. * Coding Style:: Hygiene of the contributor. * Submitting Patches:: Share your work. @end detailmenu @end menu @c ********************************************************************* @node Introduction @chapter Introduction @quotation These were “Maxwell’s Equations of Software!” @author Alan Kay @end quotation The purpose of GNU Mes@footnote{``Mes'' is an acronym for the Maxwell Equations of Software.} is to help create a computer operating system that we can trust. Mes consists of a mutual self-hosting Scheme interpreter written in C and a Nyacc-based (see @pxref{NYACC User's Guide,,, nyacc-ug, NYACC User's Guide}) C compiler written in Scheme. The Scheme interpreter @file{mes.c} is about 5,000LOC of restricted C, to be compiled with M2-Planet@footnote{See @url{https://github.com/oriansj/m2-planet}}, a very simple C compiler. If we want to trust our computers to do what we instructed them to do then we need to be able to inspect all instructions---all softwares---that we have given it to run. @section Software Freedom @cindex purpose The four essential Freedoms of Software are at the core of our GNU community. Quoting the GNU philosophy@footnote{The four essential freedoms @url{https://www.gnu.org/philosophy/free-sw.html}} @quotation A program is free software if the program's users have the four essential freedoms: @enumerate 0 @item The freedom to run the program as you wish, for any purpose (freedom 0). @item The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this. @item The freedom to redistribute copies so you can help others (freedom 2). @item The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this. @end enumerate @end quotation A computer operating system that respects the user's freedom is one essential ingredient for building a reliable, trustable computing system. There are about a dozen general purpose operating systems that can be trusted in this way, see @url{https://www.gnu.org/distros/free-distros.html, Free Distributions}. For all softwares on such a system we have the full source code and build recipes available. @c The Free System Distribution Guidelines (GNU FSDG)@footnote{Examples of @c free operating systems are GNU Guix, GNU Parabola and Trisquel, see @c https://www.gnu.org/distros/free-system-distribution-guidelines.html} @c can serve as help to create such a system So we have access to all the software, we have studied it, possibly modified it, then we built it and we installed it on a computer or some device or appliance. How can we trust that when we run the program we are indeed running the untainted product of the source code that we studied? Unless we are certain of this we cannot really enjoy Freedom 1. @menu * Reproducible Builds:: Reproducibility and free software. * Bootstrappable Builds:: The freedom to build a software without binary seed. * Reduced Binary Seed Bootstrap:: Guix reduces bootstrap binaries with 50%. * Scheme-only Bootsrap:: Guix reduced bootstrap binaries to 25%. * Full Source Bootstrap:: A bootstrap worthy of GNU. * LISP as Maxwell's Equations of Software:: Auditable elegance. @end menu @node Reproducible Builds @section Reproducible Builds The current Reproducible Builds effort incubated in the Debian project@footnote{@url{https://debian.org, The Debian Project}} and was organized by Lunar. Quoting the Reproducible Builds website@footnote{@url{https://reproducible-builds.org/,Reproducible Builds}} @quotation A build is reproducible if given the same source code, build environment and build instructions, any party can recreate bit-by-bit identical copies of all specified artifacts. @end quotation @subsection Can we trust our freedom? Now consider the opposite, that a second build of a piece of source code produces a different binary program. Upon further investigation we might find that the only difference is probably harmless: a timestamp that was embedded in the binary, or perhaps the name of the user that built it or directory it was built in. Such investigations can be nontrivial and are highly unpractical. And what if the binary difference is not so trivial, cannot be easily accounted for? A piece of software that cannot be built bit-by-bit reproducible is probably not a good community member in the world of software freedom. We think the importance of reproducibility should not be underestimated largely because failing that precondition makes justifable trust in binaries provided suspect at best and downright dangerous in reality. It becomes clear that a bit-by-bit reproducible build of all our sofwares is essential if we value our Freedom 1. @subsection An Old Idea The idea of reproducible builds is not very new. It was implemented for GNU tools in the early 1990s (which we learned, much later in 2017). In the Debian world it was mentioned first in 2000 and then more explicitly in 2007 on debian-devel@footnote{@url{https://lists.debian.org/debian-devel/2007/09/msg00746.html,Martin Uecker on debian-devel on bit-reproducibility}} @quotation I think it would be really cool if the Debian policy required that packages could be rebuild bit-identical from source. @author Martin Uecker @end quotation @node Bootstrappable Builds @section Bootstrappable Builds Software distributions that take reproducible builds seriously are currently shipping well over 90% reproducible packages. That a package builds bit-by-bit reproducibly however is not enough to guarantee Freedom 1. There is another factor that is often overlooked: opaque ascii or binary @emph{seeds} that are injected during build time. Yes, a package may build reproduciblly from all inspectable sourcess...but what functionality is programmed in the opaque seed? @subsection Bootstrap Binary Seed Possibly one of the most harmless, but certainly by far the biggest binary seed that all software distributions inject are the so called @emph{bootstrap binary seed}. Bootstrap binaries are the initial binary seeds that are used to start building the distribution. The GNU Guix operating system (@pxref{Top,,, guix, The GNU Guix Manual}), version 1.0 had a relatively small closure of bootstrap binary seed: GNU binutils, GNU gcc, GNU Libc, GNU Guile, and ``Static binaries'' (think: bash, bzip2, coreutils, gawk, grep, gzip, patch, sed, tar, xz). @example $ du -schx $(readlink $(guix build bootstrap-tarballs)/*) 2.1M /gnu/store/9623n4bq6iq5c8cwwdq99qb7d0xj93ym-binutils-static-stripped-tarball-2.28.1/binutils-static-stripped-2.28.1-x86_64-linux.tar.xz 18M /gnu/store/437xwygmmwwpkddcyy1qvjcv4hak89pb-gcc-stripped-tarball-5.5.0/gcc-stripped-5.5.0-x86_64-linux.tar.xz 1.8M /gnu/store/55ccx18a0d1x5y6a575jf1yr0ywizvdg-glibc-stripped-tarball-2.26.105-g0890d5379c/glibc-stripped-2.26.105-g0890d5379c-x86_64-linux.tar.xz 5.7M /gnu/store/bqf0ajclbvnbm0a46819f30804y3ilx0-guile-static-stripped-tarball-2.2.3/guile-static-stripped-2.2.3-x86_64-linux.tar.xz 5.8M /gnu/store/j8yzjmh9sy4gbdfwjrhw46zca43aah6x-static-binaries-tarball-0/static-binaries-0-x86_64-linux.tar.xz 33M total @end example only a 33MB download that unpacks to a 252MB @emph{seed} of opaque binary code. @example $ for i in $(readlink $(guix build bootstrap-tarballs)/*);\ do sudo tar xf $i; done $ du -schx * 130M bin 13M include 54M lib 51M libexec 5.2M share 252M total @end example @node Reduced Binary Seed Bootstrap @section Reduced Binary Seed Bootstrap During the Guix 1.1 development series we managed to create the first reduction by 50% of the Guix @emph{bootstrap binary seed}@footnote{See @url{https://guix.gnu.org/blog/2019/guix-reduces-bootstrap-seed-by-50/}}. This was a very important step because the ~250MB @emph{seed} of binary code was practically non-auditable, which makes it hard to establish what source code produced them. @node Scheme-only Bootsrap @section Scheme-only Bootstrap The next step that Guix has taken is to replace the shell and all its utilities with implementations in Guile Scheme, the @emph{Scheme-only bootstrap}. This second halving of the boostrap binaries reduced their size to 25% @footnote{See @url{https://guix.gnu.org/en/blog/2020/guix-further-reduces-bootstrap-seed-to-25/}}. Gash (@pxref{Gash,,, gash, The Gash manual}) is a POSIX-compatible shell that replaces Bash, and it comes with Gash Utils which has minimalist replacements for Awk, the GNU Core Utilities, Grep, Gzip, Sed, and Tar. The rest of the bootstrap binary seeds that were removed are now built from source. @node Full Source Bootstrap @section Full Source Bootstrap Reduction of binary seeds is great, but there is an obvious target: we cannot allow any binary seeds in our software stack. Not even in the bootstrap binary seed. Maybe that is a bit too strong: we want to have the absolute minimum of binary seeds and all binary seeds need to be inspectable and must be reviewed. How big would the absolute minimal set be? @menu * Stage0:: The Magical Self-Hosting Hex Assembler. * M2-Planet:: A Sub-C bootstrap compiler. @end menu @node Stage0 @subsection Stage0 June 2016 I learnt about @url{https://github.com/oriansj/stage0/,Stage0}. Jeremiah Orians created @file{hex0} a ~500 byte self-hosting hex assembler. The source code is well documented and the binary is the exact mirror of the source code. I was inspired. Here is an example of what the @file{hex0} program looks like; the start of the @var{hex} function @example 00000060: 4883 f830 7c6f 4883 f83a 7c5a 4883 f841 H..0|oH..:|ZH..A @dots{} 000000d0: 48c7 c0ff ffff ffc3 0000 0000 0000 0000 H............... 000000e0: 4883 e830 c300 0000 0000 0000 0000 0000 H..0............ @end example All computer programs look like this: an opaque list of computer codes. The initial programs that we take for granted---the bootstrap binary seed---are about 250MB of such numbers: think 250,000 pages full of numbers. Most computers work pretty well so apparently there is not a pressing need to inspect and study all of these codes. At the same time it is tricky to fully trust@footnote{ Ken Thompson's 1984 Turing award acceptance speech @url{https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf, Reflections on Trusting Tust}.} a computer that was bootstrapped in this way. Here is what the source code of the @file{hex0} assembler looks like @example ## function: hex 48 83 f8 30 # cmp $0x30,%rax 7c 6f # jl 6000f3 48 83 f8 3a # cmp $0x3a,%rax 7c 5a # jl 6000e4 48 83 f8 41 # cmp $0x41,%rax @dots{} ## function: ascii_other 48 c7 c0 ff ff ff ff # mov $0xffffffffffffffff,%rax c3 # ret @dots{} ## function: ascii_num 48 83 e8 30 # sub $0x30,%rax c3 # ret @end example While it may be hard to understand what this piece of the program does, it should be possible for anyone to verify that the computer codes above correspond to the source code with comments. One step beyond these annotated codes is Assembly language. To write a program in Assembly, you only need to provide the instructions; the codes are computed by the @file{assembler} program. @example hex: # deal all ascii less than 0 cmp $48, %rax jl ascii_other # deal with 0-9 cmp $58, %rax jl ascii_num @dots{} ascii_other: mov $-1, %rax ret ascii_num: sub $48, %rax ret @end example More readable still, a similar program text in the C programming language. @example int hex (int c) @{ if (c >= '0' && c <= '9') return c - 48; @dots{} @} @end example What if we could bootstrap our entire system from only this one @file{hex0} assembler binary seed? We would only ever need to inspect these 500 bytes of computer codes. Every@footnote{Some program languages have become very hard or practically impossible to bootstrap. Instead of depending on a simple language such as C, they depend on a recent version of itself, or on other binary or ASCII seeds, on other recent programs written in that language, or even on manual intervention. Programs written in a language that cannot be bootstrapped can still run on our systems, but cannot enjoy any of the trust we intend to create.} later program is written in a more friendly programming language: Assembly, C, @dots{} Scheme. Inspecting all these programs is a lot of work, but it can certainly be done. We might be able to create a fully inspectable path from almost nothing to all of the programs that our computer runs. Something that seemed to be an impossible dream is suddenly starting to look like ``just a couple years of work''. @node M2-Planet @subsection M2-Planet @url{https://github.com/oriansj/m2-planet/,M2-Planet} @footnote{The PLAtform NEutral Transpiler}, when combined with @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}; allows one to compile a subset of the C language into working binaries with introspective steps inbetween. In 2021 M2-Planet with release 1.8.0 reached a level of maturity that allowed to build MesCC-Tools and Mes. This allows for another reduction the Guix bootstrap binaries: mes and mescc-tools can be removed. @node LISP as Maxwell's Equations of Software @section LISP as Maxwell's Equations of Software As fate would have it, I stumbled upon this @url{https://queue.acm.org/detail.cfm?id=1039523, interview with Alan Kay}, where he shares a revelation he had when reading John McCarthy's @url{https://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf, LISP-1.5} manual: @quotation that was the big revelation to me @dots{} when I finally understood that the half page of code on the bottom of page 13 of the Lisp 1.5 manual was Lisp in itself. These were “Maxwell’s Equations of Software!” This is the whole world of programming in a few lines that I can put my hand over. @author Alan Kay @end quotation Our starting point is @file{hex0}, a 500 byte hex assembler and we need to somehow close the gap to building the bootstrap binary seed, esp. GNU Gcc and the GNU C Library. What better way to do that than by leveraging the powers of LISP? GNU Mes is a Scheme@footnote{Scheme is a modern LISP} interpreter that will be indirectly bootstrapped from @file{hex0} and that wields the magical powers of LISP to close the bootstrap gap, asserting we can enjoy software Freedom 1. @subsection Auditable Elegance @code{eval} and @code{apply} are mutual recursing functions that---using a few helper functions---describe the core of the universe of computing. @lisp (define (apply fn x a) (cond ((atom fn) (cond ((eq fn CAR) (caar x)) ((eq fn CDR) (cdar x)) ((eq fn CONS) (cons (car x) (cadr x))) ((eq fn ATOM) (atom (car x))) ((eq fn EQ) (eq (car x) (cadr x))) (#t (apply (eval fn a) x a)))) ((eq (car fn) LAMBDA) (eval (caddr fn) (pairlis (cadr fn) x a))) ((eq (car fn) LABEL) (apply (caddr fn) x (cons (cons (cadr fn) (caddr fn)) a))))) @end lisp @lisp (define (eval e a) (cond ((atom e) (cdr (assoc e a))) ((atom (car e)) (cond ((eq (car e) QUOTE) (cadr e)) ((eq (car e) COND) (evcon (cdr e) a)) (#t (apply (car e) (evlis (cdr e) a) a)))) (#t (apply (car e) (evlis (cdr e) a) a)))) @end lisp It will be a big day when our computers are fully bootstrapped from source. It would be nice if that source code were readable, auditable and elegant. To be honest, the elegance displayed above that we achieved at the very start of the Mes project is currently hard to find. It is our sincerest hope to bring back this level of quality and elegance.. @c ********************************************************************* @node Installation @chapter Installation @cindex installing Mes Mes is available for download from its website at @url{https://www.gnu.org/pub/gnu/mes/}. This section describes the software requirements of Mes, as well as how to install it and get ready to use it. @menu * Requirements:: Software needed to build and run Mes. * Bootstrap Requirements:: Software needed to bootstrap Mes. * Running the Test Suites:: Testing Mes. @end menu @node Requirements @section Requirements This section lists requirements when building Mes from source. The build procedure for Mes is the same as for other GNU software, and is not covered here. Please see the files @file{README} and @file{INSTALL} in the Mes source tree for additional details. GNU Mes depends on the following packages: @itemize @item @url{https://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or later, including 2.2.x and 3.0.x, @item @url{https://www.gnu.org/software/make/, GNU Make}. @item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2, @item @url{https://gcc.gnu.org, GCC's gcc}, version 2.95.3 or later, including 10.2.0, @item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0, @end itemize The following dependencies are optional: @itemize Support for building the bootstrap @file{bin/mes-m2} depends on @item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0. @end itemize @cindex Guile, compatibility Mes is compatible with GNU Guile, so it is possible to share the same Scheme code between both. Currently Mes only supports the minimal subset of R5RS and Guile extensions to run MesCC. @node Bootstrap Requirements @section Bootstrap Requirements This section lists requirements when building Mes as a bootstrap package. The bootstrap build procedure for Mes is similar to building GNU software and goes like this @example sh configure.sh --prefix=/your/prefix/here sh bootstrap.sh sh check.sh sh install.sh @end example See @file{configure.sh} and @file{bootstrap.sh} for inspiration on what environment variables to set. Bootstrapping Mes depends on the following packages: @itemize @item a POSIX-compatible shell @item @url{https://savannah.gnu.org/projects/mescc-tools/, mescc-tools}, version 1.4.0, @item @url{https://github.com/oriansj/m2-planet/, M2-Planet}, version 1.9.0. @item @url{https://savannah.gnu.org/projects/nyacc/, NYACC}, version 1.00.2, @end itemize @node Running the Test Suites @section Running the Test Suites @cindex test suites After a successful @command{configure} and @code{make} run, it is a good idea to run the test suites. @example make check @end example Run Mes Scheme language semantics tests (@file{scaffold/boot}) only @example build-aux/check-boot.sh @end example Run a single Mes boot test @example MES_BOOT=scaffold/boot/00-zero.scm bin/mes @end example Run a single Mes Scheme test @example ./pre-inst-env tests/boot.test MES=guile ./pre-inst-env tests/boot.test @end example Run MesCC tests only @example build-aux/check-mescc.sh @end example Run a single MesCC test @example CC=gcc CC32=i686-unknown-linux-gnu-gcc MES=guile \ build-aux/test.sh scaffold/tests/00-exit-0 @end example @node Bootstrapping @chapter Bootstrapping @quotation Recipe for yogurt: Add yogurt to milk. @author Anonymous @end quotation The bootstrap problem we have set out to solve is that none of our modern software distributions, and Guix in particular, can be created all from source code. In addition to the carefully signed source code of all the programs (the `milk') an opaque binary seed (the `yogurt') is injected as an essential dependency. Why would this be a problem, I hear you ask? This is how it is done, we always did it this way, everyone does it like this! Indeed, a popular way of handling the bootstrapping issue is by ignoring it. @quotation Your compiler becoming self-hosting@dots{}a language creator's wet dream. @author PFH @end quotation It seems that writing a self-hosting compiler is considered to be a language creator's ultimate goal. It means that their language and compiler have become powerful enough to not depend on a pre-exising language that possibly is---but certainly was until now---more powerful; it feels like passing the rite to adulthood. When you see the irony, you grasp what our bootstrapping effort means in practice. Creating bootstrappable software is not hard; actually most softwares' first releases are bootstrappable. The problem of bootstrapping is not a technical one, it is a lack of awareness and responsibility. @menu * The Mes Bootstrap Process:: How Mes will make you yogurt from pure milk. * Invoking mes:: Running Mes, a minimalist Guile lookalike. * Invoking mescc:: Running the MesCC bootstrap compiler. * Invoking mesar:: @end menu @node The Mes Bootstrap Process @section The Mes Bootstrap Process The Reduced Binary Seed bootstrap currently adopted by Guix@footnote{See @file{gnu/packages/commencement.scm} in the @var{master} branch in Guix git @url{https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/commencement.scm}}. In its intiial form it is only available for x86-linux and armhf-linux. Currently, it goes like this: @verbatim gcc-mesboot (4.9.4) ^ | glibc-mesboot (2.16.0) ^ | gcc-mesboot1 (4.7.4) ^ | binutils-mesboot (2.20.1a) ^ | gcc-mesboot0 (2.95.3) ^ | glibc-mesboot0 (2.2.5) ^ | gcc-core-mesboot (2.95.3) ^ | make-mesboot0, diffutils-mesboot, binutils-mesboot0 (2.20.1a) ^ | tcc-boot ^ | tcc-boot0 ^ | mes-boot ^ | * gash-boot, gash-utils-boot ^ | * bootstrap-mescc-tools, bootstrap-mes (~12 MiB) bootstrap-guile (~48 MiB) @end verbatim @c This graph is generated from wip-bootstrap, doing: @c guix graph --type=bag -e '(@@ (gnu packages commencement) gcc-core-mesboot0)' > doc/images/gcc-mesboot-graph.dot @c dot -T png doc/images/gcc-mesboot-graph.dot > doc/images/gcc-mesboot-graph.png Here's a generated dependency diagram to for the initial bootstrap gcc that builds the rest of Guix. @image{images/gcc-mesboot-graph,6in,,Reference graph of the gcc-core-mesboot0} Work is ongoing to remove these binary seeds that were intentionally injected by our own doing as temporary shortcut @example bootstrap-mescc-tools (seed), bootstrap-mes (seed) @end example For now, this additional non-bootstrapped dependencies (i.e., binary seeds) are taken for granted @example bootstrap-guile @end example Our next priority is to eleminate these one by one. @node Invoking mes @section Invoking mes @cindex repl The @command{mes} command is the Scheme interpreter whose prime directive is to run the @command{MesCC} program. For convenience and testing purposes, @command{mes} tries to mimic guile. @example mes @var{option}@dots{} @file{FILE}@dots{} @end example The @var{option}s can be among the following: @table @code @item -s @var{script} @var{arg}@dots{} @cindex script mode By default, mes will read a file named on the command line as a script. Any command-line arguments @var{arg}@dots{} following @var{script} become the script's arguments; the @code{command-line} function returns a list of strings of the form @code{(@var{script} @var{arg}@dots{})}. Scripts are read and evaluated as Scheme source code just as the @code{load} function would. After loading @var{script}, mes exits. @item -c @var{expr} @var{arg}@dots{} @cindex evaluate expression, command-line argument Evaluate @var{expr} as Scheme code, and then exit. Any command-line arguments @var{arg}@dots{}) following @var{expr} become command-line arguments; the @code{command-line} function returns a list of strings of the form @code{(@var{guile} @var{arg}@dots{})}, where @var{mes} is the path of the mes executable. @item -- @var{arg}@dots{} Run interactively, prompting the user for expressions and evaluating them. Any command-line arguments @var{arg}@dots{} following the @option{--} become command-line arguments for the interactive session; the @code{command-line} function returns a list of strings of the form @code{(@var{guile} @var{arg}@dots{})}, where @var{mes} is the path of the mes executable. @item -L,--load-path=@var{directory} Add @var{directory} to the front of Mes module load path. The given directories are searched in the order given on the command line and before any directories in the @env{GUILE_LOAD_PATH} environment variable. @item -C,--compiled-path=@var{directory} Accepted and ignored for Guile compatibility. @item -l @var{file} Load Scheme source code from @var{file}, and continue processing the command line. @item -e,--main=@var{function} Make @var{function} the @dfn{entry point} of the script. After loading the script file (with @option{-s}) or evaluating the expression (with @option{-c}), apply @var{function} to a list containing the program name and the command-line arguments---the list provided by the @code{command-line} function. @item -h@r{, }--help Display help on invoking mes, and then exit. @item -v@r{, }--version Display the current version of mes%, and then exit. @end table @menu * Environment Variables:: If the bits won't change, change their habitat. @end menu @node Environment Variables @subsection Environment Variables @cindex environment variables @cindex shell @cindex initialization @c Hmm, I expected this paragraph in the Guix manual? Here are the environment variables (see @pxref{Environment Variables,,, guile, Guile Reference}) that affect the run-time behavior of mes: @table @env @item MES_BOOT @vindex MES_BOOT Set @env{MES_BOOT} to change the initial Scheme program that mes runs. @item MES_ARENA @vindex MES_ARENA The initial size of the arena @pxref{5.3,,, sicp, SICP} in cells. Default: 20,000. @item MES_MAX_ARENA @vindex MES_MAX_ARENA The maximum size of the arena in cells. Default: 100,000,000. @item MES_MAX_STRING @vindex MES_MAX_STRING The maximum size of a string. Default: 524,288. @item MES_DEBUG @vindex MES_DEBUG @enumerate @item Informational: @itemize @item MODULEDIR @item included SCM modules and sources @item result of program @item gc stats at exit @end itemize @item opened files @item runtime gc stats @item detailed info @itemize @item parsed, expanded program @item list of builtins @item list of symbol @item opened input strings @item gc details @end itemize @item usage of opened input strings @end enumerate @item GUILE_LOAD_PATH @vindex GUILE_LOAD_PATH This variable may be used to augment the path that is searched for Scheme files when loading. Its value should be a colon-separated list of directories. If it contains the special path component @code{...} (ellipsis), then the default path is put in place of the ellipsis, otherwise the default path is placed at the end. The result is stored in @code{%load-path}. Mes uses @var{@strong{GUILE}_LOAD_PATH} for compatibility with Guile. @end table @node Invoking mescc @section Invoking mescc @example mescc @var{option}@dots{} @file{FILE}@dots{} @end example The @var{option}s can be among the following: @table @code @item --align=@var{symbol} align @var{symbol}, the default is @code{functions}; other valid values are: @code{globals}. @item --base-address=ADDRESS use BaseAddress ADDRESS [0x1000000] @item -c @cindex compile preprocess, compile and assemble only; do not link @item -D @var{DEFINE}[=@var{VALUE}] @cindex define DEFINE [VALUE=1] @item -dumpmachine @cindex arch @cindex architecture @cindex machine display the compiler's target processor @item -E preprocess only; do not compile, assemble or link @item -g add @command{blood-elf} debug info This enables GDB setting breakpoints on function names, and to have the GDB backtrace command to show the function call stack. @item -h, --help display this help and exit @item -I DIR append DIR to include path @item -L DIR append DIR to library path @item -l LIBNAME link with LIBNAME @item -m BITS compile for BITS bits [32] @item -O LEVEL use optimizing LEVEL @item -o FILE write output to FILE @item -S preprocess and compile only; do not assemble or link @item --std=STANDARD assume that the input sources are for STANDARD @item -V,--version display version and exit @item -w,--write=TYPE dump Nyacc AST using TYPE @{pretty-print,write@} @item -x LANGUAGE specify LANGUAGE of the following input files @end table @menu * MesCC Environment Variables:: There's no NIX like POSIX. @end menu @node MesCC Environment Variables @subsection MesCC Environment Variables @table @env @item MES @vindex MES Setting @env{MES} to a mes-compatible Scheme will run mescc using that @example MES=guile mescc -c scaffold/main.c @end example See, now Guile has become compatible with Mes, instead of the other way around ;-) @item C_INCLUDE_PATH @vindex C_INCLUDE_PATH @item LIBRARY_PATH @vindex LIBRARY_PATH @item NYACC_DEBUG @vindex NYACC_DEBUG Setting @env{NYACC_DEBUG} makes nyacc print names of function during the parsing phase. @end table @node Invoking mesar @section Invoking mesar @example mesar @var{option}@dots{} @var{command} @file{ARCHIVE-FILE} @file{FILE}@dots{} @end example The @var{command} is ignored for compatibility with @file{ar} @example r[ab][f][u] - replace existing or insert new file(s) into the archive [c] - do not warn if the library had to be created [D] - use zero for timestamps and uids/gids (default) @end example and assumed to be @var{crD}. The @var{option}s can be among the following: @table @code @item -h, --help display this help and exit @item -V,--version display version and exit @end table @c ********************************************************************* @node Contributing @chapter Contributing @menu * Building from Git:: The latest and greatest. * Running Mes From the Source Tree:: Hacker tricks. * Porting GNU Mes:: Teach Mes about your platform. * The Perfect Setup:: The right tools. * Coding Style:: Hygiene of the contributor. * Submitting Patches:: Share your work. @end menu @node Building from Git @section Building from Git If you want to hack GNU Mes itself, it is recommended to use the latest version from the Git repository: @example git clone git://git.savannah.gnu.org/mes.git @end example The easiest way to set up a development environment for Mes is, of course, by using Guix! The following command starts a new shell where all the dependencies and appropriate environment variables are set up to hack on Mes: @example guix shell @end example If you are unable to use Guix when building Mes from a Git checkout, the following are the required packages in addition to those mentioned in the installation instructions (@pxref{Requirements}). @itemize @item @url{https://gnu.org/software/help2man/, GNU Help2man}; @item @url{https://gnu.org/software/texinfo/, GNU Texinfo}; @item @url{https://www.graphviz.org/, Graphviz}; @item @url{https://www.perl.org/, Perl}. @end itemize Finally, you have to invoke @code{make check} to run tests (@pxref{Running the Test Suites}). If anything fails, take a look at installation instructions (@pxref{Installation}) or send a message to the @email{bug-mes@@gnu.org} mailing list. @node Running Mes From the Source Tree @section Running Mes From the Source Tree First, you need to have an environment with all the dependencies available (@pxref{Building from Git}), and then simply prefix each command by @command{./pre-inst-env} (the @file{pre-inst-env} script lives in the top build tree of Mes). @node Porting GNU Mes @section Porting GNU Mes Mes is supported for x86-linux and armhf-linux. A 64 bit (x86_64-linux) is almost done, only a few bugs remain. The Guix bootstrap for x86_64-linux uses mes for x86-lunix and that is not expected to change. Likewise, aarch64-linux uses mes for armhf-linux. A port to GNU/Hurd (x86-gnu) is underway. Initial scaffold, built by @file{build-aux/build-scaffold.sh}: @example @file{lib/linux/x86-mes-gcc/exit-42.S} @file{lib/linux/x86-mes/elf32-0exit-42.hex2} @file{lib/linux/x86-mes/elf32-body-exit-42.hex2} @file{lib/linux/x86-mes-gcc/hello-mes.S} @file{lib/linux/x86-mes/elf32-0hello-mes.hex2} @file{lib/linux/x86-mes/elf32-body-hello-mes.hex2} @end example Porting MesCC: @example @file{lib/x86-mes/x86.M1} @file{module/mescc/mescc.scm} @file{module/mescc/i386/as.scm} @file{module/mescc/i386/info.scm} @file{mes/module/mescc/i386/as.mes} @file{mes/module/mescc/i386/info.mes} @end example @node The Perfect Setup @section The Perfect Setup The Perfect Setup to hack on Mes is basically the perfect setup used for Guile hacking (@pxref{Using Guile in Emacs,,, guile, Guile Reference Manual}). First, you need more than an editor, you need @url{https://www.gnu.org/software/emacs, Emacs}, empowered by the wonderful @url{https://nongnu.org/geiser/, Geiser}. Geiser allows for interactive and incremental development from within Emacs: code compilation and evaluation from within buffers, access to on-line documentation (docstrings), context-sensitive completion, @kbd{M-.} to jump to an object definition, a REPL to try out your code, and more (@pxref{Introduction,,, geiser, Geiser User Manual}). @node Coding Style @section Coding Style In general our code follows the GNU Coding Standards (@pxref{Top,,, standards, GNU Coding Standards}). However, they do not say much about Scheme, so here are some additional rules. @subsection Programming Paradigm Scheme code in Mes is written in a purely functional style. @subsection Formatting Code @cindex formatting code @cindex coding style When writing Scheme code, we follow common wisdom among Scheme programmers. In general, we follow the @url{https://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp Style Rules}. This document happens to describe the conventions mostly used in Guile’s code too. It is very thoughtful and well written, so please do read it. @cindex indentation, of code @cindex formatting, of code If you do not use Emacs, please make sure to let your editor knows these rules. Additionally, in Mes we prefer to format @code{if} statements like this @example (if foo? trivial-then (let ((bar (the-longer @dots{}))) more-complicated @dots{} else)) @end example @node Submitting Patches @section Submitting Patches Development is done using the Git distributed version control system. Thus, access to the repository is not strictly necessary. We welcome contributions in the form of patches as produced by @code{git format-patch} sent to the @email{bug-mes@@gnu.org} mailing list. Please write commit logs in the ChangeLog format (@pxref{Change Logs,,, standards, GNU Coding Standards}); you can check the commit history for examples. @subsection Reporting Bugs Encountering a problem or bug can be very frustrating for you as a user or potential contributor. For us as Mes maintainers, the preferred bug report includes a beautiful and tested patch that we can integrate without any effort. However, please don't let our preference stop you from reporting a bug. There's one thing @emph{much} worse for us than getting a bug report without a patch: Reading a complaint or rant online about your frustrations and how our work sucks, without having heard directly what you experienced. So if you report a problem, will it be fixed? And @strong{when}? The most honest answer is: It depends. Let's curry that informationless honesty with a more helpful and more blunt reminder of a mantra of free software: @quotation @table @strong @item Q: When will it be finished? @item A: It will be ready sooner if you help. @end table @author Richard Stallman @end quotation @cindex contact, irc, mailing list Join us on @code{#bootstrappable} on the Libera Chat IRC network or on @email{bug-mes@@gnu.org} to share your experience---good or bad. @cindex bug, bug report, reporting a bug Please send bug reports with full details to @email{bug-mes@@gnu.org}. @c ********************************************************************* @node Acknowledgments @chapter Acknowledgments We would like to thank the following people for their help: Jeremiah Orians, Peter de Wachter, rain1, Ricardo Wurmus, Rutger van Beusekom. We also thank Ludovic Courtès for creating GNU Guix and making the bootstrap problem so painfully visible, John McCarthy for creating LISP-1.5 and Alan Kay for their inspiring comment on @url{https://queue.acm.org/detail.cfm?id=1039523, Page 13}. @c ********************************************************************* @node Resources @chapter Resources @itemize @item @url{https://bootstrappable.org, Bootstrappable Builds} Minimize the amount and size of opaque binary seeds we need to swallow. @item @url{https://reproducible-builds.org, Reproducible Builds} Provide a verifiable path from source code to binary. @item @url{https://gitlab.com/oriansj/stage0, Stage0} If we want, it could all start with a ~500 byte self-hosting hex assembler. @item @url{https://bootstrapping.miraheze.org, Bootstrapping wiki} An amazing collection of small/bootstrappable compilers, operating systems, anything you need. @item @url{irc.libera.chat, #bootstrappable} The bootstrapping community home at the Libera Chat IRC network. @item @file{guix-devel@@gnu.org} The Guix mailing list, where it all started. @url{https://lists.gnu.org/archive/html/guix-devel/, guix-devel archives}. @end itemize @c ********************************************************************* @node GNU Free Documentation License @appendix GNU Free Documentation License @cindex license, GNU Free Documentation License @include fdl-1.3.texi @c ********************************************************************* @node Concept Index @unnumbered Concept Index @printindex cp @node Programming Index @unnumbered Programming Index @syncodeindex tp fn @syncodeindex vr fn @printindex fn @bye @c Local Variables: @c ispell-local-dictionary: "american"; @c End: mes-0.24.2/guix.scm0000644000000000000000000000261214372371517010744 0ustar ;;; guix.scm -- Guix package definition ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; ;;; GNU Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see . ;;; Commentary: ;; ;; GNU Guix development package. To build and install, run: ;; ;; guix package -f guix.scm ;; ;; To build it, but not install it, run: ;; ;; guix build -f guix.scm ;; ;; To use as the basis for a development environment, run: ;; ;; guix time-machine --commit=ffb616b69dced25b840f2e5178062072d89623eb -- shell ;; ;;; Code: (define %source-dir (dirname (current-filename))) (add-to-load-path (string-append %source-dir "/guix")) (use-modules (git mes)) ;; Return it here so `guix build/environment/package' can consume it directly. mes.git mes-0.24.2/guix/git/mes.scm0000644000000000000000000002360314372371517012316 0ustar ;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright © 2016,2017,2018,2019,2020,2021,2022 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Mes. ;;; ;;; Also borrowing code from: ;;; guile-sdl2 --- FFI bindings for SDL2 ;;; Copyright © 2015 David Thompson ;;; ;;; GNU Mes is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Mes is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Mes. If not, see . (define-module (git mes) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:use-module (ice-9 popen) #:use-module (ice-9 rdelim) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages commencement) #:use-module (gnu packages cross-base) #:use-module (gnu packages gcc) #:use-module (gnu packages graphviz) #:use-module (gnu packages guile) #:use-module (gnu packages man) #:use-module (gnu packages mes) #:use-module (gnu packages package-management) #:use-module (gnu packages version-control) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages texinfo) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix licenses) #:use-module (guix packages) #:use-module (guix utils)) (define %source-dir (getcwd)) (define-public mescc-tools (package (name "mescc-tools") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://git.savannah.nongnu.org/r/mescc-tools.git") (commit (string-append "Release_" version)) (recursive? #t))) ;for M2libc (file-name (git-file-name name version)) (sha256 (base32 "0z2ni2qn2np1walcaqlxz8sinzb78d4hiq9glddzf26wxc226hs4")))) (build-system gnu-build-system) (supported-systems '("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")) (native-inputs (list which)) (arguments `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) (string-append "CC=" ,(cc-for-target))) #:test-target "test" #:phases (modify-phases %standard-phases (delete 'configure)))) (synopsis "Tools for the full source bootstrapping process") (description "Mescc-tools is a collection of tools for use in a full source bootstrapping process. It consists of the M1 macro assembler, the hex2 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and get_machine.") (home-page "https://savannah.nongnu.org/projects/mescc-tools") (license gpl3+))) (define-public m2-planet (package (name "m2-planet") (version "1.9.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/oriansj/m2-planet") (commit (string-append "Release_" version)) (recursive? #t))) ;for M2libc (file-name (git-file-name name version)) (sha256 (base32 "0cgvvq91cbxxm93k8ayyvhpaf3c2lv10qw4wyqwn3hc1qb1cfyvr")))) (native-inputs (list mescc-tools)) (build-system gnu-build-system) (arguments `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) (string-append "CC=" ,(cc-for-target))) #:tests? #f #:phases (modify-phases %standard-phases (delete 'bootstrap) (delete 'configure)))) (synopsis "The PLAtform NEutral Transpiler") (description "M2-Planet, The PLAtform NEutral Transpiler, when combined with mescc-tools compiles a subset of the C language into working binaries with introspective steps inbetween.") (home-page "https://github.com/oriansj/m2-planet") (license gpl3+))) (define-public nyacc-0.99 (package (name "nyacc") (version "0.99.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/nyacc/nyacc-" version ".tar.gz")) (sha256 (base32 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3")) (modules '((guix build utils))) (snippet '(begin (substitute* (find-files "." "^Makefile\\.in$") (("^SITE_SCM_DIR =.*") "SITE_SCM_DIR = \ @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n") (("^SITE_SCM_GO_DIR =.*") "SITE_SCM_GO_DIR = \ @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n") (("^INFODIR =.*") "INFODIR = @prefix@/share/info\n") (("^DOCDIR =.*") "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n")) #t)))) (build-system gnu-build-system) (native-inputs (list pkg-config)) (inputs (list guile-2.2)) (synopsis "LALR(1) Parser Generator in Guile") (description "NYACC is an LALR(1) parser generator implemented in Guile. The syntax and nomenclature should be considered not stable. It comes with extensive examples, including parsers for the Javascript and C99 languages.") (home-page "https://savannah.nongnu.org/projects/nyacc") (license (list gpl3+ lgpl3+)))) (define-public nyacc (package (inherit nyacc-0.99) (version "1.00.2") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/nyacc/nyacc-" version ".tar.gz")) (modules '((guix build utils))) (snippet '(begin (substitute* (find-files "." "^Makefile\\.in$") (("^SITE_SCM_DIR =.*") "SITE_SCM_DIR = \ @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n") (("^SITE_SCM_GO_DIR =.*") "SITE_SCM_GO_DIR = \ @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n") (("^INFODIR =.*") "INFODIR = @prefix@/share/info\n") (("^DOCDIR =.*") "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n")) #t)) (sha256 (base32 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk")))) (inputs (list guile-3.0)))) (define-public mes (package (name "mes") (version #!mes!# "0.24.1") (source (origin (method url-fetch) (uri (string-append "https://ftp.gnu.org/pub/gnu/mes/mes-" version ".tar.gz")) (sha256 (base32 #!mes!# "0246sy5zm49zw4zs87hrq1j1x74mchijh4rlj2mzlwjccha5cybs")))) (build-system gnu-build-system) (supported-systems '("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")) (propagated-inputs (list mescc-tools nyacc)) (native-inputs (append (list guile-3.0) (let ((target-system (or (%current-target-system) (%current-system)))) (cond ((string-prefix? "x86_64-linux" target-system) ;; Use cross-compiler rather than #:system "i686-linux" to get ;; MesCC 64 bit .go files installed ready for use with Guile. (list (cross-binutils "i686-unknown-linux-gnu") (cross-gcc "i686-unknown-linux-gnu"))) ((string-prefix? "aarch64-linux" target-system) ;; Use cross-compiler rather than #:system "armhf-linux" to get ;; MesCC 64 bit .go files installed ready for use with Guile. (let ((triplet "arm-linux-gnueabihf")) (list (cross-binutils triplet) (cross-gcc triplet)))) (else '()))) (list graphviz help2man m2-planet perl ;build-aux/gitlog-to-changelog texinfo))) (arguments `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries (native-search-paths (list (search-path-specification (variable "C_INCLUDE_PATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH") (files '("lib"))) (search-path-specification (variable "MES_PREFIX") (separator #f) (files '(""))))) (synopsis "Scheme interpreter and C compiler for full source bootstrapping") (description "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed bootstrap to Guix and aims to help create full source bootstrapping for GNU/Linux distributions. It consists of a mutual self-hosting Scheme interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with Guile.") (home-page "https://www.gnu.org/software/mes") (license gpl3+))) (define-public mes.git (let ((version #!mes!# "0.24.1") (revision "0") (commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ)))) (package (inherit mes) (name "mes.git") (version (string-append version "-" revision "." (string-take commit 7))) (source (local-file %source-dir #:recursive? #t #:select? (git-predicate %source-dir)))))) mes-0.24.2/include/alloca.h0000644000000000000000000000230414372371517012311 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_ALLOCA_H #define __MES_ALLOCA_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_ALLOCA_H #include_next #else // ! SYSTEM_LIBC #include #if _ALLOCA_UNSIGNED void *alloca (unsigned size); #elif _ALLOCA_CHAR char *alloca (int); #else void *alloca (size_t size); #endif #endif // ! SYSTEM_LIBC #endif // __MES_ALLOCA_H mes-0.24.2/include/ar.h0000644000000000000000000000371514372371517011467 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1996 Free Software Foundation, Inc. * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_AR_H #define __MES_AR_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_AR_H #include_next #else // ! SYSTEM_LIBC // Taken from GNU C Library 2.2.5 /* Archive files start with the ARMAG identifying string. Then follows a `struct ar_hdr', and as many bytes of member file data as its `ar_size' member indicates, for each member file. */ #define ARMAG "!\n" /* String that begins an archive file. */ #define SARMAG 8 /* Size of that string. */ #define ARFMAG "`\n" /* String in ar_fmag at end of each header. */ struct ar_hdr { char ar_name[16]; /* Member file name, sometimes / terminated. */ char ar_date[12]; /* File date, decimal seconds since Epoch. */ char ar_uid[6], ar_gid[6]; /* User and group IDs, in ASCII decimal. */ char ar_mode[8]; /* File mode, in ASCII octal. */ char ar_size[10]; /* File size, in ASCII decimal. */ char ar_fmag[2]; /* Always contains ARFMAG. */ }; #endif // ! SYSTEM_LIBC #endif // __MES_ARGZ_H mes-0.24.2/include/argz.h0000644000000000000000000000237014372371517012024 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_ARGZ_H #define __MES_ARGZ_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_ARGZ_H #include_next #else // ! SYSTEM_LIBC #include size_t __argz_count (char const *argz, size_t len); void __argz_extract (char const *argz, size_t len, char **argv); size_t __argz_extract_count (char const *argz, size_t len, char **argv); #endif // ! SYSTEM_LIBC #endif // __MES_ARGZ_H mes-0.24.2/include/assert.h0000644000000000000000000000233214372371517012360 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_ASSERT_H #define __MES_ASSERT_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_ASSERT_H #include_next #else // ! SYSTEM_LIBC #define assert(x) ((x) ? (void)0 : __assert_fail (#x, 0, 0, 0)) void __assert_fail (char const *s, char const *file, unsigned line, char const *function); #endif // ! SYSTEM_LIBC #endif // __MES_ASSERT_H mes-0.24.2/include/ctype.h0000644000000000000000000000261114372371517012203 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_CTYPE_H #define __MES_CTYPE_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_CTYPE_H #include_next #else // ! SYSTEM_LIBC #include int isalnum (int c); int isalpha (int c); int isascii (int c); int iscntrl (int c); int isdigit (int c); int isgraph (int c); int islower (int c); int isnumber (int c, int base); int isprint (int c); int ispunct (int c); int isspace (int c); int isupper (int c); int isxdigit (int c); int tolower (int c); int toupper (int c); #endif // ! SYSTEM_LIBC #endif // __MES_CTYPE_H mes-0.24.2/include/dirent.h0000644000000000000000000000415114372371517012345 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1991, 1992 Free Software Foundation, Inc. * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_DIRENT_H #define __MES_DIRENT_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_DIRENT_H #include_next #else // ! SYSTEM_LIBC #include // Taken from GNU C Library 1.06.4, 2.2.5 /* * POSIX Standard: 5.1.2 Directory Operations */ #include int __getdirentries (int filedes, char *buffer, size_t nbytes, off_t * basep); struct dirent { ino_t d_ino; off_t d_off; unsigned short int d_reclen; #if 0 unsigned char d_type; #endif char d_name[256]; /* We must not include limits.h! */ }; /* Open a directory stream on NAME. Return a DIR stream on the directory, or NULL if it could not be opened. */ DIR *opendir (char const *name); /* Close the directory stream DIRP. Return 0 if successful, -1 if not. */ int closedir (DIR * dirp); /* Read a directory entry from DIRP. Return a pointer to a `struct dirent' describing the entry, or NULL for EOF or error. The storage returned may be overwritten by a later readdir call on the same DIR stream. */ struct dirent *readdir (DIR * dirp); /* Rewind DIRP to the beginning of the directory. */ extern void rewinddir (DIR * dirp); #endif // ! SYSTEM_LIBC #endif // __MES_DIRENT_H mes-0.24.2/include/dirstream.h0000644000000000000000000000325214372371517013053 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software *Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_DIRSTREAM_H #define __MES_DIRSTREAM_H 1 #if SYSTEM_LIBC && HAVE_DIRSTREAM_H #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_DIRSTREAM_H #include_next #else // ! SYSTEM_LIBC #include // Taken from GNU C Library 2.2.5 /* Directory stream type. */ struct __dirstream { int fd; /* File descriptor. */ char *data; /* Directory block. */ size_t allocation; /* Space allocated for the block. */ size_t size; /* Total valid data in the block. */ size_t offset; /* Current offset into the block. */ off_t filepos; /* Position of next entry to read. */ }; typedef struct __dirstream DIR; #endif // ! SYSTEM_LIBC #endif // __MES_DIRSTREAM_H mes-0.24.2/include/dlfcn.h0000644000000000000000000000247014372371517012150 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_DLFCN_H #define __MES_DLFCN_H 1 #if SYSTEM_LIBC #undef __MES_DLFCN_H #include_next #else // ! SYSTEM_LIBC #define RTLD_LAZY 0x00001 #define RTLD_NOW 0x00002 #define RTLD_BINDING_MASK 0x3 #define RTLD_NOLOAD 0x00004 #define RTLD_DEEPBIND 0x00008 #define RTLD_GLOBAL 0x00100 #define RTLD_LOCAL 0 #define RTLD_NODELETE 0x01000 #define RTLD_DEFAULT 0 void *dlopen (char const *filename, int flags); int dlclose (void *handle); #endif // ! SYSTEM_LIBC #endif // __MES_DLFCN_H mes-0.24.2/include/endian.h0000644000000000000000000000220314372371517012312 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_ENDIAN_H #define __MES_ENDIAN_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_ENDIAN_H #include_next #else // ! SYSTEM_LIBC #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #define __BYTE_ORDER __LITTLE_ENDIAN #endif // ! SYSTEM_LIBC #endif // __MES_ENDIAN_H mes-0.24.2/include/errno.h0000644000000000000000000000335014372371517012205 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_ERRNO_H #define __MES_ERRNO_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_ERRNO_H #include_next #else // ! SYSTEM_LIBC #ifndef __MES_ERRNO_T #define __MES_ERRNO_T 1 typedef int error_t; #endif // !__MES_ERRNO_T extern int errno; #define ENOENT 2 #define EINTR 4 #define EIO 5 #define ENXIO 6 #define E2BIG 7 #define ENOEXEC 8 #define EBADF 9 #define ECHILD 10 #define EAGAIN 11 #define ENOMEM 12 #define EACCES 13 #define EEXIST 17 #define EXDEV 18 #define ENOTDIR 20 #define EISDIR 21 #define EINVAL 22 #define EMFILE 24 #define ENOSPC 28 #define ESPIPE 29 #define EPIPE 32 #define ERANGE 34 #define ENAMETOOLONG 36 #define ENOSYS 38 #define ELOOP 40 #if !__MESC__ //extern char const *const sys_errlist[]; extern char *sys_errlist[]; extern int sys_nerr; #endif // !__MESC__ #endif // ! SYSTEM_LIBC #endif // __MES_ERRNO_H mes-0.24.2/include/fcntl.h0000644000000000000000000000363514372371517012174 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_FCNTL_H #define __MES_FCNTL_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_FCNTL_H #include_next #else // ! SYSTEM_LIBC // *INDENT-OFF* #if __linux__ #define O_RDONLY 0 #define O_WRONLY 1 #define O_RDWR 2 #define O_CREAT 0x40 #define O_EXCL 0x80 #define O_TRUNC 0x200 #define O_APPEND 0x400 #ifdef __arm__ #define O_DIRECTORY 0x4000 /*#define O_DIRECT 0x10000*/ #else #define O_DIRECTORY 0x10000 #endif #elif __GNU__ #define O_RDONLY 1 #define O_WRONLY 2 #define O_RDWR 3 #define O_CREAT 0x10 #define O_APPEND 0x100 #define O_TRUNC 0x10000 #else #error platform not supported #endif // *INDENT-ON* #define FD_CLOEXEC 1 #define F_DUPFD 0 #define F_GETFD 1 #define F_SETFD 2 #define F_GETFL 3 #define F_SETFL 4 #define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode) int dup (int old); int dup2 (int old, int new); int fcntl (int filedes, int command, ...); int open (char const *s, int flags, ...); #endif // ! SYSTEM_LIBC #endif // __MES_FCNTL_H mes-0.24.2/include/features.h0000644000000000000000000000175214372371517012702 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_FEATURES_H #define __MES_FEATURES_H 1 #if SYSTEM_LIBC #undef __MES_FEATURES_H #include_next #endif // (SYSTEM_LIBC) #endif // __MES_FEATURES_H mes-0.24.2/include/float.h0000644000000000000000000000207714372371517012172 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_FLOAT_H #define __MES_FLOAT_H 1 #if SYSTEM_LIBC #undef __MES_FLOAT_H #include_next #else // ! SYSTEM_LIBC #define MIN_EXP -1021 #define DBL_MIN_EXP -1021 #define LDBL_MIN_EXP -1021 #endif // ! SYSTEM_LIBC #endif // __MES_FLOAT_H mes-0.24.2/include/getopt.h0000644000000000000000000000331214372371517012360 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_GETOPT_H #define __MES_GETOPT_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_GETOPT_H #include_next #else // ! SYSTEM_LIBC #include int isdigit (int); int isxdigit (int); char *optarg; int optind; int opterr; struct option { char const *name; int has_arg; int *flag; int val; }; enum _argtype { no_argument, required_argument, optional_argument }; int getopt (int argc, char *const *argv, char const *options); int getopt_long (int argc, char *const *argv, char const *options, struct option const *long_options, int *opt_index); int getopt_long_only (int argc, char *const *argv, char const *options, struct option const *long_options, int *opt_index); #endif // ! SYSTEM_LIBC #endif // __MES_GETOPT_H mes-0.24.2/include/gnu/hurd-types.h0000644000000000000000000003571714372371517013771 0ustar /* C declarations for Hurd server interfaces Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2010 Free Software Foundation, Inc. This file is part of the GNU Hurd. The GNU Hurd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. The GNU Hurd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the GNU Hurd; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _HURD_TYPES_H #define _HURD_TYPES_H #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 32 #endif #include /* For struct timespec. */ #include /* For mach_port_t et al. */ #include /* For mach_msg_id_t et al. */ #include /* For pid_t and uid_t. */ /* A string identifying this release of the GNU Hurd. Our interpretation of the term "release" is that it refers to a set of server interface definitions. A "version" in Posix terminology is a distribution of the Hurd; there may be more than one distribution without changing the release number. */ #define HURD_RELEASE "0.0" /* Simple type declarations */ /* These types identify certain kinds of ports used by the Hurd. */ typedef mach_port_t file_t; typedef mach_port_t fsys_t; typedef mach_port_t io_t; typedef mach_port_t process_t; typedef mach_port_t auth_t; typedef mach_port_t socket_t; typedef mach_port_t pf_t; /* Protocol family */ typedef mach_port_t addr_port_t; typedef mach_port_t startup_t; typedef mach_port_t fs_notify_t; typedef mach_port_t exec_startup_t; typedef mach_port_t interrupt_t; typedef mach_port_t proccoll_t; typedef mach_port_t ctty_t; #include /* Defines `error_t'. */ /* These names exist only because of MiG deficiencies. You should not use them in C source; use the normal C types instead. */ typedef char *data_t; typedef const char *const_data_t; typedef char string_t [1024]; typedef int *intarray_t; typedef const int *const_intarray_t; typedef int *fd_mask_t; typedef const int *const_fd_mask_t; typedef mach_port_t *portarray_t; typedef const mach_port_t *const_portarray_t; typedef pid_t *pidarray_t; typedef const pid_t *const_pidarray_t; typedef uid_t *idarray_t; typedef const uid_t *const_idarray_t; #if 0 typedef __loff_t *off_array_t; typedef const __loff_t *const_off_array_t; #endif typedef struct rusage rusage_t; typedef struct flock flock_t; typedef struct utsname utsname_t; #if _FILE_OFFSET_BITS == 64 typedef struct stat io_statbuf_t; typedef struct statfs fsys_statfsbuf_t; #else typedef struct stat64 io_statbuf_t; typedef struct statfs64 fsys_statfsbuf_t; #endif typedef struct timespec timespec_t; /* Parameters and flags in RPC calls */ /* Many such parameters and flags are also defined in various libc headers. */ /* Bits for flags in fs.defs:file_exec_paths and exec.defs:exec_* calls: */ #define EXEC_NEWTASK 0x00000001 /* Create new task; kill old one. */ #define EXEC_SECURE 0x00000002 /* Use secure values of portarray, etc. */ #define EXEC_DEFAULTS 0x00000004 /* Use defaults for unspecified ports. */ #define EXEC_SIGTRAP 0x00000008 /* Simulate SIGTRAP on startup. */ /* This flag is passed through by the exec server but not examined by it. */ #define EXEC_STACK_ARGS 0x00000010 /* Use arguments from stack, not RPC. */ /* Bits for flags in fs.defs:file_set_translator call: */ #define FS_TRANS_FORCE 0x00000001 /* Must use translator(no sht circuit) */ #define FS_TRANS_EXCL 0x00000002 /* Don't do it if already translated. */ #define FS_TRANS_SET 0x00000004 /* Set or clear translator */ #define FS_TRANS_ORPHAN 0x00000008 /* Orphan the active translator. */ /* Values for retry field in fs.defs:dir_lookup call: */ enum retry_type { FS_RETRY_NORMAL = 1, /* Retry normally if retry_name is not null. */ FS_RETRY_REAUTH = 2, /* Retry after reauthenticating retry port. Even if the retry name is null, a retry is still necessary with this code after the reauthentication is complete. */ FS_RETRY_MAGICAL = 3, /* Retry string is magical. */ /* "tty" means controlling tty; "fd/%u" means file descriptor N; "machtype/..." means replace `machtype' with the numbers in decimal returned by the user's kernel as the cpu_type (N) and cpu_subtype (M) (producing N/M/...) and then retry as for FS_RETRY_NORMAL. "/..." means retry "...", but starting from the users root directory. "pid/..." means replace `pid' with the PID of the current process in %u format and then retry as for FS_RETRY_NORMAL. */ }; typedef enum retry_type retry_type; /* Types for fs_notify.defs:dir_changed call: */ enum dir_changed_type { DIR_CHANGED_NULL, /* Always sent first for sync. */ DIR_CHANGED_NEW, /* Specified name has been added. */ DIR_CHANGED_UNLINK, /* Specified name has been removed. */ DIR_CHANGED_RENUMBER, /* Name has been the target of rename. */ }; typedef enum dir_changed_type dir_changed_type_t; /* Types for fs_notify.defs:file_changed call: */ enum file_changed_type { FILE_CHANGED_NULL, /* Always sent first for sync. */ FILE_CHANGED_WRITE, /* File data has been written. */ FILE_CHANGED_EXTEND, /* File has grown. */ FILE_CHANGED_TRUNCATE, /* File has been truncated. */ FILE_CHANGED_META, /* Stat information has changed, and none of the previous three apply. Not sent for changes in node times. */ }; typedef enum file_changed_type file_changed_type_t; /* Select types for io.defs:io_select call: */ #define SELECT_READ 0x00000001 #define SELECT_WRITE 0x00000002 #define SELECT_URG 0x00000004 /* Flags for fsys.defs:fsys_goaway. Also, these flags are sent as the oldtrans_flags in fs.defs:file_set_translator to describe how to terminate the old translator. */ #define FSYS_GOAWAY_NOWAIT 0x00000001 /* Return immediately. */ #define FSYS_GOAWAY_NOSYNC 0x00000002 /* Don't update physical media. */ #define FSYS_GOAWAY_FORCE 0x00000004 /* Go away despite current users. */ #define FSYS_GOAWAY_UNLINK 0x00000008 /* Go away only if non-directory. */ #define FSYS_GOAWAY_RECURSE 0x00000010 /* Shutdown children too. */ /* Types of ports the terminal driver can run on top of; used in term.defs:term_get_bottom_type. */ enum term_bottom_type { TERM_ON_MACHDEV, TERM_ON_HURDIO, TERM_ON_MASTERPTY, }; /* Types of storage, as returned by file_get_storage_info. STORAGE_DEVICE is a mach device_t (for random access devices) STORAGE_HURD_FILE is a hurd file_t (as if a file were mapped) STORAGE_TASK is a task_t (the storage is in the vm of the task) STORAGE_MEMORY is a memory object port STORAGE_ZERO is a fixed-size constant source of zeros STORAGE_INTERLEAVE is a set of other storage types interleaved at a fixed interval STORAGE_CONCAT is a set of other storage types concatenated end-to-end STORAGE_LAYER is a set of storage types, representing the same address range; all will be written too, and will be read in turn until one succeeds STORAGE_REMAP is a layer on top of another store that remaps its blocks STORAGE_COPY is a memory snapshot of another store STORAGE_NETWORK means that the file is stored elsewhere on the network; all the remaining fields contan type-specific information. STORAGE_OTHER means none of these apply; and should be used when no meaningful answer can be given The vectors returned by file_get_storage_info encode each of the above (note that the first int is always the storage type). There are four: ports, ints, offsets (off_t), and data (char); each type of store uses the following entries in each vector: -type- -ports- -ints- -offsets- -data- -kids- device DEVICE TY, FL, BS, NR, NL, ML NR * (OFFS, LEN) NL + ML - file FILE TY, FL, BS, NR, NL, ML NR * (OFFS, LEN) NL + ML - memory MEMOBJ TY, FL, BS, NR, NL, ML NR * (OFFS, LEN) NL + ML - task TASK TY, FL, BS, NR, NL, ML NR * (OFFS, LEN) NL + ML - (the data for the above is a name (incl '\0') and a misc data block) null - TY, FL SIZE - - (BS is 1) ileave - TY, FL, IL, NC - - NC (BS is the LCM of its children; SIZE is the minimum of theirs * IL) concat - TY, FL, NC - - NC (BS is the LCM of its children; SIZE is the sum of theirs) layer - TY, FL, NC - - NC (BS is the LCM of its children; SIZE is the minimum of theirs) remap - TY, FL, NR NR * (OFFS, LEN) - 1 (BS and SIZE are that of the child) copy - TY, FL, SIZE - DATA - (DATA is preceded by padding to the next page boundary, and is SIZE bytes long itself) For ileave, concat, and layer, the children are encoded following the parent. The first int must always be TY. key: TY = type code, FL = flags, BS = block size, NR = num runs, NL = name len, ML = misc len, NC = num children, IL = interleave (bytes), SIZE = Size of storage (blocks), LEN = run length (blocks), OFFS = run offset (blocks), The NR * (OFFS, LEN) offsets for some of the types is the set of block ranges in the underlying address space that, concatenated, make up the contents of the storage -- for instance, doing file_get_storage_info on a file may return storage of type STORAGE_DEVICE, and the accompanying block ranges are the set of blocks on the given device that correspond to that file. Any OFFS == -1 designates a hole in the address range. Note that the total size (SIZE) for these types is the sum of their LEN's. The optional NAME returned by some types (if NL != 0) is a type specific name for the same object referenced by the port also returned. E.g.: device -- The mach device name file -- The file name (unreliable, as the root may not be the same) task -- The pid Unless it is MACH_PORT_NULL, the port should generally be used instead of trying to regenerate it from the associated name, which is intended more for printing messages, etc. */ enum file_storage_class { STORAGE_OTHER, STORAGE_DEVICE, STORAGE_HURD_FILE, STORAGE_NETWORK, STORAGE_MEMORY, STORAGE_TASK, STORAGE_ZERO, STORAGE_CONCAT, STORAGE_INTERLEAVE, STORAGE_LAYER, STORAGE_REMAP, STORAGE_COPY, }; /* Flags for the flags word returned by some types . */ #define STORAGE_MUTATED 0x00000001 /* data as stored is munged from file */ /* Data types */ #include #include #ifndef THREAD_SCHED_INFO #include #endif /* Flags sent in proc_getprocinfo request. */ #define PI_FETCH_TASKINFO 0x0001 #define PI_FETCH_TASKEVENTS 0x0020 #define PI_FETCH_THREADS 0x0002 #define PI_FETCH_THREAD_BASIC 0x0004 #define PI_FETCH_THREAD_SCHED 0x0008 #define PI_FETCH_THREAD_WAITS 0x0010 struct procinfo { int state; uid_t owner; pid_t ppid; pid_t pgrp; pid_t session; pid_t logincollection; int exitstatus; int sigcode; int nthreads; /* size of pi_threadinfos */ struct task_basic_info taskinfo; struct task_events_info taskevents; #ifdef TASK_SCHED_TIMESHARE_INFO struct policy_timeshare_base timeshare_base_info; #endif struct { int died; /* this thread died in the middle of call */ mach_msg_id_t rpc_block; /* thread is blocked on this RPC */ struct thread_basic_info pis_bi; #ifdef THREAD_SCHED_INFO struct thread_sched_info pis_si; #else struct policy_infos pis_pi; #endif } threadinfos[0]; }; typedef int *procinfo_t; typedef const int *const_procinfo_t; /* Bits in struct procinfo state: */ #define PI_STOPPED 0x00000001 /* Proc server thinks is stopped. */ #define PI_EXECED 0x00000002 /* Has called proc_exec. */ #define PI_WAITING 0x00000004 /* Process is waiting for child to exit */ #define PI_ORPHAN 0x00000008 /* Process group is orphaned. */ #define PI_NOMSG 0x00000010 /* Process has no message port. */ #define PI_SESSLD 0x00000020 /* Session leader. */ #define PI_NOTOWNED 0x0000040 /* Process has no owner. */ #define PI_NOPARENT 0x0000080 /* Hasn't identified a parent. */ #define PI_ZOMBIE 0x00000100 /* Has no associated task. */ #define PI_TRACED 0x00000200 /* Process is being traced */ #define PI_GETMSG 0x00000400 /* Process is blocked in proc_getmsgport. */ #define PI_LOGINLD 0x00000800 /* Process is leader of login collection */ /* Conventions */ /* st_fstype in struct stat and fsys_stb_type in fsys_statfsbuf is one of: */ #define FSTYPE_UFS 0x00000000 /* 4.x BSD Fast File System */ #define FSTYPE_NFS 0x00000001 /* Network File System ala Sun */ #define FSTYPE_GFS 0x00000002 /* GNU file system */ #define FSTYPE_LFS 0x00000003 /* Logging File System ala Sprite */ #define FSTYPE_SYSV 0x00000004 /* Old U*x filesystem ala System V */ #define FSTYPE_FTP 0x00000005 /* Transparent FTP */ #define FSTYPE_TAR 0x00000006 /* Transparent TAR */ #define FSTYPE_AR 0x00000007 /* Transparent AR */ #define FSTYPE_CPIO 0x00000008 /* Transparent CPIO */ #define FSTYPE_MSLOSS 0x00000009 /* MS-DOS */ #define FSTYPE_CPM 0x0000000a /* CP/M */ #define FSTYPE_HFS 0x0000000b /* Don't ask */ #define FSTYPE_DTFS 0x0000000c /* used by desktop to provide more info */ #define FSTYPE_GRFS 0x0000000d /* GNU Remote File System */ #define FSTYPE_TERM 0x0000000e /* GNU Terminal driver */ #define FSTYPE_DEV 0x0000000f /* GNU Special file server */ #define FSTYPE_PROC 0x00000010 /* /proc filesystem ala Version 9 */ #define FSTYPE_IFSOCK 0x00000011 /* PF_LOCAL socket naming point */ #define FSTYPE_AFS 0x00000012 /* Andrew File System 3.xx */ #define FSTYPE_DFS 0x00000013 /* Distributed File Sys (OSF) == AFS 4.xx */ #define FSTYPE_PROC9 0x00000014 /* /proc filesystem ala Plan 9 */ #define FSTYPE_SOCKET 0x00000015 /* io_t that isn't a file but a socket */ #define FSTYPE_MISC 0x00000016 /* generic trivfs server */ #define FSTYPE_EXT2FS 0x00000017 /* Linux filesystem by Remy Card */ #define FSTYPE_HTTP 0x00000018 /* Transparent HTTP */ #define FSTYPE_MEMFS 0x00000019 /* In-core filesystem */ #define FSTYPE_ISO9660 0x0000001a /* ISO9660 */ /* Standard port assignments for file_exec_paths and exec_* */ enum { INIT_PORT_CWDIR, INIT_PORT_CRDIR, INIT_PORT_AUTH, INIT_PORT_PROC, INIT_PORT_CTTYID, /* If MACH_PORT_NULL is given for the bootstrap port, the bootstrap port of the old task is used. */ INIT_PORT_BOOTSTRAP, INIT_PORT_MAX }; /* Standard ints for file_exec_paths and exec_* */ enum { INIT_UMASK, INIT_SIGMASK, INIT_SIGIGN, INIT_SIGPENDING, INIT_TRACEMASK, INIT_INT_MAX, }; #endif // _HURD_TYPES_H mes-0.24.2/include/gnu/hurd.h0000644000000000000000000000407014372371517012613 0ustar /* * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_GNU_HURD_H #define __MES_GNU_HURD_H #define _GNU_SOURCE 1 #define __USE_GNU 1 #include #include #ifndef _BITS_TYPES_H #ifndef _LOFF_T #define _LOFF_T typedef off64_t loff_t; #endif #endif #include #include #include struct hurd_startup_data { int flags; mach_port_t *dtable; mach_msg_type_number_t dtable_count; char *argp; int arg_size; char *envp; int env_size; mach_port_t *portarray; mach_msg_type_number_t portarray_count; int *intarray; mach_msg_type_number_t intarray_count; vm_address_t stack_base; vm_size_t stack_count; vm_address_t phdr; vm_size_t phdr_count; vm_address_t user_entry; }; #define _HURD_DTABLE_MAX 1024 extern mach_port_t _hurd_dtable[_HURD_DTABLE_MAX]; extern int _hurd_dtable_count; extern struct hurd_startup_data _hurd_startup_data; #define _HURD_ARGV_MAX 1000 #define _HURD_ENVV_MAX 1000 extern size_t __argc; extern char *__argv[_HURD_ARGV_MAX]; extern char *__envv[_HURD_ENVV_MAX]; mach_port_t fd_get (int filedes); error_t fd_write (mach_port_t port, void const *buffer, size_t *size, loff_t offset); error_t fd_read (mach_port_t port, void *buffer, size_t *size, loff_t offset); #endif // __MES_GNU_HURD_H mes-0.24.2/include/gnu/syscall.h0000644000000000000000000000746214372371517013333 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_GNU_SYSCALL_H #define __MES_GNU_SYSCALL_H #define _GNU_SOURCE 1 #define __USE_GNU 1 #include #include #include #include #include // mach/mach.defs enum { SYS__task_terminate = 2008, SYS__vm_allocate = 2021, SYS__vm_statistics = 2030, SYS__task_get_special_port = 2058, }; // hurd/fsys.defs enum { SYS__dir_lookup = 20018, }; // hurd/io.defs enum { SYS__io_write = 21000, SYS__io_read, }; // hurd/process.defs enum { SYS__proc_mark_exit = 24025, }; // hurd/startup.defs enum { SYS__exec_startup_get_info = 30500, }; extern mach_msg_type_t mach_msg_type_int32; extern mach_msg_type_t mach_msg_type_int64; extern mach_msg_type_long_t mach_msg_type_pointer; struct mach_msg { mach_msg_header_t header; }; struct mach_msg_1 { mach_msg_header_t header; mach_msg_type_t type_one; int one; }; struct mach_msg_2 { mach_msg_header_t header; mach_msg_type_t type_one; int one; mach_msg_type_t type_two; int two; }; struct mach_msg_loff_int { mach_msg_header_t header; mach_msg_type_t type_one; loff_t one; mach_msg_type_t type_two; int two; }; struct mach_msg_startup_info { mach_msg_header_t header; mach_msg_type_t RetCodeType; kern_return_t RetCode; mach_msg_type_t user_entryType; vm_address_t user_entry; mach_msg_type_t phdrType; vm_address_t phdr; mach_msg_type_t phdr_sizeType; vm_size_t phdr_size; mach_msg_type_t stack_baseType; vm_address_t stack_base; mach_msg_type_t stack_sizeType; vm_size_t stack_size; mach_msg_type_t flagsType; int flags; mach_msg_type_long_t argvType; char *argv; mach_msg_type_long_t envpType; char *envp; mach_msg_type_long_t dtableType; mach_port_t *dtable; mach_msg_type_long_t portarrayType; mach_port_t *portarray; mach_msg_type_long_t intarrayType; int *intarray; }; kern_return_t __syscall (mach_port_t port, int sys_call); kern_return_t __syscall2 (mach_port_t port, int sys_call, int one, int two); kern_return_t __syscall_get (mach_port_t port, int sys_call, mach_msg_header_t *message, size_t size); kern_return_t __syscall_put (mach_port_t port, int sys_call, mach_msg_header_t *message, size_t size); // mach.defs kern_return_t __task_terminate (mach_port_t task); kern_return_t __task_get_special_port (mach_port_t task, int which, mach_port_t *port); kern_return_t __vm_allocate (mach_port_t task, vm_address_t *address, vm_size_t size, boolean_t anywhere); kern_return_t __vm_statistics (mach_port_t task, vm_statistics_data_t *vm_stats); // process.defs kern_return_t __proc_mark_exit (mach_port_t process, int one, int two); kern_return_t __exec_startup_get_data (mach_port_t bootstrap, struct hurd_startup_data *data); // io.c kern_return_t __io_write (io_t io_object, data_t data, mach_msg_type_number_t size, loff_t offset, vm_size_t *wrote); kern_return_t __io_read (io_t io, data_t *data, mach_msg_type_number_t *read, loff_t offset, vm_size_t size); #endif // __MES_GNU_SYSCALL_H mes-0.24.2/include/gnu/x86/kernel-stat.h0000644000000000000000000000171714372371517014534 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_GNU_X86_KERNEL_STAT_H #define __MES_GNU_X86_KERNEL_STAT_H 1 #include #endif // __MES_GNU_X86_KERNEL_STAT_H mes-0.24.2/include/grp.h0000644000000000000000000000234114372371517011647 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_GRP_H #define __MES_GRP_H 1 #if SYSTEM_LIBC #undef __MES_GRP_H #include_next #else // ! SYSTEM_LIBC #include struct group { char *gr_name; gid_t gr_gid; char **gr_mem; }; struct group *getgrent (void); void endgrent (void); void setgrent (void); struct group *getgrgid (gid_t gid); struct group *getgrnam (char const *name); #endif // ! SYSTEM_LIBC #endif // __MES_GRP_H mes-0.24.2/include/inttypes.h0000644000000000000000000000210514372371517012734 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_INTTYPES_H #define __MES_INTTYPES_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_INTTYPES_H #include_next #else // ! SYSTEM_LIBC #include #endif // ! SYSTEM_LIBC #endif // __MES_INTTYPES_H mes-0.24.2/include/libgen.h0000644000000000000000000000207714372371517012325 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LIBGEN_H #define __MES_LIBGEN_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_LIBGEN_H #include_next #else // ! SYSTEM_LIBC char *dirname (char *); #endif // ! SYSTEM_LIBC #endif // __MES_LIBGEN_H mes-0.24.2/include/limits.h0000644000000000000000000000223514372371517012362 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LIMITS_H #define __MES_LIMITS_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_LIMITS_H #include_next #else // ! SYSTEM_LIBC #include #define MB_CUR_MAX 1 #define NAME_MAX 255 #define PATH_MAX 512 #define _POSIX_OPEN_MAX 16 #endif // ! SYSTEM_LIBC #endif // __MES_LIMITS_H mes-0.24.2/include/linux/arm/kernel-stat.h0000644000000000000000000000426114372371517015231 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LINUX_ARM_KERNEL_STAT_H #define __MES_LINUX_ARM_KERNEL_STAT_H 1 // https://github.com/torvalds/linux/blob/master/arch/arm/include/uapi/asm/stat.h #include #if __SIZEOF_LONG_LONG__ != 8 // *INDENT-OFF* struct stat { unsigned long st_dev; unsigned long st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned long st_rdev; unsigned long st_size; unsigned long st_blksize; unsigned long st_blocks; unsigned long st_atime; unsigned long st_atime_usec; unsigned long st_mtime; unsigned long st_mtime_usec; unsigned long st_ctime; unsigned long st_ctime_usec; unsigned long __pad0; unsigned long __pad1; }; #else // __SIZEOF_LONG_LONG__ == 8 struct stat { unsigned long long st_dev; unsigned char __pad0[4]; unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned long st_uid; unsigned long st_gid; unsigned long long st_rdev; unsigned char __pad3[4]; long long st_size; unsigned long st_blksize; unsigned long long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned int st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long long st_ino; }; #endif // __SIZEOF_LONG_LONG__ == 8 #endif // __MES_LINUX_ARM_KERNEL_STAT_H mes-0.24.2/include/linux/arm/syscall.h0000644000000000000000000000653214372371517014455 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen * Copyright © 2020 Danny Milosavljevic * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LINUX_ARM_SYSCALL_H #define __MES_LINUX_ARM_SYSCALL_H 1 /* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl */ /* libc-mini */ #ifndef SYS_exit // CONSTANT SYS_exit 0x01 #define SYS_exit 0x01 #endif #ifndef SYS_write // CONSTANT SYS_write 0x04 #define SYS_write 0x04 #endif /* libc */ // CONSTANT SYS_fork 0x02 #define SYS_fork 0x02 // CONSTANT SYS_read 0x03 #define SYS_read 0x03 // CONSTANT SYS_open 0x05 #define SYS_open 0x05 //#define SYS_waitpid // CONSTANT SYS_wait4 0x72 #define SYS_wait4 0x72 // CONSTANT SYS_execve 0x0b #define SYS_execve 0x0b // CONSTANT SYS_chmod 0x0f #define SYS_chmod 0x0f // CONSTANT SYS_access 0x21 #define SYS_access 0x21 // CONSTANT SYS_brk 0x2d #define SYS_brk 0x2d // CONSTANT SYS_ioctl 0x36 #define SYS_ioctl 0x36 // CONSTANT SYS_fsync 0x76 #define SYS_fsync 0x76 // CONSTANT SYS_getcwd 0xb7 #define SYS_getcwd 0xb7 // CONSTANT SYS_dup 0x29 #define SYS_dup 0x29 // CONSTANT SYS_dup2 0x3f #define SYS_dup2 0x3f // CONSTANT SYS_unlink 0x0a #define SYS_unlink 0x0a // CONSTANT SYS_gettimeofday 0x4e #define SYS_gettimeofday 0x4e // CONSTANT SYS_clock_gettime 0x107 #define SYS_clock_gettime 0x107 /* libc+tcc */ #define SYS_close 0x06 #define SYS_lseek 0x13 #define SYS_rmdir 0x28 #define SYS_stat 0x6a /* libc+gnu */ #define SYS_chdir 0x0c #define SYS_link 0x09 #define SYS_getpid 0x14 #define SYS_getuid 0x18 #define SYS_kill 0x25 #define SYS_rename 0x26 #define SYS_mkdir 0x27 #define SYS_pipe 0x2a #define SYS_getgid 0x2f #define SYS_rt_sigaction 0xae #define SYS_rt_sigreturn 0xad #define SYS_fcntl 0x37 #define SYS_getrusage 0x4d #define SYS_lstat 0x6b #define SYS_setitimer 0x68 #define SYS_fstat 0x6c #define SYS_nanosleep 0xa2 #define SYS_getdents 0x8d /* bash */ #define SYS_setuid 0x17 #define SYS_setgid 0x2e #define SYS_geteuid 0x31 #define SYS_getegid 0x32 #define SYS_getppid 0x40 /* make+WITH_GLIBC */ #define SYS_rt_sigprocmask 0xaf /* tar */ #define SYS_symlink 0x53 #define SYS_readlink 0x55 #define SYS_mknod 0x0e #if __SIZEOF_LONG_LONG__ == 8 #define SYS_stat64 0xc3 #define SYS_lstat64 0xc4 #define SYS_fstat64 0xc5 #define SYS_fcntl64 0xdd #define SYS_getdents64 0xdc #undef SYS_stat #define SYS_stat SYS_stat64 #undef SYS_lstat #define SYS_lstat SYS_lstat64 #undef SYS_fstat #define SYS_fstat SYS_fstat64 #endif // __SIZEOF_LONG_LONG__ == 8 #endif /* __MES_LINUX_ARM_SYSCALL_H */ mes-0.24.2/include/linux/m2/kernel-stat.h0000644000000000000000000000263214372371517014770 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __LINUX_M2_KERNEL_STAT_H #define __LINUX_M2_KERNEL_STAT_H /* https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h */ /* *INDENT-OFF* */ struct stat { unsigned st_dev; unsigned st_ino; char st_mode[2]; char st_nlink[2]; char st_uid[2]; char st_gid[2]; unsigned st_rdev; unsigned st_size; unsigned st_blksize; unsigned st_blocks; unsigned st_atime; unsigned st_atime_usec; unsigned st_mtime; unsigned st_mtime_usec; unsigned st_ctime; unsigned st_ctime_usec; unsigned __pad0; unsigned __pad1; }; #endif /* __LINUX_M2_KERNEL_STAT_H */ mes-0.24.2/include/linux/syscall.h0000644000000000000000000000240714372371517013673 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYSCALL_H #define __MES_SYSCALL_H long _sys_call (long sys_call); long _sys_call1 (long sys_call, long one); long _sys_call2 (long sys_call, long one, long two); long _sys_call3 (long sys_call, long one, long two, long three); long _sys_call4 (long sys_call, long one, long two, long three, long four); long _sys_call6 (long sys_call, long one, long two, long three, long four, long five, long six); #endif //__MES_SYSCALL_H mes-0.24.2/include/linux/x86/kernel-stat.h0000644000000000000000000000426114372371517015077 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LINUX_X86_KERNEL_STAT_H #define __MES_LINUX_X86_KERNEL_STAT_H 1 // https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h #include #if __SIZEOF_LONG_LONG__ != 8 // *INDENT-OFF* struct stat { unsigned long st_dev; unsigned long st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned long st_rdev; unsigned long st_size; unsigned long st_blksize; unsigned long st_blocks; unsigned long st_atime; unsigned long st_atime_usec; unsigned long st_mtime; unsigned long st_mtime_usec; unsigned long st_ctime; unsigned long st_ctime_usec; unsigned long __pad0; unsigned long __pad1; }; #else // __SIZEOF_LONG_LONG__ == 8 struct stat { unsigned long long st_dev; unsigned char __pad0[4]; unsigned long __st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned long st_uid; unsigned long st_gid; unsigned long long st_rdev; unsigned char __pad3[4]; long long st_size; unsigned long st_blksize; unsigned long long st_blocks; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned int st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long long st_ino; }; #endif // __SIZEOF_LONG_LONG__ == 8 #endif // __MES_LINUX_X86_KERNEL_STAT_H mes-0.24.2/include/linux/x86/syscall.h0000644000000000000000000000647714372371517014333 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LINUX_X86_SYSCALL_H #define __MES_LINUX_X86_SYSCALL_H 1 /* libc-mini */ #ifndef SYS_exit // CONSTANT SYS_exit 0x01 #define SYS_exit 0x01 #endif #ifndef SYS_write // CONSTANT SYS_write 0x04 #define SYS_write 0x04 #endif /* libc */ // CONSTANT SYS_fork 0x02 #define SYS_fork 0x02 // CONSTANT SYS_read 0x03 #define SYS_read 0x03 // CONSTANT SYS_open 0x05 #define SYS_open 0x05 // CONSTANT SYS_waitpid 0x07 #define SYS_waitpid 0x07 // CONSTANT SYS_wait4 0x72 #define SYS_wait4 0x72 // CONSTANT SYS_execve 0x0b #define SYS_execve 0x0b // CONSTANT SYS_chmod 0x0f #define SYS_chmod 0x0f // CONSTANT SYS_access 0x21 #define SYS_access 0x21 // CONSTANT SYS_brk 0x2d #define SYS_brk 0x2d // CONSTANT SYS_ioctl 0x36 #define SYS_ioctl 0x36 // CONSTANT SYS_fsync 0x76 #define SYS_fsync 0x76 // CONSTANT SYS_getcwd 0xb7 #define SYS_getcwd 0xb7 // CONSTANT SYS_dup 0x29 #define SYS_dup 0x29 // CONSTANT SYS_dup2 0x3f #define SYS_dup2 0x3f // CONSTANT SYS_unlink 0x0a #define SYS_unlink 0x0a // CONSTANT SYS_gettimeofday 0x4e #define SYS_gettimeofday 0x4e // CONSTANT SYS_clock_gettime 0x109 #define SYS_clock_gettime 0x109 // CONSTANT SYS_time 0x0d #define SYS_time 0x0d /* libc+tcc */ #define SYS_close 0x06 #define SYS_lseek 0x13 #define SYS_rmdir 0x28 #define SYS_stat 0x6a /* libc+gnu */ #define SYS_chdir 0x0c #define SYS_link 0x09 #define SYS_getpid 0x14 #define SYS_getuid 0x18 #define SYS_kill 0x25 #define SYS_rename 0x26 #define SYS_mkdir 0x27 #define SYS_pipe 0x2a #define SYS_getgid 0x2f #define SYS_signal 0x30 #define SYS_sigaction 0x43 #define SYS_rt_sigaction 0xae #define SYS_signal 0x30 #define SYS_fcntl 0x37 #define SYS_getrusage 0x4d #define SYS_lstat 0x6b #define SYS_setitimer 0x68 #define SYS_fstat 0x6c #define SYS_nanosleep 0xa2 #define SYS_getdents 0x8d /* bash */ #define SYS_setuid 0x17 #define SYS_geteuid 0x31 #define SYS_getegid 0x32 #define SYS_setgid 0x3e #define SYS_getppid 0x40 /* make+POSIX */ #define SYS_sigprocmask 0x7e /* tar */ #define SYS_symlink 0x53 #define SYS_readlink 0x55 #define SYS_mknod 0x0e #if __SIZEOF_LONG_LONG__ == 8 #define SYS_stat64 0xc3 #define SYS_lstat64 0xc4 #define SYS_fstat64 0xc5 #define SYS_fcntl64 0xdd #define SYS_getdents64 0xdc #undef SYS_stat #define SYS_stat SYS_stat64 #undef SYS_lstat #define SYS_lstat SYS_lstat64 #undef SYS_fstat #define SYS_fstat SYS_fstat64 #endif // __SIZEOF_LONG_LONG__ == 8 #endif /* __MES_LINUX_X86_SYSCALL_H */ mes-0.24.2/include/linux/x86_64/kernel-stat.h0000644000000000000000000000311314372371517015403 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LINUX_X86_64_KERNEL_STAT_H #define __MES_LINUX_X86_64_KERNEL_STAT_H 1 // https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/stat.h // *INDENT-OFF* struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; unsigned int __pad0; unsigned long st_rdev; unsigned long st_size; unsigned long st_atime; unsigned long st_atime_nsec; unsigned long st_mtime; unsigned long st_mtime_nsec; unsigned long st_ctime; unsigned long st_ctime_nsec; unsigned long st_blksize; long st_blocks; unsigned long __pad1; unsigned long __pad2; unsigned long __pad3; unsigned long __pad4; }; #endif // __MES_LINUX_X86_64_KERNEL_STAT_H mes-0.24.2/include/linux/x86_64/syscall.h0000644000000000000000000000452014372371517014627 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LINUX_X86_64_SYSCALL_H #define __MES_LINUX_X86_64_SYSCALL_H 1 // libc-mini // #define SYS_write 0x01 // #define SYS_exit 0x3c // libc #define SYS_fork 0x39 #define SYS_read 0x00 #define SYS_open 0x02 //#define SYS_waitpid #define SYS_wait4 0x3d #define SYS_execve 0x3b #define SYS_chmod 0x5a #define SYS_access 0x15 #define SYS_brk 0x0c #define SYS_ioctl 0x10 #define SYS_fsync 0x4a // libc+tcc #define SYS_close 0x03 #define SYS_time 0xc9 #define SYS_lseek 0x08 #define SYS_unlink 0x57 #define SYS_rmdir 0x54 #define SYS_gettimeofday 0x60 #define SYS_stat 0x04 #define SYS_getcwd 0x4f // libc+gnu #define SYS_chdir 0x50 #define SYS_link 0x56 #define SYS_getpid 0x27 #define SYS_getuid 0x66 #define SYS_kill 0x3e #define SYS_rename 0x52 #define SYS_mkdir 0x53 #define SYS_dup 0x20 #define SYS_pipe 0x16 #define SYS_getgid 0x68 #define SYS_rt_sigaction 0x0d #define SYS_rt_sigreturn 0x0f #define SYS_fcntl 0x48 #define SYS_dup2 0x21 #define SYS_getrusage 0x62 #define SYS_lstat 0x06 #define SYS_setitimer 0x26 #define SYS_fstat 0x05 #define SYS_nanosleep 0x33 #define SYS_getdents 0x4e #define SYS_clock_gettime 0xe4 // bash #define SYS_setuid 0x69 #define SYS_setgid 0x6a #define SYS_geteuid 0x6b #define SYS_getegid 0x6c #define SYS_getppid 0x6e // make+SYSTEM_LIBC #define SYS_rt_sigprocmask 0x0e // tar #define SYS_symlink 0x58 #define SYS_readlink 0x59 #define SYS_mknod 0x85 #endif // __MES_LINUX_X86_64_SYSCALL_H mes-0.24.2/include/locale.h0000644000000000000000000000235414372371517012322 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LOCALE_H #define __MES_LOCALE_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_LOCALE_H #include_next #else // ! SYSTEM_LIBC // *INDENT-OFF* #ifndef LC_ALL #define LC_CTYPE 0 #define LC_NUMERIC 1 #define LC_COLLATE 3 #define LC_ALL 6 #endif // *INDENT-ON* char *setlocale (int category, char const *locale); #endif // ! SYSTEM_LIBC #endif // __MES_LOCALE_H mes-0.24.2/include/m2/lib.h0000644000000000000000000000320714372371517012145 0ustar /* * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __M2_LIB_H #define __M2_LIB_H char **environ; int __stdin; int __stdout; int __stderr; int errno; // CONSTANT EOF 0xffffffff // CONSTANT __FILEDES_MAX 512 char* cast_intp_to_charp (int *i); char* cast_long_to_charp (long i); long cast_charp_to_long (char const *); long cast_int_to_long (int i); long cast_voidp_to_long (void const *); char *itoa (int number); char *ltoa (long number); int __ungetc_p (int filedes); int eputs (char *s); int oputs (char *s); int puts (char *s); size_t strlen (char *s); ssize_t _write (); ssize_t write (int filedes, void *buffer, size_t size); void __ungetc_clear (int filedes); void __ungetc_init (); void __ungetc_set (int filedes, int c); struct timezone { int tz_minuteswest; int tz_dsttime; }; struct timespec { long tv_sec; long tv_nsec; }; struct timeval { long tv_sec; long tv_usec; }; #endif /* __M2_LIB_H */ mes-0.24.2/include/m2/types.h0000644000000000000000000000523414372371517012545 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2022,2023 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __M2_TYPES_H #define __M2_TYPES_H 1 /* #ifndef __MES_CLOCK_T #define __MES_CLOCK_T #undef clock_t typedef long clock_t; #endif */ #ifndef __MES_DEV_T #define __MES_DEV_T #undef dev_t typedef long dev_t; #endif /* #if !defined (__MES_FILE_T) && ! defined (_FILE_T) #define __MES_FILE_T #define _FILE_T typedef long FILE; #endif */ #ifndef __MES_GID_T #define __MES_GID_T #undef gid_t typedef unsigned gid_t; #endif #ifndef __MES_INO_T #define __MES_INO_T #undef ino_t typedef unsigned ino_t; #endif #if __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_INO64_T #define __MES_INO64_T #undef ino64_t typedef unsigned ino64_t; #endif #endif // __SIZEOF_LONG_LONG__ == 8 #if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined) #define __MES_INTPTR_T #define __intptr_t_defined #undef intptr_t typedef long intptr_t; #undef uintptr_t typedef unsigned uintptr_t; #endif #ifndef __MES_OFF_T #define __MES_OFF_T #undef off_t typedef long off_t; #endif #if __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_OFF64_T #define __MES_OFF64_T #undef off64_t typedef unsigned off64_t; #endif #endif // __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_PID_T #define __MES_PID_T #undef pid_t typedef int pid_t; #endif #ifndef __PTRDIFF_T #define __PTRDIFF_T #ifndef __MES_PTRDIFF_T #define __MES_PTRDIFF_T #undef ptrdiff_t typedef long ptrdiff_t; #endif #endif #ifndef __MES_SIGVAL_T #define __MES_SIGVAL_T #undef clock_t typedef long sigval_t; #endif #ifndef __SIZE_T #define __SIZE_T #ifndef __MES_SIZE_T #define __MES_SIZE_T typedef unsigned size_t; #endif #endif #ifndef __MES_SSIZE_T #define __MES_SSIZE_T #undef ssize_t typedef long ssize_t; #endif #ifndef __MES_UID_T #define __MES_UID_T #undef uid_t typedef unsigned uid_t; #endif #ifndef __WCHAR_T #define __WCHAR_T #ifndef __MES_WCHAR_T #define __MES_WCHAR_T #undef wchar_t typedef int wchar_t; #endif #endif #endif // __M2_TYPES_H mes-0.24.2/include/mach/mach-init.h0000644000000000000000000000313514372371517013642 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 1993-2016 Free Software Foundation, Inc. * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ /** Commentary: Taken from GNU C Library Declarations and macros for the basic Mach things set at startup. */ #ifndef _MACH_INIT_H #define _MACH_INIT_H 1 #include /* Return the current task's task port. */ extern mach_port_t mach_task_self (void); extern mach_port_t mach_host_self (void); /* Kernel page size. */ extern vm_size_t __vm_page_size; extern vm_size_t vm_page_size; /* Round the address X up to a page boundary. */ #define round_page(x) \ ((((vm_offset_t) (x) + __vm_page_size - 1) / __vm_page_size) * \ __vm_page_size) /* Truncate the address X down to a page boundary. */ #define trunc_page(x) \ ((((vm_offset_t) (x)) / __vm_page_size) * __vm_page_size) #endif /* mach_init.h */ mes-0.24.2/include/math.h0000644000000000000000000000253114372371517012011 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_MATH_H #define __MES_MATH_H 1 #if SYSTEM_LIBC #undef __MES_MATH_H #include_next #else // ! SYSTEM_LIBC double atan2 (double y, double x); double ceil (double x); double cos (double x); double exp (double x); double fabs (double number); double floor (double x); double ldexp (double value, int exponent); double log (double x); double modf (double value, double *integer_part); double pow (double base, double power); double sin (double x); double sqrt (double x); #endif // ! SYSTEM_LIBC #endif // __MES_MATH_H mes-0.24.2/include/memory.h0000644000000000000000000000207514372371517012373 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_MEMORY_H #define __MES_MEMORY_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_MEMORY_H #include_next #else // ! SYSTEM_LIBC #include #endif // ! SYSTEM_LIBC #endif // __MES_MEMORY_H mes-0.24.2/include/mes/builtins.h0000644000000000000000000001740014372371517013476 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_BUILTINS_H #define __MES_BUILTINS_H /* src/builtins.c */ struct scm *make_builtin (struct scm *builtin_type, struct scm *name, struct scm *arity, struct scm *function); struct scm *builtin_name (struct scm *builtin); struct scm *builtin_arity (struct scm *builtin); struct scm *builtin_p (struct scm *x); struct scm *builtin_printer (struct scm *builtin); /* src/core.c */ struct scm *car (struct scm *x); struct scm *cdr (struct scm *x); struct scm *list (struct scm *x); struct scm *null_p (struct scm *x); struct scm *eq_p (struct scm *x, struct scm *y); struct scm *values (struct scm *x); struct scm *acons (struct scm *key, struct scm *value, struct scm *alist); struct scm *length (struct scm *x); struct scm *error (struct scm *key, struct scm *x); struct scm *append2 (struct scm *x, struct scm *y); struct scm *append_reverse (struct scm *x, struct scm *y); struct scm *reverse_x_ (struct scm *x, struct scm *t); struct scm *assq (struct scm *x, struct scm *a); struct scm *assoc (struct scm *x, struct scm *a); /* src/display.c */ struct scm *display_ (struct scm *x); struct scm *display_error_ (struct scm *x); struct scm *display_port_ (struct scm *x, struct scm *p); struct scm *write_ (struct scm *x); struct scm *write_error_ (struct scm *x); struct scm *write_port_ (struct scm *x, struct scm *p); /* src/eval-apply.c */ struct scm *pairlis (struct scm *x, struct scm *y, struct scm *a); struct scm *set_car_x (struct scm *x, struct scm *e); struct scm *set_cdr_x (struct scm *x, struct scm *e); struct scm *set_env_x (struct scm *x, struct scm *e, struct scm *a); struct scm *add_formals (struct scm *formals, struct scm *x); struct scm *eval_apply (); /* src/gc.c */ struct scm *gc_stats (); struct scm *cons (struct scm *x, struct scm *y); struct scm *gc_check (); struct scm *gc (); /* src/hash.c */ struct scm *hashq (struct scm *x, struct scm *size); struct scm *hash (struct scm *x, struct scm *size); struct scm *hashq_get_handle (struct scm *table, struct scm *key, struct scm *dflt); struct scm *hashq_ref (struct scm *table, struct scm *key, struct scm *dflt); struct scm *hash_ref (struct scm *table, struct scm *key, struct scm *dflt); struct scm *hashq_set_x (struct scm *table, struct scm *key, struct scm *value); struct scm *hash_set_x (struct scm *table, struct scm *key, struct scm *value); struct scm *hash_table_printer (struct scm *table); struct scm *make_hash_table (struct scm *x); /* src/lib.c */ struct scm *type_ (struct scm *x); struct scm *car_ (struct scm *x); struct scm *cdr_ (struct scm *x); struct scm *xassq (struct scm *x, struct scm *a); struct scm *memq (struct scm *x, struct scm *a); struct scm *equal2_p (struct scm *a, struct scm *b); struct scm *last_pair (struct scm *x); struct scm *pair_p (struct scm *x); struct scm *char_to_integer (struct scm *x); struct scm *integer_to_char (struct scm *x); /* src/math.c */ struct scm *greater_p (struct scm *x); struct scm *less_p (struct scm *x); struct scm *is_p (struct scm *x); struct scm *minus (struct scm *x); struct scm *plus (struct scm *x); struct scm *divide (struct scm *x); struct scm *modulo (struct scm *a, struct scm *b); struct scm *multiply (struct scm *x); struct scm *logand (struct scm *x); struct scm *logior (struct scm *x); struct scm *lognot (struct scm *x); struct scm *logxor (struct scm *x); struct scm *ash (struct scm *n, struct scm *count); /* src/module.c */ struct scm *make_module_type (); struct scm *module_printer (struct scm *module); struct scm *module_variable (struct scm *module, struct scm *name); struct scm *module_ref (struct scm *module, struct scm *name); struct scm *module_define_x (struct scm *module, struct scm *name, struct scm *value); /* src/posix.c */ struct scm *abort_ (); struct scm *exit_ (struct scm *x); struct scm *peek_byte (); struct scm *read_byte (); struct scm *unread_byte (struct scm *i); struct scm *peek_char (); struct scm *read_char (struct scm *port); struct scm *unread_char (struct scm *i); struct scm *write_char (struct scm *i); struct scm *write_byte (struct scm *x); struct scm *getenv_ (struct scm *s); struct scm *setenv_ (struct scm *s, struct scm *v); struct scm *access_p (struct scm *file_name, struct scm *mode); struct scm *current_input_port (); struct scm *open_input_file (struct scm *file_name); struct scm *open_input_string (struct scm *string); struct scm *set_current_input_port (struct scm *port); struct scm *current_output_port (); struct scm *current_error_port (); struct scm *open_output_file (struct scm *x); struct scm *set_current_output_port (struct scm *port); struct scm *set_current_error_port (struct scm *port); struct scm *chmod_ (struct scm *file_name, struct scm *mode); struct scm *isatty_p (struct scm *port); struct scm *primitive_fork (); struct scm *execl_ (struct scm *file_name, struct scm *args); struct scm *waitpid_ (struct scm *pid, struct scm *options); struct scm *current_time (); struct scm *gettimeofday_ (); struct scm *get_internal_run_time (); struct scm *getcwd_ (); struct scm *dup_ (struct scm *port); struct scm *dup2_ (struct scm *old, struct scm *new); struct scm *delete_file (struct scm *file_name); /* src/reader.c */ struct scm *read_input_file_env_ (struct scm *e, struct scm *a); struct scm *read_input_file_env (struct scm *a); struct scm *read_env (struct scm *a); struct scm *reader_read_sexp (struct scm *c, struct scm *s, struct scm *a); struct scm *reader_read_character (); struct scm *reader_read_binary (); struct scm *reader_read_octal (); struct scm *reader_read_hex (); struct scm *reader_read_string (); /* src/stack.c */ struct scm *frame_printer (struct scm *frame); struct scm *make_stack (struct scm *stack); struct scm *stack_length (struct scm *stack); struct scm *stack_ref (struct scm *stack, struct scm *index); /* src/string.c */ struct scm *string_equal_p (struct scm *a, struct scm *b); struct scm *symbol_to_string (struct scm *symbol); struct scm *symbol_to_keyword (struct scm *symbol); struct scm *keyword_to_string (struct scm *keyword); struct scm *string_to_symbol (struct scm *string); struct scm *make_symbol (struct scm *string); struct scm *string_to_list (struct scm *string); struct scm *list_to_string (struct scm *list); struct scm *read_string (struct scm *port); struct scm *string_append (struct scm *x); struct scm *string_length (struct scm *string); struct scm *string_ref (struct scm *str, struct scm *k); /* src/struct.c */ struct scm *make_struct (struct scm *type, struct scm *fields, struct scm *printer); struct scm *struct_length (struct scm *x); struct scm *struct_ref (struct scm *x, struct scm *i); struct scm *struct_set_x (struct scm *x, struct scm *i, struct scm *e); /* src/vector.c */ struct scm *make_vector (struct scm *x); struct scm *vector_length (struct scm *x); struct scm *vector_ref (struct scm *x, struct scm *i); struct scm *vector_entry (struct scm *x); struct scm *vector_set_x (struct scm *x, struct scm *i, struct scm *e); struct scm *list_to_vector (struct scm *x); struct scm *vector_to_list (struct scm *v); #endif /* __MES_BUILTINS_H */ mes-0.24.2/include/mes/cc.h0000644000000000000000000000251314372371517012231 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_CC_H #define __MES_CC_H typedef struct scm* SCM; #if __MESC__ typedef long FUNCTION; typedef long function0_t; typedef long function1_t; typedef long function2_t; typedef long function3_t; typedef long functionn_t; #else // !__MESC__ typedef SCM (*FUNCTION) (void); typedef SCM (*function0_t) (void); typedef SCM (*function1_t) (SCM); typedef SCM (*function2_t) (SCM, SCM); typedef SCM (*function3_t) (SCM, SCM, SCM); typedef SCM (*functionn_t) (SCM); #endif // !__MESC__ #endif //__MES_CC_H mes-0.24.2/include/mes/constants.h0000644000000000000000000000503114372371517013656 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_CONSTANTS_H #define __MES_CONSTANTS_H /* Cell types */ // CONSTANT TCHAR 0 #define TCHAR 0 // CONSTANT TBYTES 1 #define TBYTES 1 // CONSTANT TCLOSURE 2 #define TCLOSURE 2 // CONSTANT TCONTINUATION 3 #define TCONTINUATION 3 // CONSTANT TKEYWORD 4 #define TKEYWORD 4 // CONSTANT TMACRO 5 #define TMACRO 5 // CONSTANT TNUMBER 6 #define TNUMBER 6 // CONSTANT TPAIR 7 #define TPAIR 7 // CONSTANT TPORT 8 #define TPORT 8 // CONSTANT TREF 9 #define TREF 9 // CONSTANT TSPECIAL 10 #define TSPECIAL 10 // CONSTANT TSTRING 11 #define TSTRING 11 // CONSTANT TSTRUCT 12 #define TSTRUCT 12 // CONSTANT TSYMBOL 13 #define TSYMBOL 13 // CONSTANT TVALUES 14 #define TVALUES 14 // CONSTANT TVARIABLE 15 #define TVARIABLE 15 // CONSTANT TVECTOR 16 #define TVECTOR 16 // CONSTANT TBROKEN_HEART 17 #define TBROKEN_HEART 17 /* Struct types */ // CONSTANT STRUCT_TYPE 0 #define STRUCT_TYPE 0 // CONSTANT STRUCT_PRINTER 1 #define STRUCT_PRINTER 1 // CONSTANT GC_FRAME_SIZE 5 #define GC_FRAME_SIZE 5 // CONSTANT GC_FRAME_PROCEDURE 4 #define GC_FRAME_PROCEDURE 4 // CONSTANT STDIN 0 // CONSTANT STDOUT 1 // CONSTANT STDERR 2 /* Unknown type 1 // CONSTANT EOF -1 */ // CONSTANT O_RDONLY 0 // CONSTANT O_WRONLY 1 // CONSTANT O_CREAT 0x40 // CONSTANT O_TRUNC 0x200 // CONSTANT PATH_MAX 1024 // CONSTANT __FILEDES_MAX 512 // CONSTANT S_IRUSR 00400 // CONSTANT S_IWUSR 00200 // CONSTANT CLOCK_PROCESS_CPUTIME_ID 2 #endif /* __MES_CONSTANTS_H */ mes-0.24.2/include/mes/lib-mini.h0000644000000000000000000000377414372371517013356 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LIB_MINI_H #define __MES_LIB_MINI_H #if HAVE_CONFIG_H #include #endif // CONSTANT STDIN 0 #ifndef STDIN #define STDIN 0 #endif // CONSTANT STDOUT 1 #ifndef STDOUT #define STDOUT 1 #endif // CONSTANT STDERR 2 #ifndef STDERR #define STDERR 2 #endif extern char **environ; extern int __stdin; extern int __stdout; extern int __stderr; int eputs (char const *s); int puts (char const *s); int oputs (char const *s); #if SYSTEM_LIBC #include #include #else //!SYSTEM_LIBC #ifndef _SIZE_T #define _SIZE_T #ifndef __SIZE_T #define __SIZE_T #ifndef __MES_SIZE_T #define __MES_SIZE_T #undef size_t typedef unsigned long size_t; #endif #endif #endif #ifndef _SSIZE_T #define _SSIZE_T #ifndef __SSIZE_T #define __SSIZE_T #ifndef __MES_SSIZE_T #define __MES_SSIZE_T #undef ssize_t #if __i386__ typedef int ssize_t; #else typedef long ssize_t; #endif #endif #endif #endif #ifndef __MES_ERRNO_T #define __MES_ERRNO_T 1 typedef int error_t; extern int errno; #endif // !__MES_ERRNO_T size_t strlen (char const *s); ssize_t _write (); ssize_t write (int filedes, void const *buffer, size_t size); #endif // !SYSTEM_LIBC #endif //__MES_LIB_MINI_H mes-0.24.2/include/mes/lib.h0000644000000000000000000000613514372371517012416 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_LIB_H #define __MES_LIB_H #include char *cast_intp_to_charp (int const *i); char *cast_long_to_charp (long i); long cast_charp_to_long (char const *); long cast_int_to_long (int i); long cast_voidp_to_long (void const *); int __mes_debug (); void __ungetc_init (); void __ungetc_clear (int filedes); void __ungetc_set (int filedes, int c); int __ungetc_p (int filedes); double abtod (char const **p, int base); long abtol (char const **p, int base); char *dtoab (double number, int base, int signed_p); char *itoa (int number); char *ltoa (long number); char *ltoab (long x, int base); char *ntoab (long number, unsigned base, int signed_p); char *ultoa (unsigned long number); char *utoa (unsigned number); int eputc (int c); int fdgetc (int fd); char * fdgets (char *s, int count, int fd); int fdputc (int c, int fd); int fdputs (char const *s, int fd); int fdungetc (int c, int fd); char *_getcwd (char *buffer, size_t size); int ioctl3 (int filedes, size_t command, long data); int isnumber (int c, int base); int mes_open (char const *file_name, int flags, int mask); int _open2 (char const *file_name, int flags); int _open3 (char const *file_name, int flags, int mask); int oputc (int c); int oputs (char const *s); char *search_path (char const *file_name); ssize_t _read (int fd, void *buffer, size_t size); void assert_msg (int check, char *msg); extern char *__brk; extern void (*__call_at_exit) (void); #define __FILEDES_MAX 512 #if !SYSTEM_LIBC void __assert_fail (char const *s, char const *file, unsigned line, char const *function); ssize_t __buffered_read (int filedes, void *buffer, size_t size); size_t __buffered_read_clear (int filedes); void _exit (int code); long brk (void *addr); #endif // !SYSTEM_LIBC long __mesabi_imod (long a, long b); long __mesabi_idiv (long a, long b); unsigned long __mesabi_umod (unsigned long a, unsigned long b); unsigned long __mesabi_udiv (unsigned long a, unsigned long b); unsigned long __mesabi_uldiv (unsigned long a, unsigned long b, unsigned long *remainder); void *__memcpy (void *dest, void const *src, size_t n); void *__memmove (void *dest, void const *src, size_t n); void *__memset (void *s, int c, size_t n); int __raise (int signal); #endif //__MES_LIB_H mes-0.24.2/include/mes/mes.h0000644000000000000000000001273314372371517012435 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_MES_H #define __MES_MES_H #include #include "mes/cc.h" struct scm { long type; union { struct scm *car; long car_value; char *bytes; long length; struct scm *ref; struct scm *variable; struct scm *macro; long port; }; union { struct scm *cdr; long cdr_value; struct scm *closure; struct scm *continuation; char *name; struct scm *string; struct scm *structure; long value; FUNCTION function; struct scm *vector; }; }; /* mes */ extern char *g_datadir; extern int g_debug; extern char *g_buf; extern int g_continuations; extern struct scm *g_symbols; extern struct scm *g_symbol_max; extern int g_mini; /* a/env */ extern struct scm *R0; /* param 1 */ extern struct scm *R1; /* save 2 */ extern struct scm *R2; /* continuation */ extern struct scm *R3; /* current-module */ extern struct scm *M0; /* macro */ extern struct scm *g_macros; extern struct scm *g_ports; /* gc */ extern size_t ARENA_SIZE; extern size_t MAX_ARENA_SIZE; extern size_t STACK_SIZE; extern size_t JAM_SIZE; extern size_t GC_SAFETY; extern size_t MAX_STRING; extern char *g_arena; extern struct scm *cell_arena; extern struct scm *cell_zero; extern struct scm *g_free; extern struct scm *g_symbol; extern struct scm **g_stack_array; extern struct scm *g_cells; extern struct scm *g_news; extern long g_stack; extern size_t gc_count; extern struct timespec *gc_start_time; extern struct timespec *gc_end_time; extern size_t gc_time; extern char **__execl_c_argv; extern char *__open_boot_buf; extern char *__open_boot_file_name; extern char *__setenv_buf; extern char *__reader_read_char_buf; extern struct timespec *g_start_time; extern struct timeval *__gettimeofday_time; extern struct timespec *__get_internal_run_time_ts; struct scm *cast_charp_to_scmp (char const *i); struct scm **cast_charp_to_scmpp (char const *i); char *cast_voidp_to_charp (void const *i); long cast_scmp_to_long (struct scm *i); char *cast_scmp_to_charp (struct scm *i); struct scm *alloc (long n); struct scm *apply (struct scm *f, struct scm *x, struct scm *a); struct scm *apply_builtin (struct scm *fn, struct scm *x); struct scm *apply_builtin0 (struct scm *fn); struct scm *apply_builtin1 (struct scm *fn, struct scm *x); struct scm *apply_builtin2 (struct scm *fn, struct scm *x, struct scm *y); struct scm *apply_builtin3 (struct scm *fn, struct scm *x, struct scm *y, struct scm *z); struct scm *builtin_name (struct scm *builtin); struct scm *cstring_to_list (char const *s); struct scm *cstring_to_symbol (char const *s); struct scm *cell_ref (struct scm *cell, long index); struct scm *fdisplay_ (struct scm *, int, int); struct scm *init_symbols (); struct scm *init_time (struct scm *a); struct scm *make_builtin_type (); struct scm *make_bytes (char const *s, size_t length); struct scm *make_cell (long type, struct scm *car, struct scm *cdr); struct scm *make_pointer_cell (long type, long car, void *cdr); struct scm *make_value_cell (long type, long car, long cdr); struct scm *make_char (int n); struct scm *make_continuation (long n); struct scm *make_hash_table_ (long size); struct scm *make_hashq_type (); struct scm *make_initial_module (struct scm *a); struct scm *make_macro (struct scm *name, struct scm *x); struct scm *make_number (long n); struct scm *make_ref (struct scm *x); struct scm *make_string (char const *s, size_t length); struct scm *make_string0 (char const *s); struct scm *make_string_port (struct scm *x); struct scm *make_vector_ (long k, struct scm *e); struct scm *mes_builtins (struct scm *a); struct scm *push_cc (struct scm *p1, struct scm *p2, struct scm *a, struct scm *c); struct scm *struct_ref_ (struct scm *x, long i); struct scm *struct_set_x_ (struct scm *x, long i, struct scm *e); struct scm *vector_ref_ (struct scm *x, long i); struct scm *vector_set_x_ (struct scm *x, long i, struct scm *e); FUNCTION builtin_function (struct scm *builtin); char *cell_bytes (struct scm *x); int peekchar (); int readchar (); int unreadchar (); long gc_free (); long length__ (struct scm *x); size_t bytes_cells (size_t length); void assert_max_string (size_t i, char const *msg, char const *string); void assert_msg (int check, char *msg); void assert_number (char const *name, struct scm *x); void copy_cell (struct scm *to, struct scm *from); void gc_ (); void gc_dump_arena (struct scm *cells, long size); void gc_init (); void gc_peek_frame (); void gc_pop_frame (); void gc_push_frame (); void gc_stats_ (char const* where); void init_symbols_ (); long seconds_and_nanoseconds_to_long (long s, long ns); #include "mes/builtins.h" #include "mes/constants.h" #include "mes/symbols.h" #endif /* __MES_MES_H */ mes-0.24.2/include/mes/symbols.h0000644000000000000000000001320614372371517013335 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYMBOLS_H #define __MES_SYMBOLS_H extern struct scm *cell_nil; extern struct scm *cell_f; extern struct scm *cell_t; extern struct scm *cell_dot; extern struct scm *cell_arrow; extern struct scm *cell_undefined; extern struct scm *cell_unspecified; extern struct scm *cell_closure; extern struct scm *cell_circular; extern struct scm *cell_vm_apply; extern struct scm *cell_vm_apply2; extern struct scm *cell_vm_begin; extern struct scm *cell_vm_begin_eval; extern struct scm *cell_vm_begin_expand; extern struct scm *cell_vm_begin_expand_eval; extern struct scm *cell_vm_begin_expand_macro; extern struct scm *cell_vm_begin_expand_primitive_load; extern struct scm *cell_vm_begin_primitive_load; extern struct scm *cell_vm_begin_read_input_file; extern struct scm *cell_vm_call_with_current_continuation2; extern struct scm *cell_vm_call_with_values2; extern struct scm *cell_vm_eval; extern struct scm *cell_vm_eval2; extern struct scm *cell_vm_eval_check_func; extern struct scm *cell_vm_eval_define; extern struct scm *cell_vm_eval_macro_expand_eval; extern struct scm *cell_vm_eval_macro_expand_expand; extern struct scm *cell_vm_eval_pmatch_car; extern struct scm *cell_vm_eval_pmatch_cdr; extern struct scm *cell_vm_eval_set_x; extern struct scm *cell_vm_evlis; extern struct scm *cell_vm_evlis2; extern struct scm *cell_vm_evlis3; extern struct scm *cell_vm_if; extern struct scm *cell_vm_if_expr; extern struct scm *cell_vm_macro_expand; extern struct scm *cell_vm_macro_expand_car; extern struct scm *cell_vm_macro_expand_cdr; extern struct scm *cell_vm_macro_expand_define; extern struct scm *cell_vm_macro_expand_define_macro; extern struct scm *cell_vm_macro_expand_lambda; extern struct scm *cell_vm_macro_expand_set_x; extern struct scm *cell_vm_return; extern struct scm *cell_symbol_lambda; extern struct scm *cell_symbol_begin; extern struct scm *cell_symbol_if; extern struct scm *cell_symbol_quote; extern struct scm *cell_symbol_define; extern struct scm *cell_symbol_define_macro; extern struct scm *cell_symbol_quasiquote; extern struct scm *cell_symbol_unquote; extern struct scm *cell_symbol_unquote_splicing; extern struct scm *cell_symbol_syntax; extern struct scm *cell_symbol_quasisyntax; extern struct scm *cell_symbol_unsyntax; extern struct scm *cell_symbol_unsyntax_splicing; extern struct scm *cell_symbol_set_x; extern struct scm *cell_symbol_sc_expand; extern struct scm *cell_symbol_macro_expand; extern struct scm *cell_symbol_portable_macro_expand; extern struct scm *cell_symbol_sc_expander_alist; extern struct scm *cell_symbol_call_with_values; extern struct scm *cell_symbol_call_with_current_continuation; extern struct scm *cell_symbol_boot_module; extern struct scm *cell_symbol_current_module; extern struct scm *cell_symbol_primitive_load; extern struct scm *cell_symbol_car; extern struct scm *cell_symbol_cdr; extern struct scm *cell_symbol_not_a_number; extern struct scm *cell_symbol_not_a_pair; extern struct scm *cell_symbol_system_error; extern struct scm *cell_symbol_throw; extern struct scm *cell_symbol_unbound_variable; extern struct scm *cell_symbol_wrong_number_of_args; extern struct scm *cell_symbol_wrong_type_arg; extern struct scm *cell_symbol_buckets; extern struct scm *cell_symbol_builtin; extern struct scm *cell_symbol_frame; extern struct scm *cell_symbol_hashq_table; extern struct scm *cell_symbol_module; extern struct scm *cell_symbol_procedure; extern struct scm *cell_symbol_record_type; extern struct scm *cell_symbol_size; extern struct scm *cell_symbol_stack; extern struct scm *cell_symbol_argv; extern struct scm *cell_symbol_mes_datadir; extern struct scm *cell_symbol_mes_version; extern struct scm *cell_symbol_internal_time_units_per_second; extern struct scm *cell_symbol_compiler; extern struct scm *cell_symbol_arch; extern struct scm *cell_symbol_pmatch_car; extern struct scm *cell_symbol_pmatch_cdr; extern struct scm *cell_type_bytes; extern struct scm *cell_type_char; extern struct scm *cell_type_closure; extern struct scm *cell_type_continuation; extern struct scm *cell_type_function; extern struct scm *cell_type_keyword; extern struct scm *cell_type_macro; extern struct scm *cell_type_number; extern struct scm *cell_type_pair; extern struct scm *cell_type_port; extern struct scm *cell_type_ref; extern struct scm *cell_type_special; extern struct scm *cell_type_string; extern struct scm *cell_type_struct; extern struct scm *cell_type_symbol; extern struct scm *cell_type_values; extern struct scm *cell_type_variable; extern struct scm *cell_type_vector; extern struct scm *cell_type_broken_heart; extern struct scm *cell_symbol_program; extern struct scm *cell_symbol_test; // CONSTANT SYMBOL_MAX 114 #define SYMBOL_MAX 114 // CONSTANT CELL_UNSPECIFIED 7 #define CELL_UNSPECIFIED 7 // CONSTANT CELL_SYMBOL_RECORD_TYPE 82 #define CELL_SYMBOL_RECORD_TYPE 82 #endif /* __MES_SYMBOLS_H */ mes-0.24.2/include/pwd.h0000644000000000000000000000225314372371517011653 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_PWD_H #define __MES_PWD_H 1 #if SYSTEM_LIBC #undef __MES_PWD_H #include_next #else // ! SYSTEM_LIBC #include struct passwd { char *pw_name; char *pw_passwd; uid_t pw_uid; gid_t pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; }; struct passwd *getpwuid (); #endif // ! SYSTEM_LIBC #endif // __MES_PWD_H mes-0.24.2/include/setjmp.h0000644000000000000000000000315214372371517012362 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * Copyright © 2020 Danny Milosavljevic * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SETJMP_H #define __MES_SETJMP_H 1 #if SYSTEM_LIBC #undef __MES_SETJMP_H #include_next #else // ! SYSTEM_LIBC #if __arm__ #if __GNUC__ || __TINYC__ #warning "It is not supported to use mes' setjmp implementation together with GCC. Continuing with best-effort implementation." typedef struct { long __sp; long __lr; long __registers[8]; /* Note: Keep in sync with lib/arm-mes-gcc/setjmp.c */ } __jmp_buf; #else typedef struct { long __fp; long __lr; long __sp; } __jmp_buf; #endif #else typedef struct { long __bp; long __pc; long __sp; } __jmp_buf; #endif typedef __jmp_buf jmp_buf[1]; void longjmp (jmp_buf env, int val); int setjmp (jmp_buf env); #endif // ! SYSTEM_LIBC #endif // __MES_SETJMP_H mes-0.24.2/include/signal.h0000644000000000000000000001322114372371517012333 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SIGNAL_H #define __MES_SIGNAL_H 1 #if SYSTEM_LIBC #undef __MES_SIGNAL_H #include_next #else //! SYSTEM_LIBC #define _NSIG 64 #define _SIGSET_NITEMS (_NSIG / (8 * sizeof(unsigned long))) typedef struct { unsigned long items[_SIGSET_NITEMS]; } sigset_t; typedef long stack_t; #include // *INDENT-OFF* #define NSIG 30 #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 #define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGUSR1 10 #define SIGSEGV 11 #define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGSTKFLT 16 #define SIGCHLD 17 #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGURG 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGVTALRM 26 #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 #define SIGPOLL SIGIO #define FPE_INTDIV 1 #define FPE_INTOVF 2 #define FPE_FLTDIV 3 #define FPE_FLTOVF 4 #define FPE_FLTUND 5 #define FPE_FLTRES 6 #define FPE_FLTINV 7 #define FPE_FLTSUB 8 #define SA_NOCLDSTOP 0x00000001 #define SA_NOCLDWAIT 0x00000002 #define SA_SIGINFO 0x00000004 #define SA_RESTORER 0x04000000 #define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND typedef struct siginfo_t { int si_signo; int si_errno; int si_code; int si_trapno; pid_t si_pid; uid_t si_uid; int si_status; clock_t si_utime; clock_t si_stime; sigval_t si_value; int si_int; void *si_ptr; int si_overrun; int si_timerid; void *si_addr; long si_band; int si_fd; short si_addr_lsb; void *si_lower; void *si_upper; int si_pkey; void *si_call_addr; int si_syscall; unsigned int si_arch; } siginfo_t; // *INDENT-ON* #if __MESC__ typedef long sighandler_t; #else typedef void (*sighandler_t) (int); #endif #if __i386__ || __x86_64__ struct sigaction { union { sighandler_t sa_handler; void (*sa_sigaction) (int signum, siginfo_t *, void *); }; unsigned long sa_flags; #if __x86_64__ long _foo0; #endif sigset_t sa_mask; #if __x86_64__ long _foo1[15]; #endif //unsigned long sa_flags; // x86? void (*sa_restorer) (void); }; #else /* uapi */ struct sigaction { union { sighandler_t sa_handler; void (*sa_sigaction) (int signum, siginfo_t *, void *); }; unsigned long sa_flags; void (*sa_restorer) (void); sigset_t sa_mask; }; #endif #define SIG_DFL ((sighandler_t)0) #define SIG_IGN ((sighandler_t)1) #define SIG_ERR ((sighandler_t)-1) #ifdef __i386__ #define EBX 0 #define ECX 1 #define EDX 2 #define ESI 3 #define EDI 4 #define EBP 5 #define EAX 6 #define DS 7 #define ES 8 #define FS 9 #define GS 10 #define ORIG_EAX 11 #define EIP 12 #define CS 13 #define EFL 14 #define UESP 15 #define SS 16 #define FRAME_SIZE 17 /* Type for general register. */ typedef int greg_t; /* Number of general registers. */ #define NGREG 19 /* Container for all general registers. */ typedef greg_t gregset_t[NGREG]; /* Definitions taken from the kernel headers. */ struct _libc_fpreg { unsigned short int significand[4]; unsigned short int exponent; }; struct _libc_fpstate { unsigned long int cw; unsigned long int sw; unsigned long int tag; unsigned long int ipoff; unsigned long int cssel; unsigned long int dataoff; unsigned long int datasel; struct _libc_fpreg _st[8]; unsigned long int status; }; /* Structure to describe FPU registers. */ typedef struct _libc_fpstate *fpregset_t; typedef struct { gregset_t gregs; /* Due to Linux's history we have to use a pointer here. The SysV/i386 ABI requires a struct with the values. */ fpregset_t fpregs; unsigned long int oldmask; unsigned long int cr2; } mcontext_t; /* Userlevel context. */ typedef struct ucontext { unsigned long int uc_flags; struct ucontext *uc_link; stack_t uc_stack; mcontext_t uc_mcontext; sigset_t uc_sigmask; struct _libc_fpstate __fpregs_mem; } ucontext_t; #endif // !__i386__ int kill (pid_t pid, int signum); int raise (int); int sigaction (int signum, struct sigaction const *act, struct sigaction *oldact); int sigaddset (sigset_t * set, int signum); #if __MESC__ void *signal (int signum, void *action); #else sighandler_t signal (int signum, sighandler_t action); #endif int sigemptyset (sigset_t * set); #ifndef SIG_BLOCK #define SIG_BLOCK 0 #define SIG_UNBLOCK 1 #define SIG_SETMASK 2 #endif int sigprocmask (int how, sigset_t const *set, sigset_t * oldset); #endif //! SYSTEM_LIBC #endif // __MES_SIGNAL_H mes-0.24.2/include/stdarg.h0000644000000000000000000000373214372371517012350 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDARG_H #define __MES_STDARG_H 1 #if SYSTEM_LIBC #undef __MES_STDARG_H #include_next #define va_arg8(ap, type) va_arg(ap, type) #else // ! SYSTEM_LIBC #include #if __GNUC__ && __x86_64__ #define __FOO_VARARGS 1 #endif typedef char *va_list; #define va_start(ap, last) (void)((ap) = (char*)(&(last) + 1)) #define va_arg(ap, type) (type)(((long*)((ap) = ((ap) + sizeof (void*))))[-1]) #define va_align(ap, alignment) ((char*)((((unsigned long) (ap)) + (alignment) - 1) &~ ((alignment) - 1))) #define va_arg8(ap, type) (type)(((double*)((ap) = (va_align((ap), 8) + sizeof(double))))[-1]) #define va_end(ap) (void)((ap) = 0) #define va_copy(dest, src) dest = src int vexec (char const *file_name, va_list ap); int vfprintf (FILE * stream, char const *template, va_list ap); int vfscanf (FILE * stream, char const *template, va_list ap); int vprintf (char const *format, va_list ap); int vsprintf (char *str, char const *format, va_list ap); int vsnprintf (char *str, size_t size, char const *format, va_list ap); int vsscanf (char const *s, char const *template, va_list ap); #endif // ! SYSTEM_LIBC #endif // __MES_STDARG_H mes-0.24.2/include/stdbool.h0000644000000000000000000000213514372371517012526 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDBOOL_H #define __MES_STDBOOL_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_STDBOOL_H #include_next #else // ! SYSTEM_LIBC typedef int bool; #define false 0 #define true 1 #endif // ! SYSTEM_LIBC #endif // __MES_STDBOOL_H mes-0.24.2/include/stddef.h0000644000000000000000000000264014372371517012332 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * Copyright © 2021 Danny Milosavljevic * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDDEF_H #define __MES_STDDEF_H 1 #if SYSTEM_LIBC #undef __MES_STDDEF_H #include_next #else // ! SYSTEM_LIBC #include #include #include #ifndef offsetof #if __MESC__ #define offsetof(type, field) (&((type *)0)->field) #else // !__MESC__ #define offsetof(type, field) ((size_t)&((type *)0)->field) #endif // !__MESC__ #endif // offsetof /* Note: on banana gcc, max_align_t is 16 Byte big instead! */ typedef double max_align_t; #endif // ! SYSTEM_LIBC #endif // __MES_STDDEF_H mes-0.24.2/include/stdint.h0000644000000000000000000000511614372371517012367 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2020 Jan (janneke) Nieuwenhuizen * Copyright © 2018 Peter De Wachter * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDINT_H #define __MES_STDINT_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_STDINT_H #include_next #else // ! SYSTEM_LIBC #undef unsigned #undef uint8_t #undef int8_t #undef uint16_t #undef int16_t #undef uint32_t #undef int32_t #undef uint64_t #undef int64_t #undef uintptr_t #undef intmax_t #undef intptr_t #undef uintmax_t #undef ptrdiff_t typedef unsigned char uint8_t; typedef char int8_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned uint32_t; typedef int int32_t; #if __SIZEOF_LONG_LONG__ == 8 typedef unsigned long long uint64_t; typedef long long int64_t; #endif // __SIZEOF_LONG_LONG__ == 8 typedef int intmax_t; typedef unsigned uintmax_t; #include #define CHAR_BIT 8 #define CHAR_MAX 255 #define UCHAR_MAX 255 #define INT8_MAX 127 #define INT8_MIN (-INT8_MAX-1) #define UINT8_MAX 255 #define INT16_MAX 32767 #define INT16_MIN (-INT16_MAX-1) #define UINT16_MAX 65535 #define INT32_MAX 2147483647 #define INT32_MIN (-INT32_MAX-1) #define UINT32_MAX 4294967295U #define INT64_MAX 9223372036854775807LL #define INT64_MIN (-INT64_MAX-1) #define UINT64_MAX 18446744073709551615ULL #define INT_MIN -2147483648 #define INT_MAX 2147483647 #if __i386__ || __arm__ #define LONG_MIN INT_MIN #define LONG_MAX INT_MAX #define UINT_MAX UINT32_MAX #define ULONG_MAX UINT32_MAX #define LLONG_MIN INT64_MIN #define LLONG_MAX INT64_MAX #define SIZE_MAX UINT32_MAX #elif __x86_64__ #define LONG_MIN INT64_MIN #define LONG_MAX INT64_MAX #define UINT_MAX UINT32_MAX #define ULONG_MAX UINT64_MAX #define LLONG_MIN INT64_MIN #define LLONG_MAX INT64_MAX #define SIZE_MAX UINT64_MAX #endif #endif // ! SYSTEM_LIBC #endif // __MES_STDINT_H mes-0.24.2/include/stdio.h0000644000000000000000000000535614372371517012212 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDIO_H #define __MES_STDIO_H 1 #include #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_STDIO_H #include_next #else // ! SYSTEM_LIBC #ifndef _IOFBF #define _IOFBF 0 /* Fully buffered. */ #define _IOLBF 1 /* Line buffered. */ #define _IONBF 2 /* No buffering. */ #endif #ifndef BUFSIZ #define BUFSIZ 256 #endif #ifndef L_tmpnam #define L_tmpnam 100 #endif #include #define stdin (FILE*)0 #define stdout (FILE*)1 #define stderr (FILE*)2 #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 FILE *fdopen (int fd, char const *mode); FILE *fopen (char const *file_name, char const *mode); int eputc (int c); int eputs (char const *s); int fclose (FILE * stream); int feof (FILE * stream); int ferror (FILE * stream); int fflush (FILE * stream); int fgetc (FILE * stream); char *fgets (char *s, int size, FILE * stream); int fprintf (FILE * stream, char const *format, ...); int fpurge (FILE * stream); int fputc (int c, FILE * stream); int fputs (char const *s, FILE * stream); int fscanf (FILE * stream, char const *template, ...); int fseek (FILE * stream, long offset, int whence); int getc (FILE * stream); int getchar (void); char *getlogin (void); int printf (char const *format, ...); int putc (int c, FILE * stream); int putchar (int c); int puts (char const *s); int remove (char const *file_name); int setvbuf (FILE * stream, char *buf, int mode, size_t size); int snprintf (char *str, size_t size, char const *format, ...); int sprintf (char *str, char const *format, ...); int sscanf (char const *str, char const *format, ...); int ungetc (int c, FILE * stream); long ftell (FILE * stream); size_t fread (void *ptr, size_t size, size_t count, FILE * stream); size_t freadahead (FILE * fp); size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream); #endif // ! SYSTEM_LIBC #endif // __MES_STDIO_H mes-0.24.2/include/stdlib.h0000644000000000000000000000446414372371517012350 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDLIB_H #define __MES_STDLIB_H 1 #ifndef __MES_COMPARISON_FN_T #define __MES_COMPARISON_FN_T typedef int (*comparison_fn_t) (void const *, void const *); #endif #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_STDLIB_H #include_next #else // ! SYSTEM_LIBC #include #include void abort (void); double atof (char const *s); int atoi (char const *s); int atexit (void (*function) (void)); void *calloc (size_t nmemb, size_t size); void _exit (int status); void exit (int status); void free (void *ptr); char *getenv (char const *s); int setenv (char const *s, char const *v, int overwrite_p); void unsetenv (char const *name); void *malloc (size_t); void qsort (void *base, size_t nmemb, size_t size, int (*compar) (void const *, void const *)); int rand (void); void *realloc (void *p, size_t size); double strtod (char const *string, char **tailptr); float strtof (char const *string, char **tailptr); long double strtold (char const *string, char **tailptr); long strtol (char const *string, char **tailptr, int base); long long strtoll (char const *string, char **tailptr, int base); unsigned long strtoul (char const *string, char **tailptr, int base); unsigned long long strtoull (char const *string, char **tailptr, int base); #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 void *bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare); #endif // ! SYSTEM_LIBC #endif // __MES_STDLIB_H mes-0.24.2/include/stdnoreturn.h0000644000000000000000000000211114372371517013441 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STDNORETURN_H #define __MES_STDNORETURN_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_STDNORETURN_H #include_next #else // ! SYSTEM_LIBC // whut? #endif // ! SYSTEM_LIBC #endif // __MES_STDNORETURN_H mes-0.24.2/include/string.h0000644000000000000000000000402014372371517012361 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STRING_H #define __MES_STRING_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_STRING_H #include_next #else // ! SYSTEM_LIBC #include void *memchr (void const *block, int c, size_t size); void *memcpy (void *dest, void const *src, size_t n); void *memmove (void *dest, void const *src, size_t n); void *memset (void *s, int c, size_t n); void *memchr (void const *block, int c, size_t size); int memcmp (void const *s1, void const *s2, size_t n); void *memmem (void const *haystack, int haystack_len, void const *needle, int needle_len); char *strcat (char *dest, char const *src); char *strchr (char const *s, int c); int strcasecmp (char const *s1, char const *s2); int strcmp (char const *, char const *); char *strcpy (char *dest, char const *src); size_t strlen (char const *); char *strncpy (char *to, char const *from, size_t size); int strncmp (char const *, char const *, size_t); char *strrchr (char const *s, int c); char *strstr (char const *haystack, char const *needle); char *strlwr (char *string); char *strupr (char *string); char *strerror (int errnum); void perror (char const *message); #endif // ! SYSTEM_LIBC #endif // __MES_STRING_H mes-0.24.2/include/strings.h0000644000000000000000000000174514372371517012557 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_STRINGS_H #define __MES_STRINGS_H 1 #if SYSTEM_LIBC #undef __MES_STRINGS_H #include_next #endif // (SYSTEM_LIBC) #endif // __MES_STRINGS_H mes-0.24.2/include/sys/cdefs.h0000644000000000000000000000175714372371517012773 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_CDEFS_H #define __MES_SYS_CDEFS_H 1 #if SYSTEM_LIBC #undef __MES_SYS_CDEFS_H #include_next #endif // (SYSTEM_LIBC) #endif // __MES_SYS_CDEFS_H mes-0.24.2/include/sys/dir.h0000644000000000000000000000177714372371517012467 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_DIR_H #define __MES_SYS_DIR_H 1 #if SYSTEM_LIBC #undef __MES_SYS_DIR_H #include_next #else // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC #endif // __MES_SYS_DIR_H mes-0.24.2/include/sys/file.h0000644000000000000000000000200414372371517012610 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_FILE_H #define __MES_SYS_FILE_H 1 #if SYSTEM_LIBC #undef __MES_SYS_FILE_H #include_next #else // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC #endif // __MES_SYS_FILE_H mes-0.24.2/include/sys/ioctl.h0000644000000000000000000000223414372371517013010 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_IOCTL_H #define __MES_SYS_IOCTL_H 1 #if SYSTEM_LIBC #undef __MES_SYS_IOCTL_H #include_next #else // ! SYSTEM_LIBC #define TCGETS 0x5401 #define TCGETA 0x5405 int ioctl (int fd, unsigned long request, ...); int ioctl3 (int fd, unsigned long request, long data); #endif // ! SYSTEM_LIBC #endif // __MES_SYS_IOCTL_H mes-0.24.2/include/sys/mman.h0000644000000000000000000000232714372371517012631 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_MMAN_H #define __MES_SYS_MMAN_H 1 #if SYSTEM_LIBC #undef __MES_SYS_MMAN_H #include_next #else // ! SYSTEM_LIBC #ifndef __MES_SIZE_T #define __MES_SIZE_T typedef unsigned long size_t; #endif #define PROT_NONE 0 #define PROT_READ 1 #define PROT_WRITE 2 #define PROT_EXEC 4 int mprotect (void *addr, size_t len, int prot); #endif // ! SYSTEM_LIBC #endif // __MES_SYS_MMAN_H mes-0.24.2/include/sys/param.h0000644000000000000000000000201014372371517012766 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_PARAM_H #define __MES_SYS_PARAM_H 1 #if SYSTEM_LIBC #undef __MES_SYS_PARAM_H #include_next #else // ! SYSTEM_LIBC #endif // ! SYSTEM_LIBC #endif // __MES_SYS_PARAM_H mes-0.24.2/include/sys/resource.h0000644000000000000000000000311614372371517013525 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_RESOURCE_H #define __MES_SYS_RESOURCE_H 1 #if SYSTEM_LIBC #undef __MES_SYS_RESOURCE_H #include_next #else // ! SYSTEM_LIBC #include struct rusage { struct timeval ru_utime; struct timeval ru_stime; long int ru_maxrss; long int ru_ixrss; long int ru_idrss; long int ru_isrss; long int ru_minflt; long int ru_majflt; long int ru_nswap; long int ru_inblock; long int ru_oublock; long int ru_msgsnd; long int ru_msgrcv; long int ru_nsignals; long int ru_nvcsw; long int ru_nivcsw; }; #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN -1 #define RLIMIT_NOFILE 1024 #define OPEN_MAX RLIMIT_NOFILE int getrusage (int processes, struct rusage *rusage); #endif // ! SYSTEM_LIBC #endif // __MES_SYS_RESOURCE_H mes-0.24.2/include/sys/select.h0000644000000000000000000000203514372371517013154 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_SELECT_H #define __MES_SYS_SELECT_H 1 #if SYSTEM_LIBC #undef __MES_SYS_SELECT_H #include_next #else //! SYSTEM_LIBC typedef int fd_set; #endif //! SYSTEM_LIBC #endif // __MES_SYS_SELECT_H mes-0.24.2/include/sys/stat.h0000644000000000000000000000422114372371517012647 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * Copyright © 2022 Dor Askayo * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_STAT_H #define __MES_SYS_STAT_H 1 #if SYSTEM_LIBC #undef __MES_SYS_STAT_H #include_next #else // ! SYSTEM_LIBC #include #include #include #ifndef __MES_MODE_T #define __MES_MODE_T typedef int mode_t; #endif int chmod (char const *file_name, mode_t mode); int fstat (int filedes, struct stat *buf); int mkdir (char const *file_name, mode_t mode); int mknod (char const *file_name, mode_t mode, dev_t dev); int chown (char const *file_name, uid_t owner, gid_t group); int rmdir (char const *file_name); int stat (char const *file_name, struct stat *buf); #define S_IFIFO 0010000 #define S_IFCHR 0020000 #define S_IFDIR 0040000 #define S_IFBLK 0060000 #define S_IFREG 0100000 #define S_IFLNK 0120000 #define S_IFMT 0170000 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_IRWXU 00700 #define S_IXUSR 00100 #define S_IWUSR 00200 #define S_IRUSR 00400 #define S_ISUID 04000 #define S_ISGID 02000 #define S_IXGRP 00010 #define S_IXOTH 00001 #define S_IRGRP 00040 #define S_IROTH 00004 #define S_IWGRP 00020 #define S_IWOTH 00002 #define S_IRWXG 00070 #define S_IRWXO 00007 #endif // ! SYSTEM_LIBC #endif // __MES_SYS_STAT_H mes-0.24.2/include/sys/time.h0000644000000000000000000000263514372371517012641 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_TIME_H #define __MES_SYS_TIME_H 1 #if SYSTEM_LIBC #undef __MES_SYS_TIME_H #include_next #else // ! SYSTEM_LIBC struct timeval { long tv_sec; long tv_usec; }; struct timezone { int tz_minuteswest; int tz_dsttime; }; struct itimerval { struct timeval it_interval; struct timeval it_value; }; #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 int gettimeofday (struct timeval *tv, struct timezone *tz); int setitimer (int which, struct itimerval const *new, struct itimerval *old); #endif // ! SYSTEM_LIBC #endif // __MES_SYS_TIME_H mes-0.24.2/include/sys/timeb.h0000644000000000000000000000175714372371517013007 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_TIMEB_H #define __MES_SYS_TIMEB_H 1 #if SYSTEM_LIBC #undef __MES_SYS_TIMEB_H #include_next #endif // (SYSTEM_LIBC) #endif // __MES_SYS_TIMEB_H mes-0.24.2/include/sys/times.h0000644000000000000000000000245014372371517013017 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_TIMES_H #define __MES_SYS_TIMES_H 1 #if SYSTEM_LIBC #undef __MES_SYS_TIMES_H #include_next #else // ! SYSTEM_LIBC #ifndef __MES_CLOCK_T #define __MES_CLOCK_T #undef clock_t typedef long clock_t; #endif #ifndef CLOCKS_PER_SEC #define CLOCKS_PER_SEC 1000000 #endif #ifndef HZ #define HZ 100 #endif struct tms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; }; #endif // ! SYSTEM_LIBC #endif // __MES_SYS_TIMES_H mes-0.24.2/include/sys/types.h0000644000000000000000000000571514372371517013051 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_TYPES_H #define __MES_SYS_TYPES_H 1 #if SYSTEM_LIBC #undef __MES_SYS_TYPES_H #include_next #else // ! SYSTEM_LIBC #include #ifndef __MESCCLIB__ #define __MESCCLIB__ 15 #endif #ifndef EOF #define EOF -1 #endif #ifndef NULL #define NULL 0 #endif #ifndef __MES_CLOCK_T #define __MES_CLOCK_T #undef clock_t typedef long clock_t; #endif #ifndef __MES_DEV_T #define __MES_DEV_T #undef dev_t typedef long dev_t; #endif #if !defined (__MES_FILE_T) && ! defined (_FILE_T) #define __MES_FILE_T #define _FILE_T typedef long FILE; #endif #ifndef __MES_GID_T #define __MES_GID_T #undef gid_t typedef unsigned gid_t; #endif #ifndef __MES_INO_T #define __MES_INO_T #undef ino_t typedef unsigned long ino_t; #endif #if __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_INO64_T #define __MES_INO64_T #undef ino64_t typedef unsigned long long ino64_t; #endif #endif // __SIZEOF_LONG_LONG__ == 8 #if !defined (__MES_INTPTR_T) && !defined (__intptr_t_defined) #define __MES_INTPTR_T #define __intptr_t_defined #undef intptr_t typedef long intptr_t; #undef uintptr_t typedef unsigned long uintptr_t; #endif #ifndef __MES_OFF_T #define __MES_OFF_T #undef off_t typedef long off_t; #endif #if __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_OFF64_T #define __MES_OFF64_T #undef off64_t typedef unsigned long long off64_t; #endif #endif // __SIZEOF_LONG_LONG__ == 8 #ifndef __MES_PID_T #define __MES_PID_T #undef pid_t typedef int pid_t; #endif #ifndef __PTRDIFF_T #define __PTRDIFF_T #ifndef __MES_PTRDIFF_T #define __MES_PTRDIFF_T #undef ptrdiff_t typedef long ptrdiff_t; #endif #endif #ifndef __MES_SIGVAL_T #define __MES_SIGVAL_T #undef clock_t typedef long sigval_t; #endif #ifndef __SIZE_T #define __SIZE_T #ifndef __MES_SIZE_T #define __MES_SIZE_T #undef size_t typedef unsigned long size_t; #endif #endif #ifndef __MES_SSIZE_T #define __MES_SSIZE_T #undef ssize_t typedef long ssize_t; #endif #ifndef __MES_UID_T #define __MES_UID_T #undef uid_t typedef unsigned uid_t; #endif #ifndef __WCHAR_T #define __WCHAR_T #ifndef __MES_WCHAR_T #define __MES_WCHAR_T #undef wchar_t typedef int wchar_t; #endif #endif #endif // ! SYSTEM_LIBC #endif // __MES_SYS_TYPES_H mes-0.24.2/include/sys/ucontext.h0000644000000000000000000000177614372371517013561 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_UCONTEXT_H #define __MES_SYS_UCONTEXT_H 1 #if SYSTEM_LIBC #undef __MES_SYS_UCONTEXT_H #include_next #endif // (SYSTEM_LIBC) #endif // __MES_SYS_UCONTEXT_H mes-0.24.2/include/sys/user.h0000644000000000000000000000553214372371517012660 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_USER_H #define __MES_SYS_USER_H 1 #if SYSTEM_LIBC #undef __MES_SYS_USER_H #include_next #else // ! SYSTEM_LIBC /* These are the 32-bit x86 structures. */ struct user_fpregs_struct { long int cwd; long int swd; long int twd; long int fip; long int fcs; long int foo; long int fos; long int st_space[20]; }; struct user_fpxregs_struct { unsigned short int cwd; unsigned short int swd; unsigned short int twd; unsigned short int fop; long int fip; long int fcs; long int foo; long int fos; long int mxcsr; long int reserved; long int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ long int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ long int padding[56]; }; struct user_regs_struct { long int ebx; long int ecx; long int edx; long int esi; long int edi; long int ebp; long int eax; long int xds; long int xes; long int xfs; long int xgs; long int orig_eax; long int eip; long int xcs; long int eflags; long int esp; long int xss; }; // *INDENT-OFF* struct user { struct user_regs_struct regs; int u_fpvalid; struct user_fpregs_struct i387; unsigned long int u_tsize; unsigned long int u_dsize; unsigned long int u_ssize; unsigned long int start_code; unsigned long int start_stack; long int signal; int reserved; struct user_regs_struct *u_ar0; struct user_fpregs_struct *u_fpstate; unsigned long int magic; char u_comm [32]; int u_debugreg [8]; }; #define PAGE_SHIFT 12 #define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #define NBPG PAGE_SIZE #define UPAGES 1 #define HOST_TEXT_START_ADDR (u.start_code) #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) // *INDENT-ON* #endif // ! SYSTEM_LIBC #endif // __MES_SYS_USER_H mes-0.24.2/include/sys/wait.h0000644000000000000000000000237014372371517012643 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_SYS_WAIT_H #define __MES_SYS_WAIT_H 1 #if SYSTEM_LIBC #undef __MES_SYS_WAIT_H #include_next #else // ! SYSTEM_LIBC #ifndef __MES_PID_T #define __MES_PID_T typedef int pid_t; #endif #define WNOHANG 1 #define W_EXITCODE(status, signal) ((status) << 8 | (signal)) pid_t waitpid (pid_t pid, int *status_ptr, int options); pid_t wait (int *status_ptr); #endif // ! SYSTEM_LIBC #endif // __MES_SYS_WAIT_H mes-0.24.2/include/termio.h0000644000000000000000000000323714372371517012363 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_TERMIO_H #define __MES_TERMIO_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_TERMIO_H #include_next #else // ! SYSTEM_LIBC #define TIOCGWINSZ 0x5413 #define TCGETA 0x5405 #define TCSETAW 0x5407 #define VTIME 5 #define VMIN 6 #define ISIG 0000001 #define ICANON 0000002 #define ECHO 0000010 #define ECHOK 0000040 #define ECHONL 0000100 #define ISTRIP 0000040 #define INLCR 0000100 #define ICRNL 0000400 #define CS8 0000060 #define PARENB 0000400 struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; }; struct termio { unsigned short c_iflag; unsigned short c_oflag; unsigned short c_cflag; unsigned short c_lflag; unsigned char c_line; unsigned char c_cc[8]; }; #endif // ! SYSTEM_LIBC #endif // __MES_TERMIO_H mes-0.24.2/include/time.h0000644000000000000000000000332014372371517012013 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_TIME_H #define __MES_TIME_H 1 #if SYSTEM_LIBC #undef __MES_TIME_H #include_next #else // ! SYSTEM_LIBC #ifndef __MES_TIME_T #define __MES_TIME_T 1 typedef long int clockid_t; typedef long int time_t; #endif struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; #ifndef __MES_STRUCT_TIMESPEC #define __MES_STRUCT_TIMESPEC struct timespec { long tv_sec; long tv_nsec; }; #endif // __MES_STRUCT_TIMESPEC #define CLOCK_PROCESS_CPUTIME_ID 2 int clock_gettime (clockid_t clk_id, struct timespec *tp); struct tm *localtime (time_t const *timep); struct tm *gmtime (time_t const *time); time_t mktime (struct tm *broken_time); int nanosleep (struct timespec const *requested_time, struct timespec const *remaining); time_t time (time_t * tloc); #endif // ! SYSTEM_LIBC #endif // __MES_TIME_H mes-0.24.2/include/unistd.h0000644000000000000000000000533514372371517012373 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #ifndef __MES_UNISTD_H #define __MES_UNISTD_H 1 #if SYSTEM_LIBC #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #undef __MES_UNISTD_H #include_next #else // ! SYSTEM_LIBC #if defined (BOOTSTRAP_WITH_POSIX) #define _POSIX_VERSION 199009L #endif #include #ifndef NULL #define NULL 0 #endif #ifndef STDIN_FILENO #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 #endif // STDIN_FILENO #ifndef STDIN_FILE_NO #define STDIN_FILE_NO 0 #define STDOUT_FILE_NO 1 #define STDERR_FILE_NO 2 #endif // STDIN_FILE_NO #ifndef R_OK #define F_OK 0 #define X_OK 1 #define W_OK 2 #define R_OK 4 #endif int access (char const *s, int mode); unsigned int alarm (unsigned int seconds); int close (int fd); int execv (char const *file_name, char *const argv[]); int execl (char const *file_name, char const *arg, ...); int execlp (char const *file_name, char const *arg, ...); int execve (char const *file, char *const argv[], char *const env[]); int execvp (char const *file, char *const argv[]); int fork (void); int fsync (int filedes); char *getcwd (char *buf, size_t size); uid_t getuid (void); gid_t getgid (void); int setgid (gid_t newgid); int setuid (uid_t newuid); uid_t geteuid (void); gid_t getegid (void); pid_t getpgrp (void); pid_t getpid (void); pid_t getppid (void); int getpgid (pid_t pid); int isatty (int fd); int link (char const *old_name, char const *new_name); off_t lseek (int fd, off_t offset, int whence); ssize_t read (int fd, void *buffer, size_t size); ssize_t readlink (char const *file_name, char *buffer, size_t size); #if __SBRK_CHAR_PTRDIFF /* xmalloc in binutils <= 2.10.1 uses this old prototype */ char *sbrk (ptrdiff_t delta); #else void *sbrk (intptr_t delta); #endif int symlink (char const *old_name, char const *new_name); int unlink (char const *file_name); ssize_t write (int filedes, void const *buffer, size_t size); #endif // ! SYSTEM_LIBC #endif // __MES_UNISTD_H mes-0.24.2/kaem.run0000644000000000000000000001457514372371517010742 0ustar #! /bin/sh # Copyright © 2019,2020,2022 Jan (janneke) Nieuwenhuizen # # This file is part of GNU Mes. # # GNU Mes is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or (at # your option) any later version. # # GNU Mes is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mes. If not, see . # Usage: # kaem --verbose --strict mes_cpu=${mes_cpu:-x86} stage0_cpu=${stage0_cpu:-x86} mkdir -p m2 M2-Planet \ --bootstrap-mode \ --debug \ --architecture ${stage0_cpu} \ -f include/m2/lib.h \ -f lib/linux/${mes_cpu}-mes-m2/crt1.c \ -f lib/linux/${mes_cpu}-mes-m2/_exit.c \ -f lib/linux/${mes_cpu}-mes-m2/_write.c \ -f lib/mes/globals.c \ -f lib/m2/cast.c \ -f lib/m2/exit.c \ -f lib/mes/mini-write.c \ -f lib/linux/${mes_cpu}-mes-m2/syscall.c \ -f include/linux/${mes_cpu}/syscall.h \ -f lib/stub/__raise.c \ -f lib/linux/brk.c \ -f lib/m2/malloc.c \ -f lib/string/memset.c \ -f lib/m2/read.c \ -f lib/mes/fdgetc.c \ -f lib/stdio/getchar.c \ -f lib/stdio/putchar.c \ -f lib/m2/open.c \ -f lib/m2/mes_open.c \ -f lib/string/strlen.c \ -f lib/mes/eputs.c \ -f lib/mes/fdputc.c \ -f lib/mes/eputc.c \ \ -f include/m2/types.h \ -f include/mes/mes.h \ -f include/mes/builtins.h \ -f include/mes/constants.h \ -f include/mes/symbols.h \ \ -f lib/mes/__assert_fail.c \ -f lib/mes/assert_msg.c \ \ -f lib/mes/fdputc.c \ -f lib/string/strncmp.c \ -f lib/posix/getenv.c \ -f lib/mes/fdputs.c \ -f lib/mes/ntoab.c \ -f lib/ctype/isdigit.c \ -f lib/ctype/isxdigit.c \ -f lib/ctype/isspace.c \ -f lib/ctype/isnumber.c \ -f lib/mes/abtol.c \ -f lib/stdlib/atoi.c \ -f lib/string/memcpy.c \ -f lib/stdlib/free.c \ -f lib/stdlib/realloc.c \ -f lib/string/strcpy.c \ -f lib/mes/itoa.c \ -f lib/mes/ltoa.c \ -f lib/mes/fdungetc.c \ -f lib/posix/setenv.c \ -f lib/linux/access.c \ -f include/linux/m2/kernel-stat.h \ -f include/sys/stat.h \ -f lib/m2/chmod.c \ -f lib/linux/ioctl3.c \ -f lib/m2/isatty.c \ -f lib/linux/fork.c \ -f lib/m2/execve.c \ -f lib/m2/execv.c \ -f lib/m2/waitpid.c \ -f lib/linux/gettimeofday.c \ -f lib/m2/clock_gettime.c \ -f lib/m2/time.c \ -f lib/linux/_getcwd.c \ -f lib/m2/getcwd.c \ -f lib/linux/dup.c \ -f lib/linux/dup2.c \ -f lib/string/strcmp.c \ -f lib/string/memcmp.c \ -f lib/linux/unlink.c \ -f src/builtins.c \ -f src/core.c \ -f src/display.c \ -f src/eval-apply.c \ -f src/gc.c \ -f src/hash.c \ -f src/lib.c \ -f src/m2.c \ -f src/math.c \ -f src/mes.c \ -f src/module.c \ -f src/posix.c \ -f src/reader.c \ -f src/stack.c \ -f src/string.c \ -f src/struct.c \ -f src/symbol.c \ -f src/vector.c \ -o m2/mes.M1 blood-elf --little-endian -f m2/mes.M1 -o m2/mes.blood-elf-M1 M1 \ --architecture ${stage0_cpu} \ --little-endian \ -f lib/m2/${mes_cpu}/${mes_cpu}_defs.M1 \ -f lib/${mes_cpu}-mes/${mes_cpu}.M1 \ -f lib/linux/${mes_cpu}-mes-m2/crt1.M1 \ -f m2/mes.M1 \ -f m2/mes.blood-elf-M1 \ -o m2/mes.hex2 mkdir -p bin hex2 \ --architecture ${stage0_cpu} \ --little-endian \ --base-address 0x1000000 \ -f lib/m2/${mes_cpu}/ELF-${mes_cpu}.hex2 \ -f m2/mes.hex2 \ -o bin/mes-m2 echo Running mes-m2 ./bin/mes-m2 -c "(display 'Hello,M2-mes!) (newline)" cp bin/mes-m2 bin/mes mes-0.24.2/lib/arm-mes-gcc/setjmp.c0000644000000000000000000001220714372371517013574 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen * Copyright © 2019,2020 Danny Milosavljevic * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include #include #ifndef HAVE_FLOAT #define HAVE_FLOAT 0 #endif #if !__TINYC__ void __attribute__ ((noinline)) longjmp (jmp_buf env, int val) { // *INDENT-OFF* asm ( "mov r0, %0\n\t" "mov r1, %1\n\t" "cmp r1, #0\n\t" "moveq r1, #1\n\t" /* returning 0 is not allowed, even when the user wanted to. */ "ldr r13, [r0], #4\n\t" /* stack pointer (sp) */ "ldr r14, [r0], #4\n\t" /* link register (lr) */ "ldmia r0!, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" #if HAVE_FLOAT // TODO: If using VFP, vldmia r0!, {d8-d15} #endif "mov r0, r1\n\t" : : "r" (env), "r" (val)); // *INDENT-ON* // not reached } #else //__TINYC__ #ifndef SETJMP_ASM #define SETJMP_ASM 0 #endif #if SETJMP_ASM __asm__ (".global longjmp\n"); __asm__ ("longjmp:\n"); __asm__ (".int 0xe52db004\n"); //push {fp} ; (str fp, [sp, #-4]!) __asm__ (".int 0xe28db000\n"); //add fp, sp, #0 __asm__ (".int 0xe24dd00c\n"); //sub sp, sp, #12 __asm__ (".int 0xe50b0008\n"); //str r0, [fp, #-8] __asm__ (".int 0xe50b100c\n"); //str r1, [fp, #-12] __asm__ (".int 0xe51b3008\n"); //ldr r3, [fp, #-8] __asm__ (".int 0xe51b200c\n"); //ldr r2, [fp, #-12] __asm__ (".int 0xe1a00003\n"); //mov r0, r3 __asm__ (".int 0xe1a01002\n"); //mov r1, r2 __asm__ (".int 0xe3510000\n"); //cmp r1, #0 __asm__ (".int 0x03a01001\n"); //moveq r1, #1 __asm__ (".int 0xe490d004\n"); //ldr sp, [r0], #4 __asm__ (".int 0xe490e004\n"); //ldr lr, [r0], #4 __asm__ (".int 0xe8b00ff0\n"); //ldm r0!, {r4, r5, r6, r7, r8, r9, sl, fp} #if HAVE_FLOAT // TODO: If using VFP, vldmia r0!, {d8-d15} #endif __asm__ (".int 0xe1a00001\n"); //mov r0, r1 __asm__ (".int 0xe12fff1e\n"); //bx lr #else //!SETJMP_ASM void __attribute__ ((noinline)) longjmp (jmp_buf env, int val) { __asm__ (".int 0xe3510000\n"); //cmp r1, #0 __asm__ (".int 0x03a01001\n"); //moveq r1, #1 __asm__ (".int 0xe490d004\n"); //ldr sp, [r0], #4 __asm__ (".int 0xe490e004\n"); //ldr lr, [r0], #4 __asm__ (".int 0xe8b00ff0\n"); //ldm r0!, {r4, r5, r6, r7, r8, r9, sl, fp} #if HAVE_FLOAT // TODO: If using VFP, vldmia r0!, {d8-d15} #endif __asm__ (".int 0xe1a00001\n"); //mov r0, r1 __asm__ (".int 0xe12fff1e\n"); //bx lr } #endif //!SETJMP_ASM #endif //__TINYC__ #if !__TINYC__ int __attribute__ ((noinline)) setjmp (jmp_buf env) { // *INDENT-OFF* asm ( "mov r0, %0\n\t" "str r13, [r0], #4\n\t" /* stack pointer (sp) */ "str r14, [r0], #4\n\t" /* link register (lr) */ "stmia r0!, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" #if HAVE_FLOAT // TODO: If using VFP, vstmia r0!, {d8-d15} #endif : : "r" (env) : "r0"); // *INDENT-ON* return 0; } #else //__TINYC__ #if SETJMP_ASM __asm__ (".global setjmp\n"); __asm__ ("setjmp:\n"); __asm__ (".int 0xe52db004\n"); //push {fp} ; (str fp, [sp, #-4]!) __asm__ (".int 0xe28db000\n"); //add fp, sp, #0 __asm__ (".int 0xe24dd00c\n"); //sub sp, sp, #12 __asm__ (".int 0xe50b0008\n"); //str r0, [fp, #-8] __asm__ (".int 0xe51b3008\n"); //ldr r3, [fp, #-8] __asm__ (".int 0xe1a00003\n"); //mov r0, r3 __asm__ (".int 0xe480d004\n"); //str sp, [r0], #4 __asm__ (".int 0xe480e004\n"); //str lr, [r0], #4 __asm__ (".int 0xe28bd000\n"); //add sp, fp, #0 __asm__ (".int 0xe49db004\n"); //pop {fp} ; (ldr fp, [sp], #4) __asm__ (".int 0xe8a00ff0\n"); //stmia r0!, {r4, r5, r6, r7, r8, r9, sl, fp} #if HAVE_FLOAT // TODO: If using VFP, vstmia r0!, {d8-d15} #endif __asm__ (".int 0xe1a0b00d\n"); //mov fp, sp __asm__ (".int 0xe3a03000\n"); //mov r3, #0 __asm__ (".int 0xe1a00003\n"); //mov r0, r3 __asm__ (".int 0xe12fff1e\n"); //bx lr #else //!SETJMP_ASM int __attribute__ ((noinline)) setjmp (jmp_buf env) { __asm__ (".int 0xe480d004\n"); //str sp, [r0], #4 __asm__ (".int 0xe480e004\n"); //str lr, [r0], #4 //__asm__ (".int 0xe1a0300b\n"); //mov r3, fp __asm__ (".int 0xe59bb000\n"); //ldr fp, [fp] __asm__ (".int 0xe8a00ff0\n"); //stmia r0!, {r4, r5, r6, r7, r8, r9, sl, fp} #if HAVE_FLOAT // TODO: If using VFP, vstmia r0!, {d8-d15} #endif __asm__ (".int 0xe1a0b00d\n"); //mov fp, sp //__asm__ (".int 0xe1a0b003\n"); //mov fp, r3 __asm__ (".int 0xe3a00000\n"); // mov r0, #0 } #endif //!SETJMP_ASM #endif //__TINYC__ mes-0.24.2/lib/arm-mes-mescc/setjmp.c0000644000000000000000000000405614372371517014135 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * Copyright © 2020 Danny Milosavljevic * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include #include void longjmp (jmp_buf env, int val) { val = val == 0 ? 1 : val; asm ("!0xc ldr____%r0,(%fp,+#$i8)"); // val asm ("!0x8 ldr____%fp,(%fp,+#$i8)"); // env asm ("!0x8 ldr____%sp,(%fp,+#$i8)"); // env.__sp /* setjmp's ENV argument is missing in setjmp caller's frame. Re-add it. */ asm ("pop____%lr"); // junk asm ("push___%ebp"); asm ("!0x4 ldr____%lr,(%fp,+#$i8)"); // env.__lr asm ("!0x0 ldr____%fp,(%fp,+#$i8)"); // env.__fp asm ("push___%lr"); /* Avoid function epilogue */ asm ("ret"); } int setjmp (__jmp_buf * env) { /* Function prelude emitter emits: push %lr; push %fp; %fp := %sp */ long *p = (long*)&env; // location of parameter on stack env[0].__fp = p[-2]; // frame of caller of setjmp env[0].__lr = p[-1]; // caller of setjmp env[0].__sp = p; // stack of caller of setjmp (location of ENV value) /* Function epilogue emitter emits: %sp := %fp; pop %fp; pop %lr; %pc := %lr. That means that all of the setjmp state is gone after we return from setjmp. Once we enter longjmp, we can't use setjmp state and have to reconstruct the state of setjmp's call site instead. */ return 0; } mes-0.24.2/lib/arm-mes/arm.M10000644000000000000000000003410714372371517012355 0ustar ### GNU Mes --- Maxwell Equations of Software ### Copyright © 2017,2018,2020,2022 Jan (janneke) Nieuwenhuizen ### Copyright © 2019,2020 Danny Milosavljevic ### ### This file is part of GNU Mes. ### ### Mes is free software# you can redistribute it and/or modify it ### under the terms of the GNU General Public License as published by ### the Free Software Foundation# either version 3 of the License, or (at ### your option) any later version. ### ### GNU Mes is distributed in the hope that it will be useful, but ### WITHOUT ANY WARRANTY# without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with GNU Mes. If not, see . # Note: r9 is used as scratch register and is assumed to not contain anything important! # reduced instruction set: r0, r1 (some r2 for shift, r3 for mul) # The "e" in most opcodes near the end means "always". # 020090e0 # adds r0, r0, r2; ADDS = '0' op3 op1 '09' op2 'e0' # 030091e0 # adds r0, r1, r3 # 031091e0 # adds r1, r1, r3 # 030090e0 # adds r0, r0, r3 DEFINE add____$i8,%r0 0090e2 # adds r0, r0, #xx; ADDSI = immediate op1 '09' op2 'e2' # 0091e2 # adds r0, r1, #xx; ADDSI = immediate op1 '09' op2 'e2' # 1090e2 # adds r1, r0, #xx; ADDSI = immediate op1 '09' op2 'e2' DEFINE add____$i8,%r1 1091e2 # adds r1, r1, #xx DEFINE add____$i8,%r13 d09de2 # adds r13, r13, #xx DEFINE sub____$i8,%r0 0050e2 # subs r0, r0, #xx DEFINE sub____$i8,%r1 1051e2 # subs r1, r1, #xx DEFINE add____%r0,%r0 000090e0 # adds r0, r0, r0 DEFINE add____%r0,%r1 001091e0 # adds r1, r1, r0 DEFINE add____%r1,%r0 010090e0 # adds r0, r0, r1 DEFINE add____%r1,%r1 011091e0 # adds r1, r1, r1 DEFINE and____%r1,%r0 010010e0 # ands r0, r0, r1 DEFINE and____$i8,%r0 0000e2 DEFINE and____$i8,%r1 1001e2 DEFINE call___*%r0 30ff2fe1 DEFINE call___*%r1 31ff2fe1 DEFINE cmp____$i8,%r0 0050e3 DEFINE cmp____$i8,%r1 0051e3 DEFINE cmn____$i8,%r0 0070e3 DEFINE cmn____$i8,%r1 0071e3 # e59f9004 ldr r9, [pc, #4] # e1500009 cmp r0, r9 # ea000000 b 10064 # dd 0 # Q: DEFINE cmp____$i32,%r0 04909fe5090050e1000000ea DEFINE cmp____$i32,%r1 04909fe5090051e1000000ea DEFINE cmp____$i32,%r2 04909fe5090052e1000000ea DEFINE swi____$0 000000ef DEFINE ja 8a DEFINE jae 3a DEFINE jb 2a DEFINE jbe 9a DEFINE je 0a DEFINE jg ca DEFINE jge aa DEFINE jl ba DEFINE jle da DEFINE jne 1a # e3a00064 mov r0, #100 # e3a01064 mov r1, #100 # e3a02064 mov r2, #100 # 0: e3047215 movw r7, #16917 ; 0x4215 # OK: DEFINE mov____$i8,%r0 00a0e3 DEFINE mov____$i8,%r1 10a0e3 DEFINE mov____$i8,%r7 70a0e3 DEFINE mvn____%r0,$i8 00e0e3 DEFINE mvn____%r1,$i8 10e0e3 DEFINE mvn____%r7,$i8 70e0e3 DEFINE mov____%r0,%r1 0010a0e1 DEFINE mov____%r0,%r2 0020a0e1 DEFINE mov____%fp,%r1 0b10a0e1 DEFINE mov____%fp,%r2 0b20a0e1 DEFINE mov____%r0,(%r1) 000081e5 DEFINE mov____%r1,%r0 0100a0e1 DEFINE mov____%r1,%r2 0120a0e1 DEFINE mov____%esp,%r0 0d00a0e1 DEFINE mov____%esp,%r3 0d30a0e1 # e59f9004 ldr r9, [pc, #4] ; # e5890000 str r0, [r9] # ea000000 b L2 # L1: ??? # L2: DEFINE mov____%r0,0x32 04909fe5000089e5000000ea DEFINE mov____%r1,0x32 04909fe5001089e5000000ea DEFINE mov____%r2,0x32 04909fe5002089e5000000ea # e92d0005 push {r0, r2} # e5910000 ldr r0, [r1] # e59f200c ldr r2, [pc, #12] ; 1c # e0800002 add r0, r0, r2 # e5810000 str r0, [r1] # e8bd0005 pop {r0, r2} # ea000000 b 20 # X2: ??? # Y2: DEFINE add____$i32,(%r1) 05002de9000091e50c209fe5020080e0000081e50500bde8000000ea # e59f0000 ldr r0, [pc] # ea000000 b c # nop # R: DEFINE mov____$i32,%r0 00009fe5000000ea DEFINE mov____$i32,%r1 00109fe5000000ea DEFINE mov____$i32,%r2 00209fe5000000ea DEFINE mov____$i32,%r7 00709fe5000000ea DEFINE mov____%r2,(%r1) 002081e5 DEFINE mov____%r3,%r0 0300a0e1 DEFINE mov____%r3,%r1 0e10a0e1 DEFINE mov____(%r0),%r0 000090e5 DEFINE mov____(%r0),%r2 002090e5 DEFINE mov____(%r1),%r1 001091e5 DEFINE nop 0000a0e1 DEFINE not____%r0 0000e0e1 DEFINE not____%r1 0110e0e1 DEFINE or_____%r1,%r0 010090e1 # orrs r0, r0, r1 DEFINE pop____%r0 04009de4 DEFINE pop____%r1 04109de4 DEFINE pop____%r3 04309de4 DEFINE pop____%lr 04e09de4 # e59f9004 ldr r9, [pc, #4] ; c # e52d9004 push {r9} ; (str r9, [sp, #-4]!) # ea000000 b 10 # L1x: data # L1y: DEFINE push___$i32 04909fe504902de5000000ea DEFINE push___%r0 04002de5 # str r0, [sp, #-4]! DEFINE push___%r1 04102de5 # str r1, [sp, #-4]! DEFINE push___%r2 04202de5 # str r2, [sp, #-4]! DEFINE push___%r3 04302de5 # str r3, [sp, #-4]! DEFINE push___%lr 04e02de5 # str lr, [sp, #-4]! DEFINE sub____%r1,%r0 010050e0 # subs r0, r0, r1 DEFINE test___%r0,%r0 000010e1 DEFINE test___%r1,%r1 010011e1 DEFINE xor____$i8,%r0 0030e2 # eors r0, r0, #xx DEFINE xor____%r0,%r0 000030e0 # eors r0, r0, r0 DEFINE xor____%r1,%r0 010030e0 # eors r0, r0, r1 DEFINE xor____%r1,%r1 011031e0 # eors r1, r1, r1 DEFINE xor____%r3,%r3 033033e0 # eors r3, r3, r3 # Note: These are the native ARM instructions. # Note: i8 immediate DEFINE ldr____%r0,(%fp,+#$i8) 009be5 DEFINE ldr____%r1,(%fp,+#$i8) 109be5 DEFINE ldr____%r2,(%fp,+#$i8) 209be5 DEFINE ldr____%r3,(%fp,+#$i8) 309be5 DEFINE ldr____%r4,(%fp,+#$i8) 409be5 DEFINE ldr____%r5,(%fp,+#$i8) 509be5 DEFINE ldr____%r7,(%fp,+#$i8) 709be5 DEFINE ldr____%fp,(%fp,+#$i8) b09be5 DEFINE ldr____%sp,(%fp,+#$i8) d09be5 DEFINE ldr____%lr,(%fp,+#$i8) e09be5 DEFINE ldr____%r0,(%fp,-#$i8) 001be5 DEFINE ldr____%r1,(%fp,-#$i8) 101be5 DEFINE ldr____%r2,(%fp,-#$i8) 201be5 DEFINE ldr____%r3,(%fp,-#$i8) 301be5 DEFINE ldr____%r4,(%fp,-#$i8) 401be5 DEFINE ldr____%r5,(%fp,-#$i8) 501be5 DEFINE ldr____%r7,(%fp,-#$i8) 701be5 DEFINE ldr____%fp,(%fp,-#$i8) b01be5 DEFINE ldr____%sp,(%fp,-#$i8) d01be5 DEFINE ldr____%lr,(%fp,-#$i8) e01be5 DEFINE str____%r0,(%fp,+#$i8) 008be5 DEFINE str____%r1,(%fp,+#$i8) 108be5 DEFINE str____%r2,(%fp,+#$i8) 208be5 DEFINE str____%r3,(%fp,+#$i8) 308be5 DEFINE str____%r4,(%fp,+#$i8) 408be5 DEFINE str____%r5,(%fp,+#$i8) 508be5 DEFINE str____%r7,(%fp,+#$i8) 708be5 DEFINE str____%fp,(%fp,+#$i8) b08be5 DEFINE str____%sp,(%fp,+#$i8) d08be5 DEFINE str____%lr,(%fp,+#$i8) e08be5 DEFINE str____%r0,(%fp,-#$i8) 000be5 DEFINE str____%r1,(%fp,-#$i8) 100be5 DEFINE str____%r2,(%fp,-#$i8) 200be5 DEFINE str____%r3,(%fp,-#$i8) 300be5 DEFINE str____%r4,(%fp,-#$i8) 400be5 DEFINE str____%r5,(%fp,-#$i8) 500be5 DEFINE str____%r7,(%fp,-#$i8) 700be5 DEFINE str____%fp,(%fp,-#$i8) b00be5 DEFINE str____%sp,(%fp,-#$i8) d00be5 DEFINE str____%lr,(%fp,-#$i8) e00be5 # Note: Loads INTO register r0 (ARM original operand order) DEFINE ldrsb__%r0,(%r0) d000d0e1 # ldrsb r0, [r0] DEFINE ldrsb__%r0,(%r1) d000d1e1 # ldrsb r0, [r1] DEFINE ldrsb__%r1,(%r1) d010d1e1 # ldrsb r1, [r1] DEFINE ldrsb__%r2,(%r2) d020d2e1 # ldrsb r2, [r2] DEFINE ldrsb__%r3,(%r3) d030d3e1 # ldrsb r3, [r3] DEFINE ldrsb__%r4,(%r4) d040d4e1 # ldrsb r4, [r4] DEFINE ldrsb__%r5,(%r5) d050d5e1 # ldrsb r5, [r5] DEFINE ldrsh__%r0,(%r0) f000d0e1 # ldrsh r0, [r0] DEFINE ldrsh__%r0,(%r1) f000d1e1 # ldrsh r0, [r1] DEFINE ldrsh__%r1,(%r1) f010d1e1 # ldrsh r1, [r1] DEFINE ldrsh__%r2,(%r2) f020d2e1 # ldrsh r2, [r2] DEFINE ldrsh__%r3,(%r3) f030d3e1 # ldrsh r3, [r3] DEFINE strb___%r0,(%r0) 0000c0e5 # strb r0, [r0] DEFINE strb___%r0,(%r1) 0000c1e5 # strb r0, [r1] DEFINE strb___%r1,(%r1) 0010c1e5 # strb r1, [r1] DEFINE strb___%r2,(%r2) 0020c2e5 # strb r2, [r2] DEFINE strb___%r3,(%r3) 0030c3e5 # strb r3, [r3] DEFINE strb___%r4,(%r4) 0040c4e5 # strb r4, [r4] DEFINE strb___%r0,(%fp,+#$i8) 00cbe5 # strb r0, [fp, +#xx] DEFINE strb___%r0,(%fp,-#$i8) 004be5 # strb r0, [fp, -#xx] DEFINE strh___%r0,(%r0) b000c0e1 # strh r0, [r0] DEFINE strh___%r0,(%r1) b000c1e1 # strh r0, [r1] DEFINE strh___%r1,(%r1) b010c1e1 # strh r1, [r1] DEFINE strh___%r2,(%r2) b020c2e1 # strh r2, [r2] DEFINE strh___%r3,(%r3) b030c3e1 # strh r3, [r3] DEFINE strh___%r4,(%r4) b040c4e1 # strh r4, [r4] # tcc DEFINE ldrsb__%r2,(%r0) d020d0e1 # ldrsb r2, [r0] DEFINE strh___%r2,(%r1) b020c1e1 # strh r2, [r1] DEFINE strb___%r2,(%r1) 0020c1e5 # strb r2, [r1] # There's a single instruction that does it--but I don't know how to encode it. # mov %r9, immediate # add %r9, %r9, %fp # strh %r0, [%r9] DEFINE strh___%r0,(%fp,+#$i8) 90a0e30b9089e0b000c9e1 # There's a single instruction that does it--but I don't know how to encode it. # e3a090xx mov %r9, immediate # e05b9009 sub %r9, %fp, %r9 # e1c900b0 strh %r0, [%r9] DEFINE strh___%r0,(%fp,-#$i8) 90a0e309904be0b000c9e1 DEFINE movle__%r0,$i8 00a0d3 # movle r0, #xx DEFINE movlt__%r0,$i8 00a0b3 # movlt r0, #xx DEFINE movge__%r0,$i8 00a0a3 # movge r0, #xx DEFINE movgt__%r0,$i8 00a0c3 # movgt r0, #xx DEFINE movcs__%r0,$i8 00a023 # movcs r0, #xx DEFINE movcc__%r0,$i8 00a033 # movcc r0, #xx DEFINE movhi__%r0,$i8 00a083 # movhi r0, #xx DEFINE moveq__%r0,$i8 00a003 # moveq r0, #xx DEFINE movle__%r1,$i8 10a0d3 # movle r1, #xx DEFINE movlt__%r1,$i8 10a0b3 # movlt r1, #xx DEFINE movge__%r1,$i8 10a0a3 # movge r1, #xx DEFINE movgt__%r1,$i8 10a0c3 # movgt r1, #xx DEFINE movcs__%r1,$i8 10a023 # movcs r1, #xx DEFINE movcc__%r1,$i8 10a033 # movcc r1, #xx DEFINE movhi__%r1,$i8 10a083 # movhi r1, #xx DEFINE moveq__%r1,$i8 10a003 # moveq r1, #xx DEFINE asr____%r0,%r0,%r1 5001a0e1 # asr %r0, %r0, %r1 DEFINE lsl____%r0,%r0,%r1 1001a0e1 # lsl %r0, %r0, %r1 DEFINE lsl____%r0,%r0,$i8 90a0e31009a0e1 # mov r9, #xx; lsl %r0, %r0, %r9 DEFINE lsl____%r1,%r1,$i8 90a0e31119a0e1 # mov r9, #xx; lsl %r1, %r1, %r9 DEFINE lsr____%r0,%r0,%r1 3001a0e1 # lsr %r0, %r0, %r1 DEFINE ldr____%r0,(%sp,#$i8) 009de5 # ldr r0, [r13+xx] DEFINE ldr____%r1,(%sp,#$i8) 109de5 # ldr r1, [r13+xx] #DEFINE add____%r2,%r0,%r1,lsl#4 012280e0 # Without carry DEFINE add____%r2,%r0,%r1,lsl#2 012180e0 DEFINE add____%r2,%r1,%r0,lsl#2 002181e0 DEFINE add____%r1,$i8 1081e2 DEFINE add____%r2,$i8 2082e2 DEFINE bl eb DEFINE b ea DEFINE sxtb__%r0,%r0 7000afe6 DEFINE sxtb__%r1,%r1 7110afe6 DEFINE sxth__%r0,%r0 7000bfe6 DEFINE sxth__%r1,%r1 7110bfe6 DEFINE uxtb__%r0,%r0 7000efe6 DEFINE uxtb__%r1,%r1 7110efe6 DEFINE uxth__%r0,%r0 7000ffe6 DEFINE uxth__%r1,%r1 7110ffe6 # See: https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl DEFINE SYS_exit 01 DEFINE SYS_fork 02 DEFINE SYS_read 03 DEFINE SYS_write 04 DEFINE SYS_open 05 DEFINE SYS_close 06 # DEFINE SYS_waitpid does_not_exist DEFINE SYS_rmdir 28 DEFINE SYS_wait4 72 # waitid: 0x118 DEFINE SYS_unlink 0a DEFINE SYS_execve 0b DEFINE SYS_chmod 0f DEFINE SYS_lseek 13 DEFINE SYS_access 21 DEFINE SYS_brk 2d DEFINE SYS_ioctl 36 DEFINE SYS_stat 6a DEFINE SYS_fsync 76 DEFINE SYS_getcwd b7 # These are x86 ABI remnants: DEFINE mul____%r1,%r0 910089e0 # umull r0, r9, r1, r0 DEFINE mul____%r0,%r1 910089e0 # umull r0, r9, r1, r0 DEFINE mov____%ebp,%r0 0b00a0e1 DEFINE mov____%ebp,%r1 0b10a0e1 DEFINE push___%ebp 04b02de5 # str fp, [sp, #-4]! DEFINE pop____%ebp 04b09de4 # ldr fp, [sp], #4 DEFINE mov____%esp,%ebp 0db0a0e1 # mov fp, sp DEFINE mov____%ebp,%esp 0bd0a0e1 # mov sp, fp DEFINE sub____$i8,%esp d04de2 # sub sp, sp, #xx DEFINE jmp____*%r1 11ff2fe1 # e59f9008 ldr r9, [pc, #8] ; 10 # e089900b add r9, r9, fp # e5890000 str r0, [r9] # ea000000 b 14 # 00000010 : data # 00000014 : DEFINE mov____%r0,0x32(%ebp) 08909fe50b9089e0000089e5000000ea DEFINE mov____%r1,0x32(%ebp) 08909fe50b9089e0001089e5000000ea DEFINE mov____%r2,0x32(%ebp) 08909fe50b9089e0002089e5000000ea # e59f9004 ldr r9, [pc, #4] ; c # e5990000 ldr r0, [r9] # ea000000 b 10 DEFINE mov____0x32,%r0 04909fe5000099e5000000ea DEFINE mov____0x32,%r1 04909fe5001099e5000000ea DEFINE mov____0x32,%r2 04909fe5002099e5000000ea # e1a09000 mov r9, r0 # e1a00001 mov r0, r1 # e1a01009 mov r1, r9 DEFINE xchg___%r0,%r1 0090a0e10100a0e10910a0e1 # e49de004 pop {lr} ; (ldr lr, [sp], #4) # e1a0f00e mov pc, lr DEFINE ret 04e09de40ef0a0e1 # The flags are also updated, but that's probably useless. DEFINE add____$i8,%esp d09de2 # e24ddeff sub sp, sp, #4080 # e24dd064 sub sp, sp, #100 DEFINE allocate_stack_4180 ffde4de264d04de2 DEFINE mov____0x32(%ebp),%r0 08909fe50b9089e0000099e5000000ea # e59f9008 ldr r9, [pc, #8] # e089900b add r9, r9, fp # e5991000 ldr r1, [r9] # ea000000 b 20 # V: ... # VD: DEFINE mov____0x32(%ebp),%r1 08909fe50b9089e0001099e5000000ea # e1a09000 mov r9, r0 # e59d0000 ldr r0, [sp] # e58d9000 str r9, [sp] DEFINE xchg___%r0,(%esp) 0090a0e100009de500908de5 # e52d1004 push {r1} ; (str r1, [sp, #-4]!) # e59f1010 ldr r1, [pc, #16] ; 1c # e5909000 ldr r9, [r0] # e0999001 adds r9, r9, r1 # e5809000 str r9, [r0] # e49d1004 pop {r1} ; (ldr r1, [sp], #4) # ea000000 b 20 # V: ... # VD: DEFINE add____$i32,(%r0) 04102de510109fe5009090e5019099e0009080e504109de4000000ea # mov %r9, #00 # push {%r9} DEFINE push___0 0090a0e304902de5 DEFINE add____$i32,%r0 04909fe5090090e0000000ea # e59f9004 ldr r9, [pc, #4] ; c # e0911009 adds r1, r1, r9 # ea000000 b 10 # VALUE: DEFINE add____$i32,%r1 04909fe5091091e0000000ea DEFINE add____$i32,%r2 04909fe5092092e0000000ea # e59f9008 ldr r9, [pc, #8] ; 10 # e089900b add r9, r9, fp # e5c90000 strb r0, [r9] # ea000000 b 14 # WERT: nop # WERTD: DEFINE strb___%r0,0x32(%ebp) 08909fe50b9089e00000c9e5000000ea DEFINE wfi 03f020e3 mes-0.24.2/lib/ctype/isalnum.c0000644000000000000000000000162014372371517012770 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isalnum (int c) { return isdigit (c) || isalpha (c); } mes-0.24.2/lib/ctype/isalpha.c0000644000000000000000000000162014372371517012741 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isalpha (int c) { return islower (c) || isupper (c); } mes-0.24.2/lib/ctype/isascii.c0000644000000000000000000000161014372371517012743 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isascii (int c) { return c >= 0 && c <= 127; } mes-0.24.2/lib/ctype/iscntrl.c0000644000000000000000000000160614372371517013002 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int iscntrl (int c) { return c >= 0 && c < 32; } mes-0.24.2/lib/ctype/isdigit.c0000644000000000000000000000171414372371517012760 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen * Copyright © 2023 Rick Masters * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isdigit (int c) { return c >= '0' && c <= '9'; } mes-0.24.2/lib/ctype/isgraph.c0000644000000000000000000000160714372371517012762 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isgraph (int c) { return c > 32 && c < 127; } mes-0.24.2/lib/ctype/islower.c0000644000000000000000000000161714372371517013012 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int islower (int c) { return c >= 'a' && c <= 'z'; } mes-0.24.2/lib/ctype/isnumber.c0000644000000000000000000000210114372371517013137 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isnumber (int c, int base) { if (base == 2) return (c >= '0') && (c <= '1'); if (base == 8) return (c >= '0') && (c <= '7'); if (base == 10) return isdigit (c); if (base == 16) return isxdigit (c); } mes-0.24.2/lib/ctype/isprint.c0000644000000000000000000000161014372371517013007 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isprint (int c) { return c >= 32 && c < 127; } mes-0.24.2/lib/ctype/ispunct.c0000644000000000000000000000164114372371517013010 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int ispunct (int c) { return isprint (c) && !isspace (c) && !isalnum (c); } mes-0.24.2/lib/ctype/isspace.c0000644000000000000000000000171514372371517012754 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isspace (int c) { return (c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r' || c == ' '); } mes-0.24.2/lib/ctype/isupper.c0000644000000000000000000000161714372371517013015 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int isupper (int c) { return c >= 'A' && c <= 'Z'; } mes-0.24.2/lib/ctype/isxdigit.c0000644000000000000000000000173214372371517013150 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include #include int isxdigit (int c) { return isdigit (c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } mes-0.24.2/lib/ctype/tolower.c0000644000000000000000000000165314372371517013021 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int tolower (int c) { if (isupper (c)) return c + ('a' - 'A'); return c; } mes-0.24.2/lib/ctype/toupper.c0000644000000000000000000000165314372371517013024 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include int toupper (int c) { if (islower (c)) return c - ('a' - 'A'); return c; } mes-0.24.2/lib/dirent/__getdirentries.c0000644000000000000000000000225214372371517014631 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1993 Free Software Foundation, Inc. * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ // Taken from GNU C Library 1.06.4 #include #include #include #include int __getdirentries (int filedes, char *buffer, size_t nbytes, off_t * basep) { if (basep) *basep = lseek (filedes, (off_t) 0, SEEK_CUR); return read (filedes, buffer, nbytes); } mes-0.24.2/lib/dirent/closedir.c0000644000000000000000000000262214372371517013270 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1991, 1993, 1995, 1996, 1998 Free Software Foundation, Inc. * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ // Taken from GNU C Library 2.2.5 #include #include #include #include #include #include #include #include #include #include #include /* Close the directory stream DIRP. Return 0 if successful, -1 if not. */ int closedir (DIR * dirp) { int filedes; if (dirp == NULL) { errno = EINVAL; return -1; } filedes = dirp->fd; free (dirp); return close (filedes); } mes-0.24.2/lib/dirent/opendir.c0000644000000000000000000000373514372371517013132 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1991-1996,98,2000,2001 Free Software Foundation, Inc. * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ // Taken from GNU C Library 2.2.5 #include #include #include #include #include #include #include #include #include #include #include #include /* Open a directory stream on NAME. */ DIR * opendir (char const *name) { DIR *dirp; struct stat statbuf; int fd; size_t allocation; int save_errno; if (name[0] == '\0') { /* POSIX.1-1990 says an empty name gets ENOENT; but `open' might like it fine. */ errno = ENOENT; return 0; } fd = open (name, O_RDONLY | O_DIRECTORY); if (fd < 0) return 0; if (fstat (fd, &statbuf) < 0) goto lose; if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0) goto lose; allocation = statbuf.st_blksize; dirp = (DIR *) calloc (1, sizeof (DIR) + allocation); if (!dirp) lose: { save_errno = errno; close (fd); errno = save_errno; return 0; } dirp->data = (char *) (dirp + 1); dirp->allocation = allocation; dirp->fd = fd; return dirp; } mes-0.24.2/lib/dirent/readdir.c0000644000000000000000000000440714372371517013101 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright (C) 1991,92,93,94,95,96,97,99,2000 Free Software Foundation, Inc. * Copyright © 2018 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ // Taken from GNU C Library 2.2.5 #include #include #include #include #include #include #include #include #include int getdents (int filedes, char *buffer, size_t nbytes); /* Read a directory entry from DIRP. */ struct dirent * readdir (DIR * dirp) { struct dirent *dp; int saved_errno = errno; do { size_t reclen; if (dirp->offset >= dirp->size) { /* We've emptied out our buffer. Refill it. */ size_t maxread; ssize_t bytes; maxread = dirp->allocation; #if 0 off_t base; bytes = __getdirentries (dirp->fd, dirp->data, maxread, &base); #else bytes = getdents (dirp->fd, dirp->data, maxread); #endif if (bytes <= 0) { /* Don't modifiy errno when reaching EOF. */ if (bytes == 0) errno = saved_errno; dp = 0; break; } dirp->size = (size_t) bytes; /* Reset the offset into the buffer. */ dirp->offset = 0; } dp = (struct dirent *) &dirp->data[dirp->offset]; reclen = dp->d_reclen; dirp->offset += reclen; dirp->filepos = dp->d_off; /* Skip deleted files. */ } while (dp->d_ino == 0); return dp; } mes-0.24.2/lib/freebsd/x86-mes-gcc/_exit.c0000644000000000000000000000227114372371517014662 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include "mes/lib-mini.h" #define SYS_exit "0x01" // *INDENT-OFF* void _exit (int code) { asm ( "mov $"SYS_exit",%%eax\n\t" "mov %0,%%ebx\n\t" "push %%ebx\n\t" "push %%ebx\n\t" "int $0x80\n\t" : // no outputs "=" (r) : "rm" (code) : "eax", "ebx" ); // not reached _exit (0); } mes-0.24.2/lib/freebsd/x86-mes-gcc/_write.c0000644000000000000000000000260514372371517015044 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include "mes/lib-mini.h" #define SYS_exit "0x01" // *INDENT-OFF* ssize_t _write (int filedes, void const *buffer, size_t size) { long r; asm ( "mov $"SYS_write",%%eax\n\t" "mov %3,%%edx\n\t" "push %%edx\n\t" "mov %2,%%ecx\n\t" "push %%ecx\n\t" "mov %1,%%ebx\n\t" "push %%ebx\n\t" "push %%ebx\n\t" "int $0x80\n\t" "mov %%eax,%0\n\t" : "=r" (r) : "rm" (filedes), "rm" (buffer), "rm" (size) : "eax", "ebx", "ecx", "edx" ); return r; } mes-0.24.2/lib/freebsd/x86-mes-gcc/crt1.c0000644000000000000000000000365514372371517014432 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include //int main (int argc, char *argv[], char *envp[]); // *INDENT-OFF* void _start () { asm ( "mov $0,%%eax\n\t" "mov %%eax,%0\n" : "=r" (__stdin) : //no inputs "" ); asm ( "mov $1,%%eax\n\t" "mov %%eax,%0\n" : "=r" (__stdout) : //no inputs "" ); asm ( "mov $2,%%eax\n\t" "mov %%eax,%0\n" : "=r" (__stderr) : //no inputs "" ); asm ( "mov %%ebp,%%eax\n\t" "add $4,%%eax\n\t" "mov (%%eax),%%eax\n\t" "add $3,%%eax\n\t" "shl $2,%%eax\n\t" "add %%ebp,%%eax\n\t" "mov %%eax,%0\n\t" "push %%eax\n\t" : "=r" (environ) : //no inputs "" ); asm ( "mov %ebp,%eax\n\t" "add $8,%eax\n\t" "push %eax\n\t" "mov %ebp,%eax\n\t" "add $4,%eax\n\t" "mov (%eax),%eax\n\t" "push %eax\n\t" "call main\n\t" "push %eax\n\t" "call _exit\n\t" "hlt \n\t" ); } mes-0.24.2/lib/freebsd/x86-mes-gcc/exit-42.S0000644000000000000000000000255214372371517014730 0ustar /* * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ /** Commentary: */ /* Using gdb, esp. GUD in GNU Emacs is recommended M-x gdb-display-disassembly-buffer M-x gdb-display-io-buffer set disassemble-next-line on break _start run info registers si p/x $eax RET ... */ /** Code: */ SYS_exit = 1 /* FreeBSD syscall: exit. */ .globl _start /* Magic linker symbol: --entry-address. */ .text /* Program text. */ _start: mov $SYS_exit,%eax /* System call function: exit, in %eax. */ push $42 /* Push first parameter: exit status. */ push $00 /* Push ??. */ int $0x80 /* Call system. */ hlt /* Should not be reached. */ mes-0.24.2/lib/freebsd/x86-mes-gcc/hello-mes.S0000644000000000000000000000330414372371517015415 0ustar /* * GNU Mes --- Maxwell Equations of Software * Copyright © 2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ /** Commentary: */ /* Using gdb, esp. GUD in GNU Emacs is recommended M-x gdb-display-disassembly-buffer M-x gdb-display-io-buffer set disassemble-next-line on break _start run info registers si p/x $eax RET ... */ /** Code: */ SYS_exit = 1 /* Linux syscalls. */ SYS_write = 4 stdout = 1 /* File discriptor */ .globl _start /* Magic linker symbol: --entry-address. */ .text /* Program text. */ _start: mov $SYS_write,%eax /* System call function: write, in %eax. */ push $(bye-hello) /* 3rd parameter: byte count. */ push $hello /* 2nd parameter: address. */ push $stdout /* 1st parameter: file descriptor. */ push $0 /* ?? */ int $0x80 /* Call system. */ mov $SYS_exit,%eax /* System call function: exit, in %eax. */ push $0 /* 1st parameter: exit status. */ push $0 /* ?? */ int $0x80 /* Call system. */ hlt /* Should not be reached. */ .data hello: .ascii "Hello, GNU Mes!\n" bye: .byte 0 mes-0.24.2/lib/freebsd/x86-mes-mescc/_exit.c0000644000000000000000000000175714372371517015230 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ void _exit () { asm ("mov____$i32,%eax SYS_exit"); asm ("mov____0x8(%ebp),%ebx !8"); asm ("push___%ebx"); asm ("push___%ebx"); asm ("int____$0x80"); } mes-0.24.2/lib/freebsd/x86-mes-mescc/_write.c0000644000000000000000000000215114372371517015376 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2016,2017,2019,2020 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ void _write () { asm ("mov____$i32,%eax SYS_write"); asm ("mov____0x8(%ebp),%edx !16"); asm ("push___%edx"); asm ("mov____0x8(%ebp),%ecx !12"); asm ("push___%ecx"); asm ("mov____0x8(%ebp),%ebx !8"); asm ("push___%ebx"); asm ("push___%ebx"); asm ("int____$0x80"); } mes-0.24.2/lib/freebsd/x86-mes-mescc/crt1.c0000644000000000000000000000331314372371517014757 0ustar /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software * Copyright © 2017,2018,2019,2021 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * * GNU Mes is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * GNU Mes is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Mes. If not, see . */ #include "mes/lib-mini.h" int main (int argc, char *argv[], char *envp[]); int _start () { asm ("mov____$i8,%eax !0"); asm ("mov____%eax,0x32 &__stdin"); asm ("mov____$i8,%eax !1"); asm ("mov____%eax,0x32 &__stdout"); asm ("mov____$i8,%eax !2"); asm ("mov____%eax,0x32 &__stderr"); asm ("mov____%ebp,%eax"); asm ("add____$i8,%eax !4"); asm ("mov____(%eax),%eax"); asm ("add____$i8,%eax !3"); asm ("shl____$i8,%eax !0x02"); asm ("add____%ebp,%eax"); asm ("mov____%eax,0x32 &environ"); asm ("push___%eax"); asm ("mov____%ebp,%eax"); asm ("add____$i8,%eax !8"); asm ("push___%eax"); asm ("mov____%ebp,%eax"); asm ("add____$i8,%eax !4"); asm ("mov____(%eax),%eax"); asm ("push___%eax"); main (); asm ("mov____%eax,%ebx"); asm ("mov____$i32,%eax %1"); asm ("push___%ebx"); asm ("push___%ebx"); asm ("int____$0x80"); asm ("hlt"); } mes-0.24.2/lib/freebsd/x86-mes/elf32-0exit-42.hex20000644000000000000000000000255714372371517015640 0ustar ### GNU Mes --- Maxwell Equations of Software ### Copyright © 2017,2019 Jan (janneke) Nieuwenhuizen ### ### This file is part of GNU Mes. ### ### GNU Mes is free software; you can redistribute it and/or modify it ### under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 3 of the License, or (at ### your option) any later version. ### ### GNU Mes is distributed in the hope that it will be useful, but ### WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with GNU Mes. If not, see . ### Commentary: # elf32-exit-42.hex2: `exit 42' for i686-freebsd written in hex2 assembly, # for usage with elf32-0header.hex2. This produces a 112-byte binary # (70 hex). Inspiration was taken from GNU Gcc output of exit-42.S. ### Code: # DEFINE SYS_exit 1 # @60 :ELF_text b8 01 00 00 00 # mov SYS_exit,%eax 68 2a 00 00 00 # push $42 68 00 00 00 00 # push $00 cd 80 # int $0x80 f4 # hlt 00 00 00 00 00 00 # align to @80 00 00 00 00 00 00 00 00 :ELF_end mes-0.24.2/lib/freebsd/x86-mes/elf32-0header.hex20000644000000000000000000000611014372371517015661 0ustar ### Copyright (C) 2016 Jeremiah Orians ### Copyright (C) 2017,2019 Jan (janneke) Nieuwenhuizen ### ### This file is part of GNU Mes. ### ### GNU Mes is free software; you can redistribute it and/or modify it ### under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 3 of the License, or (at ### your option) any later version. ### ### GNU Mes is distributed in the hope that it will be useful, but ### WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with GNU Mes. If not, see . ### Commentary: # elf32-0header.hex2: Simplest 32 bit elf header in hex2. Only a text # segment, no data segment, no symbol tables. # stage0's hex2 format for x86 # !