2007-06-01 15:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/harbour.spec
    * set attributes explicitly to clean some wrong attributes committed
      to CVS and minor cleanup

  * harbour/include/hbapierr.h
  * harbour/source/rtl/errorapi.c
    + added hb_errorBlock()

  * harbour/source/macro/macro.yyc
  * harbour/source/compiler/harbour.yyc
    * manual hack to pacify BCC warning messages

  * harbour/include/hbpcode.h
  * harbour/include/hbxvm.h
  * harbour/source/compiler/genc.c
  * harbour/source/compiler/gencc.c
  * harbour/source/compiler/harbour.y
  * harbour/source/compiler/harbour.yyc
  * harbour/source/compiler/hbdead.c
  * harbour/source/compiler/hbfix.c
  * harbour/source/compiler/hblbl.c
  * harbour/source/compiler/hbmain.c
  * harbour/source/compiler/hbopt.c
  * harbour/source/compiler/hbpcode.c
  * harbour/source/compiler/hbstripl.c
  * harbour/source/vm/hvm.c
    + added support for:
         BEGIN SEQUENCE WITH <errorBlockExp>
            [<statements;...>]
         [ RECOVER [ USING oErr ] ]
            ...
         [ ALWAYS ]
            ...
         END
      It works like normal BEGIN SEQUENCE but sets <errorBlockExp> as
      ErrorBlock() before executing <statements;...> and restore
      previous ErrorBlock() at the end or when exception will appear.
      I hope it will make some xHarbour user happy ;-)

  * harbour/include/hbcompat.ch
    + added preprocessor directive for TRY / CATCH / FINALLY / END
      working like in xHarbour - translated to:
         BEGIN SEQUENCE WITH { |oErr| Break( oErr ) }
            ...
         [ RECOVER [ USING oErr ] ]
            ...
         [ ALWAYS ]
            ...
         END
This commit is contained in:
Przemyslaw Czerpak
2007-06-01 13:12:29 +00:00
parent bbde486ff1
commit 581507c90d
20 changed files with 1922 additions and 1719 deletions

View File

@@ -8,6 +8,57 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-06-01 15:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/harbour.spec
* set attributes explicitly to clean some wrong attributes committed
to CVS and minor cleanup
* harbour/include/hbapierr.h
* harbour/source/rtl/errorapi.c
+ added hb_errorBlock()
* harbour/source/macro/macro.yyc
* harbour/source/compiler/harbour.yyc
* manual hack to pacify BCC warning messages
* harbour/include/hbpcode.h
* harbour/include/hbxvm.h
* harbour/source/compiler/genc.c
* harbour/source/compiler/gencc.c
* harbour/source/compiler/harbour.y
* harbour/source/compiler/harbour.yyc
* harbour/source/compiler/hbdead.c
* harbour/source/compiler/hbfix.c
* harbour/source/compiler/hblbl.c
* harbour/source/compiler/hbmain.c
* harbour/source/compiler/hbopt.c
* harbour/source/compiler/hbpcode.c
* harbour/source/compiler/hbstripl.c
* harbour/source/vm/hvm.c
+ added support for:
BEGIN SEQUENCE WITH <errorBlockExp>
[<statements;...>]
[ RECOVER [ USING oErr ] ]
...
[ ALWAYS ]
...
END
It works like normal BEGIN SEQUENCE but sets <errorBlockExp> as
ErrorBlock() before executing <statements;...> and restore
previous ErrorBlock() at the end or when exception will appear.
I hope it will make some xHarbour user happy ;-)
* harbour/include/hbcompat.ch
+ added preprocessor directive for TRY / CATCH / FINALLY / END
working like in xHarbour - translated to:
BEGIN SEQUENCE WITH { |oErr| Break( oErr ) }
...
[ RECOVER [ USING oErr ] ]
...
[ ALWAYS ]
...
END
2007-06-01 13:00 UTC+0200 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com)
* harbour/make_gnu.sh
* updated msgs

View File

