Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!news.mathworks.com!newsfeed.internetmci.com!news.uoregon.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!ddyer
From: ddyer@netcom.com (Dave Dyer)
Subject: Re: Stripping / converting files made on a symbolics?
Message-ID: <ddyerDDBAGo.LqK@netcom.com>
Reply-To: ddyer@netcom.com
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <TFB.95Aug13123257@scarp.ed.ac.uk> <DDB30B.1Gy@aplcenmp.apl.jhu.edu>
Date: Mon, 14 Aug 1995 17:41:11 GMT
Lines: 65
Sender: ddyer@netcom5.netcom.com

If you're fortunate enough to still edit on symbolics machines some of
the time, here's a code snippet that sets up the readtable to ignore
symbolics font information.  With this hack, you don't need to remove
the fonts to compile under harlequin/lucid/franz lisp.

A couple caveats; this doesn't work correctly if partial words are fontified,
and the font information still makes editing on unix platforms look bad. It
does, however, provide a bridge to delay the inevitable.


(defconstant ESCAPE-QUOTE (code-char 6))

(defvar BAD-ESCAPE-ACTION :error)

(defun SKIP-ESCAPE-SEQUENCE (stream)
  ;;(format t "~&@~D" (file:read-stream-pointer stream))
  (let* ((next-char (read-char stream)))
    (or (when (or (eql next-char escape-quote)
		  (eql next-char #\return))
	  next-char)
	(block process-real-escape-sequence
	  (cond ((eql next-char #\( )
		 (unread-char next-char stream)
		 (read stream))
		((eql next-char #\* )
		 nil)
		((eql next-char #\ )
		 (let ((c nil))
		   (loop (setq c (read-char stream)) (when (eql c #\] ) (return)))))
		((char-lessp next-char #\0)
		 (case bad-escape-action
		   (:error  (error "Junk (~S) in escape sequence" next-char))
		   (:notify (format t "~&Junk (~S) in escape sequence...losing it."
				    next-char))))))
	nil))
  )

(defun MAKE-EPSILON-IGNORING-READTABLE (&key
					(template-readtable *readtable*)
					(new-readtable (copy-readtable template-readtable)))
  (set-macro-character escape-quote
		       #'(lambda (stream macro-character)
			   (declare (ignore macro-character))
			   (skip-escape-sequence stream)
			   (values))
		       nil  ;was T.  NIL is the right thing [ddyer]
		       new-readtable)
  new-readtable)

(defmacro %RT (&optional (readtable 'cl:*readtable*))
  `(make-epsilon-ignoring-readtable :new-readtable ,readtable))


(eval-when (load eval)
  #-symbolics (%rt)
  #+lucid   (progn
	      (proclaim '(special lucid::*standard-readtable*))
	      (%rt lucid::*standard-readtable*))
  )


-- 
---
My home page: ftp://ftp.netcom.com/pub/dd/ddyer/home.html
or try http://www.triple-i.com/~ddyer/home.html
