Jan Nieuwenhuizen [Sat, 11 Nov 2017 12:09:26 +0000 (13:09 +0100)]
doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.11: New file.
Jan Nieuwenhuizen [Sat, 18 Nov 2017 14:02:21 +0000 (15:02 +0100)]
build: fix for 07-include, thanks rain1!
* make.scm (add-scaffold-test): New keyword parameter: includes.
("07-include"): Use it.
Jan Nieuwenhuizen [Sat, 18 Nov 2017 13:50:56 +0000 (14:50 +0100)]
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.
Jan Nieuwenhuizen [Sat, 18 Nov 2017 11:14:07 +0000 (12:14 +0100)]
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.
Jan Nieuwenhuizen [Sat, 18 Nov 2017 10:55:47 +0000 (11:55 +0100)]
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.
Jan Nieuwenhuizen [Fri, 17 Nov 2017 14:24:45 +0000 (15:24 +0100)]
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.
Jan Nieuwenhuizen [Thu, 16 Nov 2017 21:11:07 +0000 (22:11 +0100)]
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.
Jan Nieuwenhuizen [Thu, 16 Nov 2017 04:52:47 +0000 (05:52 +0100)]
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.
Jan Nieuwenhuizen [Thu, 16 Nov 2017 04:33:11 +0000 (05:33 +0100)]
tinycc: scaffold/main.c: running mes-tcc compiled binary #6.
* scaffold/main.c (main): Use variable, if, argc, ++, +=, function call to return 42.
Jan Nieuwenhuizen [Wed, 15 Nov 2017 22:06:23 +0000 (23:06 +0100)]
tinycc: scaffold/main.c: running mes-tcc compiled binary #5.
* scaffold/main.c (main): Use function call and variable to return 42.
Jan Nieuwenhuizen [Tue, 14 Nov 2017 18:42:08 +0000 (19:42 +0100)]
tinycc: scaffold/main.c: running mes-tcc compiled binary #4.
* scaffold/main.c (main): Use variables to return 42.
Jan Nieuwenhuizen [Tue, 14 Nov 2017 18:39:46 +0000 (19:39 +0100)]
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.
Jan Nieuwenhuizen [Sat, 11 Nov 2017 12:45:53 +0000 (13:45 +0100)]
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.
Jan Nieuwenhuizen [Sat, 11 Nov 2017 12:42:42 +0000 (13:42 +0100)]
mlibc: errno.h: declare errno without extern.
* mlibc/include/errno.h: drop extern. Fixes tcc compile.
Jan Nieuwenhuizen [Sat, 11 Nov 2017 12:20:25 +0000 (13:20 +0100)]
guix: nyacc: Update to 0.82.4.
* guix.scm (nyacc): Update to 0.82.4.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 19:59:16 +0000 (21:59 +0200)]
guix: Release update.
* guix.scm (mes): Update commit, hash and version.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 19:55:05 +0000 (21:55 +0200)]
Release 0.10.
* configure (VERSION): Bump to 0.10.
Jan Nieuwenhuizen [Sat, 26 Aug 2017 11:29:07 +0000 (13:29 +0200)]
doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* doc/ANNOUNCE-0.10: New file.
* BOOTSTRAP: New file.
* make.scm: Install them.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 19:17:17 +0000 (21:17 +0200)]
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.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 19:10:08 +0000 (21:10 +0200)]
guix: Bump Nyacc to 0.82.0.
* guix.scm (nyacc): Bump to 0.82.0.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 19:09:23 +0000 (21:09 +0200)]
mescc: Support Nyacc-0.81.0.
* module/language/c99/compiler.mes (ast->info): Handle asm-expr from
Nyacc 0.81.0.
Jan Nieuwenhuizen [Sun, 3 Sep 2017 08:43:02 +0000 (10:43 +0200)]
tinycc: scaffold/main.c: running tcc-compiled binary #3.
* scaffold/main.c (main): Remove asm.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 14:59:53 +0000 (16:59 +0200)]
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.
Jan Nieuwenhuizen [Sat, 2 Sep 2017 22:37:39 +0000 (00:37 +0200)]
tinycc: scaffold/main.c: running tcc-compiled binary #2.
* scaffold/main.c (main)[__i386__]: Rename from _start.
Jan Nieuwenhuizen [Sun, 10 Sep 2017 14:59:43 +0000 (16:59 +0200)]
build: compile crt1.c, libc-mesc.c and <input>.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.
Jan Nieuwenhuizen [Sun, 3 Sep 2017 06:18:18 +0000 (08:18 +0200)]
mescc: Tinycc support: refactor _start.
* mlibc/libc-mes.c (_start): Refactor.
(_env): Remove.
* stage0/x86.M1:
Jan Nieuwenhuizen [Sat, 19 Aug 2017 09:35:58 +0000 (11:35 +0200)]
tinycc: scaffold/main.c: first running tcc-compiled binary.
* scaffold/main.c (_start): Exit 42 using asm.
Jan Nieuwenhuizen [Sun, 27 Aug 2017 14:58:56 +0000 (16:58 +0200)]
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.
Jan Nieuwenhuizen [Sun, 27 Aug 2017 10:57:50 +0000 (12:57 +0200)]
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.
Jan Nieuwenhuizen [Sun, 27 Aug 2017 10:53:01 +0000 (12:53 +0200)]
core: Add logand, lognot.
* src/math.c (logand, lognot): New function.
Jan Nieuwenhuizen [Sun, 27 Aug 2017 09:23:45 +0000 (11:23 +0200)]
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.
Jan Nieuwenhuizen [Sun, 27 Aug 2017 09:29:07 +0000 (11:29 +0200)]
mescc: Tinycc support: stdint.h: declare size_t.
* mlibc/include/stdint.h (size_t)[!__MES_SIZE_T]: Declare.
Jan Nieuwenhuizen [Sat, 26 Aug 2017 08:16:53 +0000 (10:16 +0200)]
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.
Jan Nieuwenhuizen [Fri, 25 Aug 2017 04:58:15 +0000 (06:58 +0200)]
mescc: Tinycc support: pointer arithmetic with &variable.
* module/language/c99/compiler.mes (expr->pointer): Handle ref.
* scaffold/tests/76-pointer-arithmetic.c: Test it.
Jan Nieuwenhuizen [Wed, 23 Aug 2017 05:08:16 +0000 (07:08 +0200)]
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.
Jan Nieuwenhuizen [Wed, 23 Aug 2017 04:55:25 +0000 (06:55 +0200)]
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.
Jan Nieuwenhuizen [Sat, 19 Aug 2017 08:51:24 +0000 (10:51 +0200)]
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.
Jan Nieuwenhuizen [Sat, 12 Aug 2017 15:38:44 +0000 (17:38 +0200)]
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.
Jan Nieuwenhuizen [Thu, 10 Aug 2017 19:36:49 +0000 (21:36 +0200)]
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.
Jan Nieuwenhuizen [Thu, 10 Aug 2017 19:00:22 +0000 (21:00 +0200)]
mescc: Fix compile warnings.
* mlibc/include/stdio.h (fdputs): Declare.
* mlibc/libc-gcc.c (malloc):
(memcpy): Fix compile warning.
Jan Nieuwenhuizen [Thu, 10 Aug 2017 18:57:43 +0000 (20:57 +0200)]
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.
Jan Nieuwenhuizen [Tue, 8 Aug 2017 08:00:13 +0000 (10:00 +0200)]
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.
Jan Nieuwenhuizen [Mon, 7 Aug 2017 17:43:59 +0000 (19:43 +0200)]
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.
Jan Nieuwenhuizen [Sun, 6 Aug 2017 16:49:19 +0000 (18:49 +0200)]
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.
Jan Nieuwenhuizen [Sun, 6 Aug 2017 11:53:56 +0000 (13:53 +0200)]
mescc: Tinycc support: eputc.
* mlibc/include/stdio.h (eputc): Declare.
* mlibc/libc-gcc.c (eputc):
* mlibc/libc-mes.c (eputc): New function.
Jan Nieuwenhuizen [Sun, 6 Aug 2017 11:14:09 +0000 (13:14 +0200)]
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
Jan Nieuwenhuizen [Sun, 6 Aug 2017 10:27:16 +0000 (12:27 +0200)]
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.
Jan Nieuwenhuizen [Sun, 6 Aug 2017 10:16:34 +0000 (12:16 +0200)]
mescc: Tinycc support: eputs as function for gcc.
* mlibc/libc-gcc.c (eputs)[POSIX]: New function.
* mlibc/include/stdio.h (eputs)[POSIX]: Remove define.
Jan Nieuwenhuizen [Sat, 5 Aug 2017 19:09:19 +0000 (21:09 +0200)]
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.
Jan Nieuwenhuizen [Sat, 5 Aug 2017 17:10:00 +0000 (19:10 +0200)]
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.
Jan Nieuwenhuizen [Sat, 5 Aug 2017 10:39:36 +0000 (12:39 +0200)]
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.
Jan Nieuwenhuizen [Fri, 4 Aug 2017 19:45:29 +0000 (21:45 +0200)]
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.
Jan Nieuwenhuizen [Fri, 4 Aug 2017 09:45:15 +0000 (11:45 +0200)]
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
Jan Nieuwenhuizen [Fri, 4 Aug 2017 06:59:09 +0000 (08:59 +0200)]
guix: use nyacc 0.80.41.
* guix.scm (nyacc): use 0.80.41.
Jan Nieuwenhuizen [Fri, 4 Aug 2017 09:40:04 +0000 (11:40 +0200)]
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.
Jan Nieuwenhuizen [Fri, 4 Aug 2017 09:34:01 +0000 (11:34 +0200)]
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.
Jan Nieuwenhuizen [Fri, 4 Aug 2017 09:33:34 +0000 (11:33 +0200)]
mescc: Tinycc support: define __linux__.
* module/language/c99/compiler.mes (c99-input->full-ast): Add
"__linux__=1" to cpp-defs.
Jan Nieuwenhuizen [Tue, 1 Aug 2017 11:26:17 +0000 (13:26 +0200)]
mescc: Tinycc support: strcat.
* mlibc/libc-mes+tcc.c (strcat): Implement.
Jan Nieuwenhuizen [Tue, 1 Aug 2017 11:24:23 +0000 (13:24 +0200)]
mescc: Tinycc support: vsnprintf.
* module/language/c99/compiler.mes (ast-type->type): Support *p++ in test.
* mlibc/libc-mes+tcc.c (vsnprintf): Implement.
Jan Nieuwenhuizen [Tue, 1 Aug 2017 09:26:00 +0000 (11:26 +0200)]
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.
Jan Nieuwenhuizen [Tue, 1 Aug 2017 09:08:14 +0000 (11:08 +0200)]
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.
Jan Nieuwenhuizen [Mon, 31 Jul 2017 10:19:23 +0000 (12:19 +0200)]
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.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 16:04:25 +0000 (18:04 +0200)]
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.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 12:52:35 +0000 (14:52 +0200)]
mescc: Tinycc support: fwrite.
* mlibc/libc-mes+tcc.c (fwrite): Implement.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 12:51:59 +0000 (14:51 +0200)]
mescc: Tinycc support: fclose.
* mlibc/libc-mes+tcc.c (fclose): Implement.
rain1 [Sun, 30 Jul 2017 12:28:19 +0000 (08:28 -0400)]
mescc: Tinycc support: fgetc.
* mlibc/libc-mes.c (fgetc): Implement.
rain1 [Sun, 30 Jul 2017 12:28:19 +0000 (08:28 -0400)]
mescc: Tinycc support: fprintf.
* mlibc/libc-mes+tcc.c (fprintf): Implement.
rain1 [Sun, 30 Jul 2017 12:28:19 +0000 (08:28 -0400)]
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.
rain1 [Sun, 30 Jul 2017 12:28:19 +0000 (08:28 -0400)]
mescc: support \x00 strings in M1.
* module/mes/M1.mes (object->m1): Support \x00 strings.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 11:59:06 +0000 (13:59 +0200)]
mescc: Tinycc support: memmove.
* mlibc/libc-mes+tcc.c (memmove): Implement.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 11:09:19 +0000 (13:09 +0200)]
mescc: Tinycc support: strrchr.
* mlibc/libc-mes+tcc.c (strrchr): Implement.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 10:55:58 +0000 (12:55 +0200)]
mescc: Tinycc support: strchr.
* mlibc/libc-mes+tcc.c (strchr): Implement.
Jan Nieuwenhuizen [Thu, 27 Jul 2017 16:53:44 +0000 (18:53 +0200)]
mescc: Tinycc support: noisy stubs.
* mlibc/libc-mes+tcc.c: Noisy stubs.
Jan Nieuwenhuizen [Sun, 30 Jul 2017 06:27:05 +0000 (08:27 +0200)]
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,...}.
Jan Nieuwenhuizen [Sat, 29 Jul 2017 20:50:00 +0000 (22:50 +0200)]
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.
Jan Nieuwenhuizen [Sat, 29 Jul 2017 18:46:16 +0000 (20:46 +0200)]
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.
Jan Nieuwenhuizen [Sat, 29 Jul 2017 09:09:00 +0000 (11:09 +0200)]
mescc: Tinycc support: memcmp.
* mlibc/libc-mes+tcc.c (memcmp): Implement.
Jan Nieuwenhuizen [Sat, 29 Jul 2017 08:45:16 +0000 (10:45 +0200)]
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.
Jan Nieuwenhuizen [Sat, 29 Jul 2017 07:08:44 +0000 (09:08 +0200)]
mescc: Tinycc support: uniquify strings per compilation unit.
* module/mes/M1.mes (object->M1): Add file-name to string id.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 20:45:32 +0000 (22:45 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 19:39:39 +0000 (21:39 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 18:36:21 +0000 (20:36 +0200)]
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.
Jan Nieuwenhuizen [Sat, 29 Jul 2017 06:37:34 +0000 (08:37 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 16:04:39 +0000 (18:04 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 16:00:46 +0000 (18:00 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 13:45:22 +0000 (15:45 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 13:27:25 +0000 (15:27 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 08:40:30 +0000 (10:40 +0200)]
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.
Jan Nieuwenhuizen [Fri, 28 Jul 2017 06:07:41 +0000 (08:07 +0200)]
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.
Jan Nieuwenhuizen [Thu, 27 Jul 2017 21:44:22 +0000 (23:44 +0200)]
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.
Jan Nieuwenhuizen [Thu, 27 Jul 2017 16:51:58 +0000 (18:51 +0200)]
mescc: Tinycc support: malloc,memcpy.
* mlibc/libc-mes.c (malloc): Rewrite.
* mlibc/libc-mes+tcc.c (memcpy): Implement.
Jan Nieuwenhuizen [Thu, 27 Jul 2017 16:41:45 +0000 (18:41 +0200)]
build: support libc-mes+tcc.
Jan Nieuwenhuizen [Thu, 27 Jul 2017 07:08:11 +0000 (09:08 +0200)]
mescc: Tinycc support: memset.
* mlibc/libc-mes+tcc.c (memset): Implement.
Jan Nieuwenhuizen [Sat, 26 Aug 2017 11:40:30 +0000 (13:40 +0200)]
mescc: bump default maximum for M1-strings to 80.
* module/mes/M1.mes (object->M1): bump default maximum for M1-strings to 80.
Jan Nieuwenhuizen [Wed, 26 Jul 2017 22:13:39 +0000 (00:13 +0200)]
mescc: Tinycc support: oops, use new realloc.
* mlibc/libc-mes.c (realloc): Disable naive realloc for libc-mes+tcc.c.
Jan Nieuwenhuizen [Wed, 26 Jul 2017 21:42:18 +0000 (23:42 +0200)]
mescc: Bugfix: output M1-strings if possible.
* module/mes/M1.mes (object->M1): Typo. Also disallow \return in M1-strings.
Jan Nieuwenhuizen [Wed, 26 Jul 2017 11:10:42 +0000 (13:10 +0200)]
guix: Release update.
* guix.scm (mes): Update commit, hash and version.
Jan Nieuwenhuizen [Wed, 26 Jul 2017 10:55:19 +0000 (12:55 +0200)]
Release 0.9.
* configure (VERSION): Bump to 0.9.
Jan Nieuwenhuizen [Sun, 9 Jul 2017 16:40:12 +0000 (18:40 +0200)]
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.
Jan Nieuwenhuizen [Wed, 26 Jul 2017 13:42:44 +0000 (15:42 +0200)]
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.