1
0
mirror of https://github.com/PDP-10/its.git synced 2026-03-24 01:27:33 +00:00
Files
PDP-10.its/src/libdoc/smurf.rwk1
Eric Swenson aefb232db9 Added sources and build instructions for Lisp library packages
required by Macsyma. Resolves #706.
2018-03-07 09:03:40 +01:00

37 lines
1.4 KiB
Plaintext
Executable File

;; (SMURF) prints 300 characters around the current position in INFILE.
;; It's useful when you get a dot-context error or other error while
;; loading a file. Just do (SMURF) and it'll print out the vicinity
;; of the error. 2/3 of the printing will be before the error, 1/3
;; after. If you want to see more context, just call it on the number
;; of characters you'd like to see instead of 300.
;; This function is my version of a long-existing function who's origin
;; is lost in the murky depths of history. You'll have to play historian
;; if you want to know why it's named SMURF! --RWK
(HERALD SMURF)
(defun smurf (&optional (chars-wanted 300))
(cond ((and (filep infile) (memq 'filepos (status filemode infile)))
(terpri tyo)
(let ((old-filepos (filepos infile))
(pre-chars (// (* 2 chars-wanted) 3)))
(let ((new-filepos (max 0 (- old-filepos pre-chars)))
(post-chars (- chars-wanted pre-chars)))
(filepos infile new-filepos)
(smurf-em (min old-filepos pre-chars))
(filepos infile old-filepos)
(princ '|===>>> Error Occured Here <<<===| tyo)
(smurf-em post-chars))))
(T (terpri tyo)
(princ '|Can't FILEPOS with INFILE = | tyo)
(prin1 infile tyo)
(terpri tyo))))
(defun smurf-em (chars-wanted)
(DO ((num chars-wanted (1- num))
(char (tyi infile nil)
(tyi infile nil)))
((or (= num 0)
(null char)))
(tyo char tyo)))