2001-11-28 22:45 GMT+1 JFL (mafact) <jfl@mafact.com>

This commit is contained in:
Jean-Francois Lefebvre
2001-11-28 22:19:14 +00:00
parent 072d061c2e
commit 7620d41c8b
3 changed files with 85 additions and 9 deletions

View File

@@ -1,3 +1,9 @@
2001-11-28 22:45 GMT+1 JFL (mafact) <jfl@mafact.com>
* harbour/source/vm/classes.c
* Now releasing Classes from the last one to check Bryan GPF
* harbour/include/hbclass.ch
* Changed a bit some PP define to avoid unusued var warning from mscv
2001-11-28 12:57 GMT-3 Horacio Roldan <harbour_ar@yahoo.com.ar>
* include/hbrddcdx.h
* source/rdd/dbfcdx/dbfcdx1.c

View File

@@ -150,6 +150,8 @@ DECLARE HBClass ;
#xtranslate CREATE CLASS => CLASS
#endif
#ifdef HB_CLS_ALLOWCLASS /* DONT DECLARE IT ! WORK IN PROGRESS !!! */
#ifndef HB_SHORTNAMES
#xtranslate DECLMETH <ClassName> <MethodName> => <ClassName>_<MethodName>
@@ -158,9 +160,13 @@ DECLARE HBClass ;
_HB_CLASS <ClassName> ;;
<static> function <ClassName>() ;;
static s_oClass ;;
local MetaClass,nScope := HB_OO_CLSTP_EXPORTED ;;
local MetaClass,nScope ;;
nScope := HB_OO_CLSTP_EXPORTED ;;
if s_oClass == NIL ;;
s_oClass := IIF(<.metaClass.>, <(metaClass)>, HBClass():new( <(ClassName)> , __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;;
s_oClass := IIF(<.metaClass.>, <(metaClass)>, HBClass():new( <(ClassName)> , __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;;
if ! <.metaClass.> ;;
Metaclass := HBClass():new( <(ClassName)>+" class", __HB_CLS_PAR0 ( [ <SuperClass1>():class ] [ ,<SuperClassN>():class ] ) ) ;;
endif ;;
#undef _CLASS_NAME_ ;;
#define _CLASS_NAME_ <ClassName> ;;
#undef _CLASS_MODE_ ;;
@@ -180,9 +186,64 @@ DECLARE HBClass ;
_HB_CLASS <ClassName> ;;
<static> function <ClassName>() ;;
static s_oClass ;;
local MetaClass,nScope := HB_OO_CLSTP_EXPORTED ;;
local MetaClass,nScope ;;
nScope := HB_OO_CLSTP_EXPORTED ;;
if s_oClass == NIL ;;
s_oClass := IIF(<.metaClass.>,<(metaClass)>, HBClass():new(<(ClassName)>, __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;;
s_oClass := IIF(<.metaClass.>, <(metaClass)>, HBClass():new( <(ClassName)> , __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;;
if ! <.metaClass.> ;;
Metaclass := HBClass():new( <(ClassName)>+" class", __HB_CLS_PAR0 ( [ <SuperClass1>():class ] [ ,<SuperClassN>():class ] ) ) ;;
endif ;;
#undef _CLASS_NAME_ ;;
#define _CLASS_NAME_ <ClassName> ;;
#undef _CLASS_MODE_ ;;
#define _CLASS_MODE_ _CLASS_DECLARATION_ ;;
#translate CLSMETH <ClassName> <MethodName>() => @<MethodName> ;
[ ; #translate Super( <SuperClassN> ) : => ::<SuperClassN>: ] ;
[ ; #translate Super( <SuperClass1> ) : => ::<SuperClass1>: ] ;
[ ; #translate Super() : => ::<SuperClass1>: ] ;
[ ; #translate Super : => ::<SuperClass1>: ] ;
[ ; #translate ::Super : => ::<SuperClass1>: ] ;
[ ; REQUEST <SuperClass1> ] [ ,<SuperClassN> ]
#endif /* HB_SHORTNAMES */
#else
#ifndef HB_SHORTNAMES
#xtranslate DECLMETH <ClassName> <MethodName> => <ClassName>_<MethodName>
#xcommand CLASS <ClassName> [METACLASS <metaClass>] [ <frm: FROM, INHERIT> <SuperClass1> [,<SuperClassN>] ] [<static: STATIC>] => ;
_HB_CLASS <ClassName> ;;
<static> function <ClassName>() ;;
static s_oClass ;;
local nScope ;;
nScope := HB_OO_CLSTP_EXPORTED ;;
if s_oClass == NIL ;;
s_oClass := IIF(<.metaClass.>, <(metaClass)>, HBClass():new( <(ClassName)> , __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;;
#undef _CLASS_NAME_ ;;
#define _CLASS_NAME_ <ClassName> ;;
#undef _CLASS_MODE_ ;;
#define _CLASS_MODE_ _CLASS_DECLARATION_ ;;
#xtranslate CLSMETH <ClassName> <MethodName> => @<ClassName>_<MethodName> ;;
#xtranslate DECLCLASS <ClassName> => ;;
[ ; #translate Super( <SuperClassN> ) : => ::<SuperClassN>: ] ;
[ ; #translate Super( <SuperClass1> ) : => ::<SuperClass1>: ] ;
[ ; #translate Super() : => ::<SuperClass1>: ] ;
[ ; #translate Super : => ::<SuperClass1>: ] ;
[ ; #translate ::Super : => ::<SuperClass1>: ] ;
[ ; REQUEST <SuperClass1> ] [ ,<SuperClassN> ]
#else
#xcommand CLASS <ClassName> [METACLASS <metaClass>] [ <frm: FROM, INHERIT> <SuperClass1> [,<SuperClassN>] ] [<static: STATIC>] => ;
_HB_CLASS <ClassName> ;;
<static> function <ClassName>() ;;
static s_oClass ;;
local nScope ;;
nScope := HB_OO_CLSTP_EXPORTED ;;
if s_oClass == NIL ;;
s_oClass := IIF(<.metaClass.>, <(metaClass)>, HBClass():new( <(ClassName)> , __HB_CLS_PAR ( [ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ) ;;
#undef _CLASS_NAME_ ;;
#define _CLASS_NAME_ <ClassName> ;;
#undef _CLASS_MODE_ ;;
@@ -198,14 +259,15 @@ DECLARE HBClass ;
#endif /* HB_SHORTNAMES */
/* Disable the message :Class */
#ifndef HB_CLS_ALLOWCLASS
/* CLASSY SYNTAX */
#IFDEF HB_CLS_CSY
#xtranslate :CLASS =>
#xtranslate :CLASS: => :
#endif
#endif
/* CLASSY SYNTAX */
#IFDEF HB_CLS_CSY
@@ -578,7 +640,7 @@ s_oClass:AddInline( <(op)>, {|Self, <cArg> | <Code> }, HBCLSCHOICE( <.export.>,
#ifdef HB_CLS_ALLOWCLASS
#xcommand ENDCLASS => ;;
s_oClass:Create(MetaClass) ;;
MetaClass:InitClass();;
MetaClass:InitClass() ;;
endif ;;
return s_oClass:Instance() AS CLASS _CLASS_NAME_ ;;
#undef _CLASS_MODE_ ;;

View File

@@ -341,12 +341,18 @@ static void hb_clsRelease( PCLASS pClass )
*/
void hb_clsReleaseAll( void )
{
USHORT uiClass;
SHORT uiClass;
HB_TRACE(HB_TR_DEBUG, ("hb_clsReleaseAll()"));
for( uiClass = 0; uiClass < s_uiClasses; uiClass++ )
hb_clsRelease( s_pClasses + uiClass );
/* for( uiClass = 0 ; uiClass < s_uiClasses ; uiClass++ ) */
/* hb_clsRelease( s_pClasses + uiClass ); */
uiClass = (SHORT) (s_uiClasses-1) ;
s_uiClasses = 0 ;
for( ; uiClass >= 0 ; uiClass-- )
hb_clsRelease( s_pClasses + uiClass );
if( s_pClasses )
hb_xfree( s_pClasses );
@@ -358,6 +364,7 @@ void hb_clsReleaseAll( void )
/* Mark all internal data as used so it will not be released by the
* garbage collector
*/
void hb_clsIsClassRef( void )
{
USHORT uiClass = s_uiClasses;
@@ -370,6 +377,7 @@ void hb_clsIsClassRef( void )
while( uiClass-- )
{
printf("isClassRef %i\n",uiClass );
if( pClass->pInlines )
hb_gcItemRef( pClass->pInlines );