Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
99917ae8
Commit
99917ae8
authored
13 years ago
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Future proof swig. Newer versions won't support nested templates.
parent
18e723e9
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swig/parsedexpression.i
+22
-18
22 additions, 18 deletions
swig/parsedexpression.i
swig/variables.i
+35
-21
35 additions, 21 deletions
swig/variables.i
swig/wcclfile.i
+46
-36
46 additions, 36 deletions
swig/wcclfile.i
with
103 additions
and
75 deletions
swig/parsedexpression.i
+
22
−
18
View file @
99917ae8
...
...
@@ -37,27 +37,12 @@ namespace Wccl {
return NULL;
}
}
%template(get_bool) get<Bool>;
%template(get_tset) get<TSet>;
%template(get_strset) get<StrSet>;
%template(get_position) get<Position>;
%template(get_match) get<Match>;
template<class T> bool has(const std::string& var_name);
%template(has_bool) has<Bool>;
%template(has_tset) has<TSet>;
%template(has_strset) has<StrSet>;
%template(has_position) has<Position>;
%template(has_match) has<Match>;
/* Those functions are overridden later to handle shared_ptr values,
* anyway they are needed for those overrides to work. */
template<class T> void set(const std::string& var_name, const T& value);
%template(set_bool) set<Bool>;
%template(set_tset) set<TSet>;
%template(set_strset) set<StrSet>;
%template(set_position) set<Position>;
%template(set_match) set<Match>;
/* --------------------------------------------------------------------- */
void clean();
...
...
@@ -75,7 +60,25 @@ namespace Wccl {
virtual ParsedExpression* clone_internal() const = 0;
};
%extend ParsedExpression {
%extend ParsedExpression {
%template(get_bool) get<Bool>;
%template(get_tset) get<TSet>;
%template(get_strset) get<StrSet>;
%template(get_position) get<Position>;
%template(get_match) get<Match>;
%template(has_bool) has<Bool>;
%template(has_tset) has<TSet>;
%template(has_strset) has<StrSet>;
%template(has_position) has<Position>;
%template(has_match) has<Match>;
%template(set_bool) set<Bool>;
%template(set_tset) set<TSet>;
%template(set_strset) set<StrSet>;
%template(set_position) set<Position>;
%template(set_match) set<Match>;
void set_bool(const std::string& name, const boost::shared_ptr<const Wccl::Bool>& b) {
self->set<Wccl::Bool>(name, *b);
}
...
...
@@ -91,8 +94,9 @@ namespace Wccl {
void set_match(const std::string& name, const boost::shared_ptr<const Wccl::Match>& b) {
self->set<Wccl::Match>(name, *b);
}
}
}
}
}
// namespace Wccl
using
namespace
std
;
using
namespace
Wccl
;
...
...
This diff is collapsed.
Click to expand it.
swig/variables.i
+
35
−
21
View file @
99917ae8
...
...
@@ -64,98 +64,112 @@ namespace Wccl {
Variables();
template<typename T> int size() const;
void reset_values();
template<typename T> const typename detail::Vmap<T>::map_t get_all() const;
Variables* clone() const;
template<typename T> boost::shared_ptr<T> get(const std::string& s) const;
template<typename T> boost::shared_ptr<T> get_or_throw(const std::string& s) const;
template<typename T> const typename T::value_type& get_value(const std::string& s) const;
template<typename T> VariableAccessor<T> create_accessor(const std::string& s);
template<typename T> boost::shared_ptr<T> get_fast(const VariableAccessor<T>& a) const;
template<typename T> boost::shared_ptr<T> get_put(const std::string& s);
template<typename T> void put(const std::string& s, const boost::shared_ptr<T>& v);
void put_any(const std::string& s, const boost::shared_ptr<Value>& v);
template<typename T> bool del_variable(const std::string& s);
bool del_any(const std::string& s);
template<typename T> void put(const std::string& s, T* v);
template<typename T> void set(const std::string& s, const T& v);
};
%extend Variables {
%template(size_bool) size<Bool>;
%template(size_tset) size<TSet>;
%template(size_strset) size<StrSet>;
%template(size_position) size<Position>;
%template(size_match) size<Match>;
void reset_values();
template<typename T> const typename detail::Vmap<T>::map_t get_all() const;
%template(get_all_bool) get_all<Bool>;
%template(get_all_tset) get_all<TSet>;
%template(get_all_strset) get_all<StrSet>;
%template(get_all_position) get_all<Position>;
%template(get_all_match) get_all<Match>;
Variables* clone() const;
template<typename T> boost::shared_ptr<T> get(const std::string& s) const;
%template(get_bool) get<Bool>;
%template(get_tset) get<TSet>;
%template(get_strset) get<StrSet>;
%template(get_position) get<Position>;
%template(get_match) get<Match>;
template<typename T> boost::shared_ptr<T> get_or_throw(const std::string& s) const;
%template(get_or_throw_bool) get_or_throw<Bool>;
%template(get_or_throw_tset) get_or_throw<TSet>;
%template(get_or_throw_strset) get_or_throw<StrSet>;
%template(get_or_throw_position) get_or_throw<Position>;
%template(get_or_throw_match) get_or_throw<Match>;
template<typename T> const typename T::value_type& get_value(const std::string& s) const;
%template(get_value_bool) get_value<Bool>;
%template(get_value_tset) get_value<TSet>;
%template(get_value_strset) get_value<StrSet>;
%template(get_value_position) get_value<Position>;
// %template(get_value_match) get_value<Match>;
template<typename T> VariableAccessor<T> create_accessor(const std::string& s);
%template(create_accessor_bool) create_accessor<Bool>;
%template(create_accessor_tset) create_accessor<TSet>;
%template(create_accessor_strset) create_accessor<StrSet>;
%template(create_accessor_position) create_accessor<Position>;
%template(create_accessor_match) create_accessor<Match>;
template<typename T> boost::shared_ptr<T> get_fast(const VariableAccessor<T>& a) const;
%template(get_fast_bool) get_fast<Bool>;
%template(get_fast_tset) get_fast<TSet>;
%template(get_fast_strset) get_fast<StrSet>;
%template(get_fast_position) get_fast<Position>;
%template(get_fast_match) get_fast<Match>;
template<typename T> boost::shared_ptr<T> get_put(const std::string& s);
%template(get_put_bool) get_put<Bool>;
%template(get_put_tset) get_put<TSet>;
%template(get_put_strset) get_put<StrSet>;
%template(get_put_position) get_put<Position>;
%template(get_put_match) get_put<Match>;
template<typename T> void put(const std::string& s, const boost::shared_ptr<T>& v);
%template(put_bool_2) put<Bool>;
%template(put_tset_2) put<TSet>;
%template(put_strset_2) put<StrSet>;
%template(put_position_2) put<Position>;
%template(put_match_2) put<Match>;
void put_any(const std::string& s, const boost::shared_ptr<Value>& v);
template<typename T> bool del_variable(const std::string& s);
%template(del_bool) del_variable<Bool>;
%template(del_tset) del_variable<TSet>;
%template(del_strset) del_variable<StrSet>;
%template(del_position) del_variable<Position>;
%template(del_match) del_variable<Match>;
bool del_any(const std::string& s);
template<typename T> void put(const std::string& s, T* v);
%template(put_bool) put<Bool>;
%template(put_tset) put<TSet>;
%template(put_strset) put<StrSet>;
%template(put_position) put<Position>;
%template(put_match) put<Match>;
template<typename T> void set(const std::string& s, const T& v);
%template(set_bool) set<Bool>;
%template(set_tset) set<TSet>;
%template(set_strset) set<StrSet>;
%template(set_position) set<Position>;
%template(set_match) set<Match>;
}
;
}
}
}
// namespace Wccl;
using
namespace
boost
;
using
namespace
std
;
...
...
This diff is collapsed.
Click to expand it.
swig/wcclfile.i
+
46
−
36
View file @
99917ae8
...
...
@@ -61,22 +61,12 @@ namespace Wccl {
bool has_untyped_section(const std::string& name) const;
template<class T> bool has_section(const std::string& name) const;
%template(has_section_bool) has_section<Bool>;
%template(has_section_tset) has_section<TSet>;
%template(has_section_strset) has_section<StrSet>;
%template(has_section_position) has_section<Position>;
%template(has_section_match) has_section<Match>;
/* --------------------------------------------------------------------- */
std::vector<std::string> untyped_section_names() const;
template<class T> std::vector<std::string> section_names() const;
%template(section_names_bool) section_names<Bool>;
%template(section_names_tset) section_names<TSet>;
%template(section_names_strset) section_names<StrSet>;
%template(section_names_position) section_names<Position>;
%template(section_names_match) section_names<Match>;
/* --------------------------------------------------------------------- */
...
...
@@ -95,11 +85,6 @@ namespace Wccl {
// template<class T> const OpSequence<T>& get_section(const std::string& name) const;
template<class T> OpSequence<T>& get_section(const std::string& name);
%template(get_section_bool) get_section<Bool>;
%template(get_section_tset) get_section<TSet>;
%template(get_section_strset) get_section<StrSet>;
%template(get_section_position) get_section<Position>;
%template(get_section_match) get_section<Match>;
%exception {
try {
...
...
@@ -134,11 +119,6 @@ namespace Wccl {
}
}
template<class T> shared_ptr<OpSequence<T> > get_section_ptr(const std::string& name);
%template(get_section_ptr_bool) get_section_ptr<Bool>;
%template(get_section_ptr_tset) get_section_ptr<TSet>;
%template(get_section_ptr_strset) get_section_ptr<StrSet>;
%template(get_section_ptr_position) get_section_ptr<Position>;
%template(get_section_ptr_match) get_section_ptr<Match>;
/* --------------------------------------------------------------------- */
...
...
@@ -198,11 +178,6 @@ namespace Wccl {
}
}
template<class T> shared_ptr<Operator<T> > get_op_ptr(const std::string& name, size_t idx = 0);
%template(get_op_ptr_bool) get_op_ptr<Bool>;
%template(get_op_ptr_tset) get_op_ptr<TSet>;
%template(get_op_ptr_strset) get_op_ptr<StrSet>;
%template(get_op_ptr_position) get_op_ptr<Position>;
%template(get_op_ptr_match) get_op_ptr<Match>;
/* --------------------------------------------------------------------- */
...
...
@@ -229,11 +204,6 @@ namespace Wccl {
}
}
template<class T> typename OpSequence<T>::name_op_v_t gen_name_op_pairs();
%template(gen_name_op_pairs_bool) gen_name_op_pairs<Bool>;
%template(gen_name_op_pairs_tset) gen_name_op_pairs<TSet>;
%template(gen_name_op_pairs_strset) gen_name_op_pairs<StrSet>;
%template(gen_name_op_pairs_position) gen_name_op_pairs<Position>;
%template(gen_name_op_pairs_match) gen_name_op_pairs<Match>;
/* --------------------------------------------------------------------- */
...
...
@@ -334,11 +304,6 @@ namespace Wccl {
*/
template<class T> void add_section(const OpSequence<T>& section);
%template(add_section_bool) add_section<Bool>;
%template(add_section_tset) add_section<TSet>;
%template(add_section_strset) add_section<StrSet>;
%template(add_section_position) add_section<Position>;
%template(add_section_match) add_section<Match>;
void import_lexicon(const shared_ptr<Lexicon>& lexicon);
...
...
@@ -350,7 +315,52 @@ namespace Wccl {
void set_match_rules(const shared_ptr<MatchRuleSequence>& match_rules);
*/
};
}
%extend WcclFile {
%template(has_section_bool) has_section<Bool>;
%template(has_section_tset) has_section<TSet>;
%template(has_section_strset) has_section<StrSet>;
%template(has_section_position) has_section<Position>;
%template(has_section_match) has_section<Match>;
%template(section_names_bool) section_names<Bool>;
%template(section_names_tset) section_names<TSet>;
%template(section_names_strset) section_names<StrSet>;
%template(section_names_position) section_names<Position>;
%template(section_names_match) section_names<Match>;
%template(get_section_bool) get_section<Bool>;
%template(get_section_tset) get_section<TSet>;
%template(get_section_strset) get_section<StrSet>;
%template(get_section_position) get_section<Position>;
%template(get_section_match) get_section<Match>;
%template(get_section_ptr_bool) get_section_ptr<Bool>;
%template(get_section_ptr_tset) get_section_ptr<TSet>;
%template(get_section_ptr_strset) get_section_ptr<StrSet>;
%template(get_section_ptr_position) get_section_ptr<Position>;
%template(get_section_ptr_match) get_section_ptr<Match>;
%template(get_op_ptr_bool) get_op_ptr<Bool>;
%template(get_op_ptr_tset) get_op_ptr<TSet>;
%template(get_op_ptr_strset) get_op_ptr<StrSet>;
%template(get_op_ptr_position) get_op_ptr<Position>;
%template(get_op_ptr_match) get_op_ptr<Match>;
%template(gen_name_op_pairs_bool) gen_name_op_pairs<Bool>;
%template(gen_name_op_pairs_tset) gen_name_op_pairs<TSet>;
%template(gen_name_op_pairs_strset) gen_name_op_pairs<StrSet>;
%template(gen_name_op_pairs_position) gen_name_op_pairs<Position>;
%template(gen_name_op_pairs_match) gen_name_op_pairs<Match>;
%template(add_section_bool) add_section<Bool>;
%template(add_section_tset) add_section<TSet>;
%template(add_section_strset) add_section<StrSet>;
%template(add_section_position) add_section<Position>;
%template(add_section_match) add_section<Match>;
}
}
// namespace Wccl
using
namespace
boost
;
using
namespace
Wccl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment