EgtGeneral 1.5d4 :
- aggiunto param. bSkipEmptyLine a Init di Scanner - aggiunto a TSC comando EXEC con sottocomandi SKIP, DO e STOP.
This commit is contained in:
+53
-4
@@ -44,6 +44,7 @@ CmdParser::CmdParser( void)
|
||||
m_ExecMgr.Insert( "RESET", &CmdParser::ExecuteReset) ;
|
||||
m_ExecMgr.Insert( "RUN", &CmdParser::ExecuteRun) ;
|
||||
m_ExecMgr.Insert( "SET", &CmdParser::ExecuteSet) ;
|
||||
m_ExecMgr.Insert( "EXEC", &CmdParser::ExecuteExec) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -129,17 +130,25 @@ CmdParser::Run( const std::string& sCmdFile, bool bIsolated)
|
||||
}
|
||||
|
||||
// interpretazione dei comandi del file
|
||||
while ( bOk && TheScanner.GetLine( sLine)) {
|
||||
m_nCurrLine = 0 ;
|
||||
m_nExec = DO ;
|
||||
while ( bOk && m_nExec != STOP && TheScanner.GetLine( sLine)) {
|
||||
// assegno numero linea corrente
|
||||
m_nCurrLine = TheScanner.GetCurrLineNbr() ;
|
||||
// elimino gli spazi all'inizio e alla fine
|
||||
Trim( sLine) ;
|
||||
// separo comando e parametri
|
||||
SplitFirst( sLine, "(", sCmd, sParams) ;
|
||||
ToUpper( sCmd) ;
|
||||
// elimino dai parametri tutto quanto dopo ultima parentesi chiusa
|
||||
SplitLast( sParams, ")", sParams, sDummy) ;
|
||||
// se da saltare e non è comando che fa riprendere esecuzione, vado al prossimo
|
||||
if ( m_nExec == SKIP && sCmd != "EXEC.DO")
|
||||
continue ;
|
||||
// deve esserci un comando e deve essere eseguito correttamente
|
||||
if ( sCmd.empty() || ! ExecCommand( sCmd, sParams)) {
|
||||
bOk = false ;
|
||||
sOut = GetInitSpaces() + "Error on line (" + ToString( TheScanner.GetCurrLineNbr()) + ") : " + sLine ;
|
||||
sOut = GetInitSpaces() + "Error on line (" + ToString( m_nCurrLine) + ") : " + sLine ;
|
||||
LOG_ERROR( GetEGnLogger(), sOut.c_str())
|
||||
}
|
||||
}
|
||||
@@ -177,6 +186,7 @@ CmdParser::ExecLine( const string& sCmdLine, bool bIsolated)
|
||||
// separo comando e parametri
|
||||
string sCmd, sParams ;
|
||||
SplitFirst( sLine, "(", sCmd, sParams) ;
|
||||
ToUpper( sCmd) ;
|
||||
// elimino dai parametri tutto quanto dopo ultima parentesi chiusa
|
||||
string sDummy ;
|
||||
SplitLast( sParams, ")", sParams, sDummy) ;
|
||||
@@ -301,9 +311,7 @@ CmdParser::ExecCommand( const string& sCmd, const string& sParams)
|
||||
string sCmd1, sCmd2 ;
|
||||
SplitFirst( sCmd, ".", sCmd1, sCmd2) ;
|
||||
Trim( sCmd1) ;
|
||||
ToUpper( sCmd1) ;
|
||||
Trim( sCmd2) ;
|
||||
ToUpper( sCmd2) ;
|
||||
|
||||
// divido i parametri
|
||||
STRVECTOR vsParams ;
|
||||
@@ -382,6 +390,47 @@ CmdParser::ExecuteDir( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CmdParser::ExecuteExec( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
{
|
||||
if ( sCmd2 == "SKIP") {
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
return false ;
|
||||
// imposto il flag di esecuzione
|
||||
m_nExec = SKIP ;
|
||||
// emetto log
|
||||
string sOut = GetInitSpaces() + "Skip on line (" + ToString( m_nCurrLine) + ")" ;
|
||||
LOG_INFO( GetEGnLogger(), sOut.c_str())
|
||||
return true ;
|
||||
}
|
||||
else if ( sCmd2 == "DO") {
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
return false ;
|
||||
// imposto il flag di stop
|
||||
m_nExec = DO ;
|
||||
// emetto log
|
||||
string sOut = GetInitSpaces() + "Do on line (" + ToString( m_nCurrLine) + ")" ;
|
||||
LOG_INFO( GetEGnLogger(), sOut.c_str())
|
||||
return true ;
|
||||
}
|
||||
else if ( sCmd2 == "STOP") {
|
||||
// nessun parametro
|
||||
if ( vsParams.size() != 0)
|
||||
return false ;
|
||||
// imposto il flag di stop
|
||||
m_nExec = STOP ;
|
||||
// emetto log
|
||||
string sOut = GetInitSpaces() + "Stop on line (" + ToString( m_nCurrLine) + ")" ;
|
||||
LOG_INFO( GetEGnLogger(), sOut.c_str())
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CmdParser::ExecuteFile( const string& sCmd2, const STRVECTOR& vsParams)
|
||||
|
||||
Reference in New Issue
Block a user