[vala] girwriter: write GArray and GPtrArray to GIRs as arrays.



commit f2c638648cff1d10b389bc01214c16587c15d4e2
Author: Evan Nemerson <evan coeus-group com>
Date:   Tue Nov 20 15:17:53 2012 -0800

    girwriter: write GArray and GPtrArray to GIRs as arrays.

 codegen/valagirwriter.vala |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 597cdac..3f743d3 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1269,7 +1269,12 @@ public class Vala.GIRWriter : CodeVisitor {
 			buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s\"/>\n", CCodeBaseModule.get_ccode_name (type));
 		} else if (type.data_type != null) {
 			write_indent ();
-			buffer.append_printf ("<type name=\"%s\" c:type=\"%s\"", gi_type_name (type.data_type), CCodeBaseModule.get_ccode_name (type));
+			string type_name = gi_type_name (type.data_type);
+			bool is_array = false;
+			if ((type_name == "GLib.Array") || (type_name == "GLib.PtrArray")) {
+				is_array = true;
+			}
+			buffer.append_printf ("<%s name=\"%s\" c:type=\"%s\"", is_array ? "array" : "type", gi_type_name (type.data_type), CCodeBaseModule.get_ccode_name (type));
 
 			List<DataType> type_arguments = type.get_type_arguments ();
 			if (type_arguments.size == 0) {
@@ -1284,7 +1289,7 @@ public class Vala.GIRWriter : CodeVisitor {
 
 				indent--;
 				write_indent ();
-				buffer.append_printf ("</type>\n");
+				buffer.append_printf ("</%s>\n", is_array ? "array" : "type");
 			}
 		} else if (type is DelegateType) {
 			var deleg_type = (DelegateType) type;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]