HP3000-L Archives

June 2003, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Emerson <[log in to unmask]>
Reply To:
Tom Emerson <[log in to unmask]>
Date:
Wed, 4 Jun 2003 02:32:55 -0700
Content-Type:
Text/Plain
Parts/Attachments:
Text/Plain (70 lines)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 04 June 2003 12:08 am, Jay Chandru wrote:
> In order to clear the screen in HP3000 machine, we do a
>
> ECHO  H J
>
> The ' ' indicates that this is a escape sequence.
>
> But i am wondering, how is the ' ' typed on to the screen. Any pointers?

There are a variety of ways.  "really old" UDC's [before "echo" existed]
usually consisted of an "option list" UDC that contained the string as a
comment -- you usually couldn't list the UDC file without it actually taking
effect.  In order to enter this, you simply typed it in via the editor -OR-
typed it in with a "placeholder", then issued a command such as

   c "<esc>",'27,all

In Edit/3000,  [and other editors], the "single quote" character has a special
meaning -- a numerical value following it is converted to the corresponding
ascii character, in this case, escape=27 [decimal], so the above change
command replaces every occurance of the string "<esc>", with the actual
escape character.

Qedit's "visual" mode also has the ability to replace a single special
character with the escape, and does so automatically.  The default value is
the tilde (~), but be careful -- if you edit a file that REALLY should have
this character in it, even scrolling through "in visual mode" will replace
them with escape characters...

BUT all of that is "the old way" of doing it.

The "new"(er) way is to use an expression, something along the lines of:

   :ECHO ![CHR(27)]H![CHR(27)]J

The "![...]" construct means "evaluate the contents and return as if typed
into the line originally", and "chr()" is a function that returns the ASCII
character that corresponds to the parameter [again, "27"]

Of course, ![chr(...)] gets tiresome to type, especially if you do that a lot.
Instead, you can issue a command such as

   :SETVAR EC=CHR(27)

then use

   :ECHO !"EC"H!"EC"J

The additional " characters are needed in this one special case -- legitimate
(variable name) characters immediately following an actual variable name in
an ! replacement need to be delimited in some way (which for escape sequences
doesn't cut down much on ![chr()] syntax, but it is shorter...)

- --
Yet another Blog: http://osnut.homelinux.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
Comment: http://osnut.homelinux.net/TomEmerson.asc

iD8DBQE+3bzJV/YHUqq2SwsRAhZbAKCMLxbQjMxwlNk2rnqzf1zRrvSLKACeIv0r
4q+S+yfMfsMWy5GtFd3wp+E=
=/2ED
-----END PGP SIGNATURE-----

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2