EgtGeneral 1.5f2 :
- a CmdParser aggiunta ContinueOnError.
This commit is contained in:
+22
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user