[net.sources] The best clear for VAX/VMS

moroney@jon.DEC (Mike Moroney 223-9038) (07/09/85)

The best clear for VAX/VMS is the following since it is VERY fast (no image 
activation), assuming you have a VT100 or better.

$ CLEAR	:==	"WRITE SYS$OUTPUT ""<ESC>[24;1H<ESC>[2J"""

Replace <ESC>'s with the real thing.  A similar CLEAR can be done for VT52's
as well.

"There's a madness to my method."			Mike Moroney
						..decwrl!rhea!jon!moroney

umdhep@eneevax.UUCP (Todd Aven) (07/09/85)

In reply to the many people who submitted parts of the solution to
the question: 'What's the best way to clear the screen under VAX/VMS?'

The answer:

First of all, don't assume (you know the saying) that the terminal is
a VT100 emulator, as not everyone uses VT100 emulators (simple, right?).
Second, decide upon how important login speed and clear speed are, because
there are essentially two ways to go about this: either a command
procedure, or an executable.

I. Define the terminal type as a symbol -
    You can define at login (sys$sylogin) symbols for the recognized
    terminals. For example, if you were using a H19, in SYLOGIN.COM
    you would have $ H19 :== @sys$somewhere:h19.com, in which case
    you would have h19.com contain two things:
     $ term_type == "H19"
     $ set term/dev=H19 (if you have defined it for SMG) or
     ! set term/dev=unknown.
    Now, whether you choose to do the clearing with a proc or an image,
    the terminal type will be known.

II. Execute proc or image upon command -
	Define your clear command as either
	$ clear :== run sys$somewhere:clear.exe  or
	$ clear :== @sys$somewhere:clear.com

	A. Clear is an image:
	   1. Write clear in C and use curses with SMG for max speed.
	   2. Write clear in whatever and use lib$xxxx to translate
		the symbol term_type, then switch to the correct
		output routine for clearing that terminal.

	B. Clear is a proc:
	   Translate term_type (trivial) and switch to the appropriate
	   output routine for clearing that terminal.

My vote is for using SMG, Curses, and C. This is elegant and forces you
to get off your duff and define foreign terminals for SMG. If you wnat
speed, I guess the proc is best, because there is no image activation
and the switching takes very few lines, and allows easy addition of
new terminal clear sequences. You can also get fancy and pass parameters
to the proc to add functions like a hard reset or change emulation mode,
or whatever your heart's desire.

============================================================
|Todd Aven               MANAGER@UMDHEP.BITNET             |
|Softwear Sweatshop         AVEN@UMCINCOM (arpanet, bitnet)|
|High Energy Physics      UMDHEP@ENEEVAX.UUCP              |
|University of Maryland                                    |
|College Park, MD 20742                                    |
============================================================