From: Michael Wallner Date: Wed, 14 Oct 2015 19:14:53 +0000 (+0200) Subject: flush X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=94fbd01435494508cb54d6321c7d745b94949475;ds=sidebyside flush --- diff --git a/.gitignore b/.gitignore index 70680cf..0e802ee 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,7 @@ tests/*/*.php tests/*/*.exp tests/*/*.log tests/*/*.sh +/compiler.h +/parser.h +/parser_proc.h +/validator.h diff --git a/Makefile.frag b/Makefile.frag index fbf6c9c..79af1be 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -23,8 +23,8 @@ lemon.c: ./lemon: lemon.c | lempar.c -$(PHP_PSI_BUILDDIR)/src/parser_proc.c: $(PHP_PSI_SRCDIR)/src/parser_proc.y $(LEMON) +$(PHP_PSI_SRCDIR)/src/parser_proc.c: $(PHP_PSI_SRCDIR)/src/parser_proc.y $(LEMON) $(LEMON) -c $< -$(PHP_PSI_BUILDDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re +$(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re $(RE2C) -o $@ $< diff --git a/config.m4 b/config.m4 index 999f61c..9915505 100644 --- a/config.m4 +++ b/config.m4 @@ -29,6 +29,7 @@ if test "$PHP_PSI" != "no"; then PHP_PSI_HEADERS=`(cd $PHP_PSI_SRCDIR/src && echo *.h)` PHP_PSI_SOURCES=`(cd $PHP_PSI_SRCDIR && echo src/*.c)` + PHP_PSI_SOURCES="src/parser.c src/parser_proc.c" PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared) PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS) diff --git a/idl/Makefile b/idl/Makefile index 6534ffe..450905e 100644 --- a/idl/Makefile +++ b/idl/Makefile @@ -1,4 +1,9 @@ -CFLAGS += -g -D$(shell uname | tr a-z A-Z) +PHP_INCLUDES := -I/Users/Mike/Sources/php-src.git/{.,main,includes,Zend,TSRM,ext} +JIT_INCLUDES := -I/usr/local/include +UNAME := $(shell uname | tr a-z A-Z) +INCLUDES += $(PHP_INCLUDES) $(JIT_INCLUDES) +CFLAGS += -g -D$(UNAME) $(INCLUDES) +LDFLAGS += -ljit -ljitdynamic /usr/local/php7/lib/libphp7.dylib -Xlinker -rpath -Xlinker /usr/local/php7/lib SOURCES := parser_proc.c parser.c validator.c compiler.c main.c GENERATED_FILES := $(addsuffix .h, $(basename $(SOURCES))) @@ -23,6 +28,8 @@ lemon: lemon.c | lempar.c ## # Main test program ## +$(SOURCES): Makefile + GENERATED_FILES += main main: $(SOURCES) diff --git a/idl/main.c b/idl/main.c index b4eb459..db88740 100644 --- a/idl/main.c +++ b/idl/main.c @@ -5,16 +5,17 @@ #include "parser.h" #include "validator.h" -static int TRACE; - int main(int argc, char *argv[]) { PSI_Parser P; PSI_Validator V; + unsigned flags = 0; - TRACE = !!getenv("TRACE"); + if (getenv("TRACE")) { + flags |= PSI_PARSER_DEBUG; + } - if (!PSI_ParserInit(&P, argv[1])) { + if (!PSI_ParserInit(&P, argv[1], flags)) { perror("Failer to init parser"); return 1; } diff --git a/src/module.c b/src/module.c index c45ddb0..31bd2df 100644 --- a/src/module.c +++ b/src/module.c @@ -35,10 +35,10 @@ PHP_MINIT_FUNCTION(psi) } PHP_MSHUTDOWN_FUNCTION(psi) { - jit_context_t *ctx = PSI_G(context); + jit_context_t ctx = PSI_G(context); jit_context_destroy(ctx); - + UNREGISTER_INI_ENTRIES(); return SUCCESS;