Merge remote branch 'gvdb/master'
[platform/upstream/glib.git] / glib / gtypes.h
index a7ec358..e616f99 100644 (file)
  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GLib Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
- * GLib at ftp://ftp.gtk.org/pub/gtk/. 
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
  */
 
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
 #ifndef __G_TYPES_H__
 #define __G_TYPES_H__
 
 #include <glibconfig.h>
+#include <glib/gmacros.h>
 
 G_BEGIN_DECLS
 
@@ -65,7 +70,7 @@ typedef double  gdouble;
 #define G_MAXINT32     ((gint32)  0x7fffffff)
 #define G_MAXUINT32    ((guint32) 0xffffffff)
 
-#define G_MININT64     G_GINT64_CONSTANT(0x8000000000000000)
+#define G_MININT64     ((gint64) G_GINT64_CONSTANT(0x8000000000000000))
 #define G_MAXINT64     G_GINT64_CONSTANT(0x7fffffffffffffff)
 #define G_MAXUINT64    G_GINT64_CONSTANT(0xffffffffffffffffU)
 
@@ -88,16 +93,39 @@ typedef void            (*GHFunc)               (gpointer       key,
                                                  gpointer       user_data);
 typedef void            (*GFreeFunc)            (gpointer       data);
 
+/**
+ * GTranslateFunc:
+ * @str: the untranslated string
+ * @data: user data specified when installing the function, e.g.
+ *  in g_option_group_set_translate_func()
+ * 
+ * The type of functions which are used to translate user-visible
+ * strings, for <option>--help</option> output.
+ * 
+ * Returns: a translation of the string for the current locale.
+ *  The returned string is owned by GLib and must not be freed.
+ */
+typedef const gchar *   (*GTranslateFunc)       (const gchar   *str,
+                                                gpointer       data);
+
+
 /* Define some mathematical constants that aren't available
  * symbolically in some strict ISO C implementations.
+ *
+ * Note that the large number of digits used in these definitions
+ * doesn't imply that GLib or current computers in general would be
+ * able to handle floating point numbers with an accuracy like this.
+ * It's mostly an exercise in futility and future proofing. For
+ * extended precision floating point support, look somewhere else
+ * than GLib.
  */
-#define G_E     2.7182818284590452354E0
-#define G_LN2   6.9314718055994530942E-1
-#define G_LN10  2.3025850929940456840E0
-#define G_PI    3.14159265358979323846E0
-#define G_PI_2  1.57079632679489661923E0
-#define G_PI_4  0.78539816339744830962E0
-#define G_SQRT2 1.4142135623730950488E0
+#define G_E     2.7182818284590452353602874713526624977572470937000
+#define G_LN2   0.69314718055994530941723212145817656807550013436026
+#define G_LN10  2.3025850929940456840179914546843642076011014886288
+#define G_PI    3.1415926535897932384626433832795028841971693993751
+#define G_PI_2  1.5707963267948966192313216916397514420985846996876
+#define G_PI_4  0.78539816339744830961566084581987572104929234984378
+#define G_SQRT2 1.4142135623730950488016887242096980785696718753769
 
 /* Portable endian checks and conversions
  *
@@ -156,7 +184,7 @@ typedef void            (*GFreeFunc)            (gpointer       data);
            __v; }))
 #    if !defined (__i486__) && !defined (__i586__) \
        && !defined (__pentium__) && !defined (__i686__) \
-       && !defined (__pentiumpro__)
+       && !defined (__pentiumpro__) && !defined (__pentium4__)
 #       define GUINT32_SWAP_LE_BE_IA32(val) \
          (__extension__                                        \
           ({ register guint32 __v, __x = ((guint32) (val));    \
@@ -307,6 +335,11 @@ typedef void            (*GFreeFunc)            (gpointer       data);
 #define GINT_FROM_BE(val)      (GINT_TO_BE (val))
 #define GUINT_FROM_BE(val)     (GUINT_TO_BE (val))
 
+#define GSIZE_FROM_LE(val)     (GSIZE_TO_LE (val))
+#define GSSIZE_FROM_LE(val)    (GSSIZE_TO_LE (val))
+#define GSIZE_FROM_BE(val)     (GSIZE_TO_BE (val))
+#define GSSIZE_FROM_BE(val)    (GSSIZE_TO_BE (val))
+
 
 /* Portable versions of host-network order stuff
  */
@@ -393,7 +426,7 @@ struct _GTimeVal
 G_END_DECLS
 
 /* We prefix variable declarations so they can
- * properly get exported in windows dlls.
+ * properly get exported in Windows DLLs.
  */
 #ifndef GLIB_VAR
 #  ifdef G_PLATFORM_WIN32
@@ -416,4 +449,3 @@ G_END_DECLS
 #endif /* GLIB_VAR */
 
 #endif /* __G_TYPES_H__ */
-