Bruno see ChangeLog

This commit is contained in:
Andi Jahja
1999-07-07 16:20:17 +00:00
parent 99d012f435
commit 8c9402290a
3 changed files with 56 additions and 5 deletions

View File

@@ -232,6 +232,7 @@ int hb_arrayGetType( PHB_ITEM pArray, ULONG ulIndex );
void hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex );
PHB_ITEM hb_arrayClone( PHB_ITEM pArray );
void hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue );
char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the date value contained on an array element */
int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ); /* our string compare */
char * hb_str( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec ); /* convert number to string */

View File

@@ -7,6 +7,7 @@
#include <errorapi.h>
#include <ctoharb.h>
#include <init.h>
#include <dates.h>
HARBOUR HB_AADD(void);
HARBOUR HB_ACLONE(void);
@@ -50,6 +51,51 @@ static char *szArgumentError = "Argument error: incorrect type";
* Internal
*/
char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex )
{
char szDate[ 9 ];
long lDay, lMonth, lYear;
if( IS_ARRAY( pArray ) )
{
if( ulIndex <= ( unsigned )hb_arrayLen( pArray ) )
{
PHB_ITEM pItem = pArray->item.asArray.value->pItems + ulIndex - 1;
if( IS_DATE( pItem ) && pItem->item.asDate.value > 0 )
{
hb_dateDecode( pItem->item.asDate.value, &lDay, &lMonth, &lYear );
szDate[ 0 ] = ( lYear / 1000 ) + '0';
szDate[ 1 ] = ( ( lYear % 1000 ) / 100 ) + '0';
szDate[ 2 ] = ( ( lYear % 100 ) / 10 ) + '0';
szDate[ 3 ] = ( lYear % 10 ) + '0';
szDate[ 4 ] = ( lMonth / 10 ) + '0';
szDate[ 5 ] = ( lMonth % 10 ) + '0';
szDate[ 6 ] = ( lDay / 10 ) + '0';
szDate[ 7 ] = ( lDay % 10 ) + '0';
szDate[ 8 ] = 0;
return szDate;
}
else
return " ";
}
else
{
hb_errorRT_BASE(EG_ARG, 1132, "Bound error", "array access");
}
}
else
{
hb_errorRT_BASE(EG_ARG, 1068, "Argument error", "array access");
}
return " ";
}
BOOL hb_arrayGetBool( PHB_ITEM pArray, ULONG ulIndex )
{

View File

@@ -118,12 +118,16 @@ char * hb_pards( WORD wParam, ... )
pItem = stack.pBase + 1 + wParam;
if( pItem->type & IT_BYREF )
pItem = stack.pItems + pItem->item.asRefer.value;
if( IS_ARRAY( pItem ) )
{
if( wArrayIndex )
return strcpy( stack.szDate, hb_arrayGetDate( pItem, wArrayIndex ) );
else
return " ";
}
if( IS_ARRAY( pItem ) && wArrayIndex )
/* TODO: implement wArrayIndex use when retrieving an array element */
return " ";
else if( IS_DATE( pItem ) && pItem->item.asDate.value > 0 )
else if( IS_DATE( pItem ) && pItem->item.asDate.value > 0 )
{
hb_dateDecode( pItem->item.asDate.value, &lDay, &lMonth, &lYear );