Commit graph

180 commits

Author SHA1 Message Date
Jan Nieuwenhuizen 8bda737ee4
mescc: Mes C Library: Use mes_open to avoid open trickery.
* include/mes/lib.h (mes_open): Declare.
* lib/libmes.c[WITH_GLIBC]: Remove open undefine.
(mes_open)[!WITH_GLIBC]: New function.
* src/mes.c (open_boot): Use mes_open.
* src/posix.c (open_input_file): Likewise.
(open_output_file): Likewise.
2019-05-13 00:40:33 +02:00
Jan Nieuwenhuizen 3ed82d7010
mescc: Mes C Library: Cleanup includes.
* include/mes/lib-mini.h: Move from include/libmes-mini.h.  Update users.
* include/mes/lib.h: Move from include/libmes.h.  Update users.
2019-05-08 00:25:41 +02:00
Jan Nieuwenhuizen ff32cd03cc
mescc: Mes C Library: 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.
* scaffold/tests/65-read.c: Update.
2019-03-16 11:55:00 +01:00
Jan Nieuwenhuizen 48a0bf181d
build: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.
* build-aux/build-mes.sh: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.
* build-aux/build.sh.in: Likewise.
* build-aux/cc.sh (link): Likewise.
* build-aux/config.make.in (with_glibc_p): Likewise.
* build-aux/config.sh (libc): Likewise.
(CPPFLAGS): Likewise.
* build-aux/config.status.in (with_glibc_p): Likewise.
* build-aux/test.sh: Likewise.
* configure (main): Likewise.
* configure.sh (subst): Likewise.
(mes_arch): Likewise.
* include/libmes.h: Likewise.
* include/linux/x86_64/syscall.h: Likewise.
* lib/libmes.c: Likewise.
* lib/tests/stdio/70-printf-hello.c (main): Likewise.
* lib/tests/stdio/70-printf-simple.c (main): Likewise.
* lib/tests/stdio/80-sscanf.c (main): Likewise.
* lib/tests/stdlib/50-malloc.c: Likewise.
* module/mescc/preprocess.scm (c99-input->full-ast): Likewise.
* scaffold/cons-mes.c: Likewise.
* scaffold/lib/stdlib/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/tests/61-array.c (getenv): Likewise.
* scaffold/tiny-mes.c: Likewise.
* src/mes.c: Likewise.
2019-03-23 21:44:00 +01:00
Jan Nieuwenhuizen 66019c8421
mescc: Mes C Library: Fix compile warnings.
* include/libmes.h (dtoab, itoa, ltoa, ntoab, ultoa, utoa): Return
char* (WAS: char const*).
* lib/*/*c: Update, add missing includes.
2019-03-03 10:04:33 +01:00
Jan Nieuwenhuizen 757d603e4c
mescc: Mes C Library: Use __ as global internal prefix.
* include/libmes-mini.h (g_stdin, g_stdout, g_stderr): Rename to
__stdin, __stdout, __stderr.  Update users.
2019-03-02 12:35:18 +01:00
Jan Nieuwenhuizen c78a087c38
mescc: ctype.h: Add missing prototypes.
* include/ctype.h: Add missing prototypes.
2019-02-28 10:25:37 +01:00
Jan Nieuwenhuizen 5232cfe669
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-02-24 12:31:44 +01:00
Jan Nieuwenhuizen 47d9996079
mescc: Support Bash: Add getppid.
* lib/linux/gnu.c (getppid): New function.
* include/linux/x86/syscall.h (SYS_getppid): New macro.
* include/linux/x86_64/syscall.h (SYS_getppid): New macro.
2018-12-14 18:48:03 +01:00
Jan Nieuwenhuizen 149f2a3e51
core: String as array of bytes.
* src/strings.c: New file.
* src/mes.c: Use it.  Update users.
2018-11-11 16:25:36 +01:00
Jan Nieuwenhuizen 614bfeb3b8
mescc: Compile fixes.
* include/libmes-mini.h[WITH_GLIBC]: Do not declare strlen, write, types.
2018-11-14 13:07:59 +01:00
Jan Nieuwenhuizen 7d2e0f1215
core: Support redirection of stderr.
* include/libmes-mini.h (g_stderr): New global.
* lib/mes/eputc.c (eputc): Use it.
* lib/mes/eputs.c (eputs): Likewise.
* lib/mes/oputc.c (oputc): Likewise.
* lib/mes/oputs.c (oputs): Likewise.
* src/lib.c (display_error_, write_error_): Likewise.
* src/posix.c (write_byte): Likewise.
* src/mes.c (mes_builtins): Likewise.
(main): Iniitalize g_stderr.
* src/posix.c (current_error_port, set_current_error_port): New
function.
* mes/module/mes/boot-0.scm.in (current-output-port,
current-error-port): Remove.
2018-11-11 10:04:03 +01:00
Jan Nieuwenhuizen 68441476e0
mescc: Support GNU make with POSIX.
* include/linux/x86/syscall.h (SYS_sigprocmask): New macro.
* include/linux/x86_64/syscall.h (SYS_rt_sigprocmask): New macro.
* include/signal.h (SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK): New macro.
(sigprocmask): Declare.
* lib/linux/gnu.c (sigprocmask): New function.
2018-11-10 08:32:42 +01:00
Jan Nieuwenhuizen 9ecc11ee52
mescc: Support GNU Bash.
* include/errno.h (EACCES, ENOSPC, ESPIPE): New macro.
* include/linux/x86/syscall.h (SYS_setuid, SYS_geteuid, SYS_getegid,
SYS_setgid): New macro.
* include/linux/x86_64/syscall.h: Likewise.
* include/stdint.h (LLONG_MIN, LLONG_MAX, SIZE_MAX): New macro.
* include/sys/stat.h (S_ISUID, S_ISGID, S_IXGRP, S_IXOTH, S_IRGRP,
S_IROTH, S_IWGRP, S_IWOTH, S_IRWXG, S_IRWXO): New macro.
* include/termio.h: New file.
* include/unistd.h (_POSIX_VERSION): New macro.
* lib/linux/gnu.c (geteuid, getegid, setuid, setgid): New function.
* lib/string/memchr.c: New file.
* lib/stub/getpwuid.c: New file.
* lib/stub/rand.c: New file.
* lib/stub/ttyname.c: New file.
* include/string.h (memchr): Declare.
* include/unistd.h (geteuid, getegid, setuid, setgid): Declare.
2018-11-09 21:26:10 +01:00
Jan Nieuwenhuizen 094bdac0bd
core: Support time functions.
* lib/linux/clock_gettime.c: New file, move from gnu.c.
* lib/linux/gettimeofday.c: New file, move from tcc.c.
* lib/linux/time.c: New file, move from tcc.c.
* lib/linux/libc.c: Include them.
* lib/linux/gnu.c (clock_gettime): Remove.
* lib/linux/tcc.c (time, gettimeofday): Remove.
* include/time.h (CLOCK_PROCESS_CPUTIME_ID): New define.
* src/posix.c (init_time, current_time, gettimeofday_,
seconds_and_nanoseconds_to_long, get_internal_run_time): New function.
* src/mes.c (scm_symbol_internal_time_units_per_second): New symbol.
(main): Call init_time.
2018-10-20 14:18:04 +02:00
Jan Nieuwenhuizen 999642052b
mescc: Mes C Library: oputs: New function.
* lib/mes/oputc.c: New file.
* lib/libmes.c: Include it.
* include/libmes.h: Declare it.
2018-10-15 15:44:47 +02:00
Peter De Wachter 34b265df20
mescc: Add INTn_MIN/MAX defines to stdint.h.
* include/stdint.h: Add INTn_MIN/MAX defines.  Move integere size
defines from limits.h
* include/limits.h: Include it.
2018-10-16 20:40:41 +02:00
Jan Nieuwenhuizen 8f33bb5c4f
mescc: Mes C Library: Fix execve on x86_64.
* include/linux/x86_64/syscall.h (SYS_execve): Typo.  Fixes execve on
x86_64.
2018-10-06 22:38:28 +02:00
Jan Nieuwenhuizen 186d059c38
mescc: Mes C Library: Add ultoa.
* lib/mes/ultoa.c: New file.
* lib/libmes.c: Include it.
* include/libmes.h: Declare ultoa.
2018-10-06 12:02:16 +02:00
Jan Nieuwenhuizen 41f50664c1
mescc: Mes C Library: Add ltoa.
* lib/mes/ltoa.c: New file.
* lib/libmes.c: Include it.
* include/libmes.h: Declare ltoa.
2018-10-06 11:59:20 +02:00
Jan Nieuwenhuizen 7a8a2fc517
mescc: x86_64 support: Refactor to abstracted assembly, add x86_64.
* module/mescc/as.scm: Support abstracted assembly.
* module/mescc/i386/as.scm: Rewrite.
* module/mescc/x86_64/as.scm: Implement.
* module/mescc/compile.scm: Refactor to abstracted assembly.
* module/mescc/M1.scm: Update for partial 64 bit support.
* module/mescc/bytevectors.scm (bytevector-u64-native-set!): New
procedure.
* module/mescc/i386/info.scm (i386:type-alist): Use 4 byte type length
also for faking double, long long, long double.
* module/mescc/info.scm:modified:
* module/mescc/x86_64/info.scm (x86_64:registers): New variable.
* lib/x86-mes/x86.M1: Update for new register scheme.
* lib/x86_64-mes/x86_64.M1: Implement.
* lib/x86-mes/setjmp.c: Implement.
* lib/x86_64-mes-gcc/setjmp.c: Implement.
* build-aux/build-cc.sh: Update for x86_64.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/build-x86_64-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* build-aux/test64.sh: Likewise.
* include/libmes.h: Likewise.
* include/setjmp.h: Likewise.
* include/signal.h: Likewise.
* include/stdarg.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/types.h: Likewise.
* include/sys/wait.h: Likewise.
* include/unistd.h: Likewise.
* lib/libc+gnu.c: Likewise.
* lib/libc+tcc.c: Likewise.
* lib/linux/gnu.c: Likewise.
* lib/linux/libc-mini.c: Likewise.
* lib/linux/libc.c: Likewise.
* lib/linux/tcc.c: Likewise.
* lib/linux/x86_64-mes-gcc/mes.c: Likewise.
* lib/linux/x86_64-mes/crt1.c: Likewise.
* lib/mes/abtol.c: Likewise.
* lib/posix/mktemp.c: Likewise.
* lib/posix/wait.c: Likewise.
* lib/stdio/fopen.c: Likewise.
* lib/stdio/fputc.c: Likewise.
* lib/stdio/fseek.c: Likewise.
* lib/stdio/printf.c: Likewise.
* lib/stdio/sprintf.c: Likewise.
* lib/stdio/vfprintf.c: Likewise.
* lib/stdio/vsprintf.c: Likewise.
* lib/stdio/vsscanf.c: Likewise.
* lib/stdlib/qsort.c: Likewise.
* lib/x86-mes-gcc/setjmp.c: Likewise.
* scaffold/tests/11-if-1.c: Likewise.
* scaffold/tests/15-if-!f.c: Likewise.
* scaffold/tests/16-if-t.c: Likewise.
* scaffold/tests/21-char[].c: Likewise.
* scaffold/tests/23-pointer.c: Likewise.
* scaffold/tests/32-compare.c: Likewise.
* scaffold/tests/33-and-or.c: Likewise.
* scaffold/tests/34-pre-post.c: Likewise.
* scaffold/tests/35-compare-char.c: Likewise.
* scaffold/tests/36-compare-arithmetic.c: Likewise.
* scaffold/tests/37-compare-assign.c: Likewise.
* scaffold/tests/38-compare-call.c: Likewise.
* scaffold/tests/40-if-else.c: Likewise.
* scaffold/tests/41-?.c: Likewise.
* scaffold/tests/42-goto-label.c: Likewise.
* scaffold/tests/43-for-do-while.c: Likewise.
* scaffold/tests/44-switch.c: Likewise.
* scaffold/tests/45-void-call.c: Likewise.
* scaffold/tests/46-function-static.c: Likewise.
* scaffold/tests/51-strcmp.c: Likewise.
* scaffold/tests/51-strncmp.c: Likewise.
* scaffold/tests/53-strcpy.c: Likewise.
* scaffold/tests/54-argv.c: Likewise.
* scaffold/tests/60-math.c: Likewise.
* scaffold/tests/61-array.c: Likewise.
* scaffold/tests/63-struct-cell.c: Likewise.
* scaffold/tests/64-make-cell.c: Likewise.
* scaffold/tests/65-read.c: Likewise.
* scaffold/tests/70-printf.c: Likewise.
* scaffold/tests/71-struct-array.c: Likewise.
* scaffold/tests/72-typedef-struct-def.c: Likewise.
* scaffold/tests/74-multi-line-string.c: Likewise.
* scaffold/tests/76-pointer-arithmetic.c: Likewise.
* scaffold/tests/79-int-array.c: Likewise.
* scaffold/tests/7a-struct-char-array.c: Likewise.
* scaffold/tests/7b-struct-int-array.c: Likewise.
* scaffold/tests/7i-struct-struct.c: Likewise.
* scaffold/tests/7k-for-each-elem.c: Likewise.
* scaffold/tests/7l-struct-any-size-array.c: Likewise.
* scaffold/tests/7o-struct-pre-post.c: Likewise.
* scaffold/tests/7q-bit-field.c: Likewise.
* scaffold/tests/7s-struct-short.c: Likewise.
* scaffold/tests/80-setjmp.c: Likewise.
* scaffold/tests/81-qsort.c: Likewise.
* scaffold/tests/85-sizeof.c: Likewise.
* scaffold/tests/87-sscanf.c: Likewise.
* scaffold/tests/90-strpbrk.c: Likewise.
* scaffold/tests/91-fseek.c: Likewise.
* scaffold/tests/95-signal.c: Likewise.
* scaffold/tests/97-fopen.c: Likewise.
* scaffold/tests/99-readdir.c: Likewise.
* scaffold/tests/t.c: Likewise.
* lib/linux/x86_64-mes/mes.c: New file.
* lib/linux/x86_64-mes/mini.c: New file.
* lib/x86_64-mes/setjmp.c: New file.
* scaffold/tests/06-!call-1.c: New file.
* scaffold/tests/06-call-2.c: New file.
* scaffold/tests/06-call-variable.c: New file.
* scaffold/tests/08-assign-global.c: New file.
* scaffold/tests/08-assign-negative.c: New file.
* scaffold/tests/17-compare-and-or.c: New file.
* scaffold/tests/17-compare-and.c: New file.
* scaffold/tests/17-compare-ge.c: New file.
* scaffold/tests/17-compare-gt.c: New file.
* scaffold/tests/17-compare-le.c: New file.
* scaffold/tests/17-compare-lt.c: New file.
* scaffold/tests/17-compare-or.c: New file.
* scaffold/tests/17-compare-unsigned-ge.c: New file.
* scaffold/tests/17-compare-unsigned-gt.c: New file.
* scaffold/tests/17-compare-unsigned-le.c: New file.
* scaffold/tests/17-compare-unsigned-lt.c: New file.
* scaffold/tests/21-char[]-simple.c: New file.
* scaffold/tests/23-global-pointer-init-null.c: New file.
* scaffold/tests/23-global-pointer-init.c: New file.
* scaffold/tests/23-global-pointer-pointer-ref.c: New file.
* scaffold/tests/23-global-pointer-ref.c: New file.
* scaffold/tests/23-pointer-sub.c: New file.
* scaffold/tests/31-oputs.c: New file.
* scaffold/tests/32-call-wrap.c: New file.
* scaffold/tests/38-compare-call-2.c: New file.
* scaffold/tests/38-compare-call-3.c: New file.
* scaffold/tests/51-pointer-sub.c: New file.
* scaffold/tests/54-argc.c: New file.
* scaffold/tests/63-struct-array-assign.c: New file.
* scaffold/tests/63-struct-array-compare.c: New file.
* scaffold/tests/63-struct-array.c: New file.
* scaffold/tests/63-struct-assign.c: New file.
* scaffold/tests/63-struct-function.c: New file.
* scaffold/tests/63-struct-local.c: New file.
* scaffold/tests/63-struct-pointer.c: New file.
* scaffold/tests/63-struct.c: New file.
* scaffold/tests/70-printf-hello.c: New file.
* scaffold/tests/70-printf-simple.c: New file.
* scaffold/tests/70-stdarg.c: New file.
* scaffold/tests/70-strchr.c: New file.
* scaffold/tests/73-union-hello.c: New file.
* scaffold/tests/76-pointer-arithmetic-pp.c: New file.
* scaffold/tests/79-int-array-simple.c: New file.
* scaffold/tests/7b-struct-int-array-hello.c: New file.
* scaffold/tests/7b-struct-int-array-pointer.c: New file.
* scaffold/tests/7i-struct-struct-simple.c: New file.
* scaffold/tests/7k-for-each-elem-simple.c: New file.
* scaffold/tests/7l-struct-any-size-array-simple.c: New file.
* scaffold/tests/7o-struct-pre-post-simple.c: New file.
* scaffold/tests/7q-bit-field-simple.c: New file.
* scaffold/tests/90-strspn.c: New file.
* scaffold/tests/06-call-string.c.: Rename from 31-eputs.c.
* scaffold/tests/7t-function-destruct.c: Rename from 48-function-destruct.c.
* scaffold/tests/48-global-static.c: Rename from 49-global-static.c.
* scaffold/tests/55-char-array.c:renamed: Rename from 4a-char-array.c.
* scaffold/tests/51-itoa.c:r Rename from 52-itoa.c.
* include/signal.h:(struct sigaction):
2018-08-15 18:26:55 +02:00
Jan Nieuwenhuizen 15e94917f0
mescc: Support gcc-3.0: Locale header fix.
* include/locale.h (LC_ALL, LC_NUMERIC): Numbers, not strings.
(LC_COLLATE, LC_CTYPE): New macro.
2018-09-11 07:01:33 +02:00
Jan Nieuwenhuizen db753e8fee
mescc: Mes C Library: Do not redefine size_t.
* include/stddef.h: Do not redefine size_t.
2018-09-01 16:55:45 +02:00
Jan Nieuwenhuizen ea357f506e
mescc: Mes C Library: Support make 3.80: Add setlocale, sigaddset.
* include/limits.h (ULONG_MAX): New macro.
* include/locale.h (LC_ALL, LC_NUMERIC): New macro.
* lib/stub/setlocale.c: New file.
* lib/stub/sigaddset.c: New file.
* lib/libc+gnu.c: Include them.
2018-08-28 00:45:23 +02:00
Jan Nieuwenhuizen 06e9dd4bce
mescc: Mes C Library: Support make: Implement clock_gettime, time.
* include/linux/x86/syscall.h (SYS_time, SYS_clock_gettime,
SYS_gettimeofday): New macro.
* include/linux/x86_64/syscall.h (SYS_time, SYS_clock_gettime,
SYS_gettimeofday): New macro.
* lib/linux/tcc.c (gettimeofday, time): New function.
* lib/linux/gnu.c (clock_gettime): New function.
* include/time.h: Declare it.
* lib/stub/gettimeofday.c: Remove.
* lib/stub/time.c: Remove.
2018-08-27 00:34:13 +02:00
Jan Nieuwenhuizen 8b9d51e4a4
mescc: Mes C Library: Support make: Add chdir, getlogin, setvbuf, sigblock.
* lib/stub/getlogin.c: New file.
* lib/stub/setvbuf.c: New file.
* lib/stub/sigblock.c: New file.
* lib/libc+gnu.c: Include them.
* include/linux/x86/syscall.h (SYS_chdir): New macro.
* include/linux/x86_64/syscall.h (SYS_chdir): New macro.
* include/stdio.h (_IOFBF, _IOLBF, _IONBF): New macro.
* include/errno.h (ENOEXEC, ECHILD): New macro.
* include/sys/wait.h (WNOHANG): New macro.
* lib/linux/gnu.c (chdir): New function.
* include/ar.h: New file.
2018-08-26 22:41:52 +02:00
Jan Nieuwenhuizen 543ae4df32
mescc: Mes C Library: Support diffutils: Add execl.
* include/limits.h (CHAR_MAX): New macro.
* lib/posix/execl.c: New file.
* include/unistd.h: Declare it.
2018-08-26 20:54:29 +02:00
Jan Nieuwenhuizen fa4ba916ea
mescc: Mes C Library: Add closedir, opendir, readdir.
* include/dirent.h: New file.  Import from glibc-2.2.5.
* include/dirstream.h: Likewise.
* lib/dirent/__getdirentries.c: Likewise.
* lib/dirent/closedir.c: Likewise.
* lib/dirent/readdir.c (readdir): Likewise.
* lib/libc+gnu.c: Include them.
* include/linux/x86/syscall.h (SYS_getdents): New macro.
* include/linux/x86_64/syscall.h (SYS_getdents): Likewise.
* lib/linux/gnu.c (getdents): New function.
* include/limits.h (NAME_MAX): New macro.
* include/fcntl.h (O_DIRECTORY): New macro.
* scaffold/tests/readdir.dir: New directory.
* scaffold/tests/99-readdir.c: New file, use it.
* build-aux/check-mescc.sh (tests): Run it.
2018-08-26 18:34:53 +02:00
Jan Nieuwenhuizen 8545542d71
mescc: Cleanup includes.
* include/libmes-mini.h: New file.
* include/libmes.h: Use it.
2018-08-19 11:17:57 +02:00
Jan Nieuwenhuizen 457d120770
mescc: Mes C Library: Explode libc+gnu.c.
* modified:   include/math.h: Add declarations.
* lib/posix/getopt.c: Rename from lib/getopt.c.
* lib/gcc.c: Remove.
* lib/m4.c: Remove.
* lib/ctype/isalnum.c: New file, explode from libc+gnu.c.
* lib/ctype/isalpha.c: Likewise.
* lib/ctype/isascii.c: Likewise.
* lib/ctype/iscntrl.c: Likewise.
* lib/ctype/isnumber.c: Likewise.
* lib/ctype/isprint.c: Likewise.
* lib/ctype/ispunct.c: Likewise.
* lib/math/fabs.c: Likewise.
* lib/posix/alarm.c: Likewise.
* lib/posix/mktemp.c: Likewise.
* lib/posix/raise.c: Likewise.
* lib/posix/sbrk.c: Likewise.
* lib/posix/sleep.c: Likewise.
* lib/posix/unsetenv.c: Likewise.
* lib/stdio/clearerr.c: Likewise.
* lib/stdio/fdgets.c: Likewise.
* lib/stdio/feof.c: Likewise.
* lib/stdio/fgets.c: Likewise.
* lib/stdio/fileno.c: Likewise.
* lib/stdio/freeopen.c: Likewise.
* lib/stdio/freopen.c: Likewise.
* lib/stdio/perror.c: Likewise.
* lib/stdlib/__exit.c: Likewise.
* lib/stdlib/abs.c: Likewise.
* lib/stdlib/atexit.c: Likewise.
* lib/stdlib/atol.c: Likewise.
* lib/stdlib/bsearch.c: Likewise.
* lib/stdlib/mbstowcs.c: Likewise.
* lib/string/bcmp.c: Likewise.
* lib/string/bcopy.c: Likewise.
* lib/string/bzero.c: Likewise.
* lib/string/index.c: Likewise.
* lib/string/rindex.c: Likewise.
* lib/string/strcspn.c: Likewise.
* lib/string/strdup.c: Likewise.
* lib/string/strerror.c: Likewise.
* lib/string/strncat.c: Likewise.
* lib/string/strpbrk.c: Likewise.
* lib/string/strspn.c: Likewise.
* lib/stub/__cleanup.c: Likewise.
* lib/stub/atof.c: Likewise.
* lib/stub/chown.c: Likewise.
* lib/stub/ctime.c: Likewise.
* lib/stub/fpurge.c: Likewise.
* lib/stub/freadahead.c: Likewise.
* lib/stub/frexp.c: Likewise.
* lib/stub/fscanf.c: Likewise.
* lib/stub/getpwnam.c: Likewise.
* lib/stub/gmtime.c: Likewise.
* lib/stub/pclose.c: Likewise.
* lib/stub/popen.c: Likewise.
* lib/stub/rewind.c: Likewise.
* lib/stub/setbuf.c: Likewise.
* lib/stub/sigsetmask.c: Likewise.
* lib/stub/strftime.c: Likewise.
* lib/stub/sys_siglist.c: Likewise.
* lib/stub/system.c: Likewise.
* lib/stub/times.c: Likewise.
* lib/stub/umask.c: Likewise.
* lib/stub/utime.c: Likewise.
* lib/libc+gnu.c: Include explodings.
* lib/libg.c: Likewise.
* lib/libgetopt.c: Include explodings.
2018-08-24 20:57:34 +02:00
Jan Nieuwenhuizen e9d9e80980
mescc: Mes C Library: Explode libc+tcc.c.
* include/libmes.h: Add declarations.
* include/string.h: Likewise.
* lib/ctype/islower.c: New file, explode from lib/libc+tcc.c.
* lib/ctype/isupper.c: Likewise.
* lib/ctype/tolower.c: Likewise.
* lib/ctype/toupper.c: Likewise.
* lib/mes/search-path.c: Likewise.
* lib/posix/execvp.c: Likewise.
* lib/stdio/fclose.c: Likewise.
* lib/stdio/fdopen.c: Likewise.
* lib/stdio/ferror.c: Likewise.
* lib/stdio/fflush.c: Likewise.
* lib/stdio/fopen.c: Likewise.
* lib/stdio/fprintf.c: Likewise.
* lib/stdio/fread.c: Likewise.
* lib/stdio/fseek.c: Likewise.
* lib/stdio/ftell.c: Likewise.
* lib/stdio/fwrite.c: Likewise.
* lib/stdio/printf.c: Likewise.
* lib/stdio/remove.c: Likewise.
* lib/stdio/snprintf.c: Likewise.
* lib/stdio/sprintf.c: Likewise.
* lib/stdio/sscanf.c: Likewise.
* lib/stdio/vfprintf.c: Likewise.
* lib/stdio/vprintf.c: Likewise.
* lib/stdio/vsnprintf.c: Likewise.
* lib/stdio/vsprintf.c: Likewise.
* lib/stdio/vsscanf.c: Likewise.
* lib/stdlib/calloc.c: Likewise.
* lib/stdlib/qsort.c: Likewise.
* lib/stdlib/strtof.c: Likewise.
* lib/stdlib/strtol.c: Likewise.
* lib/stdlib/strtold.c: Likewise.
* lib/stdlib/strtoll.c: Likewise.
* lib/stdlib/strtoul.c: Likewise.
* lib/stdlib/strtoull.c: Likewise.
* lib/string/memcmp.c: Likewise.
* lib/string/memmem.c: Likewise.
* lib/string/memmove.c: Likewise.
* lib/string/memset.c: Likewise.
* lib/string/strcat.c: Likewise.
* lib/string/strchr.c: Likewise.
* lib/string/strlwr.c: Likewise.
* lib/string/strncpy.c: Likewise.
* lib/string/strrchr.c: Likewise.
* lib/string/strstr.c: Likewise.
* lib/string/strupr.c: Likewise.
* lib/stub/gettimeofday.c: Likewise.
* lib/stub/ldexp.c: Likewise.
* lib/stub/localtime.c: Likewise.
* lib/stub/mprotect.c: Likewise.
* lib/stub/sigaction.c: Likewise.
* lib/stub/sigemptyset.c: Likewise.
* lib/stub/strtod.c: Likewise.
* lib/stub/time.c: Likewise.
* lib/libc+tcc.c: Include explodings.
2018-08-22 07:23:27 +02:00
Jan Nieuwenhuizen a08baf2d48
mescc: Mes C Library: Explode libmes.c.
* include/libmes.h: Add declarations.
* lib/abtol.c: New file, explode from lib/libmes.c.
* lib/ctype/isdigit.c: Likewise.
* lib/ctype/isnumber.c: Likewise.
* lib/ctype/isspace.c: Likewise.
* lib/ctype/isxdigit.c: Likewise.
* lib/mes/abtol.c: Likewise.
* lib/mes/eputc.c: Likewise.
* lib/mes/eputs.c: Likewise.
* lib/mes/fdgetc.c: Likewise.
* lib/mes/fdputc.c: Likewise.
* lib/mes/fdputs.c: Likewise.
* lib/mes/fdungetc.c: Likewise.
* lib/mes/itoa.c: Likewise.
* lib/mes/ltoab.c: Likewise.
* lib/mes/ntoab.c: Likewise.
* lib/mes/utoa.c: Likewise.
* lib/stdlib/atoi.c: Likewise.
* lib/libmes.c: Include explodings.
2018-08-16 11:43:27 +02:00
Jan Nieuwenhuizen 38a7077b72
mescc: Mes C Library: Explode libc-mini.c.
* include/libmes.h: Add declarations.
* lib/mes/eputs.c: New file, explode from lib/libc-mini.c.
* lib/mes/oputs.c: Likewise.
* lib/stdlib/exit.c: Likewise.
* lib/stdlib/puts.c: Likewise.
* lib/string/strlen.c: Likewise.
* lib/libc-mini.c: Include explodings.
2018-08-16 11:07:33 +02:00
Jan Nieuwenhuizen 25047c7606
test: Remove 30-test.i indirection.
* include/30-test.i: Remove.
* scaffold/tests/30-strlen.c: Remove 30-test.i indirection.
* scaffold/tests/31-eputs.c: Likewise.
* scaffold/tests/32-compare.c: Likewise.
* scaffold/tests/33-and-or.c: Likewise.
* scaffold/tests/34-pre-post.c: Likewise.
* scaffold/tests/35-compare-char.c: Likewise.
* scaffold/tests/36-compare-arithmetic.c: Likewise.
* scaffold/tests/37-compare-assign.c: Likewise.
* scaffold/tests/38-compare-call.c: Likewise.
* scaffold/tests/40-if-else.c: Likewise.
* scaffold/tests/41-?.c: Likewise.
* scaffold/tests/42-goto-label.c: Likewise.
* scaffold/tests/43-for-do-while.c: Likewise.
* scaffold/tests/44-switch.c: Likewise.
* scaffold/tests/45-void-call.c: Likewise.
* scaffold/tests/46-function-static.c: Likewise.
* scaffold/tests/50-assert.c: Likewise.
* scaffold/tests/51-strcmp.c: Likewise.
* scaffold/tests/52-itoa.c: Likewise.
* scaffold/tests/53-strcpy.c: Likewise.
* scaffold/tests/60-math.c: Likewise.
* scaffold/tests/63-struct-cell.c: Likewise.
* scaffold/tests/64-make-cell.c: Likewise.
* scaffold/tests/65-read.c: Likewise.
* scaffold/tests/66-local-char-array.c: Likewise.
* scaffold/tests/70-printf.c: Likewise.
* scaffold/tests/71-struct-array.c: Likewise.
* scaffold/tests/72-typedef-struct-def.c: Likewise.
* scaffold/tests/73-union.c: Likewise.
* scaffold/tests/74-multi-line-string.c: Likewise.
* scaffold/tests/75-struct-union.c: Likewise.
* scaffold/tests/76-pointer-arithmetic.c: Likewise.
* scaffold/tests/77-pointer-assign.c: Likewise.
* scaffold/tests/78-union-struct.c: Likewise.
* scaffold/tests/79-int-array.c: Likewise.
* scaffold/tests/7a-struct-char-array.c: Likewise.
* scaffold/tests/7b-struct-int-array.c: Likewise.
* scaffold/tests/7c-dynarray.c: Likewise.
* scaffold/tests/7d-cast-char.c: Likewise.
* scaffold/tests/7e-struct-array-access.c: Likewise.
* scaffold/tests/7f-struct-pointer-arithmetic.c: Likewise.
* scaffold/tests/7g-struct-byte-word-field.c: Likewise.
* scaffold/tests/7h-struct-assign.c: Likewise.
* scaffold/tests/7i-struct-struct.c: Likewise.
* scaffold/tests/7j-strtoull.c: Likewise.
* scaffold/tests/7k-for-each-elem.c: Likewise.
* scaffold/tests/7l-struct-any-size-array.c: Likewise.
* scaffold/tests/7m-struct-char-array-assign.c: Likewise.
* scaffold/tests/7n-struct-struct-array.c: Likewise.
* scaffold/tests/80-setjmp.c: Likewise.
* scaffold/tests/81-qsort.c: Likewise.
* scaffold/tests/86-strncpy.c: Likewise.
* scaffold/tests/87-sscanf.c: Likewise.
2018-08-15 18:01:14 +02:00
Jan Nieuwenhuizen 03e479e30a
test: Remove 00-test.i indirection.
* include/00-test.i: Remove.
* scaffold/tests/01-return-0.c: Remove 00-test.i indirection.
* scaffold/tests/02-return-1.c: Likewise.
* scaffold/tests/03-call.c: Likewise.
* scaffold/tests/04-call-0.c: Likewise.
* scaffold/tests/05-call-1.c: Likewise.
* scaffold/tests/06-call-!1.c: Likewise.
* scaffold/tests/10-if-0.c: Likewise.
* scaffold/tests/11-if-1.c: Likewise.
* scaffold/tests/12-if-==.c: Likewise.
* scaffold/tests/13-if-!=.c: Likewise.
* scaffold/tests/14-if-goto.c: Likewise.
* scaffold/tests/15-if-!f.c: Likewise.
* scaffold/tests/16-if-t.c: Likewise.
* scaffold/tests/20-while.c: Likewise.
* scaffold/tests/21-char[].c: Likewise.
* scaffold/tests/22-while-char[].c: Likewise.
* scaffold/tests/23-pointer.c: Likewise.
2018-08-15 17:27:11 +02:00
Jan Nieuwenhuizen fe055ba344
mescc: Mes C Library: Add x86_64 libc+gnu support.
* include/linux/x86/syscall.h: Move SYS_ defines from gnu.c.
* include/linux/x86_64/syscall.h: Add SYS_ defines for gnu.
* lib/linux/gnu.c: Update.
* lib/linux/gnu.c (signal)[__x86_64__]: Implement using rt_sigaction.
* lib/stdlib/abort.c: Support x86_64.
2018-08-11 19:04:01 +02:00
Jan Nieuwenhuizen 50dff52c99
mescc: Mes C Library: Add x86_64 libc+tcc support.
* include/linux/x86/syscall.h: Move SYS_ defines from tcc.c.
* include/linux/x86_64/syscall.h: Add SYS_ defines for tcc.
* lib/x86-mes-gcc/setjmp.c: Rename from lib/libc+tcc-gcc.c
* lib/x86-mes/setjmp.c: Rename from lib/libc+tcc-mes.c
* lib/linux/tcc.c: Update.
2018-08-11 18:39:48 +02:00
Jan Nieuwenhuizen 5a6d8c21e0
mescc: Mes C Library: Add x86_64 libc support.
* include/linux/x86_64/syscall.h: New file.
* include/linux/x86/syscall.h: New file.
* lib/linux/x86_64-mes-gcc/mes.c: New file.
* lib/linux/x86-mes/mes.c: Rename from lib/linux/mes.c.
* lib/linux/x86-mes-gcc/mes.c: Rename from lib/linux/gcc.c.
* lib/linux/libc.c: Update includes.
(waitpid)[__x86_64__]: Use wait4.
* build-aux/build-cc.sh: Build libc too.
* lib/x86-mes/x86.M1 (mov____0x8(%ebp),%esi): New macro.
2018-08-11 11:42:30 +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 58ca3ab6c0
mescc: Add proper includes.
* include/libmes.h (__mes_debug): Declare.
* lib/libtcc1.c: Add proper includes.
* lib/linux+gnu.c: Likewise.
* lib/m4.c: Likewise.
2018-07-21 11:15:48 +02:00
Jan Nieuwenhuizen 0535630913
core: typo: Remove trailing 1.
* include/alloca.h: typo: Remove trailing 1.
2018-07-21 07:21:31 +02:00
Jan Nieuwenhuizen c2ff5ec954
mescc: Support glibc-2.2.5: header tweaks.
* include/sys/types.h [__PTRDIFF_T]: Extra guard for ptrdiff_t.
  [__SIZE_T]: Extra guard for size_t.
* include/stdlib.h: Include alloca; remove alloca prototype,
* include/errno.h: Add E2BIG.
2018-06-21 00:27:27 +02:00
Jan Nieuwenhuizen 98a8f3f23e
mescc: Support binutils-2.20.1a: header tweaks.
* include/signal.h: Include sys/types.h; remove type declaration copies.
* include/stdarg.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/unistd.h: Likewise.
2018-06-19 20:23:38 +02:00
Jan Nieuwenhuizen 63bf9bb2f7
mescc: Support Tinycc 0.9.27: Drop dlclose, dlopen.
* lib/libc+tcc.c (dlclose, dlopen): Remove.
* include/dlfcn.h (RTLD_DEFAULT): Add.
2018-06-18 22:56:06 +02:00
Jan Nieuwenhuizen 584482fb79
mescc: Add fopen test.
* scaffold/tests/97-fopen.c: New file.
* build-aux/check-mescc.sh (tests): Run it.
* include/unistd.h (link): Declare.
2018-06-16 15:18:27 +02:00
Jan Nieuwenhuizen c349f6fdd8
mescc: Support binutils-2.30.
* lib/binutils.c (raise, strdup): New function.
  (mbstowcs): New stub.
* include/fcntl.h (O_APPEND, FD_CLOEXEC): New define.
2018-06-09 17:58:47 +02:00
Jan Nieuwenhuizen bb3353a272
mescc: Silence some stubs.
* lib/libc+tcc.c: [!NOISY_FLOATS, !NOISY_TIMES]: Silence stubs.
* lib/gcc.c: Likewise.
* lib/binutils.c: Likewise.
2018-06-09 07:40:07 +02:00
Jan Nieuwenhuizen ef0a39547c
mescc: Support gcc-3.0: Implement atexit. 2018-06-07 18:02:21 +02:00
Jan Nieuwenhuizen 93cb6375ae
mescc: Support gcc-3.0: Implement dup2, fcntl, getrusage.
* include/sys/resource.h: New file.
* lib/linux+gnu.c (fcntl, dup2, getrusage): New function.
* lib/binutils.c (fcntl): Remove stub.
2018-06-07 08:02:32 +02:00
Jan Nieuwenhuizen cc466662b9
mescc: Support gcc-3.2: Implement integer strto*.
* lib/libc+tcc.c (strtoll, strtoul): Call strtoul.
2018-06-06 22:39:57 +02:00
Jan Nieuwenhuizen 04302b3fe4
mescc: Support gcc-3.2: Add getpid, signal.
* lib/linux+gnu.c (getpid, signal): New function.
* include/signal.h: Declare signal.
* include/unistd.h: Declare getpid.
* scaffold/tests/95-signal.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-06-06 22:14:35 +02:00
Jan Nieuwenhuizen f4616dfef1
mescc: Support gcc-3.4.0: alloca.
* lib/alloca.c: New file.
* AUTHORS: Mention it.
* lib/libc+gnu.c: Add it.
* include/stdlib.h: Declare alloca.
2018-06-06 19:44:29 +02:00
Jan Nieuwenhuizen f60cac6e1d
mescc: Support gcc-3.4.0: unsetenv.
* lib/gcc.c (unsetenv): New function.
2018-06-06 19:43:32 +02:00
Jan Nieuwenhuizen 0f3856f7b4
mescc: Support gcc-3.2: puts with newline.
* lib/libc-mini.c (oputs): Rename from puts.
  (puts): New function: Add newline.
2018-06-06 15:55:03 +02:00
Jan Nieuwenhuizen eb939b11b8
mescc: Support binutils-2.10.1.
xx
2018-06-06 13:16:25 +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 a3a3654d54
mescc: Implement fflush, sscanf, vsscanf.
* lib/libc+tcc.c (vsscanf): New function.
  (sscanf): Use it.
  (fflush): Remove stub notice; we have no buffering.
* include/stdarg.h: Declare it.
* scaffold/tests/87-sscanf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it.
2018-05-30 21:49:40 +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 cfda148e1e
mescc: Tinycc support: Minimal float support.
* lib/libc+tcc.c (ldexp, strtod, strtof, strtold): New stub.
* include/math.h (ldexp): Declare.
* include/stdlib.h (strtod, strtof, strtold): Declare.
* module/mes/scm.mes (string->number): Minimal float support.
  (inexact->exact): New function.
* tests/math.test ("string->number"): Test it.
* module/language/c99/compiler.mes (ast->type): Handle float type.
  (type->info): Likewise.
  (cstring->int): Rename from cstring->number.  Update callers.
  (cstring->float): New function.
  (expr->accu): Use it.
2018-05-18 15:28:05 +02:00
Jan Nieuwenhuizen 0ba240a4e0
build: Build mini-libc and libc+tcc-gcc too.
* include/getopt.h[__GNUC__ && POSIX]: Only use include_next.
* lib/libc+tcc-gcc.c[POSIX](longjmp, setjmp, __udivdi3, __umoddi3):
  Remove.
* build-aux/build-cc.sh: Build mini-libc-gcc and libc+tcc-gcc too.
* build-aux/build-mlibc.sh: Build mini-libc-gcc too.
2018-05-23 18:41:57 +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 5f7f2c9894
mlibc: Declare chmod.
* include/sys/stat.h (mode_t, chmod): Declare.
2018-04-29 12:01:25 +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 979406f3a6
mlibc: Add ioctl.
* stage0/x86.M1 (SYS_ioctl): New define.
* lib/linux-mes.c (ioctl): New syscall.
* lib/linux-gcc.c (ioctl): New syscall.
* include/sys/ioctl.h: New file.
2018-04-22 11:42:47 +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 49de95fe5d mlibc: M4 support: robustify headers, add sys/signal.h.
* include/errno.h (ERANGE): New define.
* include/stdarg.h (size_t): Undefine before typedef.
* include/stdint.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/sys/types.h: Likewise.
* include/string.h: Likewise.
  (ssize_t): Undefine before typedef.
* include/unistd.h: Likewise.
  (off_t): Undefine before typedef.
* include/sys/stat.h (struct stat): New stub.
* include/sys/signal.h: New file.
2017-12-05 19:49:37 +01:00
Jan Nieuwenhuizen 53695b6124 mlibc: Tinycc support: Avoid hex.
* include/00-test.i (main)[__TINYC__]: Do not use $0x.
2017-12-04 22:58:10 +01: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
Jan Nieuwenhuizen e8884d83e1 mlibc: GNU Gcc support: setjmp, longjmp.
* stage0/x86.M1 (jmp____*%ebx): New macro.
  (mov____0x8(%ebp),%ebp): New macro.
  (mov____0x8(%ebp),%esp): New macro.
* include/setjmp.h (jmp_buf): Redefine as struct.
* lib/libc-mes+tcc.c (longjmp, setjmp): Implement.
* scaffold/tests/80-setjmp.c: Test it.
* make.scm ("80-setjmp"): Build it.
* .gitignore: Ignore *.tcc-guile.
2017-11-26 13:10:46 +01:00
Jan Nieuwenhuizen 83f2a55c2c mlibc: GNU Gcc support: ferror.
* lib/libc-mes+tcc.c (ferror): New function.
* include/stdio.h (ferror): Declare it.
2017-11-25 22:57:18 +01:00
Jan Nieuwenhuizen 0fa18b338d build: mlib/include to include, move mlib to lib.
* include: Move from mlib/include.
* lib: Move from mlib.
* BOOTSTRAP: Update.
* HACKING: Update.
* guile/guix/make.scm: Update.
* make.scm: Update.
* module/language/c99/compiler.mes: Update.
2017-11-22 16:23:48 +01:00