Files
EgtInterface/LUA_Base.cpp
T
Dario Sassi 18bf9c19e1 EgtInterface 1.6c8 :
- gestione inserimento in testa ad un gruppo
- gestione Machinings.
2015-03-25 14:34:53 +00:00

182 lines
5.4 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 "API.h"
#include "LUA.h"
#include "LUA_Base.h"
#include "/EgtDev/Include/EGnLuaMgr.h"
using namespace std ;
//----------------------------------------------------------------------------
static LuaMgr s_LuaMgr ;
//----------------------------------------------------------------------------
bool
LuaInit( void)
{
// inizializzo l'interprete lua
if ( ! s_LuaMgr.Init())
return false ;
// carico le funzioni speciali
if ( ! LuaInstallGeneral()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeneral (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeoBase()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoBase (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeomDB()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeomDB (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreate()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreate (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreateCurve()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateCurve (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbCreateSurf()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbCreateSurf (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModify()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModify (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModifyCurve()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifyCurve (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbModifySurf()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbModifySurf (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbPartLayer()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbPartLayer (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbObjects()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjects (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbObjSelection()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjSelection (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGdbObjAttribs()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGdbObjAttribs (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeoSnap()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoSnap (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallGeoTransform()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallGeoTransform (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallMachMgr()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallMachMgr (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallScene()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallScene (" __FUNCTION__ ")")
return false ;
}
if ( ! LuaInstallExchange()) {
LOG_ERROR( GetLogger(), "Error in LuaInstallExchange (" __FUNCTION__ ")")
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
LuaRegisterFunction( const std::string& sFunName, PFLUA pFun)
{
return s_LuaMgr.RegisterFunction( sFunName, pFun) ;
}
//----------------------------------------------------------------------------
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() ;
}