vala r1222 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1222 - in trunk: . gobject vala
- Date: Mon, 14 Apr 2008 17:49:37 +0100 (BST)
Author: juergbi
Date: Mon Apr 14 17:49:37 2008
New Revision: 1222
URL: http://svn.gnome.org/viewvc/vala?rev=1222&view=rev
Log:
2008-04-14 Juerg Billeter <j bitron ch>
* vala/valaclass.vala, vala/valainterface.vala,
vala/valatypesymbol.vala, vala/valavaluetype.vala,
gobject/valaccodegenerator.vala: prepare support for nullable and
boxed value types
Modified:
trunk/ChangeLog
trunk/gobject/valaccodegenerator.vala
trunk/vala/valaclass.vala
trunk/vala/valainterface.vala
trunk/vala/valatypesymbol.vala
trunk/vala/valavaluetype.vala
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Mon Apr 14 17:49:37 2008
@@ -695,7 +695,7 @@
// pass non-simple structs always by reference
if (p.type_reference.data_type is Struct) {
var st = (Struct) p.type_reference.data_type;
- if (!st.is_simple_type () && !p.type_reference.is_ref && !p.type_reference.is_out) {
+ if (!st.is_simple_type () && !p.type_reference.is_ref && !p.type_reference.is_out && !p.type_reference.nullable) {
ctypename += "*";
}
}
@@ -3240,7 +3240,7 @@
}
public CCodeExpression get_implicit_cast_expression (CCodeExpression cexpr, DataType? expression_type, DataType target_type) {
- if (null == expression_type) {
+ if (expression_type == null) {
return cexpr;
}
Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala (original)
+++ trunk/vala/valaclass.vala Mon Apr 14 17:49:37 2008
@@ -600,7 +600,7 @@
return get_ref_function () != null;
}
- public override string get_ref_function () {
+ public override string? get_ref_function () {
if (ref_function == null && base_class != null) {
return base_class.get_ref_function ();
} else {
@@ -608,11 +608,11 @@
}
}
- public void set_ref_function (string name) {
+ public void set_ref_function (string? name) {
this.ref_function = name;
}
- public override string get_unref_function () {
+ public override string? get_unref_function () {
if (unref_function == null && base_class != null) {
return base_class.get_unref_function ();
} else {
@@ -620,15 +620,15 @@
}
}
- public void set_unref_function (string name) {
+ public void set_unref_function (string? name) {
this.unref_function = name;
}
- public override string get_dup_function () {
+ public override string? get_dup_function () {
return copy_function;
}
- public void set_dup_function (string name) {
+ public void set_dup_function (string? name) {
this.copy_function = name;
}
@@ -636,7 +636,7 @@
return get_lower_case_cprefix () + "free";
}
- public override string get_free_function () {
+ public override string? get_free_function () {
if (free_function == null) {
free_function = get_default_free_function ();
}
Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala (original)
+++ trunk/vala/valainterface.vala Mon Apr 14 17:49:37 2008
@@ -371,11 +371,11 @@
return true;
}
- public override string get_ref_function () {
+ public override string? get_ref_function () {
return "g_object_ref";
}
- public override string get_unref_function () {
+ public override string? get_unref_function () {
return "g_object_unref";
}
Modified: trunk/vala/valatypesymbol.vala
==============================================================================
--- trunk/vala/valatypesymbol.vala (original)
+++ trunk/vala/valatypesymbol.vala Mon Apr 14 17:49:37 2008
@@ -1,6 +1,6 @@
/* valatype.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
@@ -58,23 +58,45 @@
*
* @return the name of the C function if supported or null otherwise
*/
- public virtual string get_dup_function () {
+ public virtual string? get_dup_function () {
return null;
}
/**
* Returns the C function name that frees instances of this data type.
- * This is only valid for data types with reference type semantics that
- * do not support reference counting. The specified C function must
- * accept one argument pointing to the instance to be freed.
+ * The specified C function must accept one argument pointing to the
+ * instance to be freed.
*
- * @return the name of the C function or null if this data type is not a
- * reference type or if it supports reference counting
+ * @return the name of the C function if supported or null otherwise
*/
- public virtual string get_free_function () {
+ public virtual string? get_free_function () {
return null;
}
-
+
+ /**
+ * Returns the C function name that copies contents of instances of
+ * this data type. This is only applicable to structs. The specified
+ * C function must accept two arguments, the first is the source value
+ * and the second is the destination value.
+ *
+ * @return the name of the C function if supported or null otherwise
+ */
+ public virtual string? get_copy_function () {
+ return null;
+ }
+
+ /**
+ * Returns the C function name that destroys the contents of instances
+ * of this data type. This is only applicable to structs. The specified
+ * C function must accept one argument pointing to the instance to be
+ * destroyed.
+ *
+ * @return the name of the C function if supported or null otherwise
+ */
+ public virtual string? get_destroy_function () {
+ return null;
+ }
+
/**
* Checks whether this data type supports reference counting. This is
* only valid for reference types.
@@ -95,7 +117,7 @@
* @return the name of the C function or null if this data type does not
* support reference counting
*/
- public virtual string get_ref_function () {
+ public virtual string? get_ref_function () {
return null;
}
@@ -108,7 +130,7 @@
* @return the name of the C function or null if this data type does not
* support reference counting
*/
- public virtual string get_unref_function () {
+ public virtual string? get_unref_function () {
return null;
}
Modified: trunk/vala/valavaluetype.vala
==============================================================================
--- trunk/vala/valavaluetype.vala (original)
+++ trunk/vala/valavaluetype.vala Mon Apr 14 17:49:37 2008
@@ -52,4 +52,15 @@
return result;
}
+
+ public override string get_cname (bool var_type, bool const_type) {
+ string ptr = "";
+ if (is_ref || is_out) {
+ ptr += "*";
+ }
+ if (nullable) {
+ ptr += "*";
+ }
+ return type_symbol.get_cname (const_type) + ptr;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]