projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
tests: fix ndbm cleanup
[m6w6/ext-psi]
/
src
/
module.c
diff --git
a/src/module.c
b/src/module.c
index f71975b295932bdc053129e3b2fd03b4e955ae41..a70a50a0249f400287a3015d9873ab4c2a38d2d5 100644
(file)
--- a/
src/module.c
+++ b/
src/module.c
@@
-1,6
+1,7
@@
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
+#else
+# include "php_config.h"
#endif
#include "php.h"
#endif
#include "php.h"
@@
-10,6
+11,8
@@
#include "zend_operators.h"
#include "php_psi.h"
#include "zend_operators.h"
#include "php_psi.h"
+#include "token.h"
+#include "parser.h"
#if HAVE_LIBJIT
# include "libjit.h"
#if HAVE_LIBJIT
# include "libjit.h"
@@
-37,12
+40,18
@@
zend_class_entry *psi_object_get_class_entry()
return psi_class_entry;
}
return psi_class_entry;
}
-void psi_error_wrapper(
PSI_T
oken *t, int type, const char *msg, ...)
+void psi_error_wrapper(
void *context, struct psi_t
oken *t, int type, const char *msg, ...)
{
va_list argv;
const char *fn = NULL;
unsigned ln = 0;
{
va_list argv;
const char *fn = NULL;
unsigned ln = 0;
+ if (context) {
+ if (PSI_DATA(context)->flags & PSI_PARSER_SILENT) {
+ return;
+ }
+ }
+
if (t) {
fn = t->file;
ln = t->line;
if (t) {
fn = t->file;
ln = t->line;
@@
-113,7
+122,7
@@
static PHP_FUNCTION(psi_dump) {
RETURN_FALSE;
}
}
RETURN_FALSE;
}
}
-
PSI_ContextD
ump(&PSI_G(context), fd);
+
psi_context_d
ump(&PSI_G(context), fd);
}
ZEND_BEGIN_ARG_INFO_EX(ai_psi_validate, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_psi_validate, 0, 0, 1)
@@
-121,36
+130,38
@@
ZEND_BEGIN_ARG_INFO_EX(ai_psi_validate, 0, 0, 1)
ZEND_END_ARG_INFO();
static PHP_FUNCTION(psi_validate) {
zend_string *file;
ZEND_END_ARG_INFO();
static PHP_FUNCTION(psi_validate) {
zend_string *file;
-
PSI_P
arser P;
+
struct psi_p
arser P;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "P", &file)) {
return;
}
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "P", &file)) {
return;
}
- if (!
PSI_ParserI
nit(&P, file->val, psi_error_wrapper, 0)) {
+ if (!
psi_parser_i
nit(&P, file->val, psi_error_wrapper, 0)) {
RETURN_FALSE;
}
RETURN_FALSE;
}
- while (0 <
PSI_ParserS
can(&P)) {
-
PSI_ParserParse(&P, PSI_TokenA
lloc(&P));
+ while (0 <
psi_parser_s
can(&P)) {
+
psi_parser_parse(&P, psi_token_a
lloc(&P));
if (P.num == PSI_T_EOF) {
break;
}
}
if (P.num == PSI_T_EOF) {
break;
}
}
-
PSI_ParserP
arse(&P, NULL);
+
psi_parser_p
arse(&P, NULL);
- if (0 ==
PSI_ContextValidateD
ata(NULL, PSI_DATA(&P)) && !P.errors) {
+ if (0 ==
psi_context_validate_d
ata(NULL, PSI_DATA(&P)) && !P.errors) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
-
PSI_ParserD
tor(&P);
+
psi_parser_d
tor(&P);
}
static PHP_MINIT_FUNCTION(psi)
{
}
static PHP_MINIT_FUNCTION(psi)
{
-
PSI_ContextO
ps *ops = NULL;
+
struct psi_context_o
ps *ops = NULL;
zend_class_entry ce = {0};
zend_class_entry ce = {0};
+ unsigned flags = psi_check_env("PSI_DEBUG") ? PSI_PARSER_DEBUG : (
+ psi_check_env("PSI_SILENT") ? PSI_PARSER_SILENT : 0);
REGISTER_INI_ENTRIES();
REGISTER_INI_ENTRIES();
@@
-165,11
+176,11
@@
static PHP_MINIT_FUNCTION(psi)
#ifdef HAVE_LIBJIT
if (!strcasecmp(PSI_G(engine), "jit")) {
#ifdef HAVE_LIBJIT
if (!strcasecmp(PSI_G(engine), "jit")) {
- ops =
PSI_Libjit
();
+ ops =
psi_libjit_ops
();
} else
#endif
#ifdef HAVE_LIBFFI
} else
#endif
#ifdef HAVE_LIBFFI
- ops =
PSI_Libffi
();
+ ops =
psi_libffi_ops
();
#endif
if (!ops) {
#endif
if (!ops) {
@@
-177,11
+188,11
@@
static PHP_MINIT_FUNCTION(psi)
return FAILURE;
}
return FAILURE;
}
-
PSI_ContextInit(&PSI_G(context), ops, psi_error_wrapper
);
-
PSI_ContextB
uild(&PSI_G(context), PSI_G(directory));
+
psi_context_init(&PSI_G(context), ops, psi_error_wrapper, flags
);
+
psi_context_b
uild(&PSI_G(context), PSI_G(directory));
if (psi_check_env("PSI_DUMP")) {
if (psi_check_env("PSI_DUMP")) {
-
PSI_ContextD
ump(&PSI_G(context), STDOUT_FILENO);
+
psi_context_d
ump(&PSI_G(context), STDOUT_FILENO);
}
return SUCCESS;
}
return SUCCESS;
@@
-189,7
+200,7
@@
static PHP_MINIT_FUNCTION(psi)
static PHP_MSHUTDOWN_FUNCTION(psi)
{
static PHP_MSHUTDOWN_FUNCTION(psi)
{
-
PSI_ContextD
tor(&PSI_G(context));
+
psi_context_d
tor(&PSI_G(context));
UNREGISTER_INI_ENTRIES();
UNREGISTER_INI_ENTRIES();