-
Notifications
You must be signed in to change notification settings - Fork 1
/
vt420.c
2912 lines (2479 loc) · 65.3 KB
/
vt420.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* $Id: vt420.c,v 1.234 2024/10/22 20:33:01 tom Exp $ */
/*
* Reference: Installing and Using the VT420 Video Terminal (North American
* Model (EK-VT420-UG.002)
*/
#include <vttest.h>
#include <draw.h>
#include <esc.h>
#include <ttymodes.h>
typedef enum {
marNone = -1,
marReset = 0,
marFirst = 1,
marLast = 2,
marMiddle = 3,
marEnd
} MARS;
typedef enum {
/* VT525 specific */
chkFOREGROUND = 0x1,
chkBACKGROUND = 0x2,
/* these are not visually distinct, not useful for testing */
chkPROTECTED = 0x4, /* DECSCA */
chkINVISIBLE = 0x8, /* SGR 8 */
/* these are visually distinct, used in the test */
chkUNDERLINE = 0x10, /* SGR 4 */
chkINVERSE = 0x20, /* SGR 7 */
chkBLINK = 0x40, /* SGR 5 */
chkBOLD = 0x80 /* SGR 1 */
} CHKS;
int origin_mode = FALSE;
char txt_override_color[80];
static int do_lines = FALSE;
static int use_colors = FALSE;
/******************************************************************************/
void
reset_colors(void)
{
if (use_colors) {
sgr("0");
use_colors = FALSE;
if (LOG_ENABLED) {
fprintf(log_fp, NOTE_STR "turned off colors\n");
}
}
}
void
set_colors(const char *value)
{
if (do_colors) {
if (value == 0)
value = "0";
sgr(value);
use_colors = strcmp(value, "0");
if (LOG_ENABLED) {
fprintf(log_fp, NOTE_STR "turned %s colors\n",
use_colors ? "on" : "off");
}
}
}
/******************************************************************************/
int lrmm_flag;
static MARS lr_marg_flag;
static int lr_marg1, lr_marg2;
static MARS tb_marg_flag;
static int tb_marg1, tb_marg2;
char origin_mode_mesg[80];
char lrmm_mesg[80];
char lr_marg_mesg[80];
char tb_marg_mesg[80];
int
toggle_LRMM(MENU_ARGS)
{
lrmm_flag = !lrmm_flag;
if (lrmm_flag)
sm("?69");
else
rm("?69");
return MENU_NOHOLD;
}
/*
* The message tells what margins will be used in the test, not what their
* value is while drawing the menu (since actually setting margins would
* interfere with the menu).
*/
int
toggle_STBM(MENU_ARGS)
{
switch (++tb_marg_flag) {
default:
tb_marg_flag = marReset;
tb_marg1 = 0;
tb_marg2 = 0;
strcpy(tb_marg_mesg, "Top/Bottom margins are reset");
break;
case marFirst:
tb_marg1 = 1;
tb_marg2 = max_lines / 2;
strcpy(tb_marg_mesg, "Top/Bottom margins are set to top half of screen");
break;
case marLast:
tb_marg1 = max_lines / 2;
tb_marg2 = max_lines;
strcpy(tb_marg_mesg,
"Top/Bottom margins are set to bottom half of screen");
break;
case marMiddle:
tb_marg1 = max_lines / 4;
tb_marg2 = (3 * max_lines) / 4;
strcpy(tb_marg_mesg,
"Top/Bottom margins are set to middle half of screen");
break;
}
return MENU_NOHOLD;
}
int
toggle_SLRM(MENU_ARGS)
{
switch (++lr_marg_flag) {
default:
lr_marg_flag = marReset;
lr_marg1 = 0;
lr_marg2 = 0;
strcpy(lr_marg_mesg, "Left/right margins are reset");
break;
case marFirst:
lr_marg1 = 1;
lr_marg2 = min_cols / 2;
strcpy(lr_marg_mesg, "Left/right margins are set to left half of screen");
break;
case marLast:
lr_marg1 = (min_cols / 2) + 1;
lr_marg2 = min_cols;
strcpy(lr_marg_mesg,
"Left/right margins are set to right half of screen");
break;
case marMiddle:
lr_marg1 = (min_cols / 4) + 1;
lr_marg2 = (3 * min_cols) / 4;
strcpy(lr_marg_mesg,
"Left/right margins are set to middle half of screen");
break;
}
return MENU_NOHOLD;
}
int
get_top_margin(void)
{
int result = (tb_marg1 ? tb_marg1 : 1);
if (origin_mode)
result = 1;
return result;
}
int
get_left_margin(void)
{
int result = ((lrmm_flag && lr_marg1) ? lr_marg1 : 1);
if (origin_mode)
result = 1;
return result;
}
int
get_right_margin(void)
{
int result = ((lrmm_flag && lr_marg2) ? lr_marg2 : min_cols);
if (origin_mode) {
result = (((lrmm_flag && lr_marg2) ? lr_marg2 : min_cols) -
((lrmm_flag && lr_marg1) ? lr_marg1 : 1) +
1);
}
return result;
}
int
get_bottom_margin(int n)
{
int result = (tb_marg2 ? tb_marg2 : (n));
if (origin_mode) {
result = ((tb_marg2 ? tb_marg2 : max_lines) -
(tb_marg1 ? tb_marg1 : 1) +
1);
}
return result;
}
static int
get_hold_col(void)
{
int hold_col = 1;
if (lrmm_flag) {
switch (lr_marg_flag) {
default:
break;
case marFirst:
hold_col = get_right_margin() + 1;
break;
case marMiddle:
hold_col = get_left_margin();
break;
}
}
return hold_col;
}
/*
* Return a good row value at which to print a prompt, avoiding most overwrite
* of test-results.
*/
static int
get_hold_row(void)
{
int hold_row;
switch (tb_marg_flag) {
default:
hold_row = max_lines / 2;
break;
case marFirst:
hold_row = (origin_mode
? (max_lines - 4)
: (get_bottom_margin(max_lines) + 1));
break;
case marMiddle:
hold_row = (max_lines > 16) ? (max_lines - 4) : (max_lines / 2);
break;
case marLast:
hold_row = 1;
break;
}
return hold_row;
}
static int
hold_clear(void)
{
int result;
switch (tb_marg_flag) {
default:
result = 0;
break;
case marFirst:
result = 1;
break;
case marReset:
case marLast:
result = 0;
break;
}
return result;
}
/*
* Prompt as part of a multi-step test, temporarily resetting DECOM so we can
* put the prompt anywhere.
*/
static void
special_prompt(int row, int col, const char *msg)
{
if (origin_mode)
decom(FALSE);
vt_move(row, col);
if (msg != 0) {
printxx("%s", msg);
vt_move(row + 1, col);
}
holdit();
if (origin_mode)
decom(TRUE);
}
/*
* Fill area outside margins with given character, to help show that changes
* are limited to the area within margins.
*/
static void
fill_outside(int ch)
{
int row, col;
if (LOG_ENABLED) {
fprintf(log_fp, NOTE_STR "filling outside margins with '%c'\n", ch);
}
if (!do_colors)
set_colors("0");
if (origin_mode)
decom(FALSE);
for (row = 1; row <= max_lines; ++row) {
if (row < tb_marg1 ||
row > tb_marg2 ||
lr_marg1 > 1 ||
lr_marg2 < min_cols) {
int first = 1;
int next = 0;
for (col = 1; col <= min_cols; ++col) {
if ((lrmm_flag && lr_marg1 && col < lr_marg1) ||
(lrmm_flag && lr_marg2 && col > lr_marg2) ||
(tb_marg1 != 0 && row < tb_marg1) ||
(tb_marg2 != 0 && row > tb_marg2)) {
if (first || (next != col)) {
vt_move(row, col);
first = 0;
next = col + 1;
}
putchar(ch);
++next;
}
}
}
}
if (origin_mode)
decom(TRUE);
}
void
test_with_margins(int enable)
{
switch (enable) {
case 1:
fill_outside('.');
/* FALLTHRU */
case 2:
decstbm(tb_marg1, tb_marg2);
decslrm(lr_marg1, lr_marg2);
if (origin_mode)
decom(TRUE);
break;
default:
decstbm(0, 0);
decslrm(0, 0);
if (origin_mode)
decom(FALSE);
break;
}
}
/*
* Fill the area within margins with a test pattern. The top line is numbers,
* the bottom line is alphas. In between, use asterisks.
*/
static void
fill_margins(void)
{
int top = get_top_margin();
int bot = get_bottom_margin(max_lines);
int lft = get_left_margin();
int rgt = get_right_margin();
int row, col;
set_colors(WHITE_ON_BLUE);
decawm(FALSE); /* do this to allow writing in lower-right */
for (row = top; row <= bot; ++row) {
cup(row, lft);
for (col = lft; col <= rgt; ++col) {
if (row == top) {
putchar((col - lft) % 10 + '0');
} else if (row == bot) {
putchar((col - lft) % 26 + 'a');
} else {
putchar('*');
}
}
}
decawm(TRUE);
}
static void
setup_rectangle(BOX *box, int last)
{
box->top = 5;
box->left = 5;
box->right = min_cols - 5;
box->bottom = max_lines - 10;
if (origin_mode) {
int top = get_top_margin();
int lft = get_left_margin();
int rgt = get_right_margin();
int bot = get_bottom_margin(last - 1);
int wide = (rgt - lft + 1);
int high = (bot - top + 1);
if (high > 20) {
box->top = 5;
box->bottom = high - 10;
} else {
box->top = 2;
box->bottom = high - 2;
}
if (wide > 20) {
box->left = 5;
box->right = wide - 5;
} else {
box->left = 2;
box->right = wide - 2;
}
}
}
#define DATA(name,level) { name, #name, level }
static int
show_DECLRMM(MENU_ARGS)
{
/* *INDENT-OFF* */
RQM_DATA dec_modes[] = { /* this list is sorted by code, not name */
DATA( DECLRMM, 4 /* left/right margin mode */),
};
/* *INDENT-ON* */
int code;
int old_DECRPM = set_DECRPM(4);
code = any_RQM(PASS_ARGS, dec_modes, TABLESIZE(dec_modes), 1);
set_DECRPM(old_DECRPM);
return code;
}
#undef DATA
/*
* Allow user to test the same screens with/without lines.
*/
static int
toggle_lines_mode(MENU_ARGS)
{
do_lines = !do_lines;
return MENU_NOHOLD;
}
/*
* Allow user to test the same screens with/without origin-mode.
*/
int
toggle_DECOM(MENU_ARGS)
{
origin_mode = !origin_mode;
return MENU_NOHOLD;
}
/*
* DECALN does not set attributes; we want a colored screen for some tests.
*/
static void
fill_screen(void)
{
if (do_colors) {
int y, x;
set_colors(WHITE_ON_BLUE);
for (y = 0; y < max_lines - 4; ++y) {
cup(y + 1, 1);
for (x = 0; x < min_cols; ++x)
putchar('E');
}
/* make this a different color to show fill versus erase diffs */
set_colors(WHITE_ON_GREEN);
} else {
decaln(); /* fill the screen */
}
}
/******************************************************************************/
static int
rpt_DECSACE(MENU_ARGS)
{
return any_decrqss(the_title, "*x");
}
static int
rpt_DECSNLS(MENU_ARGS)
{
return any_decrqss(the_title, "*|");
}
static int
rpt_DECSLRM(MENU_ARGS)
{
return any_decrqss(the_title, "s");
}
static int
rpt_DECELF(MENU_ARGS)
{
return any_decrqss(the_title, "+q");
}
/*
* VT420 manual shows "=}", but the terminal returns an error. VT510 sequences
* show "*}".
*/
static int
rpt_DECLFKC(MENU_ARGS)
{
return any_decrqss(the_title, "*}");
}
static int
rpt_DECSMKR(MENU_ARGS)
{
return any_decrqss(the_title, "+r");
}
/******************************************************************************/
static void
show_DataIntegrity(const char *report)
{
int pos = 0;
int code = scanto(report, &pos, 'n');
const char *show;
switch (code) {
case 70:
show = "No communication errors";
break;
case 71:
show = "Communication errors";
break;
case 73:
show = "Not reported since last power-up or RIS";
break;
default:
show = SHOW_FAILURE;
}
show_result("%s", show);
}
static void
show_keypress(int row, int col)
{
const char *report;
char last[BUF_SIZE];
last[0] = '\0';
vt_move(row++, 1);
println("When you are done, press any key twice to quit.");
vt_move(row, col);
fflush(stdout);
pause_replay();
while (strcmp(report = instr(), last)) {
vt_move(row, col);
vt_clear(0);
chrprint2(report, row, col);
strncpy(last, report, sizeof(last) - 2)[sizeof(last) - 2] = '\0';
}
resume_replay();
}
static void
show_MultisessionStatus(const char *report)
{
int pos = 0;
int Ps1 = scan_any(report, &pos, 'n');
int Ps2 = scanto(report, &pos, 'n');
const char *show;
switch (Ps1) {
case 80:
show = "SSU sessions enabled (%d max)";
break;
case 81:
show = "SSU sessions available but pending (%d max)";
break;
case 83:
show = "SSU sessions not ready";
break;
case 87:
show = "Sessions on separate lines";
break;
default:
show = SHOW_FAILURE;
}
show_result(show, Ps2);
}
/******************************************************************************/
/*
* VT400 & up.
* DECBI - Back Index
* This control function moves the cursor backward one column. If the cursor
* is at the left margin, then all screen data within the margin moves one
* column to the right. The column that shifted past the right margin is lost.
*
* Format: ESC 6
* Description:
* DECBI adds a new column at the left margin with no visual attributes. DECBI
* is not affected by the margins. If the cursor is at the left border of the
* page when the terminal received DECBI, then the terminal ignores DECBI.
*/
static int
tst_DECBI(MENU_ARGS)
{
int n, m;
int last = max_lines - 4;
int final;
int top;
int lft;
int rgt;
test_with_margins(1);
top = get_top_margin();
lft = get_left_margin();
rgt = get_right_margin();
final = (rgt - lft + 1) / 4;
set_colors(WHITE_ON_BLUE);
for (n = final; n > 0; n--) {
slowly();
cup(top, lft);
if (n != final) {
for (m = 0; m < 4; m++)
decbi();
}
printxx("%3d", n);
}
reset_colors();
test_with_margins(0);
vt_move(last, 1);
vt_clear(0);
println(the_title);
println("If your terminal supports DECBI (backward index), then the top row");
printxx("should be numbered 1 through %d.\n", final);
return MENU_HOLD;
}
static int
tst_DECBKM(MENU_ARGS)
{
int row, col;
const char *report;
vt_move(1, 1);
println(the_title);
set_tty_raw(TRUE);
set_tty_echo(FALSE);
reset_inchar();
decbkm(TRUE);
println("Press the backspace key");
vt_move(row = 3, col = 10);
report = instr();
chrprint2(report, row, col);
show_result(!strcmp(report, "\010") ? SHOW_SUCCESS : SHOW_FAILURE);
reset_inchar();
vt_move(5, 1);
decbkm(FALSE);
println("Press the backspace key again");
vt_move(row = 6, col = 10);
report = instr();
chrprint2(report, row, col);
show_result(!strcmp(report, "\177") ? SHOW_SUCCESS : SHOW_FAILURE);
vt_move(max_lines - 1, 1);
restore_ttymodes();
return MENU_HOLD;
}
/*
* VT400 & up
* Change Attributes in Rectangular Area
*/
static int
tst_DECCARA(MENU_ARGS)
{
int last = max_lines - 4;
BOX box;
setup_rectangle(&box, last);
test_with_margins(1);
set_colors(WHITE_ON_BLUE);
decsace(TRUE);
fill_screen();
deccara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */
deccara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 0); /* invert a rectangle) */
test_with_margins(0);
sgr("0");
vt_move(last, 1);
vt_clear(0);
println(the_title);
println("There should be an open rectangle formed by reverse-video E's");
holdit();
test_with_margins(2);
decsace(FALSE);
fill_screen();
deccara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */
deccara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 0); /* invert a rectangle) */
sgr("0");
test_with_margins(0);
vt_move(last, 1);
vt_clear(0);
println(the_title);
println("There should be an open rectangle formed by reverse-video E's");
println("combined with wrapping at the margins.");
return MENU_HOLD;
}
#define fmt_DECCKSR "Testing DECCKSR: %s"
static int
parse_DECCKSR(char *report, int Pid, int *digits, int *checksum)
{
int result = 0;
int pos = 0;
int actual;
const char *after;
const char *before;
if ((report = skip_dcs(report)) != 0
&& strip_terminator(report)
&& strlen(report) > 1
&& scanto(report, &pos, '!') == Pid
&& report[pos++] == '~'
&& (after = skip_xdigits((before = report + pos), &actual)) != 0
&& *after == '\0') {
result = 1;
*digits = (int) (after - before);
*checksum = actual;
}
return result;
}
static char *
check_DECCKSR(char *target, char *source, int Pid, int expected)
{
int digits;
int actual;
if (parse_DECCKSR(source, Pid, &digits, &actual)) {
if (digits != 4) {
sprintf(target, "%s: expected 4 digits", SHOW_FAILURE);
} else if (expected < 0 || (actual == expected)) {
strcpy(target, SHOW_SUCCESS);
} else {
sprintf(target, "expected %04X", (expected & 0xffff));
}
} else {
strcpy(target, SHOW_FAILURE);
}
return target;
}
static int
tst_DECCKSR(MENU_ARGS, int Pid, const char *the_csi, int expected)
{
char *report;
int row, col;
char temp[80];
vt_move(1, 1);
printxx(fmt_DECCKSR, the_title);
set_tty_raw(TRUE);
set_tty_echo(FALSE);
do_csi("%s", the_csi);
report = get_reply();
vt_move(row = 3, col = 10);
chrprint2(report, row, col);
show_result("%s", check_DECCKSR(temp, report, Pid, expected));
restore_ttymodes();
vt_move(max_lines - 1, 1);
return MENU_HOLD;
}
/*
* VT400 & up.
* Copy Rectangular area
*/
static int
tst_DECCRA(MENU_ARGS)
{
#define adj_y 3
#define adj_x 4
#define adj_DECCRA " (down %d, right %d)\r\n", box.bottom + 1 - box.top, box.right + 1 - box.left, adj_y, adj_x
#define msg_DECCRA(msg) "The %dx%d box " msg adj_DECCRA
BOX box;
int hmargin = origin_mode ? ((get_right_margin() * 3) / 8) : 30;
int vmargin = origin_mode ? ((get_bottom_margin(max_lines) * 2) / 5) : 10;
int last = max_lines - 3;
if (make_box_params(&box, vmargin, hmargin) == 0) {
box.top = 5;
box.left = 5;
test_with_margins(1);
if (do_colors) {
set_colors(WHITE_ON_BLUE);
} else {
sgr(BLINK_REVERSE);
}
draw_box_outline(&box, do_lines ? -1 : '*');
sgr("0");
test_with_margins(0);
vt_move(last, 1);
println(the_title);
tprintf(msg_DECCRA("will be copied"));
holdit();
test_with_margins(2);
deccra(box.top, box.left, box.bottom, box.right, 1,
box.top + adj_y, box.left + adj_x, 1);
test_with_margins(0);
vt_move(last, 1);
vt_clear(0);
tprintf(msg_DECCRA("should be copied, overlapping"));
holdit();
test_with_margins(2);
make_box_params(&box, vmargin, hmargin);
box.top = 5;
box.left = 5;
if (do_colors) {
set_colors(YELLOW_ON_BLACK);
} else {
sgr("0;7"); /* fill the box in reverse */
}
draw_box_filled(&box, -1);
if (do_colors) {
set_colors(WHITE_ON_BLUE);
} else {
sgr(BLINK_REVERSE);
}
draw_box_outline(&box, do_lines ? -1 : '*');
sgr("0");
test_with_margins(0);
vt_move(last, 1);
println(the_title);
tprintf(msg_DECCRA("will be copied"));
holdit();
test_with_margins(2);
sgr("0;4"); /* set underline, to check if that leaks through */
deccra(box.top, box.left, box.bottom, box.right, 1,
box.top + adj_y, box.left + adj_x, 1);
sgr("0");
test_with_margins(0);
vt_move(last, 1);
vt_clear(0);
tprintf(msg_DECCRA("should be copied, overlapping"));
}
return MENU_HOLD;
}
static int
marker_of(int n)
{
return (n - 1) % 26 + 'a';
}
/*
* VT400 & up.
* Delete column.
*/
static int
tst_DECDC(MENU_ARGS)
{
int n;
int last = max_lines - 3;
int base_row;
int base_col;
int left_col;
int last_row;
int real_col;
int top;
int bot;
int lft;
int rgt;
int final_dc;
char mark_1st = 0;
char mark_2nd = 0;
test_with_margins(1);
set_colors(WHITE_ON_BLUE);
top = get_top_margin();
lft = get_left_margin();
rgt = get_right_margin();
bot = get_bottom_margin(last - 1);
/*
* Adjustments so that most of the initial line (before shifting) passes
* through the area within margins.
*/
if (origin_mode) {
base_row = 0;
if (lrmm_flag) {
left_col = 1;
switch (tb_marg_flag) {
default:
last_row = bot;
break;
case marReset:
case marLast:
last_row = bot - 3;
break;
}
base_col = rgt - (bot - top) + last_row;
if (base_col < 0)
base_col = 0;
if (base_col > rgt)
base_col = rgt;
real_col = lr_marg1 + lft - (lr_marg1 != 0);
} else {
last_row = last;
base_col = (2 * last);
left_col = 1;
real_col = lft;
}
} else {
switch (lr_marg_flag) {
default:
base_col = (2 * last);
left_col = 1;
break;
case marFirst:
base_col = (min_cols / 2);
left_col = 1;
break;
case marMiddle:
base_col = (3 * min_cols) / 4;
left_col = (min_cols / 4) + 1;
break;
case marLast:
base_col = min_cols + 0;
left_col = (min_cols / 2) + 1;
break;
}
if (tb_marg_flag == marLast) {
base_row = max_lines / 2;
} else {
base_row = 0;