* module/language/c99/info.scm (<array>, <pointer>, <var>): New type.
* module/language/c99/compiler.mes (ast-><type>): New function.
(ast-type): Use it.
* module/language/c99/compiler.mes (struct-field): Return list of
fields. Update callers.
* scaffold/tests/84-struct-field-list.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
* module/language/c99/compiler.mes (decl->info): Support heterogeneous
variable init.
* scaffold/tests/83-heterogenoous-init.c: Test it.
* build-aux/check-mescc.sh (tests): Add it.
* module/language/c99/info.scm (make): Add statics field.
(<global>): Add name and function fields. Update callers.
(global->string): New function.
* module/mes/M1.mes (object->M1): Update.
* module/language/c99/compiler.mes (clone): Add statics field.
(ident->accu): For <global>, use global in text (WAS: name).
(ident-address->accu): Likewise.
(ident-address->base): Likewise.
(decl-local->info): New function.
(decl->info): New function.
(ast->info): Use them.
(function->info): Keep globals in object (WAS: global:value only).
* scaffold/tests/46-function-static.c: Test it.
* module/srfi/srfi-13.mes (string-trim, string-trimn-right,
string-trim-both): New function.
* tests/srfi-13.test ("string-trim"): Test it.
("string-trim-right"):
("string-trim-both"):
* src/mes.c (append_reverse): New function.
(reverse_x_): New function.
(append2): Use them to create less garbage.
* module/mes/scm.mes (reverse): Create less garbage.
* module/srfi/srfi-1.mes (reverse!): Rewrite, use core:reverse!.
(append-reverse): Remove.
* module/srfi/srfi-13.mes (string-fold, string-fold-right): New
function.
* tests/srfi-13.test ("string-fold"): Test it.
("string-fold-right"): Test it.
* check-boot.sh: New file.
* check.sh: Invoke it.
* module/srfi/srfi-16.mes: New file.
* scaffold/boot/00-zero.scm: New file.
* scaffold/boot/01-true.scm: New file.
* scaffold/boot/02-symbol.scm: New file.
* scaffold/boot/03-string.scm: New file.
* scaffold/boot/04-cons.scm: New file.
* scaffold/boot/04-quote.scm: New file.
* scaffold/boot/05-list.scm: New file.
* scaffold/boot/06-tick.scm: New file.
* scaffold/boot/07-if.scm: New file.
* scaffold/boot/08-if-if.scm: New file.
* scaffold/boot/10-cons.scm: New file.
* scaffold/boot/11-list.scm: New file.
* scaffold/boot/12-car.scm: New file.
* scaffold/boot/13-cdr.scm: New file.
* scaffold/boot/14-exit.scm: New file.
* scaffold/boot/15-display.scm: New file.
* scaffold/boot/16-if-eq-quote.scm: New file.
* scaffold/boot/20-define-quote.scm: New file.
* scaffold/boot/20-define-quoted.scm: New file.
* scaffold/boot/20-define.scm: New file.
* scaffold/boot/21-define-procedure.scm: New file.
* scaffold/boot/22-define-procedure-2.scm: New file.
* scaffold/boot/23-begin.scm: New file.
* scaffold/boot/24-begin-define.scm: New file.
* scaffold/boot/25-begin-define-2.scm: New file.
* scaffold/boot/26-begin-define-later.scm: New file.
* scaffold/boot/26-define-define.scm: New file.
* scaffold/boot/27-lambda-define.scm: New file.
* scaffold/boot/28-define-define.scm: New file.
* scaffold/boot/29-lambda-define.scm: New file.
* scaffold/boot/2a-lambda-lambda.scm: New file.
* scaffold/boot/2b-define-lambda.scm: New file.
* scaffold/boot/2c-define-lambda-recurse.scm: New file.
* scaffold/boot/2d-define-lambda-set.scm: New file.
* scaffold/boot/2e-define-second.scm: New file.
* scaffold/boot/30-capture.scm: New file.
* scaffold/boot/31-capture-define.scm: New file.
* scaffold/boot/32-capture-modify-close.scm: New file.
* scaffold/boot/33-procedure-override-close.scm: New file.
* scaffold/boot/34-cdr-override-close.scm: New file.
* scaffold/boot/35-closure-modify.scm: New file.
* scaffold/boot/36-closure-override.scm: New file.
* scaffold/boot/37-closure-lambda.scm: New file.
* scaffold/boot/38-simple-format.scm: New file.
* scaffold/boot/40-define-macro.scm: New file.
* scaffold/boot/41-when.scm: New file.
* scaffold/boot/42-if-when.scm: New file.
* scaffold/boot/43-or.scm: New file.
* scaffold/boot/44-or-if.scm: New file.
* scaffold/boot/45-pass-if.scm: New file.
* scaffold/boot/46-report.scm: New file.
* scaffold/boot/47-pass-if-eq.scm: New file.
* scaffold/boot/48-let.scm: New file.
* scaffold/boot/49-macro-override.scm: New file.
* scaffold/boot/4a-define-macro-define-macro.scm: New file.
* scaffold/boot/4b-define-macro-define.scm: New file.
* scaffold/boot/4c-quasiquote.scm: New file.
* scaffold/boot/50-primitive-load.scm: New file.
* scaffold/boot/51-module.scm: New file.
* scaffold/boot/52-define-module.scm: New file.
* scaffold/boot/53-closure-display.scm: New file.
* scaffold/boot/60-let-syntax.scm: New file.
* scaffold/boot/closure.scm: New file.
* scaffold/boot/compose.scm: New file.
* scaffold/boot/data/bar.mes: New file.
* scaffold/boot/data/i.scm: New file.
* scaffold/boot/data/module.mes: New file.
* scaffold/boot/foo.scm: New file.
* scaffold/boot/lambda-star.scm: New file.
* scaffold/boot/vector.scm: New file.
* tests/boot.test: New file.
* tests/boot.test-guile: New file.
* tests/srfi-16.test: New file.
* tests/srfi-16.test-guile: New file.
* src/mes.c (load_env): Softcode loading of boot-0.scm from
environment variabl MES_BOOT.
* module/mes/boot-00.scm: New file.
* module/mes/boot-01.scm: New file.
* module/mes/boot-0.scm: Rename from read-0.mes.
* module/mes/module.mes: New file.
* module/mes/base-0.mes (cond): Evaluate test of COND only once.
Fixes cond tests with side effects (Nyacc).
* tests/base.test ("cond side effect"): Test it.
* module/mes/display.mes (display):
* module/mes/type-0.mes (char?): -1 is not a character.
(eof-object?): New function.
* tests/base.test ("#<eof>"): Test it.
* module/mes/scm.mes (eof-object?): Remove.
(unread-char): Return character (WAS: integer).
* module/mes/getopt-long.scm (remove-if-not): Remove.
(option-spec): Add value field. Update users.
(expand-clumped-singles): Simplify, fix.
(process-options): To get an option's value, use value instead of
value-policy. Fixes multi-opt.
* tests/getopt-long.test: New file.
* make.scm (mes-tests): Add it.
* check.sh (tests): Add it.
* tests/getopt-long.test-guile: New symlink.
* make.scm (bin.gcc, bin.mescc): Use MES_C_READER=1.
* src/mes.c (scm_symbol_define, scm_symbol_define_macro): New symbol.
(scm_vm_eval_define): New special.
(scm_symbol_c_define): New symbol.
(MAKE_MACRO): New define.
(eval_apply)[MES_C_DEFINE]: Handle define, define-macro.
(mes_symbols): Define %c-define for use in read-0.mes.
* module/mes/read-0.mes: Do not implement full scheme define if %c-define.
* module/mes/quasiquote.mes (sexp:define, env:define, env:macro): New function.
(define-macro): New macro. FIXME
* module/mes/psyntax.mes (define): New macro. FIXME
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.