1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/glib/glib/glib_wsd.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,361 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +#ifndef __GLIB_WSD_H__
1.24 +#define __GLIB_WSD_H__
1.25 +
1.26 +#if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
1.27 +
1.28 +#include <_ansi.h>
1.29 +#include <sys/cdefs.h>
1.30 +#include <glib.h>
1.31 +
1.32 +
1.33 +/* --------------------- MACRO DEFINATIONS ------------------------*/
1.34 +#ifndef EMULATOR
1.35 +#define EMULATOR (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
1.36 +#endif /* EMULATOR */
1.37 +
1.38 +#define VARIABLE_NAME_MACRO(name,filename) s_##filename##_g__ ## name ## _lock
1.39 +
1.40 +#define FUNCTION_NAME_MACRO(name,filename) _s_##filename##_g__ ## name ## _lock
1.41 +
1.42 +#define VARIABLE_NAME(var,filename) s_##filename##_##var
1.43 +
1.44 +#define FUNCTION_NAME(var,filename) _s_##filename##_##var
1.45 +
1.46 +#define VARIABLE_DECL_MACRO(name,filename,datatype) \
1.47 +datatype VARIABLE_NAME_MACRO(name,filename);
1.48 +
1.49 +#define VARIABLE_DECL(var,filename,datatype)\
1.50 +datatype VARIABLE_NAME(var,filename);
1.51 +
1.52 +#define VARIABLE_DECL_ARRAY(name,filename,datatype,size) \
1.53 +datatype VARIABLE_NAME(name,filename)[size];
1.54 +
1.55 +#define RETURN_VAL(var,filename) (Glib_ImpurePtr()->VARIABLE_NAME(var,filename))
1.56 +
1.57 +#define RETURN_VAL_MACRO(var,filename) (Glib_ImpurePtr()->VARIABLE_NAME_MACRO(var,filename))
1.58 +
1.59 +#define PLS(var,filename,type) \
1.60 +type *FUNCTION_NAME(var,filename)() \
1.61 +{ \
1.62 +return &RETURN_VAL(var,filename);\
1.63 +}
1.64 +
1.65 +#define PLS_MACRO(var,filename,type) \
1.66 +type *FUNCTION_NAME_MACRO(var,filename)() \
1.67 +{ \
1.68 +return &RETURN_VAL_MACRO(var,filename);\
1.69 +}
1.70 +
1.71 +#define PLS_ARRAY(var,filename,type) \
1.72 +type *FUNCTION_NAME(var,filename)() \
1.73 +{ \
1.74 +return RETURN_VAL(var,filename);\
1.75 +}
1.76 +/* --------------------- END MACRO DEFINATIONS ------------------------*/
1.77 +
1.78 +typedef struct _GDataset GDataset;
1.79 +
1.80 +
1.81 +struct _GAllocator {
1.82 + gchar *name;
1.83 + guint16 n_preallocs;
1.84 + guint is_unused : 1;
1.85 + guint type : 4;
1.86 + GAllocator *last;
1.87 + GMemChunk *mem_chunk;
1.88 + gpointer free_list;
1.89 + };
1.90 +
1.91 +typedef struct _GLogDomain GLogDomain;
1.92 +typedef struct _GLogHandler GLogHandler;
1.93 +typedef struct _GRealThread GRealThread;
1.94 +typedef struct _ChunkLink ChunkLink;
1.95 +typedef struct _SlabInfo SlabInfo;
1.96 +
1.97 +typedef struct {
1.98 + gboolean always_malloc;
1.99 + gboolean bypass_magazines;
1.100 + gboolean debug_blocks;
1.101 + gsize working_set_msecs;
1.102 + guint color_increment;
1.103 +} SliceConfig;
1.104 +
1.105 +typedef struct {
1.106 + /* const after initialization */
1.107 + gsize min_page_size, max_page_size;
1.108 + SliceConfig config;
1.109 + gsize max_slab_chunk_size_for_magazine_cache;
1.110 + /* magazine cache */
1.111 + GMutex *magazine_mutex;
1.112 + ChunkLink **magazines; /* array of MAX_SLAB_INDEX (allocator) */
1.113 + guint *contention_counters; /* array of MAX_SLAB_INDEX (allocator) */
1.114 + gint mutex_counter;
1.115 + guint stamp_counter;
1.116 + guint last_stamp;
1.117 + /* slab allocator */
1.118 + GMutex *slab_mutex;
1.119 + SlabInfo **slab_stack; /* array of MAX_SLAB_INDEX (allocator) */
1.120 + guint color_accu;
1.121 +} Allocator;
1.122 +
1.123 +typedef struct {
1.124 + ChunkLink *chunks;
1.125 + gsize count; /* approximative chunks list length */
1.126 +} Magazine;
1.127 +typedef struct {
1.128 + Magazine *magazine1; /* array of MAX_SLAB_INDEX (allocator) */
1.129 + Magazine *magazine2; /* array of MAX_SLAB_INDEX (allocator) */
1.130 +} ThreadMemory;
1.131 +
1.132 +typedef size_t SmcKType; /* key type */
1.133 +typedef size_t SmcVType; /* value type */
1.134 +typedef struct {
1.135 + SmcKType key;
1.136 + SmcVType value;
1.137 +} SmcEntry;
1.138 +
1.139 +typedef struct {
1.140 + SmcEntry *entries;
1.141 + unsigned int n_entries;
1.142 +} SmcBranch;
1.143 +
1.144 +#define G_SCRIPT_TABLE_MIDPOINT (G_N_ELEMENTS (g_script_table) / 2)
1.145 +
1.146 +typedef struct DestroyEntry DestroyEntry;
1.147 +typedef guint64 (*function_type) (void);
1.148 +#ifdef __cplusplus
1.149 +extern "C"
1.150 +#endif /* extern "C" */
1.151 +guint64 gettime (void);
1.152 +struct global_struct
1.153 +{
1.154 +
1.155 + //Global dsta of gatomic.c
1.156 + VARIABLE_DECL(g_atomic_mutex , gatomic,GMutex *)
1.157 +
1.158 + //Global variable of gbacktrace.c
1.159 + VARIABLE_DECL(glib_on_error_halt,gbacktrace,volatile gboolean)
1.160 +
1.161 + //Global data of gconvert.c
1.162 + VARIABLE_DECL(cache_private,g_get_filename_charsets,GStaticPrivate)
1.163 +
1.164 + //Global data of gdataset.c
1.165 + VARIABLE_DECL_MACRO(g_dataset_global,gdataset,GStaticMutex)
1.166 + VARIABLE_DECL(g_dataset_location_ht,gdataset,GHashTable *)
1.167 + VARIABLE_DECL(g_dataset_cached,gdataset,GDataset *)
1.168 + VARIABLE_DECL_MACRO(g_quark_global,gdataset,GStaticMutex)
1.169 + VARIABLE_DECL(g_quark_ht,gdataset,GHashTable *)
1.170 + VARIABLE_DECL(g_quarks,gdataset,gchar **)
1.171 + VARIABLE_DECL(g_quark_seq_id,gdataset,GQuark)
1.172 +
1.173 + //Global data of gdate.c
1.174 + VARIABLE_DECL_MACRO(g_date_global,gdate,GStaticMutex)
1.175 + VARIABLE_DECL_ARRAY(long_month_names, gdate, gchar *,13)
1.176 + VARIABLE_DECL_ARRAY(short_month_names, gdate, gchar *,13)
1.177 + VARIABLE_DECL(current_locale,gdate, gchar *)
1.178 + VARIABLE_DECL_ARRAY(dmy_order, gdate, GDateDMY,3)
1.179 + VARIABLE_DECL(using_twodigit_years,gdate, gboolean)
1.180 + VARIABLE_DECL(locale_era_adjust,gdate, gint)
1.181 +
1.182 + //Global data of gfileutils.c
1.183 + VARIABLE_DECL(counter ,create_temp_file,int)
1.184 +
1.185 + //Global data of giounix.c
1.186 + VARIABLE_DECL(unix_channel_funcs,giounix,GIOFuncs )
1.187 + VARIABLE_DECL(g_io_watch_funcs,giounix,GSourceFuncs)
1.188 +
1.189 + //Global data of gmain.c
1.190 + VARIABLE_DECL_MACRO(main_loop,gmain,GStaticMutex)
1.191 + VARIABLE_DECL(default_main_context,gmain,GMainContext *)
1.192 + VARIABLE_DECL(main_contexts_without_pipe,gmain,GSList *)
1.193 + VARIABLE_DECL_MACRO(main_context_list,gmain,GStaticMutex)
1.194 + VARIABLE_DECL(main_context_list,gmain,GSList *)
1.195 + VARIABLE_DECL(depth_private,get_dispatch ,GStaticPrivate)
1.196 + VARIABLE_DECL(g_source_callback_funcs,gmain,GSourceCallbackFuncs)
1.197 + VARIABLE_DECL(g_timeout_funcs,gmain,GSourceFuncs)
1.198 + VARIABLE_DECL(g_child_watch_funcs ,gmain,GSourceFuncs)
1.199 + VARIABLE_DECL(g_idle_funcs,gmain,GSourceFuncs)
1.200 + VARIABLE_DECL(child_watch_init_state,gmain,gint)
1.201 + VARIABLE_DECL(child_watch_count,gmain,gint)
1.202 + VARIABLE_DECL_ARRAY(child_watch_wake_up_pipe,gmain,gint,2)
1.203 + VARIABLE_DECL(timer_perturb,gmain,gint)
1.204 +
1.205 + //Global data of gmarkup.c
1.206 + VARIABLE_DECL(error_quark ,g_markup_error_quark,GQuark)
1.207 +
1.208 + //Global data of gmem.c
1.209 + VARIABLE_DECL(glib_mem_vtable,gmem,GMemVTable)
1.210 + VARIABLE_DECL(vtable_set ,gmem,gboolean)
1.211 + VARIABLE_DECL(profile_data ,gmem,guint *)
1.212 + VARIABLE_DECL(profile_allocs ,gmem,gulong)
1.213 + VARIABLE_DECL(profile_zinit ,gmem,gulong)
1.214 + VARIABLE_DECL(profile_frees ,gmem,gulong)
1.215 + VARIABLE_DECL(gmem_profile_mutex ,gmem,GMutex *)
1.216 + VARIABLE_DECL(profiler_table,gmem,GMemVTable)
1.217 + VARIABLE_DECL(glib_mem_profiler_table,gmem,GMemVTable *)
1.218 + VARIABLE_DECL(g_mem_initialized ,gmem,gboolean)
1.219 + VARIABLE_DECL(g_mem_gc_friendly ,gmem,gboolean)
1.220 + VARIABLE_DECL(dummy ,g_allocator_new,struct _GAllocator)
1.221 + VARIABLE_DECL(g_trap_free_size ,gmem,gsize)
1.222 + VARIABLE_DECL(g_trap_realloc_size ,gmem,gsize)
1.223 + VARIABLE_DECL(g_trap_malloc_size ,gmem,gsize)
1.224 +
1.225 + //Global data of gmessages.c
1.226 + VARIABLE_DECL(g_messages_lock,gmessages,GMutex *)
1.227 + VARIABLE_DECL(g_log_domains,gmessages,GLogDomain *)
1.228 + VARIABLE_DECL(g_log_always_fatal,gmessages,GLogLevelFlags)
1.229 + VARIABLE_DECL(glib_print_func,gmessages,GPrintFunc)
1.230 + VARIABLE_DECL(glib_printerr_func,gmessages,GPrintFunc)
1.231 + VARIABLE_DECL(g_log_depth,gmessages,GPrivate *)
1.232 + VARIABLE_DECL(g_log_msg_prefix,gmessages,GLogLevelFlags)
1.233 + VARIABLE_DECL(default_log_func,gmessages,GLogFunc)
1.234 + VARIABLE_DECL(default_log_data,gmessages,gpointer)
1.235 + VARIABLE_DECL(initialized ,g_messages_prefixed_init,gboolean)
1.236 + VARIABLE_DECL(handler_id,g_log_set_handler,guint)
1.237 + VARIABLE_DECL(warned,strdup_convert,gboolean)
1.238 + VARIABLE_DECL(_g_debug_initialized ,gmessages,gboolean)
1.239 + VARIABLE_DECL(_g_debug_flags,gmessages,guint)
1.240 +
1.241 + //Global data of grand.c
1.242 + VARIABLE_DECL_MACRO(global_random,grand,GStaticMutex)
1.243 + VARIABLE_DECL(global_random,grand,GRand *)
1.244 + VARIABLE_DECL(initialized ,get_random_version,gboolean)
1.245 + VARIABLE_DECL(random_version ,get_random_version,guint)
1.246 + VARIABLE_DECL(dev_urandom_exists,g_rand_new ,gboolean)
1.247 +
1.248 + //Global data of gspawn-symbian.c
1.249 + VARIABLE_DECL(debug,gspawn_symbian,int)
1.250 + VARIABLE_DECL(warned_about_child_setup ,do_spawn_with_pipes,gboolean)
1.251 +
1.252 + //Global data of gthread.c
1.253 + VARIABLE_DECL(g_thread_gettime,gthread,function_type)
1.254 + VARIABLE_DECL(zero_thread,gthread,GSystemThread)
1.255 + VARIABLE_DECL(g_once_mutex,gthread,GMutex *)
1.256 + VARIABLE_DECL(g_once_cond,gthread,GCond *)
1.257 + VARIABLE_DECL(g_once_init_list,gthread,GSList *)
1.258 + VARIABLE_DECL(g_thread_specific_private ,gthread,GPrivate *)
1.259 + VARIABLE_DECL(g_thread_all_threads,gthread,GRealThread *)
1.260 + VARIABLE_DECL(g_thread_free_indeces,gthread,GSList *)
1.261 + VARIABLE_DECL_MACRO(g_thread,gthread,GStaticMutex)
1.262 + VARIABLE_DECL(next_index ,g_static_private_set,guint)
1.263 + VARIABLE_DECL(g_thread_use_default_impl,gthread,gboolean)
1.264 + VARIABLE_DECL(g_threads_got_initialized,gthread,gboolean)
1.265 + VARIABLE_DECL(g_thread_functions_for_glib_use,gthread,GThreadFunctions)
1.266 +
1.267 + //Global data of Gthreadpool.c
1.268 + VARIABLE_DECL(wakeup_thread_serial,gthreadpool,gint)
1.269 + VARIABLE_DECL(unused_thread_queue,gthreadpool,GAsyncQueue *)
1.270 + VARIABLE_DECL(unused_threads,gthreadpool,gint)
1.271 + VARIABLE_DECL(max_unused_threads,gthreadpool,gint)
1.272 + VARIABLE_DECL(kill_unused_threads,gthreadpool,gint)
1.273 + VARIABLE_DECL(max_idle_time,gthreadpool,guint)
1.274 + VARIABLE_DECL_MACRO(init,g_thread_pool_new,GStaticMutex)
1.275 +
1.276 + //Global data of gutf8.c
1.277 + VARIABLE_DECL_MACRO(aliases,gutf8,GStaticMutex)
1.278 + VARIABLE_DECL(alias_hash,get_alias_hash,GHashTable *)
1.279 + VARIABLE_DECL(cache_private,g_get_charset,GStaticPrivate)
1.280 +
1.281 + //Global data of gutils.c
1.282 + VARIABLE_DECL_MACRO(g_utils_global,gutils,GStaticMutex)
1.283 + VARIABLE_DECL(g_tmp_dir,gutils,gchar *)
1.284 + VARIABLE_DECL(g_user_name,gutils,gchar *)
1.285 + VARIABLE_DECL(g_real_name,gutils,gchar *)
1.286 + VARIABLE_DECL(g_home_dir,gutils,gchar *)
1.287 + VARIABLE_DECL(g_host_name,gutils,gchar *)
1.288 + VARIABLE_DECL(g_user_data_dir ,gutils,gchar *)
1.289 + VARIABLE_DECL(g_system_data_dirs,gutils,gchar **)
1.290 + VARIABLE_DECL(g_user_cache_dir,gutils,gchar *)
1.291 + VARIABLE_DECL(g_user_config_dir,gutils,gchar *)
1.292 + VARIABLE_DECL(g_system_config_dirs,gutils,gchar **)
1.293 + VARIABLE_DECL_MACRO(g_prgname,gutils,GStaticMutex)
1.294 + VARIABLE_DECL(g_prgname,gutils,gchar *)
1.295 + VARIABLE_DECL_MACRO(g_application_name ,gutils,GStaticMutex)
1.296 + VARIABLE_DECL(g_application_name ,gutils,gchar *)
1.297 + VARIABLE_DECL(alias_table ,gutils,GHashTable *)
1.298 + VARIABLE_DECL(said_before ,unalias_lang,gboolean)
1.299 + VARIABLE_DECL(cache_private ,g_get_language_names ,GStaticPrivate)
1.300 + VARIABLE_DECL(max_len,g_get_current_dir ,gulong)
1.301 + VARIABLE_DECL(_glib_gettext_initialized,_glib_gettext,gboolean)
1.302 + VARIABLE_DECL(g_user_special_dirs,gutils,gchar **)
1.303 +
1.304 + //Global data of localcharset.c
1.305 + VARIABLE_DECL(charset_aliases,localcharset,const char * volatile)
1.306 +
1.307 + //Global data of gstrfuncs.c
1.308 + VARIABLE_DECL(msg_private ,g_strerror,GStaticPrivate)
1.309 + VARIABLE_DECL(msg_private ,g_strsignal,GStaticPrivate)
1.310 + VARIABLE_DECL(translate ,gstrfuncs,gsize)
1.311 +
1.312 + //Global data of gslice.c
1.313 + VARIABLE_DECL(private_thread_memory,gslice,GPrivate *)
1.314 + VARIABLE_DECL(sys_page_size,gslice,gsize)
1.315 + VARIABLE_DECL_ARRAY(allocator,gslice,Allocator,1)
1.316 + VARIABLE_DECL(slice_config,gslice,SliceConfig)
1.317 + VARIABLE_DECL(smc_tree_mutex,gslice,GMutex *)
1.318 + VARIABLE_DECL(single_thread_memory,gslice,ThreadMemory *)
1.319 + VARIABLE_DECL(smc_tree_root,gslice,SmcBranch **)
1.320 +
1.321 + //Global data of gregex.c
1.322 + VARIABLE_DECL(error_quark ,g_regex_error_quark,GQuark)
1.323 + VARIABLE_DECL(initialized ,g_regex_new,gboolean)
1.324 +
1.325 + //Global data of guniprop.c
1.326 + VARIABLE_DECL(saved_mid,g_unichar_get_script_bsearch,int)
1.327 +
1.328 + //Global data of gtestutils.c
1.329 + VARIABLE_DECL(test_log_fd,gtestutils,int)
1.330 + VARIABLE_DECL(test_mode_fatal,gtestutils,gboolean)
1.331 + VARIABLE_DECL(g_test_run_once,gtestutils,gboolean)
1.332 + VARIABLE_DECL(test_run_list,gtestutils,gboolean)
1.333 + VARIABLE_DECL(test_run_seedstr,gtestutils,gchar*)
1.334 + VARIABLE_DECL(test_run_rand,gtestutils,GRand*)
1.335 + VARIABLE_DECL(test_run_name,gtestutils,gchar*)
1.336 + VARIABLE_DECL(test_run_forks,gtestutils,guint)
1.337 + VARIABLE_DECL(test_run_count,gtestutils,guint)
1.338 + VARIABLE_DECL(test_skip_count,gtestutils,guint)
1.339 + VARIABLE_DECL(test_user_timer,gtestutils,GTimer*)
1.340 + VARIABLE_DECL(test_user_stamp,gtestutils,double)
1.341 + VARIABLE_DECL(test_paths,gtestutils,GSList*)
1.342 + VARIABLE_DECL(test_suite_root,gtestutils,GTestSuite*)
1.343 + VARIABLE_DECL(test_trap_last_status,gtestutils,int)
1.344 + VARIABLE_DECL(test_trap_last_pid,gtestutils,int)
1.345 + VARIABLE_DECL(test_trap_last_stdout,gtestutils,char*)
1.346 + VARIABLE_DECL(test_trap_last_stderr,gtestutils,char*)
1.347 + VARIABLE_DECL(test_uri_base,gtestutils,char*)
1.348 + VARIABLE_DECL(test_debug_log,gtestutils,gboolean)
1.349 + VARIABLE_DECL(test_destroy_queue,gtestutils,DestroyEntry*)
1.350 + VARIABLE_DECL_ARRAY(seedstr,g_test_init,char, 4 + 4 * 8 + 1)
1.351 + VARIABLE_DECL(mutable_test_config_vars,gtestutils,GTestConfig)
1.352 + VARIABLE_DECL(g_test_config_vars,gtestutils,const GTestConfig* const)
1.353 +
1.354 + //Global data of pcre_globals.c
1.355 + VARIABLE_DECL(pcre_callout,pcre_globals,int)
1.356 +};
1.357 +
1.358 +__BEGIN_DECLS
1.359 +struct global_struct *Glib_ImpurePtr();
1.360 +__END_DECLS
1.361 +#endif /* EMULATOR */
1.362 +
1.363 +#endif /* __GLIB_WSD_H__ */
1.364 +