[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defontifying program



    Date: Thu, 2 Aug 90 06:15:05 EDT
    From: cmaeda@GS5.SP.CS.CMU.EDU (Christopher Maeda)

    Anyone have a unix/c program that strips out Symbolics font
    information from text files?  I already have a lisp program to do it
    but I have more spare cycles on unix boxes.

    Chris

On a similar but slightly different note, here is code I have that
runs in Lucid that allows you to read LISP files that have font info in
them.  (However, note that font info can't change during a symbol.)



;;; -*- Mode: LISP; Syntax: Common-lisp; Package: USER; Base: 10 -*-

(in-package "USER")

;;; The intent of this is to allow Symbolics files with fonts to be used
;;; on another lisp system.

;;; Restriction:  Symbols must all be in one font (no font changing during the middle)

;;; Control-F is the Symbolics font character.
(defun ignore-symbolics-font-info (stream char)
  (declare (ignore char))
  (let ((char (read-char stream)))
    (cond ((char-equal char #\()
	   ;; This reads a character style.  Just ignore it
	   (unread-char #\( stream)
	   (read stream)
	   )
	  ((char-equal char (code-char 5 0 0))
	   (dotimes (i 10) (read-char stream))	;Read rest of password
	   (setq char (read-char stream))
	   (unless (char-equal char (code-char 2 0 0))
	     (error "Unknown font info level after font password: ~A" char))
	   (dotimes (i 25) (read-char stream)))
	  (t nil))				;Otherwise a digit (indicating a character style) or *
    (values)))					;Return nothing so it doesn't pay attention to it

(setq *ignore-symbolics-font-info-readtable* (copy-readtable *readtable*))
(set-macro-character (code-char 6 0 0) #'ignore-symbolics-font-info nil *ignore-symbolics-font-info-readtable*)
(setq *readtable* *ignore-symbolics-font-info-readtable*)