From 5863c07618fa00cdd6ae381742e4f4cc432bfb55 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 7 Nov 2024 08:48:59 +0100 Subject: [PATCH 1/2] try to fix SWIG unified initializer problem --- rakelib/lib/extractor/function.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rakelib/lib/extractor/function.rb b/rakelib/lib/extractor/function.rb index 5bc9326f..a3257f1e 100644 --- a/rakelib/lib/extractor/function.rb +++ b/rakelib/lib/extractor/function.rb @@ -370,6 +370,8 @@ def extract(element) end if element.at_xpath('defval') @default = BaseDef.flatten_node(element.at_xpath('defval')) + # transform unified initializers to ctor form (SWIG does not like unified initializers) + @default.sub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "(#{$3})"} end end rescue Exception From fa0d6d83c308dd3181d297e6035d1322bc5a4acb Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 7 Nov 2024 12:44:50 +0100 Subject: [PATCH 2/2] fix SWIG unified initializer problem --- rakelib/lib/extractor/function.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rakelib/lib/extractor/function.rb b/rakelib/lib/extractor/function.rb index a3257f1e..430d430a 100644 --- a/rakelib/lib/extractor/function.rb +++ b/rakelib/lib/extractor/function.rb @@ -49,6 +49,9 @@ def extract(element) @template_params << txt end @args_string = element.at_xpath('argsstring').text + # transform unified initializers to ctor form (SWIG does not like unified initializers) + # (also see ParamDef#extract) + @args_string.gsub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "#{$1}(#{$3})"} check_deprecated element.xpath('param').each do |node| p = ParamDef.new(node) @@ -371,7 +374,7 @@ def extract(element) if element.at_xpath('defval') @default = BaseDef.flatten_node(element.at_xpath('defval')) # transform unified initializers to ctor form (SWIG does not like unified initializers) - @default.sub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "(#{$3})"} + @default.sub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "#{$1}(#{$3})"} end end rescue Exception