2006-09-19 18:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbexprb.c
  * harbour/source/vm/hvm.c
    + added support to compiler for sending messages with multi
      parameters resolved by macro operator: s:="1,2,3"; o:msg(&s)
      It works just like for functions and it also needs XBASE extension
      support enabled during compilation, -kx switch in compiler, it's
      enabled by default.

  * harbour/source/rdd/usrrdd/usrrdd.c
    ! added missing DBOI_* index in parameters passed to user ORDINFO()
      method.
This commit is contained in:
Przemyslaw Czerpak
2006-09-19 16:40:42 +00:00
parent 18f74581d1
commit f63bc1dc8c
4 changed files with 62 additions and 18 deletions

View File

@@ -8,6 +8,19 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
arguments are passed ( HB_APARAMS() == HB_APARAMS(0) )
SYNTAX for variable number of parameters
1) [FUNCTION|PROCEDURE] name( ... )
or
2) [FUNCTION|PROCEDURE] name( var1, var2, varN, ... )
To access passed parameters use the following:
PCOUNT() - returns number of passed parameters
HB_PVALUE( iParamNum ) - returns <iParamNum> parameter
HB_APARAMS() - returns array with all passed parameters
or usual name of parameter variable in case of syntax 2)
2006-09-19 18:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbexprb.c

View File

@@ -1657,22 +1657,22 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
if( ( strcmp( "AT", pName->value.asSymbol ) == 0 ) && usCount == 2 )
{
hb_compExprReduceAT( pSelf, HB_MACRO_PARAM );
hb_compExprReduceAT( pSelf, HB_MACRO_PARAM );
}
else if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && usCount )
{
hb_compExprReduceCHR( pSelf, HB_MACRO_PARAM );
}
else if( ( strcmp( "LEN", pName->value.asSymbol ) == 0 ) && usCount )
{
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) )
hb_compExprReduceLEN( pSelf, HB_MACRO_PARAM );
}
else if( ( strcmp( "ASC", pName->value.asSymbol ) == 0 ) && usCount )
{
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) )
hb_compExprReduceASC( pSelf, HB_MACRO_PARAM );
}
else if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && usCount )
{
hb_compExprReduceCHR( pSelf, HB_MACRO_PARAM );
}
else if( ( strcmp( "LEN", pName->value.asSymbol ) == 0 ) && usCount )
{
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) )
hb_compExprReduceLEN( pSelf, HB_MACRO_PARAM );
}
else if( ( strcmp( "ASC", pName->value.asSymbol ) == 0 ) && usCount )
{
if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) )
hb_compExprReduceASC( pSelf, HB_MACRO_PARAM );
}
}
}
break;
@@ -2197,6 +2197,7 @@ static HB_EXPR_FUNC( hb_compExprUseSend )
if( pSelf->value.asMessage.pParms ) /* Is it a method call ? */
{
BOOL fMacroList = FALSE;
int iParms = hb_compExprListLen( pSelf->value.asMessage.pParms );
HB_EXPR_PCODE2( hb_compGenMessage, pSelf->value.asMessage.szMessage, bIsObject );
if( bIsObject )
@@ -2210,9 +2211,37 @@ static HB_EXPR_FUNC( hb_compExprUseSend )
if( iParms == 1 && pSelf->value.asMessage.pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
--iParms;
if( iParms )
HB_EXPR_USE( pSelf->value.asMessage.pParms, HB_EA_PUSH_PCODE );
{
if( HB_SUPPORT_XBASE )
{
/* check if &macro is used as a function call argument */
HB_EXPR_PTR pExpr = pSelf->value.asMessage.pParms->value.asList.pExprList;
while( pExpr )
{
if( pExpr->ExprType == HB_ET_MACRO )
{
/* &macro was passed - handle it differently then in a normal statement */
pExpr->value.asMacro.SubType |= HB_ET_MACRO_LIST;
pExpr->value.asMacro.pFunCall = pSelf;
fMacroList = TRUE;
}
pExpr = pExpr->pNext;
}
}
if( fMacroList )
{
pSelf->value.asMessage.pParms->ExprType = HB_ET_MACROARGLIST;
iParms = hb_compExprMacroListLen( pSelf->value.asMessage.pParms );
HB_EXPR_USE( pSelf->value.asMessage.pParms, HB_EA_PUSH_PCODE );
pSelf->value.asMessage.pParms->ExprType = HB_ET_ARGLIST;
}
else
HB_EXPR_USE( pSelf->value.asMessage.pParms, HB_EA_PUSH_PCODE );
}
if( iParms > 255 )
if( fMacroList )
HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_MACROSEND, HB_LOBYTE( iParms ), HB_HIBYTE( iParms ), ( BOOL ) 1 );
else if( iParms > 255 )
HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_SEND, HB_LOBYTE( iParms ), HB_HIBYTE( iParms ), ( BOOL ) 1 );
else
HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, ( BYTE ) iParms, ( BOOL ) 1 );

View File

@@ -2241,8 +2241,9 @@ static ERRCODE hb_usrOrderInfo( AREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde
pItem = hb_usrOrderInfoToItem( pOrderInfo );
hb_vmPushInteger( pArea->uiArea );
hb_vmPushInteger( uiIndex );
hb_vmPush( pItem );
hb_vmDo( 2 );
hb_vmDo( 3 );
pResult = hb_arrayGetItemPtr( pItem, UR_ORI_RESULT );
if( pResult && !HB_IS_NIL( pResult ) )

View File

@@ -3912,6 +3912,7 @@ static void hb_vmMacroSend( USHORT uiArgSets )
lArgs = hb_vmArgsJoin( -1, uiArgSets );
hb_stackDecrease( uiArgSets );
hb_vmSend( lArgs );
hb_stackPushReturn();
}
static void hb_vmMacroArrayGen( USHORT uiArgSets )