TTY PackageFile: TTY.pressRevised: December 7, 1982 by Mark StefikThe TTY package is a set of functions for interacting with the TTY. It is much simpler to usethan ASKUSER. The input functions also provide a technique for suppressing prompts that makesit easy to create programs that respond to "commands" or sequenced entry with a varied amount ofprompting for input.These functions were originally written by Mark Stefik and Peter Friedland in 1978 for use with the UNITSpackage. They have been renamed and documented here.INTTY (promptStr goodList helpStr noShiftFlg)INTTY interacts with a user at the TTY and returns an atom. In its simplest usage, it promptsthe user using the promptStr. The user then types a response followed by a carriage return.INTTY returns the user's response which is a member of goodList. If there is a sequence of calls toINTTY, the user can separate the responses by spaces and follow the last one with a carriage return.More formally, the arguments to INTTY are as follows:promptStr. A prompt typed to the TTY when INTTY is invoked. This prompt is suppressed ifthe user has typed ahead.goodList. Optional argument. This is a list of acceptable answers. If the characters typed bythe user correspond to the first characters of any element of goodList, that member is returned asthe value of INTTY. If the leading characters are ambiguous, then user is warned. If goodList issupplied and the user's reply matches no entry, INTTY attempts spelling correction. On failure ofspelling correction, all type ahead is flushed and the user is warned and reprompted. If goodList isNIL, no checking is performed. helpStr. A secondary prompt if the user types a ? to INTTY. Intended to allow short prompts,and longer more explanatory prompts as needed.noShiftFlg. Normally, INTTY converts the user's response to all upper case. If noShiftFlg is T,then the user's response is passed along as typed.ExampleThe following statements:(SETQ name (INTTY "Name: " NIL "Please type your first name"))(SETQ age (INTTY "Age: " "Your age in years"))(SETQ color (INTTY "Paint color: " '(RED BLUE YELLOW WHITE)))could yield the following dialog (prompts in boldface):Name: John Age: 17 Paint color: Green Response not recognized. Type ? for help.Paint color: ? Expecting one of (RED BLUE YELLOW WHITE)Paint color: blue which illustrates the help facility, or the following dialog%Dapi ^qF ]@Zr^ Y'7 WF URqJ Q5 N#p-@Jr&8 Issr- G, sr% Fk40@C@5@@s r@ >@;esr8 96sr 8]Ssr 6/3 5UIsr 3@0srU /!.@+s r; s r *r2 &3'F@$ >k.= 7tr  tr t r t* r t(x r M< >X22Name: John 17 yell which illustrates the suppression of type ahead and name completion. Note that no actual readingof the typing takes place until the is typed. Successive calls to INTTY suppress theprompt, and read through the separating spaces. At the conclusion of execution, the LISP variablesname, age, and color have all been set to JOHN, 17, and YELLOW respectively.INTTYL (promptStr goodList helpStr noShiftFlg)Similar to INTTY except that it always returns a list of the items typed. INTTYL readssuccessive entries until a carriage return is typed. WRITE (arg1 arg2 ...)Prints the arguments arg1, arg2, etc. to the TTY (using PRINT1). Prints a carriage return atthe end. Output goes to the primary output device. PrintStatus (arg1 arg2 ...)Similar to WRITE except that PrintStatus allocates its own window and prints to that. Thewindow is title "Status Window" and is made to scroll as writing proceeds. Nfrbtr ^R ]n#; [Y Zfsrsrsr8 Upp.@RErJ P6 MOp@J#rs r- H5 E-p@BrV @~L@:' 9=.+s TIMESROMAN  TIMESROMAN TIMESROMAN  TIMESROMAN  TIMESROMAN  j/  ' tty.BravoStefikDecember 7, 1982 2:47 PM