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