Land glib-rrh-19981025-0.patch.

* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule.  Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines.  All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.

This could cause some short term instability.
This commit is contained in:
Raja R Harinath 1998-11-01 01:32:59 +00:00
parent e8a920f88d
commit 5900267cc7
23 changed files with 579 additions and 311 deletions

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,3 +1,20 @@
1998-10-31 Raja R Harinath <harinath@cs.umn.edu>
Land glib-rrh-19981025-0.patch.
* Makefile.am (glibconfig.h): New rule.
(stamp-gc-h): New rule. Generate `glibconfig.h'.
* configure.in (AM_CONFIG_HEADER): It is now `config.h'.
(HAVE_BROKEN_WCTYPE): On Solaris, look for iswalnum in -lw before
concluding "broken wctype".
(glibconfig.h): Use AC_OUTPUT_COMMANDS to put generation code into
config.status.
* glib.h: Remove a lot of tests and defines. All these have been
moved to `configure.in (glibconfig.h)'.
* gerror.c: Include <config.h>.
* gmem.c: Likewise.
* gstrfuncs.c: Likewise.
* gutils.c: Likewise.
Sat Oct 31 05:08:26 1998 Tim Janik <timj@gtk.org>
* glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros.

View File

@ -1,6 +1,10 @@
## Process this file with automake to produce Makefile.in
# build . first, then SUBDIRS
SUBDIRS = gmodule docs
all-recursive-am: all-am
# alpha `automake' supports this better
#SUBDIRS = . gmodule docs
configincludedir = $(pkglibdir)/include
@ -20,10 +24,6 @@ EXTRA_DIST = \
makefile.msc \
glibconfig.h.win32
# build . first, then SUBDIRS
all-recursive-am: all-am
lib_LTLIBRARIES = libglib.la
libglib_la_SOURCES = \
@ -54,6 +54,13 @@ include_HEADERS = \
configinclude_DATA = \
glibconfig.h
BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h
glibconfig.h: stamp-gc-h
@:
stamp-gc-h: config.status
CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibconfig.h ./config.status
echo timestamp > stamp-gc-h
libglib_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE)
INCLUDES = -I$(top_srcdir)

View File

