os/graphics/graphicsdeviceinterface/bitgdi/inc/BITPANIC.H
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __BITPANIC_H__
sl@0
    17
#define __BITPANIC_H__
sl@0
    18
sl@0
    19
#include <e32cmn.h>
sl@0
    20
/**
sl@0
    21
@internalTechnology
sl@0
    22
*/
sl@0
    23
enum TBitgdiPanic
sl@0
    24
	{
sl@0
    25
	EBitgdiPanicNoDevicePresent=1,
sl@0
    26
	EBitgdiPanicNoFBSConnection,
sl@0
    27
	EBitgdiPanicNoFontSelected,
sl@0
    28
	EBitgdiPanicNoSpriteSet,
sl@0
    29
	EBitgdiPanicInvalidScreenDeviceLibrary,
sl@0
    30
	EBitgdiPanicInvalidParameter,
sl@0
    31
	EBitgdiPanicInvalidColor,
sl@0
    32
	EBitgdiPanicInvalidDrawMode,
sl@0
    33
	EBitgdiPanicInvalidDisplayMode,
sl@0
    34
	EBitgdiPanicInvalidRegion,
sl@0
    35
	EBitgdiPanicInvalidWindowHandle,
sl@0
    36
	EBitgdiPanicInvalidFont,
sl@0
    37
	EBitgdiPanicInvalidBitmap,
sl@0
    38
	EBitgdiPanicOutOfBounds,
sl@0
    39
	EBitgdiPanicReadOnly,
sl@0
    40
	EBitgdiPanicPolygonFiller,
sl@0
    41
	EBitgdiPanicZeroLength,
sl@0
    42
	EBitgdiPanicNullPointer,
sl@0
    43
	EBitgdiPanicInvalidPointer,
sl@0
    44
	EBitgdiPanicCharacterTooBig,
sl@0
    45
	EBitgdiPanicInvalidHalValue,
sl@0
    46
	EBitgdiPanicInvalidArg,
sl@0
    47
	EBitgdiPanicNegativeShift,
sl@0
    48
	EBitgdiPanicInvalidInterfaceHandle,		//This panic may occur if MOutlineAndShadowBlend interface is not implemented.
sl@0
    49
	EBitgdiPanicInvalidBrushStyle,
sl@0
    50
	};
sl@0
    51
sl@0
    52
/**
sl@0
    53
@internalComponent
sl@0
    54
*/
sl@0
    55
void Panic(TBitgdiPanic aPanicCode);
sl@0
    56
void PanicWithInfo(TBitgdiPanic aPanic, const TDesC& aFileName, const TDesC& aPanicName, TInt aLine);
sl@0
    57
void PanicWithCondAndInfo(TBitgdiPanic aPanic, const TDesC& aCondition, const TDesC& aFileName, const TDesC& aPanicName, TInt aLine);
sl@0
    58
void InvariantWithCondAndInfo(const TDesC& aCondition, const TDesC& aFileName, TInt aLine);
sl@0
    59
sl@0
    60
// helper macros
sl@0
    61
#define BG_ASSERT_FILENAME(f)	_LIT(KPanicFileName, f);
sl@0
    62
#define BG_ASSERT_PANICNAME(p)	_LIT(KPanicEnum ## p, # p);
sl@0
    63
#define BG_ASSERT_CONDITION(c)	_LIT(KPanicCondition, c);
sl@0
    64
sl@0
    65
/* Use these macros for BitGdi server Asserts & Panics with diagnostic logging:
sl@0
    66
   BG_ASSERT_ALWAYS, BG_PANIC_ALWAYS, BG_ASSERT_DEBUG, BG_PANIC_DEBUG
sl@0
    67
   BG_ASSERT_ALWAYS_INVARIANT and BG_ASSERT_DEBUG_INVARIANT
sl@0
    68
   Note that the "do { ... } while (0)" construction forces the invocation to have a ';'
sl@0
    69
   and makes the macro expansion safe in nested "if ... else ..." clauses that forget to use the
sl@0
    70
   { braces } in the Coding Standard.
sl@0
    71
 */
sl@0
    72
 
sl@0
    73
