| 1 |
/* $Id: nonvt100.c,v 1.71 2024/12/05 00:37:39 tom Exp $ */ |
| 2 |
|
| 3 |
/* |
| 4 |
* The list of non-VT320 codes was compiled using the list of non-VT320 codes |
| 5 |
* described in the Kermit 3.13 documentation, combined with the ISO-6429 |
| 6 |
* (ECMA-48) spec. |
| 7 |
*/ |
| 8 |
#include <vttest.h> |
| 9 |
#include <ttymodes.h> |
| 10 |
#include <draw.h> |
| 11 |
#include <esc.h> |
| 12 |
|
| 13 |
int |
| 14 |
not_impl(MENU_ARGS) |
| 15 |
{ |
| 16 |
vt_move(1, 1); |
| 17 |
printxx("Sorry, test not implemented:\r\n\r\n %s", the_title); |
| 18 |
vt_move(max_lines - 1, 1); |
| 19 |
return MENU_HOLD; |
| 20 |
} |
| 21 |
|
| 22 |
/* |
| 23 |
* VT420 doesn't do this, VT510 does. |
| 24 |
* It is unaffected by left/right margins. |
| 25 |
*/ |
| 26 |
int |
| 27 |
tst_CBT(MENU_ARGS) |
| 28 |
{ |
| 29 |
int n; |
| 30 |
int count; |
| 31 |
int last = max_lines - 3; |
| 32 |
int row; |
| 33 |
int lft; |
| 34 |
int rgt; |
| 35 |
char temp[80]; |
| 36 |
|
| 37 |
test_with_margins(TRUE); |
| 38 |
|
| 39 |
lft = get_left_margin(); |
| 40 |
rgt = get_right_margin(); |
| 41 |
|
| 42 |
/* ignore left/right margins unless origin mode is set */ |
| 43 |
if (origin_mode) { |
| 44 |
count = ((rgt - lft) + TABWIDTH) / TABWIDTH; |
| 45 |
} else { |
| 46 |
count = (min_cols + (TABWIDTH - 1)) / TABWIDTH; |
| 47 |
} |
| 48 |
|
| 49 |
set_colors(WHITE_ON_BLUE); |
| 50 |
|
| 51 |
for (row = 1; row < last; ++row) { |
| 52 |
cup(row, min_cols); |
| 53 |
cbt(count + 1); |
| 54 |
print_chr('*'); |
| 55 |
for (n = 1; n <= count; n++) { |
| 56 |
int show = (count + 1 - n); |
| 57 |
|
| 58 |
cup(row, min_cols); |
| 59 |
cbt(n); |
| 60 |
slowly(); |
| 61 |
sprintf(temp, "%d", show); |
| 62 |
print_str(temp); |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
set_colors(NULL); |
| 67 |
|
| 68 |
test_with_margins(FALSE); |
| 69 |
|
| 70 |
vt_move(last, 1); |
| 71 |
ruler(last, min_cols); |
| 72 |
vt_clear(0); |
| 73 |
println(the_title); |
| 74 |
if (origin_mode) { |
| 75 |
println("The tab-stops should be numbered consecutively starting at 1 in margins."); |
| 76 |
} else { |
| 77 |
println("The tab-stops should be numbered consecutively starting at 1 in screen."); |
| 78 |
} |
| 79 |
return MENU_HOLD; |
| 80 |
} |
| 81 |
|
| 82 |
/* Note: CHA and HPA have identical descriptions in ECMA-48 */ |
| 83 |
/* dtterm implements this (VT400 doesn't, VT510 does) */ |
| 84 |
int |
| 85 |
tst_CHA(MENU_ARGS) |
| 86 |
{ |
| 87 |
int n; |
| 88 |
int last = max_lines - 4; |
| 89 |
int top; |
| 90 |
int lft; |
| 91 |
int bot; |
| 92 |
int rgt; |
| 93 |
BOX box; |
| 94 |
|
| 95 |
test_with_margins(TRUE); |
| 96 |
|
| 97 |
set_colors(WHITE_ON_BLUE); |
| 98 |
|
| 99 |
top = get_top_margin(); |
| 100 |
lft = get_left_margin(); |
| 101 |
rgt = get_right_margin(); |
| 102 |
bot = get_bottom_margin(last); |
| 103 |
|
| 104 |
if (origin_mode) { |
| 105 |
box.top = top + (bot - top + 1) / 4; |
| 106 |
box.left = lft + (rgt - lft + 1) / 4 - 1; |
| 107 |
box.right = rgt - (rgt - lft + 1) / 4 - 1; |
| 108 |
box.bottom = bot - (bot - top + 1) / 4; |
| 109 |
} else { |
| 110 |
box.top = (max_lines / 4); |
| 111 |
box.left = (min_cols / 4); |
| 112 |
box.right = (min_cols * 3) / 4 - 1; |
| 113 |
box.bottom = (max_lines * 3) / 4; |
| 114 |
} |
| 115 |
|
| 116 |
cup(box.top, box.left); |
| 117 |
for (n = box.left; n <= box.right; n++) { |
| 118 |
cha(n); |
| 119 |
print_chr('*'); |
| 120 |
} |
| 121 |
|
| 122 |
for (n = box.top; n <= box.bottom; n++) { |
| 123 |
cup(n, box.left + n); |
| 124 |
cha(box.right); |
| 125 |
print_chr('*'); |
| 126 |
cha(box.left); |
| 127 |
print_chr('*'); |
| 128 |
} |
| 129 |
|
| 130 |
cup(box.bottom, box.left); |
| 131 |
for (n = box.right; n >= box.left; --n) { |
| 132 |
cha(n); |
| 133 |
print_chr('*'); |
| 134 |
} |
| 135 |
|
| 136 |
set_colors(NULL); |
| 137 |
|
| 138 |
test_with_margins(FALSE); |
| 139 |
|
| 140 |
vt_move(last, 1); |
| 141 |
vt_clear(0); |
| 142 |
ruler(last, min_cols); |
| 143 |
|
| 144 |
println(the_title); |
| 145 |
if (origin_mode) { |
| 146 |
println("There should be a box-outline made of *'s in the middle of the margins."); |
| 147 |
} else { |
| 148 |
println("There should be a box-outline made of *'s in the middle of the screen."); |
| 149 |
} |
| 150 |
|
| 151 |
return MENU_HOLD; |
| 152 |
} |
| 153 |
|
| 154 |
/* |
| 155 |
* Kermit's documentation refers to this as CHI, ECMA-48 as CHT. |
| 156 |
* |
| 157 |
* VT420 doesn't do this, VT510 does |
| 158 |
*/ |
| 159 |
int |
| 160 |
tst_CHT(MENU_ARGS) |
| 161 |
{ |
| 162 |
int n; |
| 163 |
int last_tab; |
| 164 |
int last = max_lines - 4; |
| 165 |
int lft; |
| 166 |
int rgt; |
| 167 |
|
| 168 |
test_with_margins(TRUE); |
| 169 |
|
| 170 |
set_colors(WHITE_ON_BLUE); |
| 171 |
|
| 172 |
lft = get_left_margin(); |
| 173 |
rgt = get_right_margin(); |
| 174 |
last_tab = ((rgt * 2 - lft + 1) + (TABWIDTH - 1)) / TABWIDTH; |
| 175 |
|
| 176 |
vt_move(1, 1); |
| 177 |
println("CHT with param == 1:"); |
| 178 |
for (n = 0; n < last_tab; n++) { |
| 179 |
cht(1); |
| 180 |
tprintf("*"); |
| 181 |
} |
| 182 |
|
| 183 |
vt_move(4, 1); |
| 184 |
println("CHT with param != 1:"); |
| 185 |
for (n = 0; n < last_tab; n++) { |
| 186 |
cup(5, 1); |
| 187 |
cht(n); |
| 188 |
tprintf("+"); |
| 189 |
} |
| 190 |
|
| 191 |
vt_move(7, 1); |
| 192 |
println("Normal tabs:"); |
| 193 |
for (n = 0; n < last_tab; n++) { |
| 194 |
tprintf("\t*"); |
| 195 |
} |
| 196 |
|
| 197 |
set_colors(NULL); |
| 198 |
|
| 199 |
test_with_margins(FALSE); |
| 200 |
|
| 201 |
vt_move(last, 1); |
| 202 |
vt_clear(0); |
| 203 |
ruler(last, min_cols); |
| 204 |
println(the_title); |
| 205 |
println("The lines with *'s above should look the same (they wrap once)"); |
| 206 |
return MENU_HOLD; |
| 207 |
} |
| 208 |
|
| 209 |
/* VT420 doesn't do this, VT510 does */ |
| 210 |
int |
| 211 |
tst_CNL(MENU_ARGS) |
| 212 |
{ |
| 213 |
int n; |
| 214 |
int last = max_lines - 3; |
| 215 |
|
| 216 |
test_with_margins(TRUE); |
| 217 |
|
| 218 |
set_colors(WHITE_ON_BLUE); |
| 219 |
|
| 220 |
vt_move(1, 1); |
| 221 |
tprintf("1."); /* this line should not be overwritten */ |
| 222 |
for (n = 1; n <= last - 3; n++) { |
| 223 |
hpa(min_cols); |
| 224 |
cnl(n - 1); /* CNL 0 should skip to the second line */ |
| 225 |
slowly(); |
| 226 |
tprintf("%d.", n + 1); |
| 227 |
vpa(2); /* subsequently, start from the second line */ |
| 228 |
} |
| 229 |
|
| 230 |
set_colors(NULL); |
| 231 |
|
| 232 |
test_with_margins(FALSE); |
| 233 |
|
| 234 |
vt_move(last, 1); |
| 235 |
vt_clear(0); |
| 236 |
println(the_title); |
| 237 |
println("The lines above this should be numbered in sequence, from 1."); |
| 238 |
return MENU_HOLD; |
| 239 |
} |
| 240 |
|
| 241 |
/* |
| 242 |
* VT510 & up |
| 243 |
* |
| 244 |
* There's a comment in the MS-DOS Kermit 3.13 documentation that implies CPL |
| 245 |
* is used to replace RI (reverse-index). ECMA-48 doesn't specify scrolling |
| 246 |
* regions, DEC terminals do apparently, so for CPL and CNL we'll test this. |
| 247 |
*/ |
| 248 |
int |
| 249 |
tst_CPL(MENU_ARGS) |
| 250 |
{ |
| 251 |
int i; |
| 252 |
int last = max_lines - 3; |
| 253 |
|
| 254 |
test_with_margins(TRUE); |
| 255 |
|
| 256 |
set_colors(WHITE_ON_BLUE); |
| 257 |
|
| 258 |
vt_move(max_lines, 1); |
| 259 |
for (i = max_lines - 1; i > 0; i--) { |
| 260 |
cpl(1); |
| 261 |
slowly(); |
| 262 |
tprintf("%d.", i); |
| 263 |
} |
| 264 |
|
| 265 |
set_colors(NULL); |
| 266 |
|
| 267 |
test_with_margins(FALSE); |
| 268 |
|
| 269 |
vt_move(last, 1); |
| 270 |
vt_clear(0); |
| 271 |
println(the_title); |
| 272 |
println("The lines above this should be numbered in sequence, from 1."); |
| 273 |
return MENU_HOLD; |
| 274 |
} |
| 275 |
|
| 276 |
/* |
| 277 |
* VT420 doesn't do this, VT510 does. |
| 278 |
* VT510 ignores margins, but honors DECOM. |
| 279 |
*/ |
| 280 |
int |
| 281 |
tst_HPA(MENU_ARGS) |
| 282 |
{ |
| 283 |
int n; |
| 284 |
int last = max_lines - 4; |
| 285 |
int top; |
| 286 |
int lft; |
| 287 |
int bot; |
| 288 |
int rgt; |
| 289 |
BOX box; |
| 290 |
|
| 291 |
test_with_margins(TRUE); |
| 292 |
|
| 293 |
set_colors(WHITE_ON_BLUE); |
| 294 |
|
| 295 |
top = get_top_margin(); |
| 296 |
lft = get_left_margin(); |
| 297 |
rgt = get_right_margin(); |
| 298 |
bot = get_bottom_margin(last); |
| 299 |
|
| 300 |
if (origin_mode) { |
| 301 |
box.top = top + (bot - top + 1) / 4; |
| 302 |
box.left = lft + (rgt - lft + 1) / 4 - 1; |
| 303 |
box.right = rgt - (rgt - lft + 1) / 4 - 1; |
| 304 |
box.bottom = bot - (bot - top + 1) / 4; |
| 305 |
} else { |
| 306 |
box.top = (max_lines / 4); |
| 307 |
box.left = (min_cols / 4); |
| 308 |
box.right = (min_cols * 3) / 4 - 1; |
| 309 |
box.bottom = (max_lines * 3) / 4; |
| 310 |
} |
| 311 |
|
| 312 |
cup(box.top, box.left); |
| 313 |
for (n = box.left; n <= box.right; n++) { |
| 314 |
hpa(n); |
| 315 |
print_chr('*'); |
| 316 |
} |
| 317 |
|
| 318 |
for (n = box.top; n <= box.bottom; n++) { |
| 319 |
cup(n, box.left + n); |
| 320 |
hpa(box.right); |
| 321 |
print_chr('*'); |
| 322 |
hpa(box.left); |
| 323 |
print_chr('*'); |
| 324 |
} |
| 325 |
|
| 326 |
cup(box.bottom, box.left); |
| 327 |
for (n = box.right; n >= box.left; --n) { |
| 328 |
hpa(n); |
| 329 |
print_chr('*'); |
| 330 |
} |
| 331 |
|
| 332 |
set_colors(NULL); |
| 333 |
|
| 334 |
test_with_margins(FALSE); |
| 335 |
|
| 336 |
vt_move(last, 1); |
| 337 |
vt_clear(0); |
| 338 |
ruler(last, min_cols); |
| 339 |
|
| 340 |
println(the_title); |
| 341 |
if (origin_mode) { |
| 342 |
println("There should be a box-outline made of *'s in the middle of the margins."); |
| 343 |
} else { |
| 344 |
println("There should be a box-outline made of *'s in the middle of the screen."); |
| 345 |
} |
| 346 |
|
| 347 |
return MENU_HOLD; |
| 348 |
} |
| 349 |
|
| 350 |
int |
| 351 |
tst_HPR(MENU_ARGS) |
| 352 |
{ |
| 353 |
int n; |
| 354 |
int last = max_lines - 4; |
| 355 |
int top; |
| 356 |
int lft; |
| 357 |
int bot; |
| 358 |
int rgt; |
| 359 |
BOX box; |
| 360 |
|
| 361 |
test_with_margins(TRUE); |
| 362 |
|
| 363 |
set_colors(WHITE_ON_BLUE); |
| 364 |
|
| 365 |
top = get_top_margin(); |
| 366 |
lft = get_left_margin(); |
| 367 |
rgt = get_right_margin(); |
| 368 |
bot = get_bottom_margin(last); |
| 369 |
|
| 370 |
if (origin_mode) { |
| 371 |
box.top = top + (bot - top + 1) / 4; |
| 372 |
box.left = lft + (rgt - lft + 1) / 4 - 1; |
| 373 |
box.right = rgt - (rgt - lft + 1) / 4 - 1; |
| 374 |
box.bottom = bot - (bot - top + 1) / 4; |
| 375 |
} else { |
| 376 |
box.top = (max_lines / 4); |
| 377 |
box.left = (min_cols / 4); |
| 378 |
box.right = (min_cols * 3) / 4 - 1; |
| 379 |
box.bottom = (max_lines * 3) / 4; |
| 380 |
} |
| 381 |
|
| 382 |
cup(box.top, box.left); |
| 383 |
for (n = box.left; n <= box.right; n++) { |
| 384 |
if (n > box.left) { |
| 385 |
cup(box.top, box.left); |
| 386 |
hpr(n - box.left); |
| 387 |
} |
| 388 |
print_chr('*'); |
| 389 |
} |
| 390 |
|
| 391 |
for (n = box.top; n <= box.bottom; n++) { |
| 392 |
cup(n, 1); |
| 393 |
if (box.left > 1) |
| 394 |
hpr(box.left - 1); |
| 395 |
print_chr('*'); |
| 396 |
hpr(box.right - box.left - 1); |
| 397 |
print_chr('*'); |
| 398 |
} |
| 399 |
|
| 400 |
for (n = box.right; n >= box.left; --n) { |
| 401 |
if (n > box.left) { |
| 402 |
cup(box.bottom, box.left); |
| 403 |
hpr(n - box.left); |
| 404 |
} |
| 405 |
print_chr('*'); |
| 406 |
} |
| 407 |
|
| 408 |
set_colors(NULL); |
| 409 |
|
| 410 |
test_with_margins(FALSE); |
| 411 |
|
| 412 |
vt_move(last, 1); |
| 413 |
vt_clear(0); |
| 414 |
ruler(last, min_cols); |
| 415 |
|
| 416 |
println(the_title); |
| 417 |
if (origin_mode) { |
| 418 |
println("There should be a box-outline made of *'s in the middle of the margins."); |
| 419 |
} else { |
| 420 |
println("There should be a box-outline made of *'s in the middle of the screen."); |
| 421 |
} |
| 422 |
|
| 423 |
return MENU_HOLD; |
| 424 |
} |
| 425 |
|
| 426 |
/* |
| 427 |
* Neither VT420 nor VT510. |
| 428 |
*/ |
| 429 |
static int |
| 430 |
tst_REP(MENU_ARGS) |
| 431 |
{ |
| 432 |
int n; |
| 433 |
int last = max_lines - 5; |
| 434 |
|
| 435 |
test_with_margins(TRUE); |
| 436 |
vt_move(1, 1); |
| 437 |
for (n = 1; n < last; n++) { |
| 438 |
if (n > 1) { |
| 439 |
tprintf(" "); |
| 440 |
if (n > 2) |
| 441 |
rep(n - 2); |
| 442 |
} |
| 443 |
tprintf("+"); |
| 444 |
rep(default_1(n)); /* make that 2 +'s */ |
| 445 |
rep(10); /* this should be ignored, since a control sequence precedes */ |
| 446 |
println(""); |
| 447 |
} |
| 448 |
test_with_margins(FALSE); |
| 449 |
|
| 450 |
vt_move(last, 1); |
| 451 |
for (n = 1; n <= min_cols; n++) |
| 452 |
tprintf("%c", (n == last || n == last + 1) ? '+' : '*'); |
| 453 |
vt_move(last + 1, 1); |
| 454 |
ruler(last + 1, min_cols); |
| 455 |
println(the_title); |
| 456 |
println("There should be a diagonal of 2 +'s down to the row of *'s above this message."); |
| 457 |
println("The ++ in the row of *'s is the target. If there are 11 +'s, ECMA-48 does"); |
| 458 |
println("not prohibit this, but treats it as undefined behavior (still nonstandard)."); |
| 459 |
return MENU_HOLD; |
| 460 |
} |
| 461 |
|
| 462 |
/* |
| 463 |
* Test the SD (scroll-down) by forcing characters written in a diagonal into |
| 464 |
* a horizontal row. |
| 465 |
* |
| 466 |
* VT400 and dtterm use the (incorrect?) escape sequence (ending with 'T' |
| 467 |
* instead of '^'), apparently someone misread 05/14 as 05/04 or vice versa. |
| 468 |
*/ |
| 469 |
int |
| 470 |
tst_SD(MENU_ARGS) |
| 471 |
{ |
| 472 |
int n; |
| 473 |
int last = max_lines - 3; |
| 474 |
|
| 475 |
for (n = 1; n < last; n++) { |
| 476 |
cup(n, n); |
| 477 |
tprintf("*"); |
| 478 |
slowly(); |
| 479 |
sd(default_1a(n)); |
| 480 |
} |
| 481 |
vt_move(last + 1, 1); |
| 482 |
ruler(last + 1, min_cols); |
| 483 |
vt_clear(0); |
| 484 |
println(the_title); |
| 485 |
println("There should be a horizontal row of *'s above, just above the message."); |
| 486 |
return MENU_HOLD; |
| 487 |
} |
| 488 |
|
| 489 |
/* |
| 490 |
* not in VT510 |
| 491 |
* |
| 492 |
* Test the SL (scroll-left) by forcing characters written in a diagonal into |
| 493 |
* a vertical line. |
| 494 |
*/ |
| 495 |
static int |
| 496 |
tst_SL(MENU_ARGS) |
| 497 |
{ |
| 498 |
int n; |
| 499 |
int last = max_lines - 3; |
| 500 |
|
| 501 |
for (n = 1; n < last; n++) { |
| 502 |
cup(n, min_cols / 2 + last - n); |
| 503 |
tprintf("*"); |
| 504 |
slowly(); |
| 505 |
sl(default_1(n)); |
| 506 |
} |
| 507 |
vt_move(last, 1); |
| 508 |
ruler(last, min_cols); |
| 509 |
vt_clear(0); |
| 510 |
println(the_title); |
| 511 |
println("There should be a vertical column of *'s centered above."); |
| 512 |
return MENU_HOLD; |
| 513 |
} |
| 514 |
|
| 515 |
/* |
| 516 |
* not in VT510 |
| 517 |
* |
| 518 |
* Test the SR (scroll-right) by forcing characters written in a diagonal into |
| 519 |
* a vertical line. |
| 520 |
*/ |
| 521 |
static int |
| 522 |
tst_SR(MENU_ARGS) |
| 523 |
{ |
| 524 |
int n; |
| 525 |
int last = max_lines - 3; |
| 526 |
|
| 527 |
for (n = 1; n < last; n++) { |
| 528 |
cup(n, min_cols / 2 - last + n); |
| 529 |
tprintf("*"); |
| 530 |
slowly(); |
| 531 |
sr(default_1(n)); |
| 532 |
} |
| 533 |
vt_move(last, 1); |
| 534 |
ruler(last, min_cols); |
| 535 |
vt_clear(0); |
| 536 |
println(the_title); |
| 537 |
println("There should be a vertical column of *'s centered above."); |
| 538 |
return MENU_HOLD; |
| 539 |
} |
| 540 |
|
| 541 |
/* |
| 542 |
* Test the SU (scroll-up) by forcing characters written in a diagonal into |
| 543 |
* a horizontal row. |
| 544 |
*/ |
| 545 |
int |
| 546 |
tst_SU(MENU_ARGS) |
| 547 |
{ |
| 548 |
int n; |
| 549 |
int last = max_lines - 3; |
| 550 |
|
| 551 |
for (n = 1; n < last; n++) { |
| 552 |
cup(last + 1 - n, n); |
| 553 |
tprintf("*"); |
| 554 |
slowly(); |
| 555 |
su(default_1(n)); |
| 556 |
} |
| 557 |
vt_move(last + 1, 1); |
| 558 |
ruler(last, min_cols); |
| 559 |
vt_clear(0); |
| 560 |
println(the_title); |
| 561 |
println("There should be a horizontal row of *'s above, on the top row."); |
| 562 |
return MENU_HOLD; |
| 563 |
} |
| 564 |
|
| 565 |
/******************************************************************************/ |
| 566 |
|
| 567 |
static int erm_flag; |
| 568 |
|
| 569 |
static int |
| 570 |
toggle_ERM(MENU_ARGS) |
| 571 |
{ |
| 572 |
erm_flag = !erm_flag; |
| 573 |
if (erm_flag) |
| 574 |
sm("6"); |
| 575 |
else |
| 576 |
rm("6"); |
| 577 |
return MENU_NOHOLD; |
| 578 |
} |
| 579 |
|
| 580 |
/* |
| 581 |
* Test SPA (set-protected area). |
| 582 |
*/ |
| 583 |
static int |
| 584 |
tst_SPA(MENU_ARGS) |
| 585 |
{ |
| 586 |
BOX box; |
| 587 |
|
| 588 |
if (make_box_params(&box, 5, 20) == 0) { |
| 589 |
int pass; |
| 590 |
|
| 591 |
for (pass = 0; pass < 2; pass++) { |
| 592 |
if (pass == 0) { |
| 593 |
esc("V"); /* SPA */ |
| 594 |
} |
| 595 |
/* make two passes so we can paint over the protected-chars in the second */ |
| 596 |
draw_box_filled(&box, '*'); |
| 597 |
if (pass == 0) { |
| 598 |
esc("W"); /* EPA */ |
| 599 |
|
| 600 |
cup(max_lines / 2, min_cols / 2); |
| 601 |
ed(0); /* after the cursor */ |
| 602 |
ed(1); /* before the cursor */ |
| 603 |
ed(2); /* the whole display */ |
| 604 |
|
| 605 |
el(0); /* after the cursor */ |
| 606 |
el(1); /* before the cursor */ |
| 607 |
el(2); /* the whole line */ |
| 608 |
|
| 609 |
ech(min_cols); |
| 610 |
|
| 611 |
__(cup(1, 1), println(the_title)); |
| 612 |
cup(max_lines - 4, 1); |
| 613 |
printxx("There %s be an solid box made of *'s in the middle of the screen.\n", |
| 614 |
erm_flag |
| 615 |
? "may" |
| 616 |
: "should"); |
| 617 |
println("note: DEC terminals do not implement ERM (erase mode)."); |
| 618 |
holdit(); |
| 619 |
} |
| 620 |
} |
| 621 |
} |
| 622 |
|
| 623 |
return MENU_NOHOLD; |
| 624 |
} |
| 625 |
|
| 626 |
static int |
| 627 |
tst_protected_area(MENU_ARGS) |
| 628 |
{ |
| 629 |
static char erm_mesg[80]; |
| 630 |
/* *INDENT-OFF* */ |
| 631 |
static MENU my_menu[] = { |
| 632 |
{ "Exit", NULL }, |
| 633 |
{ erm_mesg, toggle_ERM }, |
| 634 |
{ "Test Protected-Areas (SPA)", tst_SPA }, |
| 635 |
{ "", NULL }, |
| 636 |
}; |
| 637 |
/* *INDENT-ON* */ |
| 638 |
|
| 639 |
do { |
| 640 |
vt_clear(2); |
| 641 |
__(title(0), printxx("Protected-Areas Tests")); |
| 642 |
__(title(2), println("Choose test type:")); |
| 643 |
sprintf(erm_mesg, "%s ERM (erase mode)", STR_ENABLE(erm_flag)); |
| 644 |
} while (menu(my_menu)); |
| 645 |
if (erm_flag) |
| 646 |
toggle_ERM(PASS_ARGS); |
| 647 |
return MENU_NOHOLD; |
| 648 |
} |
| 649 |
|
| 650 |
/******************************************************************************/ |
| 651 |
|
| 652 |
/* |
| 653 |
* Kermit's documentation refers to this as CVA, ECMA-48 as VPA. |
| 654 |
* Move the cursor in the current column to the specified line. |
| 655 |
* |
| 656 |
* VT420 doesn't do this, VT510 does |
| 657 |
*/ |
| 658 |
int |
| 659 |
tst_VPA(MENU_ARGS) |
| 660 |
{ |
| 661 |
int n; |
| 662 |
int last = max_lines - 4; |
| 663 |
int top; |
| 664 |
int lft; |
| 665 |
int bot; |
| 666 |
int rgt; |
| 667 |
BOX box; |
| 668 |
|
| 669 |
test_with_margins(TRUE); |
| 670 |
|
| 671 |
set_colors(WHITE_ON_BLUE); |
| 672 |
|
| 673 |
top = get_top_margin(); |
| 674 |
lft = get_left_margin(); |
| 675 |
rgt = get_right_margin(); |
| 676 |
bot = get_bottom_margin(last); |
| 677 |
|
| 678 |
if (origin_mode) { |
| 679 |
box.top = top + (bot - top + 1) / 4; |
| 680 |
box.left = lft + (rgt - lft + 1) / 4 - 1; |
| 681 |
box.right = rgt - (rgt - lft + 1) / 4 - 1; |
| 682 |
box.bottom = bot - (bot - top + 1) / 4; |
| 683 |
} else { |
| 684 |
box.top = (max_lines / 4); |
| 685 |
box.left = (min_cols / 4); |
| 686 |
box.right = (min_cols * 3) / 4 - 1; |
| 687 |
box.bottom = (max_lines * 3) / 4; |
| 688 |
} |
| 689 |
|
| 690 |
/* |
| 691 |
* BS is affected by left/right margins, but VPA is unaffected by margins. |
| 692 |
* Both are affected by origin mode. |
| 693 |
*/ |
| 694 |
if (lrmm_flag) { |
| 695 |
if ((box.left >= lft - 1) && (box.left < lft + 1) && (lft > 1)) { |
| 696 |
if (lft > 2) |
| 697 |
box.left = lft - 2; |
| 698 |
else |
| 699 |
box.left = lft + 1; |
| 700 |
} |
| 701 |
if ((box.right == rgt) && (rgt < min_cols)) |
| 702 |
box.right = rgt + 1; |
| 703 |
} |
| 704 |
|
| 705 |
cup(box.top, box.left); |
| 706 |
for (n = box.left; n <= box.right; n++) { |
| 707 |
print_str("*"); |
| 708 |
if (lrmm_flag && |
| 709 |
!origin_mode && |
| 710 |
(n == rgt) && (rgt < min_cols) && (n < box.right)) { |
| 711 |
cup(box.top, n + 1); |
| 712 |
} |
| 713 |
} |
| 714 |
print_str("\b"); |
| 715 |
for (n = box.top; n <= box.bottom; n++) { |
| 716 |
vpa(n); |
| 717 |
print_str("*\b"); |
| 718 |
} |
| 719 |
|
| 720 |
for (n = box.right; n >= box.left; n--) { |
| 721 |
if (lrmm_flag && |
| 722 |
!origin_mode && |
| 723 |
(((n == lft) && (lft > 1) && (n > box.left)) || |
| 724 |
((n == lft + 1) && (lft > 1) && (n > box.left)) || |
| 725 |
((n == lft - 1) && (lft > 1) && (n > box.left)) || |
| 726 |
((n == rgt + 0) && (rgt < min_cols) && (n < box.right)))) { |
| 727 |
cup(box.bottom, n); |
| 728 |
print_chr('*'); |
| 729 |
cup(box.bottom, n); |
| 730 |
} else { |
| 731 |
print_str("\b*\b"); |
| 732 |
} |
| 733 |
} |
| 734 |
for (n = box.top; n <= box.bottom; n++) { |
| 735 |
vpa(n); |
| 736 |
print_str("*\b"); |
| 737 |
} |
| 738 |
|
| 739 |
set_colors(NULL); |
| 740 |
|
| 741 |
test_with_margins(FALSE); |
| 742 |
|
| 743 |
vt_move(last, 1); |
| 744 |
vt_clear(0); |
| 745 |
|
| 746 |
ruler(last, min_cols); |
| 747 |
|
| 748 |
println(the_title); |
| 749 |
if (origin_mode) { |
| 750 |
println("There should be a box-outline made of *'s in the middle of the margins."); |
| 751 |
} else { |
| 752 |
println("There should be a box-outline made of *'s in the middle of the screen."); |
| 753 |
} |
| 754 |
|
| 755 |
return MENU_HOLD; |
| 756 |
} |
| 757 |
|
| 758 |
int |
| 759 |
tst_VPR(MENU_ARGS) |
| 760 |
{ |
| 761 |
int n; |
| 762 |
int last = max_lines - 4; |
| 763 |
int top; |
| 764 |
int lft; |
| 765 |
int bot; |
| 766 |
int rgt; |
| 767 |
BOX box; |
| 768 |
|
| 769 |
test_with_margins(TRUE); |
| 770 |
|
| 771 |
set_colors(WHITE_ON_BLUE); |
| 772 |
|
| 773 |
top = get_top_margin(); |
| 774 |
lft = get_left_margin(); |
| 775 |
rgt = get_right_margin(); |
| 776 |
bot = get_bottom_margin(last); |
| 777 |
|
| 778 |
if (origin_mode) { |
| 779 |
box.top = top + (bot - top + 1) / 4; |
| 780 |
box.left = lft + (rgt - lft + 1) / 4 - 1; |
| 781 |
box.right = rgt - (rgt - lft + 1) / 4 - 1; |
| 782 |
box.bottom = bot - (bot - top + 1) / 4; |
| 783 |
} else { |
| 784 |
box.top = (max_lines / 4); |
| 785 |
box.left = (min_cols / 4); |
| 786 |
box.right = (min_cols * 3) / 4 - 1; |
| 787 |
box.bottom = (max_lines * 3) / 4; |
| 788 |
} |
| 789 |
|
| 790 |
/* |
| 791 |
* BS is affected by left/right margins, but VPA is unaffected by margins. |
| 792 |
* Both are affected by origin mode. |
| 793 |
*/ |
| 794 |
if (lrmm_flag) { |
| 795 |
if ((box.left >= lft - 1) && (box.left < lft + 1) && (lft > 1)) { |
| 796 |
if (lft > 2) |
| 797 |
box.left = lft - 2; |
| 798 |
else |
| 799 |
box.left = lft + 1; |
| 800 |
} |
| 801 |
if ((box.right == rgt) && (rgt < min_cols)) |
| 802 |
box.right = rgt + 1; |
| 803 |
} |
| 804 |
|
| 805 |
cup(box.top, box.left); |
| 806 |
for (n = box.left; n <= box.right; n++) { |
| 807 |
print_str("*"); |
| 808 |
if (lrmm_flag && |
| 809 |
!origin_mode && |
| 810 |
(n == rgt) && (rgt < min_cols) && (n < box.right)) { |
| 811 |
cup(box.top, n + 1); |
| 812 |
} |
| 813 |
} |
| 814 |
print_str("\b"); |
| 815 |
for (n = box.top; n <= box.bottom; n++) { |
| 816 |
if (n > box.top) { |
| 817 |
cup(box.top, box.right); |
| 818 |
vpr(n - box.top); |
| 819 |
} |
| 820 |
print_str("*\b"); |
| 821 |
} |
| 822 |
|
| 823 |
if (box.right > box.left) { |
| 824 |
for (n = box.right; n > box.left; n--) { |
| 825 |
if (lrmm_flag && |
| 826 |
!origin_mode && |
| 827 |
(((n == lft) && (lft > 1)) || |
| 828 |
((n == lft + 1) && (lft > 1)) || |
| 829 |
((n == lft - 1) && (lft > 1)) || |
| 830 |
((n == rgt + 0) && (rgt < min_cols) && (n < box.right)))) { |
| 831 |
cup(box.bottom, n); |
| 832 |
print_chr('*'); |
| 833 |
cup(box.bottom, n); |
| 834 |
} else { |
| 835 |
print_str("\b*\b"); |
| 836 |
} |
| 837 |
} |
| 838 |
} |
| 839 |
|
| 840 |
for (n = box.bottom; n >= box.top; --n) { |
| 841 |
if (n > box.top) { |
| 842 |
cup(box.top, box.left); |
| 843 |
vpr(n - box.top); |
| 844 |
} |
| 845 |
print_str("*\b"); |
| 846 |
} |
| 847 |
|
| 848 |
set_colors(NULL); |
| 849 |
|
| 850 |
test_with_margins(FALSE); |
| 851 |
|
| 852 |
vt_move(last, 1); |
| 853 |
vt_clear(0); |
| 854 |
|
| 855 |
ruler(last, min_cols); |
| 856 |
|
| 857 |
println(the_title); |
| 858 |
if (origin_mode) { |
| 859 |
println("There should be a box-outline made of *'s in the middle of the margins."); |
| 860 |
} else { |
| 861 |
println("There should be a box-outline made of *'s in the middle of the screen."); |
| 862 |
} |
| 863 |
|
| 864 |
return MENU_HOLD; |
| 865 |
} |
| 866 |
|
| 867 |
/******************************************************************************/ |
| 868 |
|
| 869 |
/* |
| 870 |
* ECMA-48 mentions margins, but does not say how they might be set. VT420 |
| 871 |
* and up implement margins; look in vt520.c for tests of these features |
| 872 |
* which take into account margins. |
| 873 |
*/ |
| 874 |
int |
| 875 |
tst_ecma48_curs(MENU_ARGS) |
| 876 |
{ |
| 877 |
/* *INDENT-OFF* */ |
| 878 |
static MENU my_menu[] = { |
| 879 |
{ "Exit", NULL }, |
| 880 |
{ "Test Character-Position-Absolute (HPA)", tst_HPA }, |
| 881 |
{ "Test Cursor-Back-Tab (CBT)", tst_CBT }, |
| 882 |
{ "Test Cursor-Character-Absolute (CHA)", tst_CHA }, |
| 883 |
{ "Test Cursor-Horizontal-Index (CHT)", tst_CHT }, |
| 884 |
{ "Test Horizontal-Position-Relative (HPR)", tst_HPR }, |
| 885 |
{ "Test Line-Position-Absolute (VPA)", tst_VPA }, |
| 886 |
{ "Test Next-Line (CNL)", tst_CNL }, |
| 887 |
{ "Test Previous-Line (CPL)", tst_CPL }, |
| 888 |
{ "Test Vertical-Position-Relative (VPR)", tst_VPR }, |
| 889 |
{ "", NULL } |
| 890 |
}; |
| 891 |
/* *INDENT-ON* */ |
| 892 |
|
| 893 |
do { |
| 894 |
vt_clear(2); |
| 895 |
__(title(0), printxx("ISO-6429 (ECMA-48) Cursor-Movement")); |
| 896 |
__(title(2), println("Choose test type:")); |
| 897 |
} while (menu(my_menu)); |
| 898 |
return MENU_NOHOLD; |
| 899 |
} |
| 900 |
|
| 901 |
int |
| 902 |
tst_ecma48_misc(MENU_ARGS) |
| 903 |
{ |
| 904 |
/* *INDENT-OFF* */ |
| 905 |
static MENU my_menu[] = { |
| 906 |
{ "Exit", NULL }, |
| 907 |
{ "Protected-Area Tests", tst_protected_area }, |
| 908 |
{ "Test Repeat (REP)", tst_REP }, |
| 909 |
{ "Test Scroll-Down (SD)", tst_SD }, |
| 910 |
{ "Test Scroll-Left (SL)", tst_SL }, |
| 911 |
{ "Test Scroll-Right (SR)", tst_SR }, |
| 912 |
{ "Test Scroll-Up (SU)", tst_SU }, |
| 913 |
{ "", NULL }, |
| 914 |
}; |
| 915 |
/* *INDENT-ON* */ |
| 916 |
|
| 917 |
do { |
| 918 |
vt_clear(2); |
| 919 |
__(title(0), printxx("Miscellaneous ISO-6429 (ECMA-48) Tests")); |
| 920 |
__(title(2), println("Choose test type:")); |
| 921 |
} while (menu(my_menu)); |
| 922 |
return MENU_NOHOLD; |
| 923 |
} |
| 924 |
|
| 925 |
/******************************************************************************/ |
| 926 |
int |
| 927 |
tst_nonvt100(MENU_ARGS) |
| 928 |
{ |
| 929 |
/* *INDENT-OFF* */ |
| 930 |
static MENU my_menu[] = { |
| 931 |
{ "Exit", NULL }, |
| 932 |
{ "Test of VT220 features", tst_vt220 }, |
| 933 |
{ "Test of VT320 features", tst_vt320 }, |
| 934 |
{ "Test of VT420 features", tst_vt420 }, |
| 935 |
{ "Test of VT520 features", tst_vt520 }, |
| 936 |
{ "Test ISO-6429 cursor-movement", tst_ecma48_curs }, |
| 937 |
{ "Test ISO-6429 colors", tst_colors }, |
| 938 |
{ "Test other ISO-6429 features", tst_ecma48_misc }, |
| 939 |
{ "Test XTERM special features", tst_xterm }, |
| 940 |
{ "", NULL } |
| 941 |
}; |
| 942 |
/* *INDENT-ON* */ |
| 943 |
|
| 944 |
do { |
| 945 |
vt_clear(2); |
| 946 |
title(0); |
| 947 |
printxx("Non-VT100 Tests"); |
| 948 |
title(2); |
| 949 |
println("Choose test type:"); |
| 950 |
} while (menu(my_menu)); |
| 951 |
return MENU_NOHOLD; |
| 952 |
} |