2000-07-24 22:28 UTC+0100 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-07-24 20:30:05 +00:00
parent 5184b749ca
commit d407f71aa5
10 changed files with 75 additions and 60 deletions

View File

@@ -1,3 +1,17 @@
2000-07-24 22:28 UTC+0100 Victor Szakats <info@szelvesz.hu>
* rdd/dbcmd.c
* rtl/errorapi.c
* vm/classes.c
* vm/fm.c
* vm/garbage.c
* vm/hvm.c
* vm/itemapi.c
* vm/memvars.c
* include/error.ch
* IE_* macros renamed to HB_EI_* to not pollute namespace.
! Removed // comments from error.ch, since it was used in C code.
2000-07-24 22:12 UTC+0100 Victor Szakats <info@szelvesz.hu>
* include/hbextern.ch

View File

@@ -91,28 +91,28 @@
#define EG_CONDITION 50 /* Harbour special */
/* Internal errors */
#define IE_ERRUNRECOV 9000 // "Unrecoverable error %lu: "
#define IE_ERRRECFAILURE 9001 // "Error recovery failure"
#define IE_ERRNOBLOCK 9002 // "No ERRORBLOCK() for error"
#define IE_ERRTOOMANY 9003 // "Too many recursive error handler calls"
#define IE_RDDINVALID 9004 // "RDD invalid or failed to load"
#define IE_CLSINVMETHOD 9005 // "Invalid method type from %s"
#define IE_XGRABALLOC 9006 // "hb_xgrab can't allocate memory"
#define IE_XREALLOCNULL 9007 // "hb_xrealloc called with a NULL pointer"
#define IE_XREALLOCINV 9008 // "hb_xrealloc called with an invalid pointer"
#define IE_XREALLOC 9009 // "hb_xrealloc can't reallocate memory"
#define IE_XFREEINV 9010 // "hb_xfree called with an invalid pointer"
#define IE_XFREENULL 9011 // "hb_xfree called with a NULL pointer"
#define IE_VMBADSTARTUP 9012 // "Can\'t locate the starting procedure: \'%s\'"
#define IE_VMNOSTARTUP 9013 // "No starting procedure"
#define IE_VMBADOPCODE 9014 // "Unsupported VM opcode"
#define IE_VMNOTSYMBOL 9015 // "Symbol item expected from %s"
#define IE_VMINVSYMBOL 9016 // "Invalid symbol type for self from %s"
#define IE_VMNOTCBLOCK 9017 // "Codeblock expected from %s"
#define IE_VMPOPINVITEM 9018 // "Incorrect item type on the stack trying to pop from %s"
#define IE_STACKUFLOW 9019 // "Stack underflow"
#define IE_ITEMBADCOPY 9020 // "An item was going to be copied to itself from %s"
#define IE_MVBADSYMBOL 9021 // "Invalid symbol item passed as memvar %s"
#define HB_EI_ERRUNRECOV 9000 /* "Unrecoverable error %lu: " */
#define HB_EI_ERRRECFAILURE 9001 /* "Error recovery failure" */
#define HB_EI_ERRNOBLOCK 9002 /* "No ERRORBLOCK() for error" */
#define HB_EI_ERRTOOMANY 9003 /* "Too many recursive error handler calls" */
#define HB_EI_RDDINVALID 9004 /* "RDD invalid or failed to load" */
#define HB_EI_CLSINVMETHOD 9005 /* "Invalid method type from %s" */
#define HB_EI_XGRABALLOC 9006 /* "hb_xgrab can't allocate memory" */
#define HB_EI_XREALLOCNULL 9007 /* "hb_xrealloc called with a NULL pointer" */
#define HB_EI_XREALLOCINV 9008 /* "hb_xrealloc called with an invalid pointer" */
#define HB_EI_XREALLOC 9009 /* "hb_xrealloc can't reallocate memory" */
#define HB_EI_XFREEINV 9010 /* "hb_xfree called with an invalid pointer" */
#define HB_EI_XFREENULL 9011 /* "hb_xfree called with a NULL pointer" */
#define HB_EI_VMBADSTARTUP 9012 /* "Can\'t locate the starting procedure: \'%s\'" */
#define HB_EI_VMNOSTARTUP 9013 /* "No starting procedure" */
#define HB_EI_VMBADOPCODE 9014 /* "Unsupported VM opcode" */
#define HB_EI_VMNOTSYMBOL 9015 /* "Symbol item expected from %s" */
#define HB_EI_VMINVSYMBOL 9016 /* "Invalid symbol type for self from %s" */
#define HB_EI_VMNOTCBLOCK 9017 /* "Codeblock expected from %s" */
#define HB_EI_VMPOPINVITEM 9018 /* "Incorrect item type on the stack trying to pop from %s" */
#define HB_EI_STACKUFLOW 9019 /* "Stack underflow" */
#define HB_EI_ITEMBADCOPY 9020 /* "An item was going to be copied to itself from %s" */
#define HB_EI_MVBADSYMBOL 9021 /* "Invalid symbol item passed as memvar %s" */
#endif /* _ERROR_CH */

