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.
This commit is contained in:
Jan Nieuwenhuizen 2019-05-29 16:15:12 +02:00
parent 77e75c3142
commit 26e88603d4
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
67 changed files with 175 additions and 176 deletions

View File

@ -98,7 +98,7 @@ CPPFLAGS=${CPPFLAGS-"
-I ${srcdest}include
"}
[ "$with_glibc_p" ] && CPPFLAGS="$CPPFLAGS -D WITH_GLIBC=1"
[ "$with_glibc_p" ] && CPPFLAGS="$CPPFLAGS -D SYSTEM_LIBC=1"
LDFLAGS=${LDFLAGS-"
-v

View File

@ -20,14 +20,14 @@
#ifndef __MES_ALLOCA_H
#define __MES_ALLOCA_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_ALLOCA_H
#include_next <alloca.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
@ -43,6 +43,6 @@ char *alloca (int);
void *alloca (size_t size);
#endif
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_ALLOCA_H

View File

@ -21,14 +21,14 @@
#ifndef __MES_AR_H
#define __MES_AR_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_AR_H
#include_next <ar.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
// Taken from GNU C Library 2.2.5
@ -51,6 +51,6 @@ struct ar_hdr
char ar_fmag[2]; /* Always contains ARFMAG. */
};
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_ARGZ_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_ARGZ_H
#define __MES_ARGZ_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_ARGZ_H
#include_next <argz.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef libc_hidden_def
#define libc_hidden_def(x)
@ -37,6 +37,6 @@
size_t __argz_count (char const *argz, size_t len);
void __argz_extract (char const *argz, size_t len, char **argv);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_ARGZ_H

View File

@ -20,15 +20,15 @@
#ifndef __MES_ASSERT_H
#define __MES_ASSERT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_ASSERT_H
#include_next <assert.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#define assert(x) ((x) ? (void)0 : assert_fail (#x))
void assert_fail (char *s);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_ASSERT_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_CTYPE_H
#define __MES_CTYPE_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_CTYPE_H
#include_next <ctype.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <endian.h>
int isalnum (int c);
@ -45,6 +45,6 @@ int isxdigit (int c);
int tolower (int c);
int toupper (int c);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_CTYPE_H

View File

@ -22,14 +22,14 @@
#ifndef __MES_DIRENT_H
#define __MES_DIRENT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_DIRENT_H
#include_next <dirent.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <dirstream.h>
@ -71,6 +71,6 @@ struct dirent *readdir (DIR * dirp);
/* Rewind DIRP to the beginning of the directory. */
extern void rewinddir (DIR * dirp);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_DIRENT_H

View File

@ -22,14 +22,14 @@
#ifndef __MES_DIRSTREAM_H
#define __MES_DIRSTREAM_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_DIRSTREAM_H
#include_next <dirstream.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <sys/types.h>
@ -50,6 +50,6 @@ struct __dirstream
typedef struct __dirstream DIR;
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_DIRSTREAM_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_DLFCN_H
#define __MES_DLFCN_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_DLFCN_H
#include_next <dlfcn.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#define RTLD_LAZY 0x00001
#define RTLD_NOW 0x00002
@ -39,6 +39,6 @@
void *dlopen (char const *filename, int flags);
int dlclose (void *handle);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_DLFCN_H

View File

@ -20,17 +20,17 @@
#ifndef __MES_ENDIAN_H
#define __MES_ENDIAN_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_ENDIAN_H
#include_next <endian.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_ENDIAN_H

View File

@ -20,13 +20,13 @@
#ifndef __MES_ERRNO_H
#define __MES_ERRNO_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_ERRNO_H
#include_next <errno.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef __MES_ERRNO_T
#define __MES_ERRNO_T 1
@ -65,6 +65,6 @@ extern char *sys_errlist[];
extern int sys_nerr;
#endif // !__MESC__
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_ERRNO_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_FCNTL_H
#define __MES_FCNTL_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_FCNTL_H
#include_next <fcntl.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
// *INDENT-OFF*
#define O_RDONLY 0
@ -53,6 +53,6 @@ int dup2 (int old, int new);
int fcntl (int filedes, int command, ...);
int open (char const *s, int flags, ...);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_FCNTL_H

View File

@ -20,9 +20,9 @@
#ifndef __MES_FEATURES_H
#define __MES_FEATURES_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_FEATURES_H
#include_next <features.h>
#endif // (WITH_GLIBC)
#endif // (SYSTEM_LIBC)
#endif // __MES_FEATURES_H

View File

@ -20,15 +20,15 @@
#ifndef __MES_FLOAT_H
#define __MES_FLOAT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_FLOAT_H
#include_next <float.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#define MIN_EXP -1021
#define DBL_MIN_EXP -1021
#define LDBL_MIN_EXP -1021
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_FLOAT_H

View File

@ -21,14 +21,14 @@
#ifndef __MES_GETOPT_H
#define __MES_GETOPT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_GETOPT_H
#include_next <getopt.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <endian.h>
int isdigit (int);
int isxdigit (int);
@ -57,6 +57,6 @@ int getopt_long (int argc, char *const *argv, char const *options,
int getopt_long_only (int argc, char *const *argv, char const *options,
struct option const *long_options, int *opt_index);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_GETOPT_H

View File

@ -20,15 +20,15 @@
#ifndef __MES_INTTYPES_H
#define __MES_INTTYPES_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_INTTYPES_H
#include_next <inttypes.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <stdint.h>
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_INTTYPES_H

View File

@ -20,15 +20,15 @@
#ifndef __MES_LIBGEN_H
#define __MES_LIBGEN_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_LIBGEN_H
#include_next <libgen.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
char *dirname (char *);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_LIBGEN_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_LIMITS_H
#define __MES_LIMITS_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_LIMITS_H
#include_next <limits.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <stdint.h>
@ -36,6 +36,6 @@
#define PATH_MAX 512
#define _POSIX_OPEN_MAX 16
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_LIMITS_H

View File

@ -77,7 +77,7 @@
#define SYS_getegid 0x6c
#define SYS_getppid 0x6e
// make+WITH_GLIBC
// make+SYSTEM_LIBC
#define SYS_rt_sigprocmask 0x0e
#endif // __MES_LINUX_X86_64_SYSCALL_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_LOCALE_H
#define __MES_LOCALE_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_LOCALE_H
#include_next <locale.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
// *INDENT-OFF*
#ifndef LC_ALL
@ -40,6 +40,6 @@
char *setlocale (int category, char const *locale);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_LOCALE_H

View File

@ -20,13 +20,12 @@
#ifndef __MES_MATH_H
#define __MES_MATH_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_MATH_H
#include_next <math.h>
#else // ! WITH_GLIBC
double ldexp (double x, int exp);
#endif // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
double fabs (double number);
double ldexp (double value, int exponent);
#endif // ! SYSTEM_LIBC
#endif // __MES_MATH_H

View File

@ -20,17 +20,17 @@
#ifndef __MES_MEMORY_H
#define __MES_MEMORY_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_MEMORY_H
#include_next <memory.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <string.h>
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_MEMORY_H

View File

@ -21,7 +21,7 @@
#ifndef __MES_LIB_MINI_H
#define __MES_LIB_MINI_H
#if !WITH_GLIBC
#if !SYSTEM_LIBC
#ifndef _SIZE_T
#define _SIZE_T
@ -83,10 +83,10 @@ int eputs (char const *s);
int puts (char const *s);
int oputs (char const *s);
#if !WITH_GLIBC
#if !SYSTEM_LIBC
size_t strlen (char const *s);
ssize_t _write ();
ssize_t write (int filedes, void const *buffer, size_t size);
#endif // !WITH_GLIBC
#endif // !SYSTEM_LIBC
#endif //__MES_LIB_MINI_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_PWD_H
#define __MES_PWD_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_PWD_H
#include_next <pwd.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
struct passwd
{
@ -39,6 +39,6 @@ struct passwd
struct passwd *getpwuid ();
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_PWD_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_SETJMP_H
#define __MES_SETJMP_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SETJMP_H
#include_next <setjmp.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
typedef struct
{
@ -42,6 +42,6 @@ jmp_buf buf;
void longjmp (jmp_buf env, int val);
int setjmp (jmp_buf env);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SETJMP_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_SIGNAL_H
#define __MES_SIGNAL_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SIGNAL_H
#include_next <signal.h>
#else //! WITH_GLIBC
#else //! SYSTEM_LIBC
typedef long sigset_t;
@ -236,6 +236,6 @@ int sigemptyset (sigset_t * set);
#endif
int sigprocmask (int how, sigset_t const *set, sigset_t * oldset);
#endif //! WITH_GLIBC
#endif //! SYSTEM_LIBC
#endif // __MES_SIGNAL_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_STDARG_H
#define __MES_STDARG_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_STDARG_H
#include_next <stdarg.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <sys/types.h>
@ -43,6 +43,6 @@ int vsprintf (char *str, char const *format, va_list ap);
int vsnprintf (char *str, size_t size, char const *format, va_list ap);
int vsscanf (char const *s, char const *template, va_list ap);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDARG_H

View File

@ -20,17 +20,17 @@
#ifndef __MES_STDBOOL_H
#define __MES_STDBOOL_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_STDBOOL_H
#include_next <stdbool.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
typedef int bool;
#define false 0
#define true 1
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDBOOL_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_STDDEF_H
#define __MES_STDDEF_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_STDDEF_H
#include_next <stddef.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <sys/types.h>
#include <stdint.h>
@ -37,6 +37,6 @@
#endif // !__MESC__
#endif // offsetof
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDDEF_H

View File

@ -21,14 +21,14 @@
#ifndef __MES_STDINT_H
#define __MES_STDINT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_STDINT_H
#include_next <stdint.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#undef unsigned
#undef uint8_t
@ -121,6 +121,6 @@ typedef long ptrdiff_t;
#define SIZE_MAX UINT64_MAX
#endif
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDINT_H

View File

@ -22,14 +22,14 @@
#include <mes/lib.h>
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_STDIO_H
#include_next <stdio.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef _IOFBF
#define _IOFBF 0 /* Fully buffered. */
@ -88,6 +88,6 @@ size_t fread (void *ptr, size_t size, size_t count, FILE * stream);
size_t freadahead (FILE * fp);
size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDIO_H

View File

@ -20,13 +20,13 @@
#ifndef __MES_STDLIB_H
#define __MES_STDLIB_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_STDLIB_H
#include_next <stdlib.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <sys/types.h>
#include <alloca.h>
@ -63,6 +63,6 @@ typedef int (*comparison_fn_t) (void const *, void const *);
void *bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDLIB_H

View File

@ -20,15 +20,15 @@
#ifndef __MES_STDNORETURN_H
#define __MES_STDNORETURN_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_STDNORETURN_H
#include_next <stdnoreturn.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
// whut?
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STDNORETURN_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_STRING_H
#define __MES_STRING_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_STRING_H
#include_next <string.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef NULL
#define NULL 0
@ -69,6 +69,6 @@ char *strupr (char *string);
char *strerror (int errnum);
void perror (char const *message);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_STRING_H

View File

@ -20,9 +20,9 @@
#ifndef __MES_STRINGS_H
#define __MES_STRINGS_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_STRINGS_H
#include_next <strings.h>
#endif // (WITH_GLIBC)
#endif // (SYSTEM_LIBC)
#endif // __MES_STRINGS_H

View File

@ -20,9 +20,9 @@
#ifndef __MES_SYS_CDEFS_H
#define __MES_SYS_CDEFS_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_CDEFS_H
#include_next <sys/cdefs.h>
#endif // (WITH_GLIBC)
#endif // (SYSTEM_LIBC)
#endif // __MES_SYS_CDEFS_H

View File

@ -20,13 +20,13 @@
#ifndef __MES_SYS_DIR_H
#define __MES_SYS_DIR_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_DIR_H
#include_next <sys/dir.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_DIR_H

View File

@ -20,13 +20,13 @@
#ifndef __MES_SYS_FILE_H
#define __MES_SYS_FILE_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_FILE_H
#include_next <sys/file.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_FILE_H

View File

@ -20,16 +20,16 @@
#ifndef __MES_SYS_IOCTL_H
#define __MES_SYS_IOCTL_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_IOCTL_H
#include_next <sys/ioctl.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#define TCGETS 0x5401
#define TCGETA 0x5405
int ioctl (int fd, unsigned long request, ...);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_IOCTL_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_SYS_MMAN_H
#define __MES_SYS_MMAN_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_MMAN_H
#include_next <sys/mman.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef __MES_SIZE_T
#define __MES_SIZE_T
@ -37,7 +37,7 @@ typedef unsigned long size_t;
int mprotect (void *addr, size_t len, int prot);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_MMAN_H

View File

@ -20,12 +20,12 @@
#ifndef __MES_SYS_PARAM_H
#define __MES_SYS_PARAM_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_PARAM_H
#include_next <sys/param.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_PARAM_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_SYS_RESOURCE_H
#define __MES_SYS_RESOURCE_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_RESOURCE_H
#include_next <sys/resource.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <sys/time.h>
@ -55,6 +55,6 @@ struct rusage
int getrusage (int processes, struct rusage *rusage);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_RESOURCE_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_SYS_SELECT_H
#define __MES_SYS_SELECT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_SELECT_H
#include_next <sys/select.h>
#else //! WITH_GLIBC
#else //! SYSTEM_LIBC
typedef int fd_set;
#endif //! WITH_GLIBC
#endif //! SYSTEM_LIBC
#endif // __MES_SYS_SELECT_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_SYS_STAT_H
#define __MES_SYS_STAT_H 1lei
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_STAT_H
#include_next <sys/stat.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <time.h>
#include <sys/types.h>
@ -114,6 +114,6 @@ int stat (char const *file_name, struct stat *buf);
#define S_IRWXG 00070
#define S_IRWXO 00007
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_STAT_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_SYS_TIME_H
#define __MES_SYS_TIME_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_TIME_H
#include_next <sys/time.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
struct timeval
{
@ -51,6 +51,6 @@ struct itimerval
int gettimeofday (struct timeval *tv, struct timezone *tz);
int setitimer (int which, struct itimerval const *new, struct itimerval *old);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_TIME_H

View File

@ -20,9 +20,9 @@
#ifndef __MES_SYS_TIMEB_H
#define __MES_SYS_TIMEB_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_TIMEB_H
#include_next <sys/timeb.h>
#endif // (WITH_GLIBC)
#endif // (SYSTEM_LIBC)
#endif // __MES_SYS_TIMEB_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_SYS_TIMES_H
#define __MES_SYS_TIMES_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_TIMES_H
#include_next <sys/times.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef __MES_CLOCK_T
#define __MES_CLOCK_T
@ -48,6 +48,6 @@ struct tms
clock_t tms_cstime;
};
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_TIMES_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_SYS_TYPES_H
#define __MES_SYS_TYPES_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_TYPES_H
#include_next <sys/types.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#include <endian.h>
@ -135,6 +135,6 @@ typedef long ssize_t;
typedef unsigned uid_t;
#endif
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_TYPES_H

View File

@ -20,9 +20,9 @@
#ifndef __MES_SYS_UCONTEXT_H
#define __MES_SYS_UCONTEXT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_UCONTEXT_H
#include_next <sys/ucontext.h>
#endif // (WITH_GLIBC)
#endif // (SYSTEM_LIBC)
#endif // __MES_SYS_UCONTEXT_H

View File

@ -20,11 +20,11 @@
#ifndef __MES_SYS_USER_H
#define __MES_SYS_USER_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_USER_H
#include_next <sys/user.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
/* These are the 32-bit x86 structures. */
struct user_fpregs_struct
@ -106,6 +106,6 @@ struct user
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
// *INDENT-ON*
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_USER_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_SYS_WAIT_H
#define __MES_SYS_WAIT_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_SYS_WAIT_H
#include_next <sys/wait.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef __MES_PID_T
#define __MES_PID_T
@ -35,6 +35,6 @@ typedef int pid_t;
pid_t waitpid (pid_t pid, int *status_ptr, int options);
pid_t wait (int *status_ptr);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_SYS_WAIT_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_TERMIO_H
#define __MES_TERMIO_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_TERMIO_H
#include_next <termio.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#define TIOCGWINSZ 0x5413
#define TCGETA 0x5405
@ -59,6 +59,6 @@ struct termio
unsigned char c_cc[8];
};
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_TERMIO_H

View File

@ -20,10 +20,10 @@
#ifndef __MES_TIME_H
#define __MES_TIME_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#undef __MES_TIME_H
#include_next <time.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#ifndef __MES_TIME_T
#define __MES_TIME_T 1
@ -62,6 +62,6 @@ struct tm *gmtime (time_t const *time);
time_t time (time_t * tloc);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_TIME_H

View File

@ -20,14 +20,14 @@
#ifndef __MES_UNISTD_H
#define __MES_UNISTD_H 1
#if WITH_GLIBC
#if SYSTEM_LIBC
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#undef __MES_UNISTD_H
#include_next <unistd.h>
#else // ! WITH_GLIBC
#else // ! SYSTEM_LIBC
#if defined (BOOTSTRAP_WITH_POSIX)
#define _POSIX_VERSION 199009L
@ -86,6 +86,6 @@ int unlink (char const *file_name);
ssize_t write (int filedes, void const *buffer, size_t size);
pid_t getpid (void);
#endif // ! WITH_GLIBC
#endif // ! SYSTEM_LIBC
#endif // __MES_UNISTD_H

View File

@ -41,7 +41,7 @@
#include <mes/fdputs.c>
#include <mes/fdungetc.c>
#if WITH_GLIBC
#if SYSTEM_LIBC
#include <fcntl.h>
#include <stdarg.h>
// The Mes C Library defines and initializes these in crt1
@ -62,7 +62,7 @@ mes_open (char const *file_name, int flags, int mask)
#include <mes/eputs.c>
#include <mes/oputs.c>
#else // !WITH_GLIBC
#else // !SYSTEM_LIBC
int
mes_open (char const *file_name, int flags, int mask)
@ -70,7 +70,7 @@ mes_open (char const *file_name, int flags, int mask)
return _open3 (file_name, flags, mask);
}
#endif // !WITH_GLIBC
#endif // !SYSTEM_LIBC
#include <mes/eputc.c>
#include <mes/oputc.c>

View File

@ -27,7 +27,7 @@
int
main ()
{
#if __GNUC__ && __x86_64__ && !WITH_GLIBC
#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
return 0;
#endif
int i = 42;

View File

@ -27,7 +27,7 @@
int
main ()
{
#if __GNUC__ && __x86_64__ && !WITH_GLIBC
#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
return 0;
#endif
char *s = "mes";

View File

@ -26,7 +26,7 @@
int
main ()
{
#if __GNUC__ && __x86_64__ && !WITH_GLIBC
#if __GNUC__ && __x86_64__ && !SYSTEM_LIBC
return 0;
#endif
int i;

View File

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#include <mes/lib.h>

View File

@ -85,7 +85,7 @@
"NULL=0"
"__linux__=1"
"_POSIX_SOURCE=0"
"WITH_GLIBC=0"
"SYSTEM_LIBC=0"
"__STDC__=1"
"__MESC__=1"
,(if mes? "__MESC_MES__=1" "__MESC_MES__=0")

View File

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#include <stdio.h>

View File

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#include <mes/lib.h>

View File

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#include <stdio.h>

View File

@ -26,7 +26,7 @@
char *env[] = { "foo", "bar", "baz", 0 };
#if 0 //!WITH_GLIBC
#if 0 //!SYSTEM_LIBC
#define getenv xgetenv
char *

View File

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#include <mes/lib.h>

View File

@ -30,8 +30,8 @@ rm -f src/strings.h
# GLIBC build
rm -rf out-glibc
mkdir out-glibc
gcc -c -D WITH_GLIBC=1 -I include -I lib -o out-glibc/libmes.o lib/libmes.c
gcc -c -D WITH_GLIBC=1 -D VERSION=\"0.19\" -D MODULEDIR=\"module\" -D PREFIX=\"/usr/local\" -I include -o out-glibc/mes.o src/mes.c
gcc -c -D SYSTEM_LIBC=1 -I include -I lib -o out-glibc/libmes.o lib/libmes.c
gcc -c -D SYSTEM_LIBC=1 -D VERSION=\"0.19\" -D MODULEDIR=\"module\" -D PREFIX=\"/usr/local\" -I include -o out-glibc/mes.o src/mes.c
gcc out-glibc/mes.o out-glibc/libmes.o -o out-glibc/mes
MES_PREFIX=mes out-glibc/mes --help

View File

@ -27,7 +27,7 @@
#include <mes/lib.h>
//#define MES_MINI 1
#if WITH_GLIBC
#if SYSTEM_LIBC
long ARENA_SIZE = 100000000; // 2.3GiB
#else
long ARENA_SIZE = 300000; // 32b: 3MiB, 64b: 6 MiB