2007-06-23 11:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/rtl/gtchrmap.c
  * harbour/source/rtl/gttrm/Makefile
  * harbour/source/rtl/gttrm/gttrm.c
    + set Id keyword property

  * harbour/source/common/expropt1.c
    ! fixed typo in HB_TRACE() parameters

  * harbour/include/hbapicdp.h
  * harbour/include/hbapirdd.h
  * harbour/source/rtl/strcase.c
  * harbour/source/rtl/is.c
  * harbour/source/rtl/gtxwc/gtxwc.h
  * harbour/source/rtl/gtxwc/gtxwc.c
  * harbour/source/rtl/gtstd/gtstd.c
  * harbour/source/rtl/gtsln/gtsln.c
  * harbour/source/rtl/gtsln/gtsln.h
  * harbour/source/rtl/gtpca/gtpca.c
  * harbour/source/rtl/gtcgi/gtcgi.c
  * harbour/source/rdd/dbfcdx/dbfcdx1.c
  * harbour/source/vm/hvm.c
    ! fixed compilation with HB_CDP_SUPPORT_OFF - I do not plan to
      create such builds but now these macro allow to easy locate
      CDP dependent code

  * harbour/include/hbextern.ch
  * harbour/source/rtl/cdpapi.c
    + added two prg functions for translations from/to UTF-8:
         HB_STRTOUTF8( <cStr> [, <cCPID> ] ) -> <cUTF8Str>
         HB_UTF8TOSTR( <cUTF8Str> [, <cCPID> ] ) -> <cStr>
      <cCPID> is Harbour codepage id, f.e.: "EN", "ES", "ESWIN",
      "PLISO", "PLMAZ", "PL852", "PLWIN", ...
      When not given then default HVM codepage (set by HB_SETCODEPAGE())
      is used.
This commit is contained in:
Przemyslaw Czerpak
2007-06-23 09:13:50 +00:00
parent 6fc278c406
commit 685393a361
20 changed files with 154 additions and 24 deletions

View File

@@ -8,6 +8,42 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-06-23 11:10 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/gtchrmap.c
* harbour/source/rtl/gttrm/Makefile
* harbour/source/rtl/gttrm/gttrm.c
+ set Id keyword property
* harbour/source/common/expropt1.c
! fixed typo in HB_TRACE() parameters
* harbour/include/hbapicdp.h
* harbour/include/hbapirdd.h
* harbour/source/rtl/strcase.c
* harbour/source/rtl/is.c
* harbour/source/rtl/gtxwc/gtxwc.h
* harbour/source/rtl/gtxwc/gtxwc.c
* harbour/source/rtl/gtstd/gtstd.c
* harbour/source/rtl/gtsln/gtsln.c
* harbour/source/rtl/gtsln/gtsln.h
* harbour/source/rtl/gtpca/gtpca.c
* harbour/source/rtl/gtcgi/gtcgi.c
* harbour/source/rdd/dbfcdx/dbfcdx1.c
* harbour/source/vm/hvm.c
! fixed compilation with HB_CDP_SUPPORT_OFF - I do not plan to
create such builds but now these macro allow to easy locate
CDP dependent code
* harbour/include/hbextern.ch
* harbour/source/rtl/cdpapi.c
+ added two prg functions for translations from/to UTF-8:
HB_STRTOUTF8( <cStr> [, <cCPID> ] ) -> <cUTF8Str>
HB_UTF8TOSTR( <cUTF8Str> [, <cCPID> ] ) -> <cStr>
<cCPID> is Harbour codepage id, f.e.: "EN", "ES", "ESWIN",
"PLISO", "PLMAZ", "PL852", "PLWIN", ...
When not given then default HVM codepage (set by HB_SETCODEPAGE())
is used.
2007-06-22 16:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/bin/pack_src.sh
+ added GTTRM to compressed file list

View File

