webengine/osswebengine/MemoryManager/Inc/common.h
changeset 1 7c90e6132015
equal deleted inserted replaced
0:dd21522fd290 1:7c90e6132015
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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 #ifndef __E32_COMMON_H__
       
    20 #define __E32_COMMON_H__
       
    21 
       
    22 #ifdef __KERNEL_MODE__
       
    23 #include <e32cmn.h>
       
    24 #include <e32panic.h>
       
    25 #include <u32std.h>
       
    26 #else
       
    27 #include <e32std.h>
       
    28 #include <e32base.h>
       
    29 #include <e32math.h>
       
    30 #include <e32svr.h>
       
    31 #include <e32ver.h>
       
    32 #include <e32hal.h>
       
    33 #include <e32panic.h>
       
    34 #include <u32exec.h>
       
    35 #endif
       
    36 
       
    37 GLREF_C void Panic(TCdtPanic aPanic);
       
    38 GLDEF_C void PanicBadArrayIndex();
       
    39 GLREF_C TInt __DoConvertNum(TUint, TRadix, TUint, TUint8*&);
       
    40 GLREF_C TInt __DoConvertNum(Uint64, TRadix, TUint, TUint8*&);
       
    41 
       
    42 #ifdef __KERNEL_MODE__
       
    43 GLREF_C void KernHeapFault(TCdtPanic aPanic);
       
    44 GLREF_C void KHeapCheckThreadState();
       
    45 TInt StringLength(const TUint16* aPtr);
       
    46 TInt StringLength(const TUint8* aPtr);
       
    47 
       
    48 #define	STD_CLASS					Kern
       
    49 #define	STRING_LENGTH(s)			StringLength(s)
       
    50 #define	STRING_LENGTH_16(s)			StringLength(s)
       
    51 #define	PANIC_CURRENT_THREAD(c,r)	Kern::PanicCurrentThread(c, r)
       
    52 #define __KERNEL_CHECK_RADIX(r)		__ASSERT_ALWAYS(((r)==EDecimal)||((r)==EHex),Panic(EInvalidRadix))
       
    53 #define	APPEND_BUF_SIZE				10
       
    54 #define	APPEND_BUF_SIZE_64			20
       
    55 #define	HEAP_PANIC(r)				RHeapK::Fault(r)
       
    56 #define	GET_PAGE_SIZE(x)			x = M::PageSizeInBytes()
       
    57 #define	DIVISION_BY_ZERO()			FAULT()
       
    58 
       
    59 #ifdef _DEBUG
       
    60 #define	__CHECK_THREAD_STATE		RHeapK::CheckThreadState()
       
    61 #else
       
    62 #define	__CHECK_THREAD_STATE
       
    63 #endif
       
    64 
       
    65 #else
       
    66 
       
    67 #define	STD_CLASS					User
       
    68 #define	STRING_LENGTH(s)			User::StringLength(s)
       
    69 #define	STRING_LENGTH_16(s)			User::StringLength(s)
       
    70 #define	PANIC_CURRENT_THREAD(c,r)	User::Panic(c, r)
       
    71 #define	MEM_COMPARE_16				Mem::Compare
       
    72 #define __KERNEL_CHECK_RADIX(r)
       
    73 #define	APPEND_BUF_SIZE				32
       
    74 #define	APPEND_BUF_SIZE_64			64
       
    75 #define	HEAP_PANIC(r)				Panic(r)
       
    76 #define	GET_PAGE_SIZE(x)			UserHal::PageSizeInBytes(x)
       
    77 #define	DIVISION_BY_ZERO()			User::RaiseException(EExcIntegerDivideByZero)
       
    78 #define	__CHECK_THREAD_STATE
       
    79 
       
    80 #endif	// __KERNEL_MODE__
       
    81 
       
    82 #endif