From 95673458f29aaff89a21046e13b604a85b8a3270 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 13 Apr 2009 08:53:53 +0000 Subject: [PATCH] 2009-04-13 10:49 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * tests/speedtst.prg ! Fixed missing hb_progname() for non-Harbour compilers. * include/hbextern.ch + Added time related new functions. * utils/hbmk2/hbmk2.prg + Added -runflag: option to pass flags to target executable. + Started -inc (incremental link) support. It's very early stage, don't expect it to work yet and please don't report any problems with this feature yet. * source/vm/asort.c ! Fixed to return Clipper compatible results when non-logical non-numeric value is returned from ASORT() codeblock. * utils/hbtest/rt_array.prg * Cleaned ASORT() tests when sorting block returns constant value. Now Clipper results aren't bent anymore, instead I've added different expected results for Harbour and Clipper. The difference is due to different sorting algorithms used, here the point is to get similar *pattern* for different invalid values. * source/rtl/philes.c % HB_FGETDATETIME(): Removed double call to hb_stortdt(). * contrib/hbqt/tests/hbqt.hbp * Removed extra line at EOL. * contrib/gtqtc/tests/hbqt.hbp ! Removed environment dependent 'libspath=' line. Please don't add such path to Harbour SVN, since these can differ from system to system and is also non-portable. The correct name of the directive is: 'libpaths='. * contrib/gtqtc/Makefile % Removed double SVN ID. This file needs to be updated according to hbqt latest Makefile portability changes. * contrib/rddads/ads1.c * Minor formatting. --- harbour/ChangeLog | 49 ++++++++++++++++- harbour/contrib/gtqtc/Makefile | 5 -- harbour/contrib/gtqtc/tests/hbqt.hbp | 2 - harbour/contrib/hbqt/tests/hbqt.hbp | 1 - harbour/contrib/rddads/ads1.c | 2 +- harbour/include/hbextern.ch | 18 +++++++ harbour/source/rtl/philes.c | 3 +- harbour/source/vm/asort.c | 10 +++- harbour/tests/speedtst.prg | 9 ++++ harbour/utils/hbmk2/hbmk2.prg | 80 ++++++++++++++++++++++------ harbour/utils/hbtest/rt_array.prg | 35 +++++++++++- 11 files changed, 184 insertions(+), 30 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6630c395f1..ff2013780b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,51 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-13 10:49 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * tests/speedtst.prg + ! Fixed missing hb_progname() for non-Harbour compilers. + + * include/hbextern.ch + + Added time related new functions. + + * utils/hbmk2/hbmk2.prg + + Added -runflag: option to pass flags to target executable. + + Started -inc (incremental link) support. It's very early + stage, don't expect it to work yet and please don't report + any problems with this feature yet. + + * source/vm/asort.c + ! Fixed to return Clipper compatible results when non-logical + non-numeric value is returned from ASORT() codeblock. + + * utils/hbtest/rt_array.prg + * Cleaned ASORT() tests when sorting block returns constant value. + Now Clipper results aren't bent anymore, instead I've added + different expected results for Harbour and Clipper. The + difference is due to different sorting algorithms used, + here the point is to get similar *pattern* for different + invalid values. + + * source/rtl/philes.c + % HB_FGETDATETIME(): Removed double call to hb_stortdt(). + + * contrib/hbqt/tests/hbqt.hbp + * Removed extra line at EOL. + + * contrib/gtqtc/tests/hbqt.hbp + ! Removed environment dependent 'libspath=' line. + Please don't add such path to Harbour SVN, since these + can differ from system to system and is also non-portable. + The correct name of the directive is: 'libpaths='. + + * contrib/gtqtc/Makefile + % Removed double SVN ID. + This file needs to be updated according to hbqt latest + Makefile portability changes. + + * contrib/rddads/ads1.c + * Minor formatting. + 2009-04-13 12:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtqtc/gtqtc.cpp * harbour/contrib/gtqtc/gtqtc.h @@ -55,12 +100,12 @@ brain. I will request Przemek to set the basic GT framework in place. Rest will be quiet easy, easy than Windows itself. - demoqtc.exe remains in the memory after closing it with + demoqtc.exe remains in the memory after closing it with X button. I have tried hard to set it right but have faised so far. So you may need to kill it from task manager. * harbour/contrib/gtwvg/tests/demowvg.prg - + Added My_Alert() function which you can copy and + + Added My_Alert() function which you can copy and paste in your GTWVG linked applications to have a GUI replacement of Alert() funtion. diff --git a/harbour/contrib/gtqtc/Makefile b/harbour/contrib/gtqtc/Makefile index 43ae95fc40..ded12a68ee 100644 --- a/harbour/contrib/gtqtc/Makefile +++ b/harbour/contrib/gtqtc/Makefile @@ -48,11 +48,6 @@ ifneq ($(strip $(HB_INC_QT_OK)),) HB_USER_CFLAGS += $(foreach d, $(HB_INC_QT_OK), -I$(d)) -# -# $Id$ -# - - CPP_SOURCES=\ gtqtc.cpp \ moc_gtqtc.cpp \ diff --git a/harbour/contrib/gtqtc/tests/hbqt.hbp b/harbour/contrib/gtqtc/tests/hbqt.hbp index 07dc0641a5..b53d001584 100644 --- a/harbour/contrib/gtqtc/tests/hbqt.hbp +++ b/harbour/contrib/gtqtc/tests/hbqt.hbp @@ -9,5 +9,3 @@ libs=QtCore4 QtGui4 QtNetwork4 QtWebKit4 #libs=QtCore QtGui QtNetwork QtWebKit gui=yes gt=gtnul -libspath=c:\qt\2009.01\gt\lib - diff --git a/harbour/contrib/hbqt/tests/hbqt.hbp b/harbour/contrib/hbqt/tests/hbqt.hbp index b69227d6bd..a11cb92715 100644 --- a/harbour/contrib/hbqt/tests/hbqt.hbp +++ b/harbour/contrib/hbqt/tests/hbqt.hbp @@ -13,4 +13,3 @@ libs=hbqt #libs=QtCore QtGui QtNetwork QtWebKit gui=yes gt=gtnul - diff --git a/harbour/contrib/rddads/ads1.c b/harbour/contrib/rddads/ads1.c index 76b6511b3b..49205fb34d 100644 --- a/harbour/contrib/rddads/ads1.c +++ b/harbour/contrib/rddads/ads1.c @@ -2733,7 +2733,7 @@ static HB_ERRCODE adsInfo( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) AdsGetDateFormat( pucFormat, &pusLen ); AdsSetDateFormat( ( UNSIGNED8 * ) "YYYYMMDD" ); AdsGetLastTableUpdate( pArea->hTable, pucDate, &pusLen ); - *(pucDate + 8) = '\0'; + *( pucDate + 8 ) = '\0'; hb_itemPutDS( pItem, ( char * ) pucDate ); AdsSetDateFormat( pucFormat ); break; diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 89519a43f4..0dfadc1d96 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -857,6 +857,23 @@ EXTERNAL HB_ISOBJECT EXTERNAL HB_ISPOINTER EXTERNAL HB_ISSTRING EXTERNAL HB_ISSYMBOL +EXTERNAL HB_ISDATETIME +EXTERNAL HB_ISTIMESTAMP + +EXTERNAL HB_DATETIME +EXTERNAL HB_CTOD +EXTERNAL HB_DTOC +EXTERNAL HB_NTOT +EXTERNAL HB_TTON +EXTERNAL HB_TTOC +EXTERNAL HB_CTOT +EXTERNAL HB_TTOS +EXTERNAL HB_STOT +EXTERNAL HB_TSTOSTR +EXTERNAL HB_STRTOTS +EXTERNAL HB_HOUR +EXTERNAL HB_MINUTE +EXTERNAL HB_SEC EXTERNAL HB_IDLEADD EXTERNAL HB_IDLEDEL @@ -1322,6 +1339,7 @@ EXTERNAL HBARRAY EXTERNAL HBBLOCK EXTERNAL HBCHARACTER EXTERNAL HBDATE +EXTERNAL HBTIMESTAMP EXTERNAL HBLOGICAL EXTERNAL HBNIL EXTERNAL HBNUMERIC diff --git a/harbour/source/rtl/philes.c b/harbour/source/rtl/philes.c index 664dbc8ac4..a987efdb0e 100644 --- a/harbour/source/rtl/philes.c +++ b/harbour/source/rtl/philes.c @@ -416,8 +416,6 @@ HB_FUNC( HB_FGETDATETIME ) if( hb_fsGetFileTime( ( UCHAR * ) hb_parcx( 1 ), &lJulian, &lMillisec ) ) { - - hb_stortdt( lJulian, lMillisec, 2 ); if( ISBYREF( 3 ) ) { char buf[ 13 ]; @@ -429,6 +427,7 @@ HB_FUNC( HB_FGETDATETIME ) } else hb_stortdt( lJulian, lMillisec, 2 ); + hb_retl( TRUE ); } else diff --git a/harbour/source/vm/asort.c b/harbour/source/vm/asort.c index 964965f30e..7763876f77 100644 --- a/harbour/source/vm/asort.c +++ b/harbour/source/vm/asort.c @@ -76,10 +76,18 @@ static BOOL hb_itemIsLess( PHB_ITEM pItem1, PHB_ITEM pItem2, PHB_ITEM pBlock, PH if( pBaseArray->ulLen <= ulLast ) return FALSE; else + { + PHB_ITEM pRet = hb_param( -1, HB_IT_ANY ); + /* CA-Cl*pper always takes return value as logical item * accepting 0, 1 as numeric representation of FALSE/TRUE */ - return hb_parl( -1 ); + if( HB_IS_LOGICAL( pRet ) || + HB_IS_NUMERIC( pRet ) ) + return hb_itemGetL( pRet ); + else + return TRUE; + } } /* Do native compare when no codeblock is supplied */ diff --git a/harbour/tests/speedtst.prg b/harbour/tests/speedtst.prg index ce480ecc68..34b60bf3a8 100644 --- a/harbour/tests/speedtst.prg +++ b/harbour/tests/speedtst.prg @@ -253,6 +253,15 @@ STATIC FUNCTION FN_ExtSet( cFileName, cExt ) RETURN hb_FNameMerge( cDir, cName, cExt ) +#ifndef __HARBOUR__ +STATIC FUNCTION hb_progname() + RETURN "speedtst" +#else +#ifdef __XHARBOUR__ +STATIC FUNCTION hb_progname() + RETURN "speedtst" +#endif +#endif /*** TESTS ***/ diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 35bbcc0bd8..d2d892872c 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -114,6 +114,14 @@ /* TODO: Add support for dynamic library creation for rest of compilers. */ /* TODO: Cleanup on variable names and compiler configuration. */ /* TODO: Optimizations (speed/memory). */ +/* TODO: Incremental support: + - separate link from C compilation for all compilers + - handle resources + - handle .c and object input files + - handle libs? (problematic) + - creating intermediate files in '_arch/comp' subdir + - add 'inc=on' support in .hbp files + - 'clean' option? */ /* PLANNING: hbgtwvg.hbp @@ -242,6 +250,7 @@ PROCEDURE Main( ... ) LOCAL s_aOPTL LOCAL s_aOPTA LOCAL s_aOPTD + LOCAL s_aOPTRUN LOCAL s_cPROGDIR LOCAL s_cPROGNAME LOCAL s_cFIRST @@ -270,6 +279,7 @@ PROCEDURE Main( ... ) LOCAL s_lBLDFLGL := .F. LOCAL s_lRUN := .F. LOCAL s_lFMSTAT := NIL /* NIL = default, .T. = on, .F. = off */ + LOCAL s_lINC := .F. LOCAL aCOMPDET LOCAL aCOMPDET_LOCAL @@ -335,6 +345,8 @@ PROCEDURE Main( ... ) LOCAL cParam LOCAL cParamL + LOCAL cTarget, tTarget + LOCAL cDir, cName, cExt LOCAL lNIX := hb_Version( HB_VERSION_UNIX_COMPAT ) @@ -816,6 +828,7 @@ PROCEDURE Main( ... ) s_aOPTL := {} s_aOPTA := {} s_aOPTD := {} + s_aOPTRUN := {} s_aRESSRC := {} s_aRESCMP := {} s_aLIBFM := {} @@ -938,6 +951,9 @@ PROCEDURE Main( ... ) CASE cParamL == "-map" ; s_lMAP := .T. CASE cParamL == "-map-" .OR. ; cParamL == "-nomap" ; s_lMAP := .F. + CASE cParamL == "-inc" ; s_lINC := .T. + CASE cParamL == "-inc-" .OR. ; + cParamL == "-noinc" ; s_lINC := .F. CASE cParamL == "-fmstat" ; s_lFMSTAT := .T. CASE cParamL == "-fmstat-" .OR. ; cParamL == "-nofmstat" ; s_lFMSTAT := .F. @@ -1071,6 +1087,13 @@ PROCEDURE Main( ... ) AAdd( s_aOPTA , PathSepToTarget( cParam, 2 ) ) ENDIF + CASE Left( cParamL, Len( "-runflag:" ) ) == "-runflag:" + + cParam := ArchCompFilter( SubStr( cParam, Len( "-runflag:" ) + 1 ) ) + IF Left( cParam, 1 ) $ cOptPrefix + AAdd( s_aOPTRUN , PathSepToTarget( cParam, 2 ) ) + ENDIF + CASE Left( cParam, 2 ) == "-l" .AND. ; Len( cParam ) > 2 .AND. ; !( Left( cParam, 3 ) == "-l-" ) @@ -1180,6 +1203,39 @@ PROCEDURE Main( ... ) RETURN ENDIF + IF ! lStopAfterInit .AND. ! lStopAfterHarbour + + /* If -o with full name wasn't specified, let's + make it the first source file specified. */ + DEFAULT s_cPROGNAME TO FN_NameGet( s_cFIRST ) + + /* Combine output dir with output name. */ + IF ! Empty( s_cPROGDIR ) + hb_FNameSplit( s_cPROGNAME, @cDir, @cName, @cExt ) + s_cPROGNAME := hb_FNameMerge( iif( Empty( cDir ), s_cPROGDIR, cDir ), cName, cExt ) + ENDIF + + /* Incremental */ + + IF s_lINC + + DO CASE + CASE lCreateLib ; cTarget := PathSepToTarget( FN_ExtSet( cLibLibPrefix + s_cPROGNAME, cLibLibExt ) ) + CASE lCreateDyn ; cTarget := PathSepToTarget( FN_ExtSet( s_cPROGNAME, cDynLibExt ) ) + OTHERWISE ; cTarget := PathSepToTarget( FN_ExtSet( s_cPROGNAME, cBinExt ) ) + ENDCASE + + tTarget := NIL + IF hb_FGetDateTime( cTarget, @tTarget ) + FOR EACH tmp IN s_aPRG DESCEND + IF hb_FGetDateTime( tmp, @tmp1 ) .AND. tTarget >= tmp1 + hb_ADel( s_aPRG, tmp:__enumIndex(), .T. ) + ENDIF + NEXT + ENDIF + ENDIF + ENDIF + /* Harbour compilation */ IF ! lStopAfterInit .AND. Len( s_aPRG ) > 0 @@ -1240,10 +1296,6 @@ PROCEDURE Main( ... ) IF ! lStopAfterInit .AND. ! lStopAfterHarbour - /* If -o with full name wasn't specified, let's - make it the first source file specified. */ - DEFAULT s_cPROGNAME TO FN_NameGet( s_cFIRST ) - IF s_cGT == t_cGTDEFAULT s_cGT := NIL ENDIF @@ -1251,12 +1303,6 @@ PROCEDURE Main( ... ) /* Merge user libs from command line and envvar. Command line has priority. */ s_aLIBUSER := ArrayAJoin( { s_aLIBUSER, s_aLIBUSERGT, ListToArray( PathSepToTarget( GetEnv( "HB_USER_LIBS" ) ) ) } ) - /* Combine output dir with output name. */ - IF ! Empty( s_cPROGDIR ) - hb_FNameSplit( s_cPROGNAME, @cDir, @cName, @cExt ) - s_cPROGNAME := hb_FNameMerge( iif( Empty( cDir ), s_cPROGDIR, cDir ), cName, cExt ) - ENDIF - IF lSysLoc cPrefix := "" ELSE @@ -2450,10 +2496,12 @@ PROCEDURE Main( ... ) ENDIF AEval( ListDirExt( s_aPRG, "", ".c" ), {|tmp| FErase( tmp ) } ) IF ! lStopAfterCComp .OR. lCreateLib .OR. lCreateDyn - IF ! Empty( cResExt ) - AEval( ListDirExt( s_aRESSRC, "", cResExt ), {|tmp| FErase( tmp ) } ) + IF ! s_lINC + IF ! Empty( cResExt ) + AEval( ListDirExt( s_aRESSRC, "", cResExt ), {|tmp| FErase( tmp ) } ) + ENDIF + AEval( s_aOBJ, {|tmp| FErase( tmp ) } ) ENDIF - AEval( s_aOBJ, {|tmp| FErase( tmp ) } ) ENDIF AEval( s_aCLEAN, {|tmp| FErase( tmp ) } ) @@ -2499,14 +2547,15 @@ PROCEDURE Main( ... ) s_cPROGNAME := "." + hb_osPathSeparator() + s_cPROGNAME ENDIF #endif + cCommand := AllTrim( PathSepToTarget( s_cPROGNAME ) + " " + ArrayToList( s_aOPTRUN ) ) IF s_lTRACE IF ! s_lDONTEXEC .OR. ! t_lQuiet OutStd( "hbmk: Running executable:" + hb_osNewLine() ) ENDIF - OutStd( PathSepToTarget( s_cPROGNAME ) + hb_osNewLine() ) + OutStd( cCommand + hb_osNewLine() ) ENDIF IF ! s_lDONTEXEC - nErrorLevel := hb_run( PathSepToTarget( s_cPROGNAME ) ) + nErrorLevel := hb_run( cCommand ) ENDIF ENDIF ENDIF @@ -3752,6 +3801,7 @@ STATIC PROCEDURE ShowHelp( lLong ) " -ldflag: pass flag to linker (executable)" ,; " -aflag: pass flag to linker (static library)" ,; " -dflag: pass flag to linker (dynamic library)" ,; + " -runflag: pass flag to output executable when -run option is used" ,; " -hbcmp stop after creating the object files" ,; " create link/copy hbmk to hbcmp for the same effect" ,; " -hbcc stop after creating the object files and accept raw C flags" ,; diff --git a/harbour/utils/hbtest/rt_array.prg b/harbour/utils/hbtest/rt_array.prg index e7ec3ad639..f846d68c2f 100644 --- a/harbour/utils/hbtest/rt_array.prg +++ b/harbour/utils/hbtest/rt_array.prg @@ -289,7 +289,40 @@ PROCEDURE Main_ARRAY() /* ASort() */ - TEST_LINE( TAStr(ASort(TARRv(),,,{||NIL})) , "ABCDEFGHIJ" ) /* Bug/Feature in CA-Cl*pper, it will return: "IHGFEDCBAJ" */ + /* Different results in Harbour and CA-Cl*pper due to different + sorting algorithms. Anyhow the results pattern should match. + [vszakats] */ +#ifdef __HARBOUR__ + TEST_LINE( TAStr(ASort(TARRv(),,,{||NIL})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||hb_SToD()})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"0"})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"1"})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"2"})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"a"})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"A"})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||""})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"z"})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||.T.})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||.F.})) , "FEIDGCHBJA" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||2})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||1})) , "DCBAEFIHGJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||0})) , "FEIDGCHBJA" ) +#else + TEST_LINE( TAStr(ASort(TARRv(),,,{||NIL})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||hb_SToD()})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"0"})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"1"})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"2"})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"a"})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"A"})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||""})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||"z"})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||.T.})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||.F.})) , "DCEABJIHFG" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||2})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||1})) , "IHGFEDCBAJ" ) + TEST_LINE( TAStr(ASort(TARRv(),,,{||0})) , "DCEABJIHFG" ) +#endif TEST_LINE( TAStr(ASort(TARRv())) , "ABCDEFGHIJ" ) TEST_LINE( TAStr(ASort(TARRv(),NIL,NIL)) , "ABCDEFGHIJ" ) TEST_LINE( TAStr(ASort(TARRv(),NIL, -2)) , "ABCDEFGHIJ" )