X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fcpp.c;h=eaf43f800dce273f81c9724e73bb8236777d9d23;hp=4982c7842337b8a4d8bcc26780b8af95b73e9cbd;hb=f077a911ab3d74c43a6316d745e885446820e7bf;hpb=a7ac1c0a3c855321f21682c127a4b707de33a303 diff --git a/src/cpp.c b/src/cpp.c index 4982c78..eaf43f8 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -23,21 +23,27 @@ 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 #include "cpp.h" #include "parser.h" +#include "debug.h" #define PSI_CPP_SEARCH #define PSI_CPP_PREDEF -#include "php_psi_cpp.h" - -#include "php_psi.h" +#include "php_psi_predef.h" HashTable psi_cpp_defaults; +PHP_MINIT_FUNCTION(psi_cpp); PHP_MINIT_FUNCTION(psi_cpp) { struct psi_parser parser; @@ -70,6 +76,7 @@ PHP_MINIT_FUNCTION(psi_cpp) return SUCCESS; } +PHP_MSHUTDOWN_FUNCTION(psi_cpp); PHP_MSHUTDOWN_FUNCTION(psi_cpp) { struct psi_cpp_macro_decl *macro; @@ -114,28 +121,11 @@ static char *include_flavor[] = { "include once" }; -#if PSI_CPP_DEBUG > 1 -static int dump_def(zval *p) -{ - struct psi_cpp_macro_decl *decl = Z_PTR_P(p); - - if (decl) { - dprintf(2, "PSI: CPP decl -> #define "); - psi_cpp_macro_decl_dump(2, decl); - dprintf(2, "\n"); - } - return ZEND_HASH_APPLY_KEEP; -} -#endif - void psi_cpp_free(struct psi_cpp **cpp_ptr) { if (*cpp_ptr) { struct psi_cpp *cpp = *cpp_ptr; -#if PSI_CPP_DEBUG > 1 - zend_hash_apply(&cpp->defs, dump_def); -#endif *cpp_ptr = NULL; zend_hash_destroy(&cpp->defs); zend_hash_destroy(&cpp->once); @@ -219,7 +209,7 @@ static bool psi_cpp_stage1(struct psi_cpp *cpp) no_ws->type = PSI_T_NO_WHITESPACE; zend_string_release(no_ws->text); - no_ws->text = zend_string_init_interned("\xA0", 1, 1); + no_ws->text = psi_string_init_interned("\xA0", 1, 1); psi_cpp_tokiter_add(cpp, no_ws); continue; }