Commit 087945bc authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

support creation methods in structs, replace InstanceByReference method

2007-09-15  Juerg Billeter  <j@bitron.ch>

	* vala/valainterfacewriter.vala, vala/valamethod.vala,
	  vala/valasemanticanalyzer.vala, vala/valastruct.vala,
	  gobject/valacodegenerator.vala,
	  gobject/valacodegeneratorinvocationexpression.vala,
	  gobject/valacodegeneratormethod.vala, vapigen/valagidlparser.vala,
	  vapi/glib-2.0.vala: support creation methods in structs, replace
	  InstanceByReference method attribute by SimpleType type attribute
	  (inverse effect)

	* tests/Makefile.am, tests/structs.exp, tests/structs.vala: add struct
	  declaration test

	* vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala: regenerated

svn path=/trunk/; revision=608
parent 6f39dba7
2007-09-15 Jürg Billeter <j@bitron.ch>
* vala/valainterfacewriter.vala, vala/valamethod.vala,
vala/valasemanticanalyzer.vala, vala/valastruct.vala,
gobject/valacodegenerator.vala,
gobject/valacodegeneratorinvocationexpression.vala,
gobject/valacodegeneratormethod.vala, vapigen/valagidlparser.vala,
vapi/glib-2.0.vala: support creation methods in structs, replace
InstanceByReference method attribute by SimpleType type attribute
(inverse effect)
* tests/Makefile.am, tests/structs.exp, tests/structs.vala: add struct
declaration test
* vapi/gdk-2.0.vala, vapi/gtk+-2.0.vala, vapi/pango.vala: regenerated
2007-09-15 Jürg Billeter <j@bitron.ch>
* vala/scanner.l: support real literals with exponent
......
......@@ -2408,44 +2408,58 @@ public class Vala.CodeGenerator : CodeVisitor {
}
public override void visit_end_object_creation_expression (ObjectCreationExpression! expr) {
CCodeExpression struct_instance = null;
CCodeFunctionCall creation_call = null;
if (expr.type_reference.data_type is Struct) {
// value-type initialization
var temp_decl = get_temp_variable_declarator (expr.type_reference, false, expr);
temp_vars.add (temp_decl);
struct_instance = new CCodeIdentifier (get_variable_cname (temp_decl.name));
}
if (expr.symbol_reference == null) {
// no creation method
if (expr.type_reference.data_type == glist_type ||
expr.type_reference.data_type == gslist_type) {
expr.type_reference.data_type == gslist_type) {
// NULL is an empty list
expr.ccodenode = new CCodeConstant ("NULL");
} else if (expr.type_reference.data_type is Class && expr.type_reference.data_type.is_subtype_of (gobject_type)) {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_object_new"));
ccall.add_argument (new CCodeConstant (expr.type_reference.data_type.get_type_id ()));
ccall.add_argument (new CCodeConstant ("NULL"));
expr.ccodenode = ccall;
} else {
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
ccall.add_argument (new CCodeConstant (expr.type_reference.data_type.get_cname ()));
ccall.add_argument (new CCodeConstant ("1"));
expr.ccodenode = ccall;
creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_object_new"));
creation_call.add_argument (new CCodeConstant (expr.type_reference.data_type.get_type_id ()));
creation_call.add_argument (new CCodeConstant ("NULL"));
} else if (expr.type_reference.data_type is Class) {
creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
creation_call.add_argument (new CCodeConstant (expr.type_reference.data_type.get_cname ()));
creation_call.add_argument (new CCodeConstant ("1"));
} else if (expr.type_reference.data_type is Struct) {
// memset needs string.h
string_h_needed = true;
creation_call = new CCodeFunctionCall (new CCodeIdentifier ("memset"));
creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, struct_instance));
creation_call.add_argument (new CCodeConstant ("0"));
creation_call.add_argument (new CCodeIdentifier ("sizeof (%s)".printf (expr.type_reference.get_cname ())));
}
} else if (expr.symbol_reference is Method) {
// use creation method
var m = (Method) expr.symbol_reference;
var params = m.get_parameters ();
var ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_cname ()));
creation_call = new CCodeFunctionCall (new CCodeIdentifier (m.get_cname ()));
if (struct_instance != null) {
creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, struct_instance));
}
if (expr.type_reference.data_type is Class && expr.type_reference.data_type.is_subtype_of (gobject_type)) {
foreach (TypeReference type_arg in expr.type_reference.get_type_arguments ()) {
if (type_arg.takes_ownership) {
ccall.add_argument (get_dup_func_expression (type_arg));
ccall.add_argument (get_destroy_func_expression (type_arg));
creation_call.add_argument (get_dup_func_expression (type_arg));
creation_call.add_argument (get_destroy_func_expression (type_arg));
} else {
ccall.add_argument (new CCodeConstant ("NULL"));
ccall.add_argument (new CCodeConstant ("NULL"));
creation_call.add_argument (new CCodeConstant ("NULL"));
creation_call.add_argument (new CCodeConstant ("NULL"));
}
}
}
......@@ -2464,7 +2478,7 @@ public class Vala.CodeGenerator : CodeVisitor {
}
}
ccall.add_argument (cexpr);
creation_call.add_argument (cexpr);
i++;
}
while (params_it.next ()) {
......@@ -2485,41 +2499,47 @@ public class Vala.CodeGenerator : CodeVisitor {
* parameter yet */
param.default_expression.accept (this);
ccall.add_argument ((CCodeExpression) param.default_expression.ccodenode);
creation_call.add_argument ((CCodeExpression) param.default_expression.ccodenode);
i++;
}
if (expr.can_fail) {
// method can fail
current_method_inner_error = true;
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("inner_error")));
creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("inner_error")));
}
if (ellipsis) {
// ensure variable argument list ends with NULL
ccall.add_argument (new CCodeConstant ("NULL"));
creation_call.add_argument (new CCodeConstant ("NULL"));
}
expr.ccodenode = ccall;
} else if (expr.symbol_reference is EnumValue) {
// error code
var ev = (EnumValue) expr.symbol_reference;
var en = (Enum) ev.parent_symbol;
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
ccall.add_argument (new CCodeIdentifier ("error"));
ccall.add_argument (new CCodeIdentifier (en.get_upper_case_cname ()));
ccall.add_argument (new CCodeIdentifier (ev.get_cname ()));
creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
creation_call.add_argument (new CCodeIdentifier ("error"));
creation_call.add_argument (new CCodeIdentifier (en.get_upper_case_cname ()));
creation_call.add_argument (new CCodeIdentifier (ev.get_cname ()));
foreach (Expression arg in expr.get_argument_list ()) {
ccall.add_argument ((CCodeExpression) arg.ccodenode);
creation_call.add_argument ((CCodeExpression) arg.ccodenode);
}
expr.ccodenode = ccall;
} else {
assert (false);
}
if (expr.type_reference.data_type is Struct) {
var ccomma = new CCodeCommaExpression ();
ccomma.append_expression (creation_call);
ccomma.append_expression (struct_instance);
expr.ccodenode = ccomma;
} else if (creation_call != null) {
expr.ccodenode = creation_call;
}
visit_expression (expr);
}
......
......@@ -56,10 +56,7 @@ public class Vala.CodeGenerator {
} else if (m is ArrayMoveMethod) {
requires_array_move = true;
}
/* explicitly use strong reference as ccall gets unrefed
* at end of inner block
*/
CCodeExpression instance;
if (m != null && m.instance) {
var base_method = m;
......@@ -79,7 +76,7 @@ public class Vala.CodeGenerator {
instance_expression_type = ma.inner.static_type;
}
if (m.instance_by_reference && (ma.inner != null || m.parent_symbol != current_type_symbol)) {
if (m.parent_symbol is Struct && !((Struct) m.parent_symbol).is_simple_type () && (ma.inner != null || m.parent_symbol != current_type_symbol)) {
instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance);
}
......
......@@ -99,7 +99,7 @@ public class Vala.CodeGenerator {
CCodeFormalParameter instance_param = null;
if (m.instance) {
if (m.instance || (m.parent_symbol is Struct && m is CreationMethod)) {
var this_type = new TypeReference ();
this_type.data_type = find_parent_type (m);
if (m.base_interface_method != null) {
......@@ -111,7 +111,7 @@ public class Vala.CodeGenerator {
base_type.data_type = (DataType) m.base_method.parent_symbol;
instance_param = new CCodeFormalParameter ("base", base_type.get_cname ());
} else {
if (m.instance_by_reference) {
if (m.parent_symbol is Struct && !((Struct) m.parent_symbol).is_simple_type ()) {
instance_param = new CCodeFormalParameter ("*self", this_type.get_cname ());
} else {
instance_param = new CCodeFormalParameter ("self", this_type.get_cname ());
......@@ -308,11 +308,14 @@ public class Vala.CodeGenerator {
cinit.append (cdecl);
} else {
var st = (Struct) m.parent_symbol;
var cdecl = new CCodeDeclaration (st.get_cname () + "*");
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_new0"));
ccall.add_argument (new CCodeIdentifier (st.get_cname ()));
cdecl.add_declarator (new CCodeVariableDeclarator.with_initializer ("self", ccall));
cinit.append (cdecl);
// memset needs string.h
string_h_needed = true;
var czero = new CCodeFunctionCall (new CCodeIdentifier ("memset"));
czero.add_argument (new CCodeIdentifier ("self"));
czero.add_argument (new CCodeConstant ("0"));
czero.add_argument (new CCodeIdentifier ("sizeof (%s)".printf (st.get_cname ())));
cinit.append (new CCodeExpressionStatement (czero));
}
}
......@@ -428,9 +431,11 @@ public class Vala.CodeGenerator {
function.block.add_statement (new CCodeExpressionStatement (cfreeparams));
}
var creturn = new CCodeReturnStatement ();
creturn.return_expression = new CCodeIdentifier ("self");
function.block.add_statement (creturn);
if (current_type_symbol is Class) {
var creturn = new CCodeReturnStatement ();
creturn.return_expression = new CCodeIdentifier ("self");
function.block.add_statement (creturn);
}
}
bool return_value = true;
......
......@@ -35,6 +35,7 @@ TESTS_ENVIRONMENT = $(srcdir)/testrunner.sh
TESTS = \
hello.vala \
classes.vala \
structs.vala \
property-sample.vala \
\
test-001.vala \
......@@ -82,6 +83,7 @@ EXTRA_DIST = \
\
hello.exp \
classes.exp \
structs.exp \
property-sample.exp \
\
test-001.exp \
......
Structs Test:
new SimpleStruct ()
new PublicStruct ()
new StructWithCreationMethod ()
StructWithCreationMethod
new StructWithNamedCreationMethod ()
StructWithNamedCreationMethod
.
using GLib;
struct SimpleStruct {
}
public struct PublicStruct {
}
struct StructWithCreationMethod {
public StructWithCreationMethod () {
stdout.printf ("StructWithCreationMethod\n");
}
}
struct StructWithNamedCreationMethod {
public StructWithNamedCreationMethod.named () {
stdout.printf ("StructWithNamedCreationMethod\n");
}
}
static class StructsTest {
static int main (string[] args) {
stdout.printf ("Structs Test:\n");
stdout.printf ("new SimpleStruct ()\n");
var simple_struct = new SimpleStruct ();
stdout.printf ("new PublicStruct ()\n");
var public_struct = new PublicStruct ();
stdout.printf ("new StructWithCreationMethod ()\n");
var struct_with_creation_method = new StructWithCreationMethod ();
stdout.printf ("new StructWithNamedCreationMethod ()\n");
var struct_with_named_creation_method = new StructWithNamedCreationMethod.named ();
stdout.printf (".\n");
return 0;
}
}
......@@ -480,10 +480,6 @@ public class Vala.InterfaceWriter : CodeVisitor {
write_indent ();
write_string ("[InstanceLast]");
}
if (m.instance_by_reference) {
write_indent ();
write_string ("[InstanceByReference]");
}
var ccode_params = new String ();
var separator = "";
......
......@@ -113,13 +113,7 @@ public class Vala.Method : Member, Invokable {
* or as the last argument in C code. Defaults to first.
*/
public bool instance_last { get; set; }
/**
* Specifies whether the instance of a value type should be passed by
* reference. Only valid for instance methods of value types.
*/
public bool instance_by_reference { get; set; }
/**
* Specifies the virtual or abstract method this method overrides.
* Reference must be weak as virtual methods set base_method to
......@@ -305,8 +299,6 @@ public class Vala.Method : Member, Invokable {
returns_modified_pointer = true;
} else if (a.name == "InstanceLast") {
instance_last = true;
} else if (a.name == "InstanceByReference") {
instance_by_reference = true;
} else if (a.name == "FloatingReference") {
return_type.floating_reference = true;
} else if (a.name == "NoArrayLength") {
......
......@@ -435,10 +435,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
public override void visit_creation_method (CreationMethod! m) {
m.return_type = new TypeReference ();
m.return_type.data_type = (DataType) m.parent_symbol;
m.return_type.transfers_ownership = true;
if (current_symbol is Class) {
m.return_type.data_type = (DataType) m.parent_symbol;
m.return_type.transfers_ownership = true;
// check for floating reference
var cl = (Class) current_symbol;
while (cl != null) {
......@@ -1876,12 +1877,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
type = expr.type_reference.data_type;
}
if (!type.is_reference_type () && !(type is Enum)) {
expr.error = true;
Report.error (expr.source_reference, "Can't create instance of value type `%s'".printf (expr.type_reference.to_string ()));
return;
}
current_source_file.add_symbol_dependency (type, SourceFileDependencyType.SOURCE);
expr.static_type = expr.type_reference.copy ();
......@@ -1912,6 +1907,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
} else if (type is Struct) {
var st = (Struct) type;
expr.static_type.transfers_ownership = false;
if (expr.symbol_reference == null) {
expr.symbol_reference = st.default_construction_method;
}
......
......@@ -48,7 +48,8 @@ public class Vala.Struct : DataType {
private string get_value_function;
private string set_value_function;
private string default_value = null;
private bool simple_type;
/**
* Specifies the default construction method.
*/
......@@ -139,6 +140,10 @@ public class Vala.Struct : DataType {
}
public override void accept_children (CodeVisitor! visitor) {
foreach (TypeReference type in base_types) {
type.accept (visitor);
}
foreach (TypeParameter p in type_parameters) {
p.accept (visitor);
}
......@@ -281,6 +286,8 @@ public class Vala.Struct : DataType {
foreach (Attribute a in attributes) {
if (a.name == "CCode") {
process_ccode_attribute (a);
} else if (a.name == "SimpleType") {
simple_type = true;
} else if (a.name == "IntegerType") {
process_integer_type_attribute (a);
} else if (a.name == "FloatingType") {
......@@ -375,4 +382,18 @@ public class Vala.Struct : DataType {
return -1;
}
/**
* Returns whether this struct is a simple type, i.e. whether
* instances are passed by value.
*/
public bool is_simple_type () {
foreach (TypeReference type in base_types) {
var st = type.data_type as Struct;
if (st != null && st.is_simple_type ()) {
return true;
}
}
return simple_type;
}
}
......@@ -1799,17 +1799,12 @@ namespace Gdk {
public ushort red;
public ushort green;
public ushort blue;
[InstanceByReference]
public Gdk.Color copy ();
[InstanceByReference]
public bool equal (out Gdk.Color colorb);
[InstanceByReference]
public void free ();
public static GLib.Type get_type ();
[InstanceByReference]
public uint hash ();
public static bool parse (string spec, out Gdk.Color color);
[InstanceByReference]
public weak string to_string ();
}
[CCode (cheader_filename = "gdk/gdk.h")]
......@@ -1819,9 +1814,7 @@ namespace Gdk {
public int width;
public int height;
public static GLib.Type get_type ();
[InstanceByReference]
public bool intersect (out Gdk.Rectangle src2, out Gdk.Rectangle dest);
[InstanceByReference]
public void union (out Gdk.Rectangle src2, out Gdk.Rectangle dest);
}
[CCode (cheader_filename = "gdk/gdk.h")]
......
......@@ -23,10 +23,12 @@
* Mathias Hasselmann <mathias.hasselmann@gmx.de>
*/
[SimpleType]
[CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", marshaller_type_name = "BOOLEAN", get_value_function = "g_value_get_boolean", set_value_function = "g_value_set_boolean", default_value = "FALSE")]
public struct bool {
}
[SimpleType]
[CCode (cname = "gpointer", cheader_filename = "glib.h", type_id = "G_TYPE_POINTER", marshaller_type_name = "POINTER", get_value_function = "g_value_get_pointer", set_value_function = "g_value_set_pointer", default_value = "NULL")]
public struct pointer {
[CCode (cname ="GPOINTER_TO_INT")]
......@@ -35,10 +37,12 @@ public struct pointer {
public uint to_uint ();
}
[SimpleType]
[CCode (cname = "gconstpointer", cheader_filename = "glib.h", type_id = "G_TYPE_POINTER", marshaller_type_name = "POINTER", get_value_function = "g_value_get_pointer", set_value_function = "g_value_set_pointer", default_value = "NULL")]
public struct constpointer {
}
[SimpleType]
[CCode (cname = "gchar", cprefix = "g_ascii_", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "\'\\0\'")]
[IntegerType (rank = 1)]
public struct char {
......@@ -62,6 +66,7 @@ public struct char {
public char toupper ();
}
[SimpleType]
[CCode (cname = "guchar", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "\'\\0\'")]
[IntegerType (rank = 2)]
public struct uchar {
......@@ -70,6 +75,7 @@ public struct uchar {
public string! to_string (string! format = "%hhu");
}
[SimpleType]
[CCode (cname = "gint", cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0")]
[IntegerType (rank = 9)]
public struct int {
......@@ -89,6 +95,7 @@ public struct int {
public pointer to_pointer ();
}
[SimpleType]
[CCode (cname = "guint", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U")]
[IntegerType (rank = 10)]
public struct uint {
......@@ -108,6 +115,7 @@ public struct uint {
public pointer to_pointer ();
}
[SimpleType]
[CCode (cname = "gshort", cheader_filename = "glib.h", default_value = "0")]
[IntegerType (rank = 5)]
public struct short {
......@@ -121,6 +129,7 @@ public struct short {
public string! to_string (string! format = "%hi");
}
[SimpleType]
[CCode (cname = "gushort", cheader_filename = "glib.h", default_value = "0U")]
[IntegerType (rank = 6)]
public struct ushort {
......@@ -134,6 +143,7 @@ public struct ushort {
public string! to_string (string! format = "%hu");
}
[SimpleType]
[CCode (cname = "glong", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L")]
[IntegerType (rank = 14)]
public struct long {
......@@ -147,6 +157,7 @@ public struct long {
public string! to_string (string! format = "%li");
}
[SimpleType]
[CCode (cname = "gulong", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")]
[IntegerType (rank = 15)]
public struct ulong {
......@@ -160,6 +171,7 @@ public struct ulong {
public string! to_string (string! format = "%lu");
}
[SimpleType]
[CCode (cname = "gint8", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "0")]
[IntegerType (rank = 3)]
public struct int8 {
......@@ -172,6 +184,7 @@ public struct int8 {
public string! to_string (string! format = "%hhi");
}
[SimpleType]
[CCode (cname = "guint8", cheader_filename = "glib.h", default_value = "0U")]
[IntegerType (rank = 4)]
public struct uint8 {
......@@ -184,6 +197,7 @@ public struct uint8 {
public string! to_string (string! format = "%hhu");
}
[SimpleType]
[CCode (cname = "gint16", cheader_filename = "glib.h", default_value = "0")]
[IntegerType (rank = 7)]
public struct int16 {
......@@ -196,6 +210,7 @@ public struct int16 {
public string! to_string (string! format = "%hi");
}
[SimpleType]
[CCode (cname = "guint16", cheader_filename = "glib.h", default_value = "0U")]
[IntegerType (rank = 8)]
public struct uint16 {
......@@ -208,6 +223,7 @@ public struct uint16 {
public string! to_string (string! format = "%hu");
}
[SimpleType]
[CCode (cname = "gint32", cheader_filename = "glib.h", default_value = "0")]
[IntegerType (rank = 11)]
public struct int32 {
......@@ -220,6 +236,7 @@ public struct int32 {
public string! to_string (string! format = "%i");
}
[SimpleType]
[CCode (cname = "guint32", cheader_filename = "glib.h", default_value = "0U")]
[IntegerType (rank = 12)]
public struct uint32 {
......@@ -233,6 +250,7 @@ public struct uint32 {
public string! to_string (string! format = "%u");
}
[SimpleType]
[CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64", get_value_function = "g_value_get_int64", set_value_function = "g_value_set_int64", default_value = "0LL")]
[IntegerType (rank = 16)]
public struct int64 {
......@@ -246,6 +264,7 @@ public struct int64 {
public string! to_string (string! format = "%lli");
}
[SimpleType]
[CCode (cname = "guint64", cheader_filename = "glib.h", type_id = "G_TYPE_UINT64", marshaller_type_name = "UINT64", get_value_function = "g_value_get_uint64", set_value_function = "g_value_set_uint64", default_value = "0ULL")]
[IntegerType (rank = 17)]
public struct uint64 {
......@@ -259,6 +278,7 @@ public struct uint64 {
public string! to_string (string! format = "%llu");
}
[SimpleType]
[CCode (cname = "float", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_FLOAT", marshaller_type_name = "FLOAT", get_value_function = "g_value_get_float", set_value_function = "g_value_set_float", default_value = "0.0F")]
[FloatingType (rank = 1)]
public struct float {
......@@ -302,6 +322,7 @@ public struct float {
public string! to_string (string! format = "%g");
}
[SimpleType]
[CCode (cname = "double", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_DOUBLE", marshaller_type_name = "DOUBLE", get_value_function = "g_value_get_double", set_value_function = "g_value_set_double", default_value = "0.0")]
[FloatingType (rank = 2)]
public struct double {
......@@ -345,6 +366,7 @@ public struct double {
public string! to_string (string! format = "%g");
}
[SimpleType]
[CCode (cname = "gunichar", cprefix = "g_unichar_", cheader_filename = "glib.h", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0U")]
[IntegerType (rank = 13)]
public struct unichar {
......@@ -543,7 +565,7 @@ public class string {
[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h")]
namespace GLib {
[CCode (type_id = "G_TYPE_GTYPE")]
public struct Type {
public struct Type : ulong {
[CCode (cname