|
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(construct_objects_lock, 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 |
|
65 int InitializeWsd(struct global_struct* g) |
|
66 { |
|
67 memset(g,0,sizeof(struct global_struct)); |
|
68 |
|
69 //initialization of genums.c data |
|
70 memcpy(&(g->VARIABLE_NAME(info,g_enum_types_init)),&temp_info,sizeof(GTypeInfo)); |
|
71 |
|
72 //initialization of gobject.c data |
|
73 memcpy(&(g->VARIABLE_NAME(info,g_object_type_init)),&gobject_info,sizeof(GTypeInfo)); |
|
74 g->VARIABLE_NAME(floating_flag_handler,gobject) = object_floating_flag_handler; |
|
75 |
|
76 //initialization of gparamspec.c |
|
77 memcpy(&(g->VARIABLE_NAME(pspec_info,g_param_spec_types_init)),&temp_pspec_info,sizeof(GParamSpecTypeInfo)); |
|
78 |
|
79 //initialization of gsignal.c data |
|
80 memcpy(&(g->VARIABLE_NAME(g_signal_hlbsa_bconfig,gsignal)),&temp_g_signal_hlbsa_bconfig,sizeof(GBSearchConfig)); |
|
81 memcpy(&(g->VARIABLE_NAME(g_class_closure_bconfig,gsignal)),&temp_g_class_closure_bconfig,sizeof(GBSearchConfig)); |
|
82 g->VARIABLE_NAME(g_handler_sequential_number ,gsignal) = 1; |
|
83 g->VARIABLE_NAME(seq_hook_id ,g_signal_add_emission_hook) = 1; |
|
84 |
|
85 //initialization of gsourceclosure.c data |
|
86 memcpy(&(g->VARIABLE_NAME(closure_callback_funcs,gsourceclosure)),&temp_closure_callback_funcs,sizeof(GSourceCallbackFuncs)); |
|
87 |
|
88 //initialization of gtype.c data |
|
89 g->VARIABLE_NAME(static_fundamental_next,gtype) = G_TYPE_RESERVED_USER_FIRST; |
|
90 memcpy(&(g->VARIABLE_NAME(instance_real_class_bconfig,gtype)),>ype_instance_real_class_bconfig,sizeof(GBSearchConfig)); |
|
91 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[0]).key = "objects"; |
|
92 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[0]).value = G_TYPE_DEBUG_OBJECTS ; |
|
93 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[1]).key = "signals"; |
|
94 (g->VARIABLE_NAME(debug_keys,g_type_init_with_debug_flags)[1]).value = G_TYPE_DEBUG_SIGNALS ; |
|
95 |
|
96 //initialization of gvalue.c data |
|
97 memcpy(&(g->VARIABLE_NAME(transform_bconfig,gvalue)),&temp_transform_bconfig,sizeof(GBSearchConfig)); |
|
98 |
|
99 InitializeGlobalStaticMutexes(g); |
|
100 |
|
101 return KErrNone; |
|
102 } |
|
103 |
|
104 struct global_struct *Gobject_ImpurePtr() |
|
105 { |
|
106 #if defined(__WINSCW__) || defined(__WINS__) |
|
107 |
|
108 // Access the PLS of this process |
|
109 struct global_struct* p = Pls<struct global_struct>(KLibgobjectUid3, &InitializeWsd); |
|
110 return p; |
|
111 |
|
112 #else |
|
113 |
|
114 return NULL; |
|
115 |
|
116 #endif |
|
117 } |
|
118 |
|
119 G_END_DECLS |
|
120 #endif /* EMULATOR */ |
|
121 |