vala r840 - in trunk: . gobject



Author: juergbi
Date: Wed Jan 16 13:53:23 2008
New Revision: 840
URL: http://svn.gnome.org/viewvc/vala?rev=840&view=rev

Log:
2008-01-16  Juerg Billeter  <j bitron ch>

	* gobject/valaccodegeneratorinterface.vala,
	  gobject/valaccodegeneratorsignal.vala: support signals with
	  ref or out parameters


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegeneratorinterface.vala
   trunk/gobject/valaccodegeneratorsignal.vala

Modified: trunk/gobject/valaccodegeneratorinterface.vala
==============================================================================
--- trunk/gobject/valaccodegeneratorinterface.vala	(original)
+++ trunk/gobject/valaccodegeneratorinterface.vala	Wed Jan 16 13:53:23 2008
@@ -177,7 +177,7 @@
 
 		var params = sig.get_parameters ();
 		var params_len = params.size;
-		if (sig.return_type.type_parameter != null) {
+		if (sig.return_type is PointerType || sig.return_type.type_parameter != null) {
 			csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
 		} else if (sig.return_type.data_type == null) {
 			csignew.add_argument (new CCodeConstant ("G_TYPE_NONE"));
@@ -186,7 +186,7 @@
 		}
 		csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
 		foreach (FormalParameter param in params) {
-			if (param.type_reference.type_parameter != null) {
+			if (param.type_reference is PointerType || param.type_reference.type_parameter != null || param.type_reference.is_ref || param.type_reference.is_out) {
 				csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
 			} else {
 				csignew.add_argument (new CCodeConstant (param.type_reference.data_type.get_type_id ()));

Modified: trunk/gobject/valaccodegeneratorsignal.vala
==============================================================================
--- trunk/gobject/valaccodegeneratorsignal.vala	(original)
+++ trunk/gobject/valaccodegeneratorsignal.vala	Wed Jan 16 13:53:23 2008
@@ -1,6 +1,6 @@
 /* valaccodegeneratorsignal.vala
  *
- * Copyright (C) 2006-2007  JÃrg Billeter, Raffaele Sandrini
+ * Copyright (C) 2006-2008  JÃrg Billeter, Raffaele Sandrini
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,9 +25,9 @@
 
 public class Vala.CCodeGenerator {
 	private string get_marshaller_type_name (DataType t) {
-		if (t.type_parameter != null) {
+		if (t is PointerType || t.type_parameter != null || t.is_ref || t.is_out) {
 			return ("POINTER");
-		} else if (t.data_type == null) {
+		} else if (t is VoidType) {
 			return ("VOID");
 		} else {
 			return t.data_type.get_marshaller_type_name ();
@@ -61,18 +61,14 @@
 	}
 	
 	private string get_value_type_name_from_type_reference (DataType! t) {
-		if (t.type_parameter != null) {
+		if (t is PointerType || t.type_parameter != null || t.is_ref || t.is_out) {
 			return "gpointer";
 		} else if (t.data_type == null) {
 			return "void";
 		} else if (t.data_type is Class || t.data_type is Interface) {
-			return "GObject *";
+			return "gpointer";
 		} else if (t.data_type is Struct) {
-			if (((Struct) t.data_type).is_reference_type ()) {
-				return "gpointer";
-			} else {
-				return t.data_type.get_cname ();
-			}
+			return t.data_type.get_cname ();
 		} else if (t.data_type is Enum) {
 			return "gint";
 		} else if (t.data_type is Array) {
@@ -203,7 +199,7 @@
 		i = 1;
 		foreach (FormalParameter p in params) {
 			string get_value_function;
-			if (p.type_reference.type_parameter != null) {
+			if (p.type_reference is PointerType || p.type_reference.type_parameter != null || p.type_reference.is_ref || p.type_reference.is_out) {
 				get_value_function = "g_value_get_pointer";
 			} else {
 				get_value_function = p.type_reference.data_type.get_get_value_function ();



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