Added the macros G_(U)?INT_(8|16|32|64)_FORMAT to use for printf and (much

1999-03-15  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* 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 <sb@adasys.ch>.
This commit is contained in:
Sebastian Wilhelmi 1999-03-15 16:09:15 +00:00 committed by Sebastian Wilhelmi
parent 21d0ac27b8
commit d9f1357113
11 changed files with 157 additions and 5 deletions

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -1,3 +1,16 @@
1999-03-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <sb@adasys.ch>.
1999-03-14 Jeff Garzik <jgarzik@pobox.com> 1999-03-14 Jeff Garzik <jgarzik@pobox.com>
* gdate.c: * gdate.c:

View File

@ -866,6 +866,8 @@ _______EOF
cat >>$outfile <<_______EOF cat >>$outfile <<_______EOF
typedef signed char gint8; typedef signed char gint8;
typedef unsigned char guint8; typedef unsigned char guint8;
#define G_GINT8_FORMAT "hi"
#define G_GUINT8_FORMAT "hu"
_______EOF _______EOF
@ -873,6 +875,8 @@ _______EOF
cat >>$outfile <<_______EOF cat >>$outfile <<_______EOF
typedef signed $gint16 gint16; typedef signed $gint16 gint16;
typedef unsigned $gint16 guint16; typedef unsigned $gint16 guint16;
#define G_GINT16_FORMAT $gint16_format
#define G_GUINT16_FORMAT $guint16_format
_______EOF _______EOF
fi fi
@ -881,6 +885,8 @@ _______EOF
cat >>$outfile <<_______EOF cat >>$outfile <<_______EOF
typedef signed $gint32 gint32; typedef signed $gint32 gint32;
typedef unsigned $gint32 guint32; typedef unsigned $gint32 guint32;
#define G_GINT32_FORMAT $gint32_format
#define G_GUINT32_FORMAT $guint32_format
_______EOF _______EOF
fi fi
@ -892,6 +898,8 @@ ${glib_warning_guard}#define G_HAVE_GINT64 1
${glib_extension}typedef signed $gint64 gint64; ${glib_extension}typedef signed $gint64 gint64;
${glib_extension}typedef unsigned $gint64 guint64; ${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 #define G_GINT64_CONSTANT(val) $gint64_constant
_______EOF _______EOF
fi fi
@ -1044,29 +1052,55 @@ if test x$ac_cv_header_sys_poll_h = xyes ; then
fi fi
case 2 in case 2 in
$ac_cv_sizeof_short) gint16=short;; $ac_cv_sizeof_short)
$ac_cv_sizeof_int) gint16=int;; gint16=short
gint16_format='"hi"'
guint16_format='"hu"'
;;
$ac_cv_sizeof_int)
gint16=int
gint16_format='"i"'
guint16_format='"u"'
;;
esac esac
case 4 in case 4 in
$ac_cv_sizeof_short) gint32=short;; $ac_cv_sizeof_short)
$ac_cv_sizeof_int) gint32=int;; gint32=short
$ac_cv_sizeof_long) gint32=long;; 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 esac
case 8 in case 8 in
$ac_cv_sizeof_int) $ac_cv_sizeof_int)
gint64=int gint64=int
gint64_format='"i"'
guint64_format='"u"'
glib_extension= glib_extension=
glib_warning_guard= glib_warning_guard=
gint64_constant='(val)' gint64_constant='(val)'
;; ;;
$ac_cv_sizeof_long) $ac_cv_sizeof_long)
gint64=long gint64=long
gint64_format='"li"'
guint64_format='"lu"'
glib_extension= glib_extension=
glib_warning_guard= glib_warning_guard=
gint64_constant='(val##L)' gint64_constant='(val##L)'
;; ;;
$ac_cv_sizeof_long_long) $ac_cv_sizeof_long_long)
gint64='long long' gint64='long long'
gint64_format='"lli"'
guint64_format='"llu"'
glib_extension='G_GNUC_EXTENSION ' glib_extension='G_GNUC_EXTENSION '
glib_warning_guard=" glib_warning_guard="
#if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8 #if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8

7
glib.h
View File

@ -470,6 +470,13 @@ typedef unsigned short gushort;
typedef unsigned long gulong; typedef unsigned long gulong;
typedef unsigned int guint; 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 float gfloat;
typedef double gdouble; typedef double gdouble;

View File

@ -470,6 +470,13 @@ typedef unsigned short gushort;
typedef unsigned long gulong; typedef unsigned long gulong;
typedef unsigned int guint; 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 float gfloat;
typedef double gdouble; typedef double gdouble;