|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <_ansi.h> |
|
24 #include "gobject_wsd.h" |
|
25 #include <glib.h> |
|
26 |
|
27 #if EMULATOR |
|
28 #include <pls.h> // For emulator WSD API |
|
29 const TUid KLibgobjectUid3 = {0x10281F39}; // This is the UID of the library |
|
30 |
|
31 G_BEGIN_DECLS |
|
32 extern const GTypeInfo temp_info; |
|
33 extern const GTypeInfo gobject_info; |
|
34 extern const GParamSpecTypeInfo temp_pspec_info; |
|
35 extern const GBSearchConfig temp_g_signal_hlbsa_bconfig; |
|
36 extern const GBSearchConfig temp_g_class_closure_bconfig; |
|
37 extern const GSourceCallbackFuncs temp_closure_callback_funcs; |
|
38 extern const GBSearchConfig gtype_instance_real_class_bconfig; |
|
39 extern const GBSearchConfig temp_transform_bconfig; |
|
40 |
|
41 void InitializeGlobalStaticMutexes(struct global_struct* g) |
|
42 { |
|
43 GStaticMutex temp_init_mutex = { NULL, PTHREAD_MUTEX_INITIALIZER }; |
|
44 GStaticRWLock temp_init_lock = {G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0}; |
|
45 |
|
46 //variable initialisation for gobject.c |
|
47 memcpy(&(g->VARIABLE_NAME_MACRO(construction_mutex, gobject)), &temp_init_mutex, sizeof(GStaticMutex)); |
|
48 #ifdef G_ENABLE_DEBUG |
|
49 memcpy(&(g->VARIABLE_NAME_MACRO(debug_objects, gobject)), &temp_init_mutex, sizeof(GStaticMutex)); |
|
50 #endif /* G_ENABLE_DEBUG */ |
|
51 |
|
52 //variable initialisation for gparam.c |
|
53 memcpy(&(g->VARIABLE_NAME(init_smutex, g_param_spec_pool_new)), &temp_init_mutex, sizeof(GStaticMutex)); |
|
54 |
|
55 //variable initialisation for gsignal.c |
|
56 memcpy(&(g->VARIABLE_NAME_MACRO(g_signal_mutex,gsignal)), &temp_init_mutex, sizeof(GStaticMutex)); |
|
57 |
|
58 //variable initialisation for gtype.c |
|
59 memcpy(&(g->VARIABLE_NAME_MACRO(instance_real_class,gtype)), &temp_init_mutex, sizeof(GStaticMutex)); |
|
60 memcpy(&(g->VARIABLE_NAME_MACRO(type_init_lock,g_type_init_with_debug_flags)), &temp_init_mutex, sizeof(GStaticMutex)); |
|
61 memcpy(&(g->VARIABLE_NAME(type_rw_lock,gtype)), &temp_init_lock, sizeof(GStaticRWLock)); |
|
62 }; |
|
63 |
|
64 int InitializeWsd(struct global_struct* g) |
|
65 { |
|
66 memset(g,0,sizeof(struct global_struct)); |
|
67 |
|
68 //initialization of genums.c data |
|
69 memcpy(&(g->VARIABLE_NAME(info,g_enum_types_init)),&temp_info,sizeof(GTypeInfo)); |
|
70 |
|
71 //initialization of gobject.c data |
|
72 memcpy(&(g->VARIABLE_NAME(info,g_object_type_init)),&gobject_info,sizeof(GTypeInfo)); |
|
73 g->VARIABLE_NAME(floating_flag_handler,gobject) = object_floating_flag_handler; |
|
74 |
|
75 //initialization of gparamspec.c |
|
76 memcpy(&(g->VARIABLE_NAME(pspec_info,g_param_spec_types_init)),&temp_pspec_info,sizeof(GParamSpecTypeInfo)); |
|
77 |
|
78 //initialization of gsignal.c data |
|
79 memcpy(&(g->VARIABLE_NAME(g_signal_hlbsa_bconfig,gsignal)),&temp_g_signal_hlbsa_bconfig,sizeof(GBSearchConfig)); |
|
80 memcpy(&(g->VARIABLE_NAME(g_class_closure_bconfig,gsignal)),&temp_g_class_closure_bconfig,sizeof(GBSearchConfig)); |
|
81 g->VARIABLE_NAME(g_handler_sequential_number ,gsignal) = 1; |
|
82 g->VARIABLE_NAME(seq_hook_id ,g_signal_add_emission_hook) = 1; |
|
83 |
|
84 //initialization of gsourceclosure.c data |
|
85 memcpy(&(g->VARIABLE_NAME(closure_callback_funcs,gsourceclosure)),&temp_closure_callback_funcs,sizeof(GSourceCallbackFuncs)); |
|
86 |
|
87 //initialization of gtype.c data |
|
88 g->VARIABLE_NAME(static_fundamental_next,gtype) = G_TYPE_RESERVED_USER_FIRST; |
|
89 memcpy(&(g->VARIABLE_NAME(instance_real_class_bconfig,gtype)),>ype_instance_real_class_bconfig,sizeof(GBSearchConfig)); |
|
90 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[0]).key = "objects"; |
|
91 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[0]).value = G_TYPE_DEBUG_OBJECTS ; |
|
92 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[1]).key = "signals"; |
|
93 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[1]).value = G_TYPE_DEBUG_SIGNALS ; |
|
94 |
|
95 //initialization of gvalue.c data |
|
96 memcpy(&(g->VARIABLE_NAME(transform_bconfig,gvalue)),&temp_transform_bconfig,sizeof(GBSearchConfig)); |
|
97 |
|
98 InitializeGlobalStaticMutexes(g); |
|
99 |
|
100 return KErrNone; |
|
101 } |
|
102 |
|
103 struct global_struct *Gobject_ImpurePtr() |
|
104 { |
|
105 #if defined(__WINSCW__) || defined(__WINS__) |
|
106 |
|
107 // Access the PLS of this process |
|
108 struct global_struct* p = Pls<struct global_struct>(KLibgobjectUid3, &InitializeWsd); |
|
109 return p; |
|
110 |
|
111 #else |
|
112 |
|
113 return NULL; |
|
114 |
|
115 #endif |
|
116 } |
|
117 |
|
118 G_END_DECLS |
|
119 #endif /* EMULATOR */ |
|
120 |