Commit Graph

28 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 338010d498
mescc: Mes C Library: Support GNU Sed: Fix ungetc.
* include/sys/resource.h (OPEN_MAX, RLIMIT_NOFILE): New macro.
* lib/libc.c: Add memset.c include.
* lib/libc+tcc.c: Remove memset.c include.
* lib/linux/tcc.c (close):
* lib/mes/fdgetc.c (__ungetc_buf): New global.
(_ungetc_pos, _ungetc_fd, _ungetc_buf): Remove.  Update users.
2019-01-12 22:08:19 +01:00
Jan Nieuwenhuizen 9dbbe334b0
mescc: Mes C Library: Initialize streams in crt1.
* lib/linux/x86-mes-gcc/crt1.c: Initialize streams.
* lib/linux/x86-mes/crt1.c: Likewise.
* lib/linux/x86_64-mes-gcc/crt1.c: Likewise.
* lib/linux/x86_64-mes/crt1.c: Likewise.
* src/mes.c (main): Remove initialization of streams.
2019-01-12 22:01:40 +01:00
Jan Nieuwenhuizen 8b21ff5925
mescc: Mes C Library: Populate with function tests from scaffold.
* .gitignore: Update.
* build-aux/bootstrap.sh.in: Update.
* build-aux/build-mes.sh: Update.
* build-aux/check-mescc.sh: Update.
* lib/tests/assert/50-assert.c: Move from scaffold/tests/50-assert.c.
* lib/tests/dirent/90-readdir.c: Move from scaffold/tests/99-readdir.c.
* lib/tests/dirent/readdir.dir: Move from scaffold/tests/readdir.dir.
* lib/tests/io/90-stat.c: Move from scaffold/tests/92-stat.c.
* lib/tests/mes/30-oputs.c: Move from scaffold/tests/31-oputs.c.
* lib/tests/mes/50-itoa.c: Move from scaffold/tests/51-itoa.c.
* lib/tests/posix/90-unsetenv.c: Move from scaffold/tests/94-unsetenv.c.
* lib/tests/setjmp/80-setjmp.c: Move from scaffold/tests/80-setjmp.c.
* lib/tests/signal/90-signal.c: Move from scaffold/tests/95-signal.c.
* lib/tests/stdio/70-printf-hello.c: Move from scaffold/tests/70-printf-hello.c.
* lib/tests/stdio/70-printf-simple.c: Move from scaffold/tests/70-printf-simple.c.
* lib/tests/stdio/70-printf.c: Move from scaffold/tests/70-printf.c.
* lib/tests/stdio/80-sscanf.c: Move from scaffold/tests/87-sscanf.c.
* lib/tests/stdio/90-fopen-append.c: Move from scaffold/tests/98-fopen.c.
* lib/tests/stdio/90-fopen.c: Move from scaffold/tests/97-fopen.c.
* lib/tests/stdio/90-fread-fwrite.c: Move from scaffold/tests/93-fread-fwrite.c.
* lib/tests/stdio/90-fseek.c: Move from scaffold/tests/91-fseek.c.
* lib/tests/stdlib/50-getenv.c: Move from lib/tests/stdlib/getenv.c.
* lib/tests/stdlib/50-malloc.c: Move from lib/tests/stdlib/malloc.c.
* lib/tests/stdlib/70-strtoull.c: Move from scaffold/tests/7j-strtoull.c.
* lib/tests/stdlib/80-qsort-dupes.c: Move from scaffold/tests/81-qsort-dupes.c.
* lib/tests/stdlib/80-qsort.c: Move from scaffold/tests/81-qsort.c.
* lib/tests/stdlib/90-strtol.c: Move from scaffold/tests/96-strto.c.
* lib/tests/string/30-strlen.c: Move from scaffold/tests/30-strlen.c.
* lib/tests/string/50-strcmp.c: Move from scaffold/tests/51-strcmp.c.
* lib/tests/string/50-strcpy.c: Move from scaffold/tests/53-strcpy.c.
* lib/tests/string/50-strncmp.c: Move from scaffold/tests/51-strncmp.c.
* lib/tests/string/70-strchr.c: Move from scaffold/tests/70-strchr.c.
* lib/tests/string/80-strncpy.c: Move from scaffold/tests/86-strncpy.c.
* lib/tests/string/80-strrchr.c: Move from scaffold/tests/88-strrchr.c.
* lib/tests/string/90-snprintf.c: Move from scaffold/tests/9a-snprintf.c.
* lib/tests/string/90-strpbrk.c: Move from scaffold/tests/90-strpbrk.c.
* lib/tests/string/90-strspn.c: Move from scaffold/tests/90-strspn.c.
2019-01-12 22:01:40 +01:00
Jan Nieuwenhuizen 2e97dc1250
mescc: Move mecmp to libc.
* lib/libc.c: Include mecmp.c.
* lib/libc+tcc.c: Remove mecmp.c include.
2018-11-25 16:09:31 +01:00
Jan Nieuwenhuizen 3e87e9de3c
mescc: Move memchr to libc.
* lib/libc.c: Include memchr.c.
2018-11-16 00:01:18 +01:00
Jan Nieuwenhuizen 3e4a56a05b
mescc: Mes C Library: Explode libc.c.
* lib/libc.c: New file, explode from lib/libc.c.
* lib/posix/execv.c: Likewise.
* lib/posix/isatty.c: Likewise.
* lib/posix/wait.c: Likewise.
* lib/stdio/fgetc.c: Likewise.
* lib/stdio/fputc.c: Likewise.
* lib/stdio/fputs.c: Likewise.
* lib/stdio/getc.c: Likewise.
* lib/stdio/getchar.c: Likewise.
* lib/stdio/putc.c: Likewise.
* lib/stdio/putchar.c: Likewise.
* lib/stdio/ungetc.c: Likewise.
* lib/stdlib/free.c: Likewise.
* lib/stdlib/getenv.c: Likewise.
* lib/stdlib/realloc.c: Likewise.
* lib/stdlib/setenv.c: Likewise.
* lib/string/strcmp.c: Likewise.
* lib/string/strcpy.c: Likewise.
* lib/string/strncmp.c: Likewise.
* lib/libc.c: Include explodings.
2018-08-16 10:50:53 +02:00
Jan Nieuwenhuizen 72cb975213
GNU Mes.
Throughout, make these changes

   Copyright headers: GNU Mes
   First mention of name: GNU Mes
   Website: https://www.gnu.org/software/mes
   Git:     git://git.savannah.gnu.org/mes.git
