2001-07-23 04:15 UTC-0800 Ron Pinkas <ron@profit-master.com>
* include/hbexprop.h
+ Added #define HB_ET_MACRO_PARE 64
* source/vm/hvm.c
* source/vm/macro.c
* source/macro/macro.y
* include/hbexprb.c
+ Added support for HB_P_MACROPUSHPARE aand HB_P_MACROPUSHINDEX
* include/hbmacro.h
+ Added #define HB_MACRO_GEN_PARE 16 /* generate parentesized list */
* source/common/expropt1.c
* source/common/expropt2.c
* include/hbpcode.h
* source/compiler/genc.c
* source/compiler/hbfix.c
* source/compiler/hbpcode.c
+ Added new opcode HB_P_MACROPUSHPARE
/* This should complete macro list support for ( &cMacro ) and aArray[ &cMacro ] syntaxes. */
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
2001-07-23 04:15 UTC-0800 Ron Pinkas <ron@profit-master.com>
|
||||
* include/hbexprop.h
|
||||
+ Added #define HB_ET_MACRO_PARE 64
|
||||
|
||||
* source/vm/hvm.c
|
||||
* source/vm/macro.c
|
||||
* source/macro/macro.y
|
||||
* include/hbexprb.c
|
||||
+ Added support for HB_P_MACROPUSHPARE aand HB_P_MACROPUSHINDEX
|
||||
|
||||
* include/hbmacro.h
|
||||
+ Added #define HB_MACRO_GEN_PARE 16 /* generate parentesized list */
|
||||
|
||||
* source/common/expropt1.c
|
||||
* source/common/expropt2.c
|
||||
|
||||
* include/hbpcode.h
|
||||
* source/compiler/genc.c
|
||||
* source/compiler/hbfix.c
|
||||
* source/compiler/hbpcode.c
|
||||
+ Added new opcode HB_P_MACROPUSHPARE
|
||||
|
||||
/* This should complete macro list support for ( &cMacro ) and aArray[ &cMacro ] syntaxes. */
|
||||
|
||||
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 )
|
||||
|
||||
@@ -738,6 +738,14 @@ static HB_EXPR_FUNC( hb_compExprUseList )
|
||||
{
|
||||
case HB_EA_REDUCE:
|
||||
{
|
||||
if( hb_compExprListLen( pSelf ) == 1 )
|
||||
{
|
||||
if( pSelf->value.asList.pExprList->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
pSelf->value.asList.pExprList->value.asMacro.SubType |= HB_ET_MACRO_PARE;
|
||||
}
|
||||
}
|
||||
|
||||
HB_EXPR_PCODE1( hb_compExprReduceList, pSelf );
|
||||
/* NOTE: if the list contains a single expression then the list
|
||||
* is not reduced to this expression - if you need that reduction
|
||||
@@ -776,6 +784,11 @@ static HB_EXPR_FUNC( hb_compExprUseList )
|
||||
{
|
||||
while( pExpr )
|
||||
{
|
||||
if( pExpr->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
pExpr->value.asMacro.SubType |= HB_ET_MACRO_PARE;
|
||||
}
|
||||
|
||||
if( pExpr->pNext )
|
||||
HB_EXPR_USE( pExpr, HB_EA_PUSH_POP );
|
||||
else
|
||||
@@ -796,6 +809,11 @@ static HB_EXPR_FUNC( hb_compExprUseList )
|
||||
|
||||
while( pExpr )
|
||||
{
|
||||
if( pExpr->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
pExpr->value.asMacro.SubType |= HB_ET_MACRO_PARE;
|
||||
}
|
||||
|
||||
HB_EXPR_USE( pExpr, HB_EA_PUSH_POP );
|
||||
pExpr = pExpr->pNext;
|
||||
}
|
||||
@@ -1044,6 +1062,10 @@ static HB_EXPR_FUNC( hb_compExprUseMacro )
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHINDEX );
|
||||
}
|
||||
else if( pSelf->value.asMacro.SubType & HB_ET_MACRO_PARE )
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHPARE );
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSH );
|
||||
@@ -1101,7 +1123,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro )
|
||||
HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asMacro.pExprList );
|
||||
|
||||
#if defined( HB_MACRO_SUPPORT )
|
||||
if( pSelf->value.asMacro.szMacro );
|
||||
if( pSelf->value.asMacro.szMacro )
|
||||
HB_XFREE( pSelf->value.asMacro.szMacro );
|
||||
#else
|
||||
/* NOTE: This will be released during releasing of symbols' table */
|
||||
|
||||
@@ -102,6 +102,7 @@ typedef enum
|
||||
#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. */
|
||||
#define HB_ET_MACRO_PARE 64 /* &variable used as arrays index. */
|
||||
|
||||
/* types of expressions
|
||||
* NOTE: the order of these definition is important - change it carefully
|
||||
|
||||
@@ -83,6 +83,7 @@ extern "C" {
|
||||
#define HB_MACRO_GEN_POP 2 /* generate POP pcodes */
|
||||
#define HB_MACRO_GEN_ALIASED 4 /* force aliased variable */
|
||||
#define HB_MACRO_GEN_TYPE 8 /* check the type of expression (from TYPE() function) */
|
||||
#define HB_MACRO_GEN_PARE 16 /* generate parentesized list */
|
||||
#define HB_MACRO_DEALLOCATE 128 /* macro structure is allocated on the heap */
|
||||
|
||||
/* values returned from compilation process
|
||||
|
||||
@@ -105,88 +105,89 @@ typedef enum
|
||||
HB_P_MACROPUSHARG, /* 41 compile and run - leave the result on the stack */
|
||||
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 */
|
||||
HB_P_MACROPUSHPARE, /* 44 compile and run - leave the result on the stack */
|
||||
HB_P_MACROPUSHALIASED, /* 45 compile and run - leave the field value on the stack */
|
||||
HB_P_MACROSYMBOL, /* 46 compile into a symbol name (used in function calls) */
|
||||
HB_P_MACROTEXT, /* 47 macro text substitution */
|
||||
HB_P_MESSAGE, /* 48 sends a message to an object */
|
||||
HB_P_MINUS, /* 49 subs the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_MODULUS, /* 50 calculates the modulus of the two values on the stack, removing them and leaving there the result */
|
||||
HB_P_MODULENAME, /* 51 sets the name of debugged module */
|
||||
/* start: pcodes generated by the macro compiler - the symbol address is used */
|
||||
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 */
|
||||
HB_P_MMESSAGE, /* 52 */
|
||||
HB_P_MPOPALIASEDFIELD, /* 53 */
|
||||
HB_P_MPOPALIASEDVAR, /* 54 */
|
||||
HB_P_MPOPFIELD, /* 55 */
|
||||
HB_P_MPOPMEMVAR, /* 56 */
|
||||
HB_P_MPUSHALIASEDFIELD, /* 57 */
|
||||
HB_P_MPUSHALIASEDVAR, /* 58 */
|
||||
HB_P_MPUSHBLOCK, /* 59 */
|
||||
HB_P_MPUSHFIELD, /* 60 */
|
||||
HB_P_MPUSHMEMVAR, /* 61 */
|
||||
HB_P_MPUSHMEMVARREF, /* 62 */
|
||||
HB_P_MPUSHSYM, /* 63 */
|
||||
HB_P_MPUSHVARIABLE, /* 64 */
|
||||
/* end: */
|
||||
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_MULT, /* 65 multiplies the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_NEGATE, /* 66 numerically negates the latest value on the stack */
|
||||
HB_P_NOOP, /* 67 no operation */
|
||||
HB_P_NOT, /* 68 logically negates the latest value on the stack */
|
||||
HB_P_NOTEQUAL, /* 69 checks if the latest two stack values are equal, leaves just the result */
|
||||
HB_P_OR, /* 70 peforms the logical OR of two latest stack values, removes them and places result */
|
||||
HB_P_PARAMETER, /* 71 creates PRIVATE variables and assigns values to functions paramaters */
|
||||
HB_P_PLUS, /* 72 adds the latest two values on the stack, removing them and leaving there the result */
|
||||
HB_P_POP, /* 73 removes the latest value from the stack */
|
||||
HB_P_POPALIAS, /* 74 pops the item from the eval stack and selects the current workarea */
|
||||
HB_P_POPALIASEDFIELD, /* 75 pops aliased field */
|
||||
HB_P_POPALIASEDFIELDNEAR, /* 76 pops aliased field */
|
||||
HB_P_POPALIASEDVAR, /* 77 pops aliased variable (either a field or a memvar) */
|
||||
HB_P_POPFIELD, /* 78 pops unaliased field */
|
||||
HB_P_POPLOCAL, /* 79 pops the contains of the virtual machine stack onto a local variable */
|
||||
HB_P_POPLOCALNEAR, /* 80 pops the contains of the virtual machine stack onto a local variable */
|
||||
HB_P_POPMEMVAR, /* 81 pops the contains of a memvar variable to the virtual machine stack */
|
||||
HB_P_POPSTATIC, /* 82 pops the contains of the virtual machine stack onto a static variable */
|
||||
HB_P_POPVARIABLE, /* 83 pops the contains of an undeclared variable from the virtual machine stack */
|
||||
HB_P_POWER, /* 84 calculates the power of the two values on the stack, removing them and leaving there the result */
|
||||
HB_P_PUSHALIAS, /* 85 saves the current workarea number on the eval stack */
|
||||
HB_P_PUSHALIASEDFIELD, /* 86 pushes aliased field */
|
||||
HB_P_PUSHALIASEDFIELDNEAR, /* 87 pushes aliased field */
|
||||
HB_P_PUSHALIASEDVAR, /* 88 pushes aliased variable (either a field or a memvar) */
|
||||
HB_P_PUSHBLOCK, /* 89 start of a codeblock definition */
|
||||
HB_P_PUSHBLOCKSHORT, /* 90 start of a codeblock definition */
|
||||
HB_P_PUSHFIELD, /* 91 pushes unaliased field */
|
||||
HB_P_PUSHBYTE, /* 92 places a 1 byte integer number on the virtual machine stack */
|
||||
HB_P_PUSHINT, /* 93 places an integer number on the virtual machine stack */
|
||||
HB_P_PUSHLOCAL, /* 94 pushes the contains of a local variable to the virtual machine stack */
|
||||
HB_P_PUSHLOCALNEAR, /* 95 pushes the contains of a local variable to the virtual machine stack */
|
||||
HB_P_PUSHLOCALREF, /* 96 pushes a local variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHLONG, /* 97 places an integer number on the virtual machine stack */
|
||||
HB_P_PUSHMEMVAR, /* 98 pushes the contains of a memvar variable to the virtual machine stack */
|
||||
HB_P_PUSHMEMVARREF, /* 99 pushes the a memvar variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHNIL, /* 100 places a nil on the virtual machine stack */
|
||||
HB_P_PUSHDOUBLE, /* 101 places a double number on the virtual machine stack */
|
||||
HB_P_PUSHSELF, /* 102 pushes Self for the current processed method */
|
||||
HB_P_PUSHSTATIC, /* 103 pushes the contains of a static variable to the virtual machine stack */
|
||||
HB_P_PUSHSTATICREF, /* 104 pushes the a static variable by reference to the virtual machine stack */
|
||||
HB_P_PUSHSTR, /* 105 places a string on the virtual machine stack */
|
||||
HB_P_PUSHSTRSHORT, /* 106 places a string on the virtual machine stack */
|
||||
HB_P_PUSHSYM, /* 107 places a symbol on the virtual machine stack */
|
||||
HB_P_PUSHSYMNEAR, /* 108 places a symbol on the virtual machine stack */
|
||||
HB_P_PUSHVARIABLE, /* 109 pushes the contains of an undeclared variable to the virtual machine stack */
|
||||
HB_P_RETVALUE, /* 110 instructs the virtual machine to return the latest stack value */
|
||||
HB_P_SEND, /* 111 send operator */
|
||||
HB_P_SENDSHORT, /* 112 send operator */
|
||||
HB_P_SEQBEGIN, /* 113 BEGIN SEQUENCE */
|
||||
HB_P_SEQEND, /* 114 END SEQUENCE */
|
||||
HB_P_SEQRECOVER, /* 115 RECOVER statement */
|
||||
HB_P_SFRAME, /* 116 sets the statics frame for a function */
|
||||
HB_P_STATICS, /* 117 defines the number of statics variables for a PRG */
|
||||
HB_P_STATICNAME, /* 118 sets the name of static variable */
|
||||
HB_P_SWAPALIAS, /* 119 restores the current workarea number from the eval stack */
|
||||
HB_P_TRUE, /* 120 pushes true on the virtual machine stack */
|
||||
HB_P_ZERO, /* 121 places a ZERO on the virtual machine stack */
|
||||
HB_P_ONE, /* 122 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 */
|
||||
HB_P_MACROLISTEND, /* 123 places a ONE on the virtual machine stack */
|
||||
/* NOTE: This have to be the last definition */
|
||||
HB_P_LAST_PCODE /* 123 this defines the number of defined pcodes */
|
||||
} HB_PCODE;
|
||||
|
||||
@@ -815,6 +815,15 @@ static HB_GENC_FUNC( hb_p_macropushindex )
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macropushpare )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
HB_SYMBOL_UNUSED( lPCodePos );
|
||||
|
||||
fprintf( cargo->yyc, "\tHB_P_MACROPUSHPARE,\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HB_GENC_FUNC( hb_p_macropushaliased )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pFunc );
|
||||
@@ -1822,6 +1831,7 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = {
|
||||
hb_p_macropusharg,
|
||||
hb_p_macropushlist,
|
||||
hb_p_macropushindex,
|
||||
hb_p_macropushpare,
|
||||
hb_p_macropushaliased,
|
||||
hb_p_macrosymbol,
|
||||
hb_p_macrotext,
|
||||
|
||||
@@ -297,6 +297,7 @@ static HB_FIX_FUNC_PTR s_fixlocals_table[] =
|
||||
NULL, /* HB_P_MACROPUSHARG, */
|
||||
NULL, /* HB_P_MACROPUSHLIST, */
|
||||
NULL, /* HB_P_MACROPUSHINDEX, */
|
||||
NULL, /* HB_P_MACROPUSHPARE, */
|
||||
NULL, /* HB_P_MACROPUSHALIASED, */
|
||||
NULL, /* HB_P_MACROSYMBOL, */
|
||||
NULL, /* HB_P_MACROTEXT, */
|
||||
|
||||
@@ -84,8 +84,9 @@ 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_MACROPUSHLIST, */
|
||||
1, /* HB_P_MACROPUSHINDEX, */
|
||||
1, /* HB_P_MACROPUSHPARE, */
|
||||
1, /* HB_P_MACROPUSHALIASED, */
|
||||
1, /* HB_P_MACROSYMBOL, */
|
||||
1, /* HB_P_MACROTEXT, */
|
||||
|
||||
@@ -478,7 +478,10 @@ RootParamList : EmptyExpression ',' { /* AsParamList only acceptable for HB_P_MA
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
EmptyExpression { HB_MACRO_DATA->iListElements = 1; $$ = hb_compExprAddListExpr( hb_compExprNewArgList( $1 ), $4 ); }
|
||||
EmptyExpression {
|
||||
HB_MACRO_DATA->iListElements = 1;
|
||||
$$ = hb_compExprAddListExpr( ( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PARE ) ? hb_compExprNewList( $1 ) : hb_compExprNewArgList( $1 ), $4 );
|
||||
}
|
||||
|
||||
AsParamList : RootParamList { $$ = $1; }
|
||||
| AsParamList ',' EmptyExpression { HB_MACRO_DATA->iListElements++; $$ = hb_compExprAddListExpr( $1, $3 ); }
|
||||
|
||||
@@ -258,6 +258,8 @@ 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;
|
||||
|
||||
int hb_vm_iExtraIndex;
|
||||
|
||||
/* Request for some action - stop processing of opcodes
|
||||
*/
|
||||
static USHORT s_uiActionRequest;
|
||||
@@ -1303,7 +1305,44 @@ 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 ), 0 );
|
||||
hb_macroGetValue( hb_stackItemFromTop( -1 ), HB_P_MACROPUSHINDEX );
|
||||
|
||||
if( hb_vm_iExtraIndex )
|
||||
{
|
||||
HB_ITEM *aExtraItems = hb_xgrab( sizeof( HB_ITEM ) * hb_vm_iExtraIndex );
|
||||
int i;
|
||||
|
||||
/* Storing and removing the extra indexes. */
|
||||
for ( i = hb_vm_iExtraIndex - 1; i >= 0; i-- )
|
||||
{
|
||||
hb_itemCopy( aExtraItems + i, hb_stackItemFromTop(-1) );
|
||||
hb_stackPop();
|
||||
}
|
||||
|
||||
/* First index is still on stack.*/
|
||||
hb_vmArrayPush();
|
||||
|
||||
/* Now process each of the additional index including the last one (we will skip the HB_P_ARRAYPUSH which is know to follow . */
|
||||
for ( i = 0; i < hb_vm_iExtraIndex; i++ )
|
||||
{
|
||||
hb_vmPush( aExtraItems + i );
|
||||
hb_vmArrayPush();
|
||||
}
|
||||
|
||||
hb_xfree( aExtraItems );
|
||||
|
||||
w++; // To force skip the HB_P_ARRAYPUSH (was already processed above).
|
||||
}
|
||||
|
||||
w++;
|
||||
break;
|
||||
|
||||
case HB_P_MACROPUSHPARE:
|
||||
/* 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_MACROPUSHPARE );
|
||||
w++;
|
||||
break;
|
||||
|
||||
|
||||
@@ -429,6 +429,8 @@ 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 int hb_vm_iExtraIndex;
|
||||
|
||||
extern PHB_SYMB hb_vm_apExtraParamsSymbol[HB_MAX_MACRO_ARGS];
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_macroGetValue(%p)", pItem));
|
||||
@@ -452,6 +454,11 @@ void hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext )
|
||||
struMacro.status = HB_MACRO_CONT;
|
||||
struMacro.iListElements = ( iContext ? 0 : -1 );
|
||||
|
||||
if( iContext == HB_P_MACROPUSHPARE )
|
||||
{
|
||||
struMacro.Flags |= HB_MACRO_GEN_PARE;
|
||||
}
|
||||
|
||||
#ifdef HB_MACRO_STATEMENTS
|
||||
slen = HB_MIN( strlen( szString ), HB_PP_STR_SIZE - 1 );
|
||||
memcpy( pText, szString, slen );
|
||||
@@ -498,6 +505,10 @@ void hb_macroGetValue( HB_ITEM_PTR pItem, BYTE iContext )
|
||||
{
|
||||
hb_vm_aiExtraElements[hb_vm_iExtraElementsIndex - 1] += struMacro.iListElements;
|
||||
}
|
||||
else if( iContext == HB_P_MACROPUSHINDEX )
|
||||
{
|
||||
hb_vm_iExtraIndex = struMacro.iListElements;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user