2001-07-22 14:30 UTC-0800 Ron Pinkas <ron@profit-master.com>
* include/hbapi.h
* Changed 2nd parameter to BYTE iContext in hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext )
* include/hbexprop.h
+ Added #define HB_ET_MACRO_LIST 16 /* &variable used as in literal arrays or parentesised expressions. */
+ Added #define HB_ET_MACRO_INDEX 32 /* &variable used as arrays index. */
* include/hbexprb.c
+ Added macro list support logic to hb_compExprUseArray()
+ Added generation of HB_P_MACROLIST, HB_P_MACROPUSHLIST, HB_P_MACROLISTEND, and HB_P_MACROPUSHINDEX in hb_compExprUseMacro()
/* HB_P_MACROLIST and HB_P_MACROLISTEND are only generated as an enevelope if array contains a one or more macro element
which will generate an HB_P_MACROPUSHLIST. */
* include/hbpcode.h
* source/compiler/genc.c
* source/compiler/hbfix.c
* source/compiler/hbpcode.c
+ Added: new opcodes HB_P_MACROLIST, HB_P_MACROPUSHLIST, HB_P_MACROLISTEND, and HB_P_MACROPUSHINDEX.
* source/vm/hvm.c
* source/vm/macro.c
+ Added: support for new opcodes HB_P_MACROLIST, HB_P_MACROPUSHLIST, HB_P_MACROLISTEND, and HB_P_MACROPUSHINDEX.
/* HB_P_MACROPUSHINDEX not completed yet.*/
/* NOTE: This implements macro as literal array arguments list syntax <{ &cMacro }>.
( &Cmacro ) and Array[ &cMacro ] are not completed yet.
*** All prgs must be recompiled due to new opcodes !!!
*/
This commit is contained in:
@@ -1,3 +1,36 @@
|
||||
2001-07-22 14:30 UTC-0800 Ron Pinkas <ron@profit-master.com>
|
||||
* include/hbapi.h
|
||||
* Changed 2nd parameter to BYTE iContext in hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext )
|
||||
|
||||
* include/hbexprop.h
|
||||
+ Added #define HB_ET_MACRO_LIST 16 /* &variable used as in literal arrays or parentesised expressions. */
|
||||
+ Added #define HB_ET_MACRO_INDEX 32 /* &variable used as arrays index. */
|
||||
|
||||
* include/hbexprb.c
|
||||
+ Added macro list support logic to hb_compExprUseArray()
|
||||
+ Added generation of HB_P_MACROLIST, HB_P_MACROPUSHLIST, HB_P_MACROLISTEND, and HB_P_MACROPUSHINDEX in hb_compExprUseMacro()
|
||||
|
||||
/* HB_P_MACROLIST and HB_P_MACROLISTEND are only generated as an enevelope if array contains a one or more macro element
|
||||
which will generate an HB_P_MACROPUSHLIST. */
|
||||
|
||||
* include/hbpcode.h
|
||||
* source/compiler/genc.c
|
||||
* source/compiler/hbfix.c
|
||||
* source/compiler/hbpcode.c
|
||||
+ Added: new opcodes HB_P_MACROLIST, HB_P_MACROPUSHLIST, HB_P_MACROLISTEND, and HB_P_MACROPUSHINDEX.
|
||||
|
||||
* source/vm/hvm.c
|
||||
* source/vm/macro.c
|
||||
+ Added: support for new opcodes HB_P_MACROLIST, HB_P_MACROPUSHLIST, HB_P_MACROLISTEND, and HB_P_MACROPUSHINDEX.
|
||||
|
||||
/* HB_P_MACROPUSHINDEX not completed yet.*/
|
||||
|
||||
/* NOTE: This implements macro as literal array arguments list syntax <{ &cMacro }>.
|
||||
( &Cmacro ) and Array[ &cMacro ] are not completed yet.
|
||||
|
||||
*** All prgs must be recompiled due to new opcodes !!!
|
||||
*/
|
||||
|
||||
2001-07-22 18:00 GMT -3 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
+source/rtl/radiobtn.prg
|
||||
*Added an 'LOCAL cColor' to compile without warning
|
||||
@@ -24,7 +57,6 @@
|
||||
source/rtl/makefile
|
||||
*Added radiobtn.prg and radiogrp.prg to dependencie list
|
||||
|
||||
|
||||
2001-07-22 20:15 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*include/hbapi.h
|
||||
@@ -40,7 +72,7 @@
|
||||
area := "MyAlias"
|
||||
? &cAlias->someFile
|
||||
? &cAlias->( someExpr )
|
||||
|
||||
|
||||
2001-07-22 08:40 GMT -3 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
*source/rtl/getsys.prg
|
||||
*Now if an get has an message it will display properly
|
||||
@@ -60,13 +92,13 @@
|
||||
*fixed support for &alias->( expression )
|
||||
*removed global variables that were breaking modularity of the code
|
||||
*fixed support for syntax: SomeFun( ¯o + someValue )
|
||||
|
||||
|
||||
*source/compiler/harbour.y
|
||||
*removed access to internal HB_EXPR structure data
|
||||
|
||||
|
||||
*source/rtl/checkbox.prg
|
||||
* added 'LOCAL oCheck' to compile without warnings
|
||||
|
||||
|
||||
*source/rtl/gtsln/gtsln.c
|
||||
*fixed to support (at least) SLang version 1.3.8
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@ typedef struct HB_MACRO_ /* a macro compiled pcode container */
|
||||
int iListElements;
|
||||
} HB_MACRO, * HB_MACRO_PTR;
|
||||
|
||||
extern void hb_macroGetValue( HB_ITEM_PTR pItem, BOOL bArg ); /* retrieve results of a macro expansion */
|
||||
extern void hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext ); /* retrieve results of a macro expansion */
|
||||
extern void hb_macroSetValue( HB_ITEM_PTR pItem ); /* assign a value to a macro-expression item */
|
||||
extern void hb_macroTextValue( HB_ITEM_PTR pItem ); /* macro text substitution */
|
||||
extern void hb_macroPushSymbol( HB_ITEM_PTR pItem ); /* handle a macro function calls, e.g. var := ¯o() */
|
||||
|
||||
@@ -528,11 +528,34 @@ static HB_EXPR_FUNC( hb_compExprUseArray )
|
||||
HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_ARRAYGEN, 0, 0, ( BOOL ) 1 );
|
||||
else
|
||||
{
|
||||
BOOL bMacroList = FALSE;
|
||||
|
||||
/* Find out if macro is used as on of the elements- if so generate a prefix HB_P_MACROLIST. */
|
||||
while( pElem )
|
||||
{
|
||||
if( pElem->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
pElem->value.asMacro.SubType |= HB_ET_MACRO_LIST;
|
||||
bMacroList = TRUE;
|
||||
}
|
||||
pElem = pElem->pNext;
|
||||
}
|
||||
|
||||
if( bMacroList )
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROLIST );
|
||||
}
|
||||
pElem = pSelf->value.asList.pExprList;
|
||||
while( pElem )
|
||||
{
|
||||
HB_EXPR_USE( pElem, HB_EA_PUSH_PCODE );
|
||||
pElem = pElem->pNext;
|
||||
}
|
||||
if( bMacroList )
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROLISTEND );
|
||||
}
|
||||
|
||||
HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_ARRAYGEN, HB_LOBYTE( pSelf->ulLength ), HB_HIBYTE( pSelf->ulLength ), ( BOOL ) 1 );
|
||||
}
|
||||
}
|
||||
@@ -926,7 +949,13 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt )
|
||||
case HB_EA_PUSH_PCODE:
|
||||
{
|
||||
HB_EXPR_USE( pSelf->value.asList.pExprList, HB_EA_PUSH_PCODE );
|
||||
|
||||
if( pSelf->value.asList.pIndex->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
pSelf->value.asList.pIndex->value.asMacro.SubType |= HB_ET_MACRO_INDEX;
|
||||
}
|
||||
HB_EXPR_USE( pSelf->value.asList.pIndex, HB_EA_PUSH_PCODE );
|
||||
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_ARRAYPUSH );
|
||||
}
|
||||
break;
|
||||
@@ -1007,6 +1036,14 @@ static HB_EXPR_FUNC( hb_compExprUseMacro )
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHARG );
|
||||
HB_EXPR_USE( pSelf->value.asMacro.pFunCall->value.asFunCall.pFunName, HB_EA_PUSH_PCODE );
|
||||
}
|
||||
else if( pSelf->value.asMacro.SubType & HB_ET_MACRO_LIST )
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHLIST );
|
||||
}
|
||||
else if( pSelf->value.asMacro.SubType & HB_ET_MACRO_INDEX )
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHINDEX );
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSH );
|
||||
@@ -1063,12 +1100,12 @@ static HB_EXPR_FUNC( hb_compExprUseMacro )
|
||||
if( pSelf->value.asMacro.pExprList )
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asMacro.pExprList );
|
||||
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
if( pSelf->value.asMacro.szMacro );
|
||||
HB_XFREE( pSelf->value.asMacro.szMacro );
|
||||
#else
|
||||
#else
|
||||
/* NOTE: This will be released during releasing of symbols' table */
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return pSelf;
|
||||
|
||||
@@ -100,6 +100,8 @@ typedef enum
|
||||
#define HB_ET_MACRO_ALIASED 2 /* &alias->&variable */
|
||||
#define HB_ET_MACRO_EXPR 4 /* &( expr ) */
|
||||
#define HB_ET_MACRO_ARGLIST 8 /* &variable used as a function call argument */
|
||||
#define HB_ET_MACRO_LIST 16 /* &variable used as in literal arrays or parentesised expressions. */
|
||||
#define HB_ET_MACRO_INDEX 32 /* &variable used as arrays index. */
|
||||
|
||||
/* types of expressions
|
||||
* NOTE: the order of these definition is important - change it carefully
|
||||
|
||||
@@ -103,88 +103,92 @@ typedef enum
|
||||
HB_P_MACROPOPALIASED, /* 39 compile and run - pop a field value from the stack */
|
||||
HB_P_MACROPUSH, /* 40 compile and run - leave the result on the stack */
|
||||
HB_P_MACROPUSHARG, /* 41 compile and run - leave the result on the stack */
|
||||
HB_P_MACROPUSHALIASED, /* 42 compile and run - leave the field value on the stack */
|
||||
HB_P_MACROSYMBOL, /* 43 compile into a symbol name (used in function calls) */
|
||||
HB_P_MACROTEXT, /* 44 macro text substitution */
|
||||
HB_P_MESSAGE, /* 45 sends a message to an object */
|
||||
HB_P_MINUS, /* 46 subs the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_MODULUS, /* 47 calculates the modulus of the two values on the stack, removing them and leaving there the result */
|
||||
HB_P_MODULENAME, /* 48 sets the name of debugged module */
|
||||
HB_P_MACROPUSHLIST, /* 42 compile and run - leave the result on the stack */
|
||||
HB_P_MACROPUSHINDEX, /* 43 compile and run - leave the result on the stack */
|
||||
HB_P_MACROPUSHALIASED, /* 44 compile and run - leave the field value on the stack */
|
||||
HB_P_MACROSYMBOL, /* 45 compile into a symbol name (used in function calls) */
|
||||
HB_P_MACROTEXT, /* 46 macro text substitution */
|
||||
HB_P_MESSAGE, /* 47 sends a message to an object */
|
||||
HB_P_MINUS, /* 48 subs the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_MODULUS, /* 49 calculates the modulus of the two values on the stack, removing them and leaving there the result */
|
||||
HB_P_MODULENAME, /* 50 sets the name of debugged module */
|
||||
/* start: pcodes generated by the macro compiler - the symbol address is used */
|
||||
HB_P_MMESSAGE, /* 49 */
|
||||
HB_P_MPOPALIASEDFIELD, /* 50 */
|
||||
HB_P_MPOPALIASEDVAR, /* 51 */
|
||||
HB_P_MPOPFIELD, /* 52 */
|
||||
HB_P_MPOPMEMVAR, /* 53 */
|
||||
HB_P_MPUSHALIASEDFIELD, /* 54 */
|
||||
HB_P_MPUSHALIASEDVAR, /* 55 */
|
||||
HB_P_MPUSHBLOCK, /* 56 */
|
||||
HB_P_MPUSHFIELD, /* 57 */
|
||||
HB_P_MPUSHMEMVAR, /* 58 */
|
||||
HB_P_MPUSHMEMVARREF, /* 59 */
|
||||
HB_P_MPUSHSYM, /* 60 */
|
||||
HB_P_MPUSHVARIABLE, /* 61 */
|
||||
HB_P_MMESSAGE, /* 51 */
|
||||
HB_P_MPOPALIASEDFIELD, /* 52 */
|
||||
HB_P_MPOPALIASEDVAR, /* 53 */
|
||||
HB_P_MPOPFIELD, /* 54 */
|
||||
HB_P_MPOPMEMVAR, /* 55 */
|
||||
HB_P_MPUSHALIASEDFIELD, /* 56 */
|
||||
HB_P_MPUSHALIASEDVAR, /* 57 */
|
||||
HB_P_MPUSHBLOCK, /* 58 */
|
||||
HB_P_MPUSHFIELD, /* 59 */
|
||||
HB_P_MPUSHMEMVAR, /* 60 */
|
||||
HB_P_MPUSHMEMVARREF, /* 61 */
|
||||
HB_P_MPUSHSYM, /* 62 */
|
||||
HB_P_MPUSHVARIABLE, /* 63 */
|
||||
/* end: */
|
||||
HB_P_MULT, /* 62 multiplies the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_NEGATE, /* 63 numerically negates the latest value on the stack */
|
||||
HB_P_NOOP, /* 64 no operation */
|
||||
HB_P_NOT, /* 65 logically negates the latest value on the stack */
|
||||
HB_P_NOTEQUAL, /* 66 checks if the latest two stack values are equal, leaves just the result */
|
||||
HB_P_OR, /* 67 peforms the logical OR of two latest stack values, removes them and places result */
|
||||
HB_P_PARAMETER, /* 68 creates PRIVATE variables and assigns values to functions paramaters */
|
||||
HB_P_PLUS, /* 69 adds the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_POP, /* 70 removes the latest value from the stack */
|
||||
HB_P_POPALIAS, /* 71 pops the item from the eval stack and selects the current workarea */
|
||||
HB_P_POPALIASEDFIELD, /* 72 pops aliased field */
|
||||
HB_P_POPALIASEDFIELDNEAR, /* 73 pops aliased field */
|
||||
HB_P_POPALIASEDVAR, /* 74 pops aliased variable (either a field or a memvar) */
|
||||
HB_P_POPFIELD, /* 75 pops unaliased field */
|
||||
HB_P_POPLOCAL, /* 76 pops the contains of the virtual machine stack onto a local variable */
|
||||
HB_P_POPLOCALNEAR, /* 77 pops the contains of the virtual machine stack onto a local variable */
|
||||
HB_P_POPMEMVAR, /* 78 pops the contains of a memvar variable to the virtual machine stack */
|
||||
HB_P_POPSTATIC, /* 79 pops the contains of the virtual machine stack onto a static variable */
|
||||
HB_P_POPVARIABLE, /* 80 pops the contains of an undeclared variable from the virtual machine stack */
|
||||
HB_P_POWER, /* 81 calculates the power of the two values on the stack, removing them and leaving there the result */
|
||||
HB_P_PUSHALIAS, /* 82 saves the current workarea number on the eval stack */
|
||||
HB_P_PUSHALIASEDFIELD, /* 83 pushes aliased field */
|
||||
HB_P_PUSHALIASEDFIELDNEAR, /* 84 pushes aliased field */
|
||||
HB_P_PUSHALIASEDVAR, /* 85 pushes aliased variable (either a field or a memvar) */
|
||||
HB_P_PUSHBLOCK, /* 86 start of a codeblock definition */
|
||||
HB_P_PUSHBLOCKSHORT, /* 87 start of a codeblock definition */
|
||||
HB_P_PUSHFIELD, /* 88 pushes unaliased field */
|
||||
HB_P_PUSHBYTE, /* 89 places a 1 byte integer number on the virtual machine stack */
|
||||
HB_P_PUSHINT, /* 90 places an integer number on the virtual machine stack */
|
||||
HB_P_PUSHLOCAL, /* 91 pushes the contains of a local variable to the virtual machine stack */
|
||||
HB_P_PUSHLOCALNEAR, /* 92 pushes the contains of a local variable to the virtual machine stack */
|
||||
HB_P_PUSHLOCALREF, /* 93 pushes a local variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHLONG, /* 94 places an integer number on the virtual machine stack */
|
||||
HB_P_PUSHMEMVAR, /* 95 pushes the contains of a memvar variable to the virtual machine stack */
|
||||
HB_P_PUSHMEMVARREF, /* 96 pushes the a memvar variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHNIL, /* 97 places a nil on the virtual machine stack */
|
||||
HB_P_PUSHDOUBLE, /* 98 places a double number on the virtual machine stack */
|
||||
HB_P_PUSHSELF, /* 99 pushes Self for the current processed method */
|
||||
HB_P_PUSHSTATIC, /* 100 pushes the contains of a static variable to the virtual machine stack */
|
||||
HB_P_PUSHSTATICREF, /* 101 pushes the a static variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHSTR, /* 102 places a string on the virtual machine stack */
|
||||
HB_P_PUSHSTRSHORT, /* 103 places a string on the virtual machine stack */
|
||||
HB_P_PUSHSYM, /* 104 places a symbol on the virtual machine stack */
|
||||
HB_P_PUSHSYMNEAR, /* 105 places a symbol on the virtual machine stack */
|
||||
HB_P_PUSHVARIABLE, /* 106 pushes the contains of an undeclared variable to the virtual machine stack */
|
||||
HB_P_RETVALUE, /* 107 instructs the virtual machine to return the latest stack value */
|
||||
HB_P_SEND, /* 108 send operator */
|
||||
HB_P_SENDSHORT, /* 109 send operator */
|
||||
HB_P_SEQBEGIN, /* 110 BEGIN SEQUENCE */
|
||||
HB_P_SEQEND, /* 111 END SEQUENCE */
|
||||
HB_P_SEQRECOVER, /* 112 RECOVER statement */
|
||||
HB_P_SFRAME, /* 113 sets the statics frame for a function */
|
||||
HB_P_STATICS, /* 114 defines the number of statics variables for a PRG */
|
||||
HB_P_STATICNAME, /* 115 sets the name of static variable */
|
||||
HB_P_SWAPALIAS, /* 116 restores the current workarea number from the eval stack */
|
||||
HB_P_TRUE, /* 117 pushes true on the virtual machine stack */
|
||||
HB_P_ZERO, /* 118 places a ZERO on the virtual machine stack */
|
||||
HB_P_ONE, /* 119 places a ONE on the virtual machine stack */
|
||||
HB_P_MULT, /* 64 multiplies the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_NEGATE, /* 65 numerically negates the latest value on the stack */
|
||||
HB_P_NOOP, /* 66 no operation */
|
||||
HB_P_NOT, /* 67 logically negates the latest value on the stack */
|
||||
HB_P_NOTEQUAL, /* 68 checks if the latest two stack values are equal, leaves just the result */
|
||||
HB_P_OR, /* 69 peforms the logical OR of two latest stack values, removes them and places result */
|
||||
HB_P_PARAMETER, /* 70 creates PRIVATE variables and assigns values to functions paramaters */
|
||||
HB_P_PLUS, /* 71 adds the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_POP, /* 72 removes the latest value from the stack */
|
||||
HB_P_POPALIAS, /* 73 pops the item from the eval stack and selects the current workarea */
|
||||
HB_P_POPALIASEDFIELD, /* 74 pops aliased field */
|
||||
HB_P_POPALIASEDFIELDNEAR, /* 75 pops aliased field */
|
||||
HB_P_POPALIASEDVAR, /* 76 pops aliased variable (either a field or a memvar) */
|
||||
HB_P_POPFIELD, /* 77 pops unaliased field */
|
||||
HB_P_POPLOCAL, /* 78 pops the contains of the virtual machine stack onto a local variable */
|
||||
HB_P_POPLOCALNEAR, /* 79 pops the contains of the virtual machine stack onto a local variable */
|
||||
HB_P_POPMEMVAR, /* 80 pops the contains of a memvar variable to the virtual machine stack */
|
||||
HB_P_POPSTATIC, /* 81 pops the contains of the virtual machine stack onto a static variable */
|
||||
HB_P_POPVARIABLE, /* 82 pops the contains of an undeclared variable from the virtual machine stack */
|
||||
HB_P_POWER, /* 83 calculates the power of the two values on the stack, removing them and leaving there the result */
|
||||
HB_P_PUSHALIAS, /* 84 saves the current workarea number on the eval stack */
|
||||
HB_P_PUSHALIASEDFIELD, /* 85 pushes aliased field */
|
||||
HB_P_PUSHALIASEDFIELDNEAR, /* 86 pushes aliased field */
|
||||
HB_P_PUSHALIASEDVAR, /* 87 pushes aliased variable (either a field or a memvar) */
|
||||
HB_P_PUSHBLOCK, /* 88 start of a codeblock definition */
|
||||
HB_P_PUSHBLOCKSHORT, /* 89 start of a codeblock definition */
|
||||
HB_P_PUSHFIELD, /* 90 pushes unaliased field */
|
||||
HB_P_PUSHBYTE, /* 91 places a 1 byte integer number on the virtual machine stack */
|
||||
HB_P_PUSHINT, /* 92 places an integer number on the virtual machine stack */
|
||||
HB_P_PUSHLOCAL, /* 93 pushes the contains of a local variable to the virtual machine stack */
|
||||
HB_P_PUSHLOCALNEAR, /* 94 pushes the contains of a local variable to the virtual machine stack */
|
||||
HB_P_PUSHLOCALREF, /* 95 pushes a local variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHLONG, /* 96 places an integer number on the virtual machine stack */
|
||||
HB_P_PUSHMEMVAR, /* 97 pushes the contains of a memvar variable to the virtual machine stack */
|
||||
HB_P_PUSHMEMVARREF, /* 98 pushes the a memvar variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHNIL, /* 99 places a nil on the virtual machine stack */
|
||||
HB_P_PUSHDOUBLE, /* 100 places a double number on the virtual machine stack */
|
||||
HB_P_PUSHSELF, /* 101 pushes Self for the current processed method */
|
||||
HB_P_PUSHSTATIC, /* 102 pushes the contains of a static variable to the virtual machine stack */
|
||||
HB_P_PUSHSTATICREF, /* 103 pushes the a static variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHSTR, /* 104 places a string on the virtual machine stack */
|
||||
HB_P_PUSHSTRSHORT, /* 105 places a string on the virtual machine stack */
|
||||
HB_P_PUSHSYM, /* 106 places a symbol on the virtual machine stack */
|
||||
HB_P_PUSHSYMNEAR, /* 107 places a symbol on the virtual machine stack */
|
||||
HB_P_PUSHVARIABLE, /* 108 pushes the contains of an undeclared variable to the virtual machine stack */
|
||||
HB_P_RETVALUE, /* 109 instructs the virtual machine to return the latest stack value */
|
||||
HB_P_SEND, /* 110 send operator */
|
||||
HB_P_SENDSHORT, /* 111 send operator */
|
||||
HB_P_SEQBEGIN, /* 112 BEGIN SEQUENCE */
|
||||
HB_P_SEQEND, /* 113 END SEQUENCE */
|
||||
HB_P_SEQRECOVER, /* 114 RECOVER statement */
|
||||
HB_P_SFRAME, /* 115 sets the statics frame for a function */
|
||||
HB_P_STATICS, /* 116 defines the number of statics variables for a PRG */
|
||||
HB_P_STATICNAME, /* 117 sets the name of static variable */
|
||||
HB_P_SWAPALIAS, /* 118 restores the current workarea number from the eval stack */
|
||||
HB_P_TRUE, /* 119 pushes true on the virtual machine stack */
|
||||
HB_P_ZERO, /* 120 places a ZERO on the virtual machine stack */
|
||||
HB_P_ONE, /* 121 places a ONE on the virtual machine stack */
|
||||
HB_P_MACROLIST, /* 122 places a ONE on the virtual machine stack */
|
||||
HB_P_MACROLISTEND, /* 122 places a ONE on the virtual machine stack */
|
||||
/* NOTE: This have to be the last definition */
|
||||
HB_P_LAST_PCODE /* 120 this defines the number of defined pcodes */
|
||||
HB_P_LAST_PCODE /* 123 this defines the number of defined pcodes */
|
||||
} HB_PCODE;
|
||||
|
||||
#endif /* HB_PCODE_H_ */
|
||||
|
||||
@@ -797,6 +797,24 @@ static HB_GENC_FUNC( hb_p_macropusharg )
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macropushlist )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
HB_SYMBOL_UNUSED( lPCodePos );
|
||||
|
||||
fprintf( cargo->yyc, "\tHB_P_MACROPUSHLIST,\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macropushindex )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
HB_SYMBOL_UNUSED( lPCodePos );
|
||||
|
||||
fprintf( cargo->yyc, "\tHB_P_MACROPUSHINDEX,\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macropushaliased )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
@@ -1738,6 +1756,24 @@ static HB_GENC_FUNC( hb_p_dummy )
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macrolist )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
HB_SYMBOL_UNUSED( lPCodePos );
|
||||
|
||||
fprintf( cargo->yyc, "\tHB_P_MACROLIST,\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macrolistend )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
HB_SYMBOL_UNUSED( lPCodePos );
|
||||
|
||||
fprintf( cargo->yyc, "\tHB_P_MACROLISTEND,\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* NOTE: The order of functions have to match the order of opcodes
|
||||
* mnemonics
|
||||
*/
|
||||
@@ -1784,6 +1820,8 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = {
|
||||
hb_p_macropopaliased,
|
||||
hb_p_macropush,
|
||||
hb_p_macropusharg,
|
||||
hb_p_macropushlist,
|
||||
hb_p_macropushindex,
|
||||
hb_p_macropushaliased,
|
||||
hb_p_macrosymbol,
|
||||
hb_p_macrotext,
|
||||
@@ -1863,7 +1901,9 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = {
|
||||
hb_p_swapalias,
|
||||
hb_p_true,
|
||||
hb_p_zero,
|
||||
hb_p_one
|
||||
hb_p_one,
|
||||
hb_p_macrolist,
|
||||
hb_p_macrolistend
|
||||
};
|
||||
|
||||
static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc )
|
||||
|
||||
@@ -295,6 +295,8 @@ static HB_FIX_FUNC_PTR s_fixlocals_table[] =
|
||||
NULL, /* HB_P_MACROPOPALIASED, */
|
||||
NULL, /* HB_P_MACROPUSH, */
|
||||
NULL, /* HB_P_MACROPUSHARG, */
|
||||
NULL, /* HB_P_MACROPUSHLIST, */
|
||||
NULL, /* HB_P_MACROPUSHINDEX, */
|
||||
NULL, /* HB_P_MACROPUSHALIASED, */
|
||||
NULL, /* HB_P_MACROSYMBOL, */
|
||||
NULL, /* HB_P_MACROTEXT, */
|
||||
@@ -374,7 +376,9 @@ static HB_FIX_FUNC_PTR s_fixlocals_table[] =
|
||||
NULL, /* HB_P_SWAPALIAS, */
|
||||
NULL, /* HB_P_TRUE, */
|
||||
NULL, /* HB_P_ZERO, */
|
||||
NULL /* HB_P_ONE, */
|
||||
NULL, /* HB_P_ONE, */
|
||||
NULL, /* HB_P_MACROLIST, */
|
||||
NULL /* HB_P_MACROLISTEND, */
|
||||
};
|
||||
|
||||
void hb_compFixFuncPCode( PFUNCTION pFunc )
|
||||
|
||||
@@ -84,6 +84,8 @@ static BYTE s_pcode_len[] = {
|
||||
1, /* HB_P_MACROPOPALIASED, */
|
||||
1, /* HB_P_MACROPUSH, */
|
||||
1, /* HB_P_MACROPUSHARG, */
|
||||
1, /* HB_P_MACROPUSLIST, */
|
||||
1, /* HB_P_MACROPUSINDEX, */
|
||||
1, /* HB_P_MACROPUSHALIASED, */
|
||||
1, /* HB_P_MACROSYMBOL, */
|
||||
1, /* HB_P_MACROTEXT, */
|
||||
@@ -163,7 +165,9 @@ static BYTE s_pcode_len[] = {
|
||||
1, /* HB_P_SWAPALIAS, */
|
||||
1, /* HB_P_TRUE, */
|
||||
1, /* HB_P_ZERO, */
|
||||
1 /* HB_P_ONE, */
|
||||
1, /* HB_P_ONE, */
|
||||
1, /* HB_P_MACROLIST, */
|
||||
1 /* HB_P_MACROLISTEND, */
|
||||
};
|
||||
|
||||
static PVAR hb_compPrivateFind( char * szPrivateName )
|
||||
|
||||
@@ -256,6 +256,8 @@ static LONG s_lRecoverBase;
|
||||
int hb_vm_aiExtraParams[HB_MAX_MACRO_ARGS], hb_vm_iExtraParamsIndex = 0;
|
||||
PHB_SYMB hb_vm_apExtraParamsSymbol[HB_MAX_MACRO_ARGS];
|
||||
|
||||
int hb_vm_aiExtraElements[HB_MAX_MACRO_ARGS], hb_vm_iExtraElementsIndex = 0, hb_vm_iExtraElements = 0;
|
||||
|
||||
/* Request for some action - stop processing of opcodes
|
||||
*/
|
||||
static USHORT s_uiActionRequest;
|
||||
@@ -581,7 +583,8 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
break;
|
||||
|
||||
case HB_P_ARRAYGEN:
|
||||
hb_vmArrayGen( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) );
|
||||
hb_vmArrayGen( pCode[ w + 1 ] + ( pCode[ w + 2 ] * 256 ) + hb_vm_iExtraElements );
|
||||
hb_vm_iExtraElements = 0;
|
||||
w += 3;
|
||||
break;
|
||||
|
||||
@@ -1227,7 +1230,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
/* the topmost element on the stack contains a macro
|
||||
* string for compilation
|
||||
*/
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), FALSE );
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), 0 );
|
||||
w++;
|
||||
break;
|
||||
|
||||
@@ -1236,7 +1239,7 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
/* the topmost element on the stack contains a macro
|
||||
* string for compilation
|
||||
*/
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), TRUE );
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), HB_P_MACROPUSHARG );
|
||||
w++;
|
||||
|
||||
if( hb_vm_iExtraParamsIndex && hb_vm_apExtraParamsSymbol[hb_vm_iExtraParamsIndex - 1] == NULL )
|
||||
@@ -1276,6 +1279,34 @@ void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
|
||||
}
|
||||
break;
|
||||
|
||||
case HB_P_MACROLIST:
|
||||
hb_vm_aiExtraElements[hb_vm_iExtraElementsIndex++] = 0;
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_MACROPUSHLIST:
|
||||
/* compile and run - leave the result on the stack */
|
||||
/* the topmost element on the stack contains a macro
|
||||
* string for compilation
|
||||
*/
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), HB_P_MACROPUSHLIST );
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_MACROLISTEND:
|
||||
hb_vm_iExtraElements = hb_vm_aiExtraElements[--hb_vm_iExtraElementsIndex];
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_MACROPUSHINDEX:
|
||||
/* compile and run - leave the result on the stack */
|
||||
/* the topmost element on the stack contains a macro
|
||||
* string for compilation
|
||||
*/
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), 0 );
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_MACROPUSHALIASED:
|
||||
/* compile and run - leave an aliased variable on the stack */
|
||||
hb_macroPushAliasedValue( hb_stackItemFromTop( -2 ), hb_stackItemFromTop( -1 ) );
|
||||
@@ -2843,7 +2874,7 @@ static ERRCODE hb_vmSelectWorkarea( PHB_ITEM pAlias )
|
||||
/* expand '&' operator if exists */
|
||||
char *cAlias;
|
||||
BOOL bNewString;
|
||||
|
||||
|
||||
cAlias = hb_macroExpandString( pAlias->item.asString.value, pAlias->item.asString.length, &bNewString );
|
||||
bSuccess = hb_rddSelectWorkAreaAlias( cAlias );
|
||||
if( bNewString )
|
||||
|
||||
@@ -425,9 +425,10 @@ char * hb_macroTextSubst( char * szString, ULONG *pulStringLen )
|
||||
* a parameter.
|
||||
* PUSH operation
|
||||
*/
|
||||
void hb_macroGetValue( HB_ITEM_PTR pItem, BOOL bArg )
|
||||
void hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext )
|
||||
{
|
||||
extern int hb_vm_aiExtraParams[HB_MAX_MACRO_ARGS], hb_vm_iExtraParamsIndex;
|
||||
extern int hb_vm_aiExtraElements[HB_MAX_MACRO_ARGS], hb_vm_iExtraElementsIndex;
|
||||
extern PHB_SYMB hb_vm_apExtraParamsSymbol[HB_MAX_MACRO_ARGS];
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_macroGetValue(%p)", pItem));
|
||||
@@ -449,7 +450,7 @@ void hb_macroGetValue( HB_ITEM_PTR pItem, BOOL bArg )
|
||||
struMacro.bShortCuts = hb_comp_bShortCuts;
|
||||
struMacro.uiNameLen = HB_SYMBOL_NAME_LEN;
|
||||
struMacro.status = HB_MACRO_CONT;
|
||||
struMacro.iListElements = ( bArg ? 0 : -1 );
|
||||
struMacro.iListElements = ( iContext ? 0 : -1 );
|
||||
|
||||
#ifdef HB_MACRO_STATEMENTS
|
||||
slen = HB_MIN( strlen( szString ), HB_PP_STR_SIZE - 1 );
|
||||
@@ -470,7 +471,7 @@ void hb_macroGetValue( HB_ITEM_PTR pItem, BOOL bArg )
|
||||
|
||||
iStatus = hb_macroParse( &struMacro, szString );
|
||||
|
||||
if( bArg && hb_vm_iExtraParamsIndex == HB_MAX_MACRO_ARGS )
|
||||
if( iContext && ( hb_vm_iExtraParamsIndex == HB_MAX_MACRO_ARGS ) || ( hb_vm_iExtraElementsIndex >= HB_MAX_MACRO_ARGS ) )
|
||||
{
|
||||
hb_macroSyntaxError( &struMacro );
|
||||
}
|
||||
@@ -485,10 +486,18 @@ void hb_macroGetValue( HB_ITEM_PTR pItem, BOOL bArg )
|
||||
{
|
||||
hb_macroEvaluate( &struMacro );
|
||||
|
||||
if( bArg && struMacro.iListElements > 0 )
|
||||
if( iContext && struMacro.iListElements > 0 )
|
||||
{
|
||||
hb_vm_aiExtraParams[hb_vm_iExtraParamsIndex] = struMacro.iListElements;
|
||||
hb_vm_apExtraParamsSymbol[hb_vm_iExtraParamsIndex++] = NULL;
|
||||
|
||||
if( iContext == HB_P_MACROPUSHARG )
|
||||
{
|
||||
hb_vm_aiExtraParams[hb_vm_iExtraParamsIndex] = struMacro.iListElements;
|
||||
hb_vm_apExtraParamsSymbol[hb_vm_iExtraParamsIndex++] = NULL;
|
||||
}
|
||||
else if( iContext == HB_P_MACROPUSHLIST )
|
||||
{
|
||||
hb_vm_aiExtraElements[hb_vm_iExtraElementsIndex - 1] += struMacro.iListElements;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user