Files
EgtExecutor/LUA_Base.cpp
T
Dario Sassi 966885645e EgtExecutor 1.6e2 :
- primo rilascio (esecutore e lua da EgtInterface).
2015-05-05 22:14:04 +00:00

186 lines
5.7 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : LUA_General.cpp Data : 27.09.14 Versione : 1.5i5
// Contenuto : Funzioni generali per LUA.
//
//
//
// Modifiche : 27.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "EXE.h"
#include "LUA.h"
#include "LUA_Base.h"
#include "/EgtDev/Include/EGnLuaMgr.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
LuaInstallAllFunctions( LuaMgr& LuaMgr)
{
if ( ! LuaInstallGeneral( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeneral (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeoBase( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoBase (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeomDB( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeomDB (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreate( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreate (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreateCurve( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateCurve (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreateSurf( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateSurf (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModify( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModify (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModifyCurve( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifyCurve (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModifySurf( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifySurf (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbPartLayer( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbPartLayer (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbObjects( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjects (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbObjSelection( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjSelection (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbObjAttribs( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjAttribs (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeoSnap( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoSnap (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeoTransform( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoTransform (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallMachMgr( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallScene( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallScene (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallExchange( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallExchange (" __FUNCTION__ ")")
return false ;
}
return true ;
}
//----------------------------------------------------------------------------
// Static LuaMgr per EgtExecutor
//----------------------------------------------------------------------------
static LuaMgr s_LuaMgr ;
//----------------------------------------------------------------------------
bool
LuaInit( void)
{
// inizializzo l'interprete lua
if ( ! s_LuaMgr.Init())
return false ;
// carico le funzioni speciali
if ( ! LuaInstallAllFunctions( s_LuaMgr))
return false ;
// recupero la versione di Lua
string sLua ;
if ( s_LuaMgr.GetVersion( sLua))
sLua += " interpreter started" ;
else
sLua = "Lua *.* interpreter started" ;
LOG_INFO( GetLogger(), sLua.c_str())
return true ;
}
//----------------------------------------------------------------------------
bool
LuaExit( void)
{
s_LuaMgr.Exit() ;
LOG_INFO( GetLogger(), "Lua interpreter closed")
return true ;
}
//----------------------------------------------------------------------------
bool
LuaSetLuaLibsDir( const string& sDir)
{
return s_LuaMgr.SetLuaLibsDir( sDir) ;
}
//----------------------------------------------------------------------------
bool
LuaRequire( const string& sFile)
{
return s_LuaMgr.Require( sFile) ;
}
//----------------------------------------------------------------------------
bool
LuaEvalNumExpr( const string& sExpr, double& dVal)
{
return s_LuaMgr.EvalNumExpr( sExpr, dVal) ;
}
//----------------------------------------------------------------------------
bool
LuaEvalStringExpr( const string& sExpr, string& sVal)
{
return s_LuaMgr.EvalStringExpr( sExpr, sVal) ;
}
//----------------------------------------------------------------------------
bool
LuaExecLine( const string& sLine)
{
return s_LuaMgr.ExecLine( sLine) ;
}
//----------------------------------------------------------------------------
bool
LuaExecFile( const string& sFile)
{
return s_LuaMgr.ExecFile( sFile) ;
}
//----------------------------------------------------------------------------
const string&
LuaGetLastError( void)
{
return s_LuaMgr.GetLastError() ;
}