| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | #include "DHL_OSAL.h" |
|---|
| 5 | #include "DHL_DBG.h" |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | #define USE_INNER_KSX_TO_UNICODE_TABLE 1 |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | #if USE_INNER_KSX_TO_UNICODE_TABLE |
|---|
| 12 | #include "grp_ksx_unicode_table.h" |
|---|
| 13 | #else |
|---|
| 14 | //extern UINT16 DST_cktouk[]; |
|---|
| 15 | extern UINT16 p_ck2uk_table[]; |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | int DMG_UStrLen(UINT16 *str) |
|---|
| 20 | { |
|---|
| 21 | int i; |
|---|
| 22 | |
|---|
| 23 | for(i=0; str[i]; i++); |
|---|
| 24 | |
|---|
| 25 | return i; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | BOOL DMG_UStrCmp(UINT16 *str1, UINT16 *str2) |
|---|
| 29 | { |
|---|
| 30 | int i; |
|---|
| 31 | |
|---|
| 32 | for(i=0; str1[i] || str2[i]; i++) { |
|---|
| 33 | if(str1[i]!=str2[i]) return FALSE; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | return TRUE; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | void DMG_UStrCpy(UINT16 *str_dst, UINT16 *str_src) |
|---|
| 40 | { |
|---|
| 41 | int i; |
|---|
| 42 | |
|---|
| 43 | for(i=0; str_src[i]; i++) str_dst[i]=str_src[i]; |
|---|
| 44 | str_dst[i]='\0'; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | void DMG_UStrNCpy(UINT16 *str_dst, UINT16 *str_src, int len) |
|---|
| 48 | { |
|---|
| 49 | int i; |
|---|
| 50 | |
|---|
| 51 | for(i=0; str_src[i] && i<len-1; i++) str_dst[i]=str_src[i]; |
|---|
| 52 | str_dst[i]='\0'; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | void DMG_UStrCat(UINT16 *str_dst, UINT16 *str_src) |
|---|
| 56 | { |
|---|
| 57 | int i; |
|---|
| 58 | int len_str1=DMG_UStrLen(str_dst); |
|---|
| 59 | |
|---|
| 60 | DMG_UStrCpy(str_dst+len_str1, str_src); |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | UINT16 DMG_Ksx1001toUnicode(UINT16 code) |
|---|
| 65 | { |
|---|
| 66 | UINT16 ret_code; |
|---|
| 67 | |
|---|
| 68 | code |= 0x8080; |
|---|
| 69 | |
|---|
| 70 | if(code>=0xb0a1 && code<=0xc8fe) { |
|---|
| 71 | code-=45217; |
|---|
| 72 | code=code/256*94 + code%256; |
|---|
| 73 | ret_code=p_ck2uk_table[code]; |
|---|
| 74 | } |
|---|
| 75 | else if(code==0xa1a1) //space |
|---|
| 76 | ret_code=0x20; |
|---|
| 77 | else if(code==0xa3dc) //back slash -> won |
|---|
| 78 | ret_code=0x20a9; |
|---|
| 79 | else if(code>=0xa3a1 && code<=0xa3fe) |
|---|
| 80 | ret_code=code-0xa380; |
|---|
| 81 | else if(code==0xa2a6) |
|---|
| 82 | ret_code=0x7e; |
|---|
| 83 | else |
|---|
| 84 | ret_code=0x20;//Áö¿øÇÏÁö ¾Ê´Â ÄÚµå´Â °ø¹é ó¸®//ret_code=0x25af; //Áö¿øÇÏÁö ¾Ê´Â codeÀÎ °æ¿ì ¼¼¿î Á÷»ç°¢Çü |
|---|
| 85 | |
|---|
| 86 | return ret_code; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | UINT16 *DMG_MakeUniStr(char *str1, UINT16 *str2) |
|---|
| 91 | { |
|---|
| 92 | int i; |
|---|
| 93 | |
|---|
| 94 | for(i=0; str1[i]; i++) str2[i]=str1[i]; |
|---|
| 95 | str2[i]='\0'; |
|---|
| 96 | |
|---|
| 97 | return str2; |
|---|
| 98 | } |
|---|
| 99 | |
|---|
| 100 | UINT16 *DMG_MakeUniStr2(char *str) |
|---|
| 101 | { |
|---|
| 102 | static UINT16 uni_str[128]; |
|---|
| 103 | int i; |
|---|
| 104 | |
|---|
| 105 | for(i=0; str[i] && i<128-1; i++) uni_str[i]=str[i]; |
|---|
| 106 | uni_str[i]='\0'; |
|---|
| 107 | |
|---|
| 108 | return uni_str; |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|