Commit 61934ac1 authored by Raffaele Sandrini's avatar Raffaele Sandrini Committed by Raffaele Sandrini

add get and set value support add user (arbitrary) signal support

2006-10-06  Raffaele Sandrini  <rasa@gmx.ch>

	* vapi/glib-2.0.vala, vala/valaflags.vala, vala/valaenum.vala,
	  vala/valadatatype.vala, vala/valaarray.vala, vala/valaclass.vala,
	  vala/valastruct.vala: add get and set value support
	* vala/valacodegenerator.vala: add user (arbitrary) signal support
	* vala/valadatatype.vala, vala/valamemorymanager.vala,
	  vala/valastruct.vala: correctly honor ref types in type arguments
	* ccode/valaccodedeclaration.vala, ccode/valaccodemodifiers.vala:
	  support register local variables
	* ccode/valaccodememberaccess.vala: make one line creation possible
	* vapi/glib-2.0.vala: fix return type of Glib.List.nth_data
	* tests/test-024.vala: add user signal test
	* tests/Makefile.am: update

svn path=/trunk/; revision=143
parent 470d5004
2006-10-06 Raffaele Sandrini <rasa@gmx.ch>
* vapi/glib-2.0.vala, vala/valaflags.vala, vala/valaenum.vala,
vala/valadatatype.vala, vala/valaarray.vala, vala/valaclass.vala,
vala/valastruct.vala: add get and set value support
* vala/valacodegenerator.vala: add user (arbitrary) signal support
* vala/valadatatype.vala, vala/valamemorymanager.vala,
vala/valastruct.vala: correctly honor ref types in type arguments
* ccode/valaccodedeclaration.vala, ccode/valaccodemodifiers.vala:
support register local variables
* ccode/valaccodememberaccess.vala: make one line creation possible
* vapi/glib-2.0.vala: fix return type of Glib.List.nth_data
* tests/test-024.vala: add user signal test
* tests/Makefile.am: update
2006-10-05 Jürg Billeter <j@bitron.ch>
* vala/parser.y, vala/valasemanticanalyzer.vala: complete support for
......
......@@ -56,6 +56,9 @@ public class Vala.CCodeDeclaration : CCodeStatement {
if ((modifiers & CCodeModifiers.STATIC) == CCodeModifiers.STATIC) {
writer.write_string ("static ");
}
if ((modifiers & CCodeModifiers.REGISTER) == CCodeModifiers.REGISTER) {
writer.write_string ("register ");
}
writer.write_string (type_name);
writer.write_string (" ");
......
......@@ -41,9 +41,10 @@ public class Vala.CCodeMemberAccess : CCodeExpression {
*/
public bool is_pointer { get; set; }
public construct (CCodeExpression! container, string! member) {
public construct (CCodeExpression! container, string! member, bool pointer = false) {
inner = container;
member_name = member;
is_pointer = pointer;
}
public construct pointer (CCodeExpression! container, string! member) {
......
/* valaccodemodifiers.vala
*
* Copyright (C) 2006 Jürg Billeter
* Copyright (C) 2006 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
......@@ -18,11 +18,13 @@
*
* Author:
* Jürg Billeter <j@bitron.ch>
* Raffaele Sandrini <rasa@gmx.ch>
*/
using GLib;
public enum /* flags */ Vala.CCodeModifiers {
NONE,
STATIC
STATIC,
REGISTER
}
......@@ -24,4 +24,5 @@ EXTRA_DIST = \
test-021.vala \
test-022.vala \
test-023.vala \
test-024.vala \
$(NULL)
using GLib;
class Maman.Foo {
public signal void activated (int i1, int i2);
public void do_action () {
activated (6, -2);
}
}
class Maman.Bar {
public void run () {
stdout.printf (" 2");
var foo = new Foo ();
foo.activated += (foo, i1, i2) => {
stdout.printf (" %d", i1 + i2);
};
stdout.printf (" 3");
foo.do_action ();
stdout.printf (" 5");
}
static int main (string[] args) {
stdout.printf ("User Signal Test: 1");
var bar = new Bar ();
bar.run ();
stdout.printf (" 6\n");
return 0;
}
}
......@@ -143,4 +143,16 @@ public class Vala.Array : DataType {
public override ref List<string> get_cheader_filenames () {
return element_type.get_cheader_filenames ();
}
public override string get_marshaller_type_name () {
return "POINTER";
}
public override string get_get_value_function () {
return "g_value_get_pointer";
}
public override string get_set_value_function () {
return "g_value_set_pointer";
}
}
......@@ -346,6 +346,14 @@ public class Vala.Class : DataType {
return "OBJECT";
}
public override string get_get_value_function () {
return "g_value_get_object";
}
public override string get_set_value_function () {
return "g_value_set_object";
}
public override bool is_reference_counting () {
return true;
}
......
......@@ -46,9 +46,11 @@ public class Vala.CodeGenerator : CodeVisitor {
CCodeFragment source_begin;
CCodeFragment source_include_directives;
CCodeFragment source_type_member_declaration;
CCodeFragment source_signal_marshaller_declaration;
CCodeFragment source_type_member_definition;
CCodeFragment instance_init_fragment;
CCodeFragment instance_dispose_fragment;
CCodeFragment source_signal_marshaller_definition;
CCodeStruct instance_struct;
CCodeStruct type_struct;
......@@ -62,6 +64,10 @@ public class Vala.CodeGenerator : CodeVisitor {
List<VariableDeclarator> temp_vars;
/* temporary variables that own their content */
List<VariableDeclarator> temp_ref_vars;
/* cache to check whether a certain marshaller has been created yet */
HashTable<string,bool> user_marshal_list;
/* (constant) hash table with all predefined marshallers */
HashTable<string,bool> predefined_marshal_list;
private int next_temp_var_id = 0;
......@@ -85,6 +91,26 @@ public class Vala.CodeGenerator : CodeVisitor {
public construct (bool manage_memory = true) {
memory_management = manage_memory;
predefined_marshal_list = new HashTable (str_hash, str_equal);
predefined_marshal_list.insert ("VOID:VOID", true);
predefined_marshal_list.insert ("VOID:BOOLEAN", true);
predefined_marshal_list.insert ("VOID:CHAR", true);
predefined_marshal_list.insert ("VOID:UCHAR", true);
predefined_marshal_list.insert ("VOID:INT", true);
predefined_marshal_list.insert ("VOID:UINT", true);
predefined_marshal_list.insert ("VOID:LONG", true);
predefined_marshal_list.insert ("VOID:ULONG", true);
predefined_marshal_list.insert ("VOID:ENUM", true);
predefined_marshal_list.insert ("VOID:FLAGS", true);
predefined_marshal_list.insert ("VOID:FLOAT", true);
predefined_marshal_list.insert ("VOID:DOUBLE", true);
predefined_marshal_list.insert ("VOID:STRING", true);
predefined_marshal_list.insert ("VOID:POINTER", true);
predefined_marshal_list.insert ("VOID:OBJECT", true);
predefined_marshal_list.insert ("STRING:OBJECT,POINTER", true);
predefined_marshal_list.insert ("VOID:UINT,POINTER", true);
predefined_marshal_list.insert ("BOOLEAN:FLAGS", true);
}
/**
......@@ -171,6 +197,10 @@ public class Vala.CodeGenerator : CodeVisitor {
source_include_directives = new CCodeFragment ();
source_type_member_declaration = new CCodeFragment ();
source_type_member_definition = new CCodeFragment ();
source_signal_marshaller_definition = new CCodeFragment ();
source_signal_marshaller_declaration = new CCodeFragment ();
user_marshal_list = new HashTable (str_hash, str_equal);
next_temp_var_id = 0;
......@@ -291,8 +321,12 @@ public class Vala.CodeGenerator : CodeVisitor {
writer.write_newline ();
source_type_member_declaration.write (writer);
writer.write_newline ();
source_signal_marshaller_declaration.write (writer);
writer.write_newline ();
source_type_member_definition.write (writer);
writer.write_newline ();
source_signal_marshaller_definition.write (writer);
writer.write_newline ();
writer.close ();
header_begin = null;
......@@ -303,6 +337,8 @@ public class Vala.CodeGenerator : CodeVisitor {
source_include_directives = null;
source_type_member_declaration = null;
source_type_member_definition = null;
source_signal_marshaller_definition = null;
source_signal_marshaller_declaration = null;
}
public override void visit_begin_class (Class! cl) {
......@@ -519,7 +555,7 @@ public class Vala.CodeGenerator : CodeVisitor {
csignew.add_argument (new CCodeConstant ("NULL"));
/* TODO: generate marshallers */
string marshaller = "g_cclosure_marshal";
string marshaller = get_signal_marshaller_function (sig);
var marshal_arg = new CCodeIdentifier (marshaller);
csignew.add_argument (marshal_arg);
......@@ -527,22 +563,15 @@ public class Vala.CodeGenerator : CodeVisitor {
var params = sig.get_parameters ();
var params_len = params.length ();
if (sig.return_type.data_type == null) {
marshaller = "%s_VOID_".printf (marshaller);
csignew.add_argument (new CCodeConstant ("G_TYPE_NONE"));
} else {
marshaller = "%s_%s_".printf (marshaller, sig.return_type.data_type.get_marshaller_type_name ());
csignew.add_argument (new CCodeConstant (sig.return_type.data_type.get_type_id ()));
}
csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
foreach (FormalParameter param in params) {
marshaller = "%s_%s".printf (marshaller, param.type_reference.data_type.get_marshaller_type_name ());
csignew.add_argument (new CCodeConstant (param.type_reference.data_type.get_type_id ()));
}
if (params_len == 0) {
marshaller = "%s_VOID".printf (marshaller);
}
marshal_arg.name = marshaller;
init_block.add_statement (new CCodeExpressionStatement (csignew));
......@@ -1283,6 +1312,202 @@ public class Vala.CodeGenerator : CodeVisitor {
source_type_member_definition.append (function);
}
private string get_marshaller_type_name (DataType t) {
if (t == null) {
return ("VOID");
} else {
return t.get_marshaller_type_name ();
}
}
private ref string get_signal_marshaller_function (Signal! sig, string prefix = null) {
var signature = get_signal_signature (sig);
string ret;
var params = sig.get_parameters ();
if (prefix == null) {
if (predefined_marshal_list.lookup (signature) != null) {
prefix = "g_cclosure_marshal";
} else {
prefix = "g_cclosure_user_marshal";
}
}
ret = "%s_%s_".printf (prefix, get_marshaller_type_name (sig.return_type.data_type));
if (params == null) {
ret = ret + "_VOID";
} else {
foreach (FormalParameter p in params) {
ret = "%s_%s".printf (ret, get_marshaller_type_name (p.type_reference.data_type));
}
}
return ret;
}
private string get_value_type_name_from_datatype (DataType t) {
if (t == null) {
return "void";
} else if (t is Class) {
return "GObject *";
} else if (t is Struct) {
if (((Struct)t).is_reference_type ()) {
return "gpointer";
} else {
return t.get_cname ();
}
} else if (t is Enum) {
return "gint";
} else if (t is Flags) {
return "guint";
} else if (t is Array) {
return "gpointer";
}
return null;
}
private ref string get_signal_signature (Signal! sig) {
string signature;
var params = sig.get_parameters ();
signature = "%s:".printf (get_marshaller_type_name (sig.return_type.data_type));
if (params == null) {
signature = signature + "VOID";
} else {
bool first = true;
foreach (FormalParameter p in params) {
if (first) {
signature = signature + get_marshaller_type_name (p.type_reference.data_type);
first = false;
} else {
signature = "%s,%s".printf (signature, get_marshaller_type_name (p.type_reference.data_type));
}
}
}
return signature;
}
public override void visit_end_signal (Signal! sig) {
string signature;
var params = sig.get_parameters ();
int n_params, i;
/* check whether a signal with the same signature already exists for this source file (or predefined) */
signature = get_signal_signature (sig);
if (predefined_marshal_list.lookup (signature) != null || user_marshal_list.lookup (signature) != null) {
return;
}
var signal_marshaller = new CCodeFunction (get_signal_marshaller_function (sig), "void");
signal_marshaller.modifiers = CCodeModifiers.STATIC;
signal_marshaller.add_parameter (new CCodeFormalParameter ("closure", "GClosure *"));
signal_marshaller.add_parameter (new CCodeFormalParameter ("return_value", "GValue *"));
signal_marshaller.add_parameter (new CCodeFormalParameter ("n_param_values", "guint"));
signal_marshaller.add_parameter (new CCodeFormalParameter ("param_values", "const GValue *"));
signal_marshaller.add_parameter (new CCodeFormalParameter ("invocation_hint", "gpointer"));
signal_marshaller.add_parameter (new CCodeFormalParameter ("marshal_data", "gpointer"));
source_signal_marshaller_declaration.append (signal_marshaller.copy ());
var marshaller_body = new CCodeBlock ();
var callback_decl = new CCodeFunctionDeclarator (get_signal_marshaller_function (sig, "GMarshalFunc"));
callback_decl.add_parameter (new CCodeFormalParameter ("data1", "gpointer"));
n_params = 1;
foreach (FormalParameter p in params) {
callback_decl.add_parameter (new CCodeFormalParameter ("arg_%d".printf (n_params), get_value_type_name_from_datatype (p.type_reference.data_type)));
n_params++;
}
callback_decl.add_parameter (new CCodeFormalParameter ("data2", "gpointer"));
marshaller_body.add_statement (new CCodeTypeDefinition (get_value_type_name_from_datatype (sig.return_type.data_type), callback_decl));
var var_decl = new CCodeDeclaration (get_signal_marshaller_function (sig, "GMarshalFunc"));
var_decl.modifiers = CCodeModifiers.REGISTER;
var_decl.add_declarator (new CCodeVariableDeclarator ("callback"));
marshaller_body.add_statement (var_decl);
var_decl = new CCodeDeclaration ("GCClosure *");
var_decl.modifiers = CCodeModifiers.REGISTER;
var_decl.add_declarator (new CCodeVariableDeclarator.with_initializer ("cc", new CCodeCastExpression (new CCodeIdentifier ("closure"), "GCClosure *")));
marshaller_body.add_statement (var_decl);
var_decl = new CCodeDeclaration ("gpointer");
var_decl.modifiers = CCodeModifiers.REGISTER;
var_decl.add_declarator (new CCodeVariableDeclarator ("data1"));
var_decl.add_declarator (new CCodeVariableDeclarator ("data2"));
marshaller_body.add_statement (var_decl);
CCodeFunctionCall fc;
if (sig.return_type.data_type != null) {
var_decl = new CCodeDeclaration (get_value_type_name_from_datatype (sig.return_type.data_type));
var_decl.add_declarator (new CCodeVariableDeclarator ("v_return"));
marshaller_body.add_statement (var_decl);
fc = new CCodeFunctionCall (new CCodeIdentifier ("g_return_if_fail"));
fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.INEQUALITY, new CCodeIdentifier ("return_value"), new CCodeConstant ("NULL")));
marshaller_body.add_statement (new CCodeExpressionStatement (fc));
}
fc = new CCodeFunctionCall (new CCodeIdentifier ("g_return_if_fail"));
fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, new CCodeIdentifier ("n_param_values"), new CCodeConstant (n_params.to_string())));
marshaller_body.add_statement (new CCodeExpressionStatement (fc));
var data = new CCodeMemberAccess (new CCodeIdentifier ("closure"), "data", true);
var param = new CCodeMemberAccess (new CCodeMemberAccess (new CCodeIdentifier ("param_values"), "data[0]", true), "v_pointer");
var cond = new CCodeFunctionCall (new CCodeConstant ("G_CCLOSURE_SWAP_DATA"));
cond.add_argument (new CCodeIdentifier ("closure"));
var true_block = new CCodeBlock ();
true_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("data1"), data)));
true_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("data2"), param)));
var false_block = new CCodeBlock ();
false_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("data1"), param)));
false_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("data2"), data)));
marshaller_body.add_statement (new CCodeIfStatement (cond, true_block, false_block));
var c_assign = new CCodeAssignment (new CCodeIdentifier ("callback"), new CCodeCastExpression (new CCodeConditionalExpression (new CCodeIdentifier ("marshal_data"), new CCodeIdentifier ("marshal_data"), new CCodeMemberAccess (new CCodeIdentifier ("cc"), "callback", true)), get_signal_marshaller_function (sig, "GMarshalFunc")));
marshaller_body.add_statement (new CCodeExpressionStatement (c_assign));
fc = new CCodeFunctionCall (new CCodeIdentifier ("callback"));
fc.add_argument (new CCodeIdentifier ("data1"));
i = 1;
foreach (FormalParameter p in params) {
var inner_fc = new CCodeFunctionCall (new CCodeIdentifier (p.type_reference.data_type.get_get_value_function ()));
inner_fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("param_values"), new CCodeIdentifier (i.to_string ())));
fc.add_argument (inner_fc);
i++;
}
fc.add_argument (new CCodeIdentifier ("data2"));
if (sig.return_type.data_type != null) {
marshaller_body.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeIdentifier ("v_return"), fc)));
CCodeFunctionCall set_fc;
if (sig.return_type.data_type is Class) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_object"));
} else if (sig.return_type.data_type == string_type.data_type) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_string"));
} else {
set_fc = new CCodeFunctionCall (new CCodeIdentifier (sig.return_type.data_type.get_set_value_function ()));
}
set_fc.add_argument (new CCodeIdentifier ("return_value"));
set_fc.add_argument (new CCodeIdentifier ("v_return"));
marshaller_body.add_statement (new CCodeExpressionStatement (set_fc));
} else {
marshaller_body.add_statement (new CCodeExpressionStatement (fc));
}
signal_marshaller.block = marshaller_body;
source_signal_marshaller_definition.append (signal_marshaller);
user_marshal_list.insert (signature, true);
}
public override void visit_end_constructor (Constructor! c) {
var cl = (Class) c.symbol.parent_symbol.node;
......
......@@ -149,6 +149,20 @@ public abstract class Vala.DataType : CodeNode {
return null;
}
/**
* Returns the cname of the GValue getter function,
*/
public virtual string get_get_value_function () {
return null;
}
/**
* Returns the cname of the GValue setter function,
*/
public virtual string get_set_value_function () {
return null;
}
/**
* Returns the C name of this data type in upper case. Words are
* separated by underscores. The upper case C name of the namespace is
......@@ -242,4 +256,11 @@ public abstract class Vala.DataType : CodeNode {
public virtual bool is_subtype_of (DataType! t) {
return false;
}
/**
* Return the index of the specified type parameter name.
*/
public virtual int get_type_parameter_index (string! name) {
return -1;
}
}
......@@ -151,4 +151,16 @@ public class Vala.Enum : DataType {
// FIXME: use GType-registered enums
return "G_TYPE_INT";
}
public override string get_marshaller_type_name () {
return "ENUM";
}
public override string get_get_value_function () {
return "g_value_get_enum";
}
public override string get_set_value_function () {
return "g_value_set_enum";
}
}
......@@ -74,4 +74,16 @@ public class Vala.Flags : DataType {
public override bool is_reference_type () {
return false;
}
public override string get_marshaller_type_name () {
return "FLAGS";
}
public override string get_get_value_function () {
return "g_value_get_flags";
}
public override string get_set_value_function () {
return "g_value_set_flags";
}
}
......@@ -153,10 +153,12 @@ public class Vala.MemoryManager : CodeVisitor {
if (is_ref && param.type_reference.type_parameter != null) {
if (expr.call is MemberAccess) {
var instance_type = ((MemberAccess) expr.call).inner.static_type;
foreach (TypeReference type_arg in instance_type.get_type_arguments ()) {
/* generic method parameters may only be strong references if the type argument is strong, too */
is_ref = type_arg.takes_ownership;
var param_index = instance_type.data_type.get_type_parameter_index (param.type_reference.type_parameter.name);
if (param_index == -1) {
Report.error (arg.source_reference, "Internal Error: No actual parameter found for `%s' in `%s'".printf (param.name, instance_type.data_type.symbol.get_full_name ()));
return;
}
is_ref = ((TypeReference)instance_type.get_type_arguments ().nth_data (param_index)).takes_ownership;
}
}
......
......@@ -44,6 +44,8 @@ public class Vala.Struct : DataType {
private bool floating_type;
private int rank;
private string marshaller_type_name;
private string get_value_function;
private string set_value_function;
/**
* Specifies the default construction method.
......@@ -266,6 +268,22 @@ public class Vala.Struct : DataType {
set_marshaller_type_name (((StringLiteral) lit).eval ());
}
}
} else if (arg.name == "get_value_function") {
/* this will already be checked during semantic analysis */
if (arg.argument is LiteralExpression) {
var lit = ((LiteralExpression) arg.argument).literal;
if (lit is StringLiteral) {
set_get_value_function (((StringLiteral) lit).eval ());
}
}
} else if (arg.name == "set_value_function") {
/* this will already be checked during semantic analysis */
if (arg.argument is LiteralExpression) {
var lit = ((LiteralExpression) arg.argument).literal;
if (lit is StringLiteral) {
set_set_value_function (((StringLiteral) lit).eval ());
}
}
}
}
}
......@@ -387,6 +405,38 @@ public class Vala.Struct : DataType {
private void set_marshaller_type_name (string! name) {
this.marshaller_type_name = name;
}
public override string get_get_value_function () {
if (get_value_function == null) {
if (is_reference_type ()) {
return "g_value_get_pointer";
} else {
Report.error (source_reference, "The value type `%s` doesn't declare a GValue get function".printf (symbol.get_full_name ()));
}
} else {
return get_value_function;
}
}
public override string get_set_value_function () {
if (set_value_function == null) {
if (is_reference_type ()) {
return "g_value_set_pointer";
} else {
Report.error (source_reference, "The value type `%s` doesn't declare a GValue set function".printf (symbol.get_full_name ()));
}
} else {
return set_value_function;
}
}
private void set_get_value_function (string! function) {
get_value_function = function;
}
private void set_set_value_function (string! function) {
set_value_function = function;
}
/**
* Adds the specified struct to the list of base types of this struct.
......@@ -405,4 +455,17 @@ public class Vala.Struct : DataType {
public ref List<weak TypeReference> get_base_types () {
return base_types.copy ();
}
public override int get_type_parameter_index (string! name) {
int i = 0;
foreach (TypeParameter p in type_parameters) {
if (p.name == name) {
return (i);
}
i++;
}
return -1;
}
}
......@@ -21,15 +21,15 @@
* Raffaele Sandrini <rasa@gmx.ch>
*/
[CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", marshaller_type_name = "BOOLEAN")]
[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")]
public struct bool {
}
[CCode (cname = "gpointer", cheader_filename = "glib.h", type_id = "G_TYPE_POINTER", marshaller_type_name = "POINTER")]
[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")]
public struct pointer {
}
[CCode (cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR")]
[CCode (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")]
[IntegerType (rank = 1)]
public struct char {
[InstanceLast ()]
......@@ -37,7 +37,7 @@ public struct char {
public ref string! to_string (string! format = "%hhi");
}
[CCode (cname = "unsigned char", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", marshaller_type_name = "UCHAR")]
[CCode (cname = "unsigned char", 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")]
[IntegerType (rank = 2)]
public struct uchar {
[InstanceLast ()]
......@@ -45,7 +45,7 @@ public struct uchar {
public ref string! to_string (string! format = "%hhu");
}
[CCode (cheader_filename = "glib.h", type_id = "G_TYPE_INT", marshaller_type_name = "INT")]
[CCode (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")]
[IntegerType (rank = 7)]
public struct int {
[InstanceLast ()]
......@@ -53,7 +53,7 @@ public struct int {
public ref string! to_string (string! format = "%i");
}
[CCode (cname = "unsigned int", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", marshaller_type_name = "UINT")]
[CCode (cname = "unsigned int", 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")]
[IntegerType (rank = 8)]
public struct uint {
[InstanceLast ()]
......@@ -77,7 +77,7 @@ public struct ushort {
public ref string! to_string (string! format = "%hu");
}
[CCode (cheader_filename = "glib.h", type_id = "G_TYPE_LONG", marshaller_type_name = "LONG")]
[CCode (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")]
[IntegerType (rank = 12)]
public struct long {
[InstanceLast ()]
......@@ -85,7 +85,7 @@ public struct long {
public ref string! to_string (string! format = "%li");
}
[CCode (cname = "unsigned long", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", marshaller_type_name = "ULONG")]
[CCode (cname = "unsigned long", 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")]
[IntegerType (rank = 13)]
public struct ulong {
[InstanceLast ()]
......@@ -113,7 +113,7 @@ public struct int32 {
public struct uint32 {
}
[CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", marshaller_type_name = "INT64")]
[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")]
[IntegerType (rank = 14)]
public struct int64 {
[InstanceLast ()]
......@@ -121,7 +121,7 @@ public struct int64 {
public ref string! to_string (string! format = "%lli");
}
[CCode (cname = "guint64", cheader_filename = "glib.h", type_id = "G_TYPE_UINT64", marshaller_type_name = "UINT64")]
[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")]
[IntegerType (rank = 15)]
public struct uint64 {
[InstanceLast ()]
......@@ -129,17 +129,17 @@ public struct uint64 {
public ref string! to_string (string! format = "%llu");
}
[CCode (cname = "float", cheader_filename = "glib.h", type_id = "G_TYPE_FLOAT", marshaller_type_name = "FLOAT")]
[CCode (cname = "float", cheader_filename = "glib.h", type_id = "G_TYPE_FLOAT", marshaller_type_name = "FLOAT", get_value_function = "g_value_get_float", set_value_function = "g_value_set_float")]
[FloatingType (rank = 1)]
public struct float {
}
[CCode (cname = "double", cheader_filename = "glib.h", type_id = "G_TYPE_DOUBLE", marshaller_type_name = "DOUBLE")]
[CCode (cname = "double", cheader_filename = "glib.h", type_id = "G_TYPE_DOUBLE", marshaller_type_name = "DOUBLE", get_value_function = "g_value_get_double", set_value_function = "g_value_set_double")]
[FloatingType (rank = 2)]
public struct double {
}