From e19254b50664a2ab71251d66bd5547492df52191 Mon Sep 17 00:00:00 2001 From: nsz Date: Oct 14 2012 02:26:00 +0000 Subject: api: posix header test --- diff --git a/src/api/Makefile b/src/api/Makefile new file mode 100644 index 0000000..a3332b2 --- /dev/null +++ b/src/api/Makefile @@ -0,0 +1,11 @@ +CFLAGS+=-std=c99 -pedantic -Wall -Werror -Wno-unused -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 + +all: + for i in *.c; do \ + $(CC) $(CFLAGS) -c $$i 2>&1; \ + done + $(CC) $(LDFLAGS) -lcrypt -ldl -lm -lpthread -lrt *.o -o main + +clean: + rm -f main *.o + diff --git a/src/api/aio.c b/src/api/aio.c new file mode 100644 index 0000000..95a65a7 --- /dev/null +++ b/src/api/aio.c @@ -0,0 +1,41 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(off_t) +T(pthread_attr_t) +T(size_t) +T(ssize_t) +T(struct timespec) + +{ +struct aiocb x; +F(int, aio_fildes) +F(off_t, aio_offset) +F(volatile void *, aio_buf) +F(size_t, aio_nbytes) +F(int, aio_reqprio) +F(struct sigevent, aio_sigevent) +F(int, aio_lio_opcode) +} + +C(AIO_ALLDONE) +C(AIO_CANCELED) +C(AIO_NOTCANCELED) +C(LIO_NOP) +C(LIO_NOWAIT) +C(LIO_READ) +C(LIO_WAIT) +C(LIO_WRITE) + +int(*p_aio_cancel)(int,struct aiocb*) = aio_cancel; +int(*p_aio_error)(const struct aiocb*) = aio_error; +int(*p_aio_fsync)(int,struct aiocb*) = aio_fsync; +int(*p_aio_read)(struct aiocb*) = aio_read; +ssize_t(*p_aio_return)(struct aiocb*) = aio_return; +int(*p_aio_suspend)(const struct aiocb*const[],int,const struct timespec*) = aio_suspend; +int(*p_aio_write)(struct aiocb*) = aio_write; +int(*p_lio_listio)(int,struct aiocb*restrict const[restrict],int,struct sigevent*restrict) = lio_listio; +} diff --git a/src/api/arpa_inet.c b/src/api/arpa_inet.c new file mode 100644 index 0000000..52b013a --- /dev/null +++ b/src/api/arpa_inet.c @@ -0,0 +1,40 @@ +#include +#define T(t) (t*)0; +#define C(n) switch(n){case n:;} +static void f() +{ +T(in_port_t) +T(in_addr_t) +T(struct in_addr) +T(uint32_t) +T(uint16_t) + +C(INET_ADDRSTRLEN) +C(INET6_ADDRSTRLEN) + +#ifdef htonl +C(htonl(0)) +#else +uint32_t(*p_htonl)(uint32_t) = htonl; +#endif +#ifdef htons +C(htons(0)) +#else +uint16_t(*p_htons)(uint16_t) = htons; +#endif +#ifdef ntohl +C(ntohl(0)) +#else +uint32_t(*p_ntohl)(uint32_t) = ntohl; +#endif +#ifdef ntohs +C(ntohs(0)) +#else +uint16_t(*p_ntohs)(uint16_t) = ntohs; +#endif + +in_addr_t(*p_inet_addr)(const char*) = inet_addr; +char*(*p_inet_ntoa)(struct in_addr) = inet_ntoa; +const char*(*p_inet_ntop)(int,const void*restrict,char*restrict,socklen_t) = inet_ntop; +int(*p_inet_pton)(int,const char*restrict,void*restrict) = inet_pton; +} diff --git a/src/api/assert.c b/src/api/assert.c new file mode 100644 index 0000000..c75ec79 --- /dev/null +++ b/src/api/assert.c @@ -0,0 +1,11 @@ +#include +#ifndef assert +#error no assert +#endif + +#define NDEBUG 1 +#include +#ifndef assert +#error no assert +#endif + diff --git a/src/api/complex.c b/src/api/complex.c new file mode 100644 index 0000000..36351fc --- /dev/null +++ b/src/api/complex.c @@ -0,0 +1,76 @@ +#include +#define T(t) (t*)0; +static void f() +{ +T(float complex) + +{const float complex c = _Complex_I;} +{const float complex c = I;} + +double(*p_cabs)(double complex) = cabs; +float(*p_cabsf)(float complex) = cabsf; +long double(*p_cabsl)(long double complex) = cabsl; +double complex(*p_cacos)(double complex) = cacos; +float complex(*p_cacosf)(float complex) = cacosf; +double complex(*p_cacosh)(double complex) = cacosh; +float complex(*p_cacoshf)(float complex) = cacoshf; +long double complex(*p_cacoshl)(long double complex) = cacoshl; +long double complex(*p_cacosl)(long double complex) = cacosl; +double(*p_carg)(double complex) = carg; +float(*p_cargf)(float complex) = cargf; +long double(*p_cargl)(long double complex) = cargl; +double complex(*p_casin)(double complex) = casin; +float complex(*p_casinf)(float complex) = casinf; +double complex(*p_casinh)(double complex) = casinh; +float complex(*p_casinhf)(float complex) = casinhf; +long double complex(*p_casinhl)(long double complex) = casinhl; +long double complex(*p_casinl)(long double complex) = casinl; +double complex(*p_catan)(double complex) = catan; +float complex(*p_catanf)(float complex) = catanf; +double complex(*p_catanh)(double complex) = catanh; +float complex(*p_catanhf)(float complex) = catanhf; +long double complex(*p_catanhl)(long double complex) = catanhl; +long double complex(*p_catanl)(long double complex) = catanl; +double complex(*p_ccos)(double complex) = ccos; +float complex(*p_ccosf)(float complex) = ccosf; +double complex(*p_ccosh)(double complex) = ccosh; +float complex(*p_ccoshf)(float complex) = ccoshf; +long double complex(*p_ccoshl)(long double complex) = ccoshl; +long double complex(*p_ccosl)(long double complex) = ccosl; +double complex(*p_cexp)(double complex) = cexp; +float complex(*p_cexpf)(float complex) = cexpf; +long double complex(*p_cexpl)(long double complex) = cexpl; +double(*p_cimag)(double complex) = cimag; +float(*p_cimagf)(float complex) = cimagf; +long double(*p_cimagl)(long double complex) = cimagl; +double complex(*p_clog)(double complex) = clog; +float complex(*p_clogf)(float complex) = clogf; +long double complex(*p_clogl)(long double complex) = clogl; +double complex(*p_conj)(double complex) = conj; +float complex(*p_conjf)(float complex) = conjf; +long double complex(*p_conjl)(long double complex) = conjl; +double complex(*p_cpow)(double complex,double complex) = cpow; +float complex(*p_cpowf)(float complex,float complex) = cpowf; +long double complex(*p_cpowl)(long double complex,long double complex) = cpowl; +double complex(*p_cproj)(double complex) = cproj; +float complex(*p_cprojf)(float complex) = cprojf; +long double complex(*p_cprojl)(long double complex) = cprojl; +double(*p_creal)(double complex) = creal; +float(*p_crealf)(float complex) = crealf; +long double(*p_creall)(long double complex) = creall; +double complex(*p_csin)(double complex) = csin; +float complex(*p_csinf)(float complex) = csinf; +double complex(*p_csinh)(double complex) = csinh; +float complex(*p_csinhf)(float complex) = csinhf; +long double complex(*p_csinhl)(long double complex) = csinhl; +long double complex(*p_csinl)(long double complex) = csinl; +double complex(*p_csqrt)(double complex) = csqrt; +float complex(*p_csqrtf)(float complex) = csqrtf; +long double complex(*p_csqrtl)(long double complex) = csqrtl; +double complex(*p_ctan)(double complex) = ctan; +float complex(*p_ctanf)(float complex) = ctanf; +double complex(*p_ctanh)(double complex) = ctanh; +float complex(*p_ctanhf)(float complex) = ctanhf; +long double complex(*p_ctanhl)(long double complex) = ctanhl; +long double complex(*p_ctanl)(long double complex) = ctanl; +} diff --git a/src/api/cpio.c b/src/api/cpio.c new file mode 100644 index 0000000..da2b24e --- /dev/null +++ b/src/api/cpio.c @@ -0,0 +1,26 @@ +#include +#define C(n) switch(n){case n:;} +static void f(){ +C(C_IRUSR) +C(C_IWUSR) +C(C_IXUSR) +C(C_IRGRP) +C(C_IWGRP) +C(C_IXGRP) +C(C_IROTH) +C(C_IWOTH) +C(C_IXOTH) +C(C_ISUID) +C(C_ISGID) +C(C_ISVTX) +C(C_ISDIR) +C(C_ISFIFO) +C(C_ISREG) +C(C_ISBLK) +C(C_ISCHR) +C(C_ISCTG) +C(C_ISLNK) +C(C_ISSOCK) +char *s = MAGIC; +} + diff --git a/src/api/ctype.c b/src/api/ctype.c new file mode 100644 index 0000000..8af509d --- /dev/null +++ b/src/api/ctype.c @@ -0,0 +1,44 @@ +#include +#define T(t) (t*)0; +static void f() +{ +int(*p_isalnum)(int) = isalnum; +int(*p_isalpha)(int) = isalpha; +int(*p_isascii)(int) = isascii; +int(*p_isblank)(int) = isblank; +int(*p_iscntrl)(int) = iscntrl; +int(*p_isdigit)(int) = isdigit; +int(*p_isgraph)(int) = isgraph; +int(*p_islower)(int) = islower; +int(*p_isprint)(int) = isprint; +int(*p_ispunct)(int) = ispunct; +int(*p_isspace)(int) = isspace; +int(*p_isupper)(int) = isupper; +int(*p_isxdigit)(int) = isxdigit; +int(*p_toascii)(int) = toascii; +int(*p_tolower)(int) = tolower; +int(*p_toupper)(int) = toupper; + +#ifdef _POSIX_C_SOURCE +T(locale_t) +int(*p_isalnum_l)(int,locale_t) = isalnum_l; +int(*p_isalpha_l)(int,locale_t) = isalpha_l; +int(*p_isblank_l)(int,locale_t) = isblank_l; +int(*p_iscntrl_l)(int,locale_t) = iscntrl_l; +int(*p_isdigit_l)(int,locale_t) = isdigit_l; +int(*p_isgraph_l)(int,locale_t) = isgraph_l; +int(*p_islower_l)(int,locale_t) = islower_l; +int(*p_isprint_l)(int,locale_t) = isprint_l; +int(*p_ispunct_l)(int,locale_t) = ispunct_l; +int(*p_isspace_l)(int,locale_t) = isspace_l; +int(*p_isupper_l)(int,locale_t) = isupper_l; +int(*p_isxdigit_l)(int,locale_t) = isxdigit_l; +int(*p_tolower_l)(int,locale_t) = tolower_l; +int(*p_toupper_l)(int,locale_t) = toupper_l; +#endif + +#ifdef _XOPEN_SOURCE +int(*p__tolower)(int) = _tolower; +int(*p__toupper)(int) = _toupper; +#endif +} diff --git a/src/api/dirent.c b/src/api/dirent.c new file mode 100644 index 0000000..501c97c --- /dev/null +++ b/src/api/dirent.c @@ -0,0 +1,32 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(DIR) +T(struct dirent) +#ifdef _XOPEN_SOURCE +T(ino_t) +#endif +{ +struct dirent x; +#ifdef _XOPEN_SOURCE +F(ino_t, d_ino) +#endif +F(char, d_name[0]) +} +int(*p_alphasort)(const struct dirent**,const struct dirent**) = alphasort; +int(*p_closedir)(DIR*) = closedir; +int(*p_dirfd)(DIR*) = dirfd; +DIR*(*p_fdopendir)(int) = fdopendir; +DIR*(*p_opendir)(const char*) = opendir; +struct dirent*(*p_readdir)(DIR*) = readdir; +int(*p_readdir_r)(DIR*restrict,struct dirent*restrict,struct dirent**restrict) = readdir_r; +void(*p_rewinddir)(DIR*) = rewinddir; +int(*p_scandir)(const char*,struct dirent***,int(*)(const struct dirent*),int(*)(const struct dirent**,const struct dirent**)) = scandir; +#ifdef _XOPEN_SOURCE +void(*p_seekdir)(DIR*,long) = seekdir; +long(*p_telldir)(DIR*) = telldir; +#endif +} diff --git a/src/api/dlfcn.c b/src/api/dlfcn.c new file mode 100644 index 0000000..a861507 --- /dev/null +++ b/src/api/dlfcn.c @@ -0,0 +1,14 @@ +#include +#define C(n) switch(n){case n:;} +static void f() +{ +C(RTLD_LAZY) +C(RTLD_NOW) +C(RTLD_GLOBAL) +C(RTLD_LOCAL) + +int(*p_dlclose)(void*) = dlclose; +char*(*p_dlerror)(void) = dlerror; +void*(*p_dlopen)(const char*,int) = dlopen; +void*(*p_dlsym)(void*restrict,const char*restrict) = dlsym; +} diff --git a/src/api/errno.c b/src/api/errno.c new file mode 100644 index 0000000..53c29eb --- /dev/null +++ b/src/api/errno.c @@ -0,0 +1,89 @@ +#include +#define C(n) switch(n){case n:;} +static void f() +{ +{int c = errno;} +C(EDOM) +C(EILSEQ) +C(ERANGE) +#ifdef _POSIX_C_SOURCE +C(E2BIG) +C(EACCES) +C(EADDRINUSE) +C(EADDRNOTAVAIL) +C(EAFNOSUPPORT) +C(EAGAIN) +C(EALREADY) +C(EBADF) +C(EBADMSG) +C(EBUSY) +C(ECANCELED) +C(ECHILD) +C(ECONNABORTED) +C(ECONNREFUSED) +C(ECONNRESET) +C(EDEADLK) +C(EDESTADDRREQ) +C(EDQUOT) +C(EEXIST) +C(EFAULT) +C(EFBIG) +C(EHOSTUNREACH) +C(EIDRM) +C(EINPROGRESS) +C(EINTR) +C(EINVAL) +C(EIO) +C(EISCONN) +C(EISDIR) +C(ELOOP) +C(EMFILE) +C(EMLINK) +C(EMSGSIZE) +C(EMULTIHOP) +C(ENAMETOOLONG) +C(ENETDOWN) +C(ENETRESET) +C(ENETUNREACH) +C(ENFILE) +C(ENOBUFS) +C(ENODATA) +C(ENODEV) +C(ENOENT) +C(ENOEXEC) +C(ENOLCK) +C(ENOLINK) +C(ENOMEM) +C(ENOMSG) +C(ENOPROTOOPT) +C(ENOSPC) +C(ENOSR) +C(ENOSTR) +C(ENOSYS) +C(ENOTCONN) +C(ENOTDIR) +C(ENOTEMPTY) +C(ENOTRECOVERABLE) +C(ENOTSOCK) +C(ENOTSUP) +C(ENOTTY) +C(ENXIO) +C(EOPNOTSUPP) +C(EOVERFLOW) +C(EOWNERDEAD) +C(EPERM) +C(EPIPE) +C(EPROTO) +C(EPROTONOSUPPORT) +C(EPROTOTYPE) +C(EROFS) +C(ESPIPE) +C(ESRCH) +C(ESTALE) +C(ETIME) +C(ETIMEDOUT) +C(ETXTBSY) +C(EWOULDBLOCK) +C(EXDEV) +#endif +} diff --git a/src/api/fcntl.c b/src/api/fcntl.c new file mode 100644 index 0000000..ca58523 --- /dev/null +++ b/src/api/fcntl.c @@ -0,0 +1,95 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +C(F_DUPFD) +C(F_DUPFD_CLOEXEC) +C(F_GETFD) +C(F_SETFD) +C(F_GETFL) +C(F_SETFL) +C(F_GETLK) +C(F_SETLK) +C(F_SETLKW) +C(F_GETOWN) +C(F_SETOWN) +C(FD_CLOEXEC) +C(F_RDLCK) +C(F_UNLCK) +C(F_WRLCK) +C(SEEK_SET) +C(SEEK_CUR) +C(SEEK_END) +C(O_CREAT) +C(O_EXCL) +C(O_NOCTTY) +C(O_TRUNC) +C(O_TTY_INIT) +C(O_APPEND) +C(O_DSYNC) +C(O_NONBLOCK) +C(O_RSYNC) +C(O_SYNC) +C(O_ACCMODE) +C(O_EXEC) +C(O_RDONLY) +C(O_RDWR) +C(O_SEARCH) +C(O_WRONLY) +C(S_IRWXU) +C(S_IRUSR) +C(S_IWUSR) +C(S_IXUSR) +C(S_IRWXG) +C(S_IRGRP) +C(S_IWGRP) +C(S_IXGRP) +C(S_IRWXO) +C(S_IROTH) +C(S_IWOTH) +C(S_IXOTH) +C(S_ISUID) +C(S_ISGID) +#ifdef _XOPEN_SOURCE +C(S_ISVTX) +#endif +C(AT_FDCWD) +C(AT_EACCESS) +C(AT_SYMLINK_NOFOLLOW) +C(AT_SYMLINK_FOLLOW) +C(O_CLOEXEC) +C(O_DIRECTORY) +C(O_NOFOLLOW) +C(AT_REMOVEDIR) +C(POSIX_FADV_DONTNEED) +C(POSIX_FADV_NOREUSE) +C(POSIX_FADV_NORMAL) +C(POSIX_FADV_RANDOM) +C(POSIX_FADV_SEQUENTIAL) +C(POSIX_FADV_WILLNEED) + +{ +struct flock x; +F(short, l_type) +F(short, l_whence) +F(off_t, l_start) +F(off_t, l_len) +F(pid_t, l_pid) +} + +T(mode_t) +T(off_t) +T(pid_t) + +int(*p_fcntl)(int,int,...) = fcntl; +int(*p_posix_fadvise)(int,off_t,off_t,int) = posix_fadvise; +int(*p_posix_fallocate)(int,off_t,off_t) = posix_fallocate; +#ifndef _XOPEN_SOURCE +#include +#endif +int(*p_creat)(const char*,mode_t) = creat; +int(*p_open)(const char*,int,...) = open; +int(*p_openat)(int,const char*,int,...) = openat; +} diff --git a/src/api/fenv.c b/src/api/fenv.c new file mode 100644 index 0000000..d489386 --- /dev/null +++ b/src/api/fenv.c @@ -0,0 +1,31 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(fenv_t) +T(fexcept_t) +//FE_DIVBYZERO +//FE_INEXACT +//FE_INVALID +//FE_OVERFLOW +//FE_UNDERFLOW +C(FE_ALL_EXCEPT) +//FE_DOWNWARD +//FE_TONEAREST +//FE_TOWARDZERO +//FE_UPWARD +{const fenv_t *c = FE_DFL_ENV;} +int(*p_feclearexcept)(int) = feclearexcept; +int(*p_fegetenv)(fenv_t*) = fegetenv; +int(*p_fegetexceptflag)(fexcept_t*,int) = fegetexceptflag; +int(*p_fegetround)(void) = fegetround; +int(*p_feholdexcept)(fenv_t*) = feholdexcept; +int(*p_feraiseexcept)(int) = feraiseexcept; +int(*p_fesetenv)(const fenv_t*) = fesetenv; +int(*p_fesetexceptflag)(const fexcept_t*,int) = fesetexceptflag; +int(*p_fesetround)(int) = fesetround; +int(*p_fetestexcept)(int) = fetestexcept; +int(*p_feupdateenv)(const fenv_t*) = feupdateenv; +} diff --git a/src/api/fmtmsg.c b/src/api/fmtmsg.c new file mode 100644 index 0000000..1c79c84 --- /dev/null +++ b/src/api/fmtmsg.c @@ -0,0 +1,27 @@ +#ifdef _XOPEN_SOURCE +#include +#define C(n) switch(n){case n:;} +static void f() +{ +C(MM_HARD) +C(MM_SOFT) +C(MM_FIRM) +C(MM_APPL) +C(MM_UTIL) +C(MM_OPSYS) +C(MM_RECOVER) +C(MM_NRECOV) +C(MM_HALT) +C(MM_ERROR) +C(MM_WARNING) +C(MM_INFO) +C(MM_NOSEV) +C(MM_PRINT) +C(MM_CONSOLE) +C(MM_OK) +C(MM_NOTOK) +C(MM_NOMSG) +C(MM_NOCON) +int(*p_fmtmsg)(long,const char*,int,const char*,const char*,const char*) = fmtmsg; +} +#endif diff --git a/src/api/fnmatch.c b/src/api/fnmatch.c new file mode 100644 index 0000000..e740d79 --- /dev/null +++ b/src/api/fnmatch.c @@ -0,0 +1,10 @@ +#include +#define C(n) switch(n){case n:;} +static void f() +{ +C(FNM_NOMATCH) +C(FNM_PATHNAME) +C(FNM_PERIOD) +C(FNM_NOESCAPE) +int(*p_fnmatch)(const char*,const char*,int) = fnmatch; +} diff --git a/src/api/ftw.c b/src/api/ftw.c new file mode 100644 index 0000000..1c63627 --- /dev/null +++ b/src/api/ftw.c @@ -0,0 +1,76 @@ +#ifdef _XOPEN_SOURCE +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(struct FTW) +T(struct stat) +C(FTW_F) +C(FTW_D) +C(FTW_DNR) +C(FTW_DP) +C(FTW_NS) +C(FTW_SL) +C(FTW_SLN) +C(FTW_PHYS) +C(FTW_MOUNT) +C(FTW_DEPTH) +C(FTW_CHDIR) +C(S_IRWXU) +C(S_IRUSR) +C(S_IWUSR) +C(S_IXUSR) +C(S_IRWXG) +C(S_IRGRP) +C(S_IWGRP) +C(S_IXGRP) +C(S_IRWXO) +C(S_IROTH) +C(S_IWOTH) +C(S_IXOTH) +C(S_ISUID) +C(S_ISGID) +C(S_ISVTX) +C(S_IFMT) +C(S_IFBLK) +C(S_IFCHR) +C(S_IFIFO) +C(S_IFREG) +C(S_IFDIR) +C(S_IFLNK) +C(S_IFSOCK) +C(S_ISBLK(0)) +C(S_ISCHR(0)) +C(S_ISDIR(0)) +C(S_ISFIFO(0)) +C(S_ISREG(0)) +C(S_ISLNK(0)) +C(S_ISSOCK(0)) +{ +struct FTW x; +F(int, base) +F(int, level) +} +{ +struct stat x; +F(dev_t, st_dev) +F(ino_t, st_ino) +F(mode_t, st_mode) +F(nlink_t, st_nlink) +F(uid_t, st_uid) +F(gid_t, st_gid) +F(dev_t, st_rdev) +F(off_t, st_size) +F(struct timespec, st_atim) +F(struct timespec, st_mtim) +F(struct timespec, st_ctim) +F(blksize_t, st_blksize) +F(blkcnt_t, st_blocks) +} +int(*p_ftw)(const char*,int(*)(const char*,const struct stat*,int),int) = ftw; +int(*p_nftw)(const char*,int(*)(const char*,const struct stat*,int,struct FTW*),int,int) = nftw; +} +#endif + diff --git a/src/api/glob.c b/src/api/glob.c new file mode 100644 index 0000000..2e724e4 --- /dev/null +++ b/src/api/glob.c @@ -0,0 +1,27 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(glob_t) +T(size_t) +{ +glob_t x; +F(size_t, gl_pathc) +F(char**, gl_pathv) +F(size_t, gl_offs) +} +C(GLOB_APPEND) +C(GLOB_DOOFFS) +C(GLOB_ERR) +C(GLOB_MARK) +C(GLOB_NOCHECK) +C(GLOB_NOESCAPE) +C(GLOB_NOSORT) +C(GLOB_ABORTED) +C(GLOB_NOMATCH) +C(GLOB_NOSPACE) +int(*p_glob)(const char*restrict,int,int(*)(const char*,int),glob_t*restrict) = glob; +void(*p_globfree)(glob_t*) = globfree; +} diff --git a/src/api/grp.c b/src/api/grp.c new file mode 100644 index 0000000..2149c9e --- /dev/null +++ b/src/api/grp.c @@ -0,0 +1,23 @@ +#include +#define T(t) (t*)0; +#define F(t,n) {t *y = &x.n;} +static void f() +{ +T(gid_t) +T(size_t) +{ +struct group x; +F(char*, gr_name) +F(gid_t, gr_gid) +F(char**, gr_mem) +} +void(*p_endgrent)(void) = endgrent; +struct group*(*p_getgrent)(void) = getgrent; +struct group*(*p_getgrgid)(gid_t) = getgrgid; +int(*p_getgrgid_r)(gid_t,struct group*,char*,size_t,struct group**) = getgrgid_r; +struct group*(*p_getgrnam)(const char*) = getgrnam; +int(*p_getgrnam_r)(const char*,struct group*,char*,size_t,struct group**) = getgrnam_r; +#ifdef _XOPEN_SOURCE +void(*p_setgrent)(void) = setgrent; +#endif +} diff --git a/src/api/iconv.c b/src/api/iconv.c new file mode 100644 index 0000000..966db10 --- /dev/null +++ b/src/api/iconv.c @@ -0,0 +1,10 @@ +#include +#define T(t) (t*)0; +static void f() +{ +T(iconv_t) +T(size_t) +size_t(*p_iconv)(iconv_t,char**restrict,size_t*restrict,char**restrict,size_t*restrict) = iconv; +int(*p_iconv_close)(iconv_t) = iconv_close; +iconv_t(*p_iconv_open)(const char*,const char*) = iconv_open; +} diff --git a/src/api/inttypes.c b/src/api/inttypes.c new file mode 100644 index 0000000..0d00167 --- /dev/null +++ b/src/api/inttypes.c @@ -0,0 +1,260 @@ +#include +#define T(t) (t*)0; +#define S(n) {char s[] = "" n;} +#define C(n) switch(n){case n:;} +static void f() +{ +T(imaxdiv_t) +T(int8_t) +T(int16_t) +T(int32_t) +T(int64_t) +T(uint8_t) +T(uint16_t) +T(uint32_t) +T(uint64_t) +T(int_least8_t) +T(int_least16_t) +T(int_least32_t) +T(int_least64_t) +T(uint_least8_t) +T(uint_least16_t) +T(uint_least32_t) +T(uint_least64_t) +T(int_fast8_t) +T(int_fast16_t) +T(int_fast32_t) +T(int_fast64_t) +T(uint_fast8_t) +T(uint_fast16_t) +T(uint_fast32_t) +T(uint_fast64_t) +#ifdef _XOPEN_SOURCE +T(intptr_t) +T(uintptr_t) +#endif +T(intmax_t) +T(uintmax_t) +C(INT8_MIN) +C(INT16_MIN) +C(INT32_MIN) +C(INT64_MIN) +C(INT8_MAX) +C(INT16_MAX) +C(INT32_MAX) +C(INT64_MAX) +C(UINT8_MAX) +C(UINT16_MAX) +C(UINT32_MAX) +C(UINT64_MAX) +C(INT_LEAST8_MIN) +C(INT_LEAST16_MIN) +C(INT_LEAST32_MIN) +C(INT_LEAST64_MIN) +C(INT_LEAST8_MAX) +C(INT_LEAST16_MAX) +C(INT_LEAST32_MAX) +C(INT_LEAST64_MAX) +C(UINT_LEAST8_MAX) +C(UINT_LEAST16_MAX) +C(UINT_LEAST32_MAX) +C(UINT_LEAST64_MAX) +C(INT_FAST8_MIN) +C(INT_FAST16_MIN) +C(INT_FAST32_MIN) +C(INT_FAST64_MIN) +C(INT_FAST8_MAX) +C(INT_FAST16_MAX) +C(INT_FAST32_MAX) +C(INT_FAST64_MAX) +C(UINT_FAST8_MAX) +C(UINT_FAST16_MAX) +C(UINT_FAST32_MAX) +C(UINT_FAST64_MAX) +C(INTPTR_MIN) +C(INTPTR_MAX) +C(UINTPTR_MAX) +C(INTMAX_MIN) +C(INTMAX_MAX) +C(UINTMAX_MAX) +C(PTRDIFF_MIN) +C(PTRDIFF_MAX) +C(SIG_ATOMIC_MIN) +C(SIG_ATOMIC_MAX) +C(SIZE_MAX) +C(WCHAR_MIN) +C(WCHAR_MAX) +C(WINT_MIN) +C(WINT_MAX) +C(INT8_C(0)) +C(INT16_C(0)) +C(INT32_C(0)) +C(INT64_C(0)) +C(UINT8_C(0)) +C(UINT16_C(0)) +C(UINT32_C(0)) +C(UINT64_C(0)) +C(INTMAX_C(0)) +C(UINTMAX_C(0)) +S(PRId8) +S(PRId16) +S(PRId32) +S(PRId64) +S(PRIdLEAST8) +S(PRIdLEAST16) +S(PRIdLEAST32) +S(PRIdLEAST64) +S(PRIdFAST8) +S(PRIdFAST16) +S(PRIdFAST32) +S(PRIdFAST64) +S(PRIdMAX) +S(PRIdPTR) +S(PRIi8) +S(PRIi16) +S(PRIi32) +S(PRIi64) +S(PRIiLEAST8) +S(PRIiLEAST16) +S(PRIiLEAST32) +S(PRIiLEAST64) +S(PRIiFAST8) +S(PRIiFAST16) +S(PRIiFAST32) +S(PRIiFAST64) +S(PRIiMAX) +S(PRIiPTR) +S(PRIo8) +S(PRIo16) +S(PRIo32) +S(PRIo64) +S(PRIoLEAST8) +S(PRIoLEAST16) +S(PRIoLEAST32) +S(PRIoLEAST64) +S(PRIoFAST8) +S(PRIoFAST16) +S(PRIoFAST32) +S(PRIoFAST64) +S(PRIoMAX) +S(PRIoPTR) +S(PRIu8) +S(PRIu16) +S(PRIu32) +S(PRIu64) +S(PRIuLEAST8) +S(PRIuLEAST16) +S(PRIuLEAST32) +S(PRIuLEAST64) +S(PRIuFAST8) +S(PRIuFAST16) +S(PRIuFAST32) +S(PRIuFAST64) +S(PRIuMAX) +S(PRIuPTR) +S(PRIx8) +S(PRIx16) +S(PRIx32) +S(PRIx64) +S(PRIxLEAST8) +S(PRIxLEAST16) +S(PRIxLEAST32) +S(PRIxLEAST64) +S(PRIxFAST8) +S(PRIxFAST16) +S(PRIxFAST32) +S(PRIxFAST64) +S(PRIxMAX) +S(PRIxPTR) +S(PRIX8) +S(PRIX16) +S(PRIX32) +S(PRIX64) +S(PRIXLEAST8) +S(PRIXLEAST16) +S(PRIXLEAST32) +S(PRIXLEAST64) +S(PRIXFAST8) +S(PRIXFAST16) +S(PRIXFAST32) +S(PRIXFAST64) +S(PRIXMAX) +S(PRIXPTR) +S(SCNd8) +S(SCNd16) +S(SCNd32) +S(SCNd64) +S(SCNdLEAST8) +S(SCNdLEAST16) +S(SCNdLEAST32) +S(SCNdLEAST64) +S(SCNdFAST8) +S(SCNdFAST16) +S(SCNdFAST32) +S(SCNdFAST64) +S(SCNdMAX) +S(SCNdPTR) +S(SCNi8) +S(SCNi16) +S(SCNi32) +S(SCNi64) +S(SCNiLEAST8) +S(SCNiLEAST16) +S(SCNiLEAST32) +S(SCNiLEAST64) +S(SCNiFAST8) +S(SCNiFAST16) +S(SCNiFAST32) +S(SCNiFAST64) +S(SCNiMAX) +S(SCNiPTR) +S(SCNo8) +S(SCNo16) +S(SCNo32) +S(SCNo64) +S(SCNoLEAST8) +S(SCNoLEAST16) +S(SCNoLEAST32) +S(SCNoLEAST64) +S(SCNoFAST8) +S(SCNoFAST16) +S(SCNoFAST32) +S(SCNoFAST64) +S(SCNoMAX) +S(SCNoPTR) +S(SCNu8) +S(SCNu16) +S(SCNu32) +S(SCNu64) +S(SCNuLEAST8) +S(SCNuLEAST16) +S(SCNuLEAST32) +S(SCNuLEAST64) +S(SCNuFAST8) +S(SCNuFAST16) +S(SCNuFAST32) +S(SCNuFAST64) +S(SCNuMAX) +S(SCNuPTR) +S(SCNx8) +S(SCNx16) +S(SCNx32) +S(SCNx64) +S(SCNxLEAST8) +S(SCNxLEAST16) +S(SCNxLEAST32) +S(SCNxLEAST64) +S(SCNxFAST8) +S(SCNxFAST16) +S(SCNxFAST32) +S(SCNxFAST64) +S(SCNxMAX) +S(SCNxPTR) +intmax_t(*p_imaxabs)(intmax_t) = imaxabs; +imaxdiv_t(*p_imaxdiv)(intmax_t,intmax_t) = imaxdiv; +intmax_t(*p_strtoimax)(const char*restrict,char**restrict,int) = strtoimax; +uintmax_t(*p_strtoumax)(const char*restrict,char**restrict,int) = strtoumax; +#include +intmax_t(*p_wcstoimax)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoimax; +uintmax_t(*p_wcstoumax)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoumax; +} diff --git a/src/api/main.c b/src/api/main.c new file mode 100644 index 0000000..237c8ce --- /dev/null +++ b/src/api/main.c @@ -0,0 +1 @@ +int main() {} diff --git a/src/api/stdint.c b/src/api/stdint.c new file mode 100644 index 0000000..28c3b01 --- /dev/null +++ b/src/api/stdint.c @@ -0,0 +1,97 @@ +#include +#define T(t) (t*)0; +#define C(n) switch(n){case n:;} +static void f() +{ +T(int8_t) +T(int16_t) +T(int32_t) +T(int64_t) +T(uint8_t) +T(uint16_t) +T(uint32_t) +T(uint64_t) +T(int_least8_t) +T(int_least16_t) +T(int_least32_t) +T(int_least64_t) +T(uint_least8_t) +T(uint_least16_t) +T(uint_least32_t) +T(uint_least64_t) +T(int_fast8_t) +T(int_fast16_t) +T(int_fast32_t) +T(int_fast64_t) +T(uint_fast8_t) +T(uint_fast16_t) +T(uint_fast32_t) +T(uint_fast64_t) +#ifdef _XOPEN_SOURCE +T(intptr_t) +T(uintptr_t) +#endif +T(intmax_t) +T(uintmax_t) +C(INT8_MIN) +C(INT16_MIN) +C(INT32_MIN) +C(INT64_MIN) +C(INT8_MAX) +C(INT16_MAX) +C(INT32_MAX) +C(INT64_MAX) +C(UINT8_MAX) +C(UINT16_MAX) +C(UINT32_MAX) +C(UINT64_MAX) +C(INT_LEAST8_MIN) +C(INT_LEAST16_MIN) +C(INT_LEAST32_MIN) +C(INT_LEAST64_MIN) +C(INT_LEAST8_MAX) +C(INT_LEAST16_MAX) +C(INT_LEAST32_MAX) +C(INT_LEAST64_MAX) +C(UINT_LEAST8_MAX) +C(UINT_LEAST16_MAX) +C(UINT_LEAST32_MAX) +C(UINT_LEAST64_MAX) +C(INT_FAST8_MIN) +C(INT_FAST16_MIN) +C(INT_FAST32_MIN) +C(INT_FAST64_MIN) +C(INT_FAST8_MAX) +C(INT_FAST16_MAX) +C(INT_FAST32_MAX) +C(INT_FAST64_MAX) +C(UINT_FAST8_MAX) +C(UINT_FAST16_MAX) +C(UINT_FAST32_MAX) +C(UINT_FAST64_MAX) +C(INTPTR_MIN) +C(INTPTR_MAX) +C(UINTPTR_MAX) +C(INTMAX_MIN) +C(INTMAX_MAX) +C(UINTMAX_MAX) +C(PTRDIFF_MIN) +C(PTRDIFF_MAX) +C(SIG_ATOMIC_MIN) +C(SIG_ATOMIC_MAX) +C(SIZE_MAX) +C(WCHAR_MIN) +C(WCHAR_MAX) +C(WINT_MIN) +C(WINT_MAX) +C(INT8_C(0)) +C(INT16_C(0)) +C(INT32_C(0)) +C(INT64_C(0)) +C(UINT8_C(0)) +C(UINT16_C(0)) +C(UINT32_C(0)) +C(UINT64_C(0)) +C(INTMAX_C(0)) +C(UINTMAX_C(0)) +}