First public contribution.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
27 //#include <e32test.h>
31 LOCAL_D CConsoleBase* console; // write all your messages to this
32 LOCAL_C void doExampleL(); // code this function for the real example
34 LOCAL_C void callExampleL(); // initialize with cleanup stack, then do example
36 GLDEF_C TInt E32Main() // main function called by E32
39 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
40 TRAPD(error,callExampleL()); // more initialization, then do example
42 __ASSERT_ALWAYS(!error,User::Panic(_L("CERT"),error));
43 delete cleanup; // destroy clean-up stack
45 return 0; // and return
48 LOCAL_C void callExampleL() // initialize and call example code under cleanup stack
50 console=Console::NewL(_L("Test code"),
51 TSize(KDefaultConsWidth,KDefaultConsHeight));
52 CleanupStack::PushL(console);
53 TRAPD(error,doExampleL()); // perform example function
54 if (error) console->Printf(_L("failed: leave code=%d"), error);
55 else console->Printf(_L("ok"));
56 console->Printf(_L(" [press any key]"));
57 console->Getch(); // get and ignore character
58 CleanupStack::PopAndDestroy(); // close console