20000415-05:12 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-04-15 03:09:29 +00:00
parent c029e2efaa
commit ce2c427df3
16 changed files with 104 additions and 96 deletions

View File

@@ -1,3 +1,17 @@
20000415-05:12 GMT+1 Victor Szakats <info@szelvesz.hu>
* include/error.ch
* source/rdd/dbcmd.c
* source/rtl/errorapi.c
* source/vm/classes.c
* source/vm/fm.c
* source/vm/hvm.c
* source/vm/itemapi.c
* source/vm/memvars.c
* source/lang/*.c
+ All internal error texts converted to support multi-language.
Also the internal error code are now correctly set.
20000415-03:32 GMT+1 Victor Szakats <info@szelvesz.hu>
* include/error.ch

View File

@@ -91,28 +91,28 @@
#define EG_CONDITION 50 /* Harbour special */
/* Internal errors */
#define IE_ERRUNRECOV 9000
#define IE_ERRRECFAILURE 9001
#define IE_ERRNOBLOCK 9002
#define IE_ERRTOOMANY 9003
#define IE_RDDINVALID 9004
#define IE_CLSINVMETHOD 9005
#define IE_XGRABALLOC 9006
#define IE_XREALLOCNULL 9007
#define IE_XREALLOCINV 9008
#define IE_XREALLOC 9009
#define IE_XFREEINV 9010
#define IE_XFREENULL 9011
#define IE_VMBADSTARTUP 9012
#define IE_VMNOSTARTUP 9013
#define IE_VMBADOPCODE 9014
#define IE_VMNOTSYMBOL 9015
#define IE_VMINVSYMBOL 9016
#define IE_VMNOTCBLOCK 9017
#define IE_VMNOTNUMBER 9018
#define IE_VMNOTDOUBLE 9019
#define IE_STACKUFLOW 9020
#define IE_ITEMBADCOPY 9021
#define IE_MVBADSYMBOL 9022
#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"
#endif /* _ERROR_CH */

View File

@@ -54,8 +54,8 @@ extern "C" {
#define HB_LANG_ITEM_BASE_NATMSG 25
#define HB_LANG_ITEM_BASE_ERRDESC 38
#define HB_LANG_ITEM_BASE_ERRINTR 89
#define HB_LANG_ITEM_BASE_TEXT 112
#define HB_LANG_ITEM_MAX_ 115
#define HB_LANG_ITEM_BASE_TEXT 111
#define HB_LANG_ITEM_MAX_ 114
typedef struct _HB_LANG
{

View File

@@ -164,12 +164,11 @@ static HB_LANG s_lang =
"No starting procedure",
"Unsupported VM opcode",
"Symbol item expected from %s",
"Invalid symbol type for self from hb_vmDo()",
"Codeblock expected from hb_vmDoBlock()",
"Incorrect item type on the stack trying to pop a number",
"Incorrect item type on the stack trying to pop a double",
"Invalid symbol type for self from %s",
"Codeblock expected from %s",
"Incorrect item type on the stack trying to pop from %s",
"Stack underflow",
"An item was going to be copied to itself from hb_itemCopy()",
"An item was going to be copied to itself from %s",
"Invalid symbol item passed as memvar %s",
/* Texts */

View File

@@ -164,12 +164,11 @@ static HB_LANG s_lang =
"No starting procedure",
"Unsupported VM opcode",
"Symbol item expected from %s",
"Invalid symbol type for self from hb_vmDo()",
"Codeblock expected from hb_vmDoBlock()",
"Incorrect item type on the stack trying to pop a number",
"Incorrect item type on the stack trying to pop a double",
"Invalid symbol type for self from %s",
"Codeblock expected from %s",
"Incorrect item type on the stack trying to pop from %s",
"Stack underflow",
"An item was going to be copied to itself from hb_itemCopy()",
"An item was going to be copied to itself from %s",
"Invalid symbol item passed as memvar %s",
/* Texts */

View File

@@ -164,12 +164,11 @@ static HB_LANG s_lang =
"No starting procedure",
"Unsupported VM opcode",
"Symbol item expected from %s",
"Invalid symbol type for self from hb_vmDo()",
"Codeblock expected from hb_vmDoBlock()",
"Incorrect item type on the stack trying to pop a number",
"Incorrect item type on the stack trying to pop a double",
"Invalid symbol type for self from %s",
"Codeblock expected from %s",
"Incorrect item type on the stack trying to pop from %s",
"Stack underflow",
"An item was going to be copied to itself from hb_itemCopy()",
"An item was going to be copied to itself from %s",
"Invalid symbol item passed as memvar %s",
/* Texts */

View File

@@ -152,8 +152,8 @@ static HB_LANG s_lang =
"Error recovery failure",
"No ERRORBLOCK() for error",
"Too many recursive error handler calls",
"RDD invalid of failed to load",
"Invalid method type from __clsAddMsg",
"RDD invalid or failed to load",
"Invalid method type from %s",
"hb_xgrab can't allocate memory",
"hb_xrealloc called with a NULL pointer",
"hb_xrealloc called with an invalid pointer",
@@ -164,12 +164,11 @@ static HB_LANG s_lang =
"No starting procedure",
"Unsupported VM opcode",
"Symbol item expected from %s",
"Invalid symbol type for self from hb_vmDo()",
"Codeblock expected from hb_vmDoBlock()",
"Incorrect item type on the stack trying to pop a number",
"Incorrect item type on the stack trying to pop a double",
"Invalid symbol type for self from %s",
"Codeblock expected from %s",
"Incorrect item type on the stack trying to pop from %s",
"Stack underflow",
"An item was going to be copied to itself from hb_itemCopy()",
"An item was going to be copied to itself from %s",
"Invalid symbol item passed as memvar %s",
/* Texts */

View File

@@ -152,8 +152,8 @@ static HB_LANG s_lang =
"Error recovery failure",
"No ERRORBLOCK() for error",
"Too many recursive error handler calls",
"RDD invalid of failed to load",
"Invalid method type from __clsAddMsg",
"RDD invalid or failed to load",
"Invalid method type from %s",
"hb_xgrab can't allocate memory",
"hb_xrealloc called with a NULL pointer",
"hb_xrealloc called with an invalid pointer",
@@ -164,12 +164,11 @@ static HB_LANG s_lang =
"No starting procedure",
"Unsupported VM opcode",
"Symbol item expected from %s",
"Invalid symbol type for self from hb_vmDo()",
"Codeblock expected from hb_vmDoBlock()",
"Incorrect item type on the stack trying to pop a number",
"Incorrect item type on the stack trying to pop a double",
"Invalid symbol type for self from %s",
"Codeblock expected from %s",
"Incorrect item type on the stack trying to pop from %s",
"Stack underflow",
"An item was going to be copied to itself from hb_itemCopy()",
"An item was going to be copied to itself from %s",
"Invalid symbol item passed as memvar %s",
/* Texts */

View File

@@ -164,12 +164,11 @@ static HB_LANG s_lang =
"No starting procedure",
"Unsupported VM opcode",
"Symbol item expected from %s",
"Invalid symbol type for self from hb_vmDo()",
"Codeblock expected from hb_vmDoBlock()",
"Incorrect item type on the stack trying to pop a number",
"Incorrect item type on the stack trying to pop a double",
"Stack underflow",
"An item was going to be copied to itself from hb_itemCopy()",
"Invalid symbol type for self from %s",
"Codeblock expected from %s",
"Incorrect item type on the stack trying to pop from %s",
"Stack underflow",
"An item was going to be copied to itself from %s",
"Invalid symbol item passed as memvar %s",
/* Texts */

View File

@@ -3293,7 +3293,7 @@ HB_FUNC( RDDREGISTER )
* > 1: error
*/
if( hb_rddRegister( szDriver, hb_parni( 2 ) ) > 1 )
hb_errInternal( 9999, "RDD invalid of failed to load", NULL, NULL );
hb_errInternal( IE_RDDINVALID, NULL, NULL, NULL );
}
}

View File

@@ -90,7 +90,7 @@ void hb_errForceLink()
HB_FUNC( __ERRINHANDLER )
{
hb_errInternal( 9999, "Error recovery failure", NULL, NULL );
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
}
HB_FUNC( ERRORBLOCK )
@@ -177,12 +177,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( 9999, "No ERRORBLOCK() for error", NULL, NULL );
hb_errInternal( IE_ERRNOBLOCK, NULL, NULL, NULL );
/* Check if the error launcher was called too many times recursively */
if( s_iLaunchCount == HB_ERROR_LAUNCH_MAX )
hb_errInternal( 9999, "Too many recursive error handler calls", NULL, NULL );
hb_errInternal( IE_ERRTOOMANY, NULL, NULL, NULL );
/* Launch the error handler: "lResult := EVAL( ErrorBlock(), oError )" */
@@ -241,7 +241,7 @@ USHORT hb_errLaunch( PHB_ITEM pError )
hb_itemRelease( pResult );
if( bFailure )
hb_errInternal( 9999, "Error recovery failure", NULL, NULL );
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
/* Add one try to the counter. */
@@ -249,7 +249,7 @@ USHORT hb_errLaunch( PHB_ITEM pError )
hb_errPutTries( pError, hb_errGetTries( pError ) + 1 );
}
else
hb_errInternal( 9999, "Error recovery failure", NULL, NULL );
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
}
else
uiAction = E_RETRY; /* Clipper does this, undocumented */
@@ -280,12 +280,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( 9999, "No ERRORBLOCK() for error", NULL, NULL );
hb_errInternal( IE_ERRNOBLOCK, NULL, NULL, NULL );
/* Check if the error launcher was called too many times recursively */
if( s_iLaunchCount == HB_ERROR_LAUNCH_MAX )
hb_errInternal( 9999, "Too many recursive ERRORBLOCK() calls", NULL, NULL );
hb_errInternal( IE_ERRTOOMANY, NULL, NULL, NULL );
/* Launch the error handler: "xResult := EVAL( ErrorBlock(), oError )" */
@@ -328,7 +328,7 @@ PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError )
consider it as a failure. */
if( ! ( hb_errGetFlags( pError ) & EF_CANSUBSTITUTE ) )
hb_errInternal( 9999, "Error recovery failure", NULL, NULL );
hb_errInternal( IE_ERRRECFAILURE, NULL, NULL, NULL );
}
}
else
@@ -793,7 +793,7 @@ void hb_errInternal( ULONG ulIntCode, char * szText, char * szPar1, char * szPar
HB_TRACE(HB_TR_DEBUG, ("hb_errInternal(%lu, %s, %s, %s)", ulIntCode, szText, szPar1, szPar2));
hb_conOutErr( hb_conNewLine(), 0 );
sprintf( buffer, "Unrecoverable error %lu: ", ulIntCode );
sprintf( buffer, ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ERRINTR ), ulIntCode );
hb_conOutErr( buffer, 0 );
sprintf( buffer, szText != NULL ? szText : ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ERRINTR + ulIntCode - 9000 ), szPar1, szPar2 );
hb_conOutErr( buffer, 0 );

View File

@@ -503,7 +503,7 @@ HB_FUNC( __CLSADDMSG )
break;
default:
hb_errInternal( 9999, "Invalid method type from __clsAddMsg", NULL, NULL );
hb_errInternal( IE_CLSINVMETHOD, NULL, "__clsAddMsg", NULL );
break;
}
}

View File

