* harbour/common.mak
* harbour/include/hbapirdd.h
- harbour/include/hbrddwrk.h
* harbour/source/rdd/Makefile
+ harbour/source/rdd/wacore.c
+ harbour/source/rdd/wafunc.c
* harbour/source/rdd/workarea.c
* cleaned RDD code:
* the default work area implementation from which each RDD inherits
and RDD management is now in workarea.c file - this part will be
common for all threads in future MT version
* the code to mange workareas and aliases moved to wacore.c - this
code uses some static variables which will be moved to HVM stack
in MT version
* helper RDD functions thread independent moved to wafunc.c
* harbour/source/rdd/dbcmd.c
* removed RDD/WorkArea management code - only independent HB_FUNCs
left. IMHO it will be good to divide this file into few ones.
* changed dbCreate() and dbUseArea() to return logical value
* harbour/config/global.cf
- removed nulsys from linked library list - it should not be here
because it can confuse some linkers and wrong library will be
created
* harbour/contrib/rdd_ads/ads1.c
* harbour/source/rdd/dbf1.c
* harbour/source/rdd/delim1.c
* harbour/source/rdd/sdf1.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* harbour/source/rdd/dbfdbt/dbfdbt1.c
* harbour/source/rdd/dbffpt/dbffpt1.c
* harbour/source/rdd/dbfntx/dbfntx1.c
* harbour/source/rdd/nulsys/nulsys.c
* updated for recent modifications in RDD API
* harbour/include/hbextern.ch
- removed __RDDSETDEFAULT() - this function was necessary with old
rdd register code and we not not need it for few years. It's not
Clipper function so I do not see any reason to keep it but if you
want we can add wrapper to standard RDDSETDEFAULT()
* harbour/source/rdd/hbsix/sxcompr.c
+ added workaround for SIX3 bug which I intentionally replicated in
[x]Harbour but it may cause data corruption so IMHO it will be better
to fix it.
* harbour/source/rtl/errorsys.prg
* added default action for EG_LOCK - it's Clipper compatible behavior
but done in differ way. Due to some differences in linker we are
using we cannot exactly replicate Clipper behavior because it will
not work on some platforms as expected so I decided to add it here.
I think it's even more Clear then the trick with source/sys/ntxerr.prg
done by Clipper. Many people do not even knows about it.
* harbour/source/rtl/gtcrs/chrmap.c
* changed environment variable name from HB_CHRMAP to HB_CHARMAP to
be compatible with description in default map file
206 lines
5.4 KiB
Plaintext
206 lines
5.4 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* The default error handler
|
|
*
|
|
* Copyright 1999 Antonio Linares <alinares@fivetech.com>
|
|
* www - http://www.harbour-project.org
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this software; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
|
*
|
|
* As a special exception, the Harbour Project gives permission for
|
|
* additional uses of the text contained in its release of Harbour.
|
|
*
|
|
* The exception is that, if you link the Harbour libraries with other
|
|
* files to produce an executable, this does not by itself cause the
|
|
* resulting executable to be covered by the GNU General Public License.
|
|
* Your use of that executable is in no way restricted on account of
|
|
* linking the Harbour library code into it.
|
|
*
|
|
* This exception does not however invalidate any other reasons why
|
|
* the executable file might be covered by the GNU General Public License.
|
|
*
|
|
* This exception applies only to the code released by the Harbour
|
|
* Project under the name Harbour. If you copy code from other
|
|
* Harbour Project or Free Software Foundation releases into a copy of
|
|
* Harbour, as the General Public License permits, the exception does
|
|
* not apply to the code that you add in this way. To avoid misleading
|
|
* anyone as to the status of such modified files, you must delete
|
|
* this exception notice from them.
|
|
*
|
|
* If you write modifications of your own for Harbour, it is your choice
|
|
* whether to permit this exception to apply to your modifications.
|
|
* If you do not wish that, delete this exception notice.
|
|
*
|
|
*/
|
|
|
|
#include "common.ch"
|
|
#include "error.ch"
|
|
|
|
PROCEDURE ErrorSys
|
|
|
|
ErrorBlock( { | oError | DefError( oError ) } )
|
|
|
|
RETURN
|
|
|
|
STATIC FUNCTION DefError( oError )
|
|
LOCAL cMessage
|
|
LOCAL cDOSError
|
|
|
|
LOCAL aOptions
|
|
LOCAL nChoice
|
|
|
|
LOCAL n
|
|
|
|
// By default, division by zero results in zero
|
|
IF oError:genCode == EG_ZERODIV .AND. ;
|
|
oError:canSubstitute
|
|
RETURN 0
|
|
ENDIF
|
|
|
|
// By default, retry on RDD lock error failure */
|
|
IF oError:genCode == EG_LOCK .AND. ;
|
|
oError:canRetry
|
|
// oError:tries++
|
|
RETURN .T.
|
|
ENDIF
|
|
|
|
// Set NetErr() of there was a database open error
|
|
IF oError:genCode == EG_OPEN .AND. ;
|
|
oError:osCode == 32 .AND. ;
|
|
oError:canDefault
|
|
NetErr( .T. )
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
// Set NetErr() if there was a lock error on dbAppend()
|
|
IF oError:genCode == EG_APPENDLOCK .AND. ;
|
|
oError:canDefault
|
|
NetErr( .T. )
|
|
RETURN .F.
|
|
ENDIF
|
|
|
|
cMessage := ErrorMessage( oError )
|
|
IF ! Empty( oError:osCode )
|
|
cDOSError := "(DOS Error " + LTrim( Str( oError:osCode ) ) + ")"
|
|
ENDIF
|
|
|
|
// Build buttons
|
|
|
|
aOptions := {}
|
|
|
|
// AAdd( aOptions, "Break" )
|
|
AAdd( aOptions, "Quit" )
|
|
|
|
IF oError:canRetry
|
|
AAdd( aOptions, "Retry" )
|
|
ENDIF
|
|
|
|
IF oError:canDefault
|
|
AAdd( aOptions, "Default" )
|
|
ENDIF
|
|
|
|
// Show alert box
|
|
|
|
nChoice := 0
|
|
WHILE nChoice == 0
|
|
|
|
IF ISNIL( cDOSError )
|
|
nChoice := Alert( cMessage, aOptions )
|
|
ELSE
|
|
nChoice := Alert( cMessage + ";" + cDOSError, aOptions )
|
|
ENDIF
|
|
|
|
ENDDO
|
|
|
|
IF ! Empty( nChoice )
|
|
DO CASE
|
|
CASE aOptions[ nChoice ] == "Break"
|
|
Break( oError )
|
|
CASE aOptions[ nChoice ] == "Retry"
|
|
RETURN .T.
|
|
CASE aOptions[ nChoice ] == "Default"
|
|
RETURN .F.
|
|
ENDCASE
|
|
ENDIF
|
|
|
|
// "Quit" selected
|
|
|
|
IF ! ISNIL( cDOSError )
|
|
cMessage += " " + cDOSError
|
|
ENDIF
|
|
|
|
OutErr( hb_OSNewLine() )
|
|
OutErr( cMessage )
|
|
|
|
n := 1
|
|
WHILE ! Empty( ProcName( ++n ) )
|
|
|
|
OutErr( hb_OSNewLine() )
|
|
OutErr( "Called from " + ProcName( n ) + ;
|
|
"(" + LTrim( Str( ProcLine( n ) ) ) + ") " )
|
|
|
|
ENDDO
|
|
|
|
/// For some strange reason, the DOS prompt gets written on the first line
|
|
/// *of* the message instead of on the first line *after* the message after
|
|
/// the program quits, unless the screen has scrolled. - dgh
|
|
|
|
ErrorLevel( 1 )
|
|
QUIT
|
|
|
|
RETURN .F.
|
|
|
|
// [vszakats]
|
|
|
|
STATIC FUNCTION ErrorMessage( oError )
|
|
LOCAL cMessage
|
|
|
|
// start error message
|
|
cMessage := iif( oError:severity > ES_WARNING, "Error", "Warning" ) + " "
|
|
|
|
// add subsystem name if available
|
|
IF ISCHARACTER( oError:subsystem )
|
|
cMessage += oError:subsystem()
|
|
ELSE
|
|
cMessage += "???"
|
|
ENDIF
|
|
|
|
// add subsystem's error code if available
|
|
IF ISNUMBER( oError:subCode )
|
|
cMessage += "/" + LTrim( Str( oError:subCode ) )
|
|
ELSE
|
|
cMessage += "/???"
|
|
ENDIF
|
|
|
|
// add error description if available
|
|
IF ISCHARACTER( oError:description )
|
|
cMessage += " " + oError:description
|
|
ENDIF
|
|
|
|
// add either filename or operation
|
|
DO CASE
|
|
CASE !Empty( oError:filename )
|
|
cMessage += ": " + oError:filename
|
|
CASE !Empty( oError:operation )
|
|
cMessage += ": " + oError:operation
|
|
ENDCASE
|
|
|
|
RETURN cMessage
|