From 2315700f868a19c2301ffc8891264888656ba6a5 Mon Sep 17 00:00:00 2001 From: David PIROTTE Date: Thu, 3 Jul 2014 15:22:32 -0300 Subject: [PATCH 8/9] fix missing some basic pointer types * glib/gnome/gw/glib-spec.scm: guint8*, guchar*, gunichar*, gunichar2* added and wrapped as opaque pointers. * glib/gnome/gw/glib-support.h: * glib/gnome/gw/glib-support.c: standard coding style changes, end of line white space removed. --- glib/gnome/gw/glib-spec.scm | 16 +++++++++++----- glib/gnome/gw/glib-support.c | 35 ++++++++++++++++++++++------------- glib/gnome/gw/glib-support.h | 11 +++++------ 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/glib/gnome/gw/glib-spec.scm b/glib/gnome/gw/glib-spec.scm index f99fd6a..b8f6817 100644 --- a/glib/gnome/gw/glib-spec.scm +++ b/glib/gnome/gw/glib-spec.scm @@ -74,6 +74,7 @@ ("void" void . #f) ("int" int) ("char" char . #f) + ("char*" mchars . #f) ("float" float) ("double" double) ("short" short) @@ -101,15 +102,14 @@ ;; GLib type aliases ("gboolean" bool) ("gchar" char . #f) - ("guchar" unsigned-char . #f) - ("char*" mchars . #f) ("gchar*" mchars . #f) + ("guchar" unsigned-char . #f) ("gdouble" double) ("gfloat" float) ("gshort" short) ("gushort" unsigned-short) ("gint8" int8) - ("guint8" unsigned-int8) + ("guint8" unsigned-int8 . #f) ("gint" int) ("gint16" int16) ("guint" unsigned-int) @@ -129,13 +129,19 @@ ("gssize" ssize_t) ("gsize" size_t) - ("gunichar" unsigned-int32) - + ("gunichar" unsigned-int32 . #f) + ("gunichar2" unsigned-int16 . #f) + ("none" void . #f))) (add-type-rule! ws "gchar**" '(mchars caller-owned out)) (add-type-rule! ws "const-gchar**" '(mchars callee-owned out)) + (wrap-opaque-pointer! ws "guint8*") + (wrap-opaque-pointer! ws "guchar*") + (wrap-opaque-pointer! ws "gunichar*") + (wrap-opaque-pointer! ws "gunichar2*") + (add-type! ws (make #:name 'glist-of #:type-cname "GList*" #:func-prefix "g_list")) (add-type-alias! ws "GList*" 'glist-of) diff --git a/glib/gnome/gw/glib-support.c b/glib/gnome/gw/glib-support.c index 0776d29..09dd3e4 100644 --- a/glib/gnome/gw/glib-support.c +++ b/glib/gnome/gw/glib-support.c @@ -348,47 +348,56 @@ _wrap_g_utf8_strrchr (const gchar *p, gunichar c) return g_utf8_strrchr (p, -1, c); } -char* _wrap_g_utf8_strreverse (const gchar *p) +char* +_wrap_g_utf8_strreverse (const gchar *p) { return g_utf8_strreverse (p, -1); } -gboolean _wrap_g_utf8_validate (const gchar *p) +gboolean +_wrap_g_utf8_validate (const gchar *p) { return g_utf8_validate (p, -1, NULL); } -char* _wrap_g_utf8_strup (const gchar *p) +char* +_wrap_g_utf8_strup (const gchar *p) { return g_utf8_strup (p, -1); } -char* _wrap_g_utf8_strdown (const gchar *p) +char* +_wrap_g_utf8_strdown (const gchar *p) { return g_utf8_strdown (p, -1); } -char* _wrap_g_utf8_casefold (const gchar *p) +char* +_wrap_g_utf8_casefold (const gchar *p) { return g_utf8_casefold (p, -1); } -char* _wrap_g_utf8_normalize (const gchar *p, GNormalizeMode mode) +char* +_wrap_g_utf8_normalize (const gchar *p, GNormalizeMode mode) { return g_utf8_normalize (p, -1, mode); } -char* _wrap_g_utf8_collate_key (const gchar *p) +char* +_wrap_g_utf8_collate_key (const gchar *p) { return g_utf8_collate_key (p, -1); } -char* _wrap_g_utf8_collate_key_for_filename (const gchar *p) +char* +_wrap_g_utf8_collate_key_for_filename (const gchar *p) { return g_utf8_collate_key_for_filename (p, -1); } -char* _wrap_g_unichar_to_utf8 (gunichar c) +char* +_wrap_g_unichar_to_utf8 (gunichar c) { char *ret; int n; @@ -412,25 +421,25 @@ _wrap_g_utf8_to_ucs4 (const gchar *str, GError **error) } gunichar* -_wrap_g_utf16_to_ucs4 (const gunichar2* str, GError **error) +_wrap_g_utf16_to_ucs4 (const gunichar2 *str, GError **error) { return g_utf16_to_ucs4 (str, -1, NULL, NULL, error); } gchar* -_wrap_g_utf16_to_utf8 (const gunichar2* str, GError **error) +_wrap_g_utf16_to_utf8 (const gunichar2 *str, GError **error) { return g_utf16_to_utf8 (str, -1, NULL, NULL, error); } gunichar2* -_wrap_g_ucs4_to_utf16 (const gunichar* str, GError **error) +_wrap_g_ucs4_to_utf16 (const gunichar *str, GError **error) { return g_ucs4_to_utf16 (str, -1, NULL, NULL, error); } gchar* -_wrap_g_ucs4_to_utf8 (const gunichar* str, GError **error) +_wrap_g_ucs4_to_utf8 (const gunichar *str, GError **error) { return g_ucs4_to_utf8 (str, -1, NULL, NULL, error); } diff --git a/glib/gnome/gw/glib-support.h b/glib/gnome/gw/glib-support.h index 16b4571..c82c790 100644 --- a/glib/gnome/gw/glib-support.h +++ b/glib/gnome/gw/glib-support.h @@ -52,8 +52,7 @@ SCM _wrap_g_string_get_str (GString *str); guint _wrap_g_io_add_watch (GIOChannel *channel, GIOCondition condition, SCM func); GIOStatus _wrap_g_io_channel_read_line (GIOChannel *channel, gchar **str_return, GError **error); -gunichar -_wrap_g_utf8_get_char (const gchar *p); +gunichar _wrap_g_utf8_get_char (const gchar *p); const char* _wrap_g_utf8_find_next_char (const gchar *p); long _wrap_g_utf8_strlen (const gchar *p); const char* _wrap_g_utf8_strchr (const gchar *p, gunichar c); @@ -69,10 +68,10 @@ char* _wrap_g_utf8_collate_key_for_filename (const gchar *p); char* _wrap_g_unichar_to_utf8 (gunichar c); gunichar2* _wrap_g_utf8_to_utf16 (const gchar *str, GError **error); gunichar* _wrap_g_utf8_to_ucs4 (const gchar *str, GError **error); -gunichar* _wrap_g_utf16_to_ucs4 (const gunichar2* str, GError **error); -gchar* _wrap_g_utf16_to_utf8 (const gunichar2* str, GError **error); -gunichar2* _wrap_g_ucs4_to_utf16 (const gunichar* str, GError **error); -gchar* _wrap_g_ucs4_to_utf8 (const gunichar* str, GError **error); +gunichar* _wrap_g_utf16_to_ucs4 (const gunichar2 *str, GError **error); +gchar* _wrap_g_utf16_to_utf8 (const gunichar2 *str, GError **error); +gunichar2* _wrap_g_ucs4_to_utf16 (const gunichar *str, GError **error); +gchar* _wrap_g_ucs4_to_utf8 (const gunichar *str, GError **error); G_END_DECLS -- 2.0.0