diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-10-09 08:59:02 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-10-09 08:59:02 +0200 |
commit | 7d8b1ff684b412da292e0fc734748975188a0f10 (patch) | |
tree | 2673e3da51cc80bfc38a426048b30a4d71c31d4c /src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp | |
parent | 62c5bb90525baf0d82c23892c2666f611750d63c (diff) | |
download | crawler-7d8b1ff684b412da292e0fc734748975188a0f10.tar.gz crawler-7d8b1ff684b412da292e0fc734748975188a0f10.tar.bz2 |
first trials with a Google normalizer called from Lua, std::string is the problem currently
and the missing wrapper for the URL class
also added a local 'tolua', we will have to hack it
Diffstat (limited to 'src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp')
-rwxr-xr-x | src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp b/src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp index ea04980..734afea 100755 --- a/src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp +++ b/src/modules/urlnormalizer/googleurl/GoogleURLNormalizer.cpp @@ -6,6 +6,12 @@ #include "url_canon_stdstring.h" #include "url_parse.h" +#ifdef WITH_LUA +#include "tolua.h" +#include "GoogleURLNormalizerLua.hpp" +#include "LuaVM.hpp" +#endif + using namespace std; using namespace url_util; using namespace url_canon; @@ -106,4 +112,17 @@ URL GoogleURLNormalizer::normalize( const URL url, const string s ) "" ); } -REGISTER_MODULE( "google_urlnormalizer", 0, 0, URLNormalizer, GoogleURLNormalizer ) +static void initModule( void *user_data ) +{ +#ifdef WITH_LUA + LuaVM *luaVm = (LuaVM *)user_data; + + tolua_GoogleURLNormalizer_open( luaVm->handle( ) ); +#endif +} + +static void destroyModule( void * /* user_data */ ) +{ +} + +REGISTER_MODULE( "google_urlnormalizer", &initModule, &destroyModule, URLNormalizer, GoogleURLNormalizer ) |