00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00029 #ifndef _LIB_SCONFIG_H_
00030 #define _LIB_SCONFIG_H_ 1
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #if !defined(_GNU_SOURCE)
00081 # define _GNU_SOURCE
00082 #endif
00083
00084
00085 #ifndef _REENTRANT
00086 # define _REENTRANT
00087 #endif
00088
00089
00090
00091
00092 #if !defined(__cplusplus) && \
00093 (defined(__CPLUSPLUS) || defined(c_plusplus) || defined(C_PLUSPLUS))
00094 #define __cplusplus 1
00095 #endif
00096
00097
00098
00099 #include <glibconfig.h>
00100
00101
00102 #if defined(G_OS_WIN32)
00103 # include "config-w32.h"
00104 #endif
00105
00106
00107 #if HAVE_CONFIG_H
00108 # include <config.h>
00109 #endif
00110
00111
00112
00113
00114 #if STDC_HEADERS
00115 # include <stdlib.h>
00116 # include <stddef.h>
00117 #else
00118 # if HAVE_STDLIB_H
00119 # include <stdlib.h>
00120 # endif
00121 #endif
00122 #if HAVE_STRING_H
00123 # if !STDC_HEADERS && HAVE_MEMORY_H
00124 # include <memory.h>
00125 # endif
00126 # include <string.h>
00127 #endif
00128 #if HAVE_STRINGS_H
00129 # include <strings.h>
00130 #endif
00131 #if HAVE_INTTYPES_H
00132 # include <inttypes.h>
00133 #else
00134 # if HAVE_STDINT_H
00135 # include <stdint.h>
00136 # endif
00137 #endif
00138
00139
00140
00141 #ifndef G_THREADS_ENABLED
00142 # error "You need to enable threads in glib."
00143 #endif
00144
00147 #ifndef USE_PRIVATE__PTHREADS
00148 # ifdef G_THREADS_IMPL_POSIX
00149
00150
00151 # define USE_PRIVATE__PTHREADS 1
00152 # else
00153 # define USE_PRIVATE__PTHREADS 0
00154 # endif
00155 #endif
00156
00157
00160 #ifndef USE_PRIVATE__POSIX_SEMAPHORES
00161 # if USE_PRIVATE__PTHREADS && HAVE_SEMAPHORE_H
00162 # define USE_PRIVATE__POSIX_SEMAPHORES 1
00163 # else
00164 # define USE_PRIVATE__POSIX_SEMAPHORES 0
00165 # endif
00166 #endif
00167
00168
00171 #ifndef USE_PRIVATE__ATOMIC
00172 # if HAVE_ASM_ATOMIC_H || HAVE_ATOMIC_H
00173 # define USE_PRIVATE__ATOMIC 1
00174 # else
00175 # define USE_PRIVATE__ATOMIC 0
00176 # endif
00177 #endif
00178
00179
00180
00181 #ifndef USE_PRIVATE__TIMEVAL
00182 # if HAVE_GETTIMEOFDAY
00183 # define USE_PRIVATE__TIMEVAL 1
00184 #else
00185 # define USE_PRIVATE__TIMEVAL 0
00186 # endif
00187 #endif
00188
00189
00191 typedef unsigned char uchar;
00192
00195 typedef unsigned int uint;
00196
00198 typedef unsigned char uint8;
00199
00201 typedef signed char int8;
00202
00204 typedef guint16 uint16;
00205
00207 typedef gint16 int16;
00208
00210 typedef guint32 uint32;
00211
00213 typedef gint32 int32;
00214
00216 typedef guint64 uint64;
00217
00219 typedef gint64 int64;
00220
00221
00223 typedef int64 filepos_t;
00224
00226 typedef double dbl;
00227
00229 typedef float flt;
00230
00231
00232 #if !HAVE_SSIZE_T
00233 typedef signed int ssize_t;
00234 #endif
00235
00236 #if HAVE_ATTRIBUTE_ALWAYS_INLINE
00237 # ifdef __OPTIMIZE__
00238 # define inline inline __attribute__((always_inline))
00239 # endif
00240 #endif
00241
00242 #if HAVE_ATTRIBUTE_NOINLINE
00243 # define _noinline_ __attribute__((noinline))
00244 #endif
00245
00246
00247
00248 #if HAVE_ATTRIBUTE_CONST
00249 # define _constfn_ __attribute__((__const__))
00250
00251 #else
00252 # define _constfn_
00253
00254 #endif
00255
00256 #if HAVE_ATTRIBUTE_PURE
00257 # define _purefn_ __attribute__((pure))
00258 #else
00259 # define _purefn_
00260 #endif
00261
00262 #if HAVE_ATTRIBUTE_DEPRECATED
00263 # define _deprecated_ __attribute__((deprecated))
00264 #else
00265 # define _deprecated_
00266 #endif
00267
00268
00269 #if HAVE_ATTRIBUTE_PACKED
00270 # define _packed_ __attribute__((__packed__))
00271 #else
00272 # define _packed_
00273 #endif
00274
00275
00276 #if HAVE_ATTRIBUTE_FORMAT
00277 # define _fnformat_(A,B,C) __attribute__((__format__ (A, B, C)))
00278 #else
00279 # define _fnformat_(A,B,C)
00280 #endif
00281
00282
00283 #if HAVE_ATTRIBUTE_UNUSED
00284 # define _unused_ __attribute__((__unused__))
00285 #else
00286 # define _unused_
00287 #endif
00288
00289
00290 #if HAVE_FIELD_COLON_VALUE_INIT
00291
00292
00293 # define INIT_FIELD(x) x:
00294 #else
00295
00296 # define INIT_FIELD(x) .x=
00297 #endif
00298
00299
00300 #if HAVE_STATIC_CONST_FP_MEMB
00301 # define USE_STATIC_CONST_FP_MEMB 1
00302 #else
00303 # define USE_STATIC_CONST_FP_MEMB 0
00304 #endif
00305
00306 #ifndef DOXYGEN_IS_SCANNING
00307
00308
00309
00310 #if HAVE_BUILTIN_EXPECT
00311 # define likely(x) __builtin_expect(!!(x), 1)
00312 # define unlikely(x) __builtin_expect(!!(x), 0)
00313 #else
00314
00315 # define likely(x) (x)
00316 # define unlikely(x) (x)
00317 #endif
00318 #else
00319
00320 #error "We may not be here!"
00321
00331 #define likely(x)
00332
00343 #define unlikely(x)
00344
00345 #endif
00346
00347
00348
00349 #if defined(DOXYGEN_IS_SCANNING)
00350 # error "You may not compile with DOXYGEN_IS_SCANNING enabled."
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 #endif
00364
00365
00366 #include <assert.h>
00367
00395 #define Assert(X) do { if(!likely(X)) assert(X); } while(0)
00396
00408 #define CritAssert(X) do { if(!likely(X)) assert(X); } while(0)
00409
00410
00416 #ifndef LMALLOC_DEBUGGING
00417 #define LMALLOC_DEBUGGING 1
00418 #endif
00419
00420 #ifndef USE_MALLOC_USABLE_SIZE
00421 # define USE_MALLOC_USABLE_SIZE HAVE_MALLOC_USABLE_SIZE
00422 #endif
00423
00424
00425 #include <lib/salloc.h>
00426
00427 #endif