From c429bee405fbed3a43918fba30d47c25bd944efe Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 29 Sep 2010 00:08:43 +0000 Subject: [PATCH] 2010-09-29 02:08 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapirdd.h * harbour/src/rdd/workarea.c + added new 5-th parameter with pointer to super table ID to _GETFUNCTABLE() function + added new C function hb_rddInheritEx() which allows to retrieve super RDD ID during registration. + added new C function: HB_BOOL hb_rddIsDerivedFrom( HB_USHORT uiRddID, HB_USHORT uiSupperRddID ); which returns HB_TRUE if one of uiRddID ancestors is uiSupperRddID * harbour/src/rdd/dbf1.c * harbour/src/rdd/delim1.c * harbour/src/rdd/sdf1.c * harbour/src/rdd/dbffpt/dbffpt1.c * harbour/src/rdd/dbfntx/dbfntx1.c * harbour/src/rdd/dbfnsx/dbfnsx1.c * harbour/src/rdd/dbfcdx/dbfcdx1.c * harbour/src/rdd/usrrdd/usrrdd.c * harbour/src/rdd/usrrdd/rdds/arrayrdd.prg * harbour/src/rdd/usrrdd/rdds/dbtcdx.prg * harbour/src/rdd/usrrdd/rdds/fptcdx.prg * harbour/src/rdd/usrrdd/rdds/hscdx.prg * harbour/src/rdd/usrrdd/rdds/vfpcdx.prg * harbour/src/rdd/usrrdd/rdds/logrdd.prg * harbour/src/rdd/usrrdd/rdds/rlcdx.prg * harbour/src/rdd/usrrdd/rdds/smtcdx.prg * harbour/contrib/rddbmcdx/bmdbfcdx.c * harbour/contrib/rddsql/sqlbase.c * harbour/contrib/rddsql/sqlmix.c * harbour/contrib/rddads/adsx.c * harbour/contrib/rddads/ads1.c * respect new parameter in _GETFUNCTABLE() and use hb_rddInheritEx() instead of hb_rddInherit() * harbour/contrib/rddads/ads1.c * use hb_rddIsDerivedFrom() to recognize RDDs which inherits from one of ADS* RDDs. It should resolve some problems with ADS*X RDDs and help to simplify ADS*X RDDs code. Please test it and update ADS*X code removing some code which is not longer necessary. --- harbour/ChangeLog | 44 +++++++++ harbour/contrib/rddads/ads1.c | 112 ++++++++++++----------- harbour/contrib/rddads/adsx.c | 13 ++- harbour/contrib/rddbmcdx/bmdbfcdx.c | 34 +++---- harbour/contrib/rddsql/sqlbase.c | 12 ++- harbour/contrib/rddsql/sqlmix.c | 13 ++- harbour/include/hbapirdd.h | 6 +- harbour/src/rdd/dbf1.c | 12 +-- harbour/src/rdd/dbfcdx/dbfcdx1.c | 34 +++---- harbour/src/rdd/dbffpt/dbffpt1.c | 13 +-- harbour/src/rdd/dbfnsx/dbfnsx1.c | 13 +-- harbour/src/rdd/dbfntx/dbfntx1.c | 15 +-- harbour/src/rdd/delim1.c | 12 +-- harbour/src/rdd/sdf1.c | 12 +-- harbour/src/rdd/usrrdd/rdds/arrayrdd.prg | 4 +- harbour/src/rdd/usrrdd/rdds/dbtcdx.prg | 4 +- harbour/src/rdd/usrrdd/rdds/fptcdx.prg | 4 +- harbour/src/rdd/usrrdd/rdds/hscdx.prg | 4 +- harbour/src/rdd/usrrdd/rdds/logrdd.prg | 4 +- harbour/src/rdd/usrrdd/rdds/rlcdx.prg | 4 +- harbour/src/rdd/usrrdd/rdds/smtcdx.prg | 4 +- harbour/src/rdd/usrrdd/rdds/vfpcdx.prg | 4 +- harbour/src/rdd/usrrdd/usrrdd.c | 5 +- harbour/src/rdd/workarea.c | 40 +++++++- 24 files changed, 259 insertions(+), 163 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f9f3666ac8..d10a537ffe 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,50 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-29 02:08 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapirdd.h + * harbour/src/rdd/workarea.c + + added new 5-th parameter with pointer to super table ID to + _GETFUNCTABLE() function + + added new C function hb_rddInheritEx() which allows to retrieve + super RDD ID during registration. + + added new C function: + HB_BOOL hb_rddIsDerivedFrom( HB_USHORT uiRddID, + HB_USHORT uiSupperRddID ); + which returns HB_TRUE if one of uiRddID ancestors is uiSupperRddID + + * harbour/src/rdd/dbf1.c + * harbour/src/rdd/delim1.c + * harbour/src/rdd/sdf1.c + * harbour/src/rdd/dbffpt/dbffpt1.c + * harbour/src/rdd/dbfntx/dbfntx1.c + * harbour/src/rdd/dbfnsx/dbfnsx1.c + * harbour/src/rdd/dbfcdx/dbfcdx1.c + * harbour/src/rdd/usrrdd/usrrdd.c + * harbour/src/rdd/usrrdd/rdds/arrayrdd.prg + * harbour/src/rdd/usrrdd/rdds/dbtcdx.prg + * harbour/src/rdd/usrrdd/rdds/fptcdx.prg + * harbour/src/rdd/usrrdd/rdds/hscdx.prg + * harbour/src/rdd/usrrdd/rdds/vfpcdx.prg + * harbour/src/rdd/usrrdd/rdds/logrdd.prg + * harbour/src/rdd/usrrdd/rdds/rlcdx.prg + * harbour/src/rdd/usrrdd/rdds/smtcdx.prg + * harbour/contrib/rddbmcdx/bmdbfcdx.c + * harbour/contrib/rddsql/sqlbase.c + * harbour/contrib/rddsql/sqlmix.c + * harbour/contrib/rddads/adsx.c + * harbour/contrib/rddads/ads1.c + * respect new parameter in _GETFUNCTABLE() and use + hb_rddInheritEx() instead of hb_rddInherit() + + * harbour/contrib/rddads/ads1.c + * use hb_rddIsDerivedFrom() to recognize RDDs which inherits from + one of ADS* RDDs. + It should resolve some problems with ADS*X RDDs and help to simplify + ADS*X RDDs code. + Please test it and update ADS*X code removing some code which is + not longer necessary. + 2010-09-28 16:58 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpbrowse.prg * contrib/hbxbp/xbptreeview.prg diff --git a/harbour/contrib/rddads/ads1.c b/harbour/contrib/rddads/ads1.c index ddf7546df0..2633fc97d2 100644 --- a/harbour/contrib/rddads/ads1.c +++ b/harbour/contrib/rddads/ads1.c @@ -270,8 +270,7 @@ static HB_BOOL adsIndexKeyCmp( ADSHANDLE hIndex, UNSIGNED8 * pszKey, UNSIGNED16 return HB_FALSE; } - -static int adsGetFileType( HB_USHORT uiRddID ) +static int adsGetRddType( HB_USHORT uiRddID ) { if( uiRddID == s_uiRddIdADSCDX ) return ADS_CDX; @@ -283,8 +282,30 @@ static int adsGetFileType( HB_USHORT uiRddID ) else if( uiRddID == s_uiRddIdADSVFP ) return ADS_VFP; #endif + else if( uiRddID == s_uiRddIdADS ) + return ADS_DEFAULT; - return hb_ads_iFileType; + else if( hb_rddIsDerivedFrom( uiRddID, s_uiRddIdADSCDX ) ) + return ADS_CDX; + else if( hb_rddIsDerivedFrom( uiRddID, s_uiRddIdADSNTX ) ) + return ADS_NTX; + else if( hb_rddIsDerivedFrom( uiRddID, s_uiRddIdADSADT ) ) + return ADS_ADT; +#if ADS_LIB_VERSION >= 900 + else if( hb_rddIsDerivedFrom( uiRddID, s_uiRddIdADSVFP ) ) + return ADS_VFP; +#endif + else if( hb_rddIsDerivedFrom( uiRddID, s_uiRddIdADS ) ) + return ADS_DEFAULT; + else + return -1; +} + +static int adsGetFileType( HB_USHORT uiRddID ) +{ + int iType = adsGetRddType( uiRddID ); + + return iType > 0 ? iType : hb_ads_iFileType; } static const char * adsTableExt( int iFileType ) @@ -296,8 +317,8 @@ static const char * adsMemoExt( int iFileType ) { switch( iFileType ) { - case ADS_ADT: return ".adm"; - case ADS_NTX: return ".dbt"; + case ADS_ADT: return ".adm"; + case ADS_NTX: return ".dbt"; } return ".fpt"; @@ -307,8 +328,8 @@ static const char * adsIndexExt( int iFileType ) { switch( iFileType ) { - case ADS_ADT: return ".adi"; - case ADS_NTX: return ".ntx"; + case ADS_ADT: return ".adi"; + case ADS_NTX: return ".ntx"; } return ".cdx"; @@ -3206,33 +3227,31 @@ static HB_ERRCODE adsNewArea( ADSAREAP pArea ) errCode = SUPER_NEW( ( AREAP ) pArea ); if( errCode == HB_SUCCESS ) { - if( pArea->area.rddID == s_uiRddIdADSADT ) + switch( adsGetRddType( pArea->area.rddID ) ) { - pArea->iFileType = ADS_ADT; - pArea->area.uiMaxFieldNameLength = ADS_MAX_FIELD_NAME; - } - else if( pArea->area.rddID == s_uiRddIdADSNTX ) - { - pArea->iFileType = ADS_NTX; - pArea->area.uiMaxFieldNameLength = ADS_MAX_DBF_FIELD_NAME; - } - else if( pArea->area.rddID == s_uiRddIdADSCDX ) - { - pArea->iFileType = ADS_CDX; - pArea->area.uiMaxFieldNameLength = ADS_MAX_DBF_FIELD_NAME; - } + case ADS_NTX: + pArea->iFileType = ADS_NTX; + pArea->area.uiMaxFieldNameLength = ADS_MAX_DBF_FIELD_NAME; + break; + case ADS_CDX: + pArea->iFileType = ADS_CDX; + pArea->area.uiMaxFieldNameLength = ADS_MAX_DBF_FIELD_NAME; + break; + case ADS_ADT: + pArea->iFileType = ADS_ADT; + pArea->area.uiMaxFieldNameLength = ADS_MAX_FIELD_NAME; + break; #if ADS_LIB_VERSION >= 900 - else if( pArea->area.rddID == s_uiRddIdADSVFP ) - { - pArea->iFileType = ADS_VFP; - pArea->area.uiMaxFieldNameLength = ADS_MAX_DBF_FIELD_NAME; - } + case ADS_VFP: + pArea->iFileType = ADS_VFP; + pArea->area.uiMaxFieldNameLength = ADS_MAX_DBF_FIELD_NAME; + break; #endif - else /* if( pArea->rddID == s_uiRddIdADS ) */ - { - pArea->iFileType = hb_ads_iFileType; - pArea->area.uiMaxFieldNameLength = ( pArea->iFileType == ADS_ADT ) ? - ADS_MAX_FIELD_NAME : ADS_MAX_DBF_FIELD_NAME; + default: /* ADS_DEFAULT */ + pArea->iFileType = hb_ads_iFileType; + pArea->area.uiMaxFieldNameLength = ( pArea->iFileType == ADS_ADT ) ? + ADS_MAX_FIELD_NAME : ADS_MAX_DBF_FIELD_NAME; + break; } } return errCode; @@ -3712,19 +3731,11 @@ static HB_ERRCODE adsSetRel( ADSAREAP pArea, LPDBRELINFO lpdbRelations ) { UNSIGNED32 u32RetVal = ( UNSIGNED32 ) ~AE_SUCCESS; UNSIGNED8 *szExp; - HB_USHORT rddID; HB_TRACE(HB_TR_DEBUG, ("adsSetRel(%p, %p)", pArea, lpdbRelations)); szExp = ( UNSIGNED8 * ) hb_itemGetCPtr( lpdbRelations->abKey ); - rddID = lpdbRelations->lpaChild->rddID; - if( *szExp && ( rddID == s_uiRddIdADS || - rddID == s_uiRddIdADSADT || -#if ADS_LIB_VERSION >= 900 - rddID == s_uiRddIdADSVFP || -#endif - rddID == s_uiRddIdADSNTX || - rddID == s_uiRddIdADSCDX ) ) + if( *szExp && adsGetRddType( lpdbRelations->lpaChild->rddID ) >= 0 ) { ADSHANDLE hIndex = ( ( ADSAREAP ) lpdbRelations->lpaChild )->hOrdCurrent; @@ -5154,19 +5165,20 @@ static const RDDFUNCS adsTable = { ( DBENTRYP_BP ) adsBof, static void adsRegisterRDD( HB_USHORT * pusRddId ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, * puiSuperRddId, uiRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = ( HB_USHORT ) hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &adsTable, &adsSuper, NULL ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &adsTable, &adsSuper, NULL, puiSuperRddId ); if( errCode == HB_SUCCESS ) { /* @@ -5289,15 +5301,7 @@ ADSAREAP hb_adsGetWorkAreaPointer( void ) if( pArea ) { - HB_USHORT rddID = pArea->area.rddID; - - if( rddID == s_uiRddIdADS || - rddID == s_uiRddIdADSADT || -#if ADS_LIB_VERSION >= 900 - rddID == s_uiRddIdADSVFP || -#endif - rddID == s_uiRddIdADSNTX || - rddID == s_uiRddIdADSCDX ) + if( adsGetRddType( pArea->area.rddID ) >= 0 ) return pArea; } return NULL; diff --git a/harbour/contrib/rddads/adsx.c b/harbour/contrib/rddads/adsx.c index 74a223f783..b92c4ffdee 100644 --- a/harbour/contrib/rddads/adsx.c +++ b/harbour/contrib/rddads/adsx.c @@ -1475,18 +1475,21 @@ static RDDFUNCS adsxTable = { NULL, static void adsxRegisterRDD( HB_USHORT * pusRddId, const char * szRddName ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, * puiSuperRddId, uiRddId; - uiCount = ( HB_USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) ); - * uiCount = RDDFUNCSCOUNT; - pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); + pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = ( HB_USHORT ) hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); if( pTable ) { HB_ERRCODE errCode; - errCode = hb_rddInherit( pTable, &adsxTable, &adsxSuper, szRddName ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + + errCode = hb_rddInheritEx( pTable, &adsxTable, &adsxSuper, szRddName, puiSuperRddId ); if( errCode == HB_SUCCESS ) { *pusRddId = uiRddId; diff --git a/harbour/contrib/rddbmcdx/bmdbfcdx.c b/harbour/contrib/rddbmcdx/bmdbfcdx.c index 232d32896a..4f0ed6d178 100644 --- a/harbour/contrib/rddbmcdx/bmdbfcdx.c +++ b/harbour/contrib/rddbmcdx/bmdbfcdx.c @@ -10464,24 +10464,25 @@ HB_FUNC( BMSIXCDX ) {;} HB_FUNC( BMSIXCDX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount; + HB_USHORT * puiCount, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); - HB_TRACE(HB_TR_DEBUG, ("BMSIXCDX_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("BMSIXCDX_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFFPT" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFFPT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFDBT" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFDBT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBF", puiSuperRddId ); hb_retni( errCode ); } else @@ -10517,24 +10518,25 @@ HB_FUNC( BMDBFCDX ) {;} HB_FUNC( BMDBFCDX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount; + HB_USHORT * puiCount, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); - HB_TRACE(HB_TR_DEBUG, ("BMDBFCDX_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("BMDBFCDX_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFFPT" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFFPT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFDBT" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFDBT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBF", puiSuperRddId ); hb_retni( errCode ); } else diff --git a/harbour/contrib/rddsql/sqlbase.c b/harbour/contrib/rddsql/sqlbase.c index 673a659122..9cb5fad543 100644 --- a/harbour/contrib/rddsql/sqlbase.c +++ b/harbour/contrib/rddsql/sqlbase.c @@ -1236,18 +1236,20 @@ HB_FUNC( SQLBASE ) {;} HB_FUNC( SQLBASE_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId; - uiCount = ( HB_USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) ); - * uiCount = RDDFUNCSCOUNT; - pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); + pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = ( HB_USHORT ) hb_parni( 4 ); if ( pTable ) { HB_ERRCODE errCode; - errCode = hb_rddInherit( pTable, &sqlbaseTable, &sqlbaseSuper, 0 ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + + errCode = hb_rddInheritEx( pTable, &sqlbaseTable, &sqlbaseSuper, NULL, NULL ); if ( errCode == HB_SUCCESS ) { s_rddidSQLBASE = uiRddId; diff --git a/harbour/contrib/rddsql/sqlmix.c b/harbour/contrib/rddsql/sqlmix.c index c38d0db8f0..630ff3b3ae 100644 --- a/harbour/contrib/rddsql/sqlmix.c +++ b/harbour/contrib/rddsql/sqlmix.c @@ -2173,18 +2173,21 @@ static RDDFUNCS sqlmixTable = HB_FUNC( SQLMIX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, * puiSuperRddId, uiRddId; - uiCount = ( HB_USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) ); - * uiCount = RDDFUNCSCOUNT; - pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); + pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = ( HB_USHORT ) hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); if ( pTable ) { HB_ERRCODE errCode; - errCode = hb_rddInherit( pTable, &sqlmixTable, &sqlmixSuper, "SQLBASE" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + + errCode = hb_rddInheritEx( pTable, &sqlmixTable, &sqlmixSuper, "SQLBASE", puiSuperRddId ); if ( errCode == HB_SUCCESS ) { s_uiRddIdSQLMIX = uiRddId; diff --git a/harbour/include/hbapirdd.h b/harbour/include/hbapirdd.h index 793bbeb273..1bf5d54ba6 100644 --- a/harbour/include/hbapirdd.h +++ b/harbour/include/hbapirdd.h @@ -797,10 +797,10 @@ typedef RDDFUNCS * PRDDFUNCS; typedef struct _RDDNODE { char szName[ HB_RDD_MAX_DRIVERNAME_LEN + 1 ]; /* Name of RDD */ - HB_USHORT rddID; /* RDD id */ + HB_USHORT rddID; /* RDD ID */ HB_USHORT uiType; /* Type of RDD */ HB_USHORT uiAreaSize; /* Size of the WorkArea */ - HB_USHORT unused; /* filler */ + HB_USHORT rddSuperID; /* ancestor RDD ID */ RDDFUNCS pTable; /* Table of functions */ RDDFUNCS pSuperTable; /* Table of super functions */ void *lpvCargo; /* RDD specific extended data, if used then @@ -1176,6 +1176,8 @@ extern HB_EXPORT void hb_rddReleaseCurrentArea( void ); extern HB_EXPORT int hb_rddRegister( const char * szDriver, HB_USHORT uiType ); extern HB_EXPORT HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNCS * pSuperTable, const char * szDrvName ); +extern HB_EXPORT HB_ERRCODE hb_rddInheritEx( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNCS * pSuperTable, const char * szDrvName, HB_USHORT * puiSuperRddId ); +extern HB_EXPORT HB_BOOL hb_rddIsDerivedFrom( HB_USHORT uiRddID, HB_USHORT uiSupperRddID ); extern HB_EXPORT LPRDDNODE hb_rddGetNode( HB_USHORT uiNode ); extern HB_EXPORT LPRDDNODE hb_rddFindNode( const char * szDriver, HB_USHORT * uiIndex ); extern HB_EXPORT HB_USHORT hb_rddFieldIndex( AREAP pArea, const char * szName ); diff --git a/harbour/src/rdd/dbf1.c b/harbour/src/rdd/dbf1.c index 3fe1462106..edbcec43ac 100644 --- a/harbour/src/rdd/dbf1.c +++ b/harbour/src/rdd/dbf1.c @@ -5776,21 +5776,21 @@ HB_FUNC( _DBF ) { ; } HB_FUNC( DBF_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = ( HB_USHORT ) hb_parni( 4 ); - HB_TRACE(HB_TR_DEBUG, ("DBF_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("DBF_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &dbfTable, &dbfSuper, NULL ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &dbfTable, &dbfSuper, NULL, NULL ); hb_retni( errCode ); if( errCode == HB_SUCCESS ) { diff --git a/harbour/src/rdd/dbfcdx/dbfcdx1.c b/harbour/src/rdd/dbfcdx/dbfcdx1.c index a116e6a537..f782ffe7bc 100644 --- a/harbour/src/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/src/rdd/dbfcdx/dbfcdx1.c @@ -9827,25 +9827,26 @@ HB_FUNC( SIXCDX ) {;} HB_FUNC( SIXCDX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); - HB_TRACE(HB_TR_DEBUG, ("SIXCDX_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("SIXCDX_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFFPT" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFFPT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFDBT" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFDBT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBF", puiSuperRddId ); hb_retni( errCode ); if( errCode == HB_SUCCESS ) { @@ -9902,25 +9903,26 @@ HB_FUNC( DBFCDX ) {;} HB_FUNC( DBFCDX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); - HB_TRACE(HB_TR_DEBUG, ("DBFCDX_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("DBFCDX_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFFPT" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFFPT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBFDBT" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBFDBT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &cdxTable, &cdxSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &cdxTable, &cdxSuper, "DBF", puiSuperRddId ); if( errCode == HB_SUCCESS ) { /* diff --git a/harbour/src/rdd/dbffpt/dbffpt1.c b/harbour/src/rdd/dbffpt/dbffpt1.c index fc81af50dc..26f2566c68 100644 --- a/harbour/src/rdd/dbffpt/dbffpt1.c +++ b/harbour/src/rdd/dbffpt/dbffpt1.c @@ -5283,11 +5283,12 @@ HB_FUNC( DBFBLOB ) {;} static void hb_dbffptRegisterRDD( HB_USHORT * pusRddId ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); - uiRddId = hb_parni( 4 ); + uiRddId = ( HB_USHORT ) hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); HB_TRACE(HB_TR_DEBUG, ("DBFFPT_GETFUNCTABLE(%p, %p)", uiCount, pTable)); @@ -5295,10 +5296,10 @@ static void hb_dbffptRegisterRDD( HB_USHORT * pusRddId ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &fptTable, &fptSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &fptTable, &fptSuper, "DBF", puiSuperRddId ); if( errCode == HB_SUCCESS ) *pusRddId = uiRddId; hb_retni( errCode ); diff --git a/harbour/src/rdd/dbfnsx/dbfnsx1.c b/harbour/src/rdd/dbfnsx/dbfnsx1.c index ab17076326..36bedeb8d9 100644 --- a/harbour/src/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/src/rdd/dbfnsx/dbfnsx1.c @@ -8164,21 +8164,22 @@ HB_FUNC( DBFNSX ) {;} HB_FUNC( DBFNSX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &nsxTable, &nsxSuper, "DBFFPT" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &nsxTable, &nsxSuper, "DBFFPT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &nsxTable, &nsxSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &nsxTable, &nsxSuper, "DBF", puiSuperRddId ); if( errCode == HB_SUCCESS ) { /* diff --git a/harbour/src/rdd/dbfntx/dbfntx1.c b/harbour/src/rdd/dbfntx/dbfntx1.c index ac61fa957b..c391281a8f 100644 --- a/harbour/src/rdd/dbfntx/dbfntx1.c +++ b/harbour/src/rdd/dbfntx/dbfntx1.c @@ -7844,23 +7844,24 @@ HB_FUNC( DBFNTX ) {;} HB_FUNC( DBFNTX_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount, uiRddId; + HB_USHORT * puiCount, uiRddId, * puiSuperRddId; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); uiRddId = hb_parni( 4 ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 5 ); if( pTable ) { HB_ERRCODE errCode; - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - errCode = hb_rddInherit( pTable, &ntxTable, &ntxSuper, "DBFFPT" ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + errCode = hb_rddInheritEx( pTable, &ntxTable, &ntxSuper, "DBFFPT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &ntxTable, &ntxSuper, "DBFDBT" ); + errCode = hb_rddInheritEx( pTable, &ntxTable, &ntxSuper, "DBFDBT", puiSuperRddId ); if( errCode != HB_SUCCESS ) - errCode = hb_rddInherit( pTable, &ntxTable, &ntxSuper, "DBF" ); + errCode = hb_rddInheritEx( pTable, &ntxTable, &ntxSuper, "DBF", puiSuperRddId ); if( errCode == HB_SUCCESS ) { /* diff --git a/harbour/src/rdd/delim1.c b/harbour/src/rdd/delim1.c index 4bb8599d3c..a3c803eda0 100644 --- a/harbour/src/rdd/delim1.c +++ b/harbour/src/rdd/delim1.c @@ -1569,18 +1569,18 @@ HB_FUNC( DELIM ) { ; } HB_FUNC( DELIM_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount; + HB_USHORT * puiCount; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); - HB_TRACE(HB_TR_DEBUG, ("DELIM_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("DELIM_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - hb_retni( hb_rddInherit( pTable, &delimTable, &delimSuper, NULL ) ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + hb_retni( hb_rddInheritEx( pTable, &delimTable, &delimSuper, NULL, NULL ) ); } else hb_retni( HB_FAILURE ); diff --git a/harbour/src/rdd/sdf1.c b/harbour/src/rdd/sdf1.c index 7f3d79c860..ef099a5ca2 100644 --- a/harbour/src/rdd/sdf1.c +++ b/harbour/src/rdd/sdf1.c @@ -1304,18 +1304,18 @@ HB_FUNC( SDF ) { ; } HB_FUNC( SDF_GETFUNCTABLE ) { RDDFUNCS * pTable; - HB_USHORT * uiCount; + HB_USHORT * puiCount; - uiCount = ( HB_USHORT * ) hb_parptr( 1 ); + puiCount = ( HB_USHORT * ) hb_parptr( 1 ); pTable = ( RDDFUNCS * ) hb_parptr( 2 ); - HB_TRACE(HB_TR_DEBUG, ("SDF_GETFUNCTABLE(%p, %p)", uiCount, pTable)); + HB_TRACE(HB_TR_DEBUG, ("SDF_GETFUNCTABLE(%p, %p)", puiCount, pTable)); if( pTable ) { - if( uiCount ) - * uiCount = RDDFUNCSCOUNT; - hb_retni( hb_rddInherit( pTable, &sdfTable, &sdfSuper, NULL ) ); + if( puiCount ) + * puiCount = RDDFUNCSCOUNT; + hb_retni( hb_rddInheritEx( pTable, &sdfTable, &sdfSuper, NULL, NULL ) ); } else hb_retni( HB_FAILURE ); diff --git a/harbour/src/rdd/usrrdd/rdds/arrayrdd.prg b/harbour/src/rdd/usrrdd/rdds/arrayrdd.prg index 1e60333761..f2c29c3ed8 100644 --- a/harbour/src/rdd/usrrdd/rdds/arrayrdd.prg +++ b/harbour/src/rdd/usrrdd/rdds/arrayrdd.prg @@ -940,7 +940,7 @@ STATIC FUNCTION AR_DUMMY() * This function have to exist in all RDD and then name have to be in * format: _GETFUNCTABLE */ -FUNCTION ARRAYRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION ARRAYRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) LOCAL cSuperRDD := NIL /* NO SUPER RDD */ LOCAL aMyFunc[ UR_METHODCOUNT ] @@ -971,7 +971,7 @@ FUNCTION ARRAYRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) aMyFunc[ UR_ORDINFO ] := ( @AR_ORDINFO() ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - cSuperRDD, aMyFunc ) + cSuperRDD, aMyFunc, pSuperRddID ) INIT PROCEDURE ARRAYRDD_INIT() rddRegister( "ARRAYRDD", RDT_FULL ) diff --git a/harbour/src/rdd/usrrdd/rdds/dbtcdx.prg b/harbour/src/rdd/usrrdd/rdds/dbtcdx.prg index 5d99720bf3..b5c31ef128 100644 --- a/harbour/src/rdd/usrrdd/rdds/dbtcdx.prg +++ b/harbour/src/rdd/usrrdd/rdds/dbtcdx.prg @@ -67,9 +67,9 @@ REQUEST DBFFPT /* Announce our RDD for foreign REQUESTs */ ANNOUNCE DBTCDX -FUNCTION DBTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION DBTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - "DBFCDX", {} ) /* We are inheriting from DBFCDX */ + "DBFCDX", {}, pSuperRddID ) /* We are inheriting from DBFCDX */ INIT PROCEDURE DBTCDX_INIT() rddRegister( "DBTCDX", RDT_FULL ) diff --git a/harbour/src/rdd/usrrdd/rdds/fptcdx.prg b/harbour/src/rdd/usrrdd/rdds/fptcdx.prg index f6319491be..7b32ae199d 100644 --- a/harbour/src/rdd/usrrdd/rdds/fptcdx.prg +++ b/harbour/src/rdd/usrrdd/rdds/fptcdx.prg @@ -67,9 +67,9 @@ REQUEST DBFFPT /* Announce our RDD for forign REQUESTs */ ANNOUNCE FPTCDX -FUNCTION FPTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION FPTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - "DBFCDX", {} ) /* We are inheriting from DBFCDX */ + "DBFCDX", {}, pSuperRddID ) /* We are inheriting from DBFCDX */ INIT PROCEDURE FPTCDX_INIT() rddRegister( "FPTCDX", RDT_FULL ) diff --git a/harbour/src/rdd/usrrdd/rdds/hscdx.prg b/harbour/src/rdd/usrrdd/rdds/hscdx.prg index efd46d0239..88c1b9ca86 100644 --- a/harbour/src/rdd/usrrdd/rdds/hscdx.prg +++ b/harbour/src/rdd/usrrdd/rdds/hscdx.prg @@ -251,7 +251,7 @@ REQUEST DBFCDX * This function have to exist in all RDD and then name have to be in * format: _GETFUNCTABLE */ -FUNCTION HSCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION HSCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) LOCAL cSuperRDD := "DBFCDX" /* We are inheriting from DBFCDX */ LOCAL aMyFunc[ UR_METHODCOUNT ] @@ -262,7 +262,7 @@ FUNCTION HSCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) aMyFunc[ UR_APPEND ] := ( @_HSX_APPEND() ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - cSuperRDD, aMyFunc ) + cSuperRDD, aMyFunc, pSuperRddID ) /* * Register our HSCDX at program startup diff --git a/harbour/src/rdd/usrrdd/rdds/logrdd.prg b/harbour/src/rdd/usrrdd/rdds/logrdd.prg index b5c4f57b82..33ba225f0b 100644 --- a/harbour/src/rdd/usrrdd/rdds/logrdd.prg +++ b/harbour/src/rdd/usrrdd/rdds/logrdd.prg @@ -182,7 +182,7 @@ REQUEST DBFCDX * This function have to exist in all RDD and then name have to be in * format: _GETFUNCTABLE */ -FUNCTION LOGRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION LOGRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) LOCAL cSuperRDD := hb_LogRddInherit() /* We are inheriting from a User Defined RDD */ LOCAL aMyFunc[ UR_METHODCOUNT ] @@ -199,7 +199,7 @@ FUNCTION LOGRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) aMyFunc[ UR_ZAP ] := ( @LOGRDD_ZAP() ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - cSuperRDD, aMyFunc ) + cSuperRDD, aMyFunc, pSuperRddID ) INIT PROCEDURE _LOGRDD_INIT() rddRegister( "LOGRDD", RDT_FULL ) diff --git a/harbour/src/rdd/usrrdd/rdds/rlcdx.prg b/harbour/src/rdd/usrrdd/rdds/rlcdx.prg index 25cde1a239..fd84b930b8 100644 --- a/harbour/src/rdd/usrrdd/rdds/rlcdx.prg +++ b/harbour/src/rdd/usrrdd/rdds/rlcdx.prg @@ -207,7 +207,7 @@ REQUEST DBFCDX * This function have to exist in all RDD and then name have to be in * format: _GETFUNCTABLE */ -FUNCTION RLCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION RLCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) LOCAL cSuperRDD := "DBFCDX" /* We are inheriting from DBFCDX */ LOCAL aMethods[ UR_METHODCOUNT ] @@ -218,7 +218,7 @@ FUNCTION RLCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) aMethods[ UR_APPEND ] := ( @RLCDX_APPEND() ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - cSuperRDD, aMethods ) + cSuperRDD, aMethods, pSuperRddID ) INIT PROCEDURE RLCDX_INIT() rddRegister( "RLCDX", RDT_FULL ) diff --git a/harbour/src/rdd/usrrdd/rdds/smtcdx.prg b/harbour/src/rdd/usrrdd/rdds/smtcdx.prg index 014acb73e7..e0ea23a651 100644 --- a/harbour/src/rdd/usrrdd/rdds/smtcdx.prg +++ b/harbour/src/rdd/usrrdd/rdds/smtcdx.prg @@ -67,9 +67,9 @@ REQUEST DBFFPT /* Announce our RDD for forign REQUESTs */ ANNOUNCE SMTCDX -FUNCTION SMTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION SMTCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, ; - "DBFCDX", {} ) /* We are inheriting from DBFCDX */ + "DBFCDX", {}, pSuperRddID ) /* We are inheriting from DBFCDX */ INIT PROCEDURE SMTCDX_INIT() rddRegister( "SMTCDX", RDT_FULL ) diff --git a/harbour/src/rdd/usrrdd/rdds/vfpcdx.prg b/harbour/src/rdd/usrrdd/rdds/vfpcdx.prg index 8834680a58..3371c6da0e 100644 --- a/harbour/src/rdd/usrrdd/rdds/vfpcdx.prg +++ b/harbour/src/rdd/usrrdd/rdds/vfpcdx.prg @@ -60,9 +60,9 @@ REQUEST DBFFPT ANNOUNCE VFPCDX -FUNCTION VFPCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID ) +FUNCTION VFPCDX_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, pSuperRddID ) /* We are inheriting from DBFCDX */ - RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, "DBFCDX", {} ) + RETURN USRRDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID, "DBFCDX", {}, pSuperRddID ) INIT PROCEDURE VFPCDX_INIT() diff --git a/harbour/src/rdd/usrrdd/usrrdd.c b/harbour/src/rdd/usrrdd/usrrdd.c index 5654b183c1..5ceaa49f5a 100644 --- a/harbour/src/rdd/usrrdd/usrrdd.c +++ b/harbour/src/rdd/usrrdd/usrrdd.c @@ -2857,7 +2857,7 @@ static const HB_RDD_FUNCTABLE rddFuncTable = HB_FUNC( USRRDD_GETFUNCTABLE ) { RDDFUNCS * pSelfTable, * pSuperTable; - HB_USHORT * puiCount, uiCount, uiSize; + HB_USHORT * puiCount, * puiSuperRddId, uiCount, uiSize; HB_ERRCODE uiResult; const char * szSuperRDD; PHB_ITEM pMethods; @@ -2870,6 +2870,7 @@ HB_FUNC( USRRDD_GETFUNCTABLE ) /* uiRddID = hb_parni( 4 ); */ szSuperRDD = hb_parc( 5 ); pMethods = hb_param( 6, HB_IT_ARRAY ); + puiSuperRddId = ( HB_USHORT * ) hb_parptr( 7 ); if( puiCount && pSelfTable && pSuperTable && pMethods ) { @@ -2896,7 +2897,7 @@ HB_FUNC( USRRDD_GETFUNCTABLE ) ++pRddFunction; ++pFunction; } - uiResult = hb_rddInherit( pSelfTable, &funcTable.funcTable, pSuperTable, szSuperRDD ); + uiResult = hb_rddInheritEx( pSelfTable, &funcTable.funcTable, pSuperTable, szSuperRDD, puiSuperRddId ); if( uiResult == HB_SUCCESS ) { pSelfTable->whoCares = ( DBENTRYP_SVP ) hb_itemNew( pMethods ); diff --git a/harbour/src/rdd/workarea.c b/harbour/src/rdd/workarea.c index 926099ea57..0d62230541 100644 --- a/harbour/src/rdd/workarea.c +++ b/harbour/src/rdd/workarea.c @@ -2123,7 +2123,7 @@ int hb_rddRegister( const char * szDriver, HB_USHORT uiType ) LPRDDNODE pRddNewNode; PHB_DYNS pGetFuncTable; char szGetFuncTable[ HB_RDD_MAX_DRIVERNAME_LEN + 14 ]; - HB_USHORT uiFunctions; + HB_USHORT uiFunctions = 0; int iResult; HB_TRACE(HB_TR_DEBUG, ("hb_rddRegister(%s, %hu)", szDriver, uiType)); @@ -2145,6 +2145,7 @@ int hb_rddRegister( const char * szDriver, HB_USHORT uiType ) hb_strncpy( pRddNewNode->szName, szDriver, sizeof( pRddNewNode->szName ) - 1 ); pRddNewNode->uiType = uiType; pRddNewNode->rddID = s_uiRddCount; + pRddNewNode->rddSuperID = ( HB_USHORT ) ( -1 ); /* Call _GETFUNCTABLE() */ hb_vmPushDynSym( pGetFuncTable ); @@ -2153,8 +2154,9 @@ int hb_rddRegister( const char * szDriver, HB_USHORT uiType ) hb_vmPushPointer( ( void * ) &pRddNewNode->pTable ); hb_vmPushPointer( ( void * ) &pRddNewNode->pSuperTable ); hb_vmPushInteger( s_uiRddCount ); - hb_vmProc( 4 ); - if( hb_parni( -1 ) != HB_SUCCESS ) + hb_vmPushPointer( ( void * ) &pRddNewNode->rddSuperID ); + hb_vmProc( 5 ); + if( hb_parnidef( -1, HB_FAILURE ) != HB_SUCCESS ) iResult = 3; /* Invalid FUNCTABLE */ else { @@ -2193,13 +2195,15 @@ int hb_rddRegister( const char * szDriver, HB_USHORT uiType ) * pSuperTable - a current table in a RDDNODE * szDrvName - a driver name that will be inherited */ -HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNCS * pSuperTable, const char * szDrvName ) +HB_ERRCODE hb_rddInheritEx( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, + RDDFUNCS * pSuperTable, const char * szDrvName, + HB_USHORT * puiSupperRddId ) { LPRDDNODE pRddNode; HB_USHORT uiCount; DBENTRYP_V * pFunction, * pSubFunction; - HB_TRACE(HB_TR_DEBUG, ("hb_rddInherit(%p, %p, %p, %s)", pTable, pSubTable, pSuperTable, szDrvName)); + HB_TRACE(HB_TR_DEBUG, ("hb_rddInheritEx(%p, %p, %p, %s, %p)", pTable, pSubTable, pSuperTable, szDrvName, puiSupperRddId)); if( !pTable ) { @@ -2212,6 +2216,8 @@ HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNC /* no name for inherited driver - use the default one */ memcpy( pTable, &waTable, sizeof( RDDFUNCS ) ); memcpy( pSuperTable, &waTable, sizeof( RDDFUNCS ) ); + if( puiSupperRddId ) + * puiSupperRddId = ( HB_USHORT ) -1; } else { @@ -2224,6 +2230,8 @@ HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNC memcpy( pTable, &pRddNode->pTable, sizeof( RDDFUNCS ) ); memcpy( pSuperTable, &pRddNode->pTable, sizeof( RDDFUNCS ) ); + if( puiSupperRddId ) + * puiSupperRddId = pRddNode->rddID; } /* Copy the non NULL entries from pSubTable into pTable */ @@ -2239,6 +2247,28 @@ HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, RDDFUNC return HB_SUCCESS; } +HB_ERRCODE hb_rddInherit( RDDFUNCS * pTable, const RDDFUNCS * pSubTable, + RDDFUNCS * pSuperTable, const char * szDrvName ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_rddInherit(%p, %p, %p, %s)", pTable, pSubTable, pSuperTable, szDrvName)); + + return hb_rddInheritEx( pTable, pSubTable, pSuperTable, szDrvName, NULL ); +} + +HB_BOOL hb_rddIsDerivedFrom( HB_USHORT uiRddID, HB_USHORT uiSupperRddID ) +{ + if( uiRddID == uiSupperRddID ) + return HB_TRUE; + + while( uiRddID < s_uiRddCount ) + { + uiRddID = s_RddList[ uiRddID ]->rddSuperID; + if( uiRddID == uiSupperRddID ) + return HB_TRUE; + } + return HB_FALSE; +} + /* extend the size of RDD nodes buffer to given value to avoid later * RT reallocations. It may be useful in some very seldom cases * for MT programs which will register dynamically at runtime