From a25ebcc07088d9f607db615467d9399e6e2ce497 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 11 Aug 2010 15:03:44 +0000 Subject: [PATCH] 2010-08-11 17:03 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/classes.c + extended error messages in __CLSINSTSUPER() function to show the name of super class which cannot be created * harbour/src/rtl/tclass.prg * force RTE for superclasses defined using function declared as DYNAMIC It should help in locating the problem in wrongly linked code, i.e. without some superclasses. --- harbour/ChangeLog | 10 ++++++++++ harbour/src/rtl/tclass.prg | 16 +++++++--------- harbour/src/vm/classes.c | 19 ++++++++++++++++++- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7b28fead36..39620d389f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-11 17:03 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/vm/classes.c + + extended error messages in __CLSINSTSUPER() function to show the name + of super class which cannot be created + + * harbour/src/rtl/tclass.prg + * force RTE for superclasses defined using function declared as DYNAMIC + It should help in locating the problem in wrongly linked code, i.e. + without some superclasses. + 2010-08-11 12:28 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/empty.c * modified EMPTY() function behavior so now for symbols diff --git a/harbour/src/rtl/tclass.prg b/harbour/src/rtl/tclass.prg index d14dc70092..cbd046a772 100644 --- a/harbour/src/rtl/tclass.prg +++ b/harbour/src/rtl/tclass.prg @@ -172,21 +172,19 @@ STATIC FUNCTION New( cClassName, xSuper, sClassFunc, lModuleFriendly ) DEFAULT lModuleFriendly TO .F. - IF Empty( xSuper ) + IF hb_isSymbol( xSuper ) + ::asSuper := { xSuper } + ELSEIF Empty( xSuper ) ::asSuper := {} ELSEIF ISCHARACTER( xSuper ) ::asSuper := { __DynsN2Sym( xSuper ) } - ELSEIF hb_isSymbol( xSuper ) - ::asSuper := { xSuper } ELSEIF ISARRAY( xSuper ) ::asSuper := {} FOR EACH i IN xSuper - IF ! Empty( i ) - IF ISCHARACTER( i ) - AAdd( ::asSuper, __DynsN2Sym( i ) ) - ELSEIF hb_isSymbol( i ) - AAdd( ::asSuper, i ) - ENDIF + IF hb_isSymbol( i ) + AAdd( ::asSuper, i ) + ELSEIF ISCHARACTER( i ) .AND. ! Empty( i ) + AAdd( ::asSuper, __DynsN2Sym( i ) ) ENDIF NEXT ENDIF diff --git a/harbour/src/vm/classes.c b/harbour/src/vm/classes.c index 50d3a1c2fd..1fec7440fa 100644 --- a/harbour/src/vm/classes.c +++ b/harbour/src/vm/classes.c @@ -3751,6 +3751,7 @@ HB_FUNC( __CLSINSTSUPER ) PHB_ITEM pItem = hb_param( 1, HB_IT_STRING | HB_IT_SYMBOL ); HB_USHORT uiClassH = 0, uiClass; PHB_SYMB pClassFuncSym = NULL; + char szDesc[ 128 ]; if( pItem ) { @@ -3809,12 +3810,28 @@ HB_FUNC( __CLSINSTSUPER ) if( uiClassH && HB_IS_OBJECT( pObject ) ) pObject->item.asArray.value->uiClass = 0; else if( hb_vmRequestQuery() == 0 ) + { + hb_snprintf( szDesc, sizeof( szDesc ), + "Super class '%s' does not return an object", + pClassFuncSym->szName ); hb_errRT_BASE( EG_ARG, 3002, "Super class does not return an object", HB_ERR_FUNCNAME, 0 ); + } } } } else - hb_errRT_BASE( EG_ARG, 3003, "Cannot find super class", HB_ERR_FUNCNAME, 0 ); + { + const char * pszName = NULL; + + pClassFuncSym = hb_itemGetSymbol( pItem ); + if( pClassFuncSym ) + pszName = pClassFuncSym->szName; + else + pszName = hb_itemGetCPtr( pItem ); + hb_snprintf( szDesc, sizeof( szDesc ), + "Cannot find super class '%s'", pszName ); + hb_errRT_BASE( EG_ARG, 3003, szDesc, HB_ERR_FUNCNAME, 0 ); + } hb_retni( uiClassH ); }