From: Martin Ling Date: Tue, 11 Nov 2014 18:26:50 +0000 (+0000) Subject: bindings: Support per-language extensions to EnumValue wrappers. X-Git-Tag: libsigrok-0.4.0~794 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7a36ceacb96c4fdbeea164d7368b4eef1ad545f9;p=libsigrok.git bindings: Support per-language extensions to EnumValue wrappers. --- diff --git a/bindings/cxx/enums.py b/bindings/cxx/enums.py index 25bd6f42..fb00102a 100644 --- a/bindings/cxx/enums.py +++ b/bindings/cxx/enums.py @@ -154,6 +154,9 @@ for enum, (classname, classbrief) in classes.items(): print >> swig, '%%template(EnumValue%s) sigrok::EnumValue;' % ( classname, classname, enum_name) + # Apply any language-specific extras. + print >> swig, '%%enumextras(%s);' % classname + # Declare additional attributes if present filename = os.path.join(dirname, "%s_methods.i" % classname) if os.path.exists(filename): diff --git a/bindings/java/org/sigrok/core/classes/classes.i b/bindings/java/org/sigrok/core/classes/classes.i index 22e6e256..3ca7d1aa 100644 --- a/bindings/java/org/sigrok/core/classes/classes.i +++ b/bindings/java/org/sigrok/core/classes/classes.i @@ -386,4 +386,7 @@ typedef jobject jsourcecallback; %attributeval(sigrok::Class, Type, Name, Get); %enddef +%define %enumextras(Class) +%enddef + %include "bindings/swig/classes.i" diff --git a/bindings/python/sigrok/core/classes.i b/bindings/python/sigrok/core/classes.i index 7cfdc29d..066dbf82 100644 --- a/bindings/python/sigrok/core/classes.i +++ b/bindings/python/sigrok/core/classes.i @@ -381,6 +381,9 @@ std::map dict_to_map_options(PyObject *dict, } %enddef +%define %enumextras(Class) +%enddef + %include "../../../swig/classes.i" /* Support Driver.scan() with keyword arguments. */