@@ -295,6 +295,8 @@ case "`uname -m`" in
;;
esac
[ "%{?_with_odbc:1}" ] || rm -fR contrib/odbc
make -r
######################################################################
@@ -326,7 +328,7 @@ mkdir -p $HB_LIB_INSTALL
make -r -i install
[ "%{?_without_gtsln:1}" ] && rm -f $HB_LIB_INSTALL/libgtsln.a
[ "%{?_without_tip:1}" ] && rm -f $HB_LIB_INSTALL/libtip.a
[ "%{?_without_tip:1}" ] && rm -f $HB_LIB_INSTALL/libtip.a
[ "%{?_with_odbc:1}" ] || rm -f $HB_LIB_INSTALL/libhbodbc.a
[ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a
@@ -514,7 +516,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,755)
%doc ChangeLog
%doc ChangeLog*
%doc doc/*.txt
%doc doc/%{readme}
%doc doc/en/
@@ -537,10 +539,10 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/hbpp
%{_bindir}/hbmake
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*
%attr(644,root,root,755) %{_includedir}/%{name}/*
%files static
%defattr(-,root,root,755)
%defattr(644,root,root,755)
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/libcodepage.a
%{_libdir}/%{name}/libcommon.a
@@ -563,7 +565,7 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/%{name}/libusrrdd.a
%files contrib
%defattr(-,root,root,755)
%defattr(644,root,root,755)
%dir %{_libdir}/%{name}
%{?_with_odbc: %{_libdir}/%{name}/libhbodbc.a}
%{!?_without_nf: %{_libdir}/%{name}/libnf*.a}
@@ -580,7 +582,7 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/%{name}/libct.a
%files lib
%defattr(-,root,root,755)
%defattr(755,root,root,755)
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*.so
%{_libdir}/*.so

View File

@@ -179,9 +179,12 @@ typedef struct HB_ERROR_INFO_
HB_ITEM_PTR ErrorBlock;
} HB_ERROR_INFO, * HB_ERROR_INFO_PTR;
/* set/get current error handler */
/* set/get current error handler */
extern HB_EXPORT HB_ERROR_INFO_PTR hb_errorHandler( HB_ERROR_INFO_PTR pNewHandler );
/* current errorblock item */
extern HB_EXPORT PHB_ITEM hb_errorBlock( void );
HB_EXTERN_END
#endif /* HB_APIERR_H_ */

View File

@@ -84,9 +84,6 @@
#xtranslate hb_isregexstring([<xx>]) => hb_isregex([<xx>])
/* SWITCH ... ; case ... ; DEFAULT ; ... ; END */
#xcommand DEFAULT => OTHERWISE
#xtranslate HASH([<x,...>]) => HB_HASH([<x>])
#xtranslate HHASKEY([<x,...>]) => HB_HHASKEY([<x>])
#xtranslate HGETPOS([<x,...>]) => HB_HPOS([<x>])
@@ -118,6 +115,14 @@
#xcommand TEXT INTO <v> => #pragma __text|<v>+=%s+HB_OSNEWLINE();<v>:=""
/* SWITCH ... ; case ... ; DEFAULT ; ... ; END */
#xcommand DEFAULT => OTHERWISE
/* TRY / CATCH / FINALLY / END */
#xcommand TRY => BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
#xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
#xcommand FINALLY => ALWAYS
#endif
#endif /* __HARBOUR__ */

View File

@@ -249,7 +249,8 @@ typedef enum
HB_P_LOCALINCPUSH, /* 175 increments the local variable, push result on the stack */
HB_P_PUSHFUNCSYM, /* 176 places a symbol on the virtual machine stack */
HB_P_HASHGEN, /* 177 instructs the virtual machine to build a hash and load element from the stack */
HB_P_LAST_PCODE /* 178 this defines the number of defined pcodes */
HB_P_SEQBLOCK, /* 178 set BEQIN SEQUENCE WITH block */
HB_P_LAST_PCODE /* 179 this defines the number of defined pcodes */
} HB_PCODE;
#endif /* HB_PCODE_H_ */

View File

@@ -82,6 +82,7 @@ extern HB_EXPORT BOOL hb_xvmSeqRecover( void );
extern HB_EXPORT void hb_xvmSeqAlways( void );
extern HB_EXPORT BOOL hb_xvmAlwaysBegin( void );
extern HB_EXPORT BOOL hb_xvmAlwaysEnd( void );
extern HB_EXPORT BOOL hb_xvmSeqBlock( void );
extern HB_EXPORT BOOL hb_xvmEnumStart( BYTE, BYTE ); /* prepare FOR EACH loop */
extern HB_EXPORT BOOL hb_xvmEnumNext( void ); /* increment FOR EACH loop counter */

