glibconfig.h.win32.in revision f9da22ef0739705a3536214ae8e02b1b46f9722a
1/* glibconfig.h.win32 */
2/* Handcrafted for Microsoft C and gcc -mno-cygwin ("mingw32"). */
3
4#ifndef __G_LIBCONFIG_H__
5#define __G_LIBCONFIG_H__
6
7#include <gmacros.h>
8
9#ifdef _MSC_VER
10/* Make MSVC more pedantic, this is a recommended pragma list
11 * from _Win32_Programming_ by Rector and Newcomer.
12 */
13#pragma warning(error:4002)
14#pragma warning(error:4003)
15#pragma warning(1:4010)
16#pragma warning(error:4013)
17#pragma warning(1:4016)
18#pragma warning(error:4020)
19#pragma warning(error:4021)
20#pragma warning(error:4027)
21#pragma warning(error:4029)
22#pragma warning(error:4033)
23#pragma warning(error:4035)
24#pragma warning(error:4045)
25#pragma warning(error:4047)
26#pragma warning(error:4049)
27#pragma warning(error:4053)
28#pragma warning(error:4071)
29#pragma warning(disable:4101)
30#pragma warning(error:4150)
31
32#pragma warning(disable:4244)	/* No possible loss of data warnings */
33#pragma warning(disable:4305)   /* No truncation from int to char warnings */
34#endif /* _MSC_VER */
35
36#include <limits.h>
37#include <float.h>
38
39#define G_MINFLOAT	FLT_MIN
40#define G_MAXFLOAT	FLT_MAX
41#define G_MINDOUBLE	DBL_MIN
42#define G_MAXDOUBLE	DBL_MAX
43#define G_MINSHORT	SHRT_MIN
44#define G_MAXSHORT	SHRT_MAX
45#define G_MAXUSHORT	USHRT_MAX
46#define G_MININT	INT_MIN
47#define G_MAXINT	INT_MAX
48#define G_MAXUINT	UINT_MAX
49#define G_MINLONG	LONG_MIN
50#define G_MAXLONG	LONG_MAX
51#define G_MAXULONG	ULONG_MAX
52
53G_BEGIN_DECLS
54
55typedef signed char gint8;
56typedef unsigned char guint8;
57typedef signed short gint16;
58typedef unsigned short guint16;
59#define G_GINT16_FORMAT "hi"
60#define G_GUINT16_FORMAT "hu"
61typedef signed int gint32;
62typedef unsigned int guint32;
63#define G_GINT32_FORMAT "i"
64#define G_GUINT32_FORMAT "u"
65
66#define G_HAVE_GINT64 1
67
68/* These are compiler specific */
69#ifdef _MSC_VER
70typedef __int64 gint64;
71typedef unsigned __int64 guint64;
72#define G_GINT64_CONSTANT(val)	(val##i64)
73#elif __GNUC__
74typedef long long gint64;
75typedef unsigned long long guint64;
76#define G_GINT64_CONSTANT(val)	(val##LL)
77#endif
78
79/* These depend on the C library. Using this file means the we
80 * use the (bundled) Microsoft msvcrt.dll.
81 */
82#define G_GINT64_FORMAT "I64i"
83#define G_GUINT64_FORMAT "I64u"
84
85#define GLIB_SIZEOF_VOID_P 4
86#define GLIB_SIZEOF_LONG   4
87
88typedef gint32 gssize;
89typedef guint32 gsize;
90
91#define GPOINTER_TO_INT(p)	((gint)(p))
92#define GPOINTER_TO_UINT(p)	((guint)(p))
93
94#define GINT_TO_POINTER(i)	((gpointer)(i))
95#define GUINT_TO_POINTER(u)	((gpointer)(u))
96
97#define g_ATEXIT(proc)	(atexit (proc))
98
99#define g_memmove(d,s,n) G_STMT_START { memmove ((d), (s), (n)); } G_STMT_END
100
101#define GLIB_MAJOR_VERSION @GLIB_MAJOR_VERSION@
102#define GLIB_MINOR_VERSION @GLIB_MINOR_VERSION@
103#define GLIB_MICRO_VERSION @GLIB_MICRO_VERSION@
104
105#define G_OS_WIN32
106
107#ifdef	__cplusplus
108#define	G_HAVE_INLINE	1
109#else	/* !__cplusplus */
110#define G_HAVE___INLINE 1
111#endif
112
113#define G_THREADS_ENABLED
114/*
115 * The following program can be used to determine the magic values below:
116 * #include <stdio.h>
117 * #include <pthread.h>
118 * main(int argc, char **argv)
119 * {
120 *   int i;
121 *   pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
122 *   printf ("sizeof (pthread_mutex_t) = %d\n", sizeof (pthread_mutex_t));
123 *   printf ("sizeof (pthread_t) = %d\n", sizeof (pthread_t));
124 *   printf ("PTHREAD_MUTEX_INITIALIZER = ");
125 *   for (i = 0; i < sizeof (pthread_mutex_t); i++)
126 *     printf ("%u, ", ((unsigned char *) &m)[i]);
127 *   printf ("\n");
128 *   exit(0);
129 * }
130 */
131
132#define G_THREADS_IMPL_POSIX
133typedef struct _GStaticMutex GStaticMutex;
134struct _GStaticMutex
135{
136  struct _GMutex *runtime_mutex;
137  struct {
138    union {
139      /* The size of the pad array should be sizeof (pthread_mutex_t) */
140      /* This value corresponds to the 1999-05-30 version of pthreads-win32 */
141      char   pad[4];
142      double dummy_double;
143      void  *dummy_pointer;
144      long   dummy_long;
145    } mutex;
146    void *debug_info;
147  } static_mutex;
148};
149/* This should be NULL followed by the bytes in PTHREAD_MUTEX_INITIALIZER */
150#define	G_STATIC_MUTEX_INIT	{ NULL, { { 255, 255, 255, 255 } } }
151#define	g_static_mutex_get_mutex(mutex) \
152  (g_thread_use_default_impl ? ((GMutex*) &((mutex)->static_mutex)) : \
153   g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))
154/* This represents a system thread as used by the implementation. An
155 * alien implementaion, as loaded by g_thread_init can only count on
156 * "sizeof (gpointer)" bytes to store their info. We however need more
157 * for some of our native implementations. */
158typedef union _GSystemThread GSystemThread;
159union _GSystemThread
160{
161  /* The size of the data array should be sizeof (pthread_t) */
162  /* This value corresponds to the 1999-05-30 version of pthreads-win32 */
163  char   data[4];
164  double dummy_double;
165  void  *dummy_pointer;
166  long   dummy_long;
167};
168
169#define GINT16_TO_LE(val)	((gint16) (val))
170#define GUINT16_TO_LE(val)	((guint16) (val))
171#define GINT16_TO_BE(val)	((gint16) GUINT16_SWAP_LE_BE (val))
172#define GUINT16_TO_BE(val)	(GUINT16_SWAP_LE_BE (val))
173
174#define GINT32_TO_LE(val)	((gint32) (val))
175#define GUINT32_TO_LE(val)	((guint32) (val))
176#define GINT32_TO_BE(val)	((gint32) GUINT32_SWAP_LE_BE (val))
177#define GUINT32_TO_BE(val)	(GUINT32_SWAP_LE_BE (val))
178
179#define GINT64_TO_LE(val)	((gint64) (val))
180#define GUINT64_TO_LE(val)	((guint64) (val))
181#define GINT64_TO_BE(val)	((gint64) GUINT64_SWAP_LE_BE (val))
182#define GUINT64_TO_BE(val)	(GUINT64_SWAP_LE_BE (val))
183
184#define GLONG_TO_LE(val)	((glong) GINT32_TO_LE (val))
185#define GULONG_TO_LE(val)	((gulong) GUINT32_TO_LE (val))
186#define GLONG_TO_BE(val)	((glong) GINT32_TO_BE (val))
187#define GULONG_TO_BE(val)	((gulong) GUINT32_TO_BE (val))
188
189#define GINT_TO_LE(val)		((gint) GINT32_TO_LE (val))
190#define GUINT_TO_LE(val)	((guint) GUINT32_TO_LE (val))
191#define GINT_TO_BE(val)		((gint) GINT32_TO_BE (val))
192#define GUINT_TO_BE(val)	((guint) GUINT32_TO_BE (val))
193#define G_BYTE_ORDER G_LITTLE_ENDIAN
194
195#define GLIB_SYSDEF_POLLIN	= 1
196#define GLIB_SYSDEF_POLLOUT	= 4
197#define GLIB_SYSDEF_POLLPRI	= 2
198#define GLIB_SYSDEF_POLLERR	= 8
199#define GLIB_SYSDEF_POLLHUP	= 16
200#define GLIB_SYSDEF_POLLNVAL	= 32
201
202#define G_MODULE_SUFFIX "dll"
203
204G_END_DECLS
205
206#endif /* __G_LIBCONFIG_H__ */
207