Jan Nieuwenhuizen
ec335eef50
mescc: Tinycc support: strtoull stub.
...
* mlibc/include/stdlib.h (strtoull): Declare.
* mlibc/libc-mes+tcc.c (strtoull): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
c749bb5aa3
mescc: Tinycc support: strtol stub.
...
* mlibc/include/stdlib.h (strtol): Declare.
* mlibc/libc-mes+tcc.c (strtol): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
9f60904d1c
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.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
a8f22ea993
mescc: Tinycc support: fclose stub.
...
* mlibc/include/stdio.h (fclose): Declare.
* mlibc/libc-mes+tcc.c (fclose): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
b479d200b3
mescc: Tinycc support: fdopen stub.
...
* mlibc/include/stdio.h (fdopen): Declare.
* mlibc/libc-mes+tcc.c (fdopen): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
3e39c56f35
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.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
b860cb7a17
mescc: Tinycc support: fwrite stub.
...
* mlibc/include/stdio.h (fwrite): Declare.
* mlibc/libc-mes+tcc.c (fwrite): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
15a9452d33
mescc: Tinycc support: qsort stub.
...
* mlibc/include/stdlib.h (qsort): Declare.
* mlibc/libc-mes+tcc.c (qsort): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
2d1623c5f0
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.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
ecf0fb50b1
mescc: Tinycc support: strchr stub.
...
* mlibc/include/string.h (strchr): Declare.
* mlibc/libc-mes+tcc.c (strchr): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
718410e426
mescc: Tinycc support: fprintf stub.
...
* mlibc/include/stdio.h (fprintf): Declare.
* mlibc/libc-mes+tcc.c (fprintf): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
702a1f9f54
mescc: Tinycc support: localtime stub.
...
* mlibc/include/time.h (localtime): Declare.
* mlibc/libc-mes+tcc.c (localtime): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
aa297a28a9
mescc: Tinycc support: time stub.
...
* mlibc/include/time.h (time): Declare.
* mlibc/libc-mes+tcc.c (time): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
beb24d9550
mescc: Tinycc support: snprintf stub.
...
* mlibc/include/stdio.h (snprintf): Declare.
* mlibc/libc-mes+tcc.c (snprintf): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
ce9f0b12d0
mescc: Tinycc support: strtoul stub.
...
* mlibc/include/stdlib.h (strtoul): Declare.
* mlibc/libc-mes+tcc.c (strtoul): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
5c338ef705
mescc: Tinycc support: memmove stub.
...
* mlibc/include/string.h (memcmp): Declare.
* mlibc/libc-mes+tcc.c (memcmp): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
6c7d26fa1c
mescc: Tinycc support: memset stub.
...
* mlibc/include/string.h (memset): Declare.
* mlibc/libc-mes+tcc.c (memset): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
8f7b47ef36
mescc: Tinycc support: memmove stub.
...
* mlibc/include/string.h (memmove): Declare.
* mlibc/libc-mes+tcc.c (memmove): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
7b8253cd47
mescc: Tinycc support: memcpy stub.
...
* mlibc/include/string.h (memcpy): Declare.
* mlibc/libc-mes+tcc.c (memcpy): Add stub.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
ba6edad975
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.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
ee4471058f
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.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
accf4159a4
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.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
af626da19a
mescc: Naming fix.
...
* stage0/x86.M1 (je8): Rename from jne8.
* module/mes/as-i386.mes (i386:jump-byte-z): Update.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
31758dd03c
mescc: Tinycc support: remove warnings for foo (void), foo (...).
...
* module/language/c99/compiler.mes (.name, .type): Expect foo (void), foo (...).
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
4ec2532ad5
mescc: Tinycc support: multiple statements in default case.
...
* module/language/c99/compiler.mes (clause->info): Support multiple
statements in default case.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
a7a3de05f6
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.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
d1a7527eaf
mescc: Use "tag" for tag namespace.
...
* module/language/c99/compiler.mes: Use "tag" for tag namespace (WAS: "struct").
Move enums to "tag" namespace.
2017-07-26 11:36:44 +02:00
Jan Nieuwenhuizen
5f90fe3919
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.
2017-07-26 11:36:36 +02:00
Jan Nieuwenhuizen
eee7f8cb3c
mescc: Non-Guix support. Thanks rain1!
...
* mlibc/include: Neutralize include guards before #include_next.
Fixes compiling tinycc on Debian GNU/Linux.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
2756dd9071
mescc: Tinycc support: sizeof (struct.field).
...
* module/language/c99/compiler.mes (expr->accu): Support sizeof (struct.field).
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
1d996c7131
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
1c01a65d8b
mescc: Tinycc support: sizeof ("foo").
...
* module/language/c99/compiler.mes (expr->accu): Support sizeof (string).
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
ce3233f998
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):
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
dcce4bae8a
mescc: Tinycc support: generalize neg.
...
* module/language/c99/compiler.mes (expr->accu): Generalize neg.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
fd4f4f87be
mescc: Tinycc support: >>=, <<=.
...
* module/language/c99/compiler.mes (expr->accu): Support >>= <<=.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
b44825a035
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]).
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
3af652a4d0
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
137547afa7
mescc: Tinycc support: *global =.
...
* module/language/c99/compiler.mes (base->ident-address):
Support *global = ...
* scaffold/tests/74-multi-line-string.c: Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
73726b2e27
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
2ab93d7308
mescc: Tinycc support: declare struct tm.
...
* mlibc/include/time.h (struct tm): New type.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
ef4868eb13
mescc: Tinycc support: ignore [ULL], UL, LL, L.
...
* module/language/c99/compiler.mes (cstring->number): Drop suffix.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
eff1e97cdf
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
cccbfe4c61
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
b87cd56376
mescc: Tinycc support: ***parameter.
...
* module/language/c99/compiler.mes (.name): Support ***parameter.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
11fb4e03dc
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
3687740b64
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.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
e8023cd2ef
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?
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
16b9a21712
mescc: Tinycc support: headers.
...
* mlibc/include/string.h (ssize_t): New type.
* mlibc/include/unistd.h (ssize_t): New type.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
8ec7e1225b
mescc: Tinycc support: sizeof struct field.
...
* module/language/c99/compiler.mes (expr->accu): Sizeof struct field.
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
d393785381
mescc: Tinycc support: sizeof typename.
...
* module/language/c99/compiler.mes (expr->accu): Sizeof typename.
2017-07-26 11:36:08 +02:00