diff --git a/harbour/ChangeLog.txt b/harbour/ChangeLog.txt index 56063bf169..cca05e77c4 100644 --- a/harbour/ChangeLog.txt +++ b/harbour/ChangeLog.txt @@ -10,6 +10,40 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-03-04 16:53 UTC+0100 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/hbmk2.prg + % eliminated unnecessary groups from regexps + + made regexp expressions non-PCRE specific + ; with the help of fantastic tool: + http://www.debuggex.com/ + % eliminated ATail() from regexp eval loops for + better performance + + marked all regexp strings to find them easily + + * config/postinst.hb + * synced regexps with hbmk2.prg + + * include/harbour.hbx + * regenerated + + * bin/commit.hb + ! stricter regexp for timestamp + + * contrib/hbnf/fttext.c + ! fixed EOL detection if CRLF pair falls onto the read + buffer boundary + + * contrib/hbodbc/odbc.c + * src/rtl/philes.c + % "" -> NULL in hb_storc() + + * tests/gfx2.prg + ! fixed to run as script + * minors + + * src/rtl/gtxwc/gtxwc.c + * use #if 0 instead of commented code + 2013-03-04 12:58 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/contrib/hbnetio/netiosrv.c * harbour/contrib/hbnetio/hbnetio.hbx @@ -32,8 +66,8 @@ ! fixed getting window position in HB_GTI_SETPOS_XY and HB_GTI_SETPOS_ROWCOL. Warnings: - 1) some WMs may report window upper left coroner inside - the border and some other ones border upper left coroner. + 1) some WMs may report window upper left corner inside + the border and some other ones border upper left corner. 2) Setting window position by this function strictly depends on WMs behavior and in most cases code like: aPos := hb_gtInfo( HB_GTI_SETPOS_XY ) @@ -128,7 +162,7 @@ LF delimited text file. This API pbly needs more thorough review regarding portable EOL handling, f.e. it seems buggy when CRLF pair falls onto the buffer - (length = 4096) boundary. + (length = 4096) boundary [DONE]. ! fixed 1 byte read past buffer in internal _findeol() function ; Checkme @@ -12112,7 +12146,7 @@ ! fixed SWPRUNCMD() on OS/2 * contrib/hbxpp/runshell.prg - ! fixed for RUNSHELL() on non-*nix platforms + ! fixes for RUNSHELL() on non-*nix platforms 2012-10-07 23:38 UTC+0200 Viktor Szakats (harbour syenar.net) * doc/Makefile @@ -12487,14 +12521,6 @@ in an OOP flavor. Please rework it in a way that it uses the underlying API and avoid copy/pasting complete source. -2012-10-05 12:18 UTC+0200 Viktor Szakats (harbour syenar.net) - * contrib/hbct/tests/ctwtest.prg - * contrib/hbwin/tests/testole.prg - * extras/gtwvw/tests/wvwtest9.prg - * tests/gtkeys.prg - * tests/tb1.prg - * tests/wvtext.prg - 2012-10-05 12:09 UTC+0200 Viktor Szakats (harbour syenar.net) * tests/gtkeys.prg * use hb_keyCode() instead of Asc() with __HARBOUR__ diff --git a/harbour/bin/commit.hb b/harbour/bin/commit.hb index 5cfbbb1977..555b6bae01 100644 --- a/harbour/bin/commit.hb +++ b/harbour/bin/commit.hb @@ -87,7 +87,7 @@ PROCEDURE Main() cLog := MemoRead( cLogName ) cOldLang := hb_cdpSelect( "EN" ) - cHit := hb_AtX( "\n[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] UTC[\-+][0-9][0-9][0-9][0-9] ", cLog ) + cHit := hb_AtX( "\n[1-2][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9] UTC[\-+][0-1][0-9][0-5][0-9] ", cLog ) IF Empty( cHit ) cHit := "" ENDIF diff --git a/harbour/config/postinst.hb b/harbour/config/postinst.hb index 990e394440..0305f06173 100644 --- a/harbour/config/postinst.hb +++ b/harbour/config/postinst.hb @@ -581,7 +581,7 @@ STATIC FUNCTION __hb_extern_get_list( cInputName ) LOCAL tmp LOCAL cCommand - LOCAL cRegex := "[[:space:]]_?HB_FUN_([A-Z0-9_]*)[[:space:]]" + LOCAL cRegex := "[\s]_?HB_FUN_([A-Z0-9_]*)[\s]" /* NOTE: non-gcc extractor configs don't support dynamic libs as input. */ DO CASE @@ -593,7 +593,7 @@ STATIC FUNCTION __hb_extern_get_list( cInputName ) ELSE cCommand := "podump -symbols {I}" ENDIF - cRegex := "SECT[0-9A-Z][0-9A-Z ].*[Ee]xternal.*_?HB_FUN_([A-Z0-9_]*)[[:space:]]" + cRegex := "SECT[0-9A-Z][0-9A-Z ].*[Ee]xternal.*_?HB_FUN_([A-Z0-9_]*)[\s]" CASE GetEnv( "HB_COMPILER" ) == "watcom" cCommand := "wlib {I}" CASE GetEnv( "HB_COMPILER" ) == "bcc" @@ -649,12 +649,12 @@ STATIC PROCEDURE __hb_extern_get_exception_list( cInputName, /* @ */ aInclude, / hDynamic := { => } IF ! Empty( cFile := MemoRead( cInputName ) ) - IF ! Empty( pRegex := hb_regexComp( "[[:space:]]" + _HB_FUNC_INCLUDE_ + "[[:space:]]([a-zA-Z0-9_].[^ \t\n\r]*)", .T., .T. ) ) + IF ! Empty( pRegex := hb_regexComp( "[\s]" + _HB_FUNC_INCLUDE_ + "[\s]([a-zA-Z0-9_].[^ \t\n\r]*)", .T., .T. ) ) FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. ) AAdd( aInclude, tmp[ 2 ] ) NEXT ENDIF - IF ! Empty( pRegex := hb_regexComp( "[[:space:]]" + _HB_FUNC_EXCLUDE_ + "[[:space:]]([a-zA-Z0-9_].[^ \t\n\r]*)", .T., .T. ) ) + IF ! Empty( pRegex := hb_regexComp( "[\s]" + _HB_FUNC_EXCLUDE_ + "[\s]([a-zA-Z0-9_].[^ \t\n\r]*)", .T., .T. ) ) FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. ) AAdd( aExclude, tmp[ 2 ] ) NEXT diff --git a/harbour/contrib/hbnf/fttext.c b/harbour/contrib/hbnf/fttext.c index bf8bd6b55c..16511d1d7f 100644 --- a/harbour/contrib/hbnf/fttext.c +++ b/harbour/contrib/hbnf/fttext.c @@ -847,7 +847,7 @@ static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len, HB_ISIZ * eol_len ) *eol_len = 2; return tmp + 2; } - else if( buf[ tmp ] == FT_CHR_LF ) + else if( buf[ tmp ] == FT_CHR_LF || buf[ tmp ] == FT_CHR_CR ) { if( eol_len ) *eol_len = 1; diff --git a/harbour/contrib/hbodbc/odbc.c b/harbour/contrib/hbodbc/odbc.c index 572ca25f4c..30f58392ba 100644 --- a/harbour/contrib/hbodbc/odbc.c +++ b/harbour/contrib/hbodbc/odbc.c @@ -863,9 +863,9 @@ HB_FUNC( SQLGETDIAGREC ) /* nHandleType, hHandle, nRecNumber, @cSQLState, @nErro hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); #else hb_retni( SQL_ERROR ); - hb_storc( "", 4 ); + hb_storc( NULL, 4 ); hb_stornl( 0, 5 ); - hb_storc( "", 6 ); + hb_storc( NULL, 6 ); #endif } diff --git a/harbour/include/harbour.hbx b/harbour/include/harbour.hbx index 4370bc3bc8..d3d27b9813 100644 --- a/harbour/include/harbour.hbx +++ b/harbour/include/harbour.hbx @@ -805,12 +805,12 @@ DYNAMIC hb_StrCDecode DYNAMIC hb_StrClear DYNAMIC hb_StrDecodEscape DYNAMIC hb_StrFormat +DYNAMIC hb_StrReplace DYNAMIC hb_StrShrink DYNAMIC hb_StrToExp DYNAMIC hb_StrToHex DYNAMIC hb_StrToTS DYNAMIC hb_StrToUTF8 -DYNAMIC hb_StrReplace DYNAMIC hb_StrXor DYNAMIC hb_threadDetach DYNAMIC hb_threadID diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index 3422ca2b2f..e7b576baf3 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -5249,7 +5249,7 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { int x = wnd->iNewPosX, y = wnd->iNewPosY; -/* +#if 0 if( wnd->window ) { XWindowAttributes wndAttr; @@ -5271,7 +5271,8 @@ static HB_BOOL hb_gt_xwc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } } } -*/ +#endif + if( ! pInfo->pResult ) pInfo->pResult = hb_itemNew( NULL ); hb_arrayNew( pInfo->pResult, 2 ); diff --git a/harbour/src/rtl/philes.c b/harbour/src/rtl/philes.c index b5bda5149c..9cc7cb5f12 100644 --- a/harbour/src/rtl/philes.c +++ b/harbour/src/rtl/philes.c @@ -473,7 +473,7 @@ HB_FUNC( HB_FGETDATETIME ) { if( HB_ISBYREF( 3 ) ) { - hb_storc( "", 3 ); + hb_storc( NULL, 3 ); hb_stordl( 0, 2 ); } else diff --git a/harbour/tests/gfx2.prg b/harbour/tests/gfx2.prg index fa322ccc11..29065440e2 100644 --- a/harbour/tests/gfx2.prg +++ b/harbour/tests/gfx2.prg @@ -14,12 +14,6 @@ #include "hbgtinfo.ch" #include "hbgfx.ch" -#if defined( __PLATFORM__WINDOWS ) - REQUEST HB_GT_WVT_DEFAULT -#elif defined( __PLATFORM__UNIX ) - REQUEST HB_GT_XWC_DEFAULT -#endif - PROCEDURE Main() LOCAL nRed, nGreen, nBlue @@ -30,11 +24,17 @@ PROCEDURE Main() # elif defined( __PLATFORM__UNIX ) hbshell_gtSelect( "GTXWC" ) # endif +#else +# if defined( __PLATFORM__WINDOWS ) + REQUEST HB_GT_WVT_DEFAULT +# elif defined( __PLATFORM__UNIX ) + REQUEST HB_GT_XWC_DEFAULT +# endif #endif - ? hb_gtVersion() + ? "GT" + hb_gtVersion() IF ! hb_gtInfo( HB_GTI_ISGRAPHIC ) - ? "You are using a non graphics capable gt:" + ? "You are using a non graphics capable gt" QUIT ENDIF @@ -89,4 +89,4 @@ PROCEDURE Main() hb_gtInfo( HB_GTI_SCREENWIDTH ) - 1, nGreen ) WAIT -RETURN + RETURN diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 0913fdccfa..2c2f1180a0 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -193,6 +193,7 @@ EXTERNAL hbmk_KEYW #define _SELF_NAME_ "hbmk2" #define I_( x ) hb_UTF8ToStr( hb_i18n_gettext( x ) ) +#define R_( x ) ( x ) /* marking for regexps */ #define _TARG_PLAT 1 #define _TARG_COMP 2 @@ -294,8 +295,8 @@ EXTERNAL hbmk_KEYW #define _HBMK_TARGENAME_ADHOC ".adhoc." -#define _HBMK_REGEX_INCLUDE '(^|;)[[:blank:]]*#[[:blank:]]*(incl|inclu|includ|include|import)[[:blank:]]*(\".+?\"|<.+?>'+"|['`].+?'"+')' -#define _HBMK_REGEX_REQUIRE '(^|;)[[:blank:]]*#[[:blank:]]*(require)[[:blank:]]*(\".+?\"'+"|'.+?'"+')' +#define _HBMK_REGEX_INCLUDE R_( '(?:^|;)[ \t]*#[ \t]*(?:incl|inclu|includ|include|import)[ \t]*(\".+?\"' + "|<.+?>|['`].+?')" ) +#define _HBMK_REGEX_REQUIRE R_( '(?:^|;)[ \t]*#[ \t]*require[ \t]*(\".+?\"' + "|'.+?')" ) #define _HBMK_NEST_MAX 10 #define _HBMK_HEAD_NEST_MAX 10 @@ -3872,7 +3873,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit #define _HBLIB_FULLPATH( cName ) ( hb_DirSepAdd( hbmk[ _HBMK_cHB_INSTALL_LIB ] ) + hb_ps() + cLibLibPrefix + cName + cLibLibExt ) - cLibHBX_Regex := "[[:space:]]_?HB_FUN_([A-Z0-9_]*)[[:space:]]" + cLibHBX_Regex := R_( "[\s]_?HB_FUN_([A-Z0-9_]*)[\s]" ) DO CASE /* GCC family */ @@ -4043,7 +4044,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit cBin_LibHBX := hbmk[ _HBMK_cCCPREFIX ] + "nm" cOpt_LibHBX := "-g" + iif( hbmk[ _HBMK_cPLAT ] == "darwin", "", " --defined-only -C" ) + " {LI}" IF hbmk[ _HBMK_cPLAT ] == "darwin" - cLibHBX_Regex := "[[:space:]]T" + cLibHBX_Regex + cLibHBX_Regex := R_( "[\s]T" ) + cLibHBX_Regex ENDIF IF l_lLIBGROUPING .AND. HBMK_ISPLAT( "linux|beos|qnx|android|vxworks|cygwin|bsd" ) AAdd( hbmk[ _HBMK_aOPTL ], "-Wl,--start-group {LL} {LB} {LF} -Wl,--end-group" ) @@ -4739,7 +4740,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit cOpt_LibHBX := "{LI}" IF HBMK_ISPLAT( "linux|dos|os2" ) /* register callconv (-6r, -5r) puts an underscore after names */ - cLibHBX_Regex := "[[:space:]]_?HB_FUN_([A-Z0-9_]*)_[[:space:]]" + cLibHBX_Regex := R_( "[\s]_?HB_FUN_([A-Z0-9_]*)_[\s]" ) ENDIF IF HBMK_ISPLAT( "win|os2" ) bBlk_ImpLib := {| cSourceDLL, cTargetLib, cFlags | win_implib_command_watcom( hbmk, cBin_Lib + " -q -o={OL} {ID}", cSourceDLL, cTargetLib, cFlags ) } @@ -5032,7 +5033,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit cOpt_CompC := "-nologo -c" cBin_LibHBX := "dumpbin.exe" cOpt_LibHBX := "-symbols {LI}" - cLibHBX_Regex := "SECT[0-9A-Z][0-9A-Z ].*[Ee]xternal.*_?HB_FUN_([A-Z0-9_]*)[[:space:]]" + cLibHBX_Regex := R_( "SECT[0-9A-Z][0-9A-Z ].*[Ee]xternal.*_?HB_FUN_([A-Z0-9_]*)[\s]" ) IF hbmk[ _HBMK_lOPTIM ] IF hbmk[ _HBMK_cPLAT ] == "wce" IF hbmk[ _HBMK_nCOMPVer ] != 0 .AND. hbmk[ _HBMK_nCOMPVer ] < 1400 @@ -5218,7 +5219,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit bBlk_ImpLib := {| cSourceDLL, cTargetLib, cFlags | win_implib_command_pocc( hbmk, cBin_Lib + " {ID} -out:{OL}", cSourceDLL, cTargetLib, cFlags ) } cBin_LibHBX := "podump.exe" cOpt_LibHBX := "-symbols {LI}" - cLibHBX_Regex := "SECT[0-9A-Z][0-9A-Z ].*[Ee]xternal.*_?HB_FUN_([A-Z0-9_]*)[[:space:]]" + cLibHBX_Regex := R_( "SECT[0-9A-Z][0-9A-Z ].*[Ee]xternal.*_?HB_FUN_([A-Z0-9_]*)[\s]" ) IF hbmk[ _HBMK_lWINUNI ] AAdd( hbmk[ _HBMK_aOPTC ], "-DUNICODE" ) ENDIF @@ -8365,7 +8366,7 @@ STATIC FUNCTION s_getIncludedFiles( hbmk, cFile, cParentDir, lCMode ) NIL /* lNewLine */, NIL, ; NIL /* nGetMatch */, ; .T. /* lOnlyMatch */ ) - cHeader := ATail( tmp ) /* Last group in match marker */ + cHeader := tmp[ 2 ] lSystemHeader := ( Left( cHeader, 1 ) == "<" ) cHeader := SubStr( cHeader, 2, Len( cHeader ) - 2 ) @@ -8494,7 +8495,7 @@ STATIC FUNCTION s_getIncludedFiles( hbmk, cFile, cParentDir, lCMode ) NIL /* lNewLine */, NIL, ; NIL /* nGetMatch */, ; .T. /* lOnlyMatch */ ) - cHeader := ATail( tmp ) /* Last group in match marker */ + cHeader := tmp[ 2 ] cHeader := SubStr( cHeader, 2, Len( cHeader ) - 2 ) hbmk[ _HBMK_hAUTOHBCFOUND ][ "." + cHeader ] := hb_FNameExtSet( cHeader, ".hbc" ) NEXT @@ -13182,7 +13183,7 @@ STATIC FUNCTION ExtractHarbourSymbols( cString ) LOCAL cOldCP := hb_cdpSelect( "EN" ) - IF ! Empty( pRegex := hb_regexComp( "HB_FUN_([A-Z_][A-Z_0-9]*)", .T., .T. ) ) + IF ! Empty( pRegex := hb_regexComp( R_( "HB_FUN_([A-Z_][A-Z_0-9]*)" ), .T., .T. ) ) FOR EACH cLine IN hb_ATokens( StrTran( cString, Chr( 13 ), Chr( 10 ) ), Chr( 10 ) ) IF AScan( sc_aException, {| tmp | tmp $ Lower( cLine ) } ) == 0 FOR EACH tmp IN hb_regexAll( pRegex, cLine,,,,, .T. ) @@ -13247,8 +13248,8 @@ STATIC PROCEDURE GetListOfFunctionsKnownLoadHBX( cFileName, cRoot, hAll, cName ) IF ! Empty( cFile := hb_MemoRead( cFileName ) ) FOR EACH cFilter IN { ; - "^DYNAMIC ([a-zA-Z0-9_]*)$", ; - "ANNOUNCE ([a-zA-Z0-9_]*)$" } + R_( "^DYNAMIC ([a-zA-Z0-9_]*)$" ), ; + R_( "ANNOUNCE ([a-zA-Z0-9_]*)$" ) } IF ! Empty( pRegex := hb_regexComp( cFilter, .T., .T. ) ) FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. ) @@ -13347,17 +13348,17 @@ STATIC PROCEDURE __hb_extern_get_exception_list( cInputName, /* @ */ aInclude, / hDynamic := { => } IF ! Empty( cFile := MemoRead( cInputName ) ) - IF ! Empty( pRegex := hb_regexComp( "[[:space:]]" + _HB_FUNC_INCLUDE_ + "[[:space:]]([a-zA-Z0-9_].[^ \t\n\r]*)", .T., .T. ) ) + IF ! Empty( pRegex := hb_regexComp( R_( "[\s]" + _HB_FUNC_INCLUDE_ + "[\s]([a-zA-Z0-9_].[^ \t\n\r]*)" ), .T., .T. ) ) FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. ) AAdd( aInclude, tmp[ 2 ] ) NEXT ENDIF - IF ! Empty( pRegex := hb_regexComp( "[[:space:]]" + _HB_FUNC_EXCLUDE_ + "[[:space:]]([a-zA-Z0-9_].[^ \t\n\r]*)", .T., .T. ) ) + IF ! Empty( pRegex := hb_regexComp( R_( "[\s]" + _HB_FUNC_EXCLUDE_ + "[\s]([a-zA-Z0-9_].[^ \t\n\r]*)" ), .T., .T. ) ) FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. ) AAdd( aExclude, tmp[ 2 ] ) NEXT ENDIF - IF ! Empty( pRegex := hb_regexComp( "^DYNAMIC ([a-zA-Z0-9_]*)$", .T., .T. ) ) + IF ! Empty( pRegex := hb_regexComp( R_( "^DYNAMIC ([a-zA-Z0-9_]*)$" ), .T., .T. ) ) FOR EACH tmp IN hb_regexAll( pRegex, StrTran( cFile, Chr( 13 ) ),,,,, .T. ) hDynamic[ Upper( tmp[ 2 ] ) ] := tmp[ 2 ] NEXT @@ -13864,7 +13865,7 @@ STATIC PROCEDURE __hbshell_LoadExtFromSource( aExtension, cFileName ) NIL /* lNewLine */, NIL, ; NIL /* nGetMatch */, ; .T. /* lOnlyMatch */ ) - AAdd( aExtension, SubStr( ATail( tmp ), 2, Len( ATail( tmp ) ) - 2 ) /* Last group in match marker */ ) + AAdd( aExtension, SubStr( tmp[ 2 ], 2, Len( tmp[ 2 ] ) - 2 ) ) NEXT ENDIF