Commit Graph

1133 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen b6375aa016 mescc: Tinycc support: workaround for nyacc "\0" bug.
* module/language/c99/compiler.mes (fix-null): Replace "\nul" with "\0".
  (initzer->data): Use it.
  (expr->global): Use it.
2017-07-28 21:39:39 +02:00
Jan Nieuwenhuizen 03eadd6fa6 mescc: Tinycc support: bugfix foo % bar.
* stage0/x86.M1 (mov____%edx,%ebx): Typo
  (idiv___%ebx): Replace div____%ebx.
* module/mes/as-i386.mes (i386:accu/base): Update.
  (i386:accu%base): Update.
2017-07-28 20:36:21 +02:00
Jan Nieuwenhuizen e102ef94ca mescc: Tinycc support: fix foo[bar]->baz.
* module/language/c99/compiler.mes (expr->accu*): Lose one indirection.
* scaffold/tests/72-typedef-struct-def.c: Test it.
2017-07-29 08:37:34 +02:00
Jan Nieuwenhuizen abd1272a31 mescc: Tinycc support: foo *bar[baz].
* 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.
2017-07-28 18:04:39 +02:00
Jan Nieuwenhuizen 73148c6f78 mescc: Tinycc support: bugfix foo[bar] = baz, with foo*[].
* 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.
2017-07-28 18:00:46 +02:00
Jan Nieuwenhuizen 17e0e0cab7 mescc: Tinycc support: bugfix *foo = bar.
* module/language/c99/compiler.mes (base->ident-address): Typo, fixes (non-char*)*x = y.
* scaffold/tests/77-pointer-assign.c (test): Test it.
2017-07-28 15:45:22 +02:00
Jan Nieuwenhuizen 2e0c1c0aff mescc: Tinycc support: bugfix *(cast)foo = bar.
* 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.
2017-07-28 15:27:25 +02:00
Jan Nieuwenhuizen c7547dfd52 mescc: Tinycc support: pointer arithmetic.
* 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.
2017-07-28 10:40:30 +02:00
Jan Nieuwenhuizen ce980c8239 mescc: Tinycc support: compile tcc with TCC_IS_NATIVE.
* mlibc/include/string.h (strcat): Declare.
* mlibc/libc-mes+tcc.c (dlclose, dlopen, mprotect, sigaction,
  sigemptyset, strcat, vfprintf): Move from libc-gcc+tcc.c.
* mlibc/libc-gcc+tcc.c: Remove them.
* module/language/c99/compiler.mes (c99-input->full-ast): Define __i386__=1.
  (i386:type-alist): Parse `long long int', `unsigned short int',
  `unsigned long long int'.
  (struct-field): Support void**.
  (init-declr->name):
  (init-declr->pointer): Support function declaration.
2017-07-28 08:07:41 +02:00
Jan Nieuwenhuizen 397d7a6c43 mlibc: Tinycc support: gcc -nostdinc -nostdlib.
* mlibc/libc-gcc+tcc.c: New file.
* mlibc/include/dlfcn.h:
* mlibc/include/errno.h:
* mlibc/include/signal.h:
* mlibc/include/sys/mman.h:
* mlibc/include/sys/time.h:  Add tcc declarations.
2017-07-27 23:44:22 +02:00
Jan Nieuwenhuizen ab74876131 mescc: Tinycc support: malloc,memcpy.
* mlibc/libc-mes.c (malloc): Rewrite.
* mlibc/libc-mes+tcc.c (memcpy): Implement.
2017-07-27 18:51:58 +02:00
Jan Nieuwenhuizen ba78b78203 build: support libc-mes+tcc. 2017-07-27 18:41:45 +02:00
Jan Nieuwenhuizen 08ba0fce55 mescc: Tinycc support: memset.
* mlibc/libc-mes+tcc.c (memset): Implement.
2017-07-27 09:08:11 +02:00
Jan Nieuwenhuizen 28f056fdde mescc: bump default maximum for M1-strings to 80.
* module/mes/M1.mes (object->M1): bump default maximum for M1-strings to 80.
2017-08-26 13:40:30 +02:00
Jan Nieuwenhuizen 913fd66e5b mescc: Tinycc support: oops, use new realloc.
* mlibc/libc-mes.c (realloc): Disable naive realloc for libc-mes+tcc.c.
2017-07-27 00:13:39 +02:00
Jan Nieuwenhuizen c52b16daf5 mescc: Bugfix: output M1-strings if possible.
* module/mes/M1.mes (object->M1): Typo.  Also disallow \return in M1-strings.
2017-07-27 00:02:54 +02:00
Jan Nieuwenhuizen 908a4fab97 guix: Release update.
* guix.scm (mes): Update commit, hash and version.
2017-07-26 16:05:11 +02:00
Jan Nieuwenhuizen 06c4857c84 Release 0.9.
* configure (VERSION): Bump to 0.9.
2017-07-26 15:57:38 +02:00
Jan Nieuwenhuizen e1e8f03735 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.9: New file.
* make.scm: Install it.
* guix.scm (mescc-tools): Bump to 0.2.
2017-07-26 15:57:38 +02:00
Jan Nieuwenhuizen 4b1de28449 build: Install and installed-run fixes.
* guile/mescc.scm (%datadir,%docdir,%moduledir,%version): Remove.
* scripts/mescc.mes: Likewise.
* module/language/c99/compiler.mes: Likewise.
 (%prefix): Prefer environment setting.
 (c99-input->full-ast): Remove unnecessary includes.
 Remove unnecessary defines.
* make.scm (%scm-files): Add mes/guile.scm.
 (src/mes.gcc, src/mes.mlibc-gcc, src/mes.guile):  Update  MODULEDIR,
 add -I src.
* src/mes.c (load_env): Use temporary variable for MODULEDIR concatenation.
  (bload_env): Likewise.
2017-07-26 15:57:38 +02:00
Jan Nieuwenhuizen 62e7809725 mescc: Tinycc support: calloc,malloc,realloc.
* mlibc/libc-mes+tcc.c (calloc,malloc,realloc): New function.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen b7cc9d375d mescc: Tinycc support: bugfix struct.array.
* 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.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen d2f701b825 mescc: Tinycc support: bugfix struct pointer.
* module/language/c99/compiler.mes (decl->info): Only set non-pointer struct to -1.
* scaffold/tests/23-pointer.c (test): Test it.
2017-07-26 11:36:45 +02:00
Jan Nieuwenhuizen 10e65b35ce mescc: Tinycc support: more function stack space.
* module/mes/as-i386.mes (function-locals): Increase local space from
  64 (16 vars) to 2*1025 + 80 (20 vars).
2017-07-26 11:36:45 +02:00
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 a13b2ad28c mescc: Tinycc support: function parameters.
* module/language/c99/compiler.mes (.name): Handle function parameters.
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 97164b473d mescc: Tinycc support: jump 32.
* module/mes/as-i386.mes (i386:jump-byte-z): Use jne32 (was: jne8).
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