2012-10-17 22:04 UTC+0200 Viktor Szakats (harbour syenar.net)

* contrib/hbnf/hbnf.hbp
  * contrib/hbnf/readme.txt
  - contrib/hbnf/setdate.prg
  - contrib/hbnf/settime.prg
  + contrib/hbnf/setdate.c
  + contrib/hbnf/settime.c
    + Implemented FT_SETTIME()/FT_SETDATE() for MS-DOS
      (build tested)
This commit is contained in:
Viktor Szakats
2012-10-17 20:06:12 +00:00
parent 8a3cba5756
commit 44c6d42f30
7 changed files with 238 additions and 101 deletions

View File

@@ -16,6 +16,16 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-10-17 22:04 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/hbnf.hbp
* contrib/hbnf/readme.txt
- contrib/hbnf/setdate.prg
- contrib/hbnf/settime.prg
+ contrib/hbnf/setdate.c
+ contrib/hbnf/settime.c
+ Implemented FT_SETTIME()/FT_SETDATE() for MS-DOS
(build tested)
2012-10-17 20:39 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/hbnf/hbnf.hbx
* contrib/hbnf/video1.c

View File

@@ -43,8 +43,10 @@ proper.c
prtscr.c
putkey.c
rmdir.c
setdate.c
setkeys.c
setlastk.c
settime.c
shadow.c
shift.c
stod.c
@@ -136,8 +138,6 @@ savearr.prg
savesets.prg
scancode.prg
scregion.prg
setdate.prg
settime.prg
sinkey.prg
sleep.prg
sqzn.prg

View File

@@ -15,9 +15,6 @@ nwuid.prg FT_NWUID()
scancode.prg FT_SCANCODE()
setdate.prg FT_SETDATE()
settime.prg FT_SETTIME()
sysmem.prg FT_SYSMEM()
vidcur.prg FT_GETVCUR(), FT_SETVCUR()

View File

@@ -0,0 +1,106 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* FT_SETDATE()
*
* Copyright 2012 Viktor Szakats (harbour syenar.net)
* www - http://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.
*
*/
/*
* Author....: Glenn Scott
* CIS ID....: 71620,1521
*
* This is an original work by Glenn Scott and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.3 15 Aug 1991 23:04:36 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.2 14 Jun 1991 19:52:58 GLENN
* Minor edit to file header
*
* Rev 1.1 12 Jun 1991 02:32:28 GLENN
* Documentation mod and change documented return value from "n" to "l"
* reflecting Ted's update of ft_int86().
*
* Rev 1.0 01 Apr 1991 01:02:16 GLENN
* Nanforum Toolkit
*
*/
#include "hbapi.h"
#include "hbdate.h"
#if defined( HB_OS_DOS )
# include "dos.h"
#endif
HB_FUNC( FT_SETDATE )
{
#if defined( HB_OS_DOS )
int iYear, iMonth, iDay;
union REGS regs;
if( HB_ISDATE( 1 ) )
hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay );
else
hb_dateToday( &iYear, &iMonth, &iDay );
regs.h.ah = 43;
regs.HB_XREGS.cx = iYear;
regs.h.dh = iMonth;
regs.h.dl = iDay;
HB_DOS_INT86( 0x21, &regs, &regs );
hb_retl( HB_TRUE );
#else
hb_retl( HB_FALSE );
#endif
}

View File

@@ -1,45 +0,0 @@
/*
* $Id$
*/
/*
* Author....: Glenn Scott
* CIS ID....: 71620,1521
*
* This is an original work by Glenn Scott and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.3 15 Aug 1991 23:04:36 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.2 14 Jun 1991 19:52:58 GLENN
* Minor edit to file header
*
* Rev 1.1 12 Jun 1991 02:32:28 GLENN
* Documentation mod and change documented return value from "n" to "l"
* reflecting Ted's update of ft_int86().
*
* Rev 1.0 01 Apr 1991 01:02:16 GLENN
* Nanforum Toolkit
*
*/
#include "ftint86.ch"
#define DOS 33
#define SETDATE 43
FUNCTION FT_SETDATE( dDate )
LOCAL aRegs[ INT86_MAX_REGS ]
dDate := iif( HB_ISDATE( dDate ), dDate, Date() )
aRegs[ AX ] := SETDATE * ( 2 ^ 8 )
aregs[ CX ] := Year( dDate )
aregs[ DX ] := ( Month( dDate ) * ( 2 ^ 8 ) ) + Day( dDate )
RETURN FT_INT86( DOS, aRegs )

