Commit graph

41 commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen 6bc6e8354e lib: linux: Add wait4.
* lib/linux/waitpid.c (waitpid): Factor-out wait4 call to...
* lib/linux/wait4.c: ...new file here.
* include/sys/wait.h (wait4): Add prototype.  Include sys/resource.h.
* include/sys/resource.h (struct rusage): Remove gratuitous "int" for
M2-Planet.
* build-aux/configure-lib.sh (libc_SOURCES): Add it.
* kaem.run,
simple.make (M2_SOURCES),
simple.sh: Likewise.  Also add resource.h.
2023-05-03 08:04:32 +02:00
Jan (janneke) Nieuwenhuizen dad460189f kaem.run: Remove --bootstrap-mode.
* include/linux/arm/syscall.h,
include/linux/x86/syscall.h,
include/mes/constants.h: Remove CONSTANTs.
* lib/m2/open.c: Move to...
* lib/linux/open.c: ...here.  Update to make gcc-compatible.
* scaffold/argv.kaem: Update accordingly.
* lib/linux/lseek.c (_leek, lseek): Suport M2-Planet.
* lib/linux/_open3.c (_open3): Fix cast.
* lib/linux/waitpid.c (waitpid): Suport M2-Planet.
* lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT.
* lib/m2/isatty.c (TCGETS): Remove CONSTANT.
* lib/mes/ntoab.c: Support M2-Planet.
* lib/posix/getcwd.c (__getcwd_buf): Remove.
* lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define.
* lib/posix/setenv.c: Likewise.
* lib/stub/__raise.c (SIGABRT): Remove CONSTANT.
* src/core.c (error): Use __M2__ instead of __M2_PLANET__.
* src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define.  Support
non-bootstrap-mode.
* src/symbol.c: Likewise.
* src/vector.c: Likewise.
* src/posix.c: Likewise.
(__raise): Move to...
* include/mes/lib-cc.h (__raise): ...this new file to avoid M2-Planet crash.
* include/sys/types.h: Include it.
* lib/mes/div.c (__raise): Remove prototype.
[__TINYC__ || SYSTEM_LIBC] (__raise): Remove macro.
* include/mes/lib.h (__raise)[SYSTEM_LIBC]: Remove prototype.
* kaem.run: Remove --botstrap-mode.  Update source list accordingly.
* simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode.
* simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list
accordingly.
* include/sys/types.h (EOF): Move to...
* include/mes/lib-cccc.h (EOF): ...here, and...
* include/m2/types.h (EOF): ...here, to avoid M2-Planet crash.
2023-05-03 08:03:48 +02:00
Jan (janneke) Nieuwenhuizen 4d4e6959e9 kaem: read: Remove --bootstrap-mode.
* include/mes/lib.h[__M2__](__call_at_exit,abtod,dtoab,ultoa,
* include/sys/types.h[__M2__]: Fall back to unsigned instead of using
unsigned long.
* include/stdio.h[__M2__](fprintf, fscanf, printf, snprintf, sprintf,
sscanf): Hide prototypes.
* lib/stdlib/exit.c (exit)[__M2__]: Hide call to __call_at_exit.
* lib/linux/read.c (read)[__M2__]: Hide debugging.
* lib/linux/malloc.c (malloc)[__M2__]: Hide alignment.
__mesabi_umod, __mesabi_udiv, __mesabi_uldiv): Hide prototypes.
* scaffold/argv.kaem: Use them together with lib/mes/lib-mini.h instead of
lib/mes/* specializations.  Remove --bootstrap-mode from M2-Planet call.
2023-05-02 10:22:45 +02:00
Jan (janneke) Nieuwenhuizen bc1fa57851
lib: stat: Use SYS_stat64 for 32bit platforms.
This fixes <https://debbugs.gnu.org/41264>.

* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them.  Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 13:17:58 +02:00
Dor Askayo ce54ccc2c0
Fix definition of S_ISUID.
* include/sys/stat.h (S_ISUID: Append missing zero.
2022-05-09 07:01:01 +02:00
Danny Milosavljevic 096939b819
mescc: define int64_t and uint64_t only if it's possible to define them as
exactly 64 bits.

* include/stdint.h[__SIZEOF_LONG_LONG__ != 8]: Remove typedefs for int64_t,
uint16_t.
2021-01-23 08:43:45 +01:00
Danny Milosavljevic 2b69460894
Prepare header files for ARMv4.
* include/fcntl.h (O_DIRECTORY): Add ARM case.
* include/signal.h (struct sigaction): Add uapi case.
* include/stdint.h: Add ARM case.
* include/sys/stat.h (struct stat): Add ARM case.
2020-06-02 14:37:55 +02:00
Jan Nieuwenhuizen 784838e368
hurd: Initial support.
This adds minimal Hurd support by implementing the _exit function.

* AUTHORS: Update.
* .gitignore: Ignore a.out, core, .config.
* include/sys/wait.h (W_EXITCODE): New define.
* lib/gnu/x86-mes-gcc/crt1.c: New file.
* lib/gnu/x86-mes-gcc/mini.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/_exit.c: New file.
* include/gnu/syscall.h: New file.
* include/gnu/hurd.h: New file.
* lib/gnu/_exit.c: New file.
* lib/gnu/exec-startup-get-data.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/proc-mark-exit.c: New file.
* lib/gnu/syscall.c: New file.
* lib/gnu/task-get-special-port.c: New file.
* lib/gnu/task-terminate.c: New file.
* lib/gnu/vm-statistics.c: New file.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add Hurd sources.
* build-aux/build.sh.in (CPPFLAGS): Add lib to includes, to find linux
crt1.c.
* build-aux/test-c.sh: Always use at least -l c+mini for GNU.
* lib/tests/scaffold/30-exit-42.exit: New file.
* lib/tests/scaffold/30-exit-42.c: New test.
* build-aux/check-mescc.sh (TESTS): Add it.
* lib/tests/scaffold/30-exit-0.c (main): Move from 00-exit-0.c; Rewrite,
use _exit.
* include/gnu/hurd-types.h: Import from GNU C Library.
* include/mach/mach-init.h: Likewise.
* lib/mach/mach-init.c: Likewise.
* lib/mach/mach_host_self.S: Likewise.
* lib/mach/mach_msg_trap.S: Likewise.
* lib/mach/mach_reply_port.S: Likewise.
* lib/mach/mach_task_self.S: Likewise.
* lib/mach/mach_thread_self.S: Likewise.
* lib/mach/msg.c: Likewise.
2019-12-13 21:52:29 +01:00
Jan Nieuwenhuizen 5480c133ae
mescc: Mes C Library: Fix isatty for x86_64.
* lib/linux/ioctl.c (ioctl3): New function.
* include/sys/ioctl.h: Declare it.
* lib/posix/isatty.c (__tcgetattr): Use it.
2019-11-23 21:29:36 +01:00
Jan Nieuwenhuizen d643f923a3
mescc: Mes C Libray: Fix off_t.
* include/sys/types.h (off_t): Drop unsigned.
2019-09-04 17:35:33 +02:00
Jan Nieuwenhuizen 9573f469f8
mescc: Mes C Library: Support GNU Awk: Add wchar_t.
* include/sys/types.h (wchar_t): New typedef.
2019-07-21 13:23:49 +02:00
Jan Nieuwenhuizen b97c59ff21
mescc: Mes C Library: Support GNU Tar: Add creat, mknod.
* include/linux/x86_64/syscall.h (SYS_mknod): New macro.
* include/linux/x86/syscall.h (SYS_mknod): New macro.
* lib/linux/mknod.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it.
* include/sys/stat.h (mknod): Declare it.
* include/fcntl.h (creat): New macro.
2019-07-12 11:56:58 +02:00
Jan Nieuwenhuizen 203ef4944b
mescc: Mes C Library: Support GNU Tar: Add missing defines.
* include/errno.h (ENXIO): New macro.
* include/sys/stat.h (S_IFIFO, S_ISFIFO): New macro.
2019-07-09 11:53:16 +02:00
Danny Milosavljevic 9799e4df2d
Clarify our data type choices in "struct stat".
* include/sys/stat.h: Clarify our data type choices in "struct stat".
2019-06-18 17:37:10 +02:00
Jan Nieuwenhuizen 0904a288c7
mescc: Support tcc: Add intptr_t, uintptr_t.
* include/sys/types.h (intptr_t, uintptr_t): Add typedef.
2019-07-17 22:54:13 +02:00
Jan Nieuwenhuizen 5dc245e739
build: Simplify.
core: Make mes src/ c files separate compilation units.

* include/mes/constants.h: New file.
* include/mes/macros.h: New file.
* include/mes/mes.h: New file.
* src/gc.c: Update.
* src/hash.c: Update.
* src/lib.c: Update.
* src/math.c: Update.
* src/mes.c: Update.
* src/module.c: Update.
* src/posix.c: Update.
* src/reader.c: Update.
* src/string.c: Update.
* src/struct.c: Update.
* src/vector.c: Update.

    mes: Update datadir.

* src/mes.c (g_datadir): New global.
(open_boot): Rename from read_boot.
(read_boot): New function.
* mes/module/mes/boot-0.scm: Move from boot-0.scm.in
* configure: Update.
* configure.sh: Update.

    mescc: Create libraries from separate files.

* .gitignore: Update.
* build-aux/bootstrap-mes.sh: Remove.
* build-aux/bootstrap.sh.in: Remove.
* build-aux/build-guile.sh: Update.
* build-aux/build-mes.sh: Update.
* build-aux/build-scaffold.sh: New file.
* build-aux/build.sh.in: Update.
* build-aux/cc.sh: Update.
* build-aux/check-tcc.sh: Remove.
* build-aux/config.sh.in: New file.
* build-aux/config.sh: Remove.
* build-aux/install.sh.in: Update.
* build-aux/test-boot.sh: New file.
* build-aux/test-c.sh: New file.
* build-aux/test-driver: New file.
* build-aux/test-suite.sh: New file.
* build-aux/trace.sh: Update.
* build-aux/uninstall.sh.in: Update.
* configure: Update.
* configure.sh: Update.
* lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes.
* lib/linux/x86-mes-mescc/mini.c: Likewise.
* lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes.
* lib/linux/x86_64-mes-mescc/mini.c: Likewise.
* lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c.
* lib/linux/x86-mes-mescc/syscall.c: Likewise.
* lib/linux/x86_64-mes-gcc/syscall.c: Likewise.
* lib/linux/x86_64-mes-mescc/syscall.c: Likewise.
* lib/mes/mes_open.c: Include config.h.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* scaffold/gc-test.sh: New file.
* simple.sh: Update.
2019-06-08 15:36:22 +02:00
Jan Nieuwenhuizen 26e88603d4
mescc: Mes C Library: Use SYSTEM_LIBC [WAS: WITH_GLIBC].
Run: sed -i 's,WITH_GLIBC,SYSTEM_LIBC,g' $(git grep -l WITH_GLIBC)

* build-aux/config.sh: Update.
* include/alloca.h: Likewise.
* include/ar.h: Likewise.
* include/argz.h: Likewise.
* include/assert.h: Likewise.
* include/ctype.h: Likewise.
* include/dirent.h: Likewise.
* include/dirstream.h: Likewise.
* include/dlfcn.h: Likewise.
* include/endian.h: Likewise.
* include/errno.h: Likewise.
* include/fcntl.h: Likewise.
* include/features.h: Likewise.
* include/float.h: Likewise.
* include/getopt.h: Likewise.
* include/inttypes.h: Likewise.
* include/libgen.h: Likewise.
* include/limits.h: Likewise.
* include/linux/x86_64/syscall.h: Likewise.
* include/locale.h: Likewise.
* include/math.h: Likewise.
* include/memory.h: Likewise.
* include/mes/lib-mini.h: Likewise.
* include/pwd.h: Likewise.
* include/setjmp.h: Likewise.
* include/signal.h: Likewise.
* include/stdarg.h: Likewise.
* include/stdbool.h: Likewise.
* include/stddef.h: Likewise.
* include/stdint.h: Likewise.
* include/stdio.h: Likewise.
* include/stdlib.h: Likewise.
* include/stdnoreturn.h: Likewise.
* include/string.h: Likewise.
* include/strings.h: Likewise.
* include/sys/cdefs.h: Likewise.
* include/sys/dir.h: Likewise.
* include/sys/file.h: Likewise.
* include/sys/ioctl.h: Likewise.
* include/sys/mman.h: Likewise.
* include/sys/param.h: Likewise.
* include/sys/resource.h: Likewise.
* include/sys/select.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/time.h: Likewise.
* include/sys/timeb.h: Likewise.
* include/sys/times.h: Likewise.
* include/sys/types.h: Likewise.
* include/sys/ucontext.h: Likewise.
* include/sys/user.h: Likewise.
* include/sys/wait.h: Likewise.
* include/termio.h: Likewise.
* include/time.h: Likewise.
* include/unistd.h: Likewise.
* lib/libmes.c: Likewise.
* lib/tests/stdio/70-printf-hello.c: Likewise.
* lib/tests/stdio/70-printf-simple.c: Likewise.
* lib/tests/stdio/80-sscanf.c: Likewise.
* lib/tests/stdlib/50-malloc.c: Likewise.
* module/mescc/preprocess.scm: Likewise.
* scaffold/cons-mes.c: Likewise.
* scaffold/lib/stdlib/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/tests/61-array.c: Likewise.
* scaffold/tiny-mes.c: Likewise.
* simple.sh: Likewise.
* src/mes.c: Likewise.
2019-05-29 16:15:12 +02:00
Jan Nieuwenhuizen c33d6d00bc
mes: Run build-aux/indent.sh.
* src/mes.c: Re-indent.
* src: Likewise.
* include: Likewise.
* lib: Likewise.
* scaffold: Likewise.
2019-05-18 13:27:42 +02:00
Jan Nieuwenhuizen a46c318bb8
mes: Grand indent: prepare.
* build-aux/indent.sh: New file.
* include/mes/builtins.h: Move from src/builtins.h.
* include/fcntl.h: Use // *INDENT-OFF* to prevent indent breakage.
* include/locale.h: Likewise.
* include/signal.h: Likewise.
* include/sys/stat.h: Likewise.
* include/sys/user.h: Likewise.
* lib/linux/x86-mes-gcc/crt0.c: Likewise.
* lib/linux/x86-mes-gcc/crt1.c: Likewise.
* lib/linux/x86-mes-gcc/mes.c: Likewise.
* lib/linux/x86-mes-gcc/mini.c: Likewise.
* lib/linux/x86_64-mes-gcc/crt0.c: Likewise.
* lib/linux/x86_64-mes-gcc/crt1.c: Likewise.
* lib/linux/x86_64-mes-gcc/mes.c: Likewise.
* lib/linux/x86_64-mes-gcc/mini.c: Likewise.
* lib/x86_64-mes-gcc/setjmp.c: Likewise.
* src/mes.c: Likewise.
* src/reader.c: Likewise.
2019-05-13 01:07:32 +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 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 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 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 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 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 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 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 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 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 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 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 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
Jan Nieuwenhuizen 5f7f2c9894
mlibc: Declare chmod.
* include/sys/stat.h (mode_t, chmod): Declare.
2018-04-29 12:01:25 +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 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 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 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