| 1 |
/* $Id: vt420.c,v 1.236 2024/12/05 00:43:14 tom Exp $ */ |
| 2 |
|
| 3 |
/* |
| 4 |
* Reference: Installing and Using the VT420 Video Terminal (North American |
| 5 |
* Model (EK-VT420-UG.002) |
| 6 |
*/ |
| 7 |
#include <vttest.h> |
| 8 |
#include <draw.h> |
| 9 |
#include <esc.h> |
| 10 |
#include <ttymodes.h> |
| 11 |
|
| 12 |
typedef enum { |
| 13 |
marNone = -1, |
| 14 |
marReset = 0, |
| 15 |
marFirst = 1, |
| 16 |
marLast = 2, |
| 17 |
marMiddle = 3, |
| 18 |
marEnd |
| 19 |
} MARS; |
| 20 |
|
| 21 |
typedef enum { |
| 22 |
/* VT525 specific */ |
| 23 |
chkFOREGROUND = 0x1, |
| 24 |
chkBACKGROUND = 0x2, |
| 25 |
/* these are not visually distinct, not useful for testing */ |
| 26 |
chkPROTECTED = 0x4, /* DECSCA */ |
| 27 |
chkINVISIBLE = 0x8, /* SGR 8 */ |
| 28 |
/* these are visually distinct, used in the test */ |
| 29 |
chkUNDERLINE = 0x10, /* SGR 4 */ |
| 30 |
chkINVERSE = 0x20, /* SGR 7 */ |
| 31 |
chkBLINK = 0x40, /* SGR 5 */ |
| 32 |
chkBOLD = 0x80 /* SGR 1 */ |
| 33 |
} CHKS; |
| 34 |
|
| 35 |
int origin_mode = FALSE; |
| 36 |
char txt_override_color[80]; |
| 37 |
|
| 38 |
static int do_lines = FALSE; |
| 39 |
static int use_colors = FALSE; |
| 40 |
|
| 41 |
/******************************************************************************/ |
| 42 |
|
| 43 |
void |
| 44 |
reset_colors(void) |
| 45 |
{ |
| 46 |
if (use_colors) { |
| 47 |
sgr("0"); |
| 48 |
use_colors = FALSE; |
| 49 |
if (LOG_ENABLED) { |
| 50 |
fprintf(log_fp, NOTE_STR "turned off colors\n"); |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
set_colors(const char *value) |
| 57 |
{ |
| 58 |
if (do_colors) { |
| 59 |
if (value == NULL) |
| 60 |
value = "0"; |
| 61 |
sgr(value); |
| 62 |
use_colors = strcmp(value, "0"); |
| 63 |
if (LOG_ENABLED) { |
| 64 |
fprintf(log_fp, NOTE_STR "turned %s colors\n", |
| 65 |
use_colors ? "on" : "off"); |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
/******************************************************************************/ |
| 71 |
|
| 72 |
int lrmm_flag; |
| 73 |
|
| 74 |
static MARS lr_marg_flag; |
| 75 |
static int lr_marg1, lr_marg2; |
| 76 |
static MARS tb_marg_flag; |
| 77 |
static int tb_marg1, tb_marg2; |
| 78 |
|
| 79 |
char origin_mode_mesg[80]; |
| 80 |
char lrmm_mesg[80]; |
| 81 |
char lr_marg_mesg[80]; |
| 82 |
char tb_marg_mesg[80]; |
| 83 |
|
| 84 |
int |
| 85 |
toggle_LRMM(MENU_ARGS) |
| 86 |
{ |
| 87 |
lrmm_flag = !lrmm_flag; |
| 88 |
if (lrmm_flag) |
| 89 |
sm("?69"); |
| 90 |
else |
| 91 |
rm("?69"); |
| 92 |
return MENU_NOHOLD; |
| 93 |
} |
| 94 |
|
| 95 |
/* |
| 96 |
* The message tells what margins will be used in the test, not what their |
| 97 |
* value is while drawing the menu (since actually setting margins would |
| 98 |
* interfere with the menu). |
| 99 |
*/ |
| 100 |
int |
| 101 |
toggle_STBM(MENU_ARGS) |
| 102 |
{ |
| 103 |
switch (++tb_marg_flag) { |
| 104 |
default: |
| 105 |
tb_marg_flag = marReset; |
| 106 |
tb_marg1 = 0; |
| 107 |
tb_marg2 = 0; |
| 108 |
strcpy(tb_marg_mesg, "Top/Bottom margins are reset"); |
| 109 |
break; |
| 110 |
case marFirst: |
| 111 |
tb_marg1 = 1; |
| 112 |
tb_marg2 = max_lines / 2; |
| 113 |
strcpy(tb_marg_mesg, "Top/Bottom margins are set to top half of screen"); |
| 114 |
break; |
| 115 |
case marLast: |
| 116 |
tb_marg1 = max_lines / 2; |
| 117 |
tb_marg2 = max_lines; |
| 118 |
strcpy(tb_marg_mesg, |
| 119 |
"Top/Bottom margins are set to bottom half of screen"); |
| 120 |
break; |
| 121 |
case marMiddle: |
| 122 |
tb_marg1 = max_lines / 4; |
| 123 |
tb_marg2 = (3 * max_lines) / 4; |
| 124 |
strcpy(tb_marg_mesg, |
| 125 |
"Top/Bottom margins are set to middle half of screen"); |
| 126 |
break; |
| 127 |
} |
| 128 |
return MENU_NOHOLD; |
| 129 |
} |
| 130 |
|
| 131 |
int |
| 132 |
toggle_SLRM(MENU_ARGS) |
| 133 |
{ |
| 134 |
switch (++lr_marg_flag) { |
| 135 |
default: |
| 136 |
lr_marg_flag = marReset; |
| 137 |
lr_marg1 = 0; |
| 138 |
lr_marg2 = 0; |
| 139 |
strcpy(lr_marg_mesg, "Left/right margins are reset"); |
| 140 |
break; |
| 141 |
case marFirst: |
| 142 |
lr_marg1 = 1; |
| 143 |
lr_marg2 = min_cols / 2; |
| 144 |
strcpy(lr_marg_mesg, "Left/right margins are set to left half of screen"); |
| 145 |
break; |
| 146 |
case marLast: |
| 147 |
lr_marg1 = (min_cols / 2) + 1; |
| 148 |
lr_marg2 = min_cols; |
| 149 |
strcpy(lr_marg_mesg, |
| 150 |
"Left/right margins are set to right half of screen"); |
| 151 |
break; |
| 152 |
case marMiddle: |
| 153 |
lr_marg1 = (min_cols / 4) + 1; |
| 154 |
lr_marg2 = (3 * min_cols) / 4; |
| 155 |
strcpy(lr_marg_mesg, |
| 156 |
"Left/right margins are set to middle half of screen"); |
| 157 |
break; |
| 158 |
} |
| 159 |
return MENU_NOHOLD; |
| 160 |
} |
| 161 |
|
| 162 |
int |
| 163 |
get_top_margin(void) |
| 164 |
{ |
| 165 |
int result = (tb_marg1 ? tb_marg1 : 1); |
| 166 |
if (origin_mode) |
| 167 |
result = 1; |
| 168 |
return result; |
| 169 |
} |
| 170 |
|
| 171 |
int |
| 172 |
get_left_margin(void) |
| 173 |
{ |
| 174 |
int result = ((lrmm_flag && lr_marg1) ? lr_marg1 : 1); |
| 175 |
if (origin_mode) |
| 176 |
result = 1; |
| 177 |
return result; |
| 178 |
} |
| 179 |
|
| 180 |
int |
| 181 |
get_right_margin(void) |
| 182 |
{ |
| 183 |
int result = ((lrmm_flag && lr_marg2) ? lr_marg2 : min_cols); |
| 184 |
if (origin_mode) { |
| 185 |
result = (((lrmm_flag && lr_marg2) ? lr_marg2 : min_cols) - |
| 186 |
((lrmm_flag && lr_marg1) ? lr_marg1 : 1) + |
| 187 |
1); |
| 188 |
} |
| 189 |
return result; |
| 190 |
} |
| 191 |
|
| 192 |
int |
| 193 |
get_bottom_margin(int n) |
| 194 |
{ |
| 195 |
int result = (tb_marg2 ? tb_marg2 : (n)); |
| 196 |
if (origin_mode) { |
| 197 |
result = ((tb_marg2 ? tb_marg2 : max_lines) - |
| 198 |
(tb_marg1 ? tb_marg1 : 1) + |
| 199 |
1); |
| 200 |
} |
| 201 |
return result; |
| 202 |
} |
| 203 |
|
| 204 |
static int |
| 205 |
get_hold_col(void) |
| 206 |
{ |
| 207 |
int hold_col = 1; |
| 208 |
|
| 209 |
if (lrmm_flag) { |
| 210 |
switch (lr_marg_flag) { |
| 211 |
default: |
| 212 |
break; |
| 213 |
case marFirst: |
| 214 |
hold_col = get_right_margin() + 1; |
| 215 |
break; |
| 216 |
case marMiddle: |
| 217 |
hold_col = get_left_margin(); |
| 218 |
break; |
| 219 |
} |
| 220 |
} |
| 221 |
return hold_col; |
| 222 |
} |
| 223 |
|
| 224 |
/* |
| 225 |
* Return a good row value at which to print a prompt, avoiding most overwrite |
| 226 |
* of test-results. |
| 227 |
*/ |
| 228 |
static int |
| 229 |
get_hold_row(void) |
| 230 |
{ |
| 231 |
int hold_row; |
| 232 |
|
| 233 |
switch (tb_marg_flag) { |
| 234 |
default: |
| 235 |
hold_row = max_lines / 2; |
| 236 |
break; |
| 237 |
case marFirst: |
| 238 |
hold_row = (origin_mode |
| 239 |
? (max_lines - 4) |
| 240 |
: (get_bottom_margin(max_lines) + 1)); |
| 241 |
break; |
| 242 |
case marMiddle: |
| 243 |
hold_row = (max_lines > 16) ? (max_lines - 4) : (max_lines / 2); |
| 244 |
break; |
| 245 |
case marLast: |
| 246 |
hold_row = 1; |
| 247 |
break; |
| 248 |
} |
| 249 |
return hold_row; |
| 250 |
} |
| 251 |
|
| 252 |
static int |
| 253 |
hold_clear(void) |
| 254 |
{ |
| 255 |
int result; |
| 256 |
|
| 257 |
switch (tb_marg_flag) { |
| 258 |
default: |
| 259 |
result = 0; |
| 260 |
break; |
| 261 |
case marFirst: |
| 262 |
result = 1; |
| 263 |
break; |
| 264 |
case marReset: |
| 265 |
case marLast: |
| 266 |
result = 0; |
| 267 |
break; |
| 268 |
} |
| 269 |
|
| 270 |
return result; |
| 271 |
} |
| 272 |
|
| 273 |
/* |
| 274 |
* Prompt as part of a multi-step test, temporarily resetting DECOM so we can |
| 275 |
* put the prompt anywhere. |
| 276 |
*/ |
| 277 |
static void |
| 278 |
special_prompt(int row, int col, const char *msg) |
| 279 |
{ |
| 280 |
if (origin_mode) |
| 281 |
decom(FALSE); |
| 282 |
|
| 283 |
vt_move(row, col); |
| 284 |
if (msg != NULL) { |
| 285 |
printxx("%s", msg); |
| 286 |
vt_move(row + 1, col); |
| 287 |
} |
| 288 |
holdit(); |
| 289 |
|
| 290 |
if (origin_mode) |
| 291 |
decom(TRUE); |
| 292 |
} |
| 293 |
|
| 294 |
/* |
| 295 |
* Fill area outside margins with given character, to help show that changes |
| 296 |
* are limited to the area within margins. |
| 297 |
*/ |
| 298 |
static void |
| 299 |
fill_outside(int ch) |
| 300 |
{ |
| 301 |
int row, col; |
| 302 |
|
| 303 |
if (LOG_ENABLED) { |
| 304 |
fprintf(log_fp, NOTE_STR "filling outside margins with '%c'\n", ch); |
| 305 |
} |
| 306 |
|
| 307 |
if (!do_colors) |
| 308 |
set_colors("0"); |
| 309 |
|
| 310 |
if (origin_mode) |
| 311 |
decom(FALSE); |
| 312 |
|
| 313 |
for (row = 1; row <= max_lines; ++row) { |
| 314 |
if (row < tb_marg1 || |
| 315 |
row > tb_marg2 || |
| 316 |
lr_marg1 > 1 || |
| 317 |
lr_marg2 < min_cols) { |
| 318 |
int first = 1; |
| 319 |
int next = 0; |
| 320 |
|
| 321 |
for (col = 1; col <= min_cols; ++col) { |
| 322 |
if ((lrmm_flag && lr_marg1 && col < lr_marg1) || |
| 323 |
(lrmm_flag && lr_marg2 && col > lr_marg2) || |
| 324 |
(tb_marg1 != 0 && row < tb_marg1) || |
| 325 |
(tb_marg2 != 0 && row > tb_marg2)) { |
| 326 |
if (first || (next != col)) { |
| 327 |
vt_move(row, col); |
| 328 |
first = 0; |
| 329 |
next = col + 1; |
| 330 |
} |
| 331 |
putchar(ch); |
| 332 |
++next; |
| 333 |
} |
| 334 |
} |
| 335 |
} |
| 336 |
} |
| 337 |
|
| 338 |
if (origin_mode) |
| 339 |
decom(TRUE); |
| 340 |
} |
| 341 |
|
| 342 |
void |
| 343 |
test_with_margins(int enable) |
| 344 |
{ |
| 345 |
switch (enable) { |
| 346 |
case 1: |
| 347 |
fill_outside('.'); |
| 348 |
/* FALLTHRU */ |
| 349 |
case 2: |
| 350 |
decstbm(tb_marg1, tb_marg2); |
| 351 |
decslrm(lr_marg1, lr_marg2); |
| 352 |
if (origin_mode) |
| 353 |
decom(TRUE); |
| 354 |
break; |
| 355 |
default: |
| 356 |
decstbm(0, 0); |
| 357 |
decslrm(0, 0); |
| 358 |
if (origin_mode) |
| 359 |
decom(FALSE); |
| 360 |
break; |
| 361 |
} |
| 362 |
} |
| 363 |
|
| 364 |
/* |
| 365 |
* Fill the area within margins with a test pattern. The top line is numbers, |
| 366 |
* the bottom line is alphas. In between, use asterisks. |
| 367 |
*/ |
| 368 |
static void |
| 369 |
fill_margins(void) |
| 370 |
{ |
| 371 |
int top = get_top_margin(); |
| 372 |
int bot = get_bottom_margin(max_lines); |
| 373 |
int lft = get_left_margin(); |
| 374 |
int rgt = get_right_margin(); |
| 375 |
int row, col; |
| 376 |
|
| 377 |
set_colors(WHITE_ON_BLUE); |
| 378 |
|
| 379 |
decawm(FALSE); /* do this to allow writing in lower-right */ |
| 380 |
for (row = top; row <= bot; ++row) { |
| 381 |
cup(row, lft); |
| 382 |
for (col = lft; col <= rgt; ++col) { |
| 383 |
if (row == top) { |
| 384 |
putchar((col - lft) % 10 + '0'); |
| 385 |
} else if (row == bot) { |
| 386 |
putchar((col - lft) % 26 + 'a'); |
| 387 |
} else { |
| 388 |
putchar('*'); |
| 389 |
} |
| 390 |
} |
| 391 |
} |
| 392 |
decawm(TRUE); |
| 393 |
} |
| 394 |
|
| 395 |
static void |
| 396 |
setup_rectangle(BOX *box, int last) |
| 397 |
{ |
| 398 |
box->top = 5; |
| 399 |
box->left = 5; |
| 400 |
box->right = min_cols - 5; |
| 401 |
box->bottom = max_lines - 10; |
| 402 |
|
| 403 |
if (origin_mode) { |
| 404 |
int top = get_top_margin(); |
| 405 |
int lft = get_left_margin(); |
| 406 |
int rgt = get_right_margin(); |
| 407 |
int bot = get_bottom_margin(last - 1); |
| 408 |
int wide = (rgt - lft + 1); |
| 409 |
int high = (bot - top + 1); |
| 410 |
|
| 411 |
if (high > 20) { |
| 412 |
box->top = 5; |
| 413 |
box->bottom = high - 10; |
| 414 |
} else { |
| 415 |
box->top = 2; |
| 416 |
box->bottom = high - 2; |
| 417 |
} |
| 418 |
|
| 419 |
if (wide > 20) { |
| 420 |
box->left = 5; |
| 421 |
box->right = wide - 5; |
| 422 |
} else { |
| 423 |
box->left = 2; |
| 424 |
box->right = wide - 2; |
| 425 |
} |
| 426 |
} |
| 427 |
} |
| 428 |
|
| 429 |
#define DATA(name,level) { name, #name, level } |
| 430 |
|
| 431 |
static int |
| 432 |
show_DECLRMM(MENU_ARGS) |
| 433 |
{ |
| 434 |
/* *INDENT-OFF* */ |
| 435 |
RQM_DATA dec_modes[] = { /* this list is sorted by code, not name */ |
| 436 |
DATA( DECLRMM, 4 /* left/right margin mode */), |
| 437 |
}; |
| 438 |
/* *INDENT-ON* */ |
| 439 |
|
| 440 |
int code; |
| 441 |
int old_DECRPM = set_DECRPM(4); |
| 442 |
|
| 443 |
code = any_RQM(PASS_ARGS, dec_modes, TABLESIZE(dec_modes), 1); |
| 444 |
set_DECRPM(old_DECRPM); |
| 445 |
return code; |
| 446 |
} |
| 447 |
|
| 448 |
#undef DATA |
| 449 |
|
| 450 |
/* |
| 451 |
* Allow user to test the same screens with/without lines. |
| 452 |
*/ |
| 453 |
static int |
| 454 |
toggle_lines_mode(MENU_ARGS) |
| 455 |
{ |
| 456 |
do_lines = !do_lines; |
| 457 |
return MENU_NOHOLD; |
| 458 |
} |
| 459 |
|
| 460 |
/* |
| 461 |
* Allow user to test the same screens with/without origin-mode. |
| 462 |
*/ |
| 463 |
int |
| 464 |
toggle_DECOM(MENU_ARGS) |
| 465 |
{ |
| 466 |
origin_mode = !origin_mode; |
| 467 |
return MENU_NOHOLD; |
| 468 |
} |
| 469 |
|
| 470 |
/* |
| 471 |
* DECALN does not set attributes; we want a colored screen for some tests. |
| 472 |
*/ |
| 473 |
static void |
| 474 |
fill_screen(void) |
| 475 |
{ |
| 476 |
if (do_colors) { |
| 477 |
int y, x; |
| 478 |
|
| 479 |
set_colors(WHITE_ON_BLUE); |
| 480 |
for (y = 0; y < max_lines - 4; ++y) { |
| 481 |
cup(y + 1, 1); |
| 482 |
for (x = 0; x < min_cols; ++x) |
| 483 |
putchar('E'); |
| 484 |
} |
| 485 |
/* make this a different color to show fill versus erase diffs */ |
| 486 |
set_colors(WHITE_ON_GREEN); |
| 487 |
} else { |
| 488 |
decaln(); /* fill the screen */ |
| 489 |
} |
| 490 |
} |
| 491 |
|
| 492 |
/******************************************************************************/ |
| 493 |
|
| 494 |
static int |
| 495 |
rpt_DECSACE(MENU_ARGS) |
| 496 |
{ |
| 497 |
return any_decrqss(the_title, "*x"); |
| 498 |
} |
| 499 |
|
| 500 |
static int |
| 501 |
rpt_DECSNLS(MENU_ARGS) |
| 502 |
{ |
| 503 |
return any_decrqss(the_title, "*|"); |
| 504 |
} |
| 505 |
|
| 506 |
static int |
| 507 |
rpt_DECSLRM(MENU_ARGS) |
| 508 |
{ |
| 509 |
return any_decrqss(the_title, "s"); |
| 510 |
} |
| 511 |
|
| 512 |
static int |
| 513 |
rpt_DECELF(MENU_ARGS) |
| 514 |
{ |
| 515 |
return any_decrqss(the_title, "+q"); |
| 516 |
} |
| 517 |
|
| 518 |
/* |
| 519 |
* VT420 manual shows "=}", but the terminal returns an error. VT510 sequences |
| 520 |
* show "*}". |
| 521 |
*/ |
| 522 |
static int |
| 523 |
rpt_DECLFKC(MENU_ARGS) |
| 524 |
{ |
| 525 |
return any_decrqss(the_title, "*}"); |
| 526 |
} |
| 527 |
|
| 528 |
static int |
| 529 |
rpt_DECSMKR(MENU_ARGS) |
| 530 |
{ |
| 531 |
return any_decrqss(the_title, "+r"); |
| 532 |
} |
| 533 |
|
| 534 |
/******************************************************************************/ |
| 535 |
|
| 536 |
static void |
| 537 |
show_DataIntegrity(const char *report) |
| 538 |
{ |
| 539 |
int pos = 0; |
| 540 |
int code = scanto(report, &pos, 'n'); |
| 541 |
const char *show; |
| 542 |
|
| 543 |
switch (code) { |
| 544 |
case 70: |
| 545 |
show = "No communication errors"; |
| 546 |
break; |
| 547 |
case 71: |
| 548 |
show = "Communication errors"; |
| 549 |
break; |
| 550 |
case 73: |
| 551 |
show = "Not reported since last power-up or RIS"; |
| 552 |
break; |
| 553 |
default: |
| 554 |
show = SHOW_FAILURE; |
| 555 |
} |
| 556 |
show_result("%s", show); |
| 557 |
} |
| 558 |
|
| 559 |
static void |
| 560 |
show_keypress(int row, int col) |
| 561 |
{ |
| 562 |
const char *report; |
| 563 |
char last[BUF_SIZE]; |
| 564 |
|
| 565 |
last[0] = '\0'; |
| 566 |
vt_move(row++, 1); |
| 567 |
println("When you are done, press any key twice to quit."); |
| 568 |
vt_move(row, col); |
| 569 |
fflush(stdout); |
| 570 |
pause_replay(); |
| 571 |
while (strcmp(report = instr(), last)) { |
| 572 |
vt_move(row, col); |
| 573 |
vt_clear(0); |
| 574 |
chrprint2(report, row, col); |
| 575 |
strncpy(last, report, sizeof(last) - 2)[sizeof(last) - 2] = '\0'; |
| 576 |
} |
| 577 |
resume_replay(); |
| 578 |
} |
| 579 |
|
| 580 |
static void |
| 581 |
show_MultisessionStatus(const char *report) |
| 582 |
{ |
| 583 |
int pos = 0; |
| 584 |
int Ps1 = scan_any(report, &pos, 'n'); |
| 585 |
int Ps2 = scanto(report, &pos, 'n'); |
| 586 |
|
| 587 |
switch (Ps1) { |
| 588 |
case 80: |
| 589 |
show_result("SSU sessions enabled (%d max)", Ps2); |
| 590 |
break; |
| 591 |
case 81: |
| 592 |
show_result("SSU sessions available but pending (%d max)", Ps2); |
| 593 |
break; |
| 594 |
case 83: |
| 595 |
show_result("SSU sessions not ready"); |
| 596 |
break; |
| 597 |
case 87: |
| 598 |
show_result("Sessions on separate lines"); |
| 599 |
break; |
| 600 |
default: |
| 601 |
show_result(SHOW_FAILURE); |
| 602 |
} |
| 603 |
} |
| 604 |
|
| 605 |
/******************************************************************************/ |
| 606 |
|
| 607 |
/* |
| 608 |
* VT400 & up. |
| 609 |
* DECBI - Back Index |
| 610 |
* This control function moves the cursor backward one column. If the cursor |
| 611 |
* is at the left margin, then all screen data within the margin moves one |
| 612 |
* column to the right. The column that shifted past the right margin is lost. |
| 613 |
* |
| 614 |
* Format: ESC 6 |
| 615 |
* Description: |
| 616 |
* DECBI adds a new column at the left margin with no visual attributes. DECBI |
| 617 |
* is not affected by the margins. If the cursor is at the left border of the |
| 618 |
* page when the terminal received DECBI, then the terminal ignores DECBI. |
| 619 |
*/ |
| 620 |
static int |
| 621 |
tst_DECBI(MENU_ARGS) |
| 622 |
{ |
| 623 |
int n, m; |
| 624 |
int last = max_lines - 4; |
| 625 |
int final; |
| 626 |
int top; |
| 627 |
int lft; |
| 628 |
int rgt; |
| 629 |
|
| 630 |
test_with_margins(1); |
| 631 |
|
| 632 |
top = get_top_margin(); |
| 633 |
lft = get_left_margin(); |
| 634 |
rgt = get_right_margin(); |
| 635 |
|
| 636 |
final = (rgt - lft + 1) / 4; |
| 637 |
|
| 638 |
set_colors(WHITE_ON_BLUE); |
| 639 |
|
| 640 |
for (n = final; n > 0; n--) { |
| 641 |
slowly(); |
| 642 |
cup(top, lft); |
| 643 |
if (n != final) { |
| 644 |
for (m = 0; m < 4; m++) |
| 645 |
decbi(); |
| 646 |
} |
| 647 |
printxx("%3d", n); |
| 648 |
} |
| 649 |
|
| 650 |
reset_colors(); |
| 651 |
|
| 652 |
test_with_margins(0); |
| 653 |
|
| 654 |
vt_move(last, 1); |
| 655 |
vt_clear(0); |
| 656 |
|
| 657 |
println(the_title); |
| 658 |
println("If your terminal supports DECBI (backward index), then the top row"); |
| 659 |
printxx("should be numbered 1 through %d.\n", final); |
| 660 |
return MENU_HOLD; |
| 661 |
} |
| 662 |
|
| 663 |
static int |
| 664 |
tst_DECBKM(MENU_ARGS) |
| 665 |
{ |
| 666 |
int row, col; |
| 667 |
const char *report; |
| 668 |
|
| 669 |
vt_move(1, 1); |
| 670 |
println(the_title); |
| 671 |
|
| 672 |
set_tty_raw(TRUE); |
| 673 |
set_tty_echo(FALSE); |
| 674 |
|
| 675 |
reset_inchar(); |
| 676 |
decbkm(TRUE); |
| 677 |
println("Press the backspace key"); |
| 678 |
vt_move(row = 3, col = 10); |
| 679 |
report = instr(); |
| 680 |
chrprint2(report, row, col); |
| 681 |
show_result(!strcmp(report, "\010") ? SHOW_SUCCESS : SHOW_FAILURE); |
| 682 |
|
| 683 |
reset_inchar(); |
| 684 |
vt_move(5, 1); |
| 685 |
decbkm(FALSE); |
| 686 |
println("Press the backspace key again"); |
| 687 |
vt_move(row = 6, col = 10); |
| 688 |
report = instr(); |
| 689 |
chrprint2(report, row, col); |
| 690 |
show_result(!strcmp(report, "\177") ? SHOW_SUCCESS : SHOW_FAILURE); |
| 691 |
|
| 692 |
vt_move(max_lines - 1, 1); |
| 693 |
restore_ttymodes(); |
| 694 |
return MENU_HOLD; |
| 695 |
} |
| 696 |
|
| 697 |
/* |
| 698 |
* VT400 & up |
| 699 |
* Change Attributes in Rectangular Area |
| 700 |
*/ |
| 701 |
static int |
| 702 |
tst_DECCARA(MENU_ARGS) |
| 703 |
{ |
| 704 |
int last = max_lines - 4; |
| 705 |
BOX box; |
| 706 |
|
| 707 |
setup_rectangle(&box, last); |
| 708 |
|
| 709 |
test_with_margins(1); |
| 710 |
|
| 711 |
set_colors(WHITE_ON_BLUE); |
| 712 |
|
| 713 |
decsace(TRUE); |
| 714 |
fill_screen(); |
| 715 |
deccara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ |
| 716 |
deccara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 0); /* invert a rectangle) */ |
| 717 |
|
| 718 |
test_with_margins(0); |
| 719 |
sgr("0"); |
| 720 |
vt_move(last, 1); |
| 721 |
vt_clear(0); |
| 722 |
|
| 723 |
println(the_title); |
| 724 |
println("There should be an open rectangle formed by reverse-video E's"); |
| 725 |
holdit(); |
| 726 |
|
| 727 |
test_with_margins(2); |
| 728 |
decsace(FALSE); |
| 729 |
fill_screen(); |
| 730 |
deccara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ |
| 731 |
deccara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 0); /* invert a rectangle) */ |
| 732 |
|
| 733 |
sgr("0"); |
| 734 |
|
| 735 |
test_with_margins(0); |
| 736 |
|
| 737 |
vt_move(last, 1); |
| 738 |
vt_clear(0); |
| 739 |
|
| 740 |
println(the_title); |
| 741 |
println("There should be an open rectangle formed by reverse-video E's"); |
| 742 |
println("combined with wrapping at the margins."); |
| 743 |
return MENU_HOLD; |
| 744 |
} |
| 745 |
|
| 746 |
#define fmt_DECCKSR "Testing DECCKSR: %s" |
| 747 |
|
| 748 |
static int |
| 749 |
parse_DECCKSR(char *report, int Pid, int *digits, int *checksum) |
| 750 |
{ |
| 751 |
int result = 0; |
| 752 |
int pos = 0; |
| 753 |
int actual; |
| 754 |
const char *after; |
| 755 |
const char *before; |
| 756 |
|
| 757 |
if ((report = skip_dcs(report)) != NULL |
| 758 |
&& strip_terminator(report) |
| 759 |
&& strlen(report) > 1 |
| 760 |
&& scanto(report, &pos, '!') == Pid |
| 761 |
&& report[pos++] == '~' |
| 762 |
&& (after = skip_xdigits((before = report + pos), &actual)) != NULL |
| 763 |
&& *after == '\0') { |
| 764 |
result = 1; |
| 765 |
*digits = (int) (after - before); |
| 766 |
*checksum = actual; |
| 767 |
} |
| 768 |
return result; |
| 769 |
} |
| 770 |
|
| 771 |
static char * |
| 772 |
check_DECCKSR(char *target, char *source, int Pid, int expected) |
| 773 |
{ |
| 774 |
int digits; |
| 775 |
int actual; |
| 776 |
|
| 777 |
if (parse_DECCKSR(source, Pid, &digits, &actual)) { |
| 778 |
if (digits != 4) { |
| 779 |
sprintf(target, "%s: expected 4 digits", SHOW_FAILURE); |
| 780 |
} else if (expected < 0 || (actual == expected)) { |
| 781 |
strcpy(target, SHOW_SUCCESS); |
| 782 |
} else { |
| 783 |
sprintf(target, "expected %04X", (expected & 0xffff)); |
| 784 |
} |
| 785 |
} else { |
| 786 |
strcpy(target, SHOW_FAILURE); |
| 787 |
} |
| 788 |
return target; |
| 789 |
} |
| 790 |
|
| 791 |
static int |
| 792 |
tst_DECCKSR(MENU_ARGS, int Pid, const char *the_csi, int expected) |
| 793 |
{ |
| 794 |
char *report; |
| 795 |
int row, col; |
| 796 |
char temp[80]; |
| 797 |
|
| 798 |
vt_move(1, 1); |
| 799 |
printxx(fmt_DECCKSR, the_title); |
| 800 |
|
| 801 |
set_tty_raw(TRUE); |
| 802 |
set_tty_echo(FALSE); |
| 803 |
|
| 804 |
do_csi("%s", the_csi); |
| 805 |
report = get_reply(); |
| 806 |
vt_move(row = 3, col = 10); |
| 807 |
chrprint2(report, row, col); |
| 808 |
show_result("%s", check_DECCKSR(temp, report, Pid, expected)); |
| 809 |
|
| 810 |
restore_ttymodes(); |
| 811 |
vt_move(max_lines - 1, 1); |
| 812 |
return MENU_HOLD; |
| 813 |
} |
| 814 |
|
| 815 |
/* |
| 816 |
* VT400 & up. |
| 817 |
* Copy Rectangular area |
| 818 |
*/ |
| 819 |
static int |
| 820 |
tst_DECCRA(MENU_ARGS) |
| 821 |
{ |
| 822 |
#define adj_y 3 |
| 823 |
#define adj_x 4 |
| 824 |
#define adj_DECCRA " (down %d, right %d)\r\n", box.bottom + 1 - box.top, box.right + 1 - box.left, adj_y, adj_x |
| 825 |
#define msg_DECCRA(msg) "The %dx%d box " msg adj_DECCRA |
| 826 |
BOX box; |
| 827 |
int hmargin = origin_mode ? ((get_right_margin() * 3) / 8) : 30; |
| 828 |
int vmargin = origin_mode ? ((get_bottom_margin(max_lines) * 2) / 5) : 10; |
| 829 |
int last = max_lines - 3; |
| 830 |
|
| 831 |
if (make_box_params(&box, vmargin, hmargin) == 0) { |
| 832 |
box.top = 5; |
| 833 |
box.left = 5; |
| 834 |
|
| 835 |
test_with_margins(1); |
| 836 |
|
| 837 |
if (do_colors) { |
| 838 |
set_colors(WHITE_ON_BLUE); |
| 839 |
} else { |
| 840 |
sgr(BLINK_REVERSE); |
| 841 |
} |
| 842 |
draw_box_outline(&box, do_lines ? -1 : '*'); |
| 843 |
sgr("0"); |
| 844 |
|
| 845 |
test_with_margins(0); |
| 846 |
|
| 847 |
vt_move(last, 1); |
| 848 |
println(the_title); |
| 849 |
tprintf(msg_DECCRA("will be copied")); |
| 850 |
holdit(); |
| 851 |
|
| 852 |
test_with_margins(2); |
| 853 |
|
| 854 |
deccra(box.top, box.left, box.bottom, box.right, 1, |
| 855 |
box.top + adj_y, box.left + adj_x, 1); |
| 856 |
|
| 857 |
test_with_margins(0); |
| 858 |
|
| 859 |
vt_move(last, 1); |
| 860 |
vt_clear(0); |
| 861 |
|
| 862 |
tprintf(msg_DECCRA("should be copied, overlapping")); |
| 863 |
holdit(); |
| 864 |
|
| 865 |
test_with_margins(2); |
| 866 |
|
| 867 |
make_box_params(&box, vmargin, hmargin); |
| 868 |
box.top = 5; |
| 869 |
box.left = 5; |
| 870 |
|
| 871 |
if (do_colors) { |
| 872 |
set_colors(YELLOW_ON_BLACK); |
| 873 |
} else { |
| 874 |
sgr("0;7"); /* fill the box in reverse */ |
| 875 |
} |
| 876 |
draw_box_filled(&box, -1); |
| 877 |
|
| 878 |
if (do_colors) { |
| 879 |
set_colors(WHITE_ON_BLUE); |
| 880 |
} else { |
| 881 |
sgr(BLINK_REVERSE); |
| 882 |
} |
| 883 |
draw_box_outline(&box, do_lines ? -1 : '*'); |
| 884 |
sgr("0"); |
| 885 |
|
| 886 |
test_with_margins(0); |
| 887 |
|
| 888 |
vt_move(last, 1); |
| 889 |
println(the_title); |
| 890 |
tprintf(msg_DECCRA("will be copied")); |
| 891 |
holdit(); |
| 892 |
|
| 893 |
test_with_margins(2); |
| 894 |
|
| 895 |
sgr("0;4"); /* set underline, to check if that leaks through */ |
| 896 |
deccra(box.top, box.left, box.bottom, box.right, 1, |
| 897 |
box.top + adj_y, box.left + adj_x, 1); |
| 898 |
sgr("0"); |
| 899 |
|
| 900 |
test_with_margins(0); |
| 901 |
|
| 902 |
vt_move(last, 1); |
| 903 |
vt_clear(0); |
| 904 |
|
| 905 |
tprintf(msg_DECCRA("should be copied, overlapping")); |
| 906 |
} |
| 907 |
return MENU_HOLD; |
| 908 |
} |
| 909 |
|
| 910 |
static int |
| 911 |
marker_of(int n) |
| 912 |
{ |
| 913 |
return (n - 1) % 26 + 'a'; |
| 914 |
} |
| 915 |
|
| 916 |
/* |
| 917 |
* VT400 & up. |
| 918 |
* Delete column. |
| 919 |
*/ |
| 920 |
static int |
| 921 |
tst_DECDC(MENU_ARGS) |
| 922 |
{ |
| 923 |
int n; |
| 924 |
int last = max_lines - 3; |
| 925 |
int base_row; |
| 926 |
int base_col; |
| 927 |
int left_col; |
| 928 |
int last_row; |
| 929 |
int real_col; |
| 930 |
int top; |
| 931 |
int bot; |
| 932 |
int lft; |
| 933 |
int rgt; |
| 934 |
int final_dc; |
| 935 |
char mark_1st = 0; |
| 936 |
char mark_2nd = 0; |
| 937 |
|
| 938 |
test_with_margins(1); |
| 939 |
|
| 940 |
set_colors(WHITE_ON_BLUE); |
| 941 |
|
| 942 |
top = get_top_margin(); |
| 943 |
lft = get_left_margin(); |
| 944 |
rgt = get_right_margin(); |
| 945 |
bot = get_bottom_margin(last - 1); |
| 946 |
|
| 947 |
/* |
| 948 |
* Adjustments so that most of the initial line (before shifting) passes |
| 949 |
* through the area within margins. |
| 950 |
*/ |
| 951 |
if (origin_mode) { |
| 952 |
base_row = 0; |
| 953 |
if (lrmm_flag) { |
| 954 |
left_col = 1; |
| 955 |
switch (tb_marg_flag) { |
| 956 |
default: |
| 957 |
last_row = bot; |
| 958 |
break; |
| 959 |
case marReset: |
| 960 |
case marLast: |
| 961 |
last_row = bot - 3; |
| 962 |
break; |
| 963 |
} |
| 964 |
base_col = rgt - (bot - top) + last_row; |
| 965 |
if (base_col < 0) |
| 966 |
base_col = 0; |
| 967 |
if (base_col > rgt) |
| 968 |
base_col = rgt; |
| 969 |
real_col = lr_marg1 + lft - (lr_marg1 != 0); |
| 970 |
} else { |
| 971 |
last_row = last; |
| 972 |
base_col = (2 * last); |
| 973 |
left_col = 1; |
| 974 |
real_col = lft; |
| 975 |
} |
| 976 |
} else { |
| 977 |
switch (lr_marg_flag) { |
| 978 |
default: |
| 979 |
base_col = (2 * last); |
| 980 |
left_col = 1; |
| 981 |
break; |
| 982 |
case marFirst: |
| 983 |
base_col = (min_cols / 2); |
| 984 |
left_col = 1; |
| 985 |
break; |
| 986 |
case marMiddle: |
| 987 |
base_col = (3 * min_cols) / 4; |
| 988 |
left_col = (min_cols / 4) + 1; |
| 989 |
break; |
| 990 |
case marLast: |
| 991 |
base_col = min_cols + 0; |
| 992 |
left_col = (min_cols / 2) + 1; |
| 993 |
break; |
| 994 |
} |
| 995 |
if (tb_marg_flag == marLast) { |
| 996 |
base_row = max_lines / 2; |
| 997 |
} else { |
| 998 |
base_row = 0; |
| 999 |
} |
| 1000 |
last_row = last; |
| 1001 |
real_col = lft; |
| 1002 |
} |
| 1003 |
|
| 1004 |
final_dc = base_col - 1; |
| 1005 |
|
| 1006 |
for (n = 1; n < last_row; n++) { |
| 1007 |
int row = base_row + n; |
| 1008 |
int col = base_col - n; |
| 1009 |
|
| 1010 |
if (row <= last_row) { |
| 1011 |
int mark = marker_of(n); |
| 1012 |
|
| 1013 |
if (row >= top && row <= bot && row < last_row) { |
| 1014 |
mark_2nd = (char) mark; |
| 1015 |
if (mark_1st == 0) { |
| 1016 |
mark_1st = (char) mark; |
| 1017 |
} |
| 1018 |
} |
| 1019 |
|
| 1020 |
slowly(); |
| 1021 |
__(cup(row, col), print_chr(mark)); |
| 1022 |
if (top > 1 || (lrmm_flag && lft > 1)) { |
| 1023 |
__(cup(1, 1), decdc(1)); /* outside margins, should be ignored */ |
| 1024 |
__(cup(row, col), print_chr(mark)); |
| 1025 |
} |
| 1026 |
if (final_dc-- > left_col) |
| 1027 |
__(cup(top, lft), decdc(1)); |
| 1028 |
} |
| 1029 |
} |
| 1030 |
if (final_dc > left_col) { |
| 1031 |
slowly(); |
| 1032 |
__(cup(top, lft), decdc(final_dc - left_col)); |
| 1033 |
} |
| 1034 |
|
| 1035 |
reset_colors(); |
| 1036 |
|
| 1037 |
test_with_margins(0); |
| 1038 |
|
| 1039 |
ruler(last, min_cols); |
| 1040 |
vt_move(last + 1, 1); |
| 1041 |
vt_clear(0); |
| 1042 |
|
| 1043 |
tprintf("If your terminal supports DECDC, letters %c-%c are on column %d\n", |
| 1044 |
mark_1st, mark_2nd, real_col); |
| 1045 |
return MENU_HOLD; |
| 1046 |
} |
| 1047 |
|
| 1048 |
static void |
| 1049 |
show_DECERA(MENU_ARGS, const char *color_name, const char *color_value) |
| 1050 |
{ |
| 1051 |
int last = max_lines - 3; |
| 1052 |
BOX box; |
| 1053 |
|
| 1054 |
setup_rectangle(&box, last); |
| 1055 |
|
| 1056 |
fill_screen(); |
| 1057 |
|
| 1058 |
test_with_margins(1); |
| 1059 |
|
| 1060 |
set_colors(color_value); |
| 1061 |
|
| 1062 |
decera(box.top, box.left, box.bottom, box.right); |
| 1063 |
|
| 1064 |
sgr("0"); |
| 1065 |
|
| 1066 |
test_with_margins(0); |
| 1067 |
|
| 1068 |
vt_move(last, 1); |
| 1069 |
vt_clear(0); |
| 1070 |
|
| 1071 |
println(the_title); |
| 1072 |
tprintf("There should be a%s rectangle cleared in the middle of the %s.\r\n", |
| 1073 |
color_name, |
| 1074 |
origin_mode ? "margins" : "screen"); |
| 1075 |
} |
| 1076 |
|
| 1077 |
/* |
| 1078 |
* VT400 & up |
| 1079 |
* Erase Rectangular area |
| 1080 |
*/ |
| 1081 |
static int |
| 1082 |
tst_DECERA(MENU_ARGS) |
| 1083 |
{ |
| 1084 |
if (do_colors) { |
| 1085 |
show_DECERA(PASS_ARGS, " blue", WHITE_ON_BLUE); |
| 1086 |
holdit(); |
| 1087 |
show_DECERA(PASS_ARGS, " green", WHITE_ON_GREEN); |
| 1088 |
} else { |
| 1089 |
show_DECERA(PASS_ARGS, "", WHITE_ON_BLUE); |
| 1090 |
} |
| 1091 |
return MENU_HOLD; |
| 1092 |
} |
| 1093 |
|
| 1094 |
/* |
| 1095 |
* This is two tests: IND (index) and RI (reverse index). For each test, we |
| 1096 |
* start by filling the area inside (including) the margins with a test |
| 1097 |
* pattern, and then after the user presses "return", update the screen so that |
| 1098 |
* only one line of the test-pattern should remain visible. |
| 1099 |
*/ |
| 1100 |
static int |
| 1101 |
tst_IND_RI(MENU_ARGS) |
| 1102 |
{ |
| 1103 |
int hold_row = get_hold_row(); |
| 1104 |
int hold_col = get_hold_col(); /* where to put "Push RETURN" */ |
| 1105 |
int row; |
| 1106 |
int top = get_top_margin(); |
| 1107 |
int bot = get_bottom_margin(max_lines); |
| 1108 |
int lft = get_left_margin(); |
| 1109 |
int rgt = get_right_margin(); |
| 1110 |
|
| 1111 |
test_with_margins(1); |
| 1112 |
|
| 1113 |
fill_margins(); |
| 1114 |
|
| 1115 |
set_colors(NULL); |
| 1116 |
special_prompt(hold_row, hold_col, NULL); |
| 1117 |
|
| 1118 |
set_colors(WHITE_ON_GREEN); |
| 1119 |
cup(bot, (lft + rgt) / 2); |
| 1120 |
for (row = top; row < bot; ++row) { |
| 1121 |
slowly(); |
| 1122 |
ind(); |
| 1123 |
} |
| 1124 |
|
| 1125 |
set_colors(NULL); |
| 1126 |
special_prompt(hold_row, hold_col, "\"abcd...\" should be at top. "); |
| 1127 |
|
| 1128 |
fill_margins(); |
| 1129 |
fill_outside('.'); |
| 1130 |
|
| 1131 |
set_colors(NULL); |
| 1132 |
special_prompt(hold_row, hold_col, NULL); |
| 1133 |
|
| 1134 |
set_colors(WHITE_ON_GREEN); |
| 1135 |
cup(top, (lft + rgt) / 2); |
| 1136 |
for (row = top; row < bot; ++row) { |
| 1137 |
slowly(); |
| 1138 |
ri(); |
| 1139 |
} |
| 1140 |
|
| 1141 |
set_colors(NULL); |
| 1142 |
special_prompt(hold_row, hold_col, "\"0123...\" should be at bottom. "); |
| 1143 |
|
| 1144 |
test_with_margins(0); |
| 1145 |
|
| 1146 |
return MENU_NOHOLD; |
| 1147 |
} |
| 1148 |
|
| 1149 |
static int |
| 1150 |
tst_IL_DL(MENU_ARGS) |
| 1151 |
{ |
| 1152 |
int hold_row = get_hold_row(); |
| 1153 |
int hold_col = get_hold_col(); /* where to put "Push RETURN" */ |
| 1154 |
int row; |
| 1155 |
int top = get_top_margin(); |
| 1156 |
int bot = get_bottom_margin(max_lines); |
| 1157 |
int lft = get_left_margin(); |
| 1158 |
int rgt = get_right_margin(); |
| 1159 |
|
| 1160 |
test_with_margins(1); |
| 1161 |
|
| 1162 |
fill_margins(); |
| 1163 |
|
| 1164 |
set_colors(NULL); |
| 1165 |
special_prompt(hold_row, hold_col, NULL); |
| 1166 |
|
| 1167 |
/* |
| 1168 |
* This should be ignored because it is outside margins. |
| 1169 |
*/ |
| 1170 |
set_colors(WHITE_ON_GREEN); |
| 1171 |
if (!origin_mode) { |
| 1172 |
if (top > 1) { |
| 1173 |
cup(top - 1, lft); |
| 1174 |
il(1); |
| 1175 |
} else if (bot < max_lines) { |
| 1176 |
cup(bot + 1, lft); |
| 1177 |
il(1); |
| 1178 |
} else if (lft > 1) { |
| 1179 |
cup(top, lft - 1); |
| 1180 |
il(1); |
| 1181 |
} else if (rgt < min_cols) { |
| 1182 |
cup(top, rgt + 1); |
| 1183 |
il(1); |
| 1184 |
} |
| 1185 |
} |
| 1186 |
|
| 1187 |
cup(top, (lft + rgt) / 2); |
| 1188 |
for (row = top; row < bot;) { |
| 1189 |
int skip = (row % 2) + 1; |
| 1190 |
row += skip; |
| 1191 |
if (row >= bot) |
| 1192 |
skip = 1; |
| 1193 |
slowly(); |
| 1194 |
il(skip); |
| 1195 |
} |
| 1196 |
|
| 1197 |
set_colors(NULL); |
| 1198 |
special_prompt(hold_row, hold_col, "\"0123...\" should be at bottom. "); |
| 1199 |
|
| 1200 |
fill_margins(); |
| 1201 |
fill_outside('.'); |
| 1202 |
|
| 1203 |
set_colors(NULL); |
| 1204 |
special_prompt(hold_row, hold_col, NULL); |
| 1205 |
|
| 1206 |
set_colors(WHITE_ON_GREEN); |
| 1207 |
cup(top, (lft + rgt) / 2); |
| 1208 |
for (row = top; row < bot;) { |
| 1209 |
int skip = (row % 2) + 1; |
| 1210 |
row += skip; |
| 1211 |
if (row >= bot) |
| 1212 |
skip = 1; |
| 1213 |
slowly(); |
| 1214 |
dl(skip); |
| 1215 |
} |
| 1216 |
|
| 1217 |
set_colors(NULL); |
| 1218 |
special_prompt(hold_row, hold_col, "\"abcd...\" should be at top. "); |
| 1219 |
|
| 1220 |
test_with_margins(0); |
| 1221 |
|
| 1222 |
return MENU_NOHOLD; |
| 1223 |
} |
| 1224 |
|
| 1225 |
static int |
| 1226 |
tst_ICH_DCH(MENU_ARGS) |
| 1227 |
{ |
| 1228 |
int n; |
| 1229 |
int last = max_lines - 3; |
| 1230 |
int base_row; |
| 1231 |
int base_col; |
| 1232 |
int last_row; |
| 1233 |
int real_col; |
| 1234 |
int top; |
| 1235 |
int bot; |
| 1236 |
int lft; |
| 1237 |
int rgt; |
| 1238 |
char mark_1st = 0; |
| 1239 |
char mark_2nd = 0; |
| 1240 |
|
| 1241 |
test_with_margins(1); |
| 1242 |
|
| 1243 |
set_colors(WHITE_ON_BLUE); |
| 1244 |
|
| 1245 |
top = get_top_margin(); |
| 1246 |
bot = get_bottom_margin(last - 1); |
| 1247 |
lft = get_left_margin(); |
| 1248 |
rgt = get_right_margin(); |
| 1249 |
|
| 1250 |
/* |
| 1251 |
* Adjustments so that most of the initial line (before shifting) passes |
| 1252 |
* through the area within margins. |
| 1253 |
*/ |
| 1254 |
if (origin_mode) { |
| 1255 |
base_row = 0; |
| 1256 |
if (lrmm_flag) { |
| 1257 |
base_col = rgt - (bot - top) - 2; |
| 1258 |
if (base_col < 0) |
| 1259 |
base_col = 0; |
| 1260 |
switch (tb_marg_flag) { |
| 1261 |
default: |
| 1262 |
last_row = bot; |
| 1263 |
break; |
| 1264 |
case marReset: |
| 1265 |
case marLast: |
| 1266 |
last_row = bot - 3; |
| 1267 |
break; |
| 1268 |
} |
| 1269 |
real_col = rgt + lr_marg1 - (lr_marg1 != 0); |
| 1270 |
} else { |
| 1271 |
last_row = last; |
| 1272 |
base_col = (2 * last); |
| 1273 |
real_col = rgt; |
| 1274 |
} |
| 1275 |
} else { |
| 1276 |
switch (lr_marg_flag) { |
| 1277 |
default: |
| 1278 |
base_col = (2 * last); |
| 1279 |
break; |
| 1280 |
case marFirst: |
| 1281 |
base_col = 0; |
| 1282 |
break; |
| 1283 |
case marMiddle: |
| 1284 |
base_col = min_cols / 4; |
| 1285 |
break; |
| 1286 |
case marLast: |
| 1287 |
base_col = (min_cols / 2); |
| 1288 |
break; |
| 1289 |
} |
| 1290 |
if (tb_marg_flag == marLast) { |
| 1291 |
base_row = max_lines / 2; |
| 1292 |
} else { |
| 1293 |
base_row = 0; |
| 1294 |
} |
| 1295 |
last_row = last; |
| 1296 |
real_col = rgt; |
| 1297 |
} |
| 1298 |
|
| 1299 |
for (n = 1; n < last_row; n++) { |
| 1300 |
int row = base_row + n; |
| 1301 |
int col = base_col + n; |
| 1302 |
|
| 1303 |
if (row < last_row) { |
| 1304 |
int mark = marker_of(n); |
| 1305 |
|
| 1306 |
if (row >= top && row <= bot) { |
| 1307 |
mark_2nd = (char) mark; |
| 1308 |
if (mark_1st == 0) { |
| 1309 |
mark_1st = (char) mark; |
| 1310 |
} |
| 1311 |
} |
| 1312 |
|
| 1313 |
slowly(); |
| 1314 |
__(cup(row, col), print_chr(mark)); |
| 1315 |
if (col < rgt) { |
| 1316 |
cup(row, lft); |
| 1317 |
print_chr('?'); |
| 1318 |
cup(row, lft); |
| 1319 |
ich(rgt - col); |
| 1320 |
} |
| 1321 |
} |
| 1322 |
} |
| 1323 |
|
| 1324 |
reset_colors(); |
| 1325 |
|
| 1326 |
test_with_margins(0); |
| 1327 |
|
| 1328 |
ruler(last, min_cols); |
| 1329 |
vt_move(last + 1, 1); |
| 1330 |
vt_clear(0); |
| 1331 |
|
| 1332 |
tprintf("If your terminal supports ICH, letters %c-%c are on column %d\n", |
| 1333 |
mark_1st, mark_2nd, real_col); |
| 1334 |
holdit(); |
| 1335 |
|
| 1336 |
vt_clear(0); |
| 1337 |
test_with_margins(1); |
| 1338 |
|
| 1339 |
set_colors(WHITE_ON_BLUE); |
| 1340 |
|
| 1341 |
/* |
| 1342 |
* Adjustments so that most of the initial line (before shifting) passes |
| 1343 |
* through the area within margins. |
| 1344 |
*/ |
| 1345 |
if (origin_mode) { |
| 1346 |
base_row = 0; |
| 1347 |
if (lrmm_flag) { |
| 1348 |
switch (tb_marg_flag) { |
| 1349 |
default: |
| 1350 |
last_row = bot; |
| 1351 |
break; |
| 1352 |
case marReset: |
| 1353 |
case marLast: |
| 1354 |
last_row = bot - 3; |
| 1355 |
break; |
| 1356 |
} |
| 1357 |
base_col = rgt - (bot - top) + last_row; |
| 1358 |
if (base_col < 0) |
| 1359 |
base_col = 0; |
| 1360 |
if (base_col > rgt) |
| 1361 |
base_col = rgt; |
| 1362 |
real_col = lr_marg1 + lft - (lr_marg1 != 0); |
| 1363 |
} else { |
| 1364 |
last_row = last; |
| 1365 |
base_col = (2 * last); |
| 1366 |
real_col = lft; |
| 1367 |
} |
| 1368 |
} else { |
| 1369 |
switch (lr_marg_flag) { |
| 1370 |
default: |
| 1371 |
base_col = (2 * last); |
| 1372 |
break; |
| 1373 |
case marFirst: |
| 1374 |
base_col = (min_cols / 2); |
| 1375 |
break; |
| 1376 |
case marMiddle: |
| 1377 |
base_col = (3 * min_cols) / 4; |
| 1378 |
break; |
| 1379 |
case marLast: |
| 1380 |
base_col = min_cols + 0; |
| 1381 |
break; |
| 1382 |
} |
| 1383 |
if (tb_marg_flag == marLast) { |
| 1384 |
base_row = max_lines / 2; |
| 1385 |
} else { |
| 1386 |
base_row = 0; |
| 1387 |
} |
| 1388 |
last_row = last; |
| 1389 |
real_col = lft; |
| 1390 |
} |
| 1391 |
|
| 1392 |
for (n = 1; n < last_row; n++) { |
| 1393 |
int row = base_row + n; |
| 1394 |
int col = base_col - n; |
| 1395 |
|
| 1396 |
if (row <= last_row) { |
| 1397 |
int mark = marker_of(n); |
| 1398 |
|
| 1399 |
if (row >= top && row <= bot && row < last_row) { |
| 1400 |
mark_2nd = (char) mark; |
| 1401 |
if (mark_1st == 0) { |
| 1402 |
mark_1st = (char) mark; |
| 1403 |
} |
| 1404 |
} |
| 1405 |
|
| 1406 |
__(cup(row, col), print_chr(mark)); |
| 1407 |
slowly(); |
| 1408 |
if (col < rgt) |
| 1409 |
ech(rgt - col); |
| 1410 |
if (col > lft) { |
| 1411 |
cup(row, lft); |
| 1412 |
dch(col - lft); |
| 1413 |
} else { |
| 1414 |
cup(row, 1); |
| 1415 |
dch(col - 1); |
| 1416 |
} |
| 1417 |
} |
| 1418 |
} |
| 1419 |
|
| 1420 |
reset_colors(); |
| 1421 |
|
| 1422 |
test_with_margins(0); |
| 1423 |
|
| 1424 |
ruler(last, min_cols); |
| 1425 |
vt_move(last + 1, 1); |
| 1426 |
vt_clear(0); |
| 1427 |
|
| 1428 |
tprintf("If your terminal supports DCH, letters %c-%c are on column %d\n", |
| 1429 |
mark_1st, mark_2nd, real_col); |
| 1430 |
return MENU_HOLD; |
| 1431 |
} |
| 1432 |
|
| 1433 |
/* |
| 1434 |
* Check to see if ASCII formatting controls (BS, HT, CR) are affected by |
| 1435 |
* left/right margins. Do this by starting after the left-margin, and |
| 1436 |
* backspacing "before" the left margin. Then fill the margins with a usable |
| 1437 |
* test pattern. After that, use tabs to go to the right margin, adding |
| 1438 |
* another usable test (+), and use carriage returns to go to the left margin, |
| 1439 |
* adding another usable test (-). |
| 1440 |
*/ |
| 1441 |
static int |
| 1442 |
tst_ASCII_format(MENU_ARGS) |
| 1443 |
{ |
| 1444 |
int last = max_lines - 4; |
| 1445 |
int top; |
| 1446 |
int bot; |
| 1447 |
int lft; |
| 1448 |
int rgt; |
| 1449 |
int n; |
| 1450 |
int tab; |
| 1451 |
int size; |
| 1452 |
|
| 1453 |
test_with_margins(1); |
| 1454 |
|
| 1455 |
top = get_top_margin(); |
| 1456 |
bot = get_bottom_margin(last - 1); |
| 1457 |
lft = get_left_margin(); |
| 1458 |
rgt = get_right_margin(); |
| 1459 |
|
| 1460 |
/* |
| 1461 |
* This should stop at the left margin, and the result overwritten by a |
| 1462 |
* fill-pattern. |
| 1463 |
*/ |
| 1464 |
set_colors(WHITE_ON_BLUE); |
| 1465 |
cup(top, rgt); |
| 1466 |
for (n = 0; n < rgt; ++n) { |
| 1467 |
tprintf("*%c%c", BS, BS); |
| 1468 |
} |
| 1469 |
|
| 1470 |
/* |
| 1471 |
* Fill the margins with a repeating pattern. Do it twice, to force it to |
| 1472 |
* scroll up. |
| 1473 |
*/ |
| 1474 |
set_colors(WHITE_ON_GREEN); |
| 1475 |
size = 2 * (rgt - lft + 1) * (bot - top + 1); |
| 1476 |
for (n = 0; n < size; ++n) { |
| 1477 |
int ch = ((n % 10) ? ((n % 10) + '0') : '_'); |
| 1478 |
putchar(ch); |
| 1479 |
} |
| 1480 |
|
| 1481 |
/* |
| 1482 |
* Mark the margins with '-' (left) and '+' (right). |
| 1483 |
*/ |
| 1484 |
set_colors(YELLOW_ON_BLACK); |
| 1485 |
cup(top, lft); |
| 1486 |
for (n = top; n <= bot; ++n) { |
| 1487 |
for (tab = 0; tab < (rgt - lft + 16) / TABWIDTH; ++tab) { |
| 1488 |
putchar(TAB); |
| 1489 |
} |
| 1490 |
putchar('+'); |
| 1491 |
putchar(CR); |
| 1492 |
putchar('-'); |
| 1493 |
putchar(TAB); |
| 1494 |
putchar('*'); |
| 1495 |
if (n < bot) { |
| 1496 |
putchar(LF); |
| 1497 |
} |
| 1498 |
} |
| 1499 |
|
| 1500 |
test_with_margins(0); |
| 1501 |
|
| 1502 |
set_colors("0"); |
| 1503 |
|
| 1504 |
vt_move(last, 1); |
| 1505 |
vt_clear(0); |
| 1506 |
|
| 1507 |
ruler(last, min_cols); |
| 1508 |
println(the_title); |
| 1509 |
println("A repeating \"0123456789_\" pattern should fall within the -/+ margins"); |
| 1510 |
return MENU_HOLD; |
| 1511 |
} |
| 1512 |
|
| 1513 |
/* |
| 1514 |
* VT400 & up. |
| 1515 |
* |
| 1516 |
* DECFI - Forward Index |
| 1517 |
* This control function moves the column forward one column. If the cursor is |
| 1518 |
* at the right margin, then all screen data within the margins moves one |
| 1519 |
* column to the left. The column shifted past the left margin is lost. |
| 1520 |
* |
| 1521 |
* Format: ESC 9 |
| 1522 |
* Description: |
| 1523 |
* DECFI adds a new column at the right margin with no visual attributes. |
| 1524 |
* DECFI is not affected by the margins. If the cursor is at the right border |
| 1525 |
* of the page when the terminal receives DECFI, then the terminal ignores |
| 1526 |
* DECFI. |
| 1527 |
*/ |
| 1528 |
static int |
| 1529 |
tst_DECFI(MENU_ARGS) |
| 1530 |
{ |
| 1531 |
int n, m; |
| 1532 |
int last = max_lines - 4; |
| 1533 |
int final; |
| 1534 |
int top; |
| 1535 |
int lft; |
| 1536 |
int rgt; |
| 1537 |
|
| 1538 |
test_with_margins(1); |
| 1539 |
|
| 1540 |
set_colors(WHITE_ON_BLUE); |
| 1541 |
|
| 1542 |
top = get_top_margin(); |
| 1543 |
lft = get_left_margin(); |
| 1544 |
rgt = get_right_margin(); |
| 1545 |
|
| 1546 |
final = (rgt - lft + 1) / 4; |
| 1547 |
|
| 1548 |
for (n = 1; n <= final; n++) { |
| 1549 |
slowly(); |
| 1550 |
cup(top, rgt - 3); |
| 1551 |
tprintf("%3d", n); /* leaves cursor in rightmost column */ |
| 1552 |
if (n != final) { |
| 1553 |
for (m = 0; m < 4; m++) |
| 1554 |
decfi(); |
| 1555 |
} |
| 1556 |
} |
| 1557 |
|
| 1558 |
reset_colors(); |
| 1559 |
|
| 1560 |
test_with_margins(0); |
| 1561 |
|
| 1562 |
vt_move(last, 1); |
| 1563 |
vt_clear(0); |
| 1564 |
|
| 1565 |
println(the_title); |
| 1566 |
println("If your terminal supports DECFI (forward index), then the top row"); |
| 1567 |
printxx("should be numbered 1 through %d.\n", final); |
| 1568 |
return MENU_HOLD; |
| 1569 |
} |
| 1570 |
|
| 1571 |
/* |
| 1572 |
* Demonstrate whether cursor movement is limited by margins. VT420 manual |
| 1573 |
* says that CUU/CUD will stop on the margins, but if outside the margins |
| 1574 |
* will proceed to the page border. So we can test this by |
| 1575 |
* |
| 1576 |
* a) moving to the margin, and cursor up/down toward the border, placing a |
| 1577 |
* marker at the end of the cursor movement (to overwrite a prior marker placed |
| 1578 |
* explicitly on the border). |
| 1579 |
* |
| 1580 |
* b) repeat the process, going from the border into the area within margins. |
| 1581 |
* |
| 1582 |
* c) Even for the no-margins case, this is useful, since it demonstrates |
| 1583 |
* whether the cursor forces scrolling. |
| 1584 |
*/ |
| 1585 |
static int |
| 1586 |
tst_cursor_margins(MENU_ARGS) |
| 1587 |
{ |
| 1588 |
BOX box; |
| 1589 |
int last = get_hold_row(); |
| 1590 |
int row; |
| 1591 |
int col; |
| 1592 |
|
| 1593 |
test_with_margins(1); |
| 1594 |
|
| 1595 |
box.top = get_top_margin(); |
| 1596 |
box.left = get_left_margin(); |
| 1597 |
box.right = get_right_margin(); |
| 1598 |
box.bottom = get_bottom_margin(max_lines); |
| 1599 |
|
| 1600 |
set_colors(WHITE_ON_BLUE); |
| 1601 |
draw_box_filled(&box, ' '); |
| 1602 |
draw_box_outline(&box, '*'); |
| 1603 |
set_colors(WHITE_ON_GREEN); |
| 1604 |
|
| 1605 |
for (row = box.top; row <= box.bottom; ++row) { |
| 1606 |
cup(row, box.left); |
| 1607 |
for (col = min_cols; col > 0; col--) { |
| 1608 |
cub(1); |
| 1609 |
} |
| 1610 |
putchar('l'); |
| 1611 |
} |
| 1612 |
|
| 1613 |
for (row = box.top; row <= box.bottom; ++row) { |
| 1614 |
cup(row, box.right); |
| 1615 |
for (col = get_left_margin(); col <= min_cols; col++) { |
| 1616 |
cuf(1); |
| 1617 |
} |
| 1618 |
putchar('r'); |
| 1619 |
} |
| 1620 |
|
| 1621 |
for (col = box.left; col <= box.right; ++col) { |
| 1622 |
cup(box.top, col); |
| 1623 |
for (row = box.top; row > 0; row--) { |
| 1624 |
cuu(1); |
| 1625 |
} |
| 1626 |
putchar('u'); |
| 1627 |
} |
| 1628 |
|
| 1629 |
for (col = box.left; col <= box.right; ++col) { |
| 1630 |
cup(box.bottom, col); |
| 1631 |
for (row = box.bottom; row <= max_lines; row++) { |
| 1632 |
cud(1); |
| 1633 |
} |
| 1634 |
putchar('d'); |
| 1635 |
} |
| 1636 |
|
| 1637 |
set_colors("0"); |
| 1638 |
test_with_margins(0); |
| 1639 |
|
| 1640 |
vt_move(last, 1); |
| 1641 |
if (last > box.bottom) |
| 1642 |
vt_clear(0); |
| 1643 |
|
| 1644 |
println(the_title); |
| 1645 |
println("A box of *'s was written on screen border, overwritten using margins (u/d/l/r)"); |
| 1646 |
return MENU_HOLD; |
| 1647 |
} |
| 1648 |
|
| 1649 |
/* |
| 1650 |
* Test movement with other things than cursor controls, i.e., BS, HT, CR, LF, |
| 1651 |
* to see how margins affect them. |
| 1652 |
*/ |
| 1653 |
static int |
| 1654 |
tst_other_margins(MENU_ARGS) |
| 1655 |
{ |
| 1656 |
BOX box; |
| 1657 |
int last = get_hold_row(); |
| 1658 |
int row; |
| 1659 |
int col; |
| 1660 |
|
| 1661 |
test_with_margins(1); |
| 1662 |
|
| 1663 |
box.top = get_top_margin(); |
| 1664 |
box.left = get_left_margin(); |
| 1665 |
box.right = get_right_margin(); |
| 1666 |
box.bottom = get_bottom_margin(max_lines); |
| 1667 |
|
| 1668 |
set_colors(WHITE_ON_BLUE); |
| 1669 |
draw_box_filled(&box, ' '); |
| 1670 |
draw_box_outline(&box, '*'); |
| 1671 |
set_colors(WHITE_ON_GREEN); |
| 1672 |
|
| 1673 |
for (row = box.top; row <= box.bottom; ++row) { |
| 1674 |
cup(row, box.left); |
| 1675 |
for (col = box.left; col > 0; col--) { |
| 1676 |
putchar('\b'); |
| 1677 |
} |
| 1678 |
putchar('l'); |
| 1679 |
} |
| 1680 |
|
| 1681 |
for (row = box.top; row <= box.bottom; ++row) { |
| 1682 |
cup(row, box.right); |
| 1683 |
for (col = 1; col <= min_cols; col++) { |
| 1684 |
putchar('\t'); |
| 1685 |
} |
| 1686 |
putchar('r'); |
| 1687 |
} |
| 1688 |
|
| 1689 |
for (col = box.left; col <= box.right; ++col) { |
| 1690 |
cup(box.top, col); |
| 1691 |
putchar('u'); |
| 1692 |
for (row = box.bottom; row > box.top; row--) { |
| 1693 |
ind(); |
| 1694 |
} |
| 1695 |
} |
| 1696 |
|
| 1697 |
for (col = box.left; col <= box.right; ++col) { |
| 1698 |
switch (col % 4) { |
| 1699 |
case 0: |
| 1700 |
cup(box.bottom, col); |
| 1701 |
putchar('d'); |
| 1702 |
break; |
| 1703 |
case 1: |
| 1704 |
cup(box.top, col); |
| 1705 |
for (row = box.top; row < box.bottom; row++) { |
| 1706 |
putchar('\f'); |
| 1707 |
} |
| 1708 |
putchar('d'); |
| 1709 |
break; |
| 1710 |
case 2: |
| 1711 |
cup(box.top, col); |
| 1712 |
for (row = box.top; row < box.bottom; row++) { |
| 1713 |
nel(); |
| 1714 |
cuf(col - get_left_margin()); |
| 1715 |
} |
| 1716 |
putchar('d'); |
| 1717 |
break; |
| 1718 |
case 3: |
| 1719 |
cup(box.bottom, col); |
| 1720 |
putchar('d'); |
| 1721 |
for (row = box.top; row < box.bottom; row++) { |
| 1722 |
ri(); |
| 1723 |
} |
| 1724 |
putchar('u'); |
| 1725 |
break; |
| 1726 |
} |
| 1727 |
} |
| 1728 |
|
| 1729 |
set_colors("0"); |
| 1730 |
test_with_margins(0); |
| 1731 |
|
| 1732 |
vt_move(last, 1); |
| 1733 |
if (hold_clear()) |
| 1734 |
vt_clear(0); |
| 1735 |
|
| 1736 |
println(the_title); |
| 1737 |
println("A box of *'s was written on screen border, overwritten using margins (u/d/l/r)"); |
| 1738 |
return MENU_HOLD; |
| 1739 |
} |
| 1740 |
|
| 1741 |
/* |
| 1742 |
* VT400 & up |
| 1743 |
* Fill Rectangular area |
| 1744 |
*/ |
| 1745 |
static int |
| 1746 |
tst_DECFRA(MENU_ARGS) |
| 1747 |
{ |
| 1748 |
int last = max_lines - 3; |
| 1749 |
BOX box; |
| 1750 |
|
| 1751 |
setup_rectangle(&box, last); |
| 1752 |
|
| 1753 |
test_with_margins(1); |
| 1754 |
|
| 1755 |
if (do_colors) { |
| 1756 |
set_colors(WHITE_ON_BLUE); |
| 1757 |
vt_clear(2); /* xterm fills the whole screen's background */ |
| 1758 |
set_colors(WHITE_ON_GREEN); |
| 1759 |
} |
| 1760 |
decfra('*', box.top, box.left, box.bottom, box.right); |
| 1761 |
|
| 1762 |
set_colors("0"); |
| 1763 |
|
| 1764 |
test_with_margins(0); |
| 1765 |
|
| 1766 |
vt_move(last, 1); |
| 1767 |
vt_clear(0); |
| 1768 |
|
| 1769 |
println(the_title); |
| 1770 |
if (origin_mode) |
| 1771 |
println("There should be a rectangle of *'s in the middle of the margins."); |
| 1772 |
else |
| 1773 |
println("There should be a rectangle of *'s in the middle of the screen."); |
| 1774 |
holdit(); |
| 1775 |
|
| 1776 |
test_with_margins(2); |
| 1777 |
|
| 1778 |
set_colors(WHITE_ON_BLUE); |
| 1779 |
|
| 1780 |
decfra(' ', box.top, box.left, box.bottom, box.right); |
| 1781 |
sgr("0"); |
| 1782 |
|
| 1783 |
test_with_margins(0); |
| 1784 |
|
| 1785 |
vt_move(last, 1); |
| 1786 |
vt_clear(0); |
| 1787 |
|
| 1788 |
println(the_title); |
| 1789 |
println("The rectangle of *'s should be gone."); |
| 1790 |
return MENU_HOLD; |
| 1791 |
} |
| 1792 |
|
| 1793 |
/* |
| 1794 |
* VT400 & up. |
| 1795 |
* Insert column. |
| 1796 |
*/ |
| 1797 |
static int |
| 1798 |
tst_DECIC(MENU_ARGS) |
| 1799 |
{ |
| 1800 |
int n; |
| 1801 |
int last = max_lines - 3; |
| 1802 |
int base_row; |
| 1803 |
int base_col; |
| 1804 |
int last_row; |
| 1805 |
int last_col; |
| 1806 |
int real_col; |
| 1807 |
int top; |
| 1808 |
int bot; |
| 1809 |
int lft; |
| 1810 |
int rgt; |
| 1811 |
int final_ic; |
| 1812 |
char mark_1st = 0; |
| 1813 |
char mark_2nd = 0; |
| 1814 |
|
| 1815 |
test_with_margins(1); |
| 1816 |
|
| 1817 |
set_colors(WHITE_ON_BLUE); |
| 1818 |
|
| 1819 |
top = get_top_margin(); |
| 1820 |
bot = get_bottom_margin(last - 1); |
| 1821 |
lft = get_left_margin(); |
| 1822 |
rgt = get_right_margin(); |
| 1823 |
|
| 1824 |
/* |
| 1825 |
* Adjustments so that most of the initial line (before shifting) passes |
| 1826 |
* through the area within margins. |
| 1827 |
*/ |
| 1828 |
if (origin_mode) { |
| 1829 |
base_row = 0; |
| 1830 |
if (lrmm_flag) { |
| 1831 |
base_col = rgt - (bot - top) - 2; |
| 1832 |
if (base_col < 0) |
| 1833 |
base_col = 0; |
| 1834 |
last_col = rgt - 1; |
| 1835 |
switch (tb_marg_flag) { |
| 1836 |
default: |
| 1837 |
last_row = bot; |
| 1838 |
break; |
| 1839 |
case marReset: |
| 1840 |
case marLast: |
| 1841 |
last_row = bot - 3; |
| 1842 |
break; |
| 1843 |
} |
| 1844 |
real_col = rgt + lr_marg1 - (lr_marg1 != 0); |
| 1845 |
} else { |
| 1846 |
last_row = last; |
| 1847 |
base_col = (2 * last); |
| 1848 |
last_col = min_cols - 1; |
| 1849 |
real_col = rgt; |
| 1850 |
} |
| 1851 |
} else { |
| 1852 |
if (lrmm_flag) { |
| 1853 |
switch (lr_marg_flag) { |
| 1854 |
default: |
| 1855 |
base_col = (2 * last); |
| 1856 |
last_col = min_cols - 1; |
| 1857 |
break; |
| 1858 |
case marFirst: |
| 1859 |
base_col = 0; |
| 1860 |
last_col = min_cols / 2 - 1; |
| 1861 |
break; |
| 1862 |
case marMiddle: |
| 1863 |
base_col = min_cols / 4; |
| 1864 |
last_col = (3 * min_cols) / 4 - 1; |
| 1865 |
break; |
| 1866 |
case marLast: |
| 1867 |
base_col = (min_cols / 2); |
| 1868 |
last_col = min_cols - 1; |
| 1869 |
break; |
| 1870 |
} |
| 1871 |
} else { |
| 1872 |
base_col = (2 * last); |
| 1873 |
last_col = min_cols - 1; |
| 1874 |
} |
| 1875 |
if (tb_marg_flag == marLast) { |
| 1876 |
base_row = max_lines / 2; |
| 1877 |
} else { |
| 1878 |
base_row = 0; |
| 1879 |
} |
| 1880 |
last_row = last; |
| 1881 |
real_col = rgt; |
| 1882 |
} |
| 1883 |
|
| 1884 |
final_ic = base_col; |
| 1885 |
|
| 1886 |
for (n = 1; n < last_row; n++) { |
| 1887 |
int row = base_row + n; |
| 1888 |
int col = base_col + n; |
| 1889 |
|
| 1890 |
if (row < last_row) { |
| 1891 |
int mark = marker_of(n); |
| 1892 |
|
| 1893 |
if (row >= top && row <= bot) { |
| 1894 |
mark_2nd = (char) mark; |
| 1895 |
if (mark_1st == 0) { |
| 1896 |
mark_1st = (char) mark; |
| 1897 |
} |
| 1898 |
} |
| 1899 |
|
| 1900 |
slowly(); |
| 1901 |
__(cup(row, col), print_chr(mark)); |
| 1902 |
if (!origin_mode && (top > 1 || (lrmm_flag && lft > 1))) { |
| 1903 |
__(cup(1, 1), decic(1)); /* outside margins, should be ignored */ |
| 1904 |
__(cup(row, col), print_chr(mark)); |
| 1905 |
} |
| 1906 |
if (final_ic++ <= last_col) |
| 1907 |
__(cup(top, lft), decic(1)); |
| 1908 |
} |
| 1909 |
} |
| 1910 |
if (final_ic <= last_col) { |
| 1911 |
slowly(); |
| 1912 |
decic(last_col - final_ic); |
| 1913 |
} |
| 1914 |
|
| 1915 |
reset_colors(); |
| 1916 |
|
| 1917 |
test_with_margins(0); |
| 1918 |
|
| 1919 |
ruler(last, min_cols); |
| 1920 |
vt_move(last + 1, 1); |
| 1921 |
vt_clear(0); |
| 1922 |
|
| 1923 |
tprintf("If your terminal supports DECIC, letters %c-%c are on column %d\n", |
| 1924 |
mark_1st, mark_2nd, real_col); |
| 1925 |
return MENU_HOLD; |
| 1926 |
} |
| 1927 |
|
| 1928 |
static int |
| 1929 |
tst_DECIC_DECDC(MENU_ARGS) |
| 1930 |
{ |
| 1931 |
tst_DECIC(PASS_ARGS); |
| 1932 |
holdit(); |
| 1933 |
vt_clear(2); |
| 1934 |
tst_DECDC(PASS_ARGS); |
| 1935 |
return MENU_HOLD; |
| 1936 |
} |
| 1937 |
|
| 1938 |
static int |
| 1939 |
tst_DECKBUM(MENU_ARGS) |
| 1940 |
{ |
| 1941 |
vt_move(1, 1); |
| 1942 |
println(the_title); |
| 1943 |
|
| 1944 |
set_tty_raw(TRUE); |
| 1945 |
set_tty_echo(FALSE); |
| 1946 |
|
| 1947 |
deckbum(TRUE); |
| 1948 |
println("The keyboard is set for data processing."); |
| 1949 |
show_keypress(3, 10); |
| 1950 |
|
| 1951 |
vt_move(10, 1); |
| 1952 |
deckbum(FALSE); |
| 1953 |
println("The keyboard is set for normal (typewriter) processing."); |
| 1954 |
show_keypress(11, 10); |
| 1955 |
|
| 1956 |
restore_ttymodes(); |
| 1957 |
vt_move(max_lines - 1, 1); |
| 1958 |
return MENU_HOLD; |
| 1959 |
} |
| 1960 |
|
| 1961 |
static int |
| 1962 |
tst_DECKPM(MENU_ARGS) |
| 1963 |
{ |
| 1964 |
vt_move(1, 1); |
| 1965 |
println(the_title); |
| 1966 |
|
| 1967 |
set_tty_raw(TRUE); |
| 1968 |
set_tty_echo(FALSE); |
| 1969 |
|
| 1970 |
deckpm(TRUE); |
| 1971 |
println("The keyboard is set for position reports."); |
| 1972 |
show_keypress(3, 10); |
| 1973 |
|
| 1974 |
vt_move(10, 1); |
| 1975 |
deckpm(FALSE); |
| 1976 |
println("The keyboard is set for character codes."); |
| 1977 |
show_keypress(11, 10); |
| 1978 |
|
| 1979 |
restore_ttymodes(); |
| 1980 |
vt_move(max_lines - 1, 1); |
| 1981 |
return MENU_HOLD; |
| 1982 |
} |
| 1983 |
|
| 1984 |
static int |
| 1985 |
tst_DECNKM(MENU_ARGS) |
| 1986 |
{ |
| 1987 |
vt_move(1, 1); |
| 1988 |
println(the_title); |
| 1989 |
|
| 1990 |
set_tty_raw(TRUE); |
| 1991 |
set_tty_echo(FALSE); |
| 1992 |
|
| 1993 |
decnkm(FALSE); |
| 1994 |
println("Press one or more keys on the keypad. They should generate numeric codes."); |
| 1995 |
show_keypress(3, 10); |
| 1996 |
|
| 1997 |
vt_move(10, 1); |
| 1998 |
decnkm(TRUE); |
| 1999 |
println("Press one or more keys on the keypad. They should generate control codes."); |
| 2000 |
show_keypress(11, 10); |
| 2001 |
|
| 2002 |
decnkm(FALSE); |
| 2003 |
vt_move(max_lines - 1, 1); |
| 2004 |
restore_ttymodes(); |
| 2005 |
return MENU_HOLD; |
| 2006 |
} |
| 2007 |
|
| 2008 |
/* |
| 2009 |
* VT400 & up |
| 2010 |
* Reverse Attributes in Rectangular Area |
| 2011 |
*/ |
| 2012 |
static int |
| 2013 |
tst_DECRARA(MENU_ARGS) |
| 2014 |
{ |
| 2015 |
int last = max_lines - 4; |
| 2016 |
BOX box; |
| 2017 |
|
| 2018 |
setup_rectangle(&box, last); |
| 2019 |
|
| 2020 |
decsace(TRUE); |
| 2021 |
fill_screen(); |
| 2022 |
|
| 2023 |
test_with_margins(1); |
| 2024 |
|
| 2025 |
decrara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ |
| 2026 |
decrara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 7); /* invert a rectangle) */ |
| 2027 |
|
| 2028 |
sgr("0"); |
| 2029 |
|
| 2030 |
test_with_margins(0); |
| 2031 |
|
| 2032 |
vt_move(last, 1); |
| 2033 |
vt_clear(0); |
| 2034 |
|
| 2035 |
println(the_title); |
| 2036 |
println("There should be an open rectangle formed by reverse-video E's"); |
| 2037 |
holdit(); |
| 2038 |
|
| 2039 |
decsace(FALSE); |
| 2040 |
fill_screen(); |
| 2041 |
|
| 2042 |
test_with_margins(1); |
| 2043 |
|
| 2044 |
decrara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ |
| 2045 |
decrara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 7); /* invert a rectangle) */ |
| 2046 |
|
| 2047 |
sgr("0"); |
| 2048 |
|
| 2049 |
test_with_margins(0); |
| 2050 |
|
| 2051 |
vt_move(last, 1); |
| 2052 |
vt_clear(0); |
| 2053 |
|
| 2054 |
println(the_title); |
| 2055 |
println("There should be an open rectangle formed by reverse-video E's"); |
| 2056 |
println("combined with wrapping at the margins."); |
| 2057 |
return MENU_HOLD; |
| 2058 |
} |
| 2059 |
|
| 2060 |
int |
| 2061 |
tst_vt420_DECRQSS(MENU_ARGS) |
| 2062 |
{ |
| 2063 |
/* *INDENT-OFF* */ |
| 2064 |
static MENU my_menu[] = { |
| 2065 |
{ "Exit", NULL }, |
| 2066 |
{ "Test VT320 features (DECRQSS)", tst_vt320_DECRQSS }, |
| 2067 |
{ "Enable local functions (DECELF)", rpt_DECELF }, |
| 2068 |
{ "Local function key control (DECLFKC)", rpt_DECLFKC }, |
| 2069 |
{ "Select attribute change extent (DECSACE)", rpt_DECSACE }, |
| 2070 |
{ "Select modifier key reporting (DECSMKR)", rpt_DECSMKR }, |
| 2071 |
{ "Set left and right margins (DECSLRM)", rpt_DECSLRM }, |
| 2072 |
{ "Set number of lines per screen (DECSNLS)", rpt_DECSNLS }, |
| 2073 |
{ "", NULL } |
| 2074 |
}; |
| 2075 |
/* *INDENT-ON* */ |
| 2076 |
|
| 2077 |
do { |
| 2078 |
vt_clear(2); |
| 2079 |
__(title(0), printxx("VT420 Status-Strings Reports")); |
| 2080 |
__(title(2), println("Choose test type:")); |
| 2081 |
} while (menu(my_menu)); |
| 2082 |
return MENU_NOHOLD; |
| 2083 |
} |
| 2084 |
|
| 2085 |
/* |
| 2086 |
* Selective-Erase Rectangular area |
| 2087 |
*/ |
| 2088 |
static int |
| 2089 |
tst_DECSERA(MENU_ARGS) |
| 2090 |
{ |
| 2091 |
int last = max_lines - 3; |
| 2092 |
BOX box; |
| 2093 |
|
| 2094 |
setup_rectangle(&box, last); |
| 2095 |
|
| 2096 |
/* |
| 2097 |
* Part 1: clear the borders of a rectangle, leaving protect inner rectangle. |
| 2098 |
*/ |
| 2099 |
fill_screen(); |
| 2100 |
|
| 2101 |
test_with_margins(1); |
| 2102 |
|
| 2103 |
set_colors(WHITE_ON_GREEN); |
| 2104 |
|
| 2105 |
/* |
| 2106 |
* Protect an area slightly smaller than we will erase. |
| 2107 |
* |
| 2108 |
* That way (since the SGR color at this point differs from the color used to |
| 2109 |
* fill the screen), we can see whether the colors are modified by the erase, |
| 2110 |
* and if so, whether they come from the SGR color. |
| 2111 |
*/ |
| 2112 |
decfra('*', box.top, box.left, box.bottom, box.right); |
| 2113 |
decsca(1); |
| 2114 |
decfra('*', box.top + 1, box.left + 1, box.bottom - 1, box.right - 1); |
| 2115 |
decsca(0); |
| 2116 |
|
| 2117 |
sgr("0"); |
| 2118 |
|
| 2119 |
test_with_margins(0); |
| 2120 |
|
| 2121 |
vt_move(last, 1); |
| 2122 |
vt_clear(0); |
| 2123 |
|
| 2124 |
println(the_title); |
| 2125 |
tprintf("Rectangle %d,%d - %d,%d was filled using DECFRA\n", |
| 2126 |
box.top, |
| 2127 |
box.left, |
| 2128 |
box.bottom, |
| 2129 |
box.right); |
| 2130 |
holdit(); |
| 2131 |
|
| 2132 |
test_with_margins(2); /* reenable but do not paint margins */ |
| 2133 |
|
| 2134 |
set_colors(WHITE_ON_BLUE); |
| 2135 |
|
| 2136 |
decsera(box.top, box.left, box.bottom, box.right); /* erase the border */ |
| 2137 |
|
| 2138 |
sgr("0"); |
| 2139 |
|
| 2140 |
test_with_margins(0); |
| 2141 |
|
| 2142 |
vt_move(last, 1); |
| 2143 |
vt_clear(0); |
| 2144 |
|
| 2145 |
println(the_title); |
| 2146 |
tprintf("Border %d,%d - %d,%d is cleared using DECSERA\n", |
| 2147 |
box.top, |
| 2148 |
box.left, |
| 2149 |
box.bottom, |
| 2150 |
box.right); |
| 2151 |
holdit(); |
| 2152 |
|
| 2153 |
/* |
| 2154 |
* Part 2: clear within the borders instead of clearing the borders. |
| 2155 |
*/ |
| 2156 |
fill_screen(); |
| 2157 |
|
| 2158 |
test_with_margins(1); |
| 2159 |
|
| 2160 |
set_colors(WHITE_ON_GREEN); |
| 2161 |
|
| 2162 |
/* |
| 2163 |
* Protect a rectangle and overwrite an inner rectangle which is not |
| 2164 |
* protected. |
| 2165 |
* |
| 2166 |
* That way (since the SGR color at this point differs from the color used to |
| 2167 |
* fill the screen), we can see whether the colors are modified by the erase, |
| 2168 |
* and if so, whether they come from the SGR color. |
| 2169 |
*/ |
| 2170 |
decsca(1); |
| 2171 |
decfra('*', box.top, box.left, box.bottom, box.right); |
| 2172 |
decsca(0); |
| 2173 |
decfra('*', box.top + 1, box.left + 1, box.bottom - 1, box.right - 1); |
| 2174 |
|
| 2175 |
sgr("0"); |
| 2176 |
|
| 2177 |
test_with_margins(0); |
| 2178 |
|
| 2179 |
vt_move(last, 1); |
| 2180 |
vt_clear(0); |
| 2181 |
|
| 2182 |
println(the_title); |
| 2183 |
tprintf("Rectangle %d,%d - %d,%d was filled using DECFRA\n", |
| 2184 |
box.top, |
| 2185 |
box.left, |
| 2186 |
box.bottom, |
| 2187 |
box.right); |
| 2188 |
holdit(); |
| 2189 |
|
| 2190 |
test_with_margins(2); /* reenable but do not paint margins */ |
| 2191 |
|
| 2192 |
set_colors(WHITE_ON_BLUE); |
| 2193 |
|
| 2194 |
decsera(box.top, box.left, box.bottom, box.right); /* erase inside border */ |
| 2195 |
|
| 2196 |
sgr("0"); |
| 2197 |
|
| 2198 |
test_with_margins(0); |
| 2199 |
|
| 2200 |
vt_move(last, 1); |
| 2201 |
vt_clear(0); |
| 2202 |
|
| 2203 |
println(the_title); |
| 2204 |
tprintf("Inside %d,%d - %d,%d is cleared using DECSERA\n", |
| 2205 |
box.top + 1, |
| 2206 |
box.left + 1, |
| 2207 |
box.bottom - 1, |
| 2208 |
box.right - 1); |
| 2209 |
|
| 2210 |
return MENU_HOLD; |
| 2211 |
} |
| 2212 |
|
| 2213 |
static int |
| 2214 |
tst_DECSNLS(MENU_ARGS) |
| 2215 |
{ |
| 2216 |
int rows; |
| 2217 |
int row; |
| 2218 |
char temp[80]; |
| 2219 |
|
| 2220 |
vt_move(row = 1, 1); |
| 2221 |
println("Testing Select Number of Lines per Screen (DECSNLS)"); |
| 2222 |
println(""); |
| 2223 |
|
| 2224 |
for (rows = 48; rows >= 24; rows -= 12) { |
| 2225 |
set_tty_raw(TRUE); |
| 2226 |
set_tty_echo(FALSE); |
| 2227 |
|
| 2228 |
row += 2; |
| 2229 |
sprintf(temp, "%d Lines/Screen:", rows); |
| 2230 |
fputs(temp, stdout); |
| 2231 |
decsnls(rows); |
| 2232 |
decrqss("*|"); |
| 2233 |
chrprint2(get_reply(), row, (int) strlen(temp)); |
| 2234 |
println(""); |
| 2235 |
|
| 2236 |
restore_ttymodes(); |
| 2237 |
holdit(); |
| 2238 |
} |
| 2239 |
|
| 2240 |
return MENU_NOHOLD; |
| 2241 |
} |
| 2242 |
|
| 2243 |
#define SOH 1 |
| 2244 |
#define CHK(n) ((-(n)) & 0xffff) |
| 2245 |
|
| 2246 |
#define to_fill(ch) (((ch) == ' ') ? SOH : (ch)) |
| 2247 |
#define from_fill(ch) (((ch) == SOH) ? ' ' : (ch)) |
| 2248 |
|
| 2249 |
static int |
| 2250 |
tst_DSR_area_sum(MENU_ARGS, int g) |
| 2251 |
{ |
| 2252 |
char buffer[1024]; /* allocate buffer for lines */ |
| 2253 |
int expected = 0; |
| 2254 |
int title_sum = 0; |
| 2255 |
int first = TRUE; |
| 2256 |
int pid = 1; |
| 2257 |
int page = 1; |
| 2258 |
int i, j; |
| 2259 |
int r, c; |
| 2260 |
int rows = 2; /* first two rows have known content */ |
| 2261 |
int ch; |
| 2262 |
int full = 0; |
| 2263 |
int report_len; |
| 2264 |
int mask_bg = (decac_bg >= 0 && decac_bg < 16) ? decac_bg : 0; |
| 2265 |
int mask_fg = (decac_fg >= 0 && decac_fg < 16) ? (decac_fg << 4) : 0; |
| 2266 |
int ch_1st = g ? 160 : 32; |
| 2267 |
int ch_end = g ? 254 : 126; |
| 2268 |
char *report; |
| 2269 |
char **lines; /* keep track of "drawn" characters */ |
| 2270 |
char temp[80]; |
| 2271 |
char *temp2; |
| 2272 |
|
| 2273 |
/* make an array of blank lines, to track text on the screen */ |
| 2274 |
if ((lines = calloc((size_t) max_lines, sizeof(char *))) == NULL) |
| 2275 |
no_memory(); |
| 2276 |
for (r = 0; r < max_lines; ++r) { |
| 2277 |
if ((lines[r] = malloc((size_t) min_cols + 1)) == NULL) |
| 2278 |
no_memory(); |
| 2279 |
memset(lines[r], to_fill(' '), (size_t) min_cols); |
| 2280 |
lines[r][min_cols] = '\0'; |
| 2281 |
} |
| 2282 |
sprintf(buffer, fmt_DECCKSR, the_title); |
| 2283 |
memcpy(lines[0], buffer, strlen(buffer)); |
| 2284 |
|
| 2285 |
for (r = 0; r < rows; ++r) { |
| 2286 |
for (c = 0; c < min_cols; ++c) { |
| 2287 |
ch = from_fill((unsigned char) lines[r][c]); |
| 2288 |
expected += ch + mask_fg + mask_bg; |
| 2289 |
if (first || (ch != ' ')) |
| 2290 |
title_sum = expected; |
| 2291 |
first = FALSE; |
| 2292 |
} |
| 2293 |
} |
| 2294 |
|
| 2295 |
set_tty_raw(TRUE); |
| 2296 |
set_tty_echo(FALSE); |
| 2297 |
|
| 2298 |
vt_move(1, 1); |
| 2299 |
fputs(buffer, stdout); |
| 2300 |
|
| 2301 |
/* compute a checksum on the title line, which contains some text */ |
| 2302 |
sprintf(buffer, "%d;%d;1;1;%d;%d*y", pid, page, rows, min_cols); |
| 2303 |
do_csi("%s", buffer); |
| 2304 |
report = get_reply(); |
| 2305 |
vt_move(r = 3, c = 10); |
| 2306 |
|
| 2307 |
/* like chrprint2, but shadowed into the lines[][] array */ |
| 2308 |
vt_hilite(TRUE); |
| 2309 |
putchar(' '); |
| 2310 |
lines[r - 1][c - 1] = ' '; |
| 2311 |
report_len = 1; |
| 2312 |
temp2 = chrformat(report, c, 1); |
| 2313 |
for (i = 0, j = 1; temp2[i] != '\0'; ++i) { |
| 2314 |
if (temp2[i] == '\n') { |
| 2315 |
vt_move(++r, c); |
| 2316 |
j = 0; |
| 2317 |
} else { |
| 2318 |
putchar(temp2[i]); |
| 2319 |
lines[r - 1][c - 1 + j++] = temp2[i]; |
| 2320 |
++report_len; |
| 2321 |
} |
| 2322 |
} |
| 2323 |
free(temp2); |
| 2324 |
vt_hilite(FALSE); |
| 2325 |
|
| 2326 |
show_result("%s", check_DECCKSR(temp, report, pid, CHK(title_sum))); |
| 2327 |
lines[r - 1][c - 1 + j++] = ' '; |
| 2328 |
for (i = 0; temp[i] != '\0'; ++i) { |
| 2329 |
lines[r - 1][c - 1 + j++] = temp[i]; |
| 2330 |
} |
| 2331 |
|
| 2332 |
ch = ch_1st; |
| 2333 |
for (c = 4; c < min_cols - 10; c += 12) { |
| 2334 |
for (r = 5; r < max_lines - 3; ++r) { |
| 2335 |
char *s; |
| 2336 |
|
| 2337 |
vt_move(r, c); |
| 2338 |
|
| 2339 |
if (ch > ch_end) { |
| 2340 |
sgr("1;4"); |
| 2341 |
sprintf(buffer, "All"); |
| 2342 |
fputs(buffer, stdout); |
| 2343 |
memcpy(&lines[r - 1][c - 1], buffer, strlen(buffer)); |
| 2344 |
sgr("0;1"); |
| 2345 |
sprintf(buffer, ": "); |
| 2346 |
fputs(buffer, stdout); |
| 2347 |
memcpy(&lines[r - 1][c + 2], buffer, strlen(buffer)); |
| 2348 |
sgr("0"); |
| 2349 |
/* request checksum of the entire page */ |
| 2350 |
do_csi("%d;%d*y", pid, page); |
| 2351 |
} else { |
| 2352 |
sprintf(buffer, "%c %02X ", ch, ch); |
| 2353 |
fputs(buffer, stdout); |
| 2354 |
memcpy(&lines[r - 1][c - 1], buffer, strlen(buffer)); |
| 2355 |
/* request checksum of the given cell at (r,c) */ |
| 2356 |
do_csi("%d;%d;%d;%d;%d;%d*y", pid, page, r, c, r, c); |
| 2357 |
} |
| 2358 |
|
| 2359 |
/* FIXME - use check_DECCKSR? */ |
| 2360 |
report = get_reply(); |
| 2361 |
if ((s = strchr(report, '!')) != NULL |
| 2362 |
&& (*++s == '~') |
| 2363 |
&& strlen(++s) > 4) { |
| 2364 |
char test[5]; |
| 2365 |
|
| 2366 |
if (ch > ch_end) { |
| 2367 |
int row_limit = r; |
| 2368 |
int y, x; |
| 2369 |
|
| 2370 |
for (y = 0; y < row_limit; ++y) { |
| 2371 |
/* |
| 2372 |
* If trimming, count through space after ":" in "All:". |
| 2373 |
* Otherwise, count the whole screen. |
| 2374 |
*/ |
| 2375 |
int col_limit = (y < (r - 1)) ? min_cols : (c + 4); |
| 2376 |
|
| 2377 |
for (x = 0; x < col_limit; ++x) { |
| 2378 |
int yx = (unsigned char) lines[y][x]; |
| 2379 |
|
| 2380 |
if (yx >= ' ') { |
| 2381 |
full += yx; |
| 2382 |
full += mask_bg; |
| 2383 |
full += mask_fg; |
| 2384 |
} |
| 2385 |
/* |
| 2386 |
* Tidy up the logfile (for debugging, turn this off). |
| 2387 |
*/ |
| 2388 |
if (yx == SOH + 0) |
| 2389 |
lines[y][x] = ' '; |
| 2390 |
} |
| 2391 |
if (y == 2) { |
| 2392 |
/* add attributes for highlighted report-string */ |
| 2393 |
full += report_len * (chkINVERSE); |
| 2394 |
} |
| 2395 |
if (y == (r - 1)) { |
| 2396 |
/* add attributes for "All:" */ |
| 2397 |
full += 3 * (chkBOLD | chkUNDERLINE); |
| 2398 |
full += 2 * (chkBOLD); |
| 2399 |
} |
| 2400 |
if (LOG_ENABLED) { |
| 2401 |
fprintf(log_fp, |
| 2402 |
NOTE_STR "check %04X %2d:%s\n", |
| 2403 |
CHK(full), y + 1, lines[y]); |
| 2404 |
} |
| 2405 |
} |
| 2406 |
sprintf(test, "%04X", CHK(full)); |
| 2407 |
} else { |
| 2408 |
int part = ch + mask_bg + mask_fg; |
| 2409 |
sprintf(test, "%04X", CHK(part)); |
| 2410 |
} |
| 2411 |
if (memcmp(test, s, (size_t) 4)) { |
| 2412 |
vt_hilite(TRUE); |
| 2413 |
sprintf(buffer, "%.4s", s); |
| 2414 |
if (LOG_ENABLED) { |
| 2415 |
unsigned actual; |
| 2416 |
int ok = sscanf(s, "%x", &actual); |
| 2417 |
fprintf(log_fp, NOTE_STR "actual %.4s%s\n", |
| 2418 |
s, ok ? "" : " (ERR)"); |
| 2419 |
fprintf(log_fp, NOTE_STR "expect %.4s\n", test); |
| 2420 |
} |
| 2421 |
fputs(buffer, stdout); |
| 2422 |
vt_hilite(FALSE); |
| 2423 |
} else { |
| 2424 |
sprintf(buffer, "%.4s", test); |
| 2425 |
fputs(buffer, stdout); |
| 2426 |
} |
| 2427 |
memcpy(&lines[r - 1][c + 4], buffer, (size_t) 4); |
| 2428 |
} |
| 2429 |
++ch; |
| 2430 |
if (ch > ch_end + 1) |
| 2431 |
break; |
| 2432 |
} |
| 2433 |
if (ch > ch_end) |
| 2434 |
break; |
| 2435 |
} |
| 2436 |
restore_ttymodes(); |
| 2437 |
vt_move(max_lines - 2, 1); |
| 2438 |
printxx("Checksum for individual character is highlighted if mismatched."); |
| 2439 |
|
| 2440 |
for (r = 0; r < max_lines; r++) { |
| 2441 |
free(lines[r]); |
| 2442 |
} |
| 2443 |
free(lines); |
| 2444 |
|
| 2445 |
vt_move(max_lines - 1, 1); |
| 2446 |
return MENU_HOLD; |
| 2447 |
} |
| 2448 |
|
| 2449 |
static int |
| 2450 |
tst_DSR_area_sum_gl(MENU_ARGS) |
| 2451 |
{ |
| 2452 |
return tst_DSR_area_sum(PASS_ARGS, 0); |
| 2453 |
} |
| 2454 |
|
| 2455 |
static int |
| 2456 |
tst_DSR_area_sum_gr(MENU_ARGS) |
| 2457 |
{ |
| 2458 |
switch (get_level()) { |
| 2459 |
case 0: |
| 2460 |
case 1: |
| 2461 |
break; |
| 2462 |
case 2: |
| 2463 |
esc(")A"); /* select the 94-character NRCS, closest to MCS */ |
| 2464 |
break; |
| 2465 |
default: |
| 2466 |
esc("-A"); /* select the 96-character set */ |
| 2467 |
break; |
| 2468 |
} |
| 2469 |
esc("~"); |
| 2470 |
return tst_DSR_area_sum(PASS_ARGS, 1); |
| 2471 |
} |
| 2472 |
|
| 2473 |
static int |
| 2474 |
tst_DSR_data_ok(MENU_ARGS) |
| 2475 |
{ |
| 2476 |
return any_DSR(PASS_ARGS, "?75n", show_DataIntegrity); |
| 2477 |
} |
| 2478 |
|
| 2479 |
static int |
| 2480 |
tst_DSR_macrospace(MENU_ARGS) |
| 2481 |
{ |
| 2482 |
int row, col; |
| 2483 |
char *report; |
| 2484 |
const char *show; |
| 2485 |
|
| 2486 |
vt_move(1, 1); |
| 2487 |
printxx("Testing DECMSR: %s\n", the_title); |
| 2488 |
|
| 2489 |
set_tty_raw(TRUE); |
| 2490 |
set_tty_echo(FALSE); |
| 2491 |
|
| 2492 |
do_csi("?62n"); |
| 2493 |
report = get_reply(); |
| 2494 |
vt_move(row = 3, col = 10); |
| 2495 |
chrprint2(report, row, col); |
| 2496 |
if ((report = skip_csi(report)) != NULL |
| 2497 |
&& (report = skip_digits(report)) != NULL |
| 2498 |
&& !strcmp(report, "*{")) { |
| 2499 |
show = SHOW_SUCCESS; |
| 2500 |
} else { |
| 2501 |
show = SHOW_FAILURE; |
| 2502 |
} |
| 2503 |
show_result("%s", show); |
| 2504 |
|
| 2505 |
restore_ttymodes(); |
| 2506 |
vt_move(max_lines - 1, 1); |
| 2507 |
return MENU_HOLD; |
| 2508 |
} |
| 2509 |
|
| 2510 |
static int |
| 2511 |
tst_DSR_memory_sum(MENU_ARGS) |
| 2512 |
{ |
| 2513 |
return tst_DECCKSR(PASS_ARGS, 1, "?63;1n", -1); |
| 2514 |
} |
| 2515 |
|
| 2516 |
static int |
| 2517 |
tst_DSR_multisession(MENU_ARGS) |
| 2518 |
{ |
| 2519 |
return any_DSR(PASS_ARGS, "?85n", show_MultisessionStatus); |
| 2520 |
} |
| 2521 |
|
| 2522 |
int |
| 2523 |
tst_SRM(MENU_ARGS) |
| 2524 |
{ |
| 2525 |
int oldc, newc; |
| 2526 |
|
| 2527 |
vt_move(1, 1); |
| 2528 |
println(the_title); |
| 2529 |
|
| 2530 |
set_tty_raw(TRUE); |
| 2531 |
|
| 2532 |
set_tty_echo(FALSE); |
| 2533 |
srm(FALSE); |
| 2534 |
|
| 2535 |
println("Local echo is enabled, remote echo disabled. Press any keys, repeat to quit."); |
| 2536 |
vt_move(3, 10); |
| 2537 |
|
| 2538 |
oldc = -1; |
| 2539 |
pause_replay(); |
| 2540 |
while ((newc = inchar()) != oldc && newc > 0) |
| 2541 |
oldc = newc; |
| 2542 |
resume_replay(); |
| 2543 |
|
| 2544 |
set_tty_echo(TRUE); |
| 2545 |
srm(TRUE); |
| 2546 |
|
| 2547 |
vt_move(10, 1); |
| 2548 |
println("Local echo is disabled, remote echo enabled. Press any keys, repeat to quit."); |
| 2549 |
vt_move(11, 10); |
| 2550 |
|
| 2551 |
oldc = -1; |
| 2552 |
pause_replay(); |
| 2553 |
while ((newc = inchar()) != oldc && newc > 0) |
| 2554 |
oldc = newc; |
| 2555 |
resume_replay(); |
| 2556 |
|
| 2557 |
vt_move(max_lines - 1, 1); |
| 2558 |
restore_ttymodes(); |
| 2559 |
return MENU_HOLD; |
| 2560 |
} |
| 2561 |
|
| 2562 |
/******************************************************************************/ |
| 2563 |
|
| 2564 |
void |
| 2565 |
setup_vt420_cursor(MENU_ARGS) |
| 2566 |
{ |
| 2567 |
tb_marg_flag = marNone; |
| 2568 |
toggle_STBM(PASS_ARGS); |
| 2569 |
|
| 2570 |
lr_marg_flag = marNone; |
| 2571 |
toggle_SLRM(PASS_ARGS); |
| 2572 |
} |
| 2573 |
|
| 2574 |
void |
| 2575 |
menus_vt420_cursor(void) |
| 2576 |
{ |
| 2577 |
sprintf(origin_mode_mesg, "%s DECOM (origin mode)", STR_ENABLE(origin_mode)); |
| 2578 |
sprintf(lrmm_mesg, "%s DECLRMM (left/right mode)", STR_ENABLE(lrmm_flag)); |
| 2579 |
sprintf(txt_override_color, "%s test-regions (xterm)", |
| 2580 |
do_colors ? "Color" : "Do not color"); |
| 2581 |
} |
| 2582 |
|
| 2583 |
void |
| 2584 |
finish_vt420_cursor(MENU_ARGS) |
| 2585 |
{ |
| 2586 |
reset_colors(); |
| 2587 |
do_colors = FALSE; |
| 2588 |
|
| 2589 |
if (tb_marg_flag > marReset) |
| 2590 |
decstbm(0, 0); |
| 2591 |
|
| 2592 |
if (lr_marg_flag > marReset) { |
| 2593 |
if (!lrmm_flag) |
| 2594 |
toggle_LRMM(PASS_ARGS); |
| 2595 |
decslrm(0, 0); |
| 2596 |
} |
| 2597 |
|
| 2598 |
if (lrmm_flag) |
| 2599 |
toggle_LRMM(PASS_ARGS); |
| 2600 |
|
| 2601 |
if (origin_mode) { |
| 2602 |
decom(FALSE); |
| 2603 |
origin_mode = FALSE; |
| 2604 |
} |
| 2605 |
} |
| 2606 |
|
| 2607 |
/* |
| 2608 |
* The main vt100 module tests CUP, HVP, CUF, CUB, CUU, CUD |
| 2609 |
*/ |
| 2610 |
int |
| 2611 |
tst_vt420_cursor(MENU_ARGS) |
| 2612 |
{ |
| 2613 |
/* *INDENT-OFF* */ |
| 2614 |
static MENU my_menu[] = { |
| 2615 |
{ "Exit", NULL }, |
| 2616 |
{ "Test VT320 features", tst_vt320_cursor }, |
| 2617 |
{ origin_mode_mesg, toggle_DECOM }, |
| 2618 |
{ lrmm_mesg, toggle_LRMM }, |
| 2619 |
{ tb_marg_mesg, toggle_STBM }, |
| 2620 |
{ lr_marg_mesg, toggle_SLRM }, |
| 2621 |
{ txt_override_color, toggle_color_mode, }, |
| 2622 |
{ "Test Back Index (DECBI)", tst_DECBI }, |
| 2623 |
{ "Test Forward Index (DECFI)", tst_DECFI }, |
| 2624 |
{ "Test cursor movement within margins", tst_cursor_margins }, |
| 2625 |
{ "Test other movement (CR/HT/LF/FF) within margins", tst_other_margins }, |
| 2626 |
{ "", NULL } |
| 2627 |
}; |
| 2628 |
/* *INDENT-ON* */ |
| 2629 |
|
| 2630 |
setup_vt420_cursor(PASS_ARGS); |
| 2631 |
|
| 2632 |
do { |
| 2633 |
vt_clear(2); |
| 2634 |
__(title(0), printxx("VT420 Cursor-Movement Tests")); |
| 2635 |
__(title(2), println("Choose test type:")); |
| 2636 |
menus_vt420_cursor(); |
| 2637 |
} while (menu(my_menu)); |
| 2638 |
|
| 2639 |
finish_vt420_cursor(PASS_ARGS); |
| 2640 |
|
| 2641 |
return MENU_NOHOLD; |
| 2642 |
} |
| 2643 |
|
| 2644 |
/******************************************************************************/ |
| 2645 |
|
| 2646 |
static int |
| 2647 |
show_DECSTBM(MENU_ARGS) |
| 2648 |
{ |
| 2649 |
int code; |
| 2650 |
decstbm(tb_marg1, tb_marg2); |
| 2651 |
code = rpt_DECSTBM(PASS_ARGS); |
| 2652 |
return code; |
| 2653 |
} |
| 2654 |
|
| 2655 |
static int |
| 2656 |
show_DECSLRM(MENU_ARGS) |
| 2657 |
{ |
| 2658 |
int code; |
| 2659 |
decslrm(lr_marg1, lr_marg2); |
| 2660 |
code = rpt_DECSLRM(PASS_ARGS); |
| 2661 |
return code; |
| 2662 |
} |
| 2663 |
|
| 2664 |
/* |
| 2665 |
* The main vt100 module tests IRM, DL, IL, DCH, ICH, ED, EL |
| 2666 |
* The vt220 module tests ECH and DECSCA |
| 2667 |
*/ |
| 2668 |
static int |
| 2669 |
tst_VT420_editing(MENU_ARGS) |
| 2670 |
{ |
| 2671 |
/* *INDENT-OFF* */ |
| 2672 |
static MENU my_menu[] = { |
| 2673 |
{ "Exit", NULL }, |
| 2674 |
{ origin_mode_mesg, toggle_DECOM }, |
| 2675 |
{ lrmm_mesg, toggle_LRMM }, |
| 2676 |
{ tb_marg_mesg, toggle_STBM }, |
| 2677 |
{ lr_marg_mesg, toggle_SLRM }, |
| 2678 |
{ txt_override_color, toggle_color_mode, }, |
| 2679 |
{ "Show DECRQM response for DECLRMM", show_DECLRMM }, |
| 2680 |
{ "Show DECRQSS response for DECSTBM", show_DECSTBM }, |
| 2681 |
{ "Show DECRQSS response for DECSLRM", show_DECSLRM }, |
| 2682 |
{ "Test insert/delete column (DECIC, DECDC)", tst_DECIC_DECDC }, |
| 2683 |
{ "Test vertical scrolling (IND, RI)", tst_IND_RI }, |
| 2684 |
{ "Test insert/delete line (IL, DL)", tst_IL_DL }, |
| 2685 |
{ "Test insert/delete char (ICH, DCH)", tst_ICH_DCH }, |
| 2686 |
{ "Test ASCII formatting (BS, CR, TAB)", tst_ASCII_format }, |
| 2687 |
{ "", NULL } |
| 2688 |
}; |
| 2689 |
/* *INDENT-ON* */ |
| 2690 |
|
| 2691 |
setup_vt420_cursor(PASS_ARGS); |
| 2692 |
|
| 2693 |
do { |
| 2694 |
vt_clear(2); |
| 2695 |
__(title(0), printxx("VT420 Editing Sequence Tests")); |
| 2696 |
__(title(2), println("Choose test type:")); |
| 2697 |
menus_vt420_cursor(); |
| 2698 |
} while (menu(my_menu)); |
| 2699 |
|
| 2700 |
finish_vt420_cursor(PASS_ARGS); |
| 2701 |
|
| 2702 |
return MENU_NOHOLD; |
| 2703 |
} |
| 2704 |
|
| 2705 |
/******************************************************************************/ |
| 2706 |
|
| 2707 |
/* |
| 2708 |
* The main vt100 module tests LNM, DECKPAM, DECARM, DECAWM |
| 2709 |
*/ |
| 2710 |
static int |
| 2711 |
tst_VT420_keyboard_ctl(MENU_ARGS) |
| 2712 |
{ |
| 2713 |
/* *INDENT-OFF* */ |
| 2714 |
static MENU my_menu[] = { |
| 2715 |
{ "Exit", NULL }, |
| 2716 |
{ "Test Backarrow key (DECBKM)", tst_DECBKM }, |
| 2717 |
{ "Test Numeric keypad (DECNKM)", tst_DECNKM }, |
| 2718 |
{ "Test Keyboard usage (DECKBUM)", tst_DECKBUM }, |
| 2719 |
{ "Test Key position (DECKPM)", tst_DECKPM }, |
| 2720 |
{ "Test Enable Local Functions (DECELF)", not_impl }, |
| 2721 |
{ "Test Local Function-Key Control (DECLFKC)", not_impl }, |
| 2722 |
{ "Test Select Modifier-Key Reporting (DECSMKR)", not_impl }, /* DECEKBD */ |
| 2723 |
{ "", NULL } |
| 2724 |
}; |
| 2725 |
/* *INDENT-ON* */ |
| 2726 |
|
| 2727 |
do { |
| 2728 |
vt_clear(2); |
| 2729 |
__(title(0), printxx("VT420 Keyboard-Control Tests")); |
| 2730 |
__(title(2), println("Choose test type:")); |
| 2731 |
} while (menu(my_menu)); |
| 2732 |
return MENU_NOHOLD; |
| 2733 |
} |
| 2734 |
|
| 2735 |
/******************************************************************************/ |
| 2736 |
|
| 2737 |
static int |
| 2738 |
tst_VT420_rectangle(MENU_ARGS) |
| 2739 |
{ |
| 2740 |
static char txt_override_lines[80]; |
| 2741 |
/* *INDENT-OFF* */ |
| 2742 |
static MENU my_menu[] = { |
| 2743 |
{ "Exit", NULL }, |
| 2744 |
{ origin_mode_mesg, toggle_DECOM }, |
| 2745 |
{ lrmm_mesg, toggle_LRMM }, |
| 2746 |
{ tb_marg_mesg, toggle_STBM }, |
| 2747 |
{ lr_marg_mesg, toggle_SLRM }, |
| 2748 |
{ txt_override_color, toggle_color_mode, }, |
| 2749 |
{ txt_override_lines, toggle_lines_mode, }, |
| 2750 |
{ "Test Change-Attributes in Rectangular Area (DECCARA)", tst_DECCARA }, |
| 2751 |
{ "Test Copy Rectangular area (DECCRA)", tst_DECCRA }, |
| 2752 |
{ "Test Erase Rectangular area (DECERA)", tst_DECERA }, |
| 2753 |
{ "Test Fill Rectangular area (DECFRA)", tst_DECFRA }, |
| 2754 |
{ "Test Reverse-Attributes in Rectangular Area (DECRARA)", tst_DECRARA }, |
| 2755 |
{ "Test Selective-Erase Rectangular area (DECSERA)", tst_DECSERA }, |
| 2756 |
{ "", NULL } |
| 2757 |
}; |
| 2758 |
/* *INDENT-ON* */ |
| 2759 |
|
| 2760 |
setup_vt420_cursor(PASS_ARGS); |
| 2761 |
|
| 2762 |
do { |
| 2763 |
vt_clear(2); |
| 2764 |
__(title(0), printxx("VT420 Rectangular Area Tests%s", |
| 2765 |
((terminal_id() < 400) |
| 2766 |
? " (should not work)" |
| 2767 |
: ""))); |
| 2768 |
__(title(2), println("Choose test type:")); |
| 2769 |
menus_vt420_cursor(); |
| 2770 |
sprintf(txt_override_lines, "%s line-drawing characters", |
| 2771 |
do_lines ? "Use" : "Do not use"); |
| 2772 |
} while (menu(my_menu)); |
| 2773 |
|
| 2774 |
finish_vt420_cursor(PASS_ARGS); |
| 2775 |
|
| 2776 |
return MENU_NOHOLD; |
| 2777 |
} |
| 2778 |
|
| 2779 |
/******************************************************************************/ |
| 2780 |
|
| 2781 |
/* UDK and rectangle-checksum status are available only on VT400 */ |
| 2782 |
|
| 2783 |
int |
| 2784 |
tst_vt420_device_status(MENU_ARGS) |
| 2785 |
{ |
| 2786 |
/* *INDENT-OFF* */ |
| 2787 |
static MENU my_menu[] = { |
| 2788 |
{ "Exit", NULL }, |
| 2789 |
{ "Test VT320 features", tst_vt320_device_status }, |
| 2790 |
{ "Test Printer Status", tst_DSR_printer }, |
| 2791 |
{ "Test UDK Status", tst_DSR_userkeys }, |
| 2792 |
{ "Test Keyboard Status", tst_DSR_keyboard }, |
| 2793 |
{ "Test Macro Space", tst_DSR_macrospace }, |
| 2794 |
{ "Test Memory Checksum", tst_DSR_memory_sum }, |
| 2795 |
{ "Test Data Integrity", tst_DSR_data_ok }, |
| 2796 |
{ "Test Multiple Session Status", tst_DSR_multisession }, |
| 2797 |
{ "Test Checksum of Rectangular Area (DECRQCRA): GL", tst_DSR_area_sum_gl }, |
| 2798 |
{ "Test Checksum of Rectangular Area (DECRQCRA): GR", tst_DSR_area_sum_gr }, |
| 2799 |
{ "Test Extended Cursor-Position (DECXCPR)", tst_DSR_cursor }, |
| 2800 |
{ "", NULL } |
| 2801 |
}; |
| 2802 |
/* *INDENT-ON* */ |
| 2803 |
|
| 2804 |
do { |
| 2805 |
vt_clear(2); |
| 2806 |
__(title(0), printxx("VT420 Device Status Reports (DSR)")); |
| 2807 |
__(title(2), println("Choose test type:")); |
| 2808 |
} while (menu(my_menu)); |
| 2809 |
return MENU_NOHOLD; |
| 2810 |
} |
| 2811 |
|
| 2812 |
/******************************************************************************/ |
| 2813 |
|
| 2814 |
int |
| 2815 |
tst_vt420_report_presentation(MENU_ARGS) |
| 2816 |
{ |
| 2817 |
/* *INDENT-OFF* */ |
| 2818 |
static MENU my_menu[] = { |
| 2819 |
{ "Exit", NULL }, |
| 2820 |
{ "Test VT320 features", tst_vt320_report_presentation }, |
| 2821 |
{ "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, |
| 2822 |
{ "Status-String Report (DECRQSS)", tst_vt420_DECRQSS }, |
| 2823 |
{ "", NULL } |
| 2824 |
}; |
| 2825 |
/* *INDENT-ON* */ |
| 2826 |
|
| 2827 |
int old_DECRPM = set_DECRPM(4); |
| 2828 |
|
| 2829 |
do { |
| 2830 |
vt_clear(2); |
| 2831 |
__(title(0), printxx("VT420 Presentation State Reports")); |
| 2832 |
__(title(2), println("Choose test type:")); |
| 2833 |
} while (menu(my_menu)); |
| 2834 |
set_DECRPM(old_DECRPM); |
| 2835 |
return MENU_NOHOLD; |
| 2836 |
} |
| 2837 |
|
| 2838 |
int |
| 2839 |
tst_vt420_reports(MENU_ARGS) |
| 2840 |
{ |
| 2841 |
/* *INDENT-OFF* */ |
| 2842 |
static MENU my_menu[] = { |
| 2843 |
{ "Exit", NULL }, |
| 2844 |
{ "Test VT320 features", tst_vt320_reports }, |
| 2845 |
{ "Test Presentation State Reports", tst_vt420_report_presentation }, |
| 2846 |
{ "Test Device Status Reports (DSR)", tst_vt420_device_status }, |
| 2847 |
{ "", NULL } |
| 2848 |
}; |
| 2849 |
/* *INDENT-ON* */ |
| 2850 |
|
| 2851 |
do { |
| 2852 |
vt_clear(2); |
| 2853 |
__(title(0), printxx("VT420 Reports")); |
| 2854 |
__(title(2), println("Choose test type:")); |
| 2855 |
} while (menu(my_menu)); |
| 2856 |
return MENU_NOHOLD; |
| 2857 |
} |
| 2858 |
|
| 2859 |
/******************************************************************************/ |
| 2860 |
|
| 2861 |
static int |
| 2862 |
tst_VT420_screen(MENU_ARGS) |
| 2863 |
{ |
| 2864 |
/* *INDENT-OFF* */ |
| 2865 |
static MENU my_menu[] = { |
| 2866 |
{ "Exit", NULL }, |
| 2867 |
{ "Test VT320 features", tst_vt320_screen }, |
| 2868 |
{ "Test Select Number of Lines per Screen (DECSNLS)", tst_DECSNLS }, |
| 2869 |
{ "", NULL } |
| 2870 |
}; |
| 2871 |
/* *INDENT-ON* */ |
| 2872 |
|
| 2873 |
do { |
| 2874 |
vt_clear(2); |
| 2875 |
__(title(0), printxx("VT420 Screen-Display Tests")); |
| 2876 |
__(title(2), println("Choose test type:")); |
| 2877 |
} while (menu(my_menu)); |
| 2878 |
return MENU_NOHOLD; |
| 2879 |
} |
| 2880 |
|
| 2881 |
/******************************************************************************/ |
| 2882 |
|
| 2883 |
/* |
| 2884 |
* These apply only to VT400's & above. |
| 2885 |
*/ |
| 2886 |
int |
| 2887 |
tst_vt420(MENU_ARGS) |
| 2888 |
{ |
| 2889 |
/* *INDENT-OFF* */ |
| 2890 |
static MENU my_menu[] = { |
| 2891 |
{ "Exit", NULL }, |
| 2892 |
{ "Test VT320 features", tst_vt320 }, |
| 2893 |
{ "Test cursor-movement", tst_vt420_cursor }, |
| 2894 |
{ "Test editing sequences", tst_VT420_editing }, |
| 2895 |
{ "Test keyboard-control", tst_VT420_keyboard_ctl }, |
| 2896 |
{ "Test macro-definition (DECDMAC)", not_impl }, |
| 2897 |
{ "Test rectangular area functions", tst_VT420_rectangle }, |
| 2898 |
{ "Test reporting functions", tst_vt420_reports }, |
| 2899 |
{ "Test screen-display functions", tst_VT420_screen }, |
| 2900 |
{ "", NULL } |
| 2901 |
}; |
| 2902 |
/* *INDENT-ON* */ |
| 2903 |
|
| 2904 |
do { |
| 2905 |
vt_clear(2); |
| 2906 |
__(title(0), printxx("VT420 Tests")); |
| 2907 |
__(title(2), println("Choose test type:")); |
| 2908 |
} while (menu(my_menu)); |
| 2909 |
return MENU_NOHOLD; |
| 2910 |
} |