diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aeba9653e2..ddd52f21af 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,17 @@ +2001-04-07 13:25 UTC-0800 Ron Pinkas + * source/compiler/hbpcode.c + ! Fixed some StrongType logic. + + * source/compiler/genc.c + * source/rdd/dbf1.c + * source/rtl/gtapi.c + * source/vm/hvm.c + ! Corrected Compiler warnings. + + * source/compiler/harbour.c + * include/hbcomp.h + * Minor formatting. + 2001-07-01 21:20 GMT+3 Alexander Kresin Changes, provided by Marek Paliwoda. *doc/en/gtslang.txt diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 03d8d28ded..886cf02b74 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -90,23 +90,22 @@ struct _COMCLASS; /* forward declaration */ /* Declared Function/Method support structure */ typedef struct _COMDECLARED { - char * szName; /* the name of the symbol */ - BYTE cType; - BYTE * cParamTypes; - USHORT iParamCount; - struct _COMCLASS * pClass; - struct _COMCLASS * ( * pParamClasses ); - struct _COMDECLARED * pNext; /* pointer to the next declared function */ + char * szName; /* the name of the symbol */ + BYTE cType; + BYTE * cParamTypes; + USHORT iParamCount; + struct _COMCLASS * pClass; + struct _COMCLASS * ( * pParamClasses ); + struct _COMDECLARED * pNext; /* pointer to the next declared function */ } COMDECLARED, * PCOMDECLARED; - /* Declared Class support structure */ typedef struct _COMCLASS { - char * szName; - PCOMDECLARED pMethod; + char * szName; + PCOMDECLARED pMethod; struct _COMCLASS * pNext; - PCOMDECLARED pLast; + PCOMDECLARED pLast; } COMCLASS, * PCOMCLASS; /* locals, static, public variables support */ @@ -156,7 +155,7 @@ typedef struct __FUNC struct __FUNC * pNext; /* pointer to the next defined function */ } _FUNC, * PFUNCTION; -/* structure to hold a Clipper defined function */ +/* structure to hold an INLINE block of source */ typedef struct __INLINE { char * szName; /* name of a inline function */ diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index 43959f9df3..d1d8cf0705 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -1607,7 +1607,7 @@ static HB_GENC_FUNC( hb_p_statics ) i = 0; - while( ( chr = pVar->szName[ i++ ] ) ) + while( ( chr = pVar->szName[ i++ ] ) == TRUE ) { if( chr == '\'' || chr == '\\') fprintf( cargo->yyc, " \'\\%c\',", chr ); @@ -1876,4 +1876,4 @@ static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc ) if( nChar != 0) fprintf( yyc, "\n" ); -} \ No newline at end of file +} diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 7916dab51a..c7c6e9f692 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -3221,12 +3221,13 @@ void hb_compStaticDefEnd( void ) */ void hb_compCodeBlockStart() { - PFUNCTION pFunc = hb_compFunctionNew( NULL, HB_FS_STATIC ); + PFUNCTION pBlock; - pFunc->pOwner = hb_comp_functions.pLast; - pFunc->iStaticsBase = hb_comp_functions.pLast->iStaticsBase; + pBlock = hb_compFunctionNew( NULL, HB_FS_STATIC ); + pBlock->pOwner = hb_comp_functions.pLast; + pBlock->iStaticsBase = hb_comp_functions.pLast->iStaticsBase; - hb_comp_functions.pLast = pFunc; + hb_comp_functions.pLast = pBlock; hb_compLinePushIfDebugger(); } @@ -3304,7 +3305,7 @@ void hb_compCodeBlockEnd( void ) hb_xfree( ( void * ) pFree ); } - hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, ( BOOL ) 1 ); + hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, ( BOOL ) 0 ); hb_compGenPCode1( HB_P_ENDBLOCK ); /* finish the codeblock */ /* this fake-function is no longer needed */ diff --git a/harbour/source/compiler/hbpcode.c b/harbour/source/compiler/hbpcode.c index 65bd12b30c..4681e11042 100644 --- a/harbour/source/compiler/hbpcode.c +++ b/harbour/source/compiler/hbpcode.c @@ -243,9 +243,9 @@ void hb_compStrongType( int iSize ) else if( pFunc->iStackSize - pFunc->iStackIndex < 4 ) pFunc->pStack = ( BYTE * ) hb_xrealloc( pFunc->pStack, pFunc->iStackSize += 16 ); - /* TODO Split under conitions for the different matching possible iSize. */ + /* TODO: Split under conitions for the different matching possible iSize. */ - /* TODO Subject to Operator Overloading! */ + /* TODO: Subject to Operator Overloading! */ switch ( pFunc->pCode[ ulPos ] ) { @@ -1194,11 +1194,13 @@ void hb_compStrongType( int iSize ) break; /* Blcoks */ + /* + case HB_P_PUSHBLOCKSHORT : + break; - /* Nothing to do, handled by HB_P_ENDBLOCK. case HB_P_PUSHBLOCK : - case HB_P_PUSHBLOCKSHORT : - */ + break; + */ case HB_P_ENDBLOCK : /* Override the last value of the block left on the stack. */ @@ -1302,7 +1304,7 @@ void hb_compStrongType( int iSize ) case HB_P_PUSHLOCALREF : case HB_P_PUSHLOCAL : if( pFunc->pCode[ ulPos ] == HB_P_PUSHLOCALNEAR ) - wVar = ( SHORT ) pFunc->pCode[ ulPos + 1 ]; + wVar = ( signed char ) pFunc->pCode[ ulPos + 1 ]; else wVar = * ( ( SHORT * ) &( pFunc->pCode )[ ulPos + 1 ] ); @@ -1314,18 +1316,36 @@ void hb_compStrongType( int iSize ) /* Might be a nested block. */ while ( pTmp->pOwner ) - pTmp = pTmp->pOwner; + { + pTmp = pTmp->pOwner; + } - pVar = hb_compVariableFind( pTmp->pLocals, -wVar ); + pVar = pFunc->pStatics; + while( ++wVar < 0 && pVar ) + { + pVar = pVar->pNext; + } + + if ( pVar ) + { + wVar = hb_compVariableGetPos( pTmp->pLocals, pVar->szName ); + pVar = hb_compVariableFind( pTmp->pLocals, wVar ); + } } else + { pVar = hb_compVariableFind( pFunc->pLocals, wVar ); + } if( pVar ) { if( ! ( pVar->iUsed & VU_INITIALIZED ) ) hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_NOT_INITIALIZED, pVar->szName, NULL ); + /* + printf( "\nUsed: %s\n", pVar->szName ); + */ + /* Mark as used */ pVar->iUsed |= VU_USED; @@ -1346,11 +1366,16 @@ void hb_compStrongType( int iSize ) pFunc->pStack[ pFunc->iStackIndex++ ] = pVar->cType; } else + { + /* + printf( "\nCould not find Local %i in: $s\n", wVar, pFunc->szName ); + */ + if( pFunc->pCode[ ulPos ] == HB_P_PUSHLOCALREF ) pFunc->pStack[ pFunc->iStackIndex++ ] = '@'; else pFunc->pStack[ pFunc->iStackIndex++ ] = ' '; - + } break; case HB_P_PUSHSTATICREF : @@ -1442,19 +1467,29 @@ void hb_compStrongType( int iSize ) if( pFunc->pCode[ ulPos ] == HB_P_PUSHMEMVAR && pSym->szName ) { if( pFunc->pMemvars ) + { wVar = hb_compVariableGetPos( pFunc->pMemvars, pSym->szName ); + } if( wVar ) + { pVar = hb_compVariableFind( pFunc->pMemvars, wVar ); + } if( ! pVar ) + { pVar = hb_compPrivateFind( pSym->szName ); + } if( ( ! pVar ) && hb_comp_functions.pFirst->pMemvars ) { wVar = hb_compVariableGetPos( hb_comp_functions.pFirst->pMemvars, pSym->szName ); if( wVar ) + { pVar = hb_compVariableFind( hb_comp_functions.pFirst->pMemvars, wVar ); + /* May have been initialized in any other function - can't check. */ + pVar->iUsed |= VU_INITIALIZED; + } } } @@ -1988,17 +2023,31 @@ void hb_compStrongType( int iSize ) /* we are accesing variables within a codeblock */ if( wVar < 0 ) { - /* Finding the Function owning the block. */ - pTmp = pFunc->pOwner; + /* Finding the Function owning the block. */ + pTmp = pFunc->pOwner; - /* Might be a nested block. */ - while ( pTmp->pOwner ) - pTmp = pTmp->pOwner; + /* Might be a nested block. */ + while ( pTmp->pOwner ) + { + pTmp = pTmp->pOwner; + } - pVar = hb_compVariableFind( pTmp->pLocals, -wVar ); + pVar = pFunc->pStatics; + while( ++wVar < 0 && pVar ) + { + pVar = pVar->pNext; + } + + if ( pVar ) + { + wVar = hb_compVariableGetPos( pTmp->pLocals, pVar->szName ); + pVar = hb_compVariableFind( pTmp->pLocals, wVar ); + } } else + { pVar = hb_compVariableFind( pFunc->pLocals, wVar ); + } if( pVar ) { diff --git a/harbour/source/rdd/dbf1.c b/harbour/source/rdd/dbf1.c index 3e5b382ec6..a503a8bdb4 100644 --- a/harbour/source/rdd/dbf1.c +++ b/harbour/source/rdd/dbf1.c @@ -2384,7 +2384,6 @@ ERRCODE hb_dbfOpenMemFile( DBFAREAP pArea, LPDBOPENINFO pOpenInfo ) if( pError ) { hb_errRelease( pError ); - pError = NULL; } return ( pArea->hMemoFile == FS_ERROR ? FAILURE : SUCCESS ); } @@ -2517,4 +2516,4 @@ HB_FUNC( DBF_GETFUNCTABLE ) hb_retni( hb_rddInherit( pTable, &dbfTable, &dbfSuper, 0 ) ); else hb_retni( FAILURE ); -} \ No newline at end of file +} diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 7fd41086ba..e2caafdc80 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -443,7 +443,7 @@ USHORT hb_gtColorToN( char * szColorString ) HB_TRACE(HB_TR_DEBUG, ("hb_gtColorToN(%s)", szColorString)); - while( c = *szColorString++ ) + while( ( c = *szColorString++ ) == TRUE ) { c = toupper( c ); diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index ca290b1cfc..600f8989ef 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -2894,9 +2894,7 @@ void hb_vmSend( USHORT uiParams ) if( ! HB_IS_NIL( pSelf ) ) /* are we sending a message ? */ { - if( pSym == &( hb_symEval ) && HB_IS_BLOCK( pSelf ) ) - pFunc = pSym->pFunPtr; /* __EVAL method = function */ - else + if( ! ( pSym == &( hb_symEval ) && HB_IS_BLOCK( pSelf ) ) ) { if( HB_IS_OBJECT( pSelf ) ) /* Object passed */ { @@ -2931,8 +2929,6 @@ void hb_vmSend( USHORT uiParams ) { char *sClass, sDesc[64]; - pFunc = NULL; - if( HB_IS_POINTER( pSelf ) ) sClass = "POINTER"; else if( HB_IS_DATE( pSelf ) )