2008-04-16 14:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbclass.ch
    ! removed:
         MESSAGE <msgName> IS <mthName>
      used as synonym of:
         MESSAGE <msgName> METHOD <mthName>
      If someone was using the removed version then please update the
      code to MESSAGE ... METHOD ...
      The removed command has special meaning in Class(y) and it allow
      to define alternate names for existing messages. I'll add support
      for them in the future.

  * harbour/contrib/hbct/ctwin.c
    * added disabled code which is a workaround for some possible
      bad side effect caused by online shadow showing by CTWIN.

  * harbour/source/rtl/errorint.c
    ! fixed displaying internal error message

  * harbour/source/common/hbver.c
    * added "Rev." prefix to shown revision number

  * harbour/include/hbexprop.h
  * harbour/include/hbexprb.c
  * harbour/source/common/expropt1.c
  * harbour/source/common/expropt2.c
    + added hb_compExprReduceNegate()
    ! fixed wrong negate optimizations for platforms where HB_LONG_MAX
      is smaller then -HB_LONG_MIN, f.e. all x86 based CPUs.
    ! fixed setting the size in optimized negative numbers
    ! fixed some math optimizations to not use casting to double value
      when it's not necessary - when double precision is smaller then HB_LONG
      (f.e. on x86 it's 53 bits and HB_LONG has 64bit) such casting can damage
      up to 11 less significant bits in big 64 bit numbers.

  * harbour/source/rtl/hbinet.c
    * replaced MAKEWORD() macro with HB_MKWORD() to pacify BCC58 warnings

  * harbour/include/hbdefs.h
    + added #include <limits.h>
      It should hide some warnings related to redefined integer size constants
      Viktor if it will not help for BCC58 warnings then you will have to add
         #include <stdint.h>
      few lines below but please remember that older BCC version does not
      have it so check for the exact compiler version.
    ! changed macros which setting default numeric item size for more strict
      Clipper compatible mode. I'm not a fun of some Clipper behavior in
      calculating number size and I left some notes about it in hbdefs.h
      Anyhow this and some other modifications below should cover the
      differences you've found recently. Some things are not addressed by
      me intentionally, f.e. _itemPutNL() in Clipper always set size to 10
      without checking the maximum size so it's too small for values less
      then -999999999. Harbour compiler makes more compile time optimizations
      then Clipper. The formatting rules used by compiler are a little bit
      different then by VM so this can be source of some other differences
      to Clipper. I can easy create some examples. Harbour supports 64bit
      signed integers and Clipper doesn't. This is yet another situation
      when we may have different results then Clipper. Most of them can
      be hidden if we add new PCODE(s) for integer number with explicit
      size but I do not think it's such important to increase PCODE list.
      In few cases it will be necessary to disable some optimizations at
      all and I do not like it. In the future when I will be adding some
      new optimizations I also add compiler switch to disable/enable
      optimizations which can have such side effects for people who need
      strict formatting.

  * harbour/include/hbvmpub.h
  * harbour/source/common/hbstr.c
  * harbour/source/vm/hvm.c
  * harbour/source/vm/itemapi.c
  * harbour/source/rtl/round.c
    * updated for more Clipper compatible number formating using new macros
This commit is contained in:
Przemyslaw Czerpak
2008-04-16 12:42:05 +00:00
parent a595040043
commit f181406951
16 changed files with 278 additions and 97 deletions

View File

@@ -8,6 +8,79 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-04-16 14:41 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbclass.ch
! removed:
MESSAGE <msgName> IS <mthName>
used as synonym of:
MESSAGE <msgName> METHOD <mthName>
If someone was using the removed version then please update the
code to MESSAGE ... METHOD ...
The removed command has special meaning in Class(y) and it allow
to define alternate names for existing messages. I'll add support
for them in the future.
* harbour/contrib/hbct/ctwin.c
* added disabled code which is a workaround for some possible
bad side effect caused by online shadow showing by CTWIN.
* harbour/source/rtl/errorint.c
! fixed displaying internal error message
* harbour/source/common/hbver.c
* added "Rev." prefix to shown revision number
* harbour/include/hbexprop.h
* harbour/include/hbexprb.c
* harbour/source/common/expropt1.c
* harbour/source/common/expropt2.c
+ added hb_compExprReduceNegate()
! fixed wrong negate optimizations for platforms where HB_LONG_MAX
is smaller then -HB_LONG_MIN, f.e. all x86 based CPUs.
! fixed setting the size in optimized negative numbers
! fixed some math optimizations to not use casting to double value
when it's not necessary - when double precision is smaller then HB_LONG
(f.e. on x86 it's 53 bits and HB_LONG has 64bit) such casting can damage
up to 11 less significant bits in big 64 bit numbers.
* harbour/source/rtl/hbinet.c
* replaced MAKEWORD() macro with HB_MKWORD() to pacify BCC58 warnings
* harbour/include/hbdefs.h
+ added #include <limits.h>
It should hide some warnings related to redefined integer size constants
Viktor if it will not help for BCC58 warnings then you will have to add
#include <stdint.h>
few lines below but please remember that older BCC version does not
have it so check for the exact compiler version.
! changed macros which setting default numeric item size for more strict
Clipper compatible mode. I'm not a fun of some Clipper behavior in
calculating number size and I left some notes about it in hbdefs.h
Anyhow this and some other modifications below should cover the
differences you've found recently. Some things are not addressed by
me intentionally, f.e. _itemPutNL() in Clipper always set size to 10
without checking the maximum size so it's too small for values less
then -999999999. Harbour compiler makes more compile time optimizations
then Clipper. The formatting rules used by compiler are a little bit
different then by VM so this can be source of some other differences
to Clipper. I can easy create some examples. Harbour supports 64bit
signed integers and Clipper doesn't. This is yet another situation
when we may have different results then Clipper. Most of them can
be hidden if we add new PCODE(s) for integer number with explicit
size but I do not think it's such important to increase PCODE list.
In few cases it will be necessary to disable some optimizations at
all and I do not like it. In the future when I will be adding some
new optimizations I also add compiler switch to disable/enable
optimizations which can have such side effects for people who need
strict formatting.
* harbour/include/hbvmpub.h
* harbour/source/common/hbstr.c
* harbour/source/vm/hvm.c
* harbour/source/vm/itemapi.c
* harbour/source/rtl/round.c
* updated for more Clipper compatible number formating using new macros
2008-04-15 13:32 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/tget.prg
+ TGet instance variable ordering in class definition
@@ -179,9 +252,9 @@
2008-04-10 15:39 UTC+0100 Belgrano Massimo (mbelgrano/at/deltain.it)
* harbour/contrib/rddado/adordd.prg
Instead of overloading FOUND method in ADO RDD it will be
more efficient to use standard implementation written in C
by Przemyslaw suggestion
* Instead of overloading FOUND method in ADO RDD it will be
more efficient to use standard implementation written in C
by Przemyslaw suggestion
2008-04-09 20:42 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/ChangeLog

View File

@@ -1320,6 +1320,32 @@ static BOOL hb_ctw_gt_PutChar( PHB_GT pGT, int iRow, int iCol,
{
long lIndex = ( long ) iRow * s_iMapWidth + iCol;
iWindow = s_pWindowMap[ lIndex ];
#if 0
/* When window with shadow is closed CT3 restores attributes
* which existed before shadow was displayed. In some application
* which switches to window 0 for pass-throw output it causes that
* wrong attributes appears after this operation. In Harbour it's
* fixed so such problem do not exist. Anyhow some code may switch
* to window 0, make savescreen()/restscreen() and in such case
* all shadow attributes are copied to window 0 buffer. The code
* below is workaround for it. [druzus]
*/
if( s_pShadowMap[ lIndex ] != 0 )
{
int iShadow = s_pShadowMap[ lIndex ];
if( s_windows[ iShadow ]->iShadowAttr >= 0 &&
( BYTE ) s_windows[ iShadow ]->iShadowAttr == bColor )
{
BYTE bClr, bAtr;
USHORT usCh;
if( HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol, &bClr, &bAtr, &usCh ) )
{
if( usCh == usChar && bClr == bColor )
return TRUE;
}
}
}
#endif
s_pShadowMap[ lIndex ] = 0;
}
}

View File

@@ -7,11 +7,12 @@
* Header file for Class commands
*
* Copyright 1999 Antonio Linares <alinares@fivetechsoft.com>
* www - http://www.harbour-project.org
*
* Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* most of rules rewritten
*
* 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)
@@ -379,7 +380,7 @@ DECLARE HBClass ;
#xcommand MESSAGE <MessageName> [ AS <type> ] DEFERRED => ;
MESSAGE <MessageName> [ AS <type> ] VIRTUAL
#xcommand MESSAGE <MessageName> [ AS <type> ] <mth: METHOD, IS> <MethodName> [<ctor: CONSTRUCTOR>] [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] => ;
#xcommand MESSAGE <MessageName> [ AS <type> ] METHOD <MethodName> [<ctor: CONSTRUCTOR>] [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] => ;
_HB_MEMBER __HB_CLS_ASFUNC(<MessageName>) [<-ctor-> AS CLASS _CLASS_NAME_] [ AS <type> ];;
__HB_CLS_DECLARE_METHOD __HB_CLS_PARAMS(<MethodName>) _CLASS_NAME_ ;;
s_oClass:AddMethod( __HB_CLS_ASSTRING(<MessageName>), @__HB_CLS_ASID( __HB_CLS_MTHNAME _CLASS_NAME_ <MethodName> )(), __HB_CLS_SCOPE( <.export.>, <.protect.>, <.hidde.> ) + iif( <.ctor.>, HB_OO_CLSTP_CTOR, 0 ) + iif( <.persistent.>, HB_OO_CLSTP_PERSIST, 0 ) )
@@ -398,8 +399,15 @@ DECLARE HBClass ;
#xcommand MESSAGE <MessageName> [ AS <type> ] <arg: ARG, ARGS> <Args,...> [LOCAL <Locals,...>] INLINE <Code,...> [<ctor: CONSTRUCTOR>] [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] => ;
MESSAGE __HB_CLS_ASID(<MessageName>)(<Args>) [ AS <type> ] [LOCAL <Locals>] INLINE <Code> <ctor> <export> <protect> <hidde> <persistent>
/* MESSAGE ... IS ... command working like in Class(y) temporary disabled for
* easier detecting code which was using previous wrong syntax.
*/
/*
#xcommand MESSAGE <MessageName> [ AS <type> ] IS <AltMsgName> [<ctor: CONSTRUCTOR>] [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] => ;
MESSAGE <MessageName> [ AS <type> ] INLINE Self:<AltMsgName> <ctor> <export> <protect> <hidde> <persistent>
*/
#xcommand MESSAGE <MessageName> [ AS <type> ] TO <oObject> [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] =>;
MESSAGE <MessageName> [ AS <type> ] INLINE Self:<oObject>:<MessageName> <export> <protect> <hidde> <persistent>
#xcommand MESSAGE <MessageName> [ AS <type> ] IN <SuperClass> [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<persistent: PERSISTENT, PROPERTY>] => ;
MESSAGE <MessageName> [ AS <type> ] INLINE Self:<SuperClass>:<MessageName> <export> <protect> <hidde> <persistent>
@@ -467,8 +475,6 @@ DECLARE HBClass ;
#xtranslate _HB_MEMBER {AS Char => _HB_MEMBER {AS Character
#xtranslate _HB_MEMBER {AS Block => _HB_MEMBER {AS CodeBlock
/* The #xtranslate is wrongly used instead of #xcommand as
workaround for some preprocessor problems */
#xcommand EXPORTED: => nScope := HB_OO_CLSTP_EXPORTED
#xcommand EXPORT: => nScope := HB_OO_CLSTP_EXPORTED
#xcommand VISIBLE: => nScope := HB_OO_CLSTP_EXPORTED
@@ -484,7 +490,7 @@ DECLARE HBClass ;
MESSAGE <MethodName> [ AS <type> ] BLOCK {|Self [, <params>] [, <v>] | __HB_CLS_SYMBOL_UNUSED(Self), <Code> } [ <other>]
/* This definitions are not Class(y) compatible - I'm leaving them as is now */
/* These definitions are not Class(y) compatible - I'm leaving them as is now */
#xcommand VAR <DataNames,...> [ <tp: TYPE, AS> <type> ] [ <as: ASSIGN, INIT> <uValue> ] [<export: EXPORTED, VISIBLE>] [<protect: PROTECTED>] [<hidde: HIDDEN>] [<ro: READONLY, RO>] [<persistent: PERSISTENT, PROPERTY>] => ;
__HB_CLS_CHECKVAR(<DataNames>);;

