- # Instantiate EnumValue template for SWIG wrappers
- print >> swig, '%%template(EnumValue%s) EnumValue<%s, enum %s>;' % (
- classname, classname, enum_name)
+ # Map EnumValue::id() and EnumValue::name() as SWIG attributes.
+ print('%%attribute(sigrok::%s, int, id, id);' % classname, file=swig)
+ print('%%attributestring(sigrok::%s, std::string, name, name);' % classname,
+ file=swig)
+
+ # Instantiate EnumValue template for SWIG
+ print('%%template(EnumValue%s) sigrok::EnumValue<sigrok::%s, enum %s>;' % (
+ classname, classname, enum_name), file=swig)
+
+ # Apply any language-specific extras.
+ print('%%enumextras(%s);' % classname, file=swig)
+
+ # Declare additional attributes if present
+ filename = os.path.join(dirname, "%s_methods.i" % classname)
+ if os.path.exists(filename):
+ print(str.join('', open(filename).readlines()), file=swig)