From 19679cd238ebdf470f69e9693862296de384e9b5 Mon Sep 17 00:00:00 2001 From: Ryszard Glab Date: Sun, 15 Oct 2000 12:15:48 +0000 Subject: [PATCH] ChangeLog 2000-10-15 14;25 UTC+0100 --- harbour/ChangeLog | 13 ++++++ harbour/source/compiler/harbour.l | 7 +-- harbour/source/macro/macro.l | 3 +- harbour/source/rdd/dbfcdx/dbfcdx1.c | 72 ++++++++++++++++------------- harbour/source/rdd/rddcpy.c | 14 +++--- 5 files changed, 67 insertions(+), 42 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9248ba14d5..3af6c95013 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,16 @@ +2000-10-15 14:25 UTC+0100 Ryszard Glab + + *source/compiler/harbour.l + *source/macro/macro.l + *fixed some minor bugs + + *source/rdd/rddcpy.c + *changed some NULL to 0 to stop warnings in GCC + + *source/rdd/dbfcdx/dbfcdx1.c + *fixed handling of memo free blocks + *fixed some warnings when compiled with GCC + 2000-10-15 12:45 UTC+0800 Brian Hays * source/rdd/dbcmd.c * fixed ordKey (and therefore IndexKey() ) to accept a NIL parameter diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index 4efb0fc72e..1ad3943b8e 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -257,7 +257,7 @@ Separator {SpaceTab} if( iFirstPos > 0 ) { yyless( iFirstPos+1 ); - yytext[ iFirstPos+1 ] = '\0'; + yytext[ iFirstPos ] = '\0'; yylval.string = hb_compIdentifierNew( yytext, TRUE ); hb_comp_iState = LITERAL; @@ -1310,8 +1310,9 @@ Separator {SpaceTab} [\(] ++_iOpenBracket; hb_comp_iState =LSEPARATOR; return yytext[ 0 ]; [\)] --_iOpenBracket; hb_comp_iState =RSEPARATOR; return yytext[ 0 ]; -[\x00-\x1F] return yytext[ 0 ]; /* see below */ -[\x80-\xFF] { +[\x00-\x1F] return yytext[ 0 ]; /* see below */ +[\~\`\?\_\\] return yytext[ 0 ]; /* see below */ +[\x7F-\xFF] { /* This have to be the last rule - any nonstandard and not handled * characters should go to grammar analyser instead of printing it * on stdout. diff --git a/harbour/source/macro/macro.l b/harbour/source/macro/macro.l index b36a51c04f..a7a5982b6f 100644 --- a/harbour/source/macro/macro.l +++ b/harbour/source/macro/macro.l @@ -216,7 +216,8 @@ MacroTxt ({MacroVar}|{MacroEnd}|{MacroId})+ [\]\}\)] { pMacro->FlexState = LOOKUP; return yytext[ 0 ]; } [\x00-\x1F] return yytext[ 0 ]; /* see below */ -[\x80-\xFF] { +[\~\`\?\_\\] return yytext[ 0 ]; /* see below */ +[\x7F-\xFF] { /* This have to be the last rule - any nonstandard and unhandled * characters should go to grammar analyser instead of printing it * on stdout. diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index c3f082f208..67b7ec6f36 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -357,20 +357,23 @@ static void hb_cdxAddFreeBlocks( CDXAREAP pArea, ULONG ulBlock, USHORT uiBlocks if( pFreeBlock->ulBlock < ulBlock ) { /* Can grow current free block? */ - if( pFreeBlock->ulBlock + pFreeBlock->uiBlocks == uiBlocks ) + if( (pFreeBlock->ulBlock + pFreeBlock->uiBlocks) == ulBlock ) { + /* The new blocks are directly after the current free block */ pFreeBlock->uiBlocks += uiBlocks; ulBlock = pFreeBlock->ulBlock; uiBlocks = pFreeBlock->uiBlocks; } /* Can append to next free block? */ else if( iCount < pArea->pMemoRoot->uiListLen - 1 && - ulBlock + uiBlocks == ( pFreeBlock + 1 )->ulBlock ) + (ulBlock + uiBlocks) == ( pFreeBlock + 1 )->ulBlock ) { + /* The new blocks are directly before the next free block */ pFreeBlock++; iCount++; pFreeBlock->ulBlock = ulBlock; pFreeBlock->uiBlocks += uiBlocks; + uiBlocks = pFreeBlock->uiBlocks; } /* Append to next free block */ else @@ -390,8 +393,8 @@ static void hb_cdxAddFreeBlocks( CDXAREAP pArea, ULONG ulBlock, USHORT uiBlocks } } - /* If is the last block in memo file truncate it */ - if( ulBlock + uiBlocks == pArea->pMemoRoot->ulNextBlock ) + /* If it is the last block in memo file truncate it */ + if( (ulBlock + uiBlocks) == pArea->pMemoRoot->ulNextBlock ) { pArea->pMemoRoot->ulNextBlock = ulBlock; pArea->pMemoRoot->fChanged = TRUE; @@ -615,7 +618,9 @@ static BOOL hb_cdxPutMemo( CDXAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) hb_cdxPutMemoBlock( pArea, uiIndex, ulBlock ); return TRUE; } -/* + +/* #if 0 is used to suppress 'nested comments' warnings in GCC */ +#if 0 static void hb_cdxCreateCompoundTag( LPCDXINDEX pIndex ) { CDXTAGHEADER cdxTagHeader; @@ -628,7 +633,7 @@ static void hb_cdxCreateCompoundTag( LPCDXINDEX pIndex ) pIndex->pCompound->pKeyItem = pIndex->pCompound->pForItem = NULL; pIndex->pCompound->pIndex = pIndex; - /* Write header * / + /* Write header */ memset( &cdxTagHeader, 0, sizeof( CDXTAGHEADER ) ); cdxTagHeader.lRoot = CDX_PAGELEN * 2; cdxTagHeader.uiKeySize = CDX_MAXTAGNAMELEN; @@ -636,11 +641,11 @@ static void hb_cdxCreateCompoundTag( LPCDXINDEX pIndex ) cdxTagHeader.bType = 0xE0; hb_fsWrite( pIndex->hFile, ( BYTE * ) &cdxTagHeader, CDX_PAGELEN ); - // Append the empty keypool * / + /* Append the empty keypool */ memset( &cdxTagHeader, 0, sizeof( CDXTAGHEADER ) ); hb_fsWrite( pIndex->hFile, ( BYTE * ) &cdxTagHeader, CDX_PAGELEN ); printf("\n%hu %hu\n",sizeof(LONG),sizeof(CDXLEAFHEADER)); - // Append the empty root node * / + /* Append the empty root node */ // memset( &cdxLeafHeader, 0, sizeof( CDXLEAFHEADER ) ); // cdxLeafHeader.uiNodeType = CDX_ROOTTYPE | CDX_LEAFTYPE; // cdxLeafHeader.lLeftNode = cdxLeafHeader.lRightNode = -1; @@ -652,7 +657,8 @@ printf("\n%hu %hu\n",sizeof(LONG),sizeof(CDXLEAFHEADER)); // cdxLeafHeader.bInfo = 3; // hb_fsWrite( pIndex->hFile, ( BYTE * ) &cdxLeafHeader, CDX_PAGELEN ); } -*/ +#endif + /* * -- DBFCDX METHODS -- */ @@ -887,7 +893,9 @@ ERRCODE hb_cdxOrderListClear( CDXAREAP pArea ) /* * Create new order. */ -/* + +/* #if 0 is used to suppress 'nested comments' warnings in GCC */ +#if 0 ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) { USHORT uiType, uiLen; @@ -905,17 +913,17 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) if( SELF_GOCOLD( ( AREAP ) pArea ) == FAILURE ) return FAILURE; - /* If we have a codeblock for the expression, use it * / + /* If we have a codeblock for the expression, use it */ if( pOrderInfo->itmCobExpr ) pKeyExp = hb_itemNew( pOrderInfo->itmCobExpr ); - else /* Otherwise, try compiling the key expression string * / + else /* Otherwise, try compiling the key expression string */ { if( SELF_COMPILE( ( AREAP ) pArea, ( BYTE * ) pOrderInfo->abExpr->item.asString.value ) == FAILURE ) return FAILURE; pKeyExp = hb_itemNew( pArea->valResult ); } - /* Get a blank record before testing expression * / + /* Get a blank record before testing expression */ SUPER_GOTO( ( AREAP ) pArea, 0 ); if( hb_itemType( pKeyExp ) == HB_IT_BLOCK ) { @@ -954,7 +962,7 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) } hb_itemRelease( pResult ); - /* Make sure uiLen is not 0 * / + /* Make sure uiLen is not 0 */ if( uiLen == 0 ) { hb_itemRelease( pKeyExp ); @@ -969,14 +977,14 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) return FAILURE; } - /* Check conditional expression * / + /* Check conditional expression */ pForExp = NULL; if( pArea->lpdbOrdCondInfo ) { - /* If we have a codeblock for the conditional expression, use it * / + /* If we have a codeblock for the conditional expression, use it */ if( pArea->lpdbOrdCondInfo->itmCobFor ) pForExp = hb_itemNew( pArea->lpdbOrdCondInfo->itmCobFor ); - else /* Otherwise, try compiling the conditional expression string * / + else /* Otherwise, try compiling the conditional expression string */ { if( SELF_COMPILE( ( AREAP ) pArea, pArea->lpdbOrdCondInfo->abFor ) == FAILURE ) { @@ -989,7 +997,7 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) } } - /* Test conditional expression * / + /* Test conditional expression */ if( pForExp ) { if( hb_itemType( pForExp ) == HB_IT_BLOCK ) @@ -1024,7 +1032,7 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) else pForMacro = NULL; - /* Check file name * / + /* Check file name */ szFileName = ( char * ) hb_xgrab( _POSIX_PATH_MAX + 1 ); szTagName = ( char * ) hb_xgrab( CDX_MAXTAGNAMELEN + 1 ); if( strlen( ( char * ) pOrderInfo->abBagName ) == 0 ) @@ -1067,14 +1075,14 @@ ERRCODE hb_cdxOrderCreate( CDXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo ) hb_xfree( pFileName ); } - /* Close all index * / + /* Close all index */ SELF_ORDLSTCLEAR( ( AREAP ) pArea ); pIndex = ( LPCDXINDEX ) hb_xgrab( sizeof( CDXINDEX ) ); pIndex->pArea = pArea; pIndex->szFileName = szFileName; - /* New file? * / + /* New file? */ if( !hb_fsFile( ( BYTE * ) szFileName ) ) { pIndex->hFile = hb_fsCreate( ( BYTE * ) szFileName, FC_NORMAL ); @@ -1107,14 +1115,15 @@ hb_xfree( pIndex->pCompound ); hb_xfree( pIndex ); - /* Free all macros * / + /* Free all macros */ if( pExpMacro ) hb_macroDelete( pExpMacro ); if( pForMacro ) hb_macroDelete( pForMacro ); return SUCCESS; } -*/ +#endif + /* * Provides information about order management. */ @@ -1511,7 +1520,6 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag ) LPKEYINFO pKey; HB_MACRO_PTR pMacro; BYTE cTemp[8], *pTemp; - char i; if( pTag->OptFlags & 0x80 ) hb_cdxTagEmptyIndex( pTag ); else @@ -1559,11 +1567,13 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag ) pTemp = (BYTE*) &pKey->pItem->item.asDouble.value; if (pKey->pItem->item.asDouble.value < 0) { + int i; for ( i = 7 ; i >= 0 ; i--, pTemp++) cTemp[i] = (*pTemp) ^ 0xFF; } else { + int i; for ( i = 7 ; i >= 0 ; i--, pTemp++) cTemp[i] = (*pTemp); cTemp[0] ^= 0x80; @@ -3455,7 +3465,7 @@ static void hb_cdxSortAddInternal( LPSORTINFO pSort, USHORT Lvl, LONG Tag, LONG } /* end hb_cdxSortxxx */ -static ERRCODE hb_cdxOrderCreate( CDXAREAP pAreaCdx, LPDBORDERCREATEINFO pOrderInfo ) +ERRCODE hb_cdxOrderCreate( CDXAREAP pAreaCdx, LPDBORDERCREATEINFO pOrderInfo ) { PHB_ITEM pExpr, pKeyExp, pForExp, pResult, pError; HB_MACRO_PTR pExpMacro, pForMacro; @@ -3772,7 +3782,7 @@ static ERRCODE hb_cdxOrderCreate( CDXAREAP pAreaCdx, LPDBORDERCREATEINFO pOrderI return SELF_GOTOP( ( AREAP ) pArea ); } -static ERRCODE hb_cdxOrderListAdd( CDXAREAP pAreaCdx, LPDBORDERINFO pOrderInfo ) +ERRCODE hb_cdxOrderListAdd( CDXAREAP pAreaCdx, LPDBORDERINFO pOrderInfo ) { USHORT uiFlags; char * szFileName; @@ -3900,7 +3910,7 @@ extern ERRCODE hb_cdxOrderListClear( CDXAREAP pArea ) return SUCCESS; } -static ERRCODE hb_cdxOrderListFocus( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) +ERRCODE hb_cdxOrderListFocus( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) { HB_TRACE(HB_TR_DEBUG, ("cdxOrderListFocus(%p, %p)", pArea, pOrderInfo)); @@ -3910,7 +3920,7 @@ static ERRCODE hb_cdxOrderListFocus( CDXAREAP pArea, LPDBORDERINFO pOrderInfo ) return SUCCESS; } -static ERRCODE hb_cdxGoTop( CDXAREAP pArea ) +ERRCODE hb_cdxGoTop( CDXAREAP pArea ) { HB_TRACE(HB_TR_DEBUG, ("cdxGoTop(%p)", pArea)); /*must change to follow ordSetFocus()*/ @@ -3927,7 +3937,7 @@ static ERRCODE hb_cdxGoTop( CDXAREAP pArea ) return SELF_SKIPFILTER( ( AREAP ) pArea, 1 ); } -static ERRCODE hb_cdxGoBottom( CDXAREAP pArea ) +ERRCODE hb_cdxGoBottom( CDXAREAP pArea ) { HB_TRACE(HB_TR_DEBUG, ("cdxGoBottom(%p)", pArea)); /*must change to follow ordSetFocus()*/ @@ -3944,7 +3954,7 @@ static ERRCODE hb_cdxGoBottom( CDXAREAP pArea ) return SELF_SKIPFILTER( ( AREAP ) pArea, -1 ); } -static ERRCODE hb_cdxSkipRaw( CDXAREAP pArea, LONG lToSkip ) +ERRCODE hb_cdxSkipRaw( CDXAREAP pArea, LONG lToSkip ) { HB_TRACE(HB_TR_DEBUG, ("cdxSkipRaw(%p, %ld)", pArea, lToSkip)); @@ -4004,7 +4014,7 @@ static ERRCODE hb_cdxSkipRaw( CDXAREAP pArea, LONG lToSkip ) return SELF_SKIPFILTER( ( AREAP ) pArea, -1 ); } -static ERRCODE hb_cdxSeek( CDXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFindLast ) +ERRCODE hb_cdxSeek( CDXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFindLast ) { PHB_ITEM pError; ERRCODE retvalue; diff --git a/harbour/source/rdd/rddcpy.c b/harbour/source/rdd/rddcpy.c index 761c968ab8..880d923a24 100644 --- a/harbour/source/rdd/rddcpy.c +++ b/harbour/source/rdd/rddcpy.c @@ -68,7 +68,7 @@ static LPAREANODE GetTheOtherArea( char *szDriver, char * szFileName ) if( SELF_OPEN( ( AREAP ) pAreaNode->pArea, &pInfo ) == FAILURE ) { - hb_errRT_DBCMD( EG_OPEN, NULL, NULL, "DBAPP" ); // Could not open it + hb_errRT_DBCMD( EG_OPEN, 0, NULL, "DBAPP" ); // Could not open it SELF_RELEASE( ( AREAP ) pAreaNode->pArea ); hb_xfree( pAreaNode ); return NULL; @@ -227,9 +227,9 @@ HB_FUNC( __DBAPP ) ISNIL( 2 ) ? NULL : hb_param( 2, HB_IT_ARRAY ), // Fuelds ISNIL( 3 ) ? NULL : hb_param( 3, HB_IT_BLOCK ), // For ISNIL( 4 ) ? NULL : hb_param( 4, HB_IT_BLOCK ), // While - ISNIL( 5 ) ? NULL : hb_parni( 5 ), // Next - ISNIL( 6 ) ? NULL : hb_parni( 6 ), // Record - ISNIL( 7 ) ? NULL : hb_parnl( 7 ), // Rest + ISNIL( 5 ) ? 0 : hb_parni( 5 ), // Next + ISNIL( 6 ) ? 0 : hb_parni( 6 ), // Record + ISNIL( 7 ) ? 0 : hb_parnl( 7 ), // Rest ISNIL( 8 ) ? NULL : hb_parc( 8 ) )); // RDD } @@ -241,9 +241,9 @@ HB_FUNC( __DBCOPY ) ISNIL( 2 ) ? NULL : hb_param( 2, HB_IT_ARRAY ), // Fuelds ISNIL( 3 ) ? NULL : hb_param( 3, HB_IT_BLOCK ), // For ISNIL( 4 ) ? NULL : hb_param( 4, HB_IT_BLOCK ), // While - ISNIL( 5 ) ? NULL : hb_parni( 5 ), // Next - ISNIL( 6 ) ? NULL : hb_parni( 6 ), // Record - ISNIL( 7 ) ? NULL : hb_parnl( 7 ), // Rest + ISNIL( 5 ) ? 0 : hb_parni( 5 ), // Next + ISNIL( 6 ) ? 0 : hb_parni( 6 ), // Record + ISNIL( 7 ) ? 0 : hb_parnl( 7 ), // Rest ISNIL( 8 ) ? NULL : hb_parc( 8 ) )); // RDD }