* 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.
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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* module/language/c99/compiler.mes (expr->accu): Remove specific --/++.
(expr->accu*): Support p, *p.
* scaffold/tests/76-pointer-arithmetic.c (test): Test it.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
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.
* 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,...}.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.