2001-12-05 19:44 UTC+0100 Viktor Szakats <viktor.szakats@syenar.hu>

This commit is contained in:
Viktor Szakats
2001-12-05 18:44:47 +00:00
parent cb4678de87
commit 6cc5a3a4e2
17 changed files with 818 additions and 1056 deletions

View File

@@ -1,3 +1,47 @@
2001-12-05 19:44 UTC+0100 Viktor Szakats <viktor.szakats@syenar.hu>
* include/hbmath.h
* source/rtl/math.c
* contrib/libct/ctmath.c
* Renamed math handler C level functions to match the
naming system of Harbour:
hb_getMathError -> hb_mathGetError
hb_resetMathError -> hb_mathResetError
hb_isMathHandler -> hb_mathIsHandler
hb_installMathHandler -> hb_mathHandlerInstall
hb_deinstallMathHandler -> hb_mathHandlerDeinstall
hb_setMathHandlerStatus -> hb_mathHandlerSetStatus
hb_getMathHandlerStatus -> hb_mathHandlerGetStatus
HB_MATHERR* -> HB_MATH_ERR*
* source/rtl/mlctopos.c
* source/rtl/mpostolc.c
! Missing CVS headers added.
* include/hbextern.ch
* source/rtl/defpath.c
* source/rtl/natmsg.c
* source/rtl/oemansi.c
* source/rtl/seconds.c
* source/rtl/setcolor.c
* source/rtl/setposbs.c
* source/rtl/shadow.c
* source/rtl/trim.c
! Functions, features marked as extensions or
as undocumented.
* Functions reordered by category in hbextern.ch
It's now smaller, faster, and it's much more
meaningful for the eye.
! Fixed faulty defines in hbextern.ch which
excluded the complete GETSYS function list,
when C53 compatibility was turned off.
! Some missing symbols added to hbextern.ch
! Removed doubly defined items from hbextern.ch
* source/rtl/getsys.prg
* source/rtl/tgetlist.prg
* Some formatting.
2001-12-05 14:08 GTM+1 Antonio Linares <alinares@fivetech.com>
* source/vm/eval.c
! hb_evalBlock0() and hb_evalBlock1() functions added

View File

