2006-08-17 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Thu, 17 Aug 2006 22:35:24 +0000 (22:35 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 17 Aug 2006 22:35:24 +0000 (22:35 -0000)
* 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.

svn path=/trunk/mono/; revision=63949

eglib/ChangeLog
eglib/TODO
eglib/configure.in
eglib/src/Makefile.am
eglib/src/glib.h

index 5414e3390f9371e7d0bb322d1b309d93ef5e27db..d90e34f5876c42f3d9a60b1aa2d73a0adba9f574 100644 (file)
@@ -1,3 +1,10 @@
+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)
index d65ace42f82fc92b722a15030cd2a71c333fbedf..47487814c7e8db94f630b07fa46537ddae94b09e 100644 (file)
@@ -140,35 +140,23 @@ Routines missing from eglib, by count number:
       1 g_get_prgname
       1 g_get_charset
       1 g_filename_from_utf8
-      1 g_bit_nth_msf
       1 g_ascii_strdown
       1 g_ascii_isprint
       1 g_array_remove_index
 
 Macros:
-    124 G_GNUC_PRETTY_FUNCTION
      40 G_GSIZE_FORMAT
-     40 G_GNUC_UNUSED
-     20 G_LITTLE_ENDIAN
-     16 G_DIR_SEPARATOR_S
-     12 G_BREAKPOINT
-     10 G_STMT_START
-     10 G_STMT_END
       9 G_GUINT64_FORMAT
       7 G_FILE_TEST_IS_DIR
       6 G_UNLIKELY
       6 G_HASH_TABLE_RESIZE
-      6 G_DIR_SEPARATOR
       5 G_UNLOCK
       5 G_LOCK
       4 G_LIKELY
-      4 G_GNUC_NORETURN
       4 G_FILE_TEST_IS_REGULAR
-      3 G_SEARCHPATH_SEPARATOR_S
       2 G_USEC_PER_SEC
       2 G_STRLOC
       2 G_IO_NVAL
-      2 G_BIG_ENDIAN
       1 G_SPAWN_SEARCH_PATH
       1 G_IO_PRI
       1 G_ALLOC_ONLY
index fd7313fd49d50bbf078fde319ad8bf40bafc32a5..fe614dfd714c5928387907209f9d7fc777b8f055 100644 (file)
@@ -10,8 +10,44 @@ AM_PROG_LIBTOOL
 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
index 4d084d09a66acf2770a30b5d4b433f0b90d6e830..18c2a3a8d86f31c3efb783f3ce4b3f8a08d61472 100644 (file)
@@ -1,13 +1,15 @@
 noinst_LTLIBRARIES = libeglib.la
 
 libeglib_la_SOURCES = \
-       ghashtable.c \
-       gmem.c       \
-       gmodule.c    \
-       goutput.c    \
-       gstr.c       \
-       gslist.c     \
-       gstring.c    \
+       eglib-config.h  \
+       glib.h          \       
+       ghashtable.c    \
+       gmem.c          \
+       gmodule.c       \
+       goutput.c       \
+       gstr.c          \
+       gslist.c        \
+       gstring.c       \
        gptrarray.c
 
 libeglib_la_CFLAGS = -Wall -Werror -D_FORTIFY_SOURCE=2
@@ -18,3 +20,4 @@ libeglib_la_LIBADD = -lm
 
 MAINTAINERCLEANFILES = Makefile.in
 
+EXTRA_DIST = eglib-config.h.in
\ No newline at end of file
index 3b537797141da791056d01dd78b1e7d03bfe0a54..ccd8732906dfaa02e65f2d1df78a8496f28306f8 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <eglib-config.h>
 
 /*
  * Basic data types
@@ -38,9 +39,16 @@ typedef unsigned char  guchar;
 #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
  */
@@ -66,8 +74,8 @@ gpointer g_memdup (gconstpointer mem, guint byte_size);
 /*
  * 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
@@ -103,8 +111,8 @@ guint    g_int_hash     (gconstpointer v1);
 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