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 8445 by doda, Tue Dec 17 12:15:31 2019 UTC revision 8534 by zmatsuo, Sun Feb 9 05:55:29 2020 UTC
# Line 5038  void XsProcClipboard(PCHAR buff) Line 5038  void XsProcClipboard(PCHAR buff)
5038          }          }
5039  }  }
5040    
5041    
5042    // タイトルバーのCP932への変換を行う
5043    // 現在、SJIS、EUCのみに対応。
5044    // (2005.3.13 yutaka)
5045    static void ConvertToCP932(char *str, int destlen)
5046    {
5047    #define IS_SJIS(n) (ts.KanjiCode == IdSJIS && IsDBCSLeadByte(n))
5048    #define IS_EUC(n) (ts.KanjiCode == IdEUC && (n & 0x80))
5049            extern WORD PASCAL JIS2SJIS(WORD KCode);
5050            size_t len = strlen(str);
5051            char *cc = _alloca(len + 1);
5052            char *c = cc;
5053            size_t i;
5054            unsigned char b;
5055            WORD word;
5056    
5057            if (_stricmp(ts.Locale, DEFAULT_LOCALE) == 0) {
5058                    for (i = 0 ; i < len ; i++) {
5059                            b = str[i];
5060                            if (IS_SJIS(b) || IS_EUC(b)) {
5061                                    word = b<<8;
5062    
5063                                    if (i == len - 1) {
5064                                            *c++ = b;
5065                                            continue;
5066                                    }
5067    
5068                                    b = str[i + 1];
5069                                    word |= b;
5070                                    i++;
5071    
5072                                    if (ts.KanjiCode == IdSJIS) {
5073                                            // SJISはそのままCP932として出力する
5074    
5075                                    } else if (ts.KanjiCode == IdEUC) {
5076                                            // EUC -> SJIS
5077                                            word &= ~0x8080;
5078                                            word = JIS2SJIS(word);
5079    
5080                                    } else if (ts.KanjiCode == IdJIS) {
5081    
5082                                    } else if (ts.KanjiCode == IdUTF8) {
5083    
5084                                    } else if (ts.KanjiCode == IdUTF8m) {
5085    
5086                                    } else {
5087    
5088                                    }
5089    
5090                                    *c++ = word >> 8;
5091                                    *c++ = word & 0xff;
5092    
5093                            } else {
5094                                    *c++ = b;
5095                            }
5096                    }
5097    
5098                    *c = '\0';
5099                    strncpy_s(str, destlen, cc, _TRUNCATE);
5100            }
5101    }
5102    
5103  void XSequence(BYTE b)  void XSequence(BYTE b)
5104  {  {
5105          static char *StrBuff = NULL;          static char *StrBuff = NULL;

Legend:
Removed from v.8445  
changed lines
  Added in v.8534

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