View File

@@ -1770,6 +1770,15 @@ static HB_GENC_FUNC( hb_p_pushovarref )
return 1;
}
static HB_GENC_FUNC( hb_p_seqblock )
{
HB_SYMBOL_UNUSED( pFunc );
HB_SYMBOL_UNUSED( lPCodePos );
fprintf( cargo->yyc, "\tHB_P_SEQBLOCK,\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_seqbegin )
{
fprintf( cargo->yyc, "\tHB_P_SEQBEGIN, %i, %i, %i,",
@@ -2511,7 +2520,8 @@ static const HB_GENC_FUNC_PTR s_verbose_table[] = {
hb_p_localinc,
hb_p_localincpush,
hb_p_pushfuncsym,
hb_p_hashgen
hb_p_hashgen,
hb_p_seqblock
};
static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc )

View File

@@ -1443,6 +1443,14 @@ static HB_GENC_FUNC( hb_p_alwaysend )
return 1;
}
static HB_GENC_FUNC( hb_p_seqblock )
{
HB_GENC_LABEL();
fprintf( cargo->yyc, "\tif( hb_xvmSeqBlock() ) break;\n" );
return 1;
}
static HB_GENC_FUNC( hb_p_seqbegin )
{
HB_GENC_LABEL();
@@ -2106,7 +2114,8 @@ static const HB_GENC_FUNC_PTR s_verbose_table[] = {
hb_p_localinc,
hb_p_localincpush,
hb_p_pushfuncsym,
hb_p_hashgen
hb_p_hashgen,
hb_p_seqblock
};
void hb_compGenCRealCode( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc )

View File

@@ -1729,50 +1729,62 @@ BeginSeq : BEGINSEQ /* 1 */
++HB_COMP_PARAM->wSeqCounter;
$<lNumber>$ = hb_compSequenceBegin( HB_COMP_PARAM );
}
Crlf /* 3 */
EmptyStats /* 4 */
{ /* 5 */
BlockSeq /* 3 */
Crlf /* 4 */
EmptyStats /* 5 */
{ /* 6 */
/* Set jump address for HB_P_SEQBEGIN opcode - this address
* will be used in BREAK code if there is no RECOVER clause
*/
if( $<lNumber>3 )
hb_compGenPCode1( HB_P_POP, HB_COMP_PARAM );
hb_compGenJumpHere( $<lNumber>2, HB_COMP_PARAM );
$<lNumber>$ = hb_compSequenceEnd( HB_COMP_PARAM );
}
RecoverSeq /* 6 */
{ /* 7 */
RecoverSeq /* 7 */
{ /* 8 */
/* Replace END address with RECOVER address in
* HB_P_SEQBEGIN opcode if there is RECOVER clause
*/
if( $<lNumber>6 )
hb_compGenJumpThere( $<lNumber>2, $<lNumber>6, HB_COMP_PARAM );
if( $<lNumber>7 )
hb_compGenJumpThere( $<lNumber>2, $<lNumber>7, HB_COMP_PARAM );
else if( HB_COMP_PARAM->wSeqCounter )
--HB_COMP_PARAM->wSeqCounter;
}
AlwaysSeq /* 8 */
{ /* 9 */
AlwaysSeq /* 9 */
{ /* 10 */
HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE );
if( $<lNumber>8 )
if( $<lNumber>9 )
{
/* replace END address with ALWAYS address in
HB_P_SEQEND opcode */
hb_compGenJumpThere( $<lNumber>5, $<lNumber>8, HB_COMP_PARAM );
hb_compGenJumpThere( $<lNumber>6, $<lNumber>9, HB_COMP_PARAM );
/* Fix ALWAYS address in HB_P_SEQALWAYS opcode */
hb_compGenJumpThere( $<lNumber>2 - 4, $<lNumber>8, HB_COMP_PARAM );
hb_compGenJumpThere( $<lNumber>2 - 4, $<lNumber>9, HB_COMP_PARAM );
/* Fix ALWAYSEND address in HB_P_ALWAYSBEGIN opcode */
hb_compGenJumpHere( $<lNumber>8 + 1, HB_COMP_PARAM );
hb_compGenJumpHere( $<lNumber>9 + 1, HB_COMP_PARAM );
hb_compGenPCode1( HB_P_ALWAYSEND, HB_COMP_PARAM );
}
else
{
/* Fix END address in HB_P_SEQEND opcode */
hb_compGenJumpHere( $<lNumber>5, HB_COMP_PARAM );
hb_compGenJumpHere( $<lNumber>6, HB_COMP_PARAM );
}
hb_compSequenceFinish( HB_COMP_PARAM, $<lNumber>2, $<lNumber>5, $<lNumber>8,
$<lNumber>4 != 0, $<lNumber>6 != 0 );
hb_compSequenceFinish( HB_COMP_PARAM, $<lNumber>2, $<lNumber>6, $<lNumber>9,
$<lNumber>5 != 0, $<lNumber>7 != 0 );
}
END /* 10 */
;
BlockSeq : /* no always */ { $<lNumber>$ = 0; }
| WITH Expression
{
HB_COMP_EXPR_DELETE( hb_compExprGenPush( $2, HB_COMP_PARAM ) );
hb_compGenPCode1( HB_P_SEQBLOCK, HB_COMP_PARAM );
$<lNumber>$ = HB_COMP_PARAM->functions.pLast->lPCodePos;
}
;
AlwaysSeq : /* no always */ { $<lNumber>$ = 0; }
| Always Crlf EmptyStats
;

File diff suppressed because it is too large Load Diff

View File

@@ -535,7 +535,8 @@ static const PHB_CODETRACE_FUNC s_codeTraceFuncTable[ HB_P_LAST_PCODE ] =
hb_p_default, /* HB_P_LOCALINC */
hb_p_default, /* HB_P_LOCALINCPUSH */
hb_p_default, /* HB_P_PUSHFUNCSYM */
hb_p_default /* HB_P_HASHGEN */
hb_p_default, /* HB_P_HASHGEN */
hb_p_default /* HB_P_SEQBLOCK */
};
void hb_compCodeTraceMarkDead( HB_COMP_DECL, PFUNCTION pFunc )

View File

@@ -327,7 +327,8 @@ static const HB_FIX_FUNC_PTR s_fixlocals_table[] =
hb_p_localfix, /* HB_P_LOCALINC */
hb_p_localfix, /* HB_P_LOCALINCPUSH */
NULL, /* HB_P_PUSHFUNCSYM */
NULL /* HB_P_HASHGEN */
NULL, /* HB_P_HASHGEN */
NULL /* HB_P_SEQBLOCK */
};
void hb_compFixFuncPCode( HB_COMP_DECL, PFUNCTION pFunc )

View File

@@ -371,7 +371,8 @@ static const PHB_LABEL_FUNC s_GenLabelFuncTable[ HB_P_LAST_PCODE ] =
NULL, /* HB_P_LOCALINC */
NULL, /* HB_P_LOCALINCPUSH */
NULL, /* HB_P_PUSHFUNCSYM */
NULL /* HB_P_HASHGEN */
NULL, /* HB_P_HASHGEN */
NULL /* HB_P_SEQBLOCK */
};
void hb_compGenLabelTable( PFUNCTION pFunc, PHB_LABEL_INFO label_info )

View File

@@ -3617,34 +3617,55 @@ ULONG hb_compSequenceAlways( HB_COMP_DECL )
void hb_compSequenceFinish( HB_COMP_DECL, ULONG ulStartPos, ULONG ulEndPos,
ULONG ulAlways, BOOL fUsualStmts, BOOL fRecover )
{
--ulStartPos; /* remove also HB_P_SEQBEGIN */
--ulStartPos; /* HB_P_SEQBEGIN address */
if( !ulAlways )
if( !fUsualStmts && !HB_COMP_PARAM->fDebugInfo )
{
/* remove HB_P_SEQALWAYS */
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos - 4, 4 );
}
else if( !fRecover )
{
/* remove HB_P_SEQBEGIN and HB_P_SEQEND */
hb_compRemovePCODE( HB_COMP_PARAM, ulEndPos - 1, 4 );
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos, 4 );
if( ! HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) )
ulStartPos -= 4;
if( ulAlways )
{
/* Fix ALWAYS address in HB_P_SEQALWAYS opcode */
hb_compGenJumpThere( ulStartPos - 3, ulAlways - 8, HB_COMP_PARAM );
/* remove HB_P_ALWAYSEND opcode */
HB_COMP_PARAM->functions.pLast->lPCodePos--;
/* remove HB_P_SEQALWAYS ... HB_P_ALWAYSBEGIN opcodes */
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos,
ulAlways - ulStartPos + 4 );
}
}
if( ! HB_COMP_PARAM->fDebugInfo ) /* only if no debugger info is required */
{
if( !fUsualStmts && !ulAlways )
else
{
HB_COMP_PARAM->lastLinePos = ulStartPos - 3;
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos,
HB_COMP_PARAM->functions.pLast->lPCodePos -
ulStartPos );
}
HB_COMP_PARAM->lastLinePos = ulStartPos - 3;
}
else if( !ulAlways )
{
/* remove HB_P_SEQALWAYS opcode */
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos - 4, 4 );
}
else
{
if( !fRecover )
{
/* remove HB_P_SEQBEGIN and HB_P_SEQEND */
hb_compRemovePCODE( HB_COMP_PARAM, ulEndPos - 1, 4 );
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos, 4 );
if( ! HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) )
{
/* Fix ALWAYS address in HB_P_SEQALWAYS opcode */
ulAlways -= 8;
hb_compGenJumpThere( ulStartPos - 3, ulAlways, HB_COMP_PARAM );
}
}
/* empty always block? */
if( HB_COMP_PARAM->functions.pLast->lPCodePos - ulAlways == 5 &&
!HB_COMP_PARAM->fDebugInfo )
{
/* remove HB_P_ALWAYSBEGIN and HB_P_ALWAYSEND opcodes */
hb_compRemovePCODE( HB_COMP_PARAM, ulAlways, 5 );
/* remove HB_P_SEQALWAYS opcode */
hb_compRemovePCODE( HB_COMP_PARAM, ulStartPos - 4, 4 );
}
}
}

