From 6bbb87b063c099188e96f1a3d59aedc275e3098c Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 31 Aug 2015 13:08:50 +0200 Subject: [PATCH] recollindex and recollq build and run but fail because of unac error --- .hgignore | 5 - src/common/rclconfig.cpp | 20 +- src/index/recollindex.cpp | 2 +- src/internfile/mh_mbox.cpp | 6 +- src/query/docseq.cpp | 2 + src/query/docseqdb.cpp | 5 +- src/query/location.hh | 187 ++ src/query/position.hh | 180 ++ src/query/stack.hh | 158 ++ src/query/wasaparse.cpp | 1517 +++++++++++++++++ src/query/wasaparse.hpp | 476 ++++++ src/rcldb/rclterms.cpp | 4 +- src/utils/pathut.cpp | 259 ++- src/utils/pathut.h | 14 + src/utils/strmatcher.cpp | 34 +- src/windows/Win32ProjectRecoll.sln | 21 +- src/windows/Win32ProjectRecoll.vcxproj | 8 +- .../Win32ProjectRecoll.vcxproj.filters | 6 + src/windows/recollindex/recollindex.vcxproj | 6 +- src/windows/recollq/recollq.vcxproj | 180 ++ src/windows/recollq/recollq.vcxproj.filters | 96 ++ 21 files changed, 3133 insertions(+), 53 deletions(-) create mode 100644 src/query/location.hh create mode 100644 src/query/position.hh create mode 100644 src/query/stack.hh create mode 100644 src/query/wasaparse.cpp create mode 100644 src/query/wasaparse.hpp create mode 100644 src/windows/recollq/recollq.vcxproj create mode 100644 src/windows/recollq/recollq.vcxproj.filters diff --git a/.hgignore b/.hgignore index db7baf64..e9176fa6 100644 --- a/.hgignore +++ b/.hgignore @@ -81,12 +81,7 @@ src/qtgui/recoll src/qtgui/recoll.app src/qtgui/recoll.pro src/query/alldeps -src/query/location.hh -src/query/position.hh src/query/recollq -src/query/stack.hh -src/query/wasaparse.cpp -src/query/wasaparse.hpp src/sampleconf/rclmon.sh src/sampleconf/recoll.conf src/utils/alldeps diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index d61bb4b1..50ede075 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -122,7 +122,8 @@ void RclConfig::zeroMe() { bool RclConfig::isDefaultConfig() const { - string defaultconf = path_cat(path_canon(path_home()), ".recoll/"); + string defaultconf = path_cat(path_homedata(), + path_defaultrecollconfsubdir()); string specifiedconf = path_canon(m_confdir); path_catslash(specifiedconf); return !defaultconf.compare(specifiedconf); @@ -148,14 +149,8 @@ RclConfig::RclConfig(const string *argcnf) } // Compute our data dir name, typically /usr/local/share/recoll - const char *cdatadir = getenv("RECOLL_DATADIR"); - if (cdatadir == 0) { - // If not in environment, use the compiled-in constant. - m_datadir = RECOLL_DATADIR; - } else { - m_datadir = cdatadir; - } - + m_datadir = path_sharedatadir(); + fprintf(stderr, "RclConfig::RclConfig:: datadir: [%s]\n", m_datadir.c_str()); // We only do the automatic configuration creation thing for the default // config dir, not if it was specified through -c or RECOLL_CONFDIR bool autoconfdir = false; @@ -174,9 +169,10 @@ RclConfig::RclConfig(const string *argcnf) m_confdir = path_canon(cp); } else { autoconfdir = true; - m_confdir = path_cat(path_home(), ".recoll/"); + m_confdir = path_cat(path_homedata(), path_defaultrecollconfsubdir()); } } + fprintf(stderr, "RclConfig::RclConfig:: confdir: [%s]\n", m_confdir.c_str()); // Note: autoconfdir and isDefaultConfig() are normally the same. We just // want to avoid the imperfect test in isDefaultConfig() if we actually know @@ -1164,7 +1160,7 @@ string RclConfig::getConfdirPath(const char *varname, const char *dflt) const } else { result = path_tildexpand(result); // If not an absolute path, compute relative to config dir - if (result.at(0) != '/') { + if (!path_isabsolute(result)) { result = path_cat(getConfDir(), result); } } @@ -1320,7 +1316,7 @@ vector RclConfig::getDaemSkippedPaths() const string RclConfig::findFilter(const string &icmd) const { // If the path is absolute, this is it - if (icmd[0] == '/') + if (path_isabsolute(icmd)) return icmd; string cmd; diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index eefa92b6..d8c21b9f 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -280,7 +280,7 @@ static bool checktopdirs(RclConfig *config, vector& nonexist) for (vector::iterator it = tdl.begin(); it != tdl.end(); it++) { *it = path_tildexpand(*it); - if (!it->size() || (*it)[0] != '/') { + if (!it->size() || !path_isabsolute(*it)) { if ((*it)[0] == '~') { cerr << "Tilde expansion failed: " << *it << endl; LOGERR(("recollindex: tilde expansion failed: %s\n", diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp index 650ff6eb..b79c480d 100644 --- a/src/internfile/mh_mbox.cpp +++ b/src/internfile/mh_mbox.cpp @@ -394,7 +394,7 @@ static regex_t minifromregex; #else basic_regex fromregex; basic_regex minifromregex; -#define REG_ICASE std::regex_constants::icase +#define REG_ICASE std::regex_constants::icase #define REG_NOSUB std::regex_constants::nosubs #define REG_EXTENDED std::regex_constants::extended #define M_regexec(A, B, C, D, E) regex_match(B,A) @@ -416,8 +416,8 @@ static void compileregexes() regcomp(&fromregex, frompat, REG_NOSUB|REG_EXTENDED); regcomp(&minifromregex, miniTbirdFrom, REG_NOSUB|REG_EXTENDED); #else - fromregex = basic_regex(frompat, REG_NOSUB | REG_EXTENDED); - minifromregex = basic_regex(miniTbirdFrom, REG_NOSUB | REG_EXTENDED); + fromregex = basic_regex(frompat, REG_NOSUB | REG_EXTENDED); + minifromregex = basic_regex(miniTbirdFrom, REG_NOSUB | REG_EXTENDED); #endif regcompiled = true; } diff --git a/src/query/docseq.cpp b/src/query/docseq.cpp index d3c833b9..ebd89e89 100644 --- a/src/query/docseq.cpp +++ b/src/query/docseq.cpp @@ -14,6 +14,8 @@ * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "autoconfig.h" + #include "docseq.h" #include "filtseq.h" #include "sortseq.h" diff --git a/src/query/docseqdb.cpp b/src/query/docseqdb.cpp index 764d0199..75f84b9e 100644 --- a/src/query/docseqdb.cpp +++ b/src/query/docseqdb.cpp @@ -14,17 +14,20 @@ * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "autoconfig.h" + #include #include #include -using std::list; #include "docseqdb.h" #include "rcldb.h" #include "debuglog.h" #include "wasatorcl.h" +using std::list; + DocSequenceDb::DocSequenceDb(STD_SHARED_PTR q, const string &t, STD_SHARED_PTR sdata) : DocSequence(t), m_q(q), m_sdata(sdata), m_fsdata(sdata), diff --git a/src/query/location.hh b/src/query/location.hh new file mode 100644 index 00000000..7b708fd4 --- /dev/null +++ b/src/query/location.hh @@ -0,0 +1,187 @@ +// A Bison parser, made by GNU Bison 3.0.2. + +// Locations for Bison parsers in C++ + +// Copyright (C) 2002-2013 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file location.hh + ** Define the yy::location class. + */ + +#ifndef YY_YY_LOCATION_HH_INCLUDED +# define YY_YY_LOCATION_HH_INCLUDED + +# include "position.hh" + + +namespace yy { +#line 46 "location.hh" // location.cc:291 + /// Abstract a location. + class location + { + public: + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + { + } + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + { + } + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (std::string* f, + unsigned int l = 1u, + unsigned int c = 1u) + : begin (f, l, c) + , end (f, l, c) + { + } + + + /// Initialization. + void initialize (std::string* f = YY_NULLPTR, + unsigned int l = 1u, + unsigned int c = 1u) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline location operator+ (location res, const location& end) + { + res.end = end.end; + return res; + } + + /// Change end position in place. + inline location& operator+= (location& res, int width) + { + res.columns (width); + return res; + } + + /// Change end position. + inline location operator+ (location res, int width) + { + return res += width; + } + + /// Change end position in place. + inline location& operator-= (location& res, int width) + { + return res += -width; + } + + /// Change end position. + inline location operator- (const location& begin, int width) + { + return begin + -width; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0; + ostr << loc.begin// << "(" << loc.end << ") " +; + if (loc.end.filename + && (!loc.begin.filename + || *loc.begin.filename != *loc.end.filename)) + ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; + else if (loc.begin.line < loc.end.line) + ostr << '-' << loc.end.line << '.' << end_col; + else if (loc.begin.column < end_col) + ostr << '-' << end_col; + return ostr; + } + + +} // yy +#line 187 "location.hh" // location.cc:291 +#endif // !YY_YY_LOCATION_HH_INCLUDED diff --git a/src/query/position.hh b/src/query/position.hh new file mode 100644 index 00000000..107d8e11 --- /dev/null +++ b/src/query/position.hh @@ -0,0 +1,180 @@ +// A Bison parser, made by GNU Bison 3.0.2. + +// Positions for Bison parsers in C++ + +// Copyright (C) 2002-2013 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file position.hh + ** Define the yy::position class. + */ + +#ifndef YY_YY_POSITION_HH_INCLUDED +# define YY_YY_POSITION_HH_INCLUDED + +# include // std::max +# include +# include + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + + +namespace yy { +#line 56 "position.hh" // location.cc:291 + /// Abstract a position. + class position + { + public: + /// Construct a position. + explicit position (std::string* f = YY_NULLPTR, + unsigned int l = 1u, + unsigned int c = 1u) + : filename (f) + , line (l) + , column (c) + { + } + + + /// Initialization. + void initialize (std::string* fn = YY_NULLPTR, + unsigned int l = 1u, + unsigned int c = 1u) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (int count = 1) + { + if (count) + { + column = 1u; + line = add_ (line, count, 1); + } + } + + /// (column related) Advance to the COUNT next columns. + void columns (int count = 1) + { + column = add_ (column, count, 1); + } + /** \} */ + + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + + private: + /// Compute max(min, lhs+rhs) (provided min <= lhs). + static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min) + { + return (0 < rhs || -static_cast(rhs) < lhs + ? rhs + lhs + : min); + } + }; + + /// Add and assign a position. + inline position& + operator+= (position& res, int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline position + operator+ (position res, int width) + { + return res += width; + } + + /// Add and assign a position. + inline position& + operator-= (position& res, int width) + { + return res += -width; + } + + /// Add two position objects. + inline position + operator- (position res, int width) + { + return res -= width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return (pos1.line == pos2.line + && pos1.column == pos2.column + && (pos1.filename == pos2.filename + || (pos1.filename && pos2.filename + && *pos1.filename == *pos2.filename))); + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + +} // yy +#line 180 "position.hh" // location.cc:291 +#endif // !YY_YY_POSITION_HH_INCLUDED diff --git a/src/query/stack.hh b/src/query/stack.hh new file mode 100644 index 00000000..87d8f3ef --- /dev/null +++ b/src/query/stack.hh @@ -0,0 +1,158 @@ +// A Bison parser, made by GNU Bison 3.0.2. + +// Stack handling for Bison parsers in C++ + +// Copyright (C) 2002-2013 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file stack.hh + ** Define the yy::stack class. + */ + +#ifndef YY_YY_STACK_HH_INCLUDED +# define YY_YY_STACK_HH_INCLUDED + +# include + + +namespace yy { +#line 46 "stack.hh" // stack.hh:133 + template > + class stack + { + public: + // Hide our reversed order. + typedef typename S::reverse_iterator iterator; + typedef typename S::const_reverse_iterator const_iterator; + + stack () + : seq_ () + { + } + + stack (unsigned int n) + : seq_ (n) + { + } + + inline + T& + operator[] (unsigned int i) + { + return seq_[seq_.size () - 1 - i]; + } + + inline + const T& + operator[] (unsigned int i) const + { + return seq_[seq_.size () - 1 - i]; + } + + /// Steal the contents of \a t. + /// + /// Close to move-semantics. + inline + void + push (T& t) + { + seq_.push_back (T()); + operator[](0).move (t); + } + + inline + void + pop (unsigned int n = 1) + { + for (; n; --n) + seq_.pop_back (); + } + + void + clear () + { + seq_.clear (); + } + + inline + typename S::size_type + size () const + { + return seq_.size (); + } + + inline + const_iterator + begin () const + { + return seq_.rbegin (); + } + + inline + const_iterator + end () const + { + return seq_.rend (); + } + + private: + stack (const stack&); + stack& operator= (const stack&); + /// The wrapped container. + S seq_; + }; + + /// Present a slice of the top of a stack. + template > + class slice + { + public: + slice (const S& stack, unsigned int range) + : stack_ (stack) + , range_ (range) + { + } + + inline + const T& + operator [] (unsigned int i) const + { + return stack_[range_ - i]; + } + + private: + const S& stack_; + unsigned int range_; + }; + + +} // yy +#line 157 "stack.hh" // stack.hh:133 + +#endif // !YY_YY_STACK_HH_INCLUDED diff --git a/src/query/wasaparse.cpp b/src/query/wasaparse.cpp new file mode 100644 index 00000000..8247e2b9 --- /dev/null +++ b/src/query/wasaparse.cpp @@ -0,0 +1,1517 @@ +// A Bison parser, made by GNU Bison 3.0.2. + +// Skeleton implementation for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2013 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + + +// First part of user declarations. +#line 1 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:399 + +#define YYDEBUG 1 +#include "autoconfig.h" + +#include + +#include +#include + +#include "searchdata.h" +#include "wasaparserdriver.h" +#include "wasaparse.hpp" + +using namespace std; + +// #define LOG_PARSER +#ifdef LOG_PARSER +#define LOGP(X) {cerr << X;} +#else +#define LOGP(X) +#endif + +int yylex(yy::parser::semantic_type *, yy::parser::location_type *, + WasaParserDriver *); +void yyerror(char const *); +static void qualify(Rcl::SearchDataClauseDist *, const string &); + +static void addSubQuery(WasaParserDriver *d, + Rcl::SearchData *sd, Rcl::SearchData *sq) +{ + sd->addClause(new Rcl::SearchDataClauseSub(STD_SHARED_PTR(sq))); +} + + +#line 71 "y.tab.c" // lalr1.cc:399 + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + + + +// User implementation prologue. + +#line 85 "y.tab.c" // lalr1.cc:407 + + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include // FIXME: INFRINGES ON USER NAME SPACE. +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K].location) +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +# ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).begin = YYRHSLOC (Rhs, 1).begin; \ + (Current).end = YYRHSLOC (Rhs, N).end; \ + } \ + else \ + { \ + (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ + } \ + while (/*CONSTCOND*/ false) +# endif + + +// Suppress unused-variable warnings by "using" E. +#define YYUSE(E) ((void) (E)) + +// Enable debugging if requested. +#if YYDEBUG + +// A pseudo ostream that takes yydebug_ into account. +# define YYCDEBUG if (yydebug_) (*yycdebug_) + +# define YY_SYMBOL_PRINT(Title, Symbol) \ + do { \ + if (yydebug_) \ + { \ + *yycdebug_ << Title << ' '; \ + yy_print_ (*yycdebug_, Symbol); \ + *yycdebug_ << std::endl; \ + } \ + } while (false) + +# define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug_) \ + yy_reduce_print_ (Rule); \ + } while (false) + +# define YY_STACK_PRINT() \ + do { \ + if (yydebug_) \ + yystack_print_ (); \ + } while (false) + +#else // !YYDEBUG + +# define YYCDEBUG if (false) std::cerr +# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol) +# define YY_REDUCE_PRINT(Rule) static_cast(0) +# define YY_STACK_PRINT() static_cast(0) + +#endif // !YYDEBUG + +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yyempty = true) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) + + +namespace yy { +#line 171 "y.tab.c" // lalr1.cc:474 + + /* Return YYSTR after stripping away unnecessary quotes and + backslashes, so that it's suitable for yyerror. The heuristic is + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ + std::string + parser::yytnamerr_ (const char *yystr) + { + if (*yystr == '"') + { + std::string yyr = ""; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + // Fall through. + default: + yyr += *yyp; + break; + + case '"': + return yyr; + } + do_not_strip_quotes: ; + } + + return yystr; + } + + + /// Build a parser object. + parser::parser (WasaParserDriver* d_yyarg) + : +#if YYDEBUG + yydebug_ (false), + yycdebug_ (&std::cerr), +#endif + d (d_yyarg) + {} + + parser::~parser () + {} + + + /*---------------. + | Symbol types. | + `---------------*/ + + inline + parser::syntax_error::syntax_error (const location_type& l, const std::string& m) + : std::runtime_error (m) + , location (l) + {} + + // basic_symbol. + template + inline + parser::basic_symbol::basic_symbol () + : value () + {} + + template + inline + parser::basic_symbol::basic_symbol (const basic_symbol& other) + : Base (other) + , value () + , location (other.location) + { + value = other.value; + } + + + template + inline + parser::basic_symbol::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l) + : Base (t) + , value (v) + , location (l) + {} + + + /// Constructor for valueless symbols. + template + inline + parser::basic_symbol::basic_symbol (typename Base::kind_type t, const location_type& l) + : Base (t) + , value () + , location (l) + {} + + template + inline + parser::basic_symbol::~basic_symbol () + { + } + + template + inline + void + parser::basic_symbol::move (basic_symbol& s) + { + super_type::move(s); + value = s.value; + location = s.location; + } + + // by_type. + inline + parser::by_type::by_type () + : type (empty) + {} + + inline + parser::by_type::by_type (const by_type& other) + : type (other.type) + {} + + inline + parser::by_type::by_type (token_type t) + : type (yytranslate_ (t)) + {} + + inline + void + parser::by_type::move (by_type& that) + { + type = that.type; + that.type = empty; + } + + inline + int + parser::by_type::type_get () const + { + return type; + } + + + // by_state. + inline + parser::by_state::by_state () + : state (empty) + {} + + inline + parser::by_state::by_state (const by_state& other) + : state (other.state) + {} + + inline + void + parser::by_state::move (by_state& that) + { + state = that.state; + that.state = empty; + } + + inline + parser::by_state::by_state (state_type s) + : state (s) + {} + + inline + parser::symbol_number_type + parser::by_state::type_get () const + { + return state == empty ? 0 : yystos_[state]; + } + + inline + parser::stack_symbol_type::stack_symbol_type () + {} + + + inline + parser::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that) + : super_type (s, that.location) + { + value = that.value; + // that is emptied. + that.type = empty; + } + + inline + parser::stack_symbol_type& + parser::stack_symbol_type::operator= (const stack_symbol_type& that) + { + state = that.state; + value = that.value; + location = that.location; + return *this; + } + + + template + inline + void + parser::yy_destroy_ (const char* yymsg, basic_symbol& yysym) const + { + if (yymsg) + YY_SYMBOL_PRINT (yymsg, yysym); + + // User destructor. + switch (yysym.type_get ()) + { + case 3: // WORD + +#line 49 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:599 + {delete (yysym.value.str);} +#line 390 "y.tab.c" // lalr1.cc:599 + break; + + case 4: // QUOTED + +#line 49 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:599 + {delete (yysym.value.str);} +#line 397 "y.tab.c" // lalr1.cc:599 + break; + + case 5: // QUALIFIERS + +#line 49 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:599 + {delete (yysym.value.str);} +#line 404 "y.tab.c" // lalr1.cc:599 + break; + + case 22: // complexfieldname + +#line 49 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:599 + {delete (yysym.value.str);} +#line 411 "y.tab.c" // lalr1.cc:599 + break; + + + default: + break; + } + } + +#if YYDEBUG + template + void + parser::yy_print_ (std::ostream& yyo, + const basic_symbol& yysym) const + { + std::ostream& yyoutput = yyo; + YYUSE (yyoutput); + symbol_number_type yytype = yysym.type_get (); + yyo << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << yysym.location << ": "; + YYUSE (yytype); + yyo << ')'; + } +#endif + + inline + void + parser::yypush_ (const char* m, state_type s, symbol_type& sym) + { + stack_symbol_type t (s, sym); + yypush_ (m, t); + } + + inline + void + parser::yypush_ (const char* m, stack_symbol_type& s) + { + if (m) + YY_SYMBOL_PRINT (m, s); + yystack_.push (s); + } + + inline + void + parser::yypop_ (unsigned int n) + { + yystack_.pop (n); + } + +#if YYDEBUG + std::ostream& + parser::debug_stream () const + { + return *yycdebug_; + } + + void + parser::set_debug_stream (std::ostream& o) + { + yycdebug_ = &o; + } + + + parser::debug_level_type + parser::debug_level () const + { + return yydebug_; + } + + void + parser::set_debug_level (debug_level_type l) + { + yydebug_ = l; + } +#endif // YYDEBUG + + inline parser::state_type + parser::yy_lr_goto_state_ (state_type yystate, int yysym) + { + int yyr = yypgoto_[yysym - yyntokens_] + yystate; + if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate) + return yytable_[yyr]; + else + return yydefgoto_[yysym - yyntokens_]; + } + + inline bool + parser::yy_pact_value_is_default_ (int yyvalue) + { + return yyvalue == yypact_ninf_; + } + + inline bool + parser::yy_table_value_is_error_ (int yyvalue) + { + return yyvalue == yytable_ninf_; + } + + int + parser::parse () + { + /// Whether yyla contains a lookahead. + bool yyempty = true; + + // State. + int yyn; + /// Length of the RHS of the rule being reduced. + int yylen = 0; + + // Error handling. + int yynerrs_ = 0; + int yyerrstatus_ = 0; + + /// The lookahead symbol. + symbol_type yyla; + + /// The locations where the error started and ended. + stack_symbol_type yyerror_range[3]; + + /// The return value of parse (). + int yyresult; + + // FIXME: This shoud be completely indented. It is not yet to + // avoid gratuitous conflicts when merging into the master branch. + try + { + YYCDEBUG << "Starting parse" << std::endl; + + + /* Initialize the stack. The initial state will be set in + yynewstate, since the latter expects the semantical and the + location values to have been already stored, initialize these + stacks with a primary value. */ + yystack_.clear (); + yypush_ (YY_NULLPTR, 0, yyla); + + // A new symbol was pushed on the stack. + yynewstate: + YYCDEBUG << "Entering state " << yystack_[0].state << std::endl; + + // Accept? + if (yystack_[0].state == yyfinal_) + goto yyacceptlab; + + goto yybackup; + + // Backup. + yybackup: + + // Try to take a decision without lookahead. + yyn = yypact_[yystack_[0].state]; + if (yy_pact_value_is_default_ (yyn)) + goto yydefault; + + // Read a lookahead token. + if (yyempty) + { + YYCDEBUG << "Reading a token: "; + try + { + yyla.type = yytranslate_ (yylex (&yyla.value, &yyla.location, d)); + } + catch (const syntax_error& yyexc) + { + error (yyexc); + goto yyerrlab1; + } + yyempty = false; + } + YY_SYMBOL_PRINT ("Next token is", yyla); + + /* If the proper action on seeing token YYLA.TYPE is to reduce or + to detect an error, take that action. */ + yyn += yyla.type_get (); + if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ()) + goto yydefault; + + // Reduce or error. + yyn = yytable_[yyn]; + if (yyn <= 0) + { + if (yy_table_value_is_error_ (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + // Discard the token being shifted. + yyempty = true; + + // Count tokens shifted since error; after three, turn off error status. + if (yyerrstatus_) + --yyerrstatus_; + + // Shift the lookahead token. + yypush_ ("Shifting", yyn, yyla); + goto yynewstate; + + /*-----------------------------------------------------------. + | yydefault -- do the default action for the current state. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact_[yystack_[0].state]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + yylen = yyr2_[yyn]; + { + stack_symbol_type yylhs; + yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]); + /* If YYLEN is nonzero, implement the default value of the + action: '$$ = $1'. Otherwise, use the top of the stack. + + Otherwise, the following line sets YYLHS.VALUE to garbage. + This behavior is undocumented and Bison users should not rely + upon it. */ + if (yylen) + yylhs.value = yystack_[yylen - 1].value; + else + yylhs.value = yystack_[0].value; + + // Compute the default @$. + { + slice slice (yystack_, yylen); + YYLLOC_DEFAULT (yylhs.location, slice, yylen); + } + + // Perform the reduction. + YY_REDUCE_PRINT (yyn); + try + { + switch (yyn) + { + case 2: +#line 70 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("END PARSING\n"); + d->m_result = (yystack_[0].value.sd); +} +#line 656 "y.tab.c" // lalr1.cc:847 + break; + + case 3: +#line 77 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("q: query query\n"); + Rcl::SearchData *sd = new Rcl::SearchData(Rcl::SCLT_AND, d->m_stemlang); + addSubQuery(d, sd, (yystack_[1].value.sd)); + addSubQuery(d, sd, (yystack_[0].value.sd)); + (yylhs.value.sd) = sd; +} +#line 668 "y.tab.c" // lalr1.cc:847 + break; + + case 4: +#line 85 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("q: query AND query\n"); + Rcl::SearchData *sd = new Rcl::SearchData(Rcl::SCLT_AND, d->m_stemlang); + addSubQuery(d, sd, (yystack_[2].value.sd)); + addSubQuery(d, sd, (yystack_[0].value.sd)); + (yylhs.value.sd) = sd; +} +#line 680 "y.tab.c" // lalr1.cc:847 + break; + + case 5: +#line 93 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("q: query OR query\n"); + Rcl::SearchData *top = new Rcl::SearchData(Rcl::SCLT_AND, d->m_stemlang); + Rcl::SearchData *sd = new Rcl::SearchData(Rcl::SCLT_OR, d->m_stemlang); + addSubQuery(d, sd, (yystack_[2].value.sd)); + addSubQuery(d, sd, (yystack_[0].value.sd)); + addSubQuery(d, top, sd); + (yylhs.value.sd) = top; +} +#line 694 "y.tab.c" // lalr1.cc:847 + break; + + case 6: +#line 103 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("q: ( query )\n"); + (yylhs.value.sd) = (yystack_[1].value.sd); +} +#line 703 "y.tab.c" // lalr1.cc:847 + break; + + case 7: +#line 109 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("q: fieldexpr\n"); + Rcl::SearchData *sd = new Rcl::SearchData(Rcl::SCLT_AND, d->m_stemlang); + d->addClause(sd, (yystack_[0].value.cl)); + (yylhs.value.sd) = sd; +} +#line 714 "y.tab.c" // lalr1.cc:847 + break; + + case 8: +#line 118 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: simple fieldexpr: " << (yystack_[0].value.cl)->gettext() << endl); + (yylhs.value.cl) = (yystack_[0].value.cl); +} +#line 723 "y.tab.c" // lalr1.cc:847 + break; + + case 9: +#line 123 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: " << *(yystack_[2].value.str) << " = " << (yystack_[0].value.cl)->gettext() << endl); + (yystack_[0].value.cl)->setfield(*(yystack_[2].value.str)); + (yystack_[0].value.cl)->setrel(Rcl::SearchDataClause::REL_EQUALS); + (yylhs.value.cl) = (yystack_[0].value.cl); + delete (yystack_[2].value.str); +} +#line 735 "y.tab.c" // lalr1.cc:847 + break; + + case 10: +#line 131 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: " << *(yystack_[2].value.str) << " : " << (yystack_[0].value.cl)->gettext() << endl); + (yystack_[0].value.cl)->setfield(*(yystack_[2].value.str)); + (yystack_[0].value.cl)->setrel(Rcl::SearchDataClause::REL_CONTAINS); + (yylhs.value.cl) = (yystack_[0].value.cl); + delete (yystack_[2].value.str); +} +#line 747 "y.tab.c" // lalr1.cc:847 + break; + + case 11: +#line 139 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP(cerr << "fe: " << *(yystack_[2].value.str) << " < " << (yystack_[0].value.cl)->gettext() << endl); + (yystack_[0].value.cl)->setfield(*(yystack_[2].value.str)); + (yystack_[0].value.cl)->setrel(Rcl::SearchDataClause::REL_LT); + (yylhs.value.cl) = (yystack_[0].value.cl); + delete (yystack_[2].value.str); +} +#line 759 "y.tab.c" // lalr1.cc:847 + break; + + case 12: +#line 147 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: " << *(yystack_[2].value.str) << " <= " << (yystack_[0].value.cl)->gettext() << endl); + (yystack_[0].value.cl)->setfield(*(yystack_[2].value.str)); + (yystack_[0].value.cl)->setrel(Rcl::SearchDataClause::REL_LTE); + (yylhs.value.cl) = (yystack_[0].value.cl); + delete (yystack_[2].value.str); +} +#line 771 "y.tab.c" // lalr1.cc:847 + break; + + case 13: +#line 155 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: " << *(yystack_[2].value.str) << " > " << (yystack_[0].value.cl)->gettext() << endl); + (yystack_[0].value.cl)->setfield(*(yystack_[2].value.str)); + (yystack_[0].value.cl)->setrel(Rcl::SearchDataClause::REL_GT); + (yylhs.value.cl) = (yystack_[0].value.cl); + delete (yystack_[2].value.str); +} +#line 783 "y.tab.c" // lalr1.cc:847 + break; + + case 14: +#line 163 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: " << *(yystack_[2].value.str) << " >= " << (yystack_[0].value.cl)->gettext() << endl); + (yystack_[0].value.cl)->setfield(*(yystack_[2].value.str)); + (yystack_[0].value.cl)->setrel(Rcl::SearchDataClause::REL_GTE); + (yylhs.value.cl) = (yystack_[0].value.cl); + delete (yystack_[2].value.str); +} +#line 795 "y.tab.c" // lalr1.cc:847 + break; + + case 15: +#line 171 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("fe: - fieldexpr[" << (yystack_[0].value.cl)->gettext() << "]" << endl); + (yystack_[0].value.cl)->setexclude(true); + (yylhs.value.cl) = (yystack_[0].value.cl); +} +#line 805 "y.tab.c" // lalr1.cc:847 + break; + + case 16: +#line 181 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("cfn: WORD" << endl); + (yylhs.value.str) = (yystack_[0].value.str); +} +#line 814 "y.tab.c" // lalr1.cc:847 + break; + + case 17: +#line 187 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("cfn: complexfieldname ':' WORD" << endl); + (yylhs.value.str) = new string(*(yystack_[2].value.str) + string(":") + *(yystack_[0].value.str)); + delete (yystack_[2].value.str); + delete (yystack_[0].value.str); +} +#line 825 "y.tab.c" // lalr1.cc:847 + break; + + case 18: +#line 196 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("term[" << *(yystack_[0].value.str) << "]" << endl); + (yylhs.value.cl) = new Rcl::SearchDataClauseSimple(Rcl::SCLT_AND, *(yystack_[0].value.str)); + delete (yystack_[0].value.str); +} +#line 835 "y.tab.c" // lalr1.cc:847 + break; + + case 19: +#line 202 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + (yylhs.value.cl) = (yystack_[0].value.cl); +} +#line 843 "y.tab.c" // lalr1.cc:847 + break; + + case 20: +#line 208 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("QUOTED[" << *(yystack_[0].value.str) << "]" << endl); + (yylhs.value.cl) = new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, *(yystack_[0].value.str), 0); + delete (yystack_[0].value.str); +} +#line 853 "y.tab.c" // lalr1.cc:847 + break; + + case 21: +#line 214 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:847 + { + LOGP("QUOTED[" << *(yystack_[1].value.str) << "] QUALIFIERS[" << *(yystack_[0].value.str) << "]" << endl); + Rcl::SearchDataClauseDist *cl = + new Rcl::SearchDataClauseDist(Rcl::SCLT_PHRASE, *(yystack_[1].value.str), 0); + qualify(cl, *(yystack_[0].value.str)); + (yylhs.value.cl) = cl; + delete (yystack_[1].value.str); + delete (yystack_[0].value.str); +} +#line 867 "y.tab.c" // lalr1.cc:847 + break; + + +#line 871 "y.tab.c" // lalr1.cc:847 + default: + break; + } + } + catch (const syntax_error& yyexc) + { + error (yyexc); + YYERROR; + } + YY_SYMBOL_PRINT ("-> $$ =", yylhs); + yypop_ (yylen); + yylen = 0; + YY_STACK_PRINT (); + + // Shift the result of the reduction. + yypush_ (YY_NULLPTR, yylhs); + } + goto yynewstate; + + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ + yyerrlab: + // If not already recovering from an error, report this error. + if (!yyerrstatus_) + { + ++yynerrs_; + error (yyla.location, yysyntax_error_ (yystack_[0].state, + yyempty ? yyempty_ : yyla.type_get ())); + } + + + yyerror_range[1].location = yyla.location; + if (yyerrstatus_ == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + // Return failure if at end of input. + if (yyla.type_get () == yyeof_) + YYABORT; + else if (!yyempty) + { + yy_destroy_ ("Error: discarding", yyla); + yyempty = true; + } + } + + // Else will try to reuse lookahead token after shifting the error token. + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (false) + goto yyerrorlab; + yyerror_range[1].location = yystack_[yylen - 1].location; + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + yypop_ (yylen); + yylen = 0; + goto yyerrlab1; + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus_ = 3; // Each real token shifted decrements this. + { + stack_symbol_type error_token; + for (;;) + { + yyn = yypact_[yystack_[0].state]; + if (!yy_pact_value_is_default_ (yyn)) + { + yyn += yyterror_; + if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) + { + yyn = yytable_[yyn]; + if (0 < yyn) + break; + } + } + + // Pop the current state because it cannot handle the error token. + if (yystack_.size () == 1) + YYABORT; + + yyerror_range[1].location = yystack_[0].location; + yy_destroy_ ("Error: popping", yystack_[0]); + yypop_ (); + YY_STACK_PRINT (); + } + + yyerror_range[2].location = yyla.location; + YYLLOC_DEFAULT (error_token.location, yyerror_range, 2); + + // Shift the error token. + error_token.state = yyn; + yypush_ ("Shifting", error_token); + } + goto yynewstate; + + // Accept. + yyacceptlab: + yyresult = 0; + goto yyreturn; + + // Abort. + yyabortlab: + yyresult = 1; + goto yyreturn; + + yyreturn: + if (!yyempty) + yy_destroy_ ("Cleanup: discarding lookahead", yyla); + + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + yypop_ (yylen); + while (1 < yystack_.size ()) + { + yy_destroy_ ("Cleanup: popping", yystack_[0]); + yypop_ (); + } + + return yyresult; + } + catch (...) + { + YYCDEBUG << "Exception caught: cleaning lookahead and stack" + << std::endl; + // Do not try to display the values of the reclaimed symbols, + // as their printer might throw an exception. + if (!yyempty) + yy_destroy_ (YY_NULLPTR, yyla); + + while (1 < yystack_.size ()) + { + yy_destroy_ (YY_NULLPTR, yystack_[0]); + yypop_ (); + } + throw; + } + } + + void + parser::error (const syntax_error& yyexc) + { + error (yyexc.location, yyexc.what()); + } + + // Generate an error message. + std::string + parser::yysyntax_error_ (state_type yystate, symbol_number_type yytoken) const + { + std::string yyres; + // Number of reported tokens (one for the "unexpected", one per + // "expected"). + size_t yycount = 0; + // Its maximum. + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + // Arguments of yyformat. + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yytoken) is + if this state is a consistent state with a default action. + Thus, detecting the absence of a lookahead is sufficient to + determine that there is no unexpected or expected token to + report. In that case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is + a consistent state with a default action. There might have + been a previous inconsistent state, consistent state with a + non-default action, or user semantic action that manipulated + yyla. (However, yyla is currently not documented for users.) + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state + merging (from LALR or IELR) and default reductions corrupt the + expected token list. However, the list is correct for + canonical LR with one exception: it will still contain any + token that will not be accepted due to an error action in a + later state. + */ + if (yytoken != yyempty_) + { + yyarg[yycount++] = yytname_[yytoken]; + int yyn = yypact_[yystate]; + if (!yy_pact_value_is_default_ (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + // Stay within bounds of both yycheck and yytname. + int yychecklim = yylast_ - yyn + 1; + int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; + for (int yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ + && !yy_table_value_is_error_ (yytable_[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + break; + } + else + yyarg[yycount++] = yytname_[yyx]; + } + } + } + + char const* yyformat = YY_NULLPTR; + switch (yycount) + { +#define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +#undef YYCASE_ + } + + // Argument number. + size_t yyi = 0; + for (char const* yyp = yyformat; *yyp; ++yyp) + if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) + { + yyres += yytnamerr_ (yyarg[yyi++]); + ++yyp; + } + else + yyres += *yyp; + return yyres; + } + + + const signed char parser::yypact_ninf_ = -3; + + const signed char parser::yytable_ninf_ = -18; + + const signed char + parser::yypact_[] = + { + 24, 25, 3, 24, 26, 6, 16, -3, 31, -3, + -3, -3, 1, -3, -3, 24, 24, 4, -2, 9, + -2, -2, -2, -2, -3, 4, -3, -3, -3, 37, + -3, -3, -3, -3, -3 + }; + + const unsigned char + parser::yydefact_[] = + { + 0, 18, 20, 0, 0, 0, 2, 7, 0, 8, + 19, 21, 0, 15, 1, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 6, 4, 5, 18, 9, 18, + 10, 12, 11, 14, 13 + }; + + const signed char + parser::yypgoto_[] = + { + -3, -3, 0, 13, -3, 36, -3 + }; + + const signed char + parser::yydefgoto_[] = + { + -1, 5, 17, 7, 8, 9, 10 + }; + + const signed char + parser::yytable_[] = + { + 6, 27, 2, 12, 1, 2, 14, 15, 11, 3, + 4, 16, 29, 2, 16, 25, 26, 13, 24, 1, + 2, 0, 15, 0, 3, 4, 16, 1, 2, 1, + 2, 0, 3, 4, 0, 4, -16, -16, -16, -16, + -16, -16, 18, 19, 20, 21, 22, 23, -17, -17, + -17, -17, -17, -17, 28, 30, 31, 32, 33, 34 + }; + + const signed char + parser::yycheck_[] = + { + 0, 3, 4, 3, 3, 4, 0, 6, 5, 8, + 9, 10, 3, 4, 10, 15, 16, 4, 17, 3, + 4, -1, 6, -1, 8, 9, 10, 3, 4, 3, + 4, -1, 8, 9, -1, 9, 11, 12, 13, 14, + 15, 16, 11, 12, 13, 14, 15, 16, 11, 12, + 13, 14, 15, 16, 18, 19, 20, 21, 22, 23 + }; + + const unsigned char + parser::yystos_[] = + { + 0, 3, 4, 8, 9, 19, 20, 21, 22, 23, + 24, 5, 20, 21, 0, 6, 10, 20, 11, 12, + 13, 14, 15, 16, 17, 20, 20, 3, 23, 3, + 23, 23, 23, 23, 23 + }; + + const unsigned char + parser::yyr1_[] = + { + 0, 18, 19, 20, 20, 20, 20, 20, 21, 21, + 21, 21, 21, 21, 21, 21, 22, 22, 23, 23, + 24, 24 + }; + + const unsigned char + parser::yyr2_[] = + { + 0, 2, 1, 2, 3, 3, 3, 1, 1, 3, + 3, 3, 3, 3, 3, 2, 1, 3, 1, 1, + 1, 2 + }; + + + + // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + // First, the terminals, then, starting at \a yyntokens_, nonterminals. + const char* + const parser::yytname_[] = + { + "$end", "error", "$undefined", "WORD", "QUOTED", "QUALIFIERS", "AND", + "UCONCAT", "'('", "'-'", "OR", "EQUALS", "CONTAINS", "SMALLEREQ", + "SMALLER", "GREATEREQ", "GREATER", "')'", "$accept", "topquery", "query", + "fieldexpr", "complexfieldname", "term", "qualquote", YY_NULLPTR + }; + +#if YYDEBUG + const unsigned char + parser::yyrline_[] = + { + 0, 69, 69, 76, 84, 92, 102, 108, 117, 122, + 130, 138, 146, 154, 162, 170, 180, 186, 195, 201, + 207, 213 + }; + + // Print the state stack on the debug stream. + void + parser::yystack_print_ () + { + *yycdebug_ << "Stack now"; + for (stack_type::const_iterator + i = yystack_.begin (), + i_end = yystack_.end (); + i != i_end; ++i) + *yycdebug_ << ' ' << i->state; + *yycdebug_ << std::endl; + } + + // Report on the debug stream that the rule \a yyrule is going to be reduced. + void + parser::yy_reduce_print_ (int yyrule) + { + unsigned int yylno = yyrline_[yyrule]; + int yynrhs = yyr2_[yyrule]; + // Print the symbols being reduced, and their result. + *yycdebug_ << "Reducing stack by rule " << yyrule - 1 + << " (line " << yylno << "):" << std::endl; + // The symbols being reduced. + for (int yyi = 0; yyi < yynrhs; yyi++) + YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", + yystack_[(yynrhs) - (yyi + 1)]); + } +#endif // YYDEBUG + + // Symbol number corresponding to token number t. + inline + parser::token_number_type + parser::yytranslate_ (int t) + { + static + const token_number_type + translate_table[] = + { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 8, 17, 2, 2, 2, 9, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 10, 11, 12, 13, 14, 15, 16 + }; + const unsigned int user_token_number_max_ = 269; + const token_number_type undef_token_ = 2; + + if (static_cast(t) <= yyeof_) + return yyeof_; + else if (static_cast (t) <= user_token_number_max_) + return translate_table[t]; + else + return undef_token_; + } + + +} // yy +#line 1308 "y.tab.c" // lalr1.cc:1155 +#line 225 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:1156 + + +#include + +// Look for int at index, skip and return new index found? value. +static unsigned int qualGetInt(const string& q, unsigned int cur, int *pval) +{ + unsigned int ncur = cur; + if (cur < q.size() - 1) { + char *endptr; + int val = strtol(&q[cur + 1], &endptr, 10); + if (endptr != &q[cur + 1]) { + ncur += endptr - &q[cur + 1]; + *pval = val; + } + } + return ncur; +} + +static void qualify(Rcl::SearchDataClauseDist *cl, const string& quals) +{ + // cerr << "qualify(" << cl << ", " << quals << ")" << endl; + for (unsigned int i = 0; i < quals.length(); i++) { + //fprintf(stderr, "qual char %c\n", quals[i]); + switch (quals[i]) { + case 'b': + cl->setWeight(10.0); + break; + case 'c': break; + case 'C': + cl->addModifier(Rcl::SearchDataClause::SDCM_CASESENS); + break; + case 'd': break; + case 'D': + cl->addModifier(Rcl::SearchDataClause::SDCM_DIACSENS); + break; + case 'e': + cl->addModifier(Rcl::SearchDataClause::SDCM_CASESENS); + cl->addModifier(Rcl::SearchDataClause::SDCM_DIACSENS); + cl->addModifier(Rcl::SearchDataClause::SDCM_NOSTEMMING); + break; + case 'l': + cl->addModifier(Rcl::SearchDataClause::SDCM_NOSTEMMING); + break; + case 'L': break; + case 'o': + { + int slack = 10; + i = qualGetInt(quals, i, &slack); + cl->setslack(slack); + //cerr << "set slack " << cl->getslack() << " done" << endl; + } + break; + case 'p': + cl->setTp(Rcl::SCLT_NEAR); + if (cl->getslack() == 0) { + cl->setslack(10); + //cerr << "set slack " << cl->getslack() << " done" << endl; + } + break; + case 's': + cl->addModifier(Rcl::SearchDataClause::SDCM_NOSYNS); + break; + case 'S': + break; + case '.':case '0':case '1':case '2':case '3':case '4': + case '5':case '6':case '7':case '8':case '9': + { + int n = 0; + float factor = 1.0; + if (sscanf(&(quals[i]), "%f %n", &factor, &n)) { + if (factor != 1.0) { + cl->setWeight(factor); + } + } + if (n > 0) + i += n - 1; + } + default: + break; + } + } +} + + +// specialstartchars are special only at the beginning of a token +// (e.g. doctor-who is a term, not 2 terms separated by '-') +static const string specialstartchars("-"); +// specialinchars are special everywhere except inside a quoted string +static const string specialinchars(":=<>()"); + +// Called with the first dquote already read +static int parseString(WasaParserDriver *d, yy::parser::semantic_type *yylval) +{ + string* value = new string(); + d->qualifiers().clear(); + int c; + while ((c = d->GETCHAR())) { + switch (c) { + case '\\': + /* Escape: get next char */ + c = d->GETCHAR(); + if (c == 0) { + value->push_back(c); + goto out; + } + value->push_back(c); + break; + case '"': + /* End of string. Look for qualifiers */ + while ((c = d->GETCHAR()) && (isalnum(c) || c == '.')) + d->qualifiers().push_back(c); + d->UNGETCHAR(c); + goto out; + default: + value->push_back(c); + } + } +out: + //cerr << "GOT QUOTED ["<qualifiers() << "]" << endl; + yylval->str = value; + return yy::parser::token::QUOTED; +} + + +int yylex(yy::parser::semantic_type *yylval, yy::parser::location_type *, + WasaParserDriver *d) +{ + if (!d->qualifiers().empty()) { + yylval->str = new string(); + yylval->str->swap(d->qualifiers()); + return yy::parser::token::QUALIFIERS; + } + + int c; + + /* Skip white space. */ + while ((c = d->GETCHAR()) && isspace(c)) + continue; + + if (c == 0) + return 0; + + if (specialstartchars.find_first_of(c) != string::npos) { + //cerr << "yylex: return " << c << endl; + return c; + } + + // field-term relations + switch (c) { + case '=': return yy::parser::token::EQUALS; + case ':': return yy::parser::token::CONTAINS; + case '<': { + int c1 = d->GETCHAR(); + if (c1 == '=') { + return yy::parser::token::SMALLEREQ; + } else { + d->UNGETCHAR(c1); + return yy::parser::token::SMALLER; + } + } + case '>': { + int c1 = d->GETCHAR(); + if (c1 == '=') { + return yy::parser::token::GREATEREQ; + } else { + d->UNGETCHAR(c1); + return yy::parser::token::GREATER; + } + } + case '(': case ')': + return c; + } + + if (c == '"') + return parseString(d, yylval); + + d->UNGETCHAR(c); + + // Other chars start a term or field name or reserved word + string* word = new string(); + while ((c = d->GETCHAR())) { + if (isspace(c)) { + //cerr << "Word broken by whitespace" << endl; + break; + } else if (specialinchars.find_first_of(c) != string::npos) { + //cerr << "Word broken by special char" << endl; + d->UNGETCHAR(c); + break; + } else if (c == 0) { + //cerr << "Word broken by EOF" << endl; + break; + } else { + word->push_back(c); + } + } + + if (!word->compare("AND") || !word->compare("&&")) { + delete word; + return yy::parser::token::AND; + } else if (!word->compare("OR") || !word->compare("||")) { + delete word; + return yy::parser::token::OR; + } + +// cerr << "Got word [" << word << "]" << endl; + yylval->str = word; + return yy::parser::token::WORD; +} diff --git a/src/query/wasaparse.hpp b/src/query/wasaparse.hpp new file mode 100644 index 00000000..93928ba1 --- /dev/null +++ b/src/query/wasaparse.hpp @@ -0,0 +1,476 @@ +// A Bison parser, made by GNU Bison 3.0.2. + +// Skeleton interface for Bison LALR(1) parsers in C++ + +// Copyright (C) 2002-2013 Free Software Foundation, Inc. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// As a special exception, you may create a larger work that contains +// part or all of the Bison parser skeleton and distribute that work +// under terms of your choice, so long as that work isn't itself a +// parser generator using the skeleton or a modified version thereof +// as a parser skeleton. Alternatively, if you modify or redistribute +// the parser skeleton itself, you may (at your option) remove this +// special exception, which will cause the skeleton and the resulting +// Bison output files to be licensed under the GNU General Public +// License without this special exception. + +// This special exception was added by the Free Software Foundation in +// version 2.2 of Bison. + +/** + ** \file y.tab.h + ** Define the yy::parser class. + */ + +// C++ LALR(1) parser skeleton written by Akim Demaille. + +#ifndef YY_YY_Y_TAB_H_INCLUDED +# define YY_YY_Y_TAB_H_INCLUDED + + +# include +# include +# include +# include +# include "stack.hh" +# include "location.hh" + + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + + +namespace yy { +#line 113 "y.tab.h" // lalr1.cc:372 + + + + + + /// A Bison parser. + class parser + { + public: +#ifndef YYSTYPE + /// Symbol semantic values. + union semantic_type + { + #line 44 "/home/dockes/projets/fulltext/recoll/src/query/wasaparse.ypp" // lalr1.cc:372 + + std::string *str; + Rcl::SearchDataClauseSimple *cl; + Rcl::SearchData *sd; + +#line 133 "y.tab.h" // lalr1.cc:372 + }; +#else + typedef YYSTYPE semantic_type; +#endif + /// Symbol locations. + typedef location location_type; + + /// Syntax errors thrown from user actions. + struct syntax_error : std::runtime_error + { + syntax_error (const location_type& l, const std::string& m); + location_type location; + }; + + /// Tokens. + struct token + { + enum yytokentype + { + WORD = 258, + QUOTED = 259, + QUALIFIERS = 260, + AND = 261, + UCONCAT = 262, + OR = 263, + EQUALS = 264, + CONTAINS = 265, + SMALLEREQ = 266, + SMALLER = 267, + GREATEREQ = 268, + GREATER = 269 + }; + }; + + /// (External) token type, as returned by yylex. + typedef token::yytokentype token_type; + + /// Internal symbol number. + typedef int symbol_number_type; + + /// Internal symbol number for tokens (subsumed by symbol_number_type). + typedef unsigned char token_number_type; + + /// A complete symbol. + /// + /// Expects its Base type to provide access to the symbol type + /// via type_get(). + /// + /// Provide access to semantic value and location. + template + struct basic_symbol : Base + { + /// Alias to Base. + typedef Base super_type; + + /// Default constructor. + basic_symbol (); + + /// Copy constructor. + basic_symbol (const basic_symbol& other); + + /// Constructor for valueless symbols. + basic_symbol (typename Base::kind_type t, + const location_type& l); + + /// Constructor for symbols with semantic value. + basic_symbol (typename Base::kind_type t, + const semantic_type& v, + const location_type& l); + + ~basic_symbol (); + + /// Destructive move, \a s is emptied into this. + void move (basic_symbol& s); + + /// The semantic value. + semantic_type value; + + /// The location. + location_type location; + + private: + /// Assignment operator. + basic_symbol& operator= (const basic_symbol& other); + }; + + /// Type access provider for token (enum) based symbols. + struct by_type + { + /// Default constructor. + by_type (); + + /// Copy constructor. + by_type (const by_type& other); + + /// The symbol type as needed by the constructor. + typedef token_type kind_type; + + /// Constructor from (external) token numbers. + by_type (kind_type t); + + /// Steal the symbol type from \a that. + void move (by_type& that); + + /// The (internal) type number (corresponding to \a type). + /// -1 when this symbol is empty. + symbol_number_type type_get () const; + + /// The token. + token_type token () const; + + enum { empty = 0 }; + + /// The symbol type. + /// -1 when this symbol is empty. + token_number_type type; + }; + + /// "External" symbols: returned by the scanner. + typedef basic_symbol symbol_type; + + + /// Build a parser object. + parser (WasaParserDriver* d_yyarg); + virtual ~parser (); + + /// Parse. + /// \returns 0 iff parsing succeeded. + virtual int parse (); + +#if YYDEBUG + /// The current debugging stream. + std::ostream& debug_stream () const YY_ATTRIBUTE_PURE; + /// Set the current debugging stream. + void set_debug_stream (std::ostream &); + + /// Type for debugging levels. + typedef int debug_level_type; + /// The current debugging level. + debug_level_type debug_level () const YY_ATTRIBUTE_PURE; + /// Set the current debugging level. + void set_debug_level (debug_level_type l); +#endif + + /// Report a syntax error. + /// \param loc where the syntax error is found. + /// \param msg a description of the syntax error. + virtual void error (const location_type& loc, const std::string& msg); + + /// Report a syntax error. + void error (const syntax_error& err); + + private: + /// This class is not copyable. + parser (const parser&); + parser& operator= (const parser&); + + /// State numbers. + typedef int state_type; + + /// Generate an error message. + /// \param yystate the state where the error occurred. + /// \param yytoken the lookahead token type, or yyempty_. + virtual std::string yysyntax_error_ (state_type yystate, + symbol_number_type yytoken) const; + + /// Compute post-reduction state. + /// \param yystate the current state + /// \param yysym the nonterminal to push on the stack + state_type yy_lr_goto_state_ (state_type yystate, int yysym); + + /// Whether the given \c yypact_ value indicates a defaulted state. + /// \param yyvalue the value to check + static bool yy_pact_value_is_default_ (int yyvalue); + + /// Whether the given \c yytable_ value indicates a syntax error. + /// \param yyvalue the value to check + static bool yy_table_value_is_error_ (int yyvalue); + + static const signed char yypact_ninf_; + static const signed char yytable_ninf_; + + /// Convert a scanner token number \a t to a symbol number. + static token_number_type yytranslate_ (int t); + + // Tables. + // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + // STATE-NUM. + static const signed char yypact_[]; + + // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + // Performed when YYTABLE does not specify something else to do. Zero + // means the default is an error. + static const unsigned char yydefact_[]; + + // YYPGOTO[NTERM-NUM]. + static const signed char yypgoto_[]; + + // YYDEFGOTO[NTERM-NUM]. + static const signed char yydefgoto_[]; + + // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + // positive, shift that token. If negative, reduce the rule whose + // number is the opposite. If YYTABLE_NINF, syntax error. + static const signed char yytable_[]; + + static const signed char yycheck_[]; + + // YYSTOS[STATE-NUM] -- The (internal number of the) accessing + // symbol of state STATE-NUM. + static const unsigned char yystos_[]; + + // YYR1[YYN] -- Symbol number of symbol that rule YYN derives. + static const unsigned char yyr1_[]; + + // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. + static const unsigned char yyr2_[]; + + + /// Convert the symbol name \a n to a form suitable for a diagnostic. + static std::string yytnamerr_ (const char *n); + + + /// For a symbol, its name in clear. + static const char* const yytname_[]; +#if YYDEBUG + // YYRLINE[YYN] -- Source line where rule number YYN was defined. + static const unsigned char yyrline_[]; + /// Report on the debug stream that the rule \a r is going to be reduced. + virtual void yy_reduce_print_ (int r); + /// Print the state stack on the debug stream. + virtual void yystack_print_ (); + + // Debugging. + int yydebug_; + std::ostream* yycdebug_; + + /// \brief Display a symbol type, value and location. + /// \param yyo The output stream. + /// \param yysym The symbol. + template + void yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const; +#endif + + /// \brief Reclaim the memory associated to a symbol. + /// \param yymsg Why this token is reclaimed. + /// If null, print nothing. + /// \param yysym The symbol. + template + void yy_destroy_ (const char* yymsg, basic_symbol& yysym) const; + + private: + /// Type access provider for state based symbols. + struct by_state + { + /// Default constructor. + by_state (); + + /// The symbol type as needed by the constructor. + typedef state_type kind_type; + + /// Constructor. + by_state (kind_type s); + + /// Copy constructor. + by_state (const by_state& other); + + /// Steal the symbol type from \a that. + void move (by_state& that); + + /// The (internal) type number (corresponding to \a state). + /// "empty" when empty. + symbol_number_type type_get () const; + + enum { empty = 0 }; + + /// The state. + state_type state; + }; + + /// "Internal" symbol: element of the stack. + struct stack_symbol_type : basic_symbol + { + /// Superclass. + typedef basic_symbol super_type; + /// Construct an empty symbol. + stack_symbol_type (); + /// Steal the contents from \a sym to build this. + stack_symbol_type (state_type s, symbol_type& sym); + /// Assignment, needed by push_back. + stack_symbol_type& operator= (const stack_symbol_type& that); + }; + + /// Stack type. + typedef stack stack_type; + + /// The stack. + stack_type yystack_; + + /// Push a new state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the symbol + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, stack_symbol_type& s); + + /// Push a new look ahead token on the state on the stack. + /// \param m a debug message to display + /// if null, no trace is output. + /// \param s the state + /// \param sym the symbol (for its value and location). + /// \warning the contents of \a s.value is stolen. + void yypush_ (const char* m, state_type s, symbol_type& sym); + + /// Pop \a n symbols the three stacks. + void yypop_ (unsigned int n = 1); + + // Constants. + enum + { + yyeof_ = 0, + yylast_ = 59, ///< Last index in yytable_. + yynnts_ = 7, ///< Number of nonterminal symbols. + yyempty_ = -2, + yyfinal_ = 14, ///< Termination state number. + yyterror_ = 1, + yyerrcode_ = 256, + yyntokens_ = 18 ///< Number of tokens. + }; + + + // User arguments. + WasaParserDriver* d; + }; + + + +} // yy +#line 472 "y.tab.h" // lalr1.cc:372 + + + + +#endif // !YY_YY_Y_TAB_H_INCLUDED diff --git a/src/rcldb/rclterms.cpp b/src/rcldb/rclterms.cpp index 7832abc8..909ba8f3 100644 --- a/src/rcldb/rclterms.cpp +++ b/src/rcldb/rclterms.cpp @@ -21,13 +21,15 @@ #include "autoconfig.h" #include -using namespace std; #include "debuglog.h" #include "rcldb.h" #include "rcldb_p.h" #include "stemdb.h" #include "expansiondbs.h" +#include "strmatcher.h" + +using namespace std; namespace Rcl { diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp index b4a02155..493723d9 100644 --- a/src/utils/pathut.cpp +++ b/src/utils/pathut.cpp @@ -22,7 +22,9 @@ #include "safefcntl.h" #include "safeunistd.h" #include "dirent.h" -#ifndef _WIN32 +#ifdef _WIN32 +#include "safewindows.h" +#else #include #include #include @@ -31,6 +33,7 @@ #include #include #include "safesysstat.h" +#include "ptmutex.h" // Let's include all files where statfs can be defined and hope for no // conflict... @@ -53,13 +56,99 @@ #include #include #include -using namespace std; +#include #include "pathut.h" #include "transcode.h" #include "wipedir.h" #include "md5ut.h" +using namespace std; + +#ifdef _WIN32 +/// Convert \ separators to / +void path_slashize(string& s) +{ + for (string::size_type i = 0; i < s.size(); i++) { + if (s[i] == '\\') + s[i] = '/'; + } +} +static bool path_strlookslikedrive(const string& s) +{ + return s.size() == 2 && isalpha(s[0]) && s[1] == ':'; +} + +static bool path_hasdrive(const string& s) +{ + if (s.size() >= 2 && isalpha(s[0]) && s[1] == ':') + return true; + return false; +} +static bool path_isdriveabs(const string& s) +{ + if (s.size() >= 3 && isalpha(s[0]) && s[1] == ':' && s[2] == '/') + return true; + return false; +} + +#include +#pragma comment(lib, "shlwapi.lib") + +string path_tchartoutf8(TCHAR *text) +{ +#ifdef UNICODE + // Simple C + // const size_t size = ( wcslen(text) + 1 ) * sizeof(wchar_t); + // wcstombs(&buffer[0], text, size); + // std::vector buffer(size); + // Or: + // Windows API + std::vector buffer; + int size = WideCharToMultiByte(CP_UTF8, 0, text, -1, NULL, 0, NULL, NULL); + if (size > 0) { + buffer.resize(size); + WideCharToMultiByte(CP_UTF8, 0, text, -1, + &buffer[0], int(buffer.size()), NULL, NULL); + } else { + return string(); + } + return string(&buffer[0]); +#else + path = text; +#endif +} + +string path_thisexecpath() +{ + TCHAR text[MAX_PATH]; + DWORD length = GetModuleFileName(NULL, text, MAX_PATH); +#ifdef NTDDI_WIN8_future + PathCchRemoveFileSpec(text, MAX_PATH); +#else + PathRemoveFileSpec(text); +#endif + string path = path_tchartoutf8(text); + if (path.empty()) + path = "c:/"; + + return path; +} + +string path_wingettempfilename(TCHAR *pref) +{ + TCHAR buf[(MAX_PATH +1)*sizeof(TCHAR)]; + TCHAR dbuf[(MAX_PATH +1)*sizeof(TCHAR)]; + GetTempPath(MAX_PATH+1, dbuf); + GetTempFileName(dbuf, pref, 0, buf); + // Windows will have created a temp file, we delete it. + string filename = path_tchartoutf8(buf); + unlink(filename.c_str()); + return filename; +} +#endif + + bool fsocc(const string &path, int *pc, long long *blocks) { #ifdef _WIN32 @@ -108,13 +197,47 @@ const string& tmplocation() const char *tmpdir = getenv("RECOLL_TMPDIR"); if (tmpdir == 0) tmpdir = getenv("TMPDIR"); - if (tmpdir == 0) - tmpdir = "/tmp"; - stmpdir = string(tmpdir); + if (tmpdir == 0) + tmpdir = getenv("TMP"); + if (tmpdir == 0) + tmpdir = getenv("TEMP"); + if (tmpdir == 0) { +#ifdef _WIN32 + TCHAR bufw[(MAX_PATH+1)*sizeof(TCHAR)]; + GetTempPath(MAX_PATH+1, bufw); + stmpdir = path_tchartoutf8(bufw); +#else + stmpdir = "/tmp"; +#endif + } else { + stmpdir = tmpdir; + } + stmpdir = path_canon(stmpdir); } + return stmpdir; } +// Location for sample config, filters, etc. (e.g. /usr/share/recoll/) +const string& path_sharedatadir() +{ + static string datadir; + if (datadir.empty()) { +#ifdef _WIN32 + datadir = path_cat(path_thisexecpath(), "Share"); +#else + const char *cdatadir = getenv("RECOLL_DATADIR"); + if (cdatadir == 0) { + // If not in environment, use the compiled-in constant. + datadir = RECOLL_DATADIR; + } else { + datadir = cdatadir; + } +#endif + } + return datadir; +} + bool maketmpdir(string& tdir, string& reason) { #ifndef _WIN32 @@ -142,8 +265,18 @@ bool maketmpdir(string& tdir, string& reason) } tdir = cp; free(cp); + // At this point the directory does not exist yet if mktemp was used + +#else // _WIN32 + // There is a race condition between name computation and + // mkdir. try to make sure that we at least don't shoot ourselves + // in the foot + static PTMutexInit mlock; + PTMutexLocker lock(mlock); + tdir = path_wingettempfilename(TEXT("rcltmp")); +#endif -#ifndef HAVE_MKDTEMP +#if !defined(HAVE_MKDTEMP) || defined(_WIN32) if (mkdir(tdir.c_str(), 0700) < 0) { reason = string("maketmpdir: mkdir ") + tdir + " failed"; tdir.erase(); @@ -152,9 +285,6 @@ bool maketmpdir(string& tdir, string& reason) #endif return true; -#else - return false; -#endif } TempFileInternal::TempFileInternal(const string& suffix) @@ -178,16 +308,22 @@ TempFileInternal::TempFileInternal(const string& suffix) } close(fd); unlink(cp); - filename = cp; free(cp); +#else + // There is a race condition between name computation and + // mkdir. try to make sure that we at least don't shoot ourselves + // in the foot + static PTMutexInit mlock; + PTMutexLocker lock(mlock); + string filename = path_wingettempfilename(TEXT("recoll")); +#endif m_filename = filename + suffix; if (close(open(m_filename.c_str(), O_CREAT|O_EXCL, 0600)) != 0) { m_reason = string("Could not open/create") + m_filename; m_filename.erase(); } -#endif } TempFileInternal::~TempFileInternal() @@ -297,7 +433,26 @@ string path_suffix(const string& s) string path_home() { #ifdef _WIN32 - return "c:\\"; + string dir; + const char *cp = getenv("USERPROFILE"); + if (cp != 0) { + dir = cp; + } + if (dir.empty()) { + cp = getenv("HOMEDRIVE"); + if (cp != 0) { + const char *cp1 = getenv("HOMEPATH"); + if (cp1 != 0) { + dir = string(cp) + string(cp1); + } + } + } + if (dir.empty()) { + dir = "C:\\"; + } + dir = path_canon(dir); + path_catslash(dir); + return dir; #else uid_t uid = getuid(); @@ -316,11 +471,27 @@ string path_home() #endif } -string path_tildexpand(const string &s) +// The default place to store the default config and other stuff (e.g webqueue) +string path_homedata() { #ifdef _WIN32 - return s; + const char *cp = getenv("LOCALAPPDATA"); + string dir; + if (cp != 0) { + dir = path_canon(cp); + } + if (dir.empty()) { + dir = path_cat(path_home(), "AppData/Local/"); + } + return dir; #else + // We should use an xdg-conforming location, but, history... + return path_home(); +#endif +} + +string path_tildexpand(const string &s) +{ if (s.empty() || s[0] != '~') return s; string o = s; @@ -330,15 +501,31 @@ string path_tildexpand(const string &s) o.replace(0, 2, path_home()); } else { string::size_type pos = s.find('/'); - int l = (pos == string::npos) ? s.length() - 1 : pos - 1; + string::size_type l = (pos == string::npos) ? s.length() - 1 : pos - 1; +#ifdef _WIN32 + // Dont know what this means. Just replace with HOME + o.replace(0, l+1, path_home()); +#else struct passwd *entry = getpwnam(s.substr(1, l).c_str()); if (entry) o.replace(0, l+1, entry->pw_dir); +#endif } return o; -#endif } +bool path_isabsolute(const string &path) +{ + if (!path.empty() && (path[0] == '/' +#ifdef _WIN32 + || path_isdriveabs(path) +#endif + )) { + return true; + } + return false; +} + string path_absolute(const string &is) { if (is.length() == 0) @@ -360,7 +547,15 @@ string path_canon(const string &is, const string* cwd) if (is.length() == 0) return is; string s = is; - if (s[0] != '/') { +#ifdef _WIN32 + path_slashize(s); + // fix possible path from file: absolute url + if (s.size() && s[0] == '/' && path_hasdrive(s.substr(1))) { + s = s.substr(1); + } +#endif + + if (!path_isabsolute(s)) { char buf[MAXPATHLEN]; const char *cwdp = buf; if (cwd) { @@ -389,7 +584,13 @@ string path_canon(const string &is, const string* cwd) if (!cleaned.empty()) { for (vector::const_iterator it = cleaned.begin(); it != cleaned.end(); it++) { - ret += "/"; + ret += "/"; +#ifdef _WIN32 + if (it == cleaned.begin() && path_strlookslikedrive(*it)) { + // Get rid of just added initial "/" + ret.clear(); + } +#endif ret += *it; } } else { @@ -406,6 +607,10 @@ bool makepath(const string& ipath) path = "/"; for (vector::const_iterator it = elems.begin(); it != elems.end(); it++){ +#ifdef _WIN32 + if (it == elems.begin() && path_strlookslikedrive(*it)) + path = ""; +#endif path += *it; // Not using path_isdir() here, because this cant grok symlinks // If we hit an existing file, no worry, mkdir will just fail. @@ -557,6 +762,16 @@ string url_parentfolder(const string& url) string("http://") + parenturl; } + +string path_defaultrecollconfsubdir() +{ +#ifdef _WIN32 + return "Recoll"; +#else + return ".recoll"; +#endif +} + // Convert to file path if url is like file: // Note: this only works with our internal pseudo-urls which are not // encoded/escaped @@ -566,6 +781,13 @@ string fileurltolocalpath(string url) url = url.substr(7, string::npos); else return string(); +#ifdef _WIN32 + // Absolute file urls are like: file:///c:/mydir/... + // Get rid of the initial '/' + if (url.size() >= 3 && url[0] == '/' && isalpha(url[1]) && url[2] == ':') { + url = url.substr(1); + } +#endif string::size_type pos; if ((pos = url.find_last_of("#")) != string::npos) { url.erase(pos); @@ -816,6 +1038,7 @@ void pathut_init_mt() path_home(); tmplocation(); thumbnailsdir(); + path_sharedatadir(); } diff --git a/src/utils/pathut.h b/src/utils/pathut.h index 9be4f3dc..d4ebc15c 100644 --- a/src/utils/pathut.h +++ b/src/utils/pathut.h @@ -97,6 +97,20 @@ extern bool maketmpdir(std::string& tdir, std::string& reason); /// mkdir -p extern bool makepath(const std::string& path); +#ifdef _WIN32 +/// Convert \ separators to / +extern void path_slashize(std::string& s); +#endif + +/// Sub-directory for default recoll config (e.g: .recoll) +extern std::string path_defaultrecollconfsubdir(); +/// Where we create the user data subdirs +extern std::string path_homedata(); +/// e.g. /usr/share/recoll. Depends on OS and config +extern const std::string& path_sharedatadir(); +/// Test if path is absolute +extern bool path_isabsolute(const std::string& s); + /// Temporary file class class TempFileInternal { public: diff --git a/src/utils/strmatcher.cpp b/src/utils/strmatcher.cpp index dcd3aa1b..a287c4b4 100644 --- a/src/utils/strmatcher.cpp +++ b/src/utils/strmatcher.cpp @@ -19,16 +19,21 @@ #include #include +#ifdef _WIN32 +#include +#else #include +#endif #include #include -using std::string; #include "cstr.h" #include "debuglog.h" -#include "strmatcher.h" #include "pathut.h" +#include "strmatcher.h" + +using namespace std; bool StrWildMatcher::match(const string& val) const { @@ -60,9 +65,25 @@ StrRegexpMatcher::StrRegexpMatcher(const string& exp) bool StrRegexpMatcher::setExp(const string& exp) { if (m_compiled) { +#ifdef _WIN32 + delete (regex*)m_compiled; +#else regfree((regex_t*)m_compiled); delete (regex_t*)m_compiled; +#endif } + m_compiled = 0; + +#ifdef _WIN32 + try { + m_compiled = new regex(exp, std::regex_constants::nosubs | + std::regex_constants::extended); + } catch (...) { + m_reason = string("StrRegexpMatcher:regcomp failed for ") + + exp + string("syntax error ?"); + return false; + } +#else m_compiled = new regex_t; if ((m_errcode = regcomp((regex_t*)m_compiled, exp.c_str(), REG_EXTENDED|REG_NOSUB))) { @@ -72,6 +93,7 @@ bool StrRegexpMatcher::setExp(const string& exp) + exp + string(errbuf); return false; } +#endif m_sexp = exp; return true; } @@ -79,8 +101,12 @@ bool StrRegexpMatcher::setExp(const string& exp) StrRegexpMatcher::~StrRegexpMatcher() { if (m_compiled) { +#ifdef _WIN32 + delete (regex *)m_compiled; +#else regfree((regex_t*)m_compiled); delete (regex_t*)m_compiled; +#endif } } @@ -88,7 +114,11 @@ bool StrRegexpMatcher::match(const string& val) const { if (m_errcode) return false; +#ifdef _WIN32 + return regex_match(val, *((regex *)m_compiled)); +#else return regexec((regex_t*)m_compiled, val.c_str(), 0, 0, 0) != REG_NOMATCH; +#endif } string::size_type StrRegexpMatcher::baseprefixlen() const diff --git a/src/windows/Win32ProjectRecoll.sln b/src/windows/Win32ProjectRecoll.sln index fa3c0246..687df9b4 100644 --- a/src/windows/Win32ProjectRecoll.sln +++ b/src/windows/Win32ProjectRecoll.sln @@ -10,6 +10,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recollindex", "recollindex\ {23FF40E1-BA87-4E5F-9B22-2EB760FF403D} = {23FF40E1-BA87-4E5F-9B22-2EB760FF403D} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recollq", "recollq\recollq.vcxproj", "{C1D0CCD2-0015-44AC-A606-AC48BB80C133}" + ProjectSection(ProjectDependencies) = postProject + {23FF40E1-BA87-4E5F-9B22-2EB760FF403D} = {23FF40E1-BA87-4E5F-9B22-2EB760FF403D} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -18,22 +23,30 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Debug|x64.ActiveCfg = Debug|Win32 - {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Debug|x64.Build.0 = Debug|Win32 + {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Debug|x64.ActiveCfg = Debug|x64 + {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Debug|x64.Build.0 = Debug|x64 {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Debug|x86.ActiveCfg = Debug|Win32 {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Debug|x86.Build.0 = Debug|Win32 {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Release|x64.ActiveCfg = Release|x64 {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Release|x64.Build.0 = Release|x64 {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Release|x86.ActiveCfg = Release|Win32 {23FF40E1-BA87-4E5F-9B22-2EB760FF403D}.Release|x86.Build.0 = Release|Win32 - {A513D65F-798C-4166-B66E-49F69ADA4F59}.Debug|x64.ActiveCfg = Debug|Win32 - {A513D65F-798C-4166-B66E-49F69ADA4F59}.Debug|x64.Build.0 = Debug|Win32 + {A513D65F-798C-4166-B66E-49F69ADA4F59}.Debug|x64.ActiveCfg = Debug|x64 + {A513D65F-798C-4166-B66E-49F69ADA4F59}.Debug|x64.Build.0 = Debug|x64 {A513D65F-798C-4166-B66E-49F69ADA4F59}.Debug|x86.ActiveCfg = Debug|Win32 {A513D65F-798C-4166-B66E-49F69ADA4F59}.Debug|x86.Build.0 = Debug|Win32 {A513D65F-798C-4166-B66E-49F69ADA4F59}.Release|x64.ActiveCfg = Release|x64 {A513D65F-798C-4166-B66E-49F69ADA4F59}.Release|x64.Build.0 = Release|x64 {A513D65F-798C-4166-B66E-49F69ADA4F59}.Release|x86.ActiveCfg = Release|Win32 {A513D65F-798C-4166-B66E-49F69ADA4F59}.Release|x86.Build.0 = Release|Win32 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Debug|x64.ActiveCfg = Debug|x64 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Debug|x64.Build.0 = Debug|x64 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Debug|x86.ActiveCfg = Debug|Win32 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Debug|x86.Build.0 = Debug|Win32 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Release|x64.ActiveCfg = Release|x64 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Release|x64.Build.0 = Release|x64 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Release|x86.ActiveCfg = Release|Win32 + {C1D0CCD2-0015-44AC-A606-AC48BB80C133}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/windows/Win32ProjectRecoll.vcxproj b/src/windows/Win32ProjectRecoll.vcxproj index 160188e9..1384f8bb 100644 --- a/src/windows/Win32ProjectRecoll.vcxproj +++ b/src/windows/Win32ProjectRecoll.vcxproj @@ -90,10 +90,10 @@ NotUsing Level3 Disabled - _DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + BUILDING_RECOLL;__WIN32__;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) false - C:\xapian\xapian-core-1.2.8\include;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\bincimapmime;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\windows;C:\zlib\include;C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\common;C:\Users\Bill\recoll\src\utils;%(AdditionalIncludeDirectories) - 4800 + C:\Iconv\include;C:\xapian\xapian-core-1.2.8\include;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\bincimapmime;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\windows;C:\zlib\include;C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\common;C:\Users\Bill\recoll\src\utils;%(AdditionalIncludeDirectories) + 4800;4996 Windows @@ -152,6 +152,7 @@ + @@ -220,6 +221,7 @@ + diff --git a/src/windows/Win32ProjectRecoll.vcxproj.filters b/src/windows/Win32ProjectRecoll.vcxproj.filters index 905b4066..0d538e3c 100644 --- a/src/windows/Win32ProjectRecoll.vcxproj.filters +++ b/src/windows/Win32ProjectRecoll.vcxproj.filters @@ -84,6 +84,9 @@ Source Files + + Header Files + @@ -278,6 +281,9 @@ Source Files + + Source Files + diff --git a/src/windows/recollindex/recollindex.vcxproj b/src/windows/recollindex/recollindex.vcxproj index eea3f43d..0068ba99 100644 --- a/src/windows/recollindex/recollindex.vcxproj +++ b/src/windows/recollindex/recollindex.vcxproj @@ -103,14 +103,14 @@ Level3 Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + __WIN32__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\utils;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\common;%(AdditionalIncludeDirectories) Console true - C:\xapian\xapian-core-1.2.8\win32\Debug;C:\Users\Bill\recoll\src\windows\x64\Debug;C:\pthreads-w32\Pre-built.2\lib\x64;%(AdditionalLibraryDirectories) - pthreadVC2.lib;Win32ProjectRecoll.lib;xapian-core.lib;%(AdditionalDependencies) + C:\xapian\xapian-core-1.2.8\win32\x64\Debug;C:\Users\Bill\recoll\src\windows\x64\Debug;C:\pthreads-w32\Pre-built.2\lib\x64;%(AdditionalLibraryDirectories) + Win32ProjectRecoll.lib;C:\zlib64\zlib-win64\x64\Debug\zlib.lib;xapian-core.lib;C:\iconv64\Debug_x64\libiconvD.lib;Ws2_32.lib;Rpcrt4.lib;pthreadVC2.lib;%(AdditionalDependencies) diff --git a/src/windows/recollq/recollq.vcxproj b/src/windows/recollq/recollq.vcxproj new file mode 100644 index 00000000..68ec3cf2 --- /dev/null +++ b/src/windows/recollq/recollq.vcxproj @@ -0,0 +1,180 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {C1D0CCD2-0015-44AC-A606-AC48BB80C133} + Win32Proj + recollq + 8.1 + + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + + + Level3 + Disabled + __WIN32__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\utils;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\common;%(AdditionalIncludeDirectories) + 4800 + + + Console + true + C:\xapian\xapian-core-1.2.8\win32\x64\Debug;C:\Users\Bill\recoll\src\windows\x64\Debug;C:\pthreads-w32\Pre-built.2\lib\x64;%(AdditionalLibraryDirectories) + Win32ProjectRecoll.lib;C:\zlib64\zlib-win64\x64\Debug\zlib.lib;xapian-core.lib;C:\iconv64\Debug_x64\libiconvD.lib;Ws2_32.lib;Rpcrt4.lib;pthreadVC2.lib;%(AdditionalDependencies) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/windows/recollq/recollq.vcxproj.filters b/src/windows/recollq/recollq.vcxproj.filters new file mode 100644 index 00000000..f8e3ba7c --- /dev/null +++ b/src/windows/recollq/recollq.vcxproj.filters @@ -0,0 +1,96 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file