[net.sources] lisp beautifier - patched

colonel@sunybcs.UUCP (01/05/87)

The lisp pretty-printer shell script I posted some time ago has become
obsolete if you have the "packages" feature.  (The script bombs on colons.)
It's a one-line fix, but here's the whole thing anyway, in case you missed
it.  Colons work now.  Backquotes always worked (no expansion).  Sharps
never worked and probably never will.
-------------------------------------

# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# lb.1 lb

echo x - lb.1
sed -e 's/^X//' > "lb.1" << '//E*O*F lb.1//'
X.TH LB 1 "8 Nov 1985" Local
X.SH NAME
Xlb \- lisp program beautifier
X.SH SYNOPSIS
X.B lb
Xfile
X.SH DESCRIPTION
X.I Lb
Xis a shell script that
Xreads lisp source code from a file
Xand pretty-prints it to the standard output.
X.SH FILES
X/usr/tmp/$$ \- temporary output file
X.br
X/usr/ucb/lisp \- the lisp system
X.SH BUGS
XComments in an object are collected and printed before it.
X.PP
XThe script does not clean up when interrupted.
X.PP
XThe atoms _0, _1, _2, _3, _4, and _5 are reserved for use by
X.I lb.
X.PP
XAll lisp error messages are suppressed.
XHeaven help you if the input file contains syntax errors or loose NILs.
X.SH AUTHOR
XCol. Sicherman
//E*O*F lb.1//

echo x - lb
sed -e 's/^X//' > "lb" << '//E*O*F lb//'
X:	lb - lisp beautifier.
X:	Col. Sicherman.		8 Nov 1985. 9 Dec 1986.
Xif test $# -ne 1
Xthen
Xecho "usage: $0 file" >&2
Xexit
Xfi
Xt=/usr/tmp/$$
Xlisp << SLUGGO > /dev/null
X(putprop '_4 '|\`| 'printmacrochar)
X(putprop '_5 '|,| 'printmacrochar)
X(setsyntax '|\`| 'vmacro '(lambda nil (list '_4 (read))))
X(setsyntax '|,| 'vmacro '(lambda nil (list '_5 (read))))
X(setsyntax '|:| 'vcharacter)
X(setsyntax '|;| 'vsplicing-macro
X	'(lambda nil (do _6 (car (aexploden '|;|))(tyi _0)
X	(progn (tyo _6 _1)(= 10 _6)))))
X(setq _0 (fileopen '$1 'r))
X(setq _1 (fileopen '$t 'w))
X(def _2 (lambda (l) (cond ((null l))
X	(t (pp-form l _1)(terpr _1)(terpr _1)))))
X(do _3 nil nil (_2 (read _0)))
X(close _1)
XSLUGGO
Xcat $t
X/bin/rm -f $t
//E*O*F lb//

exit 0
-- 
Col. G. L. Sicherman
UU: ...{rocksvax|decvax}!sunybcs!colonel
CS: colonel@buffalo-cs
BI: colonel@sunybcs, csdsiche@ubvms