From e8a06795f8e4442469282d24e970fb1837a50637 Mon Sep 17 00:00:00 2001 From: Eddie Runia Date: Mon, 31 May 1999 20:47:49 +0000 Subject: [PATCH] see changelog --- harbour/ChangeLog | 6 ++++++ harbour/source/rtl/classes.c | 13 ++++++------- harbour/tests/working/inherit.prg | 20 +++++++++----------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 336c78d294..50914b4ae3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +19990531-09:45 CET Eddie Runia + * tests/working/inherit.prg + newer test program. reported crash was due to static functions ? + * source/rtl/classes.c + some small improvements + 19990531-16:35 CET Matthew Hamilton (upload by Eddie Runia) * tests/working/inifiles.prg version 2 which creates harbour.new diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index fd7618f8c1..52d3135445 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -68,10 +68,12 @@ HARBOUR CLASSCREATE() /* cClassName, nDatas, hSuper --> hClass */ pClasses[ wClasses ].wDataFirst = pClasses[ hSuper ].wDatas; pClasses[ wClasses ].wDatas = pClasses[ hSuper ].wDatas + _parni(2); pClasses[ wClasses ].wMethods = pClasses[ hSuper ].wMethods; + pClasses[ wClasses ].pClassDatas = hb_arrayClone( pClasses[ hSuper ].pClassDatas ); pClasses[ wClasses ].pInlines = hb_arrayClone( pClasses[ hSuper ].pInlines ); + pClasses[ wClasses ].wHashKey = pClasses[ hSuper ].wHashKey; pClasses[ wClasses ].pMethods = ( PMETHOD ) _xgrab( pClasses[ hSuper ].wHashKey * BUCKET * sizeof( METHOD ) ); @@ -86,13 +88,10 @@ HARBOUR CLASSCREATE() /* cClassName, nDatas, hSuper --> hClass */ pClasses[ wClasses ].pMethods = ( PMETHOD ) _xgrab( 100 * sizeof( METHOD ) ); pClasses[ wClasses ].wMethods = 0; pClasses[ wClasses ].wHashKey = 25; /* BUCKET = 4 repetitions */ - pClasses[ wClasses ].pClassDatas = hb_itemNew( 0 ); - pClasses[ wClasses ].pInlines = hb_itemNew( 0 ); -/* pClasses[ wClasses ].pInitValues = hb_itemNew( 0 ); */ - hb_arrayNew( pClasses[ wClasses ].pClassDatas, 0 ); - hb_arrayNew( pClasses[ wClasses ].pInlines, 0 ); - /* hb_arrayNew( pClasses[ wClasses ].pInitValues, 0 ); */ + pClasses[ wClasses ].pClassDatas = hb_itemArrayNew( 0 ); + pClasses[ wClasses ].pInlines = hb_itemArrayNew( 0 ); + /* pClasses[ wClasses ].pInitValues = hb_itemArrayNew( 0 ); */ memset( pClasses[ wClasses ].pMethods, 0, 100 * sizeof( METHOD ) ); } @@ -749,7 +748,7 @@ HARBOUR __INSTSUPER( void ) /* ClassH := __InstSuper( ) */ { PushSymbol( pDynSym->pSymbol ); /* Push function name */ PushNil(); - Do( 0 ); /* Execute super class */ + Function( 0 ); /* Execute super class */ if( !IS_OBJECT( &stack.Return ) ) { diff --git a/harbour/tests/working/inherit.prg b/harbour/tests/working/inherit.prg index e550f7d691..4dbdc5ca69 100644 --- a/harbour/tests/working/inherit.prg +++ b/harbour/tests/working/inherit.prg @@ -48,14 +48,12 @@ function TEmpty() oEmpty := TClass():New( "TEmpty" ) // Create a new class def -// oEmpty:AddInline( "New", {|self|self} ) // Can cause crash ? + oEmpty:AddInline( "New", {|self|self} ) - oEmpty:AddMethod( "New", @New() ) // Constructor oEmpty:AddInline( "Run", {||QOut( "Run!" ) } ) // Test command // oEmpty:AddInline( "Set", {|self,xParam|::Out := xParam } ) oEmpty:AddInline( "Set", {|self,xParam| oSend(self,"_Out",xParam) } ) - oEmpty:AddData( "Out", 1 ) - // Test command + oEmpty:AddData( "Out", 1 ) // Test command oEmpty:AddVirtual( "Dispose" ) // Clean up code oEmpty:Create() @@ -107,7 +105,7 @@ return oFile:Instance() // mode for opening. Default "R" // Optional maximum blocksize // -static function New( cFileName, cMode, nBlock ) + function New( cFileName, cMode, nBlock ) local self := QSelf() // Get self @@ -135,7 +133,7 @@ static function New( cFileName, cMode, nBlock ) return self -static function Run( xTxt, lCRLF ) + function Run( xTxt, lCRLF ) local self := QSelf() local xRet @@ -151,7 +149,7 @@ return xRet // // Dispose -> Close the file handle // -static function Dispose() + function Dispose() local self := QSelf() @@ -171,7 +169,7 @@ return self // // Read a single line // -static function Read() + function Read() local self := QSelf() local cRet := "" @@ -228,7 +226,7 @@ return cRet // one or more strings // End with Carriage Return/Line Feed (Default == TRUE) // -static function WriteLn( xTxt, lCRLF ) + function WriteLn( xTxt, lCRLF ) local self := QSelf() local cBlock @@ -251,7 +249,7 @@ static function WriteLn( xTxt, lCRLF ) return self -static function Write( xTxt ) + function Write( xTxt ) local self := QSelf() @@ -267,7 +265,7 @@ return ::WriteLn( xTxt, .F. ) // // Go to a specified line number // -static function Goto( nLine ) + function Goto( nLine ) local self := QSelf() local nWhere := 1