From a7710b224d17db5c35601d56ddce4e78ba7d8693 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 3 Nov 2010 23:00:35 +0000 Subject: [PATCH] 2010-11-03 29:59 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/harbour.hbx * src/rtl/dateshb.c + Added HB_DATE( [, , ] ) -> If called without options, it returns current date, just like DATE(). * Changed HB_DATETIME() to work like above except for timestamps. * contrib/hbqt/hbqt_all.hbp - Deleted wrong MS-DOS fix. * contrib/hbqt/utils/hbqtgen.prg % Optimized to not read each input file twice. * contrib/hbqt/hbqt_hbmk2_plugin.hbs + Added #include "hbclass.ch". After 2010-11-03 23:28 UTC+0100 it works as expect. Thanks a lot Przemek! Header dir is setup correctly now by hbmk2, so hbmk2 plugins can safely use Harbour headers. (in hbmk2 context the headers should be present anyway, so this is square) --- harbour/ChangeLog | 20 ++++++++++++++ harbour/contrib/hbqt/hbqt_all.hbp | 2 -- harbour/contrib/hbqt/hbqt_hbmk2_plugin.hbs | 2 ++ harbour/contrib/hbqt/utils/hbqtgen.prg | 5 ---- harbour/include/harbour.hbx | 1 + harbour/src/rtl/dateshb.c | 32 +++++++++++++--------- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 78726652e5..404044f425 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,26 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-03 29:59 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * include/harbour.hbx + * src/rtl/dateshb.c + + Added HB_DATE( [, , ] ) -> + If called without options, it returns current date, just like DATE(). + * Changed HB_DATETIME() to work like above except for timestamps. + + * contrib/hbqt/hbqt_all.hbp + - Deleted wrong MS-DOS fix. + + * contrib/hbqt/utils/hbqtgen.prg + % Optimized to not read each input file twice. + + * contrib/hbqt/hbqt_hbmk2_plugin.hbs + + Added #include "hbclass.ch". After 2010-11-03 23:28 UTC+0100 + it works as expect. Thanks a lot Przemek! + Header dir is setup correctly now by hbmk2, so hbmk2 plugins + can safely use Harbour headers. (in hbmk2 context the headers + should be present anyway, so this is square) + 2010-11-03 23:28 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/compiler/hbmain.c + allow to use -p* switches in HB_COMPILEFROMBUF() diff --git a/harbour/contrib/hbqt/hbqt_all.hbp b/harbour/contrib/hbqt/hbqt_all.hbp index 1624add3d7..fcb4f5f4a9 100644 --- a/harbour/contrib/hbqt/hbqt_all.hbp +++ b/harbour/contrib/hbqt/hbqt_all.hbp @@ -7,8 +7,6 @@ # See COPYING for licensing terms. # --------------------------------------------------------------- -"-stop={dos}'hbqt' doesn't support this platform/compiler (${hb_plat}/${hb_comp})." - -hbcontainer # Do not change this to hbqt.hbc reference. diff --git a/harbour/contrib/hbqt/hbqt_hbmk2_plugin.hbs b/harbour/contrib/hbqt/hbqt_hbmk2_plugin.hbs index b60ace9983..4bc408cfca 100644 --- a/harbour/contrib/hbqt/hbqt_hbmk2_plugin.hbs +++ b/harbour/contrib/hbqt/hbqt_hbmk2_plugin.hbs @@ -30,6 +30,8 @@ #pragma -km+ #pragma -ko+ +#include "hbclass.ch" + #define I_( x ) hb_i18n_gettext( x ) #if defined( __HBSCRIPT__HBMK ) diff --git a/harbour/contrib/hbqt/utils/hbqtgen.prg b/harbour/contrib/hbqt/utils/hbqtgen.prg index ea2e8a4efd..5e619ae14f 100644 --- a/harbour/contrib/hbqt/utils/hbqtgen.prg +++ b/harbour/contrib/hbqt/utils/hbqtgen.prg @@ -322,11 +322,6 @@ METHOD HbQtGenerator:genSource( cProFile, cPathIn, cPathOut, cPathDoc, cProject RETURN { nil } ENDIF - IF empty( memoread( cFile ) ) - OutStd( "Cannot read: " + cFile + hb_eol() ) - RETURN { nil } - ENDIF - OutStd( "Processing: " + cFile + hb_eol() ) /* Mark to which sub library class belongs to */ diff --git a/harbour/include/harbour.hbx b/harbour/include/harbour.hbx index 4b62507a0a..8fb79ee162 100644 --- a/harbour/include/harbour.hbx +++ b/harbour/include/harbour.hbx @@ -377,6 +377,7 @@ DYNAMIC HB_CSTR DYNAMIC HB_CTOD DYNAMIC HB_CTOT DYNAMIC HB_CURDRIVE +DYNAMIC HB_DATE DYNAMIC HB_DATETIME DYNAMIC HB_DBCREATETEMP DYNAMIC HB_DBDETACH diff --git a/harbour/src/rtl/dateshb.c b/harbour/src/rtl/dateshb.c index e104164d46..c5055ac25c 100644 --- a/harbour/src/rtl/dateshb.c +++ b/harbour/src/rtl/dateshb.c @@ -197,6 +197,16 @@ HB_FUNC( DAY ) hb_errRT_BASE_SubstR( EG_ARG, 1114, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +HB_FUNC( DOW ) +{ + PHB_ITEM pDate = hb_param( 1, HB_IT_DATETIME ); + + if( pDate ) + hb_retnilen( hb_dateJulianDOW( hb_itemGetDL( pDate ) ), 3 ); + else + hb_errRT_BASE_SubstR( EG_ARG, 1115, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} + HB_FUNC( TIME ) { char szResult[ 9 ]; @@ -211,14 +221,16 @@ HB_FUNC( DATE ) hb_retd( iYear, iMonth, iDay ); } -HB_FUNC( DOW ) +HB_FUNC( HB_DATE ) { - PHB_ITEM pDate = hb_param( 1, HB_IT_DATETIME ); - - if( pDate ) - hb_retnilen( hb_dateJulianDOW( hb_itemGetDL( pDate ) ), 3 ); + if( hb_pcount() == 0 ) + { + int iYear, iMonth, iDay; + hb_dateToday( &iYear, &iMonth, &iDay ); + hb_retd( iYear, iMonth, iDay ); + } else - hb_errRT_BASE_SubstR( EG_ARG, 1115, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + hb_retd( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ); } HB_FUNC( HB_DATETIME ) @@ -229,15 +241,9 @@ HB_FUNC( HB_DATETIME ) hb_timeStampGet( &lDate, &lTime ); hb_rettdt( lDate, lTime ); } - else if( HB_ISNUM( 4 ) || HB_ISNUM( 5 ) || HB_ISNUM( 6 ) || HB_ISNUM( 7 ) ) - { + else hb_rettdt( hb_dateEncode( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ), hb_timeEncode( hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hb_parni( 7 ) ) ); - } - else if( HB_ISNUM( 1 ) || HB_ISNUM( 2 ) || HB_ISNUM( 3 ) ) - hb_retd( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ); - else - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } HB_FUNC( HB_DTOT )