diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5ce465557f..6199aec547 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-15 00:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapicls.h + * harbour/src/vm/classes.c + + added new C function + HB_SIZE hb_clsGetVarIndex( HB_USHORT uiClass, PHB_DYNS pVarSym ); + which can be used as hack to speedup accessing some object instance + variables + 2011-02-15 00:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbide/idemain.prg + Minor to prev. Now possible to build hbide with RDDADS diff --git a/harbour/include/hbapicls.h b/harbour/include/hbapicls.h index 8b9720955d..882e13a353 100644 --- a/harbour/include/hbapicls.h +++ b/harbour/include/hbapicls.h @@ -116,6 +116,7 @@ extern HB_EXPORT const char * hb_clsFuncName( HB_USHORT uiClass ); extern HB_EXPORT const char * hb_clsMethodName( HB_USHORT uiClass, HB_USHORT uiMethod ); extern HB_EXPORT PHB_SYMB hb_clsFuncSym( HB_USHORT uiClass ); extern HB_EXPORT HB_BOOL hb_clsIsParent( HB_USHORT uiClass, const char * szParentName ); /* is a class handle inherited from szParentName Class ? */ +extern HB_EXPORT HB_SIZE hb_clsGetVarIndex( HB_USHORT uiClass, PHB_DYNS pVarSym ); extern HB_EXPORT HB_USHORT hb_clsFindClass( const char * szClass, const char * szFunc ); /* object management */ diff --git a/harbour/src/vm/classes.c b/harbour/src/vm/classes.c index 7b5090e953..db00c892dc 100644 --- a/harbour/src/vm/classes.c +++ b/harbour/src/vm/classes.c @@ -1404,6 +1404,26 @@ const char * hb_clsMethodName( HB_USHORT uiClass, HB_USHORT uiMethod ) return NULL; } +HB_SIZE hb_clsGetVarIndex( HB_USHORT uiClass, PHB_DYNS pVarSym ) +{ + if( uiClass && uiClass <= s_uiClasses ) + { + PMETHOD pMethod = hb_clsFindMsg( s_pClasses[ uiClass ], pVarSym ); + if( pMethod ) + { + PHB_SYMB pFuncSym = pMethod->pFuncSym; + + if( pFuncSym == &s___msgSync || pFuncSym == &s___msgSyncClass ) + pFuncSym = pMethod->pRealSym; + + if( pFuncSym->value.pFunPtr == HB_FUNCNAME( msgSetData ) || + pFuncSym->value.pFunPtr == HB_FUNCNAME( msgGetData ) ) + return pMethod->uiData + pMethod->uiOffset; + } + } + return 0; +} + HB_USHORT hb_clsFindClass( const char * szClass, const char * szFunc ) { HB_USHORT uiClass;