Files
EgtExecutor/LUA_Base.cpp
T
Dario Sassi c935ebbf35 EgtExecutor 1.6v7 :
- introdotte prime funzioni Exe e Lua per solidi Zmap.
2016-10-27 16:45:50 +00:00

233 lines
7.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : LUA_Base.cpp Data : 27.09.14 Versione : 1.5i5
// Contenuto : Funzioni di base 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/EXeExecutor.h"
#include "/EgtDev/Include/EGkLuaAux.h"
#include "/EgtDev/Include/EGnLuaMgr.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
LuaInstallEgtFunctions( LuaMgr& LuaMgr)
{
if ( ! LuaInstallGeneral( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeneral (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallUiUnits( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallUiUnits (" __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 ( ! LuaInstallGdbCreateVol( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateVol (" __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 ( ! LuaInstallGdbModifyVol( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifyVol (" __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 ( ! LuaInstallNesting( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallNesting (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallScene( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallScene (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallPhoto( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallPhoto (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallExchange( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallExchange (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallShortestPath( LuaMgr)) {
LOG_ERROR( GetLogger(), "Error in LuaInstallShortestPath (" __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 ( ! LuaInstallEgtFunctions( 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 ;
}
//----------------------------------------------------------------------------
LuaMgr&
LuaGetLuaMgr( void)
{
return s_LuaMgr ;
}
//----------------------------------------------------------------------------
bool
LuaSetLuaLibsDir( const string& sDir)
{
return s_LuaMgr.SetLuaLibsDir( sDir) ;
}
//----------------------------------------------------------------------------
bool
LuaRequire( const string& sFile)
{
return s_LuaMgr.Require( sFile) ;
}
//----------------------------------------------------------------------------
bool
LuaResetGlobVar( const string& sVar)
{
return LuaResetGlobVar( s_LuaMgr.GetLuaState(), sVar) ;
}
//----------------------------------------------------------------------------
bool
LuaCreateGlobTable( const string& sVar)
{
return LuaCreateGlobTable( s_LuaMgr.GetLuaState(), sVar) ;
}
//----------------------------------------------------------------------------
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() ;
}
//----------------------------------------------------------------------------
const string&
LuaGetLuaLibsDir( void)
{
return s_LuaMgr.GetLuaLibsDir() ;
}
//----------------------------------------------------------------------------
const string&
LuaGetLastRequire( void)
{
return s_LuaMgr.GetLastRequire() ;
}