@@ -64,11 +64,11 @@ int ct_math_init (void)
{
HB_TRACE(HB_TR_DEBUG, ("ctmath_init()"));
if (hb_isMathHandler())
if (hb_mathIsHandler())
{
s_ctMathHandler = hb_installMathHandler (ct_matherr);
s_ctMathHandler = hb_mathHandlerInstall (ct_matherr);
/* CT3 math handler is inactive by default */
hb_setMathHandlerStatus (s_ctMathHandler, CT_MATHERR_STATUS_INACTIVE);
hb_mathHandlerSetStatus (s_ctMathHandler, CT_MATHERR_STATUS_INACTIVE);
return (1);
}
return (0);
@@ -77,9 +77,9 @@ int ct_math_init (void)
int ct_math_exit (void)
{
HB_TRACE(HB_TR_DEBUG, ("ctmath_exit()"));
if (hb_isMathHandler())
if (hb_mathIsHandler())
{
hb_deinstallMathHandler (s_ctMathHandler);
hb_mathHandlerDeinstall (s_ctMathHandler);
}
return (1);
}
@@ -102,9 +102,9 @@ int ct_getmatherrstatus (void)
void ct_matherrbegin (void)
{
HB_TRACE(HB_TR_DEBUG, ("ct_matherrbegin()"));
if (hb_isMathHandler() && (s_ct_matherr_status == CT_MATHERR_STATUS_ACTIVE))
if (hb_mathIsHandler() && (s_ct_matherr_status == CT_MATHERR_STATUS_ACTIVE))
{
hb_setMathHandlerStatus (s_ctMathHandler, CT_MATHERR_STATUS_ACTIVE);
hb_mathHandlerSetStatus (s_ctMathHandler, CT_MATHERR_STATUS_ACTIVE);
}
return;
}
@@ -112,9 +112,9 @@ void ct_matherrbegin (void)
void ct_matherrend (void)
{
HB_TRACE(HB_TR_DEBUG, ("ct_matherrend()"));
if (hb_isMathHandler())
if (hb_mathIsHandler())
{
hb_setMathHandlerStatus (s_ctMathHandler, CT_MATHERR_STATUS_INACTIVE);
hb_mathHandlerSetStatus (s_ctMathHandler, CT_MATHERR_STATUS_INACTIVE);
}
return;
}
@@ -305,25 +305,25 @@ int ct_matherr (HB_MATH_EXCEPTION * pexc)
switch (pexc->type)
{
case HB_MATHERR_DOMAIN:
case HB_MATH_ERR_DOMAIN:
/* a domain error has occured, such as sqrt( -1 ) */
ulSubCode = CT_ERROR_MATHLIB_DOMAIN; break;
case HB_MATHERR_SING:
case HB_MATH_ERR_SING:
/* a singularity will result, such as pow( 0, -2 ) */
ulSubCode = CT_ERROR_MATHLIB_SING; break;
case HB_MATHERR_OVERFLOW:
case HB_MATH_ERR_OVERFLOW:
/* an overflow will result, such as pow( 10, 100 ) */
ulSubCode = CT_ERROR_MATHLIB_OVERFLOW; break;
case HB_MATHERR_UNDERFLOW:
case HB_MATH_ERR_UNDERFLOW:
/* an underflow will result, such as pow( 10, -100 ) */
ulSubCode = CT_ERROR_MATHLIB_UNDERFLOW; break;
case HB_MATHERR_TLOSS:
case HB_MATH_ERR_TLOSS:
/* total loss of significance will result, such as exp( 1000 ) */
ulSubCode = CT_ERROR_MATHLIB_TLOSS; break;
case HB_MATHERR_PLOSS:
case HB_MATH_ERR_PLOSS:
/* partial loss of significance will result, such as sin( 10e70 ) */
ulSubCode = CT_ERROR_MATHLIB_PLOSS; break;
default: /* HB_MATHERR_UNKNOWN */
default: /* HB_MATH_ERR_UNKNOWN */
/* unknown math lib error */
ulSubCode = CT_ERROR_MATHLIB; break;
}
@@ -351,12 +351,12 @@ int ct_matherr (HB_MATH_EXCEPTION * pexc)
/* find some appropiate return values */
switch (pexc->type)
{
case HB_MATHERR_DOMAIN:
case HB_MATH_ERR_DOMAIN:
/* a domain error has occured, such as sqrt( -1 ) */
pexc->retval = 0.0;
retval = 1;
break;
case HB_MATHERR_SING:
case HB_MATH_ERR_SING:
/* a singularity will result, such as pow( 0, -2 ) */
if (pexc->arg1 < 0) /* it is just a guess that the resulting singularity
has the same sign as the first argument */
@@ -365,7 +365,7 @@ int ct_matherr (HB_MATH_EXCEPTION * pexc)
pexc->retval = DBL_MAX;
retval = 1;
break;
case HB_MATHERR_OVERFLOW:
case HB_MATH_ERR_OVERFLOW:
/* an overflow will result, such as pow( 10, 100 ) */
if (pexc->arg1 < 0) /* it is just a guess that the resulting singularity
has the same sign as the first argument */
@@ -374,7 +374,7 @@ int ct_matherr (HB_MATH_EXCEPTION * pexc)
pexc->retval = DBL_MAX;
retval = 1;
break;
case HB_MATHERR_UNDERFLOW:
case HB_MATH_ERR_UNDERFLOW:
/* an underflow will result, such as pow( 10, -100 ) */
if (pexc->arg1 < 0) /* it is just a guess that the resulting singularity
has the same sign as the first argument */
@@ -383,17 +383,17 @@ int ct_matherr (HB_MATH_EXCEPTION * pexc)
pexc->retval = DBL_MIN;
retval = 1;
break;
case HB_MATHERR_TLOSS:
case HB_MATH_ERR_TLOSS:
/* total loss of significance will result, such as exp( 1000 ) */
pexc->retval = 1.0;
retval = 1;
break;
case HB_MATHERR_PLOSS:
case HB_MATH_ERR_PLOSS:
/* partial loss of significance will result, such as sin( 10e70 ) */
pexc->retval = 1.0;
retval = 1;
break;
default: /* HB_MATHERR_UNKNOWN */
default: /* HB_MATH_ERR_UNKNOWN */
/* unknown math lib error */
pexc->retval = 0.0;
retval = 1;

File diff suppressed because it is too large Load Diff

View File

@@ -55,6 +55,7 @@
#define HB_MATH_H_
#include "hbapi.h"
#include <math.h>
#if defined(HB_EXTERN_C)
@@ -83,45 +84,44 @@ extern "C" {
#define exception _exception
#endif
extern int hb_getMathError (void);
extern void hb_resetMathError (void);
extern int hb_isMathHandler (void);
typedef struct _HB_MATH_EXCEPTION
{
int type;
char *name;
double arg1;
double arg2;
double retval;
int type;
char * name;
double arg1;
double arg2;
double retval;
} HB_MATH_EXCEPTION;
typedef int (* HB_MATH_HANDLERPROC)(HB_MATH_EXCEPTION *err);
typedef int ( * HB_MATH_HANDLERPROC )( HB_MATH_EXCEPTION * err );
typedef struct HB_MATH_HANDLERCHAINELEMENT_
{
HB_MATH_HANDLERPROC handlerproc;
int status;
struct HB_MATH_HANDLERCHAINELEMENT_ * pnext;
HB_MATH_HANDLERPROC handlerproc;
int status;
struct HB_MATH_HANDLERCHAINELEMENT_ * pnext;
} HB_MATH_HANDLERCHAINELEMENT, * PHB_MATH_HANDLERCHAINELEMENT;
typedef PHB_MATH_HANDLERCHAINELEMENT HB_MATH_HANDLERHANDLE;
extern HB_MATH_HANDLERHANDLE hb_installMathHandler (HB_MATH_HANDLERPROC handlerproc);
extern int hb_deinstallMathHandler (HB_MATH_HANDLERHANDLE handle);
extern int hb_setMathHandlerStatus (HB_MATH_HANDLERHANDLE handle, int status);
extern int hb_getMathHandlerStatus (HB_MATH_HANDLERHANDLE handle);
extern int hb_mathGetError( void );
extern void hb_mathResetError( void );
extern int hb_mathIsHandler( void );
extern HB_MATH_HANDLERHANDLE hb_mathHandlerInstall( HB_MATH_HANDLERPROC handlerproc );
extern int hb_mathHandlerDeinstall( HB_MATH_HANDLERHANDLE handle );
extern int hb_mathHandlerSetStatus( HB_MATH_HANDLERHANDLE handle, int status );
extern int hb_mathHandlerGetStatus( HB_MATH_HANDLERHANDLE handle );
#define HB_MATH_HANDLER_STATUS_NOTFOUND ((int)-1)
#define HB_MATH_HANDLER_STATUS_INACTIVE ((int)0)
#define HB_MATH_HANDLER_STATUS_ACTIVE ((int)1)
#define HB_MATH_HANDLER_STATUS_NOTFOUND ( ( int ) -1 )
#define HB_MATH_HANDLER_STATUS_INACTIVE ( ( int ) 0 )
#define HB_MATH_HANDLER_STATUS_ACTIVE ( ( int ) 1 )
#define HB_MATHERR_UNKNOWN ((int)0)
#define HB_MATHERR_DOMAIN ((int)1)
#define HB_MATHERR_SING ((int)2)
#define HB_MATHERR_OVERFLOW ((int)3)
#define HB_MATHERR_UNDERFLOW ((int)4)
#define HB_MATHERR_TLOSS ((int)5)
#define HB_MATHERR_PLOSS ((int)6)
#define HB_MATH_ERR_UNKNOWN ( ( int ) 0 )
#define HB_MATH_ERR_DOMAIN ( ( int ) 1 )
#define HB_MATH_ERR_SING ( ( int ) 2 )
#define HB_MATH_ERR_OVERFLOW ( ( int ) 3 )
#define HB_MATH_ERR_UNDERFLOW ( ( int ) 4 )
#define HB_MATH_ERR_TLOSS ( ( int ) 5 )
#define HB_MATH_ERR_PLOSS ( ( int ) 6 )
#if defined(HB_EXTERN_C)

View File

@@ -53,6 +53,8 @@
#include "hbapi.h"
#include "hbset.h"
#ifdef HB_C52_UNDOC
HB_FUNC( DEFPATH )
{
char buffer[ _POSIX_PATH_MAX ];
@@ -92,3 +94,4 @@ HB_FUNC( __DEFPATH )
HB_FUNCNAME( DEFPATH )();
}
#endif

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* GET system module (default)
*
* Copyright 1999 Antonio Linares <alinares@fivetech.com>
* Copyright 1999-2001 Antonio Linares <alinares@fivetech.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
@@ -55,7 +55,7 @@
* www - http://www.harbour-project.org
*
* Copyright 2001 Luiz Rafael Culik
* Support for Ca-Clipper 5.3 Getsystem
* Support for CA-Clipper 5.3 Getsystem
*
* See doc/license.txt for licensing terms.
*
@@ -63,19 +63,23 @@
#include "common.ch"
#include "hbsetup.ch"
#ifndef HB_COMPAT_C53
FUNCTION ReadModal( GetList, nPos )
#else
FUNCTION ReadModal( GetList, nPos, nMsgRow, nMsgLeft, nMsgRight, cMsgColor )
#endif
LOCAL oGetList
#ifdef HB_COMPAT_C53
Local lMsgFlag
Local cSaveColor
Local cOldMsg
Local lColorFlag
Local oGet
FUNCTION ReadModal( GetList, nPos, nMsgRow, nMsgLeft, nMsgRight, cMsgColor )
#else
FUNCTION ReadModal( GetList, nPos )
#endif
LOCAL oGetList
#ifdef HB_COMPAT_C53
LOCAL lMsgFlag
LOCAL cSaveColor
LOCAL cOldMsg
LOCAL lColorFlag
LOCAL oGet
#endif
IF Empty( GetList )
SetPos( MaxRow() - 1, 0 )
RETURN .F.
@@ -90,6 +94,7 @@ FUNCTION ReadModal( GetList, nPos, nMsgRow, nMsgLeft, nMsgRight, cMsgColor )
IF ! ( ISNUMBER( nPos ) .AND. nPos > 0 )
oGetList:nPos := oGetList:Settle( 0 )
ENDIF
#ifdef HB_COMPAT_C53
if ( ! ValType( nMsgRow ) == "N" )
lMsgFlag := .f.
@@ -106,13 +111,14 @@ FUNCTION ReadModal( GetList, nPos, nMsgRow, nMsgLeft, nMsgRight, cMsgColor )
lColorFlag := ( ValType( cMsgColor ) == "C" )
endif
#endif
DO WHILE oGetList:nPos != 0
oGetList:oGet := oGetList:aGetList[ oGetList:nPos ]
oGetList:PostActiveGet()
#ifdef HB_COMPAT_C53
#ifdef HB_COMPAT_C53
if ( lMsgFlag )
oGet := oGetList:aGetList[ oGetList:nPos ]
if ( lColorFlag )
@@ -131,13 +137,14 @@ FUNCTION ReadModal( GetList, nPos, nMsgRow, nMsgLeft, nMsgRight, cMsgColor )
SetColor( cSaveColor )
endif
endif
#endif
#endif
IF ISBLOCK( oGetList:oGet:Reader )
#ifndef HB_COMPAT_C53
Eval( oGetList:oGet:Reader, oGetList:oGet )
#Else
#ifdef HB_COMPAT_C53
Eval( oGetList:oGet:Reader, oGetList:oGet ,Ogetlist)
#endif
#else
Eval( oGetList:oGet:Reader, oGetList:oGet )
#endif
ELSE
oGetList:Reader()
ENDIF
@@ -145,11 +152,13 @@ FUNCTION ReadModal( GetList, nPos, nMsgRow, nMsgLeft, nMsgRight, cMsgColor )
oGetList:nPos := oGetList:Settle()
ENDDO
#ifdef HB_COMPAT_C53
#ifdef HB_COMPAT_C53
if ( lMsgFlag )
RestScreen( nMsgRow, nMsgLeft, nMsgRow, nMsgRight, cOldMsg )
endif
#endif
SetPos( MaxRow() - 1, 0 )
RETURN oGetList:lUpdated
@@ -159,7 +168,6 @@ PROCEDURE GetReader( oGet )
RETURN
FUNCTION GetActive( oGet )
LOCAL oGetList := __GetListActive()
@@ -338,11 +346,14 @@ FUNCTION RangeCheck( oGet, xDummy, xLow, xHigh )
ENDIF
RETURN .F.
#ifdef HB_COMPAT_C53
PROCEDURE GUIReader( oGet ,oGetlist,a,b)
oGetlist:GuiReader(oGet,oGetList,a,b)
return
RETURN
PROCEDURE GuiApplyKey(oGet,nKey)
LOCAL oGetList := __GetListActive()
@@ -380,5 +391,4 @@ FUNCTION GuiGetPostValidate( oGet,oGui )
RETURN .F.
#endif

View File

@@ -62,125 +62,122 @@
#include "hbapierr.h"
#include "hbmath.h"
#if defined(HB_MATH_HANDLER)
static int s_internal_math_error = 0; /* TOFIX: This is not thread safe. */
int hb_getMathError( void )
int hb_mathGetError( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_getMathError()"));
return( s_internal_math_error );
HB_TRACE(HB_TR_DEBUG, ("hb_mathGetError()"));
return s_internal_math_error;
}
void hb_resetMathError( void )
void hb_mathResetError( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_resetMathError()"));
HB_TRACE(HB_TR_DEBUG, ("hb_mathResetError()"));
s_internal_math_error = 0;
}
/* math handler present ? */
int hb_isMathHandler( void )
int hb_mathIsHandler( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_isMathHandler()"));
return (1);
}
HB_TRACE(HB_TR_DEBUG, ("hb_mathIsHandler()"));
return 1;
}
static PHB_MATH_HANDLERCHAINELEMENT s_pChain = NULL; /* TODO: make this thread safe */
/* install custom math handler */
HB_MATH_HANDLERHANDLE hb_installMathHandler (HB_MATH_HANDLERPROC handlerproc)
HB_MATH_HANDLERHANDLE hb_mathHandlerInstall( HB_MATH_HANDLERPROC handlerproc )
{
PHB_MATH_HANDLERCHAINELEMENT pChain, pNewChainelement;
HB_TRACE(HB_TR_DEBUG, ("hb_installMathHandler (%p)", handlerproc));
pNewChainelement = (PHB_MATH_HANDLERCHAINELEMENT)hb_xgrab (sizeof (HB_MATH_HANDLERCHAINELEMENT));
pNewChainelement->handlerproc = handlerproc;
pNewChainelement->status = HB_MATH_HANDLER_STATUS_ACTIVE;
/* initially activated */
pNewChainelement->pnext = NULL;
pChain = s_pChain;
if (pChain == NULL)
{
s_pChain = pNewChainelement;
}
else
{
while (pChain->pnext != NULL)
pChain = pChain->pnext;
pChain->pnext = pNewChainelement;
}
return ((HB_MATH_HANDLERHANDLE)pNewChainelement);
PHB_MATH_HANDLERCHAINELEMENT pChain, pNewChainelement;
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerInstall (%p)", handlerproc));
pNewChainelement = (PHB_MATH_HANDLERCHAINELEMENT)hb_xgrab (sizeof (HB_MATH_HANDLERCHAINELEMENT));
pNewChainelement->handlerproc = handlerproc;
pNewChainelement->status = HB_MATH_HANDLER_STATUS_ACTIVE;
/* initially activated */
pNewChainelement->pnext = NULL;
pChain = s_pChain;
if( pChain == NULL )
{
s_pChain = pNewChainelement;
}
else
{
while( pChain->pnext != NULL )
pChain = pChain->pnext;
pChain->pnext = pNewChainelement;
}
return ( HB_MATH_HANDLERHANDLE ) pNewChainelement;
}
/* deinstall custom math handler */
int hb_deinstallMathHandler (HB_MATH_HANDLERHANDLE handle)
int hb_mathHandlerDeinstall( HB_MATH_HANDLERHANDLE handle )
{
PHB_MATH_HANDLERCHAINELEMENT pChain;
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerDeinstall (%p)", handle));
PHB_MATH_HANDLERCHAINELEMENT pChain;
HB_TRACE(HB_TR_DEBUG, ("hb_deinstallMathHandler (%p)", handle));
if (handle != NULL)
{
if (s_pChain == (PHB_MATH_HANDLERCHAINELEMENT)handle)
{
s_pChain = ((PHB_MATH_HANDLERCHAINELEMENT)handle)->pnext;
hb_xfree ((void *)handle);
return (0);
}
else
{
pChain = s_pChain;
while (pChain != NULL)
if( handle != NULL )
{
if( s_pChain == ( PHB_MATH_HANDLERCHAINELEMENT ) handle )
{
if (pChain->pnext == (PHB_MATH_HANDLERCHAINELEMENT)handle)
{
pChain->pnext = ((PHB_MATH_HANDLERCHAINELEMENT)handle)->pnext;
hb_xfree ((void *)handle);
return (0);
}
pChain = pChain->pnext;
s_pChain = ( ( PHB_MATH_HANDLERCHAINELEMENT ) handle )->pnext;
hb_xfree( ( void * ) handle);
return 0;
}
}
}
return (-1); /* not found, not deinstalled, so return error code */
else
{
pChain = s_pChain;
while( pChain != NULL )
{
if( pChain->pnext == ( PHB_MATH_HANDLERCHAINELEMENT ) handle )
{
pChain->pnext = ( ( PHB_MATH_HANDLERCHAINELEMENT ) handle )->pnext;
hb_xfree( ( void * ) handle );
return 0;
}
pChain = pChain->pnext;
}
}
}
return -1; /* not found, not deinstalled, so return error code */
}
/* set custom math handler status */
int hb_setMathHandlerStatus (HB_MATH_HANDLERHANDLE handle, int status)
int hb_mathHandlerSetStatus( HB_MATH_HANDLERHANDLE handle, int status )
{
int oldstatus = HB_MATH_HANDLER_STATUS_NOTFOUND;
int oldstatus = HB_MATH_HANDLER_STATUS_NOTFOUND;
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerSetStatus (%p, %i)", handle, status));
if( handle != NULL )
{
oldstatus = ( ( PHB_MATH_HANDLERCHAINELEMENT ) handle )->status;
( ( PHB_MATH_HANDLERCHAINELEMENT ) handle )->status = status;
}
HB_TRACE(HB_TR_DEBUG, ("hb_setMathHandlerStatus (%p, %i)", handle, status));
if (handle != NULL)
{
oldstatus = ((PHB_MATH_HANDLERCHAINELEMENT)handle)->status;
((PHB_MATH_HANDLERCHAINELEMENT)handle)->status = status;
}
return (oldstatus);
return oldstatus;
}
/* get custom math handler status */
int hb_getMathHandlerStatus (HB_MATH_HANDLERHANDLE handle)
int hb_mathHandlerGetStatus( HB_MATH_HANDLERHANDLE handle )
{
HB_TRACE(HB_TR_DEBUG, ("hb_getMathHandlerStatus (%p)", handle));
if (handle != NULL)
{
return (((PHB_MATH_HANDLERCHAINELEMENT)handle)->status);
}
else
{
return (HB_MATH_HANDLER_STATUS_NOTFOUND);
}
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerGetStatus (%p)", handle));
if( handle != NULL )
return ( ( PHB_MATH_HANDLERCHAINELEMENT ) handle )->status;
else
return HB_MATH_HANDLER_STATUS_NOTFOUND;
}
@@ -188,7 +185,6 @@ int hb_getMathHandlerStatus (HB_MATH_HANDLERHANDLE handle)
*/
int matherr( struct exception * err )
{
PHB_MATH_HANDLERCHAINELEMENT pChain = s_pChain;
int retval = -1;
double dretval = 0.0;
@@ -200,46 +196,46 @@ int matherr( struct exception * err )
switch( err->type )
{
case DOMAIN:
exc.type = HB_MATHERR_DOMAIN;
exc.type = HB_MATH_ERR_DOMAIN;
break;
case SING:
exc.type = HB_MATHERR_SING;
exc.type = HB_MATH_ERR_SING;
break;
case OVERFLOW:
exc.type = HB_MATHERR_OVERFLOW;
exc.type = HB_MATH_ERR_OVERFLOW;
break;
case UNDERFLOW:
exc.type = HB_MATHERR_UNDERFLOW;
exc.type = HB_MATH_ERR_UNDERFLOW;
break;
case TLOSS:
exc.type = HB_MATHERR_TLOSS;
exc.type = HB_MATH_ERR_TLOSS;
break;
case PLOSS:
exc.type = HB_MATHERR_PLOSS;
exc.type = HB_MATH_ERR_PLOSS;
break;
default:
exc.type = HB_MATHERR_UNKNOWN;
exc.type = HB_MATH_ERR_UNKNOWN;
break;
}
exc.name = err->name;
exc.arg1 = err->arg1;
exc.arg2 = err->arg2;
exc.retval = err->retval;
while (pChain != NULL)
while( pChain != NULL )
{
int ret;
if (pChain->status == HB_MATH_HANDLER_STATUS_ACTIVE)
{
ret = (*(pChain->handlerproc))(&exc);
/* store the math return value from the handler that returns the largest integer */
if (ret > retval)
{
dretval = exc.retval;
retval = ret;
}
}
pChain = pChain->pnext;
if( pChain->status == HB_MATH_HANDLER_STATUS_ACTIVE )
{
int ret = ( *( pChain->handlerproc ) )( &exc );
/* store the math return value from the handler that returns the largest integer */
if( ret > retval )
{
dretval = exc.retval;
retval = ret;
}
}
pChain = pChain->pnext;
}
switch( err->type )
@@ -273,62 +269,69 @@ int matherr( struct exception * err )
break;
}
if (retval == -1)
if( retval == -1 )
{
/* default behaviour */
err->retval = 0.0;
return (1); /* don't print any message and don't set errno */
/* default behaviour */
err->retval = 0.0;
return 1; /* don't print any message and don't set errno */
}
err->retval = dretval;
return (retval);
return retval;
}
#else /* defined (HB_MATH_HANDLER) */
/* the functions don't do anything but they must exist */
int hb_getMathError (void)
int hb_mathGetError( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_getMathError()"));
return (0);
HB_TRACE(HB_TR_DEBUG, ("hb_mathGetError()"));
return 0;
}
void hb_resetMathError (void)
void hb_mathResetError( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_resetMathError()"));
return;
HB_TRACE(HB_TR_DEBUG, ("hb_mathResetError()"));
return;
}
int hb_isMathHandler (void)
int hb_mathIsHandler( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_isMathHandler()"));
return (0);
HB_TRACE(HB_TR_DEBUG, ("hb_mathIsHandler()"));
return 0;
}
HB_MATH_HANDLERHANDLE hb_installMathHandler (HB_MATH_HANDLERPROC handlerproc)
HB_MATH_HANDLERHANDLE hb_mathHandlerInstall( HB_MATH_HANDLERPROC handlerproc )
{
HB_TRACE(HB_TR_DEBUG, ("hb_installMathHandler (%p)", handlerproc));
return ((HB_MATH_HANDLERHANDLE)NULL);
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerInstall (%p)", handlerproc));
return ( HB_MATH_HANDLERHANDLE ) NULL;
}
int hb_deinstallMathHandler (HB_MATH_HANDLERHANDLE handle)
int hb_mathHandlerDeinstall( HB_MATH_HANDLERHANDLE handle )
{
HB_TRACE(HB_TR_DEBUG, ("hb_deinstallMathHandler (%p)", handle));
return (-1);
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerDeinstall (%p)", handle));
return -1;
}
int hb_setMathHandlerStatus (HB_MATH_HANDLERHANDLE handle, int status)
int hb_mathHandlerSetStatus( HB_MATH_HANDLERHANDLE handle, int status )
{
HB_TRACE(HB_TR_DEBUG, ("hb_setMathHandlerStatus (%p, %i)", handle, status));
return (HB_MATH_HANDLER_STATUS_NOTFOUND);
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerSetStatus (%p, %i)", handle, status));
return HB_MATH_HANDLER_STATUS_NOTFOUND;
}
int hb_getMathHandlerStatus (HB_MATH_HANDLERHANDLE handle)
int hb_mathHandlerGetStatus( HB_MATH_HANDLERHANDLE handle )
{
HB_TRACE(HB_TR_DEBUG, ("hb_getMathHandlerStatus (%p)", handle));
return (HB_MATH_HANDLER_STATUS_NOTFOUND);
HB_TRACE(HB_TR_DEBUG, ("hb_mathHandlerGetStatus (%p)", handle));
return HB_MATH_HANDLER_STATUS_NOTFOUND;
}
#endif

View File

@@ -1,3 +1,7 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* MLCTOPOS() function
@@ -125,11 +129,12 @@ HB_FUNC( MLCTOPOS )
ulLastLen = ulCurLength ;
}
if ( ulLine == ulLines )
if( ulLine == ulLines )
{
ulLastLen--; /*Column is zero based*/
hb_retnl( ulBegOfLine + ( ( ulCol < ulLastLen ) ? ulCol : ulLastLen ) );
ulLastLen--; /* Column is zero based */
hb_retnl( ulBegOfLine + ( ( ulCol < ulLastLen ) ? ulCol : ulLastLen ) );
}
else
hb_retnl( ulLen );
}
}

