https://donhopkins.com/home/code/term.ps.txt
It also supported the <ESC>#8 "fill screen with E" test sequence, just so it could pass VTTest, plus a few extra Sun and AAA sequences that my slave driving boss Hugh Daniel demanded (since he was from Ann Arbor). Yes, a company actually called "Wedge Computer, Inc." paid me to write it!
There are also some subtleties about missing numeric arguments that VTTest checks. My SoftTTY emulator would detect syntax errors in escape sequences, which implied you were trying to test it with VTtest, so then it would change the cursor to the shape of a hand giving you the finger (shape-error-cursor), and flash it 20 times, to flip Hugh off for subjecting my terminal emulator to VTTest.
https://en.wikipedia.org/wiki/Vttest
/ps-string-prefix {
/ps-string 256 string def
/ps-string-len 0 def
/termulate-char //termulate-ps-string def
} def
/termulate-ps-string {
dup 27 eq {
pop
reset-termulator
ps-string 0 ps-string-len getinterval cvx
{ exec } stopped pop
} {
ps-string ps-string-len 3 -1 roll put
/ps-string-len ps-string-len 1 add def
ps-string-len ps-string length eq {
/ps-string
ps-string-len dup add string
ps-string 1 index copy pop
def
} if
} ifelse
} def
I used it for writing a Lisp "Little Backwards Chainer" program that would download a tree of dirty knowledge base symbols into the server to define a corresponding tree of pop-up pie menus, so I could browse the Lisp data structures as pie menus to debug the program.https://donhopkins.com/home/archive/lisp/little-backwards-ch...
; Write dirty nodes to the NeWS server in PostScript, and mark them as
; clean.
(defun sweep ()
(clean-tree '*KB*))
(defun clean-tree (node)
(cond ((get node 'dirty)
(send-node node)
(putprop node nil 'dirty)))
(cond
((null (node-alist node)) nil)
(t (mapcar #'(lambda (link)
(clean-tree (link-node link)))
(node-alist node))
nil)))
(defun send-node (node)
(ps-make-node node (node-sexp node)
(node-associated-atom node)
(node-alist node)))
; Magic control characters the PostScript terminal emulator responds to.
(setq StartPS "^_") ; Ctrl-_: begin trojan horse
(setq EndPS "^]") ; Escape: end and execute trojan horse
; Write out a NeWS menu definition, with the right control characters to
; make the PostScript terminal program (SoftTTY) execute it.
(defun ps-make-node (name sexp associated-atom alist)
(msg "% Sending " name "...")
(msg StartPS "userdict /" name " [" N)
(msg " " (list 'Name= name) " {" (ncons name) " print}" N
" " (list 'Sexp= sexp) " {" (ncons sexp) " print}" N
" " (list 'Atom= (fact-name associated-atom))
" {" (ncons (fact-name associated-atom)) " print}" N)
(mapcar #'(lambda (link)
(msg " " link " /" (link-node link) " cvx" N))
alist)
(msg "] /new DefaultMenu send put" N)
(msg name " /Clockwise false put" N)
(cond ((eq name '*KB*) (msg "/ClientMenu *KB* def" N))) ; kludge
(msg EndPS N))
Hugh was the author of ColorToy and ColorTool, which lets you play with and change all the user interface colors (even to dynamic random procedural colors that changed every time it paints, which was the most fun, and useful for debugging drawing, incremental screen updating, and clipping bugs!)https://donhopkins.com/home/archive/NeWS/news-tape/utilities...