FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TO: Antonio, TGet problem with WinXP Themes for 2 bytes?
Posts: 8
Joined: Mon Oct 31, 2005 10:11 AM
Compile trouble
Posted: Wed Dec 21, 2005 02: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 &gt;= 161 &amp;&amp; nAsc1 &lt;= 254 ) &amp;&amp;
      ( ( nAsc2 &gt;= 64 &amp;&amp; nAsc2 &lt;= 126 ) || ( nAsc2 &gt;= 161 &amp;&amp; nAsc2 &lt;= 254 ) ) )
     return TRUE ;
  else
     return FALSE ;

}
else
{
nAsc1 = aStr[nPos-2] ;
nAsc2 = aStr[nPos-1] ;

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

        if( nAsc1 &gt;= 161 &amp;&amp; nAsc1 &lt;= 254 )
        {
           if( ( nAsc2 &gt;= 64 &amp;&amp; nAsc2 &lt;= 126 ) || ( nAsc2 &gt;= 161 &amp;&amp; nAsc2 &lt;= 254 ) )
           {
              if( nn+1 == nPos )
                 return TRUE ;
              else if( nn &lt; nPos-1 )
                 nn ++  ;
           }
        }
     };
     if( nn &gt;= 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
Posts: 11
Joined: Thu Nov 24, 2005 04:02 AM
Re: Compile trouble
Posted: Wed Dec 21, 2005 04: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
Posts: 218
Joined: Fri Oct 07, 2005 01:55 AM
TO: Antonio, TGet problem with WinXP Themes for 2 bytes?
Posted: Thu Dec 22, 2005 09: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

Continue the discussion