2012-10-01 19:39 UTC+0200 Viktor Szakats (harbour syenar.net)

* src/rtl/Makefile
  - src/rtl/cdpbox.prg
  + src/rtl/cdpbox.c
    % HB_UTF8TOSTRBOX() converted to C
This commit is contained in:
Viktor Szakats
2012-10-01 17:40:56 +00:00
parent e22c282824
commit 105cdb0721
3 changed files with 52 additions and 5 deletions

View File

@@ -16,6 +16,12 @@
The license applies to all entries newer than 2009-04-28.
*/
2012-10-01 19:39 UTC+0200 Viktor Szakats (harbour syenar.net)
* src/rtl/Makefile
- src/rtl/cdpbox.prg
+ src/rtl/cdpbox.c
% HB_UTF8TOSTRBOX() converted to C
2012-10-01 19:30 UTC+0200 Viktor Szakats (harbour syenar.net)
* src/rtl/cdpbox.prg
% use HB_UTF8TOSTR() instead of HB_TRANSLATE()

View File

@@ -25,6 +25,7 @@ C_SOURCES := \
box.c \
cdpapi.c \
cdpapihb.c \
cdpbox.c \
cdpdetc.c \
chrasc.c \
chruni.c \
@@ -218,7 +219,6 @@ PRG_SOURCES := \
altd.prg \
browdb.prg \
browse.prg \
cdpbox.prg \
cdpdet.prg \
checkbox.prg \
color53.prg \

View File

@@ -4,8 +4,9 @@
/*
* Harbour Project source code:
* Internal support for CP agnostic box drawing chars
* HB_UTF8TOSTRBOX()
*
* Copyright 2009-2012 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* Copyright 2012 Viktor Szakats (harbour syenar.net)
* www - http://harbour-project.org
*
@@ -50,7 +51,47 @@
*
*/
#include "hbgtinfo.ch"
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#include "hbapicdp.h"
#include "hbapigt.h"
FUNCTION hb_UTF8ToStrBox( cString )
RETURN hb_UTF8ToStr( cString, hb_gtInfo( HB_GTI_BOXCP ) )
HB_FUNC( HB_UTF8TOSTRBOX )
{
const char * szString = hb_parc( 1 );
if( szString )
{
HB_SIZE nLen = hb_parclen( 1 ), nDest = 0;
char * szDest = NULL;
if( nLen )
{
PHB_CODEPAGE cdp = hb_gtBoxCP();
if( cdp )
{
if( hb_cdpIsUTF8( cdp ) )
{
hb_itemReturn( hb_param( 1, HB_IT_STRING ) );
return;
}
else
{
szString = hb_parc( 1 );
nDest = hb_cdpUTF8AsStrLen( cdp, szString, nLen, 0 );
szDest = ( char * ) hb_xgrab( nDest + 1 );
hb_cdpUTF8ToStr( cdp, szString, nLen, szDest, nDest + 1 );
}
}
}
if( szDest )
hb_retclen_buffer( szDest, nDest );
else
hb_retc_null();
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}