8bc0e986b2
- esecutore e lua scorporato in EgtExecutor.
82 lines
2.6 KiB
C++
82 lines
2.6 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : API_LUA.cpp Data : 28.09.14 Versione : 1.5i5
|
|
// Contenuto : Funzioni esecuzione LUA per API.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 28.09.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "API.h"
|
|
#include "/EgtDev/Include/EInAPI.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EGnStringConverter.h"
|
|
|
|
using namespace std ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtLuaEvalNumExpr( const wchar_t* wsExpr, double* pdVal)
|
|
{
|
|
return ( ExeLuaEvalNumExpr( 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 ( ! ExeLuaEvalStringExpr( wstrztoA( wsExpr), sVal))
|
|
return FALSE ;
|
|
// alloco buffer di ritorno ed eseguo copia
|
|
wsVal = _wcsdup( stringtoW( sVal)) ;
|
|
return (( wsVal == nullptr) ? FALSE : TRUE) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtLuaExecLine( const wchar_t* wsLine)
|
|
{
|
|
return ( ExeLuaExecLine( wstrztoA( wsLine)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtLuaExecFile( const wchar_t* wsFilePath)
|
|
{
|
|
return ( ExeLuaExecFile( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtLuaRequire( const wchar_t* wsFilePath)
|
|
{
|
|
return ( ExeLuaRequire( wstrztoA( wsFilePath)) ? TRUE : FALSE) ;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
BOOL
|
|
__stdcall EgtLuaGetLastError( wchar_t*& wsError)
|
|
{
|
|
// verifico parametro di ritorno
|
|
if ( &wsError == nullptr)
|
|
return FALSE ;
|
|
// recupero l'errore
|
|
string sError ;
|
|
if ( ! ExeLuaGetLastError( sError))
|
|
return FALSE ;
|
|
// alloco buffer di ritorno ed eseguo copia
|
|
wsError = _wcsdup( stringtoW( sError)) ;
|
|
return (( wsError == nullptr) ? FALSE : TRUE) ;
|
|
}
|