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 2487 by doda, Wed Apr 23 15:11:07 2008 UTC revision 2491 by doda, Fri Apr 25 12:32:33 2008 UTC
# Line 435  void PutChar(BYTE b) Line 435  void PutChar(BYTE b)
435    }    }
436  }  }
437    
438    void PutDecSp(BYTE b)
439    {
440      TCharAttr CharAttrTmp;
441    
442      CharAttrTmp = CharAttr;
443    
444      if (PrinterMode) { // printer mode
445        WriteToPrnFile(b, TRUE);
446        return;
447      }
448    
449      if (Wrap) {
450        CarriageReturn(FALSE);
451        LineFeed(LF, FALSE);
452    #ifndef NO_COPYLINE_FIX
453        CharAttrTmp.Attr |= ts.EnableContinuedLineCopy ? AttrLineContinued : 0;
454    #endif /* NO_COPYLINE_FIX */
455      }
456    
457      if (cv.HLogBuf!=0) Log1Byte(b);
458    /*
459      if (ts.LogTypePlainText && __isascii(b) && !isprint(b)) {
460        // ASCII文字で、非表示な文字はログ採取しない。
461      } else {
462        if (cv.HLogBuf!=0) Log1Byte(b);
463      }
464     */
465    
466      Wrap = FALSE;
467    
468      if (!Special) {
469        UpdateStr();
470        Special = TRUE;
471      }
472    
473      CharAttrTmp.Attr |= AttrSpecial;
474      BuffPutChar(b, CharAttrTmp, InsertMode);
475    
476      if (CursorX < NumOfColumns-1)
477        MoveRight();
478      else {
479        UpdateStr();
480        Wrap = AutoWrapMode;
481      }
482    }
483    
484  void PutKanji(BYTE b)  void PutKanji(BYTE b)
485  {  {
# Line 2708  static void ParseASCII(BYTE b) Line 2753  static void ParseASCII(BYTE b)
2753  // UTF-8  // UTF-8
2754  //  //
2755  #include "uni2sjis.map"  #include "uni2sjis.map"
2756    #include "unisym2decsp.map"
2757  extern unsigned short ConvertUnicode(unsigned short code, codemap_t *table, int tmax);  extern unsigned short ConvertUnicode(unsigned short code, codemap_t *table, int tmax);
2758    
2759    
# Line 2767  int GetIndexOfHFSPlusFirstCode(unsigned Line 2813  int GetIndexOfHFSPlusFirstCode(unsigned
2813    
2814  static void UnicodeToCP932(unsigned int code, int byte)  static void UnicodeToCP932(unsigned int code, int byte)
2815  {  {
         static BYTE buf[3];  
2816          int ret;          int ret;
2817          char mbchar[32];          char mbchar[32];
2818          unsigned char wchar[32];          unsigned char wchar[32];
# Line 2783  static void UnicodeToCP932(unsigned int Line 2828  static void UnicodeToCP932(unsigned int
2828          wchar[0] = code & 0xff;          wchar[0] = code & 0xff;
2829          wchar[1] = (code >> 8) & 0xff;          wchar[1] = (code >> 8) & 0xff;
2830    
2831          // Unicode -> CP932          cset = ConvertUnicode(code, mapUnicodeSymbolToDecSp, sizeof(mapUnicodeSymbolToDecSp)/sizeof(mapUnicodeSymbolToDecSp[0]));
2832          ret = wctomb(mbchar, ((wchar_t *)wchar)[0]);          if (cset != 0) {
2833          if (ret != -1) {                  PutDecSp(cset & 0xff);
2834                  if (ret == 1) {          }
2835                          ParseASCII(mbchar[0]);          else {
2836                  } else {                  // Unicode -> CP932
2837                          Kanji = mbchar[0] << 8;                  ret = wctomb(mbchar, ((wchar_t *)wchar)[0]);
2838                          PutKanji(mbchar[1]);                  switch (ret) {
2839                  }                    case -1:
2840          } else {                          if (_stricmp(ts.Locale, DEFAULT_LOCALE) == 0) {
2841                  cset = 0;                                  // U+301Cなどは変換できない。Unicode -> Shift_JISへ変換してみる。
2842                  if (_stricmp(ts.Locale, DEFAULT_LOCALE) == 0) {                                  cset = ConvertUnicode(code, mapUnicodeToSJIS, sizeof(mapUnicodeToSJIS)/sizeof(mapUnicodeToSJIS[0]));
2843                          // U+301Cなどは変換できない。Unicode -> Shift_JISへ変換してみる。                                  if (cset != 0) {
2844                          cset = ConvertUnicode(code, mapUnicodeToSJIS, sizeof(mapUnicodeToSJIS)/sizeof(mapUnicodeToSJIS[0]));                                          Kanji = cset & 0xff00;
2845                          if (cset != 0) {                                          PutKanji(cset & 0x00ff);
2846                                  Kanji = cset & 0xff00;                                  }
                                 PutKanji(cset & 0x00ff);  
2847                          }                          }
                 }  
2848    
2849                  if (cset == 0) {                          if (cset == 0) {
2850                          //for (i = 0 ; i < byte ; i++) {                                  //for (i = 0 ; i < byte ; i++) {
2851                          for (i = 0 ; i < 2 ; i++) {                                  for (i = 0 ; i < 2 ; i++) {
2852                                  buf[i] = '?';                                          ParseASCII('?');
2853                                  ParseASCII(buf[i]);                                  }
2854                          }                          }
2855                            break;
2856                      case 1:
2857                            ParseASCII(mbchar[0]);
2858                            break;
2859                      default:
2860                            Kanji = mbchar[0] << 8;
2861                            PutKanji(mbchar[1]);
2862                            break;
2863                  }                  }
2864          }          }
2865  #endif  #endif

Legend:
Removed from v.2487  
changed lines
  Added in v.2491

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