#define BG_ASSERT_ALWAYS(c, p) \
sl@0
    74
		do  { \
sl@0
    75
			if (!(c)) \
sl@0
    76
				{ \
sl@0
    77
				BG_ASSERT_FILENAME(__FILE__); \
sl@0
    78
				BG_ASSERT_PANICNAME(p); \
sl@0
    79
				BG_ASSERT_CONDITION(#c); \
sl@0
    80
				PanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \
sl@0
    81
				} \
sl@0
    82
			} while (EFalse)
sl@0
    83
sl@0
    84
#define BG_PANIC_ALWAYS(p) \
sl@0
    85
		do  { \
sl@0
    86
			BG_ASSERT_FILENAME(__FILE__); \
sl@0
    87
			BG_ASSERT_PANICNAME(p); \
sl@0
    88
			PanicWithInfo(p, KPanicFileName, KPanicEnum ## p, __LINE__); \
sl@0
    89
			} while (EFalse)
sl@0
    90
			
sl@0
    91
#define BG_ASSERT_ALWAYS_INVARIANT(c) \
sl@0
    92
		do  { \
sl@0
    93
			if (!(c)) \
sl@0
    94
				{ \
sl@0
    95
				BG_ASSERT_FILENAME(__FILE__); \
sl@0
    96
				BG_ASSERT_CONDITION(#c); \
sl@0
    97
				InvariantWithCondAndInfo(KPanicCondition, KPanicFileName, __LINE__); \
sl@0
    98
				} \
sl@0
    99
			} while (EFalse)
sl@0
   100
sl@0
   101
#if defined(_DEBUG)
sl@0
   102
#define BG_ASSERT_DEBUG(c, p) \
sl@0
   103
		do  { \
sl@0
   104
			if (!(c)) \
sl@0
   105
				{ \
sl@0
   106
				BG_ASSERT_FILENAME(__FILE__); \
sl@0
   107
				BG_ASSERT_PANICNAME(p); \
sl@0
   108
				BG_ASSERT_CONDITION(#c); \
sl@0
   109
				PanicWithCondAndInfo(p, KPanicCondition, KPanicFileName, KPanicEnum ## p, __LINE__); \
sl@0
   110
				} \
sl@0
   111
			} while (EFalse)
sl@0
   112
sl@0
   113
#define BG_PANIC_DEBUG(p) \
sl@0
   114
		do  { \
sl@0
   115
			BG_ASSERT_FILENAME(__FILE__); \
sl@0
   116
			BG_ASSERT_PANICNAME(p); \
sl@0
   117
			PanicWithInfo(p, KPanicFileName, KPanicEnum ## p, __LINE__); \
sl@0
   118
			} while (EFalse)
sl@0
   119
			
sl@0
   120
#define BG_ASSERT_DEBUG_INVARIANT(c) \
sl@0
   121
		do  { \
sl@0
   122
			if (!(c)) \
sl@0
   123
				{ \
sl@0
   124
				BG_ASSERT_FILENAME(__FILE__); \
sl@0
   125
				BG_ASSERT_CONDITION(#c); \
sl@0
   126
				InvariantWithCondAndInfo(KPanicCondition, KPanicFileName, __LINE__); \
sl@0
   127
				} \
sl@0
   128
			} while (EFalse)
sl@0
   129
			
sl@0
   130
#else
sl@0
   131
#define BG_ASSERT_DEBUG(c, p)
sl@0
   132
#define BG_PANIC_DEBUG(p)
sl@0
   133
#define BG_ASSERT_DEBUG_INVARIANT(c)
sl@0
   134
#endif
sl@0
   135
sl@0
   136
/**
sl@0
   137
Required to ensure BC between NGage and 7.0S platforms.  
sl@0
   138
Functions are exported at ordinal corresponding to where NGage platform
sl@0
   139
has extended this library and must not be moved.
sl@0
   140
@since 7.0S
sl@0
   141
@internalComponent
sl@0
   142
*/
sl@0
   143
IMPORT_C void DummyReserved1();
sl@0
   144
IMPORT_C void DummyReserved2();
sl@0
   145
IMPORT_C void DummyReserved3();
sl@0
   146
IMPORT_C void DummyReserved4();
sl@0
   147
IMPORT_C void DummyReserved5();
sl@0
   148
IMPORT_C void DummyReserved6();
sl@0
   149
IMPORT_C void DummyReserved7();
sl@0
   150
IMPORT_C void DummyReserved8();
sl@0
   151
IMPORT_C void DummyReserved9();
sl@0
   152
IMPORT_C void DummyReserved10();
sl@0
   153
sl@0
   154
#endif
sl@0
   155