2018-07-22 14:24:36 +02:00
Jan Nieuwenhuizen 573896cc1c
core: Prepare for the Hurd.
* lib/linux/libc.c: Move from lib/linux.c.
* lib/linux/gcc.c: Move from lib/linux-gcc.c.
* lib/linux/gnu.c: Move from lib/linux+gnu.c.
* lib/linux/libc.c: Move from lib/linux.c.
* lib/linux/mes.c: Move from lib/linux-mes.c.
* lib/linux/mini-gcc.c: Move from lib/linux-mini-gcc.c.
* lib/linux/mini-mes.c: Move from lib/linux-mini-mes.c.
* lib/linux/tcc.c: Move from lib/linux+tcc.c.
* lib/linux/crt0.c: Move from lib/crt0.c.
* lib/linux/crt1.c: Move from lib/crt1.c.
* lib/linux/crti.c: Move from lib/crti.c.
* lib/linux/crtn.c: Move from lib/crtn.c.
* build-aux/build-cc.sh: Update for new layout.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/cc-mes.sh: Likewise.
* build-aux/cc32-mes.sh: Likewise.
* lib/string/argz-count.c: New file taken from GNU C Library,
  relicensed.
* lib/string/argz-extract.c: New file taken from GNU C Library,
  relicensed.
* include/argz.h: New file.
* lib/string/memcpy.c: New file, extract from libc.
* lib/assert/assert.c: Likewise.
2018-06-30 13:11:03 +02:00
Jan Nieuwenhuizen 49bcea84fd
mescc: Debugging oops.
* lib/libc.c (__mes_debug): Oops, wrong direction.
2018-06-17 08:39:31 +02:00
Jan Nieuwenhuizen c2c3554884
mescc: Refactor debug and stub printing.
* lib/libc.c (__mes_debug): New function.  Use it for debug printing
  and in stubs throughout.
2018-06-10 14:07:19 +02:00
Jan Nieuwenhuizen 635dfd03a2
mescc: Support glibc-1.06.4.
* lib/glibc.c: New file.
* lib/libc+gnu.c: Include it.
2018-06-03 18:54:26 +02:00
Jan Nieuwenhuizen de964f3e1f
mescc: Support gcc-2.6.3.
* TODO
2018-06-02 11:41:06 +02:00
Jan Nieuwenhuizen f1efaa0e93
mescc: Support binutils-2.5.1.
* include/stdint.h: #undef types before typedef'ing them.
* include/sys/types.h: Likewise.
* include/string.h (NULL): New define.
* include/stdio.h (BUFSIZ): New define.
2018-05-30 21:55:39 +02:00
Jan Nieuwenhuizen 272b522962
build: Use arch-dir.
* lib/x86-mes: Move from stage0.
* build-aux/build-cc.sh: Create libraries in lib/gcc.  Update users.
* build-aux/build-mes.sh: Create libraries in lib/x86-mes.  Update users.
* build-aux/build-mes-gcc.sh: Rename from build-mlibc.sh.  Create
  libraries in lib/x86-mes-gcc.  Update callers.
