diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9b3adabec4..3e12451a9f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +19990910-11:10 GMT+1 Victor Szel + * tests/working/rtl_test.prg + + Enabled some alias tests which fail. (Ryszard, could you take a look + at it ?) + * source/vm/hvm.c + ! hb_vmSwapAlias() - Fixed mistyped variable name, pItem was accessed + instead of pWorkarea. (Is this OK, Ryszard ?) + * source/rtl/itemapi.c + ! hb_itemStrCmp() - Fixed a bug, when the character were compared as a + signed value instead of unsigned. ( BYTE ) casts added where needed. + This caused four regr.tests to fail. + * source/rtl/gtapi.c + ! hb_gtSetColorStr() is now using toupper instead of a platform + dependent bit operation. + * tests/working/rtl_test.prg + + Code added to test the :Args feature of error handling, this is commented + out, since Harbour doesn't support it yet. + * include/error.api + ! Zero bytes (!) removed from some places, so now the comptaibility header + files are working fine. + * source/compiler/harbour.y + source/rtl/dir.c + source/memvars.c + * Some formatting corrections. + * include/ctoharb.h + * Opcode functions grouped by type. Later on the same thing should be + done in HVM.C. If similar code fragments are close to each other, bugs are easier to spot. + * include/pcode.h + * Comments aligned. + 19990910-11:05 GMT+2 Ryszard Glab *source/compiler/harbour.y @@ -162,7 +192,7 @@ * hb_arrayFill(), hb_arrayScan(), hb_arrayEval(), hb_arrayCopy() changed to parameter to implement the previous change. * source/rtl/environ.c - ! __RUN() now checks for the parameter type, not the number, + ! __RUN() now checks for the parameter type, not the number. + __RUN() funtionality enabled for __CYGWIN__ + __RUN() will now throw an "operation not supported" runtime error on platforms where it's not supported, this is IMO better than silently diff --git a/harbour/include/ctoharb.h b/harbour/include/ctoharb.h index 2b31042f05..0a22f95fb0 100644 --- a/harbour/include/ctoharb.h +++ b/harbour/include/ctoharb.h @@ -32,83 +32,103 @@ /* Harbour virtual machine functions */ extern void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ +extern void hb_vmSymbolInit_RT( void ); /* initialization of runtime support symbols */ + +/* Harbour virtual machine escaping API */ extern void hb_vmRequestQuit( void ); extern void hb_vmRequestCancel( void ); extern void hb_vmRequestBreak( PHB_ITEM pItem ); extern WORD hb_vmRequestQuery( void ); extern void hb_vmQuit( void ); /* Immediately quits the virtual machine */ -extern void hb_vmSymbolInit_RT( void ); /* initialization of runtime support symbols */ /* Return values of hb_vmRequestQuery() */ #define HB_QUIT_REQUESTED 1 /* immediately quit the application */ #define HB_BREAK_REQUESTED 2 /* break to nearest RECOVER/END sequence */ /* 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 */ + +/* Operators ( mathematical / character / misc ) */ +extern void hb_vmMult( void ); /* multiplies the latest two values on the stack, removes them and leaves the result */ 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_vmPlus( void ); /* sums the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmMinus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmPower( void ); /* power the latest two values on the stack, removes them and leaves the result */ +extern void hb_vmModulus( void ); /* calculates the modulus of latest two values on the stack, removes them and leaves the result */ +extern void hb_vmInc( void ); /* increment the latest numeric value on the stack */ +extern void hb_vmDec( void ); /* decrements the latest numeric value on the stack */ +extern void hb_vmNegate( void ); /* negates (-) the latest value on the stack */ 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 */ + +/* Operators (relational) */ +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_vmNotEqual( void ); /* checks if the two latest values on the stack are not equal, removes both and leaves result */ 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_vmInstring( void ); /* check whether string 1 is contained in string 2 */ + +/* Operators (logical) */ +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_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_vmNot( void ); /* changes the latest logical value on the stack */ + +/* Array */ +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_vmDimArray( WORD wDimensions ); /* generates a wDimensions Array and initialize those dimensions from the stack values */ +extern void hb_vmGenArray( WORD wElements ); /* generates a wElements Array and fills it from the stack values */ + +/* Object */ +extern void hb_vmMessage( PHB_SYMB pSymMsg ); /* sends a message to an object */ +extern void hb_vmOperatorCall( PHB_ITEM, PHB_ITEM, char *); /* call an overloaded operator */ + +/* Execution */ +extern void hb_vmFrame( BYTE bLocals, BYTE bParams ); /* increases the stack pointer for the amount of locals and params suplied */ +extern void hb_vmLocalName( WORD wLocal, char * szLocalName ); /* locals and parameters index and name information for the debugger */ +extern void hb_vmModuleName( char * szModuleName ); /* PRG and function name information for the debugger */ extern void hb_vmSFrame( PHB_SYMB pSym ); /* sets the statics frame for a function */ extern void hb_vmStatics( PHB_SYMB pSym ); /* increases the the global statics array to hold a PRG statics */ +extern void hb_vmRetValue( void ); /* pops the latest stack value into stack.Return */ +extern void hb_vmEndBlock( void ); /* copies the last codeblock pushed value into the return value */ + +/* Misc */ +extern void hb_vmDo( WORD WParams ); /* invoke the virtual machine */ +extern HARBOUR hb_vmDoBlock( void ); /* executes a codeblock */ +extern void hb_vmFunction( WORD wParams ); /* executes a function saving its result */ +extern void hb_vmDuplicate( void ); /* duplicates the latest value on the stack */ +extern void hb_vmDuplTwo( void ); /* duplicates the latest two value on the stack */ +extern void hb_vmForTest( void ); /* test for end condition of for */ + +/* Push */ +extern void hb_vmPush( PHB_ITEM pItem ); /* pushes a generic item onto the stack */ +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_vmPushInteger( int iNumber ); /* pushes a integer number onto the stack */ +extern void hb_vmPushLong( long lNumber ); /* pushes a long number onto the stack */ +extern void hb_vmPushDouble( double lNumber, WORD wDec ); /* pushes a double number onto the stack */ +extern void hb_vmPushLogical( BOOL bValue ); /* pushes a logical value onto the stack */ +extern void hb_vmPushString( char * szText, ULONG length ); /* pushes a string on to the stack */ +extern void hb_vmPushDate( LONG lDate ); /* pushes a long date onto the stack */ +extern void hb_vmPushBlock( BYTE * pCode, PHB_SYMB pSymbols ); /* creates a codeblock */ +extern void hb_vmPushSymbol( PHB_SYMB pSym ); /* pushes a function pointer 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_vmPushLocal( SHORT iLocal ); /* pushes the containts of a local onto the stack */ +extern void hb_vmPushLocalByRef( SHORT iLocal ); /* pushes a local by refrence onto the stack */ +extern void hb_vmPushStatic( WORD wStatic ); /* pushes the containts of a static onto the stack */ +extern void hb_vmPushStaticByRef( WORD iLocal ); /* pushes a static by refrence onto the stack */ + +/* Pop */ +extern long hb_vmPopDate( void ); /* pops the stack latest value and returns its date value as a LONG */ +extern double hb_vmPopNumber( void ); /* pops the stack latest value and returns its numeric value */ +extern double hb_vmPopDouble( WORD * ); /* pops the stack latest value and returns its double numeric format value */ +extern BOOL hb_vmPopLogical( void ); /* pops the stack latest value and returns its logical value */ +extern void hb_vmPopParameter( PHB_SYMB, BYTE ); /* creates a PRIVATE variable and sets it with parameter's value */ +extern void hb_vmPopLocal( SHORT wLocal ); /* pops the stack latest value onto a local */ +extern void hb_vmPopMemvar( PHB_SYMB ); /* pops a value of memvar variable */ +extern void hb_vmPopStatic( WORD wStatic ); /* pops the stack latest value onto a static */ +extern void hb_vmPopDefStat( WORD wStatic ); /* pops the stack latest value onto a static as default init */ /* stack management functions */ extern void hb_stackDec( void ); /* pops an item from the stack without clearing it's contents */ @@ -119,7 +139,7 @@ extern void hb_stackInit( void ); /* initializes the stack */ extern void hb_stackDispLocal( void ); /* show the types of the items on the stack for debugging purposes */ extern void hb_stackDispCall( void ); /* show the procedure names of the call stack for internal errors use */ -#define STACK_INITHB_ITEMS 100 -#define STACK_EXPANDHB_ITEMS 20 +#define STACK_INITHB_ITEMS 100 +#define STACK_EXPANDHB_ITEMS 20 #endif /* HB_CTOHARB_H_ */ diff --git a/harbour/include/error.api b/harbour/include/error.api index fa457f9a53..be599b9049 100644 Binary files a/harbour/include/error.api and b/harbour/include/error.api differ diff --git a/harbour/include/pcode.h b/harbour/include/pcode.h index 0ef90a398b..24ac0b9937 100644 --- a/harbour/include/pcode.h +++ b/harbour/include/pcode.h @@ -29,82 +29,82 @@ typedef enum { - HB_P_AND, /* peforms the logical AND of two latest stack values, removes them and places result */ - HB_P_ARRAYAT, /* places on the virtual machine stack an array element */ - HB_P_ARRAYPUT, /* sets array element, the array and the index are both on the stack */ - HB_P_EQUAL, /* check if the latest two values on the stack are equal, removing them and leaving there the result */ - HB_P_ENDBLOCK, /* end of a codeblock definition */ - HB_P_ENDPROC, /* instructs the virtual machine to end execution */ - HB_P_EXACTLYEQUAL, /* check if the latest two values on the stack are exactly equal, removing them and leaving there the result */ - HB_P_FALSE, /* pushes false on the virtual machine stack */ - HB_P_FORTEST, /* For STEP. If step > 1 less. If step < 1 greater. */ - HB_P_FUNCTION, /* instructs the virtual machine to execute a function saving its result */ - HB_P_FRAME, /* instructs the virtual machine about how many parameters and locals a function uses */ - HB_P_FUNCPTR, /* returns a function address pointer */ - HB_P_GENARRAY, /* instructs the virtual machine to build an array and load elemnst from the stack */ - HB_P_GREATER, /* checks if the second latest value on the stack is greater that the lastest one */ - HB_P_GREATEREQUAL, /* checks if the second latest value on the stack is greater equal that the latest one, leaves the result only */ - HB_P_DEC, /* decrements the latest value on the virtual machine stack */ - HB_P_DIMARRAY, /* instructs the virtual machine to build an array with some specific dimensions */ - HB_P_DIVIDE, /* divides the latest two values on the stack, removing them and leaving there the result */ - HB_P_DO, /* instructs the virtual machine to execute a function discarding its result */ - HB_P_DUPLICATE, /* places a copy of the latest virtual machine stack value on to the stack */ - HB_P_DUPLTWO, /* places a copy of the latest two virtual machine stack value on to the stack */ - HB_P_INC, /* increments the latest value on the virtual machine stack */ - HB_P_INSTRING, /* checks if the second latest value on the stack is a substring of the latest one */ - HB_P_JUMP, /* jumps to a relative offset */ - HB_P_JUMPFALSE, /* checks a logic expression of the stack and jumps to a relative offset */ - HB_P_JUMPTRUE, /* checks a logic expression of the stack and jumps to a relative offset */ - HB_P_LESSEQUAL, /* checks if the second latest value on the stack is less equal that the latest one, leaves the result only */ - HB_P_LESS, /* checks if the second latest value on the stack is less that the lastest one */ - HB_P_LINE, /* currently compiled source code line number */ - HB_P_LOCALNAME, /* sets the name of local variable */ - HB_P_MESSAGE, /* sends a message to an object */ - HB_P_MINUS, /* subs the latest two values on the stack, removing them and leaving there the result */ - HB_P_MODULUS, /* calculates the modulus of the two values on the stack, removing them and leaving there the result */ - HB_P_MODULENAME, /* sets the name of debugged module */ - HB_P_MULT, /* multiplies the latest two values on the stack, removing them and leaving there the result */ - HB_P_NEGATE, /* numerically negates the latest value on the stack */ - HB_P_NOOP, /* no operation */ - HB_P_NOT, /* logically negates the latest value on the stack */ - HB_P_NOTEQUAL, /* checks if the latest two stack values are equal, leaves just the result */ - HB_P_OR, /* peforms the logical OR of two latest stack values, removes them and places result */ - HB_P_PARAMETER, /* creates PRIVATE variables and assigns values to functions paramaters */ - HB_P_PLUS, /* adds the latest two values on the stack, removing them and leaving there the result */ - HB_P_POP, /* removes the latest value from the stack */ - HB_P_POPALIAS, /* pops the item from the eval stack and selects the current workarea */ - HB_P_POPALIASEDFIELD,/* pops aliased field */ - HB_P_POPFIELD, /* pops unaliased field */ - HB_P_POPLOCAL, /* pops the contains of the virtual machine stack onto a local variable */ - HB_P_POPMEMVAR, /* pops the contains of a memvar variable to the virtual machine stack */ - HB_P_POPSTATIC, /* pops the contains of the virtual machine stack onto a static variable */ - HB_P_POWER, /* calculates the power of the two values on the stack, removing them and leaving there the result */ - HB_P_PUSHALIAS, /* saves the current workarea number on the eval stack */ + HB_P_AND, /* peforms the logical AND of two latest stack values, removes them and places result */ + HB_P_ARRAYAT, /* places on the virtual machine stack an array element */ + HB_P_ARRAYPUT, /* sets array element, the array and the index are both on the stack */ + HB_P_EQUAL, /* check if the latest two values on the stack are equal, removing them and leaving there the result */ + HB_P_ENDBLOCK, /* end of a codeblock definition */ + HB_P_ENDPROC, /* instructs the virtual machine to end execution */ + HB_P_EXACTLYEQUAL, /* check if the latest two values on the stack are exactly equal, removing them and leaving there the result */ + HB_P_FALSE, /* pushes false on the virtual machine stack */ + HB_P_FORTEST, /* For STEP. If step > 1 less. If step < 1 greater. */ + HB_P_FUNCTION, /* instructs the virtual machine to execute a function saving its result */ + HB_P_FRAME, /* instructs the virtual machine about how many parameters and locals a function uses */ + HB_P_FUNCPTR, /* returns a function address pointer */ + HB_P_GENARRAY, /* instructs the virtual machine to build an array and load elemnst from the stack */ + HB_P_GREATER, /* checks if the second latest value on the stack is greater that the lastest one */ + HB_P_GREATEREQUAL, /* checks if the second latest value on the stack is greater equal that the latest one, leaves the result only */ + HB_P_DEC, /* decrements the latest value on the virtual machine stack */ + HB_P_DIMARRAY, /* instructs the virtual machine to build an array with some specific dimensions */ + HB_P_DIVIDE, /* divides the latest two values on the stack, removing them and leaving there the result */ + HB_P_DO, /* instructs the virtual machine to execute a function discarding its result */ + HB_P_DUPLICATE, /* places a copy of the latest virtual machine stack value on to the stack */ + HB_P_DUPLTWO, /* places a copy of the latest two virtual machine stack value on to the stack */ + HB_P_INC, /* increments the latest value on the virtual machine stack */ + HB_P_INSTRING, /* checks if the second latest value on the stack is a substring of the latest one */ + HB_P_JUMP, /* jumps to a relative offset */ + HB_P_JUMPFALSE, /* checks a logic expression of the stack and jumps to a relative offset */ + HB_P_JUMPTRUE, /* checks a logic expression of the stack and jumps to a relative offset */ + HB_P_LESSEQUAL, /* checks if the second latest value on the stack is less equal that the latest one, leaves the result only */ + HB_P_LESS, /* checks if the second latest value on the stack is less that the lastest one */ + HB_P_LINE, /* currently compiled source code line number */ + HB_P_LOCALNAME, /* sets the name of local variable */ + HB_P_MESSAGE, /* sends a message to an object */ + HB_P_MINUS, /* subs the latest two values on the stack, removing them and leaving there the result */ + HB_P_MODULUS, /* calculates the modulus of the two values on the stack, removing them and leaving there the result */ + HB_P_MODULENAME, /* sets the name of debugged module */ + HB_P_MULT, /* multiplies the latest two values on the stack, removing them and leaving there the result */ + HB_P_NEGATE, /* numerically negates the latest value on the stack */ + HB_P_NOOP, /* no operation */ + HB_P_NOT, /* logically negates the latest value on the stack */ + HB_P_NOTEQUAL, /* checks if the latest two stack values are equal, leaves just the result */ + HB_P_OR, /* peforms the logical OR of two latest stack values, removes them and places result */ + HB_P_PARAMETER, /* creates PRIVATE variables and assigns values to functions paramaters */ + HB_P_PLUS, /* adds the latest two values on the stack, removing them and leaving there the result */ + HB_P_POP, /* removes the latest value from the stack */ + HB_P_POPALIAS, /* pops the item from the eval stack and selects the current workarea */ + HB_P_POPALIASEDFIELD, /* pops aliased field */ + HB_P_POPFIELD, /* pops unaliased field */ + HB_P_POPLOCAL, /* pops the contains of the virtual machine stack onto a local variable */ + HB_P_POPMEMVAR, /* pops the contains of a memvar variable to the virtual machine stack */ + HB_P_POPSTATIC, /* pops the contains of the virtual machine stack onto a static variable */ + HB_P_POWER, /* calculates the power of the two values on the stack, removing them and leaving there the result */ + HB_P_PUSHALIAS, /* saves the current workarea number on the eval stack */ HB_P_PUSHALIASEDFIELD, /* pushes aliased field */ - HB_P_PUSHBLOCK, /* start of a codeblock definition */ - HB_P_PUSHFIELD, /* pushes unaliased field */ - HB_P_PUSHINT, /* places an integer number on the virtual machine stack */ - HB_P_PUSHLOCAL, /* pushes the contains of a local variable to the virtual machine stack */ - HB_P_PUSHLOCALREF, /* pushes a local variable by reference to the virtual machine stack */ - HB_P_PUSHLONG, /* places an integer number on the virtual machine stack */ - HB_P_PUSHMEMVAR, /* pushes the contains of a memvar variable to the virtual machine stack */ - HB_P_PUSHMEMVARREF, /* pushes the a memvar variable by reference to the virtual machine stack */ - HB_P_PUSHNIL, /* places a nil on the virtual machine stack */ - HB_P_PUSHDOUBLE, /* places a double number on the virtual machine stack */ - HB_P_PUSHSELF, /* pushes Self for the current processed method */ - HB_P_PUSHSTATIC, /* pushes the contains of a static variable to the virtual machine stack */ - HB_P_PUSHSTATICREF, /* pushes the a static variable by reference to the virtual machine stack */ - HB_P_PUSHSTR, /* places a string on the virtual machine stack */ - HB_P_PUSHSYM, /* places a symbol on the virtual machine stack */ - HB_P_RETVALUE, /* instructs the virtual machine to return the latest stack value */ - HB_P_SEQBEGIN, /* BEGIN SEQUENCE */ - HB_P_SEQEND, /* END SEQUENCE */ - HB_P_SEQRECOVER, /* RECOVER statement */ - HB_P_SFRAME, /* sets the statics frame for a function */ - HB_P_STATICS, /* defines the number of statics variables for a PRG */ - HB_P_SWAPALIAS, /* restores the current workarea number from the eval stack */ - HB_P_TRUE, /* pushes true on the virtual machine stack */ - HB_P_ZERO /* places a zero on the virtual machine stack */ + HB_P_PUSHBLOCK, /* start of a codeblock definition */ + HB_P_PUSHFIELD, /* pushes unaliased field */ + HB_P_PUSHINT, /* places an integer number on the virtual machine stack */ + HB_P_PUSHLOCAL, /* pushes the contains of a local variable to the virtual machine stack */ + HB_P_PUSHLOCALREF, /* pushes a local variable by reference to the virtual machine stack */ + HB_P_PUSHLONG, /* places an integer number on the virtual machine stack */ + HB_P_PUSHMEMVAR, /* pushes the contains of a memvar variable to the virtual machine stack */ + HB_P_PUSHMEMVARREF, /* pushes the a memvar variable by reference to the virtual machine stack */ + HB_P_PUSHNIL, /* places a nil on the virtual machine stack */ + HB_P_PUSHDOUBLE, /* places a double number on the virtual machine stack */ + HB_P_PUSHSELF, /* pushes Self for the current processed method */ + HB_P_PUSHSTATIC, /* pushes the contains of a static variable to the virtual machine stack */ + HB_P_PUSHSTATICREF, /* pushes the a static variable by reference to the virtual machine stack */ + HB_P_PUSHSTR, /* places a string on the virtual machine stack */ + HB_P_PUSHSYM, /* places a symbol on the virtual machine stack */ + HB_P_RETVALUE, /* instructs the virtual machine to return the latest stack value */ + HB_P_SEQBEGIN, /* BEGIN SEQUENCE */ + HB_P_SEQEND, /* END SEQUENCE */ + HB_P_SEQRECOVER, /* RECOVER statement */ + HB_P_SFRAME, /* sets the statics frame for a function */ + HB_P_STATICS, /* defines the number of statics variables for a PRG */ + HB_P_SWAPALIAS, /* restores the current workarea number from the eval stack */ + HB_P_TRUE, /* pushes true on the virtual machine stack */ + HB_P_ZERO /* places a zero on the virtual machine stack */ } HB_PCODE; #endif /* HB_PCODE_H_ */ diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index efb1f00964..193507dd8a 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -636,10 +636,10 @@ Statement : ExecFlow Crlf {} | IfInline Crlf { GenPCode1( HB_P_POP ); } | ObjectMethod Crlf { GenPCode1( HB_P_POP ); } | VarUnary Crlf { GenPCode1( HB_P_POP ); } - | VarAssign Crlf { GenPCode1( HB_P_POP ); _bRValue =FALSE; } + | VarAssign Crlf { GenPCode1( HB_P_POP ); _bRValue = FALSE; } | IDENTIFIER '=' Expression Crlf { PopId( $1 ); } - | AliasVar '=' { $$=(void*)pAliasId; pAliasId=NULL; } Expression Crlf { pAliasId=(ALIASID_PTR) $3; PopId( $1 ); AliasRemove(); } + | AliasVar '=' { $$=(void*)pAliasId; pAliasId = NULL; } Expression Crlf { pAliasId=(ALIASID_PTR) $3; PopId( $1 ); AliasRemove(); } | AliasFunc '=' Expression Crlf { --iLine; GenError( _szCErrors, 'E', ERR_INVALID_LVALUE, NULL, NULL ); } | VarAt '=' Expression Crlf { GenPCode1( HB_P_ARRAYPUT ); GenPCode1( HB_P_POP ); } | FunCallArray '=' Expression Crlf { GenPCode1( HB_P_ARRAYPUT ); GenPCode1( HB_P_POP ); } @@ -879,13 +879,13 @@ VarAssign : IDENTIFIER INASSIGN { _bRValue = TRUE; } Expression { PopId( $1 ); | ObjectMethod ArrayIndex DIVEQ { GenPCode1( HB_P_DUPLTWO ); GenPCode1( HB_P_ARRAYAT ); _bRValue = TRUE; } Expression { GenPCode1( HB_P_DIVIDE ); GenPCode1( HB_P_ARRAYPUT ); } | ObjectMethod ArrayIndex EXPEQ { GenPCode1( HB_P_DUPLTWO ); GenPCode1( HB_P_ARRAYAT ); _bRValue = TRUE; } Expression { GenPCode1( HB_P_POWER ); GenPCode1( HB_P_ARRAYPUT ); } | ObjectMethod ArrayIndex MODEQ { GenPCode1( HB_P_DUPLTWO ); GenPCode1( HB_P_ARRAYAT ); _bRValue = TRUE; } Expression { GenPCode1( HB_P_MODULUS ); GenPCode1( HB_P_ARRAYPUT ); } - | AliasVar INASSIGN { _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } - | AliasVar PLUSEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { GenPCode1( HB_P_PLUS ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } - | AliasVar MINUSEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { GenPCode1( HB_P_MINUS ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } - | AliasVar MULTEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { GenPCode1( HB_P_MULT ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } - | AliasVar DIVEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { GenPCode1( HB_P_DIVIDE ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } - | AliasVar EXPEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { GenPCode1( HB_P_POWER ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } - | AliasVar MODEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId=NULL; } Expression { GenPCode1( HB_P_MODULUS ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar INASSIGN { _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar PLUSEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { GenPCode1( HB_P_PLUS ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar MINUSEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { GenPCode1( HB_P_MINUS ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar MULTEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { GenPCode1( HB_P_MULT ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar DIVEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { GenPCode1( HB_P_DIVIDE ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar EXPEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { GenPCode1( HB_P_POWER ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } + | AliasVar MODEQ { PushId( $1 ); _bRValue = TRUE; $$=(void*)pAliasId; pAliasId = NULL; } Expression { GenPCode1( HB_P_MODULUS ); pAliasId=(ALIASID_PTR) $3; PopId( $1 ); PushId( $1 ); AliasRemove(); } | AliasFunc INASSIGN Expression { --iLine; GenError( _szCErrors, 'E', ERR_INVALID_LVALUE, NULL, NULL ); } | AliasFunc PLUSEQ Expression { --iLine; GenError( _szCErrors, 'E', ERR_INVALID_LVALUE, NULL, NULL ); } | AliasFunc MINUSEQ Expression { --iLine; GenError( _szCErrors, 'E', ERR_INVALID_LVALUE, NULL, NULL ); } @@ -1046,7 +1046,7 @@ ArrExpList : '[' Expression { $$ = 1; } | ArrExpList ',' Expression { $$++; } ; -FieldsDef : FIELD { iVarScope =VS_FIELD; } FieldList Crlf +FieldsDef : FIELD { iVarScope = VS_FIELD; } FieldList Crlf ; FieldList : IDENTIFIER { cVarType = ' '; $$=FieldsCount(); AddVar( $1 ); } @@ -1212,7 +1212,7 @@ ForStatements : ForStat NEXT { --_wForCounter; } ForStat : Statements { Line(); } ; -BeginSeq : BEGINSEQ { ++_wSeqCounter; $$=SequenceBegin(); } Crlf { Line(); } +BeginSeq : BEGINSEQ { ++_wSeqCounter; $$ = SequenceBegin(); } Crlf { Line(); } SeqStatms { /* Set jump address for HB_P_SEQBEGIN opcode - this address @@ -1281,8 +1281,8 @@ RecoverUsing : RECOVER USING IDENTIFIER * will pass the value of variable not a reference */ DoProc : DO IDENTIFIER { PushSymbol( $2, 1 ); PushNil(); Do( 0 ); } - | DO IDENTIFIER { PushSymbol( $2, 1 ); PushNil(); _bForceByRefer=TRUE; } WITH DoArgList { Do( $5 ); _bForceByRefer=FALSE; } - | WHILE { PushSymbol( yy_strdup("WHILE"), 1 ); PushNil(); _bForceByRefer=TRUE; } WITH DoArgList { Do( $4 ); _bForceByRefer=FALSE; } + | DO IDENTIFIER { PushSymbol( $2, 1 ); PushNil(); _bForceByRefer = TRUE; } WITH DoArgList { Do( $5 ); _bForceByRefer=FALSE; } + | WHILE { PushSymbol( yy_strdup("WHILE"), 1 ); PushNil(); _bForceByRefer = TRUE; } WITH DoArgList { Do( $4 ); _bForceByRefer=FALSE; } ; DoArgList : ',' { PushNil(); PushNil(); $$ = 2; } @@ -1292,13 +1292,13 @@ DoArgList : ',' { PushNil(); PushNil(); $$ = 2; } | ',' { PushNil(); } DoExpression { $$ = 2; } ; -DoExpression: Expression { _bForceByRefer=TRUE; } +DoExpression: Expression { _bForceByRefer = TRUE; } ; Crlf : '\n' - | ';' { _bDontGenLineNum =TRUE; } + | ';' { _bDontGenLineNum = TRUE; } | '\n' Crlf - | ';' Crlf { _bDontGenLineNum =TRUE; } + | ';' Crlf { _bDontGenLineNum = TRUE; } ; %% @@ -1462,7 +1462,7 @@ int harbour_main( int argc, char * argv[] ) case 'i': case 'I': - AddSearchPath( argv[ iArg ]+2, &_pIncludePath ); + AddSearchPath( argv[ iArg ] + 2, &_pIncludePath ); break; case 'l': @@ -1612,9 +1612,9 @@ int harbour_main( int argc, char * argv[] ) PCOMSYMBOL pSym; /* Fix the number of static variables */ - _pInitFunc->pCode[ 1 ] =LOBYTE( _iStatics ); - _pInitFunc->pCode[ 2 ] =HIBYTE( _iStatics ); - _pInitFunc->iStaticsBase =_iStatics; + _pInitFunc->pCode[ 1 ] = LOBYTE( _iStatics ); + _pInitFunc->pCode[ 2 ] = HIBYTE( _iStatics ); + _pInitFunc->iStaticsBase = _iStatics; pSym = AddSymbol( _pInitFunc->szName, NULL ); pSym->cScope |= _pInitFunc->cScope; @@ -1809,7 +1809,7 @@ void AddExtern( char * szExternName ) /* defines a new extern name */ void AddVar( char * szVarName ) { PVAR pVar, pLastVar; - PFUNCTION pFunc =functions.pLast; + PFUNCTION pFunc = functions.pLast; if( ! _bStartProc && functions.iCount <= 1 && iVarScope == VS_LOCAL ) { @@ -1826,7 +1826,7 @@ void AddVar( char * szVarName ) if( (functions.pLast->bFlags & FUN_STATEMENTS) && !(iVarScope == VS_FIELD || (iVarScope & VS_MEMVAR)) ) { --iLine; - GenError( _szCErrors, 'E', ERR_FOLLOWS_EXEC, (iVarScope==VS_LOCAL?"LOCAL":"STATIC"), NULL ); + GenError( _szCErrors, 'E', ERR_FOLLOWS_EXEC, (iVarScope == VS_LOCAL ? "LOCAL" : "STATIC"), NULL ); } /* When static variable is added then functions.pLast points to function @@ -1835,7 +1835,7 @@ void AddVar( char * szVarName ) */ if( iVarScope == VS_STATIC ) { - pFunc =pFunc->pOwner; + pFunc = pFunc->pOwner; /* Check if an illegal action was invoked during a static variable * value initialization */ @@ -1854,7 +1854,7 @@ void AddVar( char * szVarName ) } else /* variable defined in a codeblock */ - iVarScope =VS_PARAMETER; + iVarScope = VS_PARAMETER; CheckDuplVars( pFunc->pLocals, szVarName, iVarScope ); pVar = ( PVAR ) hb_xgrab( sizeof( VAR ) ); @@ -1895,16 +1895,16 @@ void AddVar( char * szVarName ) if( ++functions.pLast->wParamNum > functions.pLast->wParamCount ) { - functions.pLast->wParamCount =functions.pLast->wParamNum; + functions.pLast->wParamCount = functions.pLast->wParamNum; bNewParameter = TRUE; } - pSym =GetSymbol( szVarName, &wPos ); /* check if symbol exists already */ + pSym = GetSymbol( szVarName, &wPos ); /* check if symbol exists already */ if( ! pSym ) - pSym =AddSymbol( yy_strdup(szVarName), &wPos ); - pSym->cScope |=VS_MEMVAR; - GenPCode3( HB_P_PARAMETER, LOBYTE(wPos), HIBYTE(wPos) ); - GenPCode1( LOBYTE(functions.pLast->wParamNum) ); + pSym = AddSymbol( yy_strdup(szVarName), &wPos ); + pSym->cScope |= VS_MEMVAR; + GenPCode3( HB_P_PARAMETER, LOBYTE( wPos ), HIBYTE( wPos ) ); + GenPCode1( LOBYTE( functions.pLast->wParamNum ) ); /* Add this variable to the local variables list - this will * allow to use the correct positions for real local variables. @@ -2071,7 +2071,7 @@ void AliasAddInt( int iWorkarea ) { ALIASID_PTR pAlias = (ALIASID_PTR) hb_xgrab( sizeof( ALIASID ) ); - pAlias->type =ALIAS_NUMBER; + pAlias->type = ALIAS_NUMBER; pAlias->alias.iAlias = iWorkarea; AliasAdd( pAlias ); } @@ -2129,14 +2129,14 @@ int Include( char * szFileName, PATHNAMES * pSearch ) { if( pSearch ) { - PHB_FNAME pFileName =hb_fsFNameSplit( szFileName ); + PHB_FNAME pFileName = hb_fsFNameSplit( szFileName ); char szFName[ _POSIX_PATH_MAX ]; /* filename to parse */ - pFileName->szName =szFileName; - pFileName->szExtension =NULL; + pFileName->szName = szFileName; + pFileName->szExtension = NULL; while( pSearch && !yyin ) { - pFileName->szPath =pSearch->szPath; + pFileName->szPath = pSearch->szPath; hb_fsFNameMerge( szFName, pFileName ); yyin = fopen( szFName, "r" ); if( ! yyin ) @@ -2241,7 +2241,7 @@ void ExpListPush( void ) { EXPLIST_PTR pExp = (EXPLIST_PTR) hb_xgrab( sizeof(EXPLIST) ); - pExp->pNext = pExp->pPrev =NULL; + pExp->pNext = pExp->pPrev = NULL; /* Store the previous state on the stack */ if( _pExpList ) @@ -2249,21 +2249,21 @@ void ExpListPush( void ) _pExpList->pNext = pExp; pExp->pPrev = _pExpList; /* save currently used pcode buffer */ - _pExpList->exprSize =functions.pLast->lPCodePos; + _pExpList->exprSize = functions.pLast->lPCodePos; } _pExpList = pExp; /* store current pcode buffer */ - pExp->prevPCode =functions.pLast->pCode; - pExp->prevSize =functions.pLast->lPCodeSize; - pExp->prevPos =functions.pLast->lPCodePos; + pExp->prevPCode = functions.pLast->pCode; + pExp->prevSize = functions.pLast->lPCodeSize; + pExp->prevPos = functions.pLast->lPCodePos; /* and create the new one */ functions.pLast->pCode = ( BYTE * ) hb_xgrab( PCODE_CHUNK ); functions.pLast->lPCodeSize = PCODE_CHUNK; functions.pLast->lPCodePos = 0; - pExp->exprPCode =functions.pLast->pCode; + pExp->exprPCode = functions.pLast->pCode; } /* @@ -2274,23 +2274,23 @@ void ExpListPop( int iExpCount ) EXPLIST_PTR pExp, pDel; /* save currently used pcode buffer */ - _pExpList->exprSize =functions.pLast->lPCodePos; - _pExpList->exprPCode =functions.pLast->pCode; + _pExpList->exprSize = functions.pLast->lPCodePos; + _pExpList->exprPCode = functions.pLast->pCode; /* find the first expression in the list */ while( --iExpCount ) _pExpList = _pExpList->pPrev; /* return to the original pcode buffer */ - functions.pLast->pCode =_pExpList->prevPCode; - functions.pLast->lPCodeSize =_pExpList->prevSize; - functions.pLast->lPCodePos =_pExpList->prevPos; + functions.pLast->pCode = _pExpList->prevPCode; + functions.pLast->lPCodeSize = _pExpList->prevSize; + functions.pLast->lPCodePos = _pExpList->prevPos; pExp = _pExpList; if( _pExpList->pPrev ) { - _pExpList =_pExpList->pPrev; - _pExpList->pNext =NULL; + _pExpList = _pExpList->pPrev; + _pExpList->pNext = NULL; } else _pExpList = NULL; @@ -2318,8 +2318,8 @@ void ExpListPop( int iExpCount ) hb_xfree( pExp->exprPCode ); - pDel =pExp; - pExp =pExp->pNext; + pDel = pExp; + pExp = pExp->pNext; hb_xfree( pDel ); } } @@ -2335,8 +2335,8 @@ void FieldPCode( BYTE bPCode, char * szVarName ) pVar = GetSymbol( szVarName, &wVar ); if( ! pVar ) - pVar =AddSymbol( szVarName, &wVar ); - pVar->cScope |=VS_MEMVAR; + pVar = AddSymbol( szVarName, &wVar ); + pVar->cScope |= VS_MEMVAR; GenPCode3( bPCode, LOBYTE( wVar ), HIBYTE( wVar ) ); } @@ -2590,743 +2590,743 @@ void GenCCode( char * szFileName, char * szName ) /* generates the C langu else fprintf( yyc, "HARBOUR HB_%s( void )\n{\n static BYTE pcode[] = { \n", pFunc->szName ); - bEndProcRequired =TRUE; + bEndProcRequired = TRUE; lPCodePos = 0; while( lPCodePos < pFunc->lPCodePos ) { switch( pFunc->pCode[ lPCodePos ] ) { case HB_P_AND: - fprintf( yyc, "\t\tHB_P_AND,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_AND,\n" ); + lPCodePos++; + break; case HB_P_ARRAYAT: - fprintf( yyc, "\t\tHB_P_ARRAYAT,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_ARRAYAT,\n" ); + lPCodePos++; + break; case HB_P_ARRAYPUT: - fprintf( yyc, "\t\tHB_P_ARRAYPUT,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_ARRAYPUT,\n" ); + lPCodePos++; + break; case HB_P_DEC: - fprintf( yyc, "\t\tHB_P_DEC,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_DEC,\n" ); + lPCodePos++; + break; case HB_P_DIMARRAY: - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_DIMARRAY, %i, %i,\t/* %i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w ); - lPCodePos += 3; - break; + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_DIMARRAY, %i, %i,\t/* %i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w ); + lPCodePos += 3; + break; case HB_P_DIVIDE: - fprintf( yyc, "\t\tHB_P_DIVIDE,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_DIVIDE,\n" ); + lPCodePos++; + break; case HB_P_DO: - fprintf( yyc, "\t\tHB_P_DO, %i, %i,\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ] ); - lPCodePos += 3; - break; + fprintf( yyc, "\t\tHB_P_DO, %i, %i,\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ] ); + lPCodePos += 3; + break; case HB_P_DUPLICATE: - fprintf( yyc, "\t\tHB_P_DUPLICATE,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_DUPLICATE,\n" ); + lPCodePos++; + break; case HB_P_DUPLTWO: - fprintf( yyc, "\t\tHB_P_DUPLTWO,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_DUPLTWO,\n" ); + lPCodePos++; + break; case HB_P_EQUAL: - fprintf( yyc, "\t\tHB_P_EQUAL,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_EQUAL,\n" ); + lPCodePos++; + break; case HB_P_EXACTLYEQUAL: - fprintf( yyc, "\t\tHB_P_EXACTLYEQUAL,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_EXACTLYEQUAL,\n" ); + lPCodePos++; + break; case HB_P_ENDBLOCK: - --iNestedCodeblock; - fprintf( yyc, "\t\tHB_P_ENDBLOCK,\n" ); - lPCodePos++; - break; + --iNestedCodeblock; + fprintf( yyc, "\t\tHB_P_ENDBLOCK,\n" ); + lPCodePos++; + break; case HB_P_ENDPROC: - lPCodePos++; - if( lPCodePos == pFunc->lPCodePos ) - { - bEndProcRequired =FALSE; - fprintf( yyc, "\t\tHB_P_ENDPROC\n" ); - } - else + lPCodePos++; + if( lPCodePos == pFunc->lPCodePos ) + { + bEndProcRequired = FALSE; + fprintf( yyc, "\t\tHB_P_ENDPROC\n" ); + } + else fprintf( yyc, "\t\tHB_P_ENDPROC,\n" ); - break; + break; case HB_P_FALSE: - fprintf( yyc, "\t\tHB_P_FALSE,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_FALSE,\n" ); + lPCodePos++; + break; - case HB_P_FORTEST: /* ER For tests. Step > 0 LESS */ - /* Step < 0 GREATER */ - fprintf( yyc, "\t\tHB_P_FORTEST,\n" ); - lPCodePos++; - break; + case HB_P_FORTEST: /* ER For tests. Step > 0 LESS */ + /* Step < 0 GREATER */ + fprintf( yyc, "\t\tHB_P_FORTEST,\n" ); + lPCodePos++; + break; case HB_P_FRAME: - { - PVAR pLocal = pFunc->pLocals; - BYTE bLocals = 0; + { + PVAR pLocal = pFunc->pLocals; + BYTE bLocals = 0; - while( pLocal ) - { - pLocal = pLocal->pNext; - bLocals++; - } + while( pLocal ) + { + pLocal = pLocal->pNext; + bLocals++; + } - if( bLocals || pFunc->wParamCount ) - fprintf( yyc, "\t\tHB_P_FRAME, %i, %i,\t/* locals, params */\n", - bLocals - pFunc->wParamCount, - pFunc->wParamCount ); - lPCodePos += 3; - } - break; + if( bLocals || pFunc->wParamCount ) + fprintf( yyc, "\t\tHB_P_FRAME, %i, %i,\t/* locals, params */\n", + bLocals - pFunc->wParamCount, + pFunc->wParamCount ); + lPCodePos += 3; + } + break; case HB_P_FUNCPTR: - fprintf( yyc, "\t\tHB_P_FUNCPTR,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_FUNCPTR,\n" ); + lPCodePos++; + break; case HB_P_FUNCTION: - fprintf( yyc, "\t\tHB_P_FUNCTION, %i, %i,\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ] ); - lPCodePos += 3; - break; + fprintf( yyc, "\t\tHB_P_FUNCTION, %i, %i,\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ] ); + lPCodePos += 3; + break; case HB_P_GENARRAY: - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_GENARRAY, %i, %i,\t/* %i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w ); - lPCodePos += 3; - break; + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_GENARRAY, %i, %i,\t/* %i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w ); + lPCodePos += 3; + break; case HB_P_GREATER: - fprintf( yyc, "\t\tHB_P_GREATER,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_GREATER,\n" ); + lPCodePos++; + break; case HB_P_GREATEREQUAL: - fprintf( yyc, "\t\tHB_P_GREATEREQUAL,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_GREATEREQUAL,\n" ); + lPCodePos++; + break; case HB_P_INC: - fprintf( yyc, "\t\tHB_P_INC,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_INC,\n" ); + lPCodePos++; + break; case HB_P_INSTRING: - fprintf( yyc, "\t\tHB_P_INSTRING,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_INSTRING,\n" ); + lPCodePos++; + break; case HB_P_JUMP: - /*if( 1 ) (lPCodePos + 3) < pFunc->lPCodePos ) */ - { - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_JUMP, %i, %i,\t/* %i (abs: %05li) */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); - } - lPCodePos += 3; - break; + /* if( 1 ) ( lPCodePos + 3 ) < pFunc->lPCodePos ) */ + { + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_JUMP, %i, %i,\t/* %i (abs: %05li) */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); + } + lPCodePos += 3; + break; case HB_P_JUMPFALSE: - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_JUMPFALSE, %i, %i,\t/* %i (abs: %05li) */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); - lPCodePos += 3; - break; + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_JUMPFALSE, %i, %i,\t/* %i (abs: %05li) */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); + lPCodePos += 3; + break; case HB_P_JUMPTRUE: - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_JUMPTRUE, %i, %i,\t/* %i (abs: %05li) */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); - lPCodePos += 3; - break; + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_JUMPTRUE, %i, %i,\t/* %i (abs: %05li) */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); + lPCodePos += 3; + break; case HB_P_LESS: - fprintf( yyc, "\t\tHB_P_LESS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_LESS,\n" ); + lPCodePos++; + break; case HB_P_LESSEQUAL: - fprintf( yyc, "\t\tHB_P_LESSEQUAL,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_LESSEQUAL,\n" ); + lPCodePos++; + break; case HB_P_LINE: - fprintf( yyc, "/* %05li */", lPCodePos ); - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, " HB_P_LINE, %i, %i,\t\t/* %i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w ); - lPCodePos += 3; - break; + fprintf( yyc, "/* %05li */", lPCodePos ); + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, " HB_P_LINE, %i, %i,\t\t/* %i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w ); + lPCodePos += 3; + break; case HB_P_LOCALNAME: - fprintf( yyc, "\t\tHB_P_LOCALNAME, %i, %i,\t/* %s */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - ( char * ) pFunc->pCode + lPCodePos + 3 ); - lPCodePos += 3; - while( pFunc->pCode[ lPCodePos ] ) - { - chr = pFunc->pCode[ lPCodePos++ ]; - if( chr == '\'' || chr == '\\') - fprintf( yyc, " \'\\%c\',", chr ); - else - fprintf( yyc, " \'%c\',", chr ); - } - fprintf( yyc, " 0,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_LOCALNAME, %i, %i,\t/* %s */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + ( char * ) pFunc->pCode + lPCodePos + 3 ); + lPCodePos += 3; + while( pFunc->pCode[ lPCodePos ] ) + { + chr = pFunc->pCode[ lPCodePos++ ]; + if( chr == '\'' || chr == '\\') + fprintf( yyc, " \'\\%c\',", chr ); + else + fprintf( yyc, " \'%c\',", chr ); + } + fprintf( yyc, " 0,\n" ); + lPCodePos++; + break; case HB_P_MESSAGE: - { + { WORD wFixPos; wSym = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wSym ); + wFixPos = FixSymbolPos( wSym ); fprintf( yyc, "\t\tHB_P_MESSAGE, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wSym )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_MINUS: - fprintf( yyc, "\t\tHB_P_MINUS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_MINUS,\n" ); + lPCodePos++; + break; case HB_P_MODULENAME: - fprintf( yyc, "\t\tHB_P_MODULENAME,\t/* %s */\n", - ( char * ) pFunc->pCode + lPCodePos++ + 1 ); - while( pFunc->pCode[ lPCodePos ] ) - { - chr = pFunc->pCode[ lPCodePos++ ]; - if( chr == '\'' || chr == '\\') - fprintf( yyc, " \'\\%c\',", chr ); - else - fprintf( yyc, " \'%c\',", chr ); - } - fprintf( yyc, " 0,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_MODULENAME,\t/* %s */\n", + ( char * ) pFunc->pCode + lPCodePos++ + 1 ); + while( pFunc->pCode[ lPCodePos ] ) + { + chr = pFunc->pCode[ lPCodePos++ ]; + if( chr == '\'' || chr == '\\') + fprintf( yyc, " \'\\%c\',", chr ); + else + fprintf( yyc, " \'%c\',", chr ); + } + fprintf( yyc, " 0,\n" ); + lPCodePos++; + break; case HB_P_MODULUS: - fprintf( yyc, "\t\tHB_P_MODULUS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_MODULUS,\n" ); + lPCodePos++; + break; case HB_P_MULT: - fprintf( yyc, "\t\tHB_P_MULT,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_MULT,\n" ); + lPCodePos++; + break; case HB_P_NEGATE: - fprintf( yyc, "\t\tHB_P_NEGATE,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_NEGATE,\n" ); + lPCodePos++; + break; case HB_P_NOT: - fprintf( yyc, "\t\tHB_P_NOT,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_NOT,\n" ); + lPCodePos++; + break; case HB_P_NOTEQUAL: - fprintf( yyc, "\t\tHB_P_NOTEQUAL,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_NOTEQUAL,\n" ); + lPCodePos++; + break; case HB_P_OR: - fprintf( yyc, "\t\tHB_P_OR,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_OR,\n" ); + lPCodePos++; + break; case HB_P_PARAMETER: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_PARAMETER, %i, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), pFunc->pCode[ lPCodePos + 3 ], GetSymbolOrd( wVar )->szName ); lPCodePos += 4; - } - break; + } + break; case HB_P_PLUS: - fprintf( yyc, "\t\tHB_P_PLUS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_PLUS,\n" ); + lPCodePos++; + break; case HB_P_POP: - fprintf( yyc, "\t\tHB_P_POP,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_POP,\n" ); + lPCodePos++; + break; case HB_P_POPALIAS: - fprintf( yyc, "\t\tHB_P_POPALIAS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_POPALIAS,\n" ); + lPCodePos++; + break; case HB_P_POPALIASEDFIELD: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_POPALIASEDFIELD, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_POPFIELD: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_POPFIELD, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_POPLOCAL: - { - SHORT wVar = * ( ( SHORT * ) &(pFunc->pCode )[ lPCodePos + 1 ] ); - /* Variable with negative order are local variables - * referenced in a codeblock -handle it with care - */ - if( iNestedCodeblock ) - { + { + SHORT wVar = * ( ( SHORT * ) &(pFunc->pCode )[ lPCodePos + 1 ] ); + /* Variable with negative order are local variables + * referenced in a codeblock -handle it with care + */ + if( iNestedCodeblock ) + { /* we are accesing variables within a codeblock */ /* the names of codeblock variable are lost */ if( wVar < 0 ) - fprintf( yyc, "\t\tHB_P_POPLOCAL, %i, %i,\t/* localvar%i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - -wVar ); - else - fprintf( yyc, "\t\tHB_P_POPLOCAL, %i, %i,\t/* codeblockvar%i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - wVar ); - } - else + fprintf( yyc, "\t\tHB_P_POPLOCAL, %i, %i,\t/* localvar%i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + -wVar ); + else + fprintf( yyc, "\t\tHB_P_POPLOCAL, %i, %i,\t/* codeblockvar%i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + wVar ); + } + else fprintf( yyc, "\t\tHB_P_POPLOCAL, %i, %i,\t/* %s */\n", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ], GetVar( pFunc->pLocals, wVar )->szName ); - lPCodePos += 3; - } - break; + lPCodePos += 3; + } + break; case HB_P_POPMEMVAR: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_POPMEMVAR, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_POPSTATIC: - { - PVAR pVar; - PFUNCTION pTmp = functions.pFirst; + { + PVAR pVar; + PFUNCTION pTmp = functions.pFirst; - wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) - pTmp =pTmp->pNext; - pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase ); - fprintf( yyc, "\t\tHB_P_POPSTATIC, %i, %i,\t/* %s */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - pVar->szName ); - lPCodePos += 3; - } - break; + wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) + pTmp = pTmp->pNext; + pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase ); + fprintf( yyc, "\t\tHB_P_POPSTATIC, %i, %i,\t/* %s */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + pVar->szName ); + lPCodePos += 3; + } + break; case HB_P_POWER: - fprintf( yyc, "\t\tHB_P_POWER,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_POWER,\n" ); + lPCodePos++; + break; case HB_P_PUSHALIAS: - fprintf( yyc, "\t\tHB_P_PUSHALIAS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_PUSHALIAS,\n" ); + lPCodePos++; + break; case HB_P_PUSHALIASEDFIELD: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + pFunc->pCode[ lPCodePos + 2 ] * 256; + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_PUSHALIASEDFIELD, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_PUSHBLOCK: - ++iNestedCodeblock; - fprintf( yyc, "\t\tHB_P_PUSHBLOCK, %i, %i,\t/* %i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256 ); - w = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos + 3 ] ) ); - fprintf( yyc, "\t\t%i, %i,\t/* number of local parameters (%i) */\n", - pFunc->pCode[ lPCodePos + 3 ], - pFunc->pCode[ lPCodePos + 4 ], w ); - wVar = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos + 5 ] ) ); - fprintf( yyc, "\t\t%i, %i,\t/* number of local variables (%i) */\n", - pFunc->pCode[ lPCodePos + 5 ], - pFunc->pCode[ lPCodePos + 6 ], wVar ); - lPCodePos += 7; /* codeblock size + number of parameters + number of local variables */ - /* create the table of referenced local variables */ - while( wVar-- ) - { - w = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos ] ) ); - fprintf( yyc, "\t\t%i, %i,\t/* %s */\n", - pFunc->pCode[ lPCodePos ], - pFunc->pCode[ lPCodePos + 1 ], - GetVar( pFunc->pLocals, w )->szName ); - lPCodePos +=2; - } - break; + ++iNestedCodeblock; + fprintf( yyc, "\t\tHB_P_PUSHBLOCK, %i, %i,\t/* %i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + pFunc->pCode[ lPCodePos + 1 ] + + pFunc->pCode[ lPCodePos + 2 ] * 256 ); + w = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos + 3 ] ) ); + fprintf( yyc, "\t\t%i, %i,\t/* number of local parameters (%i) */\n", + pFunc->pCode[ lPCodePos + 3 ], + pFunc->pCode[ lPCodePos + 4 ], w ); + wVar = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos + 5 ] ) ); + fprintf( yyc, "\t\t%i, %i,\t/* number of local variables (%i) */\n", + pFunc->pCode[ lPCodePos + 5 ], + pFunc->pCode[ lPCodePos + 6 ], wVar ); + lPCodePos += 7; /* codeblock size + number of parameters + number of local variables */ + /* create the table of referenced local variables */ + while( wVar-- ) + { + w = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos ] ) ); + fprintf( yyc, "\t\t%i, %i,\t/* %s */\n", + pFunc->pCode[ lPCodePos ], + pFunc->pCode[ lPCodePos + 1 ], + GetVar( pFunc->pLocals, w )->szName ); + lPCodePos +=2; + } + break; case HB_P_PUSHDOUBLE: - { - int i; - ++lPCodePos; - fprintf( yyc, "\t\tHB_P_PUSHDOUBLE, " ); - for( i = 0; i < sizeof( double ) + sizeof( BYTE ); ++i ) - fprintf( yyc, "%i,", ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ] ); - fprintf( yyc, "\t/* %.*f, %d */\n", - *( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ), - *( ( double * ) &( pFunc->pCode[ lPCodePos ] ) ), - *( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ) ); - lPCodePos += sizeof( double ) + sizeof( BYTE ); - } - break; + { + int i; + ++lPCodePos; + fprintf( yyc, "\t\tHB_P_PUSHDOUBLE, " ); + for( i = 0; i < sizeof( double ) + sizeof( BYTE ); ++i ) + fprintf( yyc, "%i,", ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ] ); + fprintf( yyc, "\t/* %.*f, %d */\n", + *( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ), + *( ( double * ) &( pFunc->pCode[ lPCodePos ] ) ), + *( ( BYTE * ) &( pFunc->pCode[ lPCodePos + sizeof( double ) ] ) ) ); + lPCodePos += sizeof( double ) + sizeof( BYTE ); + } + break; case HB_P_PUSHFIELD: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + pFunc->pCode[ lPCodePos + 2 ] * 256; + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_PUSHFIELD, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_PUSHINT: - fprintf( yyc, "\t\tHB_P_PUSHINT, %i, %i,\t/* %i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256 ); - lPCodePos += 3; - break; + fprintf( yyc, "\t\tHB_P_PUSHINT, %i, %i,\t/* %i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + pFunc->pCode[ lPCodePos + 1 ] + + pFunc->pCode[ lPCodePos + 2 ] * 256 ); + lPCodePos += 3; + break; case HB_P_PUSHLOCAL: - { - SHORT wVar = * ( ( SHORT * ) &(pFunc->pCode )[ lPCodePos + 1 ] ); - /* Variable with negative order are local variables - * referenced in a codeblock -handle it with care - */ - if( iNestedCodeblock ) - { + { + SHORT wVar = * ( ( SHORT * ) &(pFunc->pCode )[ lPCodePos + 1 ] ); + /* Variable with negative order are local variables + * referenced in a codeblock -handle it with care + */ + if( iNestedCodeblock ) + { /* we are accesing variables within a codeblock */ /* the names of codeblock variable are lost */ if( wVar < 0 ) - fprintf( yyc, "\t\tHB_P_PUSHLOCAL, %i, %i,\t/* localvar%i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - -wVar ); - else - fprintf( yyc, "\t\tHB_P_PUSHLOCAL, %i, %i,\t/* codeblockvar%i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - wVar ); - } - else + fprintf( yyc, "\t\tHB_P_PUSHLOCAL, %i, %i,\t/* localvar%i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + -wVar ); + else + fprintf( yyc, "\t\tHB_P_PUSHLOCAL, %i, %i,\t/* codeblockvar%i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + wVar ); + } + else fprintf( yyc, "\t\tHB_P_PUSHLOCAL, %i, %i,\t/* %s */\n", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ], GetVar( pFunc->pLocals, wVar )->szName ); - lPCodePos += 3; - } - break; + lPCodePos += 3; + } + break; case HB_P_PUSHLOCALREF: - { - SHORT wVar = * ( ( SHORT * ) &(pFunc->pCode )[ lPCodePos + 1 ] ); - /* Variable with negative order are local variables - * referenced in a codeblock -handle it with care - */ - if( iNestedCodeblock ) - { + { + SHORT wVar = * ( ( SHORT * ) &(pFunc->pCode )[ lPCodePos + 1 ] ); + /* Variable with negative order are local variables + * referenced in a codeblock -handle it with care + */ + if( iNestedCodeblock ) + { /* we are accesing variables within a codeblock */ /* the names of codeblock variable are lost */ if( wVar < 0 ) - fprintf( yyc, "\t\tHB_P_PUSHLOCALREF, %i, %i,\t/* localvar%i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - -wVar ); - else - fprintf( yyc, "\t\tHB_P_PUSHLOCALREF, %i, %i,\t/* codeblockvar%i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - wVar ); - } - else + fprintf( yyc, "\t\tHB_P_PUSHLOCALREF, %i, %i,\t/* localvar%i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + -wVar ); + else + fprintf( yyc, "\t\tHB_P_PUSHLOCALREF, %i, %i,\t/* codeblockvar%i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + wVar ); + } + else fprintf( yyc, "\t\tHB_P_PUSHLOCALREF, %i, %i,\t/* %s */\n", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ], GetVar( pFunc->pLocals, wVar )->szName ); - lPCodePos += 3; - } - break; + lPCodePos += 3; + } + break; case HB_P_PUSHLONG: - fprintf( yyc, "\t\tHB_P_PUSHLONG, %i, %i, %i, %i,\t/* %li */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - pFunc->pCode[ lPCodePos + 3 ], - pFunc->pCode[ lPCodePos + 4 ], - *( ( long * ) &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); - lPCodePos +=( 1 + sizeof(long) ); - break; + fprintf( yyc, "\t\tHB_P_PUSHLONG, %i, %i, %i, %i,\t/* %li */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + pFunc->pCode[ lPCodePos + 3 ], + pFunc->pCode[ lPCodePos + 4 ], + *( ( long * ) &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); + lPCodePos += ( 1 + sizeof(long) ); + break; case HB_P_PUSHMEMVAR: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + pFunc->pCode[ lPCodePos + 2 ] * 256; + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_PUSHMEMVAR, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_PUSHMEMVARREF: - { + { WORD wFixPos; wVar = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wVar ); + pFunc->pCode[ lPCodePos + 2 ] * 256; + wFixPos = FixSymbolPos( wVar ); fprintf( yyc, "\t\tHB_P_PUSHMEMVARREF, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wVar )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_PUSHNIL: - fprintf( yyc, "\t\tHB_P_PUSHNIL,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_PUSHNIL,\n" ); + lPCodePos++; + break; case HB_P_PUSHSELF: - fprintf( yyc, "\t\tHB_P_PUSHSELF,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_PUSHSELF,\n" ); + lPCodePos++; + break; case HB_P_PUSHSTATIC: - { - PVAR pVar; - PFUNCTION pTmp = functions.pFirst; + { + PVAR pVar; + PFUNCTION pTmp = functions.pFirst; - wVar = pFunc->pCode[ lPCodePos + 1 ] +pFunc->pCode[ lPCodePos + 2 ] * 256; - while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) - pTmp =pTmp->pNext; - pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase ); - fprintf( yyc, "\t\tHB_P_PUSHSTATIC, %i, %i,\t/* %s */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - pVar->szName ); - lPCodePos += 3; - } - break; + wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) + pTmp = pTmp->pNext; + pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase ); + fprintf( yyc, "\t\tHB_P_PUSHSTATIC, %i, %i,\t/* %s */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + pVar->szName ); + lPCodePos += 3; + } + break; case HB_P_PUSHSTATICREF: - { - PVAR pVar; - PFUNCTION pTmp = functions.pFirst; + { + PVAR pVar; + PFUNCTION pTmp = functions.pFirst; - wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) - pTmp =pTmp->pNext; - pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase ); - fprintf( yyc, "\t\tHB_P_PUSHSTATICREF, %i, %i,\t/* %s */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], - pVar->szName ); - lPCodePos += 3; - } - break; + wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) + pTmp = pTmp->pNext; + pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase ); + fprintf( yyc, "\t\tHB_P_PUSHSTATICREF, %i, %i,\t/* %s */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], + pVar->szName ); + lPCodePos += 3; + } + break; case HB_P_PUSHSTR: - wLen = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_PUSHSTR, %i, %i,\t/* %i */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], wLen ); - lPCodePos +=3; - while( wLen-- ) - { - chr = pFunc->pCode[ lPCodePos++ ]; - if( chr == '\'' || chr == '\\') - fprintf( yyc, " \'\\%c\',", chr ); - else - fprintf( yyc, " \'%c\',", chr ); - } - fprintf( yyc, "\n" ); - break; + wLen = pFunc->pCode[ lPCodePos + 1 ] + + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_PUSHSTR, %i, %i,\t/* %i */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], wLen ); + lPCodePos +=3; + while( wLen-- ) + { + chr = pFunc->pCode[ lPCodePos++ ]; + if( chr == '\'' || chr == '\\') + fprintf( yyc, " \'\\%c\',", chr ); + else + fprintf( yyc, " \'%c\',", chr ); + } + fprintf( yyc, "\n" ); + break; case HB_P_PUSHSYM: - { + { WORD wFixPos; wSym = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - wFixPos =FixSymbolPos( wSym ); + pFunc->pCode[ lPCodePos + 2 ] * 256; + wFixPos = FixSymbolPos( wSym ); fprintf( yyc, "\t\tHB_P_PUSHSYM, %i, %i,\t/* %s */\n", LOBYTE( wFixPos ), HIBYTE( wFixPos ), GetSymbolOrd( wSym )->szName ); lPCodePos += 3; - } - break; + } + break; case HB_P_RETVALUE: - fprintf( yyc, "\t\tHB_P_RETVALUE,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_RETVALUE,\n" ); + lPCodePos++; + break; case HB_P_SEQBEGIN: - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, "\t\tHB_P_SEQBEGIN, %i, %i,\t/* %i (abs: %05li) */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); - lPCodePos += 3; - break; + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, "\t\tHB_P_SEQBEGIN, %i, %i,\t/* %i (abs: %05li) */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); + lPCodePos += 3; + break; case HB_P_SEQEND: - fprintf( yyc, "/* %05li */", lPCodePos ); - w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; - fprintf( yyc, " HB_P_SEQEND, %i, %i,\t/* %i (abs: %05li) */\n", - pFunc->pCode[ lPCodePos + 1 ], - pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); - lPCodePos += 3; - break; + fprintf( yyc, "/* %05li */", lPCodePos ); + w = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256; + fprintf( yyc, " HB_P_SEQEND, %i, %i,\t/* %i (abs: %05li) */\n", + pFunc->pCode[ lPCodePos + 1 ], + pFunc->pCode[ lPCodePos + 2 ], w, lPCodePos + ( w ? w: 3 ) ); + lPCodePos += 3; + break; case HB_P_SEQRECOVER: - fprintf( yyc, "\t\tHB_P_SEQRECOVER,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_SEQRECOVER,\n" ); + lPCodePos++; + break; case HB_P_SFRAME: - /* we only generate it if there are statics used in this function */ - if( pFunc->bFlags & FUN_USES_STATICS ) - { - GetSymbol( _pInitFunc->szName, &w ); - w = FixSymbolPos( w ); - fprintf( yyc, "\t\tHB_P_SFRAME, %i, %i,\t/* symbol (_INITSTATICS) */\n", - LOBYTE( w ), HIBYTE( w ) ); - } - lPCodePos += 3; - break; + /* we only generate it if there are statics used in this function */ + if( pFunc->bFlags & FUN_USES_STATICS ) + { + GetSymbol( _pInitFunc->szName, &w ); + w = FixSymbolPos( w ); + fprintf( yyc, "\t\tHB_P_SFRAME, %i, %i,\t/* symbol (_INITSTATICS) */\n", + LOBYTE( w ), HIBYTE( w ) ); + } + lPCodePos += 3; + break; case HB_P_STATICS: - { - GetSymbol( _pInitFunc->szName, &w ); - w = FixSymbolPos( w ); - fprintf( yyc, "\t\tHB_P_STATICS, %i, %i,\t/* symbol (_INITSTATICS) */\n", - LOBYTE( w ), HIBYTE( w ) ); - lPCodePos += 3; - } - break; + { + GetSymbol( _pInitFunc->szName, &w ); + w = FixSymbolPos( w ); + fprintf( yyc, "\t\tHB_P_STATICS, %i, %i,\t/* symbol (_INITSTATICS) */\n", + LOBYTE( w ), HIBYTE( w ) ); + lPCodePos += 3; + } + break; case HB_P_SWAPALIAS: - fprintf( yyc, "\t\tHB_P_SWAPALIAS,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_SWAPALIAS,\n" ); + lPCodePos++; + break; case HB_P_TRUE: - fprintf( yyc, "\t\tHB_P_TRUE,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_TRUE,\n" ); + lPCodePos++; + break; case HB_P_ZERO: - fprintf( yyc, "\t\tHB_P_ZERO,\n" ); - lPCodePos++; - break; + fprintf( yyc, "\t\tHB_P_ZERO,\n" ); + lPCodePos++; + break; default: - printf( "Incorrect pcode value: %u\n", pFunc->pCode[ lPCodePos ] ); - lPCodePos = pFunc->lPCodePos; - break; + printf( "Incorrect pcode value: %u\n", pFunc->pCode[ lPCodePos ] ); + lPCodePos = pFunc->lPCodePos; + break; } } @@ -3341,19 +3341,19 @@ void GenCCode( char * szFileName, char * szName ) /* generates the C langu fclose( yyc ); - pFunc =functions.pFirst; + pFunc = functions.pFirst; while( pFunc ) pFunc = KillFunction( pFunc ); - pFunc =funcalls.pFirst; + pFunc = funcalls.pFirst; while( pFunc ) { - funcalls.pFirst =pFunc->pNext; + funcalls.pFirst = pFunc->pNext; hb_xfree( ( void * ) pFunc ); /*NOTE: szName will be released by KillSymbol() */ - pFunc =funcalls.pFirst; + pFunc = funcalls.pFirst; } - pSym =symbols.pFirst; + pSym = symbols.pFirst; while( pSym ) pSym = KillSymbol( pSym ); @@ -3369,7 +3369,7 @@ PFUNCTION KillFunction( PFUNCTION pFunc ) while( pFunc->pLocals ) { pVar = pFunc->pLocals; - pFunc->pLocals =pVar->pNext; + pFunc->pLocals = pVar->pNext; hb_xfree( ( void * ) pVar->szName ); hb_xfree( ( void * ) pVar ); @@ -3378,7 +3378,7 @@ PFUNCTION KillFunction( PFUNCTION pFunc ) while( pFunc->pStatics ) { pVar = pFunc->pStatics; - pFunc->pStatics =pVar->pNext; + pFunc->pStatics = pVar->pNext; hb_xfree( ( void * ) pVar->szName ); hb_xfree( ( void * ) pVar ); @@ -3387,7 +3387,7 @@ PFUNCTION KillFunction( PFUNCTION pFunc ) while( pFunc->pFields ) { pVar = pFunc->pFields; - pFunc->pFields =pVar->pNext; + pFunc->pFields = pVar->pNext; hb_xfree( ( void * ) pVar->szName ); if( pVar->szAlias ) @@ -3399,8 +3399,8 @@ PFUNCTION KillFunction( PFUNCTION pFunc ) while( pFunc->pMemvars ) { - pVar =pFunc->pMemvars; - pFunc->pMemvars =pVar->pNext; + pVar = pFunc->pMemvars; + pFunc->pMemvars = pVar->pNext; hb_xfree( ( void * ) pVar->szName ); if( pVar->szAlias ) @@ -3475,30 +3475,30 @@ void GenIfInline( void ) BOOL bGenPCode; /* save currently used pcode buffer */ - _pExpList->exprSize =functions.pLast->lPCodePos; - _pExpList->exprPCode =functions.pLast->pCode; + _pExpList->exprSize = functions.pLast->lPCodePos; + _pExpList->exprPCode = functions.pLast->pCode; /* find the first expression in the list */ while( --iExpCount ) _pExpList = _pExpList->pPrev; /* return to the original pcode buffer */ - functions.pLast->pCode =_pExpList->prevPCode; - functions.pLast->lPCodeSize =_pExpList->prevSize; - functions.pLast->lPCodePos =_pExpList->prevPos; + functions.pLast->pCode = _pExpList->prevPCode; + functions.pLast->lPCodeSize = _pExpList->prevSize; + functions.pLast->lPCodePos = _pExpList->prevPos; /* Update the pointer for nested or next expressions */ pExp = _pExpList; if( _pExpList->pPrev ) { - _pExpList =_pExpList->pPrev; - _pExpList->pNext =NULL; + _pExpList = _pExpList->pPrev; + _pExpList->pNext = NULL; } else _pExpList = NULL; - bGenPCode =TRUE; - pDel =pExp; /* save it for later use */ + bGenPCode = TRUE; + pDel = pExp; /* save it for later use */ /* pExp points now to pcode buffer for logical condition */ @@ -3516,23 +3516,23 @@ void GenIfInline( void ) if( pExp->exprPCode[ 0 ] == HB_P_TRUE ) { /* move to the second expression */ - pExp =pExp->pNext; + pExp = pExp->pNext; if( pExp->exprSize ) GenPCodeN( pExp->exprPCode, pExp->exprSize ); else PushNil(); /* IIF have to return some value */ - bGenPCode =FALSE; + bGenPCode = FALSE; } else if( pExp->exprPCode[ 0 ] == HB_P_FALSE ) { /* move to the third expression */ - pExp =pExp->pNext; - pExp =pExp->pNext; + pExp = pExp->pNext; + pExp = pExp->pNext; if( pExp->exprSize ) GenPCodeN( pExp->exprPCode, pExp->exprSize ); else PushNil(); /* IIF have to return some value */ - bGenPCode =FALSE; + bGenPCode = FALSE; } } @@ -3543,17 +3543,17 @@ void GenIfInline( void ) LONG lPosFalse, lPosEnd; GenPCodeN( pExp->exprPCode, pExp->exprSize ); - lPosFalse =JumpFalse( 0 ); + lPosFalse = JumpFalse( 0 ); - pExp =pExp->pNext; + pExp = pExp->pNext; if( pExp->exprSize ) GenPCodeN( pExp->exprPCode, pExp->exprSize ); else PushNil(); /* IIF have to return some value */ - lPosEnd =Jump( 0 ); + lPosEnd = Jump( 0 ); JumpHere( lPosFalse ); - pExp =pExp->pNext; + pExp = pExp->pNext; if( pExp->exprSize ) GenPCodeN( pExp->exprPCode, pExp->exprSize ); else @@ -3563,8 +3563,8 @@ void GenIfInline( void ) while( pDel ) { - pExp =pDel; - pDel =pDel->pNext; + pExp = pDel; + pDel = pDel->pNext; hb_xfree( pExp->exprPCode ); hb_xfree( pExp ); } @@ -3675,7 +3675,7 @@ WORD GetVarPos( PVAR pVars, char * szVarName ) /* returns the order + 1 of a var int GetLocalVarPos( char * szVarName ) /* returns the order + 1 of a variable if defined or zero */ { int iVar = 0; - PFUNCTION pFunc =functions.pLast; + PFUNCTION pFunc = functions.pLast; if( pFunc->szName ) /* we are in a function/procedure -we don't need any tricks */ @@ -3690,12 +3690,12 @@ int GetLocalVarPos( char * szVarName ) /* returns the order + 1 of a variable if * we have to check the list of nested codeblocks up to a function * where the codeblock is defined */ - PFUNCTION pOutBlock =pFunc; /* the outermost codeblock */ + PFUNCTION pOutBlock = pFunc; /* the outermost codeblock */ - pFunc =pFunc->pOwner; + pFunc = pFunc->pOwner; while( pFunc ) { - iVar =GetVarPos( pFunc->pLocals, szVarName ); + iVar = GetVarPos( pFunc->pLocals, szVarName ); if( iVar ) { if( pFunc->pOwner ) @@ -3757,8 +3757,8 @@ int GetLocalVarPos( char * szVarName ) /* returns the order + 1 of a variable if return iVar; } } - pOutBlock =pFunc; - pFunc =pFunc->pOwner; + pOutBlock = pFunc; + pFunc = pFunc->pOwner; } } } @@ -3779,8 +3779,8 @@ int GetStaticVarPos( char * szVarName ) * defined in current function */ if( pFunc->pOwner ) - pFunc =pFunc->pOwner; /* we are in the static variable definition state */ - iPos =GetVarPos( pFunc->pStatics, szVarName ); + pFunc = pFunc->pOwner; /* we are in the static variable definition state */ + iPos = GetVarPos( pFunc->pStatics, szVarName ); if( iPos ) return iPos + pFunc->iStaticsBase; @@ -3790,7 +3790,7 @@ int GetStaticVarPos( char * szVarName ) */ if( !_bStartProc ) { - iPos =GetVarPos( functions.pFirst->pStatics, szVarName ); + iPos = GetVarPos( functions.pFirst->pStatics, szVarName ); if( iPos ) return iPos; } @@ -3843,21 +3843,21 @@ int GetMemvarPos( char * szVarName ) if( pFunc->szName ) /* we are in a function/procedure -we don't need any tricks */ - iVar =GetVarPos( pFunc->pMemvars, szVarName ); + iVar = GetVarPos( pFunc->pMemvars, szVarName ); else { /* we have to check the list of nested codeblock up to a function * where the codeblock is defined */ while( pFunc->pOwner ) - pFunc =pFunc->pOwner; - iVar =GetVarPos( pFunc->pMemvars, szVarName ); + pFunc = pFunc->pOwner; + iVar = GetVarPos( pFunc->pMemvars, szVarName ); } /* if not found on the list declared in current function then check * the global list (only if there will be no starting procedure) */ if( ! iVar && ! _bStartProc ) - iVar =GetVarPos( functions.pFirst->pMemvars, szVarName ); + iVar = GetVarPos( functions.pFirst->pMemvars, szVarName ); return iVar; } @@ -3983,12 +3983,12 @@ ULONG JumpFalse( LONG lOffset ) if( _bWarnings ) { PSTACK_VAL_TYPE pFree; - char sType[2]; + char sType[ 2 ]; if( pStackValType ) { - sType[0] = pStackValType->cType; - sType[1] = '\0'; + sType[ 0 ] = pStackValType->cType; + sType[ 1 ] = '\0'; } else debug_msg( "\n* *HB_P_JUMPFALSE Compile time stack overflow\n", NULL ); @@ -4047,12 +4047,12 @@ ULONG JumpTrue( LONG lOffset ) if( _bWarnings ) { PSTACK_VAL_TYPE pFree; - char sType[2]; + char sType[ 2 ]; if( pStackValType ) { - sType[0] = pStackValType->cType; - sType[1] = '\0'; + sType[ 0 ] = pStackValType->cType; + sType[ 1 ] = '\0'; } else debug_msg( "\n* *HB_P_JUMPTRUE Compile time stack overflow\n", NULL ); @@ -4087,16 +4087,16 @@ void Line( void ) /* generates the pcode with the currently compiled source code { if( ((functions.pLast->lPCodePos - _ulLastLinePos) > 3) || _bDebugInfo ) { - _ulLastLinePos =functions.pLast->lPCodePos; + _ulLastLinePos = functions.pLast->lPCodePos; GenPCode3( HB_P_LINE, LOBYTE( iLine ), HIBYTE( iLine ) ); } else { - functions.pLast->pCode[ _ulLastLinePos +1 ] =LOBYTE( iLine ); - functions.pLast->pCode[ _ulLastLinePos +2 ] =HIBYTE( iLine ); + functions.pLast->pCode[ _ulLastLinePos +1 ] = LOBYTE( iLine ); + functions.pLast->pCode[ _ulLastLinePos +2 ] = HIBYTE( iLine ); } } - _bDontGenLineNum =FALSE; + _bDontGenLineNum = FALSE; } /* Generates the pcode with the currently compiled source code line @@ -4135,23 +4135,23 @@ void VariablePCode( BYTE bPCode, char * szVarName ) if( _bForceMemvars ) { /* -v swith was used -> first check the MEMVARs */ - wVar =GetMemvarPos( szVarName ); + wVar = GetMemvarPos( szVarName ); if( ! wVar ) { - wVar =GetFieldVarPos( szVarName, &pOwnerFunc ); + wVar = GetFieldVarPos( szVarName, &pOwnerFunc ); if( ! wVar ) - GenWarning( _szCWarnings, 'W', ((bPCode==HB_P_POPMEMVAR) ? WARN_MEMVAR_ASSUMED : WARN_AMBIGUOUS_VAR), + GenWarning( _szCWarnings, 'W', ( ( bPCode == HB_P_POPMEMVAR ) ? WARN_MEMVAR_ASSUMED : WARN_AMBIGUOUS_VAR ), szVarName, NULL ); } } else { /* -v was not used -> default action is checking FIELDs list */ - wVar =GetFieldVarPos( szVarName, &pOwnerFunc ); + wVar = GetFieldVarPos( szVarName, &pOwnerFunc ); if( wVar == 0 ) { - wVar =GetMemvarPos( szVarName ); + wVar = GetMemvarPos( szVarName ); if( wVar == 0 ) - GenWarning( _szCWarnings, 'W', ((bPCode==HB_P_POPMEMVAR) ? WARN_MEMVAR_ASSUMED : WARN_AMBIGUOUS_VAR), + GenWarning( _szCWarnings, 'W', ( ( bPCode == HB_P_POPMEMVAR ) ? WARN_MEMVAR_ASSUMED : WARN_AMBIGUOUS_VAR ), szVarName, NULL ); } } @@ -4163,9 +4163,9 @@ void VariablePCode( BYTE bPCode, char * szVarName ) if( pField->szAlias ) { /* the alias was specified too */ if( bPCode == HB_P_POPMEMVAR ) - bPCode =HB_P_POPALIASEDFIELD; + bPCode = HB_P_POPALIASEDFIELD; else if( bPCode == HB_P_PUSHMEMVAR ) - bPCode =HB_P_PUSHALIASEDFIELD; + bPCode = HB_P_PUSHALIASEDFIELD; else /* pushing fields by reference is not allowed */ GenError( _szCErrors, 'E', ERR_INVALID_REFER, szVarName, NULL ); @@ -4174,9 +4174,9 @@ void VariablePCode( BYTE bPCode, char * szVarName ) else { /* this is unaliased field */ if( bPCode == HB_P_POPMEMVAR ) - bPCode =HB_P_POPFIELD; + bPCode = HB_P_POPFIELD; else if( bPCode == HB_P_PUSHMEMVAR ) - bPCode =HB_P_PUSHFIELD; + bPCode = HB_P_PUSHFIELD; else /* pushing fields by reference is not allowed */ GenError( _szCErrors, 'E', ERR_INVALID_REFER, szVarName, NULL ); @@ -4185,18 +4185,18 @@ void VariablePCode( BYTE bPCode, char * szVarName ) pSym = GetSymbol( szVarName, &wVar ); if( ! pSym ) - pSym =AddSymbol( szVarName, &wVar ); - pSym->cScope |=VS_MEMVAR; + pSym = AddSymbol( szVarName, &wVar ); + pSym->cScope |= VS_MEMVAR; GenPCode3( bPCode, LOBYTE( wVar ), HIBYTE( wVar ) ); } void Message( char * szMsgName ) /* sends a message to an object */ { WORD wSym; - PCOMSYMBOL pSym =GetSymbol( szMsgName, &wSym ); + PCOMSYMBOL pSym = GetSymbol( szMsgName, &wSym ); if( ! pSym ) /* the symbol was not found on the symbol table */ - pSym =AddSymbol( szMsgName, &wSym ); + pSym = AddSymbol( szMsgName, &wSym ); pSym->cScope |= FS_MESSAGE; GenPCode3( HB_P_MESSAGE, LOBYTE( wSym ), HIBYTE( wSym ) ); @@ -4224,9 +4224,9 @@ void MessageDupl( char * szMsgName ) /* fix a generated message and duplicate t BYTE bLoGetSym, bHiGetSym; /* get symbol */ PFUNCTION pFunc = functions.pLast; /* get the currently defined Clipper function */ - pSym =GetSymbol( szMsgName, &wSetSym ); + pSym = GetSymbol( szMsgName, &wSetSym ); if( ! pSym ) /* the symbol was not found on the symbol table */ - pSym =AddSymbol( szMsgName, &wSetSym ); + pSym = AddSymbol( szMsgName, &wSetSym ); pSym->cScope |= FS_MESSAGE; /* Get previously generated message */ bLoGetSym = pFunc->pCode[ _ulMessageFix + 1]; @@ -4247,9 +4247,9 @@ void MessageFix( char * szMsgName ) /* fix a generated message to an object */ PCOMSYMBOL pSym; PFUNCTION pFunc = functions.pLast; /* get the currently defined Clipper function */ - pSym =GetSymbol( szMsgName, &wSym ); + pSym = GetSymbol( szMsgName, &wSym ); if( ! pSym ) /* the symbol was not found on the symbol table */ - pSym =AddSymbol( szMsgName, &wSym ); + pSym = AddSymbol( szMsgName, &wSym ); pSym->cScope |= FS_MESSAGE; pFunc->pCode[ _ulMessageFix + 1 ] = LOBYTE( wSym ); @@ -4284,7 +4284,7 @@ void PopId( char * szVarName ) /* generates the pcode to pop a value from the vi { if( pAliasId->type == ALIAS_NAME ) { - if( pAliasId->alias.szAlias[0] == 'M' && pAliasId->alias.szAlias[1] == '\x0' ) + if( pAliasId->alias.szAlias[ 0 ] == 'M' && pAliasId->alias.szAlias[ 1 ] == '\0' ) { /* M->variable */ VariablePCode( HB_P_POPMEMVAR, szVarName ); } @@ -4328,15 +4328,15 @@ void PopId( char * szVarName ) /* generates the pcode to pop a value from the vi if( _bWarnings ) { PSTACK_VAL_TYPE pVarType, pFree; - char sType[2]; + char sType[ 2 ]; /* Just pushed by Get...Pos() */ pVarType = pStackValType; if( pVarType ) { - sType[0] = pVarType->cType; - sType[1] = '\0'; + sType[ 0 ] = pVarType->cType; + sType[ 1 ] = '\0'; /* skip back to the assigned value */ pStackValType = pStackValType->pPrev; @@ -4412,7 +4412,7 @@ void PushId( char * szVarName ) /* generates the pcode to push a variable value { if( pAliasId->type == ALIAS_NAME ) { - if( pAliasId->alias.szAlias[0] == 'M' && pAliasId->alias.szAlias[1] == '\x0' ) + if( pAliasId->alias.szAlias[ 0 ] == 'M' && pAliasId->alias.szAlias[ 1 ] == '\0' ) { /* M->variable */ VariablePCode( HB_P_PUSHMEMVAR, szVarName ); } @@ -4420,7 +4420,7 @@ void PushId( char * szVarName ) /* generates the pcode to push a variable value { int iCmp = strncmp( pAliasId->alias.szAlias, "MEMVAR", 4 ); if( iCmp == 0 ) - iCmp = strncmp( pAliasId->alias.szAlias, "MEMVAR", strlen(pAliasId->alias.szAlias) ); + iCmp = strncmp( pAliasId->alias.szAlias, "MEMVAR", strlen( pAliasId->alias.szAlias ) ); if( iCmp == 0 ) { /* MEMVAR-> or MEMVA-> or MEMV-> */ VariablePCode( HB_P_PUSHMEMVAR, szVarName ); @@ -4429,7 +4429,7 @@ void PushId( char * szVarName ) /* generates the pcode to push a variable value { /* field variable */ iCmp = strncmp( pAliasId->alias.szAlias, "FIELD", 4 ); if( iCmp == 0 ) - iCmp = strncmp( pAliasId->alias.szAlias, "FIELD", strlen(pAliasId->alias.szAlias) ); + iCmp = strncmp( pAliasId->alias.szAlias, "FIELD", strlen( pAliasId->alias.szAlias ) ); if( iCmp == 0 ) { /* FIELD-> */ FieldPCode( HB_P_PUSHFIELD, szVarName ); @@ -4456,7 +4456,7 @@ void PushId( char * szVarName ) /* generates the pcode to push a variable value { PSTACK_VAL_TYPE pNewStackType; - pNewStackType = ( STACK_VAL_TYPE * )hb_xgrab( sizeof( STACK_VAL_TYPE ) ); + pNewStackType = ( STACK_VAL_TYPE * ) hb_xgrab( sizeof( STACK_VAL_TYPE ) ); pNewStackType->cType = cVarType; pNewStackType->pPrev = pStackValType; @@ -4658,7 +4658,7 @@ void PushSymbol( char * szSymbolName, int iIsFunction ) pSym = GetSymbol( szSymbolName, &wSym ); if( ! pSym ) /* the symbol was not found on the symbol table */ { - pSym =AddSymbol( szSymbolName, &wSym ); + pSym = AddSymbol( szSymbolName, &wSym ); if( iIsFunction ) AddFunCall( szSymbolName ); } @@ -4843,7 +4843,7 @@ void FixReturns( void ) /* fixes all last defined function returns jumps offsets char cLine[ 64 ]; while( pLoop->pNext ) - pLoop =pLoop->pNext; + pLoop = pLoop->pNext; itoa( pLoop->iLine, cLine, 10 ); GenError( _szCErrors, 'E', ERR_UNCLOSED_STRU, cLine, NULL ); @@ -5009,7 +5009,7 @@ void GenPCode1( BYTE byte ) else if( byte == HB_P_MULT || byte == HB_P_DIVIDE || byte == HB_P_MODULUS || byte == HB_P_POWER || byte == HB_P_NEGATE ) { PSTACK_VAL_TYPE pOperand1 = NULL, pOperand2; - char sType1[2], sType2[2]; + char sType1[ 2 ], sType2[ 2 ]; /* 2nd. Operand (stack top)*/ pOperand2 = pStackValType; @@ -5018,8 +5018,8 @@ void GenPCode1( BYTE byte ) if( pOperand2 ) { pOperand1 = pOperand2->pPrev; - sType2[0] = pOperand1->cType; - sType2[1] = '\0'; + sType2[ 0 ] = pOperand1->cType; + sType2[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_MULT pCode: %i Compile time stack overflow\n", byte ); @@ -5027,8 +5027,8 @@ void GenPCode1( BYTE byte ) /* skip back to the 1st. operand */ if( pOperand1 ) { - sType1[0] = pOperand1->cType; - sType1[1] = '\0'; + sType1[ 0 ] = pOperand1->cType; + sType1[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_MULT2 pCode: %i Compile time stack overflow\n", byte ); @@ -5056,7 +5056,7 @@ void GenPCode1( BYTE byte ) else if( byte == HB_P_PLUS || byte == HB_P_MINUS ) { PSTACK_VAL_TYPE pOperand1 = NULL, pOperand2; - char sType1[2], sType2[2], cType = ' '; + char sType1[ 2 ], sType2[ 2 ], cType = ' '; /* 2nd. Operand (stack top)*/ pOperand2 = pStackValType; @@ -5065,16 +5065,16 @@ void GenPCode1( BYTE byte ) if( pOperand2 ) { pOperand1 = pOperand2->pPrev; - sType2[0] = pOperand2->cType; - sType2[1] = '\0'; + sType2[ 0 ] = pOperand2->cType; + sType2[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_PLUS / HB_P_MINUS Compile time stack overflow\n", NULL ); if( pOperand1 ) { - sType1[0] = pOperand1->cType; - sType1[1] = '\0'; + sType1[ 0 ] = pOperand1->cType; + sType1[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_PLUS / HB_P_MINUS2 Compile time stack overflow\n", NULL ); @@ -5102,7 +5102,7 @@ void GenPCode1( BYTE byte ) else if( byte == HB_P_EQUAL || byte == HB_P_LESS || byte == HB_P_GREATER || byte == HB_P_INSTRING || byte == HB_P_LESSEQUAL || byte == HB_P_GREATEREQUAL || byte == HB_P_EXACTLYEQUAL || byte == HB_P_NOTEQUAL ) { PSTACK_VAL_TYPE pOperand1 = NULL, pOperand2; - char sType1[2], sType2[2]; + char sType1[ 2 ], sType2[ 2 ]; /* 2nd. Operand (stack top)*/ pOperand2 = pStackValType; @@ -5111,16 +5111,16 @@ void GenPCode1( BYTE byte ) if( pOperand2 ) { pOperand1 = pOperand2->pPrev; - sType2[0] = pOperand2->cType; - sType2[1] = '\0'; + sType2[ 0 ] = pOperand2->cType; + sType2[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_EQUAL pCode: %i Compile time stack overflow\n", byte ); if( pOperand1 ) { - sType1[0] = pOperand1->cType; - sType1[1] = '\0'; + sType1[ 0 ] = pOperand1->cType; + sType1[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_EQUAL2 pCode: %i Compile time stack overflow\n", byte ); @@ -5147,12 +5147,12 @@ void GenPCode1( BYTE byte ) } else if( byte == HB_P_NOT ) { - char sType[2]; + char sType[ 2 ]; if( pStackValType ) { - sType[0] = pStackValType->cType; - sType[1] = '\0'; + sType[ 0 ] = pStackValType->cType; + sType[ 1 ] = '\0'; } else debug_msg( "\n***HB_P_NOT Compile time stack overflow\n", NULL ); @@ -5217,8 +5217,8 @@ void GenPCodeN( BYTE * pBuffer, ULONG ulSize ) pFunc->pCode = ( BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize ); } - memcpy( pFunc->pCode+pFunc->lPCodePos, pBuffer, ulSize ); - pFunc->lPCodePos +=ulSize; + memcpy( pFunc->pCode + pFunc->lPCodePos, pBuffer, ulSize ); + pFunc->lPCodePos += ulSize; } char * SetData( char * szMsg ) /* generates an underscore-symbol name for a data assignment */ @@ -5423,25 +5423,25 @@ int FieldsCount() */ void StaticDefStart( void ) { - iVarScope =VS_STATIC; + iVarScope = VS_STATIC; Line(); functions.pLast->bFlags |= FUN_USES_STATICS; if( ! _pInitFunc ) { - _pInitFunc =FunctionNew( yy_strdup("(_INITSTATICS)"), FS_INIT ); - _pInitFunc->pOwner =functions.pLast; - _pInitFunc->bFlags =FUN_USES_STATICS | FUN_PROCEDURE; - _pInitFunc->cScope =FS_INIT | FS_EXIT; - functions.pLast =_pInitFunc; + _pInitFunc = FunctionNew( yy_strdup("(_INITSTATICS)"), FS_INIT ); + _pInitFunc->pOwner = functions.pLast; + _pInitFunc->bFlags = FUN_USES_STATICS | FUN_PROCEDURE; + _pInitFunc->cScope = FS_INIT | FS_EXIT; + functions.pLast = _pInitFunc; PushInteger( 1 ); /* the number of static variables is unknown now */ GenPCode3( HB_P_STATICS, 0, 0 ); GenPCode3( HB_P_SFRAME, 0, 0 ); /* frame for statics variables */ } else { - _pInitFunc->pOwner =functions.pLast; - functions.pLast =_pInitFunc; + _pInitFunc->pOwner = functions.pLast; + functions.pLast = _pInitFunc; } } @@ -5451,10 +5451,10 @@ void StaticDefStart( void ) */ void StaticDefEnd( int iCount ) { - functions.pLast =_pInitFunc->pOwner; - _pInitFunc->pOwner =NULL; + functions.pLast = _pInitFunc->pOwner; + _pInitFunc->pOwner = NULL; _iStatics += iCount; - iVarScope =VS_LOCAL; + iVarScope = VS_LOCAL; if( _bWarnings ) { @@ -5496,11 +5496,11 @@ static void LoopStart( void ) if( pLoops ) { - PTR_LOOPEXIT pLast =pLoops; + PTR_LOOPEXIT pLast = pLoops; while( pLast->pNext ) - pLast =pLast->pNext; - pLast->pNext =pLoop; + pLast = pLast->pNext; + pLast->pNext = pLoop; } else pLoops = pLoop; @@ -5529,17 +5529,17 @@ static void LoopLoop( void ) pLoop = (PTR_LOOPEXIT) hb_xgrab( sizeof( LOOPEXIT ) ); - pLoop->pLoopList =NULL; - pLoop->ulOffset =functions.pLast->lPCodePos; /* store the position to fix */ + pLoop->pLoopList = NULL; + pLoop->ulOffset = functions.pLast->lPCodePos; /* store the position to fix */ - pLast =pLoops; + pLast = pLoops; while( pLast->pNext ) - pLast =pLast->pNext; + pLast = pLast->pNext; while( pLast->pLoopList ) - pLast =pLast->pLoopList; + pLast = pLast->pLoopList; - pLast->pLoopList =pLoop; + pLast->pLoopList = pLoop; Jump( 0 ); } @@ -5561,17 +5561,17 @@ static void LoopExit( void ) pLoop = (PTR_LOOPEXIT) hb_xgrab( sizeof( LOOPEXIT ) ); - pLoop->pExitList =NULL; - pLoop->ulOffset =functions.pLast->lPCodePos; /* store the position to fix */ + pLoop->pExitList = NULL; + pLoop->ulOffset = functions.pLast->lPCodePos; /* store the position to fix */ - pLast =pLoops; + pLast = pLoops; while( pLast->pNext ) - pLast =pLast->pNext; + pLast = pLast->pNext; while( pLast->pExitList ) - pLast =pLast->pExitList; + pLast = pLast->pExitList; - pLast->pExitList =pLoop; + pLast->pExitList = pLoop; Jump( 0 ); } @@ -5589,7 +5589,7 @@ static void LoopHere( void ) pLoop = pLoop->pLoopList; while( pLoop ) { - JumpHere( pLoop->ulOffset +1 ); + JumpHere( pLoop->ulOffset + 1 ); pFree = pLoop; pLoop = pLoop->pLoopList; hb_xfree( ( void * ) pFree ); @@ -5609,10 +5609,10 @@ static void LoopEnd( void ) pLoop = pLoop->pNext; } - pExit =pLoop->pExitList; + pExit = pLoop->pExitList; while( pExit ) { - JumpHere( pExit->ulOffset +1 ); + JumpHere( pExit->ulOffset + 1 ); pFree = pExit; pExit = pExit->pExitList; hb_xfree( ( void * ) pFree ); @@ -5820,7 +5820,7 @@ char * yy_strdup( char * p ) char * pDup; int iLen; - iLen = strlen( p ) +1; + iLen = strlen( p ) + 1; pDup = ( char * ) hb_xgrab( iLen ); memcpy( pDup, p, iLen ); @@ -5934,7 +5934,7 @@ void GenPortObj( char * szFileName, char * szName ) * was not used in a function/procedure - this is why we have to reserve * one additional byte */ - ulCodeLength =pFunc->lPCodePos +1; + ulCodeLength = pFunc->lPCodePos + 1; fputc( ( BYTE ) ( ( ulCodeLength ) & 255 ), yyc ); /* Write size */ fputc( ( BYTE ) ( ( ulCodeLength >> 8 ) & 255 ), yyc ); fputc( ( BYTE ) ( ( ulCodeLength >> 16 ) & 255 ), yyc ); @@ -5987,8 +5987,8 @@ void GenPortObj( char * szFileName, char * szName ) case HB_P_SEQRECOVER: case HB_P_TRUE: case HB_P_ZERO: - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - break; + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + break; case HB_P_DIMARRAY: case HB_P_DO: @@ -6007,43 +6007,43 @@ void GenPortObj( char * szFileName, char * szName ) case HB_P_PUSHSTATICREF: case HB_P_SEQBEGIN: case HB_P_SEQEND: - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - break; + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + break; case HB_P_ENDPROC: - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - if( lPCodePos == pFunc->lPCodePos ) - bEndProcReq = FALSE; - break; + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + if( lPCodePos == pFunc->lPCodePos ) + bEndProcReq = FALSE; + break; case HB_P_FRAME: - /* update the number of local variables */ - { - PVAR pLocal = pFunc->pLocals; - BYTE bLocals = 0; + /* update the number of local variables */ + { + PVAR pLocal = pFunc->pLocals; + BYTE bLocals = 0; - while( pLocal ) - { - pLocal = pLocal->pNext; - bLocals++; - } + while( pLocal ) + { + pLocal = pLocal->pNext; + bLocals++; + } - if( bLocals || pFunc->wParamCount ) - { - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( ( BYTE )(bLocals - pFunc->wParamCount), yyc ); - fputc( ( BYTE )(pFunc->wParamCount), yyc ); - lPCodePos += 2; - } - else - { - lPad += 3; - lPCodePos += 3; - } - } - break; + if( bLocals || pFunc->wParamCount ) + { + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( ( BYTE )(bLocals - pFunc->wParamCount), yyc ); + fputc( ( BYTE )(pFunc->wParamCount), yyc ); + lPCodePos += 2; + } + else + { + lPad += 3; + lPCodePos += 3; + } + } + break; case HB_P_PUSHSYM: case HB_P_MESSAGE: @@ -6054,99 +6054,97 @@ void GenPortObj( char * szFileName, char * szName ) case HB_P_PUSHFIELD: case HB_P_POPALIASEDFIELD: case HB_P_PUSHALIASEDFIELD: - fputc( pFunc->pCode[ lPCodePos ], yyc ); - wVar =FixSymbolPos( pFunc->pCode[ lPCodePos+1 ] + 256 * pFunc->pCode[ lPCodePos+2 ] ); - fputc( LOBYTE( wVar ), yyc ); - fputc( HIBYTE( wVar ), yyc ); - lPCodePos +=3; - break; + fputc( pFunc->pCode[ lPCodePos ], yyc ); + wVar = FixSymbolPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] ); + fputc( LOBYTE( wVar ), yyc ); + fputc( HIBYTE( wVar ), yyc ); + lPCodePos += 3; + break; case HB_P_PARAMETER: - fputc( pFunc->pCode[ lPCodePos ], yyc ); - wVar = FixSymbolPos( pFunc->pCode[ lPCodePos+1 ] + 256 * pFunc->pCode[ lPCodePos+2 ] ); - fputc( LOBYTE( wVar ), yyc ); - fputc( HIBYTE( wVar ), yyc ); - fputc( pFunc->pCode[ lPCodePos+3 ], yyc ); - lPCodePos +=4; - break; + fputc( pFunc->pCode[ lPCodePos ], yyc ); + wVar = FixSymbolPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] ); + fputc( LOBYTE( wVar ), yyc ); + fputc( HIBYTE( wVar ), yyc ); + fputc( pFunc->pCode[ lPCodePos + 3 ], yyc ); + lPCodePos +=4; + break; case HB_P_PUSHBLOCK: - wVar = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos + 5 ] ) ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - /* create the table of referenced local variables */ - while( wVar-- ) - { - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - } - break; + wVar = * ( ( WORD * ) &( pFunc->pCode [ lPCodePos + 5 ] ) ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + /* create the table of referenced local variables */ + while( wVar-- ) + { + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + } + break; case HB_P_PUSHDOUBLE: - { - int i; - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - for( i = 0; i < sizeof( double ); ++i ) - fputc( ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ], yyc ); - fputc( pFunc->pCode[ lPCodePos + sizeof( double ) ], yyc ); - lPCodePos += sizeof( double ) + 1; - } - break; + { + int i; + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + for( i = 0; i < sizeof( double ); ++i ) + fputc( ( ( BYTE * ) pFunc->pCode )[ lPCodePos + i ], yyc ); + fputc( pFunc->pCode[ lPCodePos + sizeof( double ) ], yyc ); + lPCodePos += sizeof( double ) + 1; + } + break; case HB_P_PUSHLONG: - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - fputc( pFunc->pCode[ lPCodePos++ ], yyc ); - break; + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + break; case HB_P_PUSHSTR: - wLen = pFunc->pCode[ lPCodePos + 1 ] + - pFunc->pCode[ lPCodePos + 2 ] * 256; - fputc( pFunc->pCode[ lPCodePos ], yyc ); - fputc( pFunc->pCode[ lPCodePos + 1 ], yyc ); - fputc( pFunc->pCode[ lPCodePos + 2 ], yyc ); - lPCodePos +=3; - while( wLen-- ) - { - fputc( pFunc->pCode[ lPCodePos ++ ], yyc ); - } - break; + wLen = pFunc->pCode[ lPCodePos + 1 ] + + pFunc->pCode[ lPCodePos + 2 ] * 256; + fputc( pFunc->pCode[ lPCodePos ], yyc ); + fputc( pFunc->pCode[ lPCodePos + 1 ], yyc ); + fputc( pFunc->pCode[ lPCodePos + 2 ], yyc ); + lPCodePos += 3; + while( wLen-- ) + fputc( pFunc->pCode[ lPCodePos++ ], yyc ); + break; case HB_P_SFRAME: - /* we only generate it if there are statics used in this function */ - if( pFunc->bFlags & FUN_USES_STATICS ) - { - GetSymbol( _pInitFunc->szName, &w ); - w = FixSymbolPos( w ); - fputc( pFunc->pCode[ lPCodePos ], yyc ); - fputc( LOBYTE( w ), yyc ); - fputc( HIBYTE( w ), yyc ); - } - else - lPad += 3; - lPCodePos += 3; - break; + /* we only generate it if there are statics used in this function */ + if( pFunc->bFlags & FUN_USES_STATICS ) + { + GetSymbol( _pInitFunc->szName, &w ); + w = FixSymbolPos( w ); + fputc( pFunc->pCode[ lPCodePos ], yyc ); + fputc( LOBYTE( w ), yyc ); + fputc( HIBYTE( w ), yyc ); + } + else + lPad += 3; + lPCodePos += 3; + break; case HB_P_STATICS: - GetSymbol( _pInitFunc->szName, &w ); - w = FixSymbolPos( w ); - fputc( pFunc->pCode[ lPCodePos ], yyc ); - fputc( LOBYTE( w ), yyc ); - fputc( HIBYTE( w ), yyc ); - lPCodePos += 3; - break; + GetSymbol( _pInitFunc->szName, &w ); + w = FixSymbolPos( w ); + fputc( pFunc->pCode[ lPCodePos ], yyc ); + fputc( LOBYTE( w ), yyc ); + fputc( HIBYTE( w ), yyc ); + lPCodePos += 3; + break; default: - printf( "Incorrect pcode value: %u\n", pFunc->pCode[ lPCodePos ] ); - lPCodePos = pFunc->lPCodePos; - break; + printf( "Incorrect pcode value: %u\n", pFunc->pCode[ lPCodePos ] ); + lPCodePos = pFunc->lPCodePos; + break; } } @@ -6183,74 +6181,75 @@ typedef struct int iMaxParam; /* max no of parms need */ } FUNCINFO, * PFUNCINFO; -static FUNCINFO _StdFun[] = { -{ "AADD" , 2, 2 }, -{ "ABS" , 1, 1 }, -{ "ASC" , 1, 1 }, -{ "AT" , 2, 2 }, -{ "BOF" , 0, 0 }, -{ "BREAK" , 0, 1 }, -{ "CDOW" , 1, 1 }, -{ "CHR" , 1, 1 }, -{ "CMONTH" , 1, 1 }, -{ "COL" , 0, 0 }, -{ "CTOD" , 1, 1 }, -{ "DATE" , 0, 0 }, -{ "DAY" , 1, 1 }, -{ "DELETED" , 0, 0 }, -{ "DEVPOS" , 2, 2 }, -{ "DOW" , 1, 1 }, -{ "DTOC" , 1, 1 }, -{ "DTOS" , 1, 1 }, -{ "EMPTY" , 1, 1 }, -{ "EOF" , 0, 0 }, -{ "EVAL" , 1, -1 }, -{ "EXP" , 1, 1 }, -{ "FCOUNT" , 0, 0 }, -{ "FIELDNAME" , 1, 1 }, -{ "FILE" , 1, 1 }, -{ "FLOCK" , 0, 0 }, -{ "FOUND" , 0, 0 }, -{ "INKEY" , 0, 2 }, -{ "INT" , 1, 1 }, -{ "LASTREC" , 0, 0 }, -{ "LEFT" , 2, 2 }, -{ "LEN" , 1, 1 }, -{ "LOCK" , 0, 0 }, -{ "LOG" , 1, 1 }, -{ "LOWER" , 1, 1 }, -{ "LTRIM" , 1, 1 }, -{ "MAX" , 2, 2 }, -{ "MIN" , 2, 2 }, -{ "MONTH" , 1, 1 }, -{ "PCOL" , 0, 0 }, -{ "PCOUNT" , 0, 0 }, -{ "PROW" , 0, 0 }, -{ "RECCOUNT" , 0, 0 }, -{ "RECNO" , 0, 0 }, -{ "REPLICATE" , 2, 2 }, -{ "RLOCK" , 0, 0 }, -{ "ROUND" , 2, 2 }, -{ "ROW" , 0, 0 }, -{ "RTRIM" , 1, 2 }, /* Second parameter is a Harbour extension */ -{ "SECONDS" , 0, 0 }, -{ "SELECT" , 0, 1 }, -{ "SETPOS" , 2, 2 }, -{ "SETPOSBS" , 0, 0 }, -{ "SPACE" , 1, 1 }, -{ "SQRT" , 1, 1 }, -{ "STR" , 1, 3 }, -{ "SUBSTR" , 2, 3 }, -{ "TIME" , 0, 0 }, -{ "TRANSFORM" , 2, 2 }, -{ "TRIM" , 1, 2 }, /* Second parameter is a Harbour extension */ -{ "TYPE" , 1, 1 }, -{ "UPPER" , 1, 1 }, -{ "VAL" , 1, 1 }, -{ "VALTYPE" , 1, 1 }, -{ "WORD" , 1, 1 }, -{ "YEAR" , 1, 1 }, -{ 0 , 0, 0 } +static FUNCINFO _StdFun[] = +{ + { "AADD" , 2, 2 }, + { "ABS" , 1, 1 }, + { "ASC" , 1, 1 }, + { "AT" , 2, 2 }, + { "BOF" , 0, 0 }, + { "BREAK" , 0, 1 }, + { "CDOW" , 1, 1 }, + { "CHR" , 1, 1 }, + { "CMONTH" , 1, 1 }, + { "COL" , 0, 0 }, + { "CTOD" , 1, 1 }, + { "DATE" , 0, 0 }, + { "DAY" , 1, 1 }, + { "DELETED" , 0, 0 }, + { "DEVPOS" , 2, 2 }, + { "DOW" , 1, 1 }, + { "DTOC" , 1, 1 }, + { "DTOS" , 1, 1 }, + { "EMPTY" , 1, 1 }, + { "EOF" , 0, 0 }, + { "EVAL" , 1, -1 }, + { "EXP" , 1, 1 }, + { "FCOUNT" , 0, 0 }, + { "FIELDNAME" , 1, 1 }, + { "FILE" , 1, 1 }, + { "FLOCK" , 0, 0 }, + { "FOUND" , 0, 0 }, + { "INKEY" , 0, 2 }, + { "INT" , 1, 1 }, + { "LASTREC" , 0, 0 }, + { "LEFT" , 2, 2 }, + { "LEN" , 1, 1 }, + { "LOCK" , 0, 0 }, + { "LOG" , 1, 1 }, + { "LOWER" , 1, 1 }, + { "LTRIM" , 1, 1 }, + { "MAX" , 2, 2 }, + { "MIN" , 2, 2 }, + { "MONTH" , 1, 1 }, + { "PCOL" , 0, 0 }, + { "PCOUNT" , 0, 0 }, + { "PROW" , 0, 0 }, + { "RECCOUNT" , 0, 0 }, + { "RECNO" , 0, 0 }, + { "REPLICATE" , 2, 2 }, + { "RLOCK" , 0, 0 }, + { "ROUND" , 2, 2 }, + { "ROW" , 0, 0 }, + { "RTRIM" , 1, 2 }, /* Second parameter is a Harbour extension */ + { "SECONDS" , 0, 0 }, + { "SELECT" , 0, 1 }, + { "SETPOS" , 2, 2 }, + { "SETPOSBS" , 0, 0 }, + { "SPACE" , 1, 1 }, + { "SQRT" , 1, 1 }, + { "STR" , 1, 3 }, + { "SUBSTR" , 2, 3 }, + { "TIME" , 0, 0 }, + { "TRANSFORM" , 2, 2 }, + { "TRIM" , 1, 2 }, /* Second parameter is a Harbour extension */ + { "TYPE" , 1, 1 }, + { "UPPER" , 1, 1 }, + { "VAL" , 1, 1 }, + { "VALTYPE" , 1, 1 }, + { "WORD" , 1, 1 }, + { "YEAR" , 1, 1 }, + { 0 , 0, 0 } }; void CheckArgs( char * szFuncCall, int iArgs ) diff --git a/harbour/source/rtl/dir.c b/harbour/source/rtl/dir.c index a23e02a106..60dfde29aa 100644 --- a/harbour/source/rtl/dir.c +++ b/harbour/source/rtl/dir.c @@ -265,11 +265,11 @@ HARBOUR HB_DIRECTORY( void ) #if defined(__WATCOMC__) /* opendir in Watcom doesn't like the path delimiter at the end of a string */ dirname[ iDirnameLen ] = '.'; - dirname[ iDirnameLen+1 ] = '\x0'; + dirname[ iDirnameLen+1 ] = '\0'; #endif dir = opendir( dirname ); #if defined(__WATCOMC__) - dirname[ iDirnameLen ] = '\x0'; + dirname[ iDirnameLen ] = '\0'; #endif if( NULL == dir ) { diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index c5e6c119ac..e247be4f63 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -64,6 +64,7 @@ * changed to allow unlimited color pairs. */ +#include #include "set.h" #include "gtapi.h" @@ -332,7 +333,7 @@ int hb_gtGetColorStr( char * fpColorString ) do { - if( ( s_Color[ i ] & ( j ? 0x8000 : 0x800 ) ) != 0 ) + if( ( s_Color[ i ] & ( j ? 0x8000 : 0x0800 ) ) != 0 ) sColors[ k++ ] = 'U'; else { @@ -407,8 +408,7 @@ int hb_gtSetColorStr( char * fpColorString ) do { c = *fpColorString++; - if( c > 'A' ) - c &= 0x5f; /* convert to upper case */ + c = toupper( c ); while( c <= '9' && c >= '0' && i < 6 ) { @@ -429,7 +429,7 @@ int hb_gtSetColorStr( char * fpColorString ) if( buff[ i ] != '\0') nColor += ( ( buff[ i ] - '0' ) * y ); } - nColor &= 0xf; + nColor &= 0x0F; i = 0; ++nCount; } @@ -471,7 +471,7 @@ int hb_gtSetColorStr( char * fpColorString ) if( bHasU ) { bHasU = FALSE; - nFore |= 0x800; /* foreground underline bit */ + nFore |= 0x0800; /* foreground underline bit */ } else if( bHasX ) { @@ -502,24 +502,24 @@ int hb_gtSetColorStr( char * fpColorString ) nFore &= 0x88F8; if( bHasU ) /* background if slash, else foreground */ - nColor |= 0x800; + nColor |= 0x0800; if( bHasI ) { if( bSlash ) { - nColor &= 0x88F; - nColor |= 0x007; + nColor &= 0x088F; + nColor |= 0x0007; nFore &= 0x88F8; } else { - nColor &= 0x8F8; - nColor |= 0x070; + nColor &= 0x08F8; + nColor |= 0x0070; nFore &= 0x888F; } } - if( ( nFore & 0x8800 ) != 0 && ( ( nFore | nColor ) & 0x77 ) == 0) + if( ( nFore & 0x8800 ) != 0 && ( ( nFore | nColor ) & 0x0077 ) == 0) nFore |= 1; if( bSlash ) @@ -699,8 +699,8 @@ int hb_gtWrite( char * fpStr, ULONG length ) { int iRow, iCol, iMaxCol, iMaxRow; ULONG size = length; - char attr = s_Color[ s_uiColorIndex ] & 0xff, - *fpPointer = fpStr; + char attr = s_Color[ s_uiColorIndex ] & 0xFF; + char *fpPointer = fpStr; /* TODO: this is doing more work than needed */ diff --git a/harbour/source/rtl/itemapi.c b/harbour/source/rtl/itemapi.c index 973a2b7541..8ceee3e979 100644 --- a/harbour/source/rtl/itemapi.c +++ b/harbour/source/rtl/itemapi.c @@ -819,7 +819,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) { /* Difference found */ if( *szFirst != *szSecond ) - iRet = ( *szFirst < *szSecond ) ? -1 : 1; + iRet = ( ( BYTE ) *szFirst < ( BYTE ) *szSecond ) ? -1 : 1; else /* TODO : #define some constants */ { szFirst++; diff --git a/harbour/source/rtl/memvars.c b/harbour/source/rtl/memvars.c index ddb8a9bd75..7b18b74bd1 100644 --- a/harbour/source/rtl/memvars.c +++ b/harbour/source/rtl/memvars.c @@ -735,7 +735,7 @@ static HB_DYNS_PTR hb_memvarFindSymbol( HB_ITEM_PTR pName ) char * szName = ( char * ) hb_xgrab( ulLen + 1 ); char * szArg = pName->item.asString.value; - szName[ ulLen ] = '\x0'; + szName[ ulLen ] = '\0'; do { --ulLen; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 296fd668b2..60a59f33c7 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -899,7 +899,7 @@ void hb_vmDec( void ) /* This function creates an array item using 'wDimension' as an index * to retrieve the number of elements from the stack - */ + */ static void hb_vmArrayNew( HB_ITEM_PTR pArray, WORD wDimension ) { ULONG ulElements; @@ -921,7 +921,7 @@ static void hb_vmArrayNew( HB_ITEM_PTR pArray, WORD wDimension ) break; default: - /* NOTE: Clipper creates empty array if non-numeric value is + /* NOTE: Clipper creates empty array if non-numeric value is * specified as dimension and stops further processing. * There is no runtime error generated. */ @@ -934,7 +934,7 @@ static void hb_vmArrayNew( HB_ITEM_PTR pArray, WORD wDimension ) if( --wDimension ) { - /* call self recursively to create next dimensions + /* call self recursively to create next dimensions */ while( ulElements ) hb_vmArrayNew( hb_arrayGetItemPointer( pArray, ulElements-- ), wDimension ); @@ -2700,7 +2700,7 @@ static void hb_vmSwapAlias( void ) case IT_SYMBOL: /* Alias was specified using alias identifier, for example: al->field */ - hb_rddSelectWorkAreaSymbol( pItem->item.asSymbol.value ); + hb_rddSelectWorkAreaSymbol( pWorkArea->item.asSymbol.value ); break; case IT_STRING: diff --git a/harbour/tests/working/rtl_test.prg b/harbour/tests/working/rtl_test.prg index c0d3d03b1f..3a42cf35c9 100644 --- a/harbour/tests/working/rtl_test.prg +++ b/harbour/tests/working/rtl_test.prg @@ -578,9 +578,14 @@ STATIC FUNCTION Main_HVM() TEST_CALL( '(.T.)->(Eof())' , {|| (.T.)->(Eof()) } , .T. ) TEST_CALL( '(.F.)->(Eof())' , {|| (.F.)->(Eof()) } , .T. ) TEST_CALL( '(NIL)->(Eof())' , {|| (NIL)->(Eof()) } , .T. ) -#ifndef __HARBOUR__ TEST_LINE( NOTHERE->NOFIELD , "E BASE 1002 Alias does not exist NOTHERE F:R" ) -#endif + TEST_LINE( NOTHERE->("NOFIELD") , "E BASE 1002 Alias does not exist NOTHERE F:R" ) + TEST_LINE( NOTHERE->(NIL) , "E BASE 1002 Alias does not exist NOTHERE F:R" ) + TEST_LINE( NOTHERE->(1) , "E BASE 1002 Alias does not exist NOTHERE F:R" ) + TEST_LINE( NOTHERE->(1.5) , "E BASE 1002 Alias does not exist NOTHERE F:R" ) + TEST_LINE( NOTHERE->({}) , "E BASE 1002 Alias does not exist NOTHERE F:R" ) + TEST_LINE( NOTHERE->({|| NIL }) , "E BASE 1002 Alias does not exist NOTHERE F:R" ) + TEST_LINE( NOTHERE->(.T.) , "E BASE 1002 Alias does not exist NOTHERE F:R" ) TEST_LINE( 200->NOFIELD , "E BASE 1003 Variable does not exist NOFIELD F:R" ) TEST_LINE( 200->("NOFIELD") , "NOFIELD" ) TEST_LINE( 200->(NIL) , NIL ) @@ -2138,6 +2143,7 @@ STATIC FUNCTION XToStr( xValue ) STATIC FUNCTION ErrorMessage( oError ) LOCAL cMessage := "" + LOCAL tmp IF ValType( oError:severity ) == "N" DO CASE @@ -2163,6 +2169,20 @@ STATIC FUNCTION ErrorMessage( oError ) cMessage += oError:filename + " " ENDIF +#ifdef _COMMENT_ + IF ValType( oError:Args ) == "A" + cMessage += "A:" + FOR tmp := 1 TO Len( oError:Args ) + cMessage += ValType( oError:Args[ tmp ] ) +// cMessage += XToStr( oError:Args[ tmp ] ) +// IF tmp < Len( oError:Args ) +// cMessage += ";" +// ENDIF + NEXT + cMessage += " " + ENDIF +#endif + IF oError:canDefault .OR. ; oError:canRetry .OR. ; oError:canSubstitute