View File

@@ -744,7 +744,8 @@ static const HB_OPT_FUNC_PTR s_opt_table[] =
NULL, /* HB_P_LOCALINC */
NULL, /* HB_P_LOCALINCPUSH */
NULL, /* HB_P_PUSHFUNCSYM */
NULL /* HB_P_HASHGEN */
NULL, /* HB_P_HASHGEN */
NULL /* HB_P_SEQBLOCK */
};
void hb_compOptimizePCode( HB_COMP_DECL, PFUNCTION pFunc )

View File

@@ -302,7 +302,8 @@ const BYTE hb_comp_pcode_len[] = {
3, /* HB_P_LOCALINC */
3, /* HB_P_LOCALINCPUSH */
3, /* HB_P_PUSHFUNCSYM */
3 /* HB_P_HASHGEN */
3, /* HB_P_HASHGEN */
1 /* HB_P_SEQBLOCK */
};
/*
@@ -491,7 +492,8 @@ static HB_PCODE_FUNC_PTR s_psize_table[] =
NULL, /* HB_P_LOCALINC */
NULL, /* HB_P_LOCALINCPUSH */
NULL, /* HB_P_PUSHFUNCSYM */
NULL /* HB_P_HASHGEN */
NULL, /* HB_P_HASHGEN */
NULL /* HB_P_SEQBLOCK */
};
LONG hb_compPCodeSize( PFUNCTION pFunc, ULONG ulOffset )

