1 %{
2 /** @file
3  * @brief Custom Tcl exception handling.
4  */
5 /* Warning: This file is generated by ./generate-tcl-exceptions
6  * - do not modify directly!
7  *
8  * Copyright (c) 2006,2007,2011,2012 Olly Betts
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of the
13  * License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
23  */
24 
25 #include <exception>
26 
XapianTclHandleError(Tcl_Interp * interp,const Xapian::Error & e)27 static int XapianTclHandleError(Tcl_Interp * interp, const Xapian::Error &e) {
28     Tcl_ResetResult(interp);
29     Tcl_SetErrorCode(interp, "XAPIAN", e.get_type(), NULL);
30     Tcl_AppendResult(interp, e.get_msg().c_str(), NULL);
31     return TCL_ERROR;
32 }
33 
XapianTclHandleError(Tcl_Interp * interp,const std::exception & e)34 static int XapianTclHandleError(Tcl_Interp * interp, const std::exception &e) {
35     Tcl_ResetResult(interp);
36     Tcl_SetErrorCode(interp, "std::exception", NULL);
37     Tcl_AppendResult(interp, e.what(), NULL);
38     return TCL_ERROR;
39 }
40 
XapianTclHandleError(Tcl_Interp * interp)41 static int XapianTclHandleError(Tcl_Interp * interp) {
42     Tcl_ResetResult(interp);
43     Tcl_SetErrorCode(interp, "XAPIAN ?", NULL);
44     Tcl_AppendResult(interp, "Unknown Error", NULL);
45     return TCL_ERROR;
46 }
47 
48 %}
49 
50 /* Functions and methods which are marked as "nothrow": */
51 %exception Xapian::Compactor::~Compactor;
52 %exception Xapian::Compactor::get_constinfo_();
53 %exception Xapian::Database::~Database;
54 %exception Xapian::Database::postlist_end(const std::string &) const;
55 %exception Xapian::Database::termlist_end(Xapian::docid) const;
56 %exception Xapian::Database::positionlist_end(Xapian::docid, const std::string &) const;
57 %exception Xapian::Database::allterms_end(const std::string & = std::string()) const;
58 %exception Xapian::Database::valuestream_end(Xapian::valueno) const;
59 %exception Xapian::Database::spellings_end() const;
60 %exception Xapian::Database::synonyms_end(const std::string &) const;
61 %exception Xapian::Database::synonym_keys_end(const std::string & = std::string()) const;
62 %exception Xapian::Database::metadata_keys_end(const std::string & = std::string()) const;
63 %exception Xapian::WritableDatabase::~WritableDatabase;
64 %exception Xapian::Document::~Document;
65 %exception Xapian::Document::termlist_end() const;
66 %exception Xapian::Document::values_end() const;
67 %exception Xapian::RSet::~RSet;
68 %exception Xapian::MatchDecider::~MatchDecider;
69 %exception Xapian::Enquire::~Enquire;
70 %exception Xapian::Enquire::get_matching_terms_end(Xapian::docid  ) const;
71 %exception Xapian::Enquire::get_matching_terms_end(const MSetIterator & ) const;
72 %exception Xapian::Error::~Error;
73 %exception Xapian::Error::get_type() const;
74 %exception Xapian::Error::get_msg() const;
75 %exception Xapian::Error::get_context() const;
76 %exception Xapian::LogicError::~LogicError;
77 %exception Xapian::RuntimeError::~RuntimeError;
78 %exception Xapian::AssertionError::~AssertionError;
79 %exception Xapian::InvalidArgumentError::~InvalidArgumentError;
80 %exception Xapian::InvalidOperationError::~InvalidOperationError;
81 %exception Xapian::UnimplementedError::~UnimplementedError;
82 %exception Xapian::DatabaseError::~DatabaseError;
83 %exception Xapian::DatabaseCorruptError::~DatabaseCorruptError;
84 %exception Xapian::DatabaseCreateError::~DatabaseCreateError;
85 %exception Xapian::DatabaseLockError::~DatabaseLockError;
86 %exception Xapian::DatabaseModifiedError::~DatabaseModifiedError;
87 %exception Xapian::DatabaseOpeningError::~DatabaseOpeningError;
88 %exception Xapian::DatabaseVersionError::~DatabaseVersionError;
89 %exception Xapian::DocNotFoundError::~DocNotFoundError;
90 %exception Xapian::FeatureUnavailableError::~FeatureUnavailableError;
91 %exception Xapian::InternalError::~InternalError;
92 %exception Xapian::NetworkError::~NetworkError;
93 %exception Xapian::NetworkTimeoutError::~NetworkTimeoutError;
94 %exception Xapian::QueryParserError::~QueryParserError;
95 %exception Xapian::SerialisationError::~SerialisationError;
96 %exception Xapian::RangeError::~RangeError;
97 %exception Xapian::WildcardError::~WildcardError;
98 %exception Xapian::DatabaseNotFoundError::~DatabaseNotFoundError;
99 %exception Xapian::DatabaseClosedError::~DatabaseClosedError;
100 %exception Xapian::ErrorHandler::~ErrorHandler;
101 %exception Xapian::ErrorHandler::ErrorHandler();
102 %exception Xapian::ESet::~ESet;
103 %exception Xapian::ESetIterator::~ESetIterator;
104 %exception Xapian::ESetIterator::operator==(const ESetIterator &a, const ESetIterator &b);
105 %exception Xapian::ESetIterator::operator!=(const ESetIterator &a, const ESetIterator &b);
106 %exception Xapian::ESetIterator::operator<(const ESetIterator &a, const ESetIterator &b);
107 %exception Xapian::ESetIterator::operator>(const ESetIterator &a, const ESetIterator &b);
108 %exception Xapian::ESetIterator::operator>=(const ESetIterator &a, const ESetIterator &b);
109 %exception Xapian::ESetIterator::operator<=(const ESetIterator &a, const ESetIterator &b);
110 %exception Xapian::ExpandDecider::~ExpandDecider;
111 %exception Xapian::ExpandDeciderAnd::~ExpandDeciderAnd;
112 %exception Xapian::ExpandDeciderFilterTerms::~ExpandDeciderFilterTerms;
113 %exception Xapian::ExpandDeciderFilterPrefix::~ExpandDeciderFilterPrefix;
114 %exception Xapian::ExpandDeciderFilterPrefix::miles_to_metres(double miles);
115 %exception Xapian::ExpandDeciderFilterPrefix::metres_to_miles(double metres);
116 %exception Xapian::ExpandDeciderFilterPrefix::LatLongCoord();
117 %exception Xapian::ExpandDeciderFilterPrefix::operator<(const LatLongCoord & other) const;
118 %exception Xapian::LatLongCoordsIterator::~LatLongCoordsIterator;
119 %exception Xapian::LatLongCoords::~LatLongCoords;
120 %exception Xapian::LatLongMetric::~LatLongMetric;
121 %exception Xapian::GreatCircleMetric::~GreatCircleMetric;
122 %exception Xapian::LatLongDistancePostingSource::~LatLongDistancePostingSource;
123 %exception Xapian::LatLongDistanceKeyMaker::~LatLongDistanceKeyMaker;
124 %exception Xapian::opt_intrusive_base::~opt_intrusive_base;
125 %exception Xapian::KeyMaker::~KeyMaker;
126 %exception Xapian::MultiValueKeyMaker::~MultiValueKeyMaker;
127 %exception Xapian::MatchSpy::~MatchSpy;
128 %exception Xapian::MatchSpy::MatchSpy();
129 %exception Xapian::ValueCountMatchSpy::~ValueCountMatchSpy;
130 %exception Xapian::ValueCountMatchSpy::get_total() const;
131 %exception Xapian::ValueCountMatchSpy::values_end() const;
132 %exception Xapian::ValueCountMatchSpy::top_values_end(size_t) const;
133 %exception Xapian::MSet::~MSet;
134 %exception Xapian::MSetIterator::~MSetIterator;
135 %exception Xapian::MSetIterator::operator==(const MSetIterator &a, const MSetIterator &b);
136 %exception Xapian::MSetIterator::operator!=(const MSetIterator &a, const MSetIterator &b);
137 %exception Xapian::MSetIterator::operator<(const MSetIterator &a, const MSetIterator &b);
138 %exception Xapian::MSetIterator::operator>(const MSetIterator &a, const MSetIterator &b);
139 %exception Xapian::MSetIterator::operator>=(const MSetIterator &a, const MSetIterator &b);
140 %exception Xapian::MSetIterator::operator<=(const MSetIterator &a, const MSetIterator &b);
141 %exception Xapian::PositionIterator::~PositionIterator;
142 %exception Xapian::PositionIterator::PositionIterator();
143 %exception Xapian::PositionIterator::operator==(const PositionIterator &a, const PositionIterator &b);
144 %exception Xapian::PositionIterator::operator!=(const PositionIterator &a, const PositionIterator &b);
145 %exception Xapian::PostingIterator::~PostingIterator;
146 %exception Xapian::PostingIterator::PostingIterator();
147 %exception Xapian::PostingIterator::positionlist_end() const;
148 %exception Xapian::PostingIterator::operator==(const PostingIterator &a, const PostingIterator &b);
149 %exception Xapian::PostingIterator::operator!=(const PostingIterator &a, const PostingIterator &b);
150 %exception Xapian::PostingSource::~PostingSource;
151 %exception Xapian::PostingSource::PostingSource();
152 %exception Xapian::PostingSource::get_maxweight() const;
153 %exception Xapian::ValuePostingSource::~ValuePostingSource;
154 %exception Xapian::ValueWeightPostingSource::~ValueWeightPostingSource;
155 %exception Xapian::DecreasingValueWeightPostingSource::~DecreasingValueWeightPostingSource;
156 %exception Xapian::ValueMapPostingSource::~ValueMapPostingSource;
157 %exception Xapian::FixedWeightPostingSource::~FixedWeightPostingSource;
158 %exception Xapian::Query::~Query;
159 %exception Xapian::Query::Query();
160 %exception Xapian::Query::get_terms_end() const;
161 %exception Xapian::Query::get_unique_terms_end() const;
162 %exception Xapian::Query::get_length() const;
163 %exception Xapian::Query::empty() const;
164 %exception Xapian::Query::get_type() const;
165 %exception Xapian::Query::get_num_subqueries() const;
166 %exception Xapian::Query::Internal();
167 %exception Xapian::Query::get_length() const;
168 %exception Xapian::Query::get_type() const;
169 %exception Xapian::Query::get_num_subqueries() const;
170 %exception Xapian::Stopper::~Stopper;
171 %exception Xapian::SimpleStopper::~SimpleStopper;
172 %exception Xapian::RangeProcessor::~RangeProcessor;
173 %exception Xapian::DateRangeProcessor::~DateRangeProcessor;
174 %exception Xapian::NumberRangeProcessor::~NumberRangeProcessor;
175 %exception Xapian::ValueRangeProcessor::~ValueRangeProcessor;
176 %exception Xapian::FieldProcessor::~FieldProcessor;
177 %exception Xapian::QueryParser::~QueryParser;
178 %exception Xapian::QueryParser::stoplist_end() const;
179 %exception Xapian::QueryParser::unstem_end(const std::string &) const;
180 %exception Xapian::QueryParser::sortable_serialise_(double value, char * buf);
181 %exception Xapian::QueryParser::sortable_unserialise(const std::string & serialised);
182 %exception Xapian::Registry::~Registry;
183 %exception Xapian::StemImplementation::~StemImplementation;
184 %exception Xapian::Stem::~Stem;
185 %exception Xapian::TermGenerator::~TermGenerator;
186 %exception Xapian::TermIterator::~TermIterator;
187 %exception Xapian::TermIterator::TermIterator();
188 %exception Xapian::TermIterator::positionlist_end() const;
189 %exception Xapian::TermIterator::operator==(const TermIterator &a, const TermIterator &b);
190 %exception Xapian::TermIterator::operator!=(const TermIterator &a, const TermIterator &b);
191 %exception Xapian::Utf8Iterator::~Utf8Iterator;
192 %exception Xapian::Utf8Iterator::calculate_sequence_length() const;
193 %exception Xapian::Utf8Iterator::Utf8Iterator();
194 %exception Xapian::Utf8Iterator::operator*() const;
195 %exception Xapian::Utf8Iterator::strict_deref() const;
196 %exception Xapian::Utf8Iterator::operator==(const Utf8Iterator& other) const;
197 %exception Xapian::Utf8Iterator::operator!=(const Utf8Iterator& other) const;
198 %exception Xapian::Utf8Iterator::get_character_info(unsigned ch);
199 %exception Xapian::ValueIterator::~ValueIterator;
200 %exception Xapian::ValueIterator::ValueIterator();
201 %exception Xapian::ValueIterator::operator==(const ValueIterator &a, const ValueIterator &b);
202 %exception Xapian::ValueIterator::operator!=(const ValueIterator &a, const ValueIterator &b);
203 %exception Xapian::ValueSetMatchDecider::~ValueSetMatchDecider;
204 %exception Xapian::Weight::~Weight;
205 %exception Xapian::BoolWeight::~BoolWeight;
206 %exception Xapian::TfIdfWeight::~TfIdfWeight;
207 %exception Xapian::BM25Weight::~BM25Weight;
208 %exception Xapian::BM25PlusWeight::~BM25PlusWeight;
209 %exception Xapian::TradWeight::~TradWeight;
210 %exception Xapian::InL2Weight::~InL2Weight;
211 %exception Xapian::IfB2Weight::~IfB2Weight;
212 %exception Xapian::IneB2Weight::~IneB2Weight;
213 %exception Xapian::BB2Weight::~BB2Weight;
214 %exception Xapian::DLHWeight::~DLHWeight;
215 %exception Xapian::PL2Weight::~PL2Weight;
216 %exception Xapian::PL2PlusWeight::~PL2PlusWeight;
217 %exception Xapian::DPHWeight::~DPHWeight;
218 %exception Xapian::LMWeight::~LMWeight;
219 %exception Xapian::CoordWeight::~CoordWeight;
220 
221 %exception {
222     try {
223 	$function
catch(const Xapian::Error & e)224     } catch (const Xapian::Error &e) {
225 	return XapianTclHandleError(interp, e);
226     } catch (const std::exception &e) {
227 	return XapianTclHandleError(interp, e);
catch(...)228     } catch (...) {
229 	return XapianTclHandleError(interp);
230     }
231 }
232