fixed up gthread includes, cleaned up glibconfig.h a little bit.

Sat Dec 19 03:10:50 1998  Tim Janik  <timj@gtk.org>

        * fixed up gthread includes, cleaned up glibconfig.h a little bit.
This commit is contained in:
Tim Janik 1998-12-19 02:13:34 +00:00 committed by Tim Janik
parent 2623d2831a
commit c0c488e4ba
13 changed files with 291 additions and 159 deletions

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -1,3 +1,7 @@
Sat Dec 19 03:10:50 1998 Tim Janik <timj@gtk.org>
* fixed up gthread includes, cleaned up glibconfig.h a little bit.
Fri Dec 18 12:51:39 1998 Owen Taylor <otaylor@redhat.com>
* gmain.c: Fix errors in computation of timeout

View File

@ -39,6 +39,10 @@
#undef G_COMPILED_WITH_DEBUGGING
#undef G_THREADS_ENABLED
#undef GLIB_SIZEOF_GMUTEX
#undef GLIB_BYTE_CONTENTS_GMUTEX
#undef HAVE_BROKEN_WCTYPE
#undef HAVE_DOPRNT
#undef HAVE_FLOAT_H

80
acglib.m4 Normal file
View File

@ -0,0 +1,80 @@
dnl GLIB_IF_VAR_EQ (ENV_VAR, VALUE [, EQUALS_ACTION] [, ELSE_ACTION])
AC_DEFUN(GLIB_IF_VAR_EQ,[
case "$[$1]" in
"[$2]"[)]
[$3]
;;
*[)]
[$4]
;;
esac
])
dnl GLIB_STR_CONTAINS (SRC_STRING, SUB_STRING [, CONTAINS_ACTION] [, ELSE_ACTION])
AC_DEFUN(GLIB_STR_CONTAINS,[
case "[$1]" in
*"[$2]"*[)]
[$3]
;;
*[)]
[$4]
;;
esac
])
dnl GLIB_ADD_TO_VAR (ENV_VARIABLE, CHECK_STRING, ADD_STRING)
AC_DEFUN(GLIB_ADD_TO_VAR,[
GLIB_STR_CONTAINS($[$1], [$2], [$1]="$[$1]", [$1]="$[$1] [$3]")
])
dnl GLIB_SIZEOF (INCLUDES, TYPE, ALIAS [, CROSS-SIZE])
AC_DEFUN(GLIB_SIZEOF,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(glib_sizeof_$3, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(glib_cv_sizeof_$3, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(size of $2)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
$1
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof($2));
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$4], , , AC_CV_NAME=$4))])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
dnl GLIB_BYTE_CONTENTS (INCLUDES, TYPE, ALIAS, N_BYTES, INITIALIZER)
AC_DEFUN(GLIB_BYTE_CONTENTS,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(glib_byte_contents_$3, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(glib_cv_byte_contents_$3, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(byte contents of $2)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN([#include <stdio.h>
$1
main()
{
static $2 tv = $5;
char *p = (char*) &tv;
int i;
FILE *f=fopen("conftestval", "w");
for (i = 0; i < $4; i++)
fprintf(f, "%s%d", i?",":"", *(p++));
fprintf(f, "\n");
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])

View File

@ -1,3 +1,8 @@
dnl ***********************************
dnl *** include special GLib macros ***
dnl ***********************************
builtin(include, acglib.m4)dnl
# Process this file with autoconf to produce a configure script.
AC_INIT(glist.c)
@ -596,6 +601,7 @@ dnl ******************************
G_THREAD_LIBS=
mutex_has_default=no
case $have_threads in
posix)
G_THREAD_LIBS=error
@ -608,6 +614,10 @@ case $have_threads in
if test "x$G_THREAD_LIBS" = xerror; then
AC_CHECK_FUNC(pthread_attr_init, G_THREAD_LIBS="")
fi
mutex_has_default=yes
mutex_default_type='pthread_mutex_t'
mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
mutex_header_file='pthread.h'
;;
solaris)
G_THREAD_LIBS=error
@ -621,6 +631,14 @@ case $have_threads in
[solaris_mutex_init_broken=yes],
[solaris_mutex_init_broken=no])
AC_MSG_RESULT($solaris_mutex_init_broken)
mutex_has_default=yes
mutex_default_type='mutex_t'
if test x$solaris_mutex_init_broken = xyes; then
mutex_default_init="{ { { 0, 0, 0, 0 }, USYNC_THREAD }, { { { 0, 0, 0, 0, 0, 0, 0, 0 } } }, 0}"
else
mutex_default_init="DEFAULTMUTEX"
fi
mutex_header_file='thread.h'
;;
nspr)
AC_CHECK_LIB(nspr21, PRP_NewNakedCondVar,
@ -640,6 +658,7 @@ fi
AC_MSG_CHECKING(necessary linker options)
AC_MSG_RESULT($G_THREAD_LIBS)
dnl determination of G_THREAD_CFLAGS
dnl ********************************
@ -689,6 +708,27 @@ AC_SUBST(G_THREAD_LIBS)
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
dnl **********************************************
dnl *** GDefaultMutex setup and initialization ***
dnl **********************************************
dnl
dnl if mutex_has_default = yes, we also got
dnl mutex_default_type, mutex_default_init and mutex_header_file
GLIB_IF_VAR_EQ(mutex_has_default, yes,
GLIB_SIZEOF([#include <$mutex_header_file>],
$mutex_default_type,
gmutex,
)
GLIB_BYTE_CONTENTS([#include <$mutex_header_file>],
$mutex_default_type,
gmutex,
$glib_cv_sizeof_gmutex,
$mutex_default_init)
,
)
dnl ******************************
dnl *** output the whole stuff ***
dnl ******************************
@ -711,11 +751,13 @@ if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
fi
case "$CONFIG_OTHER" in
*glibconfig.h*)
echo creating glibconfig.h
outfile=glibconfig.h-tmp
cat > $outfile <<\outfile_EOF
/* glibconfig.h */
/* This is a generated file. Please modify `configure.in' */
echo creating glibconfig.h
outfile=glibconfig.h-tmp
cat > $outfile <<\_______EOF
/* glibconfig.h
*
* This is a generated file. Please modify `configure.in'
*/
#ifndef GLIBCONFIG_H
#define GLIBCONFIG_H
@ -724,83 +766,92 @@ case "$CONFIG_OTHER" in
extern "C" {
#endif /* __cplusplus */
outfile_EOF
_______EOF
if test x$glib_limits_h = xyes; then
echo '#include <limits.h>' >> $outfile
fi
if test x$glib_float_h = xyes; then
echo '#include <float.h>' >> $outfile
fi
if test x$glib_values_h = xyes; then
echo '#include <values.h>' >> $outfile
fi
if test x$g_mutex_header_file != x; then
echo '#include <'"$g_mutex_header_file"'>' >> $outfile
fi
if test x$glib_sys_poll_h = xyes; then
echo '#include <sys/types.h>' >> $outfile
echo '#include <sys/poll.h>' >> $outfile
fi
if test x$glib_limits_h = xyes; then
echo '#include <limits.h>' >> $outfile
fi
if test x$glib_float_h = xyes; then
echo '#include <float.h>' >> $outfile
fi
if test x$glib_values_h = xyes; then
echo '#include <values.h>' >> $outfile
fi
if test x$g_mutex_header_file != x; then
echo '#include <'"$g_mutex_header_file"'>' >> $outfile
fi
if test x$glib_sys_poll_h = xyes; then
echo '#include <sys/types.h>' >> $outfile
echo '#include <sys/poll.h>' >> $outfile
fi
cat >> $outfile <<outfile_EOF
cat >> $outfile <<_______EOF
#define G_MINFLOAT $glib_mf
#define G_MAXFLOAT $glib_Mf
#define G_MINDOUBLE $glib_md
#define G_MAXDOUBLE $glib_Md
#define G_MINSHORT $glib_ms
#define G_MAXSHORT $glib_Ms
#define G_MININT $glib_mi
#define G_MAXINT $glib_Mi
#define G_MINLONG $glib_ml
#define G_MAXLONG $glib_Ml
#define G_MINFLOAT $glib_mf
#define G_MAXFLOAT $glib_Mf
#define G_MINDOUBLE $glib_md
#define G_MAXDOUBLE $glib_Md
#define G_MINSHORT $glib_ms
#define G_MAXSHORT $glib_Ms
#define G_MININT $glib_mi
#define G_MAXINT $glib_Mi
#define G_MINLONG $glib_ml
#define G_MAXLONG $glib_Ml
outfile_EOF
_______EOF
## this should always be true in a modern C/C++ compiler
cat >>$outfile <<outfile_EOF
### this should always be true in a modern C/C++ compiler
cat >>$outfile <<_______EOF
typedef signed char gint8;
typedef unsigned char guint8;
outfile_EOF
_______EOF
if test -n "$gint16"; then
cat >>$outfile <<outfile_EOF
if test -n "$gint16"; then
cat >>$outfile <<_______EOF
typedef signed $gint16 gint16;
typedef unsigned $gint16 guint16;
outfile_EOF
fi
if test -n "$gint32"; then
cat >>$outfile <<outfile_EOF
_______EOF
fi
if test -n "$gint32"; then
cat >>$outfile <<_______EOF
typedef signed $gint32 gint32;
typedef unsigned $gint32 guint32;
outfile_EOF
fi
if test -n "$gint64"; then
cat >>$outfile <<outfile_EOF
_______EOF
fi
if test -n "$gint64"; then
cat >>$outfile <<_______EOF
${glib_warning_guard}#define G_HAVE_GINT64 1
${glib_extension}typedef signed $gint64 gint64;
${glib_extension}typedef unsigned $gint64 guint64;
#define G_GINT64_CONSTANT(val) $gint64_constant
outfile_EOF
fi
_______EOF
fi
if test -z "$glib_unknown_void_p"; then
cat >>$outfile <<outfile_EOF
if test -z "$glib_unknown_void_p"; then
cat >>$outfile <<_______EOF
#define GPOINTER_TO_INT(p) ((gint)${glib_gpi_cast}(p))
#define GPOINTER_TO_UINT(p) ((guint)${glib_gpui_cast}(p))
#define GPOINTER_TO_INT(p) ((gint) ${glib_gpi_cast} (p))
#define GPOINTER_TO_UINT(p) ((guint) ${glib_gpui_cast} (p))
#define GINT_TO_POINTER(i) ((gpointer)${glib_gpi_cast}(i))
#define GUINT_TO_POINTER(u) ((gpointer)${glib_gpui_cast}(u))
outfile_EOF
else
echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
fi
#define GINT_TO_POINTER(i) ((gpointer) ${glib_gpi_cast} (i))
#define GUINT_TO_POINTER(u) ((gpointer) ${glib_gpui_cast} (u))
_______EOF
else
echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
fi
cat >>$outfile <<outfile_EOF
cat >>$outfile <<_______EOF
$glib_atexit
$glib_memmove
$glib_defines
@ -812,57 +863,52 @@ $glib_vacopy
#else /* !__cplusplus */
$glib_inline
#endif /* !__cplusplus */
_______EOF
#define G_BYTE_ORDER $g_byte_order
outfile_EOF
cat >>$outfile <<outfile_EOF
if test x$g_mutex_has_default = xyes; then
cat >>$outfile <<_______EOF
$g_enable_threads_def G_THREADS_ENABLED
/* definitions for the default mutex implementation */
outfile_EOF
if test x$g_mutex_has_default = xyes; then
cat >>$outfile <<outfile_EOF
typedef struct _GStaticMutex GStaticMutex;
struct _GStaticMutex
struct _GStaticMutex
{
$g_mutex_default_type default_mutex;
struct _GMutex* runtime_mutex;
struct _GMutex *runtime_mutex;
union {
char pad[$g_mutex_sizeof];
double dummy_double;
void *dummy_pointer;
long dummy_long;
} aligned_pad_u;
};
#define G_STATIC_MUTEX_INIT { $g_mutex_default_init, NULL }
#define g_static_mutex_get_mutex(mutex) \
( g_thread_use_default_impl ? (GMutex*)&(mutex).default_mutex : \
g_static_mutex_get_mutex_impl(&(mutex).runtime_mutex) )
outfile_EOF
else
cat >>$outfile <<outfile_EOF
#define G_STATIC_MUTEX_INIT { NULL, { { $g_mutex_contents} } }
#define g_static_mutex_get_mutex(mutex) \
(g_thread_use_default_impl ? ((GMutex*) &(mutex).aligned_pad_u) : \
g_static_mutex_get_mutex_impl (&(mutex).runtime_mutex))
_______EOF
else
cat >>$outfile <<_______EOF
$g_enable_threads_def G_THREADS_ENABLED
typedef struct _GMutex* GStaticMutex;
#define G_STATIC_MUTEX_INIT NULL
#define g_static_mutex_get_mutex(mutex) g_static_mutex_get_mutex_impl(&mutex)
outfile_EOF
fi
#define g_static_mutex_get_mutex(mutex) (g_static_mutex_get_mutex_impl (&(mutex)))
_______EOF
fi
g_bit_sizes="16 32"
if test -n "$gint64"; then
g_bit_sizes="$g_bit_sizes 64"
fi
for bits in $g_bit_sizes; do
cat >>$outfile <<outfile_EOF
g_bit_sizes="16 32"
if test -n "$gint64"; then
g_bit_sizes="$g_bit_sizes 64"
fi
for bits in $g_bit_sizes; do
cat >>$outfile <<_______EOF
#define GINT${bits}_TO_${g_bs_native}(val) ((gint${bits}) (val))
#define GUINT${bits}_TO_${g_bs_native}(val) ((guint${bits}) (val))
#define GINT${bits}_TO_${g_bs_alien}(val) ((gint${bits}) GUINT${bits}_SWAP_LE_BE (val))
#define GUINT${bits}_TO_${g_bs_alien}(val) (GUINT${bits}_SWAP_LE_BE (val))
outfile_EOF
done
cat >>$outfile <<outfile_EOF
_______EOF
done
cat >>$outfile <<_______EOF
#define GLONG_TO_LE(val) ((glong) GINT${glongbits}_TO_LE (val))
#define GULONG_TO_LE(val) ((gulong) GUINT${glongbits}_TO_LE (val))
#define GLONG_TO_BE(val) ((glong) GINT${glongbits}_TO_BE (val))
@ -872,22 +918,25 @@ done
#define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val))
#define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val))
#define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val))
#define G_BYTE_ORDER $g_byte_order
$glib_wc
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GLIBCONFIG_H */
_______EOF
outfile_EOF
if cmp -s $outfile glibconfig.h; then
echo glibconfig.h is unchanged
rm -f $outfile
else
mv $outfile glibconfig.h
fi ;;
if cmp -s $outfile glibconfig.h; then
echo glibconfig.h is unchanged
rm -f $outfile
else
mv $outfile glibconfig.h
fi ;;
esac
],[
@ -952,16 +1001,16 @@ $ac_cv_sizeof_long)
;;
$ac_cv_sizeof_long_long)
gint64='long long'
glib_extension='GLIB_WARNINGS_MAKE_PEOPLE_CRY '
glib_extension='G_GNUC_EXTENSION '
glib_warning_guard="
#if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
# define GLIB_WARNINGS_MAKE_PEOPLE_CRY __extension__
# define G_GNUC_EXTENSION __extension__
#else
# define GLIB_WARNINGS_MAKE_PEOPLE_CRY
# define G_GNUC_EXTENSION
#endif
"
gint64_constant='(GLIB_WARNINGS_MAKE_PEOPLE_CRY (val##LL))'
gint64_constant='(G_GNUC_EXTENSION (val##LL))'
;;
esac
@ -1065,30 +1114,9 @@ xyes) g_enable_threads_def="#define";;
*) g_enable_threads_def="#undef ";;
esac
case $have_threads in
posix)
g_mutex_has_default=yes
g_mutex_default_type='pthread_mutex_t'
g_mutex_default_init='PTHREAD_MUTEX_INITIALIZER'
g_mutex_header_file='pthread.h'
;;
solaris)
g_mutex_has_default=yes
g_mutex_default_type='mutex_t'
if test x$solaris_mutex_init_broken = xyes; then
g_mutex_default_init="{ { { 0, 0, 0, 0 }, USYNC_THREAD }, { { { 0, 0, 0, 0, 0, 0, 0, 0 } } }, 0}"
else
g_mutex_default_init="DEFAULTMUTEX"
fi
g_mutex_header_file='thread.h'
;;
nspr)
g_mutex_has_default=no
;;
*)
g_mutex_has_default=no
;;
esac
g_mutex_has_default="$mutex_has_default"
g_mutex_sizeof="$glib_cv_sizeof_gmutex"
g_mutex_contents="$glib_cv_byte_contents_gmutex"
])
AC_OUTPUT([

22
glib.h
View File

@ -487,12 +487,15 @@ typedef gint32 GTime;
/* Portable endian checks and conversions
*
* glibconfig.h defines G_BYTE_ORDER which expands to one of
* the below macros.
*/
#define G_LITTLE_ENDIAN 1234
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
/* Basic bit swapping functions
*/
#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
@ -507,7 +510,6 @@ typedef gint32 GTime;
/* Intel specific stuff for speed
*/
#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
# define GUINT16_SWAP_LE_BE_X86(val) \
(__extension__ \
({ register guint16 __v; \
@ -518,9 +520,7 @@ typedef gint32 GTime;
: "=r" (__v) \
: "0" ((guint16) (val))); \
__v; }))
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
# if !defined(__i486__) && !defined(__i586__) \
&& !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
# define GUINT32_SWAP_LE_BE_X86(val) \
@ -535,7 +535,6 @@ typedef gint32 GTime;
: "=r" (__v) \
: "0" ((guint32) (val))); \
__v; }))
# else /* 486 and higher has bswap */
# define GUINT32_SWAP_LE_BE_X86(val) \
(__extension__ \
@ -548,9 +547,7 @@ typedef gint32 GTime;
: "0" ((guint32) (val))); \
__v; }))
# endif /* processor specific 32-bit stuff */
# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
#else /* !__i386__ */
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
@ -574,7 +571,6 @@ typedef gint32 GTime;
(guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) | \
(((guint64) (val) & \
(guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
# if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
# define GUINT64_SWAP_LE_BE_X86(val) \
(__extension__ \
@ -591,9 +587,7 @@ typedef gint32 GTime;
__r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \
} \
__r.__ll; }))
# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val))
# else /* !__i386__ */
# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val))
# endif
@ -608,8 +602,8 @@ typedef gint32 GTime;
(((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
(((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
/* The TO_?E stuff is defined in glibconfig.h. The transformation is symmetric,
so the FROM just maps to the TO.
/* The G*_TO_?E() macros are defined in glibconfig.h.
* The transformation is symmetric, so the FROM just maps to the TO.
*/
#define GINT16_FROM_LE(val) (GINT16_TO_LE (val))
#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))
@ -637,6 +631,7 @@ typedef gint32 GTime;
#define GINT_FROM_BE(val) (GINT_TO_BE (val))
#define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
/* Portable versions of host-network order stuff
*/
#define g_ntohl(val) (GUINT32_FROM_BE (val))
@ -665,9 +660,9 @@ GUTILS_C_VAR const guint glib_micro_version;
GUTILS_C_VAR const guint glib_interface_age;
GUTILS_C_VAR const guint glib_binary_age;
/* Forward declarations of glib types.
*/
typedef struct _GAllocator GAllocator;
typedef struct _GArray GArray;
typedef struct _GByteArray GByteArray;
@ -694,7 +689,6 @@ typedef struct _GTuples GTuples;
typedef union _GTokenValue GTokenValue;
typedef struct _GIOChannel GIOChannel;
typedef enum
{
G_TRAVERSE_LEAFS = 1 << 0,

View File

@ -487,12 +487,15 @@ typedef gint32 GTime;
/* Portable endian checks and conversions
*
* glibconfig.h defines G_BYTE_ORDER which expands to one of
* the below macros.
*/
#define G_LITTLE_ENDIAN 1234
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
/* Basic bit swapping functions
*/
#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
@ -507,7 +510,6 @@ typedef gint32 GTime;
/* Intel specific stuff for speed
*/
#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
# define GUINT16_SWAP_LE_BE_X86(val) \
(__extension__ \
({ register guint16 __v; \
@ -518,9 +520,7 @@ typedef gint32 GTime;
: "=r" (__v) \
: "0" ((guint16) (val))); \
__v; }))
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
# if !defined(__i486__) && !defined(__i586__) \
&& !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
# define GUINT32_SWAP_LE_BE_X86(val) \
@ -535,7 +535,6 @@ typedef gint32 GTime;
: "=r" (__v) \
: "0" ((guint32) (val))); \
__v; }))
# else /* 486 and higher has bswap */
# define GUINT32_SWAP_LE_BE_X86(val) \
(__extension__ \
@ -548,9 +547,7 @@ typedef gint32 GTime;
: "0" ((guint32) (val))); \
__v; }))
# endif /* processor specific 32-bit stuff */
# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
#else /* !__i386__ */
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
@ -574,7 +571,6 @@ typedef gint32 GTime;
(guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) | \
(((guint64) (val) & \
(guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
# if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
# define GUINT64_SWAP_LE_BE_X86(val) \
(__extension__ \
@ -591,9 +587,7 @@ typedef gint32 GTime;
__r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \
} \
__r.__ll; }))
# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val))
# else /* !__i386__ */
# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val))
# endif
@ -608,8 +602,8 @@ typedef gint32 GTime;
(((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
(((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
/* The TO_?E stuff is defined in glibconfig.h. The transformation is symmetric,
so the FROM just maps to the TO.
/* The G*_TO_?E() macros are defined in glibconfig.h.
* The transformation is symmetric, so the FROM just maps to the TO.
*/
#define GINT16_FROM_LE(val) (GINT16_TO_LE (val))
#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))
@ -637,6 +631,7 @@ typedef gint32 GTime;
#define GINT_FROM_BE(val) (GINT_TO_BE (val))
#define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
/* Portable versions of host-network order stuff
*/
#define g_ntohl(val) (GUINT32_FROM_BE (val))
@ -665,9 +660,9 @@ GUTILS_C_VAR const guint glib_micro_version;
GUTILS_C_VAR const guint glib_interface_age;
GUTILS_C_VAR const guint glib_binary_age;
/* Forward declarations of glib types.
*/
typedef struct _GAllocator GAllocator;
typedef struct _GArray GArray;
typedef struct _GByteArray GByteArray;
@ -694,7 +689,6 @@ typedef struct _GTuples GTuples;
typedef union _GTokenValue GTokenValue;
typedef struct _GIOChannel GIOChannel;
typedef enum
{
G_TRAVERSE_LEAFS = 1 << 0,