EgtGeneral 1.5f2 :

- a CmdParser aggiunta ContinueOnError.
This commit is contained in:
Dario Sassi
2014-06-14 17:58:02 +00:00
parent 69de0d5f78
commit e696017fa8
3 changed files with 24 additions and 1 deletions
+22 -1
View File
@@ -37,6 +37,7 @@ CmdParser::CmdParser( void)
m_nLev = 0 ;
// assegno chiavi a funzioni di esecuzione
m_ExecMgr.Init( 16) ;
m_ExecMgr.Insert( "CONTINUEONERROR", &CmdParser::ExecuteContinueOnError) ;
m_ExecMgr.Insert( "COUNTER", &CmdParser::ExecuteCounter) ;
m_ExecMgr.Insert( "DIR", &CmdParser::ExecuteDir) ;
m_ExecMgr.Insert( "FILE", &CmdParser::ExecuteFile) ;
@@ -133,7 +134,8 @@ CmdParser::Run( const string& sCmdFile, bool bIsolated)
// interpretazione dei comandi del file
m_nCurrLine = 0 ;
m_nExec = DO ;
while ( bOk && m_nExec != STOP && TheScanner.GetLine( sLine)) {
m_bContinueOnError = false ;
while ( ( bOk || m_bContinueOnError) && m_nExec != STOP && TheScanner.GetLine( sLine)) {
// assegno numero linea corrente
m_nCurrLine = TheScanner.GetCurrLineNbr() ;
// elimino gli spazi all'inizio e alla fine
@@ -159,6 +161,10 @@ CmdParser::Run( const string& sCmdFile, bool bIsolated)
sOut = GetInitSpaces() + "--- End ---" ;
LOG_INFO( GetEGnLogger(), sOut.c_str())
}
else if ( m_bContinueOnError) {
sOut = GetInitSpaces() + "--- End : some errors ---" ;
LOG_ERROR( GetEGnLogger(), sOut.c_str())
}
else {
sOut = GetInitSpaces() + "--- Stop : error ---" ;
LOG_ERROR( GetEGnLogger(), sOut.c_str())
@@ -392,6 +398,21 @@ CmdParser::ExecCommand( const string& sCmd, const string& sParams)
return false ;
}
//----------------------------------------------------------------------------
bool
CmdParser::ExecuteContinueOnError( const string& sCmd2, const STRVECTOR& vsParams)
{
// nessun parametro
if ( vsParams.size() != 0)
return false ;
// imposto il flag di continuazione su errore
m_bContinueOnError = true ;
// emetto log
string sOut = GetInitSpaces() + "Continue on error (" + ToString( m_nCurrLine) + ")" ;
LOG_INFO( GetEGnLogger(), sOut.c_str())
return true ;
}
//----------------------------------------------------------------------------
bool
CmdParser::ExecuteCounter( const string& sCmd2, const STRVECTOR& vsParams)