View File

@@ -3276,7 +3276,7 @@ HB_FUNC( RDDREGISTER )
* > 1: error
*/
if( hb_rddRegister( szDriver, hb_parni( 2 ) ) > 1 )
hb_errInternal( IE_RDDINVALID, NULL, NULL, NULL );
hb_errInternal( HB_EI_RDDINVALID, NULL, NULL, NULL );
}
}

View File

@@ -91,7 +91,7 @@ void hb_errForceLink()
HB_FUNC( __ERRINHANDLER )
{
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL );
}
HB_FUNC( ERRORBLOCK )
@@ -191,12 +191,12 @@ USHORT hb_errLaunch( PHB_ITEM pError )
/* Check if we have a valid error handler */
if( hb_itemType( &s_errorBlock ) != HB_IT_BLOCK )
hb_errInternal( IE_ERRNOBLOCK, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRNOBLOCK, NULL, NULL, NULL );
/* Check if the error launcher was called too many times recursively */
if( s_iLaunchCount == HB_ERROR_LAUNCH_MAX )
hb_errInternal( IE_ERRTOOMANY, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRTOOMANY, NULL, NULL, NULL );
/* Lock an item to prevent deallocation by the GC - the error object
* can be not assigned to any harbour level variable
@@ -261,7 +261,7 @@ USHORT hb_errLaunch( PHB_ITEM pError )
hb_itemRelease( pResult );
if( bFailure )
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL );
/* Add one try to the counter. */
@@ -269,7 +269,7 @@ USHORT hb_errLaunch( PHB_ITEM pError )
hb_errPutTries( pError, hb_errGetTries( pError ) + 1 );
}
else
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL );
}
else
uiAction = E_RETRY; /* Clipper does this, undocumented */
@@ -300,12 +300,12 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError )
/* Check if we have a valid error handler */
if( hb_itemType( &s_errorBlock ) != HB_IT_BLOCK )
hb_errInternal( IE_ERRNOBLOCK, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRNOBLOCK, NULL, NULL, NULL );
/* Check if the error launcher was called too many times recursively */
if( s_iLaunchCount == HB_ERROR_LAUNCH_MAX )
hb_errInternal( IE_ERRTOOMANY, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRTOOMANY, NULL, NULL, NULL );
/* Lock an item to prevent deallocation by the GC - the error object
* can be not assigned to any harbour level variable
@@ -354,7 +354,7 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError )
consider it as a failure. */
if( ! ( hb_errGetFlags( pError ) & EF_CANSUBSTITUTE ) )
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
hb_errInternal( HB_EI_ERRRECFAILURE, NULL, NULL, NULL );
}
}
else

View File

@@ -867,7 +867,7 @@ HB_FUNC( __CLSADDMSG )
default:
hb_errInternal( IE_CLSINVMETHOD, NULL, "__clsAddMsg", NULL );
hb_errInternal( HB_EI_CLSINVMETHOD, NULL, "__clsAddMsg", NULL );
break;
}
}

View File

