19991118-11:35 GMT+1

This commit is contained in:
Ryszard Glab
1999-11-18 10:42:19 +00:00
parent 15d6a28dd8
commit 1210cee9b8
9 changed files with 250 additions and 99 deletions

View File

@@ -1,3 +1,34 @@
19991118-11:35 GMT+1 Ryszard Glab <rglab@imid.med.pl>
*source/rtl/filesys.c
* corrected support for Watcom C/C++ compiler
*source/rtl/tone.c
* added support for Watcom C/C++ compiler
*source/rtl/gt/gtstd.c
* added missing return value in hb_gt_setPos()
*source/rtl/gt/gtdos.c
* added Ctrl-Break handler for Watcom C/C++ compiler
* changed USHORT - SHORT and (char *) to (unsigned char *)
to make happy C++ compilers in hb_gt_Scroll()
*source/compiler/expropt.c
* restored support for expression->( expressions_list ) syntax
* corrected bug in (expr .OR. .F.) and (expr .AND. .F.)
optimization
* corrected optimization of ( single_expr ) syntax
*source/rtl/classes.c
*source/rtl/arrays.c
* corrected assignment of NULL to an unsigned int type - some
compilers don't like it
*tests/rtl_test.prg
* added #ifdef __HARBOUR__ to suppres generation of errors that
are now reported at compile time (array[ 0 ], IIF( "str", ...) )
19991118-07:25 GMT+1 Victor Szel <info@szelvesz.hu>
+ source/common/hbfsapi.c
+ include/hbfsapi.h

View File

@@ -386,6 +386,7 @@ static char * s_OperTable[] = {
static void hb_compExprDelOperator( HB_EXPR_PTR );
static ULONG hb_compExprListReduce( HB_EXPR_PTR );
static HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR );
static void hb_compExprPushOperEq( HB_EXPR_PTR, BYTE );
static void hb_compExprUseOperEq( HB_EXPR_PTR, BYTE );
static void hb_compExprPushPreOp( HB_EXPR_PTR, BYTE );
@@ -1752,23 +1753,11 @@ static HB_EXPR_FUNC( hb_compExprUseList )
{
case HB_EA_REDUCE:
{
ULONG ulCount;
ulCount = hb_compExprListReduce( pSelf );
/*
if( ulCount == 1 && pSelf->value.asList.pExprList->ExprType <= HB_ET_VARIABLE )
{
*/
/* replace the list with a simple expression
*/
/*
HB_EXPR_PTR pExpr = pSelf;
pSelf = pSelf->value.asList.pExprList;
pExpr->value.asList.pExprList = NULL;
hb_compExprDelete( pExpr );
}
*/
hb_compExprListReduce( pSelf );
/* NOTE: if the list contains a single expression then the list
* is not reduced to this expression - if you need that reduction
* then call hb_compExprListStrip() additionaly
*/
}
break;
@@ -2083,6 +2072,8 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
return pSelf;
}
/* handler for expression->identifier syntax
*/
static HB_EXPR_FUNC( hb_compExprUseAliasVar )
{
switch( iMessage )
@@ -2204,6 +2195,8 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar )
return pSelf;
}
/* handler for expression->( exression, ... ) syntax
*/
static HB_EXPR_FUNC( hb_compExprUseAliasExpr )
{
switch( iMessage )
@@ -2211,13 +2204,61 @@ static HB_EXPR_FUNC( hb_compExprUseAliasExpr )
case HB_EA_REDUCE:
case HB_EA_ARRAY_AT:
case HB_EA_ARRAY_INDEX:
break;
case HB_EA_LVALUE:
hb_compErrorLValue( pSelf );
break;
case HB_EA_PUSH_PCODE:
{
/* save currently selected workarea
*/
hb_compGenPCode1( HB_P_PUSHALIAS );
/* push the expression that will return a new workarea
*/
HB_EXPR_USE( pSelf->value.asAlias.pAlias, HB_EA_PUSH_PCODE );
/* pop the value from the stack and select it as current workarea
*/
hb_compGenPCode1( HB_P_POPALIAS );
/* evaluate any expression
*/
HB_EXPR_USE( pSelf->value.asAlias.pExpList, HB_EA_PUSH_PCODE );
/* swap the two last items on the eval stack: one item is a
* value returned by evaluated expression and the second item
* is previously selected workarea. After swaping select again
* the restored workarea.
*/
hb_compGenPCode1( HB_P_SWAPALIAS );
}
break;
case HB_EA_POP_PCODE:
hb_compErrorLValue( pSelf );
break;
case HB_EA_PUSH_POP:
case HB_EA_STATEMENT:
hb_compWarnMeaningless( pSelf );
{
/* save currently selected workarea
*/
hb_compGenPCode1( HB_P_PUSHALIAS );
/* push the expression that will return a new workarea
*/
HB_EXPR_USE( pSelf->value.asAlias.pAlias, HB_EA_PUSH_PCODE );
/* pop the value from the stack and select it as current workarea
*/
hb_compGenPCode1( HB_P_POPALIAS );
/* evaluate any expression - it will not leave any return
* value on the eval stack
*/
HB_EXPR_USE( pSelf->value.asAlias.pExpList, HB_EA_PUSH_POP );
/* Pop and select again the restored workarea.
*/
hb_compGenPCode1( HB_P_SWAPALIAS );
}
break;
case HB_EA_DELETE:
hb_compExprDelete( pSelf->value.asAlias.pAlias );
hb_compExprDelete( pSelf->value.asAlias.pExpList );
break;
}
return pSelf;
@@ -2276,7 +2317,7 @@ static HB_EXPR_FUNC( hb_compExprUseSend )
{
case HB_EA_REDUCE:
{
pSelf->value.asMessage.pObject = HB_EXPR_USE( pSelf->value.asMessage.pObject, HB_EA_REDUCE );
pSelf->value.asMessage.pObject = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asMessage.pObject, HB_EA_REDUCE ) );
if( pSelf->value.asMessage.pParms ) /* Is it a method call ? */
pSelf->value.asMessage.pParms = HB_EXPR_USE( pSelf->value.asMessage.pParms, HB_EA_REDUCE );
}
@@ -2350,7 +2391,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostInc )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
case HB_EA_ARRAY_AT:
@@ -2386,7 +2427,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostDec )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
case HB_EA_ARRAY_AT:
@@ -2420,9 +2461,9 @@ static HB_EXPR_FUNC( hb_compExprUseAssign )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
break;
case HB_EA_ARRAY_AT:
@@ -2491,8 +2532,8 @@ static HB_EXPR_FUNC( hb_compExprUsePlusEq )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -2533,8 +2574,8 @@ static HB_EXPR_FUNC( hb_compExprUseMinusEq )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -2575,8 +2616,8 @@ static HB_EXPR_FUNC( hb_compExprUseMultEq )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -2617,8 +2658,8 @@ static HB_EXPR_FUNC( hb_compExprUseDivEq )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -2659,8 +2700,8 @@ static HB_EXPR_FUNC( hb_compExprUseModEq )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -2701,8 +2742,8 @@ static HB_EXPR_FUNC( hb_compExprUseExpEq )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -2746,8 +2787,8 @@ static HB_EXPR_FUNC( hb_compExprUseOr )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -2786,7 +2827,7 @@ static HB_EXPR_FUNC( hb_compExprUseOr )
}
else if( pRight->ExprType == HB_ET_LOGICAL )
{
if( pLeft->value.asLogical )
if( pRight->value.asLogical )
{
/* expr .OR. .T. => .T.
*/
@@ -2878,8 +2919,8 @@ static HB_EXPR_FUNC( hb_compExprUseAnd )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -2918,7 +2959,7 @@ static HB_EXPR_FUNC( hb_compExprUseAnd )
}
else if( pRight->ExprType == HB_ET_LOGICAL )
{
if( pLeft->value.asLogical )
if( pRight->value.asLogical )
{
/* expr .AND. .T. => expr
*/
@@ -3009,7 +3050,7 @@ static HB_EXPR_FUNC( hb_compExprUseNot )
{
HB_EXPR_PTR pExpr;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pExpr = pSelf->value.asOperator.pLeft;
if( pExpr->ExprType == HB_ET_LOGICAL )
@@ -3071,8 +3112,8 @@ static HB_EXPR_FUNC( hb_compExprUseEqual )
{
case HB_EA_REDUCE:
{
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
}
break;
@@ -3218,8 +3259,8 @@ static HB_EXPR_FUNC( hb_compExprUseEQ )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -3343,8 +3384,8 @@ static HB_EXPR_FUNC( hb_compExprUseLT )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -3460,8 +3501,8 @@ static HB_EXPR_FUNC( hb_compExprUseGT )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -3575,8 +3616,8 @@ static HB_EXPR_FUNC( hb_compExprUseLE )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -3691,8 +3732,8 @@ static HB_EXPR_FUNC( hb_compExprUseGE )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -3807,8 +3848,8 @@ static HB_EXPR_FUNC( hb_compExprUseNE )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -3931,8 +3972,8 @@ static HB_EXPR_FUNC( hb_compExprUseIN )
{
case HB_EA_REDUCE:
{
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
if( ( pSelf->value.asOperator.pLeft->ExprType == pSelf->value.asOperator.pRight->ExprType ) && pSelf->value.asOperator.pLeft->ExprType == HB_ET_STRING )
{
@@ -4009,8 +4050,8 @@ static HB_EXPR_FUNC( hb_compExprUsePlus )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -4156,8 +4197,8 @@ static HB_EXPR_FUNC( hb_compExprUseMinus )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -4283,8 +4324,8 @@ static HB_EXPR_FUNC( hb_compExprUseMult )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -4402,8 +4443,8 @@ static HB_EXPR_FUNC( hb_compExprUseDiv )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -4463,7 +4504,7 @@ static HB_EXPR_FUNC( hb_compExprUseDiv )
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;
pSelf->ExprType = HB_ET_NUMERIC;
@@ -4547,8 +4588,8 @@ static HB_EXPR_FUNC( hb_compExprUseMod )
{
HB_EXPR_PTR pLeft, pRight;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pRight = HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ) );
pLeft = pSelf->value.asOperator.pLeft;
pRight = pSelf->value.asOperator.pRight;
@@ -4693,7 +4734,7 @@ static HB_EXPR_FUNC( hb_compExprUseNegate )
{
HB_EXPR_PTR pExpr;
pSelf->value.asOperator.pLeft = HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE );
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
pExpr = pSelf->value.asOperator.pLeft;
if( pExpr->ExprType == HB_ET_NUMERIC )
@@ -4758,6 +4799,7 @@ static HB_EXPR_FUNC( hb_compExprUsePreInc )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -4797,6 +4839,7 @@ static HB_EXPR_FUNC( hb_compExprUsePreDec )
switch( iMessage )
{
case HB_EA_REDUCE:
pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ) );
HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE );
break;
@@ -4870,6 +4913,29 @@ static ULONG hb_compExprListReduce( HB_EXPR_PTR pExpr )
return ulCnt;
}
static HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR pSelf )
{
if( pSelf->ExprType == HB_ET_LIST )
{
ULONG ulCount = hb_compExprListLen( pSelf );
if( ulCount == 1 && pSelf->value.asList.pExprList->ExprType <= HB_ET_VARIABLE )
{
/* replace the list with a simple expression
* ( EXPR ) -> EXPR
*/
HB_EXPR_PTR pExpr = pSelf;
pSelf = pSelf->value.asList.pExprList;
pExpr->value.asList.pExprList = NULL;
hb_compExprDelete( pExpr );
}
}
return pSelf;
}
/* Generates pcodes for compound operators += -= *= /= %= ^=
*
* pExpr is an expression created by hb_compExprNew<operator>Eq functions

View File

@@ -76,7 +76,7 @@ BOOL hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ) /* creates a new array */
pBaseArray->ulLen = ulLen;
pBaseArray->uiHolders = 1;
pBaseArray->uiClass = 0;
pBaseArray->uiPrevCls = NULL;
pBaseArray->uiPrevCls = 0;
for( ulPos = 0; ulPos < ulLen; ulPos++ )
( pBaseArray->pItems + ulPos )->type = IT_NIL;

View File

@@ -654,7 +654,7 @@ HARBOUR HB___CLSINST( void )
hb_arrayNew( &hb_stack.Return, pClass->uiDatas );
hb_stack.Return.item.asArray.value->uiClass = uiClass;
hb_stack.Return.item.asArray.value->uiPrevCls = NULL;
hb_stack.Return.item.asArray.value->uiPrevCls = 0;
for( uiAt = 0; uiAt < uiLimit; uiAt++, pMeth++ )
{

View File

@@ -123,6 +123,7 @@
#if !defined(HAVE_POSIX_IO)
#define HAVE_POSIX_IO
#endif
#define ftruncate chsize
#endif
#if defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) || defined(__MINGW32__)
@@ -1055,7 +1056,7 @@ USHORT hb_fsCurDirBuff( USHORT uiDrive, BYTE * pbyBuffer, ULONG ulLen )
#if defined(HAVE_POSIX_IO)
errno = 0;
getcwd( pbyBuffer, ulLen );
getcwd( ( char * ) pbyBuffer, ulLen );
s_uiErrorLast = errno;
#elif defined(__MINGW32__)
@@ -1120,8 +1121,10 @@ USHORT hb_fsChDrv( BYTE nDrive )
#elif defined( __WATCOMC__ )
{
USHORT uiSave = _getdrive();
USHORT uiTotal;
/* 'unsigned int' _have to_ be used in Watcom
*/
unsigned int uiSave = _getdrive();
unsigned int uiTotal;
/* 1 = A:, 2 = B:, 3 = C:, etc
* _dos_*() functions don't set 'errno'
@@ -1190,8 +1193,10 @@ USHORT hb_fsIsDrv( BYTE nDrive )
#elif defined( __WATCOMC__ )
{
USHORT uiSave;
USHORT uiTotal;
/* 'unsigned int' _have to_ be used in Watcom
*/
unsigned int uiSave;
unsigned int uiTotal;
/* 1= A:, 2 = B:, 3 = C:, etc
* _dos_*() functions don't set 'errno'
@@ -1236,6 +1241,7 @@ BOOL hb_fsIsDevice( FHANDLE hFileHandle )
bResult = FALSE;
s_uiErrorLast = FS_ERROR;
HB_SYMBOL_UNUSED( hFileHandle );
#endif
@@ -1262,12 +1268,16 @@ BYTE hb_fsCurDrv( void )
#elif defined( __WATCOMC__ )
{
/* 'unsigned int' _have to_ be used in Watcom
*/
unsigned uiDrive;
/* 1 = A:, 2 = B:, 3 = C:, etc
* _dos_*() functions don't set 'errno'
*/
_dos_getdrive( &uiResult );
_dos_getdrive( &uiDrive );
s_uiErrorLast = 0;
uiResult--;
uiResult = ( USHORT ) uiDrive -1;
}
#else

View File

@@ -85,8 +85,11 @@ static char hb_gt_GetScreenMode( void );
static void hb_gt_SetCursorSize( char start, char end );
static void hb_gt_GetCursorSize( char * start, char * end );
#if defined(__WATCOMC__) && defined(__386__)
#define FAR
#if defined(__WATCOMC__)
#if defined(__386__)
#define FAR
#endif
#include <signal.h>
#endif
#ifndef __DJGPP__
static char FAR * scrnPtr;
@@ -96,6 +99,16 @@ static void hb_gt_GetCursorSize( char * start, char * end );
#ifndef __DJGPP__
BOOL hb_gtBreak = FALSE; /* Used to signal Ctrl+Break to hb_inkeyPoll() */
#if defined(__WATCOMC__)
static void hb_gt_Watcom_CtrlBreak_Handler( int iSignal )
{
/* Ctrl-Break was pressed */
/* NOTE: the layout of this function is forced by the Watcom compiler
*/
HB_SYMBOL_UNUSED( iSignal );
hb_gtBreak = TRUE;
}
#else
static int s_iOldCtrlBreak = 0;
static int hb_gt_CtrlBrkHandler( void )
@@ -104,11 +117,16 @@ static int hb_gt_CtrlBrkHandler( void )
hb_gtBreak = TRUE;
return 1;
}
#endif
static void hb_gt_CtrlBrkRestore( void )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_CtrlBrkRestore()"));
setcbrk( s_iOldCtrlBreak );
#if defined(__WATCOMC__)
signal( SIGBREAK, SIG_DFL);
#else
setcbrk( s_iOldCtrlBreak );
#endif
}
#endif
@@ -121,12 +139,17 @@ void hb_gt_Init( void )
__djgpp_hwint_flags |= 2; /* Count Ctrl+Break instead of killing program */
__djgpp_set_ctrl_c( 0 ); /* Disable Ctrl+C */
__djgpp_set_sigquit_key( 0 ); /* Disable Ctrl+\ */
#else
/* Set the Ctrl+Break handler [vszel] */
ctrlbrk( hb_gt_CtrlBrkHandler );
s_iOldCtrlBreak = getcbrk();
setcbrk( 1 );
#if defined(__WATCOMC__)
signal( SIGBREAK, hb_gt_Watcom_CtrlBreak_Handler );
#else
ctrlbrk( hb_gt_CtrlBrkHandler );
s_iOldCtrlBreak = getcbrk();
setcbrk( 1 );
#endif
atexit( hb_gt_CtrlBrkRestore );
/* */
@@ -236,7 +259,7 @@ void hb_gt_SetPos( USHORT usRow, USHORT usCol )
BYTE cRow, cCol;
cRow = ( BYTE ) usRow;
cCol = ( BYTE ) usCol;
_AH = 0x02;
_BH = 0;
_DH = cRow;
@@ -394,7 +417,7 @@ static void hb_gt_xGetXY( USHORT cRow, USHORT cCol, BYTE * attr, BYTE * ch )
}
#endif
}
void hb_gt_xPutch( USHORT cRow, USHORT cCol, BYTE attr, BYTE ch )
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_xPutch(%hu, %hu, %d, %d", cRow, cCol, (int) attr, (int) ch));
@@ -426,7 +449,7 @@ void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, BYTE *str, ULONG len )
int width;
BYTE * ch_attr;
BYTE * ptr;
i = ( int ) len;
left = cCol;
top = cRow;
@@ -445,7 +468,7 @@ void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, BYTE *str, ULONG len )
/*
* Calculate end row position and the remainder size for the
* end column adjust.
*/
*/
bottom += ( i / width );
i = i % width;
}
@@ -485,7 +508,7 @@ void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight
#else
{
USHORT x, y;
for( y = usTop; y <= usBottom; y++ )
{
for( x = usLeft; x <= usRight; x++ )
@@ -509,7 +532,7 @@ void hb_gt_PutText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight
#else
{
USHORT x, y;
for( y = usTop; y <= usBottom; y++ )
{
for( x = usLeft; x <= usRight; x++ )
@@ -597,7 +620,10 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight,
{
int iRows = sVert, iCols = sHoriz;
USHORT usRow, usCol;
/* NOTE: 'SHORT' is used intentionally to correctly compile
* with C++ compilers
*/
SHORT usRow, usCol;
USHORT uiSize; /* gtRectSize returns int */
int iLength = ( usRight - usLeft ) + 1;
int iCount, iColOld, iColNew, iColSize;
@@ -608,8 +634,11 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight,
if( hb_gtRectSize( usTop, usLeft, usBottom, usRight, &uiSize ) == 0 )
{
char * fpBlank = ( char * ) hb_xgrab( iLength );
char * fpBuff = ( char * ) hb_xgrab( iLength * 2 );
/* NOTE: 'unsigned' is used intentionally to correctly compile
* with C++ compilers
*/
unsigned char * fpBlank = ( unsigned char * ) hb_xgrab( iLength );
unsigned char * fpBuff = ( unsigned char * ) hb_xgrab( iLength * 2 );
memset( fpBlank, ' ', iLength );

View File

@@ -182,6 +182,7 @@ void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight,
HB_SYMBOL_UNUSED( uiLeft );
HB_SYMBOL_UNUSED( uiBottom );
HB_SYMBOL_UNUSED( uiRight );
HB_SYMBOL_UNUSED( byAttr );
HB_SYMBOL_UNUSED( iRows );
HB_SYMBOL_UNUSED( iCols );
}
@@ -206,6 +207,8 @@ BOOL hb_gt_SetMode( USHORT uiMaxRow, USHORT uiMaxCol )
s_uiMaxRow = uiMaxRow;
s_uiMaxCol = uiMaxCol;
return 0;
}
void hb_gt_Replicate( BYTE byChar, ULONG ulLen )

View File

@@ -74,6 +74,9 @@
#include <Windows32/Structures.h>
#include <Windows32/CommonFunctions.h>
#define HB_DONT_DEFINE_BASIC_TYPES
#elif defined( __WATCOMC__ )
#include <i86.h>
#include <time.h>
#endif
#include "extend.h"
@@ -145,7 +148,7 @@ void hb_tone( double dFrequency, double dDuration )
ULONG temp;
#elif defined(OS2) || defined(__MINGW32__)
USHORT temp;
#elif defined(__DJGPP__) || defined(__BORLANDC__)
#elif defined(__DJGPP__) || defined(__BORLANDC__) || defined(__WATCOMC__)
USHORT temp; /* Use USHORT, because this variable gets added to clock()
to form end_clock and we want to minimize overflow risk */
clock_t end_clock;
@@ -164,7 +167,7 @@ void hb_tone( double dFrequency, double dDuration )
dFrequency = HB_MIN_( HB_MAX_( 0.0, dFrequency ), 32767.0 );
dDuration = dDuration * CLOCKS_PER_SEC / 18.2 ; /* clocks */
#endif
#if defined(__BORLANDC__) && ! defined(_Windows) && ! defined(WINNT)
#if ( defined(__BORLANDC__) && ! defined(_Windows) && ! defined(WINNT) ) || defined(__WATCOMC__)
sound( ( unsigned ) dFrequency );
#elif defined(__DJGPP__)
sound( ( int ) dFrequency );
@@ -173,7 +176,7 @@ void hb_tone( double dFrequency, double dDuration )
{
#if defined(HARBOUR_GCC_OS2) || defined(_Windows) || defined(__CYGWIN__) || defined(WINNT)
temp = HB_MIN_( HB_MAX_( 0, dDuration ), ULONG_MAX );
#elif defined(OS2) || defined(__BORLANDC__) || defined(__DJGPP__) || defined(__MINGW32__)
#elif defined(OS2) || defined(__BORLANDC__) || defined(__DJGPP__) || defined(__MINGW32__) || defined(__WATCOMC__)
temp = HB_MIN_( HB_MAX_( 0, dDuration ), USHRT_MAX );
#endif
dDuration -= temp;
@@ -198,7 +201,7 @@ void hb_tone( double dFrequency, double dDuration )
both parameters and either generates the default sound
event or the standard system beep. */
Beep( ( ULONG ) dFrequency, temp );
#elif defined(__DJGPP__) || ( defined(__BORLANDC__) && ! defined(_Windows) )
#elif defined(__DJGPP__) || ( defined(__BORLANDC__) && ! defined(_Windows) ) || defined(__WATCOMC__)
/* Note: delay() in <dos.h> for DJGPP does not work and
delay() in <dos.h> for BORLANDC is not multi-
tasking friendly. */
@@ -208,7 +211,7 @@ void hb_tone( double dFrequency, double dDuration )
#endif
}
}
#if defined(__BORLANDC__) && ! defined(_Windows)
#if ( defined(__BORLANDC__) && ! defined(_Windows) ) || defined(__WATCOMC__)
nosound();
#elif defined(__DJGPP__)
sound( 0 );

View File

@@ -809,7 +809,10 @@ STATIC FUNCTION Main_HVM()
TEST_LINE( .NOT. .F. , .T. )
TEST_LINE( .NOT. 1 , "E BASE 1077 Argument error .NOT. F:S" )
#ifndef __HARBOUR__
// this error is reported at compile time
TEST_LINE( iif( "A", ":T:", ":F:" ) , "E BASE 1066 Argument error conditional " )
#endif
TEST_LINE( iif( .T., ":T:", ":F:" ) , ":T:" )
TEST_LINE( iif( .F., ":T:", ":F:" ) , ":F:" )
@@ -824,14 +827,20 @@ STATIC FUNCTION Main_HVM()
TEST_LINE( &mxNotHere. , "E BASE 1003 Variable does not exist MXUNDECL F:R" )
#endif
#ifndef __HARBOUR__
// this error is reported at compile time
TEST_LINE( saArray[ 0 ] , "E BASE 1132 Bound error array access " )
TEST_LINE( saArray[ 0 ] := 1 , "E BASE 1133 Bound error array assign " )
#endif
TEST_LINE( saArray[ 1000 ] , "E BASE 1132 Bound error array access " )
TEST_LINE( saArray[ 1000 ] := 1 , "E BASE 1133 Bound error array assign " )
#ifndef __HARBOUR__
// this error is reported at compile time
TEST_LINE( saArray[ -1 ] , "E BASE 1132 Bound error array access " )
TEST_LINE( saArray[ -1 ] := 1 , "E BASE 1133 Bound error array assign " )
TEST_LINE( saArray[ "1" ] , "E BASE 1068 Argument error array access F:S" )
TEST_LINE( saArray[ "1" ] := 1 , "E BASE 1069 Argument error array assign " )
#endif
/* Alias */