@@ -176,7 +176,7 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail
pMem = malloc( ulSize + sizeof( HB_MEMINFO ) );
if( ! pMem )
hb_errInternal( 9999, "hb_xgrab can't allocate memory", NULL, NULL );
hb_errInternal( IE_XGRABALLOC, NULL, NULL, NULL );
if( ! s_pFirstBlock )
{
@@ -233,7 +233,7 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail
pMem = malloc( ulSize );
if( ! pMem )
hb_errInternal( 9999, "hb_xgrab can't allocate memory", NULL, NULL );
hb_errInternal( IE_XGRABALLOC, NULL, NULL, NULL );
return pMem;
@@ -250,12 +250,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( 9999, "hb_xrealloc called with a NULL pointer", NULL, NULL );
hb_errInternal( IE_XREALLOCNULL, NULL, NULL, NULL );
pMemBlock = ( PHB_MEMINFO ) ( ( char * ) pMem - sizeof( HB_MEMINFO ) );
if( pMemBlock->ulSignature != HB_MEMINFO_SIGNATURE )
hb_errInternal( 9999, "hb_xrealloc called with an invalid pointer", NULL, NULL );
hb_errInternal( IE_XREALLOCINV, NULL, NULL, NULL );
ulMemSize = pMemBlock->ulSize;
@@ -266,7 +266,7 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */
s_lMemoryMaxConsumed = s_lMemoryConsumed;
if( ! pMem )
hb_errInternal( 9999, "hb_xrealloc can't reallocate memory", NULL, NULL );
hb_errInternal( IE_XREALLOC, NULL, NULL, NULL );
( ( PHB_MEMINFO ) pMem )->ulSize = ulSize; /* size of the memory block */
if( ( ( PHB_MEMINFO ) pMem )->pPrevBlock )
@@ -286,12 +286,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( 9999, "hb_xrealloc called with a NULL pointer", NULL, NULL );
hb_errInternal( IE_XREALLOCNULL, NULL, NULL, NULL );
pMem = realloc( pMem, ulSize );
if( ! pMem )
hb_errInternal( 9999, "hb_xrealloc can't reallocate memory", NULL, NULL );
hb_errInternal( IE_XREALLOC, NULL, NULL, NULL );
return pMem;
@@ -309,7 +309,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( 9999, "hb_xfree called with an invalid pointer", NULL, NULL );
hb_errInternal( IE_XFREEINV, NULL, NULL, NULL );
s_lMemoryConsumed -= pMemBlock->ulSize;
s_lMemoryBlocks--;
@@ -327,7 +327,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
free( ( void * ) pMemBlock );
}
else
hb_errInternal( 9999, "hb_xfree called with a NULL pointer", NULL, NULL );
hb_errInternal( IE_XFREENULL, NULL, NULL, NULL );
#else
@@ -336,7 +336,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
if( pMem )
free( pMem );
else
hb_errInternal( 9999, "hb_xfree called with a NULL pointer", NULL, NULL );
hb_errInternal( IE_XFREENULL, NULL, NULL, NULL );
#endif
}

View File

