Jan Nieuwenhuizen
7e795763f3
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.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
91f9817a44
mescc: Tinycc support: execvp stub.
...
* mlibc/include/unistd.h (execvp): Declare.
* mlibc/libc-mes+tcc.c (execvp): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
8296c8ec2c
mescc: Tinycc support: remove stub.
...
* mlibc/include/stdio.h (remove): Declare.
* mlibc/libc-mes+tcc.c (remove): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
2914b74aa4
mescc: Tinycc support: fread stub.
...
* mlibc/include/stdio.h (fread): Declare.
* mlibc/libc-mes+tcc.c (fread): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
47f0ce1d5c
mescc: Tinycc support: ftell stub.
...
* mlibc/include/stdio.h (ftell): Declare.
* mlibc/libc-mes+tcc.c (ftell): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
019994b8ed
mescc: Tinycc support: fseek stub.
...
* mlibc/include/stdio.h (fseek): Declare.
* mlibc/libc-mes+tcc.c (fseek): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
76e97a9b08
mescc: Tinycc support: fopen stub.
...
* mlibc/include/stdio.h (fopen): Declare.
* mlibc/libc-mes+tcc.c (fopen): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
fd63f744f7
mescc: Tinycc support: strstr stub.
...
* mlibc/include/string.h (strstr): Declare.
* mlibc/libc-mes+tcc.c (strstr): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
d4e9659d19
mescc: Tinycc support: sscanf stub.
...
* mlibc/include/stdio.h (sscanf): Declare.
* mlibc/libc-mes+tcc.c (sscanf): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
cd5536b283
mescc: Tinycc support: longjmp, setjump stub.
...
* mlibc/include/stdarg.h (longjmp, setjmp): Declare.
* mlibc/libc-mes+tcc.c (longjmp, setjmp): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
f711b2f005
mescc: Tinycc support: fflush stub.
...
* mlibc/include/stdio.h (fflush): Declare.
* mlibc/libc-mes+tcc.c (fflush): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
ff16c5a31f
mescc: Tinycc support: vnsprintf stub.
...
* mlibc/include/stdarg.h (vnsprintf): Declare.
* mlibc/libc-mes+tcc.c (vnsprintf): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
8f2c74c1cb
mescc: Tinycc support: free stub.
...
* mlibc/include/stdlib.h (free): Declare.
* mlibc/libc-mes+tcc.c (free): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
60de51241a
mescc: Tinycc support: strrchr stub.
...
* mlibc/include/string.h (strrchr): Declare.
* mlibc/libc-mes+tcc.c (strrchr): Add stub.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen
9f44c4875a
mescc: Tinycc support: strtoll stub.
...
* mlibc/include/stdlib.h (strtoll): Declare.
* mlibc/libc-mes+tcc.c (strtoll): Add stub.
2017-07-26 11:36:45 +02:00
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
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
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
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
94b3c828d3
mescc: Refactor decl.
...
* module/mes/as-i386.mes (i386:mem->base, i386:nop): New functions.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes:
* stage0/x86.M1 (nop,mov____(%edx),%edx,movzbl_(%edx),%edx): New defines.
* scaffold/tests/23-pointer.c: New file.
* scaffold/tests/t.c: New file.
* make.scm: Build them.
* module/language/c99/compiler.mes (init-declr->name): Handle array.
(init-declr->pointer): Likewise.
(ident->accu): Simplify.
(ident->base): Simplify.
(ident-address->base): Typo.
(expr->accu): Simplify.
(decl->info): Simplify.
* mlibc/libc-mes.c (getenv): Remove superfluous statement.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen
64db2eaf7d
test: Split-up Mescc scaffold test.
...
* make.scm (check-scaffold, check-scaffold-tests): New targets.
* mlibc/include/00-test.i: New file.
* mlibc/include/30-test.i: New file.
* mlibc/mini-libc-mes.c (puts): New function.
* scaffold/tests/00-exit-0.c: : New file.
* scaffold/tests/01-return-0.c: : New file.
* scaffold/tests/02-return-1.c: : New file.
* scaffold/tests/03-call.c: : New file.
* scaffold/tests/04-call-0.c: : New file.
* scaffold/tests/05-call-1.c: : New file.
* scaffold/tests/06-call-!1.c: : New file.
* scaffold/tests/10-if-0.c: : New file.
* scaffold/tests/11-if-1.c: : New file.
* scaffold/tests/12-if-==.c: : New file.
* scaffold/tests/13-if-!=.c: : New file.
* scaffold/tests/14-if-goto.c: : New file.
* scaffold/tests/15-if-!f.c: : New file.
* scaffold/tests/16-if-t.c: : New file.
* scaffold/tests/20-while.c: : New file.
* scaffold/tests/21-char[].c: : New file.
* scaffold/tests/22-while-char[].c: : New file.
* scaffold/tests/30-strlen.c: : New file.
* scaffold/tests/31-eputs.c: : New file.
* scaffold/tests/32-compare.c: : New file.
* scaffold/tests/33-and-or.c: : New file.
* scaffold/tests/34-pre-post.c: : New file.
* scaffold/tests/35-compare-char.c: : New file.
* scaffold/tests/36-compare-arithmetic.c: : New file.
* scaffold/tests/37-compare-assign.c: : New file.
* scaffold/tests/38-compare-call.c: : New file.
* scaffold/tests/40-if-else.c: : New file.
* scaffold/tests/41-?.c: : New file.
* scaffold/tests/42-goto-label.c: : New file.
* scaffold/tests/43-for-do-while.c: : New file.
* scaffold/tests/44-switch.c: : New file.
* scaffold/tests/45-void-call.c: : New file.
* scaffold/tests/50-assert.c: : New file.
* scaffold/tests/51-strcmp.c: : New file.
* scaffold/tests/52-itoa.c: : New file.
* scaffold/tests/53-strcpy.c: : New file.
* scaffold/tests/54-argv.c: : New file.
* scaffold/tests/60-math.c: : New file.
* scaffold/tests/61-array.c: : New file.
* scaffold/tests/63-struct-cell.c: : New file.
* scaffold/tests/64-make-cell.c: : New file.
* scaffold/tests/65-read.c: : New file.
* scaffold/tests/66-struct-array.c: : New file.
* scaffold/t.c: Remove.
* scaffold/t-tcc.c: Remove.
2017-07-09 09:24:07 +02:00
Jan Nieuwenhuizen
ebb15c72a3
mescc: Support stdarg.
...
* mlibc/include/stdarg.h (va_list): New type.
(va_start, va_arg, va_end, va_copy): New macro.
(vprintf): New declaration.
* mlibc/libc-mes.c (vprintf): New function.
(printf): Rewrite using vprintf.
* module/language/c99/compiler.mes (expr->accu, expr->accu*): Handle
any array. Limitation: element size must be 4/sizeof (expression).
(make-type): Add value pointer to type.
(type:type, type:size, type:pointer, type:description): New functions.
(ast->info): Handle typedef with pointer.
2017-07-05 18:48:08 +02:00
Jan Nieuwenhuizen
83a43b81b3
mescc: Produce M1 output instead of hex2.
...
Use: ./make.scm [TARGET]
./make.scm check
* stage0/x86.M1: New file.
* mlibc/mini-libc-mes.c (exit, write): Use M1 instead of .byte.
* mlibc/libc-mes.c (_start, exit, read, write, open, access, brk,
fsync, printf): Use M1 instead of .byte.
* module/mes/as-i386.mes: Use M1.
* module/mes/make.scm: New file.
* make.scm: New file.
* guile/guix/records.scm: New File.
* guile/guix/shell-utils.scm: New file.
* module/mes/M1.mes: Rename from hex2.mes.
* module/mes/M1.scm: Rename from hex2.scm.
* scripts/mescc.mes: Update callers.
* guile/mescc.scm: Update callers.
2017-07-02 16:25:14 +02:00
Jan Nieuwenhuizen
03ecebd594
mescc: Add headers for guile:eval.c.
...
* mlibc/include/alloca.h: New file.
* mlibc/include/stdint.h: New file.
* mlibc/include/inttypes.h: Remove definitionss, include stdint.h.
2017-06-18 17:54:33 +02:00
Jan Nieuwenhuizen
cf7211e8a7
mescc: Add headers for 8cc.
...
* mlibc/include/libgen.h: New file.
* mlibc/include/locale.hh: New file.
* mlibc/include/stdbool.h: New file.
* mlibc/include/stdnoreturn.h: New file.
* mlibc/include/time.h: Add time_t.
2017-06-18 16:12:15 +02:00
Jan Nieuwenhuizen
4479540aed
mescc: Put _start at top of mlibc.
...
* mlibc/libc-mes.c (_start): Move to top.
* mlibc/mini-libc-mes.c (_start): Likewise.
* module/mes/elf-util.mes (function-prefix): Update for _start == 0.
(function-offset): Likewise.
2017-06-11 13:01:46 +02:00
Jan Nieuwenhuizen
86b891ecb6
mescc: Bugfix for merging objects.
...
* mlibc/libc-mes.c (main): Declare.
* mlibc/mini-libc-mes.c (g_stdin): Define.
(main): Declare.
* module/language/c99/compiler.mes (alist-add): Thinko. Fixes merging
objects when first declares function of next.
2017-06-05 11:42:15 +02:00
Jan Nieuwenhuizen
4d1df9cbcb
mescc: move include into share/mlibc, allows installing alongside gcc.
...
* mlibc: Rename from libc.
* HACKING: Update for name change.
* make/bin.make: Likewise.
* make/mescc-guile.make: Likewise.
* make/mescc-mes.make: Likewise.
* scaffold/scaffold.make: Likewise.
* make/install.make: Likewise.
(install): Install mlibc into share/mlibc.
2017-06-03 12:27:53 +02:00