diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6ad424e9a8..edd2b0c06c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,20 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-05-22 12:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/bin/hb-func.sh + + added -lpcreposix to system libraries when C_USR has -DHB_PCRE_REGEX + * harbour/include/hbregex.h + * removed pcre/ path from PCRE header files - if you want to build + Harbour with PCRE regex and PCRE header files are not in default\ + path then set valid path in C_USR, f.e.: + export C_USR="${C_USR} -DHB_PCRE_REGEX -I/usr/include/pcre" + + * harbour/include/hbxvm.h + * harbour/source/compiler/gencc.c + * harbour/source/vm/hvm.c + * minor optimizatin for -gc3 output + 2007-05-22 01:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/include/hbapicls.h diff --git a/harbour/bin/hb-func.sh b/harbour/bin/hb-func.sh index 2bb13ff4ad..4557d53185 100644 --- a/harbour/bin/hb-func.sh +++ b/harbour/bin/hb-func.sh @@ -118,6 +118,9 @@ mk_hbtools() HB_SYS_LIBS="-lm" HB_CRS_LIB="" HB_SLN_LIB="" + if [ "${C_USR//-DHB_PCRE_REGEX/}" != "${C_USR}" ]; then + HB_SYS_LIBS="-lpcreposix -lpcre ${HB_SYS_LIBS}" + fi if [ "${HB_COMPILER}" = "mingw32" ]; then HB_SYS_LIBS="${HB_SYS_LIBS} -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lwsock32 -lws2_32" elif [ "${HB_COMPILER}" = "djgpp" ]; then diff --git a/harbour/include/hbregex.h b/harbour/include/hbregex.h index b46c32ffa3..fdeec4cf9f 100644 --- a/harbour/include/hbregex.h +++ b/harbour/include/hbregex.h @@ -74,8 +74,8 @@ # define HB_PCRE_REGEX # endif #elif defined( HB_PCRE_REGEX ) -# include -# include +# include +# include #elif defined( HB_POSIX_REGEX ) # include #else diff --git a/harbour/include/hbxvm.h b/harbour/include/hbxvm.h index 819e20aafb..9d0fc73f27 100644 --- a/harbour/include/hbxvm.h +++ b/harbour/include/hbxvm.h @@ -252,6 +252,10 @@ extern HB_EXPORT BOOL hb_xvmLocalAdd( int iLocal ); extern HB_EXPORT BOOL hb_xvmStaticAdd( USHORT uiStatic ); extern HB_EXPORT BOOL hb_xvmMemvarAdd( PHB_SYMB pSymbol ); +extern HB_EXPORT PHB_ITEM hb_xvmStaticPtr( int iStatic ); +extern HB_EXPORT PHB_ITEM hb_xvmLocalPtr( int iLocal ); +extern HB_EXPORT void hb_xvmCopyLocals( int iDest, int iSource ); + HB_EXTERN_END #endif /* HB_XVM_H_ */ diff --git a/harbour/source/compiler/gencc.c b/harbour/source/compiler/gencc.c index c5d029769f..d98a8256fe 100644 --- a/harbour/source/compiler/gencc.c +++ b/harbour/source/compiler/gencc.c @@ -1128,18 +1128,50 @@ static HB_GENC_FUNC( hb_p_pushlocal ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\thb_xvmPushLocal( %d );\n", - HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ); - return 3; + switch( pFunc->pCode[ lPCodePos + 3 ] ) + { + case HB_P_POPLOCALNEAR: + fprintf( cargo->yyc, "\thb_xvmCopyLocals( %d, %d );\n", + HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), + ( signed char ) pFunc->pCode[ lPCodePos + 4 ] ); + return 5; + + case HB_P_POPLOCAL: + fprintf( cargo->yyc, "\thb_xvmCopyLocals( %d, %d );\n", + HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ), + HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 4 ] ) ); + return 6; + + default: + fprintf( cargo->yyc, "\thb_xvmPushLocal( %d );\n", + HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 1 ] ) ); + return 3; + } } static HB_GENC_FUNC( hb_p_pushlocalnear ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\thb_xvmPushLocal( %d );\n", - ( signed char ) pFunc->pCode[ lPCodePos + 1 ] ); - return 2; + switch( pFunc->pCode[ lPCodePos + 2 ] ) + { + case HB_P_POPLOCALNEAR: + fprintf( cargo->yyc, "\thb_xvmCopyLocals( %d, %d );\n", + ( signed char ) pFunc->pCode[ lPCodePos + 1 ], + ( signed char ) pFunc->pCode[ lPCodePos + 3 ] ); + return 4; + + case HB_P_POPLOCAL: + fprintf( cargo->yyc, "\thb_xvmCopyLocals( %d, %d );\n", + ( signed char ) pFunc->pCode[ lPCodePos + 1 ], + HB_PCODE_MKSHORT( &pFunc->pCode[ lPCodePos + 3 ] ) ); + return 5; + + default: + fprintf( cargo->yyc, "\thb_xvmPushLocal( %d );\n", + ( signed char ) pFunc->pCode[ lPCodePos + 1 ] ); + return 2; + } } static HB_GENC_FUNC( hb_p_pushlocalref ) diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 88edffe1e7..b9e306eb51 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -7145,6 +7145,42 @@ HB_EXPORT void hb_xvmPopLocal( SHORT iLocal ) hb_vmPopLocal( iLocal ); } +HB_EXPORT PHB_ITEM hb_xvmLocalPtr( int iLocal ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_xvmLocalPtr(%d)", iLocal)); + + if( iLocal >= 0 ) + { + /* local variable or local parameter */ + return hb_stackLocalVariable( &iLocal ); + } + else + { + /* local variable referenced in a codeblock + * hb_stackSelfItem() points to a codeblock that is currently evaluated + */ + return hb_codeblockGetRef( hb_stackSelfItem()->item.asBlock.value, ( LONG ) iLocal ); + } +} + +HB_EXPORT PHB_ITEM hb_xvmStaticPtr( int iStatic ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_xvmStaticPtr(%d)", iStatic)); + + return s_aStatics.item.asArray.value->pItems + hb_stackGetStaticsBase() + iStatic - 1; +} + +HB_EXPORT void hb_xvmCopyLocals( int iDest, int iSource ) +{ + PHB_ITEM pDest; + + HB_TRACE(HB_TR_DEBUG, ("hb_xvmCopyLocals(%d,%d)", iDest, iSource)); + + pDest = hb_xvmLocalPtr( iDest ); + hb_itemCopyToRef( hb_xvmLocalPtr( iSource ), + HB_IS_BYREF( pDest ) ? hb_itemUnRef( pDest ) : pDest ); +} + HB_EXPORT void hb_xvmPushStatic( USHORT uiStatic ) { HB_TRACE(HB_TR_DEBUG, ("hb_xvmPushStatic(%hu)", uiStatic));