View File

@@ -1,3 +1,7 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* MPOSTOLC() function
@@ -119,4 +123,4 @@ HB_FUNC( MPOSTOLC )
hb_reta( 2 );
hb_stornl( ulLines, -1, 1 );
hb_stornl( ulCurLength ? ulCurLength - 1 : 0, -1, 2 );
}
}

View File

@@ -93,6 +93,8 @@ char * hb_nationGetMsg( USHORT uiMsg )
return ( uiMsg >= 1 && uiMsg <= 13 ) ? ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_NATMSG + uiMsg - 1 ) : "";
}
#ifdef HB_C52_UNDOC
HB_FUNC( ISAFFIRM )
{
PHB_ITEM pItem = hb_param( 1, HB_IT_STRING );
@@ -140,3 +142,4 @@ HB_FUNC( _NATMSGVER )
hb_retc( "NATMSGS (Harbour)" );
}
#endif

View File

@@ -58,6 +58,8 @@
#include "hbapi.h"
#include "hbapiitm.h"
#ifdef HB_EXTENSION
HB_FUNC( HB_ANSITOOEM )
{
PHB_ITEM pString = hb_param( 1, HB_IT_STRING );
@@ -102,6 +104,8 @@ HB_FUNC( HB_OEMTOANSI )
hb_retc( "" );
}
#endif
#ifdef HB_COMPAT_XPP
/* NOTE: Xbase++ compatible function */

