New function HB_ForNext() added
This commit is contained in:
@@ -342,4 +342,49 @@ void hb_evalBlock( PHB_ITEM pCodeBlock, ... )
|
||||
va_end( args );
|
||||
|
||||
hb_vmFunction( uiParams );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_FORNEXT ) /* nStart, nEnd | bEnd, bCode, nStep */
|
||||
{
|
||||
LONG lStart = hb_parnl( 1 ), lEnd;
|
||||
PHB_ITEM pEndBlock = hb_param( 2, HB_IT_BLOCK );
|
||||
PHB_ITEM pCodeBlock = hb_param( 3, HB_IT_BLOCK );
|
||||
LONG lStep = ( hb_pcount() > 3 ) ? hb_parnl( 4 ) : 1;
|
||||
|
||||
if( ! pEndBlock )
|
||||
lEnd = hb_parnl( 2 );
|
||||
|
||||
if( pCodeBlock )
|
||||
{
|
||||
if( pEndBlock )
|
||||
{
|
||||
hb_evalBlock0( pEndBlock );
|
||||
lEnd = hb_parnl( -1 );
|
||||
|
||||
while( lStart <= lEnd )
|
||||
{
|
||||
hb_vmPushSymbol( &hb_symEval );
|
||||
hb_vmPush( pCodeBlock );
|
||||
hb_vmPushLong( lStart );
|
||||
hb_vmFunction( 1 );
|
||||
|
||||
lStart += lStep;
|
||||
|
||||
hb_evalBlock0( pEndBlock );
|
||||
lEnd = hb_parnl( -1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while( lStart <= lEnd )
|
||||
{
|
||||
hb_vmPushSymbol( &hb_symEval );
|
||||
hb_vmPush( pCodeBlock );
|
||||
hb_vmPushLong( lStart );
|
||||
hb_vmFunction( 1 );
|
||||
|
||||
lStart += lStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user