]> sigrok.org Git - libsigrok.git/commitdiff
bindings: Wrap EnumValue base class.
authorMartin Ling <redacted>
Wed, 29 Oct 2014 14:36:45 +0000 (14:36 +0000)
committerUwe Hermann <redacted>
Wed, 12 Nov 2014 01:27:04 +0000 (02:27 +0100)
.gitignore
bindings/cxx/enums.py
bindings/swig/classes.i

index 6d7fdd78c52ce4d66eb2b80601bad58acabfdc97..0a59be65ee2c0b61e519d332ea4bef2f9454e4a4 100644 (file)
@@ -49,6 +49,7 @@ bindings/cxx/doxy/
 bindings/cxx/include/libsigrok/enums.hpp
 bindings/cxx/enums.cpp
 bindings/cxx/enums.timestamp
+bindings/swig/enums.i
 
 # Files generated by building Python bindings
 *.pyc
index 4f32d98e0fb00a6c52dee7738848b7a4cf265fe7..1941f783a8b3bcc92c0c606e0f3b3348aae85700 100644 (file)
@@ -66,6 +66,7 @@ for compound in index.findall('compound'):
 
 header = open(os.path.join(outdirname, 'include/libsigrok/enums.hpp'), 'w')
 code = open(os.path.join(outdirname, 'enums.cpp'), 'w')
+swig = open(os.path.join(outdirname, '../swig/enums.i'), 'w')
 
 for file in (header, code):
     print >> file, "/* Generated file - edit enums.py instead! */"
@@ -144,3 +145,7 @@ for enum, (classname, classbrief) in classes.items():
     filename = os.path.join(dirname, "%s_methods.cpp" % classname)
     if os.path.exists(filename):
         print >> code, str.join('', open(filename).readlines())
+
+    # Instantiate EnumValue template for SWIG wrappers
+    print >> swig, '%%template(EnumValue%s) EnumValue<%s, enum %s>;' % (
+        classname, classname, enum_name)
index ce96c9d9e2af2af0a2f35d7808e59d875f26e4a6..07e74573bfe837a7af196334d9fd4c27690596bf 100644 (file)
@@ -273,5 +273,6 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
 %include "libsigrok/libsigrok.hpp"
 
 namespace sigrok {
+%include "enums.i"
 %include "libsigrok/enums.hpp"
 }