| 1 |
/* @(#)tvtest.c 19.1 (ES0-DMD) 02/25/03 13:58:15 */ |
| 2 |
/*=========================================================================== |
| 3 |
Copyright (C) 1995 European Southern Observatory (ESO) |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU General Public License as |
| 7 |
published by the Free Software Foundation; either version 2 of |
| 8 |
the License, or (at your option) any later version. |
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public |
| 16 |
License along with this program; if not, write to the Free |
| 17 |
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, |
| 18 |
MA 02139, USA. |
| 19 |
|
| 20 |
Corresponding concerning ESO-MIDAS should be addressed as follows: |
| 21 |
Internet e-mail: [email protected] |
| 22 |
Postal address: European Southern Observatory |
| 23 |
Data Management Division |
| 24 |
Karl-Schwarzschild-Strasse 2 |
| 25 |
D 85748 Garching bei Muenchen |
| 26 |
GERMANY |
| 27 |
===========================================================================*/ |
| 28 |
|
| 29 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 30 |
.TYPE Program |
| 31 |
.NAME tvtest.c |
| 32 |
.LANGUAGE C |
| 33 |
.AUTHOR Francois Ochsenbein [ESO-IPG] |
| 34 |
.CATEGORY Terminal Management. |
| 35 |
.PURPOSE Test of Terminal Routines (basic functions for |
| 36 |
TermWindows Implementation) |
| 37 |
.ENVIRONMENT TermWindows |
| 38 |
.VERSION 2.0 02-Jul-1987: Creation. |
| 39 |
.VERSION 2.1 02-Dec-1987: Testing WhileInput |
| 40 |
.VERSION 3.0 20-Mar-1988: Version '3' |
| 41 |
------------------------------------------------------------*/ |
| 42 |
|
| 43 |
#define PM_LEVEL 2 |
| 44 |
|
| 45 |
#define TW_import 0 |
| 46 |
#include <macrogen.h> |
| 47 |
#include <ok.h> |
| 48 |
#include <trace.h> |
| 49 |
#include <error.h> |
| 50 |
#include <tw.h> |
| 51 |
#include <atype.h> |
| 52 |
|
| 53 |
char *gets(); |
| 54 |
char WaitandSee(); |
| 55 |
|
| 56 |
#define curc tpos[1] |
| 57 |
#define curl tpos[0] |
| 58 |
#define v_bold _BOLD_ |
| 59 |
#define v_underscore _UNDERSCORE_ |
| 60 |
#define v_blink _BLINK_ |
| 61 |
#define v_inverse _REVERSE_ |
| 62 |
#define v_graphics _GRAPHICS_ |
| 63 |
|
| 64 |
static char msg[140]; |
| 65 |
static int last_line, colCR; |
| 66 |
static short int tpos[2]; |
| 67 |
static short int dim[2]; |
| 68 |
static int three= 2,four= 3; |
| 69 |
static char temp,string[5]; |
| 70 |
static char *char_type[7] = {(char *)0}; |
| 71 |
static char arrows[5] = {'u', 'd', 'l', 'r', 'h'}; |
| 72 |
static char aux[20]; |
| 73 |
|
| 74 |
MONITOR(tvtest); |
| 75 |
|
| 76 |
main () |
| 77 |
{ |
| 78 |
char *p; |
| 79 |
int i; |
| 80 |
int ring_bell(); |
| 81 |
|
| 82 |
printf("On-line editing preference: Vms, Unix, Other, Default (VMS): "); |
| 83 |
gets(msg); switch(toupper(msg[0])) |
| 84 |
{ case 'V': i = TW_cc_VMS; break; |
| 85 |
case 'U': i = TW_cc_UNIX; break; |
| 86 |
case 'O': i = TW_cc_USER; break; |
| 87 |
default : i = -1; |
| 88 |
} |
| 89 |
|
| 90 |
printf("Device type ? "); if (gets(msg) == (char *)0) return; |
| 91 |
if (strlen(msg)) status = OpenTerm(msg,(char *)0,i); |
| 92 |
else status = OpenTerm((char *)0,(char *)0,i); |
| 93 |
if (!status) |
| 94 |
{ printf("****%s\n", ERR_LOC()); |
| 95 |
return; |
| 96 |
} |
| 97 |
|
| 98 |
ScreenSize(dim); /* Get Screen Dimensions */ |
| 99 |
last_line = dim[0] - 1; |
| 100 |
colCR = 2*(dim[1])/3; |
| 101 |
|
| 102 |
char_type[0] = " ?????????? "; |
| 103 |
char_type[_STANDARD_] = " (ASCII) "; |
| 104 |
char_type[_KEYPAD_] = " (Keypad) "; |
| 105 |
char_type[_PF_] = " (PF key) "; |
| 106 |
char_type[_ARROW_] = " (Arrow) "; |
| 107 |
char_type[_FK_] = " (other key)"; |
| 108 |
|
| 109 |
WhileInput(ring_bell); |
| 110 |
|
| 111 |
Title("TEST 1 - Clear Screen And Display Message "); |
| 112 |
Puts("This is a Test Message"); |
| 113 |
Puts("......................"); |
| 114 |
if (WaitCR() == 'i') goto Input; |
| 115 |
|
| 116 |
Title("TEST 2 - Single-character input"); |
| 117 |
Put("Type any character to perform test--"); |
| 118 |
GetChar(&temp); |
| 119 |
Puts("OK"); |
| 120 |
Put("The character you typed was: "); |
| 121 |
string[0]= temp; |
| 122 |
WriteBinary(string,1); |
| 123 |
if (WaitCR() == 'i') goto Input; |
| 124 |
|
| 125 |
|
| 126 |
Title("TEST 3 - Cursor Down and Up"); |
| 127 |
CursorDown(4); |
| 128 |
Puts("This should be down four lines."); |
| 129 |
if (CursorUp(2) == OK) |
| 130 |
Puts("This should be above the `down four' message"); |
| 131 |
else Impossible(); |
| 132 |
|
| 133 |
if (WaitCR() == 'i') goto Input; |
| 134 |
|
| 135 |
Title("TEST 4 - Line wrap and Newline"); |
| 136 |
Put("Type any character to perform test--"); |
| 137 |
GetChar(&temp); |
| 138 |
Put("::::::::::::This should cause a line wrap, and"); |
| 139 |
Puts(" This should cause a line wrap..................\ |
| 140 |
.................................OKAY?"); |
| 141 |
Puts("This should appear\non two lines..."); |
| 142 |
NewLine(); |
| 143 |
Put("The character you typed was: "); |
| 144 |
string[0]= temp; |
| 145 |
WriteBinary(string,1); |
| 146 |
|
| 147 |
if (WaitCR() == 'i') goto Input; |
| 148 |
|
| 149 |
Title("TEST 5 - Cursor Left and Right"); |
| 150 |
Put("A"); |
| 151 |
CursorRight(5); |
| 152 |
Put("G"); |
| 153 |
WaitandSee(); |
| 154 |
CursorLeft(6); |
| 155 |
Put("B"); |
| 156 |
CursorRight(3); |
| 157 |
Put("F"); |
| 158 |
CursorLeft(4); |
| 159 |
Put("C"); |
| 160 |
CursorRight(1); |
| 161 |
Put("E"); |
| 162 |
CursorLeft(2); |
| 163 |
Put("D"); |
| 164 |
CursorLeft(7); |
| 165 |
CursorDown(2); |
| 166 |
Puts("The above should read ABCDEFG"); |
| 167 |
|
| 168 |
if (WaitCR() == 'i') goto Input; |
| 169 |
|
| 170 |
Title("TEST 6 - Cursor positioning"); |
| 171 |
i = dim[0] / 3; |
| 172 |
CursorDown(1); |
| 173 |
CursorTo(i,i); |
| 174 |
Put("A"); |
| 175 |
CursorTo(i,i*2); |
| 176 |
Put("A"); |
| 177 |
CursorTo(2*i,i); |
| 178 |
Put("A"); |
| 179 |
CursorTo(2*i,2*i); |
| 180 |
Put("A"); |
| 181 |
CursorTo(9,0); |
| 182 |
Put("This should be on line 9"); |
| 183 |
if (CursorTo(three,0) == OK) |
| 184 |
Put("This should be on line 3"); |
| 185 |
else Impossible(); |
| 186 |
|
| 187 |
if (WaitCR() == 'i') goto Input; |
| 188 |
|
| 189 |
Title("TEST 7L - Clear line "); |
| 190 |
CursorTo(three,0); |
| 191 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\n"); |
| 192 |
Put("About to clear line 3..."); |
| 193 |
WaitandSee(); |
| 194 |
CursorTo(three,4); |
| 195 |
ClearLine(); |
| 196 |
|
| 197 |
if (WaitCR() == 'i') goto Input; |
| 198 |
|
| 199 |
|
| 200 |
Title("TEST 7C - Clear characters."); |
| 201 |
NewLine(); |
| 202 |
Puts("This test will erase characters F-K."); |
| 203 |
NewLine(); |
| 204 |
Put("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
| 205 |
GetCursor(tpos); |
| 206 |
WaitandSee(); |
| 207 |
CursorTo(tpos[0],5); |
| 208 |
ClearChars(6); |
| 209 |
|
| 210 |
if (WaitCR() == 'i') goto Input; |
| 211 |
|
| 212 |
Title("TEST 8 - Clear to end of line and clear to end of screen"); |
| 213 |
GetCursor(tpos); |
| 214 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); |
| 215 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); |
| 216 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); |
| 217 |
WaitandSee(); |
| 218 |
CursorTo(tpos[0]+1,10); |
| 219 |
ClearRight(); |
| 220 |
CursorTo(last_line-5,0); |
| 221 |
Puts("Cleared from K on line 3"); |
| 222 |
Put("Next should clear from H of line 2 to the bottom"); |
| 223 |
WaitandSee(); |
| 224 |
CursorTo(tpos[0],7); |
| 225 |
ClearDown(); |
| 226 |
|
| 227 |
if (WaitCR() == 'i') goto Input; |
| 228 |
|
| 229 |
Title("TEST 9L - Clear from beginning of line "); |
| 230 |
NewLine(); |
| 231 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
| 232 |
NewLine(); |
| 233 |
Puts("This test should erase characters A-F."); |
| 234 |
WaitandSee(); |
| 235 |
CursorTo(three,5); |
| 236 |
ClearLeft(); |
| 237 |
|
| 238 |
if (WaitCR() == 'i') goto Input; |
| 239 |
|
| 240 |
Title("TEST 9S - Clear from beginning of screen"); |
| 241 |
CursorTo(four,0); |
| 242 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
| 243 |
NewLine(); |
| 244 |
Puts("This test will clear the screen up to F."); |
| 245 |
WaitandSee(); |
| 246 |
CursorTo(four,5); |
| 247 |
ClearUp(); |
| 248 |
|
| 249 |
if (WaitCR() == 'i') goto Input; |
| 250 |
|
| 251 |
Title("TEST 10 - Character attributes"); |
| 252 |
NewLine(); |
| 253 |
SetAttr(v_bold); |
| 254 |
Put("BOLD"); |
| 255 |
SetAttr(v_blink); |
| 256 |
Put("BLINK"); |
| 257 |
SetAttr(v_underscore); |
| 258 |
Put("UNDERSCORE"); |
| 259 |
SetAttr(v_inverse); |
| 260 |
Puts("INVERSE"); |
| 261 |
SetAttr(v_bold+v_underscore); |
| 262 |
Put("BOLD+UNDERSCORE"); |
| 263 |
SetAttr(v_bold+v_blink); |
| 264 |
Put("BOLD+BLINK"); |
| 265 |
SetAttr(v_bold+v_inverse); |
| 266 |
Puts("BOLD+INVERSE"); |
| 267 |
SetAttr(v_blink+v_underscore); |
| 268 |
Put("UNDERSCORE+BLINK"); |
| 269 |
SetAttr(v_underscore+v_inverse); |
| 270 |
Put("UNDERSCORE+INVERSE"); |
| 271 |
SetAttr(v_blink+v_inverse); |
| 272 |
Puts("BLINK+INVERSE"); |
| 273 |
SetAttr(v_bold+v_blink+v_underscore); |
| 274 |
Puts("BOLD+UNDERSCORE+BLINK"); |
| 275 |
SetAttr(v_bold+v_underscore+v_inverse); |
| 276 |
Puts("BOLD+UNDERSCORE+INVERSE"); |
| 277 |
SetAttr(v_bold+v_blink+v_inverse); |
| 278 |
Puts("BOLD+BLINK+INVERSE"); |
| 279 |
SetAttr(v_underscore+v_blink+v_inverse); |
| 280 |
Puts("UNDERSCORE+BLINK+INVERSE"); |
| 281 |
SetAttr(v_bold+v_underscore+v_blink+v_inverse); |
| 282 |
Puts("BOLD+UNDERSCORE+BLINK+INVERSE"); |
| 283 |
NewLine(); |
| 284 |
SetAttr(0); Put(" Graphic chars =>"); |
| 285 |
Put("abcdefghijklmnopqrstuvwxyz\n"); |
| 286 |
|
| 287 |
GetCursor(tpos); |
| 288 |
DrawBox(curl, curc, 7, 44); |
| 289 |
CursorTo(++curl,1); |
| 290 |
SetAttr(0); Put("Graphic chars =>"); |
| 291 |
SetAttr(_GRAPHICS_); |
| 292 |
Put("abcdefghijklmnopqrstuvwxyz"); |
| 293 |
CursorTo(++curl,1); |
| 294 |
SetAttr(_BOLD_); Put("Graphic chars =>"); |
| 295 |
SetAttr(_GRAPHICS_+_BOLD_); |
| 296 |
Put("abcdefghijklmnopqrstuvwxyz"); |
| 297 |
CursorTo(++curl,1); |
| 298 |
SetAttr(_UNDERSCORE_); Put("Graphic chars =>"); |
| 299 |
SetAttr(_GRAPHICS_+_UNDERSCORE_); |
| 300 |
Put("abcdefghijklmnopqrstuvwxyz"); |
| 301 |
CursorTo(++curl,1); |
| 302 |
SetAttr(_REVERSE_); Put("Graphic chars =>"); |
| 303 |
SetAttr(_GRAPHICS_+_REVERSE_); |
| 304 |
Put("abcdefghijklmnopqrstuvwxyz"); |
| 305 |
CursorTo(++curl,1); |
| 306 |
SetAttr(_BLINK_); Put("Graphic chars =>"); |
| 307 |
SetAttr(_GRAPHICS_+_BLINK_); |
| 308 |
Put("abcdefghijklmnopqrstuvwxyz"); |
| 309 |
SetAttr(0); |
| 310 |
|
| 311 |
if (WaitCR() == 'i') goto Input; |
| 312 |
|
| 313 |
|
| 314 |
Title ("TEST 11 - Scrolling"); |
| 315 |
Puts("First scrolling down three lines, then three lines up."); |
| 316 |
i = dim[0]/2; |
| 317 |
CursorTo(i,0); |
| 318 |
Puts("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); |
| 319 |
Puts("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"); |
| 320 |
Puts("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"); |
| 321 |
WaitandSee(); |
| 322 |
if (ScrollDown(3) != OK) Impossible(); |
| 323 |
WaitandSee(); |
| 324 |
if (ScrollUp(3) != OK) Impossible(); |
| 325 |
|
| 326 |
if (WaitCR() == 'i') goto Input; |
| 327 |
|
| 328 |
|
| 329 |
Title ("TEST 12L - Delete and Insert Lines"); |
| 330 |
i = dim[0]/2 - dim[0] / 5; |
| 331 |
CursorTo(i,0); |
| 332 |
Puts("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); |
| 333 |
Puts("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"); |
| 334 |
Puts("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"); |
| 335 |
CursorTo(3,0); |
| 336 |
Puts("Will insert blank lines"); |
| 337 |
WaitandSee(); |
| 338 |
CursorTo(i+1,0); |
| 339 |
if (InsertLines(1) == OK) |
| 340 |
{ CursorDown(2); |
| 341 |
InsertLines(1); |
| 342 |
CursorTo(3,0); |
| 343 |
ClearRight(); |
| 344 |
Puts("Will delete blank lines"); |
| 345 |
WaitandSee(); |
| 346 |
CursorTo(i+1,0); |
| 347 |
DeleteLines(1); |
| 348 |
CursorDown(1); |
| 349 |
DeleteLines(1); |
| 350 |
} else Impossible(); |
| 351 |
|
| 352 |
if (WaitCR() == 'i') goto Input; |
| 353 |
|
| 354 |
Title ("TEST 12C - Delete and Insert Chars"); |
| 355 |
i = dim[0]/2; |
| 356 |
CursorTo(i,0); |
| 357 |
Puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
| 358 |
CursorTo(3,0); |
| 359 |
Puts("Will insert 3 blanks after A"); |
| 360 |
WaitandSee(); |
| 361 |
CursorTo(i,1); |
| 362 |
if (InsertBlanks(3)) |
| 363 |
{ CursorTo(3,0); |
| 364 |
ClearRight(); |
| 365 |
Puts("... and delete them..."); |
| 366 |
WaitandSee(); |
| 367 |
CursorTo(i,1); |
| 368 |
DeleteChars(3); |
| 369 |
} else Impossible(); |
| 370 |
|
| 371 |
if (WaitCR() == 'i') goto Input; |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
Title("TEST 13 - Terminal type"); |
| 376 |
NewLine(); |
| 377 |
sprintf(msg,"I'm made of %d lines x %d cols", |
| 378 |
dim[0],dim[1]); |
| 379 |
Put(msg); |
| 380 |
|
| 381 |
if (WaitCR() == 'i') goto Input; |
| 382 |
|
| 383 |
Input: |
| 384 |
Title("TEST 14 - Keypad input"); |
| 385 |
i = 2*(dim[0])/3; |
| 386 |
|
| 387 |
while(1) |
| 388 |
{ CursorTo(3,0); |
| 389 |
ERR_CLEAR(); |
| 390 |
Put("Please type any key -- The EOF character will stop the loop"); |
| 391 |
status = GetChar(&temp); /* Unknown char */ |
| 392 |
if (status == _EOF_) break; |
| 393 |
ClearDown(); |
| 394 |
if(status < _STANDARD_) |
| 395 |
{ CursorTo(i,i); |
| 396 |
SetAttr(_REVERSE_); |
| 397 |
p = ERR_LOC(); |
| 398 |
if (p == (char *)0) p = |
| 399 |
"TERMCAP does not understand the typed key"; |
| 400 |
Put(p); |
| 401 |
while ((temp = WaitandSee()) > ' ') |
| 402 |
SetAttr(_REVERSE_), |
| 403 |
Write(&temp,1); |
| 404 |
SetAttr(_NORMAL_); |
| 405 |
CursorTo(3,0); |
| 406 |
ClearDown(); |
| 407 |
continue; |
| 408 |
} |
| 409 |
NewLine(); |
| 410 |
Put("Character type is "); |
| 411 |
string[0] = '0' + status; |
| 412 |
Write(string,1); |
| 413 |
Put(char_type[status]); |
| 414 |
Put(" -- Character is "); |
| 415 |
string[1] = temp; string[2] = '\''; string[0] = '\''; |
| 416 |
TRACE_ED_I("Got: ", temp); |
| 417 |
if (status == _ARROW_) string[1] = arrows[temp]; |
| 418 |
else if (temp < ' ') |
| 419 |
{ string[0] = '^'; |
| 420 |
string[1] = temp + '@'; |
| 421 |
string[2] = ' '; |
| 422 |
} |
| 423 |
WriteBinary(string,3); |
| 424 |
} |
| 425 |
if (WaitCR() == 'i') goto Input; |
| 426 |
|
| 427 |
Title("TEST 15 - Command input"); |
| 428 |
CursorTo(3,0); |
| 429 |
WhileInput(NULL_FCT(int)); /* Nothing while waiting for input */ |
| 430 |
|
| 431 |
for (i=0; ; i++) |
| 432 |
{ SetAttr(_BOLD_); Put("\nPrompt=>"); SetAttr(_NORMAL_); |
| 433 |
if (i == 0) /* First test */ |
| 434 |
strcpy(msg,"Template command ===> Try to edit it !"); |
| 435 |
else msg[0] = 0; |
| 436 |
status = Mods(msg, sizeof(msg)); |
| 437 |
if (status == _EOF_) break; |
| 438 |
NewLine(); |
| 439 |
sprintf(aux,"%6d: ", i); |
| 440 |
Put(aux); |
| 441 |
SetAttr(_REVERSE_); |
| 442 |
WriteBinary(msg, strlen(msg)); |
| 443 |
SetAttr(_NORMAL_); |
| 444 |
} |
| 445 |
if (WaitCR() == 'i') goto Input; |
| 446 |
|
| 447 |
|
| 448 |
ClearScreen(); |
| 449 |
Puts("End of tests."); |
| 450 |
CloseTerm(); |
| 451 |
} |
| 452 |
int WaitCR() |
| 453 |
{ |
| 454 |
MID_STATIC short int tmp[2]; |
| 455 |
char ch; |
| 456 |
|
| 457 |
ENTER("WaitCR"); |
| 458 |
GetCursor(tmp); |
| 459 |
CursorTo(last_line,colCR); |
| 460 |
Put("Hit <Return> to continue"); |
| 461 |
GetChar(&ch); |
| 462 |
CursorTo(tmp[0],tmp[1]); |
| 463 |
EXIT (ch); |
| 464 |
} |
| 465 |
char WaitandSee() |
| 466 |
{ |
| 467 |
MID_STATIC short int tmp[2]; |
| 468 |
char ch; |
| 469 |
ENTER("WaitandSee"); |
| 470 |
GetCursor(tmp); |
| 471 |
CursorTo(last_line,colCR); |
| 472 |
SetAttr(_BLINK_|_REVERSE_); |
| 473 |
Put("Hit <Return> to continue"); |
| 474 |
GetChar(&ch); |
| 475 |
SetAttr(0); |
| 476 |
CursorTo(tmp[0],tmp[1]); |
| 477 |
EXIT (ch); |
| 478 |
} |
| 479 |
Impossible() |
| 480 |
{ |
| 481 |
ENTER("Impossible"); |
| 482 |
CursorTo(last_line,4); |
| 483 |
SetAttr(_BLINK_|_BOLD_|_REVERSE_); |
| 484 |
Put("Not Supported"); |
| 485 |
SetAttr(0); |
| 486 |
EXIT (OK); |
| 487 |
} |
| 488 |
Title(c) |
| 489 |
char *c; |
| 490 |
{ |
| 491 |
ENTER("Title"); |
| 492 |
ClearScreen(); |
| 493 |
Puts(c); |
| 494 |
EXIT(OK); |
| 495 |
} |
| 496 |
|
| 497 |
int ring_bell(n) /* Routine excuted while waiting for input */ |
| 498 |
int n; /* IN: Count for waiting clicks */ |
| 499 |
{ |
| 500 |
TVSAVE pos; |
| 501 |
|
| 502 |
ENTER("+ring_bell"); |
| 503 |
|
| 504 |
if (n > 20) EXIT(20); |
| 505 |
if (n == 1) |
| 506 |
{ ClearChars(1); |
| 507 |
SupplyInputs("\r"); |
| 508 |
Bell(); |
| 509 |
EXIT(0); |
| 510 |
} |
| 511 |
if (n == 4) |
| 512 |
{ SaveCursor(&pos); |
| 513 |
SetAttr(_BOLD_|_BLINK_|_REVERSE_); |
| 514 |
Bell(); |
| 515 |
Put("?"); |
| 516 |
RestoreCursor(&pos); |
| 517 |
} |
| 518 |
|
| 519 |
EXIT(--n); |
| 520 |
} |