stif/ConsoleUI/src/ConsoleUI.cpp
changeset 0 a03f92240627
equal deleted inserted replaced
-1:000000000000 0:a03f92240627
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description: This module contains implementation of CConsoleMain 
       
    15 * and CModule class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <e32cons.h>
       
    22 #include <e32svr.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 #include <stifinternal/UIStoreIf.h>
       
    26 
       
    27 #include "ConsoleUI.h"
       
    28 #include "ConsoleMenus.h"
       
    29 
       
    30 #include "StifTestInterface.h"
       
    31 
       
    32 // EXTERNAL DATA STRUCTURES
       
    33 
       
    34 // EXTERNAL FUNCTION PROTOTYPES  
       
    35 
       
    36 // CONSTANTS
       
    37 _LIT(KNameTxt,"STIF");
       
    38 _LIT( KConsoleMain, "CConsoleMain" );
       
    39 
       
    40 // Commandline params
       
    41 _LIT( KTestModule,      "-testmodule" );
       
    42 _LIT( KTestModuleIni,   "-testmoduleini" );
       
    43 _LIT( KTestCaseFile,    "-testcasefile" );
       
    44 _LIT( KTestSet,         "-testset" );
       
    45 _LIT( KTestRun,         "-run" );
       
    46 _LIT( KTestRunAll,      "all" );
       
    47 _LIT( KTestRunSeq,      "sequential" );
       
    48 _LIT( KTestRunPar,      "parallel" );
       
    49 
       
    50 // MACROS
       
    51 
       
    52 // LOCAL CONSTANTS AND MACROS
       
    53 
       
    54 // MODULE DATA STRUCTURES
       
    55 
       
    56 // LOCAL FUNCTION PROTOTYPES
       
    57 
       
    58 // FORWARD DECLARATIONS
       
    59 LOCAL_C void MainL();
       
    60 
       
    61 
       
    62 
       
    63 // ==================== LOCAL FUNCTIONS =======================================
       
    64 
       
    65 // None
       
    66 
       
    67 
       
    68 // ================= MEMBER FUNCTIONS =========================================
       
    69 
       
    70 
       
    71 
       
    72 /*
       
    73 -------------------------------------------------------------------------------
       
    74 
       
    75     Class: CConsoleMain
       
    76 
       
    77     Method: NewL
       
    78 
       
    79     Description: Construct the console main class
       
    80 
       
    81     Parameters: None
       
    82 
       
    83     Return Values: CConsoleMain*                    New object
       
    84 
       
    85     Errors/Exceptions: Leaves if memory allocation fails or
       
    86                        ConstructL leaves.
       
    87 
       
    88     Status: Draft
       
    89 
       
    90 -------------------------------------------------------------------------------
       
    91 */
       
    92 CConsoleMain* CConsoleMain::NewL( )
       
    93     {
       
    94 
       
    95     CConsoleMain* self = new ( ELeave ) CConsoleMain();
       
    96     CleanupStack::PushL( self );
       
    97     self->ConstructL();
       
    98     CleanupStack::Pop( self );
       
    99     return self;
       
   100 
       
   101     }
       
   102 
       
   103 
       
   104 /*
       
   105 -------------------------------------------------------------------------------
       
   106 
       
   107     Class: CConsoleMain
       
   108 
       
   109     Method: ConstructL
       
   110 
       
   111     Description: Second level constructor.
       
   112 
       
   113     Construct the console
       
   114     Construct module and case containers
       
   115     Retrieve command line parameters
       
   116     Connect to test engine
       
   117 
       
   118     Parameters: None
       
   119 
       
   120     Return Values: None
       
   121 
       
   122     Errors/Exceptions: Leaves if memory allocation fails or fileserver or
       
   123                        test engine can't be connected.
       
   124 
       
   125     Status: Draft
       
   126 
       
   127 -------------------------------------------------------------------------------
       
   128 */
       
   129 void CConsoleMain::ConstructL( )
       
   130     {
       
   131     
       
   132     CUIStoreIf::ConstructL();
       
   133 
       
   134     // Construct the console
       
   135     iConsole = Console::NewL( KNameTxt,
       
   136                              TSize( KConsFullScreen, KConsFullScreen ) );
       
   137 
       
   138     RDebug::Print(_L("Creating module list object"));
       
   139     TRAPD(err, iModuleList = CTestModuleList::NewL(NULL));
       
   140     if(err != KErrNone)
       
   141         {
       
   142         RDebug::Print(_L("Could not create module list (%d)"), err);
       
   143         UiError(_L("Could not create module list (err)"));
       
   144         User::Leave(err);
       
   145         }
       
   146     if(!iModuleList)
       
   147         {
       
   148         RDebug::Print(_L("Could not create module list (NULL)"));
       
   149         UiError(_L("Could not create module list (NULL)"));
       
   150         User::Leave(KErrGeneral);
       
   151         }
       
   152 
       
   153     // Get command line parameters
       
   154     TFileName iniFile; // TestFramework initialization file
       
   155                     
       
   156     ProcessCommandlineL( iniFile );
       
   157 
       
   158     if(iTestModule)
       
   159         {
       
   160         // Add to module list info about module taken from command line
       
   161         RDebug::Print(_L("Adding command line module to list"));
       
   162         TName moduleName;
       
   163         moduleName.Copy(iTestModule->Des());
       
   164         moduleName.LowerCase();
       
   165         err = iModuleList->AddTestModule(moduleName);
       
   166         if(err != KErrNone && err != KErrAlreadyExists)
       
   167             {
       
   168             RDebug::Print(_L("Could not add module to list of modules (%d)"), err);
       
   169             UiError(_L("Could not add module to list of modules (err)"));
       
   170             User::Leave(err);
       
   171             }
       
   172 
       
   173         //Get added module
       
   174         CTestModuleInfo* moduleInfo = iModuleList->GetModule(moduleName);
       
   175         if(!moduleInfo)
       
   176             {
       
   177             RDebug::Print(_L("Could not add get module info from list"));
       
   178             UiError(_L("Could not add get module info from list"));
       
   179             User::Leave(KErrGeneral);
       
   180             }
       
   181 
       
   182         //Add ini file if given
       
   183         if(iTestModuleIni && iTestModuleIni->Length() > 0)
       
   184             {
       
   185             TFileName filename;
       
   186             filename.Copy(iTestModuleIni->Des());
       
   187             filename.LowerCase();
       
   188             moduleInfo->SetIniFile(filename);
       
   189             }
       
   190 
       
   191         //Add config file if given
       
   192         if(iTestCaseFile && iTestCaseFile->Length() > 0)
       
   193             {
       
   194             TFileName filename;
       
   195             filename.Copy(iTestCaseFile->Des());
       
   196             filename.LowerCase();
       
   197             moduleInfo->AddCfgFile(filename);
       
   198             }
       
   199 
       
   200         //Now check all config files if there are included modules
       
   201         _LIT(KIncludeModuleStart, "[New_Include_Module]");
       
   202         _LIT(KIncludeModuleEnd, "[End_Include_Module]");
       
   203 
       
   204         RDebug::Print(_L("Start parsing included modules"));
       
   205         CTestCaseFileInfo* finfo = iModuleList->GetUncheckedCfgFile();
       
   206         while(finfo)
       
   207             {
       
   208             TFileName fname;
       
   209             finfo->GetCfgFileName(fname);
       
   210 
       
   211             RDebug::Print(_L("Checking file: '%S'"), &fname);
       
   212             finfo->SetChecked();
       
   213 
       
   214             CStifParser* parser = NULL;
       
   215  
       
   216             TRAP(err, parser = CStifParser::NewL(_L(""), fname));
       
   217             if(err != KErrNone)
       
   218                 {
       
   219                 RDebug::Print(_L("Could not create parser to read content of config file (%d)"), err);
       
   220                 UiError(_L("Could not create parser to read content of config file (err)"));
       
   221                 User::Leave(err);
       
   222                 }
       
   223             CleanupStack::PushL(parser);
       
   224 
       
   225             ParseTestModulesL(parser, iModuleList, KIncludeModuleStart, KIncludeModuleEnd);
       
   226 
       
   227             CleanupStack::PopAndDestroy(parser);
       
   228             finfo = iModuleList->GetUncheckedCfgFile();
       
   229             }
       
   230         RDebug::Print(_L("End parsing included modules"));
       
   231         }
       
   232 
       
   233     iConsole->Printf(_L("\nTest Framework starting\n"));
       
   234 
       
   235     // CUIStore open
       
   236     User::LeaveIfError( UIStore().Open( iniFile ) );
       
   237     
       
   238     }
       
   239         
       
   240 /*
       
   241 -------------------------------------------------------------------------------
       
   242 
       
   243     Class: CConsoleMain
       
   244 
       
   245     Method: CConsoleMain
       
   246 
       
   247     Description: Constructor.
       
   248     Initialize non-zero member variables.
       
   249 
       
   250     Parameters: None
       
   251 
       
   252     Return Values: None
       
   253 
       
   254     Errors/Exceptions: None
       
   255 
       
   256     Status: Draft
       
   257 
       
   258 -------------------------------------------------------------------------------
       
   259 */
       
   260 CConsoleMain::CConsoleMain( ):iStartCases( EStartCaseNo )
       
   261     {
       
   262     }
       
   263 
       
   264 
       
   265 /*
       
   266 -------------------------------------------------------------------------------
       
   267 
       
   268     Class: CConsoleMain
       
   269 
       
   270     Method: ~CConsoleMain
       
   271 
       
   272     Description: Destructor
       
   273 
       
   274     Parameters: None
       
   275 
       
   276     Return Values: None
       
   277 
       
   278     Errors/Exceptions: None
       
   279 
       
   280     Status: Draft
       
   281 
       
   282 -------------------------------------------------------------------------------
       
   283 */
       
   284 CConsoleMain::~CConsoleMain( )
       
   285     {	
       
   286 
       
   287     iDialogs.ResetAndDestroy();
       
   288     iDialogs.Close();
       
   289  
       
   290     // CUIStore close
       
   291     UIStore().Close();
       
   292     
       
   293     delete iReader;
       
   294     iReader = NULL;
       
   295     
       
   296 	delete iScroller;
       
   297 	iScroller = NULL;
       
   298     
       
   299     delete iConsole;
       
   300     iConsole = NULL;
       
   301 
       
   302     delete iMainMenu;
       
   303     iMainMenu = NULL;
       
   304 
       
   305     delete iTestModule;
       
   306     iTestModule = 0;
       
   307     
       
   308     delete iTestModuleIni;
       
   309     iTestModuleIni = 0;
       
   310     
       
   311     delete iTestCaseFile;
       
   312     iTestCaseFile = 0;
       
   313     
       
   314     delete iTestSetName;
       
   315     iTestSetName = 0;
       
   316 
       
   317     delete iModuleList;
       
   318     iModuleList = 0;
       
   319     
       
   320     iFilters.ResetAndDestroy();
       
   321     iFilters.Close();
       
   322     }
       
   323 
       
   324 /*
       
   325 -------------------------------------------------------------------------------
       
   326 
       
   327     Class: CConsoleMain
       
   328 
       
   329     Method: ProcessCommandlineL
       
   330 
       
   331     Description: Process commandline parameters.
       
   332 
       
   333     Parameters: None
       
   334 
       
   335     Return Values: None
       
   336 
       
   337     Errors/Exceptions: Leaves on error.
       
   338 
       
   339     Status: Draft
       
   340 
       
   341 -------------------------------------------------------------------------------
       
   342 */
       
   343 void CConsoleMain::ProcessCommandlineL( TFileName& aIniFile )
       
   344     {
       
   345 
       
   346 	User me;
       
   347     TInt lineLength = me.CommandLineLength();
       
   348     HBufC* lineBuf = HBufC::NewLC( lineLength );
       
   349     TPtr line( lineBuf->Des() );
       
   350     TBool firstTime = ETrue;
       
   351     TInt offset = 0;
       
   352     TPtrC param;
       
   353     TChar c;
       
   354     
       
   355     me.CommandLine( line );
       
   356     TLex lex( line );
       
   357     
       
   358     while( offset < lineLength )
       
   359         {    
       
   360         // Get first charecter of the parameter
       
   361         lex.SkipSpace();
       
   362         c = lex.Peek();
       
   363         if( c == 0 )
       
   364             {
       
   365             // End of line
       
   366             break;
       
   367             }
       
   368         
       
   369         // Get the whole parameter 
       
   370         param.Set( lex.NextToken() );
       
   371         if( firstTime )
       
   372             {
       
   373             // Filebrowser workaround. It gives the exe name as command line param
       
   374             // verify that it is not the same as the executable name
       
   375             //@spe TFileName exePath = me.FileName();
       
   376 			TFileName exePath = RProcess().FileName();
       
   377             if ( param == exePath )
       
   378                 {
       
   379                 // Discard command line parameters when using filebrowser
       
   380                 break;
       
   381                 }
       
   382 
       
   383             firstTime = EFalse;
       
   384             }
       
   385         // Check if -param option
       
   386         if( c == '-' )
       
   387             {
       
   388             // This is option
       
   389             if( param == KTestModule )
       
   390                 {
       
   391                 // Get test module name
       
   392                 param.Set( lex.NextToken() );
       
   393                 if( param.Length() == 0 )
       
   394                     {
       
   395                     UiError( _L("Test module name not given"));
       
   396                     break;
       
   397                     }
       
   398                 if( param.Length() > KMaxName )
       
   399                     {
       
   400                     UiError( _L("Test module name too long"));
       
   401                     break;
       
   402                     }
       
   403                 iTestModule = param.AllocL();
       
   404                 }
       
   405             else if( param == KTestModuleIni )
       
   406                 {
       
   407                 // Get test module initialization file
       
   408                 param.Set( lex.NextToken() );
       
   409                 if( param.Length() == 0 )
       
   410                     {
       
   411                     UiError( _L("Test module initialization file name not given"));
       
   412                     break;
       
   413                     }
       
   414                 if( param.Length() > KMaxFileName )
       
   415                     {
       
   416                     UiError( _L("Test module initialization file name too long"));
       
   417                     break;
       
   418                     }
       
   419                 TFileName tmpTestModuleIni( param );
       
   420                 TStifUtil::CorrectFilePathL( tmpTestModuleIni );
       
   421                 iTestModuleIni = tmpTestModuleIni.AllocL();
       
   422                 }
       
   423             else if( param == KTestCaseFile )
       
   424                 {
       
   425                 // Get test case file name
       
   426                 param.Set( lex.NextToken() );
       
   427                 if( param.Length() == 0 )
       
   428                     {
       
   429                     UiError( _L("Test case file name not given"));
       
   430                     break;
       
   431                     }
       
   432                 if( param.Length() > KMaxFileName )
       
   433                     {
       
   434                     UiError( _L("Test case file name too long"));
       
   435                     break;
       
   436                     }
       
   437                 TFileName tmpTestCaseFile( param );
       
   438                 TStifUtil::CorrectFilePathL( tmpTestCaseFile );
       
   439                 iTestCaseFile = tmpTestCaseFile.AllocL();
       
   440                 }
       
   441             else if( param == KTestSet )
       
   442                 {
       
   443                 // Get test set name
       
   444                 param.Set( lex.NextToken() );
       
   445                 if( param.Length() == 0 )
       
   446                     {
       
   447                     UiError( _L("Test set name not given"));
       
   448                     break;
       
   449                     }
       
   450                 if( param.Length() > KMaxFileName )
       
   451                     {
       
   452                     UiError( _L("Test set name too long"));
       
   453                     
       
   454                     break;
       
   455                     }
       
   456                 iTestSetName = param.AllocL();
       
   457                 }
       
   458             else if( param == KTestRun )
       
   459                 {
       
   460                 if( iStartCases )
       
   461                     {
       
   462                     UiError( _L("Only one -run option allowed") );
       
   463                     // Do not start anything
       
   464                     iStartCases = EStartCaseNo;
       
   465                     break;
       
   466                     }
       
   467                 // Get run type
       
   468                 lex.Mark();
       
   469                 param.Set( lex.NextToken() );
       
   470                 if( param.Length() == 0 )
       
   471                     {
       
   472                     UiError( _L("Test set name not given"));
       
   473                     break;
       
   474                     }
       
   475                 if( ( param == KTestRunAll ) ||
       
   476                     ( param == KTestRunSeq ) )
       
   477                     {
       
   478                     iStartCases = EStartCasesSeq;
       
   479                     }
       
   480                 else if( param == KTestRunPar )
       
   481                     {
       
   482                     iStartCases = EStartCasesPar;
       
   483                     }
       
   484                 else
       
   485                     {
       
   486                     lex.UnGetToMark();
       
   487                     lex.SkipSpace();
       
   488                     if( lex.Val( iTestCaseNum ) != KErrNone )
       
   489                         { 
       
   490                         UiError( _L("Unknown run type given, valid values are all/sequential/parallel/test case number"));
       
   491                         }
       
   492                     else
       
   493                         {
       
   494                         iStartCases = EStartSingleCase;
       
   495                         }    
       
   496                     break;
       
   497                     }
       
   498                 }            
       
   499             }
       
   500         else 
       
   501             {
       
   502             // This is Test Framework ini file
       
   503             aIniFile = param;
       
   504             TStifUtil::CorrectFilePathL( aIniFile );
       
   505             // ini file is last option
       
   506             break;
       
   507             }
       
   508         
       
   509         }
       
   510       
       
   511     CleanupStack::PopAndDestroy( lineBuf );
       
   512 
       
   513     }
       
   514     
       
   515     
       
   516 /*
       
   517 -------------------------------------------------------------------------------
       
   518 
       
   519     Class: CConsoleMain
       
   520 
       
   521     Method: Panic
       
   522 
       
   523     Description: Console UI panic function
       
   524 
       
   525     Parameters: TInt
       
   526 
       
   527     Return Values: 
       
   528 
       
   529     Errors/Exceptions: Does not return.
       
   530 
       
   531     Status: Draft
       
   532 
       
   533 -------------------------------------------------------------------------------
       
   534 */
       
   535 void CConsoleMain::Panic(TConsoleUIPanic aPanic )
       
   536     {
       
   537         
       
   538     User::Panic (_L("STIF TestFramework Console UI panic"), aPanic );
       
   539     
       
   540     }
       
   541 
       
   542 
       
   543 /*
       
   544 -------------------------------------------------------------------------------
       
   545 
       
   546     Class: CConsoleMain
       
   547 
       
   548     Method: StartL
       
   549 
       
   550     Description: Construct menu objects and start the menu handling
       
   551 
       
   552     Parameters: None
       
   553 
       
   554     Return Values: None
       
   555 
       
   556     Errors/Exceptions:
       
   557 
       
   558     Status: Draft
       
   559 
       
   560 -------------------------------------------------------------------------------
       
   561 */
       
   562 TInt CConsoleMain::StartL()
       
   563     {
       
   564     
       
   565     // Construct keystroke reader
       
   566     iReader           = CConsoleReader::NewL( this, iConsole );
       
   567 
       
   568     // Construct the main menu
       
   569     TInt majorV;
       
   570     TInt minorV;
       
   571     TInt buildV;
       
   572     TBuf<30> relDate;
       
   573     TStifUtil::STIFVersion(majorV, minorV, buildV, relDate);
       
   574     
       
   575     TBuf<128> version;
       
   576     version.Format(_L("STIF v%d.%d.%d - "), majorV, minorV, buildV);
       
   577     version.Append(relDate);
       
   578     version.Append(_L("\n"));
       
   579     iMainMenu = CMainMenu::NewL( this, NULL, _L("Main menu"), version );
       
   580 
       
   581     // Add the case menu
       
   582     CMenu* caseMenu   = CMenu::NewL( this, iMainMenu, _L("Case menu") );
       
   583     iMainMenu->AddItemL ( caseMenu );
       
   584 
       
   585     // Add the module menu
       
   586     CMenu* moduleMenu = CModuleListView::NewL( this, iMainMenu, _L("Module menu") );
       
   587     iMainMenu->AddItemL ( moduleMenu );
       
   588 
       
   589     // Add test set menu
       
   590     CTestSetMenu* testSetMenu = CTestSetMenu::NewL( this, iMainMenu, _L("Test set menu") );
       
   591     iMainMenu->AddItemL ( testSetMenu );
       
   592  
       
   593     // Construct the case menus
       
   594     CMenu* casestart  = NULL;
       
   595     CMenu* casestartshow  = NULL;
       
   596     
       
   597     // Load filters
       
   598     UIStore().ReadFiltersL(iFilters);
       
   599     
       
   600     // If there are no filters defined, then construct menu without filter's menu
       
   601     if(iFilters.Count() == 0)
       
   602         {
       
   603         casestart = CCaseStartMenu::NewL(this, caseMenu, _L("Start new case"));
       
   604         caseMenu->AddItemL(casestart);
       
   605     CMenu* casestartshow  = NULL;
       
   606         casestartshow = CCaseStartMenu::NewL(this, caseMenu, _L("Start & show output"), ETrue);
       
   607         caseMenu->AddItemL(casestartshow);
       
   608         }
       
   609     else // if there are filters defined, create also filter's menu
       
   610         {
       
   611         CFilterMenu* filtercasestart = NULL;
       
   612         CFilterMenu* filtercasestartshow = NULL;
       
   613         
       
   614         filtercasestart = CFilterMenu::NewL(this, caseMenu, _L("Start new case (filter)"));
       
   615         caseMenu->AddItemL(filtercasestart);
       
   616         casestart = CCaseStartMenu::NewL(this, caseMenu, _L("Start new case"));
       
   617         filtercasestart->SetTestCaseMenu(casestart);
       
   618         
       
   619         filtercasestartshow = CFilterMenu::NewL(this, caseMenu, _L("Start & show output (filter)"));
       
   620         caseMenu->AddItemL(filtercasestartshow);
       
   621         casestartshow = CCaseStartMenu::NewL(this, caseMenu, _L("Start & show output"), ETrue);
       
   622         filtercasestartshow->SetTestCaseMenu(casestartshow);
       
   623         }
       
   624 
       
   625 	CMultipleCaseMenu* multicasestart =
       
   626 	    CMultipleCaseMenu::NewL (this, caseMenu, _L("Run multiple tests") );
       
   627     caseMenu->AddItemL( multicasestart );
       
   628     casestart = CCaseMenu::NewL ( this, caseMenu, _L("Ongoing cases"), 
       
   629         CUIStoreIf::EStatusRunning );
       
   630     caseMenu->AddItemL( casestart );
       
   631     casestart = CCaseMenu::NewL ( this, caseMenu, _L("Executed cases"), 
       
   632         CUIStoreIf::EStatusExecuted );
       
   633     caseMenu->AddItemL( casestart );
       
   634     casestart = CCaseMenu::NewL ( this, caseMenu, _L("Passed cases"), 
       
   635         CUIStoreIf::EStatusPassed );
       
   636     caseMenu->AddItemL( casestart );
       
   637     casestart = CCaseMenu::NewL ( this, caseMenu, _L("Failed cases"), 
       
   638         CUIStoreIf::EStatusFailed );
       
   639     caseMenu->AddItemL( casestart );
       
   640     casestart = CCaseMenu::NewL ( this, caseMenu, _L("Aborted/Crashed cases"), 
       
   641         ( CUIStoreIf::EStatusAborted | CUIStoreIf::EStatusCrashed) );
       
   642     caseMenu->AddItemL( casestart );
       
   643     //Add "test set choice" menu
       
   644     CTestSetChoiceMenu* testChoiceMenu = CTestSetChoiceMenu::NewL( this, testSetMenu, _L("Load test set") );
       
   645  	testSetMenu->AddItemL( testChoiceMenu );
       
   646 
       
   647     // Start stuff according to command line parameters
       
   648     if( iTestSetName )
       
   649         { 
       
   650         // Set test set name
       
   651         testSetMenu->SetTestSetFileName( iTestSetName->Des() );
       
   652         
       
   653         // Load test set
       
   654         if( UIStore().LoadTestSet( iTestSetName->Des() ) != KErrNone )
       
   655  	       {
       
   656            UiError( _L("Test set loading failed"));
       
   657            }
       
   658         else 
       
   659            {
       
   660            // Inform test set menu that set is loaded
       
   661            testSetMenu->SetCreated();
       
   662     
       
   663             // Check if test set should be started
       
   664     	    if( ( iStartCases == EStartCasesPar ) || 
       
   665     	    	( iStartCases == EStartCasesSeq ))         	
       
   666             	{
       
   667             
       
   668 	            // Check set starting type
       
   669     	    	CStartedTestSet::TSetType setType = 
       
   670        	        CStartedTestSet::ESetSequential;
       
   671        	        
       
   672                 if( iStartCases == EStartCasesPar )
       
   673                     {
       
   674                     setType = 
       
   675                         CStartedTestSet::ESetParallel;
       
   676                     }
       
   677                     
       
   678                 // Start test set
       
   679                 RRefArray<CTestSetInfo> setInfos;
       
   680                 TInt ret = UIStore().TestSets( setInfos );
       
   681                 if( (  ret != KErrNone ) ||
       
   682                     ( setInfos.Count() != 1 ) )
       
   683                     {
       
   684                     // Should never ever happen
       
   685                     User::Panic( KConsoleMain, KErrGeneral );
       
   686                     }
       
   687                 
       
   688                 const CTestSetInfo& set = setInfos[0];
       
   689                 setInfos.Reset();
       
   690                 setInfos.Close();
       
   691                 
       
   692                 TInt index;
       
   693                 ret = UIStore().StartTestSet( set, index, setType );
       
   694                 if( ret != KErrNone )
       
   695                     {
       
   696                     UiError( _L("Test set starting failed") );
       
   697                     }
       
   698                 } 
       
   699             }
       
   700         delete iTestSetName;
       
   701         iTestSetName = 0;     
       
   702         }
       
   703     if( iTestModule )
       
   704         {
       
   705         TPtrC module( iTestModule->Des() ); 
       
   706 
       
   707         // Add all test modules and config files
       
   708         RDebug::Print(_L("Start creating test modules"));
       
   709         CTestModuleInfo* moduleInfo = NULL;
       
   710         TInt i;
       
   711         TInt modCnt = iModuleList->Count();
       
   712         TInt ret;
       
   713 
       
   714         for(i = 0; i < modCnt; i++)
       
   715             {
       
   716             RDebug::Print(_L("Processing module"));
       
   717             // Get module
       
   718             moduleInfo = iModuleList->GetModule(i);
       
   719             if(!moduleInfo)
       
   720                 {
       
   721                 RDebug::Print(_L("Could not get module info at index %d"), i);
       
   722                 continue;
       
   723                 }
       
   724 
       
   725             // Get module name
       
   726             TName moduleName;
       
   727             moduleInfo->GetModuleName(moduleName);
       
   728             RDebug::Print(_L("module name: '%S'"), &moduleName);
       
   729 
       
   730             // Get ini file, if exists
       
   731             TFileName ini;
       
   732             moduleInfo->GetIniFileName(ini);
       
   733             if(ini.Length() == 0)
       
   734                 {
       
   735                 RDebug::Print(_L("ini file not found"));
       
   736                 }
       
   737             else
       
   738                 {
       
   739                 RDebug::Print(_L("ini file: '%S'"), &ini);
       
   740                 }
       
   741 
       
   742             // Create test module
       
   743             RDebug::Print(_L("Adding module to UI store"));
       
   744             ret = UIStore().AddTestModule(moduleName, ini);
       
   745             if(ret != KErrNone && ret != KErrAlreadyExists)
       
   746                 {
       
   747                 RDebug::Print(_L("Test module adding failed (%d)"), ret);
       
   748                 UiError(_L("Test module adding failed"));
       
   749                 continue;
       
   750                 }
       
   751 
       
   752             //Add test case files
       
   753             TInt cfgCnt = moduleInfo->CountCfgFiles();
       
   754             TInt j;
       
   755             TFileName cfgFile;
       
   756             for(j = 0; j < cfgCnt; j++)
       
   757                 {
       
   758                 moduleInfo->GetCfgFileName(j, cfgFile);
       
   759                 if(cfgFile.Length() > 0)
       
   760                     {
       
   761                     RDebug::Print(_L("config file: '%S'"), &cfgFile);
       
   762 
       
   763                     ret = UIStore().AddTestCaseFile(moduleName, cfgFile);
       
   764                     if(ret != KErrNone)
       
   765                         {
       
   766                         // Log error
       
   767                         RDebug::Print(_L("Test case file adding failed (%d)"), ret);
       
   768                         UiError(_L("Test case file adding failed"));
       
   769                         continue;
       
   770                         }
       
   771                     }
       
   772                 else
       
   773                     {
       
   774                     RDebug::Print(_L("Got empty cfg file"));
       
   775                     }
       
   776                 }
       
   777             if(cfgCnt == 0)
       
   778                 {
       
   779                 RDebug::Print(_L("cfg file not found"));
       
   780                 }
       
   781 
       
   782             RDebug::Print(_L("Module '%S' processed correctly"), &moduleName);
       
   783             }
       
   784 
       
   785         RDebug::Print(_L("End creating test modules"));
       
   786 
       
   787         if( ( iStartCases == EStartCasesPar ) ||
       
   788             ( iStartCases == EStartCasesSeq ) )
       
   789             {
       
   790             // Start running
       
   791             CMultipleBaseMenu::TRunType runType = 
       
   792                 CMultipleBaseMenu::ERunSequential;
       
   793             if( iStartCases == EStartCasesPar )
       
   794                 {
       
   795                 runType = CMultipleBaseMenu::ERunParallel;
       
   796                 }
       
   797             TRAPD( err,
       
   798                 //multicasestart->StartRunningL( runType, module, file );
       
   799                 multicasestart->StartRunningL(runType, KNullDesC, KNullDesC);
       
   800                 );
       
   801             if( err != KErrNone )
       
   802                 {
       
   803                 UiError( _L("Stating test cases failed") );
       
   804                 }
       
   805             }
       
   806         else if( iStartCases == EStartSingleCase )
       
   807             {
       
   808             // Get test case
       
   809             RRefArray<CTestInfo> testCases;
       
   810             //ret = UIStore().TestCases( testCases, module, file );
       
   811             ret = UIStore().TestCases(testCases, KNullDesC, KNullDesC);
       
   812             if( ret == KErrNone )
       
   813                 {
       
   814                 if( ( iTestCaseNum < 0 ) ||
       
   815                     ( iTestCaseNum >= testCases.Count() ) )
       
   816                     {
       
   817                     ret = KErrNotFound;
       
   818                     }
       
   819                 else
       
   820                     {         
       
   821                     TInt index;           
       
   822                     // Start single test case
       
   823                     ret = UIStore().StartTestCase( testCases[iTestCaseNum], index );
       
   824                     }                                       
       
   825                 }
       
   826             testCases.Reset();       
       
   827             testCases.Close();
       
   828             if( ret != KErrNone )
       
   829                 {
       
   830                 UiError( _L("Starting test case failed"));        
       
   831                 }
       
   832             }
       
   833 
       
   834         delete iTestCaseFile;
       
   835         iTestCaseFile = 0;
       
   836         delete iTestModuleIni;
       
   837         iTestModuleIni = 0;
       
   838         delete iTestModule;
       
   839         iTestModule = 0;
       
   840         }
       
   841         
       
   842     iStartCases = EStartCaseNo;
       
   843     
       
   844     // Load testcase if some stored 
       
   845     UIStore().LoadSavedTestCases();
       
   846            
       
   847 	iScroller = CScrollerTimer::NewL ( this );
       
   848 	iScroller->StartL();	
       
   849 
       
   850     // Print the main menu
       
   851     iCurrentMenu = iMainMenu;
       
   852     iCurrentMenu->PrintMenuL( CMenu::EMenuPrint );
       
   853 
       
   854     // Start to process keyboard events
       
   855     iReader->StartL();
       
   856     
       
   857     return KErrNone;
       
   858 
       
   859     }
       
   860 
       
   861 
       
   862 /*
       
   863 -------------------------------------------------------------------------------
       
   864 
       
   865     Class: CConsoleMain
       
   866 
       
   867     Method: KeyPressed
       
   868 
       
   869     Description: Process keyboard events. Print new menu
       
   870 
       
   871     Parameters: None
       
   872 
       
   873     Return Values: None
       
   874 
       
   875     Errors/Exceptions: Leaves if SelectL leaves
       
   876 
       
   877     Status: Draft
       
   878 
       
   879 -------------------------------------------------------------------------------
       
   880 */
       
   881 void CConsoleMain::KeyPressed()
       
   882     {
       
   883 
       
   884     TBool cont = ETrue;
       
   885 
       
   886     // Read the key
       
   887     TKeyCode key = iConsole->KeyCode();
       
   888     CMenu* tmp = iCurrentMenu;
       
   889 
       
   890     // Let the menu handle the key press
       
   891     TRAPD( err, 
       
   892         iCurrentMenu = iCurrentMenu->SelectL( key, cont );
       
   893         );
       
   894     if( err != KErrNone )
       
   895         {
       
   896         User::InfoPrint( 
       
   897             _L("Processing keystroke failed") );  
       
   898         }
       
   899             
       
   900     if ( iCurrentMenu == NULL )
       
   901         {
       
   902         iCurrentMenu = tmp;
       
   903         }
       
   904 
       
   905    // If "not-exit" key pressed, continue
       
   906     if ( cont )
       
   907         {
       
   908 
       
   909         // Either only update old menu or new menu.
       
   910         if ( tmp == iCurrentMenu )
       
   911             {
       
   912             TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ); );
       
   913             }
       
   914         else
       
   915             {
       
   916             TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuPrint ); )
       
   917             }
       
   918         
       
   919         if( err != KErrNone )
       
   920             {
       
   921             if ( err == KErrNoMemory )
       
   922             	{            	
       
   923             	ExitWithNoMemoryErrorMessage();                
       
   924             	}
       
   925             else
       
   926             	{
       
   927 	            User::InfoPrint( 
       
   928 	                _L("Printing menu failed") );
       
   929             	}
       
   930             }
       
   931 
       
   932         // Enable keystrokes
       
   933         iReader->StartL();
       
   934 
       
   935         }
       
   936     else
       
   937         {
       
   938         // "Exit", stop scheduler and exit
       
   939         CActiveScheduler::Stop();
       
   940         }
       
   941 
       
   942     }
       
   943 
       
   944 /*
       
   945 -------------------------------------------------------------------------------
       
   946 
       
   947     Class: CConsoleMain
       
   948 
       
   949     Method: ExitWithNoMemoryErrorMessage
       
   950 
       
   951     Description: Displays no memory error message and closes ConsoleUI
       
   952     
       
   953     Parameters: None
       
   954 
       
   955     Return Values: None
       
   956 
       
   957     Errors/Exceptions: None
       
   958 
       
   959     Status: Approved
       
   960 
       
   961 -------------------------------------------------------------------------------
       
   962 */
       
   963 void CConsoleMain::ExitWithNoMemoryErrorMessage()
       
   964 	{
       
   965     // "Exit", stop scheduler and exit
       
   966     CActiveScheduler::Stop();
       
   967 
       
   968     _LIT( KErrorTitle, "Error:\n" );
       
   969     _LIT( KErrorMessage, "Test cases execution have been stopped. ConsoleUI does not have enough memory to store information about executed test cases.  Results of executed test cases can be found in TestReport file. ConsoleUI will be closed now." );
       
   970     _LIT( KErrorPressAnyKey, "\n\nPress any key" );
       
   971     
       
   972     TSize size = GetConsole()->ScreenSize();
       
   973     size.iWidth = Min( size.iWidth - KMenuOverhead, 
       
   974                        KErrorMessage().Length() );
       
   975     size.iHeight = ( KErrorTitle().Length() + KErrorMessage().Length() + 
       
   976     				 KErrorPressAnyKey().Length() ) / size.iWidth + 3;
       
   977     
       
   978     CConsoleBase* console = NULL;
       
   979     TRAPD( err, console = Console::NewL( _L("Error note"), size ) );
       
   980     if ( err != KErrNone )
       
   981     	{
       
   982     	// We can't create console, exit without displaying error message
       
   983     	return;
       
   984     	}
       
   985     
       
   986     console->Printf( KErrorTitle );    
       
   987     console->Printf( KErrorMessage ); 
       
   988     console->Printf( KErrorPressAnyKey );
       
   989         
       
   990     console->Getch();
       
   991     
       
   992     delete console;    
       
   993 	}
       
   994 
       
   995 /*
       
   996 -------------------------------------------------------------------------------
       
   997 
       
   998     Class: CConsoleMain
       
   999 
       
  1000     Method: UiError
       
  1001 
       
  1002     Description: Function is called when UI hit an error.
       
  1003     
       
  1004     Parameters: const TDesC& aInfo: in: information
       
  1005 
       
  1006     Return Values: None
       
  1007 
       
  1008     Errors/Exceptions: None
       
  1009 
       
  1010     Status: Draft
       
  1011 
       
  1012 -------------------------------------------------------------------------------
       
  1013 */
       
  1014 
       
  1015 void CConsoleMain::UiError( const TDesC& aInfo )
       
  1016     {
       
  1017     
       
  1018     // Error note deletes itself when it completes
       
  1019     CMenuNotifier::NewL( aInfo, this );
       
  1020     
       
  1021     }
       
  1022     
       
  1023 /*
       
  1024 -------------------------------------------------------------------------------
       
  1025 
       
  1026     Class: CConsoleMain
       
  1027 
       
  1028     Method: Update
       
  1029 
       
  1030     Description: Receives output update notification from CUIStore.
       
  1031     
       
  1032     Parameters: CStartedTestCase* aTestCase: in: Test case information
       
  1033                 TInt aFlags: in: Update reason flags
       
  1034 
       
  1035     Return Values: None
       
  1036 
       
  1037     Errors/Exceptions: None
       
  1038 
       
  1039     Status: Draft
       
  1040 
       
  1041 -------------------------------------------------------------------------------
       
  1042 */
       
  1043 void CConsoleMain::Update( CStartedTestCase* aTestCase, TInt aFlags )
       
  1044     {
       
  1045     
       
  1046    	TInt err( KErrNone );
       
  1047     
       
  1048     // First check if some menu should be signaled 
       
  1049     if( ( aFlags & CUIStoreIf::EStatusExecuted ) &&
       
  1050         ( aTestCase->iBackPtr ) )
       
  1051         {
       
  1052         CMenu* menu = ( CMenu* )aTestCase->iBackPtr;
       
  1053         TRAP( err, 
       
  1054             menu->SignalL( aTestCase ); 
       
  1055             );            
       
  1056         }
       
  1057 
       
  1058     // Update console if needed
       
  1059     if( iCurrentMenu && ( iCurrentMenu->Type() & aFlags ) )
       
  1060         {
       
  1061         if( aFlags & CUIStoreIf::EPrintUpdate )
       
  1062             {
       
  1063             CCaseExecutionView* view = 
       
  1064                 ( CCaseExecutionView* )iCurrentMenu;
       
  1065             if( view->TestCase() == aTestCase )
       
  1066                 {
       
  1067                 TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ) );
       
  1068                 }
       
  1069             }
       
  1070         else
       
  1071             {
       
  1072             TRAP( err, iCurrentMenu->PrintMenuL( CMenu::EMenuRefresh ); )
       
  1073             }
       
  1074         }
       
  1075     
       
  1076     	if ( err != KErrNone )
       
  1077     		{
       
  1078     		if ( err == KErrNoMemory )
       
  1079     			{
       
  1080     			ExitWithNoMemoryErrorMessage();
       
  1081     			}
       
  1082     		}
       
  1083     
       
  1084     }
       
  1085                                                               
       
  1086 
       
  1087 
       
  1088 /*
       
  1089 -------------------------------------------------------------------------------
       
  1090 
       
  1091     Class: CConsoleMain
       
  1092 
       
  1093     Method: Error
       
  1094 
       
  1095     Description: Function is called when test framework prints error.
       
  1096     
       
  1097     Parameters: TErrorNotification& aError: in: Error description
       
  1098 
       
  1099     Return Values: None
       
  1100 
       
  1101     Errors/Exceptions: None
       
  1102 
       
  1103     Status: Draft
       
  1104 
       
  1105 -------------------------------------------------------------------------------
       
  1106 */
       
  1107 
       
  1108 void CConsoleMain::Error( TErrorNotification& aError )
       
  1109     {
       
  1110     
       
  1111     // Error note deletes itself when it completes
       
  1112     CMenuNotifier::NewL( aError.iText, this );
       
  1113     
       
  1114     }
       
  1115 
       
  1116 /*
       
  1117 -------------------------------------------------------------------------------
       
  1118 
       
  1119     Class: CConsoleMain
       
  1120 
       
  1121     Method: PopupMsg
       
  1122 
       
  1123     Description: Function is called when testframework 
       
  1124         wants to print a popup window.
       
  1125     
       
  1126     Parameters: TDesC& aMsg: in: message
       
  1127                 
       
  1128 
       
  1129     Return Values: Symbian OS error code
       
  1130 
       
  1131     Errors/Exceptions: None
       
  1132 
       
  1133     Status: Draft
       
  1134 
       
  1135 -------------------------------------------------------------------------------
       
  1136 */
       
  1137 
       
  1138 TInt CConsoleMain::PopupMsg( const TDesC& aLine1, 
       
  1139                              const TDesC& aLine2, 
       
  1140                              TInt aTimeInSecs )
       
  1141     {
       
  1142     
       
  1143     TInt ret = KErrNone;
       
  1144     
       
  1145     CMenuDialog* dialog = NULL;
       
  1146 
       
  1147     TRAP( ret, dialog = CMenuDialog::NewL( this, aLine1, aLine2, aTimeInSecs ); );
       
  1148 
       
  1149     if( ret == KErrNone )
       
  1150         {
       
  1151         iDialogs.Append( dialog ); 
       
  1152         return (TInt)dialog;
       
  1153         }
       
  1154 
       
  1155     return ret;
       
  1156     
       
  1157     }
       
  1158 
       
  1159 /*
       
  1160 -------------------------------------------------------------------------------
       
  1161 
       
  1162     Class: CConsoleMain
       
  1163 
       
  1164     Method: PopupMsg
       
  1165 
       
  1166     Description: Function is called when testframework 
       
  1167         wants to print a popup window.
       
  1168     
       
  1169     Parameters: TDesC& aMsg: in: message
       
  1170                 
       
  1171 
       
  1172     Return Values: Symbian OS error code
       
  1173 
       
  1174     Errors/Exceptions: None
       
  1175 
       
  1176     Status: Draft
       
  1177 
       
  1178 -------------------------------------------------------------------------------
       
  1179 */
       
  1180 
       
  1181 TInt CConsoleMain::PopupMsg( const TDesC& aLine1, 
       
  1182                              const TDesC& aLine2, 
       
  1183                              TInt aTimeInSecs,
       
  1184                              TKeyCode& aKey,
       
  1185                              TRequestStatus& aStatus )
       
  1186     {
       
  1187     
       
  1188     TInt ret = PopupMsg( aLine1, aLine2, aTimeInSecs );
       
  1189     if( ret < 0 )
       
  1190         {
       
  1191         return ret;
       
  1192         }    
       
  1193         
       
  1194     CMenuDialog* dialog = (CMenuDialog*) ret; 
       
  1195     ret = dialog->WaitForKeypress( aKey, aStatus );
       
  1196 
       
  1197     return (TInt) dialog;
       
  1198     
       
  1199     }
       
  1200 /*
       
  1201 -------------------------------------------------------------------------------
       
  1202 
       
  1203     Class: CConsoleMain
       
  1204 
       
  1205     Method: Close
       
  1206 
       
  1207     Description: Close instance.
       
  1208     
       
  1209     Parameters: TInt aHandle: in: handle to open instance.                
       
  1210 
       
  1211     Return Values: Symbian OS error code
       
  1212 
       
  1213     Errors/Exceptions: None
       
  1214 
       
  1215     Status: Draft
       
  1216 
       
  1217 -------------------------------------------------------------------------------
       
  1218 */
       
  1219 void CConsoleMain::Close( TInt aHandle )
       
  1220     {
       
  1221     
       
  1222     if( aHandle < 0 )
       
  1223         {
       
  1224         return;
       
  1225         }
       
  1226     CMenuDialog* dialog = (CMenuDialog*) aHandle;
       
  1227     TInt index = iDialogs.Find( dialog );
       
  1228     if( index >= 0 )
       
  1229         {
       
  1230         delete dialog;
       
  1231         iDialogs.Remove( index );
       
  1232         }
       
  1233         
       
  1234     }
       
  1235            
       
  1236 /*
       
  1237 -------------------------------------------------------------------------------
       
  1238 
       
  1239     Class: CConsoleMain
       
  1240 
       
  1241     Method: GetConsole
       
  1242 
       
  1243     Description: Returns the console
       
  1244 
       
  1245     Parameters: None
       
  1246 
       
  1247     Return Values: CConsoleBase*                    Console
       
  1248 
       
  1249     Errors/Exceptions: None
       
  1250 
       
  1251     Status: Draft
       
  1252 
       
  1253 -------------------------------------------------------------------------------
       
  1254 */
       
  1255 CConsoleBase* CConsoleMain::GetConsole()
       
  1256     {
       
  1257 
       
  1258     return iConsole;
       
  1259 
       
  1260     }
       
  1261 
       
  1262 /*
       
  1263 -------------------------------------------------------------------------------
       
  1264 
       
  1265     Class: CConsoleMain
       
  1266 
       
  1267     Method: TimerUpdate
       
  1268 
       
  1269     Description: Updates current menu from timer
       
  1270 
       
  1271     Parameters: None
       
  1272 
       
  1273     Return Values: None
       
  1274 
       
  1275     Errors/Exceptions: None
       
  1276 
       
  1277     Status: Draft
       
  1278 
       
  1279 -------------------------------------------------------------------------------
       
  1280 */
       
  1281 void CConsoleMain::TimerUpdate()
       
  1282     {
       
  1283 
       
  1284 	iCurrentMenu->TimerUpdate();
       
  1285 
       
  1286     }
       
  1287 
       
  1288 /*
       
  1289 -------------------------------------------------------------------------------
       
  1290 
       
  1291     Class: CConsoleMain
       
  1292 
       
  1293     Method: ParseTestModulesL
       
  1294 
       
  1295     Description: Parse and search for module info and fill list of modules.
       
  1296 
       
  1297     Parameters: CStifParser*     aParser:       in: CStifParser object
       
  1298                 CTestModuleList* aModuleList:   in: list of modules
       
  1299                 TPtrC&           aSectionStart: in: descriptor with start of section string
       
  1300                 TPTrC&           aSectionEnd:   in: descriptor with end of section string
       
  1301 
       
  1302     Return Values: None
       
  1303 
       
  1304     Errors/Exceptions: Leaves if some of called leaving methods leaves
       
  1305 
       
  1306     Status: Approved
       
  1307 
       
  1308 -------------------------------------------------------------------------------
       
  1309 */
       
  1310 void CConsoleMain::ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd)
       
  1311     {
       
  1312     //First let's find all modules given in Stif's ini file and store that info in CTestModuleList object
       
  1313     CStifSectionParser* sectionParser = NULL;
       
  1314     CStifItemParser* item = NULL;
       
  1315 
       
  1316     sectionParser = aParser->SectionL(aSectionStart, aSectionEnd);
       
  1317 
       
  1318     while(sectionParser)
       
  1319         {
       
  1320         RDebug::Print(_L("Found '%S' and '%S' sections"), &aSectionStart, &aSectionEnd);
       
  1321         CleanupStack::PushL(sectionParser);
       
  1322         RDebug::Print(_L("Starting to read module information"));
       
  1323 
       
  1324         // Get name of module
       
  1325         _LIT(KModuleName, "ModuleName=");
       
  1326         item = sectionParser->GetItemLineL(KModuleName);
       
  1327         CleanupStack::PushL(item);
       
  1328         if(!item)
       
  1329             {
       
  1330             CleanupStack::PopAndDestroy(item);
       
  1331             UiError(_L("Line not found from module section"));
       
  1332             User::Leave(KErrGeneral);
       
  1333             }
       
  1334         else
       
  1335             {
       
  1336             RDebug::Print(_L("'%S' found"), &KModuleName);
       
  1337             }
       
  1338 
       
  1339         TPtrC name;
       
  1340         TName moduleName;
       
  1341         TInt ret(KErrNone);
       
  1342         ret = item->GetString(KModuleName, name);
       
  1343         if(ret != KErrNone)
       
  1344             {
       
  1345             CleanupStack::PopAndDestroy(item);
       
  1346             RDebug::Print(_L("Module name parsing left with error (%d)"), ret);
       
  1347             UiError(_L("Module name parsing left with error (err)"));
       
  1348             User::Leave(ret);
       
  1349             }
       
  1350         else
       
  1351             {
       
  1352             RDebug::Print(_L("Module '%S' found from ini-file"), &name);
       
  1353             moduleName.Copy(name);
       
  1354             moduleName.LowerCase();
       
  1355             ret = aModuleList->AddTestModule(moduleName);
       
  1356             if(ret != KErrNone && ret != KErrAlreadyExists)
       
  1357                 {
       
  1358                 RDebug::Print(_L("Could not add module to list of modules (%d)"), ret);
       
  1359                 UiError(_L("Could not add module to list of modules (err)"));
       
  1360                 User::Leave(ret);
       
  1361                 }
       
  1362             }
       
  1363         CleanupStack::PopAndDestroy(item);
       
  1364 
       
  1365         //Get pointer to added module
       
  1366         CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName);
       
  1367         if(!moduleInfo)
       
  1368             {
       
  1369                 RDebug::Print(_L("Could not add get module info from list"));
       
  1370                 UiError(_L("Could not add get module info from list"));
       
  1371                 User::Leave(KErrNotFound);
       
  1372             }
       
  1373 
       
  1374         // Get ini file, if it exists
       
  1375         RDebug::Print(_L("Start parsing ini file"));
       
  1376         _LIT(KIniFile, "IniFile=");
       
  1377         item = sectionParser->GetItemLineL(KIniFile);
       
  1378         if(item)
       
  1379             {
       
  1380             RDebug::Print(_L("'%S' found"), &KIniFile);
       
  1381             CleanupStack::PushL(item);
       
  1382             TPtrC iniFile;
       
  1383             ret = item->GetString(KIniFile, iniFile);
       
  1384             if(ret == KErrNone)
       
  1385                 {
       
  1386                 RDebug::Print(_L("Initialization file '%S' found, file can be empty"), &iniFile);
       
  1387                 TFileName filename;
       
  1388                 filename.Copy(iniFile);
       
  1389 				TStifUtil::CorrectFilePathL(filename);
       
  1390                 filename.LowerCase();
       
  1391                 moduleInfo->SetIniFile(filename);
       
  1392                 }
       
  1393             else
       
  1394                 {
       
  1395                 RDebug::Print(_L("Initialization file not found"));
       
  1396                 }
       
  1397             CleanupStack::PopAndDestroy(item);
       
  1398             }
       
  1399         else
       
  1400             {
       
  1401             RDebug::Print(_L("'%S' not found"), &KIniFile);
       
  1402             }
       
  1403 
       
  1404         // Get config (testcase) file
       
  1405         RDebug::Print(_L("Start parsing cfg files"));
       
  1406         TPtrC cfgTag;
       
  1407         for(TInt i = 0; i < 2; i++)
       
  1408             {
       
  1409             //Set tag for config files
       
  1410             if(i == 0)
       
  1411                 {
       
  1412                 cfgTag.Set(_L("ConfigFile="));
       
  1413                 }
       
  1414                 else
       
  1415                 {
       
  1416                 cfgTag.Set(_L("TestCaseFile="));
       
  1417                 }
       
  1418             //Read data
       
  1419             item = sectionParser->GetItemLineL(cfgTag);
       
  1420             while(item)
       
  1421                 {
       
  1422                 CleanupStack::PushL(item);
       
  1423                 RDebug::Print(_L("Item '%S' found"), &cfgTag);
       
  1424                 TPtrC cfgFile;
       
  1425                 ret = item->GetString(cfgTag, cfgFile);
       
  1426                 if(ret == KErrNone)
       
  1427                     {
       
  1428                     RDebug::Print(_L("Configuration file '%S' found"), &cfgFile);
       
  1429                     TFileName ifile;
       
  1430                     ifile.Copy(cfgFile);
       
  1431 					TStifUtil::CorrectFilePathL(ifile);
       
  1432                     ifile.LowerCase();
       
  1433                     moduleInfo->AddCfgFile(ifile);
       
  1434                     }
       
  1435                 else
       
  1436                     {
       
  1437                     RDebug::Print(_L("Configuration file not found"));
       
  1438                     }
       
  1439                 CleanupStack::PopAndDestroy(item);
       
  1440                 item = sectionParser->GetNextItemLineL(cfgTag);
       
  1441                 }
       
  1442             }
       
  1443 
       
  1444         RDebug::Print(_L("Module '%S' information read correctly"), &moduleName);
       
  1445 
       
  1446         // Get next section
       
  1447         CleanupStack::PopAndDestroy(sectionParser);
       
  1448         sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd);
       
  1449         }
       
  1450     }
       
  1451 
       
  1452 /*
       
  1453 -------------------------------------------------------------------------------
       
  1454 
       
  1455     Class: CConsoleMain
       
  1456 
       
  1457     Method: GetMainMenu
       
  1458 
       
  1459     Description: Return main menu of console.
       
  1460 
       
  1461     Parameters: None
       
  1462 
       
  1463     Return Values: CMainMenu*  pointer to main menu
       
  1464 
       
  1465     Errors/Exceptions: None
       
  1466 
       
  1467     Status: Approved
       
  1468 
       
  1469 -------------------------------------------------------------------------------
       
  1470 */
       
  1471 CMainMenu* CConsoleMain::GetMainMenu()
       
  1472     {
       
  1473     return dynamic_cast<CMainMenu*>(iMainMenu);
       
  1474     }
       
  1475 
       
  1476 /*
       
  1477 -------------------------------------------------------------------------------
       
  1478 
       
  1479     Class: CConsoleMain
       
  1480 
       
  1481     Method: GetFilterArray
       
  1482 
       
  1483     Description: Get filter array for reading purposes
       
  1484 
       
  1485     Parameters: None
       
  1486 
       
  1487     Return Values: const RPointerArray<TDesC>&  array with filters
       
  1488 
       
  1489     Errors/Exceptions: None
       
  1490 
       
  1491     Status: Approved
       
  1492 
       
  1493 -------------------------------------------------------------------------------
       
  1494 */
       
  1495 const RPointerArray<TDesC>& CConsoleMain::GetFilterArray(void) const
       
  1496     {
       
  1497     return iFilters;
       
  1498     }
       
  1499 
       
  1500 /*
       
  1501 -------------------------------------------------------------------------------
       
  1502 
       
  1503     Class: CConsoleMain
       
  1504 
       
  1505     Method: SetFilterIndex
       
  1506 
       
  1507     Description: Set info about which index filter is used
       
  1508 
       
  1509     Parameters: TInt aFilterIndex: filter index selected by user
       
  1510 
       
  1511     Return Values: None
       
  1512 
       
  1513     Errors/Exceptions: None
       
  1514 
       
  1515     Status: Approved
       
  1516 
       
  1517 -------------------------------------------------------------------------------
       
  1518 */
       
  1519 void CConsoleMain::SetFilterIndex(TInt aFilterIndex)
       
  1520     {
       
  1521     iChosenFilterIndex = aFilterIndex;
       
  1522     }
       
  1523 
       
  1524 /*
       
  1525 -------------------------------------------------------------------------------
       
  1526 
       
  1527     Class: CConsoleMain
       
  1528 
       
  1529     Method: GetFilterIndex
       
  1530 
       
  1531     Description: Get info about which index filter is used
       
  1532 
       
  1533     Parameters: None
       
  1534 
       
  1535     Return Values: TInt: filter index selected by user
       
  1536 
       
  1537     Errors/Exceptions: None
       
  1538 
       
  1539     Status: Approved
       
  1540 
       
  1541 -------------------------------------------------------------------------------
       
  1542 */
       
  1543 TInt CConsoleMain::GetFilterIndex(void)
       
  1544     {
       
  1545     return iChosenFilterIndex;
       
  1546     }
       
  1547 
       
  1548 /*
       
  1549 -------------------------------------------------------------------------------
       
  1550 
       
  1551     Class: CScrollerTimer
       
  1552 
       
  1553     Method: NewL
       
  1554 
       
  1555     Description: Construct a new CScrollerTimer object
       
  1556 
       
  1557     Parameters: CConsoleMain*             :in:      Pointer to main console               
       
  1558 
       
  1559     Return Values: CScrollerTimer*                         New CScrollerTimer object
       
  1560 
       
  1561     Errors/Exceptions: Leaves if memory allocation or ConstructL leaves
       
  1562 
       
  1563     Status: Draft
       
  1564 
       
  1565 -------------------------------------------------------------------------------
       
  1566 */
       
  1567 CScrollerTimer* CScrollerTimer::NewL( CConsoleMain* aMain )
       
  1568     {
       
  1569 
       
  1570     CScrollerTimer* self = new ( ELeave ) CScrollerTimer();
       
  1571     CleanupStack::PushL( self );
       
  1572     self->ConstructL( aMain );
       
  1573     CleanupStack::Pop( self );
       
  1574     return self;
       
  1575 
       
  1576     }
       
  1577 
       
  1578 /*
       
  1579 -------------------------------------------------------------------------------
       
  1580 
       
  1581     Class: CScrollerTimer
       
  1582 
       
  1583     Method: ConstructL
       
  1584 
       
  1585     Description: Second level constructor
       
  1586 
       
  1587     Parameters: CConsoleMain*             :in:      Pointer to main console
       
  1588 
       
  1589     Return Values: None
       
  1590 
       
  1591     Errors/Exceptions: None
       
  1592 
       
  1593     Status: Draft
       
  1594 
       
  1595 -------------------------------------------------------------------------------
       
  1596 */
       
  1597 void CScrollerTimer::ConstructL( CConsoleMain* aMain )
       
  1598     {
       
  1599 
       
  1600     // Store module information
       
  1601     iMain = aMain;
       
  1602 	iTimer.CreateLocal();
       
  1603 
       
  1604 	CActiveScheduler::Add ( this );
       
  1605 
       
  1606     }
       
  1607 
       
  1608 /*
       
  1609 -------------------------------------------------------------------------------
       
  1610 
       
  1611     Class: CScrollerTimer
       
  1612 
       
  1613     Method: CScrollerTimer
       
  1614 
       
  1615     Description: Constructor.
       
  1616 
       
  1617     Parameters: None
       
  1618 
       
  1619     Return Values: None
       
  1620 
       
  1621     Errors/Exceptions: None
       
  1622 
       
  1623     Status: Draft
       
  1624     
       
  1625 -------------------------------------------------------------------------------
       
  1626 */
       
  1627 CScrollerTimer::CScrollerTimer() : CActive (CActive::EPriorityStandard)
       
  1628     {
       
  1629 
       
  1630     }
       
  1631 
       
  1632 
       
  1633 /*
       
  1634 -------------------------------------------------------------------------------
       
  1635 
       
  1636     Class: CScrollerTimer
       
  1637 
       
  1638     Method: ~CScrollerTimer
       
  1639 
       
  1640     Description: None
       
  1641 
       
  1642     Parameters: None
       
  1643 
       
  1644     Return Values: None
       
  1645 
       
  1646     Errors/Exceptions: None
       
  1647 
       
  1648     Status: Draft
       
  1649     
       
  1650 -------------------------------------------------------------------------------
       
  1651 */
       
  1652 CScrollerTimer::~CScrollerTimer( )
       
  1653     {
       
  1654 
       
  1655 	Cancel();
       
  1656 	iTimer.Close();
       
  1657 
       
  1658     }
       
  1659 
       
  1660 /*
       
  1661 -------------------------------------------------------------------------------
       
  1662 
       
  1663     Class: CScrollerTimer
       
  1664 
       
  1665     Method: StartL
       
  1666 
       
  1667     Description: None
       
  1668 
       
  1669     Parameters: None
       
  1670 
       
  1671     Return Values: None
       
  1672 
       
  1673     Errors/Exceptions: None
       
  1674 
       
  1675     Status: Draft
       
  1676     
       
  1677 -------------------------------------------------------------------------------
       
  1678 */
       
  1679 void CScrollerTimer::StartL( )
       
  1680     {
       
  1681 
       
  1682 	SetActive();
       
  1683 	iTimer.After ( iStatus, KScrollPeriod );	
       
  1684 
       
  1685     }
       
  1686 
       
  1687 /*
       
  1688 -------------------------------------------------------------------------------
       
  1689 
       
  1690     Class: CScrollerTimer
       
  1691 
       
  1692     Method: RunL
       
  1693 
       
  1694     Description: None
       
  1695 
       
  1696     Parameters: None
       
  1697 
       
  1698     Return Values: None
       
  1699 
       
  1700     Errors/Exceptions: None
       
  1701 
       
  1702     Status: Draft
       
  1703     
       
  1704 -------------------------------------------------------------------------------
       
  1705 */
       
  1706 void CScrollerTimer::RunL( )
       
  1707     {
       
  1708 
       
  1709 	iMain->TimerUpdate();
       
  1710 
       
  1711 	// Restart request
       
  1712 	SetActive();
       
  1713 	iTimer.After ( iStatus, KScrollPeriod );
       
  1714 
       
  1715     }
       
  1716 
       
  1717 /*
       
  1718 -------------------------------------------------------------------------------
       
  1719 
       
  1720     Class: CScrollerTimer
       
  1721 
       
  1722     Method: DoCancel
       
  1723 
       
  1724     Description: None
       
  1725 
       
  1726     Parameters: None
       
  1727 
       
  1728     Return Values: None
       
  1729 
       
  1730     Errors/Exceptions: None
       
  1731 
       
  1732     Status: Draft
       
  1733     
       
  1734 -------------------------------------------------------------------------------
       
  1735 */
       
  1736 void CScrollerTimer::DoCancel( )
       
  1737     {
       
  1738 
       
  1739 	iTimer.Cancel();
       
  1740 
       
  1741     }
       
  1742 
       
  1743 /*
       
  1744 -------------------------------------------------------------------------------
       
  1745 
       
  1746     Class: CScrollerTimer
       
  1747 
       
  1748     Method: RunError
       
  1749 
       
  1750     Description: None
       
  1751 
       
  1752     Parameters: None
       
  1753 
       
  1754     Return Values: None
       
  1755 
       
  1756     Errors/Exceptions: None
       
  1757 
       
  1758     Status: Draft
       
  1759     
       
  1760 -------------------------------------------------------------------------------
       
  1761 */
       
  1762 TInt CScrollerTimer::RunError( TInt aError)
       
  1763     {
       
  1764     if ( aError == KErrNoMemory )
       
  1765     	{
       
  1766     	iMain->ExitWithNoMemoryErrorMessage();
       
  1767     	}
       
  1768   
       
  1769 	return aError;
       
  1770     }    
       
  1771 
       
  1772 /*
       
  1773 -------------------------------------------------------------------------------
       
  1774 
       
  1775     DESCRIPTION
       
  1776 
       
  1777     This module contains implementation of CConsoleReader class.
       
  1778 
       
  1779 -------------------------------------------------------------------------------
       
  1780 */
       
  1781 
       
  1782 // ================= MEMBER FUNCTIONS =========================================
       
  1783 
       
  1784 
       
  1785 
       
  1786 /*
       
  1787 -------------------------------------------------------------------------------
       
  1788 
       
  1789     Class: CConsoleReader
       
  1790 
       
  1791     Method: NewL
       
  1792 
       
  1793     Description: Construct the console main class
       
  1794 
       
  1795     Parameters: CConsoleMain* aMain: in: Pointer to main console
       
  1796                 CConsoleBase* aConsole: in: Console pointer
       
  1797 
       
  1798     Return Values: CConsoleReader*                    New object
       
  1799 
       
  1800     Errors/Exceptions: Leaves if memory allocation fails or
       
  1801                        ConstructL leaves.
       
  1802 
       
  1803     Status: Draft
       
  1804 
       
  1805 -------------------------------------------------------------------------------
       
  1806 */
       
  1807 CConsoleReader* CConsoleReader::NewL( CConsoleMain* aMain, 
       
  1808                                       CConsoleBase* aConsole )
       
  1809     {
       
  1810 
       
  1811     CConsoleReader* self = 
       
  1812         new ( ELeave ) CConsoleReader( aMain, aConsole );
       
  1813     CleanupStack::PushL( self );
       
  1814     self->ConstructL();
       
  1815     CleanupStack::Pop( self );
       
  1816     return self;
       
  1817 
       
  1818     }
       
  1819 
       
  1820 
       
  1821 /*
       
  1822 -------------------------------------------------------------------------------
       
  1823 
       
  1824     Class: CConsoleReader
       
  1825 
       
  1826     Method: ConstructL
       
  1827 
       
  1828     Description: Second level constructor.
       
  1829     
       
  1830     Parameters: None
       
  1831 
       
  1832     Return Values: None
       
  1833 
       
  1834     Errors/Exceptions: 
       
  1835 
       
  1836     Status: Draft
       
  1837 
       
  1838 -------------------------------------------------------------------------------
       
  1839 */
       
  1840 void CConsoleReader::ConstructL( )
       
  1841     {
       
  1842     }
       
  1843 
       
  1844 
       
  1845 /*
       
  1846 -------------------------------------------------------------------------------
       
  1847 
       
  1848     Class: CConsoleReader
       
  1849 
       
  1850     Method: CConsoleReader
       
  1851 
       
  1852     Description: Constructor.
       
  1853 
       
  1854     Parameters: CConsoleMain* aMain: in: Pointer to main console
       
  1855                 CConsoleBase* aConsole: in: Console pointer
       
  1856 
       
  1857     Return Values: None
       
  1858 
       
  1859     Errors/Exceptions: None
       
  1860 
       
  1861     Status: Draft
       
  1862 
       
  1863 -------------------------------------------------------------------------------
       
  1864 */
       
  1865 CConsoleReader::CConsoleReader( CConsoleMain* aMain, 
       
  1866                                 CConsoleBase* aConsole ): 
       
  1867     CActive( EPriorityStandard )
       
  1868     {
       
  1869     
       
  1870     iMain = aMain;
       
  1871     iConsole = aConsole;
       
  1872     
       
  1873     CActiveScheduler::Add( this );
       
  1874 
       
  1875     }
       
  1876 
       
  1877 
       
  1878 /*
       
  1879 -------------------------------------------------------------------------------
       
  1880 
       
  1881     Class: CConsoleReader
       
  1882 
       
  1883     Method: ~CConsoleReader
       
  1884 
       
  1885     Description: Destructor
       
  1886 
       
  1887     Parameters: None
       
  1888 
       
  1889     Return Values: None
       
  1890 
       
  1891     Errors/Exceptions: None
       
  1892 
       
  1893     Status: Draft
       
  1894 
       
  1895 -------------------------------------------------------------------------------
       
  1896 */
       
  1897 CConsoleReader::~CConsoleReader( )
       
  1898     {	
       
  1899     
       
  1900     Cancel();    
       
  1901     
       
  1902     }
       
  1903 
       
  1904 /*
       
  1905 -------------------------------------------------------------------------------
       
  1906 
       
  1907     Class: CConsoleReader
       
  1908 
       
  1909     Method: StartL
       
  1910 
       
  1911     Description: Construct menu objects and start the menu handling
       
  1912 
       
  1913     Parameters: None
       
  1914 
       
  1915     Return Values: None
       
  1916 
       
  1917     Errors/Exceptions:
       
  1918 
       
  1919     Status: Draft
       
  1920 
       
  1921 -------------------------------------------------------------------------------
       
  1922 */
       
  1923 void CConsoleReader::StartL( )
       
  1924     {
       
  1925 
       
  1926     // Start to process keyboard events
       
  1927     SetActive();
       
  1928     iConsole->Read(iStatus);
       
  1929 
       
  1930     }
       
  1931 /*
       
  1932 -------------------------------------------------------------------------------
       
  1933 
       
  1934     Class: CConsoleReader
       
  1935 
       
  1936     Method: RunError
       
  1937 
       
  1938     Description: None
       
  1939 
       
  1940     Parameters: TInt aError
       
  1941 
       
  1942     Return Values: Error code
       
  1943 
       
  1944     Errors/Exceptions: None
       
  1945 
       
  1946     Status: Draft
       
  1947     
       
  1948 -------------------------------------------------------------------------------
       
  1949 */    
       
  1950 TInt CConsoleReader::RunError(TInt aError)
       
  1951     {
       
  1952     return aError;
       
  1953     }
       
  1954 
       
  1955 
       
  1956 /*
       
  1957 -------------------------------------------------------------------------------
       
  1958 
       
  1959     Class: CConsoleReader
       
  1960 
       
  1961     Method: RunL
       
  1962 
       
  1963     Description: Process keyboard events. Print new menu
       
  1964 
       
  1965     Parameters: None
       
  1966 
       
  1967     Return Values: None
       
  1968 
       
  1969     Errors/Exceptions: Leaves if SelectL leaves
       
  1970 
       
  1971     Status: Draft
       
  1972 
       
  1973 -------------------------------------------------------------------------------
       
  1974 */
       
  1975 void CConsoleReader::RunL()
       
  1976     {
       
  1977 
       
  1978     iMain->KeyPressed();
       
  1979     
       
  1980     }
       
  1981 
       
  1982 
       
  1983 /*
       
  1984 -------------------------------------------------------------------------------
       
  1985 
       
  1986     Class: CConsoleReader
       
  1987 
       
  1988     Method: DoCancel
       
  1989 
       
  1990     Description: Cancel request
       
  1991 
       
  1992     Parameters: None
       
  1993 
       
  1994     Return Values: None
       
  1995 
       
  1996     Errors/Exceptions: None
       
  1997 
       
  1998     Status: Draft
       
  1999 
       
  2000 -------------------------------------------------------------------------------
       
  2001 */
       
  2002 void CConsoleReader::DoCancel()
       
  2003     {
       
  2004     
       
  2005     iConsole->ReadCancel();
       
  2006     
       
  2007     }
       
  2008 
       
  2009 
       
  2010 // ================= OTHER EXPORTED FUNCTIONS =================================
       
  2011 
       
  2012 /*
       
  2013 -------------------------------------------------------------------------------
       
  2014 
       
  2015     Class: -
       
  2016 
       
  2017     Method: MainL
       
  2018 
       
  2019     Description: The main function that can leave.
       
  2020     Create the CMainConsole object and create, initialise and 
       
  2021     start active scheduler.
       
  2022 
       
  2023     When active scheduler is stopped, clean up memory and exit.
       
  2024 
       
  2025     Parameters: None
       
  2026 
       
  2027     Return Values: None
       
  2028 
       
  2029     Errors/Exceptions: Leaves if memory allocation or CConsoleMain construction
       
  2030                        leaves.
       
  2031 
       
  2032     Status: Draft
       
  2033 
       
  2034 -------------------------------------------------------------------------------
       
  2035 */
       
  2036 LOCAL_C void MainL()
       
  2037     {
       
  2038 
       
  2039     // Construct and install active scheduler
       
  2040     CActiveScheduler* scheduler=new ( ELeave ) CActiveScheduler;
       
  2041     CleanupStack::PushL( scheduler );
       
  2042     CActiveScheduler::Install( scheduler );
       
  2043 
       
  2044     // Construct the console
       
  2045     CConsoleMain* mainConsole = CConsoleMain::NewL();
       
  2046     CleanupStack::PushL( mainConsole );
       
  2047 
       
  2048     // Start the console
       
  2049     mainConsole->StartL();
       
  2050 
       
  2051     // Start handling requests
       
  2052     CActiveScheduler::Start();
       
  2053     // Execution continues from here after CActiveScheduler::Stop()
       
  2054 
       
  2055     // Clean-up
       
  2056     CleanupStack::PopAndDestroy( mainConsole );
       
  2057     CleanupStack::PopAndDestroy( scheduler );
       
  2058 
       
  2059     }
       
  2060 
       
  2061 
       
  2062 /*
       
  2063 -------------------------------------------------------------------------------
       
  2064 
       
  2065     Class: -
       
  2066 
       
  2067     Method: E32Main
       
  2068 
       
  2069     Description: The main function. Execution starts from here.
       
  2070     Create clean-up stack and trap the MainL function which does the
       
  2071     real work.
       
  2072 
       
  2073     Parameters: None
       
  2074 
       
  2075     Return Values: TInt                             Error code
       
  2076 
       
  2077     Errors/Exceptions: None
       
  2078 
       
  2079     Status: Draft
       
  2080 
       
  2081 -------------------------------------------------------------------------------
       
  2082 */
       
  2083 GLDEF_C TInt E32Main()
       
  2084     {
       
  2085 
       
  2086     __UHEAP_MARK;
       
  2087 
       
  2088     // Get clean-up stack
       
  2089     CTrapCleanup* cleanup=CTrapCleanup::New();
       
  2090 
       
  2091     // Call the main function
       
  2092     TRAPD( error, MainL() );
       
  2093 
       
  2094     // Clean-up
       
  2095     delete cleanup; 
       
  2096     cleanup = NULL;
       
  2097 
       
  2098     __UHEAP_MARKEND;
       
  2099 
       
  2100     return error;
       
  2101 
       
  2102     }
       
  2103 
       
  2104 #if defined(__WINS__)
       
  2105 /*
       
  2106 -------------------------------------------------------------------------------
       
  2107 
       
  2108     Class: -
       
  2109 
       
  2110     Method: WinsMain
       
  2111 
       
  2112     Description: The WinsMain function.
       
  2113 
       
  2114     Parameters: None
       
  2115 
       
  2116     Return Values: TInt                             Error code
       
  2117 
       
  2118     Errors/Exceptions: None
       
  2119 
       
  2120     Status: Draft
       
  2121 
       
  2122 -------------------------------------------------------------------------------
       
  2123 */
       
  2124 EXPORT_C TInt WinsMain()
       
  2125 	{
       
  2126 	E32Main();
       
  2127 	return KErrNone;
       
  2128 	}
       
  2129 
       
  2130 #endif // __WINS__
       
  2131 
       
  2132 // End of File