2006-03-01 20:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbapicdp.h
  * harbour/source/rtl/cdpapi.c
    * added optional BOOL parameter to functions which translate to UTF8
      to not translate control code characters

  * harbour/source/rtl/gtsln/gtsln.c
  * harbour/source/rtl/gtxwc/gtxwc.c
    * update for new parameter in UTF8 functions
This commit is contained in:
Przemyslaw Czerpak
2006-03-01 19:45:51 +00:00
parent 204f44ef8c
commit 5245b4c25f
5 changed files with 39 additions and 28 deletions

View File

@@ -8,6 +8,16 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* harbour/makefile.vc
2006-03-02 01:10 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/pp/ppcore.c
* fixed yest another problem with PP which caused GPF on
minigui compilation
2006-03-01 21:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/dbinfo.ch
* harbour/source/rdd/workarea.c
* added DBI_SCOPEDRELATION action. It alow to test if given
relation on current work area sets scope on child index.
F.e.: dbInfo( DBI_SCOPEDRELATION, 1 )
2006-03-01 20:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

View File

@@ -167,19 +167,19 @@ extern HB_EXPORT BOOL hb_cdpRegister( PHB_CODEPAGE );
extern HB_EXPORT char * hb_cdpSelectID( char * );
extern HB_EXPORT PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE );
extern HB_EXPORT PHB_CODEPAGE hb_cdpFind( char * );
extern HB_EXPORT void hb_cdpTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE );
extern HB_EXPORT void hb_cdpnTranslate( char*, PHB_CODEPAGE, PHB_CODEPAGE, unsigned int );
extern HB_EXPORT int hb_cdpcmp( char*, char*, ULONG, PHB_CODEPAGE, ULONG* );
extern HB_EXPORT void hb_cdpTranslate( char *, PHB_CODEPAGE, PHB_CODEPAGE );
extern HB_EXPORT void hb_cdpnTranslate( char *, PHB_CODEPAGE, PHB_CODEPAGE, ULONG );
extern HB_EXPORT int hb_cdpcmp( char *, char *, ULONG, PHB_CODEPAGE, ULONG * );
extern HB_EXPORT int hb_cdpchrcmp( char, char, PHB_CODEPAGE );
extern HB_EXPORT void hb_cdpReleaseAll( void );
extern HB_EXPORT USHORT hb_cdpGetU16( PHB_CODEPAGE, BYTE );
extern HB_EXPORT BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BYTE ch, int * n, USHORT * uc );
extern HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE, BYTE*, ULONG, BYTE* );
extern HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE, BYTE*, ULONG, BYTE* );
extern HB_EXPORT ULONG hb_cdpUTF8StringLength( BYTE * pSrc, ULONG ulLen );
extern HB_EXPORT ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE cdp, BYTE * pSrc, ULONG ulLen );
extern HB_EXPORT ULONG hb_cdpUTF8ToStrn( PHB_CODEPAGE cdp, BYTE * pSrc, ULONG ulSrc, BYTE * pDst, ULONG ulDst );
extern HB_EXPORT USHORT hb_cdpGetU16( PHB_CODEPAGE, BOOL, BYTE );
extern HB_EXPORT BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE, BYTE ch, int *, USHORT * );
extern HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE, BOOL, BYTE *, ULONG, BYTE * );
extern HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE, BOOL, BYTE *, ULONG, BYTE * );
extern HB_EXPORT ULONG hb_cdpUTF8StringLength( BYTE *, ULONG );
extern HB_EXPORT ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE, BOOL, BYTE *, ULONG );
extern HB_EXPORT ULONG hb_cdpUTF8ToStrn( PHB_CODEPAGE, BYTE *, ULONG, BYTE *, ULONG );
extern PHB_CODEPAGE hb_cdp_page;

View File