@@ -53,9 +53,10 @@
#ifndef HB_APICDP_H_
#define HB_APICDP_H_
#include <ctype.h>
#ifndef HB_CDP_SUPPORT_OFF
#include <ctype.h>
#include "hbapi.h"
#include "hbinit.h"
@@ -197,7 +198,7 @@ HB_EXTERN_END
#else
typedef PHB_CODEPAGE void *
typedef void * PHB_CODEPAGE;
#endif /* HB_CDP_SUPPORT_OFF */

View File

@@ -56,16 +56,10 @@
#include "hbapifs.h"
#include "dbinfo.ch" /* Constants for SELF_ORDINFO, SELF_INFO(), SELF_RECINFO() */
#include "dbstruct.ch" /* Constants for SELF_FIELDINFO() */
#ifndef HB_CDP_SUPPORT_OFF
#include "hbapicdp.h"
#endif
HB_EXTERN_BEGIN
#ifdef HB_CDP_SUPPORT_OFF
typedef void * PHB_CODEPAGE
#endif
#define HARBOUR_MAX_RDD_DRIVERNAME_LENGTH 32
#ifndef HARBOUR_MAX_RDD_ALIAS_LENGTH

View File

@@ -348,6 +348,8 @@ EXTERNAL HB_LANGSELECT
EXTERNAL HB_SETCODEPAGE
EXTERNAL HB_TRANSLATE
EXTERNAL HB_CDPLIST
EXTERNAL HB_STRTOUTF8
EXTERNAL HB_UTF8TOSTR
#endif
EXTERNAL HB_OSNEWLINE
EXTERNAL HB_PVALUE

View File

@@ -443,7 +443,7 @@ HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, ULONG ulLen, int iFlags, HB_C
{
HB_EXPR_PTR pExpr;
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%d,%d,%p)",string, iLen, iFlags, HB_COMP_PARAM));
HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%lu,%d,%p)",string, ulLen, iFlags, HB_COMP_PARAM));
pExpr = HB_COMP_EXPR_NEW( HB_ET_CODEBLOCK );

View File

@@ -405,6 +405,8 @@ static void hb_cdxMakeSortTab( CDXAREAP pArea )
pArea->bCdxSortTab[pbSort[i]] = i;
hb_xfree( pbSort );
}
#else
HB_SYMBOL_UNUSED( pArea );
#endif
}
@@ -654,6 +656,8 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, ULONG ulRec, LP
#ifndef HB_CDP_SUPPORT_OFF
if ( fTrans && pTag->uiType == 'C' )
hb_cdpnTranslate( ( char * ) pKey->val, hb_cdp_page, pTag->pIndex->pArea->cdPage, pKey->len );
#else
HB_SYMBOL_UNUSED( fTrans );
#endif
return pKey;
}
@@ -681,6 +685,8 @@ static PHB_ITEM hb_cdxKeyGetItem( LPCDXKEY pKey, PHB_ITEM pItem, LPCDXTAG pTag,
pItem = hb_itemPutCPtr( pItem, pVal, pKey->len );
}
else
#else
HB_SYMBOL_UNUSED( fTrans );
#endif
{
pItem = hb_itemPutCL( pItem, ( char * ) pKey->val, pKey->len );

View File

@@ -1040,5 +1040,49 @@ HB_FUNC( HB_CDPLIST )
}
}
HB_FUNC( HB_STRTOUTF8 )
{
ULONG ulLen = hb_parclen( 1 ), ulDest = 0;
char * szString, * szDest = NULL;
if( ulLen )
{
PHB_CODEPAGE cdp = ISCHAR( 2 ) ? hb_cdpFind( hb_parc( 2 ) ) : hb_cdp_page;
if( cdp )
{
szString = hb_parc( 1 );
ulDest = hb_cdpStringInUTF8Length( cdp, FALSE, ( BYTE * ) szString, ulLen );
szDest = ( char * ) hb_xgrab( ulDest + 1 );
hb_cdpStrnToUTF8( cdp, FALSE, ( BYTE * ) szString, ulLen, ( BYTE * ) szDest );
}
}
if( szDest )
hb_retclen_buffer( szDest, ulDest );
else
hb_retc( NULL );
}
HB_FUNC( HB_UTF8TOSTR )
{
ULONG ulLen = hb_parclen( 1 ), ulDest = 0;
char * szString, * szDest = NULL;
if( ulLen )
{
PHB_CODEPAGE cdp = ISCHAR( 2 ) ? hb_cdpFind( hb_parc( 2 ) ) : hb_cdp_page;
if( cdp )
{
szString = hb_parc( 1 );
ulDest = hb_cdpUTF8StringLength( ( BYTE * ) szString, ulLen );
szDest = ( char * ) hb_xgrab( ulDest + 1 );
hb_cdpUTF8ToStrn( cdp, FALSE, ( BYTE * ) szString, ulLen, ( BYTE * ) szDest, ulDest );
}
}
if( szDest )
hb_retclen_buffer( szDest, ulDest );
else
hb_retc( NULL );
}
#endif /* HB_CDP_SUPPORT_OFF */

