From: Sebastian Wilhelmi Date: Mon, 15 Mar 1999 16:09:15 +0000 (+0000) Subject: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to use for printf and (much X-Git-Tag: GLIB_1_3_0~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9f135711392682a9caa5987471ceccd6f9af2c7;p=platform%2Fupstream%2Fglib.git Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to use for printf and (much 1999-03-15 Sebastian Wilhelmi * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to use for printf and (much more important) scanf format strings for the corresponding GLib types. * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as they are different for printf (f for both) and scanf (f for float, lf for double). Defining G_INT_FORMAT makes sense however, as we might want to define gint to something different than int someday in the future. Idea from Sascha Brawer . --- diff --git a/ChangeLog b/ChangeLog index 3a14119..8f63df1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 3a14119..8f63df1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +1999-03-15 Sebastian Wilhelmi + + * configure.in: Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to + use for printf and (much more important) scanf format strings for + the corresponding GLib types. + + * glib.h Added G_(U)?(SHORT|INT|LONG)_FORMAT for consistency. It + however makes no sense to also provide G_(FLOAT|DOUBLE)_FORMAT, as + they are different for printf (f for both) and scanf (f for float, + lf for double). Defining G_INT_FORMAT makes sense however, as we + might want to define gint to something different than int someday + in the future. Idea from Sascha Brawer . + 1999-03-14 Jeff Garzik * gdate.c: diff --git a/configure.in b/configure.in index b4fd293..4ca36dc 100644 --- a/configure.in +++ b/configure.in @@ -866,6 +866,8 @@ _______EOF cat >>$outfile <<_______EOF typedef signed char gint8; typedef unsigned char guint8; +#define G_GINT8_FORMAT "hi" +#define G_GUINT8_FORMAT "hu" _______EOF @@ -873,6 +875,8 @@ _______EOF cat >>$outfile <<_______EOF typedef signed $gint16 gint16; typedef unsigned $gint16 guint16; +#define G_GINT16_FORMAT $gint16_format +#define G_GUINT16_FORMAT $guint16_format _______EOF fi @@ -881,6 +885,8 @@ _______EOF cat >>$outfile <<_______EOF typedef signed $gint32 gint32; typedef unsigned $gint32 guint32; +#define G_GINT32_FORMAT $gint32_format +#define G_GUINT32_FORMAT $guint32_format _______EOF fi @@ -892,6 +898,8 @@ ${glib_warning_guard}#define G_HAVE_GINT64 1 ${glib_extension}typedef signed $gint64 gint64; ${glib_extension}typedef unsigned $gint64 guint64; +#define G_GINT64_FORMAT $gint64_format +#define G_GUINT64_FORMAT $guint64_format #define G_GINT64_CONSTANT(val) $gint64_constant _______EOF fi @@ -1044,29 +1052,55 @@ if test x$ac_cv_header_sys_poll_h = xyes ; then fi case 2 in -$ac_cv_sizeof_short) gint16=short;; -$ac_cv_sizeof_int) gint16=int;; +$ac_cv_sizeof_short) + gint16=short + gint16_format='"hi"' + guint16_format='"hu"' + ;; +$ac_cv_sizeof_int) + gint16=int + gint16_format='"i"' + guint16_format='"u"' + ;; esac case 4 in -$ac_cv_sizeof_short) gint32=short;; -$ac_cv_sizeof_int) gint32=int;; -$ac_cv_sizeof_long) gint32=long;; +$ac_cv_sizeof_short) + gint32=short + gint32_format='"hi"' + guint32_format='"hu"' + ;; +$ac_cv_sizeof_int) + gint32=int + gint32_format='"i"' + guint32_format='"u"' + ;; +$ac_cv_sizeof_long) + gint32=long + gint32_format='"li"' + guint32_format='"lu"' + ;; esac case 8 in $ac_cv_sizeof_int) gint64=int + gint64_format='"i"' + guint64_format='"u"' glib_extension= glib_warning_guard= gint64_constant='(val)' ;; $ac_cv_sizeof_long) gint64=long + gint64_format='"li"' + guint64_format='"lu"' glib_extension= glib_warning_guard= gint64_constant='(val##L)' ;; $ac_cv_sizeof_long_long) gint64='long long' + gint64_format='"lli"' + guint64_format='"llu"' glib_extension='G_GNUC_EXTENSION ' glib_warning_guard=" #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8 diff --git a/glib.h b/glib.h index 82893e2..5f489ae 100644 --- a/glib.h +++ b/glib.h @@ -470,6 +470,13 @@ typedef unsigned short gushort; typedef unsigned long gulong; typedef unsigned int guint; +#define G_GSHORT_FORMAT "hi" +#define G_GUSHORT_FORMAT "hu" +#define G_GINT_FORMAT "i" +#define G_GUINT_FORMAT "u" +#define G_GLONG_FORMAT "li" +#define G_GULONG_FORMAT "lu" + typedef float gfloat; typedef double gdouble; diff --git a/glib/glib.h b/glib/glib.h index 82893e2..5f489ae 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -470,6 +470,13 @@ typedef unsigned short gushort; typedef unsigned long gulong; typedef unsigned int guint; +#define G_GSHORT_FORMAT "hi" +#define G_GUSHORT_FORMAT "hu" +#define G_GINT_FORMAT "i" +#define G_GUINT_FORMAT "u" +#define G_GLONG_FORMAT "li" +#define G_GULONG_FORMAT "lu" + typedef float gfloat; typedef double gdouble;