| 1 |
/* $Id: vt320.c,v 1.102 2024/12/05 00:43:14 tom Exp $ */ |
| 2 |
|
| 3 |
/* |
| 4 |
* Reference: VT330/VT340 Programmer Reference Manual (EK-VT3XX-TP-001) |
| 5 |
*/ |
| 6 |
#include <vttest.h> |
| 7 |
#include <ttymodes.h> |
| 8 |
#include <draw.h> |
| 9 |
#include <esc.h> |
| 10 |
|
| 11 |
static void |
| 12 |
show_Locator_Status(const char *report) |
| 13 |
{ |
| 14 |
int pos = 0; |
| 15 |
int code = scanto(report, &pos, 'n'); |
| 16 |
const char *show; |
| 17 |
|
| 18 |
switch (code) { |
| 19 |
case 53: |
| 20 |
show = "No locator"; |
| 21 |
break; |
| 22 |
case 50: |
| 23 |
show = "Locator ready"; |
| 24 |
break; |
| 25 |
case 58: |
| 26 |
show = "Locator busy"; |
| 27 |
break; |
| 28 |
default: |
| 29 |
show = SHOW_FAILURE; |
| 30 |
} |
| 31 |
show_result("%s", show); |
| 32 |
} |
| 33 |
|
| 34 |
static void |
| 35 |
show_Identify_Locator(const char *report) |
| 36 |
{ |
| 37 |
int pos = 0; |
| 38 |
int Ps1 = scan_any(report, &pos, 'n'); |
| 39 |
int Ps2 = scanto(report, &pos, 'n'); |
| 40 |
const char *show = SHOW_FAILURE; |
| 41 |
|
| 42 |
if (Ps1 == 57) { |
| 43 |
switch (Ps2) { |
| 44 |
case 0: |
| 45 |
show = "Cannot identify locator"; |
| 46 |
break; |
| 47 |
case 1: |
| 48 |
show = "Locator is mouse"; |
| 49 |
break; |
| 50 |
case 2: |
| 51 |
show = "Locator is tablet"; |
| 52 |
break; |
| 53 |
} |
| 54 |
} |
| 55 |
show_result("%s", show); |
| 56 |
} |
| 57 |
|
| 58 |
/* |
| 59 |
* Though some people refer to the locator controls as "vt220", it appears in |
| 60 |
* later terminals (documented in the vt330 manual, but introduced as in UWS). |
| 61 |
*/ |
| 62 |
static int |
| 63 |
tst_DSR_locator_status(MENU_ARGS) |
| 64 |
{ |
| 65 |
return any_DSR(PASS_ARGS, "?55n", show_Locator_Status); |
| 66 |
} |
| 67 |
|
| 68 |
static int |
| 69 |
tst_DSR_identify_locator(MENU_ARGS) |
| 70 |
{ |
| 71 |
return any_DSR(PASS_ARGS, "?56n", show_Identify_Locator); |
| 72 |
} |
| 73 |
|
| 74 |
static void |
| 75 |
show_ExtendedCursorPosition(const char *report) |
| 76 |
{ |
| 77 |
int pos = 0; |
| 78 |
int Pl = scan_any(report, &pos, 'R'); |
| 79 |
int Pc = scan_any(report, &pos, 'R'); |
| 80 |
int Pp = scan_any(report, &pos, 'R'); |
| 81 |
|
| 82 |
if (Pl != 0 && Pc != 0) { |
| 83 |
if (Pp != 0) |
| 84 |
show_result("Line %d, Column %d, Page %d", Pl, Pc, Pp); |
| 85 |
else |
| 86 |
show_result("Line %d, Column %d (Page?)", Pl, Pc); |
| 87 |
} else |
| 88 |
show_result(SHOW_FAILURE); |
| 89 |
} |
| 90 |
|
| 91 |
/* vt340/vt420 & up */ |
| 92 |
int |
| 93 |
tst_DSR_cursor(MENU_ARGS) |
| 94 |
{ |
| 95 |
return any_DSR(PASS_ARGS, "?6n", show_ExtendedCursorPosition); |
| 96 |
} |
| 97 |
|
| 98 |
/******************************************************************************/ |
| 99 |
|
| 100 |
int |
| 101 |
tst_vt320_device_status(MENU_ARGS) |
| 102 |
{ |
| 103 |
/* *INDENT-OFF* */ |
| 104 |
static MENU my_menu[] = { |
| 105 |
{ "Exit", NULL }, |
| 106 |
{ "Test VT220 features", tst_vt220_device_status }, |
| 107 |
{ "Test Keyboard Status", tst_DSR_keyboard }, |
| 108 |
{ "Test Printer Status", tst_DSR_printer }, |
| 109 |
{ "Test UDK Status", tst_DSR_userkeys }, |
| 110 |
{ "Test Locator Status", tst_DSR_locator_status }, |
| 111 |
{ "Identify Locator", tst_DSR_identify_locator }, |
| 112 |
{ "Test Extended Cursor-Position (DECXCPR)", tst_DSR_cursor }, |
| 113 |
{ "", NULL } |
| 114 |
}; |
| 115 |
/* *INDENT-ON* */ |
| 116 |
|
| 117 |
do { |
| 118 |
vt_clear(2); |
| 119 |
__(title(0), printxx("VT320 Device Status Reports (DSR)")); |
| 120 |
__(title(2), println("Choose test type:")); |
| 121 |
} while (menu(my_menu)); |
| 122 |
return MENU_NOHOLD; |
| 123 |
} |
| 124 |
|
| 125 |
/******************************************************************************/ |
| 126 |
|
| 127 |
/* |
| 128 |
* DECCIR returns single characters separated by semicolons. It's not clear |
| 129 |
* (unless you test on a DEC terminal) from the documentation, which only cites |
| 130 |
* their values. This function returns an equivalent-value, recovering from |
| 131 |
* the bogus implementations that return a decimal number. |
| 132 |
*/ |
| 133 |
static int |
| 134 |
scan_chr(const char *str, int *pos, int toc) |
| 135 |
{ |
| 136 |
int value = 0; |
| 137 |
while (str[*pos] != '\0' && str[*pos] != toc) { |
| 138 |
value = (value * 256) + (unsigned char) str[*pos]; |
| 139 |
*pos += 1; |
| 140 |
} |
| 141 |
if (str[*pos] == toc) |
| 142 |
*pos += 1; |
| 143 |
return value; |
| 144 |
} |
| 145 |
|
| 146 |
/* |
| 147 |
* From Kermit 3.13 & VT220 pocket guide |
| 148 |
* |
| 149 |
* Request CSI 1 $ w cursor information report |
| 150 |
* Response DCS 1 $ u Pr; Pc; Pp; Srend; Satt; Sflag; Pgl; Pgr; Scss; Sdesig ST |
| 151 |
* where Pr is cursor row (counted from origin as 1,1) |
| 152 |
* Pc is cursor column |
| 153 |
* Pp is 1, video page, a constant for VT320s |
| 154 |
* Srend = 40h + 8 (rev video on) + 4 (blinking on) |
| 155 |
* + 2 (underline on) + 1 (bold on) |
| 156 |
* Satt = 40h + 1 (selective erase on) |
| 157 |
* Sflag = 40h + 8 (autowrap pending) + 4 (SS3 pending) |
| 158 |
* + 2 (SS2 pending) + 1 (Origin mode on) |
| 159 |
* Pgl = char set in GL (0 = G0, 1 = G1, 2 = G2, 3 = G3) |
| 160 |
* Pgr = char set in GR (same as for Pgl) |
| 161 |
* Scss = 40h + 8 (G3 is 96 char) + 4 (G2 is 96 char) |
| 162 |
* + 2 (G1 is 96 char) + 1 (G0 is 96 char) |
| 163 |
* Sdesig is string of character idents for sets G0...G3, with |
| 164 |
* no separators between set idents. |
| 165 |
* If NRCs are active the set idents (all 94 byte types) are: |
| 166 |
* British A Italian Y |
| 167 |
* Dutch 4 Norwegian/Danish ' (hex 60) or E or 6 |
| 168 |
* Finnish 5 or C Portuguese %6 or g or L |
| 169 |
* French R or f Spanish Z |
| 170 |
* French Canadian 9 or Q Swedish 7 or H |
| 171 |
* German K Swiss = |
| 172 |
* Hebrew %= |
| 173 |
* (MS Kermit uses any choice when there are multiple) |
| 174 |
*/ |
| 175 |
|
| 176 |
typedef struct { |
| 177 |
/* position */ |
| 178 |
int row; |
| 179 |
int col; |
| 180 |
int page; |
| 181 |
/* current rendition */ |
| 182 |
int Srend; /* raw rendition information */ |
| 183 |
int reverse; |
| 184 |
int blinking; |
| 185 |
int underline; |
| 186 |
int bold; |
| 187 |
/* attributes */ |
| 188 |
int Satt; /* raw attribute information */ |
| 189 |
int selective_erase; |
| 190 |
/* flags */ |
| 191 |
int Sflag; /* raw flag-information */ |
| 192 |
int aw_pending; |
| 193 |
int ss3_pending; |
| 194 |
int ss2_pending; |
| 195 |
int origin_mode; |
| 196 |
/* character sets */ |
| 197 |
int gl; |
| 198 |
int gr; |
| 199 |
int Scss; |
| 200 |
char cs_suffix[4][3]; |
| 201 |
int cs_sizes[4]; |
| 202 |
const char *cs_names[4]; |
| 203 |
} DECCIR_REPORT; |
| 204 |
|
| 205 |
static int |
| 206 |
parse_DECCIR(const char *input, DECCIR_REPORT * output) |
| 207 |
{ |
| 208 |
int valid = 1; |
| 209 |
int pos = 3; /* skip "1$u" */ |
| 210 |
int n; |
| 211 |
|
| 212 |
memset(output, 0, sizeof(*output)); |
| 213 |
|
| 214 |
/* *INDENT-EQLS* */ |
| 215 |
output->row = scanto(input, &pos, ';'); |
| 216 |
output->col = scanto(input, &pos, ';'); |
| 217 |
output->page = scanto(input, &pos, ';'); |
| 218 |
|
| 219 |
output->Srend = scan_chr(input, &pos, ';'); |
| 220 |
if (output->Srend & 0x40) { |
| 221 |
/* *INDENT-EQLS* */ |
| 222 |
output->reverse = ((output->Srend & 0x08) != 0); |
| 223 |
output->blinking = ((output->Srend & 0x04) != 0); |
| 224 |
output->underline = ((output->Srend & 0x02) != 0); |
| 225 |
output->bold = ((output->Srend & 0x01) != 0); |
| 226 |
} |
| 227 |
|
| 228 |
output->Satt = scan_chr(input, &pos, ';'); |
| 229 |
if (output->Satt & 0x40) { |
| 230 |
output->selective_erase = ((output->Satt & 1) != 0); |
| 231 |
} |
| 232 |
|
| 233 |
output->Sflag = scan_chr(input, &pos, ';'); |
| 234 |
if (output->Sflag & 0x40) { |
| 235 |
/* *INDENT-EQLS* */ |
| 236 |
output->aw_pending = ((output->Sflag & 0x08) != 0); |
| 237 |
output->ss3_pending = ((output->Sflag & 0x04) != 0); |
| 238 |
output->ss2_pending = ((output->Sflag & 0x02) != 0); |
| 239 |
output->origin_mode = ((output->Sflag & 0x01) != 0); |
| 240 |
} |
| 241 |
|
| 242 |
output->gl = scanto(input, &pos, ';'); |
| 243 |
output->gr = scanto(input, &pos, ';'); |
| 244 |
|
| 245 |
output->Scss = scan_chr(input, &pos, ';'); |
| 246 |
if (output->Scss & 0x40) { |
| 247 |
output->cs_sizes[3] = (output->Scss & 0x08) ? 96 : 94; |
| 248 |
output->cs_sizes[2] = (output->Scss & 0x04) ? 96 : 94; |
| 249 |
output->cs_sizes[1] = (output->Scss & 0x02) ? 96 : 94; |
| 250 |
output->cs_sizes[0] = (output->Scss & 0x01) ? 96 : 94; |
| 251 |
} |
| 252 |
|
| 253 |
n = 0; |
| 254 |
while (input[pos] != '\0') { |
| 255 |
strncpy(output->cs_suffix[n], input + pos, (size_t) 2)[2] = '\0'; |
| 256 |
if (output->cs_suffix[n][0] != '%') { |
| 257 |
output->cs_suffix[n][1] = '\0'; |
| 258 |
} |
| 259 |
output->cs_names[n++] = parse_Sdesig(input, &pos); |
| 260 |
if (n >= 4) |
| 261 |
break; |
| 262 |
} |
| 263 |
|
| 264 |
return valid; |
| 265 |
} |
| 266 |
|
| 267 |
static int |
| 268 |
read_DECCIR(DECCIR_REPORT * output) |
| 269 |
{ |
| 270 |
char *report; |
| 271 |
int Ps = 1; |
| 272 |
|
| 273 |
do_csi("%d$w", Ps); |
| 274 |
report = get_reply(); |
| 275 |
if ((report = skip_dcs(report)) != NULL |
| 276 |
&& strip_terminator(report) |
| 277 |
&& *report == Ps + '0' |
| 278 |
&& !strncmp(report + 1, "$u", (size_t) 2)) { |
| 279 |
return parse_DECCIR(report, output); |
| 280 |
} else { |
| 281 |
return 0; |
| 282 |
} |
| 283 |
} |
| 284 |
|
| 285 |
#define show_DECCIR_flag(value, mask, string) \ |
| 286 |
if (value & mask) { value &= ~mask; show_result(string); } |
| 287 |
|
| 288 |
static void |
| 289 |
show_DECCIR(const char *report) |
| 290 |
{ |
| 291 |
int row; |
| 292 |
int n; |
| 293 |
DECCIR_REPORT data; |
| 294 |
|
| 295 |
parse_DECCIR(report, &data); |
| 296 |
|
| 297 |
vt_move(5, 10); |
| 298 |
show_result("Cursor (%d,%d), page %d", data.row, data.col, data.page); |
| 299 |
|
| 300 |
vt_move(6, 10); |
| 301 |
if ((data.Srend & 0x4f) == data.Srend) { |
| 302 |
printxx("Rendition:"); |
| 303 |
if (data.Srend == 0) { |
| 304 |
show_result(" normal"); |
| 305 |
} else { |
| 306 |
printxx("%s", data.reverse ? " reverse" : ""); |
| 307 |
printxx("%s", data.blinking ? " blinking" : ""); |
| 308 |
printxx("%s", data.underline ? " underline" : ""); |
| 309 |
printxx("%s", data.bold ? " bold" : ""); |
| 310 |
} |
| 311 |
} else { |
| 312 |
show_result(" -> unknown rendition (0x%x)", data.Srend); |
| 313 |
} |
| 314 |
|
| 315 |
vt_move(7, 10); |
| 316 |
if ((data.Satt & 0x4f) == data.Satt) { |
| 317 |
show_result("Selective erase: %s", data.selective_erase ? "ON" : "off"); |
| 318 |
} else { |
| 319 |
show_result(" -> unknown attribute (0x%x)", data.Satt); |
| 320 |
} |
| 321 |
|
| 322 |
vt_move(8, 10); |
| 323 |
if ((data.Sflag & 0x4f) == data.Sflag) { |
| 324 |
printxx("Flags:"); |
| 325 |
printxx("%s", data.aw_pending ? " autowrap pending" : ""); |
| 326 |
printxx("%s", data.ss3_pending ? " SS3 pending" : ""); |
| 327 |
printxx("%s", data.ss2_pending ? " SS2 pending" : ""); |
| 328 |
printxx("%s", data.origin_mode ? " origin-mode on" : ""); |
| 329 |
} else { |
| 330 |
show_result(" -> unknown flag (0x%x)", data.Sflag); |
| 331 |
} |
| 332 |
|
| 333 |
vt_move(9, 10); |
| 334 |
show_result("Character set in GL: G%d", data.gl); |
| 335 |
|
| 336 |
vt_move(10, 10); |
| 337 |
show_result("Character set in GR: G%d", data.gr); |
| 338 |
|
| 339 |
vt_move(11, 10); |
| 340 |
if ((data.Scss & 0x4f) == data.Scss) { |
| 341 |
printxx(" Character set sizes:"); |
| 342 |
for (n = 0; n <= 3; n++) { |
| 343 |
printxx(" G%d(%d)", n, data.cs_sizes[n]); |
| 344 |
} |
| 345 |
} else { |
| 346 |
show_result(" -> unknown char set size (0x%x)", data.Scss); |
| 347 |
} |
| 348 |
|
| 349 |
row = 12; |
| 350 |
vt_move(row, 10); |
| 351 |
show_result("Character set names for G0...G3: "); |
| 352 |
println(""); |
| 353 |
for (n = 0; n < 4; ++n) { |
| 354 |
show_result(" %s\n", (data.cs_names[n] |
| 355 |
? data.cs_names[n] |
| 356 |
: "?")); |
| 357 |
println(""); |
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
/******************************************************************************/ |
| 362 |
static void |
| 363 |
setup_charset(void) |
| 364 |
{ |
| 365 |
int g; |
| 366 |
for (g = 0; g <= 3; ++g) { |
| 367 |
if (current_Gx[g] != sane_cs(g)) |
| 368 |
do_scs(g); |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
static void |
| 373 |
restore_charset(void) |
| 374 |
{ |
| 375 |
int g; |
| 376 |
for (g = 0; g <= 3; ++g) { |
| 377 |
if (current_Gx[g]) { |
| 378 |
int save = current_Gx[g]; |
| 379 |
current_Gx[g] = sane_cs(g); |
| 380 |
do_scs(g); |
| 381 |
current_Gx[g] = save; |
| 382 |
} |
| 383 |
} |
| 384 |
} |
| 385 |
|
| 386 |
/******************************************************************************/ |
| 387 |
|
| 388 |
/* |
| 389 |
* Request CSI 2 $ w tab stop report |
| 390 |
* Response DCS 2 $ u Pc/Pc/...Pc ST |
| 391 |
* Pc are column numbers (from 1) where tab stops occur. Note the |
| 392 |
* separator "/" occurs in a real VT320 but should have been ";". |
| 393 |
*/ |
| 394 |
static void |
| 395 |
show_DECTABSR(char *report, int row) |
| 396 |
{ |
| 397 |
int pos = 3; /* skip "2$u" */ |
| 398 |
int stop; |
| 399 |
int *stops; |
| 400 |
int n; |
| 401 |
int len = 0; |
| 402 |
int used = 0; |
| 403 |
|
| 404 |
if ((stops = (int *) malloc(sizeof(int) * (strlen(report) + 1))) == NULL) |
| 405 |
no_memory(); |
| 406 |
strcat(report, "/"); /* simplify scanning */ |
| 407 |
while ((stop = scanto(report, &pos, '/')) != 0) { |
| 408 |
stops[len++] = stop; |
| 409 |
} |
| 410 |
println(""); |
| 411 |
printxx("Tab stops:"); |
| 412 |
row += 2; |
| 413 |
ruler(row, min_cols); |
| 414 |
for (n = 0; n < len; ++n) { |
| 415 |
if (stops[n] <= min_cols && stops[n] > 0) { |
| 416 |
cup(row, stops[n]); |
| 417 |
print_chr('*'); |
| 418 |
} |
| 419 |
} |
| 420 |
cup(++row, 1); |
| 421 |
for (n = used = 0; n < len; ++n) { |
| 422 |
if (stops[n] <= min_cols && stops[n] > 0) { |
| 423 |
if (used) |
| 424 |
print_chr('\t'); |
| 425 |
print_chr('*'); |
| 426 |
++used; |
| 427 |
} |
| 428 |
} |
| 429 |
free(stops); |
| 430 |
} |
| 431 |
|
| 432 |
/******************************************************************************/ |
| 433 |
|
| 434 |
int |
| 435 |
any_decrqpsr(MENU_ARGS, int Ps) |
| 436 |
{ |
| 437 |
char *report; |
| 438 |
int row; |
| 439 |
|
| 440 |
vt_move(1, 1); |
| 441 |
printxx("Testing DECRQPSR: %s\n", the_title); |
| 442 |
|
| 443 |
set_tty_raw(TRUE); |
| 444 |
set_tty_echo(FALSE); |
| 445 |
|
| 446 |
vt_move(row = 3, 10); |
| 447 |
|
| 448 |
setup_charset(); |
| 449 |
do_csi("%d$w", Ps); |
| 450 |
report = get_reply(); |
| 451 |
restore_charset(); |
| 452 |
|
| 453 |
row = chrprint2(report, row, 1); |
| 454 |
if ((report = skip_dcs(report)) != NULL) { |
| 455 |
if (strip_terminator(report) |
| 456 |
&& *report == Ps + '0' |
| 457 |
&& !strncmp(report + 1, "$u", (size_t) 2)) { |
| 458 |
show_result("%s (valid request)", SHOW_SUCCESS); |
| 459 |
switch (Ps) { |
| 460 |
case 1: |
| 461 |
show_DECCIR(report); |
| 462 |
break; |
| 463 |
case 2: |
| 464 |
show_DECTABSR(report, row); |
| 465 |
break; |
| 466 |
} |
| 467 |
} else { |
| 468 |
show_result(SHOW_FAILURE); |
| 469 |
} |
| 470 |
} else { |
| 471 |
show_result(SHOW_FAILURE); |
| 472 |
} |
| 473 |
|
| 474 |
restore_ttymodes(); |
| 475 |
vt_move(max_lines - 1, 1); |
| 476 |
return MENU_HOLD; |
| 477 |
} |
| 478 |
|
| 479 |
/******************************************************************************/ |
| 480 |
|
| 481 |
static int |
| 482 |
tst_DECCIR(MENU_ARGS) |
| 483 |
{ |
| 484 |
return any_decrqpsr(PASS_ARGS, 1); |
| 485 |
} |
| 486 |
|
| 487 |
static int |
| 488 |
tst_any_DECCIR(MENU_ARGS) |
| 489 |
{ |
| 490 |
static char whatis_Gx[4][80]; |
| 491 |
static char nrc_mesg[80]; |
| 492 |
/* *INDENT-OFF* */ |
| 493 |
static MENU my_menu[] = { |
| 494 |
{ "Exit", NULL }, |
| 495 |
{ "Reset (G0 ASCII, G1 Latin-1, no NRC mode)", reset_charset }, |
| 496 |
{ nrc_mesg, toggle_nrc }, |
| 497 |
{ whatis_Gx[0], specify_G0 }, |
| 498 |
{ whatis_Gx[1], specify_G1 }, |
| 499 |
{ whatis_Gx[2], specify_G2 }, |
| 500 |
{ whatis_Gx[3], specify_G3 }, |
| 501 |
{ "Cursor Information Report (DECCIR)", tst_DECCIR }, |
| 502 |
{ "", NULL } |
| 503 |
}; |
| 504 |
/* *INDENT-ON* */ |
| 505 |
|
| 506 |
reset_charset(PASS_ARGS); /* make the menu consistent */ |
| 507 |
|
| 508 |
if (get_level() > 2) { |
| 509 |
int n; |
| 510 |
|
| 511 |
do { |
| 512 |
vt_clear(2); |
| 513 |
__(title(0), printxx("Character-Set Tests")); |
| 514 |
__(title(2), println("Choose test type:")); |
| 515 |
sprintf(nrc_mesg, "%s National Replacement Character (NRC) mode", |
| 516 |
STR_ENABLE(scs_national)); |
| 517 |
for (n = 0; n < 4; n++) { |
| 518 |
sprintf(whatis_Gx[n], "Specify G%d (now %s)", |
| 519 |
n, charset_name(n, current_Gx[n])); |
| 520 |
} |
| 521 |
} while (menu(my_menu)); |
| 522 |
/* tidy in case a "vt100" emulator does not ignore SCS */ |
| 523 |
vt_clear(1); |
| 524 |
return reset_charset(PASS_ARGS); |
| 525 |
} else { |
| 526 |
vt_move(1, 1); |
| 527 |
printxx("Sorry, terminal supports only VT%d", terminal_id()); |
| 528 |
vt_move(max_lines - 1, 1); |
| 529 |
return MENU_HOLD; |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
/******************************************************************************/ |
| 534 |
|
| 535 |
static void |
| 536 |
set_tabstops(int row, int stop) |
| 537 |
{ |
| 538 |
int col; |
| 539 |
|
| 540 |
tbc(3); /* clear existing tab-stops */ |
| 541 |
for (col = 0; col < min_cols; col += stop) { |
| 542 |
cup(row, 1 + col); |
| 543 |
hts(); |
| 544 |
} |
| 545 |
} |
| 546 |
|
| 547 |
static int test_tabstop; |
| 548 |
|
| 549 |
static int |
| 550 |
reset_tabstops(MENU_ARGS) |
| 551 |
{ |
| 552 |
set_tabstops(1, test_tabstop = 8); |
| 553 |
return MENU_NOHOLD; |
| 554 |
} |
| 555 |
|
| 556 |
static int |
| 557 |
toggle_tabstop(MENU_ARGS) |
| 558 |
{ |
| 559 |
if (--test_tabstop < 4) |
| 560 |
test_tabstop = 10; |
| 561 |
return MENU_NOHOLD; |
| 562 |
} |
| 563 |
|
| 564 |
static int |
| 565 |
tst_DECTABSR(MENU_ARGS) |
| 566 |
{ |
| 567 |
set_tabstops(1, test_tabstop); |
| 568 |
return any_decrqpsr(PASS_ARGS, 2); |
| 569 |
} |
| 570 |
|
| 571 |
static int |
| 572 |
tst_any_DECTABSR(MENU_ARGS) |
| 573 |
{ |
| 574 |
static char msg_toggle_tabstop[80]; |
| 575 |
/* *INDENT-OFF* */ |
| 576 |
static MENU my_menu[] = { |
| 577 |
{ "Exit", NULL }, |
| 578 |
{ "Reset Tab Stops", reset_tabstops }, |
| 579 |
{ msg_toggle_tabstop, toggle_tabstop }, |
| 580 |
{ "Tab Stop Report (DECTABSR)", tst_DECTABSR }, |
| 581 |
{ "", NULL } |
| 582 |
}; |
| 583 |
/* *INDENT-ON* */ |
| 584 |
int last_tabstop = 0; |
| 585 |
|
| 586 |
reset_tabstops(PASS_ARGS); /* make the menu consistent */ |
| 587 |
|
| 588 |
do { |
| 589 |
vt_clear(2); |
| 590 |
__(title(0), printxx("Tab Stop Report (DECTABSR)")); |
| 591 |
__(title(2), println("Choose test type:")); |
| 592 |
if (last_tabstop != test_tabstop) |
| 593 |
sprintf(msg_toggle_tabstop, "Set Tabs: %d", last_tabstop = test_tabstop); |
| 594 |
} while (menu(my_menu)); |
| 595 |
vt_clear(1); |
| 596 |
return reset_tabstops(PASS_ARGS); |
| 597 |
} |
| 598 |
|
| 599 |
/******************************************************************************/ |
| 600 |
|
| 601 |
/* |
| 602 |
* The restore should move the cursor to 2,1; the relative move back to the |
| 603 |
* test-grid demonstrates that. |
| 604 |
*/ |
| 605 |
static void |
| 606 |
tst_restore_cursor(const char *old_mode, int row, int col) |
| 607 |
{ |
| 608 |
print_str(old_mode); |
| 609 |
fflush(stdout); /* ensure terminal is updated */ |
| 610 |
if (row > 2) |
| 611 |
cud(row - 2); |
| 612 |
if (col > 1) |
| 613 |
cuf(col - 1); |
| 614 |
} |
| 615 |
|
| 616 |
static int |
| 617 |
tst_DECRSPS_cursor(MENU_ARGS) |
| 618 |
{ |
| 619 |
char *old_mode; |
| 620 |
char *s; |
| 621 |
DECCIR_REPORT actual; |
| 622 |
|
| 623 |
vt_move(1, 1); |
| 624 |
printxx("Testing %s\n", the_title); |
| 625 |
|
| 626 |
set_tty_raw(TRUE); |
| 627 |
set_tty_echo(FALSE); |
| 628 |
|
| 629 |
decrqpsr(1); |
| 630 |
old_mode = strdup(get_reply()); |
| 631 |
|
| 632 |
if ((s = strchr(old_mode, 'u')) != NULL) { |
| 633 |
int item; |
| 634 |
int row, col; |
| 635 |
int len; |
| 636 |
int j, k; |
| 637 |
int tries, fails; |
| 638 |
char temp[80]; |
| 639 |
|
| 640 |
println(""); |
| 641 |
println("Position/rendition:"); |
| 642 |
*s = 't'; |
| 643 |
|
| 644 |
for (item = 0; item < 16; ++item) { |
| 645 |
cup(row = item + 4, col = 10); |
| 646 |
sprintf(temp, "rendition[%2d]: ", item); |
| 647 |
len = print_str(temp); |
| 648 |
if (item == 0) { |
| 649 |
len += print_str(" none"); |
| 650 |
} else { |
| 651 |
if (item & 8) { |
| 652 |
len += print_chr(' '); |
| 653 |
sgr("7"); |
| 654 |
len += print_str("reverse"); |
| 655 |
} |
| 656 |
if (item & 4) { |
| 657 |
len += print_chr(' '); |
| 658 |
sgr("5"); |
| 659 |
len += print_str("blinking"); |
| 660 |
} |
| 661 |
if (item & 2) { |
| 662 |
len += print_chr(' '); |
| 663 |
sgr("4"); |
| 664 |
len += print_str("underline"); |
| 665 |
} |
| 666 |
if (item & 1) { |
| 667 |
len += print_chr(' '); |
| 668 |
sgr("1"); |
| 669 |
len += print_str("bold"); |
| 670 |
} |
| 671 |
} |
| 672 |
if (read_DECCIR(&actual)) { |
| 673 |
tst_restore_cursor(old_mode, row, col + len); |
| 674 |
if (actual.Srend != (0x40 | item)) { |
| 675 |
printxx(" (rendition?)"); |
| 676 |
} else if (actual.row != row) { |
| 677 |
printxx(" (row?)"); |
| 678 |
} else if (actual.col != (col + len)) { |
| 679 |
printxx(" (col?)"); |
| 680 |
} else { |
| 681 |
printxx(" (OK)"); |
| 682 |
} |
| 683 |
} else { |
| 684 |
tst_restore_cursor(old_mode, row, col + len); |
| 685 |
printxx(" (N/A)"); |
| 686 |
} |
| 687 |
} |
| 688 |
|
| 689 |
cup(max_lines - 1, 1); |
| 690 |
restore_ttymodes(); |
| 691 |
holdit(); |
| 692 |
|
| 693 |
set_tty_raw(TRUE); |
| 694 |
set_tty_echo(FALSE); |
| 695 |
|
| 696 |
vt_move(1, 1); |
| 697 |
printxx("Testing %s\n", the_title); |
| 698 |
ed(0); |
| 699 |
println(""); |
| 700 |
println("Flags:"); |
| 701 |
|
| 702 |
len = 42; |
| 703 |
vt_move(row = 4, col = 10); |
| 704 |
tprintf("%-*s", len, "Selective erase, should be blank:"); |
| 705 |
tst_restore_cursor(old_mode, row, col + len); |
| 706 |
tprintf("XXXXXX"); |
| 707 |
vt_move(row, col + len); |
| 708 |
decsel(0); |
| 709 |
|
| 710 |
vt_move(++row, col); |
| 711 |
tprintf("%-*s", len, "Selective erase, should not be blank:"); |
| 712 |
vt_move(row, col + len); |
| 713 |
decsca(1); |
| 714 |
tprintf("XXXXXX"); |
| 715 |
vt_move(row, col + len); |
| 716 |
decsel(0); |
| 717 |
|
| 718 |
fails = 0; |
| 719 |
tries = 0; |
| 720 |
for (j = ++row; j <= max_lines; ++j) { |
| 721 |
cup(j, min_cols - 1); |
| 722 |
for (k = 0; k < 3; k++) { |
| 723 |
print_chr('0' + k); |
| 724 |
fflush(stdout); |
| 725 |
if (read_DECCIR(&actual)) { |
| 726 |
tries++; |
| 727 |
if (actual.aw_pending ^ (k == 1)) |
| 728 |
fails += 1; |
| 729 |
} |
| 730 |
if (j >= max_lines && k > 0) |
| 731 |
break; |
| 732 |
} |
| 733 |
} |
| 734 |
|
| 735 |
vt_move(row, 1); |
| 736 |
ed(0); |
| 737 |
println(""); |
| 738 |
println("Modes:"); |
| 739 |
|
| 740 |
vt_move(row += 2, col); |
| 741 |
el(2); |
| 742 |
if (fails) { |
| 743 |
printxx("Autowrap-pending: failed %d of %d tries", fails, tries); |
| 744 |
} else { |
| 745 |
printxx("Autowrap-pending: OK"); |
| 746 |
} |
| 747 |
println(""); |
| 748 |
|
| 749 |
fails = 1; |
| 750 |
vt_move(++row, col); |
| 751 |
print_str(ss2_output()); |
| 752 |
if (read_DECCIR(&actual) && actual.ss2_pending) { |
| 753 |
print_chr(' '); |
| 754 |
if (read_DECCIR(&actual) && !actual.ss2_pending) { |
| 755 |
fails = 0; |
| 756 |
} |
| 757 |
} |
| 758 |
el(2); |
| 759 |
vt_move(row, col); |
| 760 |
if (fails) { |
| 761 |
println("SS2 pending: ERR"); |
| 762 |
} else { |
| 763 |
println("SS2 pending: OK"); |
| 764 |
} |
| 765 |
|
| 766 |
fails = 1; |
| 767 |
vt_move(++row, col); |
| 768 |
print_str(ss3_output()); |
| 769 |
if (read_DECCIR(&actual) && actual.ss3_pending) { |
| 770 |
print_chr(' '); |
| 771 |
if (read_DECCIR(&actual) && !actual.ss3_pending) { |
| 772 |
fails = 0; |
| 773 |
} |
| 774 |
} |
| 775 |
el(2); |
| 776 |
vt_move(row, col); |
| 777 |
if (fails) { |
| 778 |
println("SS3 pending: ERR"); |
| 779 |
} else { |
| 780 |
println("SS3 pending: OK"); |
| 781 |
} |
| 782 |
|
| 783 |
fails = 1; |
| 784 |
vt_move(++row, col); |
| 785 |
decom(1); |
| 786 |
if (read_DECCIR(&actual) && actual.origin_mode) { |
| 787 |
fails = 0; |
| 788 |
} |
| 789 |
print_str(old_mode); /* restore original settings */ |
| 790 |
vt_move(row, col); |
| 791 |
printxx("Origin mode: %s", fails ? "ERR" : "OK"); |
| 792 |
|
| 793 |
vt_move(++row, 1); |
| 794 |
ed(0); |
| 795 |
println(""); |
| 796 |
println("Character sets:"); |
| 797 |
|
| 798 |
esc("+A"); /* set G3 to British */ |
| 799 |
esc("o"); /* select that into GL */ |
| 800 |
esc("*0"); /* set G2 to DEC special graphics */ |
| 801 |
esc("}"); /* select that into GR */ |
| 802 |
esc("(<"); /* set G1 to DEC supplementary */ |
| 803 |
esc(")>"); /* set G0 to DEC technical */ |
| 804 |
read_DECCIR(&actual); |
| 805 |
print_str(old_mode); |
| 806 |
|
| 807 |
vt_move(row += 2, col); |
| 808 |
printxx("Current GL: %s", (actual.gl == 3) ? "OK" : "ERR"); |
| 809 |
|
| 810 |
vt_move(++row, col); |
| 811 |
printxx("Current GR: %s", (actual.gr == 2) ? "OK" : "ERR"); |
| 812 |
|
| 813 |
for (j = 0; j < 4; ++j) { |
| 814 |
static const char *my_suffix = "<>0A"; |
| 815 |
|
| 816 |
vt_move(++row, col); |
| 817 |
printxx("G%d suffix: '%.2s' %s (%s)", j, |
| 818 |
actual.cs_suffix[j], |
| 819 |
(actual.cs_suffix[j][0] == my_suffix[j]) ? "OK" : "ERR", |
| 820 |
actual.cs_names[j]); |
| 821 |
} |
| 822 |
|
| 823 |
print_str(old_mode); /* restore original settings */ |
| 824 |
} |
| 825 |
|
| 826 |
free(old_mode); |
| 827 |
restore_ttymodes(); |
| 828 |
vt_move(max_lines - 1, 1); |
| 829 |
ed(0); |
| 830 |
return MENU_HOLD; |
| 831 |
} |
| 832 |
|
| 833 |
/******************************************************************************/ |
| 834 |
|
| 835 |
static void |
| 836 |
tabstop_ruler(const char *tabsr, int row, int col) |
| 837 |
{ |
| 838 |
int valid = 1; |
| 839 |
int n; |
| 840 |
int tabstops = 0; |
| 841 |
char *expect; |
| 842 |
const char *suffix; |
| 843 |
const char *s; |
| 844 |
|
| 845 |
if ((expect = malloc((size_t) min_cols + 1)) == NULL) |
| 846 |
no_memory(); |
| 847 |
|
| 848 |
vt_move(row, col); |
| 849 |
|
| 850 |
for (n = 0; n < min_cols; ++n) { |
| 851 |
expect[n] = '-'; |
| 852 |
if (((n + 1) % 10) == 0) { |
| 853 |
expect[n] = (char) ((((n + 1) / 10) % 10) + '0'); |
| 854 |
} else if (((n + 1) % 5) == 0) { |
| 855 |
expect[n] = '+'; |
| 856 |
} |
| 857 |
} |
| 858 |
expect[min_cols] = '\0'; |
| 859 |
|
| 860 |
if (!strncmp(tabsr, "\033P", (size_t) 2)) { |
| 861 |
suffix = "\033\\"; |
| 862 |
s = tabsr + 2; |
| 863 |
} else if ((unsigned char) *tabsr == 0x90) { |
| 864 |
suffix = "\234"; |
| 865 |
s = tabsr + 1; |
| 866 |
} else { |
| 867 |
suffix = NULL; |
| 868 |
s = NULL; |
| 869 |
} |
| 870 |
|
| 871 |
if (s != NULL && !strncmp(s, "2$u", (size_t) 2)) { |
| 872 |
int value = 0; |
| 873 |
s += 2; |
| 874 |
while (*++s != '\0') { |
| 875 |
if (*s >= '0' && *s <= '9') { |
| 876 |
value = (value * 10) + (*s - '0'); |
| 877 |
} else if (*s == '/' || !strcmp(s, suffix)) { |
| 878 |
if (value-- > 0 && value < min_cols) { |
| 879 |
if (expect[value] != '*') { |
| 880 |
expect[value] = '*'; |
| 881 |
++tabstops; |
| 882 |
value = 0; |
| 883 |
} else { |
| 884 |
valid = 0; |
| 885 |
break; |
| 886 |
} |
| 887 |
} |
| 888 |
if (!strcmp(s, suffix)) |
| 889 |
break; |
| 890 |
} else { |
| 891 |
valid = 0; |
| 892 |
break; |
| 893 |
} |
| 894 |
} |
| 895 |
} else { |
| 896 |
valid = 0; |
| 897 |
} |
| 898 |
|
| 899 |
if (valid) { |
| 900 |
println(expect); |
| 901 |
print_chr('*'); |
| 902 |
for (n = 1; n < tabstops; ++n) { |
| 903 |
print_chr('\t'); |
| 904 |
print_chr('*'); |
| 905 |
} |
| 906 |
} else { |
| 907 |
println("Invalid:"); |
| 908 |
chrprint2(tabsr, row, col); |
| 909 |
} |
| 910 |
free(expect); |
| 911 |
} |
| 912 |
|
| 913 |
static int |
| 914 |
tst_DECRSPS_tabs(MENU_ARGS) |
| 915 |
{ |
| 916 |
int row, stop; |
| 917 |
char *old_tabs; |
| 918 |
const char *new_tabs; |
| 919 |
char *s; |
| 920 |
|
| 921 |
vt_move(1, 1); |
| 922 |
printxx("Testing %s\n", the_title); |
| 923 |
|
| 924 |
set_tty_raw(TRUE); |
| 925 |
set_tty_echo(FALSE); |
| 926 |
|
| 927 |
println(""); |
| 928 |
println("Original:"); |
| 929 |
decrqpsr(2); |
| 930 |
old_tabs = strdup(get_reply()); |
| 931 |
tabstop_ruler(old_tabs, 4, 1); |
| 932 |
|
| 933 |
vt_move(row = 7, 1); |
| 934 |
println("Modified:"); |
| 935 |
++row; |
| 936 |
for (stop = 7; stop >= 4; --stop) { |
| 937 |
set_tabstops(row, stop); |
| 938 |
decrqpsr(2); |
| 939 |
new_tabs = get_reply(); |
| 940 |
tabstop_ruler(new_tabs, row, 1); |
| 941 |
row += 2; |
| 942 |
} |
| 943 |
|
| 944 |
println(""); |
| 945 |
println(""); |
| 946 |
println("Restore:"); |
| 947 |
if ((s = strchr(old_tabs, 'u')) != NULL) |
| 948 |
*s = 't'; |
| 949 |
print_str(old_tabs); /* restore original tab-stops */ |
| 950 |
free(old_tabs); |
| 951 |
|
| 952 |
decrqpsr(2); |
| 953 |
new_tabs = get_reply(); |
| 954 |
tabstop_ruler(new_tabs, row + 2, 1); |
| 955 |
|
| 956 |
restore_ttymodes(); |
| 957 |
vt_move(max_lines - 1, 1); |
| 958 |
return MENU_HOLD; |
| 959 |
} |
| 960 |
|
| 961 |
/* Test Window Report - VT340, VT420 */ |
| 962 |
static int |
| 963 |
tst_DECRQDE(MENU_ARGS) |
| 964 |
{ |
| 965 |
char *report; |
| 966 |
char chr; |
| 967 |
int Ph, Pw, Pml, Pmt, Pmp; |
| 968 |
int row, col; |
| 969 |
|
| 970 |
vt_move(1, 1); |
| 971 |
println("Testing DECRQDE/DECRPDE Window Report"); |
| 972 |
|
| 973 |
set_tty_raw(TRUE); |
| 974 |
set_tty_echo(FALSE); |
| 975 |
|
| 976 |
do_csi("\"v"); |
| 977 |
report = get_reply(); |
| 978 |
vt_move(row = 3, col = 10); |
| 979 |
chrprint2(report, row, col); |
| 980 |
|
| 981 |
if ((report = skip_csi(report)) != NULL |
| 982 |
&& sscanf(report, "%d;%d;%d;%d;%d\"%c", |
| 983 |
&Ph, &Pw, &Pml, &Pmt, &Pmp, &chr) == 6 |
| 984 |
&& chr == 'w') { |
| 985 |
vt_move(5, 10); |
| 986 |
show_result("lines:%d, cols:%d, left col:%d, top line:%d, page %d", |
| 987 |
Ph, Pw, Pml, Pmt, Pmp); |
| 988 |
} else { |
| 989 |
show_result(SHOW_FAILURE); |
| 990 |
} |
| 991 |
|
| 992 |
restore_ttymodes(); |
| 993 |
vt_move(max_lines - 1, 1); |
| 994 |
return MENU_HOLD; |
| 995 |
} |
| 996 |
|
| 997 |
/* Request Terminal State Report */ |
| 998 |
static int |
| 999 |
tst_DECRQTSR(MENU_ARGS) |
| 1000 |
{ |
| 1001 |
int row, col; |
| 1002 |
char *report; |
| 1003 |
const char *show; |
| 1004 |
|
| 1005 |
vt_move(1, 1); |
| 1006 |
println("Testing Terminal State Reports (DECRQTSR/DECTSR)"); |
| 1007 |
|
| 1008 |
set_tty_raw(TRUE); |
| 1009 |
set_tty_echo(FALSE); |
| 1010 |
|
| 1011 |
do_csi("1$u"); |
| 1012 |
report = get_reply(); |
| 1013 |
|
| 1014 |
vt_move(row = 3, col = 10); |
| 1015 |
chrprint2(report, row, col); |
| 1016 |
|
| 1017 |
if ((report = skip_dcs(report)) != NULL |
| 1018 |
&& strip_terminator(report) |
| 1019 |
&& !strncmp(report, "1$s", (size_t) 3)) { |
| 1020 |
show = SHOW_SUCCESS; |
| 1021 |
} else { |
| 1022 |
show = SHOW_FAILURE; |
| 1023 |
} |
| 1024 |
show_result("%s", show); |
| 1025 |
|
| 1026 |
restore_ttymodes(); |
| 1027 |
vt_move(max_lines - 1, 1); |
| 1028 |
return MENU_HOLD; |
| 1029 |
} |
| 1030 |
|
| 1031 |
/******************************************************************************/ |
| 1032 |
|
| 1033 |
static int use_DECRPM; |
| 1034 |
|
| 1035 |
int |
| 1036 |
set_DECRPM(int level) |
| 1037 |
{ |
| 1038 |
int result = use_DECRPM; |
| 1039 |
use_DECRPM = level; |
| 1040 |
return result; |
| 1041 |
} |
| 1042 |
|
| 1043 |
#define DATA(name,level) { name, #name, level } |
| 1044 |
|
| 1045 |
int |
| 1046 |
any_RQM(MENU_ARGS, RQM_DATA * table, int tablesize, int private) |
| 1047 |
{ |
| 1048 |
int j, row, Pa, Ps; |
| 1049 |
int used = -1; |
| 1050 |
char chr; |
| 1051 |
char *report; |
| 1052 |
|
| 1053 |
vt_move(1, 1); |
| 1054 |
printxx("Testing %s\n", the_title); |
| 1055 |
|
| 1056 |
set_tty_raw(TRUE); |
| 1057 |
set_tty_echo(FALSE); |
| 1058 |
|
| 1059 |
for (j = row = 0; j < tablesize; j++) { |
| 1060 |
if (use_DECRPM < table[j].level) |
| 1061 |
continue; |
| 1062 |
|
| 1063 |
/* table contains duplicates, sorted with descending levels */ |
| 1064 |
if (used >= table[j].mode) |
| 1065 |
continue; |
| 1066 |
used = table[j].mode; |
| 1067 |
|
| 1068 |
if (++row >= max_lines - 3) { |
| 1069 |
restore_ttymodes(); |
| 1070 |
cup(max_lines - 1, 1); |
| 1071 |
holdit(); |
| 1072 |
vt_clear(2); |
| 1073 |
vt_move(row = 2, 1); |
| 1074 |
set_tty_raw(TRUE); |
| 1075 |
set_tty_echo(FALSE); |
| 1076 |
} |
| 1077 |
|
| 1078 |
do_csi((private ? "?%d$p" : "%d$p"), table[j].mode); |
| 1079 |
report = get_reply(); |
| 1080 |
printxx("\n %4d: %-10s ", table[j].mode, table[j].name); |
| 1081 |
if (LOG_ENABLED) |
| 1082 |
fprintf(log_fp, NOTE_STR "testing %s\n", table[j].name); |
| 1083 |
chrprint2(report, row + 1, 23); |
| 1084 |
if ((report = skip_csi(report)) != NULL |
| 1085 |
&& sscanf(report, (private |
| 1086 |
? "?%d;%d$%c" |
| 1087 |
: "%d;%d$%c"), |
| 1088 |
&Pa, &Ps, &chr) == 3 |
| 1089 |
&& Pa == table[j].mode |
| 1090 |
&& chr == 'y') { |
| 1091 |
switch (Ps) { |
| 1092 |
case 0: |
| 1093 |
show_result(" unknown"); |
| 1094 |
break; |
| 1095 |
case 1: |
| 1096 |
show_result(" set"); |
| 1097 |
break; |
| 1098 |
case 2: |
| 1099 |
show_result(" reset"); |
| 1100 |
break; |
| 1101 |
case 3: |
| 1102 |
show_result(" permanently set"); |
| 1103 |
break; |
| 1104 |
case 4: |
| 1105 |
show_result(" permanently reset"); |
| 1106 |
break; |
| 1107 |
default: |
| 1108 |
show_result(" ?"); |
| 1109 |
break; |
| 1110 |
} |
| 1111 |
} else { |
| 1112 |
show_result(SHOW_FAILURE); |
| 1113 |
} |
| 1114 |
} |
| 1115 |
|
| 1116 |
restore_ttymodes(); |
| 1117 |
vt_move(max_lines - 1, 1); |
| 1118 |
return MENU_HOLD; |
| 1119 |
} |
| 1120 |
|
| 1121 |
static int |
| 1122 |
tst_ISO_DECRPM(MENU_ARGS) |
| 1123 |
{ |
| 1124 |
/* *INDENT-OFF* */ |
| 1125 |
RQM_DATA ansi_modes[] = { /* this list is sorted by code, not name */ |
| 1126 |
DATA( GATM, 3 /* guarded area transfer (disabled) */), |
| 1127 |
DATA( KAM, 3 /* keyboard action */), |
| 1128 |
DATA( CRM, 3 /* control representation (setup) */), |
| 1129 |
DATA( IRM, 3 /* insert/replace */), |
| 1130 |
DATA( SRTM, 3 /* status reporting transfer (disabled) */), |
| 1131 |
DATA( ERM, 9 /* erasure mode (non-DEC) */), |
| 1132 |
DATA( VEM, 3 /* vertical editing (disabled) */), |
| 1133 |
DATA( BDSM, 9 /* bi-directional support mode (non-DEC) */), |
| 1134 |
DATA( DCSM, 9 /* device component select mode (non-DEC) */), |
| 1135 |
DATA( HEM, 3 /* horizontal editing (disabled) */), |
| 1136 |
DATA( PUM, 3 /* positioning unit (disabled) */), |
| 1137 |
DATA( SRM, 3 /* send/receive */), |
| 1138 |
DATA( FEAM, 3 /* format effector action (disabled) */), |
| 1139 |
DATA( FETM, 3 /* format effector transfer (disabled) */), |
| 1140 |
DATA( MATM, 3 /* multiple area transfer (disabled) */), |
| 1141 |
DATA( TTM, 3 /* transfer termination (disabled) */), |
| 1142 |
DATA( SATM, 3 /* selected area transfer (disabled) */), |
| 1143 |
DATA( TSM, 3 /* tabulation stop (disabled) */), |
| 1144 |
DATA( EBM, 3 /* editing boundary (disabled) */), |
| 1145 |
DATA( LNM, 3 /* line feed/new line */) }; |
| 1146 |
/* *INDENT-ON* */ |
| 1147 |
|
| 1148 |
return any_RQM(PASS_ARGS, ansi_modes, TABLESIZE(ansi_modes), 0); |
| 1149 |
} |
| 1150 |
|
| 1151 |
static int |
| 1152 |
tst_DEC_DECRPM(MENU_ARGS) |
| 1153 |
{ |
| 1154 |
/* *INDENT-OFF* */ |
| 1155 |
RQM_DATA dec_modes[] = { /* this list is sorted by code, not name */ |
| 1156 |
DATA( DECCKM, 3 /* cursor keys */), |
| 1157 |
DATA( DECANM, 3 /* ANSI */), |
| 1158 |
DATA( DECCOLM, 3 /* column */), |
| 1159 |
DATA( DECSCLM, 3 /* scrolling */), |
| 1160 |
DATA( DECSCNM, 3 /* screen */), |
| 1161 |
DATA( DECOM, 3 /* origin */), |
| 1162 |
DATA( DECAWM, 3 /* autowrap */), |
| 1163 |
DATA( DECARM, 3 /* autorepeat */), |
| 1164 |
DATA( DECEDM, 3 /* edit */), |
| 1165 |
DATA( DECLTM, 3 /* line transmit */), |
| 1166 |
DATA( DECKANAM, 3 /* vt382:Katana shift */), |
| 1167 |
DATA( DECSCFDM, 3 /* space compression field delimiter */), |
| 1168 |
DATA( DECTEM, 3 /* transmission execution */), |
| 1169 |
DATA( DECEKEM, 3 /* edit key execution */), |
| 1170 |
DATA( DECPFF, 3 /* print form feed */), |
| 1171 |
DATA( DECPEX, 3 /* printer extent */), |
| 1172 |
DATA( DECTCEM, 3 /* text cursor enable */), |
| 1173 |
DATA( DECRLM, 5 /* left-to-right */), |
| 1174 |
DATA( DECHEBM, 5 /* Hebrew keyboard mapping (VT520) */), |
| 1175 |
DATA( DECHEM, 5 /* Hebrew encoding */), |
| 1176 |
DATA( DECTEK, 3 /* 4010/4014 emulation (VT240, VT330/VT340) */), |
| 1177 |
DATA( DECNRCM, 3 /* national replacement character set */), |
| 1178 |
DATA( DECGEPM, 3 /* graphics expanded print */), |
| 1179 |
DATA( DECGPCM, 3 /* graphics print color */), |
| 1180 |
DATA( DECGPCS, 3 /* graphics print color syntax */), |
| 1181 |
DATA( DECGPBM, 3 /* graphics print background */), |
| 1182 |
DATA( DECGRPM, 3 /* graphics rotated print */), |
| 1183 |
DATA( DEC131TM, 3 /* VT131 transmit */), |
| 1184 |
DATA( DECNAKB, 5 /* Greek/N-A Keyboard Mapping */), |
| 1185 |
DATA( DECKKDM, 3 /* vt382:Kanji/Katakana */), |
| 1186 |
DATA( DECHCCM, 3 /* horizontal cursor coupling (disabled) */), |
| 1187 |
DATA( DECVCCM, 3 /* vertical cursor coupling */), |
| 1188 |
DATA( DECPCCM, 3 /* page cursor coupling */), |
| 1189 |
DATA( DECNKM, 3 /* numeric keypad */), |
| 1190 |
DATA( DECBKM, 3 /* backarrow key */), |
| 1191 |
DATA( DECKBUM, 3 /* keyboard usage */), |
| 1192 |
DATA( DECLRMM, 4 /* left/right margin mode (VT420) */), |
| 1193 |
DATA( DECXRLM, 3 /* transmit rate linking */), |
| 1194 |
DATA( DECSDM, 3 /* vt382:Sixel display */), |
| 1195 |
DATA( DECKPM, 4 /* keyboard positioning */), |
| 1196 |
DATA( DECNCSM, 5 /* no clearing screen on column change */), |
| 1197 |
DATA( DECRLCM, 5 /* right-to-left copy */), |
| 1198 |
DATA( DECCRTSM, 5 /* CRT save */), |
| 1199 |
DATA( DECARSM, 5 /* auto resize */), |
| 1200 |
DATA( DECMCM, 5 /* modem control */), |
| 1201 |
DATA( DECAAM, 5 /* auto answerback */), |
| 1202 |
DATA( DECCANSM, 5 /* conceal answerback */), |
| 1203 |
DATA( DECNULM, 5 /* null */), |
| 1204 |
DATA( DECHDPXM, 5 /* half duplex */), |
| 1205 |
DATA( DECESKM, 5 /* enable secondary keyboard language */), |
| 1206 |
DATA( DECOSCNM, 5 /* overscan */), |
| 1207 |
DATA( DECFWM, 5 /* framed windows */), |
| 1208 |
DATA( DECRPL, 5 /* review previous lines */), |
| 1209 |
DATA( DECHWUM, 5 /* host wake-up mode (CRT and energy saver) */), |
| 1210 |
DATA( DECATCUM, 5 /* alternate text color underline */), |
| 1211 |
DATA( DECATCBM, 5 /* alternate text color blink */), |
| 1212 |
DATA( DECBBSM, 5 /* bold and blink style */), |
| 1213 |
DATA( DECECM, 5 /* erase color */), |
| 1214 |
}; |
| 1215 |
/* *INDENT-ON* */ |
| 1216 |
|
| 1217 |
return any_RQM(PASS_ARGS, dec_modes, TABLESIZE(dec_modes), 1); |
| 1218 |
} |
| 1219 |
|
| 1220 |
#undef DATA |
| 1221 |
|
| 1222 |
/******************************************************************************/ |
| 1223 |
|
| 1224 |
int |
| 1225 |
tst_DECRPM(MENU_ARGS) |
| 1226 |
{ |
| 1227 |
/* *INDENT-OFF* */ |
| 1228 |
static MENU my_menu[] = { |
| 1229 |
{ "Exit", NULL }, |
| 1230 |
{ "ANSI Mode Report (DECRPM)", tst_ISO_DECRPM }, |
| 1231 |
{ "DEC Mode Report (DECRPM)", tst_DEC_DECRPM }, |
| 1232 |
{ "", NULL } |
| 1233 |
}; |
| 1234 |
/* *INDENT-ON* */ |
| 1235 |
|
| 1236 |
do { |
| 1237 |
vt_clear(2); |
| 1238 |
__(title(0), printxx("Request Mode (DECRQM)/Report Mode (DECRPM)")); |
| 1239 |
__(title(2), println("Choose test type:")); |
| 1240 |
} while (menu(my_menu)); |
| 1241 |
return MENU_NOHOLD; |
| 1242 |
} |
| 1243 |
|
| 1244 |
/******************************************************************************/ |
| 1245 |
|
| 1246 |
/* |
| 1247 |
* The VT420 manual says that a valid response begins "DCS 0 $ r", |
| 1248 |
* however I see "DCS 1 $ r" on a real VT420, consistently --TD (1996/09/11) |
| 1249 |
*/ |
| 1250 |
int |
| 1251 |
any_decrqss2(const char *msg, const char *func, const char *expected) |
| 1252 |
{ |
| 1253 |
int code; |
| 1254 |
int row, col; |
| 1255 |
char *report; |
| 1256 |
const char *show; |
| 1257 |
const char *suffix = NULL; |
| 1258 |
const char *p; |
| 1259 |
char buffer[80]; |
| 1260 |
|
| 1261 |
vt_move(1, 1); |
| 1262 |
printxx("Testing DECRQSS: %s\n", msg); |
| 1263 |
|
| 1264 |
set_tty_raw(TRUE); |
| 1265 |
set_tty_echo(FALSE); |
| 1266 |
|
| 1267 |
decrqss(func); |
| 1268 |
report = get_reply(); |
| 1269 |
|
| 1270 |
reset_decstbm(); |
| 1271 |
reset_decslrm(); |
| 1272 |
|
| 1273 |
vt_move(row = 3, col = 10); |
| 1274 |
chrprint2(report, row, col); |
| 1275 |
|
| 1276 |
/* workaround for embedded parameter in XTQMODKEYS */ |
| 1277 |
for (p = func; *p != '\0'; ++p) { |
| 1278 |
if (isdigit(CharOf(*p))) |
| 1279 |
suffix = NULL; |
| 1280 |
else if (suffix == NULL) |
| 1281 |
suffix = p; |
| 1282 |
} |
| 1283 |
if (suffix == NULL) |
| 1284 |
suffix = ""; |
| 1285 |
|
| 1286 |
switch ((code = parse_decrqss(report, suffix))) { |
| 1287 |
case 1: |
| 1288 |
if (expected && strcmp(expected, report)) { |
| 1289 |
sprintf(buffer, "ok (expect '%s', actual '%s')", expected, report); |
| 1290 |
show = buffer; |
| 1291 |
} else { |
| 1292 |
show = "ok (valid request)"; |
| 1293 |
} |
| 1294 |
break; |
| 1295 |
case 0: |
| 1296 |
show = "invalid request"; |
| 1297 |
break; |
| 1298 |
default: |
| 1299 |
show = SHOW_FAILURE; |
| 1300 |
break; |
| 1301 |
} |
| 1302 |
show_result("%s", show); |
| 1303 |
|
| 1304 |
if (code == 1) { |
| 1305 |
const char *lead = output_8bits ? "\233" : "\033["; |
| 1306 |
char *part = malloc(5 + strlen(report) + strlen(suffix)); |
| 1307 |
|
| 1308 |
if (part != NULL) { |
| 1309 |
char *full; |
| 1310 |
|
| 1311 |
sprintf(part, "%s%s%s", lead, report, suffix); |
| 1312 |
full = chrformat(part, col, 0); |
| 1313 |
if (full != NULL) { |
| 1314 |
vt_move(++row, col); |
| 1315 |
tprintf("%s", full); |
| 1316 |
free(full); |
| 1317 |
} |
| 1318 |
free(part); |
| 1319 |
} |
| 1320 |
} |
| 1321 |
|
| 1322 |
restore_ttymodes(); |
| 1323 |
vt_move(max_lines - 1, 1); |
| 1324 |
return MENU_HOLD; |
| 1325 |
} |
| 1326 |
|
| 1327 |
int |
| 1328 |
any_decrqss(const char *msg, const char *func) |
| 1329 |
{ |
| 1330 |
return any_decrqss2(msg, func, (const char *) 0); |
| 1331 |
} |
| 1332 |
|
| 1333 |
static int |
| 1334 |
rpt_DECPRO(MENU_ARGS) |
| 1335 |
{ |
| 1336 |
return any_decrqss(the_title, "}"); |
| 1337 |
} |
| 1338 |
|
| 1339 |
static int |
| 1340 |
rpt_DECSASD(MENU_ARGS) |
| 1341 |
{ |
| 1342 |
return any_decrqss(the_title, "$}"); |
| 1343 |
} |
| 1344 |
|
| 1345 |
static int |
| 1346 |
rpt_DECSCA(MENU_ARGS) |
| 1347 |
{ |
| 1348 |
return any_decrqss(the_title, "\"q"); |
| 1349 |
} |
| 1350 |
|
| 1351 |
static int |
| 1352 |
rpt_DECSCL(MENU_ARGS) |
| 1353 |
{ |
| 1354 |
return any_decrqss(the_title, "\"p"); |
| 1355 |
} |
| 1356 |
|
| 1357 |
static int |
| 1358 |
rpt_DECSCPP(MENU_ARGS) |
| 1359 |
{ |
| 1360 |
return any_decrqss(the_title, "$|"); |
| 1361 |
} |
| 1362 |
|
| 1363 |
static int |
| 1364 |
rpt_DECSLPP(MENU_ARGS) |
| 1365 |
{ |
| 1366 |
return any_decrqss(the_title, "t"); |
| 1367 |
} |
| 1368 |
|
| 1369 |
static int |
| 1370 |
rpt_DECSSDT(MENU_ARGS) |
| 1371 |
{ |
| 1372 |
return any_decrqss(the_title, "$~"); |
| 1373 |
} |
| 1374 |
|
| 1375 |
int |
| 1376 |
rpt_DECSTBM(MENU_ARGS) |
| 1377 |
{ |
| 1378 |
return any_decrqss(the_title, "r"); |
| 1379 |
} |
| 1380 |
|
| 1381 |
static int |
| 1382 |
rpt_SGR(MENU_ARGS) |
| 1383 |
{ |
| 1384 |
return any_decrqss(the_title, "m"); |
| 1385 |
} |
| 1386 |
|
| 1387 |
static int |
| 1388 |
rpt_DECTLTC(MENU_ARGS) |
| 1389 |
{ |
| 1390 |
return any_decrqss(the_title, "'s"); |
| 1391 |
} |
| 1392 |
|
| 1393 |
static int |
| 1394 |
rpt_DECTTC(MENU_ARGS) |
| 1395 |
{ |
| 1396 |
return any_decrqss(the_title, "|"); |
| 1397 |
} |
| 1398 |
|
| 1399 |
int |
| 1400 |
tst_vt320_DECRQSS(MENU_ARGS) |
| 1401 |
{ |
| 1402 |
/* *INDENT-OFF* */ |
| 1403 |
static MENU my_menu[] = { |
| 1404 |
{ "Exit", NULL }, |
| 1405 |
{ "Protected fields attributes (DECPRO)", rpt_DECPRO }, |
| 1406 |
{ "Select active status display (DECSASD)", rpt_DECSASD }, |
| 1407 |
{ "Select graphic rendition (SGR)", rpt_SGR }, |
| 1408 |
{ "Set character attribute (DECSCA)", rpt_DECSCA }, |
| 1409 |
{ "Set columns per page (DECSCPP)", rpt_DECSCPP }, |
| 1410 |
{ "Set conformance level (DECSCL)", rpt_DECSCL }, |
| 1411 |
{ "Set lines per page (DECSLPP)", rpt_DECSLPP }, |
| 1412 |
{ "Set status line type (DECSSDT)", rpt_DECSSDT }, |
| 1413 |
{ "Set top and bottom margins (DECSTBM)", rpt_DECSTBM }, |
| 1414 |
{ "Set transmit termination character (DECTTC)", rpt_DECTTC }, |
| 1415 |
{ "Transmission line termination character (DECTLTC)", rpt_DECTLTC }, |
| 1416 |
{ "", NULL } |
| 1417 |
}; |
| 1418 |
/* *INDENT-ON* */ |
| 1419 |
|
| 1420 |
do { |
| 1421 |
vt_clear(2); |
| 1422 |
__(title(0), printxx("VT320 Status-String Reports")); |
| 1423 |
__(title(2), println("Choose test type:")); |
| 1424 |
} while (menu(my_menu)); |
| 1425 |
return MENU_NOHOLD; |
| 1426 |
} |
| 1427 |
|
| 1428 |
/******************************************************************************/ |
| 1429 |
|
| 1430 |
/* |
| 1431 |
* The main vt100 module tests CUP, HVP, CUF, CUB, CUU, CUD |
| 1432 |
*/ |
| 1433 |
int |
| 1434 |
tst_vt320_cursor(MENU_ARGS) |
| 1435 |
{ |
| 1436 |
/* *INDENT-OFF* */ |
| 1437 |
static MENU my_menu[] = { |
| 1438 |
{ "Exit", NULL }, |
| 1439 |
{ "Test Pan down (SU)", tst_SU }, |
| 1440 |
{ "Test Pan up (SD)", tst_SD}, |
| 1441 |
{ "Test Vertical Cursor Coupling (DECVCCM)", not_impl }, |
| 1442 |
{ "Test Page Cursor Coupling (DECPCCM)", not_impl }, |
| 1443 |
{ "", NULL } |
| 1444 |
}; |
| 1445 |
/* *INDENT-ON* */ |
| 1446 |
|
| 1447 |
do { |
| 1448 |
vt_clear(2); |
| 1449 |
__(title(0), printxx("VT320 Cursor-Movement Tests")); |
| 1450 |
__(title(2), println("Choose test type:")); |
| 1451 |
} while (menu(my_menu)); |
| 1452 |
return MENU_NOHOLD; |
| 1453 |
} |
| 1454 |
|
| 1455 |
/******************************************************************************/ |
| 1456 |
|
| 1457 |
static int |
| 1458 |
tst_vt320_report_terminal(MENU_ARGS) |
| 1459 |
{ |
| 1460 |
/* *INDENT-OFF* */ |
| 1461 |
static MENU my_menu[] = { |
| 1462 |
{ "Exit", NULL }, |
| 1463 |
{ "Restore Terminal State (DECRSTS)", not_impl }, |
| 1464 |
{ "Terminal State Report (DECRQTS/DECTSR)", tst_DECRQTSR }, |
| 1465 |
{ "", NULL } |
| 1466 |
}; |
| 1467 |
/* *INDENT-ON* */ |
| 1468 |
|
| 1469 |
do { |
| 1470 |
vt_clear(2); |
| 1471 |
__(title(0), printxx("VT320 Terminal State Reports")); |
| 1472 |
__(title(2), println("Choose test type:")); |
| 1473 |
} while (menu(my_menu)); |
| 1474 |
return MENU_NOHOLD; |
| 1475 |
} |
| 1476 |
|
| 1477 |
/******************************************************************************/ |
| 1478 |
|
| 1479 |
int |
| 1480 |
tst_vt320_report_presentation(MENU_ARGS) |
| 1481 |
{ |
| 1482 |
/* *INDENT-OFF* */ |
| 1483 |
static MENU my_menu[] = { |
| 1484 |
{ "Exit", NULL }, |
| 1485 |
{ "Cursor Information Report (DECCIR)", tst_any_DECCIR }, |
| 1486 |
{ "Tab Stop Report (DECTABSR)", tst_any_DECTABSR }, |
| 1487 |
{ "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, |
| 1488 |
{ "Restore Presentation State (DECRSPS): cursor", tst_DECRSPS_cursor }, |
| 1489 |
{ "Restore Presentation State (DECRSPS): tabstops", tst_DECRSPS_tabs }, |
| 1490 |
{ "Status-String Report (DECRQSS)", tst_vt320_DECRQSS }, |
| 1491 |
{ "", NULL } |
| 1492 |
}; |
| 1493 |
/* *INDENT-ON* */ |
| 1494 |
|
| 1495 |
int old_DECRPM = set_DECRPM(3); |
| 1496 |
|
| 1497 |
do { |
| 1498 |
vt_clear(2); |
| 1499 |
__(title(0), printxx("VT320 Presentation State Reports")); |
| 1500 |
__(title(2), println("Choose test type:")); |
| 1501 |
} while (menu(my_menu)); |
| 1502 |
set_DECRPM(old_DECRPM); |
| 1503 |
return MENU_NOHOLD; |
| 1504 |
} |
| 1505 |
|
| 1506 |
/******************************************************************************/ |
| 1507 |
|
| 1508 |
int |
| 1509 |
tst_vt320_reports(MENU_ARGS) |
| 1510 |
{ |
| 1511 |
/* *INDENT-OFF* */ |
| 1512 |
static MENU my_menu[] = { |
| 1513 |
{ "Exit", NULL }, |
| 1514 |
{ "Test VT220 features", tst_vt220_reports }, |
| 1515 |
{ "Test Device Status Report (DSR)", tst_vt320_device_status }, |
| 1516 |
{ "Test Presentation State Reports", tst_vt320_report_presentation }, |
| 1517 |
{ "Test Terminal State Reports", tst_vt320_report_terminal }, |
| 1518 |
{ "Test User-Preferred Supplemental Set", tst_upss }, |
| 1519 |
{ "Test Window Report (DECRPDE)", tst_DECRQDE }, |
| 1520 |
{ "", NULL } |
| 1521 |
}; |
| 1522 |
/* *INDENT-ON* */ |
| 1523 |
|
| 1524 |
do { |
| 1525 |
vt_clear(2); |
| 1526 |
__(title(0), printxx("VT320 Reports")); |
| 1527 |
__(title(2), println("Choose test type:")); |
| 1528 |
} while (menu(my_menu)); |
| 1529 |
return MENU_NOHOLD; |
| 1530 |
} |
| 1531 |
|
| 1532 |
/******************************************************************************/ |
| 1533 |
|
| 1534 |
/* vt340/vt420 & up */ |
| 1535 |
static int |
| 1536 |
tst_DECSCPP(MENU_ARGS) |
| 1537 |
{ |
| 1538 |
static const int table[] = |
| 1539 |
{-1, 80, 80, 132}; |
| 1540 |
size_t n; |
| 1541 |
char temp[80]; |
| 1542 |
int last = max_lines - 4; |
| 1543 |
|
| 1544 |
for (n = 0; n < TABLESIZE(table); ++n) { |
| 1545 |
int width = (table[n] < 0) ? min_cols : table[n]; |
| 1546 |
|
| 1547 |
vt_clear(2); |
| 1548 |
decaln(); |
| 1549 |
decscpp(table[n]); |
| 1550 |
vt_move(last, 1); |
| 1551 |
ruler(last, width); |
| 1552 |
vt_clear(0); |
| 1553 |
sprintf(temp, "Screen should be filled (%d of %d columns)", min_cols, width); |
| 1554 |
println(temp); |
| 1555 |
holdit(); |
| 1556 |
|
| 1557 |
} |
| 1558 |
decscpp(-1); |
| 1559 |
vt_move(last, 1); |
| 1560 |
vt_clear(0); |
| 1561 |
println("Screen is reset to original width"); |
| 1562 |
|
| 1563 |
return MENU_HOLD; |
| 1564 |
} |
| 1565 |
|
| 1566 |
static int |
| 1567 |
tst_DECSLPP(MENU_ARGS) |
| 1568 |
{ |
| 1569 |
static const int table[] = |
| 1570 |
{24, 25, 36, 48, 72, 144}; |
| 1571 |
size_t n; |
| 1572 |
char temp[80]; |
| 1573 |
int last = max_lines - 4; |
| 1574 |
|
| 1575 |
for (n = 0; n < TABLESIZE(table); ++n) { |
| 1576 |
int high = (table[n] < 0) ? min_cols : table[n]; |
| 1577 |
|
| 1578 |
vt_clear(2); |
| 1579 |
decaln(); |
| 1580 |
decslpp(table[n]); |
| 1581 |
vt_move(last, 1); |
| 1582 |
ruler(last, min_cols); |
| 1583 |
vt_clear(0); |
| 1584 |
sprintf(temp, "Screen should be filled (%d of %d rows)", max_lines, high); |
| 1585 |
println(temp); |
| 1586 |
holdit(); |
| 1587 |
|
| 1588 |
} |
| 1589 |
decslpp(max_lines); |
| 1590 |
vt_move(last, 1); |
| 1591 |
vt_clear(0); |
| 1592 |
println("Screen is reset to original height"); |
| 1593 |
|
| 1594 |
return MENU_HOLD; |
| 1595 |
} |
| 1596 |
|
| 1597 |
static int |
| 1598 |
tst_PageFormat(MENU_ARGS) |
| 1599 |
{ |
| 1600 |
/* *INDENT-OFF* */ |
| 1601 |
static MENU my_menu[] = { |
| 1602 |
{ "Exit", NULL }, |
| 1603 |
{ "Test set columns per page (DECSCPP)", tst_DECSCPP }, |
| 1604 |
{ "Test set lines per page (DECSLPP)", tst_DECSLPP }, |
| 1605 |
{ "", NULL } |
| 1606 |
}; |
| 1607 |
/* *INDENT-ON* */ |
| 1608 |
|
| 1609 |
do { |
| 1610 |
vt_clear(2); |
| 1611 |
__(title(0), printxx("Page Format Tests")); |
| 1612 |
__(title(2), println("Choose test type:")); |
| 1613 |
} while (menu(my_menu)); |
| 1614 |
return MENU_NOHOLD; |
| 1615 |
} |
| 1616 |
|
| 1617 |
/******************************************************************************/ |
| 1618 |
|
| 1619 |
/* vt340/vt420 & up */ |
| 1620 |
static int |
| 1621 |
tst_PageMovement(MENU_ARGS) |
| 1622 |
{ |
| 1623 |
/* *INDENT-OFF* */ |
| 1624 |
static MENU my_menu[] = { |
| 1625 |
{ "Exit", NULL }, |
| 1626 |
{ "Test Next Page (NP)", not_impl }, |
| 1627 |
{ "Test Preceding Page (PP)", not_impl }, |
| 1628 |
{ "Test Page Position Absolute (PPA)", not_impl }, |
| 1629 |
{ "Test Page Position Backward (PPB)", not_impl }, |
| 1630 |
{ "Test Page Position Relative (PPR)", not_impl }, |
| 1631 |
{ "", NULL } |
| 1632 |
}; |
| 1633 |
/* *INDENT-ON* */ |
| 1634 |
|
| 1635 |
do { |
| 1636 |
vt_clear(2); |
| 1637 |
__(title(0), printxx("Page Format Tests")); |
| 1638 |
__(title(2), println("Choose test type:")); |
| 1639 |
} while (menu(my_menu)); |
| 1640 |
return MENU_NOHOLD; |
| 1641 |
} |
| 1642 |
|
| 1643 |
/******************************************************************************/ |
| 1644 |
|
| 1645 |
/* vt340/vt420 & up */ |
| 1646 |
int |
| 1647 |
tst_vt320_screen(MENU_ARGS) |
| 1648 |
{ |
| 1649 |
/* *INDENT-OFF* */ |
| 1650 |
static MENU my_menu[] = { |
| 1651 |
{ "Exit", NULL }, |
| 1652 |
{ "Test VT220 features", tst_vt220_screen }, |
| 1653 |
{ "Test Status line (DECSASD/DECSSDT)", tst_statusline }, |
| 1654 |
{ "", NULL } |
| 1655 |
}; |
| 1656 |
/* *INDENT-ON* */ |
| 1657 |
|
| 1658 |
do { |
| 1659 |
vt_clear(2); |
| 1660 |
__(title(0), printxx("VT320 Screen-Display Tests")); |
| 1661 |
__(title(2), println("Choose test type:")); |
| 1662 |
} while (menu(my_menu)); |
| 1663 |
return MENU_NOHOLD; |
| 1664 |
} |
| 1665 |
|
| 1666 |
/******************************************************************************/ |
| 1667 |
|
| 1668 |
int |
| 1669 |
tst_vt320(MENU_ARGS) |
| 1670 |
{ |
| 1671 |
/* *INDENT-OFF* */ |
| 1672 |
static MENU my_menu[] = { |
| 1673 |
{ "Exit", NULL }, |
| 1674 |
{ "Test VT220 features", tst_vt220 }, |
| 1675 |
{ "Test cursor-movement", tst_vt320_cursor }, |
| 1676 |
{ "Test page-format controls", tst_PageFormat }, |
| 1677 |
{ "Test page-movement controls", tst_PageMovement }, |
| 1678 |
{ "Test reporting functions", tst_vt320_reports }, |
| 1679 |
{ "Test screen-display functions", tst_vt320_screen }, |
| 1680 |
{ "", NULL } |
| 1681 |
}; |
| 1682 |
/* *INDENT-ON* */ |
| 1683 |
|
| 1684 |
do { |
| 1685 |
vt_clear(2); |
| 1686 |
__(title(0), printxx("VT320 Tests")); |
| 1687 |
__(title(2), println("Choose test type:")); |
| 1688 |
} while (menu(my_menu)); |
| 1689 |
return MENU_NOHOLD; |
| 1690 |
} |