TO: Antonio, TGet problem with WinXP Themes for 2 bytes?

Compile trouble

Postby jhncon » Wed Dec 21, 2005 2:20 am

Johnny:

The code i summited was just a direct extract, you need to modify it for your own usage.

Append following C code to your xFWH\..\Tget.prg, for calling lBig5_1st( cString, nPos ) and lBig5_2nd( cString, nPos ) from PRG.

p.s. GB2312-1980 with simpler range : 1st byte range: A1-F7, 2nd byte range: A1-FE


Regards.

JMS


//===========================================================
#pragma BEGINDUMP
//---------------
#include "hbapi.h"
//-----------------------------

// for ChineseBig5 1st(high_order) Chr( 161 - 254 ), 2nd(Low_order) Chr( 64 - 126, 161 - 254 )
BOOL ulBig5_2nd( unsigned char * aStr, int nPos, int nLen )
{
int nn ;
unsigned int nAsc1 ;
unsigned int nAsc2 ;

if( nLen < nPos )
return FALSE ;
else if( nPos == 1 )
return FALSE ;
else if( nPos == 2 )
{
nAsc1 = aStr[0] ;
nAsc2 = aStr[1] ;

if( ( nAsc1 >= 161 && nAsc1 <= 254 ) &&
( ( nAsc2 >= 64 && nAsc2 <= 126 ) || ( nAsc2 >= 161 && nAsc2 <= 254 ) ) )
return TRUE ;
else
return FALSE ;
}
else
{
nAsc1 = aStr[nPos-2] ;
nAsc2 = aStr[nPos-1] ;

if( ( nAsc2 < 64 || ( nAsc2 > 126 && nAsc2 < 161 ) || nAsc2 > 254 ) )
return FALSE ;
else if ( nAsc1 < 161 || nAsc1 > 254 )
return FALSE ;
else
{
for( nn = 1 ; nn < nPos; nn++ )
{
nAsc1 = aStr[nn-1] ;
nAsc2 = aStr[nn] ;

if( nAsc1 >= 161 && nAsc1 <= 254 )
{
if( ( nAsc2 >= 64 && nAsc2 <= 126 ) || ( nAsc2 >= 161 && nAsc2 <= 254 ) )
{
if( nn+1 == nPos )
return TRUE ;
else if( nn < nPos-1 )
nn ++ ;
}
}
};
if( nn >= nPos )
return FALSE ;
}
}
return FALSE ;
}

//-----------------------------------------------

HB_FUNC( LBIG5_1ST ) // lBig5_1st( cString, nPos )
{
unsigned char * aStr = (unsigned char * ) hb_parc( 1 ) ;
int nPos = hb_parni( 2 ) ;
int nLen = hb_parclen( 1 ) ;
unsigned int nAsc1 ;
if( nPos < nLen )
{
nAsc1 = aStr[nPos-1] ;
if( ( nAsc1 >= 161 && nAsc1 <= 254 ) && ulBig5_2nd( aStr, nPos+1, nLen ) )
hb_retl(TRUE);
else
hb_retl(FALSE);
}
else
hb_retl(FALSE);
}

//-----------------------------------------------

HB_FUNC( LBIG5_2ND ) // lBig5_2nd( cString, nPos )
{
hb_retl( ulBig5_2nd( (unsigned char * ) hb_parc( 1 ), hb_parni( 2 ), hb_parclen( 1 ) ) ) ;
}

//----------------------------------------------------------------------------//

//-----------------------------
#pragma ENDDUMP
//===========================================================
John M. S. Chiang
jhncon
 
Posts: 8
Joined: Mon Oct 31, 2005 10:11 am

Re: Compile trouble

Postby Johnny Yiu » Wed Dec 21, 2005 4:04 am

jhncon wrote:Johnny:

The code i summited was just a direct extract, you need to modify it for your own usage.

Append following C code to your xFWH\..\Tget.prg, for calling lBig5_1st( cString, nPos ) and lBig5_2nd( cString, nPos ) from PRG.

p.s. GB2312-1980 with simpler range : 1st byte range: A1-F7, 2nd byte range: A1-FE


Regards.

JMS


John,

I did modify tget.prg using your code the problems was the missing #pragma and #include. I will try again, thanks.

Johnny
Johnny Yiu
 
Posts: 11
Joined: Thu Nov 24, 2005 4:02 am

Postby Taiwan » Thu Dec 22, 2005 9:16 pm

Hello John,

Could you send to me sample file and let me run it?
Because My friend test your code same problem with WinXP themes.

Regards,

Richard
richard.service@seed.net.tw
User avatar
Taiwan
 
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests