Created
March 23, 2013 20:23
-
-
Save puzza007/5229219 to your computer and use it in GitHub Desktop.
port.ii from GEPD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 "port.cpp" | |
# 1 "/Users/puzza/src/GEPD//" | |
# 1 "<built-in>" | |
# 1 "<command-line>" | |
# 1 "./test_bindings.h" 1 | |
# 93 "./test_bindings.h" | |
# 1 "/usr/local/include/boost/preprocessor/cat.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/cat.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/config/config.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/cat.hpp" 2 3 | |
# 94 "./test_bindings.h" 2 | |
# 1 "<command-line>" 2 | |
# 1 "port.cpp" | |
# 45 "port.cpp" | |
# 1 "/usr/include/c++/4.2.1/cstring" 1 3 | |
# 48 "/usr/include/c++/4.2.1/cstring" 3 | |
# 49 "/usr/include/c++/4.2.1/cstring" 3 | |
# 1 "/usr/include/c++/4.2.1/bits/c++config.h" 1 3 | |
# 41 "/usr/include/c++/4.2.1/bits/c++config.h" 3 | |
# 1 "/usr/include/c++/4.2.1/bits/os_defines.h" 1 3 | |
# 61 "/usr/include/c++/4.2.1/bits/os_defines.h" 3 | |
# 1 "/usr/include/unistd.h" 1 3 4 | |
# 71 "/usr/include/unistd.h" 3 4 | |
# 1 "/usr/include/_types.h" 1 3 4 | |
# 27 "/usr/include/_types.h" 3 4 | |
# 1 "/usr/include/sys/_types.h" 1 3 4 | |
# 32 "/usr/include/sys/_types.h" 3 4 | |
# 1 "/usr/include/sys/cdefs.h" 1 3 4 | |
# 406 "/usr/include/sys/cdefs.h" 3 4 | |
# 1 "/usr/include/sys/_symbol_aliasing.h" 1 3 4 | |
# 407 "/usr/include/sys/cdefs.h" 2 3 4 | |
# 472 "/usr/include/sys/cdefs.h" 3 4 | |
# 1 "/usr/include/sys/_posix_availability.h" 1 3 4 | |
# 473 "/usr/include/sys/cdefs.h" 2 3 4 | |
# 33 "/usr/include/sys/_types.h" 2 3 4 | |
# 1 "/usr/include/machine/_types.h" 1 3 4 | |
# 32 "/usr/include/machine/_types.h" 3 4 | |
# 1 "/usr/include/i386/_types.h" 1 3 4 | |
# 37 "/usr/include/i386/_types.h" 3 4 | |
typedef signed char __int8_t; | |
typedef unsigned char __uint8_t; | |
typedef short __int16_t; | |
typedef unsigned short __uint16_t; | |
typedef int __int32_t; | |
typedef unsigned int __uint32_t; | |
typedef long long __int64_t; | |
typedef unsigned long long __uint64_t; | |
typedef long __darwin_intptr_t; | |
typedef unsigned int __darwin_natural_t; | |
# 70 "/usr/include/i386/_types.h" 3 4 | |
typedef int __darwin_ct_rune_t; | |
typedef union { | |
char __mbstate8[128]; | |
long long _mbstateL; | |
} __mbstate_t; | |
typedef __mbstate_t __darwin_mbstate_t; | |
typedef long int __darwin_ptrdiff_t; | |
typedef long unsigned int __darwin_size_t; | |
typedef __builtin_va_list __darwin_va_list; | |
typedef int __darwin_wchar_t; | |
typedef __darwin_wchar_t __darwin_rune_t; | |
typedef int __darwin_wint_t; | |
typedef unsigned long __darwin_clock_t; | |
typedef __uint32_t __darwin_socklen_t; | |
typedef long __darwin_ssize_t; | |
typedef long __darwin_time_t; | |
# 33 "/usr/include/machine/_types.h" 2 3 4 | |
# 34 "/usr/include/sys/_types.h" 2 3 4 | |
# 58 "/usr/include/sys/_types.h" 3 4 | |
struct __darwin_pthread_handler_rec | |
{ | |
void (*__routine)(void *); | |
void *__arg; | |
struct __darwin_pthread_handler_rec *__next; | |
}; | |
struct _opaque_pthread_attr_t { long __sig; char __opaque[56]; }; | |
struct _opaque_pthread_cond_t { long __sig; char __opaque[40]; }; | |
struct _opaque_pthread_condattr_t { long __sig; char __opaque[8]; }; | |
struct _opaque_pthread_mutex_t { long __sig; char __opaque[56]; }; | |
struct _opaque_pthread_mutexattr_t { long __sig; char __opaque[8]; }; | |
struct _opaque_pthread_once_t { long __sig; char __opaque[8]; }; | |
struct _opaque_pthread_rwlock_t { long __sig; char __opaque[192]; }; | |
struct _opaque_pthread_rwlockattr_t { long __sig; char __opaque[16]; }; | |
struct _opaque_pthread_t { long __sig; struct __darwin_pthread_handler_rec *__cleanup_stack; char __opaque[1168]; }; | |
# 94 "/usr/include/sys/_types.h" 3 4 | |
typedef __int64_t __darwin_blkcnt_t; | |
typedef __int32_t __darwin_blksize_t; | |
typedef __int32_t __darwin_dev_t; | |
typedef unsigned int __darwin_fsblkcnt_t; | |
typedef unsigned int __darwin_fsfilcnt_t; | |
typedef __uint32_t __darwin_gid_t; | |
typedef __uint32_t __darwin_id_t; | |
typedef __uint64_t __darwin_ino64_t; | |
typedef __darwin_ino64_t __darwin_ino_t; | |
typedef __darwin_natural_t __darwin_mach_port_name_t; | |
typedef __darwin_mach_port_name_t __darwin_mach_port_t; | |
typedef __uint16_t __darwin_mode_t; | |
typedef __int64_t __darwin_off_t; | |
typedef __int32_t __darwin_pid_t; | |
typedef struct _opaque_pthread_attr_t | |
__darwin_pthread_attr_t; | |
typedef struct _opaque_pthread_cond_t | |
__darwin_pthread_cond_t; | |
typedef struct _opaque_pthread_condattr_t | |
__darwin_pthread_condattr_t; | |
typedef unsigned long __darwin_pthread_key_t; | |
typedef struct _opaque_pthread_mutex_t | |
__darwin_pthread_mutex_t; | |
typedef struct _opaque_pthread_mutexattr_t | |
__darwin_pthread_mutexattr_t; | |
typedef struct _opaque_pthread_once_t | |
__darwin_pthread_once_t; | |
typedef struct _opaque_pthread_rwlock_t | |
__darwin_pthread_rwlock_t; | |
typedef struct _opaque_pthread_rwlockattr_t | |
__darwin_pthread_rwlockattr_t; | |
typedef struct _opaque_pthread_t | |
*__darwin_pthread_t; | |
typedef __uint32_t __darwin_sigset_t; | |
typedef __int32_t __darwin_suseconds_t; | |
typedef __uint32_t __darwin_uid_t; | |
typedef __uint32_t __darwin_useconds_t; | |
typedef unsigned char __darwin_uuid_t[16]; | |
typedef char __darwin_uuid_string_t[37]; | |
# 28 "/usr/include/_types.h" 2 3 4 | |
# 39 "/usr/include/_types.h" 3 4 | |
typedef int __darwin_nl_item; | |
typedef int __darwin_wctrans_t; | |
typedef __uint32_t __darwin_wctype_t; | |
# 72 "/usr/include/unistd.h" 2 3 4 | |
# 1 "/usr/include/sys/unistd.h" 1 3 4 | |
# 138 "/usr/include/sys/unistd.h" 3 4 | |
struct accessx_descriptor { | |
unsigned int ad_name_offset; | |
int ad_flags; | |
int ad_pad[2]; | |
}; | |
# 73 "/usr/include/unistd.h" 2 3 4 | |
# 1 "/usr/include/Availability.h" 1 3 4 | |
# 144 "/usr/include/Availability.h" 3 4 | |
# 1 "/usr/include/AvailabilityInternal.h" 1 3 4 | |
# 145 "/usr/include/Availability.h" 2 3 4 | |
# 74 "/usr/include/unistd.h" 2 3 4 | |
typedef __darwin_gid_t gid_t; | |
typedef __darwin_intptr_t intptr_t; | |
typedef __darwin_off_t off_t; | |
typedef __darwin_pid_t pid_t; | |
typedef __darwin_size_t size_t; | |
typedef __darwin_ssize_t ssize_t; | |
typedef __darwin_uid_t uid_t; | |
typedef __darwin_useconds_t useconds_t; | |
# 458 "/usr/include/unistd.h" 3 4 | |
extern "C" { | |
void _exit(int) __attribute__((noreturn)); | |
int access(const char *, int); | |
unsigned int | |
alarm(unsigned int); | |
int chdir(const char *); | |
int chown(const char *, uid_t, gid_t); | |
int close(int) __asm("_" "close" ); | |
int dup(int); | |
int dup2(int, int); | |
int execl(const char *, const char *, ...); | |
int execle(const char *, const char *, ...); | |
int execlp(const char *, const char *, ...); | |
int execv(const char *, char * const *); | |
int execve(const char *, char * const *, char * const *); | |
int execvp(const char *, char * const *); | |
pid_t fork(void); | |
long fpathconf(int, int); | |
char *getcwd(char *, size_t); | |
gid_t getegid(void); | |
uid_t geteuid(void); | |
gid_t getgid(void); | |
int getgroups(int, gid_t []); | |
char *getlogin(void); | |
pid_t getpgrp(void); | |
pid_t getpid(void); | |
pid_t getppid(void); | |
uid_t getuid(void); | |
int isatty(int); | |
int link(const char *, const char *); | |
off_t lseek(int, off_t, int); | |
long pathconf(const char *, int); | |
int pause(void) __asm("_" "pause" ); | |
int pipe(int [2]); | |
ssize_t read(int, void *, size_t) __asm("_" "read" ); | |
int rmdir(const char *); | |
int setgid(gid_t); | |
int setpgid(pid_t, pid_t); | |
pid_t setsid(void); | |
int setuid(uid_t); | |
unsigned int | |
sleep(unsigned int) __asm("_" "sleep" ); | |
long sysconf(int); | |
pid_t tcgetpgrp(int); | |
int tcsetpgrp(int, pid_t); | |
char *ttyname(int); | |
int ttyname_r(int, char *, size_t) __asm("_" "ttyname_r" ); | |
int unlink(const char *); | |
ssize_t write(int, const void *, size_t) __asm("_" "write" ); | |
} | |
# 535 "/usr/include/unistd.h" 3 4 | |
extern "C" { | |
size_t confstr(int, char *, size_t) __asm("_" "confstr" ); | |
int getopt(int, char * const [], const char *) __asm("_" "getopt" ); | |
extern char *optarg; | |
extern int optind, opterr, optopt; | |
} | |
# 560 "/usr/include/unistd.h" 3 4 | |
extern "C" { | |
void *brk(const void *); | |
int chroot(const char *) ; | |
char *crypt(const char *, const char *); | |
char *ctermid(char *); | |
void encrypt(char *, int) __asm("_" "encrypt" ); | |
int fchdir(int); | |
long gethostid(void); | |
pid_t getpgid(pid_t); | |
pid_t getsid(pid_t); | |
int getdtablesize(void) ; | |
int getpagesize(void) __attribute__((const)) ; | |
char *getpass(const char *) ; | |
char *getwd(char *) ; | |
int lchown(const char *, uid_t, gid_t) __asm("_" "lchown" ); | |
int lockf(int, int, off_t) __asm("_" "lockf" ); | |
int nice(int) __asm("_" "nice" ); | |
ssize_t pread(int, void *, size_t, off_t) __asm("_" "pread" ); | |
ssize_t pwrite(int, const void *, size_t, off_t) __asm("_" "pwrite" ); | |
void *sbrk(int); | |
pid_t setpgrp(void) __asm("_" "setpgrp" ); | |
int setregid(gid_t, gid_t) __asm("_" "setregid" ); | |
int setreuid(uid_t, uid_t) __asm("_" "setreuid" ); | |
void swab(const void * , void * , ssize_t); | |
void sync(void); | |
int truncate(const char *, off_t); | |
useconds_t ualarm(useconds_t, useconds_t); | |
int usleep(useconds_t) __asm("_" "usleep" ); | |
pid_t vfork(void); | |
int fsync(int) __asm("_" "fsync" ); | |
int ftruncate(int, off_t); | |
int getlogin_r(char *, size_t); | |
} | |
# 647 "/usr/include/unistd.h" 3 4 | |
extern "C" { | |
int fchown(int, uid_t, gid_t); | |
int gethostname(char *, size_t); | |
ssize_t readlink(const char * , char * , size_t); | |
int setegid(gid_t); | |
int seteuid(uid_t); | |
int symlink(const char *, const char *); | |
} | |
# 1 "/usr/include/sys/select.h" 1 3 4 | |
# 66 "/usr/include/sys/select.h" 3 4 | |
# 1 "/usr/include/sys/appleapiopts.h" 1 3 4 | |
# 67 "/usr/include/sys/select.h" 2 3 4 | |
# 78 "/usr/include/sys/select.h" 3 4 | |
# 1 "/usr/include/sys/_structs.h" 1 3 4 | |
# 88 "/usr/include/sys/_structs.h" 3 4 | |
struct timespec | |
{ | |
__darwin_time_t tv_sec; | |
long tv_nsec; | |
}; | |
struct timeval | |
{ | |
__darwin_time_t tv_sec; | |
__darwin_suseconds_t tv_usec; | |
}; | |
# 183 "/usr/include/sys/_structs.h" 3 4 | |
extern "C" { | |
typedef struct fd_set { | |
__int32_t fds_bits[((((1024) % ((sizeof(__int32_t) * 8))) == 0) ? ((1024) / ((sizeof(__int32_t) * 8))) : (((1024) / ((sizeof(__int32_t) * 8))) + 1))]; | |
} fd_set; | |
} | |
static inline int | |
__darwin_fd_isset(int _n, const struct fd_set *_p) | |
{ | |
return (_p->fds_bits[_n/(sizeof(__int32_t) * 8)] & (1<<(_n % (sizeof(__int32_t) * 8)))); | |
} | |
# 79 "/usr/include/sys/select.h" 2 3 4 | |
# 87 "/usr/include/sys/select.h" 3 4 | |
typedef __darwin_time_t time_t; | |
typedef __darwin_suseconds_t suseconds_t; | |
typedef __darwin_sigset_t sigset_t; | |
# 134 "/usr/include/sys/select.h" 3 4 | |
extern "C" { | |
int pselect(int, fd_set * , fd_set * , | |
fd_set * , const struct timespec * , | |
const sigset_t * ) | |
__asm("_" "pselect" "$1050") | |
; | |
# 1 "/usr/include/sys/_select.h" 1 3 4 | |
# 39 "/usr/include/sys/_select.h" 3 4 | |
int select(int, fd_set * , fd_set * , | |
fd_set * , struct timeval * ) | |
__asm("_" "select" "$1050") | |
; | |
# 153 "/usr/include/sys/select.h" 2 3 4 | |
} | |
# 663 "/usr/include/unistd.h" 2 3 4 | |
typedef __darwin_dev_t dev_t; | |
typedef __darwin_mode_t mode_t; | |
typedef __darwin_uuid_t uuid_t; | |
extern "C" { | |
void _Exit(int) __attribute__((noreturn)); | |
int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t); | |
int acct(const char *); | |
int add_profil(char *, size_t, unsigned long, unsigned int); | |
void endusershell(void); | |
int execvP(const char *, const char *, char * const *); | |
char *fflagstostr(unsigned long); | |
int getdomainname(char *, int); | |
int getgrouplist(const char *, int, int *, int *); | |
int gethostuuid(uuid_t, const struct timespec *) __attribute__((visibility("default"))); | |
mode_t getmode(const void *, mode_t); | |
int getpeereid(int, uid_t *, gid_t *); | |
int getsgroups_np(int *, uuid_t); | |
char *getusershell(void); | |
int getwgroups_np(int *, uuid_t); | |
int initgroups(const char *, int); | |
int iruserok(unsigned long, int, const char *, const char *); | |
int iruserok_sa(const void *, int, int, const char *, const char *); | |
int issetugid(void); | |
char *mkdtemp(char *); | |
int mknod(const char *, mode_t, dev_t); | |
int mkpath_np(const char *path, mode_t omode) __attribute__((visibility("default"))); | |
int mkstemp(char *); | |
int mkstemps(char *, int); | |
char *mktemp(char *); | |
int nfssvc(int, void *); | |
int profil(char *, size_t, unsigned long, unsigned int); | |
int pthread_setugid_np(uid_t, gid_t); | |
int pthread_getugid_np( uid_t *, gid_t *); | |
int rcmd(char **, int, const char *, const char *, const char *, int *); | |
int rcmd_af(char **, int, const char *, const char *, const char *, int *, | |
int); | |
int reboot(int); | |
int revoke(const char *); | |
int rresvport(int *); | |
int rresvport_af(int *, int); | |
int ruserok(const char *, int, const char *, const char *); | |
int setdomainname(const char *, int); | |
int setgroups(int, const gid_t *); | |
void sethostid(long); | |
int sethostname(const char *, int); | |
void setkey(const char *) __asm("_" "setkey" ); | |
int setlogin(const char *); | |
void *setmode(const char *) __asm("_" "setmode" ); | |
int setrgid(gid_t); | |
int setruid(uid_t); | |
int setsgroups_np(int, const uuid_t); | |
void setusershell(void); | |
int setwgroups_np(int, const uuid_t); | |
int strtofflags(char **, unsigned long *, unsigned long *); | |
int swapon(const char *); | |
int syscall(int, ...); | |
int ttyslot(void); | |
int undelete(const char *); | |
int unwhiteout(const char *); | |
void *valloc(size_t); | |
extern char *suboptarg; | |
int getsubopt(char **, char * const *, char **); | |
int fgetattrlist(int,void*,void*,size_t,unsigned int) __attribute__((visibility("default"))); | |
int fsetattrlist(int,void*,void*,size_t,unsigned int) __attribute__((visibility("default"))); | |
int getattrlist(const char*,void*,void*,size_t,unsigned int) __asm("_" "getattrlist" ); | |
int setattrlist(const char*,void*,void*,size_t,unsigned int) __asm("_" "setattrlist" ); | |
int exchangedata(const char*,const char*,unsigned int); | |
int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int); | |
# 763 "/usr/include/unistd.h" 3 4 | |
struct fssearchblock; | |
struct searchstate; | |
int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *); | |
int fsctl(const char *,unsigned long,void*,unsigned int); | |
int ffsctl(int,unsigned long,void*,unsigned int) __attribute__((visibility("default"))); | |
int fsync_volume_np(int, int) __attribute__((visibility("default"))); | |
int sync_volume_np(const char *, int) __attribute__((visibility("default"))); | |
extern int optreset; | |
} | |
# 62 "/usr/include/c++/4.2.1/bits/os_defines.h" 2 3 | |
extern "C" { | |
# 92 "/usr/include/c++/4.2.1/bits/os_defines.h" 3 | |
extern void __dtrace_probe$cxa_runtime$cxa_exception_rethrow$v1(void); | |
extern int __dtrace_isenabled$cxa_runtime$cxa_exception_rethrow$v1(void); | |
extern void __dtrace_probe$cxa_runtime$cxa_exception_throw$v1$766f6964202a(void *); | |
extern int __dtrace_isenabled$cxa_runtime$cxa_exception_throw$v1(void); | |
} | |
# 42 "/usr/include/c++/4.2.1/bits/c++config.h" 2 3 | |
# 1 "/usr/include/c++/4.2.1/bits/cpu_defines.h" 1 3 | |
# 45 "/usr/include/c++/4.2.1/bits/c++config.h" 2 3 | |
# 153 "/usr/include/c++/4.2.1/bits/c++config.h" 3 | |
namespace std { | |
# 165 "/usr/include/c++/4.2.1/bits/c++config.h" 3 | |
} | |
# 51 "/usr/include/c++/4.2.1/cstring" 2 3 | |
# 1 "/usr/include/c++/4.2.1/cstddef" 1 3 | |
# 48 "/usr/include/c++/4.2.1/cstddef" 3 | |
# 49 "/usr/include/c++/4.2.1/cstddef" 3 | |
# 1 "/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/stddef.h" 1 3 4 | |
# 152 "/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/stddef.h" 3 4 | |
typedef long int ptrdiff_t; | |
# 52 "/usr/include/c++/4.2.1/cstddef" 2 3 | |
namespace std { | |
using ::ptrdiff_t; | |
using ::size_t; | |
} | |
# 52 "/usr/include/c++/4.2.1/cstring" 2 3 | |
# 1 "/usr/include/string.h" 1 3 4 | |
# 79 "/usr/include/string.h" 3 4 | |
extern "C" { | |
void *memchr(const void *, int, size_t); | |
int memcmp(const void *, const void *, size_t); | |
void *memcpy(void *, const void *, size_t); | |
void *memmove(void *, const void *, size_t); | |
void *memset(void *, int, size_t); | |
char *strcat(char *, const char *); | |
char *strchr(const char *, int); | |
int strcmp(const char *, const char *); | |
int strcoll(const char *, const char *); | |
char *strcpy(char *, const char *); | |
size_t strcspn(const char *, const char *); | |
char *strerror(int) __asm("_" "strerror" ); | |
size_t strlen(const char *); | |
char *strncat(char *, const char *, size_t); | |
int strncmp(const char *, const char *, size_t); | |
char *strncpy(char *, const char *, size_t); | |
char *strpbrk(const char *, const char *); | |
char *strrchr(const char *, int); | |
size_t strspn(const char *, const char *); | |
char *strstr(const char *, const char *); | |
char *strtok(char *, const char *); | |
size_t strxfrm(char *, const char *, size_t); | |
} | |
# 113 "/usr/include/string.h" 3 4 | |
extern "C" { | |
char *strtok_r(char *, const char *, char **); | |
} | |
# 125 "/usr/include/string.h" 3 4 | |
extern "C" { | |
int strerror_r(int, char *, size_t); | |
char *strdup(const char *); | |
void *memccpy(void *, const void *, int, size_t); | |
} | |
# 139 "/usr/include/string.h" 3 4 | |
extern "C" { | |
char *stpcpy(char *, const char *); | |
char *stpncpy(char *, const char *, size_t) __attribute__((visibility("default"))); | |
char *strndup(const char *, size_t) __attribute__((visibility("default"))); | |
size_t strnlen(const char *, size_t) __attribute__((visibility("default"))); | |
char *strsignal(int sig); | |
} | |
# 158 "/usr/include/string.h" 3 4 | |
extern "C" { | |
void *memmem(const void *, size_t, const void *, size_t) __attribute__((visibility("default"))); | |
void memset_pattern4(void *, const void *, size_t) __attribute__((visibility("default"))); | |
void memset_pattern8(void *, const void *, size_t) __attribute__((visibility("default"))); | |
void memset_pattern16(void *, const void *, size_t) __attribute__((visibility("default"))); | |
char *strcasestr(const char *, const char *); | |
char *strnstr(const char *, const char *, size_t); | |
size_t strlcat(char *, const char *, size_t); | |
size_t strlcpy(char *, const char *, size_t); | |
void strmode(int, char *); | |
char *strsep(char **, const char *); | |
void swab(const void * , void * , ssize_t); | |
} | |
# 1 "/usr/include/strings.h" 1 3 4 | |
# 71 "/usr/include/strings.h" 3 4 | |
extern "C" { | |
int bcmp(const void *, const void *, size_t) ; | |
void bcopy(const void *, void *, size_t) ; | |
void bzero(void *, size_t) ; | |
char *index(const char *, int) ; | |
char *rindex(const char *, int) ; | |
int ffs(int); | |
int strcasecmp(const char *, const char *); | |
int strncasecmp(const char *, const char *, size_t); | |
} | |
extern "C" { | |
int ffsl(long) __attribute__((visibility("default"))); | |
int fls(int) __attribute__((visibility("default"))); | |
int flsl(long) __attribute__((visibility("default"))); | |
} | |
# 1 "/usr/include/string.h" 1 3 4 | |
# 95 "/usr/include/strings.h" 2 3 4 | |
# 181 "/usr/include/string.h" 2 3 4 | |
# 53 "/usr/include/c++/4.2.1/cstring" 2 3 | |
# 78 "/usr/include/c++/4.2.1/cstring" 3 | |
namespace std { | |
using ::memcpy; | |
using ::memmove; | |
using ::strcpy; | |
using ::strncpy; | |
using ::strcat; | |
using ::strncat; | |
using ::memcmp; | |
using ::strcmp; | |
using ::strcoll; | |
using ::strncmp; | |
using ::strxfrm; | |
using ::strcspn; | |
using ::strspn; | |
using ::strtok; | |
using ::memset; | |
using ::strerror; | |
using ::strlen; | |
using ::memchr; | |
inline void* | |
memchr(void* __p, int __c, size_t __n) | |
{ return memchr(const_cast<const void*>(__p), __c, __n); } | |
using ::strchr; | |
inline char* | |
strchr(char* __s1, int __n) | |
{ return __builtin_strchr(const_cast<const char*>(__s1), __n); } | |
using ::strpbrk; | |
inline char* | |
strpbrk(char* __s1, const char* __s2) | |
{ return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); } | |
using ::strrchr; | |
inline char* | |
strrchr(char* __s1, int __n) | |
{ return __builtin_strrchr(const_cast<const char*>(__s1), __n); } | |
using ::strstr; | |
inline char* | |
strstr(char* __s1, const char* __s2) | |
{ return __builtin_strstr(const_cast<const char*>(__s1), __s2); } | |
} | |
# 46 "port.cpp" 2 | |
# 1 "/usr/include/c++/4.2.1/cstdio" 1 3 | |
# 48 "/usr/include/c++/4.2.1/cstdio" 3 | |
# 49 "/usr/include/c++/4.2.1/cstdio" 3 | |
# 1 "/usr/include/stdio.h" 1 3 4 | |
# 73 "/usr/include/stdio.h" 3 4 | |
typedef __darwin_va_list va_list; | |
# 85 "/usr/include/stdio.h" 3 4 | |
typedef __darwin_off_t fpos_t; | |
# 96 "/usr/include/stdio.h" 3 4 | |
struct __sbuf { | |
unsigned char *_base; | |
int _size; | |
}; | |
struct __sFILEX; | |
# 130 "/usr/include/stdio.h" 3 4 | |
typedef struct __sFILE { | |
unsigned char *_p; | |
int _r; | |
int _w; | |
short _flags; | |
short _file; | |
struct __sbuf _bf; | |
int _lbfsize; | |
void *_cookie; | |
int (*_close)(void *); | |
int (*_read) (void *, char *, int); | |
fpos_t (*_seek) (void *, fpos_t, int); | |
int (*_write)(void *, const char *, int); | |
struct __sbuf _ub; | |
struct __sFILEX *_extra; | |
int _ur; | |
unsigned char _ubuf[3]; | |
unsigned char _nbuf[1]; | |
struct __sbuf _lb; | |
int _blksize; | |
fpos_t _offset; | |
} FILE; | |
extern "C" { | |
extern FILE *__stdinp; | |
extern FILE *__stdoutp; | |
extern FILE *__stderrp; | |
} | |
# 238 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
void clearerr(FILE *); | |
int fclose(FILE *); | |
int feof(FILE *); | |
int ferror(FILE *); | |
int fflush(FILE *); | |
int fgetc(FILE *); | |
int fgetpos(FILE * , fpos_t *); | |
char *fgets(char * , int, FILE *); | |
FILE *fopen(const char * , const char * ) __asm("_" "fopen" ); | |
int fprintf(FILE * , const char * , ...) __attribute__((__format__ (__printf__, 2, 3))); | |
int fputc(int, FILE *); | |
int fputs(const char * , FILE * ) __asm("_" "fputs" ); | |
size_t fread(void * , size_t, size_t, FILE * ); | |
FILE *freopen(const char * , const char * , | |
FILE * ) __asm("_" "freopen" ); | |
int fscanf(FILE * , const char * , ...) __attribute__((__format__ (__scanf__, 2, 3))); | |
int fseek(FILE *, long, int); | |
int fsetpos(FILE *, const fpos_t *); | |
long ftell(FILE *); | |
size_t fwrite(const void * , size_t, size_t, FILE * ) __asm("_" "fwrite" ); | |
int getc(FILE *); | |
int getchar(void); | |
char *gets(char *); | |
void perror(const char *); | |
int printf(const char * , ...) __attribute__((__format__ (__printf__, 1, 2))); | |
int putc(int, FILE *); | |
int putchar(int); | |
int puts(const char *); | |
int remove(const char *); | |
int rename (const char *, const char *); | |
void rewind(FILE *); | |
int scanf(const char * , ...) __attribute__((__format__ (__scanf__, 1, 2))); | |
void setbuf(FILE * , char * ); | |
int setvbuf(FILE * , char * , int, size_t); | |
int sprintf(char * , const char * , ...) __attribute__((__format__ (__printf__, 2, 3))); | |
int sscanf(const char * , const char * , ...) __attribute__((__format__ (__scanf__, 2, 3))); | |
FILE *tmpfile(void); | |
char *tmpnam(char *); | |
int ungetc(int, FILE *); | |
int vfprintf(FILE * , const char * , va_list) __attribute__((__format__ (__printf__, 2, 0))); | |
int vprintf(const char * , va_list) __attribute__((__format__ (__printf__, 1, 0))); | |
int vsprintf(char * , const char * , va_list) __attribute__((__format__ (__printf__, 2, 0))); | |
} | |
# 296 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
# 306 "/usr/include/stdio.h" 3 4 | |
FILE *fdopen(int, const char *) __asm("_" "fdopen" ); | |
int fileno(FILE *); | |
} | |
# 318 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
int pclose(FILE *); | |
FILE *popen(const char *, const char *) __asm("_" "popen" ); | |
} | |
# 340 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
int __srget(FILE *); | |
int __svfscanf(FILE *, const char *, va_list) __attribute__((__format__ (__scanf__, 2, 0))); | |
int __swbuf(int, FILE *); | |
} | |
static inline int __sputc(int _c, FILE *_p) { | |
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) | |
return (*_p->_p++ = _c); | |
else | |
return (__swbuf(_c, _p)); | |
} | |
# 377 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
void flockfile(FILE *); | |
int ftrylockfile(FILE *); | |
void funlockfile(FILE *); | |
int getc_unlocked(FILE *); | |
int getchar_unlocked(void); | |
int putc_unlocked(int, FILE *); | |
int putchar_unlocked(int); | |
int getw(FILE *); | |
int putw(int, FILE *); | |
char *tempnam(const char *, const char *) __asm("_" "tempnam" ); | |
} | |
# 417 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
int fseeko(FILE *, off_t, int); | |
off_t ftello(FILE *); | |
} | |
extern "C" { | |
int snprintf(char * , size_t, const char * , ...) __attribute__((__format__ (__printf__, 3, 4))); | |
int vfscanf(FILE * , const char * , va_list) __attribute__((__format__ (__scanf__, 2, 0))); | |
int vscanf(const char * , va_list) __attribute__((__format__ (__scanf__, 1, 0))); | |
int vsnprintf(char * , size_t, const char * , va_list) __attribute__((__format__ (__printf__, 3, 0))); | |
int vsscanf(const char * , const char * , va_list) __attribute__((__format__ (__scanf__, 2, 0))); | |
} | |
# 445 "/usr/include/stdio.h" 3 4 | |
extern "C" { | |
int dprintf(int, const char * , ...) __attribute__((__format__ (__printf__, 2, 3))) __attribute__((visibility("default"))); | |
int vdprintf(int, const char * , va_list) __attribute__((__format__ (__printf__, 2, 0))) __attribute__((visibility("default"))); | |
ssize_t getdelim(char ** , size_t * , int, FILE * ) __attribute__((visibility("default"))); | |
ssize_t getline(char ** , size_t * , FILE * ) __attribute__((visibility("default"))); | |
} | |
extern "C" { | |
extern const int sys_nerr; | |
extern const char *const sys_errlist[]; | |
int asprintf(char **, const char *, ...) __attribute__((__format__ (__printf__, 2, 3))); | |
char *ctermid_r(char *); | |
char *fgetln(FILE *, size_t *); | |
const char *fmtcheck(const char *, const char *); | |
int fpurge(FILE *); | |
void setbuffer(FILE *, char *, int); | |
int setlinebuf(FILE *); | |
int vasprintf(char **, const char *, va_list) __attribute__((__format__ (__printf__, 2, 0))); | |
FILE *zopen(const char *, const char *, int); | |
FILE *funopen(const void *, | |
int (*)(void *, char *, int), | |
int (*)(void *, const char *, int), | |
fpos_t (*)(void *, fpos_t, int), | |
int (*)(void *)); | |
} | |
# 54 "/usr/include/c++/4.2.1/cstdio" 2 3 | |
# 98 "/usr/include/c++/4.2.1/cstdio" 3 | |
namespace std { | |
using ::FILE; | |
using ::fpos_t; | |
using ::clearerr; | |
using ::fclose; | |
using ::feof; | |
using ::ferror; | |
using ::fflush; | |
using ::fgetc; | |
using ::fgetpos; | |
using ::fgets; | |
using ::fopen; | |
using ::fprintf; | |
using ::fputc; | |
using ::fputs; | |
using ::fread; | |
using ::freopen; | |
using ::fscanf; | |
using ::fseek; | |
using ::fsetpos; | |
using ::ftell; | |
using ::fwrite; | |
using ::getc; | |
using ::getchar; | |
using ::gets; | |
using ::perror; | |
using ::printf; | |
using ::putc; | |
using ::putchar; | |
using ::puts; | |
using ::remove; | |
using ::rename; | |
using ::rewind; | |
using ::scanf; | |
using ::setbuf; | |
using ::setvbuf; | |
using ::sprintf; | |
using ::sscanf; | |
using ::tmpfile; | |
using ::tmpnam; | |
using ::ungetc; | |
using ::vfprintf; | |
using ::vprintf; | |
using ::vsprintf; | |
} | |
# 155 "/usr/include/c++/4.2.1/cstdio" 3 | |
namespace __gnu_cxx { | |
# 170 "/usr/include/c++/4.2.1/cstdio" 3 | |
using ::snprintf; | |
using ::vfscanf; | |
using ::vscanf; | |
using ::vsnprintf; | |
using ::vsscanf; | |
} | |
namespace std { | |
using ::__gnu_cxx::snprintf; | |
using ::__gnu_cxx::vfscanf; | |
using ::__gnu_cxx::vscanf; | |
using ::__gnu_cxx::vsnprintf; | |
using ::__gnu_cxx::vsscanf; | |
} | |
# 47 "port.cpp" 2 | |
# 1 "/usr/include/c++/4.2.1/cstdlib" 1 3 | |
# 48 "/usr/include/c++/4.2.1/cstdlib" 3 | |
# 49 "/usr/include/c++/4.2.1/cstdlib" 3 | |
# 72 "/usr/include/c++/4.2.1/cstdlib" 3 | |
# 1 "/usr/include/stdlib.h" 1 3 4 | |
# 65 "/usr/include/stdlib.h" 3 4 | |
# 1 "/usr/include/sys/wait.h" 1 3 4 | |
# 79 "/usr/include/sys/wait.h" 3 4 | |
typedef enum { | |
P_ALL, | |
P_PID, | |
P_PGID | |
} idtype_t; | |
# 95 "/usr/include/sys/wait.h" 3 4 | |
typedef __darwin_id_t id_t; | |
# 116 "/usr/include/sys/wait.h" 3 4 | |
# 1 "/usr/include/sys/signal.h" 1 3 4 | |
# 81 "/usr/include/sys/signal.h" 3 4 | |
# 1 "/usr/include/machine/signal.h" 1 3 4 | |
# 32 "/usr/include/machine/signal.h" 3 4 | |
# 1 "/usr/include/i386/signal.h" 1 3 4 | |
# 39 "/usr/include/i386/signal.h" 3 4 | |
typedef int sig_atomic_t; | |
# 55 "/usr/include/i386/signal.h" 3 4 | |
# 1 "/usr/include/i386/_structs.h" 1 3 4 | |
# 56 "/usr/include/i386/signal.h" 2 3 4 | |
# 33 "/usr/include/machine/signal.h" 2 3 4 | |
# 82 "/usr/include/sys/signal.h" 2 3 4 | |
# 148 "/usr/include/sys/signal.h" 3 4 | |
# 1 "/usr/include/sys/_structs.h" 1 3 4 | |
# 57 "/usr/include/sys/_structs.h" 3 4 | |
# 1 "/usr/include/machine/_structs.h" 1 3 4 | |
# 29 "/usr/include/machine/_structs.h" 3 4 | |
# 1 "/usr/include/i386/_structs.h" 1 3 4 | |
# 38 "/usr/include/i386/_structs.h" 3 4 | |
# 1 "/usr/include/mach/i386/_structs.h" 1 3 4 | |
# 43 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_i386_thread_state | |
{ | |
unsigned int __eax; | |
unsigned int __ebx; | |
unsigned int __ecx; | |
unsigned int __edx; | |
unsigned int __edi; | |
unsigned int __esi; | |
unsigned int __ebp; | |
unsigned int __esp; | |
unsigned int __ss; | |
unsigned int __eflags; | |
unsigned int __eip; | |
unsigned int __cs; | |
unsigned int __ds; | |
unsigned int __es; | |
unsigned int __fs; | |
unsigned int __gs; | |
}; | |
# 89 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_fp_control | |
{ | |
unsigned short __invalid :1, | |
__denorm :1, | |
__zdiv :1, | |
__ovrfl :1, | |
__undfl :1, | |
__precis :1, | |
:2, | |
__pc :2, | |
__rc :2, | |
:1, | |
:3; | |
}; | |
typedef struct __darwin_fp_control __darwin_fp_control_t; | |
# 147 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_fp_status | |
{ | |
unsigned short __invalid :1, | |
__denorm :1, | |
__zdiv :1, | |
__ovrfl :1, | |
__undfl :1, | |
__precis :1, | |
__stkflt :1, | |
__errsumm :1, | |
__c0 :1, | |
__c1 :1, | |
__c2 :1, | |
__tos :3, | |
__c3 :1, | |
__busy :1; | |
}; | |
typedef struct __darwin_fp_status __darwin_fp_status_t; | |
# 191 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_mmst_reg | |
{ | |
char __mmst_reg[10]; | |
char __mmst_rsrv[6]; | |
}; | |
# 210 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_xmm_reg | |
{ | |
char __xmm_reg[16]; | |
}; | |
# 232 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_i386_float_state | |
{ | |
int __fpu_reserved[2]; | |
struct __darwin_fp_control __fpu_fcw; | |
struct __darwin_fp_status __fpu_fsw; | |
__uint8_t __fpu_ftw; | |
__uint8_t __fpu_rsrv1; | |
__uint16_t __fpu_fop; | |
__uint32_t __fpu_ip; | |
__uint16_t __fpu_cs; | |
__uint16_t __fpu_rsrv2; | |
__uint32_t __fpu_dp; | |
__uint16_t __fpu_ds; | |
__uint16_t __fpu_rsrv3; | |
__uint32_t __fpu_mxcsr; | |
__uint32_t __fpu_mxcsrmask; | |
struct __darwin_mmst_reg __fpu_stmm0; | |
struct __darwin_mmst_reg __fpu_stmm1; | |
struct __darwin_mmst_reg __fpu_stmm2; | |
struct __darwin_mmst_reg __fpu_stmm3; | |
struct __darwin_mmst_reg __fpu_stmm4; | |
struct __darwin_mmst_reg __fpu_stmm5; | |
struct __darwin_mmst_reg __fpu_stmm6; | |
struct __darwin_mmst_reg __fpu_stmm7; | |
struct __darwin_xmm_reg __fpu_xmm0; | |
struct __darwin_xmm_reg __fpu_xmm1; | |
struct __darwin_xmm_reg __fpu_xmm2; | |
struct __darwin_xmm_reg __fpu_xmm3; | |
struct __darwin_xmm_reg __fpu_xmm4; | |
struct __darwin_xmm_reg __fpu_xmm5; | |
struct __darwin_xmm_reg __fpu_xmm6; | |
struct __darwin_xmm_reg __fpu_xmm7; | |
char __fpu_rsrv4[14*16]; | |
int __fpu_reserved1; | |
}; | |
struct __darwin_i386_avx_state | |
{ | |
int __fpu_reserved[2]; | |
struct __darwin_fp_control __fpu_fcw; | |
struct __darwin_fp_status __fpu_fsw; | |
__uint8_t __fpu_ftw; | |
__uint8_t __fpu_rsrv1; | |
__uint16_t __fpu_fop; | |
__uint32_t __fpu_ip; | |
__uint16_t __fpu_cs; | |
__uint16_t __fpu_rsrv2; | |
__uint32_t __fpu_dp; | |
__uint16_t __fpu_ds; | |
__uint16_t __fpu_rsrv3; | |
__uint32_t __fpu_mxcsr; | |
__uint32_t __fpu_mxcsrmask; | |
struct __darwin_mmst_reg __fpu_stmm0; | |
struct __darwin_mmst_reg __fpu_stmm1; | |
struct __darwin_mmst_reg __fpu_stmm2; | |
struct __darwin_mmst_reg __fpu_stmm3; | |
struct __darwin_mmst_reg __fpu_stmm4; | |
struct __darwin_mmst_reg __fpu_stmm5; | |
struct __darwin_mmst_reg __fpu_stmm6; | |
struct __darwin_mmst_reg __fpu_stmm7; | |
struct __darwin_xmm_reg __fpu_xmm0; | |
struct __darwin_xmm_reg __fpu_xmm1; | |
struct __darwin_xmm_reg __fpu_xmm2; | |
struct __darwin_xmm_reg __fpu_xmm3; | |
struct __darwin_xmm_reg __fpu_xmm4; | |
struct __darwin_xmm_reg __fpu_xmm5; | |
struct __darwin_xmm_reg __fpu_xmm6; | |
struct __darwin_xmm_reg __fpu_xmm7; | |
char __fpu_rsrv4[14*16]; | |
int __fpu_reserved1; | |
char __avx_reserved1[64]; | |
struct __darwin_xmm_reg __fpu_ymmh0; | |
struct __darwin_xmm_reg __fpu_ymmh1; | |
struct __darwin_xmm_reg __fpu_ymmh2; | |
struct __darwin_xmm_reg __fpu_ymmh3; | |
struct __darwin_xmm_reg __fpu_ymmh4; | |
struct __darwin_xmm_reg __fpu_ymmh5; | |
struct __darwin_xmm_reg __fpu_ymmh6; | |
struct __darwin_xmm_reg __fpu_ymmh7; | |
}; | |
# 402 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_i386_exception_state | |
{ | |
__uint16_t __trapno; | |
__uint16_t __cpu; | |
__uint32_t __err; | |
__uint32_t __faultvaddr; | |
}; | |
# 422 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_x86_debug_state32 | |
{ | |
unsigned int __dr0; | |
unsigned int __dr1; | |
unsigned int __dr2; | |
unsigned int __dr3; | |
unsigned int __dr4; | |
unsigned int __dr5; | |
unsigned int __dr6; | |
unsigned int __dr7; | |
}; | |
# 454 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_x86_thread_state64 | |
{ | |
__uint64_t __rax; | |
__uint64_t __rbx; | |
__uint64_t __rcx; | |
__uint64_t __rdx; | |
__uint64_t __rdi; | |
__uint64_t __rsi; | |
__uint64_t __rbp; | |
__uint64_t __rsp; | |
__uint64_t __r8; | |
__uint64_t __r9; | |
__uint64_t __r10; | |
__uint64_t __r11; | |
__uint64_t __r12; | |
__uint64_t __r13; | |
__uint64_t __r14; | |
__uint64_t __r15; | |
__uint64_t __rip; | |
__uint64_t __rflags; | |
__uint64_t __cs; | |
__uint64_t __fs; | |
__uint64_t __gs; | |
}; | |
# 509 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_x86_float_state64 | |
{ | |
int __fpu_reserved[2]; | |
struct __darwin_fp_control __fpu_fcw; | |
struct __darwin_fp_status __fpu_fsw; | |
__uint8_t __fpu_ftw; | |
__uint8_t __fpu_rsrv1; | |
__uint16_t __fpu_fop; | |
__uint32_t __fpu_ip; | |
__uint16_t __fpu_cs; | |
__uint16_t __fpu_rsrv2; | |
__uint32_t __fpu_dp; | |
__uint16_t __fpu_ds; | |
__uint16_t __fpu_rsrv3; | |
__uint32_t __fpu_mxcsr; | |
__uint32_t __fpu_mxcsrmask; | |
struct __darwin_mmst_reg __fpu_stmm0; | |
struct __darwin_mmst_reg __fpu_stmm1; | |
struct __darwin_mmst_reg __fpu_stmm2; | |
struct __darwin_mmst_reg __fpu_stmm3; | |
struct __darwin_mmst_reg __fpu_stmm4; | |
struct __darwin_mmst_reg __fpu_stmm5; | |
struct __darwin_mmst_reg __fpu_stmm6; | |
struct __darwin_mmst_reg __fpu_stmm7; | |
struct __darwin_xmm_reg __fpu_xmm0; | |
struct __darwin_xmm_reg __fpu_xmm1; | |
struct __darwin_xmm_reg __fpu_xmm2; | |
struct __darwin_xmm_reg __fpu_xmm3; | |
struct __darwin_xmm_reg __fpu_xmm4; | |
struct __darwin_xmm_reg __fpu_xmm5; | |
struct __darwin_xmm_reg __fpu_xmm6; | |
struct __darwin_xmm_reg __fpu_xmm7; | |
struct __darwin_xmm_reg __fpu_xmm8; | |
struct __darwin_xmm_reg __fpu_xmm9; | |
struct __darwin_xmm_reg __fpu_xmm10; | |
struct __darwin_xmm_reg __fpu_xmm11; | |
struct __darwin_xmm_reg __fpu_xmm12; | |
struct __darwin_xmm_reg __fpu_xmm13; | |
struct __darwin_xmm_reg __fpu_xmm14; | |
struct __darwin_xmm_reg __fpu_xmm15; | |
char __fpu_rsrv4[6*16]; | |
int __fpu_reserved1; | |
}; | |
struct __darwin_x86_avx_state64 | |
{ | |
int __fpu_reserved[2]; | |
struct __darwin_fp_control __fpu_fcw; | |
struct __darwin_fp_status __fpu_fsw; | |
__uint8_t __fpu_ftw; | |
__uint8_t __fpu_rsrv1; | |
__uint16_t __fpu_fop; | |
__uint32_t __fpu_ip; | |
__uint16_t __fpu_cs; | |
__uint16_t __fpu_rsrv2; | |
__uint32_t __fpu_dp; | |
__uint16_t __fpu_ds; | |
__uint16_t __fpu_rsrv3; | |
__uint32_t __fpu_mxcsr; | |
__uint32_t __fpu_mxcsrmask; | |
struct __darwin_mmst_reg __fpu_stmm0; | |
struct __darwin_mmst_reg __fpu_stmm1; | |
struct __darwin_mmst_reg __fpu_stmm2; | |
struct __darwin_mmst_reg __fpu_stmm3; | |
struct __darwin_mmst_reg __fpu_stmm4; | |
struct __darwin_mmst_reg __fpu_stmm5; | |
struct __darwin_mmst_reg __fpu_stmm6; | |
struct __darwin_mmst_reg __fpu_stmm7; | |
struct __darwin_xmm_reg __fpu_xmm0; | |
struct __darwin_xmm_reg __fpu_xmm1; | |
struct __darwin_xmm_reg __fpu_xmm2; | |
struct __darwin_xmm_reg __fpu_xmm3; | |
struct __darwin_xmm_reg __fpu_xmm4; | |
struct __darwin_xmm_reg __fpu_xmm5; | |
struct __darwin_xmm_reg __fpu_xmm6; | |
struct __darwin_xmm_reg __fpu_xmm7; | |
struct __darwin_xmm_reg __fpu_xmm8; | |
struct __darwin_xmm_reg __fpu_xmm9; | |
struct __darwin_xmm_reg __fpu_xmm10; | |
struct __darwin_xmm_reg __fpu_xmm11; | |
struct __darwin_xmm_reg __fpu_xmm12; | |
struct __darwin_xmm_reg __fpu_xmm13; | |
struct __darwin_xmm_reg __fpu_xmm14; | |
struct __darwin_xmm_reg __fpu_xmm15; | |
char __fpu_rsrv4[6*16]; | |
int __fpu_reserved1; | |
char __avx_reserved1[64]; | |
struct __darwin_xmm_reg __fpu_ymmh0; | |
struct __darwin_xmm_reg __fpu_ymmh1; | |
struct __darwin_xmm_reg __fpu_ymmh2; | |
struct __darwin_xmm_reg __fpu_ymmh3; | |
struct __darwin_xmm_reg __fpu_ymmh4; | |
struct __darwin_xmm_reg __fpu_ymmh5; | |
struct __darwin_xmm_reg __fpu_ymmh6; | |
struct __darwin_xmm_reg __fpu_ymmh7; | |
struct __darwin_xmm_reg __fpu_ymmh8; | |
struct __darwin_xmm_reg __fpu_ymmh9; | |
struct __darwin_xmm_reg __fpu_ymmh10; | |
struct __darwin_xmm_reg __fpu_ymmh11; | |
struct __darwin_xmm_reg __fpu_ymmh12; | |
struct __darwin_xmm_reg __fpu_ymmh13; | |
struct __darwin_xmm_reg __fpu_ymmh14; | |
struct __darwin_xmm_reg __fpu_ymmh15; | |
}; | |
# 751 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_x86_exception_state64 | |
{ | |
__uint16_t __trapno; | |
__uint16_t __cpu; | |
__uint32_t __err; | |
__uint64_t __faultvaddr; | |
}; | |
# 771 "/usr/include/mach/i386/_structs.h" 3 4 | |
struct __darwin_x86_debug_state64 | |
{ | |
__uint64_t __dr0; | |
__uint64_t __dr1; | |
__uint64_t __dr2; | |
__uint64_t __dr3; | |
__uint64_t __dr4; | |
__uint64_t __dr5; | |
__uint64_t __dr6; | |
__uint64_t __dr7; | |
}; | |
# 39 "/usr/include/i386/_structs.h" 2 3 4 | |
# 48 "/usr/include/i386/_structs.h" 3 4 | |
struct __darwin_mcontext32 | |
{ | |
struct __darwin_i386_exception_state __es; | |
struct __darwin_i386_thread_state __ss; | |
struct __darwin_i386_float_state __fs; | |
}; | |
struct __darwin_mcontext_avx32 | |
{ | |
struct __darwin_i386_exception_state __es; | |
struct __darwin_i386_thread_state __ss; | |
struct __darwin_i386_avx_state __fs; | |
}; | |
# 86 "/usr/include/i386/_structs.h" 3 4 | |
struct __darwin_mcontext64 | |
{ | |
struct __darwin_x86_exception_state64 __es; | |
struct __darwin_x86_thread_state64 __ss; | |
struct __darwin_x86_float_state64 __fs; | |
}; | |
struct __darwin_mcontext_avx64 | |
{ | |
struct __darwin_x86_exception_state64 __es; | |
struct __darwin_x86_thread_state64 __ss; | |
struct __darwin_x86_avx_state64 __fs; | |
}; | |
# 127 "/usr/include/i386/_structs.h" 3 4 | |
typedef struct __darwin_mcontext64 *mcontext_t; | |
# 30 "/usr/include/machine/_structs.h" 2 3 4 | |
# 58 "/usr/include/sys/_structs.h" 2 3 4 | |
# 75 "/usr/include/sys/_structs.h" 3 4 | |
struct __darwin_sigaltstack | |
{ | |
void *ss_sp; | |
__darwin_size_t ss_size; | |
int ss_flags; | |
}; | |
# 128 "/usr/include/sys/_structs.h" 3 4 | |
struct __darwin_ucontext | |
{ | |
int uc_onstack; | |
__darwin_sigset_t uc_sigmask; | |
struct __darwin_sigaltstack uc_stack; | |
struct __darwin_ucontext *uc_link; | |
__darwin_size_t uc_mcsize; | |
struct __darwin_mcontext64 *uc_mcontext; | |
}; | |
# 218 "/usr/include/sys/_structs.h" 3 4 | |
typedef struct __darwin_sigaltstack stack_t; | |
# 227 "/usr/include/sys/_structs.h" 3 4 | |
typedef struct __darwin_ucontext ucontext_t; | |
# 149 "/usr/include/sys/signal.h" 2 3 4 | |
# 157 "/usr/include/sys/signal.h" 3 4 | |
typedef __darwin_pthread_attr_t pthread_attr_t; | |
# 175 "/usr/include/sys/signal.h" 3 4 | |
union sigval { | |
int sival_int; | |
void *sival_ptr; | |
}; | |
struct sigevent { | |
int sigev_notify; | |
int sigev_signo; | |
union sigval sigev_value; | |
void (*sigev_notify_function)(union sigval); | |
pthread_attr_t *sigev_notify_attributes; | |
}; | |
typedef struct __siginfo { | |
int si_signo; | |
int si_errno; | |
int si_code; | |
pid_t si_pid; | |
uid_t si_uid; | |
int si_status; | |
void *si_addr; | |
union sigval si_value; | |
long si_band; | |
unsigned long __pad[7]; | |
} siginfo_t; | |
# 286 "/usr/include/sys/signal.h" 3 4 | |
union __sigaction_u { | |
void (*__sa_handler)(int); | |
void (*__sa_sigaction)(int, struct __siginfo *, | |
void *); | |
}; | |
struct __sigaction { | |
union __sigaction_u __sigaction_u; | |
void (*sa_tramp)(void *, int, int, siginfo_t *, void *); | |
sigset_t sa_mask; | |
int sa_flags; | |
}; | |
struct sigaction { | |
union __sigaction_u __sigaction_u; | |
sigset_t sa_mask; | |
int sa_flags; | |
}; | |
# 348 "/usr/include/sys/signal.h" 3 4 | |
typedef void (*sig_t)(int); | |
# 365 "/usr/include/sys/signal.h" 3 4 | |
struct sigvec { | |
void (*sv_handler)(int); | |
int sv_mask; | |
int sv_flags; | |
}; | |
# 384 "/usr/include/sys/signal.h" 3 4 | |
struct sigstack { | |
char *ss_sp; | |
int ss_onstack; | |
}; | |
# 406 "/usr/include/sys/signal.h" 3 4 | |
extern "C" { | |
void (*signal(int, void (*)(int)))(int); | |
} | |
# 117 "/usr/include/sys/wait.h" 2 3 4 | |
# 1 "/usr/include/sys/resource.h" 1 3 4 | |
# 77 "/usr/include/sys/resource.h" 3 4 | |
# 1 "/usr/include/sys/_structs.h" 1 3 4 | |
# 78 "/usr/include/sys/resource.h" 2 3 4 | |
# 89 "/usr/include/sys/resource.h" 3 4 | |
typedef __uint64_t rlim_t; | |
# 151 "/usr/include/sys/resource.h" 3 4 | |
struct rusage { | |
struct timeval ru_utime; | |
struct timeval ru_stime; | |
# 162 "/usr/include/sys/resource.h" 3 4 | |
long ru_maxrss; | |
long ru_ixrss; | |
long ru_idrss; | |
long ru_isrss; | |
long ru_minflt; | |
long ru_majflt; | |
long ru_nswap; | |
long ru_inblock; | |
long ru_oublock; | |
long ru_msgsnd; | |
long ru_msgrcv; | |
long ru_nsignals; | |
long ru_nvcsw; | |
long ru_nivcsw; | |
}; | |
# 222 "/usr/include/sys/resource.h" 3 4 | |
struct rlimit { | |
rlim_t rlim_cur; | |
rlim_t rlim_max; | |
}; | |
# 245 "/usr/include/sys/resource.h" 3 4 | |
extern "C" { | |
int getpriority(int, id_t); | |
int getiopolicy_np(int, int) __attribute__((visibility("default"))); | |
int getrlimit(int, struct rlimit *) __asm("_" "getrlimit" ); | |
int getrusage(int, struct rusage *); | |
int setpriority(int, id_t, int); | |
int setiopolicy_np(int, int, int) __attribute__((visibility("default"))); | |
int setrlimit(int, const struct rlimit *) __asm("_" "setrlimit" ); | |
} | |
# 118 "/usr/include/sys/wait.h" 2 3 4 | |
# 193 "/usr/include/sys/wait.h" 3 4 | |
# 1 "/usr/include/machine/endian.h" 1 3 4 | |
# 35 "/usr/include/machine/endian.h" 3 4 | |
# 1 "/usr/include/i386/endian.h" 1 3 4 | |
# 99 "/usr/include/i386/endian.h" 3 4 | |
# 1 "/usr/include/sys/_endian.h" 1 3 4 | |
# 124 "/usr/include/sys/_endian.h" 3 4 | |
# 1 "/usr/include/libkern/_OSByteOrder.h" 1 3 4 | |
# 66 "/usr/include/libkern/_OSByteOrder.h" 3 4 | |
# 1 "/usr/include/libkern/i386/_OSByteOrder.h" 1 3 4 | |
# 44 "/usr/include/libkern/i386/_OSByteOrder.h" 3 4 | |
static inline | |
__uint16_t | |
_OSSwapInt16( | |
__uint16_t _data | |
) | |
{ | |
return ((_data << 8) | (_data >> 8)); | |
} | |
static inline | |
__uint32_t | |
_OSSwapInt32( | |
__uint32_t _data | |
) | |
{ | |
return __builtin_bswap32(_data); | |
} | |
static inline | |
__uint64_t | |
_OSSwapInt64( | |
__uint64_t _data | |
) | |
{ | |
return __builtin_bswap64(_data); | |
} | |
# 67 "/usr/include/libkern/_OSByteOrder.h" 2 3 4 | |
# 125 "/usr/include/sys/_endian.h" 2 3 4 | |
# 100 "/usr/include/i386/endian.h" 2 3 4 | |
# 36 "/usr/include/machine/endian.h" 2 3 4 | |
# 194 "/usr/include/sys/wait.h" 2 3 4 | |
union wait { | |
int w_status; | |
struct { | |
unsigned int w_Termsig:7, | |
w_Coredump:1, | |
w_Retcode:8, | |
w_Filler:16; | |
} w_T; | |
struct { | |
unsigned int w_Stopval:8, | |
w_Stopsig:8, | |
w_Filler:16; | |
} w_S; | |
}; | |
# 254 "/usr/include/sys/wait.h" 3 4 | |
extern "C" { | |
pid_t wait(int *) __asm("_" "wait" ); | |
pid_t waitpid(pid_t, int *, int) __asm("_" "waitpid" ); | |
int waitid(idtype_t, id_t, siginfo_t *, int) __asm("_" "waitid" ); | |
pid_t wait3(int *, int, struct rusage *); | |
pid_t wait4(pid_t, int *, int, struct rusage *); | |
} | |
# 66 "/usr/include/stdlib.h" 2 3 4 | |
# 1 "/usr/include/alloca.h" 1 3 4 | |
# 35 "/usr/include/alloca.h" 3 4 | |
extern "C" { | |
void *alloca(size_t); | |
} | |
# 68 "/usr/include/stdlib.h" 2 3 4 | |
# 81 "/usr/include/stdlib.h" 3 4 | |
typedef __darwin_ct_rune_t ct_rune_t; | |
typedef __darwin_rune_t rune_t; | |
# 97 "/usr/include/stdlib.h" 3 4 | |
typedef struct { | |
int quot; | |
int rem; | |
} div_t; | |
typedef struct { | |
long quot; | |
long rem; | |
} ldiv_t; | |
typedef struct { | |
long long quot; | |
long long rem; | |
} lldiv_t; | |
# 134 "/usr/include/stdlib.h" 3 4 | |
extern int __mb_cur_max; | |
# 144 "/usr/include/stdlib.h" 3 4 | |
extern "C" { | |
void abort(void) __attribute__((noreturn)); | |
int abs(int) __attribute__((const)); | |
int atexit(void (*)(void)); | |
double atof(const char *); | |
int atoi(const char *); | |
long atol(const char *); | |
long long | |
atoll(const char *); | |
void *bsearch(const void *, const void *, size_t, | |
size_t, int (*)(const void *, const void *)); | |
void *calloc(size_t, size_t); | |
div_t div(int, int) __attribute__((const)); | |
void exit(int) __attribute__((noreturn)); | |
void free(void *); | |
char *getenv(const char *); | |
long labs(long) __attribute__((const)); | |
ldiv_t ldiv(long, long) __attribute__((const)); | |
long long | |
llabs(long long); | |
lldiv_t lldiv(long long, long long); | |
void *malloc(size_t); | |
int mblen(const char *, size_t); | |
size_t mbstowcs(wchar_t * , const char * , size_t); | |
int mbtowc(wchar_t * , const char * , size_t); | |
int posix_memalign(void **, size_t, size_t) __attribute__((visibility("default"))); | |
void qsort(void *, size_t, size_t, | |
int (*)(const void *, const void *)); | |
int rand(void); | |
void *realloc(void *, size_t); | |
void srand(unsigned); | |
double strtod(const char *, char **) __asm("_" "strtod" ); | |
float strtof(const char *, char **) __asm("_" "strtof" ); | |
long strtol(const char *, char **, int); | |
long double | |
strtold(const char *, char **); | |
long long | |
strtoll(const char *, char **, int); | |
unsigned long | |
strtoul(const char *, char **, int); | |
unsigned long long | |
strtoull(const char *, char **, int); | |
int system(const char *) __asm("_" "system" ); | |
size_t wcstombs(char * , const wchar_t * , size_t); | |
int wctomb(char *, wchar_t); | |
void _Exit(int) __attribute__((noreturn)); | |
long a64l(const char *); | |
double drand48(void); | |
char *ecvt(double, int, int *, int *); | |
double erand48(unsigned short[3]); | |
char *fcvt(double, int, int *, int *); | |
char *gcvt(double, int, char *); | |
int getsubopt(char **, char * const *, char **); | |
int grantpt(int); | |
char *initstate(unsigned, char *, size_t); | |
long jrand48(unsigned short[3]); | |
char *l64a(long); | |
void lcong48(unsigned short[7]); | |
long lrand48(void); | |
char *mktemp(char *); | |
int mkstemp(char *); | |
long mrand48(void); | |
long nrand48(unsigned short[3]); | |
int posix_openpt(int); | |
char *ptsname(int); | |
int putenv(char *) __asm("_" "putenv" ); | |
long random(void); | |
int rand_r(unsigned *); | |
char *realpath(const char * , char * ) __asm("_" "realpath" "$DARWIN_EXTSN"); | |
unsigned short | |
*seed48(unsigned short[3]); | |
int setenv(const char *, const char *, int) __asm("_" "setenv" ); | |
void setkey(const char *) __asm("_" "setkey" ); | |
char *setstate(const char *); | |
void srand48(long); | |
void srandom(unsigned); | |
int unlockpt(int); | |
int unsetenv(const char *) __asm("_" "unsetenv" ); | |
# 1 "/usr/include/machine/types.h" 1 3 4 | |
# 35 "/usr/include/machine/types.h" 3 4 | |
# 1 "/usr/include/i386/types.h" 1 3 4 | |
# 70 "/usr/include/i386/types.h" 3 4 | |
# 1 "/usr/include/i386/_types.h" 1 3 4 | |
# 71 "/usr/include/i386/types.h" 2 3 4 | |
typedef signed char int8_t; | |
typedef unsigned char u_int8_t; | |
typedef short int16_t; | |
typedef unsigned short u_int16_t; | |
typedef int int32_t; | |
typedef unsigned int u_int32_t; | |
typedef long long int64_t; | |
typedef unsigned long long u_int64_t; | |
typedef int64_t register_t; | |
# 109 "/usr/include/i386/types.h" 3 4 | |
typedef unsigned long uintptr_t; | |
typedef u_int64_t user_addr_t; | |
typedef u_int64_t user_size_t; | |
typedef int64_t user_ssize_t; | |
typedef int64_t user_long_t; | |
typedef u_int64_t user_ulong_t; | |
typedef int64_t user_time_t; | |
typedef int64_t user_off_t; | |
typedef u_int64_t syscall_arg_t; | |
# 36 "/usr/include/machine/types.h" 2 3 4 | |
# 256 "/usr/include/stdlib.h" 2 3 4 | |
# 267 "/usr/include/stdlib.h" 3 4 | |
u_int32_t | |
arc4random(void); | |
void arc4random_addrandom(unsigned char * , int ); | |
void arc4random_buf(void * , size_t ) __attribute__((visibility("default"))); | |
void arc4random_stir(void); | |
u_int32_t | |
arc4random_uniform(u_int32_t ) __attribute__((visibility("default"))); | |
int atexit_b(void (^)(void)) __attribute__((visibility("default"))); | |
void *bsearch_b(const void *, const void *, size_t, | |
size_t, int (^)(const void *, const void *)) __attribute__((visibility("default"))); | |
char *cgetcap(char *, const char *, int); | |
int cgetclose(void); | |
int cgetent(char **, char **, const char *); | |
int cgetfirst(char **, char **); | |
int cgetmatch(const char *, const char *); | |
int cgetnext(char **, char **); | |
int cgetnum(char *, const char *, long *); | |
int cgetset(const char *); | |
int cgetstr(char *, const char *, char **); | |
int cgetustr(char *, const char *, char **); | |
int daemon(int, int) __asm("_" "daemon" "$1050") __attribute__((deprecated,visibility("default"))); | |
char *devname(dev_t, mode_t); | |
char *devname_r(dev_t, mode_t, char *buf, int len); | |
char *getbsize(int *, long *); | |
int getloadavg(double [], int); | |
const char | |
*getprogname(void); | |
int heapsort(void *, size_t, size_t, | |
int (*)(const void *, const void *)); | |
int heapsort_b(void *, size_t, size_t, | |
int (^)(const void *, const void *)) __attribute__((visibility("default"))); | |
int mergesort(void *, size_t, size_t, | |
int (*)(const void *, const void *)); | |
int mergesort_b(void *, size_t, size_t, | |
int (^)(const void *, const void *)) __attribute__((visibility("default"))); | |
void psort(void *, size_t, size_t, | |
int (*)(const void *, const void *)) __attribute__((visibility("default"))); | |
void psort_b(void *, size_t, size_t, | |
int (^)(const void *, const void *)) __attribute__((visibility("default"))); | |
void psort_r(void *, size_t, size_t, void *, | |
int (*)(void *, const void *, const void *)) __attribute__((visibility("default"))); | |
void qsort_b(void *, size_t, size_t, | |
int (^)(const void *, const void *)) __attribute__((visibility("default"))); | |
void qsort_r(void *, size_t, size_t, void *, | |
int (*)(void *, const void *, const void *)); | |
int radixsort(const unsigned char **, int, const unsigned char *, | |
unsigned); | |
void setprogname(const char *); | |
int sradixsort(const unsigned char **, int, const unsigned char *, | |
unsigned); | |
void sranddev(void); | |
void srandomdev(void); | |
void *reallocf(void *, size_t); | |
long long | |
strtoq(const char *, char **, int); | |
unsigned long long | |
strtouq(const char *, char **, int); | |
extern char *suboptarg; | |
void *valloc(size_t); | |
} | |
# 73 "/usr/include/c++/4.2.1/cstdlib" 2 3 | |
# 104 "/usr/include/c++/4.2.1/cstdlib" 3 | |
namespace std { | |
using ::div_t; | |
using ::ldiv_t; | |
using ::abort; | |
using ::abs; | |
using ::atexit; | |
using ::atof; | |
using ::atoi; | |
using ::atol; | |
using ::bsearch; | |
using ::calloc; | |
using ::div; | |
using ::exit; | |
using ::free; | |
using ::getenv; | |
using ::labs; | |
using ::ldiv; | |
using ::malloc; | |
using ::mblen; | |
using ::mbstowcs; | |
using ::mbtowc; | |
using ::qsort; | |
using ::rand; | |
using ::realloc; | |
using ::srand; | |
using ::strtod; | |
using ::strtol; | |
using ::strtoul; | |
using ::system; | |
using ::wcstombs; | |
using ::wctomb; | |
inline long | |
abs(long __i) { return labs(__i); } | |
inline ldiv_t | |
div(long __i, long __j) { return ldiv(__i, __j); } | |
} | |
# 161 "/usr/include/c++/4.2.1/cstdlib" 3 | |
namespace __gnu_cxx { | |
using ::lldiv_t; | |
using ::_Exit; | |
inline long long | |
abs(long long __x) { return __x >= 0 ? __x : -__x; } | |
using ::llabs; | |
inline lldiv_t | |
div(long long __n, long long __d) | |
{ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } | |
using ::lldiv; | |
# 194 "/usr/include/c++/4.2.1/cstdlib" 3 | |
using ::atoll; | |
using ::strtoll; | |
using ::strtoull; | |
using ::strtof; | |
using ::strtold; | |
} | |
namespace std { | |
using ::__gnu_cxx::lldiv_t; | |
using ::__gnu_cxx::_Exit; | |
using ::__gnu_cxx::abs; | |
using ::__gnu_cxx::llabs; | |
using ::__gnu_cxx::div; | |
using ::__gnu_cxx::lldiv; | |
using ::__gnu_cxx::atoll; | |
using ::__gnu_cxx::strtof; | |
using ::__gnu_cxx::strtoll; | |
using ::__gnu_cxx::strtoull; | |
using ::__gnu_cxx::strtold; | |
} | |
# 48 "port.cpp" 2 | |
# 1 "/usr/include/time.h" 1 3 4 | |
# 69 "/usr/include/time.h" 3 4 | |
# 1 "/usr/include/_structs.h" 1 3 4 | |
# 24 "/usr/include/_structs.h" 3 4 | |
# 1 "/usr/include/sys/_structs.h" 1 3 4 | |
# 25 "/usr/include/_structs.h" 2 3 4 | |
# 70 "/usr/include/time.h" 2 3 4 | |
typedef __darwin_clock_t clock_t; | |
# 90 "/usr/include/time.h" 3 4 | |
struct tm { | |
int tm_sec; | |
int tm_min; | |
int tm_hour; | |
int tm_mday; | |
int tm_mon; | |
int tm_year; | |
int tm_wday; | |
int tm_yday; | |
int tm_isdst; | |
long tm_gmtoff; | |
char *tm_zone; | |
}; | |
# 113 "/usr/include/time.h" 3 4 | |
extern char *tzname[]; | |
extern int getdate_err; | |
extern long timezone __asm("_" "timezone" ); | |
extern int daylight; | |
extern "C" { | |
char *asctime(const struct tm *); | |
clock_t clock(void) __asm("_" "clock" ); | |
char *ctime(const time_t *); | |
double difftime(time_t, time_t); | |
struct tm *getdate(const char *); | |
struct tm *gmtime(const time_t *); | |
struct tm *localtime(const time_t *); | |
time_t mktime(struct tm *) __asm("_" "mktime" ); | |
size_t strftime(char * , size_t, const char * , const struct tm * ) __asm("_" "strftime" ); | |
char *strptime(const char * , const char * , struct tm * ) __asm("_" "strptime" ); | |
time_t time(time_t *); | |
void tzset(void); | |
char *asctime_r(const struct tm * , char * ); | |
char *ctime_r(const time_t *, char *); | |
struct tm *gmtime_r(const time_t * , struct tm * ); | |
struct tm *localtime_r(const time_t * , struct tm * ); | |
time_t posix2time(time_t); | |
void tzsetwall(void); | |
time_t time2posix(time_t); | |
time_t timelocal(struct tm * const); | |
time_t timegm(struct tm * const); | |
int nanosleep(const struct timespec *, struct timespec *) __asm("_" "nanosleep" ); | |
} | |
# 49 "port.cpp" 2 | |
# 1 "/usr/include/errno.h" 1 3 4 | |
# 23 "/usr/include/errno.h" 3 4 | |
# 1 "/usr/include/sys/errno.h" 1 3 4 | |
# 74 "/usr/include/sys/errno.h" 3 4 | |
extern "C" { | |
extern int * __error(void); | |
} | |
# 24 "/usr/include/errno.h" 2 3 4 | |
# 51 "port.cpp" 2 | |
# 1 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" 1 | |
# 40 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
# 1 "/usr/include/errno.h" 1 3 4 | |
# 41 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" 2 | |
# 1 "/usr/include/netdb.h" 1 3 4 | |
# 87 "/usr/include/netdb.h" 3 4 | |
# 1 "/usr/include/stdint.h" 1 3 4 | |
# 40 "/usr/include/stdint.h" 3 4 | |
typedef unsigned char uint8_t; | |
typedef unsigned short uint16_t; | |
typedef unsigned int uint32_t; | |
typedef unsigned long long uint64_t; | |
typedef int8_t int_least8_t; | |
typedef int16_t int_least16_t; | |
typedef int32_t int_least32_t; | |
typedef int64_t int_least64_t; | |
typedef uint8_t uint_least8_t; | |
typedef uint16_t uint_least16_t; | |
typedef uint32_t uint_least32_t; | |
typedef uint64_t uint_least64_t; | |
typedef int8_t int_fast8_t; | |
typedef int16_t int_fast16_t; | |
typedef int32_t int_fast32_t; | |
typedef int64_t int_fast64_t; | |
typedef uint8_t uint_fast8_t; | |
typedef uint16_t uint_fast16_t; | |
typedef uint32_t uint_fast32_t; | |
typedef uint64_t uint_fast64_t; | |
# 97 "/usr/include/stdint.h" 3 4 | |
typedef long int intmax_t; | |
# 106 "/usr/include/stdint.h" 3 4 | |
typedef long unsigned int uintmax_t; | |
# 88 "/usr/include/netdb.h" 2 3 4 | |
# 1 "/usr/include/netinet/in.h" 1 3 4 | |
# 74 "/usr/include/netinet/in.h" 3 4 | |
typedef __uint32_t in_addr_t; | |
typedef __uint16_t in_port_t; | |
# 1 "/usr/include/sys/socket.h" 1 3 4 | |
# 75 "/usr/include/sys/socket.h" 3 4 | |
# 1 "/usr/include/sys/types.h" 1 3 4 | |
# 84 "/usr/include/sys/types.h" 3 4 | |
typedef unsigned char u_char; | |
typedef unsigned short u_short; | |
typedef unsigned int u_int; | |
typedef unsigned long u_long; | |
typedef unsigned short ushort; | |
typedef unsigned int uint; | |
typedef u_int64_t u_quad_t; | |
typedef int64_t quad_t; | |
typedef quad_t * qaddr_t; | |
typedef char * caddr_t; | |
typedef int32_t daddr_t; | |
typedef u_int32_t fixpt_t; | |
typedef __darwin_blkcnt_t blkcnt_t; | |
typedef __darwin_blksize_t blksize_t; | |
# 135 "/usr/include/sys/types.h" 3 4 | |
typedef __darwin_ino_t ino_t; | |
typedef __darwin_ino64_t ino64_t; | |
typedef __int32_t key_t; | |
# 157 "/usr/include/sys/types.h" 3 4 | |
typedef __uint16_t nlink_t; | |
# 176 "/usr/include/sys/types.h" 3 4 | |
typedef int32_t segsz_t; | |
typedef int32_t swblk_t; | |
# 197 "/usr/include/sys/types.h" 3 4 | |
static inline __int32_t major(__uint32_t _x) | |
{ | |
return (__int32_t)(((__uint32_t)_x >> 24) & 0xff); | |
} | |
static inline __int32_t minor(__uint32_t _x) | |
{ | |
return (__int32_t)((_x) & 0xffffff); | |
} | |
static inline dev_t makedev(__uint32_t _major, __uint32_t _minor) | |
{ | |
return (dev_t)(((_major) << 24) | (_minor)); | |
} | |
# 260 "/usr/include/sys/types.h" 3 4 | |
# 1 "/usr/include/sys/_structs.h" 1 3 4 | |
# 261 "/usr/include/sys/types.h" 2 3 4 | |
typedef __int32_t fd_mask; | |
# 307 "/usr/include/sys/types.h" 3 4 | |
typedef __darwin_pthread_cond_t pthread_cond_t; | |
typedef __darwin_pthread_condattr_t pthread_condattr_t; | |
typedef __darwin_pthread_mutex_t pthread_mutex_t; | |
typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t; | |
typedef __darwin_pthread_once_t pthread_once_t; | |
typedef __darwin_pthread_rwlock_t pthread_rwlock_t; | |
typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t; | |
typedef __darwin_pthread_t pthread_t; | |
typedef __darwin_pthread_key_t pthread_key_t; | |
typedef __darwin_fsblkcnt_t fsblkcnt_t; | |
typedef __darwin_fsfilcnt_t fsfilcnt_t; | |
# 76 "/usr/include/sys/socket.h" 2 3 4 | |
# 1 "/usr/include/machine/_param.h" 1 3 4 | |
# 29 "/usr/include/machine/_param.h" 3 4 | |
# 1 "/usr/include/i386/_param.h" 1 3 4 | |
# 30 "/usr/include/machine/_param.h" 2 3 4 | |
# 78 "/usr/include/sys/socket.h" 2 3 4 | |
# 106 "/usr/include/sys/socket.h" 3 4 | |
typedef __uint8_t sa_family_t; | |
typedef __darwin_socklen_t socklen_t; | |
# 131 "/usr/include/sys/socket.h" 3 4 | |
struct iovec { | |
void * iov_base; | |
size_t iov_len; | |
}; | |
# 220 "/usr/include/sys/socket.h" 3 4 | |
struct linger { | |
int l_onoff; | |
int l_linger; | |
}; | |
# 238 "/usr/include/sys/socket.h" 3 4 | |
struct so_np_extensions { | |
u_int32_t npx_flags; | |
u_int32_t npx_mask; | |
}; | |
# 326 "/usr/include/sys/socket.h" 3 4 | |
struct sockaddr { | |
__uint8_t sa_len; | |
sa_family_t sa_family; | |
char sa_data[14]; | |
}; | |
# 339 "/usr/include/sys/socket.h" 3 4 | |
struct sockproto { | |
__uint16_t sp_family; | |
__uint16_t sp_protocol; | |
}; | |
# 359 "/usr/include/sys/socket.h" 3 4 | |
struct sockaddr_storage { | |
__uint8_t ss_len; | |
sa_family_t ss_family; | |
char __ss_pad1[((sizeof(__int64_t)) - sizeof(__uint8_t) - sizeof(sa_family_t))]; | |
__int64_t __ss_align; | |
char __ss_pad2[(128 - sizeof(__uint8_t) - sizeof(sa_family_t) - ((sizeof(__int64_t)) - sizeof(__uint8_t) - sizeof(sa_family_t)) - (sizeof(__int64_t)))]; | |
}; | |
# 469 "/usr/include/sys/socket.h" 3 4 | |
struct msghdr { | |
void *msg_name; | |
socklen_t msg_namelen; | |
struct iovec *msg_iov; | |
int msg_iovlen; | |
void *msg_control; | |
socklen_t msg_controllen; | |
int msg_flags; | |
}; | |
# 509 "/usr/include/sys/socket.h" 3 4 | |
struct cmsghdr { | |
socklen_t cmsg_len; | |
int cmsg_level; | |
int cmsg_type; | |
}; | |
# 599 "/usr/include/sys/socket.h" 3 4 | |
struct sf_hdtr { | |
struct iovec *headers; | |
int hdr_cnt; | |
struct iovec *trailers; | |
int trl_cnt; | |
}; | |
extern "C" { | |
int accept(int, struct sockaddr * , socklen_t * ) | |
__asm("_" "accept" ); | |
int bind(int, const struct sockaddr *, socklen_t) __asm("_" "bind" ); | |
int connect(int, const struct sockaddr *, socklen_t) __asm("_" "connect" ); | |
int getpeername(int, struct sockaddr * , socklen_t * ) | |
__asm("_" "getpeername" ); | |
int getsockname(int, struct sockaddr * , socklen_t * ) | |
__asm("_" "getsockname" ); | |
int getsockopt(int, int, int, void * , socklen_t * ); | |
int listen(int, int) __asm("_" "listen" ); | |
ssize_t recv(int, void *, size_t, int) __asm("_" "recv" ); | |
ssize_t recvfrom(int, void *, size_t, int, struct sockaddr * , | |
socklen_t * ) __asm("_" "recvfrom" ); | |
ssize_t recvmsg(int, struct msghdr *, int) __asm("_" "recvmsg" ); | |
ssize_t send(int, const void *, size_t, int) __asm("_" "send" ); | |
ssize_t sendmsg(int, const struct msghdr *, int) __asm("_" "sendmsg" ); | |
ssize_t sendto(int, const void *, size_t, | |
int, const struct sockaddr *, socklen_t) __asm("_" "sendto" ); | |
int setsockopt(int, int, int, const void *, socklen_t); | |
int shutdown(int, int); | |
int sockatmark(int) __attribute__((visibility("default"))); | |
int socket(int, int, int); | |
int socketpair(int, int, int, int *) __asm("_" "socketpair" ); | |
int sendfile(int, int, off_t, off_t *, struct sf_hdtr *, int); | |
void pfctlinput(int, struct sockaddr *); | |
} | |
# 88 "/usr/include/netinet/in.h" 2 3 4 | |
# 307 "/usr/include/netinet/in.h" 3 4 | |
struct in_addr { | |
in_addr_t s_addr; | |
}; | |
# 380 "/usr/include/netinet/in.h" 3 4 | |
struct sockaddr_in { | |
__uint8_t sin_len; | |
sa_family_t sin_family; | |
in_port_t sin_port; | |
struct in_addr sin_addr; | |
char sin_zero[8]; | |
}; | |
# 398 "/usr/include/netinet/in.h" 3 4 | |
struct ip_opts { | |
struct in_addr ip_dst; | |
char ip_opts[40]; | |
}; | |
# 506 "/usr/include/netinet/in.h" 3 4 | |
struct ip_mreq { | |
struct in_addr imr_multiaddr; | |
struct in_addr imr_interface; | |
}; | |
struct ip_mreqn { | |
struct in_addr imr_multiaddr; | |
struct in_addr imr_address; | |
int imr_ifindex; | |
}; | |
#pragma pack(4) | |
struct ip_mreq_source { | |
struct in_addr imr_multiaddr; | |
struct in_addr imr_sourceaddr; | |
struct in_addr imr_interface; | |
}; | |
struct group_req { | |
uint32_t gr_interface; | |
struct sockaddr_storage gr_group; | |
}; | |
struct group_source_req { | |
uint32_t gsr_interface; | |
struct sockaddr_storage gsr_group; | |
struct sockaddr_storage gsr_source; | |
}; | |
# 554 "/usr/include/netinet/in.h" 3 4 | |
struct __msfilterreq { | |
uint32_t msfr_ifindex; | |
uint32_t msfr_fmode; | |
uint32_t msfr_nsrcs; | |
uint32_t __msfr_align; | |
struct sockaddr_storage msfr_group; | |
struct sockaddr_storage *msfr_srcs; | |
}; | |
#pragma pack() | |
struct sockaddr; | |
int setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t, | |
uint32_t, struct in_addr *) __attribute__((visibility("default"))); | |
int getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *, | |
uint32_t *, struct in_addr *) __attribute__((visibility("default"))); | |
int setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, | |
uint32_t, uint32_t, struct sockaddr_storage *) __attribute__((visibility("default"))); | |
int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, | |
uint32_t *, uint32_t *, struct sockaddr_storage *) __attribute__((visibility("default"))); | |
# 617 "/usr/include/netinet/in.h" 3 4 | |
struct in_pktinfo { | |
unsigned int ipi_ifindex; | |
struct in_addr ipi_spec_dst; | |
struct in_addr ipi_addr; | |
}; | |
# 661 "/usr/include/netinet/in.h" 3 4 | |
# 1 "/usr/include/netinet6/in6.h" 1 3 4 | |
# 158 "/usr/include/netinet6/in6.h" 3 4 | |
struct in6_addr { | |
union { | |
__uint8_t __u6_addr8[16]; | |
__uint16_t __u6_addr16[8]; | |
__uint32_t __u6_addr32[4]; | |
} __u6_addr; | |
}; | |
# 176 "/usr/include/netinet6/in6.h" 3 4 | |
struct sockaddr_in6 { | |
__uint8_t sin6_len; | |
sa_family_t sin6_family; | |
in_port_t sin6_port; | |
__uint32_t sin6_flowinfo; | |
struct in6_addr sin6_addr; | |
__uint32_t sin6_scope_id; | |
}; | |
# 218 "/usr/include/netinet6/in6.h" 3 4 | |
extern const struct in6_addr in6addr_any; | |
extern const struct in6_addr in6addr_loopback; | |
extern const struct in6_addr in6addr_nodelocal_allnodes; | |
extern const struct in6_addr in6addr_linklocal_allnodes; | |
extern const struct in6_addr in6addr_linklocal_allrouters; | |
extern const struct in6_addr in6addr_linklocal_allv2routers; | |
# 526 "/usr/include/netinet6/in6.h" 3 4 | |
struct ipv6_mreq { | |
struct in6_addr ipv6mr_multiaddr; | |
unsigned int ipv6mr_interface; | |
}; | |
struct in6_pktinfo { | |
struct in6_addr ipi6_addr; | |
unsigned int ipi6_ifindex; | |
}; | |
struct ip6_mtuinfo { | |
struct sockaddr_in6 ip6m_addr; | |
uint32_t ip6m_mtu; | |
}; | |
# 621 "/usr/include/netinet6/in6.h" 3 4 | |
extern "C" { | |
struct cmsghdr; | |
extern int inet6_option_space(int); | |
extern int inet6_option_init(void *, struct cmsghdr **, int); | |
extern int inet6_option_append(struct cmsghdr *, const __uint8_t *, | |
int, int); | |
extern __uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int); | |
extern int inet6_option_next(const struct cmsghdr *, __uint8_t **); | |
extern int inet6_option_find(const struct cmsghdr *, __uint8_t **, int); | |
extern size_t inet6_rthdr_space(int, int); | |
extern struct cmsghdr *inet6_rthdr_init(void *, int); | |
extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *, | |
unsigned int); | |
extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int); | |
extern int inet6_rthdr_segments(const struct cmsghdr *); | |
extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int); | |
extern int inet6_rthdr_getflags(const struct cmsghdr *, int); | |
extern int inet6_opt_init(void *, socklen_t); | |
extern int inet6_opt_append(void *, socklen_t, int, __uint8_t, | |
socklen_t, __uint8_t, void **); | |
extern int inet6_opt_finish(void *, socklen_t, int); | |
extern int inet6_opt_set_val(void *, int, void *, socklen_t); | |
extern int inet6_opt_next(void *, socklen_t, int, __uint8_t *, | |
socklen_t *, void **); | |
extern int inet6_opt_find(void *, socklen_t, int, __uint8_t, | |
socklen_t *, void **); | |
extern int inet6_opt_get_val(void *, int, void *, socklen_t); | |
extern socklen_t inet6_rth_space(int, int); | |
extern void *inet6_rth_init(void *, socklen_t, int, int); | |
extern int inet6_rth_add(void *, const struct in6_addr *); | |
extern int inet6_rth_reverse(const void *, void *); | |
extern int inet6_rth_segments(const void *); | |
extern struct in6_addr *inet6_rth_getaddr(const void *, int); | |
extern void addrsel_policy_init(void); | |
} | |
# 662 "/usr/include/netinet/in.h" 2 3 4 | |
extern "C" { | |
int bindresvport(int, struct sockaddr_in *); | |
struct sockaddr; | |
int bindresvport_sa(int, struct sockaddr *); | |
} | |
# 89 "/usr/include/netdb.h" 2 3 4 | |
# 108 "/usr/include/netdb.h" 3 4 | |
extern int h_errno; | |
# 119 "/usr/include/netdb.h" 3 4 | |
struct hostent { | |
char *h_name; | |
char **h_aliases; | |
int h_addrtype; | |
int h_length; | |
char **h_addr_list; | |
}; | |
struct netent { | |
char *n_name; | |
char **n_aliases; | |
int n_addrtype; | |
uint32_t n_net; | |
}; | |
struct servent { | |
char *s_name; | |
char **s_aliases; | |
int s_port; | |
char *s_proto; | |
}; | |
struct protoent { | |
char *p_name; | |
char **p_aliases; | |
int p_proto; | |
}; | |
struct addrinfo { | |
int ai_flags; | |
int ai_family; | |
int ai_socktype; | |
int ai_protocol; | |
socklen_t ai_addrlen; | |
char *ai_canonname; | |
struct sockaddr *ai_addr; | |
struct addrinfo *ai_next; | |
}; | |
struct rpcent { | |
char *r_name; | |
char **r_aliases; | |
int r_number; | |
}; | |
# 264 "/usr/include/netdb.h" 3 4 | |
extern "C" { | |
void endhostent(void); | |
void endnetent(void); | |
void endprotoent(void); | |
void endservent(void); | |
void freeaddrinfo(struct addrinfo *); | |
const char *gai_strerror(int); | |
int getaddrinfo(const char * , const char * , | |
const struct addrinfo * , | |
struct addrinfo ** ); | |
struct hostent *gethostbyaddr(const void *, socklen_t, int); | |
struct hostent *gethostbyname(const char *); | |
struct hostent *gethostent(void); | |
int getnameinfo(const struct sockaddr * , socklen_t, | |
char * , socklen_t, char * , | |
socklen_t, int); | |
struct netent *getnetbyaddr(uint32_t, int); | |
struct netent *getnetbyname(const char *); | |
struct netent *getnetent(void); | |
struct protoent *getprotobyname(const char *); | |
struct protoent *getprotobynumber(int); | |
struct protoent *getprotoent(void); | |
struct servent *getservbyname(const char *, const char *); | |
struct servent *getservbyport(int, const char *); | |
struct servent *getservent(void); | |
void sethostent(int); | |
void setnetent(int); | |
void setprotoent(int); | |
void setservent(int); | |
void freehostent(struct hostent *); | |
struct hostent *gethostbyname2(const char *, int); | |
struct hostent *getipnodebyaddr(const void *, size_t, int, int *); | |
struct hostent *getipnodebyname(const char *, int, int, int *); | |
struct rpcent *getrpcbyname(const char *name); | |
struct rpcent *getrpcbynumber(int number); | |
struct rpcent *getrpcent(void); | |
void setrpcent(int stayopen); | |
void endrpcent(void); | |
void herror(const char *); | |
const char *hstrerror(int); | |
int innetgr(const char *, const char *, const char *, const char *); | |
int getnetgrent(char **, char **, char **); | |
void endnetgrent(void); | |
void setnetgrent(const char *); | |
} | |
# 44 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" 2 | |
# 145 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
extern "C" { | |
# 170 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
extern volatile int __erl_errno; | |
# 193 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
typedef enum { | |
ERLANG_ASCII = 1, | |
ERLANG_LATIN1 = 2, | |
ERLANG_UTF8 = 4, | |
}erlang_char_encoding; | |
typedef struct { | |
char node[(255*4 + 1)]; | |
unsigned int num; | |
unsigned int serial; | |
unsigned int creation; | |
} erlang_pid; | |
typedef struct { | |
char node[(255*4 + 1)]; | |
unsigned int id; | |
unsigned int creation; | |
} erlang_port; | |
typedef struct { | |
char node[(255*4 + 1)]; | |
int len; | |
unsigned int n[3]; | |
unsigned int creation; | |
} erlang_ref; | |
typedef struct { | |
long serial; | |
long prev; | |
erlang_pid from; | |
long label; | |
long flags; | |
} erlang_trace; | |
typedef struct { | |
long msgtype; | |
erlang_pid from; | |
erlang_pid to; | |
char toname[(255*4 + 1)]; | |
char cookie[(255*4 + 1)]; | |
erlang_trace token; | |
} erlang_msg; | |
typedef struct { | |
long arity; | |
char module[(255*4 + 1)]; | |
erlang_char_encoding module_org_enc; | |
char md5[16]; | |
long index; | |
long old_index; | |
long uniq; | |
long n_free_vars; | |
erlang_pid pid; | |
long free_var_len; | |
char* free_vars; | |
} erlang_fun; | |
typedef struct { | |
unsigned int arity; | |
int is_neg; | |
void *digits; | |
} erlang_big; | |
typedef struct { | |
char ei_type; | |
int arity; | |
int size; | |
union { | |
long i_val; | |
double d_val; | |
char atom_name[(255*4 + 1)]; | |
erlang_pid pid; | |
erlang_port port; | |
erlang_ref ref; | |
} value; | |
} ei_term; | |
typedef struct { | |
char ipadr[4]; | |
char nodename[63 +1+64 +1]; | |
} ErlConnect; | |
typedef struct ei_cnode_s { | |
char thishostname[64 +1]; | |
char thisnodename[63 +1+64 +1]; | |
char thisalivename[63 +1]; | |
char ei_connect_cookie[512 +1]; | |
short creation; | |
erlang_pid self; | |
} ei_cnode; | |
typedef struct in_addr *Erl_IpAddr; | |
typedef struct ei_x_buff_TAG { | |
char* buff; | |
int buffsz; | |
int index; | |
} ei_x_buff; | |
# 313 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_connect_init(ei_cnode* ec, const char* this_node_name, | |
const char *cookie, short creation); | |
int ei_connect_xinit (ei_cnode* ec, const char *thishostname, | |
const char *thisalivename, const char *thisnodename, | |
Erl_IpAddr thisipaddr, const char *cookie, | |
const short creation); | |
int ei_connect(ei_cnode* ec, char *nodename); | |
int ei_connect_tmo(ei_cnode* ec, char *nodename, unsigned ms); | |
int ei_xconnect(ei_cnode* ec, Erl_IpAddr adr, char *alivename); | |
int ei_xconnect_tmo(ei_cnode* ec, Erl_IpAddr adr, char *alivename, unsigned ms); | |
int ei_receive(int fd, unsigned char *bufp, int bufsize); | |
int ei_receive_tmo(int fd, unsigned char *bufp, int bufsize, unsigned ms); | |
int ei_receive_msg(int fd, erlang_msg* msg, ei_x_buff* x); | |
int ei_receive_msg_tmo(int fd, erlang_msg* msg, ei_x_buff* x, unsigned ms); | |
int ei_xreceive_msg(int fd, erlang_msg* msg, ei_x_buff* x); | |
int ei_xreceive_msg_tmo(int fd, erlang_msg* msg, ei_x_buff* x, unsigned ms); | |
int ei_send(int fd, erlang_pid* to, char* buf, int len); | |
int ei_send_tmo(int fd, erlang_pid* to, char* buf, int len, unsigned ms); | |
int ei_reg_send(ei_cnode* ec, int fd, char *server_name, char* buf, int len); | |
int ei_reg_send_tmo(ei_cnode* ec, int fd, char *server_name, char* buf, int len, unsigned ms); | |
int ei_rpc(ei_cnode* ec, int fd, char *mod, char *fun, | |
const char* inbuf, int inbuflen, ei_x_buff* x); | |
int ei_rpc_to(ei_cnode* ec, int fd, char *mod, char *fun, | |
const char* buf, int len); | |
int ei_rpc_from(ei_cnode* ec, int fd, int timeout, erlang_msg* msg, | |
ei_x_buff* x); | |
int ei_publish(ei_cnode* ec, int port); | |
int ei_publish_tmo(ei_cnode* ec, int port, unsigned ms); | |
int ei_accept(ei_cnode* ec, int lfd, ErlConnect *conp); | |
int ei_accept_tmo(ei_cnode* ec, int lfd, ErlConnect *conp, unsigned ms); | |
int ei_unpublish(ei_cnode* ec); | |
int ei_unpublish_tmo(const char *alive, unsigned ms); | |
const char *ei_thisnodename(const ei_cnode* ec); | |
const char *ei_thishostname(const ei_cnode* ec); | |
const char *ei_thisalivename(const ei_cnode* ec); | |
erlang_pid *ei_self(ei_cnode* ec); | |
void ei_set_compat_rel(unsigned rel); | |
void ei_set_tracelevel(int); | |
int ei_get_tracelevel(void); | |
# 404 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
struct hostent *ei_gethostbyname(const char *name); | |
struct hostent *ei_gethostbyaddr(const char *addr, int len, int type); | |
struct hostent *ei_gethostbyname_r(const char *name, | |
struct hostent *hostp, | |
char *buffer, | |
int buflen, | |
int *h_errnop); | |
struct hostent *ei_gethostbyaddr_r(const char *addr, | |
int length, | |
int type, | |
struct hostent *hostp, | |
char *buffer, | |
int buflen, | |
int *h_errnop); | |
int ei_encode_version(char *buf, int *index); | |
int ei_x_encode_version(ei_x_buff* x); | |
int ei_encode_long(char *buf, int *index, long p); | |
int ei_x_encode_long(ei_x_buff* x, long n); | |
int ei_encode_ulong(char *buf, int *index, unsigned long p); | |
int ei_x_encode_ulong(ei_x_buff* x, unsigned long n); | |
int ei_encode_double(char *buf, int *index, double p); | |
int ei_x_encode_double(ei_x_buff* x, double dbl); | |
int ei_encode_boolean(char *buf, int *index, int p); | |
int ei_x_encode_boolean(ei_x_buff* x, int p); | |
int ei_encode_char(char *buf, int *index, char p); | |
int ei_x_encode_char(ei_x_buff* x, char p); | |
int ei_encode_string(char *buf, int *index, const char *p); | |
int ei_encode_string_len(char *buf, int *index, const char *p, int len); | |
int ei_x_encode_string(ei_x_buff* x, const char* s); | |
int ei_x_encode_string_len(ei_x_buff* x, const char* s, int len); | |
int ei_encode_atom(char *buf, int *index, const char *p); | |
int ei_encode_atom_as(char *buf, int *index, const char *p, | |
erlang_char_encoding from, erlang_char_encoding to); | |
int ei_encode_atom_len(char *buf, int *index, const char *p, int len); | |
int ei_encode_atom_len_as(char *buf, int *index, const char *p, int len, | |
erlang_char_encoding from, erlang_char_encoding to); | |
int ei_x_encode_atom(ei_x_buff* x, const char* s); | |
int ei_x_encode_atom_as(ei_x_buff* x, const char* s, | |
erlang_char_encoding from, erlang_char_encoding to); | |
int ei_x_encode_atom_len(ei_x_buff* x, const char* s, int len); | |
int ei_x_encode_atom_len_as(ei_x_buff* x, const char* s, int len, | |
erlang_char_encoding from, erlang_char_encoding to); | |
int ei_encode_binary(char *buf, int *index, const void *p, long len); | |
int ei_x_encode_binary(ei_x_buff* x, const void* s, int len); | |
int ei_encode_pid(char *buf, int *index, const erlang_pid *p); | |
int ei_x_encode_pid(ei_x_buff* x, const erlang_pid* pid); | |
int ei_encode_fun(char* buf, int* index, const erlang_fun* p); | |
int ei_x_encode_fun(ei_x_buff* x, const erlang_fun* fun); | |
int ei_encode_port(char *buf, int *index, const erlang_port *p); | |
int ei_x_encode_port(ei_x_buff* x, const erlang_port *p); | |
int ei_encode_ref(char *buf, int *index, const erlang_ref *p); | |
int ei_x_encode_ref(ei_x_buff* x, const erlang_ref *p); | |
int ei_encode_term(char *buf, int *index, void *t); | |
int ei_x_encode_term(ei_x_buff* x, void* t); | |
int ei_encode_trace(char *buf, int *index, const erlang_trace *p); | |
int ei_x_encode_trace(ei_x_buff* x, const erlang_trace *p); | |
int ei_encode_tuple_header(char *buf, int *index, int arity); | |
int ei_x_encode_tuple_header(ei_x_buff* x, long n); | |
int ei_encode_list_header(char *buf, int *index, int arity); | |
int ei_x_encode_list_header(ei_x_buff* x, long n); | |
int ei_x_encode_empty_list(ei_x_buff* x); | |
# 480 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_get_type(const char *buf, const int *index, int *type, int *size); | |
int ei_get_type_internal(const char *buf, const int *index, int *type, | |
int *size); | |
# 491 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_decode_version(const char *buf, int *index, int *version); | |
int ei_decode_long(const char *buf, int *index, long *p); | |
int ei_decode_ulong(const char *buf, int *index, unsigned long *p); | |
int ei_decode_double(const char *buf, int *index, double *p); | |
int ei_decode_boolean(const char *buf, int *index, int *p); | |
int ei_decode_char(const char *buf, int *index, char *p); | |
int ei_decode_string(const char *buf, int *index, char *p); | |
int ei_decode_atom(const char *buf, int *index, char *p); | |
int ei_decode_atom_as(const char *buf, int *index, char *p, int destlen, erlang_char_encoding want, erlang_char_encoding* was, erlang_char_encoding* result); | |
int ei_decode_binary(const char *buf, int *index, void *p, long *len); | |
int ei_decode_fun(const char* buf, int* index, erlang_fun* p); | |
void free_fun(erlang_fun* f); | |
int ei_decode_pid(const char *buf, int *index, erlang_pid *p); | |
int ei_decode_port(const char *buf, int *index, erlang_port *p); | |
int ei_decode_ref(const char *buf, int *index, erlang_ref *p); | |
int ei_decode_term(const char *buf, int *index, void *t); | |
int ei_decode_trace(const char *buf, int *index, erlang_trace *p); | |
int ei_decode_tuple_header(const char *buf, int *index, int *arity); | |
int ei_decode_list_header(const char *buf, int *index, int *arity); | |
int ei_decode_ei_term(const char* buf, int* index, ei_term* term); | |
int ei_print_term(FILE *fp, const char* buf, int* index); | |
int ei_s_print_term(char** s, const char* buf, int* index); | |
int ei_x_format(ei_x_buff* x, const char* fmt, ...); | |
int ei_x_format_wo_ver(ei_x_buff* x, const char *fmt, ...); | |
int ei_x_new(ei_x_buff* x); | |
int ei_x_new_with_version(ei_x_buff* x); | |
int ei_x_free(ei_x_buff* x); | |
int ei_x_append(ei_x_buff* x, const ei_x_buff* x2); | |
int ei_x_append_buf(ei_x_buff* x, const char* buf, int len); | |
int ei_skip_term(const char* buf, int* index); | |
# 549 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
typedef struct bucket_s { | |
int rawhash; | |
const char *key; | |
char keybuf[32]; | |
const void *value; | |
struct bucket_s *next; | |
} ei_bucket; | |
typedef struct { | |
ei_bucket **tab; | |
int (*hash)(const char *); | |
int size; | |
int nelem; | |
int npos; | |
ei_bucket *freelist; | |
} ei_hash; | |
# 591 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
typedef struct ei_reg_inode { | |
int attr; | |
int size; | |
union { | |
long i; | |
double f; | |
char *s; | |
void *p; | |
} val; | |
struct ei_reg_inode *next; | |
} ei_reg_obj; | |
typedef struct { | |
ei_reg_obj *freelist; | |
ei_hash *tab; | |
} ei_reg; | |
struct ei_reg_stat { | |
int attr; | |
int size; | |
}; | |
struct ei_reg_tabstat { | |
int size; | |
int nelem; | |
int npos; | |
int collisions; | |
}; | |
# 631 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
ei_reg *ei_reg_open(int size); | |
int ei_reg_resize(ei_reg *oldreg, int newsize); | |
int ei_reg_close(ei_reg *reg); | |
# 650 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_reg_setival(ei_reg *reg, const char *key, long i); | |
int ei_reg_setfval(ei_reg *reg, const char *key, double f); | |
int ei_reg_setsval(ei_reg *reg, const char *key, const char *s); | |
int ei_reg_setpval(ei_reg *reg, const char *key, const void *p, int size); | |
# 663 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_reg_setval(ei_reg *reg, const char *key, int flags, ...); | |
long ei_reg_getival(ei_reg *reg, const char *key); | |
double ei_reg_getfval(ei_reg *reg, const char *key); | |
const char *ei_reg_getsval(ei_reg *reg, const char *key); | |
const void *ei_reg_getpval(ei_reg *reg, const char *key, int *size); | |
# 688 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_reg_getval(ei_reg *reg, const char *key, int flags, ...); | |
# 698 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_reg_markdirty(ei_reg *reg, const char *key); | |
int ei_reg_delete(ei_reg *reg, const char *key); | |
int ei_reg_stat(ei_reg *reg, const char *key, struct ei_reg_stat *obuf); | |
int ei_reg_tabstat(ei_reg *reg, struct ei_reg_tabstat *obuf); | |
int ei_reg_dump(int fd, ei_reg *reg, const char *mntab, int flags); | |
int ei_reg_restore(int fd, ei_reg *reg, const char *mntab); | |
int ei_reg_purge(ei_reg *reg); | |
# 750 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_decode_longlong(const char *buf, int *index, long long *p); | |
int ei_decode_ulonglong(const char *buf, int *index, unsigned long long *p); | |
int ei_encode_longlong(char *buf, int *index, long long p); | |
int ei_encode_ulonglong(char *buf, int *index, unsigned long long p); | |
int ei_x_encode_longlong(ei_x_buff* x, long long n); | |
int ei_x_encode_ulonglong(ei_x_buff* x, unsigned long long n); | |
# 766 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_decode_intlist(const char *buf, int *index, long *a, int *count); | |
# 775 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_receive_encoded(int fd, char **bufp, int *bufsz, erlang_msg *to, | |
int *msglen); | |
int ei_receive_encoded_tmo(int fd, char **bufp, int *bufsz, erlang_msg *to, | |
int *msglen, unsigned ms); | |
int ei_send_encoded(int fd, const erlang_pid *to, char *msg, int msglen); | |
int ei_send_encoded_tmo(int fd, const erlang_pid *to, char *msg, int msglen, | |
unsigned ms); | |
int ei_send_reg_encoded(int fd, const erlang_pid *from, const char *to, | |
char *msg, int msglen); | |
int ei_send_reg_encoded_tmo(int fd, const erlang_pid *from, const char *to, | |
char *msg, int msglen, unsigned ms); | |
# 798 "/usr/local/lib/erlang/lib/erl_interface-3.7.11/include/ei.h" | |
int ei_encode_big(char *buf, int *index, erlang_big* big); | |
int ei_x_encode_big(ei_x_buff* x, erlang_big* big); | |
int ei_decode_big(const char *buf, int *index, erlang_big* p); | |
int ei_big_comp(erlang_big *x, erlang_big *y); | |
int ei_big_to_double(erlang_big *b, double *resp); | |
int ei_small_to_big(int s, erlang_big *b); | |
erlang_big *ei_alloc_big(unsigned int arity); | |
void ei_free_big(erlang_big *b); | |
} | |
# 52 "port.cpp" 2 | |
# 1 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/debug/error.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 21 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/control/iif.hpp" 1 3 | |
# 22 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 2 3 | |
# 21 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/punctuation/comma_if.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/punctuation/comma_if.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/control/if.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/control/if.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/logical/bool.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/control/if.hpp" 2 3 | |
# 19 "/usr/local/include/boost/preprocessor/punctuation/comma_if.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/facilities/empty.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/punctuation/comma_if.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/punctuation/comma.hpp" 1 3 | |
# 21 "/usr/local/include/boost/preprocessor/punctuation/comma_if.hpp" 2 3 | |
# 22 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/repetition/repeat.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/repetition/repeat.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 21 "/usr/local/include/boost/preprocessor/repetition/repeat.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/tuple/eat.hpp" 1 3 | |
# 22 "/usr/local/include/boost/preprocessor/repetition/repeat.hpp" 2 3 | |
# 23 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/tuple/elem.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/tuple/elem.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/facilities/overload.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/facilities/overload.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/variadic/size.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/facilities/overload.hpp" 2 3 | |
# 21 "/usr/local/include/boost/preprocessor/tuple/elem.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/tuple/rem.hpp" 1 3 | |
# 22 "/usr/local/include/boost/preprocessor/tuple/elem.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/variadic/elem.hpp" 1 3 | |
# 23 "/usr/local/include/boost/preprocessor/tuple/elem.hpp" 2 3 | |
# 24 "/usr/local/include/boost/preprocessor/repetition/enum.hpp" 2 3 | |
# 54 "port.cpp" 2 | |
# 1 "/usr/local/include/boost/preprocessor/repetition/repeat_from_to.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/repetition/repeat_from_to.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/arithmetic/add.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/arithmetic/add.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/arithmetic/dec.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/arithmetic/add.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/arithmetic/inc.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/arithmetic/add.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/control/while.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/control/while.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 21 "/usr/local/include/boost/preprocessor/control/while.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/list/fold_left.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/list/fold_left.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/control/while.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/list/fold_left.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 21 "/usr/local/include/boost/preprocessor/list/fold_left.hpp" 2 3 | |
# 41 "/usr/local/include/boost/preprocessor/list/fold_left.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/list/detail/fold_left.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/list/detail/fold_left.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/control/expr_iif.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/list/detail/fold_left.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/list/adt.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/list/adt.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/is_binary.hpp" 1 3 | |
# 16 "/usr/local/include/boost/preprocessor/detail/is_binary.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/check.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/detail/is_binary.hpp" 2 3 | |
# 19 "/usr/local/include/boost/preprocessor/list/adt.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/logical/compl.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/list/adt.hpp" 2 3 | |
# 20 "/usr/local/include/boost/preprocessor/list/detail/fold_left.hpp" 2 3 | |
# 42 "/usr/local/include/boost/preprocessor/list/fold_left.hpp" 2 3 | |
# 22 "/usr/local/include/boost/preprocessor/control/while.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/list/fold_right.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/list/fold_right.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 21 "/usr/local/include/boost/preprocessor/list/fold_right.hpp" 2 3 | |
# 37 "/usr/local/include/boost/preprocessor/list/fold_right.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/list/detail/fold_right.hpp" 1 3 | |
# 18 "/usr/local/include/boost/preprocessor/list/detail/fold_right.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/list/reverse.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/list/detail/fold_right.hpp" 2 3 | |
# 38 "/usr/local/include/boost/preprocessor/list/fold_right.hpp" 2 3 | |
# 23 "/usr/local/include/boost/preprocessor/control/while.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/logical/bitand.hpp" 1 3 | |
# 24 "/usr/local/include/boost/preprocessor/control/while.hpp" 2 3 | |
# 48 "/usr/local/include/boost/preprocessor/control/while.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/control/detail/while.hpp" 1 3 | |
# 49 "/usr/local/include/boost/preprocessor/control/while.hpp" 2 3 | |
# 21 "/usr/local/include/boost/preprocessor/arithmetic/add.hpp" 2 3 | |
# 18 "/usr/local/include/boost/preprocessor/repetition/repeat_from_to.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/arithmetic/sub.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/repetition/repeat_from_to.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 24 "/usr/local/include/boost/preprocessor/repetition/repeat_from_to.hpp" 2 3 | |
# 55 "port.cpp" 2 | |
# 1 "/usr/local/include/boost/preprocessor/seq/for_each.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/seq/for_each.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/repetition/for.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/repetition/for.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/repetition/for.hpp" 2 3 | |
# 42 "/usr/local/include/boost/preprocessor/repetition/for.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/repetition/detail/for.hpp" 1 3 | |
# 43 "/usr/local/include/boost/preprocessor/repetition/for.hpp" 2 3 | |
# 18 "/usr/local/include/boost/preprocessor/seq/for_each.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/seq/seq.hpp" 1 3 | |
# 16 "/usr/local/include/boost/preprocessor/seq/seq.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/seq/elem.hpp" 1 3 | |
# 17 "/usr/local/include/boost/preprocessor/seq/seq.hpp" 2 3 | |
# 19 "/usr/local/include/boost/preprocessor/seq/for_each.hpp" 2 3 | |
# 1 "/usr/local/include/boost/preprocessor/seq/size.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/seq/for_each.hpp" 2 3 | |
# 56 "port.cpp" 2 | |
# 1 "/usr/local/include/boost/preprocessor/seq/transform.hpp" 1 3 | |
# 16 "/usr/local/include/boost/preprocessor/seq/transform.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/seq/fold_left.hpp" 1 3 | |
# 19 "/usr/local/include/boost/preprocessor/seq/fold_left.hpp" 3 | |
# 1 "/usr/local/include/boost/preprocessor/detail/auto_rec.hpp" 1 3 | |
# 20 "/usr/local/include/boost/preprocessor/seq/fold_left.hpp" 2 3 | |
# 17 "/usr/local/include/boost/preprocessor/seq/transform.hpp" 2 3 | |
# 59 "port.cpp" 2 | |
# 1 "/usr/local/include/boost/preprocessor/tuple/to_seq.hpp" 1 3 | |
# 60 "port.cpp" 2 | |
# 1 "/usr/local/include/boost/preprocessor/punctuation/paren.hpp" 1 3 | |
# 62 "port.cpp" 2 | |
# 1 "port.hpp" 1 | |
# 48 "port.hpp" | |
# 1 "/usr/include/poll.h" 1 3 4 | |
# 23 "/usr/include/poll.h" 3 4 | |
# 1 "/usr/include/sys/poll.h" 1 3 4 | |
# 96 "/usr/include/sys/poll.h" 3 4 | |
struct pollfd | |
{ | |
int fd; | |
short events; | |
short revents; | |
}; | |
typedef unsigned int nfds_t; | |
extern "C" { | |
extern int poll (struct pollfd *, nfds_t, int) __asm("_" "poll" ); | |
} | |
# 24 "/usr/include/poll.h" 2 3 4 | |
# 49 "port.hpp" 2 | |
# 1 "realloc_ptr.hpp" 1 | |
# 45 "realloc_ptr.hpp" | |
# 1 "/usr/include/c++/4.2.1/cassert" 1 3 | |
# 47 "/usr/include/c++/4.2.1/cassert" 3 | |
# 48 "/usr/include/c++/4.2.1/cassert" 3 | |
# 1 "/usr/include/assert.h" 1 3 4 | |
# 75 "/usr/include/assert.h" 3 4 | |
extern "C" { | |
void __assert_rtn(const char *, const char *, int, const char *) __attribute__((noreturn)); | |
} | |
# 49 "/usr/include/c++/4.2.1/cassert" 2 3 | |
# 46 "realloc_ptr.hpp" 2 | |
template <typename T> | |
class realloc_ptr | |
{ | |
public: | |
typedef T element_type; | |
explicit realloc_ptr(size_t initialSize, size_t maxSize) : | |
m_size(greater_pow2(initialSize)), | |
m_maxSize(greater_pow2(maxSize)), | |
m_p(reinterpret_cast<T *>(malloc(m_size * sizeof(T)))) {} | |
~realloc_ptr() { free(m_p); } | |
size_t size() const { return m_size; } | |
T & operator [](size_t i) const | |
{ | |
(__builtin_expect(!(i < m_size), 0) ? __assert_rtn(__func__, "realloc_ptr.hpp", 70, "i < m_size") : (void)0); | |
return m_p[i]; | |
} | |
T * get() const { return m_p; } | |
template <typename R> | |
R * get() const | |
{ | |
(__builtin_expect(!(sizeof(R) == sizeof(T)), 0) ? __assert_rtn(__func__, "realloc_ptr.hpp", 79, "sizeof(R) == sizeof(T)") : (void)0); | |
return reinterpret_cast<R *>(m_p); | |
} | |
bool copy(realloc_ptr & src, size_t iDst = 0) | |
{ | |
(__builtin_expect(!(&src != this), 0) ? __assert_rtn(__func__, "realloc_ptr.hpp", 85, "&src != this") : (void)0); | |
if (! reserve(iDst + src.m_size)) | |
return false; | |
memcpy(&(m_p[iDst]), src.m_p, src.m_size * sizeof(T)); | |
return true; | |
} | |
bool copy(realloc_ptr & src, size_t nSrc, size_t iDst) | |
{ | |
(__builtin_expect(!(&src != this), 0) ? __assert_rtn(__func__, "realloc_ptr.hpp", 94, "&src != this") : (void)0); | |
if (! reserve(iDst + nSrc)) | |
return false; | |
memcpy(&(m_p[iDst]), src.m_p, nSrc * sizeof(T)); | |
return true; | |
} | |
bool copy(realloc_ptr & src, size_t iSrc, size_t nSrc, size_t iDst) | |
{ | |
(__builtin_expect(!(&src != this), 0) ? __assert_rtn(__func__, "realloc_ptr.hpp", 103, "&src != this") : (void)0); | |
if (! reserve(iDst + nSrc)) | |
return false; | |
memcpy(&(m_p[iDst]), &(src.m_p[iSrc]), nSrc * sizeof(T)); | |
return true; | |
} | |
bool move(size_t iSrc, size_t nSrc, size_t iDst) | |
{ | |
if (! reserve(iDst + nSrc)) | |
return false; | |
memmove(&(m_p[iDst]), &(m_p[iSrc]), nSrc * sizeof(T)); | |
return true; | |
} | |
bool grow() | |
{ | |
size_t const newSize = m_size << 1; | |
if (newSize > m_maxSize) | |
return false; | |
T * tmp = reinterpret_cast<T *>(realloc(m_p, newSize * sizeof(T))); | |
if (! tmp) | |
return false; | |
m_p = tmp; | |
m_size = newSize; | |
return true; | |
} | |
bool reserve(size_t size) | |
{ | |
if (size < m_size) | |
return true; | |
if (size > m_maxSize) | |
return false; | |
size_t newSize = m_size; | |
while (size >= newSize) | |
newSize <<= 1; | |
T * tmp = reinterpret_cast<T *>(realloc(m_p, newSize * sizeof(T))); | |
if (! tmp) | |
return false; | |
m_p = tmp; | |
m_size = newSize; | |
return true; | |
} | |
private: | |
size_t greater_pow2(size_t n) | |
{ | |
size_t const totalSize = n * sizeof(T); | |
int bits = 0; | |
for (size_t div2 = totalSize; div2 > 1; div2 >>= 1) | |
bits++; | |
size_t const value = (1 << bits); | |
if (value == totalSize) | |
return value; | |
else | |
return (value << 1); | |
} | |
size_t m_size; | |
size_t const m_maxSize; | |
T * m_p; | |
realloc_ptr(realloc_ptr const &); | |
realloc_ptr & operator =(realloc_ptr const &); | |
}; | |
# 50 "port.hpp" 2 | |
namespace GEPD | |
{ | |
namespace ExitStatus | |
{ | |
int const success = 0; | |
int const min = 78; | |
int const ready = 78; | |
int const timeout = 79; | |
int const errors_min = 80; | |
int const erlang_exit = errors_min; | |
int const read_EAGAIN = errors_min + 1; | |
int const read_EBADF = errors_min + 2; | |
int const read_EFAULT = errors_min + 3; | |
int const read_EINTR = errors_min + 4; | |
int const read_EINVAL = errors_min + 5; | |
int const read_EIO = errors_min + 6; | |
int const read_EISDIR = errors_min + 7; | |
int const read_null = errors_min + 8; | |
int const read_overflow = errors_min + 9; | |
int const read_unknown = errors_min + 10; | |
int const write_EAGAIN = errors_min + 11; | |
int const write_EBADF = errors_min + 12; | |
int const write_EFAULT = errors_min + 13; | |
int const write_EFBIG = errors_min + 14; | |
int const write_EINTR = errors_min + 15; | |
int const write_EINVAL = errors_min + 16; | |
int const write_EIO = errors_min + 17; | |
int const write_ENOSPC = errors_min + 18; | |
int const write_EPIPE = errors_min + 19; | |
int const write_null = errors_min + 20; | |
int const write_overflow = errors_min + 21; | |
int const write_unknown = errors_min + 22; | |
int const ei_encode_error = errors_min + 23; | |
int const poll_EBADF = errors_min + 24; | |
int const poll_EFAULT = errors_min + 25; | |
int const poll_EINTR = errors_min + 26; | |
int const poll_EINVAL = errors_min + 27; | |
int const poll_ENOMEM = errors_min + 28; | |
int const poll_ERR = errors_min + 29; | |
int const poll_HUP = errors_min + 30; | |
int const poll_NVAL = errors_min + 31; | |
int const poll_unknown = errors_min + 32; | |
int const pipe_EFAULT = errors_min + 33; | |
int const pipe_EINVAL = errors_min + 34; | |
int const pipe_EMFILE = errors_min + 35; | |
int const pipe_ENFILE = errors_min + 36; | |
int const pipe_unknown = errors_min + 37; | |
int const dup_EBADF = errors_min + 38; | |
int const dup_EBUSY = errors_min + 39; | |
int const dup_EINTR = errors_min + 40; | |
int const dup_EINVAL = errors_min + 41; | |
int const dup_EMFILE = errors_min + 42; | |
int const dup_unknown = errors_min + 43; | |
int const close_EBADF = errors_min + 44; | |
int const close_EINTR = errors_min + 45; | |
int const close_EIO = errors_min + 46; | |
int const close_unknown = errors_min + 47; | |
int const errors_max = errors_min + 48; | |
int const error_HUP = poll_HUP; | |
} | |
int consume_stream(int fd, short & revents, | |
char const * const name, unsigned long const pid, | |
realloc_ptr<unsigned char> & send_buffer, | |
realloc_ptr<unsigned char> & stream, size_t & i); | |
int flush_stream(int fd, short revents, | |
char const * const name, unsigned long const pid, | |
realloc_ptr<unsigned char> & send_buffer, | |
realloc_ptr<unsigned char> & stream, size_t & i); | |
extern realloc_ptr<struct pollfd> fds; | |
extern nfds_t nfds; | |
int default_main(); | |
int init(); | |
int wait(int & count, int const timeout, | |
realloc_ptr<unsigned char> & buffer, | |
realloc_ptr<unsigned char> & stream1, | |
realloc_ptr<unsigned char> & stream2); | |
} | |
# 67 "port.cpp" 2 | |
# 1 "pchar_len_t.h" 1 | |
# 29 "pchar_len_t.h" | |
typedef struct pchar_len_t { | |
char * pchar; | |
uint32_t length; | |
} pchar_len_t; | |
# 69 "port.cpp" 2 | |
# 144 "port.cpp" | |
extern "C" | |
{ | |
# 1 "test_functions.h" 1 | |
void sleep_test1(uint32_t arg); | |
void sleep_test2(uint32_t arg); | |
uint64_t integer_test1(); | |
char char_test1(char a); | |
unsigned char char_test2(unsigned char a); | |
float float_test1(); | |
char * pchar_test1(char * p, uint32_t length); | |
char * time_test1(time_t t); | |
float float_test2(double value); | |
int32_t integer_test2(int8_t size1, int16_t size2, | |
int32_t size4, int64_t size8); | |
uint32_t integer_test3(uint8_t size1, uint16_t size2, | |
uint32_t size4, uint64_t size8); | |
char * pchar_test2(char * p1, uint32_t l1, char c1, | |
char * p2, uint32_t l2, char c2, | |
char * p3, uint32_t l3, char c3); | |
pchar_len_t hello_test1(); | |
# 147 "port.cpp" 2 | |
} | |
# 453 "port.cpp" | |
namespace | |
{ | |
namespace Error | |
{ | |
char const * const invalid_function = "Invalid function call"; | |
} | |
int errno_read() | |
{ | |
switch ((*__error())) | |
{ | |
case 35: | |
return GEPD::ExitStatus::read_EAGAIN; | |
case 9: | |
return GEPD::ExitStatus::read_EBADF; | |
case 14: | |
return GEPD::ExitStatus::read_EFAULT; | |
case 4: | |
return GEPD::ExitStatus::read_EINTR; | |
case 22: | |
return GEPD::ExitStatus::read_EINVAL; | |
case 5: | |
return GEPD::ExitStatus::read_EIO; | |
case 21: | |
return GEPD::ExitStatus::read_EISDIR; | |
default: | |
return GEPD::ExitStatus::read_unknown; | |
} | |
} | |
int errno_write() | |
{ | |
switch ((*__error())) | |
{ | |
case 35: | |
return GEPD::ExitStatus::write_EAGAIN; | |
case 9: | |
return GEPD::ExitStatus::write_EBADF; | |
case 14: | |
return GEPD::ExitStatus::write_EFAULT; | |
case 27: | |
return GEPD::ExitStatus::write_EFBIG; | |
case 4: | |
return GEPD::ExitStatus::write_EINTR; | |
case 22: | |
return GEPD::ExitStatus::write_EINVAL; | |
case 5: | |
return GEPD::ExitStatus::write_EIO; | |
case 28: | |
return GEPD::ExitStatus::write_ENOSPC; | |
case 32: | |
return GEPD::ExitStatus::write_EPIPE; | |
default: | |
return GEPD::ExitStatus::write_unknown; | |
} | |
} | |
int errno_poll() | |
{ | |
switch ((*__error())) | |
{ | |
case 9: | |
return GEPD::ExitStatus::poll_EBADF; | |
case 14: | |
return GEPD::ExitStatus::poll_EFAULT; | |
case 4: | |
return GEPD::ExitStatus::poll_EINTR; | |
case 22: | |
return GEPD::ExitStatus::poll_EINVAL; | |
case 12: | |
return GEPD::ExitStatus::poll_ENOMEM; | |
default: | |
return GEPD::ExitStatus::poll_unknown; | |
} | |
} | |
int errno_pipe() | |
{ | |
switch ((*__error())) | |
{ | |
case 14: | |
return GEPD::ExitStatus::pipe_EFAULT; | |
case 22: | |
return GEPD::ExitStatus::pipe_EINVAL; | |
case 24: | |
return GEPD::ExitStatus::pipe_EMFILE; | |
case 23: | |
return GEPD::ExitStatus::pipe_ENFILE; | |
default: | |
return GEPD::ExitStatus::pipe_unknown; | |
} | |
} | |
int errno_dup() | |
{ | |
switch ((*__error())) | |
{ | |
case 9: | |
return GEPD::ExitStatus::dup_EBADF; | |
case 16: | |
return GEPD::ExitStatus::dup_EBUSY; | |
case 4: | |
return GEPD::ExitStatus::dup_EINTR; | |
case 22: | |
return GEPD::ExitStatus::dup_EINVAL; | |
case 24: | |
return GEPD::ExitStatus::dup_EMFILE; | |
default: | |
return GEPD::ExitStatus::dup_unknown; | |
} | |
} | |
int errno_close() | |
{ | |
switch ((*__error())) | |
{ | |
case 9: | |
return GEPD::ExitStatus::close_EBADF; | |
case 4: | |
return GEPD::ExitStatus::close_EINTR; | |
case 5: | |
return GEPD::ExitStatus::close_EIO; | |
default: | |
return GEPD::ExitStatus::close_unknown; | |
} | |
} | |
int read_exact(unsigned char * const buffer, | |
uint32_t const length) | |
{ | |
uint32_t total = 0; | |
while (total < length) | |
{ | |
ssize_t const i = read(3, | |
buffer + total, length - total); | |
if (i <= 0) | |
{ | |
if (i == -1) | |
return errno_read(); | |
else | |
return GEPD::ExitStatus::read_null; | |
} | |
total += i; | |
} | |
if (total > length) | |
return GEPD::ExitStatus::read_overflow; | |
return GEPD::ExitStatus::success; | |
} | |
int write_exact(unsigned char const * const buffer, | |
uint32_t const length) | |
{ | |
uint32_t total = 0; | |
while (total < length) | |
{ | |
ssize_t const i = write(4, | |
buffer + total, length - total); | |
if (i <= 0) | |
{ | |
if (i == -1) | |
return errno_write(); | |
else | |
return GEPD::ExitStatus::write_null; | |
} | |
total += i; | |
} | |
if (total > length) | |
return GEPD::ExitStatus::write_overflow; | |
return GEPD::ExitStatus::success; | |
} | |
int read_cmd(realloc_ptr<unsigned char> & buffer) | |
{ | |
unsigned char lengthData[4]; | |
int const status = read_exact(lengthData, 4); | |
if (status) | |
return status; | |
uint32_t const length = (lengthData[0] << 24) | | |
(lengthData[1] << 16) | | |
(lengthData[2] << 8) | | |
lengthData[3]; | |
buffer.reserve(length); | |
return read_exact(buffer.get(), length); | |
} | |
int write_cmd(realloc_ptr<unsigned char> & buffer, uint32_t length) | |
{ | |
buffer[0] = (length & 0xff000000) >> 24; | |
buffer[1] = (length & 0x00ff0000) >> 16; | |
buffer[2] = (length & 0x0000ff00) >> 8; | |
buffer[3] = length & 0x000000ff; | |
return write_exact(buffer.get(), length + 4); | |
} | |
int reply_error_string(realloc_ptr<unsigned char> & buffer, | |
int & index, uint16_t cmd, char const * const str) | |
{ | |
if (ei_encode_version(buffer.get<char>(), &index)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_tuple_header(buffer.get<char>(), &index, 3)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_atom(buffer.get<char>(), &index, "error")) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_ulong(buffer.get<char>(), &index, cmd)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (buffer.reserve(index + strlen(str) + 1) == false) | |
return GEPD::ExitStatus::write_overflow; | |
if (ei_encode_string(buffer.get<char>(), &index, str)) | |
return GEPD::ExitStatus::ei_encode_error; | |
return GEPD::ExitStatus::success; | |
} | |
# 734 "port.cpp" | |
int consume_erlang(short & revents, realloc_ptr<unsigned char> & buffer) | |
{ | |
if (revents & 0x0008) | |
return GEPD::ExitStatus::poll_ERR; | |
else if (revents & 0x0010) | |
return GEPD::ExitStatus::erlang_exit; | |
else if (revents & 0x0020) | |
return GEPD::ExitStatus::poll_NVAL; | |
revents = 0; | |
int status; | |
if ((status = read_cmd(buffer))) | |
{ | |
return status; | |
} | |
else | |
{ | |
uint16_t cmd = *((uint16_t *) buffer.get()); | |
switch (cmd) | |
{ | |
case 1:{ size_t const offset_arg0 = sizeof(uint16_t); (void) sleep_test1 ( *((uint32_t *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 1)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_atom(buffer.get<char>(), &index, "ok")) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 2:{ size_t const offset_arg0 = sizeof(uint16_t); (void) sleep_test2 ( *((uint32_t *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_atom(buffer.get<char>(), &index, "ok")) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 3:{ uint64_t returnValue = integer_test1 ( ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 3)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulonglong(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 4:{ size_t const offset_arg0 = sizeof(uint16_t); char returnValue = char_test1 ( *((char *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 4)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_long(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 5:{ size_t const offset_arg0 = sizeof(uint16_t); unsigned char returnValue = char_test2 ( *((unsigned char *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 5)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_char(buffer.get<char>(), &index, (char) returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 6:{ double returnValue = float_test1 ( ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 6)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_double(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 7:{ size_t const offset_arg0 = sizeof(uint16_t); char const * returnValue = pchar_test1 ( ((char *) &(buffer[(offset_arg0 + sizeof(uint32_t))])), *((uint32_t *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 7)) return GEPD::ExitStatus::ei_encode_error; if (buffer.reserve(index + strlen(returnValue) + 1) == false) return GEPD::ExitStatus::write_overflow; if (ei_encode_string(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 8:{ size_t const offset_arg0 = sizeof(uint16_t); char const * returnValue = time_test1 ( *((uint64_t *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 8)) return GEPD::ExitStatus::ei_encode_error; if (buffer.reserve(index + strlen(returnValue) + 1) == false) return GEPD::ExitStatus::write_overflow; if (ei_encode_string(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 9:{ size_t const offset_arg0 = sizeof(uint16_t); double returnValue = float_test2 ( *((double *) &(buffer[(offset_arg0)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 9)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_double(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 10:{ size_t const offset_arg0 = sizeof(uint16_t); size_t const offset_arg1 = offset_arg0 + sizeof(int8_t) ; size_t const offset_arg2 = offset_arg1 + sizeof(int16_t) ; size_t const offset_arg3 = offset_arg2 + sizeof(int32_t) ; int32_t returnValue = integer_test2 ( *((int8_t *) &(buffer[(offset_arg0)])) , *((int16_t *) &(buffer[(offset_arg1)])) , *((int32_t *) &(buffer[(offset_arg2)])) , *((int64_t *) &(buffer[(offset_arg3)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 10)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_long(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 11:{ size_t const offset_arg0 = sizeof(uint16_t); size_t const offset_arg1 = offset_arg0 + sizeof(uint8_t) ; size_t const offset_arg2 = offset_arg1 + sizeof(uint16_t) ; size_t const offset_arg3 = offset_arg2 + sizeof(uint32_t) ; uint32_t returnValue = integer_test3 ( *((uint8_t *) &(buffer[(offset_arg0)])) , *((uint16_t *) &(buffer[(offset_arg1)])) , *((uint32_t *) &(buffer[(offset_arg2)])) , *((uint64_t *) &(buffer[(offset_arg3)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 11)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 12:{ size_t const offset_arg0 = sizeof(uint16_t); size_t const offset_arg1 = offset_arg0 + sizeof(uint32_t) + *((uint32_t *) &(buffer[( offset_arg0 )])) ; size_t const offset_arg2 = offset_arg1 + sizeof(char) ; size_t const offset_arg3 = offset_arg2 + sizeof(uint32_t) + *((uint32_t *) &(buffer[( offset_arg2 )])) ; size_t const offset_arg4 = offset_arg3 + sizeof(char) ; size_t const offset_arg5 = offset_arg4 + sizeof(uint32_t) + *((uint32_t *) &(buffer[( offset_arg4 )])) ; char const * returnValue = pchar_test2 ( ((char *) &(buffer[(offset_arg0 + sizeof(uint32_t))])), *((uint32_t *) &(buffer[(offset_arg0)])) , *((char *) &(buffer[(offset_arg1)])) , ((char *) &(buffer[(offset_arg2 + sizeof(uint32_t))])), *((uint32_t *) &(buffer[(offset_arg2)])) , *((char *) &(buffer[(offset_arg3)])) , ((char *) &(buffer[(offset_arg4 + sizeof(uint32_t))])), *((uint32_t *) &(buffer[(offset_arg4)])) , *((char *) &(buffer[(offset_arg5)])) ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 12)) return GEPD::ExitStatus::ei_encode_error; if (buffer.reserve(index + strlen(returnValue) + 1) == false) return GEPD::ExitStatus::write_overflow; if (ei_encode_string(buffer.get<char>(), &index, returnValue)) return GEPD::ExitStatus::ei_encode_error; if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} case 13:{ pchar_len_t returnValue = hello_test1 ( ) ; int index = sizeof(uint32_t); if (ei_encode_version(buffer.get<char>(), &index)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_tuple_header(buffer.get<char>(), &index, 2)) return GEPD::ExitStatus::ei_encode_error; if (ei_encode_ulong(buffer.get<char>(), &index, 13)) return GEPD::ExitStatus::ei_encode_error; if (buffer.reserve(index + returnValue.length) == false) return GEPD::ExitStatus::write_overflow; if (ei_encode_binary(buffer.get<char>(), &index, returnValue.pchar, returnValue.length)) return GEPD::ExitStatus::ei_encode_error; free(returnValue.pchar); if ((status = write_cmd(buffer, index - sizeof(uint32_t)))) return status; return GEPD::ExitStatus::success;} | |
default: | |
int index = sizeof(uint32_t); | |
if ((status = reply_error_string(buffer, index, cmd, | |
Error::invalid_function))) | |
return status; | |
if ((status = write_cmd(buffer, index - | |
sizeof(uint32_t)))) | |
return status; | |
return GEPD::ExitStatus::success; | |
} | |
} | |
} | |
int store_standard_fd(int in, int & out) | |
{ | |
int fds[2] = {-1, -1}; | |
if (pipe(fds) == -1) | |
return errno_pipe(); | |
if (dup2(fds[1], in) == -1) | |
return errno_dup(); | |
if (close(fds[1]) == -1) | |
return errno_close(); | |
out = fds[0]; | |
return GEPD::ExitStatus::success; | |
} | |
int data_ready(int fd, bool & ready) | |
{ | |
struct pollfd fds[1] = {{fd, 0x0001 | 0x0002, 0}}; | |
int const count = poll(fds, 1, 0); | |
if (count == -1) | |
return errno_poll(); | |
ready = (count == 1); | |
return GEPD::ExitStatus::success; | |
} | |
enum | |
{ | |
INDEX_STDOUT = 0, | |
INDEX_STDERR, | |
INDEX_ERLANG | |
}; | |
} | |
int GEPD::consume_stream(int fd, short & revents, | |
char const * const name, unsigned long const pid, | |
realloc_ptr<unsigned char> & send_buffer, | |
realloc_ptr<unsigned char> & stream, size_t & i) | |
{ | |
if (revents & 0x0008) | |
return GEPD::ExitStatus::poll_ERR; | |
else if (revents & 0x0010) | |
return GEPD::ExitStatus::poll_HUP; | |
else if (revents & 0x0020) | |
return GEPD::ExitStatus::poll_NVAL; | |
revents = 0; | |
ssize_t left = stream.size() - i; | |
ssize_t readBytes; | |
while ((readBytes = read(fd, &stream[i], left)) == left && | |
stream.grow()) | |
{ | |
i += left; | |
left = stream.size() - i; | |
bool ready; | |
data_ready(fd, ready); | |
if (ready == false) | |
break; | |
} | |
if (readBytes == 0 && i == 0) | |
return GEPD::ExitStatus::success; | |
else if (readBytes == -1) | |
return errno_read(); | |
i += readBytes; | |
bool foundNewline = false; | |
size_t iNewline = 0; | |
for (ssize_t j = i - 1; ! foundNewline && j >= 0; --j) | |
{ | |
if (stream[j] == '\n') | |
{ | |
foundNewline = true; | |
iNewline = j; | |
} | |
} | |
if (foundNewline) | |
{ | |
int index = sizeof(uint32_t); | |
if (ei_encode_version(send_buffer.get<char>(), &index)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_tuple_header(send_buffer.get<char>(), &index, 3)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_atom(send_buffer.get<char>(), &index, name)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_ulong(send_buffer.get<char>(), &index, pid)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (send_buffer.reserve(index + (iNewline + 1) + 1) == false) | |
return GEPD::ExitStatus::write_overflow; | |
if (ei_encode_string_len(send_buffer.get<char>(), &index, | |
stream.get<char>(), iNewline + 1)) | |
return GEPD::ExitStatus::ei_encode_error; | |
int status; | |
if ((status = write_cmd(send_buffer, index - | |
sizeof(uint32_t)))) | |
return status; | |
if (iNewline == i - 1) | |
{ | |
i = 0; | |
} | |
else | |
{ | |
size_t const remainingBytes = i - iNewline - 1; | |
stream.move(iNewline + 1, remainingBytes, 0); | |
i = remainingBytes; | |
} | |
} | |
return GEPD::ExitStatus::success; | |
} | |
int GEPD::flush_stream(int fd, short revents, | |
char const * const name, unsigned long const pid, | |
realloc_ptr<unsigned char> & send_buffer, | |
realloc_ptr<unsigned char> & stream, size_t & i) | |
{ | |
if ((revents & 0x0001) == false) | |
return GEPD::ExitStatus::success; | |
ssize_t left = stream.size() - i; | |
ssize_t readBytes; | |
while ((readBytes = read(fd, &stream[i], left)) == left && | |
stream.grow()) | |
{ | |
i += left; | |
left = stream.size() - i; | |
bool ready; | |
data_ready(fd, ready); | |
if (ready == false) | |
break; | |
} | |
if (readBytes == 0 && i == 0) | |
return GEPD::ExitStatus::success; | |
else if (readBytes != -1) | |
i += readBytes; | |
size_t const total = i - 1; | |
i = 0; | |
int index = sizeof(uint32_t); | |
if (ei_encode_version(send_buffer.get<char>(), &index)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_tuple_header(send_buffer.get<char>(), &index, 3)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_atom(send_buffer.get<char>(), &index, name)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (ei_encode_ulong(send_buffer.get<char>(), &index, pid)) | |
return GEPD::ExitStatus::ei_encode_error; | |
if (send_buffer.reserve(index + total + 1) == false) | |
return GEPD::ExitStatus::write_overflow; | |
if (ei_encode_string_len(send_buffer.get<char>(), &index, | |
stream.get<char>(), total)) | |
return GEPD::ExitStatus::ei_encode_error; | |
int status; | |
if ((status = write_cmd(send_buffer, index - | |
sizeof(uint32_t)))) | |
return status; | |
return GEPD::ExitStatus::success; | |
} | |
realloc_ptr<struct pollfd> GEPD::fds(4, 65536); | |
nfds_t GEPD::nfds = 0; | |
int GEPD::default_main() | |
{ | |
int const timeout = -1; | |
realloc_ptr<unsigned char> buffer(32768, 4194304); | |
realloc_ptr<unsigned char> stream1(1, 16384); | |
realloc_ptr<unsigned char> stream2(1, 16384); | |
int status; | |
if ((status = GEPD::init())) | |
return status; | |
int count; | |
return GEPD::wait(count, timeout, buffer, stream1, stream2); | |
} | |
int GEPD::init() | |
{ | |
if (nfds > 0) | |
fds.move(0, nfds, 3); | |
int status; | |
if ((status = store_standard_fd(1, fds[INDEX_STDOUT].fd))) | |
return status; | |
fds[INDEX_STDOUT].events = 0x0001 | 0x0002; | |
fds[INDEX_STDOUT].revents = 0; | |
if ((status = store_standard_fd(2, fds[INDEX_STDERR].fd))) | |
return status; | |
fds[INDEX_STDERR].events = 0x0001 | 0x0002; | |
fds[INDEX_STDERR].revents = 0; | |
fds[INDEX_ERLANG].fd = 3; | |
fds[INDEX_ERLANG].events = 0x0001 | 0x0002; | |
fds[INDEX_ERLANG].revents = 0; | |
nfds += 3; | |
return GEPD::ExitStatus::success; | |
} | |
int GEPD::wait(int & count, int const timeout, | |
realloc_ptr<unsigned char> & buffer, | |
realloc_ptr<unsigned char> & stream1, | |
realloc_ptr<unsigned char> & stream2) | |
{ | |
static unsigned long const pid = getpid(); | |
static size_t index_stream1 = 0; | |
static size_t index_stream2 = 0; | |
while ((count = poll(fds.get(), nfds, timeout)) > 0) | |
{ | |
int status; | |
if (count > 0 && fds[INDEX_ERLANG].revents != 0) | |
{ | |
if ((status = consume_erlang(fds[INDEX_ERLANG].revents, buffer))) | |
return status; | |
--count; | |
} | |
fflush(__stdoutp); | |
fflush(__stderrp); | |
if (count > 0 && fds[INDEX_STDERR].revents != 0) | |
{ | |
if ((status = consume_stream(fds[INDEX_STDERR].fd, | |
fds[INDEX_STDERR].revents, | |
"stderr", pid, buffer, | |
stream2, index_stream2))) | |
return status; | |
--count; | |
} | |
if (count > 0 && fds[INDEX_STDOUT].revents != 0) | |
{ | |
if ((status = consume_stream(fds[INDEX_STDOUT].fd, | |
fds[INDEX_STDOUT].revents, | |
"stdout", pid, buffer, | |
stream1, index_stream1))) | |
return status; | |
--count; | |
} | |
if (count > 0) | |
return GEPD::ExitStatus::ready; | |
} | |
if (count == 0) | |
return GEPD::ExitStatus::timeout; | |
else | |
return errno_poll(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment