diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5113f336b8..4a349b7da0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,54 @@ +19990808-03:00 GMT+1 Victor Szel + * source/rtl/codebloc.c + source/rtl/itemapi.c + source/vm/hvm.c + include/extend.h + ! hb_Codeblock*() -> hb_codeblock*() + * source/rtl/codebloc.c + source/rtl/itemapi.c + source/rtl/memvars.c + source/vm/hvm.c + include/extend.h + ! hb_Memvar*() -> hb_memvar*() + * source/vm/hvm.c + ! Fixed and updated declaration list for HARBOUR functions. + * source/rdd/dbcmd.c + source/rtl/arrays.c + source/rtl/classes.c + source/rtl/do.c + source/rtl/errorapi.c + source/rtl/itemapi.c + source/rtl/transfrm.c + source/runner/runner.c + source/vm/hvm.c + source/vm/initsymb.c + include/ctoharb.h + include/hb_vmpub.h + * All function belonging to the vm renamed to hb_vm*() + * source/tools/debug.c + ! Some functions made static. + * source/vm/hvm.c + % Some variable declarations moved to the block which uses it. + * source/vm/hvm.c + include/ctoharb.h + * PushLogical(), PopLogical() uses BOOL instead of int. + * source/vm/hvm.c + include/extend.h + include/ctoharb.h + * declarations belonging to the vm moved to ctoharb.h + * declarations belonging to extend moved to extend.h (ulMemory* variables) + * source/rtl/console.c + source/rtl/copyfile.c + source/tools/debug.c + ! Removed #include "ctoharb.h" + * source/rtl/gt/gtwin.c + ! Fixed warning about missing parenthesis. + * include/ctoharb.h + ! #include "extend.h" + * source/runner/runner.c + ! HB_HB_RUN -> HB_MAIN - So it now works with Win32/GCC. + (this change belongs to 19990807-22:55 GMT+1) + 19990808-17:25 EDT Paul Tucker * makefile.vc + debug.lib @@ -70,7 +121,7 @@ * tests/working/Makefile -debugger +cursrtst - + tests/working\cursrtst.prg + + tests/working/cursrtst.prg 19990808-15:00 EDT Paul Tucker * makefile.vc @@ -141,7 +192,7 @@ 199908.07-12:03 GMT+3 Alexander Kresin * makefile.b32 - * added 'source\debug' to .prg path for build32.bat to work + * added 'source/debug' to .prg path for build32.bat to work 19990807-9:38 GMT+1 Antonio Linares * tests/working/hb32.bat @@ -219,7 +270,7 @@ Fri Aug 06 20:04:05 1999 Gonzalo A. Diethelm + Added support for HB_P_MODULENAME opcode 19990806-18:00 WIB Andi Jahja - * source\rt;\menuto.prg + * source/rtl/menuto.prg - added error checker 19990806-10:48 GMT+1 Victor Szel diff --git a/harbour/include/ctoharb.h b/harbour/include/ctoharb.h index 06e40ab31d..befad15b0f 100644 --- a/harbour/include/ctoharb.h +++ b/harbour/include/ctoharb.h @@ -27,22 +27,95 @@ #ifndef HB_CTOHARB_H_ #define HB_CTOHARB_H_ -/* Calling Harbour from C code */ +#include "extend.h" -/* executing Harbour code from C */ -extern void Message( PHB_SYMB ); -extern void PushSymbol( PHB_SYMB pSym ); /* pushes a function pointer onto the stack */ -extern void Push( PHB_ITEM pItem ); /* pushes any item to the stack */ -extern void PushNil( void ); /* in this case it places nil at self */ -/* parameters should come here using Push...() */ -extern void PushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ -extern void PushInteger( int iNumber ); -extern void PushLong( long lNumber ); -extern void PushDouble( double dNumber, WORD wDec ); -extern void PushString( char * szText, ULONG length ); /* pushes a string on to the stack */ -extern void PushLogical( int iTrueFalse ); /* pushes a logical value onto the stack */ -extern void PushSymbol( PHB_SYMB ); -extern void Do( WORD wParams ); /* invokes the virtual machine */ -extern void Function( WORD wParams ); /* invokes the virtual machine */ +/* 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 */ +#ifdef HARBOUR_OBJ_GENERATION +extern void hb_vmProcessObjSymbols ( void ); /* process Harbour generated OBJ symbols */ +#endif +extern void hb_vmDoInitStatics( void ); /* executes all _INITSTATICS functions */ +extern void hb_vmDoInitFunctions( int argc, char * argv[] ); /* executes all defined PRGs INIT functions */ +extern void hb_vmDoExitFunctions( void ); /* executes all defined PRGs EXIT functions */ +extern void hb_vmReleaseLocalSymbols( void ); /* releases the memory of the local symbols linked list */ + +/* PCode functions */ +extern void hb_vmAnd( void ); /* performs the logical AND on the latest two values, removes them and leaves result on the stack */ +extern void hb_vmArrayAt( void ); /* pushes an array element to the stack, removing the array and the index from the stack */ +extern void hb_vmArrayPut( void ); /* sets an array value and pushes the value on to the stack */ +extern void hb_vmDec( void ); /* decrements the latest numeric value on the stack */ +extern void hb_vmDimArray( WORD wDimensions ); /* generates a wDimensions Array and initialize those dimensions from the stack values */ +extern void hb_vmDivide( void ); /* divides the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmDo( WORD WParams ); /* invoke the virtual machine */ +extern HARBOUR hb_vmDoBlock( void ); /* executes a codeblock */ +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_vmEndBlock( void ); /* copies the last codeblock pushed value into the return value */ +extern void hb_vmEqual( BOOL bExact ); /* checks if the two latest values on the stack are equal, removes both and leaves result */ +extern void hb_vmForTest( void ); /* test for end condition of for */ +extern void hb_vmFrame( BYTE bLocals, BYTE bParams ); /* increases the stack pointer for the amount of locals and params suplied */ +extern void hb_vmFuncPtr( void ); /* pushes a function address pointer. Removes the symbol from the satck */ +extern void hb_vmFunction( WORD wParams ); /* executes a function saving its result */ +extern void hb_vmGenArray( WORD wElements ); /* generates a wElements Array and fills it from the stack values */ +extern void hb_vmGreater( void ); /* checks if the latest - 1 value is greater than the latest, removes both and leaves result */ +extern void hb_vmGreaterEqual( void ); /* checks if the latest - 1 value is greater than or equal the latest, removes both and leaves result */ +extern void hb_vmInc( void ); /* increment the latest numeric value on the stack */ +extern void hb_vmInstring( void ); /* check whether string 1 is contained in string 2 */ +extern void hb_vmLess( void ); /* checks if the latest - 1 value is less than the latest, removes both and leaves result */ +extern void hb_vmLessEqual( void ); /* checks if the latest - 1 value is less than or equal the latest, removes both and leaves result */ +extern void hb_vmLocalName( WORD wLocal, char * szLocalName ); /* locals and parameters index and name information for the debugger */ +extern void hb_vmMessage( PHB_SYMB pSymMsg ); /* sends a message to an object */ +extern void hb_vmMinus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmModuleName( char * szModuleName ); /* PRG and function name information for the debugger */ +extern void hb_vmModulus( void ); /* calculates the modulus of latest two values on the stack, removes them and leaves the result */ +extern void hb_vmMult( void ); /* multiplies the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmNegate( void ); /* negates (-) the latest value on the stack */ +extern void hb_vmNot( void ); /* changes the latest logical value on the stack */ +extern void hb_vmNotEqual( void ); /* checks if the two latest values on the stack are not equal, removes both and leaves result */ +extern void hb_vmOperatorCall( PHB_ITEM, PHB_ITEM, char *); /* call an overloaded operator */ +extern void hb_vmOr( void ); /* performs the logical OR on the latest two values, removes them and leaves result on the stack */ +extern void hb_vmPlus( void ); /* sums the latest two values on the stack, removes them and leaves the result */ +extern long hb_vmPopDate( void ); /* pops the stack latest value and returns its date value as a LONG */ +extern void hb_vmPopDefStat( WORD wStatic ); /* pops the stack latest value onto a static as default init */ +extern double hb_vmPopDouble( WORD * ); /* pops the stack latest value and returns its double numeric format value */ +extern void hb_vmPopLocal( SHORT wLocal ); /* pops the stack latest value onto a local */ +extern BOOL hb_vmPopLogical( void ); /* pops the stack latest value and returns its logical value */ +extern void hb_vmPopMemvar( PHB_SYMB ); /* pops a value of memvar variable */ +extern double hb_vmPopNumber( void ); /* pops the stack latest value and returns its numeric value */ +extern void hb_vmPopParameter( PHB_SYMB, BYTE ); /* creates a PRIVATE variable and sets it with parameter's value */ +extern void hb_vmPopStatic( WORD wStatic ); /* pops the stack latest value onto a static */ +extern void hb_vmPower( void ); /* power the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmPush( PHB_ITEM pItem ); /* pushes a generic item onto the stack */ +extern void hb_vmPushBlock( BYTE * pCode, PHB_SYMB pSymbols ); /* creates a codeblock */ +extern void hb_vmPushDate( LONG lDate ); /* pushes a long date onto the stack */ +extern void hb_vmPushDouble( double lNumber, WORD wDec ); /* pushes a double number 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_vmPushLogical( BOOL bValue ); /* pushes a logical value onto the stack */ +extern void hb_vmPushLong( long lNumber ); /* pushes a long number onto the stack */ +extern void hb_vmPushMemvar( PHB_SYMB ); /* pushes a value of memvar variable */ +extern void hb_vmPushMemvarByRef( PHB_SYMB ); /* pushes a reference to a memvar variable */ +extern void hb_vmPushNil( void ); /* in this case it places nil at self */ +extern void hb_vmPushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ +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_vmPushString( char * szText, ULONG length ); /* pushes a string on to the stack */ +extern void hb_vmPushSymbol( PHB_SYMB pSym ); /* pushes a function pointer onto the stack */ +extern void hb_vmPushInteger( int iNumber ); /* pushes a integer number onto the stack */ +extern void hb_vmRetValue( void ); /* pops the latest stack value into stack.Return */ +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 */ + +/* stack management functions */ +extern void hb_stackDec( void ); /* pops an item from the stack without clearing it's contents */ +extern void hb_stackPop( void ); /* pops an item from the stack */ +extern void hb_stackFree( void ); /* releases all memory used by the stack */ +extern void hb_stackPush( void ); /* pushes an item on to the stack */ +extern void hb_stackInit( void ); /* initializes the stack */ +extern void hb_stackShow( void ); /* show the types of the items on the stack for debugging purposes */ + +#define STACK_INITHB_ITEMS 100 +#define STACK_EXPANDHB_ITEMS 20 #endif /* HB_CTOHARB_H_ */ diff --git a/harbour/include/extend.h b/harbour/include/extend.h index c7866d4fb2..1430172ef1 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -61,9 +61,6 @@ typedef struct #define FS_MEMVAR 0x80 #define FS_ALLOCATED (-1) -extern void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ -extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ - /* items types */ #define IT_NIL 0x0000 #define IT_INTEGER 0x0002 @@ -283,6 +280,11 @@ extern void hb_xfree( void * pMem ); /* frees memory */ extern void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */ extern ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */ +extern ULONG ulMemoryBlocks; /* memory blocks used */ +extern ULONG ulMemoryMaxBlocks; /* maximum number of used memory blocks */ +extern ULONG ulMemoryConsumed; /* memory size consumed */ +extern ULONG ulMemoryMaxConsumed; /* memory max size consumed */ + /* array management */ extern void hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creates a new array */ extern void hb_arrayGet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* retrieves an item */ @@ -332,26 +334,26 @@ extern void hb_dynsymRelease( void ); /* releases the memory of the extern PHB_SYMB hb_symbolNew( char * szName ); /* Codeblock management */ -extern HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE *, WORD, WORD *, 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 ); -extern void hb_CodeblockEvaluate( PHB_ITEM ); -extern void hb_CodeblockCopy( PHB_ITEM, PHB_ITEM ); +extern HB_CODEBLOCK_PTR hb_codeblockNew( BYTE *, WORD, WORD *, 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 ); +extern void hb_codeblockEvaluate( PHB_ITEM ); +extern void hb_codeblockCopy( PHB_ITEM, PHB_ITEM ); /* memvars subsystem */ -extern HB_HANDLE hb_MemvarValueNew( PHB_ITEM, int ); -extern HB_VALUE_PTR * hb_MemvarValueBaseAddress( void ); -extern void hb_MemvarsInit( void ); -extern void hb_MemvarsRelease( void ); -extern void hb_MemvarValueIncRef( HB_HANDLE ); -extern void hb_MemvarValueDecRef( HB_HANDLE ); -extern void hb_MemvarSetValue( PHB_SYMB, HB_ITEM_PTR ); -extern void hb_MemvarGetValue( HB_ITEM_PTR, PHB_SYMB ); -extern void hb_MemvarGetRefer( HB_ITEM_PTR, PHB_SYMB ); -extern void hb_MemvarNewSymbol( PHB_SYMB ); -extern ULONG hb_MemvarGetPrivatesBase( void ); -extern void hb_MemvarSetPrivatesBase( ULONG ); +extern HB_HANDLE hb_memvarValueNew( PHB_ITEM, int ); +extern HB_VALUE_PTR * hb_memvarValueBaseAddress( void ); +extern void hb_memvarsInit( void ); +extern void hb_memvarsRelease( void ); +extern void hb_memvarValueIncRef( HB_HANDLE ); +extern void hb_memvarValueDecRef( HB_HANDLE ); +extern void hb_memvarSetValue( PHB_SYMB, HB_ITEM_PTR ); +extern void hb_memvarGetValue( HB_ITEM_PTR, PHB_SYMB ); +extern void hb_memvarGetRefer( HB_ITEM_PTR, PHB_SYMB ); +extern void hb_memvarNewSymbol( PHB_SYMB ); +extern ULONG hb_memvarGetPrivatesBase( void ); +extern void hb_memvarSetPrivatesBase( ULONG ); extern char * hb_setColor( char * ); diff --git a/harbour/include/hb_vmpub.h b/harbour/include/hb_vmpub.h index 5ab7a5c95f..ae5c2930f0 100644 --- a/harbour/include/hb_vmpub.h +++ b/harbour/include/hb_vmpub.h @@ -76,7 +76,7 @@ typedef struct PHB_DYNS pDynSym; /* pointer to its dynamic symbol if defined */ } HB_SYMB, * PHB_SYMB; -extern void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ +extern void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ /* Harbour Functions scope (SYMBOLSCOPE) */ #define FS_PUBLIC 0x00 diff --git a/harbour/include/init.h b/harbour/include/init.h index 7dc0bd31fd..595ee688f4 100644 --- a/harbour/include/init.h +++ b/harbour/include/init.h @@ -29,7 +29,7 @@ #ifndef HB_INIT_H_ #define HB_INIT_H_ -extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ +extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ #ifdef HARBOUR_STRICT_ANSI_C @@ -39,7 +39,7 @@ extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbo #define HB_INIT_SYMBOLS_END( func ) }; \ void func( void ) \ { \ - ProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ + hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ } #define HB_CALL_ON_STARTUP_BEGIN( func ) func( void ) { @@ -54,7 +54,7 @@ extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbo #define HB_INIT_SYMBOLS_END( func ) }; \ void __attribute__ ((constructor)) func( void ) \ { \ - ProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ + hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ } @@ -72,7 +72,7 @@ extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbo #define HB_INIT_SYMBOLS_END( func ) }; \ void func( void ) \ { \ - ProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ + hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ } #define HB_CALL_ON_STARTUP_BEGIN( func ) \ @@ -88,7 +88,7 @@ extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbo #define HB_INIT_SYMBOLS_END( func ) }; \ int func( void ) \ { \ - ProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ + hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ return 1; \ }; \ static int static_int_##func = func() @@ -107,7 +107,7 @@ extern void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbo #define HB_INIT_SYMBOLS_END( func ) }; \ static int func( void ) \ { \ - ProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ + hb_vmProcessSymbols( symbols, sizeof( symbols ) / sizeof( HB_SYMB ) ); \ return 1; \ }; \ static int static_int_##func = func() diff --git a/harbour/source/Makefile b/harbour/source/Makefile index 9652a2e677..1e4b972c73 100644 --- a/harbour/source/Makefile +++ b/harbour/source/Makefile @@ -7,10 +7,10 @@ ROOT = ../ DIRS=\ hbpp \ compiler \ + debug \ rtl \ vm \ rdd \ - debug \ tools \ include $(ROOT)config/dir.cf diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 9f711b2a64..6b695f9fb1 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -2930,7 +2930,7 @@ void GenCCode( char *szFileName, char *szName ) /* generates the C languag fprintf( yyc, "/* %05li */", lPCodePos ); fprintf( yyc, " HB_P_ENDPROC };\n\n" ); - fprintf( yyc, " VirtualMachine( pcode, symbols );\n}\n\n" ); + fprintf( yyc, " hb_vmExecute( pcode, symbols );\n}\n\n" ); pFunc = pFunc->pNext; } diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 022dff76a5..b65a2009c2 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -29,8 +29,8 @@ #include "errorapi.h" #include "rddapi.h" #include "set.h" -#include "rddsys.ch" #include "ctoharb.h" +#include "rddsys.ch" #include "set.ch" #define HARBOUR_MAX_RDD_DRIVERNAME_LENGTH 32 @@ -204,11 +204,11 @@ static int hb_rddRegister( char * szDriver, USHORT uiType ) pRddNewNode->uiType = uiType; /* Call _GETFUNCTABLE() */ - PushSymbol( pGetFuncTable->pSymbol ); - PushNil(); - PushLong( ( long ) &pRddNewNode->uiFunctions ); - PushLong( ( long ) &pRddNewNode->pTable ); - Do( 2 ); + hb_vmPushSymbol( pGetFuncTable->pSymbol ); + hb_vmPushNil(); + hb_vmPushLong( ( long ) &pRddNewNode->uiFunctions ); + hb_vmPushLong( ( long ) &pRddNewNode->pTable ); + hb_vmDo( 2 ); if ( hb_parni( -1 ) != SUCCESS ) { hb_xfree( pRddNewNode ); /* Delete de new RDD node */ @@ -817,7 +817,7 @@ HARBOUR HB_DBUSEAREA( void ) /* Need more space? */ SELF_STRUCTSIZE( ( AREAP ) pCurrArea->pArea, &uiSize ); if( uiSize > sizeof( AREA ) ) /* Size of Area changed */ - pCurrArea->pArea = ( AREAP ) hb_xrealloc( pCurrArea->pArea, uiSize ); + pCurrArea->pArea = ( AREAP ) hb_xrealloc( pCurrArea->pArea, uiSize ); pRddNode->uiAreaSize = uiSize; /* Update the size of WorkArea */ } @@ -880,12 +880,12 @@ HARBOUR HB_DBUSEAREA( void ) { if( ( ( AREAP ) pAreaNode->pArea )->uiArea > uiCurrArea ) { - /* Insert the new WorkArea node */ - pCurrArea->pPrev = pAreaNode->pPrev; - pCurrArea->pNext = pAreaNode; - pAreaNode->pPrev = pCurrArea; - if( pCurrArea->pPrev ) - pCurrArea->pPrev->pNext = pCurrArea; + /* Insert the new WorkArea node */ + pCurrArea->pPrev = pAreaNode->pPrev; + pCurrArea->pNext = pAreaNode; + pAreaNode->pPrev = pCurrArea; + if( pCurrArea->pPrev ) + pCurrArea->pPrev->pNext = pCurrArea; } pAreaNode = pAreaNode->pNext; } diff --git a/harbour/source/rtl/arrays.c b/harbour/source/rtl/arrays.c index b6ee7c74de..4fa7946c5a 100644 --- a/harbour/source/rtl/arrays.c +++ b/harbour/source/rtl/arrays.c @@ -459,10 +459,10 @@ int hb_arrayScan( PHB_ITEM pArray, PHB_ITEM pValue, ULONG ulStart, ULONG ulCount if ( pValue->type == IT_BLOCK ) { - PushSymbol( &symEval ); - Push( pValue ); - Push( pItem ); - Do( 1 ); + hb_vmPushSymbol( &symEval ); + hb_vmPush( pValue ); + hb_vmPush( pItem ); + hb_vmDo( 1 ); if ( stack.Return.item.asLogical.value ) iRet = 1; } @@ -531,11 +531,11 @@ void hb_arrayEval( PHB_ITEM pArray, PHB_ITEM bBlock, ULONG ulStart, ULONG ulCoun { PHB_ITEM pItem = pBaseArray->pItems + ulStart; - PushSymbol( &symEval ); - Push( bBlock ); - Push( pItem ); - PushNumber( (double)(ulStart + 1), 0 ); - Do( 2 ); + hb_vmPushSymbol( &symEval ); + hb_vmPush( bBlock ); + hb_vmPush( pItem ); + hb_vmPushNumber( (double)(ulStart + 1), 0 ); + hb_vmDo( 2 ); } } else diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index c45b5ff603..72f692b8e0 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -614,12 +614,12 @@ static HARBOUR EvalInline( void ) hb_arrayGet( pClasses[ wClass - 1 ].pInlines, pMethod->wData, &block ); - PushSymbol( &symEval ); - Push( &block ); - Push( stack.pBase + 1 ); /* Push self */ + hb_vmPushSymbol( &symEval ); + hb_vmPush( &block ); + hb_vmPush( stack.pBase + 1 ); /* Push self */ for( w = 1; w <= hb_pcount(); w++ ) - Push( hb_param( w, IT_ANY ) ); - Do( hb_pcount() + 1 ); /* Self is also an argument */ + hb_vmPush( hb_param( w, IT_ANY ) ); + hb_vmDo( hb_pcount() + 1 ); /* Self is also an argument */ hb_itemClear( &block ); /* Release block */ } @@ -849,12 +849,12 @@ HARBOUR HB_OSEND(void) if( pMessage && pObject ) /* Object & message passed */ { - Push( pObject ); /* Push object */ - Message( hb_dynsymGet( pMessage->item.asString.value )->pSymbol ); + hb_vmPush( pObject ); /* Push object */ + hb_vmMessage( hb_dynsymGet( pMessage->item.asString.value )->pSymbol ); /* Push char symbol as message */ for( w = 3; w <= hb_pcount(); w++ ) /* Push arguments on stack */ - Push( hb_param( w, IT_ANY ) ); - Do( hb_pcount()-2 ); /* Execute message */ + hb_vmPush( hb_param( w, IT_ANY ) ); + hb_vmDo( hb_pcount()-2 ); /* Execute message */ } else { @@ -994,9 +994,9 @@ HARBOUR HB___INSTSUPER( void ) pDynSym = hb_dynsymFind( pString->item.asString.value ); if( pDynSym ) /* Find function */ { - PushSymbol( pDynSym->pSymbol ); /* Push function name */ - PushNil(); - Function( 0 ); /* Execute super class */ + hb_vmPushSymbol( pDynSym->pSymbol ); /* Push function name */ + hb_vmPushNil(); + hb_vmFunction( 0 ); /* Execute super class */ if( !IS_OBJECT( &stack.Return ) ) { diff --git a/harbour/source/rtl/codebloc.c b/harbour/source/rtl/codebloc.c index 65f582ff19..b74d2ed758 100644 --- a/harbour/source/rtl/codebloc.c +++ b/harbour/source/rtl/codebloc.c @@ -37,6 +37,7 @@ #include #include "extend.h" +#include "ctoharb.h" #include "itemapi.h" /* Uncomment this to trace codeblocks activity @@ -53,7 +54,7 @@ * Note: pLocalPosTable cannot be used if wLocals is ZERO * */ -HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE * pBuffer, +HB_CODEBLOCK_PTR hb_codeblockNew( BYTE * pBuffer, WORD wLocals, WORD *pLocalPosTable, PHB_SYMB pSymbols ) @@ -96,14 +97,14 @@ HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE * pBuffer, * pool so it can be shared by codeblocks */ - hMemvar =hb_MemvarValueNew( pLocal, FALSE ); + hMemvar =hb_memvarValueNew( pLocal, FALSE ); pLocal->type =IT_BYREF | IT_MEMVAR; - pLocal->item.asMemvar.itemsbase =hb_MemvarValueBaseAddress(); + pLocal->item.asMemvar.itemsbase =hb_memvarValueBaseAddress(); pLocal->item.asMemvar.offset =0; pLocal->item.asMemvar.value =hMemvar; - hb_MemvarValueIncRef( pLocal->item.asMemvar.value ); + hb_memvarValueIncRef( pLocal->item.asMemvar.value ); memcpy( pCBlock->pLocals + w, pLocal, sizeof(HB_ITEM) ); } else @@ -114,7 +115,7 @@ HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE * pBuffer, /* Increment the reference counter so this value will not be * released if other codeblock will be deleted */ - hb_MemvarValueIncRef( pLocal->item.asMemvar.value ); + hb_memvarValueIncRef( pLocal->item.asMemvar.value ); memcpy( pCBlock->pLocals + w, pLocal, sizeof(HB_ITEM) ); } @@ -143,7 +144,7 @@ HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE * pBuffer, /* Delete a codeblock */ -void hb_CodeblockDelete( HB_ITEM_PTR pItem ) +void hb_codeblockDelete( HB_ITEM_PTR pItem ) { HB_CODEBLOCK_PTR pCBlock = pItem->item.asBlock.value; #ifdef CODEBLOCKDEBUG @@ -158,7 +159,7 @@ void hb_CodeblockDelete( HB_ITEM_PTR pItem ) WORD w = 0; while( w < pCBlock->wLocals ) { - hb_MemvarValueDecRef( pCBlock->pLocals[ w ].item.asMemvar.value ); + hb_memvarValueDecRef( pCBlock->pLocals[ w ].item.asMemvar.value ); ++w; } hb_xfree( pCBlock->pLocals ); @@ -179,18 +180,18 @@ void hb_CodeblockDelete( HB_ITEM_PTR pItem ) * (The codeblock can only see the static variables defined in a module * where the codeblock was created) */ -void hb_CodeblockEvaluate( HB_ITEM_PTR pItem ) +void hb_codeblockEvaluate( HB_ITEM_PTR pItem ) { int iStatics = stack.iStatics; stack.iStatics = pItem->item.asBlock.statics; - VirtualMachine( pItem->item.asBlock.value->pCode, pItem->item.asBlock.value->pSymbols ); + hb_vmExecute( pItem->item.asBlock.value->pCode, pItem->item.asBlock.value->pSymbols ); stack.iStatics = iStatics; } /* Get local variable referenced in a codeblock */ -PHB_ITEM hb_CodeblockGetVar( PHB_ITEM pItem, LONG iItemPos ) +PHB_ITEM hb_codeblockGetVar( PHB_ITEM pItem, LONG iItemPos ) { HB_CODEBLOCK_PTR pCBlock = pItem->item.asBlock.value; /* local variables accessed in a codeblock are always stored as reference */ @@ -199,7 +200,7 @@ PHB_ITEM hb_CodeblockGetVar( PHB_ITEM pItem, LONG iItemPos ) /* Get local variable passed by reference */ -PHB_ITEM hb_CodeblockGetRef( PHB_ITEM pItem, PHB_ITEM pRefer ) +PHB_ITEM hb_codeblockGetRef( PHB_ITEM pItem, PHB_ITEM pRefer ) { HB_CODEBLOCK_PTR pCBlock = pItem->item.asBlock.value; @@ -210,7 +211,7 @@ PHB_ITEM hb_CodeblockGetRef( PHB_ITEM pItem, PHB_ITEM pRefer ) * TODO: check if such simple pointer coping will allow to evaluate * codeblocks recursively */ -void hb_CodeblockCopy( PHB_ITEM pDest, PHB_ITEM pSource ) +void hb_codeblockCopy( PHB_ITEM pDest, PHB_ITEM pSource ) { pDest->item.asBlock.value =pSource->item.asBlock.value; pDest->item.asBlock.value->lCounter++; diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 7a8ca59c73..4f0fcea38d 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -49,7 +49,6 @@ #include "hbsetup.h" #include "extend.h" #include "itemapi.h" -#include "ctoharb.h" #include "init.h" #include "dates.h" #include "set.h" diff --git a/harbour/source/rtl/copyfile.c b/harbour/source/rtl/copyfile.c index fd6380f84e..3e978feedf 100644 --- a/harbour/source/rtl/copyfile.c +++ b/harbour/source/rtl/copyfile.c @@ -25,7 +25,6 @@ #include "itemapi.h" #include "extend.h" #include "errorapi.h" -#include "ctoharb.h" #include "filesys.h" #include "init.h" diff --git a/harbour/source/rtl/do.c b/harbour/source/rtl/do.c index c943e19f57..2929764c68 100644 --- a/harbour/source/rtl/do.c +++ b/harbour/source/rtl/do.c @@ -50,11 +50,11 @@ HARBOUR HB_DO( void ) { int i; - PushSymbol( pDynSym->pSymbol ); - PushNil(); + hb_vmPushSymbol( pDynSym->pSymbol ); + hb_vmPushNil(); for( i = 2; i <= hb_pcount(); i++ ) - Push( hb_param( i, IT_ANY ) ); - Do( hb_pcount() - 1 ); + hb_vmPush( hb_param( i, IT_ANY ) ); + hb_vmDo( hb_pcount() - 1 ); } else hb_errorRT_BASE( EG_NOFUNC, 1001, NULL, pItem->item.asString.value ); @@ -63,21 +63,21 @@ HARBOUR HB_DO( void ) { int i; - PushSymbol( &symEval ); - Push( pItem ); + hb_vmPushSymbol( &symEval ); + hb_vmPush( pItem ); for( i = 2; i <= hb_pcount(); i++ ) - Push( hb_param( i, IT_ANY ) ); - Do( hb_pcount() - 1 ); + hb_vmPush( hb_param( i, IT_ANY ) ); + hb_vmDo( hb_pcount() - 1 ); } else if( IS_SYMBOL(pItem) ) { int i; - PushSymbol( pItem->item.asSymbol.value ); - PushNil(); + hb_vmPushSymbol( pItem->item.asSymbol.value ); + hb_vmPushNil(); for( i = 2; i <= hb_pcount(); i++ ) - Push( hb_param( i, IT_ANY ) ); - Do( hb_pcount() - 1 ); + hb_vmPush( hb_param( i, IT_ANY ) ); + hb_vmDo( hb_pcount() - 1 ); } else hb_errorRT_BASE( EG_ARG, 3012, NULL, "DO" ); diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 3d9af187ad..bc2c53cb8c 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -32,9 +32,9 @@ PHB_ITEM hb_errNew( void ) { PHB_ITEM pReturn = hb_itemNew( NULL ); - PushSymbol( hb_dynsymGet( "ERRORNEW" )->pSymbol ); - PushNil(); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "ERRORNEW" )->pSymbol ); + hb_vmPushNil(); + hb_vmDo( 0 ); hb_itemCopy( pReturn, &stack.Return ); @@ -63,10 +63,10 @@ WORD hb_errLaunch( PHB_ITEM pError ) exit( 1 ); } - PushSymbol( &symEval ); - Push( &errorBlock ); - Push( pError ); - Do( 1 ); + hb_vmPushSymbol( &symEval ); + hb_vmPush( &errorBlock ); + hb_vmPush( pError ); + hb_vmDo( 1 ); /* TODO: Handle the canSubstitute case somehow */ /* Clipper doesn't document the case where canSubstitute is set */ @@ -107,155 +107,155 @@ void hb_errRelease( PHB_ITEM pError ) char * hb_errGetDescription( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "DESCRIPTION" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "DESCRIPTION" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asString.value; } PHB_ITEM hb_errPutDescription( PHB_ITEM pError, char * szDescription ) { - PushSymbol( hb_dynsymGet( "_DESCRIPTION" )->pSymbol ); - Push( pError ); - PushString( szDescription, strlen( szDescription ) ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_DESCRIPTION" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushString( szDescription, strlen( szDescription ) ); + hb_vmDo( 1 ); return pError; } char * hb_errGetFileName( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "FILENAME" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "FILENAME" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asString.value; } PHB_ITEM hb_errPutFileName( PHB_ITEM pError, char * szFileName ) { - PushSymbol( hb_dynsymGet( "_FILENAME" )->pSymbol ); - Push( pError ); - PushString( szFileName, strlen( szFileName ) ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_FILENAME" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushString( szFileName, strlen( szFileName ) ); + hb_vmDo( 1 ); return pError; } USHORT hb_errGetGenCode( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "GENCODE" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "GENCODE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asInteger.value; } PHB_ITEM hb_errPutGenCode( PHB_ITEM pError, USHORT uiGenCode ) { - PushSymbol( hb_dynsymGet( "_GENCODE" )->pSymbol ); - Push( pError ); - PushInteger( uiGenCode ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_GENCODE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushInteger( uiGenCode ); + hb_vmDo( 1 ); return pError; } char * hb_errGetOperation( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "OPERATION" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "OPERATION" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asString.value; } PHB_ITEM hb_errPutOperation( PHB_ITEM pError, char * szOperation ) { - PushSymbol( hb_dynsymGet( "_OPERATION" )->pSymbol ); - Push( pError ); - PushString( szOperation, strlen( szOperation ) ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_OPERATION" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushString( szOperation, strlen( szOperation ) ); + hb_vmDo( 1 ); return pError; } USHORT hb_errGetOsCode( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "OSCODE" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "OSCODE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asInteger.value; } PHB_ITEM hb_errPutOsCode( PHB_ITEM pError, USHORT uiOsCode ) { - PushSymbol( hb_dynsymGet( "_OSCODE" )->pSymbol ); - Push( pError ); - PushInteger( uiOsCode ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_OSCODE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushInteger( uiOsCode ); + hb_vmDo( 1 ); return pError; } USHORT hb_errGetSeverity( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "SEVERITY" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "SEVERITY" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asInteger.value; } PHB_ITEM hb_errPutSeverity( PHB_ITEM pError, USHORT uiSeverity ) { - PushSymbol( hb_dynsymGet( "_SEVERITY" )->pSymbol ); - Push( pError ); - PushInteger( uiSeverity ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_SEVERITY" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushInteger( uiSeverity ); + hb_vmDo( 1 ); return pError; } USHORT hb_errGetSubCode( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "SUBCODE" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "SUBCODE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asInteger.value; } PHB_ITEM hb_errPutSubCode( PHB_ITEM pError, USHORT uiSubCode ) { - PushSymbol( hb_dynsymGet( "_SUBCODE" )->pSymbol ); - Push( pError ); - PushInteger( uiSubCode ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_SUBCODE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushInteger( uiSubCode ); + hb_vmDo( 1 ); return pError; } char * hb_errGetSubSystem( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "SUBSYSTEM" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "SUBSYSTEM" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asString.value; } PHB_ITEM hb_errPutSubSystem( PHB_ITEM pError, char * szSubSystem ) { - PushSymbol( hb_dynsymGet( "_SUBSYSTEM" )->pSymbol ); - Push( pError ); - PushString( szSubSystem, strlen( szSubSystem ) ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_SUBSYSTEM" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushString( szSubSystem, strlen( szSubSystem ) ); + hb_vmDo( 1 ); return pError; } USHORT hb_errGetTries( PHB_ITEM pError ) { - PushSymbol( hb_dynsymGet( "TRIES" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "TRIES" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); return stack.Return.item.asInteger.value; } PHB_ITEM hb_errPutTries( PHB_ITEM pError, USHORT uiTries ) { - PushSymbol( hb_dynsymGet( "_TRIES" )->pSymbol ); - Push( pError ); - PushInteger( uiTries ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_TRIES" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushInteger( uiTries ); + hb_vmDo( 1 ); return pError; } @@ -265,25 +265,25 @@ USHORT hb_errGetFlags( PHB_ITEM pError ) /* ; */ - PushSymbol( hb_dynsymGet( "CANRETRY" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "CANRETRY" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); if (stack.Return.item.asLogical.value) uiFlags |= EF_CANRETRY; /* ; */ - PushSymbol( hb_dynsymGet( "CANSUBSTITUTE" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "CANSUBSTITUTE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); if (stack.Return.item.asLogical.value) uiFlags |= EF_CANSUBSTITUTE; /* ; */ - PushSymbol( hb_dynsymGet( "CANDEFAULT" )->pSymbol ); - Push( pError ); - Do( 0 ); + hb_vmPushSymbol( hb_dynsymGet( "CANDEFAULT" )->pSymbol ); + hb_vmPush( pError ); + hb_vmDo( 0 ); if (stack.Return.item.asLogical.value) uiFlags |= EF_CANDEFAULT; @@ -294,24 +294,24 @@ USHORT hb_errGetFlags( PHB_ITEM pError ) PHB_ITEM hb_errPutFlags( PHB_ITEM pError, USHORT uiFlags ) { - PushSymbol( hb_dynsymGet( "_CANRETRY" )->pSymbol ); - Push( pError ); - PushLogical( uiFlags & EF_CANRETRY ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_CANRETRY" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushLogical( uiFlags & EF_CANRETRY ); + hb_vmDo( 1 ); /* ; */ - PushSymbol( hb_dynsymGet( "_CANSUBSTITUTE" )->pSymbol ); - Push( pError ); - PushLogical( uiFlags & EF_CANSUBSTITUTE ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_CANSUBSTITUTE" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushLogical( uiFlags & EF_CANSUBSTITUTE ); + hb_vmDo( 1 ); /* ; */ - PushSymbol( hb_dynsymGet( "_CANDEFAULT" )->pSymbol ); - Push( pError ); - PushLogical( uiFlags & EF_CANDEFAULT ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymGet( "_CANDEFAULT" )->pSymbol ); + hb_vmPush( pError ); + hb_vmPushLogical( uiFlags & EF_CANDEFAULT ); + hb_vmDo( 1 ); /* ; */ diff --git a/harbour/source/rtl/gt/gtwin.c b/harbour/source/rtl/gt/gtwin.c index 1ea1a50b48..5ea5b688c6 100644 --- a/harbour/source/rtl/gt/gtwin.c +++ b/harbour/source/rtl/gt/gtwin.c @@ -433,7 +433,7 @@ void hb_gt_DispBegin(void) &srWin); /* screen buffer rectangle to read from */ /* store current handle */ - if( HStealth = INVALID_HANDLE_VALUE ) + if( ( HStealth = INVALID_HANDLE_VALUE ) ) { HStealth = CreateConsoleScreenBuffer( GENERIC_READ | GENERIC_WRITE, /* Access flag */ diff --git a/harbour/source/rtl/itemapi.c b/harbour/source/rtl/itemapi.c index a5ee8f2752..30da6bf6f0 100644 --- a/harbour/source/rtl/itemapi.c +++ b/harbour/source/rtl/itemapi.c @@ -86,21 +86,21 @@ PHB_ITEM hb_evalLaunch( PEVALINFO pEvalInfo ) { if( IS_STRING( pEvalInfo->pItems[ 0 ] ) ) { - PushSymbol( hb_dynsymGet( hb_itemGetC( pEvalInfo->pItems[ 0 ] ) )->pSymbol ); - PushNil(); + hb_vmPushSymbol( hb_dynsymGet( hb_itemGetC( pEvalInfo->pItems[ 0 ] ) )->pSymbol ); + hb_vmPushNil(); while( w < (HB_EVAL_PARAM_MAX_ + 1) && pEvalInfo->pItems[ w ] ) - Push( pEvalInfo->pItems[ w++ ] ); - Do( w - 1 ); + hb_vmPush( pEvalInfo->pItems[ w++ ] ); + hb_vmDo( w - 1 ); pResult = hb_itemNew( 0 ); hb_itemCopy( pResult, &stack.Return ); } else if( IS_BLOCK( pEvalInfo->pItems[ 0 ] ) ) { - PushSymbol( &symEval ); - Push( pEvalInfo->pItems[ 0 ] ); + hb_vmPushSymbol( &symEval ); + hb_vmPush( pEvalInfo->pItems[ 0 ] ); while( w < (HB_EVAL_PARAM_MAX_ + 1) && pEvalInfo->pItems[ w ] ) - Push( pEvalInfo->pItems[ w++ ] ); - Do( w - 1 ); + hb_vmPush( pEvalInfo->pItems[ w++ ] ); + hb_vmDo( w - 1 ); pResult = hb_itemNew( 0 ); hb_itemCopy( pResult, &stack.Return ); } @@ -406,10 +406,10 @@ void hb_itemClear( PHB_ITEM pItem ) } else if( IS_BLOCK( pItem ) ) { - hb_CodeblockDelete( pItem ); + hb_codeblockDelete( pItem ); } else if( IS_MEMVAR( pItem ) ) - hb_MemvarValueDecRef( pItem->item.asMemvar.value ); + hb_memvarValueDecRef( pItem->item.asMemvar.value ); pItem->type = IT_NIL; } @@ -441,11 +441,11 @@ void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ) else if( IS_BLOCK( pSource ) ) { - hb_CodeblockCopy( pDest, pSource ); + hb_codeblockCopy( pDest, pSource ); } else if( IS_MEMVAR( pSource ) ) { - hb_MemvarValueIncRef( pSource->item.asMemvar.value ); + hb_memvarValueIncRef( pSource->item.asMemvar.value ); } } @@ -460,20 +460,20 @@ PHB_ITEM hb_itemUnRef( PHB_ITEM pItem ) { HB_VALUE_PTR pValue; - pValue =*(pItem->item.asMemvar.itemsbase) + pItem->item.asMemvar.offset + - pItem->item.asMemvar.value; - pItem =&pValue->item; + pValue = *(pItem->item.asMemvar.itemsbase) + pItem->item.asMemvar.offset + + pItem->item.asMemvar.value; + pItem = &pValue->item; } else { if( pItem->item.asRefer.value >= 0 ) - pItem =*(pItem->item.asRefer.itemsbase) + pItem->item.asRefer.offset + - pItem->item.asRefer.value; + pItem = *(pItem->item.asRefer.itemsbase) + pItem->item.asRefer.offset + + pItem->item.asRefer.value; else { /* local variable referenced in a codeblock */ - pItem =hb_CodeblockGetRef( *(pItem->item.asRefer.itemsbase) + pItem->item.asRefer.offset, + pItem = hb_codeblockGetRef( *(pItem->item.asRefer.itemsbase) + pItem->item.asRefer.offset, pItem ); } } diff --git a/harbour/source/rtl/memvars.c b/harbour/source/rtl/memvars.c index 47f390bbd2..841446cda0 100644 --- a/harbour/source/rtl/memvars.c +++ b/harbour/source/rtl/memvars.c @@ -60,11 +60,11 @@ static HB_VALUE_PTR _globalTable = NULL; #define MEMVARDEBUG */ -static void hb_MemvarCreateFromItem( PHB_ITEM, BYTE, PHB_ITEM ); -static void hb_MemvarCreateFromDynSymbol( PHB_DYNS, BYTE, PHB_ITEM ); -static void hb_MemvarAddPrivate( PHB_DYNS ); +static void hb_memvarCreateFromItem( PHB_ITEM, BYTE, PHB_ITEM ); +static void hb_memvarCreateFromDynSymbol( PHB_DYNS, BYTE, PHB_ITEM ); +static void hb_memvarAddPrivate( PHB_DYNS ); -void hb_MemvarsInit( void ) +void hb_memvarsInit( void ) { _globalTable = (HB_VALUE_PTR) hb_xgrab( sizeof(HB_VALUE) * TABLE_INITHB_VALUE ); _globalTableSize = TABLE_INITHB_VALUE; @@ -77,7 +77,7 @@ void hb_MemvarsInit( void ) } -void hb_MemvarsRelease( void ) +void hb_memvarsRelease( void ) { ULONG ulCnt = _globalLastFree; @@ -103,7 +103,7 @@ void hb_MemvarsRelease( void ) /* * This function base address of values table */ -HB_VALUE_PTR *hb_MemvarValueBaseAddress( void ) +HB_VALUE_PTR *hb_memvarValueBaseAddress( void ) { return &_globalTable; } @@ -125,7 +125,7 @@ HB_VALUE_PTR *hb_MemvarValueBaseAddress( void ) * handle to variable memory or fails * */ -HB_HANDLE hb_MemvarValueNew( HB_ITEM_PTR pSource, int iTrueMemvar ) +HB_HANDLE hb_memvarValueNew( HB_ITEM_PTR pSource, int iTrueMemvar ) { HB_VALUE_PTR pValue; HB_HANDLE hValue = 1; /* handle 0 is reserved */ @@ -198,7 +198,7 @@ HB_HANDLE hb_MemvarValueNew( HB_ITEM_PTR pSource, int iTrueMemvar ) * an exit from the function/procedure) * */ -static void hb_MemvarAddPrivate( PHB_DYNS pDynSym ) +static void hb_memvarAddPrivate( PHB_DYNS pDynSym ) { /* Allocate the value from the end of table */ @@ -216,7 +216,7 @@ static void hb_MemvarAddPrivate( PHB_DYNS pDynSym ) /* * This function returns current PRIVATE variables stack base */ -ULONG hb_MemvarGetPrivatesBase( void ) +ULONG hb_memvarGetPrivatesBase( void ) { ULONG ulBase = _privateStackBase; _privateStackBase =_privateStackCnt; @@ -227,7 +227,7 @@ ULONG hb_MemvarGetPrivatesBase( void ) * This function releases PRIVATE variables created after passed base * */ -void hb_MemvarSetPrivatesBase( ULONG ulBase ) +void hb_memvarSetPrivatesBase( ULONG ulBase ) { HB_HANDLE hVar, hOldValue; @@ -236,7 +236,7 @@ void hb_MemvarSetPrivatesBase( ULONG ulBase ) --_privateStackCnt; hVar =_privateStack[ _privateStackCnt ]->hMemvar; hOldValue =_globalTable[ hVar ].hPrevMemvar; - hb_MemvarValueDecRef( hVar ); + hb_memvarValueDecRef( hVar ); /* * Restore previous value for variables that were overridden */ @@ -249,7 +249,7 @@ void hb_MemvarSetPrivatesBase( ULONG ulBase ) * This function increases the number of references to passed global value * */ -void hb_MemvarValueIncRef( HB_HANDLE hValue ) +void hb_memvarValueIncRef( HB_HANDLE hValue ) { #ifdef MEMVARDEBUG if( hValue < 1 || hValue > _globalTableSize ) @@ -271,7 +271,7 @@ void hb_MemvarValueIncRef( HB_HANDLE hValue ) * If it is the last reference then this value is deleted. * */ -void hb_MemvarValueDecRef( HB_HANDLE hValue ) +void hb_memvarValueDecRef( HB_HANDLE hValue ) { HB_VALUE_PTR pValue; @@ -317,7 +317,7 @@ void hb_MemvarValueDecRef( HB_HANDLE hValue ) } } /* This can happen if for example PUBLIC variable holds a codeblock with - * detached variable. When hb_MemvarsRelease() is called then detached + * detached variable. When hb_memvarsRelease() is called then detached * variable can be released before the codeblock. So if the codeblock * will be released later then it will try to release again this detached * variable. @@ -334,7 +334,7 @@ void hb_MemvarValueDecRef( HB_HANDLE hValue ) * pItem - value to store in memvar * */ -void hb_MemvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ) +void hb_memvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ) { PHB_DYNS pDyn; @@ -358,14 +358,14 @@ void hb_MemvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ) { /* assignment to undeclared memvar - PRIVATE is assumed */ - hb_MemvarCreateFromDynSymbol( pDyn, VS_PRIVATE, pItem ); + hb_memvarCreateFromDynSymbol( pDyn, VS_PRIVATE, pItem ); } } else hb_errorRT_BASE( EG_NOVAR, 1003, NULL, pMemvarSymb->szName ); } -void hb_MemvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) +void hb_memvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) { PHB_DYNS pDyn; @@ -393,7 +393,7 @@ void hb_MemvarGetValue( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) hb_errorRT_BASE( EG_NOVAR, 1003, NULL, pMemvarSymb->szName ); } -void hb_MemvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) +void hb_memvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) { PHB_DYNS pDyn; @@ -433,7 +433,7 @@ void hb_MemvarGetRefer( HB_ITEM_PTR pItem, PHB_SYMB pMemvarSymb ) * or NULL * */ -static void hb_MemvarCreateFromItem( PHB_ITEM pMemvar, BYTE bScope, PHB_ITEM pValue ) +static void hb_memvarCreateFromItem( PHB_ITEM pMemvar, BYTE bScope, PHB_ITEM pValue ) { PHB_DYNS pDynVar; @@ -446,10 +446,10 @@ static void hb_MemvarCreateFromItem( PHB_ITEM pMemvar, BYTE bScope, PHB_ITEM pVa hb_errorRT_BASE( EG_ARG, 3008, NULL, "&" ); if( pDynVar ) - hb_MemvarCreateFromDynSymbol( pDynVar, bScope, pValue ); + hb_memvarCreateFromDynSymbol( pDynVar, bScope, pValue ); } -static void hb_MemvarCreateFromDynSymbol( PHB_DYNS pDynVar, BYTE bScope, PHB_ITEM pValue ) +static void hb_memvarCreateFromDynSymbol( PHB_DYNS pDynVar, BYTE bScope, PHB_ITEM pValue ) { if( bScope & VS_PUBLIC ) { @@ -458,7 +458,7 @@ static void hb_MemvarCreateFromDynSymbol( PHB_DYNS pDynVar, BYTE bScope, PHB_ITE */ if( ! pDynVar->hMemvar ) { - pDynVar->hMemvar = hb_MemvarValueNew( pValue, TRUE ); + pDynVar->hMemvar = hb_memvarValueNew( pValue, TRUE ); if( !pValue ) { /* new PUBLIC variable - initialize it to .F. @@ -476,12 +476,12 @@ static void hb_MemvarCreateFromDynSymbol( PHB_DYNS pDynVar, BYTE bScope, PHB_ITE */ HB_HANDLE hCurrentValue =pDynVar->hMemvar; - pDynVar->hMemvar = hb_MemvarValueNew( pValue, TRUE ); + pDynVar->hMemvar = hb_memvarValueNew( pValue, TRUE ); _globalTable[ pDynVar->hMemvar ].hPrevMemvar =hCurrentValue; /* Add this variable to the PRIVATE variables stack */ - hb_MemvarAddPrivate( pDynVar ); + hb_memvarAddPrivate( pDynVar ); } } @@ -489,7 +489,7 @@ static void hb_MemvarCreateFromDynSymbol( PHB_DYNS pDynVar, BYTE bScope, PHB_ITE * It also restores the value that was hidden if there is another * PRIVATE variable with the same name. */ -void hb_MemvarRelease( HB_ITEM_PTR pMemvar ) +void hb_memvarRelease( HB_ITEM_PTR pMemvar ) { ULONG ulBase = _privateStackCnt; PHB_DYNS pDynVar; @@ -526,7 +526,7 @@ void hb_MemvarRelease( HB_ITEM_PTR pMemvar ) * procedure only. * The scope of released variables are specified using passed name's mask */ -void hb_MemvarReleaseWithMask( char *szMask, BOOL bInclude ) +void hb_memvarReleaseWithMask( char *szMask, BOOL bInclude ) { ULONG ulBase = _privateStackCnt; PHB_DYNS pDynVar; @@ -612,12 +612,12 @@ HARBOUR HB___MVPUBLIC( void ) for( j=1; j<=ulLen; j++ ) { hb_arrayGet( pMemvar, j, &VarItem ); - hb_MemvarCreateFromItem( &VarItem, VS_PUBLIC, NULL ); + hb_memvarCreateFromItem( &VarItem, VS_PUBLIC, NULL ); hb_itemClear( &VarItem ); } } else - hb_MemvarCreateFromItem( pMemvar, VS_PUBLIC, NULL ); + hb_memvarCreateFromItem( pMemvar, VS_PUBLIC, NULL ); } } } @@ -680,12 +680,12 @@ HARBOUR HB___MVPRIVATE( void ) for( j=1; j<=ulLen; j++ ) { hb_arrayGet( pMemvar, j, &VarItem ); - hb_MemvarCreateFromItem( &VarItem, VS_PRIVATE, NULL ); + hb_memvarCreateFromItem( &VarItem, VS_PRIVATE, NULL ); hb_itemClear( &VarItem ); } } else - hb_MemvarCreateFromItem( pMemvar, VS_PRIVATE, NULL ); + hb_memvarCreateFromItem( pMemvar, VS_PRIVATE, NULL ); } } } @@ -749,12 +749,12 @@ HARBOUR HB___MVXRELEASE( void ) for( j=1; j<=ulLen; j++ ) { hb_arrayGet( pMemvar, j, &VarItem ); - hb_MemvarRelease( &VarItem ); + hb_memvarRelease( &VarItem ); hb_itemClear( &VarItem ); } } else - hb_MemvarRelease( pMemvar ); + hb_memvarRelease( pMemvar ); } } } @@ -814,7 +814,7 @@ HARBOUR HB___MVRELEASE( void ) if( pMask->item.asString.value[ 0 ] == '*' ) bIncludeVar =TRUE; /* delete all memvar variables */ - hb_MemvarReleaseWithMask( pMask->item.asString.value, bIncludeVar ); + hb_memvarReleaseWithMask( pMask->item.asString.value, bIncludeVar ); } } } diff --git a/harbour/source/rtl/transfrm.c b/harbour/source/rtl/transfrm.c index b4073bbf2c..e7855f3fdb 100644 --- a/harbour/source/rtl/transfrm.c +++ b/harbour/source/rtl/transfrm.c @@ -220,18 +220,18 @@ char *NumPicture( char *szPic, long lPic, int iPicFlags, double dValue, bEmpty = !dPush && ( iPicFlags & PF_EMPTY ); /* Suppress 0 */ - PushSymbol ( hb_dynsymGet( "STR" )->pSymbol ); /* Push STR function */ - PushNil (); /* Function call. No object */ + hb_vmPushSymbol ( hb_dynsymGet( "STR" )->pSymbol ); /* Push STR function */ + hb_vmPushNil (); /* Function call. No object */ - PushDouble ( dPush, iDecimals ); /* Push value to transform */ + hb_vmPushDouble ( dPush, iDecimals ); /* Push value to transform */ if( !iWidth ) /* Width calculated ?? */ { iWidth = iOrigWidth; /* Push original width */ iDecimals = iOrigDec; /* Push original decimals */ } - PushInteger( iWidth ); /* Push numbers width */ - PushInteger( iDecimals ); /* Push decimals */ - Function( 3 ); /* 3 Parameters */ + 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 */ { diff --git a/harbour/source/runner/runner.c b/harbour/source/runner/runner.c index 0b893c68a4..e18a8a072d 100644 --- a/harbour/source/runner/runner.c +++ b/harbour/source/runner/runner.c @@ -212,28 +212,28 @@ HARBOUR HB_MAIN( void ) { if( (pSymRead[ ul ].cScope & (FS_INIT|FS_EXIT)) == FS_INIT ) { - PushSymbol( pSymRead + ul ); - PushNil(); + hb_vmPushSymbol( pSymRead + ul ); + hb_vmPushNil(); for( i = 0; i < (hb_pcount() - 1); i++ ) - Push( hb_param( i + 2, IT_ANY ) ); + hb_vmPush( hb_param( i + 2, IT_ANY ) ); /* Push other cmdline params*/ - Do( hb_pcount() - 1 ); /* Run init function */ + hb_vmDo( hb_pcount() - 1 ); /* Run init function */ } } - PushSymbol( pSymRead ); - PushNil(); + hb_vmPushSymbol( pSymRead ); + hb_vmPushNil(); for( i = 0; i < (hb_pcount() - 1); i++ ) - Push( hb_param( i + 2, IT_ANY ) ); /* Push other cmdline params*/ - Do( hb_pcount() - 1 ); /* Run the thing !!! */ + hb_vmPush( hb_param( i + 2, IT_ANY ) ); /* Push other cmdline params*/ + hb_vmDo( hb_pcount() - 1 ); /* Run the thing !!! */ for( ul = 0; ul < ulSymbols; ul++ ) /* Check EXIT functions */ { if( ( pSymRead[ ul ].cScope & FS_INITEXIT ) == FS_EXIT ) { - PushSymbol( pSymRead + ul ); - PushNil(); - Do( 0 ); /* Run exit function */ + hb_vmPushSymbol( pSymRead + ul ); + hb_vmPushNil(); + hb_vmDo( 0 ); /* Run exit function */ pSymRead[ ul ].cScope = pSymRead[ ul ].cScope & (~FS_EXIT); /* Exit function cannot be handled by main in hvm.c */ diff --git a/harbour/source/tools/debug.c b/harbour/source/tools/debug.c index d576d0899b..78f8e0cb7b 100644 --- a/harbour/source/tools/debug.c +++ b/harbour/source/tools/debug.c @@ -38,7 +38,6 @@ * $End$ */ #include "extend.h" -#include "ctoharb.h" #include "itemapi.h" PHB_ITEM ArrayClone( PHB_ITEM ); @@ -78,7 +77,7 @@ HARBOUR HB___STATIC(void) * $FuncName$ AddToArray( , , ) * $Description$ Add to array at pos * $End$ */ -void AddToArray( PHB_ITEM pItem, PHB_ITEM pReturn, WORD wPos ) +static void AddToArray( PHB_ITEM pItem, PHB_ITEM pReturn, WORD wPos ) { PHB_ITEM pTemp; @@ -104,7 +103,7 @@ void AddToArray( PHB_ITEM pItem, PHB_ITEM pReturn, WORD wPos ) * $FuncName$ __GlobalStackLen() * $Description$ Returns the length of the global stack * $End$ */ -WORD GlobalStackLen( void ) +static WORD GlobalStackLen( void ) { PHB_ITEM pItem; WORD nCount = 0; @@ -143,7 +142,7 @@ HARBOUR HB___AGLOBALSTACK(void) * $FuncName$ __StackLen() * $Description$ Returns the length of the stack of the calling function * $End$ */ -WORD StackLen( void ) +static WORD StackLen( void ) { PHB_ITEM pItem; PHB_ITEM pBase = stack.pItems + stack.pBase->item.asSymbol.stackbase; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 786a027189..480405766a 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -36,6 +36,7 @@ #include "hbsetup.h" /* main configuration file */ #include "extend.h" +#include "ctoharb.h" #include "errorapi.h" #include "itemapi.h" #include "langapi.h" @@ -48,11 +49,6 @@ extern void hb_consoleRelease( void ); extern void ReleaseClasses( void ); /* releases all defined classes */ extern void InitSymbolTable( void ); /* initialization of runtime support symbols */ -extern ULONG ulMemoryBlocks; /* memory blocks used */ -extern ULONG ulMemoryMaxBlocks; /* maximum number of used memory blocks */ -extern ULONG ulMemoryConsumed; /* memory size consumed */ -extern ULONG ulMemoryMaxConsumed; /* memory max size consumed */ - typedef struct _SYMBOLS { PHB_SYMB pModuleSymbols; /* pointer to a one module own symbol table */ @@ -61,87 +57,22 @@ typedef struct _SYMBOLS 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 */ -HARBOUR HB_ERRORSYS( void ); -HARBOUR HB_ERRORNEW( void ); +extern HARBOUR HB_ERRORSYS( void ); +extern HARBOUR HB_ERRORNEW( void ); + HARBOUR HB_EVAL( void ); /* Evaluates a codeblock from Harbour */ -HARBOUR HB_MAIN( void ); /* fixed entry point by now */ +HARBOUR HB_LEN( void ); /* Evaluates a codeblock from Harbour */ +HARBOUR HB_EMPTY( void ); /* fixed entry point by now */ HARBOUR HB_VALTYPE( void ); /* returns a string description of a value */ - -/* currently supported virtual machine actions */ -void And( void ); /* performs the logical AND on the latest two values, removes them and leaves result on the stack */ -void ArrayAt( void ); /* pushes an array element to the stack, removing the array and the index from the stack */ -void ArrayPut( void ); /* sets an array value and pushes the value on to the stack */ -void Dec( void ); /* decrements the latest numeric value on the stack */ -void DimArray( WORD wDimensions ); /* generates a wDimensions Array and initialize those dimensions from the stack values */ -void Div( void ); /* divides the latest two values on the stack, removes them and leaves the result */ -void Do( WORD WParams ); /* invoke the virtual machine */ -HARBOUR DoBlock( void ); /* executes a codeblock */ -void Duplicate( void ); /* duplicates the latest value on the stack */ -void DuplTwo( void ); /* duplicates the latest two value on the stack */ -void EndBlock( void ); /* copies the last codeblock pushed value into the return value */ -void Equal( BOOL bExact ); /* checks if the two latest values on the stack are equal, removes both and leaves result */ -void ForTest( void ); /* test for end condition of for */ -void Frame( BYTE bLocals, BYTE bParams ); /* increases the stack pointer for the amount of locals and params suplied */ -void FuncPtr( void ); /* pushes a function address pointer. Removes the symbol from the satck */ -void Function( WORD wParams ); /* executes a function saving its result */ -void GenArray( WORD wElements ); /* generates a wElements Array and fills it from the stack values */ -void Greater( void ); /* checks if the latest - 1 value is greater than the latest, removes both and leaves result */ -void GreaterEqual( void ); /* checks if the latest - 1 value is greater than or equal the latest, removes both and leaves result */ -void Inc( void ); /* increment the latest numeric value on the stack */ -void Instring( void ); /* check whether string 1 is contained in string 2 */ -void Less( void ); /* checks if the latest - 1 value is less than the latest, removes both and leaves result */ -void LessEqual( void ); /* checks if the latest - 1 value is less than or equal the latest, removes both and leaves result */ -void LocalName( WORD wLocal, char * szLocalName ); /* locals and parameters index and name information for the debugger */ -void Message( PHB_SYMB pSymMsg ); /* sends a message to an object */ -void Minus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ -void ModuleName( char * szModuleName ); /* PRG and function name information for the debugger */ -void Modulus( void ); /* calculates the modulus of latest two values on the stack, removes them and leaves the result */ -void Mult( void ); /* multiplies the latest two values on the stack, removes them and leaves the result */ -void Negate( void ); /* negates (-) the latest value on the stack */ -void Not( void ); /* changes the latest logical value on the stack */ -void NotEqual( void ); /* checks if the two latest values on the stack are not equal, removes both and leaves result */ -void OperatorCall( PHB_ITEM, PHB_ITEM, char *); /* call an overloaded operator */ -void Or( void ); /* performs the logical OR on the latest two values, removes them and leaves result on the stack */ -void Plus( void ); /* sums the latest two values on the stack, removes them and leaves the result */ -long PopDate( void ); /* pops the stack latest value and returns its date value as a LONG */ -void PopDefStat( WORD wStatic ); /* pops the stack latest value onto a static as default init */ -double PopDouble( WORD * ); /* pops the stack latest value and returns its double numeric format value */ -void PopLocal( SHORT wLocal ); /* pops the stack latest value onto a local */ -int PopLogical( void ); /* pops the stack latest value and returns its logical value */ -void PopMemvar( PHB_SYMB ); /* pops a value of memvar variable */ -double PopNumber( void ); /* pops the stack latest value and returns its numeric value */ -void PopParameter( PHB_SYMB, BYTE ); /* creates a PRIVATE variable and sets it with parameter's value */ -void PopStatic( WORD wStatic ); /* pops the stack latest value onto a static */ -void Power( void ); /* power the latest two values on the stack, removes them and leaves the result */ -void Push( PHB_ITEM pItem ); /* pushes a generic item onto the stack */ -void PushBlock( BYTE * pCode, PHB_SYMB pSymbols ); /* creates a codeblock */ -void PushDate( LONG lDate ); /* pushes a long date onto the stack */ -void PushDouble( double lNumber, WORD wDec ); /* pushes a double number onto the stack */ -void PushLocal( SHORT iLocal ); /* pushes the containts of a local onto the stack */ -void PushLocalByRef( SHORT iLocal ); /* pushes a local by refrence onto the stack */ -void PushLogical( int iTrueFalse ); /* pushes a logical value onto the stack */ -void PushLong( long lNumber ); /* pushes a long number onto the stack */ -void PushMemvar( PHB_SYMB ); /* pushes a value of memvar variable */ -void PushMemvarByRef( PHB_SYMB ); /* pushes a reference to a memvar variable */ -void PushNil( void ); /* in this case it places nil at self */ -void PushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ -void PushStatic( WORD wStatic ); /* pushes the containts of a static onto the stack */ -void PushStaticByRef( WORD iLocal ); /* pushes a static by refrence onto the stack */ -void PushString( char * szText, ULONG length ); /* pushes a string on to the stack */ -void PushSymbol( PHB_SYMB pSym ); /* pushes a function pointer onto the stack */ -void PushInteger( int iNumber ); /* pushes a integer number onto the stack */ -void RetValue( void ); /* pops the latest stack value into stack.Return */ -void SFrame( PHB_SYMB pSym ); /* sets the statics frame for a function */ -void Statics( PHB_SYMB pSym ); /* increases the the global statics array to hold a PRG statics */ - -void ProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ -void DoInitStatics( void ); /* executes all _INITSTATICS functions */ -void DoInitFunctions( int argc, char * argv[] ); /* executes all defined PRGs INIT functions */ -void DoExitFunctions( void ); /* executes all defined PRGs EXIT functions */ -void ReleaseLocalSymbols( void ); /* releases the memory of the local symbols linked list */ +HARBOUR HB_ERRORBLOCK( void ); +HARBOUR HB_PROCNAME( void ); +HARBOUR HB_PROCLINE( void ); +HARBOUR HB___QUIT( void ); +HARBOUR HB_ERRORLEVEL( void ); +HARBOUR HB_PCOUNT( void ); +HARBOUR HB_PVALUE( void ); #ifdef HARBOUR_OBJ_GENERATION -void ProcessObjSymbols ( void ); /* process Harbour generated OBJ symbols */ typedef struct { @@ -156,22 +87,13 @@ extern POBJSYMBOLS HB_FIRSTSYMBOL, HB_LASTSYMBOL; #endif #endif -/* stack management functions */ -void StackDec( void ); /* pops an item from the stack without clearing it's contents */ -void StackPop( void ); /* pops an item from the stack */ -void StackFree( void ); /* releases all memory used by the stack */ -void StackPush( void ); /* pushes an item on to the stack */ -void StackInit( void ); /* initializes the stack */ -void StackShow( void ); /* show the types of the items on the stack for debugging purposes */ +static void hb_vmForceLink( void ); -static void ForceLink( void ); +/* virtual machine state */ -#define STACK_INITHB_ITEMS 100 -#define STACK_EXPANDHB_ITEMS 20 - -int iHB_DEBUG = 0; /* if 1 traces the virtual machine activity */ +BOOL bHB_DEBUG = FALSE; /* if TRUE traces the virtual machine activity */ STACK stack; -HB_SYMB symEval = { "__EVAL", FS_PUBLIC, DoBlock, 0 }; /* symbol to evaluate codeblocks */ +HB_SYMB symEval = { "__EVAL", FS_PUBLIC, hb_vmDoBlock, 0 }; /* symbol to evaluate codeblocks */ PHB_SYMB pSymStart; /* start symbol of the application. MAIN() is not required */ HB_ITEM aStatics; /* Harbour array to hold all application statics variables */ HB_ITEM errorBlock; /* errorblock */ @@ -179,18 +101,17 @@ PSYMBOLS pSymbols = 0; /* to hold a linked list of all different modules sym BOOL bQuit = FALSE; /* inmediately exit the application */ BYTE bErrorLevel = 0; /* application exit errorlevel */ -#define HB_DEBUG( x ) if( iHB_DEBUG ) printf( x ) -#define HB_DEBUG2( x, y ) if( iHB_DEBUG ) printf( x, y ) +#define HB_DEBUG( x ) if( bHB_DEBUG ) printf( x ) +#define HB_DEBUG2( x, y ) if( bHB_DEBUG ) printf( x, y ) /* application entry point */ int main( int argc, char * argv[] ) { int i; - void ( * DontDiscardForceLink )( void ) = &ForceLink; + void ( * DontDiscardForceLink )( void ) = &hb_vmForceLink; - if( ! DontDiscardForceLink ) /* just to avoid warnings from the C compiler */ - iHB_DEBUG += ( int ) DontDiscardForceLink; /* just to avoid warnings from the C compiler */ + HB_SYMBOL_UNUSED( DontDiscardForceLink ); HB_DEBUG( "main\n" ); @@ -199,13 +120,13 @@ int main( int argc, char * argv[] ) errorBlock.type = IT_NIL; stack.Return.type = IT_NIL; - StackInit(); + hb_stackInit(); hb_dynsymNew( &symEval ); /* initialize dynamic symbol for evaluating codeblocks */ hb_setInitialize(); /* initialize Sets */ hb_consoleInitialize(); /* initialize Console */ - hb_MemvarsInit(); + hb_memvarsInit(); #ifdef HARBOUR_OBJ_GENERATION - ProcessObjSymbols(); /* initialize Harbour generated OBJs symbols */ + hb_vmProcessObjSymbols(); /* initialize Harbour generated OBJs symbols */ #endif /* Initialize symbol table with runtime support functions */ @@ -215,8 +136,8 @@ int main( int argc, char * argv[] ) * Static variables have to be initialized before any INIT functions * because INIT function can use static variables */ - DoInitStatics(); - DoInitFunctions( argc, argv ); /* process defined INIT functions */ + hb_vmDoInitStatics(); + hb_vmDoInitFunctions( argc, argv ); /* process defined INIT functions */ #ifdef HARBOUR_START_PROCEDURE { @@ -231,27 +152,27 @@ int main( int argc, char * argv[] ) } #endif - PushSymbol( pSymStart ); /* pushes first FS_PUBLIC defined symbol to the stack */ + hb_vmPushSymbol( pSymStart ); /* pushes first FS_PUBLIC defined symbol to the stack */ - PushNil(); /* places NIL at self */ + hb_vmPushNil(); /* places NIL at self */ for( i = 1; i < argc; i++ ) /* places application parameters on the stack */ - PushString( argv[ i ], strlen( argv[ i ] ) ); + hb_vmPushString( argv[ i ], strlen( argv[ i ] ) ); - Do( argc - 1 ); /* invoke it with number of supplied parameters */ + hb_vmDo( argc - 1 ); /* invoke it with number of supplied parameters */ - DoExitFunctions(); /* process defined EXIT functions */ + hb_vmDoExitFunctions(); /* process defined EXIT functions */ hb_itemClear( &stack.Return ); hb_arrayRelease( &aStatics ); hb_itemClear( &errorBlock ); ReleaseClasses(); - ReleaseLocalSymbols(); /* releases the local modules linked list */ + hb_vmReleaseLocalSymbols(); /* releases the local modules linked list */ hb_dynsymRelease(); /* releases the dynamic symbol table */ hb_consoleRelease(); /* releases Console */ hb_setRelease(); /* releases Sets */ - hb_MemvarsRelease(); - StackFree(); + hb_memvarsRelease(); + hb_stackFree(); /* hb_dynsymLog(); */ HB_DEBUG( "Done!\n" ); @@ -266,11 +187,11 @@ int main( int argc, char * argv[] ) return bErrorLevel; } -void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) +void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ) { BYTE bCode; WORD w = 0, wParams, wSize; - ULONG ulPrivateBase = hb_MemvarGetPrivatesBase(); + ULONG ulPrivateBase = hb_memvarGetPrivatesBase(); HB_DEBUG( "VirtualMachine\n" ); @@ -280,112 +201,112 @@ void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) switch( bCode ) { case HB_P_AND: - And(); + hb_vmAnd(); w++; break; case HB_P_ARRAYAT: - ArrayAt(); + hb_vmArrayAt(); w++; break; case HB_P_ARRAYPUT: - ArrayPut(); + hb_vmArrayPut(); w++; break; case HB_P_DEC: - Dec(); + hb_vmDec(); w++; break; case HB_P_DIMARRAY: - DimArray( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmDimArray( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_DIVIDE: - Div(); + hb_vmDivide(); w++; break; case HB_P_DO: - Do( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmDo( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_DUPLICATE: - Duplicate(); + hb_vmDuplicate(); w++; break; case HB_P_DUPLTWO: - DuplTwo(); + hb_vmDuplTwo(); w++; break; case HB_P_ENDBLOCK: - EndBlock(); - HB_DEBUG( "EndProc\n" ); + hb_vmEndBlock(); + HB_DEBUG( "EndBlock\n" ); return; /* end of a codeblock - stop evaluation */ case HB_P_EQUAL: - Equal( FALSE ); + hb_vmEqual( FALSE ); w++; break; case HB_P_EXACTLYEQUAL: - Equal( TRUE ); + hb_vmEqual( TRUE ); w++; break; case HB_P_FALSE: - PushLogical( 0 ); + hb_vmPushLogical( FALSE ); w++; break; case HB_P_FORTEST: - ForTest(); + hb_vmForTest(); w++; break; case HB_P_FRAME: - Frame( pCode[ w + 1 ], pCode[ w + 2 ] ); + hb_vmFrame( pCode[ w + 1 ], pCode[ w + 2 ] ); w += 3; break; case HB_P_FUNCPTR: - FuncPtr(); + hb_vmFuncPtr(); w++; break; case HB_P_FUNCTION: - Function( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmFunction( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_GENARRAY: - GenArray( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmGenArray( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_GREATER: - Greater(); + hb_vmGreater(); w++; break; case HB_P_GREATEREQUAL: - GreaterEqual(); + hb_vmGreaterEqual(); w++; break; case HB_P_INC: - Inc(); + hb_vmInc(); w++; break; case HB_P_INSTRING: - Instring(); + hb_vmInstring(); w++; break; @@ -398,26 +319,26 @@ void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) break; case HB_P_JUMPFALSE: - if( ! PopLogical() ) + if( ! hb_vmPopLogical() ) w += pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); else w += 3; break; case HB_P_JUMPTRUE: - if( PopLogical() ) + if( hb_vmPopLogical() ) w += pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); else w += 3; break; case HB_P_LESS: - Less(); + hb_vmLess(); w++; break; case HB_P_LESSEQUAL: - LessEqual(); + hb_vmLessEqual(); w++; break; @@ -427,92 +348,92 @@ void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) break; case HB_P_LOCALNAME: - LocalName( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ), - ( char * ) pCode + w + 3 ); + hb_vmLocalName( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ), + ( char * ) pCode + w + 3 ); w += 3; while( pCode[ w++ ] ); break; case HB_P_MESSAGE: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - Message( pSymbols + wParams ); + hb_vmMessage( pSymbols + wParams ); w += 3; break; case HB_P_MINUS: - Minus(); + hb_vmMinus(); w++; break; case HB_P_MODULENAME: - ModuleName( ( char * ) pCode + w + 1 ); + hb_vmModuleName( ( char * ) pCode + w + 1 ); while( pCode[ w++ ] ); break; case HB_P_MODULUS: - Modulus(); + hb_vmModulus(); w++; break; case HB_P_MULT: - Mult(); + hb_vmMult(); w++; break; case HB_P_NEGATE: - Negate(); + hb_vmNegate(); w++; break; case HB_P_NOT: - Not(); + hb_vmNot(); w++; break; case HB_P_NOTEQUAL: - NotEqual(); + hb_vmNotEqual(); w++; break; case HB_P_OR: - Or(); + hb_vmOr(); w++; break; case HB_P_PARAMETER: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - PopParameter( pSymbols + wParams, pCode[ w+3 ] ); + hb_vmPopParameter( pSymbols + wParams, pCode[ w+3 ] ); w +=4; break; case HB_P_PLUS: - Plus(); + hb_vmPlus(); w++; break; case HB_P_POP: - StackPop(); + hb_stackPop(); w++; break; case HB_P_POPLOCAL: - PopLocal( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPopLocal( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_POPMEMVAR: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - PopMemvar( pSymbols + wParams ); + hb_vmPopMemvar( pSymbols + wParams ); w += 3; break; case HB_P_POPSTATIC: - PopStatic( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPopStatic( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_POWER: - Power(); + hb_vmPower(); w++; break; @@ -523,103 +444,103 @@ void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) * +5 +6 -> number of referenced local variables * +7 -> start of table with referenced local variables */ - PushBlock( pCode + w, pSymbols ); + hb_vmPushBlock( pCode + w, pSymbols ); w += (pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 )); break; case HB_P_PUSHDOUBLE: - PushDouble( * ( double * ) ( &pCode[ w + 1 ] ), ( WORD ) * ( BYTE * ) &pCode[ w + 1 + sizeof( double ) ] ); + hb_vmPushDouble( * ( double * ) ( &pCode[ w + 1 ] ), ( WORD ) * ( BYTE * ) &pCode[ w + 1 + sizeof( double ) ] ); w += 1 + sizeof( double ) + 1; break; case HB_P_PUSHINT: - PushInteger( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPushInteger( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_PUSHLOCAL: - PushLocal( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPushLocal( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_PUSHLOCALREF: - PushLocalByRef( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPushLocalByRef( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_PUSHLONG: - PushLong( * ( long * ) ( &pCode[ w + 1 ] ) ); + hb_vmPushLong( * ( long * ) ( &pCode[ w + 1 ] ) ); w += 5; break; case HB_P_PUSHMEMVAR: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - PushMemvar( pSymbols + wParams ); + hb_vmPushMemvar( pSymbols + wParams ); w += 3; break; case HB_P_PUSHMEMVARREF: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - PushMemvarByRef( pSymbols + wParams ); + hb_vmPushMemvarByRef( pSymbols + wParams ); w += 3; break; case HB_P_PUSHNIL: - PushNil(); + hb_vmPushNil(); w++; break; case HB_P_PUSHSELF: - Push( stack.pBase + 1 ); + hb_vmPush( stack.pBase + 1 ); w++; break; case HB_P_PUSHSTATIC: - PushStatic( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPushStatic( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_PUSHSTATICREF: - PushStaticByRef( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); + hb_vmPushStaticByRef( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) ); w += 3; break; case HB_P_PUSHSTR: wSize = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - PushString( (char*)pCode + w + 3, wSize ); + hb_vmPushString( (char*)pCode + w + 3, wSize ); w += ( wSize + 3 ); break; case HB_P_PUSHSYM: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - PushSymbol( pSymbols + wParams ); + hb_vmPushSymbol( pSymbols + wParams ); w += 3; break; case HB_P_RETVALUE: - RetValue(); + hb_vmRetValue(); w++; break; case HB_P_SFRAME: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - SFrame( pSymbols + wParams ); + hb_vmSFrame( pSymbols + wParams ); w += 3; break; case HB_P_STATICS: wParams = pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ); - Statics( pSymbols + wParams ); + hb_vmStatics( pSymbols + wParams ); w += 3; break; case HB_P_TRUE: - PushLogical( 1 ); + hb_vmPushLogical( TRUE ); w++; break; case HB_P_ZERO: - PushInteger( 0 ); + hb_vmPushInteger( 0 ); w++; break; @@ -634,24 +555,23 @@ void VirtualMachine( BYTE * pCode, PHB_SYMB pSymbols ) break; } } - hb_MemvarSetPrivatesBase( ulPrivateBase ); + hb_memvarSetPrivatesBase( ulPrivateBase ); HB_DEBUG( "EndProc\n" ); } -void And( void ) +void hb_vmAnd( void ) { PHB_ITEM pItem2 = stack.pPos - 1; PHB_ITEM pItem1 = stack.pPos - 2; - int iResult; HB_DEBUG( "And\n" ); if( IS_LOGICAL( pItem1 ) && IS_LOGICAL( pItem2 ) ) { - iResult = pItem1->item.asLogical.value && pItem2->item.asLogical.value; - StackPop(); - StackPop(); - PushLogical( iResult ); + BOOL bResult = pItem1->item.asLogical.value && pItem2->item.asLogical.value; + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( bResult ); } else { @@ -659,21 +579,21 @@ void And( void ) } } -void ArrayAt( void ) +void hb_vmArrayAt( void ) { - double dIndex = PopNumber(); + double dIndex = hb_vmPopNumber(); PHB_ITEM pArray = stack.pPos - 1; HB_ITEM item; hb_arrayGet( pArray, dIndex, &item ); - StackPop(); + hb_stackPop(); hb_itemCopy( stack.pPos, &item ); hb_itemClear( &item ); - StackPush(); + hb_stackPush(); } -void ArrayPut( void ) +void hb_vmArrayPut( void ) { PHB_ITEM pValue = stack.pPos - 1; PHB_ITEM pIndex = stack.pPos - 2; @@ -694,11 +614,11 @@ void ArrayPut( void ) hb_arraySet( pArray, ulIndex, pValue ); hb_itemCopy( pArray, pValue ); /* places pValue at pArray position */ - StackPop(); - StackPop(); + hb_stackPop(); + hb_stackPop(); } -void Dec( void ) +void hb_vmDec( void ) { double dNumber; LONG lDate; @@ -706,18 +626,18 @@ void Dec( void ) if( IS_NUMERIC( stack.pPos - 1 ) ) { - dNumber = PopDouble( &wDec ); - PushNumber( --dNumber, wDec ); + dNumber = hb_vmPopDouble( &wDec ); + hb_vmPushNumber( --dNumber, wDec ); } else if( IS_DATE( stack.pPos - 1 ) ) { - lDate = PopDate(); - PushDate( --lDate ); /* TOFIX: Dates should decreased other way */ + lDate = hb_vmPopDate(); + hb_vmPushDate( --lDate ); /* TOFIX: Dates should decreased other way */ } /* TODO: Should we check other types here and issue an error ? */ } -void DimArray( WORD wDimensions ) /* generates a wDimensions Array and initialize those dimensions from the stack values */ +void hb_vmDimArray( WORD wDimensions ) /* generates a wDimensions Array and initialize those dimensions from the stack values */ { HB_ITEM itArray; WORD w; // , wElements; @@ -736,25 +656,25 @@ void DimArray( WORD wDimensions ) /* generates a wDimensions Array and initializ // stack.pPos - wElements + w ); for( w = 0; w < wDimensions; w++ ) - StackPop(); + hb_stackPop(); hb_itemCopy( stack.pPos, &itArray ); hb_itemClear( &itArray ); - StackPush(); + hb_stackPush(); } -void Div( void ) +void hb_vmDivide( void ) { WORD wDec1, wDec2; - double d2 = PopDouble( &wDec2 ); - double d1 = PopDouble( &wDec1 ); + double d2 = hb_vmPopDouble( &wDec2 ); + double d1 = hb_vmPopDouble( &wDec1 ); /* NOTE: Clipper always returns the result of a division with the SET number of decimal places. */ - PushNumber( d1 / d2, hb_set.HB_SET_DECIMALS ); + hb_vmPushNumber( d1 / d2, hb_set.HB_SET_DECIMALS ); } -void Do( WORD wParams ) +void hb_vmDo( WORD wParams ) { PHB_ITEM pItem = stack.pPos - wParams - 2; /* procedure name */ PHB_SYMB pSym = pItem->item.asSymbol.value; @@ -767,14 +687,14 @@ void Do( WORD wParams ) if( ! IS_SYMBOL( pItem ) ) { - StackShow(); + hb_stackShow(); printf( "symbol item expected as a base from Do() in line %i\n", stack.pBase->item.asSymbol.lineno ); exit( 1 ); } /* if( ! IS_NIL( pSelf ) ) { - StackShow(); + hb_stackShow(); printf( "invalid symbol type for self from Do()\n" ); exit( 1 ); } */ @@ -813,13 +733,13 @@ void Do( WORD wParams ) } while( stack.pPos > stack.pItems + wItemIndex ) - StackPop(); + hb_stackPop(); stack.pBase = stack.pItems + wStackBase; stack.iStatics = iStatics; } -HARBOUR DoBlock( void ) +HARBOUR hb_vmDoBlock( void ) { PHB_ITEM pBlock = stack.pBase + 1; WORD wStackBase = stack.pBase - stack.pItems; /* as the stack memory block could change */ @@ -835,14 +755,14 @@ HARBOUR DoBlock( void ) iParam =pBlock->item.asBlock.paramcnt -hb_pcount(); /* add missing parameters */ while( iParam-- > 0 ) - PushNil(); + hb_vmPushNil(); /* set pBaseCB to point to local variables of a function where * the codeblock was defined */ stack.pBase->item.asSymbol.lineno =pBlock->item.asBlock.lineno; - hb_CodeblockEvaluate( pBlock ); + hb_codeblockEvaluate( pBlock ); /* restore stack pointers */ stack.pBase = stack.pItems + wStackBase; @@ -850,18 +770,18 @@ HARBOUR DoBlock( void ) HB_DEBUG( "End of DoBlock\n" ); } -void Duplicate( void ) +void hb_vmDuplicate( void ) { hb_itemCopy( stack.pPos, stack.pPos - 1 ); - StackPush(); + hb_stackPush(); } -void DuplTwo( void ) +void hb_vmDuplTwo( void ) { hb_itemCopy( stack.pPos, stack.pPos - 2 ); - StackPush(); + hb_stackPush(); hb_itemCopy( stack.pPos, stack.pPos - 2 ); - StackPush(); + hb_stackPush(); } HARBOUR HB_EVAL( void ) @@ -872,13 +792,13 @@ HARBOUR HB_EVAL( void ) { WORD w; - PushSymbol( &symEval ); - Push( pBlock ); + hb_vmPushSymbol( &symEval ); + hb_vmPush( pBlock ); for( w = 2; w <= hb_pcount(); w++ ) - Push( hb_param( w, IT_ANY ) ); + hb_vmPush( hb_param( w, IT_ANY ) ); - Do( hb_pcount() - 1 ); + hb_vmDo( hb_pcount() - 1 ); } else { @@ -887,15 +807,15 @@ HARBOUR HB_EVAL( void ) } } -void EndBlock( void ) +void hb_vmEndBlock( void ) { - StackDec(); /* make the last item visible */ + hb_stackDec(); /* make the last item visible */ hb_itemCopy( &stack.Return, stack.pPos ); /* copy it */ hb_itemClear( stack.pPos ); /* and now clear it */ HB_DEBUG( "EndBlock\n" ); } -void Equal( BOOL bExact ) +void hb_vmEqual( BOOL bExact ) { PHB_ITEM pItem2 = stack.pPos - 1; PHB_ITEM pItem1 = stack.pPos - 2; @@ -904,34 +824,34 @@ void Equal( BOOL bExact ) if( IS_NIL( pItem1 ) && IS_NIL( pItem2 ) ) { - StackPop(); - StackPop(); - PushLogical( 1 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( TRUE ); } else if ( IS_NIL( pItem1 ) || IS_NIL( pItem2 ) ) { - StackPop(); - StackPop(); - PushLogical( 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( FALSE ); } else if( IS_STRING( pItem1 ) && IS_STRING( pItem2 ) ) { i = hb_itemStrCmp( pItem1, pItem2, bExact ); - StackPop(); - StackPop(); - PushLogical( i == 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( i == 0 ); } else if( IS_LOGICAL( pItem1 ) && IS_LOGICAL( pItem2 ) ) - PushLogical( PopLogical() == PopLogical() ); + hb_vmPushLogical( hb_vmPopLogical() == hb_vmPopLogical() ); else if( IS_NUMERIC( pItem1 ) && IS_NUMERIC( pItem2 ) ) - PushLogical( PopDouble(&wDec) == PopDouble(&wDec) ); + hb_vmPushLogical( hb_vmPopDouble(&wDec) == hb_vmPopDouble(&wDec) ); else if( IS_OBJECT( pItem1 ) && hb_isMessage( pItem1, "==" ) ) - OperatorCall( pItem1, pItem2, "==" ); + hb_vmOperatorCall( pItem1, pItem2, "==" ); else if( pItem1->type != pItem2->type ) { @@ -939,30 +859,30 @@ void Equal( BOOL bExact ) } else - PushLogical( 0 ); + hb_vmPushLogical( FALSE ); } -void ForTest( void ) /* Test to check the end point of the FOR */ +void hb_vmForTest( void ) /* Test to check the end point of the FOR */ { double dStep; - int iEqual; + BOOL bEqual; if( IS_NUMERIC( stack.pPos - 1 ) ) { WORD wDec; - dStep = PopDouble( &wDec ); + dStep = hb_vmPopDouble( &wDec ); /* NOTE: step of zero will cause endless loop, as in Clipper */ if( dStep > 0 ) /* Positive loop. Use LESS */ - Less(); + hb_vmLess(); else if( dStep < 0 ) /* Negative loop. Use GREATER */ - Greater(); + hb_vmGreater(); - iEqual = PopLogical(); /* Logical should be on top of stack */ - PushNumber( dStep, wDec ); /* Push the step expression back on the stack */ - PushLogical( iEqual ); + bEqual = hb_vmPopLogical(); /* Logical should be on top of stack */ + hb_vmPushNumber( dStep, wDec ); /* Push the step expression back on the stack */ + hb_vmPushLogical( bEqual ); } else { @@ -970,24 +890,24 @@ void ForTest( void ) /* Test to check the end point of the FOR */ } } -void Frame( BYTE bLocals, BYTE bParams ) +void hb_vmFrame( BYTE bLocals, BYTE bParams ) { int i, iTotal = bLocals + bParams; HB_DEBUG( "Frame\n" ); if( iTotal ) for( i = 0; i < ( iTotal - stack.pBase->item.asSymbol.paramcnt ); i++ ) - PushNil(); + hb_vmPushNil(); } -void FuncPtr( void ) /* pushes a function address pointer. Removes the symbol from the satck */ +void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes the symbol from the satck */ { PHB_ITEM pItem = stack.pPos - 1; if( IS_SYMBOL( pItem ) ) { - StackPop(); - PushLong( ( ULONG ) pItem->item.asSymbol.value->pFunPtr ); + hb_stackPop(); + hb_vmPushLong( ( ULONG ) pItem->item.asSymbol.value->pFunPtr ); } else { @@ -996,14 +916,14 @@ void FuncPtr( void ) /* pushes a function address pointer. Removes the symbol f } } -void Function( WORD wParams ) +void hb_vmFunction( WORD wParams ) { - Do( wParams ); + hb_vmDo( wParams ); hb_itemCopy( stack.pPos, &stack.Return ); - StackPush(); + hb_stackPush(); } -void GenArray( WORD wElements ) /* generates a wElements Array and fills it from the stack values */ +void hb_vmGenArray( WORD wElements ) /* generates a wElements Array and fills it from the stack values */ { HB_ITEM itArray; WORD w; @@ -1015,52 +935,51 @@ void GenArray( WORD wElements ) /* generates a wElements Array and fills it from stack.pPos - wElements + w ); for( w = 0; w < wElements; w++ ) - StackPop(); + hb_stackPop(); hb_itemCopy( stack.pPos, &itArray ); hb_itemClear( &itArray ); - StackPush(); + hb_stackPush(); } -void Greater( void ) +void hb_vmGreater( void ) { double dNumber1, dNumber2; LONG lDate1, lDate2; int i; - int iLogical1, iLogical2; if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) ) { i = hb_itemStrCmp( stack.pPos - 2, stack.pPos - 1, FALSE ); - StackPop(); - StackPop(); - PushLogical( i > 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( i > 0 ); } else if( IS_NUMERIC( stack.pPos - 1 ) && IS_NUMERIC( stack.pPos - 2 ) ) { - dNumber2 = PopNumber(); - dNumber1 = PopNumber(); - PushLogical( dNumber1 > dNumber2 ); + dNumber2 = hb_vmPopNumber(); + dNumber1 = hb_vmPopNumber(); + hb_vmPushLogical( dNumber1 > dNumber2 ); } else if( IS_DATE( stack.pPos - 1 ) && IS_DATE( stack.pPos - 2 ) ) { - lDate2 = PopDate(); - lDate1 = PopDate(); - PushLogical( lDate1 > lDate2 ); + lDate2 = hb_vmPopDate(); + lDate1 = hb_vmPopDate(); + hb_vmPushLogical( lDate1 > lDate2 ); } else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) ) { - iLogical1 = PopLogical(); - iLogical2 = PopLogical(); - PushLogical( iLogical1 > iLogical2 ); + BOOL bLogical1 = hb_vmPopLogical(); + BOOL bLogical2 = hb_vmPopLogical(); + hb_vmPushLogical( bLogical1 > bLogical2 ); } else if( IS_OBJECT( stack.pPos - 2 ) && hb_isMessage( stack.pPos - 2, ">" ) ) - OperatorCall( stack.pPos - 2, stack.pPos - 1, ">" ); + hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, ">" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) { @@ -1068,45 +987,44 @@ void Greater( void ) } } -void GreaterEqual( void ) +void hb_vmGreaterEqual( void ) { double dNumber1, dNumber2; LONG lDate1, lDate2; int i; - int iLogical1, iLogical2; if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) ) { i = hb_itemStrCmp( stack.pPos - 2, stack.pPos - 1, FALSE ); - StackPop(); - StackPop(); - PushLogical( i >= 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( i >= 0 ); } else if( IS_NUMERIC( stack.pPos - 1 ) && IS_NUMERIC( stack.pPos - 2 ) ) { - dNumber2 = PopNumber(); - dNumber1 = PopNumber(); - PushLogical( dNumber1 >= dNumber2 ); + dNumber2 = hb_vmPopNumber(); + dNumber1 = hb_vmPopNumber(); + hb_vmPushLogical( dNumber1 >= dNumber2 ); } else if( IS_DATE( stack.pPos - 1 ) && IS_DATE( stack.pPos - 2 ) ) { - lDate2 = PopDate(); - lDate1 = PopDate(); - PushLogical( lDate1 >= lDate2 ); + lDate2 = hb_vmPopDate(); + lDate1 = hb_vmPopDate(); + hb_vmPushLogical( lDate1 >= lDate2 ); } else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) ) { - iLogical1 = PopLogical(); - iLogical2 = PopLogical(); - PushLogical( iLogical1 >= iLogical2 ); + BOOL bLogical1 = hb_vmPopLogical(); + BOOL bLogical2 = hb_vmPopLogical(); + hb_vmPushLogical( bLogical1 >= bLogical2 ); } else if( IS_OBJECT( stack.pPos - 2 ) && hb_isMessage( stack.pPos - 2, ">=" ) ) - OperatorCall( stack.pPos - 2, stack.pPos - 1, ">=" ); + hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, ">=" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) { @@ -1114,7 +1032,7 @@ void GreaterEqual( void ) } } -void Inc( void ) +void hb_vmInc( void ) { double dNumber; LONG lDate; @@ -1122,13 +1040,13 @@ void Inc( void ) if( IS_NUMERIC( stack.pPos - 1 ) ) { - dNumber = PopDouble( &wDec ); - PushNumber( ++dNumber, wDec ); + dNumber = hb_vmPopDouble( &wDec ); + hb_vmPushNumber( ++dNumber, wDec ); } else if( IS_DATE( stack.pPos - 1 ) ) { - lDate = PopDate(); - PushDate( ++lDate ); + lDate = hb_vmPopDate(); + hb_vmPushDate( ++lDate ); } else { @@ -1136,7 +1054,7 @@ void Inc( void ) } } -void Instring( void ) +void hb_vmInstring( void ) { PHB_ITEM pItem1 = stack.pPos - 2; PHB_ITEM pItem2 = stack.pPos - 1; @@ -1146,9 +1064,9 @@ void Instring( void ) { iResult = hb_strAt( pItem1->item.asString.value, pItem1->item.asString.length, pItem2->item.asString.value, pItem2->item.asString.length ); - StackPop(); - StackPop(); - PushLogical( iResult == 0 ? 0 : 1 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( iResult == 0 ? FALSE : TRUE ); } else { @@ -1156,45 +1074,44 @@ void Instring( void ) } } -void Less( void ) +void hb_vmLess( void ) { double dNumber1, dNumber2; LONG lDate1, lDate2; int i; - int iLogical1, iLogical2; if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) ) { i = hb_itemStrCmp( stack.pPos - 2, stack.pPos - 1, FALSE ); - StackPop(); - StackPop(); - PushLogical( i < 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( i < 0 ); } else if( IS_NUMERIC( stack.pPos - 1 ) && IS_NUMERIC( stack.pPos - 2 ) ) { - dNumber2 = PopNumber(); - dNumber1 = PopNumber(); - PushLogical( dNumber1 < dNumber2 ); + dNumber2 = hb_vmPopNumber(); + dNumber1 = hb_vmPopNumber(); + hb_vmPushLogical( dNumber1 < dNumber2 ); } else if( IS_DATE( stack.pPos - 1 ) && IS_DATE( stack.pPos - 2 ) ) { - lDate2 = PopDate(); - lDate1 = PopDate(); - PushLogical( lDate1 < lDate2 ); + lDate2 = hb_vmPopDate(); + lDate1 = hb_vmPopDate(); + hb_vmPushLogical( lDate1 < lDate2 ); } else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) ) { - iLogical1 = PopLogical(); - iLogical2 = PopLogical(); - PushLogical( iLogical1 < iLogical2 ); + BOOL bLogical1 = hb_vmPopLogical(); + BOOL bLogical2 = hb_vmPopLogical(); + hb_vmPushLogical( bLogical1 < bLogical2 ); } else if( IS_OBJECT( stack.pPos - 2 ) && hb_isMessage( stack.pPos - 2, "<" ) ) - OperatorCall( stack.pPos - 2, stack.pPos - 1, "<" ); + hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, "<" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) { @@ -1202,45 +1119,44 @@ void Less( void ) } } -void LessEqual( void ) +void hb_vmLessEqual( void ) { double dNumber1, dNumber2; LONG lDate1, lDate2; int i; - int iLogical1, iLogical2; if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) ) { i = hb_itemStrCmp( stack.pPos - 2, stack.pPos - 1, FALSE ); - StackPop(); - StackPop(); - PushLogical( i <= 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( i <= 0 ); } else if( IS_NUMERIC( stack.pPos - 1 ) && IS_NUMERIC( stack.pPos - 2 ) ) { - dNumber2 = PopNumber(); - dNumber1 = PopNumber(); - PushLogical( dNumber1 <= dNumber2 ); + dNumber2 = hb_vmPopNumber(); + dNumber1 = hb_vmPopNumber(); + hb_vmPushLogical( dNumber1 <= dNumber2 ); } else if( IS_DATE( stack.pPos - 1 ) && IS_DATE( stack.pPos - 2 ) ) { - lDate2 = PopDate(); - lDate1 = PopDate(); - PushLogical( lDate1 <= lDate2 ); + lDate2 = hb_vmPopDate(); + lDate1 = hb_vmPopDate(); + hb_vmPushLogical( lDate1 <= lDate2 ); } else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) ) { - iLogical1 = PopLogical(); - iLogical2 = PopLogical(); - PushLogical( iLogical1 <= iLogical2 ); + BOOL bLogical1 = hb_vmPopLogical(); + BOOL bLogical2 = hb_vmPopLogical(); + hb_vmPushLogical( bLogical1 <= bLogical2 ); } else if( IS_OBJECT( stack.pPos - 2 ) && hb_isMessage( stack.pPos - 2, "<=" ) ) - OperatorCall( stack.pPos - 2, stack.pPos - 1, "<=" ); + hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, "<=" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) { @@ -1248,22 +1164,22 @@ void LessEqual( void ) } } -void LocalName( WORD wLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */ +void hb_vmLocalName( WORD wLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */ { } -void Message( PHB_SYMB pSymMsg ) /* sends a message to an object */ +void hb_vmMessage( PHB_SYMB pSymMsg ) /* sends a message to an object */ { hb_itemCopy( stack.pPos, stack.pPos - 1 ); /* moves the object forward */ hb_itemClear( stack.pPos - 1 ); ( stack.pPos - 1 )->type = IT_SYMBOL; ( stack.pPos - 1 )->item.asSymbol.value = pSymMsg; ( stack.pPos - 1 )->item.asSymbol.stackbase = ( stack.pPos - 1 ) - stack.pItems; - StackPush(); + hb_stackPush(); HB_DEBUG2( "Message: %s\n", pSymMsg->szName ); } -void Negate( void ) +void hb_vmNegate( void ) { if( IS_INTEGER( stack.pPos - 1 ) ) ( stack.pPos - 1 )->item.asInteger.value = -( stack.pPos - 1 )->item.asInteger.value; @@ -1275,7 +1191,7 @@ void Negate( void ) ( stack.pPos - 1 )->item.asDouble.value = -( stack.pPos - 1 )->item.asDouble.value; } -void Not( void ) +void hb_vmNot( void ) { PHB_ITEM pItem = stack.pPos - 1; @@ -1285,7 +1201,7 @@ void Not( void ) hb_errorRT_BASE(EG_ARG, 1077, NULL, ".NOT."); } -void NotEqual( void ) +void hb_vmNotEqual( void ) { PHB_ITEM pItem2 = stack.pPos - 1; PHB_ITEM pItem1 = stack.pPos - 2; @@ -1294,34 +1210,34 @@ void NotEqual( void ) if( IS_NIL( pItem1 ) && IS_NIL( pItem2 ) ) { - StackDec(); - StackDec(); - PushLogical( 0 ); + hb_stackDec(); + hb_stackDec(); + hb_vmPushLogical( FALSE ); } else if ( IS_NIL( pItem1 ) || IS_NIL( pItem2 ) ) { - StackPop(); - StackPop(); - PushLogical( 1 ); /* TOFIX: Is this correct ? */ + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( TRUE ); } else if( IS_STRING( pItem1 ) && IS_STRING( pItem2 ) ) { i = hb_itemStrCmp( pItem1, pItem2, FALSE ); - StackPop(); - StackPop(); - PushLogical( i != 0 ); + hb_stackPop(); + hb_stackPop(); + hb_vmPushLogical( i != 0 ); } else if( IS_NUMERIC( pItem1 ) && IS_NUMERIC( pItem2 ) ) - PushLogical( PopDouble( &wDec ) != PopDouble( &wDec ) ); + hb_vmPushLogical( hb_vmPopDouble( &wDec ) != hb_vmPopDouble( &wDec ) ); else if( IS_LOGICAL( pItem1 ) && IS_LOGICAL( pItem2 ) ) - PushLogical( PopLogical() != PopLogical() ); + hb_vmPushLogical( hb_vmPopLogical() != hb_vmPopLogical() ); else if( IS_OBJECT( pItem1 ) && hb_isMessage( pItem1, "!=" ) ) - OperatorCall( pItem1, pItem2, "!=" ); + hb_vmOperatorCall( pItem1, pItem2, "!=" ); else if( pItem1->type != pItem2->type ) { @@ -1329,34 +1245,35 @@ void NotEqual( void ) } else - PushLogical( 1 ); + hb_vmPushLogical( TRUE ); } -void Minus( void ) +void hb_vmMinus( void ) { - double dNumber1, dNumber2; - long lDate1, lDate2; PHB_ITEM pItem2 = stack.pPos - 1; PHB_ITEM pItem1 = stack.pPos - 2; if( IS_NUMERIC( pItem2 ) && IS_NUMERIC( pItem1 ) ) { WORD wDec2, wDec1; - dNumber2 = PopDouble( &wDec2 ); - dNumber1 = PopDouble( &wDec1 ); - PushNumber( dNumber1 - dNumber2, (wDec1 > wDec2) ? wDec1 : wDec2 ); + double dNumber2 = hb_vmPopDouble( &wDec2 ); + double dNumber1 = hb_vmPopDouble( &wDec1 ); + + hb_vmPushNumber( dNumber1 - dNumber2, (wDec1 > wDec2) ? wDec1 : wDec2 ); } else if( IS_DATE( pItem2 ) && IS_DATE( pItem1 ) ) { - lDate2 = PopDate(); - lDate1 = PopDate(); - PushNumber( lDate1 - lDate2, hb_set.HB_SET_DECIMALS ); + long lDate2 = hb_vmPopDate(); + long lDate1 = hb_vmPopDate(); + + hb_vmPushNumber( lDate1 - lDate2, hb_set.HB_SET_DECIMALS ); } else if( IS_NUMERIC( pItem2 ) && IS_DATE( pItem1 ) ) { - dNumber2 = PopNumber(); - lDate1 = PopDate(); - PushDate( lDate1 - dNumber2 ); + double dNumber2 = hb_vmPopNumber(); + long lDate1 = hb_vmPopDate(); + + hb_vmPushDate( lDate1 - dNumber2 ); } else if( IS_STRING( pItem1 ) && IS_STRING( pItem2 ) ) { @@ -1380,64 +1297,63 @@ void Minus( void ) hb_xfree( pItem2->item.asString.value ); pItem2->item.asString.value = NULL; } - StackPop(); + hb_stackPop(); return; } else if( IS_OBJECT( stack.pPos - 2 ) && hb_isMessage( stack.pPos - 2, "-" ) ) - OperatorCall( stack.pPos - 2, stack.pPos - 1, "-" ); + hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, "-" ); else hb_errorRT_BASE(EG_ARG, 1082, NULL, "-"); } -void ModuleName( char * szModuleName ) /* PRG and function name information for the debugger */ +void hb_vmModuleName( char * szModuleName ) /* PRG and function name information for the debugger */ { - PushSymbol( hb_dynsymFind( "DEBUGGER" )->pSymbol ); - PushNil(); - PushString( szModuleName, strlen( szModuleName ) ); - Do( 1 ); + hb_vmPushSymbol( hb_dynsymFind( "DEBUGGER" )->pSymbol ); + hb_vmPushNil(); + hb_vmPushString( szModuleName, strlen( szModuleName ) ); + hb_vmDo( 1 ); } -void Modulus( void ) +void hb_vmModulus( void ) { WORD wDec1, wDec2; - double d2 = PopDouble( &wDec2 ); - double d1 = PopDouble( &wDec1 ); + double d2 = hb_vmPopDouble( &wDec2 ); + double d1 = hb_vmPopDouble( &wDec1 ); /* NOTE: Clipper always returns the result of modulus with the SET number of decimal places. */ - PushNumber( fmod( d1, d2 ), hb_set.HB_SET_DECIMALS ); + hb_vmPushNumber( fmod( d1, d2 ), hb_set.HB_SET_DECIMALS ); } -void Mult( void ) +void hb_vmMult( void ) { WORD wDec2, wDec1; - double d2 = PopDouble( &wDec2 ); - double d1 = PopDouble( &wDec1 ); + double d2 = hb_vmPopDouble( &wDec2 ); + double d1 = hb_vmPopDouble( &wDec1 ); - PushNumber( d1 * d2, wDec1 + wDec2 ); + hb_vmPushNumber( d1 * d2, wDec1 + wDec2 ); } -void OperatorCall( PHB_ITEM pItem1, PHB_ITEM pItem2, char *szSymbol ) +void hb_vmOperatorCall( PHB_ITEM pItem1, PHB_ITEM pItem2, char *szSymbol ) { - Push( pItem1 ); /* Push object */ - Message( hb_dynsymGet( szSymbol )->pSymbol ); /* Push operation */ - Push( pItem2 ); /* Push argument */ - Function( 1 ); + hb_vmPush( pItem1 ); /* Push object */ + hb_vmMessage( hb_dynsymGet( szSymbol )->pSymbol ); /* Push operation */ + hb_vmPush( pItem2 ); /* Push argument */ + hb_vmFunction( 1 ); } -void Or( void ) +void hb_vmOr( void ) { PHB_ITEM pItem2 = stack.pPos - 1; PHB_ITEM pItem1 = stack.pPos - 2; - int iResult; if( IS_LOGICAL( pItem1 ) && IS_LOGICAL( pItem2 ) ) { - iResult = pItem1->item.asLogical.value || pItem2->item.asLogical.value; - StackDec(); stack.pPos->type =IT_NIL; - StackDec(); - PushLogical( iResult ); + BOOL bResult = pItem1->item.asLogical.value || pItem2->item.asLogical.value; + hb_stackDec(); stack.pPos->type = IT_NIL; + hb_stackDec(); + hb_vmPushLogical( bResult ); } else { @@ -1445,12 +1361,10 @@ void Or( void ) } } -void Plus( void ) +void hb_vmPlus( void ) { PHB_ITEM pItem1 = stack.pPos - 2; PHB_ITEM pItem2 = stack.pPos - 1; - double dNumber1, dNumber2; - long lDate1, lDate2; if( IS_STRING( pItem1 ) && IS_STRING( pItem2 ) ) { @@ -1464,36 +1378,38 @@ void Plus( void ) hb_xfree( pItem2->item.asString.value ); pItem2->item.asString.value = NULL; } - StackPop(); + hb_stackPop(); return; } else if( IS_NUMERIC( pItem1 ) && IS_NUMERIC( pItem2 ) ) { WORD wDec2, wDec1; - dNumber2 = PopDouble( &wDec2 ); - dNumber1 = PopDouble( &wDec1 ); + double dNumber1 = hb_vmPopDouble( &wDec2 ); + double dNumber2 = hb_vmPopDouble( &wDec1 ); - PushNumber( dNumber1 + dNumber2, (wDec1>wDec2) ? wDec1 : wDec2 ); + hb_vmPushNumber( dNumber1 + dNumber2, ( wDec1 > wDec2 ) ? wDec1 : wDec2 ); } else if( IS_DATE( pItem1 ) && IS_DATE( pItem2 ) ) { - lDate2 = PopDate(); - lDate1 = PopDate(); - PushDate( lDate1 + lDate2 ); + long lDate1 = hb_vmPopDate(); + long lDate2 = hb_vmPopDate(); + + hb_vmPushDate( lDate1 + lDate2 ); } else if( IS_DATE( pItem1 ) && IS_NUMERIC( pItem2 ) ) { WORD wDec; - dNumber2 = PopDouble( &wDec ); - lDate1 = PopDate(); - PushDate( lDate1 + dNumber2 ); + double dNumber2 = hb_vmPopDouble( &wDec ); + long lDate1 = hb_vmPopDate(); + + hb_vmPushDate( lDate1 + dNumber2 ); } else if( IS_OBJECT( pItem1 ) && hb_isMessage( pItem2, "+" ) ) - OperatorCall( pItem1, pItem2, "+" ); + hb_vmOperatorCall( pItem1, pItem2, "+" ); else hb_errorRT_BASE( EG_ARG, 1081, NULL, "+" ); @@ -1501,13 +1417,13 @@ void Plus( void ) HB_DEBUG( "Plus\n" ); } -long PopDate( void ) +long hb_vmPopDate( void ) { - StackDec(); + hb_stackDec(); if( IS_DATE( stack.pPos ) ) { - stack.pPos->type =IT_NIL; + stack.pPos->type = IT_NIL; return stack.pPos->item.asDate.value; } else @@ -1518,12 +1434,11 @@ long PopDate( void ) } } - -double PopDouble( WORD *pwDec ) +double hb_vmPopDouble( WORD *pwDec ) { double d; - StackDec(); + hb_stackDec(); switch( stack.pPos->type & ~IT_BYREF ) { case IT_INTEGER: @@ -1546,16 +1461,16 @@ double PopDouble( WORD *pwDec ) exit( 1 ); d = 0; } - stack.pPos->type =IT_NIL; - HB_DEBUG( "PopDouble\n" ); + stack.pPos->type = IT_NIL; + HB_DEBUG( "hb_vmPopDouble\n" ); return d; } -void PopLocal( SHORT iLocal ) +void hb_vmPopLocal( SHORT iLocal ) { PHB_ITEM pLocal; - StackDec(); + hb_stackDec(); if( iLocal >= 0 ) { @@ -1570,19 +1485,19 @@ void PopLocal( SHORT iLocal ) /* local variable referenced in a codeblock * stack.pBase+1 points to a codeblock that is currently evaluated */ - hb_itemCopy( hb_CodeblockGetVar( stack.pBase + 1, iLocal ), stack.pPos ); + hb_itemCopy( hb_codeblockGetVar( stack.pBase + 1, iLocal ), stack.pPos ); hb_itemClear( stack.pPos ); - HB_DEBUG( "PopLocal\n" ); + HB_DEBUG( "hb_vmPopLocal\n" ); } -int PopLogical( void ) +BOOL hb_vmPopLogical( void ) { - StackDec(); + hb_stackDec(); if( IS_LOGICAL( stack.pPos ) ) { - stack.pPos->type =IT_NIL; + stack.pPos->type = IT_NIL; return stack.pPos->item.asLogical.value; } else @@ -1592,20 +1507,20 @@ int PopLogical( void ) } } -void PopMemvar( PHB_SYMB pSym ) +void hb_vmPopMemvar( PHB_SYMB pSym ) { - StackDec(); - hb_MemvarSetValue( pSym, stack.pPos ); + hb_stackDec(); + hb_memvarSetValue( pSym, stack.pPos ); hb_itemClear( stack.pPos ); - HB_DEBUG( "PopMemvar\n" ); + HB_DEBUG( "hb_vmPopMemvar\n" ); } -double PopNumber( void ) +double hb_vmPopNumber( void ) { PHB_ITEM pItem = stack.pPos - 1; double dNumber; - StackDec(); + hb_stackDec(); switch( pItem->type & ~IT_BYREF ) { @@ -1623,25 +1538,25 @@ double PopNumber( void ) default: printf( "Incorrect item on the stack trying to pop a number in line %i\n", stack.pBase->item.asSymbol.lineno ); - StackShow(); + hb_stackShow(); exit( 1 ); break; } - stack.pPos->type =IT_NIL; + stack.pPos->type = IT_NIL; return dNumber; } -void PopParameter( PHB_SYMB pSym, BYTE bParam ) +void hb_vmPopParameter( PHB_SYMB pSym, BYTE bParam ) { - hb_MemvarSetValue( pSym, stack.pBase +1 +bParam ); - HB_DEBUG( "PopParameter\n" ); + hb_memvarSetValue( pSym, stack.pBase +1 +bParam ); + HB_DEBUG( "hb_vmPopParameter\n" ); } -void PopStatic( WORD wStatic ) +void hb_vmPopStatic( WORD wStatic ) { PHB_ITEM pStatic; - StackDec(); + hb_stackDec(); pStatic = aStatics.item.asArray.value->pItems + stack.iStatics + wStatic - 1; if( IS_BYREF( pStatic ) ) @@ -1650,29 +1565,29 @@ void PopStatic( WORD wStatic ) hb_itemCopy( pStatic, stack.pPos ); hb_itemClear( stack.pPos ); - HB_DEBUG( "PopStatic\n" ); + HB_DEBUG( "hb_vmPopStatic\n" ); } -void Power( void ) +void hb_vmPower( void ) { WORD wDec1, wDec2; - double d2 = PopDouble( &wDec2 ); - double d1 = PopDouble( &wDec1 ); + double d2 = hb_vmPopDouble( &wDec2 ); + double d1 = hb_vmPopDouble( &wDec1 ); /* NOTE: Clipper always returns the result of power with the SET number of decimal places. */ - PushNumber( pow( d1, d2 ), hb_set.HB_SET_DECIMALS ); + hb_vmPushNumber( pow( d1, d2 ), hb_set.HB_SET_DECIMALS ); } -void PushLogical( int iTrueFalse ) +void hb_vmPushLogical( BOOL bValue ) { - stack.pPos->type = IT_LOGICAL; - stack.pPos->item.asLogical.value = iTrueFalse; - StackPush(); - HB_DEBUG( "PushLogical\n" ); + stack.pPos->type = IT_LOGICAL; + stack.pPos->item.asLogical.value = bValue; + hb_stackPush(); + HB_DEBUG( "hb_vmPushLogical\n" ); } -void PushLocal( SHORT iLocal ) +void hb_vmPushLocal( SHORT iLocal ) { if( iLocal >= 0 ) { @@ -1689,13 +1604,13 @@ void PushLocal( SHORT iLocal ) /* local variable referenced in a codeblock * stack.pBase+1 points to a codeblock that is currently evaluated */ - hb_itemCopy( stack.pPos, hb_CodeblockGetVar( stack.pBase + 1, (LONG)iLocal ) ); + hb_itemCopy( stack.pPos, hb_codeblockGetVar( stack.pBase + 1, (LONG)iLocal ) ); - StackPush(); - HB_DEBUG2( "PushLocal %i\n", iLocal ); + hb_stackPush(); + HB_DEBUG2( "hb_vmPushLocal %i\n", iLocal ); } -void PushLocalByRef( SHORT iLocal ) +void hb_vmPushLocalByRef( SHORT iLocal ) { stack.pPos->type = IT_BYREF; /* we store its stack offset instead of a pointer to support a dynamic stack */ @@ -1703,47 +1618,47 @@ void PushLocalByRef( SHORT iLocal ) stack.pPos->item.asRefer.offset = stack.pBase - stack.pItems +1; stack.pPos->item.asRefer.itemsbase = &stack.pItems; - StackPush(); - HB_DEBUG2( "PushLocalByRef %i\n", iLocal ); + hb_stackPush(); + HB_DEBUG2( "hb_vmPushLocalByRef %i\n", iLocal ); } -void PushMemvar( PHB_SYMB pSym ) +void hb_vmPushMemvar( PHB_SYMB pSym ) { - hb_MemvarGetValue( stack.pPos, pSym ); - StackPush(); - HB_DEBUG( "PushMemvar\n" ); + hb_memvarGetValue( stack.pPos, pSym ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushMemvar\n" ); } -void PushMemvarByRef( PHB_SYMB pSym ) +void hb_vmPushMemvarByRef( PHB_SYMB pSym ) { - hb_MemvarGetRefer( stack.pPos, pSym ); - StackPush(); - HB_DEBUG( "PushMemvar\n" ); + hb_memvarGetRefer( stack.pPos, pSym ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushMemvar\n" ); } -void PushNil( void ) +void hb_vmPushNil( void ) { - stack.pPos->type =IT_NIL; - StackPush(); - HB_DEBUG( "PushNil\n" ); + stack.pPos->type = IT_NIL; + hb_stackPush(); + HB_DEBUG( "hb_vmPushNil\n" ); } -void PushNumber( double dNumber, WORD wDec ) +void hb_vmPushNumber( double dNumber, WORD wDec ) { if( wDec ) - PushDouble( dNumber, wDec ); + hb_vmPushDouble( dNumber, wDec ); else if( SHRT_MIN <= dNumber && dNumber <= SHRT_MAX ) - PushInteger( dNumber ); + hb_vmPushInteger( dNumber ); else if( LONG_MIN <= dNumber && dNumber <= LONG_MAX ) - PushLong( dNumber ); + hb_vmPushLong( dNumber ); else - PushDouble( dNumber, hb_set.HB_SET_DECIMALS ); + hb_vmPushDouble( dNumber, hb_set.HB_SET_DECIMALS ); } -void PushStatic( WORD wStatic ) +void hb_vmPushStatic( WORD wStatic ) { PHB_ITEM pStatic; @@ -1752,11 +1667,11 @@ void PushStatic( WORD wStatic ) hb_itemCopy( stack.pPos, hb_itemUnRef(pStatic) ); else hb_itemCopy( stack.pPos, pStatic ); - StackPush(); - HB_DEBUG2( "PushStatic %i\n", wStatic ); + hb_stackPush(); + HB_DEBUG2( "hb_vmPushStatic %i\n", wStatic ); } -void PushStaticByRef( WORD wStatic ) +void hb_vmPushStaticByRef( WORD wStatic ) { stack.pPos->type = IT_BYREF; /* we store the offset instead of a pointer to support a dynamic stack */ @@ -1764,11 +1679,11 @@ void PushStaticByRef( WORD wStatic ) stack.pPos->item.asRefer.offset = stack.iStatics; stack.pPos->item.asRefer.itemsbase = &aStatics.item.asArray.value->pItems; - StackPush(); - HB_DEBUG2( "PushStaticByRef %i\n", wStatic ); + hb_stackPush(); + HB_DEBUG2( "hb_vmPushStaticByRef %i\n", wStatic ); } -void PushString( char * szText, ULONG length ) +void hb_vmPushString( char * szText, ULONG length ) { char * szTemp = ( char * ) hb_xgrab( length + 1 ); @@ -1778,24 +1693,24 @@ void PushString( char * szText, ULONG length ) stack.pPos->type = IT_STRING; stack.pPos->item.asString.length = length; stack.pPos->item.asString.value = szTemp; - StackPush(); - HB_DEBUG( "PushString\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushString\n" ); } -void PushSymbol( PHB_SYMB pSym ) +void hb_vmPushSymbol( PHB_SYMB pSym ) { stack.pPos->type = IT_SYMBOL; stack.pPos->item.asSymbol.value = pSym; stack.pPos->item.asSymbol.stackbase = stack.pPos - stack.pItems; - StackPush(); - HB_DEBUG2( "PushSymbol: %s\n", pSym->szName ); + hb_stackPush(); + HB_DEBUG2( "hb_vmPushSymbol: %s\n", pSym->szName ); } -void Push( PHB_ITEM pItem ) +void hb_vmPush( PHB_ITEM pItem ) { hb_itemCopy( stack.pPos, pItem ); - StackPush(); - HB_DEBUG( "Push\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPush\n" ); } /* +0 -> HB_P_PUSHBLOCK @@ -1804,7 +1719,7 @@ void Push( PHB_ITEM pItem ) * +5 +6 -> number of referenced local variables * +7 -> start of table with referenced local variables */ -void PushBlock( BYTE * pCode, PHB_SYMB pSymbols ) +void hb_vmPushBlock( BYTE * pCode, PHB_SYMB pSymbols ) { WORD wLocals; @@ -1812,7 +1727,7 @@ void PushBlock( BYTE * pCode, PHB_SYMB pSymbols ) wLocals =pCode[ 5 ] + ( pCode[ 6 ] * 256 ); stack.pPos->item.asBlock.value = - hb_CodeblockNew( pCode + 7 + wLocals*2, /* pcode buffer */ + hb_codeblockNew( pCode + 7 + wLocals*2, /* pcode buffer */ wLocals, /* number of referenced local variables */ (WORD *)(pCode +7), /* table with referenced local variables */ pSymbols ); @@ -1826,69 +1741,69 @@ void PushBlock( BYTE * pCode, PHB_SYMB pSymbols ) /* store the line number where the codeblock was defined */ stack.pPos->item.asBlock.lineno = stack.pBase->item.asSymbol.lineno; - StackPush(); - HB_DEBUG( "PushBlock\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushBlock\n" ); } -void PushDate( LONG lDate ) +void hb_vmPushDate( LONG lDate ) { stack.pPos->type = IT_DATE; stack.pPos->item.asDate.value = lDate; - StackPush(); - HB_DEBUG( "PushDate\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushDate\n" ); } -void PushDouble( double dNumber, WORD wDec ) +void hb_vmPushDouble( double dNumber, WORD wDec ) { stack.pPos->type = IT_DOUBLE; stack.pPos->item.asDouble.value = dNumber; if( dNumber >= 10000000000.0 ) stack.pPos->item.asDouble.length = 20; else stack.pPos->item.asDouble.length = 10; stack.pPos->item.asDouble.decimal = (wDec > 9) ? 9 : wDec; - StackPush(); - HB_DEBUG( "PushDouble\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushDouble\n" ); } -void PushInteger( int iNumber ) +void hb_vmPushInteger( int iNumber ) { stack.pPos->type = IT_INTEGER; stack.pPos->item.asInteger.value = iNumber; stack.pPos->item.asInteger.length = 10; stack.pPos->item.asInteger.decimal = 0; - StackPush(); - HB_DEBUG( "PushInteger\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushInteger\n" ); } -void PushLong( long lNumber ) +void hb_vmPushLong( long lNumber ) { stack.pPos->type = IT_LONG; stack.pPos->item.asLong.value = lNumber; stack.pPos->item.asLong.length = 10; stack.pPos->item.asLong.decimal = 0; - StackPush(); - HB_DEBUG( "PushLong\n" ); + hb_stackPush(); + HB_DEBUG( "hb_vmPushLong\n" ); } -void RetValue( void ) +void hb_vmRetValue( void ) { - StackDec(); /* make the last item visible */ + hb_stackDec(); /* make the last item visible */ hb_itemCopy( &stack.Return, stack.pPos ); /* copy it */ hb_itemClear( stack.pPos ); /* now clear it */ HB_DEBUG( "RetValue\n" ); } -void StackPop( void ) +void hb_stackPop( void ) { if( --stack.pPos < stack.pItems ) { printf( "runtime error: stack underflow\n" ); exit( 1 ); } - if( stack.pPos->type ) + if( stack.pPos->type != IT_NIL ) hb_itemClear( stack.pPos ); } -void StackDec( void ) +void hb_stackDec( void ) { if( --stack.pPos < stack.pItems ) { @@ -1897,13 +1812,13 @@ void StackDec( void ) } } -void StackFree( void ) +void hb_stackFree( void ) { hb_xfree( stack.pItems ); - HB_DEBUG( "StackFree\n" ); + HB_DEBUG( "hb_stackFree\n" ); } -void StackPush( void ) +void hb_stackPush( void ) { LONG CurrIndex; /* index of current top item */ LONG TopIndex; /* index of the topmost possible item */ @@ -1919,7 +1834,7 @@ void StackPush( void ) BaseIndex = stack.pBase - stack.pItems; /* no, make more headroom: */ - /* StackShow(); */ + /* hb_stackShow(); */ stack.pItems = (PHB_ITEM)hb_xrealloc( stack.pItems, sizeof( HB_ITEM ) * ( stack.wItems + STACK_EXPANDHB_ITEMS ) ); @@ -1927,7 +1842,7 @@ void StackPush( void ) stack.pPos = stack.pItems + CurrIndex; stack.pBase = stack.pItems + BaseIndex; stack.wItems += STACK_EXPANDHB_ITEMS; - /* StackShow(); */ + /* hb_stackShow(); */ } /* now, push it: */ @@ -1936,16 +1851,16 @@ void StackPush( void ) return; } -void StackInit( void ) +void hb_stackInit( void ) { stack.pItems = ( PHB_ITEM ) hb_xgrab( sizeof( HB_ITEM ) * STACK_INITHB_ITEMS ); stack.pBase = stack.pItems; stack.pPos = stack.pItems; /* points to the first stack item */ stack.wItems = STACK_INITHB_ITEMS; - HB_DEBUG( "StackInit\n" ); + HB_DEBUG( "hb_stackInit\n" ); } -void StackShow( void ) +void hb_stackShow( void ) { PHB_ITEM p; @@ -2004,16 +1919,16 @@ void StackShow( void ) printf( "\n" ); } -void SFrame( PHB_SYMB pSym ) /* sets the statics frame for a function */ +void hb_vmSFrame( PHB_SYMB pSym ) /* sets the statics frame for a function */ { /* _INITSTATICS is now the statics frame. Statics() changed it! */ stack.iStatics = ( int ) pSym->pFunPtr; /* pSym is { "$_INITSTATICS", FS_INIT | FS_EXIT, _INITSTATICS } for each PRG */ HB_DEBUG( "SFrame\n" ); } -void Statics( PHB_SYMB pSym ) /* initializes the global aStatics array or redimensionates it */ +void hb_vmStatics( PHB_SYMB pSym ) /* initializes the global aStatics array or redimensionates it */ { - WORD wStatics = PopNumber(); + WORD wStatics = hb_vmPopNumber(); if( IS_NIL( &aStatics ) ) { @@ -2029,7 +1944,7 @@ void Statics( PHB_SYMB pSym ) /* initializes the global aStatics array or redime HB_DEBUG2( "Statics %li\n", hb_arrayLen( &aStatics ) ); } -void ProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* module symbols initialization */ +void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* module symbols initialization */ { PSYMBOLS pNewSymbols, pLastSymbols; WORD w; @@ -2074,7 +1989,7 @@ void ProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* module sy } #ifdef HARBOUR_OBJ_GENERATION -void ProcessObjSymbols( void ) +void hb_vmProcessObjSymbols( void ) { POBJSYMBOLS pObjSymbols = ( POBJSYMBOLS ) &HB_FIRSTSYMBOL; @@ -2085,14 +2000,14 @@ void ProcessObjSymbols( void ) iDone = 1; while( pObjSymbols < ( POBJSYMBOLS ) ( &HB_LASTSYMBOL - 1 ) ) { - ProcessSymbols( pObjSymbols->pSymbols, pObjSymbols->wSymbols ); + hb_vmProcessSymbols( pObjSymbols->pSymbols, pObjSymbols->wSymbols ); pObjSymbols++; } } } #endif -void ReleaseLocalSymbols( void ) +void hb_vmReleaseLocalSymbols( void ) { PSYMBOLS pDestroy; @@ -2109,7 +2024,7 @@ void ReleaseLocalSymbols( void ) * this function. These two bits cannot be marked at the same * time for normal user defined functions. */ -void DoInitStatics( void ) +void hb_vmDoInitStatics( void ) { PSYMBOLS pLastSymbols = pSymbols; WORD w; @@ -2126,9 +2041,9 @@ void DoInitStatics( void ) /* _INITSTATICS procedure cannot call any function and it * cannot use any local variable then it is safe to call * this procedure directly - * PushSymbol( pLastSymbols->pModuleSymbols + w ); - * PushNil(); - * Do( 0 ); + * hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w ); + * hb_vmPushNil(); + * hb_vmDo( 0 ); */ if( ( pLastSymbols->pModuleSymbols + w )->pFunPtr ) ( pLastSymbols->pModuleSymbols + w )->pFunPtr(); @@ -2139,7 +2054,7 @@ void DoInitStatics( void ) } while( pLastSymbols ); } -void DoExitFunctions( void ) +void hb_vmDoExitFunctions( void ) { PSYMBOLS pLastSymbols = pSymbols; WORD w; @@ -2153,9 +2068,9 @@ void DoExitFunctions( void ) scope =( pLastSymbols->pModuleSymbols + w )->cScope & (FS_EXIT | FS_INIT); if( scope == FS_EXIT ) { - PushSymbol( pLastSymbols->pModuleSymbols + w ); - PushNil(); - Do( 0 ); + hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w ); + hb_vmPushNil(); + hb_vmDo( 0 ); } } } @@ -2163,7 +2078,7 @@ void DoExitFunctions( void ) } while( pLastSymbols ); } -void DoInitFunctions( int argc, char * argv[] ) +void hb_vmDoInitFunctions( int argc, char * argv[] ) { PSYMBOLS pLastSymbols = pSymbols; WORD w; @@ -2179,13 +2094,13 @@ void DoInitFunctions( int argc, char * argv[] ) { int i; - PushSymbol( pLastSymbols->pModuleSymbols + w ); - PushNil(); + hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w ); + hb_vmPushNil(); for( i = 1; i < argc; i++ ) /* places application parameters on the stack */ - PushString( argv[ i ], strlen( argv[ i ] ) ); + hb_vmPushString( argv[ i ], strlen( argv[ i ] ) ); - Do( argc - 1 ); + hb_vmDo( argc - 1 ); } } } @@ -2193,7 +2108,7 @@ void DoInitFunctions( int argc, char * argv[] ) } while( pLastSymbols ); } -static void ForceLink( void ) /* To force the link of some functions */ +static void hb_vmForceLink( void ) /* To force the link of some functions */ { HB_ERRORSYS(); HB_ERRORNEW(); diff --git a/harbour/source/vm/initsymb.c b/harbour/source/vm/initsymb.c index ce6930701a..1b5cb7952a 100644 --- a/harbour/source/vm/initsymb.c +++ b/harbour/source/vm/initsymb.c @@ -9,6 +9,7 @@ #include "hbsetup.h" #include "extend.h" #include "hbdefs.h" +#include "ctoharb.h" #include "initsymd.h" HARBOUR HB_AADD( void ); @@ -145,5 +146,5 @@ void InitSymbolTable( void ) /* * The system symbol table with runtime functions HAVE TO be called last */ - ProcessSymbols( symbols, sizeof(symbols)/sizeof( HB_SYMB ) ); + hb_vmProcessSymbols( symbols, sizeof(symbols)/sizeof( HB_SYMB ) ); }