EgtMachKernel :

- aggiunta funzione lua EmtSetLastError per segnalare errori nel PostProc
- migliorie a simulazione con introduzione stato di movimento STOP.
This commit is contained in:
Dario Sassi
2018-08-17 18:42:16 +00:00
parent bd74a8c9e7
commit 6d5f24bc51
3 changed files with 56 additions and 89 deletions
+21
View File
@@ -108,6 +108,8 @@ Machine::LuaInit( const string& sMachineName)
m_LuaMgr.RegisterFunction( "EmtWrite", Machine::LuaEmtWrite) ;
// registro la funzione per impostare informazioni di outstroke
m_LuaMgr.RegisterFunction( "EmtSetOutstrokeInfo", Machine::LuaEmtSetOutstrokeInfo) ;
// registro la funzione per impostare informazioni di errore
m_LuaMgr.RegisterFunction( "EmtSetLastError", Machine::LuaEmtSetLastError) ;
return true ;
}
@@ -967,3 +969,22 @@ Machine::LuaEmtSetOutstrokeInfo( lua_State* L)
LuaSetParam( L, true) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtSetLastError( lua_State* L)
{
// 2 parametri : nErrId, sErrDesc
int nErrId ;
LuaCheckParam( L, 1, nErrId)
string sErrDesc ;
LuaCheckParam( L, 2, sErrDesc)
LuaClearStack( L) ;
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// assegno i dati
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SetLastError( nErrId, sErrDesc)) ;
string sOut = "(" + ToString( nErrId) + ") " + sErrDesc ;
return luaL_error( L, sOut.c_str()) ;
}