* 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.
* module/language/c99/info.mes (type?, global?, local?): New function.
(make-global): Remove name parameter.
* module/nyacc/lang/c99/pprint.mes: New file.
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.
* 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.