View File

@@ -57,6 +57,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "hbsetup.h"
#include "hbtrace.h"
@@ -451,27 +452,56 @@
# define HB_LL( num ) num##LL
#endif
#if HB_INT_MIN <= -1000000000
# define HB_INT_LENGTH( i ) ( ( (i) <= -1000000000 ) ? 20 : 10 )
#else
# define HB_INT_LENGTH( i ) 10
#endif
#if !defined( HB_LONG_LONG_OFF )
# if HB_LONG_MAX > HB_LL( 10000000000 )
# define HB_LONG_LENGTH( l ) ( ( (l) <= -1000000000 || (l) >= HB_LL( 10000000000 ) ) ? 20 : 10 )
/* HB_*_EXPLENGTH() macros are used by HVM to set the size of
* math operations, HB_*_LENGTH() macros are used when new
* item is created. [druzus]
*/
/* NOTE: the positive number limit 999999999 in HB_INT_LENGTH()
* (HB_LONG_LENGTH() on 16-bit platforms) below is not
* compatible with other limits. Clipper have such limit
* but IMHO it's result of some typo or wrong compiler
* warnings cleanup when someone removed one digit from
* upper limit instead of removing the whole limit.
* It's also possible that it comes from DBASE and was
* intentionally replicated. I think we should keep it
* only in strict compatibility mode. [druzus]
*/
#if HB_INT_MIN < -999999999
# define HB_INT_LENGTH( i ) ( ( (i) < -999999999 || (i) > 999999999 ) ? 20 : 10 )
#else
# define HB_INT_LENGTH( i ) 10
# define HB_INT_EXPLENGTH( i ) 10
# if HB_LONG_MIN < -999999999
# define HB_LONG_LENGTH( i ) ( ( (i) < -999999999 || (i) > 999999999 ) ? 20 : 10 )
# endif
#endif
#if !defined HB_LONG_LENGTH
# define HB_LONG_LENGTH( l ) ( ( (l) <= -1000000000 ) ? 20 : 10 )
#if !defined( HB_LONG_LONG_OFF )
# if HB_LONG_MAX > HB_LL( 9999999999 )
# define HB_LONG_LENGTH( l ) ( ( (l) < -999999999 || (l) > HB_LL( 9999999999 ) ) ? 20 : 10 )
# endif
# if HB_INT_MAX > HB_LL( 9999999999 )
# define HB_INT_EXPLENGTH( i ) HB_LONG_LENGTH( i )
# endif
#endif
/* NOTE: Yes, -999999999.0 is right instead of -1000000000.0 [vszakats] */
/* This comment is from hb_vmNeg() - if it's true only in this case then
the limit should be changed and this function fixed */
#if !defined( HB_LONG_LENGTH )
# define HB_LONG_LENGTH( l ) ( ( (l) < -999999999 ) ? 20 : 10 )
#endif
#if !defined( HB_INT_EXPLENGTH )
# define HB_INT_EXPLENGTH( i ) ( ( (i) < -999999999 ) ? 20 : 10 )
#endif
#if !defined( HB_LONG_EXPLENGTH )
# define HB_LONG_EXPLENGTH( l ) HB_LONG_LENGTH( l )
#endif
#define HB_DBL_LENGTH( d ) ( ( (d) >= 10000000000.0 || (d) <= -999999999.0 ) ? 20 : 10 )
/* HB_DBL_LENGTH() is used by VAL() for strings longer then 10 characters
* (counted to '.') and to set the size of math operations and new
* double item - it's CA-Cl*pper compatible range. For doubles we do
* not have separated limit for result of math operations. [druzus]
*/
#define HB_DBL_LENGTH( d ) ( ( (d) > 9999999999.0 || (d) < -999999999.0 ) ? 20 : 10 )
/* uncomment this if you need strict Clipper compatibility */
/* #define PCODE_LONG_LIM(l) HB_LIM_INT32( l ) */

View File

@@ -3806,24 +3806,10 @@ static HB_EXPR_FUNC( hb_compExprUseNegate )
switch( iMessage )
{
case HB_EA_REDUCE:
{
HB_EXPR_PTR pExpr;
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM );
pExpr = pSelf->value.asOperator.pLeft;
if( pExpr->ExprType == HB_ET_NUMERIC )
{
if( pExpr->value.asNum.NumType == HB_ET_DOUBLE )
pExpr->value.asNum.val.d = - pExpr->value.asNum.val.d;
else
pExpr->value.asNum.val.l = - pExpr->value.asNum.val.l;
pSelf->ExprType = HB_ET_NONE; /* do not delete operator parameter - we are still using it */
HB_COMP_EXPR_DELETE( pSelf );
pSelf = pExpr;
}
pSelf = hb_compExprReduceNegate( pSelf, HB_COMP_PARAM );
break;
}
case HB_EA_ARRAY_AT:
HB_COMP_ERROR_TYPE( pSelf );
break;

View File

@@ -179,6 +179,7 @@ extern HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReduceNegate( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_COMP_DECL );
extern HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_COMP_DECL );

View File

@@ -81,14 +81,14 @@ struct _HB_SYMB;
if( HB_LIM_INT( v ) ) \
{ \
(p)->type = HB_IT_INTEGER; \
(p)->item.asInteger.length = HB_INT_LENGTH( v ); \
(p)->item.asInteger.length = HB_INT_EXPLENGTH( v ); \
(p)->item.asInteger.value = ( int ) (v); \
} \
else \
{ \
(p)->type = HB_IT_LONG; \
(p)->item.asLong.value = (v); \
(p)->item.asLong.length = HB_LONG_LENGTH( v ); \
(p)->item.asLong.length = HB_LONG_EXPLENGTH( v ); \
} \
} while( 0 )