@ -40,7 +40,7 @@ PACKAGE=glib
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
# Specify a configuration file
AM_CONFIG_HEADER(glibconfig.h)
AM_CONFIG_HEADER(config.h)
AC_DEFINE_UNQUOTED(GLIB_MAJOR_VERSION, $GLIB_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(GLIB_MINOR_VERSION, $GLIB_MINOR_VERSION)
@ -97,21 +97,26 @@ AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_INSTALL
if eval "test x$GCC = xyes"; then
if eval test -z \"`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`\" ; then
CFLAGS="$CFLAGS -Wall"
fi
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
if eval "test x$enable_ansi = xyes"; then
if eval test -z \"`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`\" ; then
CFLAGS="$CFLAGS -ansi"
fi
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
if eval test -z \"`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`\" ; then
CFLAGS="$CFLAGS -pedantic"
fi
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
fi
changequote([,])dnl
dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
@ -270,31 +275,34 @@ else
fi
fi
# This stuff is here, only so that we can define these
# things in glibconfig.h. If ../config.h was installed
# (under some other name?) then the definitions would
# belong there. (They are only used in GDK)
# These are used only in GDK (gdki18n.h)
# This stuff is here only so that we can define these
# things in glibconfig.h. If gtk+ started using an installed
# gdkconfig.h file, then the definitions would belong there.
# Check for wchar.h
AC_MSG_CHECKING(for wchar.h)
AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
AC_TRY_CPP([#include <wchar.h>], glib_wchar_h=yes, glib_wchar_h=no)
if test $glib_wchar_h = yes; then
AC_DEFINE(HAVE_WCHAR_H)
fi
AC_MSG_RESULT($gtk_ok)
AC_MSG_RESULT($glib_wchar_h)
# Check for wctype.h (for iswalnum)
AC_MSG_CHECKING(for wctype.h)
AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
AC_TRY_CPP([#include <wctype.h>], glib_wctype_h=yes, glib_wctype_h=no)
if test $glib_wctype_h = yes; then
AC_DEFINE(HAVE_WCTYPE_H)
fi
AC_MSG_RESULT($gtk_ok)
AC_MSG_RESULT($glib_wctype_h)
oLIBS="$LIBS"
# in Solaris 2.5, `iswalnum' is in -lw
AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum)])
# The following is necessary for Linux libc-5.4.38
AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
AC_TRY_LINK([#include <stdlib.h>],[
#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
@ -309,12 +317,14 @@ AC_TRY_LINK([#include <stdlib.h>],[
# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
#endif
iswalnum((wchar_t) 0);
], gtk_ok=yes, gtk_ok=no)
], glib_working_wctype=yes, glib_working_wctype=no)
LIBS="$oLIBS"
if test $gtk_ok = no; then
if test $glib_working_wctype = no; then
AC_DEFINE(HAVE_BROKEN_WCTYPE)
fi
AC_MSG_RESULT($gtk_ok)
AC_MSG_RESULT($glib_working_wctype)
dnl **********************
dnl *** va_copy checks ***
@ -496,6 +506,264 @@ AC_SUBST(G_MODULE_LDFLAGS)
AC_SUBST(G_MODULE_HAVE_DLERROR)
AC_SUBST(G_MODULE_NEED_USCORE)
AC_OUTPUT_COMMANDS([
## Generate `glibconfig.h' in two cases
## 1. `config.status' is run either explicitly, or via configure.
## Esp. not when it is run in `Makefile' to generate makefiles and
## config.h
## 2. CONFIG_OTHER is set explicitly
##
## Case 1 is difficult. We know that `automake' sets one of
## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
## only when AM_CONFIG_HEADER is set, however.
if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
# Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
CONFIG_OTHER=${CONFIG_OTHER:-glibconfig.h}
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' */
#ifndef GLIBCONFIG_H
#define GLIBCONFIG_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
outfile_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
cat >> $outfile <<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
outfile_EOF
## this should always be true in a modern C/C++ compiler
cat >>$outfile <<outfile_EOF
typedef signed char gint8;
typedef unsigned char guint8;
outfile_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
#define G_HAVE_GINT64 1
typedef signed $gint64 gint64;
typedef unsigned $gint64 guint64;
outfile_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))
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
$glib_vacopy
$glib_inline
#define G_BYTE_ORDER $g_byte_order
$glib_wc
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GLIBCONFIG_H */
outfile_EOF
if cmp -s $outfile glibconfig.h; then
echo glibconfig.h is unchanged
rm -f $outfile
else
mv $outfile glibconfig.h
fi ;;
esac
],[
# Note that if two cases are the same, case goes with the first one.
# Note also that this is inside an AC_OUTPUT_COMMAND. We do not depend
# on variable expansion in case labels. Look at the generated config.status
# for a hint.
case xyes in
x$ac_cv_header_float_h)
glib_float_h=yes
glib_mf=FLT_MIN glib_Mf=FLT_MAX
glib_md=DBL_MIN glib_Md=DBL_MAX
;;
x$ac_cv_header_values_h)
glib_values_h=yes
glib_mf=MINFLOAT glib_Mf=MAXFLOAT
glib_md=MINDOUBLE glib_Md=MAXDOUBLE
;;
esac
case xyes in
x$ac_cv_header_limits_h)
glib_limits_h=yes
glib_ms=SHRT_MIN glib_Ms=SHRT_MAX
glib_mi=INT_MIN glib_Mi=INT_MAX
glib_ml=LONG_MIN glib_Ml=LONG_MAX
;;
x$ac_cv_header_values_h)
glib_values_h=yes
glib_ms=MINSHORT glib_Ms=MAXSHORT
glib_mi=MININT glib_Mi=MAXINT
glib_ml=MINLONG glib_Ml=MAXLONG
;;
esac
case 2 in
$ac_cv_sizeof_short) gint16=short;;
$ac_cv_sizeof_int) gint16=int;;
esac
case 4 in
$ac_cv_sizeof_short) gint32=short;;
$ac_cv_sizeof_int) gint32=int;;
$ac_cv_sizeof_long) gint32=long;;
esac
case 8 in
$ac_cv_sizeof_int) gint64=int;;
$ac_cv_sizeof_long) gint64=long;;
$ac_cv_sizeof_long_long) gint64='long long';;
esac
case $ac_cv_sizeof_void_p in
$ac_cv_sizeof_int) glib_gpi_cast='' glib_gpui_cast='' ;;
$ac_cv_sizeof_long) glib_gpi_cast='(glong)' glib_gpui_cast='(gulong)' ;;
*) glib_unknown_void_p=yes ;;
esac
case xyes in
x$ac_cv_func_atexit)
glib_atexit="
#ifdef NeXT /* @#%@! NeXTStep */
# define g_ATEXIT(proc) (!atexit (proc))
#else
# define g_ATEXIT(proc) (atexit (proc))
#endif"
;;
x$ac_cv_func_on_exit)
glib_atexit="
#define g_ATEXIT(proc) (on_exit ((void (*)(int, void*))(proc), NULL))"
;;
esac
case xyes in
x$ac_cv_func_memmove)
glib_memmove='
#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END'
;;
*)
glib_memmove="
/* We make the assumption that if memmove isn't available, then
* bcopy will do the job. This isn't safe everywhere. (bcopy can't
* necessarily handle overlapping copies) */
#define g_memmove(d,s,n) G_STMT_START { bcopy ((s), (d), (n)); } G_STMT_END"
;;
esac
glib_defines="
#define GLIB_MAJOR_VERSION $GLIB_MAJOR_VERSION
#define GLIB_MINOR_VERSION $GLIB_MINOR_VERSION
#define GLIB_MICRO_VERSION $GLIB_MICRO_VERSION
#define G_COMPILED_WITH_DEBUGGING \"$enable_debug\""
case xyes in
x$glib_cv_va_copy) glib_vacopy='#define G_VA_COPY va_copy' ;;
x$glib_cv___va_copy) glib_vacopy='#define G_VA_COPY __va_copy' ;;
*) glib_vacopy=''
esac
if test x$glib_cv_va_val_copy = xno; then
glib_vacopy="\$glib_vacopy
#define G_VA_COPY_AS_ARRAY 1"
fi
if test x$glib_cv_hasinline = xyes; then
glib_inline='#define G_HAVE_INLINE 1'
fi
if test x$glib_cv_has__inline = xyes; then
glib_inline="\$glib_inline
#define G_HAVE___INLINE 1"
fi
if test x$glib_cv_has__inline__ = xyes; then
glib_inline="\$glib_inline
#define G_HAVE___INLINE__ 1"
fi
case xyes in
x$ac_cv_c_bigendian) g_byte_order=G_BIG_ENDIAN ;;
*) g_byte_order=G_LITTLE_ENDIAN ;;
esac
if test x$glib_wchar_h = xyes; then
glib_wc='
#define G_HAVE_WCHAR_H 1'
fi
if test x$glib_wctype_h = xyes; then
glib_wc="\$glib_wc
#define G_HAVE_WCTYPE_H 1"
fi
if test x$glib_working_wctype = xno; then
glib_wc="\$glib_wc
#define G_HAVE_BROKEN_WCTYPE 1"
fi
])
AC_OUTPUT([
Makefile
@ -503,4 +771,6 @@ glib-config
gmodule/gmoduleconf.h
gmodule/Makefile
docs/Makefile
],[chmod +x glib-config])
],[case "$CONFIG_FILES" in
*glib-config*)chmod +x glib-config;;
esac])

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>