View File

@@ -234,6 +234,7 @@ static void hb_gt_cgi_WriteCon( BYTE * pText, ULONG ulLength )
{
BYTE * buffer = NULL;
#ifndef HB_CDP_SUPPORT_OFF
if( s_fDispTrans )
{
buffer = ( BYTE * ) hb_xgrab( ulLength );
@@ -241,6 +242,7 @@ static void hb_gt_cgi_WriteCon( BYTE * pText, ULONG ulLength )
hb_cdpnTranslate( ( char * ) buffer, s_cdpHost, s_cdpTerm, ulLength );
pText = buffer;
}
#endif
hb_gt_cgi_termOut( pText, ulLength );
while( ulLength-- )
@@ -360,8 +362,10 @@ static void hb_gt_cgi_Redraw( int iRow, int iCol, int iSize )
}
if( iLen )
{
#ifndef HB_CDP_SUPPORT_OFF
if( s_fDispTrans )
hb_cdpnTranslate( ( char * ) s_sLineBuf, s_cdpHost, s_cdpTerm, iLen );
#endif
hb_gt_cgi_termOut( s_sLineBuf, iLen );
s_iCol = iCol;
if( s_iCol > s_iLastCol )

View File

@@ -1,5 +1,5 @@
/*
* $Id: chrmap.c,v 1.4 2007/05/03 14:11:30 druzus Exp $
* $Id$
*/
/*

View File

@@ -854,8 +854,10 @@ static void hb_gt_pca_Redraw( int iRow, int iCol, int iSize )
iColor = bColor;
else if( iColor != bColor )
{
#ifndef HB_CDP_SUPPORT_OFF
if( s_fDispTrans )
hb_cdpnTranslate( ( char * ) s_sLineBuf, s_cdpHost, s_cdpTerm, iLen );
#endif
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor, s_sLineBuf, iLen );
iCol += iLen;
iLen = 0;
@@ -867,8 +869,10 @@ static void hb_gt_pca_Redraw( int iRow, int iCol, int iSize )
}
if( iLen )
{
#ifndef HB_CDP_SUPPORT_OFF
if( s_fDispTrans )
hb_cdpnTranslate( ( char * ) s_sLineBuf, s_cdpHost, s_cdpTerm, iLen );
#endif
hb_gt_pca_AnsiPutStr( iRow, iCol, iColor, s_sLineBuf, iLen );
}
}

View File

@@ -351,6 +351,7 @@ static void hb_sln_setCharTrans( PHB_CODEPAGE cdpHost, PHB_CODEPAGE cdpTerm, BOO
HB_SYMBOL_UNUSED( cdpHost );
HB_SYMBOL_UNUSED( cdpTerm );
HB_SYMBOL_UNUSED( fBox );
HB_SYMBOL_UNUSED( iSrc );
#endif
/* build a conversion chars table */

View File

@@ -62,10 +62,7 @@
#include "hbapierr.h"
#include "hbapiitm.h"
#include "inkey.ch"
#ifndef HB_CDP_SUPPORT_OFF
#include "hbapicdp.h"
#endif
#if defined(HB_OS_DARWIN) || ( defined(HB_OS_LINUX) && defined(__WATCOMC__) )
#define REAL_UNIX_SYSTEM /* this is for slang.h to include some defs */
@@ -217,6 +214,8 @@ extern BOOL hb_sln_UnderXterm;
extern unsigned char hb_sln_inputTab[ 256 ];
#ifndef HB_CDP_SUPPORT_OFF
extern PHB_CODEPAGE hb_sln_cdpIN;
#else
# define hb_cdp_page NULL
#endif
/* delay for waiting on characters after ESC key */

View File

@@ -610,8 +610,10 @@ static void hb_gt_std_Redraw( int iRow, int iCol, int iSize )
if( iLen )
{
#ifndef HB_CDP_SUPPORT_OFF
if( s_fDispTrans )
hb_cdpnTranslate( ( char * ) s_sLineBuf, s_cdpHost, s_cdpTerm, iLen );
#endif
hb_gt_std_termOut( s_sLineBuf, iLen );
}
s_iRow = iRow;

View File

@@ -1,5 +1,5 @@
#
# $Id: Makefile,v 1.3 2006/02/04 16:16:47 druzus Exp $
# $Id$
#
ROOT = ../../../

View File

@@ -285,10 +285,12 @@ typedef struct
BOOL fPosAnswer;
#ifndef HB_CDP_SUPPORT_OFF
PHB_CODEPAGE cdpHost;
PHB_CODEPAGE cdpOut;
PHB_CODEPAGE cdpIn;
PHB_CODEPAGE cdpEN;
#endif
BOOL fUTF8;
BOOL fDispTrans;
BYTE keyTransTbl[ 256 ];
@@ -669,6 +671,9 @@ static void hb_gt_trm_termOutTrans( BYTE * pStr, int iLen, int iAttr )
{
if( s_termState.iOutBufSize )
{
#ifdef HB_CDP_SUPPORT_OFF
HB_SYMBOL_UNUSED( iAttr );
#else
PHB_CODEPAGE cdp = NULL;
if( s_termState.fUTF8 )
@@ -700,6 +705,7 @@ static void hb_gt_trm_termOutTrans( BYTE * pStr, int iLen, int iAttr )
}
}
else
#endif
{
if( s_termState.fDispTrans )
{
@@ -1381,6 +1387,7 @@ again:
s_termState.key_flag = 0;
}
#ifndef HB_CDP_SUPPORT_OFF
if( nKey > 0 && nKey <= 255 && s_termState.fUTF8 && s_termState.cdpIn )
{
USHORT uc = 0;
@@ -1401,7 +1408,7 @@ again:
}
}
}
#endif
if( nKey > 0 && nKey <= 255 && s_termState.keyTransTbl[nKey] )
nKey = s_termState.keyTransTbl[nKey];
/*
@@ -2604,8 +2611,10 @@ static void hb_gt_trm_SetTerm( void )
hb_gt_chrmapinit( s_termState.charmap, szTerm );
#ifndef HB_CDP_SUPPORT_OFF
s_termState.cdpHost = s_termState.cdpOut = s_termState.cdpIn = NULL;
s_termState.cdpEN = hb_cdpFind( "EN" );
#endif
s_termState.fDispTrans = FALSE;
add_efds( s_termState.hFilenoStdin, O_RDONLY, NULL, NULL );

View File

@@ -1854,10 +1854,12 @@ static void hb_gt_xwc_ProcessKey( PXWND_DEF wnd, XKeyEvent *evt)
}
if( n > 0 )
{
#ifndef HB_CDP_SUPPORT_OFF
if( wnd->inCDP && wnd->hostCDP && wnd->inCDP != wnd->hostCDP )
{
hb_cdpnTranslate( (char *) buf, wnd->inCDP, wnd->hostCDP, n );
}
#endif
#ifdef XWC_DEBUG
buf[n] = '\0';
printf( "keySymISO=%lx keystr=[%s]\r\n", outISO, buf ); fflush(stdout);
@@ -2123,6 +2125,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
if( XGetTextProperty( wnd->dpy, wnd->window, &text,
evt->xselection.property ) != 0 )
{
#ifndef HB_CDP_SUPPORT_OFF
if( evt->xselection.target == s_atomUTF8String && text.format == 8 )
{
#ifdef XWC_DEBUG
@@ -2138,7 +2141,9 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
wnd->ClipboardTime = evt->xselection.time;
wnd->ClipboardRcvd = TRUE;
}
else if( evt->xselection.target == s_atomString && text.format == 8 )
else
#endif
if( evt->xselection.target == s_atomString && text.format == 8 )
{
#ifdef XWC_DEBUG
printf( "String='%s'\r\n", text.value ); fflush(stdout);
@@ -2147,8 +2152,10 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
hb_xfree( wnd->ClipboardData );
wnd->ClipboardData = ( unsigned char * ) hb_xgrab( text.nitems + 1 );
memcpy( wnd->ClipboardData, text.value, text.nitems );
#ifndef HB_CDP_SUPPORT_OFF
if( wnd->inCDP && wnd->hostCDP && wnd->inCDP != wnd->hostCDP )
hb_cdpnTranslate( ( char * ) wnd->ClipboardData, wnd->inCDP, wnd->hostCDP, text.nitems );
#endif
wnd->ClipboardData[ text.nitems ] = '\0';
wnd->ClipboardSize = text.nitems;
wnd->ClipboardTime = evt->xselection.time;
@@ -2214,6 +2221,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
}
else if( req->target == s_atomString )
{
#ifndef HB_CDP_SUPPORT_OFF
if( wnd->inCDP && wnd->hostCDP && wnd->inCDP != wnd->hostCDP )
{
BYTE * pBuffer = ( BYTE * ) hb_xgrab( wnd->ClipboardSize + 1 );
@@ -2225,12 +2233,14 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
hb_xfree( pBuffer );
}
else
#endif
{
XChangeProperty( wnd->dpy, req->requestor, req->property,
s_atomString, 8, PropModeReplace,
wnd->ClipboardData, wnd->ClipboardSize );
}
}
#ifndef HB_CDP_SUPPORT_OFF
else if( req->target == s_atomUTF8String )
{
ULONG ulLen = hb_cdpStringInUTF8Length( wnd->hostCDP, FALSE, wnd->ClipboardData, wnd->ClipboardSize );
@@ -2245,6 +2255,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt )
pBuffer, ulLen );
hb_xfree( pBuffer );
}
#endif
else
{
respond.xselection.property = None;
@@ -2964,7 +2975,9 @@ static PXWND_DEF hb_gt_xwc_CreateWndDef( void )
wnd->fInit = wnd->fData = FALSE;
hb_gt_xwc_SetScrBuff( wnd, XWC_DEFAULT_COLS, XWC_DEFAULT_ROWS );
wnd->fWinResize = FALSE;
#ifndef HB_CDP_SUPPORT_OFF
wnd->hostCDP = hb_cdp_page;
#endif
wnd->cursorType = SC_NORMAL;
/* Window Title */

