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 9104 by zmatsuo, Sun Dec 20 12:16:27 2020 UTC revision 9115 by zmatsuo, Mon Dec 28 14:29:48 2020 UTC
# Line 191  static BOOL PrintEX = TRUE; // printing Line 191  static BOOL PrintEX = TRUE; // printing
191  static BOOL AutoPrintMode = FALSE;  static BOOL AutoPrintMode = FALSE;
192  static BOOL PrinterMode = FALSE;  static BOOL PrinterMode = FALSE;
193  static BOOL DirectPrn = FALSE;  static BOOL DirectPrn = FALSE;
194    PrintFile *PrintFile_;
195    
196  /* User key */  /* User key */
197  static BYTE NewKeyStr[FuncKeyStrMax];  static BYTE NewKeyStr[FuncKeyStrMax];
# Line 491  static void OutputLogNewLine(vtterm_work Line 492  static void OutputLogNewLine(vtterm_work
492    
493  /**  /**
494   *      1キャラクタ(unsigned int, char32_t)をログ(or/and macro送信バッファ)へ出力   *      1キャラクタ(unsigned int, char32_t)をログ(or/and macro送信バッファ)へ出力
495     *              出力先
496     *                      ログファイル
497     *                      macro送信バッファ(DDEPut1())
498     *                      プリント用
499   */   */
500  static void OutputLogUTF32(unsigned int u32)  static void OutputLogUTF32(unsigned int u32)
501  {  {
502          vtterm_work_t *vtterm;          vtterm_work_t *vtterm;
503          CheckEOLRet r;          CheckEOLRet r;
504    
505          if (!FLogIsOpendText() && !DDELog) {          if (!FLogIsOpendText() && !DDELog && !PrinterMode) {
506                  return;                  return;
507          }          }
508          vtterm = &vtterm_work;          vtterm = &vtterm_work;
509          r = CheckEOLCheck(vtterm->check_eol, u32);          r = CheckEOLCheck(vtterm->check_eol, u32);
510          if ((r & CheckEOLOutputEOL) != 0) {  
511                  // ログ、改行を出力          // ログ
512                  if (FLogIsOpendText()) {          if (FLogIsOpendText()) {
513                    if ((r & CheckEOLOutputEOL) != 0) {
514                            // 改行を出力
515                          OutputLogNewLine(vtterm);                          OutputLogNewLine(vtterm);
516                  }                  }
517    
518                  // マクロ、改行を出力                  if ((r & CheckEOLOutputChar) != 0) {
519                  if (DDELog) {                          // u32を出力
520                            FLogPutUTF32(u32);
521                    }
522            }
523    
524            // マクロ出力
525            if (DDELog) {
526                    if ((r & CheckEOLOutputEOL) != 0) {
527                            // 改行を出力
528                          DDEPut1(CR);                          DDEPut1(CR);
529                          DDEPut1(LF);                          DDEPut1(LF);
530                  }                  }
531    
532                    // u32を出力
533                    if ((r & CheckEOLOutputChar) != 0) {
534                            DDEPut1U32(u32);
535                    }
536          }          }
537          if ((r & CheckEOLOutputChar) != 0) {  
538                  // ログ、u32を出力          // プリント
539                  if (FLogIsOpendText()) {          if (PrinterMode) {
540                          FLogPutUTF32(u32);                  if ((r & CheckEOLOutputEOL) != 0) {
541                            // 改行を出力
542                            WriteToPrnFile(PrintFile_, CR,TRUE);
543                            WriteToPrnFile(PrintFile_, LF,TRUE);
544                  }                  }
545    
546                  // マクロ、u32を出力                  // u32を出力
547                  if (DDELog) {                  if ((r & CheckEOLOutputChar) != 0) {
548                          DDEPut1U32(u32);                          WriteToPrnFileUTF32(PrintFile_, u32, TRUE);
549                  }                  }
550          }          }
551  }  }
# Line 689  static void LineFeed(BYTE b, BOOL logFla Line 712  static void LineFeed(BYTE b, BOOL logFla
712          /* for auto print mode */          /* for auto print mode */
713          if ((AutoPrintMode) &&          if ((AutoPrintMode) &&
714                  (b>=LF) && (b<=FF))                  (b>=LF) && (b<=FF))
715                  BuffDumpCurrentLine(b);                  BuffDumpCurrentLine(PrintFile_, b);
716    
717          if (!ts.EnableContinuedLineCopy || logFlag)          if (!ts.EnableContinuedLineCopy || logFlag)
718                  if (NeedsOutputBufs()) OutputLogByte(LF);                  if (NeedsOutputBufs()) OutputLogByte(LF);
# Line 792  static void PutChar(BYTE b) Line 815  static void PutChar(BYTE b)
815          LastPutCharacter = b;          LastPutCharacter = b;
816    
817          if (PrinterMode) { // printer mode          if (PrinterMode) { // printer mode
818                  WriteToPrnFile(b,TRUE);                  WriteToPrnFile(PrintFile_, b,TRUE);
819                  return;                  return;
820          }          }
821    
# Line 905  static void PutDecSp(BYTE b) Line 928  static void PutDecSp(BYTE b)
928          CharAttrTmp = CharAttr;          CharAttrTmp = CharAttr;
929    
930          if (PrinterMode) { // printer mode          if (PrinterMode) { // printer mode
931                  WriteToPrnFile(b, TRUE);                  WriteToPrnFile(PrintFile_, b, TRUE);
932                  return;                  return;
933          }          }
934    
# Line 958  static void PutKanji(BYTE b) Line 981  static void PutKanji(BYTE b)
981          Kanji = Kanji + b;          Kanji = Kanji + b;
982    
983          if (PrinterMode && DirectPrn) {          if (PrinterMode && DirectPrn) {
984                  WriteToPrnFile(HIBYTE(Kanji),FALSE);                  WriteToPrnFile(PrintFile_, HIBYTE(Kanji),FALSE);
985                  WriteToPrnFile(LOBYTE(Kanji),TRUE);                  WriteToPrnFile(PrintFile_, LOBYTE(Kanji),TRUE);
986                  return;                  return;
987          }          }
988    
# Line 967  static void PutKanji(BYTE b) Line 990  static void PutKanji(BYTE b)
990                  Kanji = JIS2SJIS((WORD)(Kanji & 0x7f7f));                  Kanji = JIS2SJIS((WORD)(Kanji & 0x7f7f));
991    
992          if (PrinterMode) { // printer mode          if (PrinterMode) { // printer mode
993                  WriteToPrnFile(HIBYTE(Kanji),FALSE);                  WriteToPrnFile(PrintFile_, HIBYTE(Kanji),FALSE);
994                  WriteToPrnFile(LOBYTE(Kanji),TRUE);                  WriteToPrnFile(PrintFile_, LOBYTE(Kanji),TRUE);
995                  return;                  return;
996          }          }
997    
# Line 1169  static void PrnParseControl(BYTE b) // p Line 1192  static void PrnParseControl(BYTE b) // p
1192                  ICount = 0;                  ICount = 0;
1193                  JustAfterESC = TRUE;                  JustAfterESC = TRUE;
1194                  ParseMode = ModeESC;                  ParseMode = ModeESC;
1195                  WriteToPrnFile(0, TRUE); // flush prn buff                  WriteToPrnFile(PrintFile_, 0, TRUE); // flush prn buff
1196                  return;                  return;
1197          case CSI:          case CSI:
1198                  if (! Accept8BitCtrl) {                  if (! Accept8BitCtrl) {
# Line 1179  static void PrnParseControl(BYTE b) // p Line 1202  static void PrnParseControl(BYTE b) // p
1202                  ClearParams();                  ClearParams();
1203                  FirstPrm = TRUE;                  FirstPrm = TRUE;
1204                  ParseMode = ModeCSI;                  ParseMode = ModeCSI;
1205                  WriteToPrnFile(0, TRUE); // flush prn buff                  WriteToPrnFile(PrintFile_, 0, TRUE); // flush prn buff
1206                  WriteToPrnFile(b, FALSE);                  WriteToPrnFile(PrintFile_, b, FALSE);
1207                  return;                  return;
1208          }          }
1209          /* send the uninterpreted character to printer */          /* send the uninterpreted character to printer */
1210          WriteToPrnFile(b, TRUE);          WriteToPrnFile(PrintFile_, b, TRUE);
1211  }  }
1212    
1213  static void ParseControl(BYTE b)  static void ParseControl(BYTE b)
# Line 1603  void PrnParseEscape(BYTE b) // printer m Line 1626  void PrnParseEscape(BYTE b) // printer m
1626                  case '[': /* CSI */                  case '[': /* CSI */
1627                          ClearParams();                          ClearParams();
1628                          FirstPrm = TRUE;                          FirstPrm = TRUE;
1629                          WriteToPrnFile(ESC,FALSE);                          WriteToPrnFile(PrintFile_, ESC,FALSE);
1630                          WriteToPrnFile('[',FALSE);                          WriteToPrnFile(PrintFile_, '[',FALSE);
1631                          ParseMode = ModeCSI;                          ParseMode = ModeCSI;
1632                          return;                          return;
1633                  } /* end of case Icount=0 */                  } /* end of case Icount=0 */
# Line 1642  void PrnParseEscape(BYTE b) // printer m Line 1665  void PrnParseEscape(BYTE b) // printer m
1665                  break;                  break;
1666          }          }
1667          // send the uninterpreted sequence to printer          // send the uninterpreted sequence to printer
1668          WriteToPrnFile(ESC,FALSE);          WriteToPrnFile(PrintFile_, ESC,FALSE);
1669          for (i=1; i<=ICount; i++)          for (i=1; i<=ICount; i++)
1670                  WriteToPrnFile(IntChar[i],FALSE);                  WriteToPrnFile(PrintFile_, IntChar[i],FALSE);
1671          WriteToPrnFile(b,TRUE);          WriteToPrnFile(PrintFile_, b,TRUE);
1672  }  }
1673    
1674  void ParseEscape(BYTE b) /* b is the final char */  void ParseEscape(BYTE b) /* b is the final char */
# Line 2271  void CS_i_Mode()               // MC Line 2294  void CS_i_Mode()               // MC
2294            case 5:            case 5:
2295                  if (ts.TermFlag&TF_PRINTERCTRL) {                  if (ts.TermFlag&TF_PRINTERCTRL) {
2296                          if (! AutoPrintMode)                          if (! AutoPrintMode)
2297                                  OpenPrnFile();                                  PrintFile_ = OpenPrnFile();
2298                          DirectPrn = (ts.PrnDev[0]!=0);                          DirectPrn = (ts.PrnDev[0]!=0);
2299                          PrinterMode = TRUE;                          PrinterMode = TRUE;
2300                  }                  }
# Line 3259  void CSQ_h_Mode() // DECSET Line 3282  void CSQ_h_Mode() // DECSET
3282          }          }
3283  }  }
3284    
3285    static void PrintFileFinish(PrintFile *handle)
3286    {
3287            PrnFinish(handle);
3288            PrintFile_ = NULL;
3289    }
3290    
3291  void CSQ_i_Mode()               // DECMC  void CSQ_i_Mode()               // DECMC
3292  {  {
3293          switch (Param[1]) {          switch (Param[1]) {
3294            case 1:            case 1:
3295                  if (ts.TermFlag&TF_PRINTERCTRL) {                  if (ts.TermFlag&TF_PRINTERCTRL) {
3296                          OpenPrnFile();                          PrintFile_ = OpenPrnFile();
3297                          BuffDumpCurrentLine(LF);                          BuffDumpCurrentLine(PrintFile_, LF);
3298                          if (! AutoPrintMode)                          if (! AutoPrintMode) {
3299                                  ClosePrnFile();                                  ClosePrnFile(PrintFile_, PrintFileFinish);
3300                            }
3301                  }                  }
3302                  break;                  break;
3303            /* auto print mode off */            /* auto print mode off */
3304            case 4:            case 4:
3305                  if (AutoPrintMode) {                  if (AutoPrintMode) {
3306                          ClosePrnFile();                          ClosePrnFile(PrintFile_, PrintFileFinish);
3307                          AutoPrintMode = FALSE;                          AutoPrintMode = FALSE;
3308                  }                  }
3309                  break;                  break;
# Line 3281  void CSQ_i_Mode()              // DECMC Line 3311  void CSQ_i_Mode()              // DECMC
3311            case 5:            case 5:
3312                  if (ts.TermFlag&TF_PRINTERCTRL) {                  if (ts.TermFlag&TF_PRINTERCTRL) {
3313                          if (! AutoPrintMode) {                          if (! AutoPrintMode) {
3314                                  OpenPrnFile();                                  PrintFile_ = OpenPrnFile();
3315                                  AutoPrintMode = TRUE;                                  AutoPrintMode = TRUE;
3316                          }                          }
3317                  }                  }
# Line 4183  void PrnParseCS(BYTE b) // printer mode Line 4213  void PrnParseCS(BYTE b) // printer mode
4213                                  if (Param[1]==4) {                                  if (Param[1]==4) {
4214                                          PrinterMode = FALSE;                                          PrinterMode = FALSE;
4215                                          // clear prn buff                                          // clear prn buff
4216                                          WriteToPrnFile(0,FALSE);                                          WriteToPrnFile(PrintFile_, 0,FALSE);
4217                                          if (! AutoPrintMode)                                          if (! AutoPrintMode) {
4218                                                  ClosePrnFile();                                                  ClosePrnFile(PrintFile_, PrintFileFinish);
4219                                            }
4220                                          return;                                          return;
4221                                  }                                  }
4222                                  break;                                  break;
# Line 4197  void PrnParseCS(BYTE b) // printer mode Line 4228  void PrnParseCS(BYTE b) // printer mode
4228            case 1: break;            case 1: break;
4229          } /* of case Icount */          } /* of case Icount */
4230    
4231          WriteToPrnFile(b,TRUE);          WriteToPrnFile(PrintFile_, b,TRUE);
4232  }  }
4233    
4234  void ParseCS(BYTE b) /* b is the final char */  void ParseCS(BYTE b) /* b is the final char */
# Line 4311  void ControlSequence(BYTE b) Line 4342  void ControlSequence(BYTE b)
4342                  ParseCS(b); /* terminate char */                  ParseCS(b); /* terminate char */
4343          else {          else {
4344                  if (PrinterMode)                  if (PrinterMode)
4345                          WriteToPrnFile(b,FALSE);                          WriteToPrnFile(PrintFile_, b,FALSE);
4346    
4347                  if ((b>=0x20) && (b<=0x2F)) { /* intermediate char */                  if ((b>=0x20) && (b<=0x2F)) { /* intermediate char */
4348                          if (ICount<IntCharMax) ICount++;                          if (ICount<IntCharMax) ICount++;

Legend:
Removed from v.9104  
changed lines
  Added in v.9115

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