Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/teraterm/vtterm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8743 by zmatsuo, Sun Apr 26 14:34:30 2020 UTC revision 8745 by zmatsuo, Sun Apr 26 14:34:49 2020 UTC
# Line 64  Line 64 
64    
65  void ParseFirst(BYTE b);  void ParseFirst(BYTE b);
66    
 #define MAPSIZE(x) (sizeof(x)/sizeof((x)[0]))  
67  #define Accept8BitCtrl ((VTlevel >= 2) && (ts.TermFlag & TF_ACCEPT8BITCTRL))  #define Accept8BitCtrl ((VTlevel >= 2) && (ts.TermFlag & TF_ACCEPT8BITCTRL))
68    
69    /* Parsing modes */    /* Parsing modes */
# Line 5712  static void ParseASCII(BYTE b) Line 5711  static void ParseASCII(BYTE b)
5711          }          }
5712  }  }
5713    
 //  
 // Unicode Combining Character Support  
 //  
 #include "uni_combining.map"  
   
 static unsigned short GetPrecomposedChar(int start_index, unsigned short first_code, unsigned short code,  
                                                                                  const combining_map_t *table, int tmax)  
 {  
         unsigned short result = 0;  
         int i;  
   
         for (i = start_index ; i < tmax ; i++) {  
                 if (table[i].first_code != first_code) { // 1文字目が異なるなら、以降はもう調べなくてよい。  
                         break;  
                 }  
   
                 if (table[i].second_code == code) {  
                         result = table[i].precomposed;  
                         break;  
                 }  
         }  
   
         return (result);  
 }  
   
 static int GetIndexOfCombiningFirstCode(unsigned short code, const combining_map_t *table, int tmax)  
 {  
         int low, mid, high;  
         int index = -1;  
   
         low = 0;  
         high = tmax - 1;  
   
         // binary search  
         while (low < high) {  
                 mid = (low + high) / 2;  
                 if (table[mid].first_code < code) {  
                         low = mid + 1;  
                 } else {  
                         high = mid;  
                 }  
         }  
   
         if (table[low].first_code == code) {  
                 while (low >= 0 && table[low].first_code == code) {  
                         index = low;  
                         low--;  
                 }  
         }  
   
         return (index);  
 }  
   
5714  // unicode(UTF-32,wchar_t)をバッファへ書き込む  // unicode(UTF-32,wchar_t)をバッファへ書き込む
5715  // TODO @@  // TODO @@
5716  #if UNICODE_INTERNAL_BUFF  #if UNICODE_INTERNAL_BUFF
# Line 6067  static BOOL ParseFirstUTF8(BYTE b, int p Line 6013  static BOOL ParseFirstUTF8(BYTE b, int p
6013    
6014                  if (proc_combining == 1) {                  if (proc_combining == 1) {
6015                          if (can_combining == 0) {                          if (can_combining == 0) {
6016                                  if ((first_code_index = GetIndexOfCombiningFirstCode(                                  first_code_index = UnicodeGetIndexOfCombiningFirstCode(code);
6017                                                  code, mapCombiningToPrecomposed, MAPSIZE(mapCombiningToPrecomposed)                                  if (first_code_index != -1) {
                                                 )) != -1) {  
6018                                          can_combining = 1;                                          can_combining = 1;
6019                                          first_code = code;                                          first_code = code;
6020                                          count = 0;                                          count = 0;
# Line 6077  static BOOL ParseFirstUTF8(BYTE b, int p Line 6022  static BOOL ParseFirstUTF8(BYTE b, int p
6022                                  }                                  }
6023                          } else {                          } else {
6024                                  can_combining = 0;                                  can_combining = 0;
6025                                  cset = GetPrecomposedChar(first_code_index, first_code, code, mapCombiningToPrecomposed, MAPSIZE(mapCombiningToPrecomposed));                                  cset = UnicodeGetPrecomposedChar(first_code_index, first_code, code);
6026                                  if (cset != 0) { // success                                  if (cset != 0) { // success
6027                                          code = cset;                                          code = cset;
6028    
6029                                  } else { // error                                  } else { // error
6030                                          // 2つめの文字が半濁点の1文字目に相当する場合は、再度検索を続ける。(2005.10.15 yutaka)                                          // 2つめの文字が半濁点の1文字目に相当する場合は、再度検索を続ける。(2005.10.15 yutaka)
6031                                          if ((first_code_index = GetIndexOfCombiningFirstCode(                                          first_code_index = UnicodeGetIndexOfCombiningFirstCode(code);
6032                                                          code, mapCombiningToPrecomposed, MAPSIZE(mapCombiningToPrecomposed)                                          if (first_code_index != -1) {
                                                         )) != -1) {  
   
6033                                                  // 1つめの文字はそのまま出力する                                                  // 1つめの文字はそのまま出力する
6034                                                  UnicodeToCP932(first_code);                                                  UnicodeToCP932(first_code);
6035    

Legend:
Removed from v.8743  
changed lines
  Added in v.8745

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26