>From 1bedb9c1c2c4a9240f1d0fa37d046f1298bd4a19 Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Fri, 26 Jun 2009 10:37:04 +0800 Subject: [PATCH] type_id_const for glib internal types --- vapi/glib-2.0.vapi | 40 ++++++++++++++++++++-------------------- vapi/gobject-2.0.vapi | 10 +++++----- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index 56e8839..b08ec31 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -29,7 +29,7 @@ */ [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", type_signature = "b")] +[CCode (cname = "gboolean", cheader_filename = "glib.h", type_id = "G_TYPE_BOOLEAN", type_id_const = true, marshaller_type_name = "BOOLEAN", get_value_function = "g_value_get_boolean", set_value_function = "g_value_set_boolean", default_value = "FALSE", type_signature = "b")] [BooleanType] public struct bool { public string to_string () { @@ -42,7 +42,7 @@ public struct bool { } [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\'", type_signature = "y")] +[CCode (cname = "gchar", cprefix = "g_ascii_", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", type_id_const = true, marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "\'\\0\'", type_signature = "y")] [IntegerType (rank = 2, min = 0, max = 127)] public struct char { [CCode (cname = "g_strdup_printf", instance_pos = -1)] @@ -72,7 +72,7 @@ public struct char { } [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\'")] +[CCode (cname = "guchar", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", type_id_const = true, marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "\'\\0\'")] [IntegerType (rank = 3, min = 0, max = 255)] public struct uchar { [CCode (cname = "g_strdup_printf", instance_pos = -1)] @@ -123,7 +123,7 @@ public struct int { } [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", type_signature = "u")] +[CCode (cname = "guint", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", type_id_const = true, marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "u")] [IntegerType (rank = 7)] public struct uint { [CCode (cname = "0")] @@ -196,7 +196,7 @@ public struct ushort { } [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")] +[CCode (cname = "glong", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", type_id_const = true, marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L")] [IntegerType (rank = 8)] public struct long { [CCode (cname = "G_MINLONG")] @@ -228,7 +228,7 @@ public struct long { } [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")] +[CCode (cname = "gulong", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", type_id_const = true, marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")] [IntegerType (rank = 9)] public struct ulong { [CCode (cname = "0UL")] @@ -258,7 +258,7 @@ public struct ulong { } [SimpleType] -[CCode (cname = "gsize", 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")] +[CCode (cname = "gsize", cheader_filename = "glib.h", type_id = "G_TYPE_ULONG", type_id_const = true, marshaller_type_name = "ULONG", get_value_function = "g_value_get_ulong", set_value_function = "g_value_set_ulong", default_value = "0UL")] [IntegerType (rank = 9)] public struct size_t { [CCode (cname = "0UL")] @@ -286,7 +286,7 @@ public struct size_t { } [SimpleType] -[CCode (cname = "gssize", 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")] +[CCode (cname = "gssize", cheader_filename = "glib.h", type_id = "G_TYPE_LONG", type_id_const = true, marshaller_type_name = "LONG", get_value_function = "g_value_get_long", set_value_function = "g_value_set_long", default_value = "0L")] [IntegerType (rank = 8)] public struct ssize_t { [CCode (cname = "G_MINSSIZE")] @@ -311,7 +311,7 @@ public struct ssize_t { } [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", type_signature = "y")] +[CCode (cname = "gint8", cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", type_id_const = true, marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char", default_value = "0", type_signature = "y")] [IntegerType (rank = 1, min = -128, max = 127)] public struct int8 { [CCode (cname = "G_MININT8")] @@ -331,7 +331,7 @@ public struct int8 { } [SimpleType] -[CCode (cname = "guint8", 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 = "0U", type_signature = "y")] +[CCode (cname = "guint8", cheader_filename = "glib.h", type_id = "G_TYPE_UCHAR", type_id_const = true, marshaller_type_name = "UCHAR", get_value_function = "g_value_get_uchar", set_value_function = "g_value_set_uchar", default_value = "0U", type_signature = "y")] [IntegerType (rank = 3, min = 0, max = 255)] public struct uint8 { [CCode (cname = "0U")] @@ -421,7 +421,7 @@ public struct uint16 { } [SimpleType] -[CCode (cname = "gint32", 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", type_signature = "i")] +[CCode (cname = "gint32", cheader_filename = "glib.h", type_id = "G_TYPE_INT", type_id_const = true, marshaller_type_name = "INT", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0", type_signature = "i")] [IntegerType (rank = 6)] public struct int32 { [CCode (cname = "G_MININT32")] @@ -456,7 +456,7 @@ public struct int32 { } [SimpleType] -[CCode (cname = "guint32", 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", type_signature = "u")] +[CCode (cname = "guint32", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", type_id_const = true, marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "u")] [IntegerType (rank = 7)] public struct uint32 { [CCode (cname = "0U")] @@ -491,7 +491,7 @@ public struct uint32 { } [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", type_signature = "x")] +[CCode (cname = "gint64", cheader_filename = "glib.h", type_id = "G_TYPE_INT64", type_id_const = true, marshaller_type_name = "INT64", get_value_function = "g_value_get_int64", set_value_function = "g_value_set_int64", default_value = "0LL", type_signature = "x")] [IntegerType (rank = 10)] public struct int64 { [CCode (cname = "G_MININT64")] @@ -528,7 +528,7 @@ public struct int64 { } [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", type_signature = "t")] +[CCode (cname = "guint64", cheader_filename = "glib.h", type_id = "G_TYPE_UINT64", type_id_const = true, marshaller_type_name = "UINT64", get_value_function = "g_value_get_uint64", set_value_function = "g_value_set_uint64", default_value = "0ULL", type_signature = "t")] [IntegerType (rank = 11)] public struct uint64 { [CCode (cname = "0ULL")] @@ -563,7 +563,7 @@ public struct uint64 { } [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")] +[CCode (cname = "float", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_FLOAT", type_id_const = true, 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 { [CCode (cname = "FLT_MANT_DIG")] @@ -614,7 +614,7 @@ public struct float { } [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", type_signature = "d")] +[CCode (cname = "double", cheader_filename = "glib.h,float.h,math.h", type_id = "G_TYPE_DOUBLE", type_id_const = true, marshaller_type_name = "DOUBLE", get_value_function = "g_value_get_double", set_value_function = "g_value_set_double", default_value = "0.0", type_signature = "d")] [FloatingType (rank = 2)] public struct double { [CCode (cname = "DBL_MANT_DIG")] @@ -673,7 +673,7 @@ public struct time_t { } [SimpleType] -[CCode (cname = "gunichar", cprefix = "g_unichar_", 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", type_signature = "u")] +[CCode (cname = "gunichar", cprefix = "g_unichar_", cheader_filename = "glib.h", type_id = "G_TYPE_UINT", type_id_const = true, marshaller_type_name = "UINT", get_value_function = "g_value_get_uint", set_value_function = "g_value_set_uint", default_value = "0U", type_signature = "u")] [IntegerType (rank = 7)] public struct unichar { public bool validate (); @@ -800,7 +800,7 @@ public enum NormalizeMode { [Compact] [Immutable] -[CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", type_signature = "s")] +[CCode (cname = "char", const_cname = "const char", copy_function = "g_strdup", free_function = "g_free", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", type_id_const = true, marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string", type_signature = "s")] public class string { [CCode (cname = "strstr")] public weak string? str (string needle); @@ -3119,7 +3119,7 @@ namespace GLib { /* Hash Tables */ [Compact] - [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_signature = "a{%s}")] + [CCode (ref_function = "g_hash_table_ref", unref_function = "g_hash_table_unref", type_id = "G_TYPE_HASH_TABLE", type_id_const = true, type_signature = "a{%s}")] public class HashTable : Boxed { public HashTable (HashFunc? hash_func, EqualFunc? key_equal_func); public HashTable.full (HashFunc? hash_func, EqualFunc? key_equal_func, DestroyNotify? key_destroy_func, DestroyNotify? value_destroy_func); @@ -3168,7 +3168,7 @@ namespace GLib { /* Strings */ [Compact] - [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")] + [CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING", type_id_const = true)] public class StringBuilder : Boxed { public StringBuilder (string init = ""); [CCode (cname = "g_string_sized_new")] diff --git a/vapi/gobject-2.0.vapi b/vapi/gobject-2.0.vapi index d902452..7815908 100644 --- a/vapi/gobject-2.0.vapi +++ b/vapi/gobject-2.0.vapi @@ -27,7 +27,7 @@ [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h")] namespace GLib { [SimpleType] - [CCode (type_id = "G_TYPE_GTYPE", marshaller_type_name = "GTYPE", get_value_function = "g_value_get_gtype", set_value_function = "g_value_set_gtype")] + [CCode (type_id = "G_TYPE_GTYPE", type_id_const = true, marshaller_type_name = "GTYPE", get_value_function = "g_value_get_gtype", set_value_function = "g_value_set_gtype")] [IntegerType (rank = 9)] public struct Type { [CCode (cname = "G_TYPE_IS_OBJECT")] @@ -172,7 +172,7 @@ namespace GLib { public static delegate void ObjectSetPropertyFunc (Object object, uint property_id, Value value, ParamSpec pspec); public static delegate void WeakNotify (void *data, Object object); - [CCode (ref_function = "g_object_ref", unref_function = "g_object_unref", marshaller_type_name = "OBJECT", get_value_function = "g_value_get_object", set_value_function = "g_value_set_object", param_spec_function = "g_param_spec_object", cheader_filename = "glib-object.h")] + [CCode (ref_function = "g_object_ref", unref_function = "g_object_unref", marshaller_type_name = "OBJECT", get_value_function = "g_value_get_object", set_value_function = "g_value_set_object", param_spec_function = "g_param_spec_object", cheader_filename = "glib-object.h", type_id_const = true)] public class Object { public uint ref_count; @@ -254,13 +254,13 @@ namespace GLib { } [Compact] - [CCode (cname = "gpointer", has_type_id = true, type_id = "G_TYPE_BOXED", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed")] + [CCode (cname = "gpointer", has_type_id = true, type_id = "G_TYPE_BOXED", type_id_const = true, marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed")] public abstract class Boxed { } public static delegate void ValueTransform (Value src_value, out Value dest_value); - [CCode (copy_function = "g_value_copy", destroy_function = "g_value_unset", type_id = "G_TYPE_VALUE", marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "v")] + [CCode (copy_function = "g_value_copy", destroy_function = "g_value_unset", type_id = "G_TYPE_VALUE", type_id_const = true, marshaller_type_name = "BOXED", get_value_function = "g_value_get_boxed", set_value_function = "g_value_set_boxed", type_signature = "v")] public struct Value { [CCode (cname = "G_VALUE_HOLDS")] public bool holds (Type type); @@ -360,7 +360,7 @@ namespace GLib { public static delegate void ClosureNotify (void* data, Closure closure); [Compact] - [CCode (type_id = "G_TYPE_VALUE_ARRAY")] + [CCode (type_id = "G_TYPE_VALUE_ARRAY", type_id_const = true)] public class ValueArray : Boxed { public uint n_values; public Value[] values; -- 1.6.0.6