compressionlibs/ziplib/test/shared/eustd.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __EUSTD_H
       
    17 #define __EUSTD_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32cons.h>
       
    21 
       
    22 _LIT(KTxtEPOC32EX,"EPOC32EX");
       
    23 _LIT(KTxtExampleCode,"E32 SDK Example Code");
       
    24 _LIT(KFormatFailed,"failed: leave code=%d");
       
    25 _LIT(KTxtOK,"ok");
       
    26 _LIT(KTxtPressAnyKey," [press any key]");
       
    27 
       
    28 // public
       
    29 LOCAL_D CConsoleBase* console; // write all your messages to this
       
    30 LOCAL_C void doExampleL(); // code this function for the real example
       
    31 
       
    32 // private
       
    33 LOCAL_C void callExampleL(); // initialize with cleanup stack, then do example
       
    34 
       
    35 GLDEF_C TInt E32Main() // main function called by E32
       
    36     {
       
    37 	__UHEAP_MARK;
       
    38 	CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
       
    39 	TRAPD(error,callExampleL()); // more initialization, then do example
       
    40 	__ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));
       
    41 	delete cleanup; // destroy clean-up stack
       
    42 	__UHEAP_MARKEND;
       
    43 	return 0; // and return
       
    44     }
       
    45 
       
    46 LOCAL_C void callExampleL() // initialize and call example code under cleanup stack
       
    47     {
       
    48 	console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
       
    49 	CleanupStack::PushL(console);
       
    50 	TRAPD(error,doExampleL()); // perform example function
       
    51 	if (error)
       
    52 		console->Printf(KFormatFailed, error);
       
    53 	else
       
    54 		console->Printf(KTxtOK);
       
    55 	console->Printf(KTxtPressAnyKey);
       
    56 	console->Getch(); // get and ignore character
       
    57 	CleanupStack::PopAndDestroy(); // close console
       
    58     }
       
    59 
       
    60 #endif