See ChangeLog entry 19991116-19:25 EDT David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
1999-11-17 00:40:27 +00:00
parent e38a210b2a
commit 8759e5e270
6 changed files with 72 additions and 15 deletions

View File

@@ -1,3 +1,26 @@
19991116-19:25 EDT David G. Holm <dholm@jsd-llc.com>
* config/dos/djgpp.cf
* config/os2/gcc.cf
* config/w32/gcc.cf
- Removed -g compiler option and -DDEBUG preprocessor option
If you want to compile with debug, add -g and -DDEBUG to the
C_USR environment variable.
* source/compiler/expropt.c
! Corrected the division optimization to return 0 for any attempt
to divide by 0.
! Corrected the division optimization to only return a long when the
result of dividing long values is a whole value instead of returning
a long when the result is within the range of a long (the result of
dividing a long by a long will always be within the range of a long).
% Changed the double results to return 2 decimal places after division
optimization, which still isn't correct (see the source code for
TODO: NOTE 1), but is more accurate than returning 0 decimal places.
* source/compiler/harbour.y
- Removed one of two occurrences of ExprEqual (on line 209).
19991117-01:03 GMT+1 Victor Szel <info@szelvesz.hu>
* include/hbver.h
* Version number updated to reflect the deep changes.
@@ -18,7 +41,9 @@
* new expression optimizer
* start of introducing new functions' naming scheme 'hb_comp'
* nonprintable characters (CR/LF/TAB, etc.) are inserted into
generated C code using hexdecimal numbers instead of quoted char
(they can appear as a result of expression optimization)
* source/pp/hbpp.c
@@ -28,19 +53,31 @@
* changes to support new functions' naming scheme 'hb_comp'
*include/pcode.h
*HB_P_ARRAYAAT -> HB_P_ARRAYPUSH
HB_P_ARRAYAPUT -> HB_P_ARRAYPOP - it removes value from the stack
This is compatible with the handling of usual variables
*source/debug/debugger.prg
* corrected the following syntax:
something <operator> other := another
for example:
? 2 + a:=5 -1
This syntax is not allowed in Clipper and in new Harbour rules too
It should be used:
? 2 + (a:=5) -1
* doc/compiler.txt
* added description of incompatibility with Clipper in object
handling

View File

@@ -13,7 +13,7 @@ CC = gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
CFLAGS = -Wall -g
CFLAGS = -Wall
LD = gcc
LD_OUT = -o

View File

@@ -13,7 +13,7 @@ CC = gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -DDEBUG -I. -I$(HB_INC_COMPILE) -DHARBOUR_GCC_OS2
CFLAGS = -Wall -g
CFLAGS = -Wall
LD = gcc
LD_OUT = -o $(SPACE)

View File

@@ -12,8 +12,8 @@ LIB_EXT = .a
CC = gcc
CC_IN = -c
CC_OUT = -o
CPPFLAGS = -DDEBUG -I. -I$(HB_INC_COMPILE)
CFLAGS = -Wall -g
CPPFLAGS = -I. -I$(HB_INC_COMPILE)
CFLAGS = -Wall
LD = gcc
LD_OUT = -o

View File

@@ -41,6 +41,7 @@
* stored in next element of the array.
*/
#include <math.h>
#include "compiler.h"
/* memory allocation
@@ -4298,23 +4299,27 @@ static HB_EXPR_FUNC( hb_compExprUseDiv )
if( pLeft->ExprType == HB_ET_NUMERIC && pRight->ExprType == HB_ET_NUMERIC )
{
unsigned char bType = ( pLeft->value.asNum.NumType & pRight->value.asNum.NumType );
double dVal = 0.0;
switch( bType )
{
case HB_ET_LONG:
{
double dVal = pLeft->value.asNum.lVal / pRight->value.asNum.lVal;
if( pRight->value.asNum.lVal )
dVal = ( double )pLeft->value.asNum.lVal / ( double )pRight->value.asNum.lVal;
if( ( double )LONG_MIN <= dVal && dVal <= ( double )LONG_MAX )
if( fmod( dVal, 1.0 ) == 0.0 )
{
pSelf->value.asNum.lVal = pLeft->value.asNum.lVal / pRight->value.asNum.lVal;
/* Return integer results as long */
pSelf->value.asNum.lVal = dVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.NumType = HB_ET_LONG;
}
else
{
/* Return non-integer results as double */
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.bDec = 0;
pSelf->value.asNum.bDec = 2; /* TODO: See NOTE 1 */
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
}
}
@@ -4322,9 +4327,11 @@ static HB_EXPR_FUNC( hb_compExprUseDiv )
case HB_ET_DOUBLE:
{
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal / pRight->value.asNum.dVal;
if( pRight->value.asNum.dVal != 0.0 )
dVal = pLeft->value.asNum.dVal / pRight->value.asNum.dVal;
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec + pRight->value.asNum.bDec;
pSelf->value.asNum.bDec = 2; /* TODO: See NOTE 1 */
}
break;
@@ -4332,16 +4339,29 @@ static HB_EXPR_FUNC( hb_compExprUseDiv )
{
if( pLeft->value.asNum.NumType == HB_ET_DOUBLE )
{
pSelf->value.asNum.dVal = pLeft->value.asNum.dVal / ( double ) pRight->value.asNum.lVal;
pSelf->value.asNum.bDec = pLeft->value.asNum.bDec;
if( pRight->value.asNum.lVal )
dVal = pLeft->value.asNum.dVal / ( double ) pRight->value.asNum.lVal;
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.bDec = 2; /* TODO: See NOTE 1 */
}
else
{
pSelf->value.asNum.dVal = ( double ) pLeft->value.asNum.lVal / pRight->value.asNum.dVal;
pSelf->value.asNum.bDec = pRight->value.asNum.bDec;
if( pRight->value.asNum.dVal != 0.0 )
dVal = ( double ) pLeft->value.asNum.lVal / pRight->value.asNum.dVal;
pSelf->value.asNum.dVal = dVal;
pSelf->value.asNum.bDec = 2; /* TODO: See NOTE 1 */
}
pSelf->value.asNum.NumType = HB_ET_DOUBLE;
}
/* TODO: NOTE 1
Clipper manages to print the default number of decimal
digits for optimized division results. Should we add a
"marker value" that tells Harbour to print the default
number of decimal digits? For example: pSelf->value.
asNum.bDec = HB_DEC_DEFAULT and then have Harbour check
for HB_DEC_DEFAULT when formatting numbers and print
the current default number of decimal digits.
*/
}
pSelf->ExprType = HB_ET_NUMERIC;
pSelf->ValType = HB_EV_NUMERIC;

View File

@@ -206,7 +206,7 @@ USHORT hb_comp_wCaseCounter = 0;
%type <asExpr> PareExpList PareExpListAlias
%type <asExpr> Expression SimpleExpression LValue
%type <asExpr> EmptyExpression
%type <asExpr> ExprAssign ExprOperEq ExprEqual ExprPreOp ExprPostOp
%type <asExpr> ExprAssign ExprOperEq ExprPreOp ExprPostOp
%type <asExpr> ExprEqual ExprMath ExprBool ExprRelation
%type <asExpr> ArrayIndex IndexList
%type <asExpr> DimIndex DimList