1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/compressionlibs/ziplib/test/shared/eustd.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,60 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __EUSTD_H
1.20 +#define __EUSTD_H
1.21 +
1.22 +#include <e32base.h>
1.23 +#include <e32cons.h>
1.24 +
1.25 +_LIT(KTxtEPOC32EX,"EPOC32EX");
1.26 +_LIT(KTxtExampleCode,"E32 SDK Example Code");
1.27 +_LIT(KFormatFailed,"failed: leave code=%d");
1.28 +_LIT(KTxtOK,"ok");
1.29 +_LIT(KTxtPressAnyKey," [press any key]");
1.30 +
1.31 +// public
1.32 +LOCAL_D CConsoleBase* console; // write all your messages to this
1.33 +LOCAL_C void doExampleL(); // code this function for the real example
1.34 +
1.35 +// private
1.36 +LOCAL_C void callExampleL(); // initialize with cleanup stack, then do example
1.37 +
1.38 +GLDEF_C TInt E32Main() // main function called by E32
1.39 + {
1.40 + __UHEAP_MARK;
1.41 + CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack
1.42 + TRAPD(error,callExampleL()); // more initialization, then do example
1.43 + __ASSERT_ALWAYS(!error,User::Panic(KTxtEPOC32EX,error));
1.44 + delete cleanup; // destroy clean-up stack
1.45 + __UHEAP_MARKEND;
1.46 + return 0; // and return
1.47 + }
1.48 +
1.49 +LOCAL_C void callExampleL() // initialize and call example code under cleanup stack
1.50 + {
1.51 + console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
1.52 + CleanupStack::PushL(console);
1.53 + TRAPD(error,doExampleL()); // perform example function
1.54 + if (error)
1.55 + console->Printf(KFormatFailed, error);
1.56 + else
1.57 + console->Printf(KTxtOK);
1.58 + console->Printf(KTxtPressAnyKey);
1.59 + console->Getch(); // get and ignore character
1.60 + CleanupStack::PopAndDestroy(); // close console
1.61 + }
1.62 +
1.63 +#endif