diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d8dc3f5cdb..9647faab45 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +19990508-00:18 Eddie Runia + * source/rtl/classes.c: + oSend( , , added. + Thu May 07 17:00:00 1999 Victor Szel * source/rtl/strings.c: diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index 9232c5e006..2413e6ae25 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -8,6 +8,7 @@ void Push( PITEM ); void PushNil( void ); void PushSymbol( PSYMBOL ); +void Message( PSYMBOL ); void Do( WORD wParams ); #define MET_METHOD 0 @@ -466,3 +467,28 @@ void ReleaseClasses( void ) if( pClasses ) _xfree( pClasses ); } + + +/* oSend send a message to an object */ + +HARBOUR OSEND() /* = oSend( , , */ +{ + PITEM pObject = _param( 1, IT_OBJECT ); + PITEM pMessage = _param( 2, IT_STRING ); + WORD w; + + if( pMessage && pObject ) /* Object & message passed */ + { + Push( pObject ); /* Push object */ + Message( GetDynSym( pMessage->value.szText )->pSymbol ); + /* Push char symbol as message */ + for( w = 3; w <= _pcount(); w++ ) /* Push arguments on stack */ + Push( _param( w, IT_ANY ) ); + Do( _pcount()-2 ); /* Execute message */ + } + else + { /* TODO: Crash code */ + } +} + + diff --git a/harbour/tests/working/debugtst.prg b/harbour/tests/working/debugtst.prg index a012405261..5a4983c476 100644 --- a/harbour/tests/working/debugtst.prg +++ b/harbour/tests/working/debugtst.prg @@ -108,6 +108,7 @@ function ToChar( xTxt, cSeparator, lDebug ) local cOut local n local nLen + local aData cSeparator := Default( cSeparator, " " ) lDebug := Default( lDebug, .F. ) @@ -159,15 +160,17 @@ function ToChar( xTxt, cSeparator, lDebug ) case cValTxt=="O" // Object if lDebug - cOut := xTxt:ClassName() + "(#"+ToChar( xTxt:ClassH() )+"):{" - nLen := Len( xTxt ) + cOut := xTxt:ClassName() + "(#" + ToChar( xTxt:ClassH() ) + "):{" + aData := aoData( xTxt ) + nLen := Len( aData ) for n := 1 to nLen // For each item : Recurse ! - cOut += ToChar( xTxt[n], cSeparator, lDebug ) + cOut += aData[n] + ":" + ; + ToChar( oSend( xTxt, aData[n] ), cSeparator, lDebug ) if n != nLen cOut += cSeparator endif next n - cOut += ";" + ToChar( aoData( xTxt ), ", " ) + "}" + cOut += "}" else cOut := ToChar( xTxt:Run(), cSeparator, lDebug ) endif