]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
glib-2.0: add support for gintptr and guintptr types
authorThomas Martitz <kugel@rockbox.org>
Mon, 14 Dec 2015 09:10:28 +0000 (10:10 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Sat, 26 Dec 2015 09:39:19 +0000 (10:39 +0100)
Modelled after existing size_t/ssize_t support, i.e. aliased to long/ulong.
Must be fixed for proper win32 support.

Fixes bug 759437

vapi/glib-2.0.vapi

index e880fef73ab26641493739585a659839e8f0135b..2fe44520e474ffb9e12e75aa6e0117dfd0c4c365 100644 (file)
@@ -349,6 +349,61 @@ public struct ssize_t {
        public ssize_t clamp (ssize_t low, ssize_t high);
 }
 
+[SimpleType]
+[GIR (name = "gulong")]
+[CCode (cname = "guintptr", 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 = 9)]
+public struct uintptr {
+       [CCode (cname = "0UL")]
+       public const ulong MIN;
+       [CCode (cname = "G_MAXSIZE")]
+       public const ulong MAX;
+
+       [CCode (cname = "G_GUINTPTR_FORMAT")]
+       public const string FORMAT;
+       [CCode (cname = "G_GINTPTR_MODIFIER")]
+       public const string FORMAT_MODIFIER;
+
+       [CCode (cname = "g_strdup_printf", instance_pos = -1)]
+       public string to_string (string format = "%" + FORMAT);
+
+       [CCode (cname = "GSIZE_TO_POINTER")]
+       public void* to_pointer ();
+
+       [CCode (cname = "MIN")]
+       public static uintptr min (uintptr a, uintptr b);
+       [CCode (cname = "MAX")]
+       public static uintptr max (uintptr a, uintptr b);
+       [CCode (cname = "CLAMP")]
+       public uintptr clamp (uintptr low, uintptr high);
+}
+
+[SimpleType]
+[GIR (name = "glong")]
+[CCode (cname = "gintptr", 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 = 8)]
+public struct intptr {
+       [CCode (cname = "G_MINSSIZE")]
+       public const long MIN;
+       [CCode (cname = "G_MAXSSIZE")]
+       public const long MAX;
+
+       [CCode (cname = "G_GINTPTR_FORMAT")]
+       public const string FORMAT;
+       [CCode (cname = "G_GINTPTR_MODIFIER")]
+       public const string FORMAT_MODIFIER;
+
+       [CCode (cname = "g_strdup_printf", instance_pos = -1)]
+       public string to_string (string format = "%" + FORMAT);
+
+       [CCode (cname = "MIN")]
+       public static intptr min (intptr a, intptr b);
+       [CCode (cname = "MAX")]
+       public static intptr max (intptr a, intptr b);
+       [CCode (cname = "CLAMP")]
+       public intptr clamp (intptr low, intptr high);
+}
+
 [SimpleType]
 [GIR (name = "gint8")]
 [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")]