oSend( <obj>, <cMessage>, <xArg, ..> ) added to classes.c
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
19990508-00:18 Eddie Runia
|
||||
* source/rtl/classes.c:
|
||||
oSend( <obj>, <cMessage>, <xArg,..> added.
|
||||
|
||||
Thu May 07 17:00:00 1999 Victor Szel <info@szelvesz.hu>
|
||||
|
||||
* source/rtl/strings.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() /* <xRet> = oSend( <oObj>, <cSymbol>, <xArg,..> */
|
||||
{
|
||||
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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user