From: Thomas Martitz Date: Mon, 14 Dec 2015 09:10:28 +0000 (+0100) Subject: glib-2.0: add support for gintptr and guintptr types X-Git-Tag: 0.31.1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b8a50320e33dc84dcd7c7e11539c2eab0bb43bd;p=thirdparty%2Fvala.git glib-2.0: add support for gintptr and guintptr types Modelled after existing size_t/ssize_t support, i.e. aliased to long/ulong. Must be fixed for proper win32 support. Fixes bug 759437 --- diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index e880fef73..2fe44520e 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -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")]