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