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 3407 by doda, Mon May 18 05:45:05 2009 UTC revision 3416 by doda, Wed May 20 13:38:32 2009 UTC
# Line 2784  BOOL CheckKanji(BYTE b) Line 2784  BOOL CheckKanji(BYTE b)
2784    return Check;    return Check;
2785  }  }
2786    
2787    BOOL CheckKorean(BYTE b)
2788    {
2789            BOOL Check;
2790            if (ts.Language!=IdKorean)
2791                    return FALSE;
2792    
2793            if (ts.KanjiCode == IdSJIS) {
2794                    if ((0xA1<=b) && (b<=0xFE)) {
2795                            Check = TRUE;
2796                    }
2797                    else {
2798                            Check = FALSE;
2799                    }
2800            }
2801    
2802            return Check;
2803    }
2804    
2805  BOOL ParseFirstJP(BYTE b)  BOOL ParseFirstJP(BYTE b)
2806  // returns TRUE if b is processed  // returns TRUE if b is processed
2807  //  (actually allways returns TRUE)  //  (actually allways returns TRUE)
2808  {  {
2809    if (KanjiIn)          if (KanjiIn) {
2810    {                  if ((! ConvJIS) && (0x3F<b) && (b<0xFD) ||
2811      if ((! ConvJIS) && (0x3F<b) && (b<0xFD) ||                        ConvJIS && ( (0x20<b) && (b<0x7f) ||
2812          ConvJIS && ( (0x20<b) && (b<0x7f) ||                                     (0xa0<b) && (b<0xff) ))
2813                       (0xa0<b) && (b<0xff) ))                  {
2814      {                          PutKanji(b);
2815        PutKanji(b);                          KanjiIn = FALSE;
2816        KanjiIn = FALSE;                          return TRUE;
2817        return TRUE;                  }
2818      }                  else if ((ts.TermFlag & TF_CTRLINKANJI)==0) {
2819      else if ((ts.TermFlag & TF_CTRLINKANJI)==0)                          KanjiIn = FALSE;
2820        KanjiIn = FALSE;                  }
2821      else if ((b==CR) && Wrap) {                  else if ((b==CR) && Wrap) {
2822        CarriageReturn(FALSE);                          CarriageReturn(FALSE);
2823        LineFeed(LF,FALSE);                          LineFeed(LF,FALSE);
2824        Wrap = FALSE;                          Wrap = FALSE;
2825      }                  }
2826    }          }
2827    
2828    if (SSflag)          if (SSflag) {
2829    {                  if (Gn[GLtmp] == IdKanji) {
2830      if (Gn[GLtmp] == IdKanji)                          Kanji = b << 8;
2831      {                          KanjiIn = TRUE;
2832        Kanji = b << 8;                          SSflag = FALSE;
2833        KanjiIn = TRUE;                          return TRUE;
2834        SSflag = FALSE;                  }
2835        return TRUE;                  else if (Gn[GLtmp] == IdKatakana) {
2836      }                          b = b | 0x80;
2837      else if (Gn[GLtmp] == IdKatakana) b = b | 0x80;                  }
2838    
2839      PutChar(b);                  PutChar(b);
2840      SSflag = FALSE;                  SSflag = FALSE;
2841      return TRUE;                  return TRUE;
2842    }          }
2843    
2844    if ((! EUCsupIn) && (! EUCkanaIn) &&          if ((!EUCsupIn) && (!EUCkanaIn) && (!KanjiIn) && CheckKanji(b)) {
2845        (! KanjiIn) && CheckKanji(b))                  Kanji = b << 8;
2846    {                  KanjiIn = TRUE;
2847      Kanji = b << 8;                  return TRUE;
2848      KanjiIn = TRUE;          }
     return TRUE;  
   }  
2849    
2850    if (b<=US)          if (b<=US) {
2851      ParseControl(b);                  ParseControl(b);
2852    else if (b==0x20)          }
2853      PutChar(b);          else if (b==0x20) {
2854    else if ((b>=0x21) && (b<=0x7E))                  PutChar(b);
2855    {          }
2856      if (EUCsupIn)          else if ((b>=0x21) && (b<=0x7E)) {
2857      {                  if (EUCsupIn) {
2858        EUCcount--;                          EUCcount--;
2859        EUCsupIn = (EUCcount==0);                          EUCsupIn = (EUCcount==0);
2860        return TRUE;                          return TRUE;
2861      }                  }
2862    
2863      if ((Gn[Glr[0]] == IdKatakana) || EUCkanaIn)                  if ((Gn[Glr[0]] == IdKatakana) || EUCkanaIn) {
2864      {                          b = b | 0x80;
2865        b = b | 0x80;                          EUCkanaIn = FALSE;
2866        EUCkanaIn = FALSE;                  }
2867      }                  PutChar(b);
2868      PutChar(b);          }
2869    }          else if (b==0x7f) {
2870    else if (b==0x7f)                  return TRUE;
2871      return TRUE;          }
2872    else if ((b>=0x80) && (b<=0x8D))          else if ((b>=0x80) && (b<=0x8D)) {
2873      ParseControl(b);                  ParseControl(b);
2874    else if (b==0x8E)          }
2875    {          else if (b==0x8E) { // SS2
2876      if (ts.KanjiCode==IdEUC)                  if (ts.KanjiCode==IdEUC) {
2877        EUCkanaIn = TRUE;                          EUCkanaIn = TRUE;
2878      else                  }
2879        ParseControl(b);                  else {
2880    }                          ParseControl(b);
2881    else if (b==0x8F)                  }
2882    {          }
2883      if (ts.KanjiCode==IdEUC)          else if (b==0x8F) { // SS3
2884      {                  if (ts.KanjiCode==IdEUC) {
2885        EUCcount = 2;                          EUCcount = 2;
2886        EUCsupIn = TRUE;                          EUCsupIn = TRUE;
2887      } else                  }
2888        ParseControl(b);                  else {
2889    }                          ParseControl(b);
2890    else if ((b>=0x90) && (b<=0x9F))                  }
2891      ParseControl(b);          }
2892    else if (b==0xA0)          else if ((b>=0x90) && (b<=0x9F)) {
2893      PutChar(0x20);                  ParseControl(b);
2894    else if ((b>=0xA1) && (b<=0xFE))          }
2895    {          else if (b==0xA0) {
2896      if (EUCsupIn)                  PutChar(0x20);
2897      {          }
2898        EUCcount--;          else if ((b>=0xA1) && (b<=0xFE)) {
2899        EUCsupIn = (EUCcount==0);                  if (EUCsupIn) {
2900        return TRUE;                          EUCcount--;
2901      }                          EUCsupIn = (EUCcount==0);
2902                            return TRUE;
2903      if ((Gn[Glr[1]] != IdASCII) ||                  }
         (ts.KanjiCode==IdEUC) && EUCkanaIn ||  
         (ts.KanjiCode==IdSJIS) ||  
         (ts.KanjiCode==IdJIS) &&  
         (ts.JIS7Katakana==0) &&  
         ((ts.TermFlag & TF_FIXEDJIS)!=0))  
       PutChar(b);  // katakana  
     else {  
       if (Gn[Glr[1]] == IdASCII)  
         b = b & 0x7f;  
       PutChar(b);  
     }  
     EUCkanaIn = FALSE;  
   }  
   else  
     PutChar(b);  
2904    
2905    return TRUE;                  if ((Gn[Glr[1]] != IdASCII) ||
2906                        (ts.KanjiCode==IdEUC) && EUCkanaIn ||
2907                        (ts.KanjiCode==IdSJIS) ||
2908                        (ts.KanjiCode==IdJIS) &&
2909                        (ts.JIS7Katakana==0) &&
2910                        ((ts.TermFlag & TF_FIXEDJIS)!=0))
2911                            PutChar(b);     // katakana
2912                    else {
2913                            if (Gn[Glr[1]] == IdASCII) {
2914                                    b = b & 0x7f;
2915                            }
2916                            PutChar(b);
2917                    }
2918                    EUCkanaIn = FALSE;
2919            }
2920            else {
2921                    PutChar(b);
2922            }
2923    
2924            return TRUE;
2925    }
2926    
2927    BOOL ParseFirstKR(BYTE b)
2928    // returns TRUE if b is processed
2929    //  (actually allways returns TRUE)
2930    {
2931            if (KanjiIn) {
2932                    if ((0x41<=b) && (b<=0x5A) ||
2933                        (0x61<=b) && (b<=0x7A) ||
2934                        (0x81<=b) && (b<=0xFE))
2935                    {
2936                            PutKanji(b);
2937                            KanjiIn = FALSE;
2938                            return TRUE;
2939                    }
2940                    else if ((ts.TermFlag & TF_CTRLINKANJI)==0) {
2941                            KanjiIn = FALSE;
2942                    }
2943                    else if ((b==CR) && Wrap) {
2944                            CarriageReturn(FALSE);
2945                            LineFeed(LF,FALSE);
2946                            Wrap = FALSE;
2947                    }
2948            }
2949    
2950            if ((!KanjiIn) && CheckKorean(b)) {
2951                    Kanji = b << 8;
2952                    KanjiIn = TRUE;
2953                    return TRUE;
2954            }
2955    
2956            if (b<=US) {
2957                    ParseControl(b);
2958            }
2959            else if (b==0x20) {
2960                    PutChar(b);
2961            }
2962            else if ((b>=0x21) && (b<=0x7E)) {
2963    //              if (Gn[Glr[0]] == IdKatakana) {
2964    //                      b = b | 0x80;
2965    //              }
2966                    PutChar(b);
2967            }
2968            else if (b==0x7f) {
2969                    return TRUE;
2970            }
2971            else if ((0x80<=b) && (b<=0x9F)) {
2972                    ParseControl(b);
2973            }
2974            else if (b==0xA0) {
2975                    PutChar(0x20);
2976            }
2977            else if ((b>=0xA1) && (b<=0xFE)) {
2978                    if (Gn[Glr[1]] == IdASCII) {
2979                            b = b & 0x7f;
2980                    }
2981                    PutChar(b);
2982            }
2983            else {
2984                    PutChar(b);
2985            }
2986    
2987            return TRUE;
2988  }  }
2989    
2990    
# Line 3206  void ParseFirst(BYTE b) Line 3289  void ParseFirst(BYTE b)
3289                  return;                  return;
3290    
3291            case IdJapanese:            case IdJapanese:
           case IdKorean:  
3292                  switch (ts.KanjiCode) {                  switch (ts.KanjiCode) {
3293                    case IdUTF8:                    case IdUTF8:
3294                          if (ParseFirstUTF8(b, 0)) {                          if (ParseFirstUTF8(b, 0)) {
# Line 3225  void ParseFirst(BYTE b) Line 3307  void ParseFirst(BYTE b)
3307                  }                  }
3308                  break;                  break;
3309    
3310              case IdKorean:
3311                    switch (ts.KanjiCode) {
3312                      case IdUTF8:
3313                            if (ParseFirstUTF8(b, 0)) {
3314                                    return;
3315                            }
3316                            break;
3317                      case IdUTF8m:
3318                            if (ParseFirstUTF8(b, 1)) {
3319                                    return;
3320                            }
3321                            break;
3322                      default:
3323                            if (ParseFirstKR(b))  {
3324                                    return;
3325                            }
3326                    }
3327                    break;
3328    
3329    
3330            case IdRussian:            case IdRussian:
3331                  if (ParseFirstRus(b)) {                  if (ParseFirstRus(b)) {
3332                          return;                          return;

Legend:
Removed from v.3407  
changed lines
  Added in v.3416

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