From c03dbf4af98918a64622ac9259850e3dd54d0f34 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 12 Sep 2012 09:51:24 +0000 Subject: [PATCH] 2012-09-12 11:51 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/include/hbmacro.h * harbour/src/vm/macro.c % added static function hb_macroClear() and cleand hb_macroDelete() code - removed not longer necessary HB_MACRO_DEALLOCATE macro * harbour/src/rdd/hsx/hsx.c * use hb_vmDestroyBlockOrMacro() * harbour/src/vm/hvm.c * allow to execute hb_vmThreadState() by threads without HVM stack * harbour/src/3rd/zlib/gzlib.c * harbour/src/3rd/zlib/zlib.dif * updated for Digital Mars builds builds * harbour/src/rtl/gtwvt/gtwvt.c * pacified warning --- harbour/ChangeLog | 19 +++++++++++++++++++ harbour/include/hbmacro.h | 1 - harbour/src/3rd/zlib/gzlib.c | 2 +- harbour/src/3rd/zlib/zlib.dif | 2 +- harbour/src/rdd/hsx/hsx.c | 4 +--- harbour/src/rtl/gtwvt/gtwvt.c | 2 +- harbour/src/vm/hvm.c | 2 +- harbour/src/vm/macro.c | 29 +++++++++++++++++------------ 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index be0b776d18..1df9c0ab05 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,25 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-12 11:51 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/include/hbmacro.h + * harbour/src/vm/macro.c + % added static function hb_macroClear() and cleand hb_macroDelete() code + - removed not longer necessary HB_MACRO_DEALLOCATE macro + + * harbour/src/rdd/hsx/hsx.c + * use hb_vmDestroyBlockOrMacro() + + * harbour/src/vm/hvm.c + * allow to execute hb_vmThreadState() by threads without HVM stack + + * harbour/src/3rd/zlib/gzlib.c + * harbour/src/3rd/zlib/zlib.dif + * updated for Digital Mars builds builds + + * harbour/src/rtl/gtwvt/gtwvt.c + * pacified warning + 2012-09-11 16:27 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/hbgtwvg.ch + Added: constants HB_GTE_CREATED and HB_GTE_CLOSED. diff --git a/harbour/include/hbmacro.h b/harbour/include/hbmacro.h index 983642cf71..23aadc7509 100644 --- a/harbour/include/hbmacro.h +++ b/harbour/include/hbmacro.h @@ -79,7 +79,6 @@ HB_EXTERN_BEGIN #define HB_MACRO_GEN_PARE 16 /* generate parentesized list */ #define HB_MACRO_GEN_LIST 32 /* generate push operation for every comma separated expressions */ #define HB_MACRO_GEN_REFER 64 /* generate PUSH pcodes for reference to given expression */ -#define HB_MACRO_DEALLOCATE 128 /* macro structure is allocated on the heap */ /* values returned from compilation process */ diff --git a/harbour/src/3rd/zlib/gzlib.c b/harbour/src/3rd/zlib/gzlib.c index 68d4661cee..c2005cb630 100644 --- a/harbour/src/3rd/zlib/gzlib.c +++ b/harbour/src/3rd/zlib/gzlib.c @@ -5,7 +5,7 @@ #include "gzguts.h" -#if defined(__XCC__) || defined(__MINGW32CE__) +#if defined(__XCC__) || defined(__DMC__) || defined(__MINGW32CE__) # define LSEEK lseek #elif defined(__POCC__) # define LSEEK _lseek64 diff --git a/harbour/src/3rd/zlib/zlib.dif b/harbour/src/3rd/zlib/zlib.dif index 9295a93381..5e98dd1799 100644 --- a/harbour/src/3rd/zlib/zlib.dif +++ b/harbour/src/3rd/zlib/zlib.dif @@ -80,7 +80,7 @@ diff -urN zlib.orig/gzlib.c zlib/gzlib.c #include "gzguts.h" -#if defined(_WIN32) && !defined(__BORLANDC__) -+#if defined(__XCC__) || defined(__MINGW32CE__) ++#if defined(__XCC__) || defined(__DMC__) || defined(__MINGW32CE__) +# define LSEEK lseek +#elif defined(__POCC__) +# define LSEEK _lseek64 diff --git a/harbour/src/rdd/hsx/hsx.c b/harbour/src/rdd/hsx/hsx.c index cf8921e3da..8b7b5243e1 100644 --- a/harbour/src/rdd/hsx/hsx.c +++ b/harbour/src/rdd/hsx/hsx.c @@ -1262,9 +1262,7 @@ static LPHSXINFO hb_hsxNew( void ) static void hb_hsxExpDestroy( PHB_ITEM pItem ) { - if( hb_itemType( pItem ) == HB_IT_POINTER ) - hb_macroDelete( ( HB_MACRO_PTR ) hb_itemGetPtr( pItem ) ); - hb_itemRelease( pItem ); + hb_vmDestroyBlockOrMacro( pItem ); } static int hb_hsxVerify( int iHandle, const char * szText, HB_SIZE nLen, diff --git a/harbour/src/rtl/gtwvt/gtwvt.c b/harbour/src/rtl/gtwvt/gtwvt.c index 805fb43111..da2628e1f1 100644 --- a/harbour/src/rtl/gtwvt/gtwvt.c +++ b/harbour/src/rtl/gtwvt/gtwvt.c @@ -1726,7 +1726,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT ) { if( pWVT->wcTransLen == 0x100 && ( usChar >> 8 ) == 0xFF ) usChar &= 0x00FF; - if( usChar < pWVT->wcTransLen && pWVT->wcTrans[ usChar ] ) + if( ( HB_SIZE ) usChar < pWVT->wcTransLen && pWVT->wcTrans[ usChar ] ) usChar = pWVT->wcTrans[ usChar ]; } diff --git a/harbour/src/vm/hvm.c b/harbour/src/vm/hvm.c index c02c343ed2..847b0f61d0 100644 --- a/harbour/src/vm/hvm.c +++ b/harbour/src/vm/hvm.c @@ -637,7 +637,7 @@ void * hb_vmThreadState( void ) HB_TRACE(HB_TR_DEBUG, ("hb_vmThreadState()")); - return hb_stackList(); + return hb_stackId() ? hb_stackList() : NULL; } static void hb_vmStackAdd( PHB_THREADSTATE pState ) diff --git a/harbour/src/vm/macro.c b/harbour/src/vm/macro.c index ade3b2be25..38852764b5 100644 --- a/harbour/src/vm/macro.c +++ b/harbour/src/vm/macro.c @@ -138,15 +138,21 @@ static int hb_macroParse( HB_MACRO_PTR pMacro ) * the 'pMacro' pointer is not released - it can be a pointer * to a memory allocated on the stack. */ -void hb_macroDelete( HB_MACRO_PTR pMacro ) +static void hb_macroClear( HB_MACRO_PTR pMacro ) { - HB_TRACE(HB_TR_DEBUG, ("hb_macroDelete(%p)", pMacro)); + HB_TRACE(HB_TR_DEBUG, ("hb_macroClear(%p)", pMacro)); hb_xfree( pMacro->pCodeInfo->pCode ); if( pMacro->pError ) hb_errRelease( pMacro->pError ); - if( pMacro->Flags & HB_MACRO_DEALLOCATE ) - hb_xfree( pMacro ); +} + +void hb_macroDelete( HB_MACRO_PTR pMacro ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_macroDelete(%p)", pMacro)); + + hb_macroClear( pMacro ); + hb_xfree( pMacro ); } /* checks if a correct ITEM was passed from the virtual machine eval stack @@ -488,7 +494,7 @@ void hb_macroGetValue( PHB_ITEM pItem, int iContext, int flags ) if( pszFree ) hb_xfree( pszFree ); - hb_macroDelete( &struMacro ); + hb_macroClear( &struMacro ); } else if( iContext == HB_P_MACROPUSHLIST && hb_vmRequestQuery() == 0 ) { @@ -531,7 +537,7 @@ void hb_macroSetValue( PHB_ITEM pItem, int flags ) else hb_macroSyntaxError( &struMacro ); - hb_macroDelete( &struMacro ); + hb_macroClear( &struMacro ); } else if( hb_vmRequestQuery() == 0 ) { @@ -574,7 +580,7 @@ void hb_macroPushReference( PHB_ITEM pItem ) else hb_macroSyntaxError( &struMacro ); - hb_macroDelete( &struMacro ); + hb_macroClear( &struMacro ); } } @@ -636,7 +642,7 @@ static void hb_macroUseAliased( PHB_ITEM pAlias, PHB_ITEM pVar, int iFlag, int i } hb_xfree( szString ); - hb_macroDelete( &struMacro ); + hb_macroClear( &struMacro ); } else if( hb_macroCheckParam( pVar ) ) { @@ -665,7 +671,7 @@ static void hb_macroUseAliased( PHB_ITEM pAlias, PHB_ITEM pVar, int iFlag, int i else hb_macroSyntaxError( &struMacro ); - hb_macroDelete( &struMacro ); + hb_macroClear( &struMacro ); } } @@ -797,8 +803,7 @@ HB_MACRO_PTR hb_macroCompile( const char * szString ) pMacro = ( HB_MACRO_PTR ) hb_xgrab( sizeof( HB_MACRO ) ); pMacro->mode = HB_MODE_MACRO; pMacro->supported = hb_macroFlags() | HB_SM_ISUSERCP(); - pMacro->Flags = HB_MACRO_DEALLOCATE | HB_MACRO_GEN_PUSH | - HB_MACRO_GEN_LIST | HB_MACRO_GEN_PARE; + pMacro->Flags = HB_MACRO_GEN_PUSH | HB_MACRO_GEN_LIST | HB_MACRO_GEN_PARE; pMacro->uiNameLen = HB_SYMBOL_NAME_LEN; pMacro->status = HB_MACRO_CONT; pMacro->string = szString; @@ -1018,7 +1023,7 @@ const char * hb_macroGetType( PHB_ITEM pItem ) else szType = "UE"; /* syntax error during compilation */ - hb_macroDelete( &struMacro ); + hb_macroClear( &struMacro ); } else szType = "U";