@@ -182,7 +182,7 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail
pMem = malloc( ulSize + sizeof( HB_MEMINFO ) );
if( ! pMem )
hb_errInternal( IE_XGRABALLOC, NULL, NULL, NULL );
hb_errInternal( HB_EI_XGRABALLOC, NULL, NULL, NULL );
if( ! s_pFirstBlock )
{
@@ -239,7 +239,7 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail
pMem = malloc( ulSize );
if( ! pMem )
hb_errInternal( IE_XGRABALLOC, NULL, NULL, NULL );
hb_errInternal( HB_EI_XGRABALLOC, NULL, NULL, NULL );
return pMem;
@@ -256,12 +256,12 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */
HB_TRACE_STEALTH(HB_TR_DEBUG, ("hb_xrealloc(%p, %lu)", pMem, ulSize));
if( ! pMem )
hb_errInternal( IE_XREALLOCNULL, NULL, NULL, NULL );
hb_errInternal( HB_EI_XREALLOCNULL, NULL, NULL, NULL );
pMemBlock = ( PHB_MEMINFO ) ( ( char * ) pMem - sizeof( HB_MEMINFO ) );
if( pMemBlock->ulSignature != HB_MEMINFO_SIGNATURE )
hb_errInternal( IE_XREALLOCINV, NULL, NULL, NULL );
hb_errInternal( HB_EI_XREALLOCINV, NULL, NULL, NULL );
ulMemSize = pMemBlock->ulSize;
@@ -272,7 +272,7 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */
s_lMemoryMaxConsumed = s_lMemoryConsumed;
if( ! pMem )
hb_errInternal( IE_XREALLOC, NULL, NULL, NULL );
hb_errInternal( HB_EI_XREALLOC, NULL, NULL, NULL );
( ( PHB_MEMINFO ) pMem )->ulSize = ulSize; /* size of the memory block */
if( ( ( PHB_MEMINFO ) pMem )->pPrevBlock )
@@ -292,12 +292,12 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */
HB_TRACE(HB_TR_DEBUG, ("hb_xrealloc(%p, %lu)", pMem, ulSize));
if( ! pMem )
hb_errInternal( IE_XREALLOCNULL, NULL, NULL, NULL );
hb_errInternal( HB_EI_XREALLOCNULL, NULL, NULL, NULL );
pMem = realloc( pMem, ulSize );
if( ! pMem )
hb_errInternal( IE_XREALLOC, NULL, NULL, NULL );
hb_errInternal( HB_EI_XREALLOC, NULL, NULL, NULL );
return pMem;
@@ -315,7 +315,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
PHB_MEMINFO pMemBlock = ( PHB_MEMINFO ) ( ( char * ) pMem - sizeof( HB_MEMINFO ) );
if( pMemBlock->ulSignature != HB_MEMINFO_SIGNATURE )
hb_errInternal( IE_XFREEINV, NULL, NULL, NULL );
hb_errInternal( HB_EI_XFREEINV, NULL, NULL, NULL );
s_lMemoryConsumed -= pMemBlock->ulSize;
s_lMemoryBlocks--;
@@ -333,7 +333,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
free( ( void * ) pMemBlock );
}
else
hb_errInternal( IE_XFREENULL, NULL, NULL, NULL );
hb_errInternal( HB_EI_XFREENULL, NULL, NULL, NULL );
#else
@@ -342,7 +342,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
if( pMem )
free( pMem );
else
hb_errInternal( IE_XFREENULL, NULL, NULL, NULL );
hb_errInternal( HB_EI_XFREENULL, NULL, NULL, NULL );
#endif
}

View File

@@ -140,27 +140,28 @@ void hb_gcFree( void *pBlock )
}
else
{
hb_errInternal( IE_XFREENULL, NULL, NULL, NULL );
hb_errInternal( HB_EI_XFREENULL, NULL, NULL, NULL );
}
}
/* Lock a memory pointer so it will not be released if stored
outside of harbour variables
*/
void *hb_gcLock( void *pBlock )
void * hb_gcLock( void * pBlock )
{
if( pBlock )
{
HB_GARBAGE_PTR pAlloc = ( HB_GARBAGE_PTR ) pBlock;
--pAlloc;
if( !pAlloc->locked )
if( ! pAlloc->locked )
{
hb_gcUnlink( &s_pCurrBlock, pAlloc );
hb_gcLink( &s_pLockedBlock, pAlloc );
}
++pAlloc->locked;
}
return pBlock;
}

View File

