From 519eebccd275ea423e23527fa230c3b78035a43b Mon Sep 17 00:00:00 2001 From: kelson42 Date: Mon, 14 Mar 2011 21:39:45 +0000 Subject: [PATCH] + continue the implementation of ctpp2 --- src/common/kiwix/searcher.cpp | 24 ++++++++++++++++++++++++ src/common/kiwix/searcher.h | 8 ++++++++ 2 files changed, 32 insertions(+) diff --git a/src/common/kiwix/searcher.cpp b/src/common/kiwix/searcher.cpp index 23ebf47b1..33d0ee8fb 100644 --- a/src/common/kiwix/searcher.cpp +++ b/src/common/kiwix/searcher.cpp @@ -74,6 +74,30 @@ namespace kiwix { const string Searcher::searchInIndexAndReturnHtml(string &search, const unsigned int resultsCount, const string templatePath, const bool verbose) { + + VMOpcodeCollector oVMOpcodeCollector; + StaticText oSyscalls; + StaticData oStaticData; + StaticText oStaticText; + HashTable oHashTable; + CTPP2Compiler oCompiler(oVMOpcodeCollector, oSyscalls, oStaticData, oStaticText, oHashTable); + + try + { + // Load template + CTPP2FileSourceLoader oSourceLoader; + oSourceLoader.LoadTemplate(search.c_str()); + + // Create template parser + CTPP2Parser oCTPP2Parser(&oSourceLoader, &oCompiler, search.c_str()); + + // Compile template + oCTPP2Parser.Compile(); + } + catch(...) + { + } + return ""; } diff --git a/src/common/kiwix/searcher.h b/src/common/kiwix/searcher.h index 384178bac..3dffd6b74 100644 --- a/src/common/kiwix/searcher.h +++ b/src/common/kiwix/searcher.h @@ -30,7 +30,15 @@ #include #include +#include +#include +#include +#include +#include +#include + using namespace std; +using namespace CTPP; struct Result {