EgtInterface 1.6a2 :

- numerose modifiche e correzioni
- aggiunta registrazione comandi in formato lua
- aggiunto valutatore di espressioni.
This commit is contained in:
Dario Sassi
2015-01-14 21:56:57 +00:00
parent bebcf1ecfe
commit e23999b6a3
32 changed files with 3080 additions and 989 deletions
+107 -24
View File
@@ -22,6 +22,7 @@
#include "/EgtDev/Include/EGnDllMain.h"
#include "/EgtDev/Include/EExDllMain.h"
#include "/EgtDev/Include/EGrDllMain.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnStringConverter.h"
#include "/EgtDev/Include/EgtLogger.h"
#include <fstream>
@@ -30,7 +31,9 @@ using namespace std ;
using namespace egtlogger ;
//----------------------------------------------------------------------------
static Logger* s_pLogGen = nullptr ;
static Logger* s_pGenLog = nullptr ;
static Logger* s_pCmdLog = nullptr ;
static bool s_bCmdLog = false ;
//-----------------------------------------------------------------------------
BOOL
@@ -39,31 +42,31 @@ __stdcall EgtInit( int nDebug, const wchar_t* sLogFile)
// cancello eventuali vecchi contesti
ClearAllGseContexts() ;
// cancello eventuale vecchio logger
if ( s_pLogGen != nullptr)
delete s_pLogGen ;
if ( s_pGenLog != nullptr)
delete s_pGenLog ;
// creo il logger generale
s_pLogGen = new Logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "EgtInterface") ;
if ( s_pLogGen == nullptr)
s_pGenLog = new Logger( ( nDebug > 0 ? LL_DEBUG : LL_INFO), "EgtInterface") ;
if ( s_pGenLog == nullptr)
return FALSE ;
// assegno il file
s_pLogGen->AddOutputStream( new ofstream( sLogFile), true) ;
s_pGenLog->AddOutputStream( new ofstream( sLogFile), true) ;
// lo passo alle DLL
SetEGnLogger( s_pLogGen) ;
SetENkLogger( s_pLogGen) ;
SetEGkLogger( s_pLogGen) ;
SetEExLogger( s_pLogGen) ;
SetEGrLogger( s_pLogGen) ;
SetEGnLogger( s_pGenLog) ;
SetENkLogger( s_pGenLog) ;
SetEGkLogger( s_pGenLog) ;
SetEExLogger( s_pGenLog) ;
SetEGrLogger( s_pGenLog) ;
// dichiaro inizio programma
LOG_DATETIME( s_pLogGen, " Init")
LOG_DATETIME( s_pGenLog, " Init")
// versione dell'interfaccia
LOG_INFO( s_pLogGen, GetEInVersion())
LOG_INFO( s_pGenLog, GetEInVersion())
// versione delle librerie
LOG_INFO( s_pLogGen, GetEGnVersion())
LOG_INFO( s_pLogGen, GetENkVersion())
LOG_INFO( s_pLogGen, GetEGkVersion())
LOG_INFO( s_pLogGen, GetEExVersion())
LOG_INFO( s_pLogGen, GetEGrVersion())
LOG_INFO( s_pGenLog, GetEGnVersion())
LOG_INFO( s_pGenLog, GetENkVersion())
LOG_INFO( s_pGenLog, GetEGkVersion())
LOG_INFO( s_pGenLog, GetEExVersion())
LOG_INFO( s_pGenLog, GetEGrVersion())
// inizializzo l'interprete LUA
LuaInit() ;
@@ -82,12 +85,18 @@ __stdcall EgtExit( void)
LuaExit() ;
// fine programma
LOG_DATETIME( s_pLogGen, " Exit")
LOG_DATETIME( s_pGenLog, " Exit")
// cancello il logger
if ( s_pLogGen != nullptr) {
delete s_pLogGen ;
s_pLogGen = nullptr ;
// cancello il logger dei comandi
if ( s_pCmdLog != nullptr) {
delete s_pCmdLog ;
s_pCmdLog = nullptr ;
}
// cancello il logger generale
if ( s_pGenLog != nullptr) {
delete s_pGenLog ;
s_pGenLog = nullptr ;
}
return TRUE ;
@@ -110,6 +119,30 @@ __stdcall EgtSetFont( const wchar_t* wsNfeFontDir, const wchar_t* wsDefaultFont)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetNfeFontDir( wchar_t*& wsNfeFontDir)
{
if ( &wsNfeFontDir == nullptr)
return false ;
// recupero il nome del font di default
string sNfeFontDir = GetNfeFontDir() ;
wsNfeFontDir = _wcsdup( stringtoW( sNfeFontDir)) ;
return (( wsNfeFontDir == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetDefaultFont( wchar_t*& wsDefaultFont)
{
if ( &wsDefaultFont == nullptr)
return false ;
// recupero il nome del font di default
string sDefaultFont = GetDefaultFont() ;
wsDefaultFont = _wcsdup( stringtoW( sDefaultFont)) ;
return (( wsDefaultFont == nullptr) ? FALSE : TRUE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetLuaLibs( const wchar_t* wsLuaLibsDir)
@@ -120,6 +153,43 @@ __stdcall EgtSetLuaLibs( const wchar_t* wsLuaLibsDir)
return FALSE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetCommandLogger( const wchar_t* sLogFile)
{
// cancello eventuale vecchio logger e disabilito output
if ( s_pCmdLog != nullptr)
delete s_pCmdLog ;
s_bCmdLog = false ;
// creo il logger dei comandi
s_pCmdLog = new Logger( LL_INFO, "EgtCommandLog") ;
if ( s_pCmdLog == nullptr)
return FALSE ;
// assegno il file
ofstream* pLogFile = new ofstream( sLogFile) ;
if ( pLogFile == nullptr || pLogFile->bad())
return FALSE ;
s_pCmdLog->AddOutputStream( pLogFile, true) ;
// scrivo intestazione
string sOut = "-- " + CurrDateTime() + " EgtCommandLog" ;
LOG_INFO( s_pCmdLog, sOut.c_str())
return TRUE ;
}
//-----------------------------------------------------------------------------
void
__stdcall EgtEnableCommandLogger( void)
{
s_bCmdLog = true ;
}
//-----------------------------------------------------------------------------
void
__stdcall EgtDisableCommandLogger( void)
{
s_bCmdLog = false ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetVersionInfo( wchar_t*& wsVer)
@@ -168,6 +238,19 @@ __stdcall EgtFreeMemory( void* pMem)
ILogger*
GetLogger( void)
{
return s_pLogGen ;
return s_pGenLog ;
}
//-----------------------------------------------------------------------------
ILogger*
GetCmdLogger( void)
{
return s_pCmdLog ;
}
//-----------------------------------------------------------------------------
bool
IsCmdLog( void)
{
return s_bCmdLog ;
}