View File

@@ -256,7 +256,8 @@ static const PHB_STRIP_FUNC s_stripLines_table[] =
NULL, /* HB_P_LOCALINC */
NULL, /* HB_P_LOCALINCPUSH */
NULL, /* HB_P_PUSHFUNCSYM */
NULL /* HB_P_HASHGEN */
NULL, /* HB_P_HASHGEN */
NULL /* HB_P_SEQBLOCK */
};
void hb_compStripFuncLines( PFUNCTION pFunc )

View File

@@ -2993,6 +2993,7 @@ yyerrlab:
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
#if 0
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
@@ -3010,6 +3011,7 @@ yyerrorlab:
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
#endif
/*-------------------------------------------------------------.

View File

@@ -154,6 +154,11 @@ HB_FUNC( ERRORBLOCK )
}
}
PHB_ITEM hb_errorBlock( void )
{
return s_errorBlock;
}
/* set new low-level error launcher (C function) and return
* handler currently active
*/

View File

@@ -124,6 +124,7 @@ static void hb_vmGreater( void ); /* checks if the latest - 1 value i
static void hb_vmGreaterEqual( void ); /* checks if the latest - 1 value is greater than or equal the latest, removes both and leaves result */
static void hb_vmInstring( void ); /* check whether string 1 is contained in string 2 */
static void hb_vmForTest( void ); /* test for end condition of for */
static void hb_vmSeqBlock( void ); /* set begin sequence WITH codeblock */
static void hb_vmWithObjectStart( void ); /* prepare WITH OBJECT block */
static void hb_vmEnumStart( BYTE, BYTE ); /* prepare FOR EACH loop */
static void hb_vmEnumNext( void ); /* increment FOR EACH loop counter */
@@ -1158,6 +1159,11 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
/* BEGIN SEQUENCE/RECOVER/ALWAYS/END SEQUENCE */
case HB_P_SEQBLOCK:
hb_vmSeqBlock();
w++;
break;
case HB_P_SEQALWAYS:
{
/*
@@ -1248,6 +1254,7 @@ HB_EXPORT void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols )
w++;
break;
}
case HB_P_SEQBEGIN:
{
/*
@@ -3498,6 +3505,38 @@ static void hb_vmForTest( void ) /* Test to check the end point of the FO
hb_vmGreater();
}
/* Begin Sequence WITH block auto destructor */
static HB_GARBAGE_FUNC( hb_SeqBlockDestructor )
{
PHB_ITEM * pBlockPtr = ( PHB_ITEM * ) Cargo;
hb_itemMove( hb_errorBlock(), * pBlockPtr );
hb_itemRelease( * pBlockPtr );
}
static void hb_vmSeqBlock( void )
{
PHB_ITEM pItem;
HB_TRACE(HB_TR_DEBUG, ("hb_vmSeqBlock()"));
pItem = hb_stackItemFromTop( -1 );
if( HB_IS_BLOCK( pItem ) )
{
PHB_ITEM * pBlockPtr, pBlock, pHolder;
pBlock = hb_errorBlock();
pHolder = hb_itemNew( pBlock );
hb_itemMove( pBlock, pItem );
pBlockPtr = ( PHB_ITEM * ) hb_gcAlloc( sizeof( PHB_ITEM ),
hb_SeqBlockDestructor );
* pBlockPtr = pHolder;
pItem->type = HB_IT_POINTER;
pItem->item.asPointer.value = pBlockPtr;
pItem->item.asPointer.collect = pItem->item.asPointer.single = TRUE;
}
}
/* With object auto destructor */
static HB_GARBAGE_FUNC( hb_withObjectDestructor )
{
@@ -3509,9 +3548,9 @@ static void hb_vmWithObjectStart( void )
{
LONG * plWithObjectBase;
PHB_ITEM pItem;
HB_TRACE(HB_TR_DEBUG, ("hb_vmWithObjectStart()"));
pItem = hb_stackAllocItem();
plWithObjectBase = ( LONG * ) hb_gcAlloc( sizeof( LONG ),
hb_withObjectDestructor );
@@ -6999,6 +7038,15 @@ HB_EXPORT BOOL hb_xvmAlwaysEnd( void )
HB_XVM_RETURN
}
HB_EXPORT BOOL hb_xvmSeqBlock( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_xvmSeqBlock()"));
hb_vmSeqBlock();
HB_XVM_RETURN
}
HB_EXPORT BOOL hb_xvmEnumStart( BYTE nVars, BYTE nDescend )
{
HB_TRACE(HB_TR_DEBUG, ("hb_xvmEnumStart(%d,%d)", nVars, nDescend));