The acronym PSI may be read as:
* PHP System Interface
-* POSIX Standard Interface
-
-The latter because PSI can be configured to include declarations for most of the
-[base definitions and system interfaces of POSIX.1-2008](http://pubs.opengroup.org/onlinepubs/9699919799/).
> **WARNING:**
-> This is heavy WIP. Only a small part of configuration and implementation has been completed yet.
+> This is heavy WIP.
## Features
-* standard scalar types mapped to stdint types
* structs, unions, enums and typedefs
-* simple numeric expressions
-* string and int constants
+* numeric and boolean expressions
+* scalar constants
* vararg calls
## Installing
> **WARNING:**
-> This is heavy WIP. Installation only works from a source checkout yet.
+> This is heavy WIP. Installation only works from a source checkout with php-src@master yet.
### PECL
This is only relevant for an in-tree build. Use `--enable-psi` to include
the PSI extension in the build.
-### --enable-psi-posix
-**Pre-define POSIX decls.**
-
-Use `--enable-psi-posix=all` to enable all available POSIX checks.
-
-Use `--enable-psi-posix=section,another,onemore` to enable specific modules only.
-
-The following modules are included by default:
-
-[stdint](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html),
-[stddef](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html),
-[stdlib](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html),
-[sys/types](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html)
-
-The following modules are available to select:
-
-[errno](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html),
-[fcntl](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html),
-[glob](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/glob.h.html),
-[locale](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html),
-[ndbm](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ndbm.h.html),
-[netdb](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html),
-[netinet/in](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html),
-[netinet/tcp](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html),
-[poll](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html),
-[signal](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html),
-[stdio](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html),
-[sys/select](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html),
-[sys/socket](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html),
-[sys/stat](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html),
-[sys/time](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html),
-[sys/times](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_times.h.html),
-[sys/uio](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html),
-[sys/utsname](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html),
-[syslog](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/syslog.h.html),
-[time](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html),
-[unistd](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html),
-[wchar](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html),
-[wctype](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html),
-
### --with-psi-libjit
**Path to libjit.**
A colon separated list of directories to scan for `*.psi` files. Defaults to "psi.d".
+### psi.blacklist.decls
+
+A comma separated list of C function declarations to ignore.
+
+### psi.blacklist.vars
+
+A comma separated list of C variable declarations do ignore.
+
## PSI files
+### CPP
+
+* conditional parsing
+* including headers
+
+```c
+#include <string.h>
+```
+
### Comments
* C style multi line comments
```
These statements define what library should be `dlopen()`-ed to look up symbols from declarations.
-They must only occur once in a file. When a `lib` statement is omitted, stdlib is assumed.
+When a `lib` statement is omitted, stdlib is assumed.
### Declarations
PSI is a PHP extension, which provides a foreign function interface through libffi and/or libjit.
The acronym PSI may be read as:
-
PHP System Interface
- POSIX Standard Interface
-
-The latter because PSI can be configured to include declarations for most of the base definitions
-and system interfaces of POSIX.1-2008 (http://pubs.opengroup.org/onlinepubs/9699919799/).
]]></description>
<lead>
<name>Michael Wallner</name>
<file role="src" name="config.m4"/>
<file role="src" name="Makefile.frag"/>
<file role="src" name="php_psi.h"/>
+ <dir name="m4">
+ <dir name="ax">
+ <file role="src" name="ax_check_sign.m4"/>
+ <file role="src" name="ax_pthread.m4"/>
+ </dir>
+ <dir name="psi">
+ <file role="src" name="psi.m4"/>
+ <file role="src" name="psi_const.m4"/>
+ <file role="src" name="psi_type.m4"/>
+ </dir>
+ </dir>
+ <dir name="psi.d">
+ <file role="src" name="arpa_inet.psi"/>
+ <file role="src" name="errno.psi"/>
+ <file role="src" name="getopt.psi"/>
+ <file role="src" name="glob.psi"/>
+ <file role="src" name="netdb.psi"/>
+ <file role="src" name="stat.psi"/>
+ <file role="src" name="stdio.psi"/>
+ <file role="src" name="stdlib.psi"/>
+ <file role="src" name="string.psi"/>
+ <file role="src" name="syslog.psi"/>
+ <file role="src" name="time.psi"/>
+ <file role="src" name="uname.psi"/>
+ </dir>
+ <dir name="scripts">
+ <file role="src" name="_include.php"/>
+ <file role="src" name="gen_calc_basic.php"/>
+ <file role="src" name="gen_calc_bin.php"/>
+ <file role="src" name="gen_calc_bool.php"/>
+ <file role="src" name="gen_calc_cast.php"/>
+ <file role="src" name="gen_calc_cmp.php"/>
+ <file role="src" name="gen_calc_oper.php"/>
+ <file role="src" name="gen_calc_unary.php"/>
+ <file role="src" name="gen_package_xml.php"/>
+ <file role="src" name="gen_travis_yml.php"/>
+ </dir>
<dir name="src">
<file role="src" name="call.c"/>
<file role="src" name="context.c"/>
+ <file role="src" name="cpp.c"/>
+ <file role="src" name="cpp_tokiter.c"/>
<file role="src" name="data.c"/>
<file role="src" name="error.c"/>
<file role="src" name="libffi.c"/>
<file role="src" name="parser_proc.c"/>
<file role="src" name="plist.c"/>
<file role="src" name="token.c"/>
+ <file role="src" name="validate.c"/>
<file role="src" name="calc.h"/>
<file role="src" name="call.h"/>
<file role="src" name="context.h"/>
+ <file role="src" name="cpp.h"/>
<file role="src" name="data.h"/>
<file role="src" name="error.h"/>
<file role="src" name="libffi.h"/>
<file role="src" name="libjit.h"/>
<file role="src" name="marshal.h"/>
<file role="src" name="parser.h"/>
- <file role="src" name="parser_proc_grammar.y"/>
- <file role="src" name="parser_proc.c"/>
<file role="src" name="parser_proc.h"/>
- <file role="src" name="parser.re"/>
<file role="src" name="plist.h"/>
<file role="src" name="token.h"/>
<file role="src" name="types.h"/>
+ <file role="src" name="validate.h"/>
+ <file role="src" name="parser_proc_grammar.y"/>
+ <file role="src" name="parser.re"/>
<dir name="calc">
<file role="src" name="basic.h"/>
<file role="src" name="bin.h"/>
<file role="src" name="cast.h"/>
<file role="src" name="cmp.h"/>
<file role="src" name="oper.h"/>
+ <file role="src" name="unary.h"/>
</dir>
<dir name="types">
<file role="src" name="assert_stmt.c"/>
<file role="src" name="const.c"/>
- <file role="src" name="const_type.c"/>
+ <file role="src" name="cpp_exp.c"/>
+ <file role="src" name="cpp_macro_call.c"/>
+ <file role="src" name="cpp_macro_decl.c"/>
<file role="src" name="decl.c"/>
<file role="src" name="decl_abi.c"/>
<file role="src" name="decl_arg.c"/>
<file role="src" name="decl_enum.c"/>
<file role="src" name="decl_enum_item.c"/>
+ <file role="src" name="decl_extvar.c"/>
<file role="src" name="decl_file.c"/>
<file role="src" name="decl_struct.c"/>
<file role="src" name="decl_type.c"/>
<file role="src" name="let_stmt.c"/>
<file role="src" name="num_exp.c"/>
<file role="src" name="number.c"/>
+ <file role="src" name="return_exp.c"/>
<file role="src" name="return_stmt.c"/>
<file role="src" name="set_exp.c"/>
<file role="src" name="set_func.c"/>
<file role="src" name="set_stmt.c"/>
<file role="src" name="assert_stmt.h"/>
<file role="src" name="const.h"/>
- <file role="src" name="const_type.h"/>
+ <file role="src" name="cpp_exp.h"/>
+ <file role="src" name="cpp_macro_call.h"/>
+ <file role="src" name="cpp_macro_decl.h"/>
<file role="src" name="decl.h"/>
<file role="src" name="decl_abi.h"/>
<file role="src" name="decl_arg.h"/>
<file role="src" name="decl_enum.h"/>
<file role="src" name="decl_enum_item.h"/>
+ <file role="src" name="decl_extvar.h"/>
<file role="src" name="decl_file.h"/>
<file role="src" name="decl_struct.h"/>
<file role="src" name="decl_type.h"/>
<file role="src" name="let_stmt.h"/>
<file role="src" name="num_exp.h"/>
<file role="src" name="number.h"/>
+ <file role="src" name="return_exp.h"/>
<file role="src" name="return_stmt.h"/>
<file role="src" name="set_exp.h"/>
<file role="src" name="set_func.h"/>
</dir>
<dir name="ndbm">
<file role="test" name="ndbm001.phpt"/>
+ <file role="test" name="gdbm.psi"/>
<file role="test" name="ndbm.psi"/>
</dir>
<dir name="netdb">
<file role="test" name="gai001.phpt"/>
</dir>
<dir name="parser">
- <file role="test" name="validate001.phpt"/>
+ <file role="test" name="cpp001.phpt"/>
<file role="test" name="dump001.phpt"/>
<file role="test" name="enum001.phpt"/>
<file role="test" name="validate001.phpt"/>
<file role="test" name="validate004.phpt"/>
<file role="test" name="validate005.phpt"/>
<file role="test" name="validate006.phpt"/>
+ <file role="test" name="validate007.phpt"/>
</dir>
<dir name="pipe">
<file role="test" name="pipe001.phpt"/>
<dependencies>
<required>
<php>
- <min>7.0.0-dev</min>
+ <min>7.3.0-dev</min>
</php>
<pearinstaller>
<min>1.4.1</min>
$doc = new DOMDocument;
$doc->load(__DIR__."/../package.xml");
+$m4 = $doc->createElement("dir");
+$m4->setAttribute("name", "m4");
+$m4->appendChild($doc->createTextNode("\n"));
+add(__DIR__."/../m4", "*.*", "src", $m4);
+$m4->appendChild($doc->createTextNode(" "));
+
$src = $doc->createElement("dir");
$src->setAttribute("name", "src");
$src->appendChild($doc->createTextNode("\n"));
add(__DIR__."/../src", "*.{c,h,y,re,inc}", "src", $src);
$src->appendChild($doc->createTextNode(" "));
+$scripts = $doc->createElement("dir");
+$scripts->setAttribute("name", "scripts");
+$scripts->appendChild($doc->createTextNode("\n"));
+add(__DIR__."/../scripts", "*.*", "src", $scripts);
+$scripts->appendChild($doc->createTextNode(" "));
+
+$psid = $doc->createElement("dir");
+$psid->setAttribute("name", "psi.d");
+$psid->appendChild($doc->createTextNode("\n"));
+add(__DIR__."/../psi.d", "*", "src", $psid);
+$psid->appendChild($doc->createTextNode(" "));
+
$tests = $doc->createElement("dir");
$tests->setAttribute("name", "tests");
$tests->appendChild($doc->createTextNode("\n"));
add(__DIR__."/../tests", "*.{phpt,inc,psi}", "test", $tests);
$tests->appendChild($doc->createTextNode(" "));
+
$xpath = new DOMXpath($doc);
$xpath->registerNamespace("p", "http://pear.php.net/dtd/package-2.0");
$root = $xpath->query("/p:package/p:contents/p:dir[@name='/']")->item(0);
+
+$root->replaceChild($m4,
+ $xpath->query("/p:package/p:contents/p:dir[@name='/']/p:dir[@name='m4']")->item(0));
+$root->replaceChild($psid,
+ $xpath->query("/p:package/p:contents/p:dir[@name='/']/p:dir[@name='psi.d']")->item(0));
$root->replaceChild($src,
$xpath->query("/p:package/p:contents/p:dir[@name='/']/p:dir[@name='src']")->item(0));
+$root->replaceChild($scripts,
+ $xpath->query("/p:package/p:contents/p:dir[@name='/']/p:dir[@name='scripts']")->item(0));
$root->replaceChild($tests,
$xpath->query("/p:package/p:contents/p:dir[@name='/']/p:dir[@name='tests']")->item(0));