175
glib.h
View File

@ -19,7 +19,41 @@
#ifndef __G_LIB_H__
#define __G_LIB_H__
/* system specific config file
/* system specific config file glibconfig.h provides definitions for
* the extrema of many of the standard types. These are:
*
* G_MINSHORT, G_MAXSHORT
* G_MININT, G_MAXINT
* G_MINLONG, G_MAXLONG
* G_MINFLOAT, G_MAXFLOAT
* G_MINDOUBLE, G_MAXDOUBLE
*
* It also provides the following typedefs:
*
* gint8, guint8
* gint16, guint16
* gint32, guint32
* gint64, guint64
*
* It defines the G_BYTE_ORDER symbol to one of G_*_ENDIAN (see later in
* this file).
*
* And it provides a way to store and retrieve a `gint' in/from a `gpointer'.
* This is useful to pass an integer instead of a pointer to a callback.
*
* GINT_TO_POINTER(i), GUINT_TO_POINTER(i)
* GPOINTER_TO_INT(p), GPOINTER_TO_UINT(p)
*
* Finally, it provide the following wrappers to STDC functions:
*
* g_ATEXIT
* To register hooks which are executed on exit().
* Usually a wrapper for STDC atexit.
*
* void *g_memmove(void *dest, const void *src, guint count);
* A wrapper for STDC memmove, or an implementation, if memmove doesn't
* exist. The prototype looks like the above, give or take a const,
* or size_t.
*/
#include <glibconfig.h>
@ -81,56 +115,6 @@
#pragma warning(disable:4244) /* No possible loss of data warnings, please */
#endif /* _MSC_VER */
/* glib provides definitions for the extrema of many
* of the standard types. These are:
* G_MINFLOAT
* G_MAXFLOAT
* G_MINDOUBLE
* G_MAXDOUBLE
* G_MINSHORT
* G_MAXSHORT
* G_MININT
* G_MAXINT
* G_MINLONG
* G_MAXLONG
*
* We include limits.h before float.h to work around a egcs 1.1
* oddity on Solaris 2.5.1
*/
#ifdef HAVE_LIMITS_H
# include <limits.h>
# define G_MINSHORT SHRT_MIN
# define G_MAXSHORT SHRT_MAX
# define G_MININT INT_MIN
# define G_MAXINT INT_MAX
# define G_MINLONG LONG_MIN
# define G_MAXLONG LONG_MAX
#elif HAVE_VALUES_H
# ifdef HAVE_FLOAT_H
# include <values.h>
# endif /* HAVE_FLOAT_H */
# define G_MINSHORT MINSHORT
# define G_MAXSHORT MAXSHORT
# define G_MININT MININT
# define G_MAXINT MAXINT
# define G_MINLONG MINLONG
# define G_MAXLONG MAXLONG
#endif /* HAVE_VALUES_H */
#ifdef HAVE_FLOAT_H
# include <float.h>
# define G_MINFLOAT FLT_MIN
# define G_MAXFLOAT FLT_MAX
# define G_MINDOUBLE DBL_MIN
# define G_MAXDOUBLE DBL_MAX
#elif HAVE_VALUES_H
# include <values.h>
# define G_MINFLOAT MINFLOAT
# define G_MAXFLOAT MAXFLOAT
# define G_MINDOUBLE MINDOUBLE
# define G_MAXDOUBLE MAXDOUBLE
#endif /* HAVE_VALUES_H */
#ifdef __cplusplus
extern "C" {
@ -304,26 +288,14 @@ extern "C" {
#define G_GNUC_PRETTY_FUNCTION ("")
#endif /* !__GNUC__ */
/* we try to provide a usefull equivalent for ATEXIT if it is
* not defined, but use is actually abandoned. people should
* use g_atexit() instead.
* keep this in sync with gutils.c.
*/
#ifndef ATEXIT
# ifdef HAVE_ATEXIT
# ifdef NeXT /* @#%@! NeXTStep */
# define ATEXIT(proc) (!atexit (proc))
# else /* !NeXT */
# define ATEXIT(proc) (atexit (proc))
# endif /* !NeXT */
# elif defined (HAVE_ON_EXIT)
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
# else
# error Could not determine proper atexit() implementation
# endif
# define ATEXIT(proc) g_ATEXIT(proc)
#else
# define G_NATIVE_ATEXIT
# define G_NATIVE_ATEXIT
#endif /* ATEXIT */
/* Hacker macro to place breakpoints for x86 machines.
@ -534,59 +506,6 @@ typedef double gldouble;
typedef void* gpointer;
typedef const void *gconstpointer;
#if (SIZEOF_CHAR == 1)
typedef signed char gint8;
typedef unsigned char guint8;
#endif /* SIZEOF_CHAR */
#if (SIZEOF_SHORT == 2)
typedef signed short gint16;
typedef unsigned short guint16;
#endif /* SIZEOF_SHORT */
#if (SIZEOF_INT == 4)
typedef signed int gint32;
typedef unsigned int guint32;
#elif (SIZEOF_LONG == 4)
typedef signed long gint32;
typedef unsigned long guint32;
#endif /* SIZEOF_INT */
#if (SIZEOF_LONG == 8)
#define HAVE_GINT64 1
typedef signed long gint64;
typedef unsigned long guint64;
#elif (SIZEOF_LONG_LONG == 8)
#define HAVE_GINT64 1
typedef signed long long gint64;
typedef unsigned long long guint64;
#else
/* No gint64 */
#undef HAVE_GINT64
#endif
/* Define macros for storing integers inside pointers
*/
#if (SIZEOF_INT == SIZEOF_VOID_P)
#define GPOINTER_TO_INT(p) ((gint)(p))
#define GPOINTER_TO_UINT(p) ((guint)(p))
#define GINT_TO_POINTER(i) ((gpointer)(i))
#define GUINT_TO_POINTER(u) ((gpointer)(u))
#elif (SIZEOF_LONG == SIZEOF_VOID_P)
#define GPOINTER_TO_INT(p) ((gint)(glong)(p))
#define GPOINTER_TO_UINT(p) ((guint)(gulong)(p))
#define GINT_TO_POINTER(i) ((gpointer)(glong)(i))
#define GUINT_TO_POINTER(u) ((gpointer)(gulong)(u))
#else
#error SIZEOF_VOID_P unknown - This should never happen
#endif
typedef gint32 gssize;
typedef guint32 gsize;
@ -601,12 +520,6 @@ typedef gint32 GTime;
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
#ifdef WORDS_BIGENDIAN
#define G_BYTE_ORDER G_BIG_ENDIAN
#else
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#endif
/* Basic bit swapping functions
*/
#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
@ -1653,20 +1566,6 @@ gchar* g_dirname (const gchar *file_name);
gchar* g_get_current_dir (void);
gchar* g_getenv (const gchar *variable);
/* We make the assumption that if memmove isn't available, then
* bcopy will do the job. This isn't safe everywhere. (bcopy can't
* necessarily handle overlapping copies).
* Either way, g_memmove() will not return a value.
*/
#ifdef HAVE_MEMMOVE
#define g_memmove(dest, src, size) G_STMT_START { \
memmove ((dest), (src), (size)); \
} G_STMT_END
#else
#define g_memmove(dest, src, size) G_STMT_START { \
bcopy ((src), (dest), (size)); \
} G_STMT_END
#endif
/* we use a GLib function as a replacement for ATEXIT, so
* the programmer is not required to check the return value

View File

@ -1,6 +1,10 @@
## Process this file with automake to produce Makefile.in
# build . first, then SUBDIRS
SUBDIRS = gmodule docs
all-recursive-am: all-am
# alpha `automake' supports this better
#SUBDIRS = . gmodule docs
configincludedir = $(pkglibdir)/include
@ -20,10 +24,6 @@ EXTRA_DIST = \
makefile.msc \
glibconfig.h.win32
# build . first, then SUBDIRS
all-recursive-am: all-am
lib_LTLIBRARIES = libglib.la
libglib_la_SOURCES = \
@ -54,6 +54,13 @@ include_HEADERS = \
configinclude_DATA = \
glibconfig.h
BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h
glibconfig.h: stamp-gc-h
@:
stamp-gc-h: config.status
CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibconfig.h ./config.status
echo timestamp > stamp-gc-h
libglib_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE)
INCLUDES = -I$(top_srcdir)

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>

View File

@ -19,7 +19,41 @@
#ifndef __G_LIB_H__
#define __G_LIB_H__
/* system specific config file
/* system specific config file glibconfig.h provides definitions for
* the extrema of many of the standard types. These are:
*
* G_MINSHORT, G_MAXSHORT
* G_MININT, G_MAXINT
* G_MINLONG, G_MAXLONG
* G_MINFLOAT, G_MAXFLOAT
* G_MINDOUBLE, G_MAXDOUBLE
*
* It also provides the following typedefs:
*
* gint8, guint8
* gint16, guint16
* gint32, guint32
* gint64, guint64
*
* It defines the G_BYTE_ORDER symbol to one of G_*_ENDIAN (see later in
* this file).
*
* And it provides a way to store and retrieve a `gint' in/from a `gpointer'.
* This is useful to pass an integer instead of a pointer to a callback.
*
* GINT_TO_POINTER(i), GUINT_TO_POINTER(i)
* GPOINTER_TO_INT(p), GPOINTER_TO_UINT(p)
*
* Finally, it provide the following wrappers to STDC functions:
*
* g_ATEXIT
* To register hooks which are executed on exit().
* Usually a wrapper for STDC atexit.
*
* void *g_memmove(void *dest, const void *src, guint count);
* A wrapper for STDC memmove, or an implementation, if memmove doesn't
* exist. The prototype looks like the above, give or take a const,
* or size_t.
*/
#include <glibconfig.h>
@ -81,56 +115,6 @@
#pragma warning(disable:4244) /* No possible loss of data warnings, please */
#endif /* _MSC_VER */
/* glib provides definitions for the extrema of many
* of the standard types. These are:
* G_MINFLOAT
* G_MAXFLOAT
* G_MINDOUBLE
* G_MAXDOUBLE
* G_MINSHORT
* G_MAXSHORT
* G_MININT
* G_MAXINT
* G_MINLONG
* G_MAXLONG
*
* We include limits.h before float.h to work around a egcs 1.1
* oddity on Solaris 2.5.1
*/
#ifdef HAVE_LIMITS_H
# include <limits.h>
# define G_MINSHORT SHRT_MIN
# define G_MAXSHORT SHRT_MAX
# define G_MININT INT_MIN
# define G_MAXINT INT_MAX
# define G_MINLONG LONG_MIN
# define G_MAXLONG LONG_MAX
#elif HAVE_VALUES_H
# ifdef HAVE_FLOAT_H
# include <values.h>
# endif /* HAVE_FLOAT_H */
# define G_MINSHORT MINSHORT
# define G_MAXSHORT MAXSHORT
# define G_MININT MININT
# define G_MAXINT MAXINT
# define G_MINLONG MINLONG
# define G_MAXLONG MAXLONG
#endif /* HAVE_VALUES_H */
#ifdef HAVE_FLOAT_H
# include <float.h>
# define G_MINFLOAT FLT_MIN
# define G_MAXFLOAT FLT_MAX
# define G_MINDOUBLE DBL_MIN
# define G_MAXDOUBLE DBL_MAX
#elif HAVE_VALUES_H
# include <values.h>
# define G_MINFLOAT MINFLOAT
# define G_MAXFLOAT MAXFLOAT
# define G_MINDOUBLE MINDOUBLE
# define G_MAXDOUBLE MAXDOUBLE
#endif /* HAVE_VALUES_H */
#ifdef __cplusplus
extern "C" {
@ -304,26 +288,14 @@ extern "C" {
#define G_GNUC_PRETTY_FUNCTION ("")
#endif /* !__GNUC__ */
/* we try to provide a usefull equivalent for ATEXIT if it is
* not defined, but use is actually abandoned. people should
* use g_atexit() instead.
* keep this in sync with gutils.c.
*/
#ifndef ATEXIT
# ifdef HAVE_ATEXIT
# ifdef NeXT /* @#%@! NeXTStep */
# define ATEXIT(proc) (!atexit (proc))
# else /* !NeXT */
# define ATEXIT(proc) (atexit (proc))
# endif /* !NeXT */
# elif defined (HAVE_ON_EXIT)
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
# else
# error Could not determine proper atexit() implementation
# endif
# define ATEXIT(proc) g_ATEXIT(proc)
#else
# define G_NATIVE_ATEXIT
# define G_NATIVE_ATEXIT
#endif /* ATEXIT */
/* Hacker macro to place breakpoints for x86 machines.
@ -534,59 +506,6 @@ typedef double gldouble;
typedef void* gpointer;
typedef const void *gconstpointer;
#if (SIZEOF_CHAR == 1)
typedef signed char gint8;
typedef unsigned char guint8;
#endif /* SIZEOF_CHAR */
#if (SIZEOF_SHORT == 2)
typedef signed short gint16;
typedef unsigned short guint16;
#endif /* SIZEOF_SHORT */
#if (SIZEOF_INT == 4)
typedef signed int gint32;
typedef unsigned int guint32;
#elif (SIZEOF_LONG == 4)
typedef signed long gint32;
typedef unsigned long guint32;
#endif /* SIZEOF_INT */
#if (SIZEOF_LONG == 8)
#define HAVE_GINT64 1
typedef signed long gint64;
typedef unsigned long guint64;
#elif (SIZEOF_LONG_LONG == 8)
#define HAVE_GINT64 1
typedef signed long long gint64;
typedef unsigned long long guint64;
#else
/* No gint64 */
#undef HAVE_GINT64
#endif
/* Define macros for storing integers inside pointers
*/
#if (SIZEOF_INT == SIZEOF_VOID_P)
#define GPOINTER_TO_INT(p) ((gint)(p))
#define GPOINTER_TO_UINT(p) ((guint)(p))
#define GINT_TO_POINTER(i) ((gpointer)(i))
#define GUINT_TO_POINTER(u) ((gpointer)(u))
#elif (SIZEOF_LONG == SIZEOF_VOID_P)
#define GPOINTER_TO_INT(p) ((gint)(glong)(p))
#define GPOINTER_TO_UINT(p) ((guint)(gulong)(p))
#define GINT_TO_POINTER(i) ((gpointer)(glong)(i))
#define GUINT_TO_POINTER(u) ((gpointer)(gulong)(u))
#else
#error SIZEOF_VOID_P unknown - This should never happen
#endif
typedef gint32 gssize;
typedef guint32 gsize;
@ -601,12 +520,6 @@ typedef gint32 GTime;
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
#ifdef WORDS_BIGENDIAN
#define G_BYTE_ORDER G_BIG_ENDIAN
#else
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#endif
/* Basic bit swapping functions
*/
#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
@ -1653,20 +1566,6 @@ gchar* g_dirname (const gchar *file_name);
gchar* g_get_current_dir (void);
gchar* g_getenv (const gchar *variable);
/* We make the assumption that if memmove isn't available, then
* bcopy will do the job. This isn't safe everywhere. (bcopy can't
* necessarily handle overlapping copies).
* Either way, g_memmove() will not return a value.
*/
#ifdef HAVE_MEMMOVE
#define g_memmove(dest, src, size) G_STMT_START { \
memmove ((dest), (src), (size)); \
} G_STMT_END
#else
#define g_memmove(dest, src, size) G_STMT_START { \
bcopy ((src), (dest), (size)); \
} G_STMT_END
#endif
/* we use a GLib function as a replacement for ATEXIT, so
* the programmer is not required to check the return value

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "glib.h"

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "glibconfig.h"
#ifdef HAVE_UNISTD_H

5
gmem.c
View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "glib.h"

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -16,6 +16,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "glibconfig.h"
#ifdef HAVE_UNISTD_H