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.
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.