Commit Graph

56 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 7f1aaa9914 mlibc: Mescc-tools support: exit stati.
* mlibc/include/stdlib.h (EXIT_FAILURE, EXIT_SUCCESS): New define.
2017-11-19 14:05:33 +01:00
Jan Nieuwenhuizen 26e9dd14e3 mlibc: Tinycc support: support, most syscalls stubbed.
* mlibc/libc-gcc.c (exit, write)[__TINYC__]: tcc-compatible gcc-style
  asm implementation.
  (read,open,access,brk,fsync)[__TINYC__]: Stub body.
* mlibc/libc-gcc+tcc.c (close,unlink, lseek, getcwd)[__TINYC__]: Stub
  body.
* mlibc/libc-mes+tcc.c: Support tinycc.
* mlibc/include/00-test.i (main) [__TINYC__]: Support tcc.
2017-11-16 22:11:07 +01:00
Jan Nieuwenhuizen 6a16258f78 mlibc: errno.h: declare errno without extern.
* mlibc/include/errno.h: drop extern.  Fixes tcc compile.
2017-11-11 13:42:42 +01:00
Jan Nieuwenhuizen 21e9bf833c mescc: Tinycc support: stdint.h: declare size_t.
* mlibc/include/stdint.h (size_t)[!__MES_SIZE_T]: Declare.
2017-08-27 11:29:07 +02:00
Jan Nieuwenhuizen 69073e1954 mescc: Tinycc support: pointer arithmetic with pointer-variable.
* 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.
2017-08-26 10:16:53 +02:00
Jan Nieuwenhuizen 93714ad0a4 mescc: Tinycc support: strtoull.
* mlibc/include/mlibc.h (_atoi): Declare.
* mlibc/include/ctype.h (isxdigit): Declare.
* mlibc/libc-gcc.c (isxdigit, _atoi): New function.
  (atoi): Use it.
* mlibc/libc-mes.c (isxdigit, _atoi): New function.
  (atoi): Use it.
* scaffold/tests/7j-strtoull.c (test): Test it.
* make.scm (add-scaffold-test): Build it.
2017-08-19 10:51:24 +02:00
Jan Nieuwenhuizen 70e3e83581 mescc: Tinycc support: snprintf.
* mlibc/include/stdarg.h (vsprintf): Declare.
* mlibc/libc-gcc.c (vsprintf): New function.
  (sprintf): Use it.
* mlibc/libc-mes+tcc.c (snprintf): Implement.
* mlibc/libc-mes.c (vsprintf): New function
  (sprintf): Use it.
2017-08-12 17:38:44 +02:00
Jan Nieuwenhuizen 5230ddc93b mescc: Fix compile warnings.
* mlibc/include/stdio.h (fdputs): Declare.
* mlibc/libc-gcc.c (malloc):
  (memcpy): Fix compile warning.
2017-08-10 21:00:22 +02:00
Jan Nieuwenhuizen e616d6120b mescc: Tinycc support: eputc.
* mlibc/include/stdio.h (eputc): Declare.
* mlibc/libc-gcc.c (eputc):
* mlibc/libc-mes.c (eputc): New function.
2017-08-06 13:53:56 +02:00
Jan Nieuwenhuizen 513180eb2c mescc: Tinycc support: eputs as function for gcc.
* mlibc/libc-gcc.c (eputs)[POSIX]: New function.
* mlibc/include/stdio.h (eputs)[POSIX]: Remove define.
2017-08-06 12:16:34 +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 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 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