From 77e2ebbac684208e4e62f4520a8cb0be22283aa5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 29 Jul 2000 15:29:58 +0000 Subject: [PATCH] 2000-07-29 17:25 UTC+0100 Victor Szakats --- harbour/ChangeLog | 19 +++++++++++++++++ harbour/source/rtl/gtapi.c | 9 +++++--- harbour/source/vm/arrays.c | 42 +++++++++---------------------------- harbour/source/vm/itemapi.c | 24 ++++++++++----------- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 71d5fff1bc..1adcbdc34c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,22 @@ +2000-07-29 17:25 UTC+0100 Victor Szakats + + * utils/hbtest/* + + Added check for :Arg variable of returned error objects. + Note that currently Harbour doesn't support the :Arg var, so many + tests will fail which looked OK until now. + + * source/vm/itemapi.c + % Small optimizations. + * One buffer size changed to 512 from 500, to be the power of 2. + + * source/vm/arrays.c + - hb_arrayGetBool() removed, since it was the same as hb_arrayGetL(), but + had no prototype in hbapi.h. + + * source/rtl/gtapi.c + * TRACE call fix in hb_gtSetPos() + ! NOTE made more clear. + 2000-07-29 07:40 UTC+0800 Ron Pinkas * source/compiler/harbour.slx + Added 2 rules to support DECLARE MACROVAR and DECLARE MACRO TEXT diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index f69271680a..f4b26c5db4 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -647,12 +647,15 @@ USHORT hb_gtGetPos( SHORT * piRow, SHORT * piCol ) return 0; } +/* NOTE: Should be exactly the same as hb_gtSetPosContext(), but without the + additional third parameter. */ + USHORT hb_gtSetPos( SHORT iRow, SHORT iCol ) { USHORT uiMaxRow; USHORT uiMaxCol; - HB_TRACE(HB_TR_DEBUG, ("hb_gtSetPosContext(%hd, %hd, %hd)", iRow, iCol, iMethod)); + HB_TRACE(HB_TR_DEBUG, ("hb_gtSetPos(%hd, %hd)", iRow, iCol)); uiMaxRow = hb_gt_GetScreenHeight(); uiMaxCol = hb_gt_GetScreenWidth(); @@ -677,7 +680,7 @@ USHORT hb_gtSetPos( SHORT iRow, SHORT iCol ) return 0; } -/* NOTE: Exactly the same as hb_gtSetPos(), but with the additional +/* NOTE: Should be exactly the same as hb_gtSetPos(), but with the additional parameter. */ USHORT hb_gtSetPosContext( SHORT iRow, SHORT iCol, SHORT iMethod ) @@ -862,7 +865,7 @@ USHORT hb_gtWriteAt( USHORT uiRow, USHORT uiCol, BYTE * pStr, ULONG ulLength ) return 0; } -#define WRITECON_BUFFER_SIZE 500 +#define WRITECON_BUFFER_SIZE 512 USHORT hb_gtWriteCon( BYTE * pStr, ULONG ulLength ) { diff --git a/harbour/source/vm/arrays.c b/harbour/source/vm/arrays.c index 9e9ba42686..5420fb7262 100644 --- a/harbour/source/vm/arrays.c +++ b/harbour/source/vm/arrays.c @@ -258,13 +258,11 @@ char * hb_arrayGetDS( PHB_ITEM pArray, ULONG ulIndex, char * szDate ) HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetDS(%p, %lu, %s)", pArray, ulIndex, szDate)); if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen ) - hb_itemGetDS( pArray->item.asArray.value->pItems + ulIndex - 1, szDate ); + return hb_itemGetDS( pArray->item.asArray.value->pItems + ulIndex - 1, szDate ); else /* NOTE: Intentionally calling it with a bad parameter in order to get the default value from hb_itemGetDS(). [vszakats] */ - hb_itemGetDS( NULL, szDate ); - - return szDate; + return hb_itemGetDS( NULL, szDate ); } long hb_arrayGetDL( PHB_ITEM pArray, ULONG ulIndex ) @@ -275,23 +273,10 @@ long hb_arrayGetDL( PHB_ITEM pArray, ULONG ulIndex ) return hb_itemGetDL( pArray->item.asArray.value->pItems + ulIndex - 1 ); else /* NOTE: Intentionally calling it with a bad parameter in order to get - the default value from hb_itemGetDS(). [vszakats] */ + the default value from hb_itemGetDL(). [vszakats] */ return hb_itemGetDL( NULL ); } -BOOL hb_arrayGetBool( PHB_ITEM pArray, ULONG ulIndex ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetBool(%p, %lu)", pArray, ulIndex)); - - if( HB_IS_ARRAY( pArray ) ) - { - if( ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen ) - return hb_itemGetL( pArray->item.asArray.value->pItems + ulIndex - 1 ); - } - - return FALSE; -} - /* * This function returns a pointer to an item occupied by the specified * array element - it doesn't return an item's value @@ -300,13 +285,10 @@ PHB_ITEM hb_arrayGetItemPtr( PHB_ITEM pArray, ULONG ulIndex ) { HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetItemPtr(%p, %lu)", pArray, ulIndex)); - if( HB_IS_ARRAY( pArray ) ) - { - if( ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen ) - return pArray->item.asArray.value->pItems + ( ulIndex - 1 ); - } - - return NULL; + if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen ) + return pArray->item.asArray.value->pItems + ulIndex - 1; + else + return NULL; } BOOL hb_arrayGetL( PHB_ITEM pArray, ULONG ulIndex ) @@ -751,13 +733,9 @@ HB_GARBAGE_FUNC( hb_arrayReleaseGarbage ) * Arrays, objects and codeblock should be released directly by * the garbage collector */ - if( HB_IS_STRING( pItem ) ) - { - if( pItem->item.asString.value ) - { - hb_xfree( pItem->item.asString.value ); - } - } + if( HB_IS_STRING( pItem ) && pItem->item.asString.value ) + hb_xfree( pItem->item.asString.value ); + ++pItem; } hb_xfree( pBaseArray->pItems ); diff --git a/harbour/source/vm/itemapi.c b/harbour/source/vm/itemapi.c index ac3a35fe68..9ffa054000 100644 --- a/harbour/source/vm/itemapi.c +++ b/harbour/source/vm/itemapi.c @@ -579,18 +579,19 @@ char * hb_itemGetDS( PHB_ITEM pItem, char * szDate ) HB_TRACE(HB_TR_DEBUG, ("hb_itemGetDS(%p, %s)", szDate)); if( pItem && HB_IS_DATE( pItem ) ) - hb_dateDecStr( szDate, pItem->item.asDate.value ); + return hb_dateDecStr( szDate, pItem->item.asDate.value ); else - hb_dateDecStr( szDate, 0 ); - - return szDate; + return hb_dateDecStr( szDate, 0 ); } long hb_itemGetDL( PHB_ITEM pItem ) { HB_TRACE(HB_TR_DEBUG, ("hb_itemGetDL(%p)", pItem)); - return ( pItem && HB_IS_DATE( pItem ) ) ? pItem->item.asDate.value : 0; + if( pItem && HB_IS_DATE( pItem ) ) + return pItem->item.asDate.value; + else + return 0; } BOOL hb_itemGetL( PHB_ITEM pItem ) @@ -836,15 +837,13 @@ PHB_ITEM hb_itemPutNLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec ) iDec = hb_set.HB_SET_DECIMALS; if( iDec > 0 ) - pItem = hb_itemPutNDLen( pItem, dNumber, iWidth, iDec ); + return hb_itemPutNDLen( pItem, dNumber, iWidth, iDec ); else if( SHRT_MIN <= dNumber && dNumber <= SHRT_MAX ) - pItem = hb_itemPutNILen( pItem, ( int ) dNumber, iWidth ); + return hb_itemPutNILen( pItem, ( int ) dNumber, iWidth ); else if( LONG_MIN <= dNumber && dNumber <= LONG_MAX ) - pItem = hb_itemPutNLLen( pItem, ( long ) dNumber, iWidth ); + return hb_itemPutNLLen( pItem, ( long ) dNumber, iWidth ); else - pItem = hb_itemPutNDLen( pItem, dNumber, iWidth, 0 ); - - return pItem; + return hb_itemPutNDLen( pItem, dNumber, iWidth, 0 ); } PHB_ITEM hb_itemPutNDLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec ) @@ -1152,7 +1151,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) ULONG ulLenSecond; ULONG ulMinLen; ULONG ulCounter; - int iRet = 0; /* Current status */ + int iRet = 0; /* Current status */ HB_TRACE(HB_TR_DEBUG, ("hb_itemStrCmp(%p, %p, %d)", pFirst, pSecond, (int) bForceExact)); @@ -1185,6 +1184,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) szSecond++; } } + if( hb_set.HB_SET_EXACT || bForceExact || ulLenSecond > ulCounter ) { /* Force an exact comparison */