@@ -463,10 +463,10 @@ HB_EXPORT void hb_cdpTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpO
}
}
HB_EXPORT void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, unsigned int nChars )
HB_EXPORT void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpOut, ULONG nChars )
{
int n;
unsigned int i;
ULONG i;
if( cdpIn != cdpOut && cdpIn->nChars == cdpOut->nChars )
{
@@ -486,11 +486,12 @@ HB_EXPORT void hb_cdpnTranslate( char* psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdp
}
}
HB_EXPORT USHORT hb_cdpGetU16( PHB_CODEPAGE cdp, BYTE ch )
HB_EXPORT USHORT hb_cdpGetU16( PHB_CODEPAGE cdp, BOOL fCtrl, BYTE ch )
{
USHORT u;
if ( cdp && cdp->uniTable && cdp->uniTable->uniCodes && ch < cdp->uniTable->nChars )
if ( ( fCtrl || ch >= 32 ) && cdp && cdp->uniTable &&
cdp->uniTable->uniCodes && ch < cdp->uniTable->nChars )
{
u = cdp->uniTable->uniCodes[ ch ];
}
@@ -519,13 +520,13 @@ HB_EXPORT ULONG hb_cdpUTF8StringLength( BYTE * pSrc, ULONG ulLen )
return ulDst;
}
HB_EXPORT ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE cdp, BYTE * pSrc, ULONG ulLen )
HB_EXPORT ULONG hb_cdpStringInUTF8Length( PHB_CODEPAGE cdp, BOOL fCtrl, BYTE * pSrc, ULONG ulLen )
{
ULONG ul, ulDst;
for( ul = ulDst = 0; ul < ulLen; ++ul )
{
ulDst += utf8Size( hb_cdpGetU16( cdp, pSrc[ ul ] ) );
ulDst += utf8Size( hb_cdpGetU16( cdp, fCtrl, pSrc[ ul ] ) );
}
return ulDst;
@@ -593,7 +594,7 @@ HB_EXPORT BOOL hb_cdpGetFromUTF8( PHB_CODEPAGE cdp, BYTE ch, int * n, USHORT * u
return FALSE;
}
HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYTE* pDst )
HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BOOL fCtrl, BYTE* pSrc, ULONG ulLen, BYTE* pDst )
{
USHORT u, *uniCodes, nChars;
ULONG i, n;
@@ -607,7 +608,7 @@ HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYT
*/
for ( i = 0, n = 0; i < ulLen; i++ )
{
u = hb_cdpGetU16( cdp, pSrc[ i ] );
u = hb_cdpGetU16( cdp, fCtrl, pSrc[ i ] );
n += u16toutf8( &pDst[n], u );
}
return n;
@@ -627,7 +628,7 @@ HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYT
for ( i = 0, n = 0; i < ulLen; i++ )
{
u = pSrc[ i ];
if ( uniCodes && u < nChars )
if ( uniCodes && u < nChars && ( fCtrl || u >= 32 ) )
u = uniCodes[ u ];
n += u16toutf8( &pDst[n], u );
}
@@ -636,7 +637,7 @@ HB_EXPORT ULONG hb_cdpStrnToUTF8( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYT
return n;
}
HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYTE* pDst )
HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BOOL fCtrl, BYTE* pSrc, ULONG ulLen, BYTE* pDst )
{
USHORT u, *uniCodes, nChars;
ULONG i;
@@ -650,7 +651,7 @@ HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYTE
*/
for ( i = 0; i < ulLen; i++, pDst += 2 )
{
u = hb_cdpGetU16( cdp, pSrc[ i ] );
u = hb_cdpGetU16( cdp, fCtrl, pSrc[ i ] );
HB_PUT_BE_UINT16( pDst, u );
}
return i<<1;
@@ -670,7 +671,7 @@ HB_EXPORT ULONG hb_cdpStrnToU16( PHB_CODEPAGE cdp, BYTE* pSrc, ULONG ulLen, BYTE
for ( i = 0; i < ulLen; i++, pDst += 2 )
{
u = pSrc[ i ];
if ( uniCodes && u < nChars )
if ( uniCodes && u < nChars && ( fCtrl || u >= 32 ) )
u = uniCodes[ u ];
HB_PUT_BE_UINT16( pDst, u );
}

View File

@@ -354,7 +354,7 @@ static void hb_sln_setCharTrans( PHB_CODEPAGE cdpHost, PHB_CODEPAGE cdpTerm, BOO
{
#ifndef HB_CDP_SUPPORT_OFF
if( hb_sln_Is_Unicode )
iDst = hb_cdpGetU16( cdpHost, ( BYTE ) i );
iDst = hb_cdpGetU16( cdpHost, TRUE, ( BYTE ) i );
else
#endif
iDst = i;
@@ -396,7 +396,7 @@ static void hb_sln_setCharTrans( PHB_CODEPAGE cdpHost, PHB_CODEPAGE cdpTerm, BOO
{
iSrc = ( unsigned char ) cdpHost->CharsUpper[ i ];
#ifdef HB_SLN_UNICODE
iDst = hb_cdpGetU16( cdpHost, ( BYTE ) iSrc );
iDst = hb_cdpGetU16( cdpHost, TRUE, ( BYTE ) iSrc );
#else
iDst = fTrans ? ( unsigned char ) cdpTerm->CharsUpper[ i ] : iSrc;
#endif
@@ -406,7 +406,7 @@ static void hb_sln_setCharTrans( PHB_CODEPAGE cdpHost, PHB_CODEPAGE cdpTerm, BOO
iSrc = ( unsigned char ) cdpHost->CharsLower[ i ];
#ifdef HB_SLN_UNICODE
iDst = hb_cdpGetU16( cdpHost, ( BYTE ) iSrc );
iDst = hb_cdpGetU16( cdpHost, TRUE, ( BYTE ) iSrc );
#else
iDst = fTrans ? ( unsigned char ) cdpTerm->CharsLower[ i ] : iSrc;
#endif

View File

@@ -1555,7 +1555,7 @@ static void hb_gt_xwc_BuildCharTrans( PXWND_DEF wnd )
for( i = 0; i < 256; i++ )
{
#ifndef HB_CDP_SUPPORT_OFF
usCh16 = hb_cdpGetU16( wnd->hostCDP, ( BYTE ) i );
usCh16 = hb_cdpGetU16( wnd->hostCDP, TRUE, ( BYTE ) i );
#else
int j;
usCh16 = ( USHORT ) i;
@@ -2228,10 +2228,10 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
}
else if( req->target == s_atomUTF8String )
{
ULONG ulLen = hb_cdpStringInUTF8Length( wnd->hostCDP, wnd->ClipboardData, wnd->ClipboardSize );
ULONG ulLen = hb_cdpStringInUTF8Length( wnd->hostCDP, FALSE, wnd->ClipboardData, wnd->ClipboardSize );
BYTE * pBuffer = ( BYTE * ) hb_xgrab( ulLen + 1 );
hb_cdpStrnToUTF8( wnd->hostCDP, wnd->ClipboardData, wnd->ClipboardSize, pBuffer );
hb_cdpStrnToUTF8( wnd->hostCDP, FALSE, wnd->ClipboardData, wnd->ClipboardSize, pBuffer );
#ifdef XWC_DEBUG
printf( "SelectionRequest: (%s)->(%s) [%s]\r\n", wnd->ClipboardData, pBuffer, wnd->hostCDP->id ); fflush(stdout);
#endif