From ab55c67e70fe1789533aec56bcf079348abb66dc Mon Sep 17 00:00:00 2001 From: Robert Arseniuk Date: Fri, 14 May 1999 18:01:22 +0000 Subject: [PATCH] updated for arrays.c --- harbour/include/extend.h | 38 +++++++++++++++++++----------------- harbour/source/rtl/extend.c | 10 +++++----- harbour/source/rtl/itemapi.c | 8 ++++---- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/harbour/include/extend.h b/harbour/include/extend.h index 07c84dccb8..e21dd309ac 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -52,16 +52,16 @@ typedef struct /* items hold at the virtual machine stack */ WORD wLength; /* length of the item */ WORD wDec; /* decimal places in a numeric double item */ union { /* different things may be holded here */ - char * szText; /* string values */ - int iNumber; /* int values */ - long lNumber; /* long values */ - double dNumber; /* double values */ - int iLogical; /* logical values */ - long lDate; /* date values */ - PSYMBOL pSymbol; /* functions call symbol */ - BYTE * pCodeblock;/* pointer to a codeblock structure */ - WORD wItem; /* variable by reference, stack offset */ - void * pBaseArray; /* array base */ + char * szText; /* string values */ + int iNumber; /* int values */ + long lNumber; /* long values */ + double dNumber; /* double values */ + int iLogical; /* logical values */ + long lDate; /* date values */ + PSYMBOL pSymbol; /* functions call symbol */ + BYTE * pCodeblock;/* pointer to a codeblock structure */ + WORD wItem; /* variable by reference, stack offset */ + void * pBaseArray; /* array base */ } value; WORD wBase; /* stack frame number of items position for a function call */ WORD wLine; /* currently processed PRG line number */ @@ -141,14 +141,16 @@ void _xfree( void * pMem ); /* frees memory */ void ItemCopy( PITEM pDest, PITEM pSource ); void ItemRelease( PITEM pItem ); -void Array( PITEM pItem, ULONG ulLen ); /* creates a new array */ -void ArrayGet( PITEM pArray, ULONG ulIndex, PITEM pItem ); /* retrieves an item */ -int ArrayLen( PITEM pArray ); /* retrives the array len */ -void ArraySet( PITEM pArray, ULONG ulIndex, PITEM pItem ); /* sets an array element */ -void ArraySize( PITEM pArray, ULONG ulLen ); /* sets the array total length */ -void ArrayRelease( PITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */ -char * ArrayGetString( PITEM pArray, ULONG ulIndex ); /* retrieves the string contained on an array element */ -ULONG ArrayGetStringLen( PITEM pArray, ULONG ulIndex ); /* retrieves the string length contained on an array element */ +void hb_arrayNew( PITEM pItem, ULONG ulLen ); /* creates a new array */ +void hb_arrayGet( PITEM pArray, ULONG ulIndex, PITEM pItem ); /* retrieves an item */ +int hb_arrayLen( PITEM pArray ); /* retrives the array len */ +void hb_arraySet( PITEM pArray, ULONG ulIndex, PITEM pItem ); /* sets an array element */ +void hb_arraySize( PITEM pArray, ULONG ulLen ); /* sets the array total length */ +void hb_arrayRelease( PITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */ +char *hb_arrayGetString( PITEM pArray, ULONG ulIndex ); /* retrieves the string contained on an array element */ +ULONG hb_arrayGetStringLen( PITEM pArray, ULONG ulIndex ); /* retrieves the string length contained on an array element */ +int hb_arrayGetType( PITEM pArray, ULONG ulIndex ); +void hb_arrayDel( PITEM pArray, ULONG ulIndex ); int hb_itemStrCmp( PITEM pFirst, PITEM pSecond, BOOL bForceExact ); /* our string compare */ BOOL hb_strempty( char * szText, ULONG ulLen ); diff --git a/harbour/source/rtl/extend.c b/harbour/source/rtl/extend.c index 186bf6fc6e..76c1368b68 100644 --- a/harbour/source/rtl/extend.c +++ b/harbour/source/rtl/extend.c @@ -46,7 +46,7 @@ char * _parc( WORD wParam, ... ) if( IS_ARRAY( pItem ) ) { if( wArrayIndex ) - return ArrayGetString( pItem, wArrayIndex ); + return hb_arrayGetString( pItem, wArrayIndex ); else return ""; } @@ -76,7 +76,7 @@ ULONG _parclen( WORD wParam, ... ) if( IS_ARRAY( pItem ) ) { if( wArrayIndex ) - return ArrayGetStringLen( pItem, wArrayIndex ); + return hb_arrayGetStringLen( pItem, wArrayIndex ); else return 0; } @@ -265,9 +265,9 @@ int _parinfa( int iParamNum, ULONG uiArrayIndex ) if( pArray ) { if( ! uiArrayIndex ) - return ArrayLen( pArray ); + return hb_arrayLen( pArray ); else - return ArrayGetType( pArray, uiArrayIndex ); + return hb_arrayGetType( pArray, uiArrayIndex ); } else return 0; /* QUESTION: should we raise an error here ? */ @@ -298,7 +298,7 @@ void _ret( void ) void _reta( ULONG ulLen ) /* undocumented _reta() */ { - Array( &stack.Return, ulLen ); + hb_arrayNew( &stack.Return, ulLen ); } void _retc( char * szText ) diff --git a/harbour/source/rtl/itemapi.c b/harbour/source/rtl/itemapi.c index 84daf2300b..12fb235f5e 100644 --- a/harbour/source/rtl/itemapi.c +++ b/harbour/source/rtl/itemapi.c @@ -138,7 +138,7 @@ PITEM hb_itemArrayNew( ULONG ulLen ) { PITEM pItem = hb_itemNew(0); - Array(pItem, ulLen); + hb_arrayNew(pItem, ulLen); return pItem; } @@ -147,14 +147,14 @@ PITEM hb_itemArrayGet( PITEM pArray, ULONG ulIndex ) { PITEM pItem = hb_itemNew(0); - ArrayGet(pArray, ulIndex, pItem); + hb_arrayGet(pArray, ulIndex, pItem); return pItem; } PITEM hb_itemArrayPut( PITEM pArray, ULONG ulIndex, PITEM pItem ) { - ArraySet(pArray, ulIndex, pItem); + hb_arraySet(pArray, ulIndex, pItem); return pArray; } @@ -373,7 +373,7 @@ ULONG hb_itemSize( PITEM pItem ) { switch( pItem->wType ) { - case IT_ARRAY: return ArrayLen(pItem); + case IT_ARRAY: return hb_arrayLen(pItem); case IT_STRING: return pItem->wLength; } }