@@ -290,12 +290,12 @@ void hb_vmInit( BOOL bStartMainProc )
if( pDynSym && pDynSym->pSymbol->pFunPtr )
s_pSymStart = pDynSym->pSymbol;
else
hb_errInternal( 9999, "Can\'t locate the starting procedure: \'%s\'", HARBOUR_START_PROCEDURE, NULL );
hb_errInternal( IE_VMBADSTARTUP, NULL, HARBOUR_START_PROCEDURE, NULL );
}
#else
#ifndef HB_C52_STRICT
else if( ! s_pSymStart )
hb_errInternal( 9999, "No starting procedure", NULL, NULL );
hb_errInternal( IE_VMNOSTARTUP, NULL, NULL, NULL );
#endif
#endif
}
@@ -1154,7 +1154,7 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
default:
/* TODO: Include to failing pcode in the error message */
hb_errInternal( 9999, "Unsupported VM opcode", NULL, NULL );
hb_errInternal( IE_VMBADOPCODE, NULL, NULL, NULL );
break;
}
@@ -1618,7 +1618,7 @@ static void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes
hb_vmPushLong( ( ULONG ) pItem->item.asSymbol.value->pFunPtr );
}
else
hb_errInternal( 9999, "Symbol item expected from hb_vmFuncPtr()", NULL, NULL );
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmFuncPtr()", NULL );
}
/* ------------------------------- */
@@ -2552,7 +2552,7 @@ void hb_vmDo( USHORT uiParams )
{
/* QUESTION: Is this call needed ? [vszakats] */
hb_stackDispLocal();
hb_errInternal( 9999, "Symbol item expected as a base from hb_vmDo()", NULL, NULL );
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmDo()", NULL );
}
#if 0
@@ -2560,7 +2560,7 @@ void hb_vmDo( USHORT uiParams )
{
/* QUESTION: Is this call needed ? [vszakats] */
hb_stackDispLocal();
hb_errInternal( 9999, "Invalid symbol type for self from hb_vmDo()", NULL, NULL );
hb_errInternal( IE_VMINVSYMBOL, NULL, "hb_vmDo()", NULL );
}
#endif
@@ -2645,7 +2645,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( 9999, "Codeblock expected from hb_vmDoBlock()", NULL, NULL );
hb_errInternal( IE_VMNOTCBLOCK, NULL, "hb_vmDoBlock()", NULL );
/* Check for valid count of parameters */
iParam = pBlock->item.asBlock.paramcnt - hb_pcount();
@@ -3283,7 +3283,7 @@ static double hb_vmPopNumber( void )
break;
default:
hb_errInternal( 9999, "Incorrect item type on the stack trying to pop a number", NULL, NULL );
hb_errInternal( IE_VMPOPINVITEM, NULL, "hb_vmPopNumber()", NULL );
break;
}
@@ -3322,7 +3322,7 @@ static double hb_vmPopDouble( int * piDec )
break;
default:
hb_errInternal( 9999, "Incorrect item type on the stack trying to pop a double", NULL, NULL );
hb_errInternal( IE_VMPOPINVITEM, NULL, "hb_vmPopDouble()", NULL );
break;
}
@@ -3469,7 +3469,7 @@ void hb_stackPop( void )
HB_TRACE(HB_TR_DEBUG, ("hb_stackPop()"));
if( --hb_stack.pPos < hb_stack.pItems )
hb_errInternal( 9999, "Stack underflow", NULL, NULL );
hb_errInternal( IE_STACKUFLOW, NULL, NULL, NULL );
if( hb_stack.pPos->type != HB_IT_NIL )
hb_itemClear( hb_stack.pPos );
@@ -3480,7 +3480,7 @@ static void hb_stackDec( void )
HB_TRACE(HB_TR_DEBUG, ("hb_stackDec()"));
if( --hb_stack.pPos < hb_stack.pItems )
hb_errInternal( 9999, "Stack underflow", NULL, NULL );
hb_errInternal( IE_STACKUFLOW, NULL, NULL, NULL );
}
static void hb_stackFree( void )

View File

@@ -1035,7 +1035,7 @@ void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource )
hb_itemClear( pDest );
if( pDest == pSource )
hb_errInternal( 9999, "An item was going to be copied to itself from hb_itemCopy()", NULL, NULL );
hb_errInternal( IE_ITEMBADCOPY, NULL, "hb_itemCopy()", NULL );
memcpy( pDest, pSource, sizeof( HB_ITEM ) );

View File

@@ -390,7 +390,7 @@ void hb_memvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem )
}
}
else
hb_errInternal( 9999, "Invalid symbol item passed as memvar %s", pMemvarSymb->szName, NULL );
hb_errInternal( IE_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
}
ERRCODE hb_memvarGet( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb )
@@ -418,7 +418,7 @@ ERRCODE hb_memvarGet( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb )
}
}
else
hb_errInternal( 9999, "Invalid symbol item passed as memvar %s", pMemvarSymb->szName, NULL );
hb_errInternal( IE_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
return bSuccess;
}
@@ -503,7 +503,7 @@ void hb_memvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb )
}
}
else
hb_errInternal( 9999, "Invalid symbol item passed as memvar %s", pMemvarSymb->szName, NULL );
hb_errInternal( IE_MVBADSYMBOL, NULL, pMemvarSymb->szName, NULL );
}
/*