EgtInterface 1.6a2 :
- numerose modifiche e correzioni - aggiunta registrazione comandi in formato lua - aggiunto valutatore di espressioni.
This commit is contained in:
+59
-2
@@ -16,17 +16,53 @@
|
||||
#include "API.h"
|
||||
#include "LUA.h"
|
||||
#include "/EgtDev/Include/EInAPI.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGnStringConverter.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtLuaEvalNumExpr( const wchar_t* wsExpr, double* pdVal)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( pdVal == nullptr)
|
||||
return FALSE ;
|
||||
// valuto l'espressione
|
||||
return ( LuaEvalNumExpr( wstrztoA( wsExpr), *pdVal) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtLuaEvalStringExpr( const wchar_t* wsExpr, wchar_t*& wsVal)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( &wsVal == nullptr)
|
||||
return false ;
|
||||
// valuto l'espressione
|
||||
string sVal ;
|
||||
if ( ! LuaEvalStringExpr( wstrztoA( wsExpr), sVal))
|
||||
return FALSE ;
|
||||
wsVal = _wcsdup( stringtoW( sVal)) ;
|
||||
return (( wsVal == nullptr) ? FALSE : TRUE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtLuaExecLine( const wchar_t* wsLine)
|
||||
{
|
||||
// eseguo il comando
|
||||
return ( LuaExecLine( wstrztoA( wsLine)) ? TRUE : FALSE) ;
|
||||
string sLine = wstrztoA( wsLine) ;
|
||||
bool bOk = LuaExecLine( sLine) ;
|
||||
// se richiesto, salvo il comando Lua
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = sLine +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -39,7 +75,28 @@ __stdcall EgtLuaExecFile( const wchar_t* wsFilePath)
|
||||
string sInfo = "Exec File = " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
// esecuzione script
|
||||
return ( LuaExecFile( sFilePath) ? TRUE : FALSE) ;
|
||||
bool bOk = LuaExecFile( sFilePath) ;
|
||||
// se richiesto, salvo il comando Lua
|
||||
if ( IsCmdLog()) {
|
||||
string sLua = "dofile('" + sFilePath + "')" +
|
||||
" -- Ok=" + ToString( bOk) ;
|
||||
LOG_INFO( GetCmdLogger(), sLua.c_str()) ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
return ( bOk ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL
|
||||
__stdcall EgtLuaRequire( const wchar_t* wsFilePath)
|
||||
{
|
||||
// converto nome file
|
||||
string sFilePath = wstrztoA( wsFilePath) ;
|
||||
// emetto info
|
||||
string sInfo = "Require Library = " + sFilePath ;
|
||||
LOG_INFO( GetLogger(), sInfo.c_str())
|
||||
// eseguo il comando
|
||||
return ( LuaRequire( sFilePath) ? TRUE : FALSE) ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user