static BOOL In(int Lp, int Hp,int Value)
{
ASSERT(Lp<=Hp);
return ( ( Value <= Hp )&&( Value >= Lp ) );
}
static char GetPYChar( WORD wHZ )
{
if (In(0xB0A1,0xB0C4,wHZ)) return 'A';
if (In(0XB0C5,0XB2C0,wHZ)) return 'B';
if (In(0xB2C1,0xB4ED,wHZ)) return 'C';
if (In(0xB4EE,0xB6E9,wHZ)) return 'D';
if (In(0xB6EA,0xB7A1,wHZ)) return 'E';
if (In(0xB7A2,0xB8c0,wHZ)) return 'F';
if (In(0xB8C1,0xB9FD,wHZ)) return 'G';
if (In(0xB9FE,0xBBF6,wHZ)) return 'H';
if (In(0xBBF7,0xBFA5,wHZ)) return 'J';
if (In(0xBFA6,0xC0AB,wHZ)) return 'K';
if (In(0xC0AC,0xC2E7,wHZ)) return 'L';
if (In(0xC2E8,0xC4C2,wHZ)) return 'M';
if (In(0xC4C3,0xC5B5,wHZ)) return 'N';
if (In(0xC5B6,0xC5BD,wHZ)) return 'O';
if (In(0xC5BE,0xC6D9,wHZ)) return 'P';
if (In(0xC6DA,0xC8BA,wHZ)) return 'Q';
if (In(0xC8BB,0xC8F5,wHZ)) return 'R';
if (In(0xC8F6,0xCBF0,wHZ)) return 'S';
if (In(0xCBFA,0xCDD9,wHZ)) return 'T';
if (In(0xCDDA,0xCEF3,wHZ)) return 'W';
if (In(0xCEF4,0xD188,wHZ)) return 'X';
if (In(0xD1B9,0xD4D0,wHZ)) return 'Y';
if (In(0xD4D1,0xD7F9,wHZ)) return 'Z';
return char(0);
}
CString GetPYString( CString& strHZ )
{
char szRet[256];
CString strRet;
strHZ.Trim(' ');
const char *pSrc = strHZ.GetBuffer();
int nLen = strHZ.GetLength();
WORD wHZ, wHzHi, wHzLo;
int nCnt = 1, nRet = 0;
memset( szRet, 0, sizeof(szRet) );
for ( int nIdx = 0; nIdx <= nLen; nIdx++ )
{
BYTE BPrint = *((BYTE*)pSrc+nIdx);
if ( (BPrint+1)<256 && isprint((int)BPrint) )
{
szRet[nRet++] = BPrint;
nCnt = 1;
}
else
{
if( nCnt == 1 )
{
wHzHi = WORD(BPrint)<<8;
nCnt = 2;
}
else if( nCnt == 2 )
{
wHzLo = BYTE(BPrint);
wHZ = wHzHi + wHzLo;
char cPy = GetPYChar(wHZ);
szRet[nRet++] = cPy;
wHZ = wHzHi = wHzLo = 0;
nCnt = 1;
}
}
}
strRet.Format( "%s", szRet );
return strRet;
}