View File

@@ -0,0 +1,120 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* FT_SETTIME()
*
* Copyright 2012 Viktor Szakats (harbour syenar.net)
* www - http://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.
*
*/
/*
* Author....: Glenn Scott
* CIS ID....: 71620,1521
*
* This is an original work by Glenn Scott and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.3 15 Aug 1991 23:06:08 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.2 14 Jun 1991 19:53:00 GLENN
* Minor edit to file header
*
* Rev 1.1 12 Jun 1991 02:34:58 GLENN
* Documentation mods: change documented return value form "n" to "l" in
* accordance with the new return value from ft_int86().
*
* Rev 1.0 01 Apr 1991 01:02:16 GLENN
* Nanforum Toolkit
*
*/
#include "hbapi.h"
#include "hbdate.h"
#if defined( HB_OS_DOS )
# include "dos.h"
#endif
HB_FUNC( FT_SETTIME )
{
#if defined( HB_OS_DOS )
int iHour, iMinute, iSeconds;
union REGS regs;
if( HB_ISCHAR( 1 ) )
{
const char * pszTime = hb_parc( 1 );
HB_SIZE nLen = strlen( pszTime );
if( nLen >= 1 )
iHour = ( int ) hb_strVal( pszTime, nLen );
if( nLen >= 4 )
iMinute = ( int ) hb_strVal( pszTime + 3, nLen - 3 );
if( nLen >= 7 )
iSeconds = ( int ) hb_strVal( pszTime + 6, nLen - 6 );
}
else
{
int iYear, iMonth, iDay, iMillisec;
hb_timeStampGetLocal( &iYear, &iMonth, &iDay,
&iHour, &iMinute, &iSeconds, &iMillisec );
}
regs.h.ah = 45;
regs.h.ch = iHour;
regs.h.cl = iMinute;
regs.h.dh = iSeconds;
HB_DOS_INT86( 0x21, &regs, &regs );
hb_retl( HB_TRUE );
#else
hb_retl( HB_FALSE );
#endif
}

View File

@@ -1,51 +0,0 @@
/*
* $Id$
*/
/*
* Author....: Glenn Scott
* CIS ID....: 71620,1521
*
* This is an original work by Glenn Scott and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.3 15 Aug 1991 23:06:08 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.2 14 Jun 1991 19:53:00 GLENN
* Minor edit to file header
*
* Rev 1.1 12 Jun 1991 02:34:58 GLENN
* Documentation mods: change documented return value form "n" to "l" in
* accordance with the new return value from ft_int86().
*
* Rev 1.0 01 Apr 1991 01:02:16 GLENN
* Nanforum Toolkit
*
*/
#include "ftint86.ch"
#define DOS 33
#define SETTIME 45
#define SECS( ts ) ( Val( SubStr( ts, 7 ) ) )
#define HRS( ts ) ( Val( SubStr( ts, 1, 2 ) ) )
#define MINS( ts ) ( Val( SubStr( ts, 4, 2 ) ) )
FUNCTION FT_SETTIME( cTime )
LOCAL aRegs[ INT86_MAX_REGS ]
cTime := iif( cTime == NIL, Time(), cTime )
// -------- High Byte ------ ----- Low Byte -------
aRegs[ AX ] := SETTIME * ( 2 ^ 8 )
aRegs[ CX ] := HRS( cTime ) * ( 2 ^ 8 ) + MINS( cTime )
aRegs[ DX ] := Secs( cTime ) * ( 2 ^ 8 )
RETURN FT_INT86( DOS, aRegs )