From: SMTP%"Info-VAX-Request@Mvb.Saic.Com" 10-SEP-1994 18:29:58.10 To: EVERHART CC: Subj: Re: clear screen From: Jerry Leichter X-Newsgroups: comp.os.vms Subject: Re: clear screen Message-Id: <9409092236.AA06157@uu3.psi.com> Date: Fri, 9 Sep 94 18:21:46 EDT Organization: Info-Vax<==>Comp.Os.Vms Gateway X-Gateway-Source-Info: Mailing List Lines: 130 To: Info-VAX@Mvb.Saic.Com =I create a symbol = = $ CLS :== WRITE SYS$OUTPUT """[2J[1;1H""" = $ HOME :== WRITE SYS$OUTPUT """[1;1H""" = $ RESET :== WRITE SYS$OUTPUT """c[2J[1;1H""" = =The is produced by pressing the escape key twice in EDT. I =know that this is limited to VT terminals. I hope this helps. Once more: THE FIRST TWO ARE *NOT* LIMITED TO VT TERMINALS. THEY ARE LIMITED TO *_ANSI_* TERMINALS. They should, for example, work with a PC set up to behave like a generic ANSI terminal. Now, the RESET I don't know about. We're getting into some deep and muddy water here. Everyone out on the list: Have you ever *read* ANSI X3.64? Hmm, don't see too many hands. Have you ever *seen a copy*? Not too many more. Is your hand up, Mr. Lydick? ANSI X3.64 is a big, complicated spec - 800 pages or more, as I recall. It's also the ultimate vendor's spec, since it is quite possible - extremely easy, in fact - to build a terminal that can be legally called "ANSI X3.64 compli- ant" even though it does nothing at all useful. Alternatively, it's possible to build two legally "ANSI X3.64 compliant" terminals that are not in any practical sense of the word interoperable or interchangeable. ANSI X3.64 starts off with purely syntactic definitions. (Actually, it may inherit some of this stuff from yet another ANSI spec, X3.41.) It defines the syntaxes of control sequences, escape sequences (yes, technically there is a *significant* distinction), and several related concepts. The syntactic definitions make it possible to recognize when a legal X3.64 "command" begins in the datastream and when it ends, even though you have no idea what it means. You can tell purely by the syntax: The choice and arrangement of the constituent characters. Thus, c is a complete escape sequence. So is (B. So, for that matter, is ((((((((c. [2J, on the other hand, is a complete control sequence. So is [((;;;?????112==??;J. Even more simply, the single character HT (CTRL/I - Horizontal Tab) is itself a command. The rest of ANSI X3.64 defines the meaning of some control and escape sequences. As I recall - and I never had reason to look at the spec too closely; it runs to hundreds of pages - ANSI will define: (a) a specific standard name for a function; (b) assign a specific command sequence to that name; (c) define the semantics of that function. Thus, the ANSI function name RI, escape sequence ESC M, is Reverse Index: The cursor moves up on line in the current column; if it was in the top column, the screen scrolls down. In addition, I believe ANSI X3.64 assigns official names to certain subsets of functions. ANSI X3.64 defines many different functions. It divides the undefined but syntactically correct sequences into two classes: Those reserved for future ANSI standardization, and those available to manufacturers as "private extensions". (There is a technical point here: Control sequences can have parameters. It is possible to define private parameters for standard control sequences. Thus, ESC [ xxx h is a standard "Set Mode" control sequence, with the xxx specifying what to set. ESC [ 1 2 h sets the standard-defined Send- Receive Mode (which has the effect of turning local echo off). ESC [ ? 8 h sets the DEC-private Auto Repeat Mode. The "?" marks a private parameter.) As I recall the definition of ANSI X3.64 compliance, a complying device: a) Correctly parse any valid ANSI command sequence. (If it doesn't understand the sequence, it may discard it as a whole or report an error - but it can't act on parts of it as though they were "just characters". All DEC terminals ignore any syntactically valid sequences they don't understand.) b) Treat any characters that are not part of a command sequence as individual displayable units (that's the meaning ANSI assigns to them). c) If it chooses to implement any of the ANSI-standardized commands, it must implement them in exactly the way specified in the standard; d) It may not provide a private meaning to any commands in the class of commands reserved for future standardization; e) (This one I'm not certain about): If it claims to implement one of the officially-defined subsets, it must implement all the commands that make up that subset. I do not believe the ANSI spec actually *requires* that any particular commands be implemented. In practice, as far as I know, *no one* has ever implemented a "full" ANSI terminal - i.e., one that implements *all* the commands the spec defines. Some of the defined commands have probably never been implemented anywhere. On the other side, as far as I know, no one has every sold a terminal that does not implement at least some private functions. In practice, very few "pure ANSI" terminals have ever been made, and almost no software that can deal with a "pure ANSI" terminal has ever been written. The private extensions defined in the VT100 have come to be the de facto defini- tion of "ANSI compatible", whatever the letter of the spec may say. By the way, if we ignore the problem that an ANSI terminal need not actually implement the functions involved, there is an easy way to tell whether a given command accepted by a DEC terminal (or printer) is standardized by ANSI or a DEC-private extension: Just check the official name for the command in the DEC documentation. All DEC extensions have a name that starts with "DEC". (Yes, theoretically an ANSI command name might start with those 3 letters, but I know of no examples.) Thus: ESC [ 2 J ED (Erase in Display) Standard command; standard parameter 2 requests that the entire display be erased. ESC [ 1 ; 1 H CUP (Cursor Position). Standard command; standard parameters specify the cursor position to move to, in this case, the home position. Note: ESC [ H is, by definition, equivalent. Also note that the definition of "home" depends on whether origin mode is set and, if so, whether a scrolling region has been define. These are DEC-private, by the way. ESC c RIS (Reset to Initial State). Surprise! This one is ANSI-standard, too. If you wanted to clear the scrolling region, you'd use: ESC [ r DECSTBM (Set Top and Bottom Margins). DEC-private. (When issued with no parameters, this command sets the top and bottom margins to the whole screen). Note the "DEC" at the front of the name. This would have no defined meaning on a generic ANSI-compliant terminal. There's no mechanism for reserving private extensions, so some other manufac- turer could define it to do something quite different. -- Jerry