[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
History capabilities for T
- To: t-users@YALE.ARPA
- Subject: History capabilities for T
- From: jth@wisc-crys (JT Hsieh)
- Date: Fri ,9 Nov 84 16:16:46 EDT
I have written a program (TT) that serves as an interface between a T
user and the T interpreter on a VAX UNIX. TT implemented most of the
history capabilities found in the UNIX C Shell. Only the lines that
begin with an exclamation point or a semicolon are processed by TT.
All other lines go to the T interpreter transparently.
The syntax and semantics of TT are similar to those used in csh. The
":h n" command displays the last n history lines. The default value of
n is 10. ":h n1-n2" prints lines n1 thru n2. Unlike csh, the :h
commands are not saved in the history buffer.
!!, !123, !?pattern?, ^pat1^pat2^, :s/pat1/pat2/ and :p work exactly
the same as in csh. Trailing delimiters are optional. !pat matches
the latest history line that begins with any number of space, tab,
and/or '(' followed by pat. More precisely, "!pat" is equivalent to
"!?^[ tab(]*pat?" One deviation from csh is that the !-reference is
recognized only at the beginning of a line. For example, the !! in
(set x !!) is not substituted.
Regular expressions [except \( \) \< \> and ~] are supported.
Metacharacters ^$.*[-]&\ and missing pat1 and pat2 have the same
meanings as in vi or ex. + is a variant of * and means `one or more.'
!0 refers to the line immediately after the one referenced by the
previous !-notation. ! followed immediately by a : (or an end of line)
is considered as !0. The "!=" command displays the location and
contents of !0. The !0 location is useful for repeating a previous
command sequence. For example, to re-execute lines 10 thru 12, one can
type "!10", "!" and "!". One can also make changes either on the fly
(!:s/pat1/pat2) or beforehand (!11:s/pat1/pat2/:w 11.) The ":w n"
command writes into the n-th history buffer.
<Ctrl-Z>, (stop) and interrupt are all handled correctly. That is, the
users feel as if they use the T interpreter directly. <ctrl-D> is
converted to (ret) by TT. :q and :x are converted to (exit).
Arguments supplied on the invocation of TT are considered as file
names. Each filename is converted into (load "filename") in order.
TT is written in C. The space and time overheads are negligible
compared with the T interpreter. Source code and documentation are
available from email@example.com.