EgtInterface 1.5l2 :
- migliorie e modifiche in generale, specie su Lua.
This commit is contained in:
+59
-13
@@ -31,7 +31,7 @@ LuaExistsObj( lua_State* L)
|
||||
LuaCheckParam( L, 1, nId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza oggetto
|
||||
bool bOk = ( EgtExistsObj( nId) ? true : false) ;
|
||||
bool bOk = ( EgtExistsObj( nId) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -45,7 +45,7 @@ LuaGetGroupObjs( lua_State* L)
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico esistenza oggetto
|
||||
// determino il numero di oggetti nel gruppo
|
||||
int nObjs = EgtGetGroupObjs( nGroupId) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, nObjs) ;
|
||||
@@ -124,6 +124,46 @@ LuaGetPrev( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetFirstNameInGroup( lua_State* L)
|
||||
{
|
||||
// 2 parametri : GroupId, sName
|
||||
int nGroupId ;
|
||||
LuaCheckParam( L, 1, nGroupId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il primo oggetto del gruppo
|
||||
int nId = EgtGetFirstNameInGroup( nGroupId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( nId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaGetNextName( lua_State* L)
|
||||
{
|
||||
// 2 parametri : Id, sName
|
||||
int nId ;
|
||||
LuaCheckParam( L, 1, nId)
|
||||
string sName ;
|
||||
LuaCheckParam( L, 2, sName)
|
||||
LuaClearStack( L) ;
|
||||
// recupero il prossimo oggetto nello stesso gruppo
|
||||
int nNextId = EgtGetNextName( nId, sName) ;
|
||||
// restituisco il risultato
|
||||
if ( nNextId != GDB_ID_NULL)
|
||||
LuaSetReturn( L, nNextId) ;
|
||||
else
|
||||
LuaSetReturn( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaCopy( lua_State* L)
|
||||
@@ -134,8 +174,9 @@ LuaCopy( lua_State* L)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_SON ;
|
||||
string sSonBeforeAfter ;
|
||||
if ( LuaGetParam( L, 3, sSonBeforeAfter)) {
|
||||
if ( lua_gettop( L) >= 3) {
|
||||
string sSonBeforeAfter ;
|
||||
LuaCheckParam( L, 3, sSonBeforeAfter) ;
|
||||
ToUpper( sSonBeforeAfter) ;
|
||||
if ( sSonBeforeAfter == "BEFORE")
|
||||
nSonBeforeAfter = GDB_BEFORE ;
|
||||
@@ -163,8 +204,9 @@ LuaCopyGlob( lua_State* L)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_SON ;
|
||||
string sSonBeforeAfter ;
|
||||
if ( LuaGetParam( L, 3, sSonBeforeAfter)) {
|
||||
if ( lua_gettop( L) >= 3) {
|
||||
string sSonBeforeAfter ;
|
||||
LuaCheckParam( L, 3, sSonBeforeAfter) ;
|
||||
ToUpper( sSonBeforeAfter) ;
|
||||
if ( sSonBeforeAfter == "BEFORE")
|
||||
nSonBeforeAfter = GDB_BEFORE ;
|
||||
@@ -192,8 +234,9 @@ LuaRelocate( lua_State* L)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_SON ;
|
||||
string sSonBeforeAfter ;
|
||||
if ( LuaGetParam( L, 3, sSonBeforeAfter)) {
|
||||
if ( lua_gettop( L) >= 3) {
|
||||
string sSonBeforeAfter ;
|
||||
LuaCheckParam( L, 3, sSonBeforeAfter) ;
|
||||
ToUpper( sSonBeforeAfter) ;
|
||||
if ( sSonBeforeAfter == "BEFORE")
|
||||
nSonBeforeAfter = GDB_BEFORE ;
|
||||
@@ -202,7 +245,7 @@ LuaRelocate( lua_State* L)
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rilocazione
|
||||
bool bOk = ( EgtRelocate( nSouId, nRefId, nSonBeforeAfter) ? true : false) ;
|
||||
bool bOk = ( EgtRelocate( nSouId, nRefId, nSonBeforeAfter) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -218,8 +261,9 @@ LuaRelocateGlob( lua_State* L)
|
||||
int nRefId ;
|
||||
LuaCheckParam( L, 2, nRefId)
|
||||
int nSonBeforeAfter = GDB_SON ;
|
||||
string sSonBeforeAfter ;
|
||||
if ( LuaGetParam( L, 3, sSonBeforeAfter)) {
|
||||
if ( lua_gettop( L) >= 3) {
|
||||
string sSonBeforeAfter ;
|
||||
LuaCheckParam( L, 3, sSonBeforeAfter) ;
|
||||
ToUpper( sSonBeforeAfter) ;
|
||||
if ( sSonBeforeAfter == "BEFORE")
|
||||
nSonBeforeAfter = GDB_BEFORE ;
|
||||
@@ -228,7 +272,7 @@ LuaRelocateGlob( lua_State* L)
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// eseguo la rilocazione
|
||||
bool bOk = ( EgtRelocateGlob( nSouId, nRefId, nSonBeforeAfter) ? true : false) ;
|
||||
bool bOk = ( EgtRelocateGlob( nSouId, nRefId, nSonBeforeAfter) != FALSE) ;
|
||||
// restituisco il risultato
|
||||
LuaSetReturn( L, bOk) ;
|
||||
return 1 ;
|
||||
@@ -244,7 +288,7 @@ LuaErase( lua_State* L)
|
||||
// eseguo la cancellazione
|
||||
bool bOk = true ;
|
||||
for ( size_t i = 0 ; i < vId.size() && bOk ; ++ i) {
|
||||
if ( ! EgtErase( vId[i]))
|
||||
if ( EgtErase( vId[i]) == FALSE)
|
||||
bOk = false ;
|
||||
}
|
||||
// restituisco il risultato
|
||||
@@ -263,6 +307,8 @@ LuaInstallGdbObjects( lua_State* L)
|
||||
lua_register( L, "EgtGetNext", LuaGetNext) ;
|
||||
lua_register( L, "EgtGetLastInGroup", LuaGetLastInGroup) ;
|
||||
lua_register( L, "EgtGetPrev", LuaGetPrev) ;
|
||||
lua_register( L, "EgtGetFirstNameInGroup", LuaGetFirstNameInGroup) ;
|
||||
lua_register( L, "EgtGetNextName", LuaGetNextName) ;
|
||||
lua_register( L, "EgtCopy", LuaCopy) ;
|
||||
lua_register( L, "EgtCopyGlob", LuaCopyGlob) ;
|
||||
lua_register( L, "EgtRelocate", LuaRelocate) ;
|
||||
|
||||
Reference in New Issue
Block a user