Navit SVN

/work/compile/navit/src/navit/support/glib/fake.h

00001 #include "config.h"
00002 #ifndef HAVE_API_WIN32_BASE
00003 #define USE_POSIX_THREADS 1
00004 #endif
00005 #if USE_POSIX_THREADS
00006 #include <pthread.h>
00007 #endif
00008 #include "debug.h"
00009 
00010 #define g_return_if_fail
00011 
00012 
00013 #if USE_POSIX_THREADS
00014 # define GMutex pthread_mutex_t
00015 # define g_mutex_new g_mutex_new_navit
00016 # define g_mutex_lock(lock) ((lock == NULL) ? 0 : pthread_mutex_lock(lock))
00017 # define g_mutex_unlock(lock) ((lock == NULL) ? 0 : pthread_mutex_unlock(lock))
00018 # define g_mutex_trylock(lock) (((lock == NULL) ? 0 : pthread_mutex_trylock(lock)) == 0)
00019 #  define GPrivate pthread_key_t
00020 #  define g_private_new(xd) g_private_new_navit()
00021 #  define g_private_get(xd) pthread_getspecific(xd)
00022 #  define g_private_set(a,b) pthread_setspecific(a, b)
00023 #else
00024 # if HAVE_API_WIN32_BASE
00025 #  define GMutex CRITICAL_SECTION
00026 #  define g_mutex_new g_mutex_new_navit
00027 #  define g_mutex_lock(lock) (EnterCriticalSection(lock))
00028 #  define g_mutex_unlock(lock) (LeaveCriticalSection(lock))
00029 #  define g_mutex_trylock(lock) (TryEnterCriticalSection(lock))
00030 #  define GPrivate int
00031 #  define g_private_new(xd) g_private_new_navit()
00032 #  define g_private_get(xd) TlsGetValue(xd)
00033 #  define g_private_set(a,b) TlsSetValue(a, b)
00034 # endif
00035 #endif
00036 
00037 char* g_convert               (const char  *str,
00038                                 int        len,            
00039                                 const char  *to_codeset,
00040                                 const char  *from_codeset,
00041                                 int        *bytes_read,     
00042                                 int        *bytes_written,  
00043                                 void      **error);
00044 #define G_LOCK_DEFINE_STATIC(name)    //void
00045 #define G_LOCK(name) //void //g_mutex_lock       (&G_LOCK_NAME (name))
00046 #define G_UNLOCK(name) //void //g_mutex_unlock   (&G_LOCK_NAME (name))
00047 
00048 #define g_thread_supported() TRUE
00049 
00050 #define g_assert(expr) dbg_assert (expr)