From 538765db81d49a4bcd8e50e200940d02172499fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <pawel.kedzia@pwr.wroc.pl>
Date: Wed, 11 May 2011 15:38:18 +0200
Subject: [PATCH] (swig) Added wrapper for Wccl::MatchRuleSequence

---
 swig/Makefile                  | 21 ++++++++++++++++
 swig/libcclmatchrulesequence.i | 44 ++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 swig/libcclmatchrulesequence.i

diff --git a/swig/Makefile b/swig/Makefile
index bd71eca..4ee6bfd 100644
--- a/swig/Makefile
+++ b/swig/Makefile
@@ -37,8 +37,10 @@ CBIN=libcclvalue.o \
 	libccltagrule.o \
 	libccltagrulesequence.o \
 	libcclmatchrule.o \
+	libcclmatchrulesequence.o \
 	libcclfunctionalopsequence.o \
 	libcclwcclfileopsections.o \
+	libcclwcclfile.o \
 	wccl.o
 
 CBINOUT=_libcclvalue.so \
@@ -63,6 +65,7 @@ CBINOUT=_libcclvalue.so \
 				_libccltagrule.so \
 				_libccltagrulesequence.so \
 				_libcclmatchrule.so \
+				_libcclmatchrulesequence.so \
 				_libcclfunctionalopsequence.so \
 				_libcclwcclfileopsections.so \
 				_wccl.so \
@@ -90,6 +93,7 @@ CWRAP=libcclvalue_wrap.cxx \
 			libccltagrule_wrap.cxx \
 			libccltagrulesequence_wrap.cxx \
 			libcclmatchrule_wrap.cxx \
+			libcclmatchrulesequence_wrap.cxx \
 			libcclfunctionalopsequence_wrap.cxx \
 			libcclwcclfileopsections_wrap.cxx \
 			wccl_wrap.cxx \
@@ -117,6 +121,7 @@ CWRAPBIN=libcclvalue_wrap.o \
 				 libccltagrule_wrap.o \
 				 libccltagrulesequence_wrap.o \
 				 libcclmatchrule_wrap.o \
+				 libcclmatchrulesequence_wrap.o \
 				 libcclfunctionalopsequence_wrap.o \
 				 libcclwcclfileopsections_wrap.o \
 				 wccl_wrap.o \
@@ -144,6 +149,7 @@ PYMODULES=libcclvalue.py \
 					libccltagrule.py \
 					libccltagrulesequence.py \
 					libcclmatchrule.py \
+					libcclmatchrulesequence.py \
 					libcclfunctionalopsequence.py \
 					libcclwcclfileopsections.py \
 					wccl.py \
@@ -171,6 +177,7 @@ PYCBIN=libcclvalue.pyc \
 			 libccltagrule.pyc \
 			 libccltagrulesequence.pyc \
 			 libcclmatchrule.pyc \
+			 libcclmatchrulesequence.pyc \
 			 libcclfunctionalopsequence.pyc \
 			 libcclwcclfileopsections.pyc \
 			 wccl.pyc \
@@ -353,6 +360,13 @@ libcclmatchrule.o:
 	$(CPP) -shared libcclmatchrule_wrap.o \
 		$(CCLBIN) $(ANTLRLIB) -o _libcclmatchrule.so
 
+# MatchRuleSequence
+libcclmatchrulesequence.o:
+	$(SWIG) $(SWIGOPTS_LANG) libcclmatchrulesequence.i
+	$(CPP) -c libcclmatchrulesequence_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS)
+	$(CPP) -shared libcclmatchrulesequence_wrap.o \
+		$(CCLBIN) $(ANTLRLIB) -o _libcclmatchrulesequence.so
+
 # FunctionalOpSequence
 libcclfunctionalopsequence.o:
 	$(SWIG) $(SWIGOPTS_LANG) libcclfunctionalopsequence.i
@@ -366,6 +380,13 @@ libcclwcclfileopsections.o:
 	$(CPP) -c libcclwcclfileopsections_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS)
 	$(CPP) -shared libcclwcclfileopsections_wrap.o \
 		$(CCLBIN) $(ANTLRLIB) -o _libcclwcclfileopsections.so
+	
+# WcclFile
+libcclwcclfile.o:
+	$(SWIG) $(SWIGOPTS_LANG) libcclwcclfile.i
+	$(CPP) -c libcclwcclfile_wrap.cxx -I$(PYTHONDIR) -I$(WCCLDIR) $(CPPFLAGS)
+	$(CPP) -shared libcclwcclfile_wrap.o \
+		$(CCLBIN) $(ANTLRLIB) -o _libcclwcclfile.so
 
 # -----------------------------------------------------------------------------
 # Wccl Library
diff --git a/swig/libcclmatchrulesequence.i b/swig/libcclmatchrulesequence.i
new file mode 100644
index 0000000..4080e8d
--- /dev/null
+++ b/swig/libcclmatchrulesequence.i
@@ -0,0 +1,44 @@
+#ifndef SWIG_LIBWCCL_MATCHRULESEQUENCE_I
+#define SWIG_LIBWCCL_MATCHRULESEQUENCE_I
+
+%module libcclmatchrulesequence
+%{
+  #include <libwccl/ops/matchrulesequence.h>
+%}
+
+%include "libcclmatchrule.i"
+%include "libcclexpression.i"
+%include "libcorpus/libcorpusannotatedsentence.i"
+
+%include "std_string.i"
+%include "std_vector.i"
+%include "boost_shared_ptr.i"
+
+%template(MatchRuleVector) std::vector<MatchRule>;
+
+namespace Wccl {
+  class MatchRuleSequence : public std::vector<MatchRule>, public Expression {
+  public:
+    MatchRuleSequence();
+    MatchRuleSequence(const std::vector<MatchRule>& rules);
+
+    /* --------------------------------------------------------------------- */
+
+    %rename(OpFunMatchRuleSequence) operator()(const boost::shared_ptr<Corpus2::AnnotatedSentence>& sentence);
+    void operator()(const boost::shared_ptr<Corpus2::AnnotatedSentence>& sentence);
+
+    /* --------------------------------------------------------------------- */
+
+    void apply_all(const boost::shared_ptr<Corpus2::AnnotatedSentence>& sentence);
+
+    /* --------------------------------------------------------------------- */
+
+    std::string to_string(const Corpus2::Tagset& tagset) const;
+  };
+}
+
+using namespace boost;
+using namespace Wccl;
+using namespace std;
+
+#endif /* SWIG_LIBWCCL_MATCHRULESEQUENCE_I */
-- 
GitLab