19990917-13:30 GMT+1

This commit is contained in:
Viktor Szakats
1999-09-17 11:43:26 +00:00
parent bd83a913a1
commit 9044ed5453
12 changed files with 281 additions and 260 deletions

View File

@@ -1,3 +1,36 @@
19990917-13:30 GMT+1 Victor Szel <info@szelvesz.hu>
* source/rtl/codebloc.c
include/extend.h
* WORD -> USHORT for codeblocks.
* source/rtl/transfrm.c
% Internal vmDo() call replaced with standard API functions.
! Internal error removed, direct buffer string modification resolved.
* source/rtl/objfunc.prg
+ Explcitly repeated function names in the __ERR*() call changed to
PROCNAME(0).
* source/vm/hvm.c
include/ctoharb.h
include/init.h
! Typo fixed.
* WORD -> USHORT (for parameter count, local/static indexes and almost
all the others)
Only one WORD declaration stayed, this one is related to OBJ generation
and SYMBOLS.ASM, so it should have strictly fixed size.
; Here comes to mind that the PCODE model should have a clear definition on
the byte level, so that VMs could process pcode byte stream compiled
on any platform, we are almost there, but for example storing a DOUBLE
directly in the pcode could cause portability problems.
* source/rdd/dbcmd.c
+ WORD -> USHORT (wLen)
% HB_USED() small opt.
* source/compiler/harbour.y
* pOutPath made global and renamed to _pOutPath
* "Functions %i" -> "Functions/Procedures %i"
* source/rtl/console.c
% __SHADOW() param checking logic simplified and corrected.
% DISPOUT(), DEVOUT() one ISCHAR() call removed so it's a bit faster now.
19990917-11:30 GMT+1 Victor Szel <info@szelvesz.hu>
* include/ctoharb.h

View File

@@ -71,7 +71,7 @@
/* Harbour virtual machine functions */
extern void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */
extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */
extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ); /* statics symbols initialization */
extern void hb_vmSymbolInit_RT( void ); /* initialization of runtime support symbols */
/* Harbour virtual machine escaping API */
@@ -126,7 +126,7 @@ extern void hb_vmOperatorCallUnary( PHB_ITEM, char * ); /* call an overloaded
/* Execution */
extern void hb_vmFrame( BYTE bLocals, BYTE bParams ); /* increases the stack pointer for the amount of locals and params suplied */
extern void hb_vmLocalName( WORD wLocal, char * szLocalName ); /* locals and parameters index and name information for the debugger */
extern void hb_vmLocalName( USHORT uiLocal, char * szLocalName ); /* locals and parameters index and name information for the debugger */
extern void hb_vmModuleName( char * szModuleName ); /* PRG and function name information for the debugger */
extern void hb_vmSFrame( PHB_SYMB pSym ); /* sets the statics frame for a function */
extern void hb_vmStatics( PHB_SYMB pSym ); /* increases the the global statics array to hold a PRG statics */
@@ -134,9 +134,9 @@ extern void hb_vmRetValue( void ); /* pops the latest stack value i
extern void hb_vmEndBlock( void ); /* copies the last codeblock pushed value into the return value */
/* Misc */
extern void hb_vmDo( WORD WParams ); /* invoke the virtual machine */
extern void hb_vmDo( USHORT uiParams ); /* invoke the virtual machine */
extern HARBOUR hb_vmDoBlock( void ); /* executes a codeblock */
extern void hb_vmFunction( WORD wParams ); /* executes a function saving its result */
extern void hb_vmFunction( USHORT uiParams ); /* executes a function saving its result */
extern void hb_vmDuplicate( void ); /* duplicates the latest value on the stack */
extern void hb_vmDuplTwo( void ); /* duplicates the latest two value on the stack */
extern void hb_vmForTest( void ); /* test for end condition of for */
@@ -155,8 +155,8 @@ extern void hb_vmPushBlock( BYTE * pCode, PHB_SYMB pSymbols ); /* creates a c
extern void hb_vmPushSymbol( PHB_SYMB pSym ); /* pushes a function pointer onto the stack */
extern void hb_vmPushLocal( SHORT iLocal ); /* pushes the containts of a local onto the stack */
extern void hb_vmPushLocalByRef( SHORT iLocal ); /* pushes a local by refrence onto the stack */
extern void hb_vmPushStatic( WORD wStatic ); /* pushes the containts of a static onto the stack */
extern void hb_vmPushStaticByRef( WORD iLocal ); /* pushes a static by refrence onto the stack */
extern void hb_vmPushStatic( USHORT uiStatic ); /* pushes the containts of a static onto the stack */
extern void hb_vmPushStaticByRef( USHORT uiLocal ); /* pushes a static by refrence onto the stack */
/* Pop */
extern long hb_vmPopDate( void ); /* pops the stack latest value and returns its date value as a LONG */
@@ -164,8 +164,8 @@ extern double hb_vmPopNumber( void ); /* pops the stack latest value a
extern double hb_vmPopDouble( int * ); /* pops the stack latest value and returns its double numeric format value */
extern BOOL hb_vmPopLogical( void ); /* pops the stack latest value and returns its logical value */
extern void hb_vmPopLocal( SHORT iLocal ); /* pops the stack latest value onto a local */
extern void hb_vmPopStatic( WORD wStatic ); /* pops the stack latest value onto a static */
extern void hb_vmPopDefStat( WORD wStatic ); /* pops the stack latest value onto a static as default init */
extern void hb_vmPopStatic( USHORT uiStatic ); /* pops the stack latest value onto a static */
extern void hb_vmPopDefStat( USHORT uiStatic ); /* pops the stack latest value onto a static as default init */
/* stack management functions */
extern void hb_stackDec( void ); /* pops an item from the stack without clearing it's contents */

View File

@@ -218,9 +218,9 @@ typedef struct _HB_CODEBLOCK
{
BYTE * pCode; /* codeblock pcode */
PHB_ITEM pLocals; /* table with referenced local variables */
WORD wLocals; /* number of referenced local variables */
USHORT uiLocals; /* number of referenced local variables */
PHB_SYMB pSymbols; /* codeblocks symbols */
ULONG lCounter; /* numer of references to this codeblock */
ULONG ulCounter; /* numer of references to this codeblock */
} HB_CODEBLOCK, * PHB_CODEBLOCK, * HB_CODEBLOCK_PTR;
typedef struct _HB_VALUE
@@ -348,7 +348,7 @@ extern void hb_dynsymEval( PHB_DYNS_FUNC, void * ); /* enumerates all dyna
extern PHB_SYMB hb_symbolNew( char * szName );
/* Codeblock management */
extern HB_CODEBLOCK_PTR hb_codeblockNew( BYTE *, WORD, WORD *, PHB_SYMB );
extern HB_CODEBLOCK_PTR hb_codeblockNew( BYTE *, USHORT, USHORT *, PHB_SYMB );
extern void hb_codeblockDelete( PHB_ITEM );
extern PHB_ITEM hb_codeblockGetVar( PHB_ITEM, LONG );
extern PHB_ITEM hb_codeblockGetRef( PHB_ITEM, PHB_ITEM );

View File

@@ -36,7 +36,7 @@
#ifndef HB_INIT_H_
#define HB_INIT_H_
extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */
extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, USHORT uiSymbols ); /* statics symbols initialization */
#ifdef HARBOUR_STRICT_ANSI_C

View File

@@ -461,6 +461,7 @@ PEXTERN pExterns = NULL;
PTR_LOOPEXIT pLoops = NULL;
PATHNAMES *_pIncludePath = NULL;
PHB_FNAME _pFileName = NULL;
PHB_FNAME _pOutPath = NULL;
ALIASID_PTR pAliasId = NULL;
ULONG _ulLastLinePos = 0; /* position of last opcode with line number */
BOOL _bDontGenLineNum = FALSE; /* suppress line number generation */
@@ -537,7 +538,7 @@ extern int _iState; /* current parser state (defined in harbour.l */
Main : { Line(); } Source {
FixReturns(); /* fix all previous function returns offsets */
if( ! _bQuiet )
printf( "\rLines %i, Functions %i\n", iLine, iFunctions );
printf( "\rLines %i, Functions/Procedures %i\n", iLine, iFunctions );
}
Source : Crlf
@@ -1372,9 +1373,9 @@ int harbour_main( int argc, char * argv[] )
{
char szFileName[ _POSIX_PATH_MAX ]; /* filename to parse */
char szPpoName[ _POSIX_PATH_MAX ];
PHB_FNAME pOutPath = NULL;
_pFileName = NULL;
_pOutPath = NULL;
Hbpp_init(); /* Initialization of preprocessor arrays */
/* Command line options */
@@ -1523,7 +1524,7 @@ int harbour_main( int argc, char * argv[] )
case 'o':
case 'O':
pOutPath = hb_fsFNameSplit( argv[ iArg ] + 2 );
_pOutPath = hb_fsFNameSplit( argv[ iArg ] + 2 );
break;
/* Added for preprocessor needs */
@@ -1729,15 +1730,15 @@ int harbour_main( int argc, char * argv[] )
_pFileName->szExtension = NULL;
/* we create a the output file */
if( pOutPath )
if( _pOutPath )
{
if( pOutPath->szPath )
_pFileName->szPath = pOutPath->szPath;
if( pOutPath->szName )
if( _pOutPath->szPath )
_pFileName->szPath = _pOutPath->szPath;
if( _pOutPath->szName )
{
_pFileName->szName = pOutPath->szName;
if( pOutPath->szExtension )
_pFileName->szExtension = pOutPath->szExtension;
_pFileName->szName = _pOutPath->szName;
if( _pOutPath->szExtension )
_pFileName->szExtension = _pOutPath->szExtension;
}
}
@@ -1780,7 +1781,8 @@ int harbour_main( int argc, char * argv[] )
iStatus = 1;
}
hb_xfree( ( void * ) _pFileName );
if( pOutPath ) hb_xfree( pOutPath );
if( _pOutPath )
hb_xfree( _pOutPath );
}
else
PrintUsage( argv[ 0 ] );

View File

@@ -1066,7 +1066,7 @@ HARBOUR HB_DBCREATE( void )
AREAP pTempArea;
USHORT uiSize, uiRddID;
DBOPENINFO pInfo;
WORD wLen;
USHORT uiLen;
PHB_FNAME pFileName;
szFileName = hb_parc( 1 );
@@ -1095,8 +1095,8 @@ HARBOUR HB_DBCREATE( void )
hb_rddCheck();
szDriver = hb_parc( 3 );
if( ( wLen = strlen( szDriver ) ) > 0 )
hb_strUpper( szDriver, wLen );
if( ( uiLen = strlen( szDriver ) ) > 0 )
hb_strUpper( szDriver, uiLen );
else
szDriver = szDefDriver;
@@ -1406,7 +1406,7 @@ HARBOUR HB_DBUNLOCKALL( void )
HARBOUR HB_DBUSEAREA( void )
{
char * szDriver, * szFileName, * szAlias;
WORD wLen;
USHORT uiLen;
LPRDDNODE pRddNode;
LPAREANODE pAreaNode;
USHORT uiSize, uiRddID;
@@ -1440,8 +1440,8 @@ HARBOUR HB_DBUSEAREA( void )
hb_rddCheck();
szDriver = hb_parc( 2 );
if( ( wLen = strlen( szDriver ) ) > 0 )
hb_strUpper( szDriver, wLen );
if( ( uiLen = strlen( szDriver ) ) > 0 )
hb_strUpper( szDriver, uiLen );
else
szDriver = szDefDriver;
@@ -1808,13 +1808,13 @@ HARBOUR HB_RDDNAME( void )
HARBOUR HB_RDDREGISTER( void )
{
char * szDriver;
WORD wLen;
USHORT uiLen;
hb_rddCheck();
szDriver = hb_parc( 1 );
if( ( wLen = strlen( szDriver ) ) > 0 )
if( ( uiLen = strlen( szDriver ) ) > 0 )
{
hb_strUpper( szDriver, wLen );
hb_strUpper( szDriver, uiLen );
/*
* hb_rddRegister returns:
*
@@ -1831,15 +1831,15 @@ HARBOUR HB_RDDREGISTER( void )
HARBOUR HB_RDDSETDEFAULT( void )
{
char * szNewDriver;
WORD wLen;
USHORT uiLen;
hb_rddCheck();
hb_retc( szDefDriver );
szNewDriver = hb_parc( 1 );
if( ( wLen = strlen( szNewDriver ) ) > 0 )
if( ( uiLen = strlen( szNewDriver ) ) > 0 )
{
hb_strUpper( szNewDriver, wLen );
szDefDriver = ( char * ) hb_xrealloc( szDefDriver, wLen + 1 );
hb_strUpper( szNewDriver, uiLen );
szDefDriver = ( char * ) hb_xrealloc( szDefDriver, uiLen + 1 );
strcpy( szDefDriver, szNewDriver );
}
}
@@ -1928,9 +1928,6 @@ HARBOUR HB_SELECT( void )
HARBOUR HB_USED( void )
{
if( pCurrArea )
hb_retl( 1 );
else
hb_retl( 0 );
hb_retl( pCurrArea ? TRUE : FALSE );
}

View File

@@ -50,12 +50,12 @@
* pLocalPosTable -> a table with positions on eval stack for referenced variables
* pSymbols -> a pointer to the module symbol table
*
* Note: pLocalPosTable cannot be used if wLocals is ZERO
* Note: pLocalPosTable cannot be used if uiLocals is ZERO
*
*/
HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
WORD wLocals,
WORD *pLocalPosTable,
USHORT uiLocals,
USHORT * pLocalPosTable,
PHB_SYMB pSymbols )
{
HB_CODEBLOCK_PTR pCBlock;
@@ -64,14 +64,14 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
/* Store the number of referenced local variables
*/
pCBlock->wLocals = wLocals;
if( wLocals )
pCBlock->uiLocals = uiLocals;
if( uiLocals )
{
/* NOTE: if a codeblock will be created by macro compiler then
* wLocal have to be ZERO
* wLocal will be also ZERO if it is a nested codeblock
* uiLocal have to be ZERO
* uiLocal will be also ZERO if it is a nested codeblock
*/
WORD w = 1;
USHORT ui = 1;
PHB_ITEM pLocal;
HB_HANDLE hMemvar;
@@ -79,11 +79,11 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
* accessed in a codeblock
* The element 0 is used as the counter of references to this table
*/
pCBlock->pLocals = ( PHB_ITEM ) hb_xgrab( ( wLocals + 1 ) * sizeof( HB_ITEM ) );
pCBlock->pLocals = ( PHB_ITEM ) hb_xgrab( ( uiLocals + 1 ) * sizeof( HB_ITEM ) );
pCBlock->pLocals[ 0 ].type = IT_LONG;
pCBlock->pLocals[ 0 ].item.asLong.value = 1;
while( wLocals-- )
while( uiLocals-- )
{
/* Swap the current value of local variable with the reference to this
* value.
@@ -108,7 +108,7 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
pLocal->item.asMemvar.value = hMemvar;
hb_memvarValueIncRef( pLocal->item.asMemvar.value );
memcpy( pCBlock->pLocals + w, pLocal, sizeof( HB_ITEM ) );
memcpy( pCBlock->pLocals + ui, pLocal, sizeof( HB_ITEM ) );
}
else
{
@@ -119,9 +119,9 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
* released if other codeblock will be deleted
*/
hb_memvarValueIncRef( pLocal->item.asMemvar.value );
memcpy( pCBlock->pLocals + w, pLocal, sizeof( HB_ITEM ) );
memcpy( pCBlock->pLocals + ui, pLocal, sizeof( HB_ITEM ) );
}
++w;
++ui;
}
}
else
@@ -138,13 +138,13 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
HB_CODEBLOCK_PTR pOwner = pLocal->item.asBlock.value;
pCBlock->pLocals = pOwner->pLocals;
pCBlock->wLocals = wLocals = pOwner->wLocals;
pCBlock->uiLocals = uiLocals = pOwner->uiLocals;
if( pOwner->pLocals )
{ /* the outer codeblock have the table with local references - reuse it */
while( wLocals )
while( uiLocals )
{
hb_memvarValueIncRef( pCBlock->pLocals[ wLocals ].item.asMemvar.value );
--wLocals;
hb_memvarValueIncRef( pCBlock->pLocals[ uiLocals ].item.asMemvar.value );
--uiLocals;
}
/* increment a reference counter for the table of local references
*/
@@ -163,10 +163,10 @@ HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer,
pCBlock->pCode = pBuffer;
pCBlock->pSymbols = pSymbols;
pCBlock->lCounter = 1;
pCBlock->ulCounter = 1;
#ifdef CODEBLOCKDEBUG
printf( "\ncodeblock created (%li) %lx", pCBlock->lCounter, pCBlock );
printf( "\ncodeblock created (%li) %lx", pCBlock->ulCounter, pCBlock );
#endif
return pCBlock;
}
@@ -177,19 +177,19 @@ void hb_codeblockDelete( HB_ITEM_PTR pItem )
{
HB_CODEBLOCK_PTR pCBlock = pItem->item.asBlock.value;
#ifdef CODEBLOCKDEBUG
printf( "\ndelete a codeblock (%li) %lx", pCBlock->lCounter, pCBlock );
printf( "\ndelete a codeblock (%li) %lx", pCBlock->ulCounter, pCBlock );
#endif
if( --pCBlock->lCounter == 0 )
if( --pCBlock->ulCounter == 0 )
{
/* free space allocated for local variables
*/
if( pCBlock->pLocals )
{
WORD w = 1;
while( w < pCBlock->wLocals )
USHORT ui = 1;
while( ui < pCBlock->uiLocals )
{
hb_memvarValueDecRef( pCBlock->pLocals[ w ].item.asMemvar.value );
++w;
hb_memvarValueDecRef( pCBlock->pLocals[ ui ].item.asMemvar.value );
++ui;
}
/* decrement the table reference counter and release memory if
* it was the last reference
@@ -202,7 +202,7 @@ void hb_codeblockDelete( HB_ITEM_PTR pItem )
*/
hb_xfree( pCBlock );
#ifdef CODEBLOCKDEBUG
printf( "\ncodeblock deleted (%li) %lx", pCBlock->lCounter, pCBlock );
printf( "\ncodeblock deleted (%li) %lx", pCBlock->ulCounter, pCBlock );
#endif
}
}
@@ -247,8 +247,8 @@ PHB_ITEM hb_codeblockGetRef( PHB_ITEM pItem, PHB_ITEM pRefer )
void hb_codeblockCopy( PHB_ITEM pDest, PHB_ITEM pSource )
{
pDest->item.asBlock.value = pSource->item.asBlock.value;
pDest->item.asBlock.value->lCounter++;
pDest->item.asBlock.value->ulCounter++;
#ifdef CODEBLOCKDEBUG
printf( "\ncopy a codeblock (%li) %lx", pSource->item.asBlock.value->lCounter, pSource->item.asBlock.value );
printf( "\ncopy a codeblock (%li) %lx", pSource->item.asBlock.value->ulCounter, pSource->item.asBlock.value );
#endif
}

View File

@@ -666,20 +666,21 @@ HARBOUR HB_DEVOUT( void ) /* writes a single value to the current device (screen
if( hb_pcount() >= 1 )
{
#ifdef HARBOUR_USE_GTAPI
char pOldColor[ CLR_STRLEN ];
if( ISCHAR( 2 ) )
{
hb_gtGetColorStr( pOldColor );
char szOldColor[ CLR_STRLEN ];
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_parc( 2 ) );
hb_out( 1, hb_devout );
hb_gtSetColorStr( szOldColor );
}
#endif
else
hb_out( 1, hb_devout );
#else
hb_out( 1, hb_devout );
#ifdef HARBOUR_USE_GTAPI
if( ISCHAR( 2 ) )
hb_gtSetColorStr( pOldColor );
#endif
}
}
@@ -689,20 +690,21 @@ HARBOUR HB_DISPOUT( void ) /* writes a single value to the current device (scree
if( hb_pcount() >= 1 )
{
#ifdef HARBOUR_USE_GTAPI
char pOldColor[ CLR_STRLEN ];
if( ISCHAR( 2 ) )
{
hb_gtGetColorStr( pOldColor );
char szOldColor[ CLR_STRLEN ];
hb_gtGetColorStr( szOldColor );
hb_gtSetColorStr( hb_parc( 2 ) );
hb_out( 1, hb_dispout );
hb_gtSetColorStr( szOldColor );
}
#endif
hb_out( 1, hb_dispout );
#ifdef HARBOUR_USE_GTAPI
if( ISCHAR( 2 ) )
hb_gtSetColorStr( pOldColor );
else
hb_out( 1, hb_dispout );
#else
hb_out( 1, hb_devout );
#endif
}
}
@@ -1015,18 +1017,14 @@ HARBOUR HB_NOSNOW( void )
HARBOUR HB___SHADOW( void )
{
#ifdef HARBOUR_USE_GTAPI
USHORT uiAttr;
if( hb_pcount() == 4 )
uiAttr = 7;
else if( hb_pcount() == 5 )
uiAttr = hb_parni( 5 );
if( hb_pcount() >= 4 )
{
hb_gt_DrawShadow( hb_parni( 1 ) + 1,
hb_parni( 2 ) + 1,
hb_parni( 3 ) + 1,
hb_parni( 4 ) + 1, uiAttr );
hb_parni( 4 ) + 1,
ISNUM( 5 ) ? hb_parni( 5 ) : 7 );
}
#endif
}

View File

@@ -57,7 +57,7 @@ function __objHasData( oObject, cSymbol )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJHASDATA")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
return __objHasMsg( oObject, cSymbol ) .and. ;
@@ -73,7 +73,7 @@ function __objHasMethod( oObject, cSymbol )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJHASMETHOD")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
return __objHasMsg( oObject, cSymbol ) .and. ;
@@ -96,7 +96,7 @@ function __objGetMsgList( oObject, lDataMethod )
local lFoundDM // Found DATA ?
if !ISOBJECT( oObject )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJGETMSGLIST")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
IF !ISLOG( lDataMethod )
@@ -135,7 +135,7 @@ return aData
function __objGetMethodList( oObject )
if !ISOBJECT( oObject )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJGETMETHODLIST")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
return __objGetMsgList( oObject, .F. )
@@ -161,7 +161,7 @@ function __objGetValueList( oObject, aExcept )
local n
if !ISOBJECT( oObject )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJGETVALUELIST")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
IF !ISARRAY( aExcept )
@@ -191,7 +191,7 @@ return aData
function __objSetValueList( oObject, aData )
if !ISOBJECT( oObject )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJSETVALUELIST")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
aEval( aData,;
@@ -210,13 +210,13 @@ function __objAddMethod( oObject, cSymbol, nFuncPtr )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol ) .or. ;
!ISNUM( nFuncPtr )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJADDMETHOD")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if !__objHasMsg( oObject, cSymbol )
__clsAddMsg( oObject:ClassH, cSymbol, nFuncPtr, MET_METHOD )
else
__errRT_BASE(EG_ARG, 3103, "Already existing symbol in class", "__OBJADDMETHOD")
__errRT_BASE(EG_ARG, 3103, "Already existing symbol in class", ProcName( 0 ) )
endif
return oObject
@@ -231,13 +231,13 @@ function __objAddInline( oObject, cSymbol, bInline )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJADDINLINE")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if !__objHasMsg( oObject, cSymbol )
__clsAddMsg( oObject:ClassH, cSymbol, bInline, MET_INLINE )
else
__errRT_BASE(EG_ARG, 3103, "Already existing symbol in class", "__OBJADDINLINE")
__errRT_BASE(EG_ARG, 3103, "Already existing symbol in class", ProcName( 0 ) )
endif
return oObject
@@ -254,7 +254,7 @@ function __objAddData( oObject, cSymbol )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJADDDATA")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if !__objHasMsg( oObject, cSymbol ) .and. ;
@@ -264,7 +264,7 @@ function __objAddData( oObject, cSymbol )
__clsAddMsg( oObject:ClassH, cSymbol, nSeq, MET_DATA )
__clsAddMsg( oObject:ClassH, "_" + cSymbol, nSeq, MET_DATA )
else
__errRT_BASE(EG_ARG, 3103, "Already existing symbol in class", "__OBJADDDATA")
__errRT_BASE(EG_ARG, 3103, "Already existing symbol in class", ProcName( 0 ) )
endif
return oObject
@@ -280,13 +280,13 @@ function __objModMethod( oObject, cSymbol, nFuncPtr )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol ) .or. ;
!ISNUM( nFuncPtr )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJMODMETHOD")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if __objHasMethod( oObject, cSymbol )
__clsModMsg( oObject:ClassH, cSymbol, nFuncPtr )
else
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", "__OBJMODMETHOD")
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", ProcName( 0 ) )
endif
return oObject
@@ -302,13 +302,13 @@ function __objModInline( oObject, cSymbol, bInline )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol ) .or. ;
!ISBLOCK( bInline )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJMODINLINE")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if __objHasMethod( oObject, cSymbol )
__clsModMsg( oObject:ClassH, cSymbol, bInline )
else
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", "__OBJMODINLINE")
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", ProcName( 0 ) )
endif
return oObject
@@ -323,13 +323,13 @@ function __objDelMethod( oObject, cSymbol )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJDELMETHOD")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if __objHasMethod( oObject, cSymbol )
__clsDelMsg( oObject:ClassH, cSymbol )
else
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", "__OBJDELMETHOD")
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", ProcName( 0 ) )
endif
return oObject
@@ -346,7 +346,7 @@ function __objDelData( oObject, cSymbol )
if !ISOBJECT( oObject ) .or. ;
!ISCHAR( cSymbol )
__errRT_BASE(EG_ARG, 3101, NIL, "__OBJDELDATA")
__errRT_BASE(EG_ARG, 3101, NIL, ProcName( 0 ) )
endif
if __objHasData( oObject, cSymbol )
@@ -354,7 +354,7 @@ function __objDelData( oObject, cSymbol )
__clsDelMsg( oObject:ClassH, "_" + cSymbol )
__cls_DecData( oObject:ClassH ) // Decrease wData
else
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", "__OBJDELDATA")
__errRT_BASE(EG_ARG, 3102, "Not existing symbol in class", ProcName( 0 ) )
endif
return oObject

View File

@@ -1239,20 +1239,23 @@ char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec )
iBytes = sprintf( szResult, "%*.*f", iSize, iDec, dNumber );
}
}
else switch( pNumber->type & ~IT_BYREF )
else
{
case IT_INTEGER:
iBytes = sprintf( szResult, "%*i", iWidth, pNumber->item.asInteger.value );
break;
switch( pNumber->type & ~IT_BYREF )
{
case IT_INTEGER:
iBytes = sprintf( szResult, "%*i", iWidth, pNumber->item.asInteger.value );
break;
case IT_LONG:
iBytes = sprintf( szResult, "%*li", iWidth, pNumber->item.asLong.value );
break;
case IT_LONG:
iBytes = sprintf( szResult, "%*li", iWidth, pNumber->item.asLong.value );
break;
default:
iBytes = 0;
szResult[ 0 ] = '\0'; /* null string */
break;
default:
iBytes = 0;
szResult[ 0 ] = '\0'; /* null string */
break;
}
}
/* Set to asterisks in case of overflow */

View File

@@ -44,14 +44,8 @@
*
*/
/* TODO: Getting rid of calling back HARBOUR HB_STR() function */
/* and #include "ctoharb.h" */
/* TOFIX: TRANSFORM() is directly modifying an item string buffer.
This is dangerous, and should be fixed. */
#include <ctype.h>
#include "extend.h"
#include "ctoharb.h"
#include "itemapi.h"
#include "errorapi.h"
#include "dates.h"
@@ -90,28 +84,18 @@
#define DF_YMD 2
#define DF_EOT 3 /* End of table for Century */
extern HARBOUR HB_STR( void );
/* NOTE: This is called via its symbol name, so we should make sure */
/* that it gets linked */
/* Don't make this function static, because it's not called from this file. */
void hb_transformForceLink()
{
HB_STR();
}
/*
PictFunc -> Analyze function flags and return binary flags bits
szPict : Pointer to the picture
szPict : Pointer to the picture
ulPicLen : Pointer to the length. Changed during execution.
*/
static USHORT PictFunc( char **szPict, ULONG *pulPicLen )
static USHORT PictFunc( char ** szPict, ULONG * pulPicLen )
{
BOOL bDone = FALSE;
USHORT uiPicFlags = 0;
char *szPic = *szPict;
char * szPic = *szPict;
szPic++;
( *pulPicLen )--;
@@ -172,19 +156,21 @@ static USHORT PictFunc( char **szPict, ULONG *pulPicLen )
iOrigWidth : Original width
iOrigDec : Original decimals
*/
static char * NumPicture( char *szPic, ULONG ulPic, USHORT uiPicFlags, double dValue,
ULONG *pulRetSize, int iOrigWidth, int iOrigDec )
static char * NumPicture( char * szPic, ULONG ulPic, USHORT uiPicFlags, double dValue,
ULONG * pulRetSize, int iOrigWidth, int iOrigDec )
{
int iWidth; /* Width of string */
int iDecimals; /* Number of decimals */
int iDec; /* Number of decimals */
ULONG i;
int iCount = 0;
char *szRet;
char *szStr;
char * szRet;
char * szStr;
char cPic;
PHB_ITEM pItem;
PHB_ITEM pNumber;
PHB_ITEM pWidth;
PHB_ITEM pDec;
BOOL bFound = FALSE;
BOOL bEmpty; /* Suppress empty string */
@@ -205,7 +191,7 @@ static char * NumPicture( char *szPic, ULONG ulPic, USHORT uiPicFlags, double dV
if( bFound ) /* Did we find a dot */
{
iDecimals = 0;
iDec = 0;
iWidth++; /* Also adjust iWidth */
for( ; i < ulPic; i++ )
{
@@ -213,35 +199,33 @@ static char * NumPicture( char *szPic, ULONG ulPic, USHORT uiPicFlags, double dV
szPic[ i ] == '$' || szPic[ i ] == '*' )
{
iWidth++;
iDecimals++;
iDec++;
}
}
}
else
iDecimals = 0;
iDec = 0;
if( ( uiPicFlags & ( PF_DEBIT + PF_PARNEG ) ) && ( dValue < 0 ) )
dPush = -dValue; /* Always push absolute val */
dPush = -dValue; /* Always push absolute val */
else
dPush = dValue;
bEmpty = !dPush && ( uiPicFlags & PF_EMPTY ); /* Suppress 0 */
hb_vmPushSymbol ( hb_dynsymGet( "STR" )->pSymbol ); /* Push STR function */
hb_vmPushNil (); /* Function call. No object */
hb_vmPushDouble ( dPush, iDecimals ); /* Push value to transform */
if( !iWidth ) /* Width calculated ?? */
if( !iWidth ) /* Width calculated ?? */
{
iWidth = iOrigWidth; /* Push original width */
iDecimals = iOrigDec; /* Push original decimals */
iWidth = iOrigWidth; /* Push original width */
iDec = iOrigDec; /* Push original decimals */
}
hb_vmPushInteger( iWidth ); /* Push numbers width */
hb_vmPushInteger( iDecimals ); /* Push decimals */
hb_vmFunction( 3 ); /* 3 Parameters */
pItem = &stack.Return;
if( IS_STRING( pItem ) ) /* Is it a string */
pNumber = hb_itemPutNDLen( NULL, dPush, -1, iDec );
pWidth = hb_itemPutNI( NULL, iWidth );
pDec = hb_itemPutNI( NULL, iDec );
szStr = hb_itemStr( pNumber, pWidth, pDec );
if( szStr )
{
szStr = pItem->item.asString.value;
iCount = 0;
#ifndef HARBOUR_STRICT_CLIPPER_COMPATIBILITY
@@ -254,9 +238,9 @@ static char * NumPicture( char *szPic, ULONG ulPic, USHORT uiPicFlags, double dV
#endif
/* Suppress empty value */
if( bEmpty && pItem->item.asString.length )
if( bEmpty && strlen( szStr ) > 0 )
{
szStr[ pItem->item.asString.length - 1 ] = ' ';
szStr[ strlen( szStr ) - 1 ] = ' ';
}
/* Left align */
@@ -365,9 +349,13 @@ static char * NumPicture( char *szPic, ULONG ulPic, USHORT uiPicFlags, double dV
*pulRetSize = i;
szRet[ i ] = '\0';
hb_xfree( szStr );
}
else
hb_errInternal( 9999, "NumPicture(): STR does not return string", NULL, NULL );
hb_itemRelease( pNumber );
hb_itemRelease( pWidth );
hb_itemRelease( pDec );
return szRet;
}
@@ -604,7 +592,7 @@ HARBOUR HB_TRANSFORM( void )
case IT_LONG:
case IT_DOUBLE:
{
char * szStr = hb_itemStr( pExp, 0, 0 );
char * szStr = hb_itemStr( pExp, NULL, NULL );
if( szStr )
{

View File

@@ -51,7 +51,7 @@
typedef struct _SYMBOLS
{
PHB_SYMB pModuleSymbols; /* pointer to a one module own symbol table */
WORD wModuleSymbols; /* number of symbols on that table */
USHORT uiModuleSymbols; /* number of symbols on that table */
struct _SYMBOLS * pNext; /* pointer to the next SYMBOLS structure */
SYMBOLSCOPE hScope; /* scope collected from all symbols in module used to speed initialization code */
} SYMBOLS, * PSYMBOLS; /* structure to keep track of all modules symbol tables */
@@ -72,7 +72,7 @@ static void hb_vmDoInitFunctions( int argc, char * argv[] ); /* executes all
static void hb_vmDoExitFunctions( void ); /* executes all defined PRGs EXIT functions */
static void hb_vmReleaseLocalSymbols( void ); /* releases the memory of the local symbols linked list */
static void hb_vmDebuggerShowLine( WORD wLine ); /* makes the debugger shows a specific source code line */
static void hb_vmDebuggerShowLine( USHORT uiLine ); /* makes the debugger shows a specific source code line */
static void hb_vmDebuggerEndProc( void ); /* notifies the debugger for an endproc */
static void hb_vmArrayNew( HB_ITEM_PTR, USHORT ); /* creates array */
@@ -214,8 +214,8 @@ void hb_vmQuit( void )
void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
{
BYTE bCode;
WORD w = 0;
WORD wParams;
USHORT w = 0;
USHORT uiParams;
BOOL bCanRecover = FALSE;
ULONG ulPrivateBase = hb_memvarGetPrivatesBase();
@@ -337,9 +337,9 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_JUMP:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
if( wParams )
w += wParams;
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
if( uiParams )
w += uiParams;
else
w += 3;
break;
@@ -383,8 +383,8 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_MESSAGE:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmMessage( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmMessage( pSymbols + uiParams );
w += 3;
break;
@@ -429,8 +429,8 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_PARAMETER:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_memvarSetValue( pSymbols + wParams, stack.pBase + 1 + pCode[ w + 3 ] );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_memvarSetValue( pSymbols + uiParams, stack.pBase + 1 + pCode[ w + 3 ] );
HB_DEBUG( "(hb_vmPopParameter)\n" );
w += 4;
break;
@@ -451,14 +451,14 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_POPALIASEDFIELD:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPopAliasedField( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPopAliasedField( pSymbols + uiParams );
w += 3;
break;
case HB_P_POPFIELD:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPopField( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPopField( pSymbols + uiParams );
w += 3;
break;
@@ -468,9 +468,9 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_POPMEMVAR:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_stackDec();
hb_memvarSetValue( pSymbols + wParams, stack.pPos );
hb_memvarSetValue( pSymbols + uiParams, stack.pPos );
hb_itemClear( stack.pPos );
HB_DEBUG( "(hb_vmPopMemvar)\n" );
w += 3;
@@ -492,8 +492,8 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_PUSHALIASEDFIELD:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushAliasedField( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushAliasedField( pSymbols + uiParams );
w += 3;
break;
@@ -514,8 +514,8 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_PUSHFIELD:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushField( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushField( pSymbols + uiParams );
w += 3;
break;
@@ -540,16 +540,16 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_PUSHMEMVAR:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_memvarGetValue( stack.pPos, pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_memvarGetValue( stack.pPos, pSymbols + uiParams );
hb_stackPush();
HB_DEBUG( "(hb_vmPushMemvar)\n" );
w += 3;
break;
case HB_P_PUSHMEMVARREF:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_memvarGetRefer( stack.pPos, pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_memvarGetRefer( stack.pPos, pSymbols + uiParams );
hb_stackPush();
HB_DEBUG( "(hb_vmPushMemvarRef)\n" );
w += 3;
@@ -579,14 +579,14 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
case HB_P_PUSHSTR:
{
WORD wSize = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushString( ( char * ) pCode + w + 3, wSize );
w += ( wSize + 3 );
USHORT uiSize = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushString( ( char * ) pCode + w + 3, ( ULONG ) uiSize );
w += ( uiSize + 3 );
break;
}
case HB_P_PUSHSYM:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushSymbol( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmPushSymbol( pSymbols + uiParams );
w += 3;
break;
@@ -706,14 +706,14 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols )
break;
case HB_P_SFRAME:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmSFrame( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmSFrame( pSymbols + uiParams );
w += 3;
break;
case HB_P_STATICS:
wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmStatics( pSymbols + wParams );
uiParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 );
hb_vmStatics( pSymbols + uiParams );
w += 3;
break;
@@ -881,12 +881,12 @@ static void hb_vmDebuggerEndProc( void )
hb_itemClear( &item );
}
static void hb_vmDebuggerShowLine( WORD wLine ) /* makes the debugger shows a specific source code line */
static void hb_vmDebuggerShowLine( USHORT uiLine ) /* makes the debugger shows a specific source code line */
{
s_bDebugShowLines = FALSE;
hb_vmPushSymbol( hb_dynsymFind( "__DBGENTRY" )->pSymbol );
hb_vmPushNil();
hb_vmPushInteger( wLine );
hb_vmPushInteger( uiLine );
hb_vmDo( 1 );
s_bDebugShowLines = TRUE;
}
@@ -1020,13 +1020,13 @@ void hb_vmDivide( void )
}
}
void hb_vmDo( WORD wParams )
void hb_vmDo( USHORT uiParams )
{
PHB_ITEM pItem = stack.pPos - wParams - 2; /* procedure name */
PHB_ITEM pItem = stack.pPos - uiParams - 2; /* procedure name */
PHB_SYMB pSym = pItem->item.asSymbol.value;
LONG wStackBase = stack.pBase - stack.pItems; /* as the stack memory block could change */
LONG wItemIndex = pItem - stack.pItems;
PHB_ITEM pSelf = stack.pPos - wParams - 1; /* NIL, OBJECT or BLOCK */
PHB_ITEM pSelf = stack.pPos - uiParams - 1; /* NIL, OBJECT or BLOCK */
PHB_FUNC pFunc;
int iStatics = stack.iStatics; /* Return iStatics position */
BOOL bDebugPrevState = s_bDebugging;
@@ -1050,11 +1050,11 @@ void hb_vmDo( WORD wParams )
#endif
pItem->item.asSymbol.lineno = 0;
pItem->item.asSymbol.paramcnt = wParams;
pItem->item.asSymbol.paramcnt = uiParams;
stack.pBase = stack.pItems + pItem->item.asSymbol.stackbase;
pItem->item.asSymbol.stackbase = wStackBase;
HB_DEBUG2( "Do with %i params\n", wParams );
HB_DEBUG2( "Do with %i params\n", uiParams );
if( ! IS_NIL( pSelf ) ) /* are we sending a message ? */
{
@@ -1106,8 +1106,8 @@ void hb_vmDo( WORD wParams )
HARBOUR hb_vmDoBlock( void )
{
PHB_ITEM pBlock = stack.pBase + 1;
WORD wStackBase = stack.pBase - stack.pItems; /* as the stack memory block could change */
WORD wLine;
USHORT uiStackBase = stack.pBase - stack.pItems; /* as the stack memory block could change */
USHORT uiLine;
int iParam;
if( ! IS_BLOCK( pBlock ) )
@@ -1121,14 +1121,14 @@ HARBOUR hb_vmDoBlock( void )
/* set the current line number to a line where the codeblock was defined
*/
wLine = stack.pBase->item.asSymbol.lineno;
uiLine = stack.pBase->item.asSymbol.lineno;
stack.pBase->item.asSymbol.lineno = pBlock->item.asBlock.lineno;
hb_codeblockEvaluate( pBlock );
/* restore stack pointers */
stack.pBase = stack.pItems + wStackBase;
stack.pBase->item.asSymbol.lineno = wLine;
stack.pBase = stack.pItems + uiStackBase;
stack.pBase->item.asSymbol.lineno = uiLine;
HB_DEBUG( "End of DoBlock\n" );
}
@@ -1288,10 +1288,10 @@ void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes the sym
hb_errInternal( 9999, "Symbol item expected from hb_vmFuncPtr()", NULL, NULL );
}
void hb_vmFunction( WORD wParams )
void hb_vmFunction( USHORT uiParams )
{
hb_itemClear( &stack.Return );
hb_vmDo( wParams );
hb_vmDo( uiParams );
hb_itemCopy( stack.pPos, &stack.Return );
hb_stackPush();
}
@@ -1559,9 +1559,9 @@ void hb_vmLessEqual( void )
}
}
void hb_vmLocalName( WORD wLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */
void hb_vmLocalName( USHORT uiLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */
{
HB_SYMBOL_UNUSED( wLocal );
HB_SYMBOL_UNUSED( uiLocal );
HB_SYMBOL_UNUSED( szLocalName );
}
@@ -2137,12 +2137,12 @@ double hb_vmPopNumber( void )
return dNumber;
}
void hb_vmPopStatic( WORD wStatic )
void hb_vmPopStatic( USHORT uiStatic )
{
PHB_ITEM pStatic;
hb_stackDec();
pStatic = aStatics.item.asArray.value->pItems + stack.iStatics + wStatic - 1;
pStatic = aStatics.item.asArray.value->pItems + stack.iStatics + uiStatic - 1;
if( IS_BYREF( pStatic ) )
hb_itemCopy( hb_itemUnRef( pStatic ), stack.pPos );
@@ -2289,9 +2289,9 @@ void hb_vmPushNumber( double dNumber, int iDec )
hb_vmPushDouble( dNumber, hb_set.HB_SET_DECIMALS );
}
void hb_vmPushStatic( WORD wStatic )
void hb_vmPushStatic( USHORT uiStatic )
{
PHB_ITEM pStatic = aStatics.item.asArray.value->pItems + stack.iStatics + wStatic - 1;
PHB_ITEM pStatic = aStatics.item.asArray.value->pItems + stack.iStatics + uiStatic - 1;
if( IS_BYREF( pStatic ) )
hb_itemCopy( stack.pPos, hb_itemUnRef( pStatic ) );
@@ -2299,19 +2299,19 @@ void hb_vmPushStatic( WORD wStatic )
hb_itemCopy( stack.pPos, pStatic );
hb_stackPush();
HB_DEBUG2( "hb_vmPushStatic %i\n", wStatic );
HB_DEBUG2( "hb_vmPushStatic %i\n", uiStatic );
}
void hb_vmPushStaticByRef( WORD wStatic )
void hb_vmPushStaticByRef( USHORT uiStatic )
{
stack.pPos->type = IT_BYREF;
/* we store the offset instead of a pointer to support a dynamic stack */
stack.pPos->item.asRefer.value = wStatic - 1;
stack.pPos->item.asRefer.value = uiStatic - 1;
stack.pPos->item.asRefer.offset = stack.iStatics;
stack.pPos->item.asRefer.itemsbase = &aStatics.item.asArray.value->pItems;
hb_stackPush();
HB_DEBUG2( "hb_vmPushStaticByRef %i\n", wStatic );
HB_DEBUG2( "hb_vmPushStaticByRef %i\n", uiStatic );
}
void hb_vmPushString( char * szText, ULONG length )
@@ -2355,15 +2355,15 @@ void hb_vmPush( PHB_ITEM pItem )
*/
void hb_vmPushBlock( BYTE * pCode, PHB_SYMB pSymbols )
{
WORD wLocals;
USHORT uiLocals;
stack.pPos->type = IT_BLOCK;
wLocals = pCode[ 5 ] + ( pCode[ 6 ] * 256 );
uiLocals = pCode[ 5 ] + ( pCode[ 6 ] * 256 );
stack.pPos->item.asBlock.value =
hb_codeblockNew( pCode + 7 + wLocals * 2, /* pcode buffer */
wLocals, /* number of referenced local variables */
( WORD * ) ( pCode + 7 ), /* table with referenced local variables */
hb_codeblockNew( pCode + 7 + uiLocals * 2, /* pcode buffer */
uiLocals, /* number of referenced local variables */
( USHORT * ) ( pCode + 7 ), /* table with referenced local variables */
pSymbols );
/* store the statics base of function where the codeblock was defined
@@ -2497,7 +2497,7 @@ void hb_stackDispLocal( void )
PHB_ITEM pBase;
printf( hb_consoleGetNewLine() );
printf( "Virtual Maching Stack Dump:" );
printf( "Virtual Machine Stack Dump:" );
printf( hb_consoleGetNewLine() );
printf( "---------------------------" );
@@ -2680,10 +2680,10 @@ static void hb_vmSwapAlias( void )
HB_DEBUG( "hb_vmSwapAlias\n" );
}
void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* module symbols initialization */
void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, USHORT uiModuleSymbols ) /* module symbols initialization */
{
PSYMBOLS pNewSymbols;
WORD w;
USHORT ui;
#ifdef HARBOUR_OBJ_GENERATION
static BOOL bObjChecked = FALSE;
@@ -2697,7 +2697,7 @@ void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* modu
pNewSymbols = ( PSYMBOLS ) hb_xgrab( sizeof( SYMBOLS ) );
pNewSymbols->pModuleSymbols = pModuleSymbols;
pNewSymbols->wModuleSymbols = wModuleSymbols;
pNewSymbols->uiModuleSymbols = uiModuleSymbols;
pNewSymbols->pNext = NULL;
pNewSymbols->hScope = 0;
@@ -2714,17 +2714,17 @@ void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* modu
pLastSymbols->pNext = pNewSymbols;
}
for( w = 0; w < wModuleSymbols; w++ ) /* register each public symbol on the dynamic symbol table */
for( ui = 0; ui < uiModuleSymbols; ui++ ) /* register each public symbol on the dynamic symbol table */
{
SYMBOLSCOPE hSymScope;
hSymScope = ( pModuleSymbols + w )->cScope;
hSymScope = ( pModuleSymbols + ui )->cScope;
pNewSymbols->hScope |= hSymScope;
if( ( ! s_pSymStart ) && ( hSymScope == FS_PUBLIC ) )
s_pSymStart = pModuleSymbols + w; /* first public defined symbol to start execution */
s_pSymStart = pModuleSymbols + ui; /* first public defined symbol to start execution */
if( ( hSymScope == FS_PUBLIC ) || ( hSymScope & ( FS_MESSAGE | FS_MEMVAR ) ) )
hb_dynsymNew( pModuleSymbols + w );
hb_dynsymNew( pModuleSymbols + ui );
}
}
@@ -2773,23 +2773,23 @@ static void hb_vmDoInitStatics( void )
{
if( ( pLastSymbols->hScope & ( FS_INIT | FS_EXIT ) ) == ( FS_INIT | FS_EXIT ) )
{
WORD w;
USHORT ui;
for( w = 0; w < pLastSymbols->wModuleSymbols; w++ )
for( ui = 0; ui < pLastSymbols->uiModuleSymbols; ui++ )
{
SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + w )->cScope & ( FS_EXIT | FS_INIT );
SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + ui )->cScope & ( FS_EXIT | FS_INIT );
if( scope == ( FS_INIT | FS_EXIT ) )
{
/* _INITSTATICS procedure cannot call any function and it
* cannot use any local variable then it is safe to call
* this procedure directly
* hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w );
* hb_vmPushSymbol( pLastSymbols->pModuleSymbols + ui );
* hb_vmPushNil();
* hb_vmDo( 0 );
*/
if( ( pLastSymbols->pModuleSymbols + w )->pFunPtr )
( pLastSymbols->pModuleSymbols + w )->pFunPtr();
if( ( pLastSymbols->pModuleSymbols + ui )->pFunPtr )
( pLastSymbols->pModuleSymbols + ui )->pFunPtr();
}
}
}
@@ -2807,15 +2807,15 @@ static void hb_vmDoExitFunctions( void )
/* only if module contains some EXIT functions */
if( pLastSymbols->hScope & FS_EXIT )
{
WORD w;
USHORT ui;
for( w = 0; w < pLastSymbols->wModuleSymbols; w++ )
for( ui = 0; ui < pLastSymbols->uiModuleSymbols; ui++ )
{
SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + w )->cScope & ( FS_EXIT | FS_INIT );
SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + ui )->cScope & ( FS_EXIT | FS_INIT );
if( scope == FS_EXIT )
{
hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w );
hb_vmPushSymbol( pLastSymbols->pModuleSymbols + ui );
hb_vmPushNil();
hb_vmDo( 0 );
if( s_uiActionRequest )
@@ -2839,17 +2839,17 @@ static void hb_vmDoInitFunctions( int argc, char * argv[] )
/* only if module contains some INIT functions */
if( pLastSymbols->hScope & FS_INIT )
{
WORD w;
USHORT ui;
for( w = 0; w < pLastSymbols->wModuleSymbols; w++ )
for( ui = 0; ui < pLastSymbols->uiModuleSymbols; ui++ )
{
SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + w )->cScope & ( FS_EXIT | FS_INIT );
SYMBOLSCOPE scope = ( pLastSymbols->pModuleSymbols + ui )->cScope & ( FS_EXIT | FS_INIT );
if( scope == FS_INIT )
{
int i;
hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w );
hb_vmPushSymbol( pLastSymbols->pModuleSymbols + ui );
hb_vmPushNil();
for( i = 1; i < argc; i++ ) /* places application parameters on the stack */
@@ -3108,12 +3108,12 @@ HARBOUR HB_PCOUNT( void )
HARBOUR HB_PVALUE( void ) /* PValue( <nArg> ) */
{
WORD wParam = hb_parni( 1 ); /* Get parameter */
USHORT uiParam = hb_parni( 1 ); /* Get parameter */
PHB_ITEM pBase = stack.pItems + stack.pBase->item.asSymbol.stackbase;
/* Skip function + self */
if( wParam && wParam <= pBase->item.asSymbol.paramcnt ) /* Valid number */
hb_itemReturn( pBase + 1 + wParam );
if( uiParam && uiParam <= pBase->item.asSymbol.paramcnt ) /* Valid number */
hb_itemReturn( pBase + 1 + uiParam );
else
hb_errRT_BASE( EG_ARG, 3011, NULL, "PVALUE" );
}