From c0c488e4baa1730eb893456c52ea879f25e312e1 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sat, 19 Dec 1998 02:13:34 +0000 Subject: [PATCH] fixed up gthread includes, cleaned up glibconfig.h a little bit. Sat Dec 19 03:10:50 1998 Tim Janik * fixed up gthread includes, cleaned up glibconfig.h a little bit. --- ChangeLog | 4 + ChangeLog.pre-2-0 | 4 + ChangeLog.pre-2-10 | 4 + ChangeLog.pre-2-12 | 4 + ChangeLog.pre-2-2 | 4 + ChangeLog.pre-2-4 | 4 + ChangeLog.pre-2-6 | 4 + ChangeLog.pre-2-8 | 4 + acconfig.h | 4 + acglib.m4 | 80 +++++++++++++++ configure.in | 290 +++++++++++++++++++++++++++++------------------------ glib.h | 22 ++-- glib/glib.h | 22 ++-- 13 files changed, 291 insertions(+), 159 deletions(-) create mode 100644 acglib.m4 diff --git a/ChangeLog b/ChangeLog index 89e13cb..cecb25e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 89e13cb..cecb25e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +Sat Dec 19 03:10:50 1998 Tim Janik + + * fixed up gthread includes, cleaned up glibconfig.h a little bit. + Fri Dec 18 12:51:39 1998 Owen Taylor * gmain.c: Fix errors in computation of timeout diff --git a/acconfig.h b/acconfig.h index 76df7d3..48582cd 100644 --- a/acconfig.h +++ b/acconfig.h @@ -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 diff --git a/acglib.m4 b/acglib.m4 new file mode 100644 index 0000000..dd14064 --- /dev/null +++ b/acglib.m4 @@ -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(<>, translit(glib_sizeof_$3, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, 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 +$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(<>, translit(glib_byte_contents_$3, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, 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 +$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 +]) diff --git a/configure.in b/configure.in index 6dbf7bb..09e860a 100644 --- a/configure.in +++ b/configure.in @@ -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 ' >> $outfile - fi - if test x$glib_float_h = xyes; then - echo '#include ' >> $outfile - fi - if test x$glib_values_h = xyes; then - echo '#include ' >> $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 ' >> $outfile - echo '#include ' >> $outfile - fi + if test x$glib_limits_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_float_h = xyes; then + echo '#include ' >> $outfile + fi + if test x$glib_values_h = xyes; then + echo '#include ' >> $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 ' >> $outfile + echo '#include ' >> $outfile + fi + + cat >> $outfile <<_______EOF - cat >> $outfile <>$outfile <>$outfile <<_______EOF typedef signed char gint8; typedef unsigned char guint8; -outfile_EOF +_______EOF - if test -n "$gint16"; then - cat >>$outfile <>$outfile <<_______EOF typedef signed $gint16 gint16; typedef unsigned $gint16 guint16; -outfile_EOF - fi - if test -n "$gint32"; then - cat >>$outfile <>$outfile <<_______EOF typedef signed $gint32 gint32; typedef unsigned $gint32 guint32; -outfile_EOF - fi - if test -n "$gint64"; then - cat >>$outfile <>$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 + +#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)) +_______EOF + else + echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile + fi -#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 - cat >>$outfile <>$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 $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 <>$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 - - g_bit_sizes="16 32" - if test -n "$gint64"; then - g_bit_sizes="$g_bit_sizes 64" - fi +#define g_static_mutex_get_mutex(mutex) (g_static_mutex_get_mutex_impl (&(mutex))) +_______EOF + fi - for bits in $g_bit_sizes; do - cat >>$outfile <>$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 #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([ diff --git a/glib.h b/glib.h index d22f895..6bf66d1 100644 --- a/glib.h +++ b/glib.h @@ -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, diff --git a/glib/glib.h b/glib/glib.h index d22f895..6bf66d1 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -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, -- 2.7.4