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.
Jan Nieuwenhuizen [Tue, 25 Jul 2017 18:55:45 +0000 (20:55 +0200)]
mescc: Tinycc support: calloc,malloc,realloc.
* mlibc/libc-mes+tcc.c (calloc,malloc,realloc): New function.
Jan Nieuwenhuizen [Tue, 25 Jul 2017 23:13:33 +0000 (01:13 +0200)]
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.
Jan Nieuwenhuizen [Tue, 25 Jul 2017 15:01:37 +0000 (17:01 +0200)]
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.
Jan Nieuwenhuizen [Tue, 25 Jul 2017 08:01:12 +0000 (10:01 +0200)]
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).
Jan Nieuwenhuizen [Tue, 25 Jul 2017 09:11:26 +0000 (11:11 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 18:33:15 +0000 (20:33 +0200)]
mescc: Tinycc support: execvp stub.
* mlibc/include/unistd.h (execvp): Declare.
* mlibc/libc-mes+tcc.c (execvp): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 18:19:49 +0000 (20:19 +0200)]
mescc: Tinycc support: remove stub.
* mlibc/include/stdio.h (remove): Declare.
* mlibc/libc-mes+tcc.c (remove): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 18:16:25 +0000 (20:16 +0200)]
mescc: Tinycc support: fread stub.
* mlibc/include/stdio.h (fread): Declare.
* mlibc/libc-mes+tcc.c (fread): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 18:14:00 +0000 (20:14 +0200)]
mescc: Tinycc support: ftell stub.
* mlibc/include/stdio.h (ftell): Declare.
* mlibc/libc-mes+tcc.c (ftell): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 18:11:22 +0000 (20:11 +0200)]
mescc: Tinycc support: fseek stub.
* mlibc/include/stdio.h (fseek): Declare.
* mlibc/libc-mes+tcc.c (fseek): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 18:08:38 +0000 (20:08 +0200)]
mescc: Tinycc support: fopen stub.
* mlibc/include/stdio.h (fopen): Declare.
* mlibc/libc-mes+tcc.c (fopen): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 17:54:32 +0000 (19:54 +0200)]
mescc: Tinycc support: strstr stub.
* mlibc/include/string.h (strstr): Declare.
* mlibc/libc-mes+tcc.c (strstr): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 17:31:52 +0000 (19:31 +0200)]
mescc: Tinycc support: sscanf stub.
* mlibc/include/stdio.h (sscanf): Declare.
* mlibc/libc-mes+tcc.c (sscanf): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 17:19:31 +0000 (19:19 +0200)]
mescc: Tinycc support: longjmp, setjump stub.
* mlibc/include/stdarg.h (longjmp, setjmp): Declare.
* mlibc/libc-mes+tcc.c (longjmp, setjmp): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 17:15:54 +0000 (19:15 +0200)]
mescc: Tinycc support: function parameters.
* module/language/c99/compiler.mes (.name): Handle function parameters.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 17:07:18 +0000 (19:07 +0200)]
mescc: Tinycc support: fflush stub.
* mlibc/include/stdio.h (fflush): Declare.
* mlibc/libc-mes+tcc.c (fflush): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 16:47:09 +0000 (18:47 +0200)]
mescc: Tinycc support: vnsprintf stub.
* mlibc/include/stdarg.h (vnsprintf): Declare.
* mlibc/libc-mes+tcc.c (vnsprintf): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 16:42:24 +0000 (18:42 +0200)]
mescc: Tinycc support: jump 32.
* module/mes/as-i386.mes (i386:jump-byte-z): Use jne32 (was: jne8).
Jan Nieuwenhuizen [Mon, 24 Jul 2017 16:24:51 +0000 (18:24 +0200)]
mescc: Tinycc support: free stub.
* mlibc/include/stdlib.h (free): Declare.
* mlibc/libc-mes+tcc.c (free): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 16:16:21 +0000 (18:16 +0200)]
mescc: Tinycc support: strrchr stub.
* mlibc/include/string.h (strrchr): Declare.
* mlibc/libc-mes+tcc.c (strrchr): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 16:12:28 +0000 (18:12 +0200)]
mescc: Tinycc support: strtoll stub.
* mlibc/include/stdlib.h (strtoll): Declare.
* mlibc/libc-mes+tcc.c (strtoll): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 16:08:02 +0000 (18:08 +0200)]
mescc: Tinycc support: strtoull stub.
* mlibc/include/stdlib.h (strtoull): Declare.
* mlibc/libc-mes+tcc.c (strtoull): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:38:25 +0000 (17:38 +0200)]
mescc: Tinycc support: strtol stub.
* mlibc/include/stdlib.h (strtol): Declare.
* mlibc/libc-mes+tcc.c (strtol): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:33:33 +0000 (17:33 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:25:53 +0000 (17:25 +0200)]
mescc: Tinycc support: fclose stub.
* mlibc/include/stdio.h (fclose): Declare.
* mlibc/libc-mes+tcc.c (fclose): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:23:32 +0000 (17:23 +0200)]
mescc: Tinycc support: fdopen stub.
* mlibc/include/stdio.h (fdopen): Declare.
* mlibc/libc-mes+tcc.c (fdopen): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:09:33 +0000 (17:09 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:06:16 +0000 (17:06 +0200)]
mescc: Tinycc support: fwrite stub.
* mlibc/include/stdio.h (fwrite): Declare.
* mlibc/libc-mes+tcc.c (fwrite): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 15:04:11 +0000 (17:04 +0200)]
mescc: Tinycc support: qsort stub.
* mlibc/include/stdlib.h (qsort): Declare.
* mlibc/libc-mes+tcc.c (qsort): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:49:17 +0000 (13:49 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:46:32 +0000 (13:46 +0200)]
mescc: Tinycc support: strchr stub.
* mlibc/include/string.h (strchr): Declare.
* mlibc/libc-mes+tcc.c (strchr): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:39:34 +0000 (13:39 +0200)]
mescc: Tinycc support: fprintf stub.
* mlibc/include/stdio.h (fprintf): Declare.
* mlibc/libc-mes+tcc.c (fprintf): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:28:18 +0000 (13:28 +0200)]
mescc: Tinycc support: localtime stub.
* mlibc/include/time.h (localtime): Declare.
* mlibc/libc-mes+tcc.c (localtime): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:25:54 +0000 (13:25 +0200)]
mescc: Tinycc support: time stub.
* mlibc/include/time.h (time): Declare.
* mlibc/libc-mes+tcc.c (time): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:23:15 +0000 (13:23 +0200)]
mescc: Tinycc support: snprintf stub.
* mlibc/include/stdio.h (snprintf): Declare.
* mlibc/libc-mes+tcc.c (snprintf): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 11:10:27 +0000 (13:10 +0200)]
mescc: Tinycc support: strtoul stub.
* mlibc/include/stdlib.h (strtoul): Declare.
* mlibc/libc-mes+tcc.c (strtoul): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 10:53:51 +0000 (12:53 +0200)]
mescc: Tinycc support: memmove stub.
* mlibc/include/string.h (memcmp): Declare.
* mlibc/libc-mes+tcc.c (memcmp): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 10:57:34 +0000 (12:57 +0200)]
mescc: Tinycc support: memset stub.
* mlibc/include/string.h (memset): Declare.
* mlibc/libc-mes+tcc.c (memset): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 10:56:56 +0000 (12:56 +0200)]
mescc: Tinycc support: memmove stub.
* mlibc/include/string.h (memmove): Declare.
* mlibc/libc-mes+tcc.c (memmove): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 10:43:04 +0000 (12:43 +0200)]
mescc: Tinycc support: memcpy stub.
* mlibc/include/string.h (memcpy): Declare.
* mlibc/libc-mes+tcc.c (memcpy): Add stub.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 10:21:24 +0000 (12:21 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 13:22:51 +0000 (15:22 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 06:36:43 +0000 (08:36 +0200)]
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.
Jan Nieuwenhuizen [Mon, 24 Jul 2017 20:57:21 +0000 (22:57 +0200)]
mescc: Naming fix.
* stage0/x86.M1 (je8): Rename from jne8.
* module/mes/as-i386.mes (i386:jump-byte-z): Update.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 21:40:23 +0000 (23:40 +0200)]
mescc: Tinycc support: remove warnings for foo (void), foo (...).
* module/language/c99/compiler.mes (.name, .type): Expect foo (void), foo (...).
Jan Nieuwenhuizen [Sun, 23 Jul 2017 21:04:00 +0000 (23:04 +0200)]
mescc: Tinycc support: multiple statements in default case.
* module/language/c99/compiler.mes (clause->info): Support multiple
statements in default case.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 19:58:34 +0000 (21:58 +0200)]
mescc: Tinycc support: array[<const-expr>].
* module/language/c99/compiler.mes (p-expr->number): New function.
(struct-field, decl->info): Use it to support const expressions in array size.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 16:56:07 +0000 (18:56 +0200)]
mescc: Use "tag" for tag namespace.
* module/language/c99/compiler.mes: Use "tag" for tag namespace (WAS: "struct").
Move enums to "tag" namespace.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 18:42:29 +0000 (20:42 +0200)]
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.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 13:49:03 +0000 (15:49 +0200)]
mescc: Non-Guix support. Thanks rain1!
* mlibc/include: Neutralize include guards before #include_next.
Fixes compiling tinycc on Debian GNU/Linux.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 12:18:00 +0000 (14:18 +0200)]
mescc: Tinycc support: sizeof (struct.field).
* module/language/c99/compiler.mes (expr->accu): Support sizeof (struct.field).
Jan Nieuwenhuizen [Sun, 23 Jul 2017 11:41:38 +0000 (13:41 +0200)]
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.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 11:56:38 +0000 (13:56 +0200)]
mescc: Tinycc support: sizeof ("foo").
* module/language/c99/compiler.mes (expr->accu): Support sizeof (string).
Jan Nieuwenhuizen [Sun, 23 Jul 2017 08:44:17 +0000 (10:44 +0200)]
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):
Jan Nieuwenhuizen [Sun, 23 Jul 2017 07:18:36 +0000 (09:18 +0200)]
mescc: Tinycc support: generalize neg.
* module/language/c99/compiler.mes (expr->accu): Generalize neg.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 06:51:42 +0000 (08:51 +0200)]
mescc: Tinycc support: >>=, <<=.
* module/language/c99/compiler.mes (expr->accu): Support >>= <<=.
Jan Nieuwenhuizen [Sun, 23 Jul 2017 06:44:48 +0000 (08:44 +0200)]
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]).
Jan Nieuwenhuizen [Sat, 22 Jul 2017 21:39:39 +0000 (23:39 +0200)]
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.
Jan Nieuwenhuizen [Sat, 22 Jul 2017 08:02:53 +0000 (10:02 +0200)]
mescc: Tinycc support: *global =.
* module/language/c99/compiler.mes (base->ident-address):
Support *global = ...
* scaffold/tests/74-multi-line-string.c: Test it.
Jan Nieuwenhuizen [Sat, 22 Jul 2017 18:40:41 +0000 (20:40 +0200)]
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.
Jan Nieuwenhuizen [Sat, 22 Jul 2017 07:22:11 +0000 (09:22 +0200)]
mescc: Tinycc support: declare struct tm.
* mlibc/include/time.h (struct tm): New type.
Jan Nieuwenhuizen [Fri, 21 Jul 2017 19:43:18 +0000 (21:43 +0200)]
mescc: Tinycc support: ignore [ULL], UL, LL, L.
* module/language/c99/compiler.mes (cstring->number): Drop suffix.
Jan Nieuwenhuizen [Fri, 21 Jul 2017 08:39:04 +0000 (10:39 +0200)]
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.
Jan Nieuwenhuizen [Tue, 18 Jul 2017 18:22:44 +0000 (20:22 +0200)]
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.
Jan Nieuwenhuizen [Thu, 20 Jul 2017 23:02:17 +0000 (01:02 +0200)]
mescc: Tinycc support: ***parameter.
* module/language/c99/compiler.mes (.name): Support ***parameter.
Jan Nieuwenhuizen [Thu, 20 Jul 2017 22:21:31 +0000 (00:21 +0200)]
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.
Jan Nieuwenhuizen [Thu, 20 Jul 2017 22:09:18 +0000 (00:09 +0200)]
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.
Jan Nieuwenhuizen [Tue, 18 Jul 2017 06:04:50 +0000 (08:04 +0200)]
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?
Jan Nieuwenhuizen [Mon, 17 Jul 2017 20:03:11 +0000 (22:03 +0200)]
mescc: Tinycc support: headers.
* mlibc/include/string.h (ssize_t): New type.
* mlibc/include/unistd.h (ssize_t): New type.