2007-08-03 04:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/contrib/libct/screen2.c
    + added SCREENSTR(), STRSCREEN()

  * harbour/contrib/libct/keyset.c
    * casting to fix warnings in DOS builds

  * harbour/source/rtl/seconds.c
    * update timezone in BSD systems when clock is stored in UTC
This commit is contained in:
Przemyslaw Czerpak
2007-08-03 02:05:58 +00:00
parent 0223a9ac1a
commit 26aae29987
4 changed files with 105 additions and 7 deletions

View File

@@ -8,6 +8,16 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-08-03 04:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/libct/screen2.c
+ added SCREENSTR(), STRSCREEN()
* harbour/contrib/libct/keyset.c
* casting to fix warnings in DOS builds
* harbour/source/rtl/seconds.c
* update timezone in BSD systems when clock is stored in UTC
2007-08-02 18:03 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* harbour/contrib/libct/keyset.c
! Fixed gcc 4.1.2 warning in SetGet() (Win32 branch).

View File

@@ -73,11 +73,11 @@
static void SetGet( unsigned char cKey )
{
#if defined(__WATCOMC__) && defined(__386__)
hb_retl( *( ( char * ) 0x0417 ) & cKey );
hb_retl( *( ( unsigned char * ) 0x0417 ) & cKey );
#elif defined(__DJGPP__)
hb_retl( _farpeekb( 0x0040, 0x0017 ) & cKey );
#else
hb_retl( *( ( char FAR * ) MK_FP( 0x0040, 0x0017 ) ) & cKey );
hb_retl( *( ( unsigned char FAR * ) MK_FP( 0x0040, 0x0017 ) ) & cKey );
#endif
if( hb_pcount() >= 1 )
@@ -85,12 +85,12 @@ static void SetGet( unsigned char cKey )
cKey = hb_parl( 1 ) * cKey;
#if defined(__WATCOMC__) && defined(__386__)
*( ( char * ) 0x0417 ) = ( *( ( char * ) 0x0417 ) & ( !cKey ) ) | cKey;
*( ( unsigned char * ) 0x0417 ) = ( *( ( unsigned char * ) 0x0417 ) & ( !cKey ) ) | cKey;
#elif defined(__DJGPP__)
_farpokeb( 0x0040, 0x0017, ( _farpeekb( 0x0040, 0x0017 ) & ( !cKey ) ) | cKey );
#else
*( ( char FAR * ) MK_FP( 0x0040, 0x0017 ) ) =
( *( ( char FAR * ) MK_FP( 0x0040, 0x0017 ) ) & ( !cKey ) ) | cKey;
*( ( unsigned char FAR * ) MK_FP( 0x0040, 0x0017 ) ) =
( *( ( unsigned char FAR * ) MK_FP( 0x0040, 0x0017 ) ) & ( !cKey ) ) | cKey;
#endif
}
}

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* CT3 video functions:
*
* SAYDOWN(), SAYSPREAD(), SAYMOVEIN()
* SAYDOWN(), SAYSPREAD(), SAYMOVEIN(), SCREENSTR(), STRSCREEN()
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
@@ -224,3 +224,91 @@ HB_FUNC( SAYMOVEIN )
hb_retc( NULL );
}
HB_FUNC( SCREENSTR )
{
SHORT sRow, sCol, sMaxRow, sMaxCol, sC;
char * pBuffer, * szText;
ULONG ulSize, ulCount = ULONG_MAX;
hb_gtGetPos( &sRow, &sCol );
if( ISNUM( 1 ) )
sRow = ( SHORT ) hb_parni( 1 );
if( ISNUM( 2 ) )
sCol = ( SHORT ) hb_parni( 2 );
if( ISNUM( 3 ) )
ulCount = hb_parnl( 3 );
sMaxRow = ( SHORT ) hb_gtMaxRow();
sMaxCol = ( SHORT ) hb_gtMaxCol();
if( sRow >= 0 && sRow <= sMaxRow && sCol >= 0 && sCol <= sMaxCol && ulCount )
{
ulSize = ( ULONG ) ( sMaxRow - sRow + 1 ) * ( sMaxCol - sCol + 1 );
if( ulSize > ulCount )
ulSize = ulCount;
ulCount = ulSize;
ulSize <<= 1;
szText = pBuffer = ( char * ) hb_xgrab( ulSize + 1 );
do
{
sC = sCol;
do
{
BYTE bColor, bAttr;
USHORT usChar;
hb_gtGetChar( sRow, sC, &bColor, &bAttr, &usChar );
*szText++ = ( char ) usChar;
*szText++ = ( char ) bColor;
}
while( ++sC <= sMaxCol && --ulCount );
}
while( ++sRow <= sMaxRow && ulCount );
hb_retclen_buffer( pBuffer, ulSize );
}
else
hb_retc( NULL );
}
HB_FUNC( STRSCREEN )
{
ULONG ulLen = hb_parclen( 1 );
if( ulLen & 1 )
ulLen--;
if( ulLen )
{
UCHAR * szText = ( UCHAR * ) hb_parc( 1 );
SHORT sRow, sCol, sMaxRow, sMaxCol, sC;
hb_gtGetPos( &sRow, &sCol );
if( ISNUM( 2 ) )
sRow = ( SHORT ) hb_parni( 2 );
if( ISNUM( 3 ) )
sCol = ( SHORT ) hb_parni( 3 );
sMaxRow = ( SHORT ) hb_gtMaxRow();
sMaxCol = ( SHORT ) hb_gtMaxCol();
if( sRow >= 0 && sRow <= sMaxRow && sCol >= 0 && sCol <= sMaxCol )
{
hb_gtBeginWrite();
do
{
sC = sCol;
do
{
USHORT usChar = *szText++;
BYTE bColor = *szText++;
hb_gtPutChar( sRow, sC, bColor, 0, usChar );
ulLen -= 2;
}
while( ulLen && ++sC <= sMaxCol );
}
while( ulLen && ++sRow <= sMaxRow );
hb_gtEndWrite();
}
}
hb_retc( NULL );
}

View File

@@ -88,7 +88,7 @@ HB_EXPORT double hb_dateSeconds( void )
#if defined(HB_OS_BSD)
gettimeofday( &tv, &tz );
seconds = tv.tv_sec;
seconds = tv.tv_sec - tz.tz_minuteswest * 60;
fraction = tv.tv_usec / 1000U;
#else
ftime( &tb );