summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
35be304)
bindings/swig/doc.py generates a swig interface file for ruby bindings
that includes docstrings with comments braces ( /* and */ ) like this:
%feature("docstring") sigrok::Channel::type "/* Type of this channel. */\n";
%feature("docstring") sigrok::Channel::enabled "/* Enabled status of this channel. */\n";
SWIG generates *.cxx and adds its own braces to the docstring:
/*/* Document-class: Sigrok::Error
Exception thrown when an error code is returned by any libsigrok call. */
*/
this causes compilation error for Ruby bindings.
To fix the error we should not add extra braces to the docstring.
With this patch libsigrok compiles fine with with ruby 2.7 and swig 4.0.2.
Fixes bug #1526
Signed-off-by: Anatol Pomozov <redacted>
if language == 'python':
print('%%feature("docstring") %s "%s";' % (class_name, brief))
elif language == 'ruby':
if language == 'python':
print('%%feature("docstring") %s "%s";' % (class_name, brief))
elif language == 'ruby':
- print('%%feature("docstring") %s "/* Document-class: %s\\n%s */\\n";' % (class_name, class_name.replace("sigrok", "Sigrok", 1), brief))
+ print('%%feature("docstring") %s "Document-class: %s\\n%s\\n";' % (class_name, class_name.replace("sigrok", "Sigrok", 1), brief))
elif language == 'java':
print('%%typemap(javaclassmodifiers) %s "/** %s */\npublic class"' % (
class_name, brief))
elif language == 'java':
print('%%typemap(javaclassmodifiers) %s "/** %s */\npublic class"' % (
class_name, brief))
for name, desc in parameters.items()]) + '";')
if language == 'ruby' and kind == 'public-func':
print(str.join('\n', [
for name, desc in parameters.items()]) + '";')
if language == 'ruby' and kind == 'public-func':
print(str.join('\n', [
- '%%feature("docstring") %s::%s "/* %s' % (
+ '%%feature("docstring") %s::%s "%s' % (
class_name, member_name, brief)] + [
'@param %s %s' % (name, desc)
class_name, member_name, brief)] + [
'@param %s %s' % (name, desc)
- for name, desc in parameters.items()]) + ' */\\n";')
+ for name, desc in parameters.items()]) + '\\n";')
elif language == 'java' and kind == 'public-func':
print(str.join('\n', [
'%%javamethodmodifiers %s::%s "/** %s' % (
elif language == 'java' and kind == 'public-func':
print(str.join('\n', [
'%%javamethodmodifiers %s::%s "/** %s' % (
print('%}')
elif language == 'ruby' and constants:
for member_name, brief in constants:
print('%}')
elif language == 'ruby' and constants:
for member_name, brief in constants:
- print('%%feature("docstring") %s::%s "/* %s */\\n";' % (class_name, member_name, brief))
+ print('%%feature("docstring") %s::%s "%s\\n";' % (class_name, member_name, brief))