View File

@@ -68,10 +68,7 @@
#include "hbapierr.h"
#include "inkey.ch"
#include "hbgfxdef.ch"
#ifndef HB_CDP_SUPPORT_OFF
#include "hbapicdp.h"
#endif
#include <unistd.h>
#include <signal.h>

View File

@@ -67,9 +67,12 @@ HB_FUNC( ISALPHA )
{
if( isalpha( ( unsigned char ) * szString ) )
hb_retl( TRUE );
else if( hb_cdp_page->nChars && szString[0] &&
( strchr( hb_cdp_page->CharsUpper,* szString ) || strchr( hb_cdp_page->CharsLower,* szString ) ) )
#ifndef HB_CDP_SUPPORT_OFF
else if( hb_cdp_page->nChars && szString[0] &&
( strchr( hb_cdp_page->CharsUpper,* szString ) ||
strchr( hb_cdp_page->CharsLower,* szString ) ) )
hb_retl( TRUE );
#endif
else
hb_retl( FALSE );
}
@@ -99,8 +102,11 @@ HB_FUNC( ISUPPER )
{
if( isupper( ( unsigned char ) * szString ) )
hb_retl( TRUE );
else if( hb_cdp_page->nChars && szString[0] && strchr( hb_cdp_page->CharsUpper,* szString ) )
#ifndef HB_CDP_SUPPORT_OFF
else if( hb_cdp_page->nChars && szString[0] &&
strchr( hb_cdp_page->CharsUpper, * szString ) )
hb_retl( TRUE );
#endif
else
hb_retl( FALSE );
}
@@ -118,8 +124,11 @@ HB_FUNC( ISLOWER )
{
if( islower( ( unsigned char ) * szString ) )
hb_retl( TRUE );
else if( hb_cdp_page->nChars && szString[0] && strchr( hb_cdp_page->CharsLower,* szString ) )
#ifndef HB_CDP_SUPPORT_OFF
else if( hb_cdp_page->nChars && szString[0] &&
strchr( hb_cdp_page->CharsLower,* szString ) )
hb_retl( TRUE );
#endif
else
hb_retl( FALSE );
}

