📄 cntrn.cpp
字号:
// CNTRN.cpp : Defines the entry point for the DLL application.
//#define CNTRN_EXPORTS
#include "CNTRN.h"
#include "GBK.h"
BOOL GetHZJianPinCode(const char *pszHZ,
char & szCode,
BOOL bLower,
int nCodeSet)
{
switch(nCodeSet)
{
case 0:
break;
case 1:
break;
default:
break;
}
return GetGBKJianPinCode(pszHZ, szCode, bLower);
};
int CNTRN_API GetHZJianPinCode(LPCSTR lpSource,
int nSourceLen,
LPSTR lpDist,
int &nDistLen,
BOOL bLower,
int nCodeSet)
{
// int nSzLen = strlen(lpSource);
if (lpSource == NULL || lpDist == NULL)
return -1;
memset(lpDist, 0, nDistLen);
int nObjectIndex = 0;
for (int i = 0; i < nSourceLen; )
{
if (lpSource[i] < 0)
{
if(GetHZJianPinCode(&(lpSource[i]), lpDist[nObjectIndex], bLower, nCodeSet))
nObjectIndex++;
i += 2;
}
else
{
lpDist[nObjectIndex] = lpSource[i];
if (bLower && lpDist[nObjectIndex] >= 0x41 && lpDist[nObjectIndex] <= 0x5a)
{
lpDist[nObjectIndex] += 0x20; //MakeLower
}
nObjectIndex++;
i ++;
}
}
nDistLen = nObjectIndex;
return nDistLen;
}
int CNTRN_API QJ2BJ(LPCSTR lpSource/*in*/,
int nSourceLen/*in*/,
LPSTR lpDist/*out*/,
int &nDistLen/*out*/
)
{
if (lpSource == NULL || lpDist == NULL)
return -1;
memset(lpDist, 0, nDistLen);
int nDistIndex = 0;
for (int i = 0; i < nSourceLen; )
{
if (unsigned char(lpSource[i]) == 163) //全角字符
{
lpDist[nDistIndex] = (char)(lpSource[i+1] - 128);
i += 2;
nDistIndex++;
}
else if ((unsigned char(lpSource[i]) == 161) &&
(unsigned char(lpSource[i+1]) == 161)) //全角空格
{
lpDist[nDistIndex] = ' ';
i += 2;
nDistIndex++;
}
else if (lpSource[i] < 0) //中文
{
lpDist[nDistIndex] = lpSource[i];
nDistIndex++;
i ++;
lpDist[nDistIndex] = lpSource[i];
nDistIndex++;
i ++;
}
else
{
lpDist[nDistIndex] = lpSource[i];
nDistIndex++;
i ++;
}
}
return nDistLen;
}
// い地
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -