From c9fde7451a37f8e4bc5ca146d3f978355959ae37 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 25 Aug 2008 14:02:59 +0000 Subject: [PATCH] 2008-08-25 16:01 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/macro.c * harbour/source/vm/hvm.c ! fixed _FIELD indirectly used as alias, f.e.: ? ("_FIELD")->NAME or: M->var := "_FIELD" ? ("&var")->NAME * harbour/include/hbclass.ch * harbour/include/common.ch * use a little bit simpler form for HB_SYMBOL_UNUSED() * harbour/contrib/hbw32/w32_ole.c * harbour/contrib/hbole/ole2.c ! fixed numeric to pointer casting * accept both pointer and numeric values as window handle for easier code migration --- harbour/ChangeLog | 19 +++++++++++++++++++ harbour/contrib/hbole/ole2.c | 4 +++- harbour/contrib/hbw32/w32_ole.c | 4 +++- harbour/include/common.ch | 2 +- harbour/include/hbclass.ch | 2 +- harbour/source/vm/hvm.c | 12 ++++++++---- harbour/source/vm/macro.c | 8 ++++++-- 7 files changed, 41 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ce16eb14e2..b9ed7633bc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-08-25 16:01 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/vm/macro.c + * harbour/source/vm/hvm.c + ! fixed _FIELD indirectly used as alias, f.e.: + ? ("_FIELD")->NAME + or: + M->var := "_FIELD" + ? ("&var")->NAME + + * harbour/include/hbclass.ch + * harbour/include/common.ch + * use a little bit simpler form for HB_SYMBOL_UNUSED() + + * harbour/contrib/hbw32/w32_ole.c + * harbour/contrib/hbole/ole2.c + ! fixed numeric to pointer casting + * accept both pointer and numeric values as window handle + for easier code migration + 2008-08-25 14:46 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/vm/cmdarg.c ! hb_hInstance, hb_hPrevInstance, s_iCmdShow, s_WinMainParam diff --git a/harbour/contrib/hbole/ole2.c b/harbour/contrib/hbole/ole2.c index d74e120b48..6ca8f3a376 100644 --- a/harbour/contrib/hbole/ole2.c +++ b/harbour/contrib/hbole/ole2.c @@ -644,7 +644,9 @@ HB_FUNC( MESSAGEBOX ) { LPTSTR lpStr1 = HB_TCHAR_CONVTO( hb_parcx( 2 ) ); LPTSTR lpStr2 = HB_TCHAR_CONVTO( hb_parcx( 3 ) ); - hb_retni( MessageBox( ( HWND ) hb_parnint( 1 ), lpStr1, lpStr2, hb_parni( 4 ) ) ); + HWND hWnd = ISNUM( 1 ) ? ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) : + ( HWND ) hb_parptr( 1 ); + hb_retni( MessageBox( hWnd, lpStr1, lpStr2, hb_parni( 4 ) ) ); HB_TCHAR_FREE( lpStr1 ); HB_TCHAR_FREE( lpStr2 ); } diff --git a/harbour/contrib/hbw32/w32_ole.c b/harbour/contrib/hbw32/w32_ole.c index c2ca460584..bbcc97fbe8 100644 --- a/harbour/contrib/hbw32/w32_ole.c +++ b/harbour/contrib/hbw32/w32_ole.c @@ -1370,7 +1370,9 @@ HB_FUNC( MESSAGEBOX ) { LPTSTR lpStr1 = HB_TCHAR_CONVTO( hb_parcx( 2 ) ); LPTSTR lpStr2 = HB_TCHAR_CONVTO( hb_parcx( 3 ) ); - hb_retni( MessageBox( ( HWND ) hb_parnint( 1 ), lpStr1, lpStr2, hb_parni( 4 ) ) ); + HWND hWnd = ISNUM( 1 ) ? ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) : + ( HWND ) hb_parptr( 1 ); + hb_retni( MessageBox( hWnd, lpStr1, lpStr2, hb_parni( 4 ) ) ); HB_TCHAR_FREE( lpStr1 ); HB_TCHAR_FREE( lpStr2 ); } diff --git a/harbour/include/common.ch b/harbour/include/common.ch index 1ccb471a69..fa64464004 100644 --- a/harbour/include/common.ch +++ b/harbour/include/common.ch @@ -82,7 +82,7 @@ optimized out by the compiler, so it won't cause any overhead. It can be used in codeblocks, too. */ /* Please keep it synced with the similar #define in hbclass.ch */ -#define HB_SYMBOL_UNUSED( symbol ) ( symbol := ( symbol ) ) +#define HB_SYMBOL_UNUSED( symbol ) ( ( symbol ) ) /* HASH autoadd options */ #define HB_HAUTOADD_NEVER 0x00 diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index 5420473a4c..52783dc587 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -207,7 +207,7 @@ #endif /* Please keep it synced with the similar #define in common.ch */ -#define __HB_CLS_SYMBOL_UNUSED( symbol ) ( symbol := ( symbol ) ) +#define __HB_CLS_SYMBOL_UNUSED( symbol ) ( ( symbol ) ) #xtranslate __HB_CLS_VARERR() => __HB_CLS_ERR( Invalid instance variable name: ) diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 14d070efba..79352b5902 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -5772,8 +5772,10 @@ static void hb_vmPushAliasedVar( PHB_SYMB pSym ) } } else if( pAlias->item.asString.length >= 4 && - hb_strnicmp( szAlias, "FIELD", /* FIELD-> or FIEL-> */ - pAlias->item.asString.length ) == 0 ) + ( hb_strnicmp( szAlias, "FIELD", /* FIELD-> or FIEL-> */ + pAlias->item.asString.length ) == 0 || + hb_strnicmp( szAlias, "_FIELD", /* _FIELD-> or _FIE-> */ + pAlias->item.asString.length ) == 0 ) ) { hb_rddGetFieldValue( pAlias, pSym ); return; @@ -6073,8 +6075,10 @@ static void hb_vmPopAliasedVar( PHB_SYMB pSym ) } } else if( pAlias->item.asString.length >= 4 && - hb_strnicmp( szAlias, "FIELD", /* FIELD-> or FIEL-> */ - pAlias->item.asString.length ) == 0 ) + ( hb_strnicmp( szAlias, "FIELD", /* FIELD-> or FIEL-> */ + pAlias->item.asString.length ) == 0 || + hb_strnicmp( szAlias, "_FIELD", /* _FIELD-> or _FIE-> */ + pAlias->item.asString.length ) == 0 ) ) { hb_rddPutFieldValue( hb_stackItemFromTop( -2 ), pSym ); hb_stackPop(); /* alias */ diff --git a/harbour/source/vm/macro.c b/harbour/source/vm/macro.c index de951b58de..c4bed00126 100644 --- a/harbour/source/vm/macro.c +++ b/harbour/source/vm/macro.c @@ -1281,7 +1281,9 @@ void hb_macroGenPopAliasedVar( char * szVarName, /* TODO: memvars created inside TYPE() function should have PUBLIC scope */ hb_macroMemvarGenPCode( HB_P_MPOPMEMVAR, szVarName, HB_COMP_PARAM ); } - else if( iLen >= 4 && iLen <= 5 && strncmp( szAlias, "FIELD", iLen ) == 0 ) + else if( iLen >= 4 && iLen <= 6 && + ( strncmp( szAlias, "FIELD", iLen ) == 0 || + strncmp( szAlias, "_FIELD", iLen ) == 0 ) ) { /* FIELD-> */ hb_macroMemvarGenPCode( HB_P_MPOPFIELD, szVarName, HB_COMP_PARAM ); } @@ -1374,7 +1376,9 @@ void hb_macroGenPushAliasedVar( char * szVarName, { /* M-> or MEMV-> or MEMVA-> or MEMVAR-> variable */ hb_macroMemvarGenPCode( HB_P_MPUSHMEMVAR, szVarName, HB_COMP_PARAM ); } - else if( iLen >= 4 && iLen <= 5 && strncmp( szAlias, "FIELD", iLen ) == 0 ) + else if( iLen >= 4 && iLen <= 6 && + ( strncmp( szAlias, "FIELD", iLen ) == 0 || + strncmp( szAlias, "_FIELD", iLen ) == 0 ) ) { /* FIELD-> */ hb_macroMemvarGenPCode( HB_P_MPUSHFIELD, szVarName, HB_COMP_PARAM ); }