View File

@@ -64,10 +64,12 @@ char * hb_strLower( char * szText, ULONG ulLen )
HB_TRACE(HB_TR_DEBUG, ("hb_strLower(%s, %lu)", szText, ulLen));
#ifndef HB_CDP_SUPPORT_OFF
if( hb_cdp_page->nChars )
for( i = 0; i < ulLen; i++ )
szText[ i ] = (char) hb_cdp_page->s_lower[szText[i]&255];
else
#endif
for( i = 0; i < ulLen; i++ )
szText[ i ] = tolower( (unsigned char) szText[ i ] );
@@ -81,10 +83,12 @@ char * hb_strUpper( char * szText, ULONG ulLen )
HB_TRACE(HB_TR_DEBUG, ("hb_strUpper(%s, %lu)", szText, ulLen));
#ifndef HB_CDP_SUPPORT_OFF
if( hb_cdp_page->nChars )
for( i = 0; i < ulLen; i++ )
szText[ i ] = (char) hb_cdp_page->s_upper[szText[i]&255];
else
#endif
for( i = 0; i < ulLen; i++ )
szText[ i ] = toupper( (unsigned char) szText[ i ] );
@@ -94,18 +98,22 @@ char * hb_strUpper( char * szText, ULONG ulLen )
/* converts iChar to upper case */
int hb_charUpper( int iChar )
{
#ifndef HB_CDP_SUPPORT_OFF
if( hb_cdp_page->nChars )
return (unsigned char) hb_cdp_page->s_upper[ (unsigned char) iChar ];
else
#endif
return toupper( (unsigned char) iChar );
}
/* converts iChar to lower case */
int hb_charLower( int iChar )
{
#ifndef HB_CDP_SUPPORT_OFF
if( hb_cdp_page->nChars )
return (unsigned char) hb_cdp_page->s_lower[ (unsigned char) iChar ];
else
#endif
return tolower( (unsigned char) iChar );
}

View File

@@ -567,8 +567,9 @@ HB_EXPORT int hb_vmQuit( void )
hb_setRelease(); /* releases Sets */
hb_vmReleaseLocalSymbols(); /* releases the local modules linked list */
hb_dynsymRelease(); /* releases the dynamic symbol table */
#ifndef HB_CDP_SUPPORT_OFF
hb_cdpReleaseAll(); /* releases codepages */
#endif
hb_itemClear( hb_stackReturnItem() );
/* release all known garbage */