From e84bc8428cbca791d7e62965caf2811f8e12a8a8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 8 Aug 1999 10:19:56 +0000 Subject: [PATCH] 19990808-11:50 GMT+1 --- harbour/ChangeLog | 9 ++++++++ harbour/include/run_exp.h | 2 +- harbour/source/rtl/errorapi.c | 39 +++++++++++++++++----------------- harbour/source/runner/Makefile | 5 ++++- harbour/source/runner/runner.c | 10 ++++----- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9ccd39ebbc..bd865f80fd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +19990808-11:50 GMT+1 Victor Szel + * source/runner/runner.c + source/runner/Makefile + include/run_exp.h + ! Some missed name changes adapted. + * source/rtl/errorapi.c + ! hb_vmPushlogical() uses BOOL. + + Some improvement in _errLaunch(). + 19990808-10:05 GMT+1 Antonio Linares * makefile.b32 * setkey and devoutp were not properly referenced diff --git a/harbour/include/run_exp.h b/harbour/include/run_exp.h index 685da4e723..d3697e34f0 100644 --- a/harbour/include/run_exp.h +++ b/harbour/include/run_exp.h @@ -77,7 +77,7 @@ HARBOUR HB___MVPRIVATE(); */ HB_INIT_SYMBOLS_BEGIN( RUNNER ) -{ "HB_RUN", FS_PUBLIC, HB_HB_RUN , 0 }, +{ "MAIN", FS_PUBLIC, HB_MAIN , 0 }, { "__AGLOBALSTACK", FS_PUBLIC, HB___AGLOBALSTACK , 0 }, { "__APARAM", FS_PUBLIC, HB___APARAM , 0 }, { "__ASTACK", FS_PUBLIC, HB___ASTACK , 0 }, diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index bc2c53cb8c..42c2aec657 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -41,11 +41,6 @@ PHB_ITEM hb_errNew( void ) return pReturn; } -/* QUESTION: When does Clipper show this: */ -/* TODO: Change to internal error: */ -/* printf("Error recovery failure, ???? (0)") */ -/* exit(1); */ - WORD hb_errLaunch( PHB_ITEM pError ) { WORD wRetVal; @@ -55,12 +50,13 @@ WORD hb_errLaunch( PHB_ITEM pError ) /* TODO: Determine if there was a BREAK in error handler. */ BOOL bBreak = FALSE; WORD nSequenceLevel = 0; + USHORT uiFlags = hb_errGetFlags( pError ); if ( ! IS_BLOCK( &errorBlock ) ) { /* TODO: Change to internal error: */ printf( "No ERRORBLOCK() for error at: ???? (0)" ); - exit( 1 ); + exit( 1 ); /* TODO: quit correctly */ } hb_vmPushSymbol( &symEval ); @@ -68,24 +64,27 @@ WORD hb_errLaunch( PHB_ITEM pError ) hb_vmPush( pError ); hb_vmDo( 1 ); - /* TODO: Handle the canSubstitute case somehow */ - /* Clipper doesn't document the case where canSubstitute is set */ - if ( bBreak ) { - if ( nSequenceLevel ) - { - wRetVal = E_BREAK; - } - else - { - exit( 1 ); /* TODO: quit correctly */ - } + wRetVal = E_BREAK; } else if ( IS_LOGICAL( &stack.Return ) ) + { wRetVal = stack.Return.item.asLogical.value ? E_RETRY : E_DEFAULT; + } else + { wRetVal = E_DEFAULT; + } + + if ( ( wRetVal == E_BREAK && nSequenceLevel == 0 ) || + ( wRetVal == E_DEFAULT && !( uiFlags & EF_CANDEFAULT ) ) || + ( wRetVal == E_RETRY && !( uiFlags & EF_CANRETRY ) ) ) + { + /* TODO: Change to internal error: */ + printf("Error recovery failure, ???? (0)"); + exit( 1 ); /* TODO: quit correctly */ + } } else wRetVal = E_RETRY; @@ -296,21 +295,21 @@ PHB_ITEM hb_errPutFlags( PHB_ITEM pError, USHORT uiFlags ) { hb_vmPushSymbol( hb_dynsymGet( "_CANRETRY" )->pSymbol ); hb_vmPush( pError ); - hb_vmPushLogical( uiFlags & EF_CANRETRY ); + hb_vmPushLogical( ( uiFlags & EF_CANRETRY ) ? TRUE : FALSE ); hb_vmDo( 1 ); /* ; */ hb_vmPushSymbol( hb_dynsymGet( "_CANSUBSTITUTE" )->pSymbol ); hb_vmPush( pError ); - hb_vmPushLogical( uiFlags & EF_CANSUBSTITUTE ); + hb_vmPushLogical( ( uiFlags & EF_CANSUBSTITUTE ) ? TRUE : FALSE ); hb_vmDo( 1 ); /* ; */ hb_vmPushSymbol( hb_dynsymGet( "_CANDEFAULT" )->pSymbol ); hb_vmPush( pError ); - hb_vmPushLogical( uiFlags & EF_CANDEFAULT ); + hb_vmPushLogical( ( uiFlags & EF_CANDEFAULT ) ? TRUE : FALSE ); hb_vmDo( 1 ); /* ; */ diff --git a/harbour/source/runner/Makefile b/harbour/source/runner/Makefile index 8e41e71de3..3ae96c60d9 100644 --- a/harbour/source/runner/Makefile +++ b/harbour/source/runner/Makefile @@ -9,8 +9,11 @@ C_SOURCES=\ C_MAIN=runner.c LIBS=\ + tools \ + debug \ + rdd \ vm \ rtl \ - tools \ + hbpp \ include $(TOP)$(ROOT)config/bin.cf diff --git a/harbour/source/runner/runner.c b/harbour/source/runner/runner.c index e18a8a072d..968cdf76ee 100644 --- a/harbour/source/runner/runner.c +++ b/harbour/source/runner/runner.c @@ -39,11 +39,11 @@ static BYTE prgFunction[] = { 0x68, 0x00, 0x00, 0x00, 0x00, 0xC3 }; /* push offset pcode push offset symbols - call near relative VirtualMachine + call near relative hb_vmExecute add esp, 8 ret near */ - /* This is the assembler output from : VirtualMachine(pcode,symbols). */ + /* This is the assembler output from : hb_vmExecute(pcode,symbols). */ /* #elseif INTEL16 */ /* #elseif MOTOROLA */ @@ -196,7 +196,7 @@ HARBOUR HB_MAIN( void ) } } - ProcessSymbols( pSymRead, ulSymbols ); + hb_vmProcessSymbols( pSymRead, ulSymbols ); /* Initialize static variables first */ @@ -446,8 +446,8 @@ static PASM_CALL CreateFun( PHB_SYMB pSymbols, BYTE * pCode ) Patch( asmRet->pAsmData, 1, pSymbols ); /* Insert pointer to testsym */ Patch( asmRet->pAsmData, 6, pCode); /* Insert pointer to testcode */ - PatchRelative( asmRet->pAsmData, 11, &VirtualMachine, 15 ); - /* Insert pointer to VirtualMachine() */ + PatchRelative( asmRet->pAsmData, 11, &hb_vmExecute, 15 ); + /* Insert pointer to hb_vmExecute() */ /* #elseif INTEL16 */ /* #elseif MOTOROLA */