View File

@@ -1053,8 +1053,20 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr, HB_COMP_DECL )
}
else
{
pNegExpr->value.asNum.val.l = - pNegExpr->value.asNum.val.l;
pNegExpr->value.asNum.bWidth = HB_LONG_LENGTH( pNegExpr->value.asNum.val.l );
#if -HB_LONG_MAX > HB_LONG_MIN
if( pNegExpr->value.asNum.val.l < -HB_LONG_MAX )
{
pNegExpr->value.asNum.NumType = HB_ET_DOUBLE;
pNegExpr->value.asNum.val.d = - ( double ) pNegExpr->value.asNum.val.l;
pNegExpr->value.asNum.bWidth = HB_DBL_LENGTH( pNegExpr->value.asNum.val.d );
pNegExpr->value.asNum.bDec = 0;
}
else
#endif
{
pNegExpr->value.asNum.val.l = - pNegExpr->value.asNum.val.l;
pNegExpr->value.asNum.bWidth = HB_DEFAULT_WIDTH;
}
}
pExpr = pNegExpr;
}

View File

@@ -259,9 +259,9 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL )
{
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.val.l * ( HB_MAXDBL ) pRight->value.asNum.val.l;
if ( HB_DBL_LIM_LONG( dVal ) )
if( HB_DBL_LIM_LONG( dVal ) )
{
pSelf->value.asNum.val.l = ( HB_LONG ) dVal;
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l * pRight->value.asNum.val.l;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
@@ -333,9 +333,9 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
{
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.val.l - ( HB_MAXDBL ) pRight->value.asNum.val.l;
if ( HB_DBL_LIM_LONG( dVal ) )
if( HB_DBL_LIM_LONG( dVal ) )
{
pSelf->value.asNum.val.l = ( HB_LONG ) dVal;
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l - pRight->value.asNum.val.l;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
@@ -487,9 +487,9 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
{
HB_MAXDBL dVal = ( HB_MAXDBL ) pLeft->value.asNum.val.l + ( HB_MAXDBL ) pRight->value.asNum.val.l;
if ( HB_DBL_LIM_LONG( dVal ) )
if( HB_DBL_LIM_LONG( dVal ) )
{
pSelf->value.asNum.val.l = ( HB_LONG ) dVal;
pSelf->value.asNum.val.l = pLeft->value.asNum.val.l + pRight->value.asNum.val.l;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
@@ -650,6 +650,44 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL )
return pSelf;
}
HB_EXPR_PTR hb_compExprReduceNegate( HB_EXPR_PTR pSelf, HB_COMP_DECL )
{
HB_EXPR_PTR pExpr;
pExpr = pSelf->value.asOperator.pLeft;
if( pExpr->ExprType == HB_ET_NUMERIC )
{
if( pExpr->value.asNum.NumType == HB_ET_DOUBLE )
{
pExpr->value.asNum.val.d = - pExpr->value.asNum.val.d;
pExpr->value.asNum.bWidth = HB_DEFAULT_WIDTH;
}
else
{
#if -HB_LONG_MAX > HB_LONG_MIN
if( pExpr->value.asNum.val.l < -HB_LONG_MAX )
{
pExpr->value.asNum.NumType = HB_ET_DOUBLE;
pExpr->value.asNum.val.d = - ( double ) pExpr->value.asNum.val.l;
pExpr->value.asNum.bWidth = HB_DEFAULT_WIDTH;
pExpr->value.asNum.bDec = 0;
}
else
#endif
{
pExpr->value.asNum.val.l = - pExpr->value.asNum.val.l;
pExpr->value.asNum.bWidth = HB_DEFAULT_WIDTH;
}
}
pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */
HB_COMP_EXPR_FREE( pSelf );
pSelf = pExpr;
}
return pSelf;
}
HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_COMP_DECL )
{

View File

@@ -635,20 +635,20 @@ static BOOL hb_str2number( BOOL fPCode, const char* szNum, ULONG ulLen, HB_LONG
*piWidth = iWidth;
else
{
int iSize = fDbl ? HB_DBL_LENGTH( *dVal ) : HB_LONG_LENGTH( *lVal );
if( fPCode )
{
if( iWidth < 10 || fNeg )
*piWidth = iSize;
*piWidth = fDbl ? HB_DBL_LENGTH( *dVal ) : HB_LONG_LENGTH( *lVal );
else
*piWidth = iWidth + ( iDec == 0 ? 1 : 0 );
}
else if( iWidth > 10 )
{
*piWidth = fDbl ? HB_DBL_LENGTH( *dVal ) : HB_LONG_LENGTH( *lVal );
}
else
{
if( iSize > 10 || iWidth > 10 )
*piWidth = iSize;
else if( iDec + iDecR == 0 )
if( iDec + iDecR == 0 )
*piWidth = ( int ) ulLen;
else if( iWidth == 0 )
*piWidth = 1;

View File

@@ -545,7 +545,7 @@ char * hb_verHarbour( void )
CA-Clipper 5.3b returns: "Clipper (R) 5.3b Intl. (Rev. 338) (1997.04.25)"
*/
snprintf( pszVersion, 80, "Harbour %s build %d.%d-%d Intl. (%d)",
snprintf( pszVersion, 80, "Harbour %s build %d.%d-%d Intl. (Rev. %d)",
HB_VER_STATUS, HB_VER_MAJOR, HB_VER_MINOR, HB_VER_REVISION,
hb_verSvnID() );

View File

@@ -63,8 +63,7 @@ void hb_errInternal( ULONG ulIntCode, const char * szText, const char * szPar1,
char buffer[ 1024 ];
BOOL fLang;
if( szText == NULL )
szText = "";
HB_TRACE(HB_TR_DEBUG, ("hb_errInternal(%lu, %s, %s, %s)", ulIntCode, szText, szPar1, szPar2));
if( szPar1 == NULL )
szPar1 = "";
@@ -72,8 +71,6 @@ void hb_errInternal( ULONG ulIntCode, const char * szText, const char * szPar1,
if( szPar2 == NULL )
szPar2 = "";
HB_TRACE(HB_TR_DEBUG, ("hb_errInternal(%lu, %s, %s, %s)", ulIntCode, szText, szPar1, szPar2));
fLang = ( hb_langID() != NULL );
hb_conOutErr( hb_conNewLine(), 0 );

View File

@@ -503,8 +503,9 @@ HB_FUNC( HB_INETINIT )
else
{
#if defined(HB_OS_WIN_32)
#define HB_MKWORD( l, h ) ((WORD)(((BYTE)(l)) | (((WORD)((BYTE)(h))) << 8)))
WSADATA wsadata;
WSAStartup( MAKEWORD(1,1), &wsadata );
WSAStartup( HB_MKWORD(1,1), &wsadata );
#elif defined( HB_OS_LINUX )
signal( HB_INET_LINUX_INTERRUPT, hb_inetLinuxSigusrHandle );
#endif

View File

@@ -106,7 +106,7 @@ HB_FUNC( ROUND )
hb_retndlen( hb_numRound( hb_itemGetND( pNumber ), iDec ), 0, HB_MAX( iDec, 0 ) );
#else
if( iDec == 0 && HB_IS_NUMINT( pNumber ) )
hb_itemReturn( pNumber );
hb_retnint( hb_itemGetNInt( pNumber ) );
else
hb_retnlen( hb_numRound( hb_itemGetND( pNumber ), iDec ), 0, HB_MAX( iDec, 0 ) );
#endif

View File

@@ -193,7 +193,6 @@ static void hb_vmPushIntegerConst( int iNumber ); /* Pushes a int constant (
#else
static void hb_vmPushLongConst( long lNumber ); /* Pushes a long constant (pcode) */
#endif
static void hb_vmPushNumType( double dNumber, int iDec, int iType1, int iType2 ); /* pushes a number on to the stack and decides if it is integer, long or double */
static void hb_vmPushStatic( USHORT uiStatic ); /* pushes the containts of a static onto the stack */
static void hb_vmPushStaticByRef( USHORT uiStatic ); /* pushes a static by refrence onto the stack */
static void hb_vmPushVariable( PHB_SYMB pVarSymb ); /* pushes undeclared variable */
@@ -2301,13 +2300,13 @@ static void hb_vmAddInt( HB_ITEM_PTR pResult, LONG lAdd )
if( HB_IS_NUMINT( pResult ) )
{
HB_LONG lVal = HB_ITEM_GET_NUMINTRAW( pResult ), lNewVal;
HB_LONG lVal = HB_ITEM_GET_NUMINTRAW( pResult ), lResult;
lNewVal = lVal + lAdd;
lResult = lVal + lAdd;
if( lAdd >= 0 ? lNewVal >= lVal : lNewVal < lVal )
if( lAdd >= 0 ? lResult >= lVal : lResult < lVal )
{
HB_ITEM_PUT_NUMINTRAW( pResult, lNewVal );
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
return;
}
else
@@ -2375,7 +2374,7 @@ static void hb_vmNegate( void )
HB_LONG lValue = ( HB_LONG ) pItem->item.asInteger.value;
pItem->type = HB_IT_LONG;
pItem->item.asLong.value = -lValue;
pItem->item.asLong.length = HB_LONG_LENGTH( -lValue );
pItem->item.asLong.length = HB_LONG_EXPLENGTH( -lValue );
#else
double dValue = ( double ) pItem->item.asInteger.value;
pItem->type = HB_IT_DOUBLE;
@@ -2388,7 +2387,7 @@ static void hb_vmNegate( void )
{
pItem->type = HB_IT_INTEGER;
pItem->item.asInteger.value = -pItem->item.asInteger.value;
pItem->item.asInteger.length = HB_INT_LENGTH( pItem->item.asInteger.value );
pItem->item.asInteger.length = HB_INT_EXPLENGTH( pItem->item.asInteger.value );
}
}
else if( HB_IS_LONG( pItem ) )
@@ -2406,7 +2405,7 @@ static void hb_vmNegate( void )
{
pItem->type = HB_IT_LONG;
pItem->item.asLong.value = -pItem->item.asLong.value;
pItem->item.asLong.length = HB_LONG_LENGTH( pItem->item.asLong.value );
pItem->item.asLong.length = HB_LONG_EXPLENGTH( pItem->item.asLong.value );
}
}
else if( HB_IS_DOUBLE( pItem ) )
@@ -2439,7 +2438,7 @@ static void hb_vmPlus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIte
if( lNumber2 >= 0 ? lResult >= lNumber1 : lResult < lNumber1 )
{
hb_itemPutNInt( pResult, lResult );
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
}
else
{
@@ -2522,7 +2521,7 @@ static void hb_vmMinus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIt
if( lNumber2 <= 0 ? lResult >= lNumber1 : lResult < lNumber1 )
{
hb_itemPutNInt( pResult, lResult );
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
}
else
{
@@ -2540,7 +2539,9 @@ static void hb_vmMinus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIt
}
else if( HB_IS_DATE( pItem1 ) && HB_IS_DATE( pItem2 ) )
{
hb_itemPutNInt( pResult, hb_itemGetDL( pItem1 ) - hb_itemGetDL( pItem2 ) );
HB_LONG lResult = hb_itemGetDL( pItem1 ) - hb_itemGetDL( pItem2 );
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
}
else if( HB_IS_DATE( pItem1 ) && HB_IS_NUMERIC( pItem2 ) )
{
@@ -2602,7 +2603,7 @@ static void hb_vmMult( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIte
HB_LONG lNumber2 = HB_ITEM_GET_NUMINTRAW( pItem2 );
HB_LONG lResult = lNumber1 * lNumber2;
if( lNumber2 == 0 || lResult / lNumber2 == lNumber1 )
hb_itemPutNInt( pResult, lResult );
HB_ITEM_PUT_NUMINTRAW( pResult, lResult );
else
hb_itemPutNLen( pResult, ( double ) lNumber1 * lNumber2, 0, 0 );
}
@@ -2713,7 +2714,10 @@ static void hb_vmModulus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR p
/* NOTE: Clipper always returns the result of modulus
with the SET number of decimal places. */
if( hb_set.HB_SET_DECIMALS == 0 )
hb_itemPutNInt( pResult, HB_ITEM_GET_NUMINTRAW( pItem1 ) % lDivisor );
{
lDivisor = HB_ITEM_GET_NUMINTRAW( pItem1 ) % lDivisor;
HB_ITEM_PUT_NUMINTRAW( pResult, lDivisor );
}
else
hb_itemPutND( pResult, ( double ) ( HB_ITEM_GET_NUMINTRAW( pItem1 ) % lDivisor ) );
}
@@ -2785,14 +2789,14 @@ static void hb_vmInc( PHB_ITEM pItem )
{
pItem->type = HB_IT_INTEGER;
pItem->item.asInteger.value++;
pItem->item.asInteger.length = HB_INT_LENGTH( pItem->item.asInteger.value );
pItem->item.asInteger.length = HB_INT_EXPLENGTH( pItem->item.asInteger.value );
}
else
{
#if HB_INT_MAX < HB_LONG_MAX
pItem->type = HB_IT_LONG;
pItem->item.asLong.value = ( HB_LONG ) pItem->item.asInteger.value + 1;
pItem->item.asLong.length = HB_LONG_LENGTH( pItem->item.asLong.value );
pItem->item.asLong.length = HB_LONG_EXPLENGTH( pItem->item.asLong.value );
#else
pItem->type = HB_IT_DOUBLE;
pItem->item.asDouble.value = ( double ) pItem->item.asInteger.value + 1;
@@ -2805,7 +2809,7 @@ static void hb_vmInc( PHB_ITEM pItem )
{
pItem->type = HB_IT_LONG;
pItem->item.asLong.value++;
pItem->item.asLong.length = HB_LONG_LENGTH( pItem->item.asLong.value );
pItem->item.asLong.length = HB_LONG_EXPLENGTH( pItem->item.asLong.value );
}
else
{
@@ -2850,14 +2854,14 @@ static void hb_vmDec( PHB_ITEM pItem )
{
pItem->type = HB_IT_INTEGER;
pItem->item.asInteger.value--;
pItem->item.asInteger.length = HB_INT_LENGTH( pItem->item.asInteger.value );
pItem->item.asInteger.length = HB_INT_EXPLENGTH( pItem->item.asInteger.value );
}
else
{
#if HB_INT_MIN > HB_LONG_MIN
pItem->type = HB_IT_LONG;
pItem->item.asLong.value = ( HB_LONG ) pItem->item.asInteger.value - 1;
pItem->item.asLong.length = HB_LONG_LENGTH( pItem->item.asLong.value );
pItem->item.asLong.length = HB_LONG_EXPLENGTH( pItem->item.asLong.value );
#else
pItem->type = HB_IT_DOUBLE;
pItem->item.asDouble.value = ( double ) pItem->item.asInteger.value - 1;
@@ -2870,7 +2874,7 @@ static void hb_vmDec( PHB_ITEM pItem )
{
pItem->type = HB_IT_LONG;
pItem->item.asLong.value--;
pItem->item.asLong.length = HB_LONG_LENGTH( pItem->item.asLong.value );
pItem->item.asLong.length = HB_LONG_EXPLENGTH( pItem->item.asLong.value );
}
else
{
@@ -5376,22 +5380,18 @@ HB_EXPORT void hb_vmPushLogical( BOOL bValue )
pItem->item.asLogical.value = bValue;
}
/* not used by HVM code */
HB_EXPORT void hb_vmPushNumber( double dNumber, int iDec )
{
hb_vmPushNumType( dNumber, iDec, 0, 0 );
}
HB_TRACE(HB_TR_DEBUG, ("hb_vmPushNumber(%lf, %d)", dNumber, iDec));
static void hb_vmPushNumType( double dNumber, int iDec, int iType1, int iType2 )
{
HB_TRACE(HB_TR_DEBUG, ("hb_vmPushNumType(%lf, %d)", dNumber, iDec));
if( iDec || iType1 & HB_IT_DOUBLE || iType2 & HB_IT_DOUBLE )
if( iDec )
hb_vmPushDouble( dNumber, iDec );
else if ( HB_DBL_LIM_INT( dNumber ) )
else if( HB_DBL_LIM_INT( dNumber ) )
hb_vmPushInteger( ( int ) dNumber );
else if ( HB_DBL_LIM_LONG( dNumber ) )
else if( HB_DBL_LIM_LONG( dNumber ) )
hb_vmPushHBLong( ( HB_LONG ) dNumber );
else
@@ -5409,7 +5409,7 @@ static int hb_vmCalcIntWidth( HB_LONG lNumber )
else
{
iWidth = 10;
while ( lNumber >= 1000000000L )
while( lNumber >= 1000000000L )
{
iWidth++;
lNumber /= 10;

View File

@@ -867,18 +867,29 @@ HB_EXPORT PHB_ITEM hb_itemPutNInt( PHB_ITEM pItem, HB_LONG lNumber )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutNInt(%p, %" PFHL "d)", pItem, lNumber));
if( pItem )
{
if( HB_IS_COMPLEX( pItem ) )
hb_itemClear( pItem );
}
else
pItem = hb_itemNew( NULL );
if( HB_LIM_INT( lNumber ) )
{
return hb_itemPutNI( pItem, ( int ) lNumber );
pItem->type = HB_IT_INTEGER;
pItem->item.asInteger.value = ( int ) lNumber;
/* EXP limit used intentionally */
pItem->item.asInteger.length = HB_INT_EXPLENGTH( lNumber );
}
else
{
#ifdef HB_LONG_LONG_OFF
return hb_itemPutNL( pItem, ( long ) lNumber );
#else
return hb_itemPutNLL( pItem, ( LONGLONG ) lNumber );
#endif
pItem->type = HB_IT_LONG;
pItem->item.asLong.value = lNumber;
pItem->item.asLong.length = HB_LONG_LENGTH( lNumber );
}
return pItem;
}
HB_EXPORT PHB_ITEM hb_itemPutNIntLen( PHB_ITEM pItem, HB_LONG lNumber, int iWidth )