From a7be129b2f57f449481fac6b7e02e107d127af66 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 15 Jun 2010 10:57:10 +0000 Subject: [PATCH] 2010-06-15 12:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/xhb/xhbcomp.prg * harbour/contrib/xhb/xhbmsgs.c + added emulation for some xHarbour extensions in ==, = and != operators. == = // it does not work correctly in xHarbour != --- harbour/ChangeLog | 9 +++++++++ harbour/contrib/xhb/xhbcomp.prg | 8 ++++++++ harbour/contrib/xhb/xhbmsgs.c | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ce6cb12a8f..fe15c2edf1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2010-06-15 12:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/xhb/xhbcomp.prg + * harbour/contrib/xhb/xhbmsgs.c + + added emulation for some xHarbour extensions in ==, = and != + operators. + == + = // it does not work correctly in xHarbour + != + 2010-06-15 12:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbdefs.h * harbour/include/hbvmpub.h diff --git a/harbour/contrib/xhb/xhbcomp.prg b/harbour/contrib/xhb/xhbcomp.prg index 2dfc3cf453..ed02fd7d95 100644 --- a/harbour/contrib/xhb/xhbcomp.prg +++ b/harbour/contrib/xhb/xhbcomp.prg @@ -72,6 +72,7 @@ INIT PROCEDURE xhb_Init() ASSOCIATE CLASS _Numeric WITH TYPE Numeric ASSOCIATE CLASS _Array WITH TYPE Array ASSOCIATE CLASS _Hash WITH TYPE Hash + ASSOCIATE CLASS _Block WITH TYPE Block RETURN @@ -129,4 +130,11 @@ CREATE CLASS Hash INHERIT __HBHash FUNCTION _Hash OPERATOR "+" FUNCTION XHB_PLUS() OPERATOR "-" FUNCTION XHB_MINUS() OPERATOR "$$" FUNCTION XHB_INCLUDE() + OPERATOR "=" FUNCTION XHB_EQUAL() + OPERATOR "<>" FUNCTION XHB_NOTEQUAL() +ENDCLASS + +CREATE CLASS Block FUNCTION _Block + OPTIONAL INHERIT HBBlock + OPERATOR "==" FUNCTION XHB_EEQUAL() ENDCLASS diff --git a/harbour/contrib/xhb/xhbmsgs.c b/harbour/contrib/xhb/xhbmsgs.c index b2e1c8693b..bdc3159727 100644 --- a/harbour/contrib/xhb/xhbmsgs.c +++ b/harbour/contrib/xhb/xhbmsgs.c @@ -133,6 +133,10 @@ HB_FUNC( XHB_EEQUAL ) double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc == dValue ); } + else if( HB_IS_BLOCK( pSelf ) && HB_IS_BLOCK( pValue ) ) + { + hb_retl( hb_codeblockId( pSelf ) == hb_codeblockId( pValue ) ); + } else { PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1070, NULL, "==", 2, pSelf, pValue ); @@ -158,6 +162,10 @@ HB_FUNC( XHB_EQUAL ) double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc == dValue ); } + else if( HB_IS_HASH( pSelf ) && HB_IS_HASH( pValue ) ) + { + hb_retl( hb_hashId( pSelf ) == hb_hashId( pValue ) ); + } else { PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1071, NULL, "=", 2, pSelf, pValue ); @@ -183,6 +191,10 @@ HB_FUNC( XHB_NOTEQUAL ) double dValue = hb_itemGetND( pValue ); hb_retl( ( double ) uc != dValue ); } + else if( HB_IS_HASH( pSelf ) && HB_IS_HASH( pValue ) ) + { + hb_retl( hb_hashId( pSelf ) != hb_hashId( pValue ) ); + } else { PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_ARG, 1072, NULL, "<>", 2, pSelf, pValue );