+2006-08-17 Miguel de Icaza <miguel@novell.com>
+
+ * src/glib.h: A handful of extra macros
+
+ * configure.in, src/eglib-config.h.in: Set some system-specific
+ settings that are probed at configure time.
+
2006-08-17 Aaron Bockover <abockover@novell.com>
* src/gptrarray.c: Added beginnings of GPtrArray (alloc, free, add, iterate)
CFLAGS='-g -O0'
AC_SUBST(CFLAGS)
+GNUC_PRETTY=
+GNUC_UNUSED=
+BREAKPOINT=
+if test x$GCC = xyes; then
+ GNUC_PRETTY=__PRETTY_FUNCTION__
+ GNUC_UNUSED='__attribute__((__unused__))'
+ GNUC_NORETURN='__attribute__((__noreturn__))'
+ case $target in
+ i[3456]86-*)
+ BREAKPOINT="G_STMT_START { __asm__ ("int $03"); } G_STMT_END"
+ ;;
+ esac
+fi
+AC_SUBST(GNUC_PRETTY)
+AC_SUBST(GNUC_UNUSED)
+AC_SUBST(GNUC_NORETURN)
+AC_SUBST(BREAKPOINT)
+
+AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
+AC_SUBST(ORDER)
+
+case $host in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+ PATHSEP='\\'
+ SEARCHSEP=';'
+ ;;
+*)
+ PATHSEP='/'
+ SEARCHSEP=':'
+ ;;
+esac
+
+AC_SUBST(PATHSEP)
+AC_SUBST(SEARCHSEP)
+
AC_OUTPUT([
Makefile
src/Makefile
+src/eglib-config.h
test/Makefile
])
\ No newline at end of file
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <eglib-config.h>
/*
* Basic data types
#define GINT_TO_POINTER(v) ((gpointer) (v))
#define GUINT_TO_POINTER(v) ((gpointer) (v))
+#define G_GSIZE_FORMAT "u"
+#define G_LITTLE_ENDIAN 1234
+#define G_BIG_ENDIAN 4321
+#define G_STMT_START do
+#define G_STMT_END while (0)
+
#define G_STRUCT_OFFSET(p_type,field) \
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
+
/*
* Allocation
*/
/*
* Precondition macros
*/
-#define g_return_if_fail(x) do { if (!(x)) { printf ("%s:%d: assertion %s failed", __FILE__, __LINE__, #x); return; } } while (0) ;
-#define g_return_val_if_fail(x,e) do { if (!(x)) { printf ("%s:%d: assertion %s failed", __FILE__, __LINE__, #x); return (e); } } while (0) ;
+#define g_return_if_fail(x) G_STMT_START { if (!(x)) { printf ("%s:%d: assertion %s failed", __FILE__, __LINE__, #x); return; } } G_STMT_END
+#define g_return_val_if_fail(x,e) G_STMT_START { if (!(x)) { printf ("%s:%d: assertion %s failed", __FILE__, __LINE__, #x); return (e); } } G_STMT_END
/*
* Hashtables
gboolean g_str_equal (gconstpointer v1, gconstpointer v2);
guint g_str_hash (gconstpointer v1);
-#define g_assert(x) do { if (!(x)) g_error ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } while (0)
-#define g_assert_not_reached() do { g_error ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } while (0)
+#define g_assert(x) G_STMT_START { if (!(x)) g_error ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END
+#define g_assert_not_reached() G_STMT_START { g_error ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } G_STMT_END
/*
* Strings utility