View File

@@ -84,7 +84,11 @@ HB_FUNC( SECONDS )
hb_retnd( hb_dateSeconds() );
}
#ifdef HB_EXTENSION
HB_FUNC( HB_CLOCKS2SECS )
{
hb_retnd((double) hb_parnl( 1 ) / CLOCKS_PER_SEC );
}
#endif

View File

@@ -89,10 +89,14 @@ HB_FUNC( SETBLINK )
hb_gtSetBlink( hb_parl( 1 ) );
}
#ifdef HB_EXTENSION
HB_FUNC( HB_COLORTON )
{
if( ISCHAR( 1 ) )
hb_retni( hb_gtColorToN( hb_parc( 1 ) ) );
else
hb_retni( 0 );
}
}
#endif

View File

@@ -53,7 +53,10 @@
#include "hbapi.h"
#include "hbapigt.h"
/* NOTE: CA-Cl*pper undocumented */
/* NOTE: Cannot be disabled with the HB_C52_UNDOC macro, because this symbol
is referenced by the VM [vszakats] */
/* NOTE: Clipper 5.x undocumented */
HB_FUNC( SETPOSBS ) /* Move the screen position to the right by one column */
{

View File

@@ -53,6 +53,8 @@
#include "hbapi.h"
#include "hbapigt.h"
#ifdef HB_EXTENSION
HB_FUNC( HB_SHADOW )
{
if( hb_pcount() >= 4 )
@@ -73,6 +75,8 @@ HB_FUNC( HB_CLRAREA )
hb_parni( 5 ) );
}
#endif
#ifdef HB_C52_UNDOC
HB_FUNC( DBGSHADOW )

