From: Michael Wallner Date: Thu, 19 Nov 2015 06:59:07 +0000 (+0100) Subject: psis -> psi.d X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=6bdeeb7b332a272617814a4358d51bb07c872407 psis -> psi.d --- diff --git a/.gitignore b/.gitignore index dd61cef..0487d1b 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ tests/*/*.sh /libffi.h /libjit.j /tests/*/*.mem +/config.cache +*~ +*.swp diff --git a/psi.d/stat.psi b/psi.d/stat.psi new file mode 100644 index 0000000..e5d8eba --- /dev/null +++ b/psi.d/stat.psi @@ -0,0 +1,48 @@ +extern int stat(char *path, struct stat *buf); +function psi\stat(string $path, array &$buf = NULL) : int { + let path = strval($path); + let buf = calloc(1, struct stat); + return to_int(stat); + set $buf = to_array(*buf, + to_int(st_dev), + to_int(st_ino), + to_int(st_mode), + to_int(st_nlink), + to_int(st_uid), + to_int(st_gid), + to_int(st_rdev), + to_int(st_size), + to_array(st_atim, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_atimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_mtim, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_mtimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_ctim, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_ctimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_birthtimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_int(st_blksize), + to_int(st_blocks), + to_int(st_flags), + to_int(st_gen) + ); +} diff --git a/psi.d/stdlib.psi b/psi.d/stdlib.psi new file mode 100644 index 0000000..6044d41 --- /dev/null +++ b/psi.d/stdlib.psi @@ -0,0 +1,2 @@ + +extern void free(void *ptr); diff --git a/psi.d/time.psi b/psi.d/time.psi new file mode 100644 index 0000000..1281c51 --- /dev/null +++ b/psi.d/time.psi @@ -0,0 +1,87 @@ +extern time_t time(time_t *t); +function psi\time() : int { + let t = NULL; + return to_int(time); +} + +extern int gettimeofday(struct timeval *tv, struct timezone *tz); +function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int { + let tv = calloc(1, struct timeval); + let tz = calloc(1, struct timezone); + return to_int(gettimeofday); + set $tv = to_array(*tv, + to_int(tv_sec), + to_int(tv_usec)); + set $tz = to_array(*tz, + to_int(tz_minuteswest), + to_int(tz_dsttime)); +} + +extern char *asctime(struct tm *tm); +function psi\asctime(array $tm = NULL) : string { + let tm = arrval($tm); + return to_string(asctime); +} + +extern char *asctime_r(struct tm *tm, char *buf); +function psi\asctime_r(array $tm = NULL) : string { + let tm = arrval($tm); + let buf = calloc(32, char); + return to_string(asctime_r); +} + +extern struct tm *gmtime(time_t *tp); +function psi\gmtime(int $ts) : array { + let tp = &intval($ts); + return to_array(*gmtime, + to_int(tm_sec), + to_int(tm_min), + to_int(tm_hour), + to_int(tm_mday), + to_int(tm_mon), + to_int(tm_year), + to_int(tm_wday), + to_int(tm_yday), + to_int(tm_isdst) + ); +} + +extern struct tm *gmtime_r(time_t *tp, struct tm *buf); +function psi\gmtime_r(int $ts) : array { + let tp = &intval($ts); + let buf = calloc(1, struct tm); + return to_array(*gmtime_r, + to_int(tm_sec), + to_int(tm_min), + to_int(tm_hour), + to_int(tm_mday), + to_int(tm_mon), + to_int(tm_year), + to_int(tm_wday), + to_int(tm_yday), + to_int(tm_isdst) + ); +} + +extern int nanosleep(struct timespec *rqtp, struct timespec *rmtp); +function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int { + let rqtp = arrval($rq); + let rmtp = calloc(1, struct timespec); + return to_int(nanosleep); + set $rm = to_array(*rmtp, + to_int(tv_sec), + to_int(tv_nsec) + ); +} + +extern clock_t times(struct tms *buf); +function psi\times(array &$tms = NULL) : int { + let buf = calloc(1, struct tms); + return to_int(times); + set $tms = to_array(*buf, + to_int(tms_utime), + to_int(tms_stime), + to_int(tms_cutime), + to_int(tms_cstime) + ); +} diff --git a/psi.d/uname.psi b/psi.d/uname.psi new file mode 100644 index 0000000..25abfcb --- /dev/null +++ b/psi.d/uname.psi @@ -0,0 +1,12 @@ +extern int uname(struct utsname *u); +function psi\uname(array &$u = NULL) : int { + let u = calloc(1, struct utsname); + return to_int(uname); + set $u = to_array(*u, + to_string(sysname), + to_string(nodename), + to_string(release), + to_string(version), + to_string(machine), + to_string(domainname)); +} \ No newline at end of file diff --git a/psis/stat.psi b/psis/stat.psi deleted file mode 100644 index e5d8eba..0000000 --- a/psis/stat.psi +++ /dev/null @@ -1,48 +0,0 @@ -extern int stat(char *path, struct stat *buf); -function psi\stat(string $path, array &$buf = NULL) : int { - let path = strval($path); - let buf = calloc(1, struct stat); - return to_int(stat); - set $buf = to_array(*buf, - to_int(st_dev), - to_int(st_ino), - to_int(st_mode), - to_int(st_nlink), - to_int(st_uid), - to_int(st_gid), - to_int(st_rdev), - to_int(st_size), - to_array(st_atim, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_array(st_atimespec, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_array(st_mtim, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_array(st_mtimespec, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_array(st_ctim, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_array(st_ctimespec, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_array(st_birthtimespec, - to_int(tv_sec), - to_int(tv_nsec) - ), - to_int(st_blksize), - to_int(st_blocks), - to_int(st_flags), - to_int(st_gen) - ); -} diff --git a/psis/stdlib.psi b/psis/stdlib.psi deleted file mode 100644 index 6044d41..0000000 --- a/psis/stdlib.psi +++ /dev/null @@ -1,2 +0,0 @@ - -extern void free(void *ptr); diff --git a/psis/time.psi b/psis/time.psi deleted file mode 100644 index 1281c51..0000000 --- a/psis/time.psi +++ /dev/null @@ -1,87 +0,0 @@ -extern time_t time(time_t *t); -function psi\time() : int { - let t = NULL; - return to_int(time); -} - -extern int gettimeofday(struct timeval *tv, struct timezone *tz); -function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int { - let tv = calloc(1, struct timeval); - let tz = calloc(1, struct timezone); - return to_int(gettimeofday); - set $tv = to_array(*tv, - to_int(tv_sec), - to_int(tv_usec)); - set $tz = to_array(*tz, - to_int(tz_minuteswest), - to_int(tz_dsttime)); -} - -extern char *asctime(struct tm *tm); -function psi\asctime(array $tm = NULL) : string { - let tm = arrval($tm); - return to_string(asctime); -} - -extern char *asctime_r(struct tm *tm, char *buf); -function psi\asctime_r(array $tm = NULL) : string { - let tm = arrval($tm); - let buf = calloc(32, char); - return to_string(asctime_r); -} - -extern struct tm *gmtime(time_t *tp); -function psi\gmtime(int $ts) : array { - let tp = &intval($ts); - return to_array(*gmtime, - to_int(tm_sec), - to_int(tm_min), - to_int(tm_hour), - to_int(tm_mday), - to_int(tm_mon), - to_int(tm_year), - to_int(tm_wday), - to_int(tm_yday), - to_int(tm_isdst) - ); -} - -extern struct tm *gmtime_r(time_t *tp, struct tm *buf); -function psi\gmtime_r(int $ts) : array { - let tp = &intval($ts); - let buf = calloc(1, struct tm); - return to_array(*gmtime_r, - to_int(tm_sec), - to_int(tm_min), - to_int(tm_hour), - to_int(tm_mday), - to_int(tm_mon), - to_int(tm_year), - to_int(tm_wday), - to_int(tm_yday), - to_int(tm_isdst) - ); -} - -extern int nanosleep(struct timespec *rqtp, struct timespec *rmtp); -function psi\nanosleep(array $rq = NULL, array &$rm = NULL) : int { - let rqtp = arrval($rq); - let rmtp = calloc(1, struct timespec); - return to_int(nanosleep); - set $rm = to_array(*rmtp, - to_int(tv_sec), - to_int(tv_nsec) - ); -} - -extern clock_t times(struct tms *buf); -function psi\times(array &$tms = NULL) : int { - let buf = calloc(1, struct tms); - return to_int(times); - set $tms = to_array(*buf, - to_int(tms_utime), - to_int(tms_stime), - to_int(tms_cutime), - to_int(tms_cstime) - ); -} diff --git a/psis/uname.psi b/psis/uname.psi deleted file mode 100644 index 25abfcb..0000000 --- a/psis/uname.psi +++ /dev/null @@ -1,12 +0,0 @@ -extern int uname(struct utsname *u); -function psi\uname(array &$u = NULL) : int { - let u = calloc(1, struct utsname); - return to_int(uname); - set $u = to_array(*u, - to_string(sysname), - to_string(nodename), - to_string(release), - to_string(version), - to_string(machine), - to_string(domainname)); -} \ No newline at end of file diff --git a/src/module.c b/src/module.c index b7a09c3..a02784c 100644 --- a/src/module.c +++ b/src/module.c @@ -17,7 +17,7 @@ ZEND_DECLARE_MODULE_GLOBALS(psi); PHP_INI_BEGIN() STD_PHP_INI_ENTRY("psi.engine", "ffi", PHP_INI_SYSTEM, OnUpdateString, engine, zend_psi_globals, psi_globals) - STD_PHP_INI_ENTRY("psi.directory", "psis", PHP_INI_SYSTEM, OnUpdateString, directory, zend_psi_globals, psi_globals) + STD_PHP_INI_ENTRY("psi.directory", "psi.d", PHP_INI_SYSTEM, OnUpdateString, directory, zend_psi_globals, psi_globals) PHP_INI_END(); void psi_error(int type, const char *msg, ...) diff --git a/tests/idn/idn001.phpt b/tests/idn/idn001.phpt index cb57c11..afcac93 100644 --- a/tests/idn/idn001.phpt +++ b/tests/idn/idn001.phpt @@ -1,7 +1,7 @@ --TEST-- libidn --INI-- -psi.directory={PWD}/../../psis:{PWD} +psi.directory={PWD}/../../psi.d:{PWD} --SKIPIF--