2008-10-09 14:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/hvm.c
    * changed the place where exception handles are set/remove.
      Now it's set at the beginning of hb_vmInit() and removed
      at the end of hb_vmQuit()

  * harbour/source/rdd/dbcmd.c
  * harbour/source/rdd/dbf1.c
    ! added workaround for problem with EVAL block used in PACK
      command

  * harbour/source/compiler/hbmain.c
    * minor simplification
This commit is contained in:
Przemyslaw Czerpak
2008-10-09 12:11:49 +00:00
parent 94c54208ae
commit cb836d8481
5 changed files with 68 additions and 27 deletions

View File

@@ -8,6 +8,20 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-09 14:11 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/hvm.c
* changed the place where exception handles are set/remove.
Now it's set at the beginning of hb_vmInit() and removed
at the end of hb_vmQuit()
* harbour/source/rdd/dbcmd.c
* harbour/source/rdd/dbf1.c
! added workaround for problem with EVAL block used in PACK
command
* harbour/source/compiler/hbmain.c
* minor simplification
2008-10-09 05:02 UTC-0500 Teo Fonrouge (teo/at/windtelsoft/dot/com)
* bin/hb_flst.tmp
* bin/pack_src.sh

View File

@@ -333,16 +333,6 @@ static PCOMSYMBOL hb_compSymbolFind( HB_COMP_DECL, const char * szSymbolName, US
return NULL;
}
/* NOTE: Name of symbols are released in hbident.c on exit */
static PCOMSYMBOL hb_compSymbolKill( PCOMSYMBOL pSym )
{
PCOMSYMBOL pNext = pSym->pNext;
hb_xfree( ( void * ) pSym );
return pNext;
}
/* returns a symbol name based on its index on the symbol table
* index starts from 0
*/
@@ -4133,12 +4123,11 @@ void hb_compCompileEnd( HB_COMP_DECL )
}
HB_COMP_PARAM->pLastClass = NULL;
if( HB_COMP_PARAM->symbols.pFirst )
while( HB_COMP_PARAM->symbols.pFirst )
{
PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst;
while( pSym )
pSym = hb_compSymbolKill( pSym );
HB_COMP_PARAM->symbols.pFirst = NULL;
HB_COMP_PARAM->symbols.pFirst = pSym->pNext;
hb_xfree( ( void * ) pSym );
}
}

View File

