From c0f8b1e1ff5b8283d7c227835167f701a42f2274 Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Wed, 15 Dec 1999 12:45:32 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 7 +++++++ harbour/source/rtl/classes.c | 10 ++++++++++ harbour/tests/testcls.prg | 14 ++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c5b214dd17..23b0dd49a3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +19991215-12:32 GMT+1 Antonio Linares + * source/rtl/classes.c + + Added a new function __GetMessage() to retrieve the message + name from a Class error handler. + * tests/testcls.prg + * enhanced showing the use of __GetMessge() + 19991215-12:09 GMT+1 Antonio Linares + added common.b32 provided by Jose Lalin * tests/bld_b32.bat diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index 4b4d5ff2fd..5619b2cb16 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -1245,4 +1245,14 @@ static HARBOUR hb___msgVirtual( void ) { /* hb_ret(); */ /* NOTE: It's safe to comment this out */ ; +} + +/* to be used from Classes ERROR HANDLER method */ +HARBOUR HB___GETMESSAGE() +{ + PHB_ITEM pBase = hb_stack.pBase; + + pBase = hb_stack.pItems + pBase->item.asSymbol.stackbase; + + hb_retc( pBase->item.asSymbol.value->szName ); } \ No newline at end of file diff --git a/harbour/tests/testcls.prg b/harbour/tests/testcls.prg index cc0c8203db..381a059160 100644 --- a/harbour/tests/testcls.prg +++ b/harbour/tests/testcls.prg @@ -6,19 +6,25 @@ function Main() local o := Test() - o:Any() // Any message is not defined for Class Test, but + o:Any( "Hello" ) // Any message is not defined for Class Test, but // it will invoke ON ERROR Any() method + o:Any = 5 // Notice how __GetMessage() shows a underscored message + // as we are setting a DATA value. return nil CLASS Test - ON ERROR Any( cMsg ) + ON ERROR Any( uParam1 ) ENDCLASS -METHOD Any( cMsg ) CLASS Test +METHOD Any( uParam1 ) CLASS Test - Alert( "Inside Any" ) + if PCount() > 0 + Alert( uParam1 ) + endif + + Alert( __GetMessage() ) // Shows the message that was sent to the object return nil \ No newline at end of file