From f6219b97e07d1652e16b296b40d2a449e4f8a59c Mon Sep 17 00:00:00 2001 From: Stephan Sundermann Date: Wed, 5 Jun 2013 19:26:33 +0200 Subject: [PATCH] generator: Added count param detection for return values --- generator/CallbackGen.cs | 2 ++ generator/ReturnValue.cs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/generator/CallbackGen.cs b/generator/CallbackGen.cs index fde76684c..a63dab813 100644 --- a/generator/CallbackGen.cs +++ b/generator/CallbackGen.cs @@ -56,6 +56,8 @@ namespace GtkSharp.Generation { if (!String.IsNullOrEmpty (retval.CountParameterName)) retval.CountParameter = parms.GetCountParameter (retval.CountParameterName); + if (retval.CountParameterIndex >= 0) + retval.CountParameter = parms[retval.CountParameterIndex]; return valid; } diff --git a/generator/ReturnValue.cs b/generator/ReturnValue.cs index 4d70d123a..7e4e6ec18 100644 --- a/generator/ReturnValue.cs +++ b/generator/ReturnValue.cs @@ -32,6 +32,7 @@ namespace GtkSharp.Generation { bool elements_owned; bool owned; string array_length_param = String.Empty; + int array_length_param_index = -1; string ctype = String.Empty; string default_value = String.Empty; string element_ctype = String.Empty; @@ -43,6 +44,8 @@ namespace GtkSharp.Generation { is_null_term = elem.GetAttributeAsBoolean ("null_term_array"); is_array = elem.GetAttributeAsBoolean ("array") || elem.HasAttribute ("array_length_param"); array_length_param = elem.GetAttribute ("array_length_param"); + if (elem.HasAttribute ("array_length_param_length")) + array_length_param_index = int.Parse (elem.GetAttribute ("array_length_param_index")); elements_owned = elem.GetAttributeAsBoolean ("elements_owned"); owned = elem.GetAttributeAsBoolean ("owned"); ctype = elem.GetAttribute("type"); @@ -60,6 +63,10 @@ namespace GtkSharp.Generation { get { return array_length_param; } } + public int CountParameterIndex { + get { return array_length_param_index; } + } + public string CType { get { return ctype;