diff options
Diffstat (limited to 'src/modules/urlnormalizer/simpleurl')
-rw-r--r-- | src/modules/urlnormalizer/simpleurl/GNUmakefile | 33 | ||||
-rwxr-xr-x | src/modules/urlnormalizer/simpleurl/SimpleURLNormalizer.cpp | 21 |
2 files changed, 53 insertions, 1 deletions
diff --git a/src/modules/urlnormalizer/simpleurl/GNUmakefile b/src/modules/urlnormalizer/simpleurl/GNUmakefile index d7e6378..64053a9 100644 --- a/src/modules/urlnormalizer/simpleurl/GNUmakefile +++ b/src/modules/urlnormalizer/simpleurl/GNUmakefile @@ -10,14 +10,36 @@ INCLUDE_DIRS = \ -I$(TOPDIR)/include/util \ -I$(TOPDIR)/include/crawler +ifeq ($(WITH_LUA),1) +INCLUDE_DIRS += \ + -I$(TOPDIR)/include/luaglue \ + $(TOLUA_INCLUDES) +endif + INCLUDE_CXXFLAGS = \ +ifeq ($(WITH_LUA),1) +INCLUDE_CXXFLAGS += \ + -DWITH_LUA +endif + INCLUDE_LDFLAGS = \ -L$(TOPDIR)/src/libcrawler +ifeq ($(WITH_LUA),1) +INCLUDE_LDFLAGS += \ + $(TOLUA_LDFLAGS) +endif + INCLUDE_LIBS = \ -lcrawler +ifeq ($(WITH_LUA),1) +INCLUDE_LIBS += \ + -llua \ + $(TOLUA_LIBS) +endif + DYNAMIC_MODULE = \ mod_urlnormalizer_simple.so @@ -27,11 +49,22 @@ STATIC_LIB = \ CPP_OBJS = \ SimpleURLNormalizer.o +ifeq ($(WITH_LUA),1) +CPP_OBJS += \ + SimpleURLNormalizerLua.o +endif + -include $(TOPDIR)/makefiles/gmake/sub.mk +SimpleURLNormalizerLua.cpp: SimpleURLNormalizer.pkg + $(TOLUA) -H SimpleURLNormalizerLua.hpp -o SimpleURLNormalizerLua.cpp SimpleURLNormalizer.pkg + local_all: local_clean: +ifeq ($(WITH_LUA),1) + @-rm SimpleURLNormalizerLua.cpp SimpleURLNormalizerLua.hpp +endif local_distclean: diff --git a/src/modules/urlnormalizer/simpleurl/SimpleURLNormalizer.cpp b/src/modules/urlnormalizer/simpleurl/SimpleURLNormalizer.cpp index 8a7efd7..0ab1d05 100755 --- a/src/modules/urlnormalizer/simpleurl/SimpleURLNormalizer.cpp +++ b/src/modules/urlnormalizer/simpleurl/SimpleURLNormalizer.cpp @@ -3,6 +3,12 @@ #include "SimpleURLNormalizer.hpp" +#ifdef WITH_LUA +#include "tolua.h" +#include "SimpleURLNormalizerLua.hpp" +#include "LuaVM.hpp" +#endif + using namespace std; SimpleURLNormalizer::SimpleURLNormalizer( ) @@ -150,4 +156,17 @@ void SimpleURLNormalizer::normalizePath( string &path ) } } -REGISTER_MODULE( "simple_urlnormalizer", 0, 0, URLNormalizer, SimpleURLNormalizer ) +static void initModule( void *user_data ) +{ +#ifdef WITH_LUA + LuaVM *luaVm = (LuaVM *)user_data; + + tolua_SimpleURLNormalizer_open( luaVm->handle( ) ); +#endif +} + +static void destroyModule( void * /* user_data */ ) +{ +} + +REGISTER_MODULE( "simple_urlnormalizer", &initModule, &destroyModule, URLNormalizer, SimpleURLNormalizer ) |