summaryrefslogtreecommitdiff
path: root/src/crawl
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-10-09 15:49:49 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-10-09 15:49:49 +0200
commit3fc6e3cf5b586640a057e3f8335605c2bf5784ec (patch)
tree5d8029190edfd1c1fd6d93359c517bea32a2a08e /src/crawl
parent5c37d14e53c729c10d87849408058031d96d51f1 (diff)
downloadcrawler-3fc6e3cf5b586640a057e3f8335605c2bf5784ec.tar.gz
crawler-3fc6e3cf5b586640a057e3f8335605c2bf5784ec.tar.bz2
first running lua code with URL normalization, cleanup needed..
Diffstat (limited to 'src/crawl')
-rwxr-xr-xsrc/crawl/GNUmakefile11
-rw-r--r--src/crawl/crawl.conf4
-rwxr-xr-xsrc/crawl/crawl.cpp11
3 files changed, 23 insertions, 3 deletions
diff --git a/src/crawl/GNUmakefile b/src/crawl/GNUmakefile
index f664f0d..5a9051a 100755
--- a/src/crawl/GNUmakefile
+++ b/src/crawl/GNUmakefile
@@ -26,13 +26,22 @@ INCLUDE_LIBS = \
# openssl
ifeq ($(WITH_SSL),1)
-INCLUDE_CFLAGS += \
+INCLUDE_CXXFLAGS += \
-DWITH_SSL
INCLUDE_LIBS += \
$(OPENSSL_LIBS)
endif
+ifeq ($(WITH_LUA),1)
+INCLUDE_CXXFLAGS += \
+ -DWITH_LUA
+
+INCLUDE_DIRS += \
+ -I$(TOPDIR)/src/libcrawler \
+ $(TOLUA_INCLUDES)
+endif
+
CPP_OBJS = \
CPP_BINS = \
diff --git a/src/crawl/crawl.conf b/src/crawl/crawl.conf
index 922ae42..5d1c380 100644
--- a/src/crawl/crawl.conf
+++ b/src/crawl/crawl.conf
@@ -1,8 +1,8 @@
local normalizer = GoogleURLNormalizer:new( )
local baseUrl = normalizer:parseUrl( "http://www.base.com" )
---io.write( "base URL is: " .. baseUrl.str( ) )
+io.write( "base URL is: " .. baseUrl:str( ) .. "\n" )
local url = normalizer:normalize( baseUrl, "/relativedir/relativefile.html" )
---io.write( "URL is: " .. url.str( ) )
+io.write( "URL is: " .. url:str( ) .. "\n" )
-- global setting
diff --git a/src/crawl/crawl.cpp b/src/crawl/crawl.cpp
index 08d3dbf..3a8fdff 100755
--- a/src/crawl/crawl.cpp
+++ b/src/crawl/crawl.cpp
@@ -55,6 +55,12 @@ BOOL WINAPI termHandler( DWORD ctrlType )
#endif
+#ifdef WITH_LUA
+// TODO: should be in the laoding function of libcrawl
+#include "tolua.h"
+#include "URLLua.hpp"
+#endif
+
static int counter = 0;
int main( int /* argc */, char *argv[] )
@@ -281,6 +287,11 @@ int main( int /* argc */, char *argv[] )
LOG( logNOTICE ) << "Crawler stopped.. normal shutdown..";
+#ifdef WITH_LUA
+ // TODO: should be in the laoding function of libcrawl
+ tolua_URL_open( luaVm.handle( ) );
+#endif
+
luaVm.executeMain( );
//luaVm.dumpState( );