[glib] Add G_G[U]INTPTR_FORMAT and G_GINTPTR_MODIFIER



commit fc9a888b8cb8b16f093caa5d5faf4057fad1c0ef
Author: Christian Persch <chpe gnome org>
Date:   Tue Jan 27 20:39:37 2009 +0100

    Add G_G[U]INTPTR_FORMAT and G_GINTPTR_MODIFIER
    
    Add macros for printf formatting for g[u]intptr. Bug 569376.
---
 configure.in                              |   16 ++++++++++++++++
 docs/reference/glib/glib-sections.txt     |    3 +++
 docs/reference/glib/tmpl/macros_misc.sgml |   26 ++++++++++++++++++++++++++
 docs/reference/glib/tmpl/types.sgml       |   12 ++++++++++++
 4 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/configure.in b/configure.in
index c9285fb..185a25f 100644
--- a/configure.in
+++ b/configure.in
@@ -2846,6 +2846,10 @@ _______EOF
 
 typedef signed $glib_intptr_type_define gintptr;
 typedef unsigned $glib_intptr_type_define guintptr;
+
+#define G_GINTPTR_MODIFIER      $gintptr_modifier
+#define G_GINTPTR_FORMAT        $gintptr_format
+#define G_GUINTPTR_FORMAT       $guintptr_format
 _______EOF
 	else
 	  echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
@@ -3225,21 +3229,33 @@ glongbits=`expr $ac_cv_sizeof_long \* 8`
 case $ac_cv_sizeof_void_p in
 $ac_cv_sizeof_int)
   glib_intptr_type_define=int
+  gintptr_modifier='""'
+  gintptr_format='"i"'
+  guintptr_format='"u"'
   glib_gpi_cast=''
   glib_gpui_cast=''
   ;;
 $ac_cv_sizeof_long)
   glib_intptr_type_define=long
+  gintptr_modifier='"l"'
+  gintptr_format='"li"'
+  guintptr_format='"lu"'
   glib_gpi_cast='(glong)'
   glib_gpui_cast='(gulong)'
   ;;
 $ac_cv_sizeof_long_long)
   glib_intptr_type_define='long long'
+  gintptr_modifier='"I64"'
+  gintptr_format='"I64i"'
+  guintptr_format='"I64u"'
   glib_gpi_cast='(gint64)'
   glib_gpui_cast='(guint64)'
   ;;
 $ac_cv_sizeof___int64)
   glib_intptr_type_define=__int64
+  gintptr_modifier='"I64"'
+  gintptr_format='"I64i"'
+  guintptr_format='"I64u"'
   glib_gpi_cast='(gint64)'
   glib_gpui_cast='(guint64)'
   ;;
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index b99f9b3..55370c2 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -372,6 +372,9 @@ G_GSIZE_FORMAT
 G_GSSIZE_FORMAT
 G_GOFFSET_MODIFIER
 G_GOFFSET_FORMAT
+G_GINTPTR_MODIFIER
+G_GINTPTR_FORMAT
+G_GUINTPTR_FORMAT
 
 <SUBSECTION Private>
 GLIB_VAR
diff --git a/docs/reference/glib/tmpl/macros_misc.sgml b/docs/reference/glib/tmpl/macros_misc.sgml
index 9dbd65c..4a86158 100644
--- a/docs/reference/glib/tmpl/macros_misc.sgml
+++ b/docs/reference/glib/tmpl/macros_misc.sgml
@@ -626,4 +626,30 @@ printing values of type #goffset. See also #G_GINT64_FORMAT.
 Since: 2.20
 
 
+<!-- ##### MACRO G_GINTPTR_MODIFIER ##### -->
+<para>
+The platform dependent length modifier for conversion specifiers for scanning
+and printing values of type #gintptr or #guintptr. It is a string literal.
+</para>
+
+ Since: 2.22
+
+
+<!-- ##### MACRO G_GINTPTR_FORMAT ##### -->
+<para>
+This is the platform dependent conversion specifier for scanning and
+printing values of type #gintptr. 
+</para>
+
+ Since: 2.22
+
+
+<!-- ##### MACRO G_GUINTPTR_FORMAT ##### -->
+<para>
+This is the platform dependent conversion specifier for scanning and
+printing values of type #guintptr.
+</para>
+
+ Since: 2.22
+
 
diff --git a/docs/reference/glib/tmpl/types.sgml b/docs/reference/glib/tmpl/types.sgml
index 28ceea3..fc3111b 100644
--- a/docs/reference/glib/tmpl/types.sgml
+++ b/docs/reference/glib/tmpl/types.sgml
@@ -271,6 +271,10 @@ To print or scan values of this type, use
 A signed integer type that is used for file offsets, corresponding to the 
 C99 type off64_t.
 </para>
+<para>
+To print or scan values of this type, use
+%G_GOFFSET_MODIFIER and/or %G_GOFFSET_FORMAT.
+</para>
 
 Since: 2.14
 
@@ -290,6 +294,10 @@ Since: 2.20
 Corresponds to the C99 type <type>intptr_t</type>, a signed integer type that
 can hold any pointer.
 </para>
+<para>
+To print or scan values of this type, use
+%G_GINTPTR_MODIFIER and/or %G_GINTPTR_FORMAT.
+</para>
 
 Since: 2.18
 
@@ -299,5 +307,9 @@ Since: 2.18
 Corresponds to the C99 type <type>uintptr_t</type>, an unsigned integer type that
 can hold any pointer.
 </para>
+<para>
+To print or scan values of this type, use
+%G_GINTPTR_MODIFIER and/or %G_GUINTPTR_FORMAT.
+</para>
 
 Since: 2.18



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]