@@ -299,12 +299,12 @@ void hb_vmInit( BOOL bStartMainProc )
if( pDynSym && pDynSym->pSymbol->pFunPtr )
s_pSymStart = pDynSym->pSymbol;
else
hb_errInternal( IE_VMBADSTARTUP, NULL, HARBOUR_START_PROCEDURE, NULL );
hb_errInternal( HB_EI_VMBADSTARTUP, NULL, HARBOUR_START_PROCEDURE, NULL );
}
#else
#ifndef HB_C52_STRICT
else if( ! s_pSymStart )
hb_errInternal( IE_VMNOSTARTUP, NULL, NULL, NULL );
hb_errInternal( HB_EI_VMNOSTARTUP, NULL, NULL, NULL );
#endif
#endif
}
@@ -1329,7 +1329,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
default:
/* TODO: Include to failing pcode in the error message */
hb_errInternal( IE_VMBADOPCODE, NULL, NULL, NULL );
hb_errInternal( HB_EI_VMBADOPCODE, NULL, NULL, NULL );
break;
}
@@ -1798,7 +1798,7 @@ static void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes
hb_vmPushLong( ( ULONG ) pItem->item.asSymbol.value->pFunPtr );
}
else
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmFuncPtr()", NULL );
hb_errInternal( HB_EI_VMNOTSYMBOL, NULL, "hb_vmFuncPtr()", NULL );
}
/* ------------------------------- */
@@ -2752,7 +2752,7 @@ void hb_vmDo( USHORT uiParams )
{
/* QUESTION: Is this call needed ? [vszakats] */
hb_stackDispLocal();
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmDo()", NULL );
hb_errInternal( HB_EI_VMNOTSYMBOL, NULL, "hb_vmDo()", NULL );
}
pItem->item.asSymbol.lineno = 0;
@@ -2850,7 +2850,7 @@ void hb_vmSend( USHORT uiParams )
{
/* QUESTION: Is this call needed ? [vszakats] */
hb_stackDispLocal();
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmSend()", NULL );
hb_errInternal( HB_EI_VMNOTSYMBOL, NULL, "hb_vmSend()", NULL );
}
pItem->item.asSymbol.lineno = 0;
@@ -2934,7 +2934,7 @@ static HARBOUR hb_vmDoBlock( void )
uiStackBase = hb_stack.pBase - hb_stack.pItems; /* as the stack memory block could change */
if( ! HB_IS_BLOCK( pBlock ) )
hb_errInternal( IE_VMNOTCBLOCK, NULL, "hb_vmDoBlock()", NULL );
hb_errInternal( HB_EI_VMNOTCBLOCK, NULL, "hb_vmDoBlock()", NULL );
/* Check for valid count of parameters */
iParam = pBlock->item.asBlock.paramcnt - hb_pcount();
@@ -3661,7 +3661,7 @@ static double hb_vmPopNumber( void )
default:
dNumber = 0; /* To avoid GCC -O2 warning */
hb_errInternal( IE_VMPOPINVITEM, NULL, "hb_vmPopNumber()", NULL );
hb_errInternal( HB_EI_VMPOPINVITEM, NULL, "hb_vmPopNumber()", NULL );
break;
}
@@ -3701,7 +3701,7 @@ static double hb_vmPopDouble( int * piDec )
default:
dNumber = 0; /* To avoid GCC -O2 warning */
hb_errInternal( IE_VMPOPINVITEM, NULL, "hb_vmPopDouble()", NULL );
hb_errInternal( HB_EI_VMPOPINVITEM, NULL, "hb_vmPopDouble()", NULL );
break;
}
@@ -3848,7 +3848,7 @@ void hb_stackPop( void )
HB_TRACE(HB_TR_DEBUG, ("hb_stackPop()"));
if( --hb_stack.pPos < hb_stack.pItems )
hb_errInternal( IE_STACKUFLOW, NULL, NULL, NULL );
hb_errInternal( HB_EI_STACKUFLOW, NULL, NULL, NULL );
if( hb_stack.pPos->type != HB_IT_NIL )
hb_itemClear( hb_stack.pPos );
@@ -3859,7 +3859,7 @@ static void hb_stackDec( void )
HB_TRACE(HB_TR_DEBUG, ("hb_stackDec()"));
if( --hb_stack.pPos < hb_stack.pItems )
hb_errInternal( IE_STACKUFLOW, NULL, NULL, NULL );
hb_errInternal( HB_EI_STACKUFLOW, NULL, NULL, NULL );
}
static void hb_stackFree( void )

View File

@@ -1053,7 +1053,7 @@ void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource )
hb_itemClear( pDest );
if( pDest == pSource )
hb_errInternal( IE_ITEMBADCOPY, NULL, "hb_itemCopy()", NULL );
hb_errInternal( HB_EI_ITEMBADCOPY, NULL, "hb_itemCopy()", NULL );
memcpy( pDest, pSource, sizeof( HB_ITEM ) );

View File

@@ -382,7 +382,7 @@ void hb_memvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem )
}
}
else
hb_errInternal( IE_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
hb_errInternal( HB_EI_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
}
ERRCODE hb_memvarGet( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb )
@@ -410,7 +410,7 @@ ERRCODE hb_memvarGet( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb )
}
}
else
hb_errInternal( IE_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
hb_errInternal( HB_EI_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
return bSuccess;
}
@@ -495,7 +495,7 @@ void hb_memvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb )
}
}
else
hb_errInternal( IE_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
hb_errInternal( HB_EI_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
}
/*