(FILECREATED "29-Dec-84 12:09:30" {ERIS}<LISPCORE>DIG>PRINT8PATCH.;1 4409   

      changes to:  (VARS PRINT8PATCHCOMS)
		   (FNS INTERPRESSFILEP INTERPRESS.OUTCHARFN)

      previous date: "22-Dec-84 11:57:02" {ERIS}<LISPNEW>PATCHES>PRINT8PATCH.;1)


(* Copyright (c) 1984 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT PRINT8PATCHCOMS)

(RPAQQ PRINT8PATCHCOMS ((FNS FONTNAME.IP INITIALIZEMASTER.IP INTERPRESSFILEP INTERPRESS.OUTCHARFN)
			(INITVARS (CHARACTERCODEVERSION (QUOTE XC1-1))
				  (INTERPRESSVERSION "2.1"))))
(DEFINEQ

(FONTNAME.IP
  [LAMBDA (FONTDESC)                                         (* rmk: "22-Dec-84 11:42")
                                                             (* Convert a Lisp font name to the proper NS font name)
    (PROG (FACE NAME)
          [COND
	    ((EQ (QUOTE ITALIC)
		 (FONTPROP FONTDESC (QUOTE DEVICESLOPE)))
	      (SETQ FACE (QUOTE (-Italic]
          [COND
	    ((EQ (QUOTE BOLD)
		 (FONTPROP FONTDESC (QUOTE DEVICEWEIGHT)))
	      (push FACE (QUOTE -Bold]
          (SETQ NAME (FONTPROP FONTDESC (QUOTE DEVICEFAMILY)))
          [COND
	    (FACE (SETQ NAME (PACK (CONS NAME FACE]
          (RETURN (LIST (QUOTE XEROX)
			CHARACTERCODEVERSION NAME])

(INITIALIZEMASTER.IP
  [LAMBDA (IPSTREAM)                                         (* rmk: "22-Dec-84 11:47")
    [for I from 1 do (\BOUT IPSTREAM (OR (NTHCHARCODE ENCODINGSTRING I)
					 (RETURN]
    [for I from 1 do (\BOUT IPSTREAM (OR (NTHCHARCODE INTERPRESSVERSION I)
					 (RETURN]
    (\BOUT IPSTREAM (CHARCODE SPACE])

(INTERPRESSFILEP
  [LAMBDA (FILE)                                             (* rmk: "22-Dec-84 11:51")
                                                             (* Returns fullname of FILE if it looks like an 
							     Interpress file--check encoding string, but ignore 
							     version.)
    (PROG (STRM)
          (RETURN (RESETLST [COND
			      ((SETQ STRM (\GETSTREAM FILE (QUOTE INPUT)
						      T))
				(RESETSAVE NIL (LIST (QUOTE SETFILEPTR)
						     STRM
						     (GETFILEPTR STRM)))
				(SETFILEPTR STRM 0))
			      (T (RESETSAVE (SETQ STRM (OPENSTREAM FILE (QUOTE INPUT)
								   (QUOTE OLD)
								   8))
					    (QUOTE (PROGN (CLOSEF? OLDVALUE]
			    (for I from 1 to (CONSTANT (NCHARS ENCODINGSTRING))
			       when (OR (EOFP STRM)
					(NEQ (NTHCHARCODE ENCODINGSTRING I)
					     (BIN STRM)))
			       do (RETURN NIL) finally (RETURN (FULLNAME STRM])

(INTERPRESS.OUTCHARFN
  [LAMBDA (IPSTREAM CHARCODE)                                (* rmk: "29-Dec-84 12:02")
    (PROG (NSCODE (IPDATA (ffetch IPDATA of IPSTREAM)))
          (SETQ NSCODE (\GETBASE (ffetch NSTRANSTABLE of IPDATA)
				 CHARCODE))                  (* Select on NSCODE, since ↑L etc might be graphic in 
							     some ascii fonts)
          (SELCHARQ NSCODE
		    (EOL (NEWLINE.IP IPSTREAM))
		    [LF (\DSPXPOSITION.IP IPSTREAM (PROG1 (\DSPXPOSITION.IP IPSTREAM)
							  (NEWLINE.IP IPSTREAM]
		    (↑L (NEWPAGE.IP IPSTREAM))
		    (PROGN [add (ffetch IPXPOS of IPDATA)
				(COND
				  ((EQ NSCODE (CHARCODE SPACE))
				    (ffetch IPSPACEWIDTH of IPDATA))
				  (T (\FGETWIDTH (ffetch IPWIDTHSCACHE of IPDATA)
						 CHARCODE]   (* Assume the widths for the untranslated code 
							     correspond to the translated character)
			   [COND
			     ((NEQ (NSCHARSET NSCODE)
				   (ffetch NSCHARSET of IPDATA))
			       (\BOUT (ffetch IPSHOWSTREAM of IPDATA)
				      NSCHARSETSHIFT)        (* Switch character set)
			       (\BOUT (ffetch IPSHOWSTREAM of IPDATA)
				      (NSCHARSET NSCODE))
			       (freplace NSCHARSET of IPDATA with (NSCHARSET NSCODE]
			   (\BOUT (ffetch IPSHOWSTREAM of IPDATA)
				  (NSCHAR NSCODE])
)

(RPAQ? CHARACTERCODEVERSION (QUOTE XC1-1))

(RPAQ? INTERPRESSVERSION "2.1")
(PUTPROPS PRINT8PATCH COPYRIGHT ("Xerox Corporation" 1984))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (547 4242 (FONTNAME.IP 557 . 1337) (INITIALIZEMASTER.IP 1339 . 1734) (INTERPRESSFILEP 
1736 . 2797) (INTERPRESS.OUTCHARFN 2799 . 4240)))))
STOP