ChangeLog 2000-07-12 10:25 UTC+0100
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
2000-07-12 10:25 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*source/common/hash.c
|
||||
* items can be removed from the hash table
|
||||
|
||||
*source/compiler/harbour.l
|
||||
* fixed handling of 'with()' and '( with )' syntax
|
||||
|
||||
*tests/keywords.prg
|
||||
* updated with few additional tests
|
||||
|
||||
|
||||
2000-07-12 08:46 UTC+0100 Victor Szakats <info@szelvesz.hu>
|
||||
|
||||
* doc/whatsnew.txt
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Harbour common hash table implementation
|
||||
* Harbour simple hash table implementation
|
||||
*
|
||||
* Copyright 1999 Ryszard Glab <rglab@imid.med.pl>
|
||||
* www - http://www.harbour-project.org
|
||||
@@ -35,6 +35,10 @@
|
||||
|
||||
#include "hbhash.h"
|
||||
|
||||
/* TODO:
|
||||
* 1) add resize function
|
||||
* 2) add better method of conflicts resolving
|
||||
*/
|
||||
static HB_HASH_ITEM_PTR hb_hashItemNew( ULONG ulKey, void * pValue )
|
||||
{
|
||||
HB_HASH_ITEM_PTR pItem = (HB_HASH_ITEM_PTR) hb_xgrab( sizeof( HB_HASH_ITEM ) );
|
||||
@@ -46,6 +50,11 @@ static HB_HASH_ITEM_PTR hb_hashItemNew( ULONG ulKey, void * pValue )
|
||||
return pItem;
|
||||
}
|
||||
|
||||
static void hb_hashItemDelete( HB_HASH_ITEM_PTR pItem )
|
||||
{
|
||||
hb_xfree( (void *) pItem );
|
||||
}
|
||||
|
||||
/* create a new hash table
|
||||
* ulSize = initial numer of items in the table
|
||||
* pHashTable = a function that calculates a hash key value
|
||||
@@ -144,6 +153,41 @@ void * hb_hashTableFind( HB_HASH_TABLE_PTR pTable, void *pValue )
|
||||
return pFound;
|
||||
}
|
||||
|
||||
/* Delete an item from the table
|
||||
* Returns TRUE if item was found and returns FALSE when passed item
|
||||
* is not stored in the table
|
||||
*/
|
||||
BOOL hb_hashTableDel( HB_HASH_TABLE_PTR pTable, void *pValue )
|
||||
{
|
||||
ULONG ulKey;
|
||||
HB_HASH_ITEM_PTR pItem;
|
||||
HB_HASH_ITEM_PTR pPrev = NULL;
|
||||
BOOL bFound = FALSE;
|
||||
|
||||
ulKey = ( pTable->pKeyFunc )( pValue, NULL );
|
||||
pItem = pTable->pItems[ ulKey ];
|
||||
while( pItem && !bFound )
|
||||
{
|
||||
if( ( pTable->pCompFunc )( pItem->cargo, pValue ) == 0 )
|
||||
{
|
||||
if( pPrev )
|
||||
pPrev->next = pItem->next;
|
||||
else
|
||||
pTable->pItems[ ulKey ] = pItem->next;
|
||||
|
||||
hb_hashItemDelete( pItem );
|
||||
bFound = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pPrev = pItem;
|
||||
pItem = pItem->next;
|
||||
}
|
||||
}
|
||||
|
||||
return bFound;
|
||||
}
|
||||
|
||||
/* return the hash table size */
|
||||
ULONG hb_hashTableBucket( HB_HASH_TABLE_PTR pTable )
|
||||
{
|
||||
|
||||
@@ -1527,6 +1527,13 @@ Separator {SpaceTab}
|
||||
return WITH;
|
||||
}
|
||||
}
|
||||
<WITH_>{Separator}*[\)\(] { /* ( with ) or with() */
|
||||
if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0;
|
||||
unput( yytext[ yyleng-1 ] );
|
||||
hb_comp_iState =IDENTIFIER;
|
||||
yylval.string = hb_compIdentifierNew( "WITH", TRUE );
|
||||
return IDENTIFIER;
|
||||
}
|
||||
<WITH_>{Separator}*[\[] { /* array */
|
||||
/* Clipper does not like with[] at all */
|
||||
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, yytext, NULL );
|
||||
|
||||
Reference in New Issue
Block a user