sbsv1/buildsystem/test/binaryvariation/CommonFramework.h
author jjkang
Wed, 30 Jun 2010 11:35:58 +0800
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Merge missed changeset 11 (raptor v2.14 and helium 10.0)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
// All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
// This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
// which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
//
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
// Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
//
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
// Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
//
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
// Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
//
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
#ifndef __CommonFramework_H
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
#define __CommonFramework_H
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
#include <e32base.h>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
#include <e32cons.h>
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
_LIT(KTxtEPOC32EX,"EXAMPLES");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
_LIT(KTxtExampleCode,"Symbian OS Example Code");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
_LIT(KFormatFailed,"failed: leave code=%d");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
_LIT(KTxtOK,"ok");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
_LIT(KTxtPressAnyKey," [press any key]");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
// public
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
LOCAL_D CConsoleBase* console; // write all your messages to this
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
LOCAL_C void doExampleL(); // code this function for the real example
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
// private
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
LOCAL_C void callExampleL(); // initialize with cleanup stack, then do example
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
GLDEF_C TInt E32Main() // main function called by E32
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
	__UHEAP_MARK;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
	TRAPD(error,callExampleL()); // more initialization, then do example
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
	__ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
	delete cleanup; // destroy clean-up stack
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	__UHEAP_MARKEND;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
	return 0; // and return
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
LOCAL_C void callExampleL() // initialize and call example code under cleanup stack
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
    {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
	console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
	CleanupStack::PushL(console);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
	TRAPD(error,doExampleL()); // perform example function
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
	if (error)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
		console->Printf(KFormatFailed, error);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
		console->Printf(KTxtOK);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
	console->Printf(KTxtPressAnyKey);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
	console->Getch(); // get and ignore character
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	CleanupStack::PopAndDestroy(); // close console
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
    }
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
#endif