View File

@@ -111,12 +111,12 @@ CLASS HBGetList
METHOD ReadExit( lNew ) INLINE Set( _SET_EXIT, lNew )
METHOD SetFocus()
METHOD Updated() INLINE ::lUpdated
#ifdef HB_COMPAT_C53
#ifdef HB_COMPAT_C53
METHOD GUIReader(oget,getsys,a,b)
METHOD GUIApplyKey( oGUI, nKey )
METHOD GuiPreValidate(oGui)
METHOD GuiPostValidate(oGui)
#endif
METHOD GUIApplyKey( oGUI, nKey )
METHOD GUIPreValidate(oGui)
METHOD GUIPostValidate(oGui)
#endif
ENDCLASS
METHOD New( GetList ) CLASS HBGetList
@@ -141,6 +141,7 @@ METHOD SetFocus() CLASS HBGetList
::aGetList[ ::nPos ]:SetFocus()
return Self
METHOD Reader() CLASS HBGetList
local oGet := ::oGet
@@ -559,8 +560,9 @@ METHOD ReadUpdated( lUpdated ) CLASS HBGetList
return lSavUpdated
#ifdef HB_COMPAT_C53
METHOD GuiReader(oget,getsys,a,b) CLASS HBGetList
//Local oGet := ::oGet
//Local oGet := ::oGet
Local oGui
IF ( ! ::GUIPreValidate( oGet , oGet:Control ) )
elseif ( ValType( oGet:Control ) == "O" )
@@ -716,7 +718,6 @@ METHOD GUIApplyKey( oGUI, nKey ) CLASS HBGetList
#endif
if ( ! lClose )
elseif ( ! TheClass == "LISTBOX" )
elseif ( ! oGUI:DropDown )
@@ -730,7 +731,6 @@ METHOD GUIApplyKey( oGUI, nKey ) CLASS HBGetList
RETURN Self
METHOD GUIPostValidate( oGUI ) CLASS HBGetList
Local oGet := ::oGet
LOCAL lSavUpdated

View File

@@ -117,8 +117,12 @@ HB_FUNC( RTRIM )
{
char * pszText = hb_itemGetCPtr( pText );
#ifdef HB_EXTENSION
hb_retclen( pszText, hb_strRTrimLen( pszText, hb_itemGetCLen( pText ),
ISLOG( 2 ) ? hb_parl( 2 ) : FALSE ) );
#else
hb_retclen( pszText, hb_strRTrimLen( pszText, hb_itemGetCLen( pText ), FALSE ) );
#endif
}
else
/* NOTE: "TRIM" is right here [vszakats] */