OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
-#include "php_psi_stdinc.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
#include "php_psi.h"
#include "data.h"
#include "php_globals.h"
+#include "zend_types.h"
#include <dlfcn.h>
#include <ctype.h>
+#if PSI_THREADED_PARSER
+# include <pthread.h>
+
+static pthread_mutex_t psi_string_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+zend_string *psi_string_init_interned(const char *buf, size_t len, int p)
+{
+ zend_string *str;
+
+ pthread_mutex_lock(&psi_string_mutex);
+ str = zend_string_init_interned(buf, len, p);
+ pthread_mutex_unlock(&psi_string_mutex);
+
+ return str;
+}
+
+zend_string *psi_new_interned_string(zend_string *str)
+{
+ zend_string *new_str;
+
+ pthread_mutex_lock(&psi_string_mutex);
+ new_str = zend_new_interned_string(str);
+ pthread_mutex_unlock(&psi_string_mutex);
+
+ return new_str;
+}
+
+#endif
+
static void psi_data_ctor_internal(struct psi_data *data,
psi_error_cb error, unsigned flags)
{
void psi_data_dump(struct psi_dump *dump, struct psi_data *D)
{
size_t i = 0;
- char *libname;
+ zend_string *libname;
if (D->file.filename) {
PSI_DUMP(dump, "// filename=%s (%u errors)\n", D->file.filename->val, D->errors);
}
while (psi_plist_get(D->file.libnames, i++, &libname)) {
- PSI_DUMP(dump, "lib \"%s\";\n", libname);
+ PSI_DUMP(dump, "#pragma lib \"%s\"\n", libname->val);
}
if (psi_plist_count(D->types)) {
size_t i = 0;
struct psi_decl_enum *enm;
while (psi_plist_get(D->enums, i++, &enm)) {
- if (!psi_decl_type_is_anon(enm->name, "enum")) {
+ if (true || !psi_decl_type_is_anon(enm->name, "enum")) {
psi_decl_enum_dump(dump, enm, 0);
PSI_DUMP(dump, "\n");
}
while (psi_plist_get(D->decls, i++, &decl)) {
if (decl->extvar) {
- PSI_DUMP(dump, "/* extvar accessor\n");
+ PSI_DUMP(dump, "/* extvar accessor \n");
}
psi_decl_dump(dump, decl);
- PSI_DUMP(dump, "\n");
if (decl->extvar) {
- PSI_DUMP(dump, " extvar accessor */\n");
+ PSI_DUMP(dump, " */");
}
+ PSI_DUMP(dump, "\n");
}
PSI_DUMP(dump, "\n");
}