PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
[ --enable-psi Enable PHP System Interface support])
+PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
+PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
+
+m4_foreach(incfile, [
+ [ax_check_sign.m4],
+ [psi.m4],
+ [psi_type.m4],
+ [psi_const.m4],
+ [psi_decl.m4],
+ [psi_macro.m4],
+ [psi_struct.m4],
+ [errno.m4],
+ [glob.m4],
+ [stddef.m4],
+ [stdio.m4],
+ [stdint.m4],
+ [stdlib.m4],
+ [sys_select.m4],
+ [sys_socket.m4],
+ [sys_stat.m4],
+ [sys_time.m4],
+ [sys_times.m4],
+ [sys_types.m4],
+ [sys_uio.m4],
+ [sys_utsname.m4],
+ [netdb.m4],
+ [syslog.m4],
+ [time.m4],
+ [wchar.m4]], [
+ dnl pecl build
+ sinclude([m4/]incfile)
+ dnl php-src build
+ sinclude([ext/psi/m4/]incfile)
+])
+
if test "$PHP_PSI" != no; then
PHP_CONFIGURE_PART(Configuring PSI)
- PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
- PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
-
- m4_foreach(incfile, [
- [ax_check_sign.m4],
- [psi.m4],
- [psi_type.m4],
- [psi_const.m4],
- [psi_decl.m4],
- [psi_macro.m4],
- [psi_struct.m4],
- [errno.m4],
- [glob.m4],
- [stddef.m4],
- [stdio.m4],
- [stdint.m4],
- [stdlib.m4],
- [sys_select.m4],
- [sys_socket.m4],
- [sys_stat.m4],
- [sys_time.m4],
- [sys_times.m4],
- [sys_types.m4],
- [sys_uio.m4],
- [sys_utsname.m4],
- [netdb.m4],
- [syslog.m4],
- [time.m4],
- [wchar.m4]], [
- dnl pecl build
- sinclude([m4/]incfile)
- dnl php-src build
- sinclude([ext/psi/m4/]incfile)
- ])
PSI_LEMON
PSI_CHECK_LIBJIT
PSI_CHECK_LIBFFI
AC_FUNC_FNMATCH
AC_HEADER_DIRENT
+ PSI_CONFIG_INIT
PSI_CHECK_STD_TYPES
PSI_CHECK_STDINT
PSI_CHECK_STDDEF
PSI_CHECK_NETDB
PSI_CHECK_SYSLOG
PSI_CHECK_WCHAR
+ PSI_CONFIG_DONE
PHP_SUBST(PSI_SHARED_LIBADD)
AC_DEFINE_UNQUOTED([PSI_DECLS], [$PSI_DECLS], [Predefined functions])
AC_DEFINE_UNQUOTED([PSI_VA_DECLS], [$PSI_VA_DECLS], [Predefined vararg functions])
-
PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
PHP_SUBST(PHP_PSI_BUILDDIR)
PHP_ADD_MAKEFILE_FRAGMENT
-
AC_MSG_RESULT()
fi
-AC_DEFUN(PSI_CHECK_ERRNO, [
+PSI_CHECK_ERRNO() {
AC_CHECK_HEADERS(errno.h)
-
+
PSI_EXTVAR(int errno)
-
+
PSI_CONST(E2BIG, int)
PSI_CONST(EACCES, int)
PSI_CONST(EADDRINUSE, int)
PSI_CONST(ETXTBSY, int)
PSI_CONST(EWOULDBLOCK, int)
PSI_CONST(EXDEV, int)
-])
+}
-AC_DEFUN(PSI_CHECK_GLOB, [
+PSI_CHECK_GLOB() {
AC_CHECK_HEADERS(glob.h)
PSI_STRUCT(glob_t, [
size_t gl_pathc,
PSI_CONST(GLOB_ABORTED, int)
PSI_CONST(GLOB_NOMATCH, int)
PSI_CONST(GLOB_NOSPACE, int)
-])
+}
-AC_DEFUN(PSI_CHECK_NETDB, [
+PSI_CHECK_NETDB() {
AC_CHECK_HEADERS(netdb.h)
-
+
PSI_STRUCT(struct hostent, [
char *h_name,
char **h_aliases,
int h_length,
char **h_addr_list]
)
-
+
PSI_STRUCT(struct netent, [
char *n_name,
char **n_aliases,
int n_addrtype,
uint32_t n_net]
)
-
+
PSI_STRUCT(struct protoent, [
char *p_name,
char **p_aliases,
int p_proto]
)
-
+
PSI_STRUCT(struct servent, [
char *s_name,
char **s_aliases,
int s_port,
char *s_proto]
)
-
+
PSI_CONST(IPPORT_RESERVED, int)
-
+
PSI_STRUCT(struct addrinfo, [
int ai_flags,
int ai_family,
char *ai_canonname,
struct addrinfo *ai_next]
)
-
+
PSI_CONST(AI_PASSIVE, int)
PSI_CONST(AI_CANONNAME, int)
PSI_CONST(AI_NUMERICHOST, int)
PSI_CONST(AI_V4MAPPED, int)
PSI_CONST(AI_ALL, int)
PSI_CONST(AI_ADDRCONFIG, int)
-
+
PSI_CONST(NI_NOFQDN, int)
PSI_CONST(NI_NUMERICHOST, int)
PSI_CONST(NI_NAMEREQD, int)
PSI_CONST(NI_NUMERICSERV, int)
PSI_CONST(NI_NUMERICSCOPE, int)
PSI_CONST(NI_DGRAM, int)
-
+
PSI_CONST(NI_MAXHOST, int)
PSI_CONST(NI_MAXSERV, int)
-
+
PSI_CONST(EAI_AGAIN, int)
PSI_CONST(EAI_BADFLAGS, int)
PSI_CONST(EAI_FAIL, int)
PSI_CONST(EAI_SOCKTYPE, int)
PSI_CONST(EAI_SYSTEM, int)
PSI_CONST(EAI_OVERFLOW, int)
-
+
PSI_DECL(void endhostent, [(void)])
PSI_DECL(void endnetent, [(void)])
PSI_DECL(void endprotoent, [(void)])
PSI_DECL(void setnetent, [(int stayopen)])
PSI_DECL(void setprotoent, [(int stayopen)])
PSI_DECL(void setservent, [(int stayopen)])
-
-])
\ No newline at end of file
+}
-PSI_TYPES=
-PSI_STRUCTS=
-PSI_CONSTS=
-PSI_REDIRS=
-PSI_MACROS=
-PSI_DECLS=
-PSI_VA_DECLS=
+PSI_TYPES=$PHP_PSI_SRCDIR/php_psi_types.h
+PSI_STRUCTS=$PHP_PSI_SRCDIR/php_psi_structs.h
+PSI_CONSTS=$PHP_PSI_SRCDIR/php_psi_consts.h
+PSI_REDIRS=$PHP_PSI_SRCDIR/php_psi_redirs.h
+PSI_MACROS=$PHP_PSI_SRCDIR/php_psi_macros.h
+PSI_DECLS=$PHP_PSI_SRCDIR/php_psi_decls.h
+PSI_VA_DECLS=$PHP_PSI_SRCDIR/php_psi_va_decls.h
+
+AC_DEFUN(PSI_CONFIG_INIT, [
+ cat >$PSI_TYPES <<EOF
+static struct psi_predef_type {
+ token_t type_tag;
+ const char *type_name;
+ const char *alias;
+} psi_predef_types@<:@@:>@ = {
+EOF
+ cat >$PSI_STRUCTS <<EOF
+static struct psi_predef_struct {
+ token_t type_tag;
+ const char *type_name;
+ const char *var_name;
+ size_t offset;
+ size_t size;
+ size_t pointer_level;
+ size_t array_size;
+} psi_predef_structs@<:@@:>@ = {
+EOF
+ cat >$PSI_CONSTS <<EOF
+static struct psi_predef_const {
+ token_t type_tag;
+ const char *type_name;
+ const char *var_name;
+ const char *val_text;
+ token_t val_type_tag;
+} psi_predef_consts@<:@@:>@ = {
+EOF
+ cat >$PSI_REDIRS <<EOF
+static struct psi_func_redir {
+ const char *name;
+ void (*func)(void);
+} psi_func_redirs@<:@@:>@ = {
+EOF
+ cat >$PSI_MACROS </dev/null
+ cat >$PSI_DECLS <<EOF
+static struct psi_predef_decl {
+ token_t type_tag;
+ const char *type_name;
+ const char *var_name;
+ size_t pointer_level;
+ size_t array_size;
+} psi_predef_decls@<:@@:>@ = {
+EOF
+ cat >$PSI_VA_DECLS <<EOF
+static struct psi_predef_decl psi_predef_vararg_decls@<:@@:>@ = {
+EOF
+])
+
+AC_DEFUN(PSI_CONFIG_DONE, [
+ for i in $PSI_TYPES $PSI_STRUCTS $PSI_CONSTS $PSI_REDIRS $PSI_DECLS $PSI_VA_DECLS; do
+ cat >>$i <<EOF
+ {0}
+};
+EOF
+ done
+])
psi_includes() {
local have_
# add_str_const(name, value)
add_str_const() {
- PSI_CONSTS="{PSI_T_STRING, \"string\", \"psi\\\\$1\", $2, PSI_T_QUOTED_STRING}, $PSI_CONSTS"
+ cat >>$PSI_CONSTS <<<" {PSI_T_STRING, \"string\", \"psi\\\\$1\", $2, PSI_T_QUOTED_STRING}, "
}
# add_int_const(name, value)
add_int_const() {
- PSI_CONSTS="{PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, $PSI_CONSTS"
+ cat >>$PSI_CONSTS <<<" {PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, "
}
dnl PSI_CONST(const name, type)
AC_DEFUN(PSI_CONST, [
AC_DEFUN(PSI_REDIR, [psi_symbol=ifelse([$2],[],[$1],[$2])
- PSI_REDIRS="{\"$1\", (void(*)(void))$psi_symbol}, $PSI_REDIRS"])
+ cat >>$PSI_REDIRS <<<" {\"$1\", (void(*)(void))$psi_symbol}, "])
AC_DEFUN(PSI_FUNC_LIBC_MAIN, [
AC_REQUIRE([AC_PROG_NM])
[m4_map_args_sep([PSI_DECL_ARG(m4_normalize(], [))], [], m4_bregexp([$2], [(\(.*\))], [\1]))])
PSI_FUNC(PSI_VAR_NAME($1), [
ifelse([$3], vararg, [
- PSI_VA_DECLS="$psi_decl_args, {0}, $PSI_VA_DECLS"
+ cat >>$PSI_VA_DECLS <<<" $psi_decl_args, {0}, "
], [
- PSI_DECLS="$psi_decl_args, {0}, $PSI_DECLS"
+ cat >>$PSI_DECLS <<<" $psi_decl_args, {0}, "
])
], [
PSI_MACRO($1, $2, [
ifelse([$3], vararg, AC_MSG_ERROR(varargs macro support is not implemented),[])
- PSI_DECLS="$psi_decl_args, {0}, $PSI_DECLS"
+ cat >>$PSI_DECLS <<<" $psi_decl_args, {0}, "
])
])
])
macro_body="return $macro_name$macro_call;"
])
psi_macro="$macro_type psi_macro_$macro_name$macro_decl { $macro_body }"
- PSI_MACROS="$PSI_MACROS $psi_macro"
+ cat >>$PSI_MACROS <<<"$psi_macro"
PSI_REDIR($macro_name, psi_macro_$macro_name)
], [], PSI_INCLUDES)
])
psi_struct_name=m4_bregexp([$1], [^\(struct \)?\(\w+\)], [\2])
psi_struct_members="{PSI_T_STRUCT, \"struct\", \"$psi_struct_name\", 0, $AS_TR_SH([ac_cv_sizeof_]$1), 0, 0}"
ifelse([$2],,,[m4_map_args_sep([PSI_STRUCT_MEMBER($1, m4_normalize(], [))], [], $2)])
- PSI_STRUCTS="$psi_struct_members, {0}, $PSI_STRUCTS"
+ cat >>$PSI_STRUCTS <<<" $psi_struct_members, {0}, "
if test "$1" = "$psi_struct_name"; then
- PSI_TYPES="{PSI_T_STRUCT, \"$1\", \"$1\"}, $PSI_TYPES"
+ cat >>$PSI_TYPES <<<" {PSI_T_STRUCT, \"$1\", \"$1\"}, "
fi
])
local psi_type_upper=`tr a-z A-Z <<<$psi_type_name`
local psi_type_bits=`expr $2 \* 8`
echo "PSI_T_${psi_type_upper}${psi_type_bits}, \"${psi_type_lower}${psi_type_bits}_t\""
- eval AS_TR_SH([psi_standard_type_]$1)="${psi_type_lower}${psi_type_bits}_t"
+ #eval AS_TR_SH([psi_standard_type_]$1)="${psi_type_lower}${psi_type_bits}_t"
;;
struct*)
echo "PSI_T_STRUCT, \"$2\""
int)
AX_CHECK_SIGN($1, :, [
psi_basic_type=uint
- ], $psi_header)
+ ], PSI_INCLUDES)
;;
sint)
psi_basic_type=int
esac
if test "$2" && test "$AS_TR_SH([ac_cv_sizeof_]$1)" -gt 0; then
AS_TR_SH(psi_basic_type_$1)=$psi_basic_type
- PSI_TYPES="{`psi_type_pair $psi_basic_type $AS_TR_SH([ac_cv_sizeof_]$1)`, \"$1\"}, $PSI_TYPES"
+ cat >>$PSI_TYPES <<<" {`psi_type_pair $psi_basic_type $AS_TR_SH([ac_cv_sizeof_]$1)`, \"$1\"}, "
fi
])
dnl PSI_TYPE_INDIRECTION(type, size, pointer_level_var, array_size_var)
AC_DEFUN(PSI_TYPE_INDIRECTION, [
- AC_MSG_CHECKING(indirection of $1)
- m4_define([pointer_level], m4_len(m4_bpatsubst([PSI_VAR_TYPE($1)], [[^*]])))
- m4_define([array_size], [m4_bregexp([PSI_VAR_TYPE($1)], [@<:@\([0-9]+\)@:>@], [\1])])
-
- ifelse(array_size.$2,0., [
+ dnl AC_MSG_CHECKING(indirection of $1)
+ m4_define([psi_pointer_level], m4_len(m4_bpatsubst([PSI_VAR_TYPE($1)], [[^*]])))
+ m4_define([psi_array_size], [m4_bregexp([PSI_VAR_TYPE($1)], [@<:@\([0-9]+\)@:>@], [\1])])
+
+ ifelse(psi_array_size.$2,0., [
AC_MSG_ERROR([cannot compute dynamic array size of a non-struct member])
], [
- ifelse(pointer_level,0,[
- m4_define([type_size],[$]AS_TR_SH([ac_cv_sizeof_]m4_bregexp(PSI_VAR_TYPE([$1]), [^\( \|\w\)+], [\&])))
+ ifelse(psi_pointer_level,0,[
+ m4_define([psi_type_size],[$]AS_TR_SH([ac_cv_sizeof_]m4_bregexp(PSI_VAR_TYPE([$1]), [^\( \|\w\)+], [\&])))
],[
- m4_define([type_size],$ac_cv_sizeof_void_p)
+ m4_define([psi_type_size],$ac_cv_sizeof_void_p)
])
])
-
- m4_case(array_size,,[
- $3=pointer_level
+
+ m4_case(psi_array_size,,[
+ $3=psi_pointer_level
$4=0]
,0,[
- $3=m4_incr(pointer_level)
- $4="`expr $2 / type_size`"
+ $3=m4_incr(psi_pointer_level)
+ $4="`expr $2 / psi_type_size`"
], [
- $3=m4_incr(pointer_level)
- $4=array_size
+ $3=m4_incr(psi_pointer_level)
+ $4=psi_array_size
])
-
- AC_MSG_RESULT([[$]$3, [$]$4])
+
+ dnl AC_MSG_RESULT([[$]$3, [$]$4])
])
AC_DEFUN(PSI_TYPE_PAIR, [m4_case(m4_bregexp([$1], [^\w+], [\&]),
-AC_DEFUN(PSI_CHECK_STDDEF, [
+PSI_CHECK_STDDEF() {
AC_CHECK_HEADERS(stddef.h)
PSI_TYPE(ptrdiff_t, int)
PSI_CONST(PTRDIFF_MIN, int)
PSI_TYPE(wchar_t, int)
PSI_CONST(WCHAR_MIN, int)
PSI_CONST(WCHAR_MAX, int)
-])
+}
-AC_DEFUN(PSI_CHECK_STDINT, [
+PSI_CHECK_STDINT() {
AC_CHECK_HEADERS(stdint.h)
PSI_TYPE(int_least8_t, int)
PSI_CONST(INTMAX_MIN, int)
PSI_CONST(INTMAX_MAX, int)
PSI_CONST(UINTMAX_MAX, int)
-])
+}
-AC_DEFUN(PSI_CHECK_STDIO, [
+PSI_CHECK_STDIO() {
AC_CHECK_HEADER(stdio.h)
PSI_STRUCT(FILE)
PSI_DECL(int snprintf, [(char *str, size_t size, char *format)], vararg)
PSI_DECL(int sprintf, [(char *str, char *format)], vararg)
PSI_DECL(int sscanf, [(char *str, char *format)], vararg)
-])
+}
-AC_DEFUN(PSI_CHECK_STDLIB, [
+PSI_CHECK_STDLIB() {
AC_CHECK_HEADERS(stdlib.h)
-
+
PSI_STRUCT(div_t, [
int quot,
int rem
PSI_DECL(int unsetenv, [(char *var)])
PSI_DECL(size_t wcstombs, [(char *dest, wchar_t *src, size_t n)])
PSI_DECL(int wctomb, [(char *s, wchar_t wc)])
-])
-
+}
-AC_DEFUN(PSI_CHECK_SYS_SELECT, [
+PSI_CHECK_SYS_SELECT() {
AC_CHECK_HEADERS(sys/select.h)
-
+
PSI_STRUCT(fd_set, [])
-
+
PSI_CONST(FD_SETSIZE, int)
-
+
PSI_MACRO(void FD_CLEAR, [(int fd, fd_set *s)])
PSI_MACRO(void FD_COPY, [(fd_set *s1, fd_set *s2)])
PSI_MACRO(void FD_CLR, [(int fd, fd_set *s)])
PSI_MACRO(void FD_SET, [(int fd, fd_set *s)])
PSI_MACRO(int FD_ISSET, [(int fd, fd_set *s)])
PSI_MACRO(void FD_ZERO, [(fd_set *s)])
-
+
PSI_DECL(int select, [(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)])
dnl PSI_DECL(int pselect, [(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout, sigset_t *sigmask)])
-])
\ No newline at end of file
+}
-AC_DEFUN(PSI_CHECK_SYS_SOCKET, [
+PSI_CHECK_SYS_SOCKET() {
AC_CHECK_HEADERS(sys/socket.h)
-
+
PSI_TYPE(socklen_t, int)
PSI_TYPE(sa_family_t, uint)
-
+
PSI_STRUCT(struct sockaddr, [
sa_family_t sa_family,
char sa_data@<:@0@:>@]
int l_onoff,
int l_linger]
)
-
+
PSI_CONST(AF_INET, int)
PSI_CONST(AF_INET6, int)
PSI_CONST(AF_UNIX, int)
PSI_CONST(SO_SNDLOWAT, int)
PSI_CONST(SO_SNDTIMEO, int)
PSI_CONST(SO_TYPE, int)
-
+
PSI_MACRO(unsigned char *CMSG_DATA, [(struct cmsghdr *m)])
PSI_MACRO(struct cmsghdr *CMSG_NXTHDR, [(struct msghdr *m, struct cmsghdr *c)])
PSI_MACRO(struct cmsghdr *CMSG_FIRSTHDR, [(struct msghdr *m)])
-
+
PSI_DECL(int accept, [(int socket, struct sockaddr *address, socklen_t *address_len)])
PSI_DECL(int bind, [(int socket, struct sockaddr *address, socklen_t address_len)])
PSI_DECL(int connect, [(int socket, struct sockaddr *address, socklen_t address_len)])
PSI_DECL(int sockatmark, [(int socket)])
PSI_DECL(int socket, [(int domain, int type, int protocol)])
PSI_DECL(int socketpair, [(int domain, int type, int protocol, int socket_vector@<:@2@:>@)])
-
-])
\ No newline at end of file
+}
-AC_DEFUN(PSI_CHECK_SYS_STAT, [
+PSI_CHECK_SYS_STAT() {
AC_CHECK_HEADERS([sys/stat.h])
PSI_STRUCT(struct stat, [
PSI_DECL(int stat, [(char *path, struct stat *buf)])
PSI_DECL(mode_t umask, [(mode_t mode)])
PSI_DECL(int utimensat, [(int fd, char *path, struct timespec times@<:@2@:>@, int flag)])
-])
+}
-AC_DEFUN(PSI_CHECK_SYS_TIME, [
+PSI_CHECK_SYS_TIME() {
AC_CHECK_HEADERS(sys/time.h)
PSI_CONST(ITIMER_REAL, int)
PSI_DECL(int gettimeofday, [(struct timeval *tp, struct timezone *tz)])
PSI_DECL(int utimes, [(char *path, struct timeval times@<:@2@:>@)])
PSI_DECL(int utimensat, [(int fd, char *path, struct timespec times@<:@2@:>@)])
-])
+}
-AC_DEFUN(PSI_CHECK_SYS_TIMES, [
+PSI_CHECK_SYS_TIMES() {
AC_CHECK_HEADERS(sys/times.h)
-
+
PSI_STRUCT(struct tms, [
clock_t tms_utime,
clock_t tms_stime,
clock_t tms_cutime,
clock_t tms_cstime]
)
-
+
PSI_DECL(clock_t times, [(struct tms *buf)])
-])
+}
-AC_DEFUN(PSI_CHECK_SYS_TYPES, [
+PSI_CHECK_SYS_TYPES() {
AC_CHECK_HEADERS(sys/types.h)
PSI_TYPE(blkcnt_t, int)
PSI_TYPE(time_t, int)
PSI_TYPE(timer_t, int)
PSI_TYPE(uid_t, int)
-])
+}
-AC_DEFUN(PSI_CHECK_SYS_UIO, [
+PSI_CHECK_SYS_UIO() {
AC_CHECK_HEADERS(sys/uio.h)
-
+
PSI_STRUCT(struct iovec, [
void *iov_base,
size_t iov_len]
)
-
+
PSI_DECL(ssize_t readv, [(int fd, struct iovec *iov, int iovcnt)])
PSI_DECL(ssize_t writev, [(int fd, struct iovec *iov, int iovcnt)])
-])
+}
-AC_DEFUN(PSI_CHECK_SYS_UTSNAME, [
+PSI_CHECK_SYS_UTSNAME() {
AC_CHECK_HEADERS(sys/utsname.h)
-
+
PSI_STRUCT(struct utsname, [
char sysname@<:@0@:>@,
char nodename@<:@0@:>@,
char machine@<:@0@:>@,
char domainname@<:@0@:>@
])
-
+
PSI_DECL(int uname, [(struct utsname *name)])
-])
\ No newline at end of file
+}
--- /dev/null
+PSI_CHECK_SYSLOG() {
+ AC_CHECK_HEADERS(syslog.h)
+
+ PSI_CONST(LOG_PID, int)
+ PSI_CONST(LOG_CONS, int)
+ PSI_CONST(LOG_NDELAY, int)
+ PSI_CONST(LOG_ODELAY, int)
+ PSI_CONST(LOG_NOWAIT, int)
+ PSI_CONST(LOG_KERN, int)
+ PSI_CONST(LOG_USER, int)
+ PSI_CONST(LOG_MAIL, int)
+ PSI_CONST(LOG_NEWS, int)
+ PSI_CONST(LOG_UUCP, int)
+ PSI_CONST(LOG_DAEMON, int)
+ PSI_CONST(LOG_AUTH, int)
+ PSI_CONST(LOG_CRON, int)
+ PSI_CONST(LOG_LPR, int)
+ PSI_CONST(LOG_LOCAL0, int)
+ PSI_CONST(LOG_LOCAL1, int)
+ PSI_CONST(LOG_LOCAL2, int)
+ PSI_CONST(LOG_LOCAL3, int)
+ PSI_CONST(LOG_LOCAL4, int)
+ PSI_CONST(LOG_LOCAL5, int)
+ PSI_CONST(LOG_LOCAL6, int)
+ PSI_CONST(LOG_LOCAL7, int)
+ PSI_CONST(LOG_EMERG, int)
+ PSI_CONST(LOG_ALERT, int)
+ PSI_CONST(LOG_CRIT, int)
+ PSI_CONST(LOG_ERR, int)
+ PSI_CONST(LOG_WARNING, int)
+ PSI_CONST(LOG_NOTICE, int)
+ PSI_CONST(LOG_INFO, int)
+ PSI_CONST(LOG_DEBUG, int)
+
+ PSI_MACRO(int LOG_MASK, [(int pri)])
+ PSI_MACRO(int LOG_UPTO, [(int pri)])
+
+ PSI_DECL(void closelog, [(void)])
+ PSI_DECL(void openlog, [(char *ident, int option, int facility)])
+ PSI_DECL(void syslog, [(int priority, char *format)], vararg)
+ PSI_DECL(int setlogmask, [(int mask)])
+}
-AC_DEFUN(PSI_CHECK_TIME, [
+PSI_CHECK_TIME() {
AC_CHECK_HEADERS(time.h)
PSI_CONST(CLOCKS_PER_SEC, int)
PSI_DECL(int timer_gettime, [(timer_t t, struct itimerspec *ts)])
PSI_DECL(int timer_settime, [(timer_t t, int flags, struct itimerspec *value, struct itimerspec *ovalue)])
PSI_DECL(void tzset, [()])
-])
+}
-AC_DEFUN(PSI_CHECK_WCHAR, [
+PSI_CHECK_WCHAR() {
AC_CHECK_HEADERS(wchar.h)
PSI_TYPE(wint_t, int)
+ PSI_TYPE(wctype_t, int)
+ PSI_STRUCT(mbstate_t)
PSI_CONST(WINT_MIN, int)
PSI_CONST(WINT_MAX, int)
PSI_CONST(WEOF, int)
- PSI_DECL(int wprintf, [(wchar_t *format)], vararg)
- PSI_DECL(int fwprintf, [(FILE *stream, wchar_t *format)], vararg)
- PSI_DECL(int swprintf, [(wchar_t *wcs, size_t maxlen, wchar_t *format)], vararg)
-])
+ PSI_DECL(wint_t btowc, [(int c)])
+ PSI_DECL(wint_t fgetwc, [(FILE *stream)])
+ PSI_DECL(wchar_t *fgetws, [(wchar_t *ws, int n, FILE *stream)])
+ PSI_DECL(wint_t fputwc, [(wchar_t c, FILE *stream)])
+ PSI_DECL(int fputws, [(const wchar_t *ws, FILE *stream)])
+ PSI_DECL(int fwide, [(FILE *stream, int mode)])
+ PSI_DECL(int fwprintf, [(FILE *stream, const wchar_t *format)], vararg)
+ PSI_DECL(int fwscanf, [(FILE *stream, const wchar_t *format)], vararg)
+ PSI_DECL(wint_t getwc, [(FILE *stream)])
+ PSI_DECL(wint_t getwchar, [(void)])
+ PSI_DECL(int iswalnum, [(wint_t wc)])
+ PSI_DECL(int iswalpha, [(wint_t wc)])
+ PSI_DECL(int iswcntrl, [(wint_t wc)])
+ PSI_DECL(int iswctype, [(wint_t wc, wctype_t class)])
+ PSI_DECL(int iswdigit, [(wint_t wc)])
+ PSI_DECL(int iswgraph, [(wint_t wc)])
+ PSI_DECL(int iswlower, [(wint_t wc)])
+ PSI_DECL(int iswprint, [(wint_t wc)])
+ PSI_DECL(int iswpunct, [(wint_t wc)])
+ PSI_DECL(int iswspace, [(wint_t wc)])
+ PSI_DECL(int iswupper, [(wint_t wc)])
+ PSI_DECL(int iswxdigit, [(wint_t wc)])
+ PSI_DECL(size_t mbrlen, [(const char *s, size_t n, mbstate_t *ps)])
+ PSI_DECL(size_t mbrtowc, [(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)])
+ PSI_DECL(int mbsinit, [(const mbstate_t *ps)])
+ PSI_DECL(size_t mbsnrtowcs, [(wchar_t *dst, const char **src, size_t nms, size_t len, mbstate_t *ps)])
+ PSI_DECL(size_t mbsrtowcs, [(wchar_t *dst, const char **src, size_t len, mbstate_t *ps)])
+ PSI_DECL(FILE *open_wmemstream, [(wchar_t **ptr, size_t *size)])
+ PSI_DECL(wint_t putwc, [(wchar_t wc, FILE *stream)])
+ PSI_DECL(wint_t putwchar, [(wchar_t wc)])
+ PSI_DECL(int swprintf, [(wchar_t *wcs, size_t maxlen, const wchar_t *format)], vararg)
+ PSI_DECL(int swscanf, [(const wchar_t *ws, const wchar_t *format)], vararg)
+ PSI_DECL(wint_t towlower, [(wint_t wc)])
+ PSI_DECL(wint_t towupper, [(wint_t wc)])
+ PSI_DECL(wint_t ungetwc, [(wint_t wc, FILE *stream)])
+ PSI_DECL(wchar_t *wcpcpy, [(wchar_t *dest, const wchar_t *src)])
+ PSI_DECL(wchar_t *wcpncpy, [(wchar_t *dest, const wchar_t *src, size_t n)])
+ PSI_DECL(size_t wcrtomb, [(char *s, wchar_t wc, mbstate_t *ps)])
+ PSI_DECL(int wcscasecmp, [(const wchar_t *s1, const wchar_t *s2)])
+ PSI_DECL(int wcscasecmp_l, [(const wchar_t *s1, const wchar_t *s2, locale_t loc)])
+ PSI_DECL(wchar_t *wcscat, [(wchar_t *dest, const wchar_t *src)])
+ PSI_DECL(wchar_t *wcschr, [(const wchar_t *wcs, wchar_t wc)])
+ PSI_DECL(int wcscmp, [(const wchar_t *s1, const wchar_t *s2)])
+ PSI_DECL(int wcscoll, [(const wchar_t *s1, const wchar_t *s2)])
+ PSI_DECL(int wcscoll_l, [(const wchar_t *s1, const wchar_t *s2, locale_t loc)])
+ PSI_DECL(wchar_t *wcscpy, [(wchar_t *dest, const wchar_t *src)])
+ PSI_DECL(size_t wcscspn, [(const wchar_t *wcs, const wchar_t *reject)])
+ PSI_DECL(wchar_t *wcsdup, [(const wchar_t *s)])
+ PSI_DECL(size_t wcsftime, [(wchar_t *wcs, size_t maxsize, const wchar_t *format, const struct tm *timeptr)])
+ PSI_DECL(size_t wcslen, [(const wchar_t *s)])
+ PSI_DECL(int wcsncasecmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)])
+ PSI_DECL(int wcsncasecmp_l, [(const wchar_t *s1, const wchar_t *s2, size_t n, locale_t loc)])
+ PSI_DECL(wchar_t *wcsncat, [(wchar_t *dest, const wchar_t *src, size_t n)])
+ PSI_DECL(int wcsncmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)])
+ PSI_DECL(wchar_t *wcsncpy, [(wchar_t *dest, const wchar_t *src, size_t n)])
+ PSI_DECL(size_t wcsnlen, [(const wchar_t *s, size_t maxlen)])
+ PSI_DECL(size_t wcsnrtombs, [(char *dest, const wchar_t **src, size_t nwc, size_t len, mbstate_t *ps)])
+ PSI_DECL(wchar_t *wcspbrk, [(const wchar_t *wcs, const wchar_t *accept)])
+ PSI_DECL(wchar_t *wcsrchr, [(const wchar_t *wcs, wchar_t wc)])
+ PSI_DECL(size_t wcsrtombs, [(char *dest, const wchar_t **src, size_t n, mbstate_t *ps)])
+ PSI_DECL(size_t wcsspn, [(const wchar_t *wcs, const wchar_t *accept)])
+ PSI_DECL(wchar_t *wcsstr, [(const wchar_t *haystack, const wchar_t *needle)])
+ PSI_DECL(double wcstod, [(const wchar_t *nptr, wchar_t **endptr)])
+ PSI_DECL(float wcstof, [(const wchar_t *nptr, wchar_t **endptr)])
+ PSI_DECL(wchar_t *wcstok, [(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)])
+ PSI_DECL(long wcstol, [(const wchar_t *nptr, wchar_t **endptr, int base)])
+ dnl PSI_DECL(long double wcstold, [(const wchar_t *nptr, wchar_t **endptr)])
+ dnl PSI_DECL(long long wcstoll, [(const wchar_t *nptr, wchar_t **endptr, int base)])
+ PSI_DECL(unsigned long wcstoul, [(const wchar_t *nptr, wchar_t **endptr, int base)])
+ dnl PSI_DECL(unsigned long long wcstoull, [(const wchar_t *nptr, wchar_t **endptr, int base)])
+ PSI_DECL(int wcswidth, [(const wchar_t *s, size_t n)])
+ PSI_DECL(size_t wcsxfrm, [(wchar_t *ws1, const wchar_t *ws2, size_t n)])
+ PSI_DECL(size_t wcsxfrm_l, [(wchar_t *ws1, const wchar_t *ws2, size_t n, locale_t loc)])
+ PSI_DECL(int wctob, [(wint_t c)])
+ PSI_DECL(wctype_t wctype, [(const char *name)])
+ PSI_DECL(int wcwidth, [(wchar_t c)])
+ PSI_DECL(wchar_t *wmemchr, [(const wchar_t *s, wchar_t c, size_t n)])
+ PSI_DECL(int wmemcmp, [(const wchar_t *s1, const wchar_t *s2, size_t n)])
+ PSI_DECL(wchar_t *wmemcpy, [(wchar_t *dest, const wchar_t *src, size_t n)])
+ PSI_DECL(wchar_t *wmemmove, [(wchar_t *dest, const wchar_t *src, size_t n)])
+ PSI_DECL(wchar_t *wmemset, [(wchar_t *wcs, wchar_t wc, size_t n)])
+ PSI_DECL(int wprintf, [(const wchar_t *format)], vararg)
+ PSI_DECL(int wscanf, [(const wchar_t *format)], vararg)
+}
--- /dev/null
+function psi\openlog(string $ident, int $option, int $facility) : void {
+ let ident = strval($ident);
+ let option = intval($option);
+ let facility = intval($facility);
+ return void(openlog);
+}
+
+function psi\closelog() : void {
+ return void(closelog);
+}
+
+function psi\setlogmask(int $mask) : int {
+ let mask = intval($mask);
+ return to_int(setlogmask);
+}
+
+function psi\syslog(int $priority, string $format, mixed ...$args) : void {
+ let priority = intval($priority);
+ let format = strval($format);
+ return void(syslog);
+}
+
+// redirected macro
+extern int LOG_MASK(int pri);
+function psi\LOG_MASK(int $pri) : int {
+ let pri = intval($pri);
+ return to_int(LOG_MASK);
+}
{0}
};
+#include "php_psi_types.h"
+#include "php_psi_consts.h"
+#include "php_psi_macros.h"
+#include "php_psi_redirs.h"
+#include "php_psi_decls.h"
+#include "php_psi_va_decls.h"
+#include "php_psi_structs.h"
+
+/*
static struct psi_predef_type {
token_t type_tag;
const char *type_name;
PSI_STRUCTS
{0}
};
-
+*/
static int validate_lib(PSI_Data *data, void **dlopened) {
char lib[MAXPATHLEN];
const char *ptr = data->psi.file.ln;
--INI--
psi.directory={PWD}:{PWD}/../../psi.d
--SKIPIF--
-<?php
+<?php
extension_loaded("psi") or die("skip -- need ext/psi");
?>
--FILE--
===TEST===
-<?php
+<?php
$rc = psi\getaddrinfo("m6w6.name", NULL, NULL, $ai);
$flags = psi\NI_NUMERICHOST|psi\NI_NUMERICSERV;
do {
- var_dump(psi\getnameinfo($ai["ai_addr"], $host, $serv, $flags), $host, $serv);
+ $rc = psi\getnameinfo($ai["ai_addr"], $host, $serv, $flags);
+ if ($rc !== 0) var_dump($rc);
+ if ($host !== "78.46.223.30") var_dump($host);
+ if ($serv !== "0") var_dump($serv);
} while (($ai = $ai["ai_next"]));
?>
===DONE===
--EXPECT--
===TEST===
-int(0)
-string(12) "78.46.223.30"
-string(1) "0"
-int(0)
-string(12) "78.46.223.30"
-string(1) "0"
-int(0)
-string(12) "78.46.223.30"
-string(1) "0"
-===DONE===
\ No newline at end of file
+===DONE===