From 011d73157d25bc0791ea91e91ed8b1d0ff81c691 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 2 Oct 2008 21:49:11 +0000 Subject: [PATCH] 2008-10-02 23:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/hbsetup.ch ! Removed some company names from comments. * source/vm/extrap.c + Added //BATCH internal switch to indicate exception handler to suppress the Windows exception dialog when an exception occurs. Useful for programs running without user interaction. NOTE: This may not be the ultimate method. If we can gather more such situations where such "batch" mode might be useful, we may as well implement it as a Set(). - Removed Harbour specific exception MessageBox(). Besides having gotten rid of a MessageBox() call in core VM, Harbour now got back the standard Windows error handling dialog, which is more standard and easy to get by than the previous default method, where several clicks were needed to pass through the (sometimes hidden) popups. The details of all GPFs are still logged into hb_out.log. + Removed size limit for the logged exception call stack. --- harbour/ChangeLog | 37 ++++++++++++++++++++++++++++++ harbour/include/hbsetup.ch | 10 ++++---- harbour/source/vm/extrap.c | 47 ++++++++++++-------------------------- 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 510ba88a89..b4152c1e20 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,43 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-02 23:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * include/hbsetup.ch + ! Removed some company names from comments. + + * source/vm/extrap.c + + Added //BATCH internal switch to indicate exception handler + to suppress the Windows exception dialog when an exception + occurs. Useful for programs running without user interaction. + NOTE: This may not be the ultimate method. If we can gather + more such situations where such "batch" mode might + be useful, we may as well implement it as a Set(). + - Removed Harbour specific exception MessageBox(). Besides + having gotten rid of a MessageBox() call in core VM, Harbour now + got back the standard Windows error handling dialog, which is + more standard and easy to get by than the previous default + method, where several clicks were needed to pass through + the (sometimes hidden) popups. The details of all GPFs are + still logged into hb_out.log. + + Removed size limit for the logged exception call stack. + +2008-10-02 23:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * include/hbsetup.ch + ! Removed some company names from comments. + + * source/vm/extrap.c + + Added //BATCH internal switch to indicate exception handler + to suppress the Windows exception dialog when an exception + occurs. Useful for programs running without user interaction. + - Removed Harbour specific exception MessageBox(). Besides + having gotten rid of a MessageBox() call in core VM, Harbour now + got back the standard Windows error handling dialog, which is + more standard and easy to get by than the previous default + method, where several clicks were needed to pass through + the (sometimes hidden) popups. The details of all GPFs are + still logged into hb_out.log. + + Removed size limit for the logged exception call stack. + 2008-10-02 21:12 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rdd/sdf1.c ! fixed stupid typo (missing !) in last modification which broke diff --git a/harbour/include/hbsetup.ch b/harbour/include/hbsetup.ch index 555b77121a..9fbfe32b35 100644 --- a/harbour/include/hbsetup.ch +++ b/harbour/include/hbsetup.ch @@ -60,11 +60,11 @@ different Clipper implementations. */ /* #define HB_EXTENSION */ /* Enable Harbour non-portable extensions */ -#define HB_C52_UNDOC /* Enable CA-Cl*pper 5.2e/5.3x undocumented features */ -/* #define HB_C52_STRICT */ /* Enable CA-Cl*pper 5.2e/5.3x strict compatibility */ -#define HB_COMPAT_C53 /* Enable CA-Cl*pper 5.3x extensions */ -#define HB_COMPAT_XPP /* Enable Alaska Xbase++ extensions */ -/* #define HB_COMPAT_VO */ /* Enable CA-VO extensions */ +#define HB_C52_UNDOC /* Enable Cl*pper 5.2e/5.3x undocumented features */ +/* #define HB_C52_STRICT */ /* Enable Cl*pper 5.2e/5.3x strict compatibility */ +#define HB_COMPAT_C53 /* Enable Cl*pper 5.3x extensions */ +#define HB_COMPAT_XPP /* Enable Xbase++ extensions */ +/* #define HB_COMPAT_VO */ /* Enable VO extensions */ #define HB_COMPAT_FLAGSHIP /* Enable Flagship extensions */ /* #define HB_COMPAT_FOXPRO */ /* Enable FoxPro extensions */ /* #define HB_COMPAT_DBASE */ /* Enable dBase extensions */ diff --git a/harbour/source/vm/extrap.c b/harbour/source/vm/extrap.c index e61f45247d..5fff5faedf 100644 --- a/harbour/source/vm/extrap.c +++ b/harbour/source/vm/extrap.c @@ -88,17 +88,15 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInfo ) { - char msg[ ( HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ) * 128 ]; - char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; - char file[ _POSIX_PATH_MAX + 1 ]; - char * ptr; - USHORT uiLine; - int iLevel; - FILE * hLog = *hb_setGetCPtr( HB_SET_HBOUTLOG ) ? hb_fopen( hb_setGetCPtr( HB_SET_HBOUTLOG ), "a+" ) : NULL; if( hLog ) { + char buffer[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 5 ]; + char file[ _POSIX_PATH_MAX + 1 ]; + USHORT uiLine; + int iLevel; + char szTime[ 9 ]; int iYear, iMonth, iDay; @@ -198,37 +196,22 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf fwrite( errmsg, sizeof( char ), strlen( errmsg ), hLog ); } #endif - } - msg[ 0 ] = '\0'; - ptr = msg; - iLevel = 0; + iLevel = 0; + while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) + { + char msg[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; - while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) - { - snprintf( ptr, sizeof( msg ) - ( ptr - msg ), - HB_I_("Called from %s(%hu)%s%s\n"), buffer, uiLine, *file ? HB_I_(" in ") : "", file ); - - if( hLog ) - fwrite( ptr, sizeof( *ptr ), strlen( ptr ), hLog ); - - ptr += strlen( ptr ); - } - - if( hLog ) - { + snprintf( msg, sizeof( msg ), HB_I_("Called from %s(%hu)%s%s\n"), buffer, uiLine, *file ? HB_I_(" in ") : "", file ); + + fwrite( msg, sizeof( *msg ), strlen( msg ), hLog ); + } + fprintf( hLog, "------------------------------------------------------------------------\n"); fclose( hLog ); } - /* GUI */ - { - LPTSTR lpStr = HB_TCHAR_CONVTO( msg ); - MessageBox( NULL, lpStr, TEXT( HB_I_("Application Exception") ), MB_ICONSTOP ); - HB_TCHAR_FREE( lpStr ); - } - - return EXCEPTION_CONTINUE_SEARCH; /* EXCEPTION_EXECUTE_HANDLER; */ + return hb_cmdargCheck( "BATCH" ) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH; } #elif defined(HB_OS_OS2)