(FILECREATED " 8-Nov-85 14:07:01" {ERIS}<LISPCORE>LIBRARY>CENTRONICS.;4 5930 changes to: (FNS \DANDETIGERP \CENTRONICS-NO-PORT-ERROR CENTRONICS.RESET \CENTRONICS.OPENFILE \CENTRONICS-CHECK-FOR-PORT) (VARS CENTRONICSCOMS) previous date: "11-Oct-85 17:58:36" {ERIS}<LISPCORE>LIBRARY>CENTRONICS.;3) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT CENTRONICSCOMS) (RPAQQ CENTRONICSCOMS [(FNS CENTRONICS.RESET CENTRONICS.BUSYWAIT) (FNS \CreateCentronicsDevice \CENTRONICS.OPENFILE \CENTRONICS.CLOSEFILE \CENTRONICS.BOUT \CENTRONICS.BUSYWAIT \CENTRONICS.EVENTFN) (FNS \DANDETIGERP \CENTRONICS-CHECK-FOR-PORT) (DECLARE: DONTEVAL@LOAD DOCOPY (P (\CreateCentronicsDevice]) (DEFINEQ (CENTRONICS.RESET [LAMBDA (C150STREAM) (* hdj " 8-Nov-85 14:06") (* * only do it if we're talking about the real centronics device, and not a disk file or something) (\CENTRONICS-CHECK-FOR-PORT) (if (OR (NULL C150STREAM) (EQ (fetch (FDEV DEVICENAME) of (fetch (STREAM DEVICE) of C150STREAM)) (QUOTE CENTRONICS))) then (WRITEPRINTERPORT 40960) (WRITEPRINTERPORT 32768) (DISMISS 1) (* 32768 means init printer) (WRITEPRINTERPORT 40960) (* turn off initialization and control lines) NIL]) (CENTRONICS.BUSYWAIT [LAMBDA NIL (* hdj "11-Oct-85 17:58") (PROG (C150STATUSLINE) RETRY (SETQ C150STATUSLINE (LOGAND (READPRINTERPORT) 31744)) (* If printer is busy, return T) (* If other than busy, then there is an error) (RETURN (if (EQ C150STATUSLINE 8192) then T else (if (NEQ (LOGAND (READPRINTERPORT) 31744) 24576) then (PRINTOUT PROMPTWINDOW "Printer error" T) (HELP "Printer error - RETURN to continue") (GO RETRY]) ) (DEFINEQ (\CreateCentronicsDevice [LAMBDA NIL (* hdj " 9-Sep-85 22:27") (LET [(DEVICE (create FDEV DEVICENAME ←(QUOTE CENTRONICS) EVENTFN ←(FUNCTION \CENTRONICS.EVENTFN) BOUT ←(FUNCTION \CENTRONICS.BOUT) OPENFILE ←(FUNCTION \CENTRONICS.OPENFILE) CLOSEFILE ←(FUNCTION \CENTRONICS.CLOSEFILE) GETFILENAME ←(FUNCTION [LAMBDA (NAME RECOG DEVICE) NAME]) DELETEFILE ←(FUNCTION NILL) GETFILEINFO ←(FUNCTION NILL) SETFILEINFO ←(FUNCTION NILL] (\DEFINEDEVICE (QUOTE CENTRONICS) DEVICE) DEVICE]) (\CENTRONICS.OPENFILE [LAMBDA (NAME ACCESS RECOG PARAMETERS DEVICE) (* hdj " 8-Nov-85 14:06") (if (OR (EQ ACCESS (QUOTE OUTPUT)) (EQ ACCESS (QUOTE APPEND))) then [LET ((OLDSTREAM (fetch (FDEV DEVICEINFO) of DEVICE))) (\CENTRONICS-CHECK-FOR-PORT) (if OLDSTREAM then (ERROR "Only one open stream allowed on this device" NAME) else (replace (FDEV DEVICEINFO) of DEVICE with (create STREAM DEVICE ← DEVICE FULLFILENAME ←(QUOTE {CENTRONICS}] else (ERROR "Centronics can only be used for output" NAME]) (\CENTRONICS.CLOSEFILE [LAMBDA (STREAM) (* hdj " 4-Sep-85 17:30") (replace (FDEV DEVICEINFO) of (fetch (STREAM DEVICE) of STREAM) with NIL]) (\CENTRONICS.BOUT [LAMBDA (STREAM BYTE) (* hdj " 4-Sep-85 16:31") (if (NEQ (LOGAND (READPRINTERPORT) 31744) 24576) then (while (\CENTRONICS.BUSYWAIT))) (* Check if printer is busy) (LET ((C150DATANOSTB (LOGOR BYTE 40960))) (* Send data, turn off strobe signal) (WRITEPRINTERPORT C150DATANOSTB) (WRITEPRINTERPORT (LOGAND 32767 C150DATANOSTB)) (* Send data, turn on strobe signal) (WRITEPRINTERPORT C150DATANOSTB)) (* Turn off strobe signal) NIL]) (\CENTRONICS.BUSYWAIT [LAMBDA NIL (* edited: "16-Jul-85 14:54") (PROG (C150STATUSLINE) RETRY (SETQ C150STATUSLINE (LOGAND (READPRINTERPORT) 31744)) (* If printer is busy, return T) (* If other than busy, then there is an error) (RETURN (if (EQ C150STATUSLINE 8192) then T else (if (NEQ (LOGAND (READPRINTERPORT) 31744) 24576) then (PRINTOUT PROMPTWINDOW "Printer error" T) (HELP "Printer error - type (RETURN) to continue") (GO RETRY]) (\CENTRONICS.EVENTFN [LAMBDA (DEVICE EVENT) (* hdj " 4-Sep-85 16:34") (SELECTQ EVENT ((AFTERLOGOUT AFTERSYSOUT AFTERMAKESYS) (CENTRONICS.RESET)) NIL]) ) (DEFINEQ (\DANDETIGERP [LAMBDA NIL (* hdj " 8-Nov-85 14:00") (AND (EQ \MACHINETYPE \DANDELION) (ODDP (\DEVICE.INPUT 8]) (\CENTRONICS-CHECK-FOR-PORT [LAMBDA NIL (* hdj " 8-Nov-85 14:05") (if (NOT (\DANDETIGERP)) then (ERROR "This machine has no Centronics port"]) ) (DECLARE: DONTEVAL@LOAD DOCOPY (\CreateCentronicsDevice) ) (PUTPROPS CENTRONICS COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (761 2191 (CENTRONICS.RESET 771 . 1491) (CENTRONICS.BUSYWAIT 1493 . 2189)) (2192 5359 ( \CreateCentronicsDevice 2202 . 2857) (\CENTRONICS.OPENFILE 2859 . 3516) (\CENTRONICS.CLOSEFILE 3518 . 3734) (\CENTRONICS.BOUT 3736 . 4398) (\CENTRONICS.BUSYWAIT 4400 . 5127) (\CENTRONICS.EVENTFN 5129 . 5357)) (5360 5789 (\DANDETIGERP 5370 . 5561) (\CENTRONICS-CHECK-FOR-PORT 5563 . 5787))))) STOP