* build-aux/cc-mes-gcc.sh: Rename from cc-mlibc.sh.  Update callers.
2018-05-29 20:07:46 +02:00
Jan Nieuwenhuizen 2cda87257a
mlibc: Cleanup. 2018-05-29 18:15:22 +02:00
Jan Nieuwenhuizen 559699969c
mescc: m4 support: WIP 2018-05-27 10:28:30 +02:00
Jan Nieuwenhuizen e4d0298d1b
core: Support fork, waitpid, execve.
* stage0/x86.M1 (SYS_fork, SYS_waitpid, SYS_execve): New define.
* lib/linux-gcc.c (fork, waitpid, execve): New function.
* lib/linux-mes.c (fork, waitpid, execve): New function.
* lib/libc.c (wait): New function.
* include/unistd.h (fork, execve): Declare.
* include/sys/wait.h (waitpid, wait): Declare.
* module/mes/posix.mes (search-path, execlp, system*, waitpid): New function.
* src/posix.c (primitive_fork, execl): New function.
2018-05-24 19:54:42 +02:00
Jeremiah Orians 43a74e382a
mescc: Add fopen.
* lib/libc+tcc.c (fopen)[!POSIX]: Remove stub.
* lib/libc.c (fopen)[!POSIX]: New function.
* AUTHORS: Add Jeremiah.
2018-05-26 16:33:00 -04:00
Jan Nieuwenhuizen 1dedd0ebca
mescc: Fix itoa.
* lib/libc.c (itoa): Use function-static buffer.  Increase to 12 to
  handle INT_MIN.
  (itoab): Likewise.
2018-05-20 08:33:06 +02:00
Jan Nieuwenhuizen 865e72ae8a
core: Fix compile warnings.
* src/posix.c: Include sys/stat.h.
  (chmod): Return cell_unspecified.
* include/stdlib.h: Typo.
2018-04-29 12:02:23 +02:00
Jan Nieuwenhuizen bb45012c39
mes: Add isatty?.
* src/posix.c (isatty_p): New function.
2018-04-22 11:48:38 +02:00
Jan Nieuwenhuizen ece39a9a18
mlibc: Add isatty.
* lib/libc.c (isatty): New function.
* include/unistd.h: Declare it.
2018-04-22 11:47:44 +02:00
Jan Nieuwenhuizen 7cad0671f3
Revert "mlibc: Use memmove in realloc."
This reverts commit f47a21e3cb4814c4a30d10ff59e5c947441725e9.
2018-04-21 13:42:16 +02:00
Jan Nieuwenhuizen 1270c767cd
mlibc: Use memmove in realloc.
* src/libc.c (memmove): New function.
  (realloc): Use it.
* src/libc+tcc.c (memmove): Remove.
2018-04-15 08:13:36 +02:00
Jan Nieuwenhuizen 25907f514c
core: Add isspace.
* include/ctype.h (isspace): Declare.
* lib/libc.c (isspace): New function.
2018-04-10 21:51:15 +02:00
Jan Nieuwenhuizen ad135d3752 doc: Release udpate.
* HACKING: Update.
* INSTALL: Update.
* NEWS: Update.
* README: Update.
* doc/ANNOUNCE-0.12: New file.
* throughout: (janneke) coming out.
2017-11-21 19:22:26 +01:00
Jan Nieuwenhuizen bd82d5988d core: Add setenv.
* lib/libc.c (setenv): New function.
* include/stdlib.h (setenv): Declare it.
* scaffold/tests/61-array.c (test): Test it.
2018-04-07 09:21:51 +02:00
Jan Nieuwenhuizen 808af5001f mlibc: New library layout; remove duplication.
* lib/libc+tcc-gcc.c: New file: Libc bits for GCC from libc-mes+tcc.c.
* lib/libc+tcc-mes.c: New file: Libc bits for MesCC from libc-mes+tcc.c.
* lib/libc+tcc.c: New file: Libc bits from libc-mes+tcc.c.
* lib/libc.c: New file: Merged from libc-mes.c, libc-gcc.c.
  (abtoi): New function: Rename from _atoi.
* lib/linux+tcc-gcc.c: New file:  Linux bits from libc-gcc+tcc.c.
* lib/linux+tcc-mes.c: New file: Linux bits from libc-mes+tcc.c.
* lib/linux-gcc.c: New file: Linux bits from libc-gcc.c.
* lib/linux-mes.c: New file: Linux bits from libc-mes.c.
* lib/mini-libc-gcc.c: New file.
* lib/mini-libc.c: New file: Libc bits from mini-libc-mes.c.
* lib/mini-linux-gcc.c: New file.
* lib/mini-linux-mes.c: New file: Linux bits from mini-libc-mes.c.
* lib/libc-gcc.c: Remove duplication using include now.
* lib/libc-mes.c: Likewise.
* lib/mini-libc-mes.c: Likewise.
* include/stdio.h (puts)[POSIX]: Remomve macro.
  (fputc, fputs)[!POSIX]: New macro.
  (fputc, fputs): Remove declaration.
* scaffold/tests/7j-strtoull.c (strtoull, test): Use abtoi.
* src/lib.c (fputs)[__MESC__]: Remove define.
* guile/guix/make.scm: Update for new library layout.
* make.scm: Likewise.
* build.sh: Likewise.
* install.sh: Likewise.
2017-12-03 13:56:21 +01:00