| 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]; |
| 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 |
} |
} |
| 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); |
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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) { |
| 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) |
| 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 */ |
| 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 */ |
| 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 |
} |
} |
| 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; |
| 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 |
} |
} |
| 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; |
| 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 */ |
| 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++; |