2009-05-26 02:54 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/xhb/Makefile
+ contrib/xhb/datesxhb.c
+ Added these xhb compatibility functions:
TSSECS(), TIMEOFDAY(), HMS2D(), TTOD().
Borrowed from xhb, work of Giancarlo Niccolai, Walter Negro,
with few changes.
* contrib/xhb/hbcompat.ch
+ Added translation for these functions:
DATETIME(), HOUR(), MINUTE(), TTOS(), STOT(), TTOC(), CTOT()
(NOTE: I don't know if the workings of corresponding Harbour
functions are fully compatible. If not we can add
xhb_*() flavours locally in xhb lib)
This commit is contained in:
@@ -17,76 +17,91 @@
|
||||
past entries belonging to these authors: Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-05-26 02:54 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/xhb/Makefile
|
||||
+ contrib/xhb/datesxhb.c
|
||||
+ Added these xhb compatibility functions:
|
||||
TSSECS(), TIMEOFDAY(), HMS2D(), TTOD().
|
||||
Borrowed from xhb, work of Giancarlo Niccolai, Walter Negro,
|
||||
with few changes.
|
||||
|
||||
* contrib/xhb/hbcompat.ch
|
||||
+ Added translation for these functions:
|
||||
DATETIME(), HOUR(), MINUTE(), TTOS(), STOT(), TTOC(), CTOT()
|
||||
(NOTE: I don't know if the workings of corresponding Harbour
|
||||
functions are fully compatible. If not we can add
|
||||
xhb_*() flavours locally in xhb lib)
|
||||
|
||||
2009-05-26 02:14 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/xhb/fparse.c
|
||||
* contrib/rddsql/sddmy/mysqldd.c
|
||||
* contrib/rddsql/sqlbase.c
|
||||
* contrib/rddsql/sqlmix.c
|
||||
* contrib/rddads/adsx.c
|
||||
* contrib/examples/terminal/trm_client.prg
|
||||
* source/rdd/dbfnsx/dbfnsx1.c
|
||||
% "" -> NULL where applicable (hb_retc*(), hb_retds(), hb_itemPutC*(),
|
||||
hb_arraySetC*(), hb_errInternal(), hb_itemPutDS(), hb_arraySetDS())
|
||||
* contrib/xhb/fparse.c
|
||||
* contrib/rddsql/sddmy/mysqldd.c
|
||||
* contrib/rddsql/sqlbase.c
|
||||
* contrib/rddsql/sqlmix.c
|
||||
* contrib/rddads/adsx.c
|
||||
* contrib/examples/terminal/trm_client.prg
|
||||
* source/rdd/dbfnsx/dbfnsx1.c
|
||||
% "" -> NULL where applicable (hb_retc*(), hb_retds(), hb_itemPutC*(),
|
||||
hb_arraySetC*(), hb_errInternal(), hb_itemPutDS(), hb_arraySetDS())
|
||||
|
||||
* contrib/hbqt/hbqt_qtextdocument.cpp
|
||||
* contrib/hbqt/hbqt_qgridlayout.cpp
|
||||
* contrib/hbqt/hbqt_qpainter.cpp
|
||||
* contrib/hbqt/hbqt_qeventloop.cpp
|
||||
* contrib/hbqt/hbqt_qicon.cpp
|
||||
* contrib/hbqt/hbqt_qtreeview.cpp
|
||||
* contrib/hbqt/hbqt_qtextline.cpp
|
||||
* contrib/hbqt/hbqt_qdesktopwidget.cpp
|
||||
* contrib/hbqt/hbqt_qhttp.cpp
|
||||
* contrib/hbqt/hbqt_qlineedit.cpp
|
||||
* contrib/hbqt/hbqt_qcombobox.cpp
|
||||
* contrib/hbqt/hbqt_qlistwidget.cpp
|
||||
* contrib/hbqt/hbqt_qtextcursor.cpp
|
||||
* contrib/hbqt/hbqt_qtextlayout.cpp
|
||||
* contrib/hbqt/hbqt_qftp.cpp
|
||||
* contrib/hbqt/hbqt_qclipboard.cpp
|
||||
* contrib/hbqt/hbqt_qurl.cpp
|
||||
* contrib/hbqt/hbqt_qwebpage.cpp
|
||||
* contrib/hbqt/hbqt_qtextedit.cpp
|
||||
* contrib/hbqt/hbqt_qpixmap.cpp
|
||||
* contrib/hbqt/hbqt_qsplashscreen.cpp
|
||||
* contrib/hbqt/hbqt_qtablewidget.cpp
|
||||
* contrib/hbqt/hbqt_qtreewidget.cpp
|
||||
* contrib/hbqt/generator/hbqtgen.prg
|
||||
* contrib/hbqt/hbqt_qfont.cpp
|
||||
* contrib/hbqt/hbqt_qmainwindow.cpp
|
||||
* contrib/hbqt/hbqt_qdir.cpp
|
||||
* contrib/hbqt/hbqt_qwidget.cpp
|
||||
* contrib/hbqt/hbqt_qstyle.cpp
|
||||
* contrib/hbqt/hbqt_qabstractbutton.cpp
|
||||
* contrib/hbqt/hbqt_qobject.cpp
|
||||
* contrib/hbqt/hbqt_qcolor.cpp
|
||||
* contrib/hbqt/hbqt_qtextstream.cpp
|
||||
* contrib/hbqt/hbqt_qwebview.cpp
|
||||
* contrib/hbqt/hbqt_qboxlayout.cpp
|
||||
* contrib/hbqt/hbqt_qstatusbar.cpp
|
||||
* contrib/hbqt/hbqt_qtabwidget.cpp
|
||||
* contrib/hbqt/hbqt_qscrollarea.cpp
|
||||
* contrib/hbqt/hbqt_qtextcharformat.cpp
|
||||
! Fixed to use HB_ISNUM() instead of HB_ISNIL().
|
||||
% Don't call HB_ISNUM() where the default value is
|
||||
zero anyway. hb_parn*() functions will return zero
|
||||
anyway. (well, maybe this exploits the array-type
|
||||
bug in our Extend API.)
|
||||
* contrib/hbqt/hbqt_qtextdocument.cpp
|
||||
* contrib/hbqt/hbqt_qgridlayout.cpp
|
||||
* contrib/hbqt/hbqt_qpainter.cpp
|
||||
* contrib/hbqt/hbqt_qeventloop.cpp
|
||||
* contrib/hbqt/hbqt_qicon.cpp
|
||||
* contrib/hbqt/hbqt_qtreeview.cpp
|
||||
* contrib/hbqt/hbqt_qtextline.cpp
|
||||
* contrib/hbqt/hbqt_qdesktopwidget.cpp
|
||||
* contrib/hbqt/hbqt_qhttp.cpp
|
||||
* contrib/hbqt/hbqt_qlineedit.cpp
|
||||
* contrib/hbqt/hbqt_qcombobox.cpp
|
||||
* contrib/hbqt/hbqt_qlistwidget.cpp
|
||||
* contrib/hbqt/hbqt_qtextcursor.cpp
|
||||
* contrib/hbqt/hbqt_qtextlayout.cpp
|
||||
* contrib/hbqt/hbqt_qftp.cpp
|
||||
* contrib/hbqt/hbqt_qclipboard.cpp
|
||||
* contrib/hbqt/hbqt_qurl.cpp
|
||||
* contrib/hbqt/hbqt_qwebpage.cpp
|
||||
* contrib/hbqt/hbqt_qtextedit.cpp
|
||||
* contrib/hbqt/hbqt_qpixmap.cpp
|
||||
* contrib/hbqt/hbqt_qsplashscreen.cpp
|
||||
* contrib/hbqt/hbqt_qtablewidget.cpp
|
||||
* contrib/hbqt/hbqt_qtreewidget.cpp
|
||||
* contrib/hbqt/generator/hbqtgen.prg
|
||||
* contrib/hbqt/hbqt_qfont.cpp
|
||||
* contrib/hbqt/hbqt_qmainwindow.cpp
|
||||
* contrib/hbqt/hbqt_qdir.cpp
|
||||
* contrib/hbqt/hbqt_qwidget.cpp
|
||||
* contrib/hbqt/hbqt_qstyle.cpp
|
||||
* contrib/hbqt/hbqt_qabstractbutton.cpp
|
||||
* contrib/hbqt/hbqt_qobject.cpp
|
||||
* contrib/hbqt/hbqt_qcolor.cpp
|
||||
* contrib/hbqt/hbqt_qtextstream.cpp
|
||||
* contrib/hbqt/hbqt_qwebview.cpp
|
||||
* contrib/hbqt/hbqt_qboxlayout.cpp
|
||||
* contrib/hbqt/hbqt_qstatusbar.cpp
|
||||
* contrib/hbqt/hbqt_qtabwidget.cpp
|
||||
* contrib/hbqt/hbqt_qscrollarea.cpp
|
||||
* contrib/hbqt/hbqt_qtextcharformat.cpp
|
||||
! Fixed to use HB_ISNUM() instead of HB_ISNIL().
|
||||
% Don't call HB_ISNUM() where the default value is
|
||||
zero anyway. hb_parn*() functions will return zero
|
||||
anyway. (well, maybe this exploits the array-type
|
||||
bug in our Extend API.)
|
||||
|
||||
* contrib/gtwvg/wvgwin.c
|
||||
* contrib/gtwvg/wvgsink.c
|
||||
* Avoiding ISNIL(). Corrected just a few occurences.
|
||||
This practice is still wrong in most of the cases in
|
||||
GTWVG code, so if the goal is GPF-free and consitently
|
||||
behaving apps, these would better be fixed. With
|
||||
string params ISNIL() is either superfluous or simply
|
||||
don't protect agains GPFs, for rest of the cases it
|
||||
either causes unexpected defaults (zero), or simply
|
||||
superfluous for the rest of the cases. IOW: Avoid it,
|
||||
use HB_ISNUM(), HB_ISCHAR() / parcx() instead.
|
||||
* contrib/gtwvg/wvgwin.c
|
||||
* contrib/gtwvg/wvgsink.c
|
||||
* Avoiding ISNIL(). Corrected just a few occurences.
|
||||
This practice is still wrong in most of the cases in
|
||||
GTWVG code, so if the goal is GPF-free and consitently
|
||||
behaving apps, these would better be fixed. With
|
||||
string params ISNIL() is either superfluous or simply
|
||||
don't protect agains GPFs, for rest of the cases it
|
||||
either causes unexpected defaults (zero), or simply
|
||||
superfluous for the rest of the cases. IOW: Avoid it,
|
||||
use HB_ISNUM(), HB_ISCHAR() / parcx() instead.
|
||||
|
||||
* contrib/hbgd/gdwrp.c
|
||||
* Formatting.
|
||||
* contrib/hbgd/gdwrp.c
|
||||
* Formatting.
|
||||
|
||||
2009-05-25 15:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/gtwvg/wvgsink.c
|
||||
|
||||
@@ -8,6 +8,7 @@ LIBNAME=xhb
|
||||
|
||||
C_SOURCES=\
|
||||
cstructc.c \
|
||||
datesxhb.c \
|
||||
dbf2txt.c \
|
||||
dbgfxc.c \
|
||||
filestat.c \
|
||||
|
||||
120
harbour/contrib/xhb/datesxhb.c
Normal file
120
harbour/contrib/xhb/datesxhb.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* The Date API (Harbour level)
|
||||
*
|
||||
* Copyright 1999-2001 Viktor Szakats <viktor.szakats@syenar.hu>
|
||||
* Copyright 2004 Giancarlo Niccolai <gc -at- niccolai -dot- ws>
|
||||
* Copyright 2007 Walter Negro <anegro@overnet.com.ar>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapierr.h"
|
||||
#include "hbdate.h"
|
||||
|
||||
/* NOTE: szTime must be 9 chars large. */
|
||||
|
||||
static ULONG hb_TimeStrToSec( char * pszTime )
|
||||
{
|
||||
ULONG ulLen;
|
||||
ULONG ulTime = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_TimeStrToSec(%s)", pszTime));
|
||||
|
||||
ulLen = strlen( pszTime );
|
||||
|
||||
if( ulLen >= 1 )
|
||||
ulTime += ( ULONG ) hb_strVal( pszTime, ulLen ) * 3600;
|
||||
|
||||
if( ulLen >= 4 )
|
||||
ulTime += ( ULONG ) hb_strVal( pszTime + 3, ulLen - 3 ) * 60;
|
||||
|
||||
if( ulLen >= 7 )
|
||||
ulTime += ( ULONG ) hb_strVal( pszTime + 6, ulLen - 6 );
|
||||
|
||||
return ulTime;
|
||||
}
|
||||
|
||||
HB_FUNC( TSSECS )
|
||||
{
|
||||
hb_retnl( hb_TimeStrToSec( hb_parcx( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( TIMEOFDAY )
|
||||
{
|
||||
char szResult[ 9 ];
|
||||
|
||||
if( hb_pcount() == 0 )
|
||||
{
|
||||
hb_dateTimeStr( szResult );
|
||||
}
|
||||
else
|
||||
{
|
||||
int iSeconds = hb_parni(1);
|
||||
iSeconds %= 3600*24;
|
||||
hb_snprintf( szResult, sizeof( szResult ), "%02d:%02d:%02d",
|
||||
iSeconds/3600 , (iSeconds % 3600)/60, iSeconds % 60 );
|
||||
}
|
||||
hb_retclen( szResult, 8 );
|
||||
}
|
||||
|
||||
HB_FUNC( HMS2D )
|
||||
{
|
||||
int iHour = hb_parni( 1 );
|
||||
int iMin = hb_parni( 2 );
|
||||
double dSec = hb_parnd( 3 );
|
||||
|
||||
hb_retnd( hb_timeEncode( iHour, iMin, ( int ) dSec, ( int ) ( ( ( double ) ( dSec - ( double ) ( ( int ) dSec ) ) ) * 1000 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( TTOD )
|
||||
{
|
||||
if( ISDATE( 1 ) )
|
||||
hb_retdl( hb_pardl( 1 ) );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 1120, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
|
||||
}
|
||||
@@ -111,6 +111,14 @@
|
||||
#xtranslate hb_ADel([<x,...>]) => ADel(<x>)
|
||||
#xtranslate hb_At([<x,...>]) => At(<x>)
|
||||
|
||||
#xtranslate hb_DateTime() => DateTime()
|
||||
#xtranslate hb_Hour([<x>]) => Hour(<x>)
|
||||
#xtranslate hb_Minute([<x>]) => Minute(<x>)
|
||||
#xtranslate hb_TToS([<x>]) => TToS(<x>)
|
||||
#xtranslate hb_SToT([<x>]) => SToT(<x>)
|
||||
#xtranslate hb_TToC([<x,...>]) => TToC(<x>)
|
||||
#xtranslate hb_CToT([<x,...>]) => CToT(<x>)
|
||||
|
||||
#xtranslate hb_GetEnv([<x,...>]) => GetEnv(<x>)
|
||||
#xtranslate hb_SetKey([<x,...>]) => SetKey(<x>)
|
||||
|
||||
@@ -216,6 +224,14 @@
|
||||
#xtranslate ADel(<a>,<n>,<l>) => hb_ADel(<a>,<n>,<l>)
|
||||
#xtranslate At(<a>,<b>,[<x,...>]) => hb_At(<a>,<b>,<x>)
|
||||
|
||||
#xtranslate DateTime() => hb_DateTime()
|
||||
#xtranslate Hour([<x>]) => hb_Hour(<x>)
|
||||
#xtranslate Minute([<x>]) => hb_Minute(<x>)
|
||||
#xtranslate TToS([<x>]) => hb_TToS(<x>)
|
||||
#xtranslate SToT([<x>]) => hb_SToT(<x>)
|
||||
#xtranslate TToC([<x,...>]) => hb_TToC(<x>)
|
||||
#xtranslate CToT([<x,...>]) => hb_CToT(<x>)
|
||||
|
||||
#xtranslate GetEnv([<x,...>]) => hb_GetEnv(<x>)
|
||||
#xtranslate SetKey([<x,...>]) => hb_SetKey(<x>)
|
||||
#xtranslate MemoWrit(<x>,<y>,<z>) => iif( hb_isLogical(<z>) .AND. <z>, MemoWrit(<x>,<y>), hb_MemoWrit(<x>,<y>) )
|
||||
|
||||
Reference in New Issue
Block a user