@@ -600,9 +600,11 @@ HB_FUNC( __DBPACK )
hb_itemRelease( pArea->valResult );
pArea->valResult = hb_itemArrayNew( 2 );
hb_arraySet( pArea->valResult, 1, pBlock );
pEvery = hb_param( 2, HB_IT_ANY );
if( pEvery && HB_IS_NUMERIC( pEvery ) )
pEvery = hb_param( 2, HB_IT_NUMERIC );
if( pEvery )
hb_arraySet( pArea->valResult, 2, pEvery );
else
hb_arraySetNI( pArea->valResult, 2, 0 );
}
else
{

View File

@@ -4168,17 +4168,25 @@ static ERRCODE hb_dbfPack( DBFAREAP pArea )
if( SELF_GOCOLD( ( AREAP ) pArea ) != SUCCESS )
return FAILURE;
if( HB_IS_ARRAY( pArea->valResult ) && hb_arrayLen( pArea->valResult ) == 2 )
/* This is bad hack but looks that people begins to use it :-(
* so I'll add workaround to make it m ore safe
*/
if( pArea->valResult && HB_IS_ARRAY( pArea->valResult ) &&
hb_arrayLen( pArea->valResult ) == 2 &&
( hb_arrayGetType( pArea->valResult, 1 ) & HB_IT_BLOCK ) != 0 &&
( hb_arrayGetType( pArea->valResult, 2 ) & HB_IT_NUMERIC ) != 0 )
{
pBlock = hb_arrayGetItemPtr( pArea->valResult, 1 );
ulUserEvery = hb_arrayGetNL( pArea->valResult, 2 );
if( ulUserEvery < 1 )
pBlock = hb_itemNew( NULL );
hb_arrayGet( pArea->valResult, 1, pBlock );
if( hb_arrayGetND( pArea->valResult, 2 ) >= 1 )
ulUserEvery = hb_arrayGetNL( pArea->valResult, 2 );
else
ulUserEvery = 1;
}
else
{
pBlock = NULL;
ulUserEvery = 1;
ulUserEvery = 0;
}
ulRecOut = ulEvery = 0;
@@ -4186,9 +4194,17 @@ static ERRCODE hb_dbfPack( DBFAREAP pArea )
while( ulRecIn <= pArea->ulRecCount )
{
if( SELF_GOTO( ( AREAP ) pArea, ulRecIn ) != SUCCESS )
{
if( pBlock )
hb_itemRelease( pBlock );
return FAILURE;
}
if( !hb_dbfReadRecord( pArea ) )
{
if( pBlock )
hb_itemRelease( pBlock );
return FAILURE;
}
/* Execute the Code Block */
if( pBlock )
@@ -4197,12 +4213,19 @@ static ERRCODE hb_dbfPack( DBFAREAP pArea )
{
ulEvery = 0;
if( SELF_EVALBLOCK( ( AREAP ) pArea, pBlock ) != SUCCESS )
{
hb_itemRelease( pBlock );
return FAILURE;
}
}
}
if( SELF_PACKREC( ( AREAP ) pArea, ulRecOut + 1, &fWritten ) != SUCCESS )
{
if( pBlock )
hb_itemRelease( pBlock );
return FAILURE;
}
if( fWritten )
{
@@ -4212,17 +4235,28 @@ static ERRCODE hb_dbfPack( DBFAREAP pArea )
pArea->ulRecNo = ulRecOut;
pArea->fRecordChanged = TRUE;
if( ! hb_dbfWriteRecord( pArea ) )
{
if( pBlock )
hb_itemRelease( pBlock );
return FAILURE;
}
}
}
ulRecIn++;
}
/* Execute the Code Block for pending record */
if( pBlock && ulEvery > 0 )
if( pBlock )
{
if( SELF_EVALBLOCK( ( AREAP ) pArea, pBlock ) != SUCCESS )
return FAILURE;
if( ulEvery > 0 )
{
if( SELF_EVALBLOCK( ( AREAP ) pArea, pBlock ) != SUCCESS )
{
hb_itemRelease( pBlock );
return FAILURE;
}
}
hb_itemRelease( pBlock );
}
if( pArea->ulRecCount != ulRecOut )

View File

@@ -835,6 +835,8 @@ HB_EXPORT void hb_vmInit( BOOL bStartMainProc )
hb_xinit();
hb_vmSetExceptionHandler();
#if defined( HB_MT_VM )
hb_threadInit();
hb_vmStackInit( hb_threadStateNew() ); /* initialize HVM thread stack */
@@ -956,8 +958,6 @@ HB_EXPORT void hb_vmInit( BOOL bStartMainProc )
int i;
int iArgCount;
hb_vmSetExceptionHandler();
hb_vmPushSymbol( s_pSymStart ); /* pushes first HB_FS_PUBLIC defined symbol to the stack */
hb_vmPushNil(); /* places NIL at self */
@@ -976,7 +976,6 @@ HB_EXPORT void hb_vmInit( BOOL bStartMainProc )
hb_vmDo( ( USHORT ) iArgCount ); /* invoke it with number of supplied parameters */
hb_vmUnsetExceptionHandler();
}
}
@@ -1050,6 +1049,9 @@ HB_EXPORT int hb_vmQuit( void )
/* release all known garbage */
if( hb_xquery( HB_MEM_USEDMAX ) == 0 ) /* check if fmstat is ON */
hb_gcReleaseAll();
hb_vmUnsetExceptionHandler();
hb_xexit();
return s_nErrorLevel;