2008-10-07 09:33 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* include/hbextern.ch
  * source/rtl/inkey.c
    + Added HB_KEYCLEAR() a documented function equivalent 
      to "CLEAR TYPEAHEAD" command, or undocumented __KEYBOARD() function.

  * contrib/rddads/rddads.h
  * contrib/rddads/ads1.c
    + Added support for ADS_USE_OEM_TRANSLATION for old ads versions.
      Borrowed from xhb/Pavel Tsarenko.
This commit is contained in:
Viktor Szakats
2008-10-07 07:35:38 +00:00
parent e1ea6f3cec
commit f75bc7b051
5 changed files with 57 additions and 2 deletions

View File

@@ -8,6 +8,17 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-07 09:33 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* include/hbextern.ch
* source/rtl/inkey.c
+ Added HB_KEYCLEAR() a documented function equivalent
to "CLEAR TYPEAHEAD" command, or undocumented __KEYBOARD() function.
* contrib/rddads/rddads.h
* contrib/rddads/ads1.c
+ Added support for ADS_USE_OEM_TRANSLATION for old ads versions.
Borrowed from xhb/Pavel Tsarenko.
2008-10-07 02:57 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/Makefile
+ harbour/include/hbatomic.h

View File

@@ -515,13 +515,21 @@ static ERRCODE adsScopeSet( ADSAREAP pArea, ADSHANDLE hOrder, USHORT nScope, PHB
if( HB_IS_STRING( pItem ) )
{
/* bTypeError = FALSE; */
pucScope = ( UNSIGNED8 * ) hb_itemGetCPtr( pItem );
#ifdef ADS_USE_OEM_TRANSLATION
if( hb_ads_bOEM )
{
#if ADS_LIB_VERSION >= 600
u16DataType = ADS_RAWKEY;
#else
USHORT uiLen = ( USHORT ) hb_itemGetCLen( pItem );
char * pBuffer = hb_adsOemToAnsi( ( char * ) pucScope, uiLen );
memcpy( ( char * ) pucScope, pBuffer, uiLen );
hb_adsOemAnsiFree( pBuffer );
#endif
}
#endif
pucScope = ( UNSIGNED8 * ) hb_itemGetCPtr( pItem );
AdsSetScope( hOrder, nScope,
( UNSIGNED8 * ) pucScope,
( UNSIGNED16 ) hb_itemGetCLen( pItem ), u16DataType );
@@ -901,7 +909,17 @@ static ERRCODE adsSeek( ADSAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin
pszKey = ( UNSIGNED8* ) hb_itemGetCPtr( pKey );
u16KeyLen = ( UNSIGNED16 ) hb_itemGetCLen( pKey );
#ifdef ADS_USE_OEM_TRANSLATION
#if ADS_LIB_VERSION >= 600
u16KeyType = hb_ads_bOEM ? ADS_RAWKEY : ADS_STRINGKEY;
#else
u16KeyType = ADS_STRINGKEY;
if( hb_ads_bOEM )
{
char * pBuffer = hb_adsOemToAnsi( ( char * ) pszKey, u16KeyLen );
memcpy( ( char * ) pszKey, pBuffer, u16KeyLen );
hb_adsOemAnsiFree( pBuffer );
}
#endif
#else
u16KeyType = ADS_STRINGKEY;
#endif
@@ -1888,7 +1906,21 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
#ifdef ADS_USE_OEM_TRANSLATION
else if( hb_ads_bOEM )
{
#if ADS_LIB_VERSION >= 600
AdsGetFieldRaw( pArea->hTable, ADSFIELD( uiIndex ), pBuffer, &u32Length );
#else
if( AdsGetField( pArea->hTable, ADSFIELD( uiIndex ), pBuffer, &u32Length, ADS_NONE ) == AE_NO_CURRENT_RECORD )
{
memset( pBuffer, ' ', pField->uiLen );
hb_adsUpdateAreaFlags( pArea );
}
else
{
char * pBufOem = hb_adsAnsiToOem( ( char * ) pBuffer, pField->uiLen );
memcpy( pBuffer, pBufOem, pField->uiLen );
hb_adsOemAnsiFree( pBufOem );
}
#endif
}
#endif
else if( AdsGetField( pArea->hTable, ADSFIELD( uiIndex ), pBuffer, &u32Length, ADS_NONE ) == AE_NO_CURRENT_RECORD )
@@ -2224,7 +2256,13 @@ static ERRCODE adsPutValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
#ifdef ADS_USE_OEM_TRANSLATION
if( hb_ads_bOEM )
{
#if ADS_LIB_VERSION >= 600
ulRetVal = AdsSetFieldRaw( pArea->hTable, ADSFIELD( uiIndex ), ( UNSIGNED8 * ) hb_itemGetCPtr( pItem ), uiCount );
#else
char * pBuffer = hb_adsOemToAnsi( hb_itemGetCPtr( pItem ), uiCount );
ulRetVal = AdsSetString( pArea->hTable, ADSFIELD( uiIndex ), ( UNSIGNED8 * ) pBuffer, uiCount );
hb_adsOemAnsiFree( pBuffer );
#endif
}
else
#endif

View File

@@ -216,7 +216,7 @@ typedef ADSAREA * ADSAREAP;
#define HB_RDD_ADS_VERSION_STRING "ADS RDD 1.4"
#if ADS_LIB_VERSION >= 600 && defined( HB_OS_WIN_32 )
#if defined( HB_OS_WIN_32 )
# define ADS_USE_OEM_TRANSLATION
#else
# undef ADS_USE_OEM_TRANSLATION

View File

@@ -1075,6 +1075,7 @@ EXTERNAL HB_FEOF
EXTERNAL HB_FCOMMIT
EXTERNAL HB_FTEMPCREATE
EXTERNAL HB_GCALL
EXTERNAL HB_KEYCLEAR
EXTERNAL HB_KEYPUT
EXTERNAL HB_KEYINS
EXTERNAL HB_OEMTOANSI

View File

@@ -173,6 +173,11 @@ HB_FUNC( __KEYBOARD )
hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ) );
}
HB_FUNC( HB_KEYCLEAR )
{
hb_inkeyReset();
}
HB_FUNC( HB_KEYPUT )
{
if( ISNUM( 1 ) )