diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 608a80b837..a5d1f5f6e9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ + + added support for executing functions with :EXEC() + registered dynamically after creating + + * harbour/source/vm/hvm.c + * minor modification + +2006-09-04 18:10 UTC+0100 Viktor Szakats (viktor.szakats syenar.hu) + * harbour/source/rtl/tlabel.prg + * harbour/source/rtl/treport.prg + ! Made the logic multiplatform where it's decided whether to + add a default extension to the loaded filename. + C:\PATH.A\MYFILE didn't get the default extension while + C:\PATH\MYFILE did. + +2006-09-04 11:40 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbexprc.c + ! fixed bug in wrong integer negating, f.e.: + proc main(); local i:=0; i-=-32768; ? i; return + ! fixed PCODE generated for +=, -=, /=, *= expressions when right side of expression is undefined variable - it's possible that it will be field and we will have RT error. It fixes tt4.prg example form TODO file. diff --git a/harbour/TODO b/harbour/TODO index 741e495a2e..d5ee27484c 100644 --- a/harbour/TODO +++ b/harbour/TODO @@ -264,36 +264,4 @@ Detail...: An error in the evaluated macro cause memory leak. `- Status...: Open. -*** - -Assign to: -Detail...: When compiled with Harbour and then run it gives BASE/1003 - Variable not exist: NUM1 with CA-Clipper it works as it - recognize NUM1 as FIELD. - - --tt4.prg-- - PROC MAIN() - LOCAL nRecs, nTotal - DBCREATE( "TEST", { { "NUM1", "N", 5, 0 } } ) - USE TEST - FOR nRecs := 1 TO 10 - APPEND BLANK - REPLACE NUM1 WITH RECN() - NEXT nRecs - nTotal := 0 - GO TOP - WHILE .NOT. EOF() - nTotal += NUM1 // It fail here - SKIP - ENDDO - QOUT( nTotal ) - RETURN - ----------- - - bld_b32 tt4 /n - tt4 - -Status...: Open. - ======================================================================= - diff --git a/harbour/include/hbexprc.c b/harbour/include/hbexprc.c index 3d27ffb088..e0629a4748 100644 --- a/harbour/include/hbexprc.c +++ b/harbour/include/hbexprc.c @@ -173,7 +173,8 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { int iScope = hb_compVariableScope( pSelf->value.asOperator.pLeft->value.asSymbol ); - if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) ) + if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && + iScope != HB_VS_UNDECLARED ) { HB_EXPRTYPE iType = pSelf->value.asOperator.pRight->ExprType; @@ -186,18 +187,21 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) if( iLocal < 256 && hb_compExprIsInteger( pSelf->value.asOperator.pRight ) ) { - int iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.lVal; + short iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.lVal; - if( bOpEq == HB_P_MINUS ) + if( bOpEq != HB_P_MINUS || iIncrement >= -INT16_MAX ) { - iIncrement = -iIncrement; + if( bOpEq == HB_P_MINUS ) + { + iIncrement = -iIncrement; + } + + hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), ( BOOL ) 0 ); + + HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); + + return; } - - hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), ( BOOL ) 0 ); - - HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); - - return; } } /* NOTE: direct type change */ @@ -227,7 +231,8 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { int iScope = hb_compVariableScope( pSelf->value.asOperator.pRight->value.asSymbol ); - if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) ) + if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && + iScope != HB_VS_UNDECLARED ) { /* NOTE: direct type change */ pSelf->value.asOperator.pLeft->ExprType = HB_ET_VARREF; @@ -306,7 +311,8 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { int iScope = hb_compVariableScope( pSelf->value.asOperator.pLeft->value.asSymbol ); - if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) ) + if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && + iScope != HB_VS_UNDECLARED ) { HB_EXPRTYPE iType = pSelf->value.asOperator.pRight->ExprType, iOldType; @@ -321,14 +327,16 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { short iIncrement = ( short ) pSelf->value.asOperator.pRight->value.asNum.lVal; - if( bOpEq == HB_P_MINUS ) + if( bOpEq != HB_P_MINUS || iIncrement >= -INT16_MAX ) { - iIncrement = -iIncrement; + if( bOpEq == HB_P_MINUS ) + { + iIncrement = -iIncrement; + } + + hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), ( BOOL ) 0 ); + return; } - - hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), ( BOOL ) 0 ); - - return; } } /* NOTE: direct type change */ @@ -360,7 +368,8 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) { int iScope = hb_compVariableScope( pSelf->value.asOperator.pRight->value.asSymbol ); - if( ! ( iScope == HB_VS_LOCAL_FIELD || iScope == HB_VS_GLOBAL_FIELD ) ) + if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && + iScope != HB_VS_UNDECLARED ) { /* NOTE: direct type change */ iOldType = pSelf->value.asOperator.pLeft->ExprType; diff --git a/harbour/source/vm/classes.c b/harbour/source/vm/classes.c index 4b576b49fe..760113d428 100644 --- a/harbour/source/vm/classes.c +++ b/harbour/source/vm/classes.c @@ -1530,7 +1530,7 @@ HB_FUNC( __CLSADDMSG ) uiIndex = ( USHORT ) hb_parni( 3 ); uiSprClass = ( USHORT ) hb_parni( 5 ); fOK = uiSprClass && uiSprClass <= s_uiClasses && - uiIndex < pClass->uiDatas; + (uiIndex == 0 || uiIndex < pClass->uiDatas); break; case HB_OO_MSG_DATA: diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index df486930b8..2399acbef4 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -1961,7 +1961,7 @@ static void hb_vmNegate( void ) if( HB_IS_INTEGER( pItem ) ) { #if -HB_INT_MAX > HB_INT_MIN - if ( pItem->item.asInteger.value < -HB_INT_MAX ) + if( pItem->item.asInteger.value < -HB_INT_MAX ) { #if HB_LONG_MAX > HB_INT_MAX HB_LONG lValue = ( HB_LONG ) pItem->item.asInteger.value; @@ -1985,7 +1985,7 @@ static void hb_vmNegate( void ) else if( HB_IS_LONG( pItem ) ) { #if -HB_LONG_MAX > HB_LONG_MIN - if ( pItem->item.asLong.value < -HB_LONG_MAX ) + if( pItem->item.asLong.value < -HB_LONG_MAX ) { double dValue = ( double ) pItem->item.asLong.value; pItem->type = HB_IT_DOUBLE; @@ -2027,7 +2027,7 @@ static void hb_vmPlus( 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 >= lNumber1 : lResult < lNumber1 ) + if( lNumber2 >= 0 ? lResult >= lNumber1 : lResult < lNumber1 ) { hb_itemPutNInt( pResult, lResult ); } @@ -2120,7 +2120,7 @@ static void hb_vmMinus( HB_ITEM_PTR pResult, HB_ITEM_PTR pItem1, HB_ITEM_PTR pIt HB_LONG lNumber2 = HB_ITEM_GET_NUMINTRAW( pItem2 ); HB_LONG lResult = lNumber1 - lNumber2; - if ( lNumber2 >= 0 ? lResult >= lNumber1 : lResult < lNumber1 ) + if( lNumber2 <= 0 ? lResult >= lNumber1 : lResult < lNumber1 ) { hb_itemPutNInt( pResult, lResult ); }