(FILECREATED "11-Oct-86 01:05:55" {ERIS}<LISPCORE>SOURCES>CLSTREAMS.;10 46861  

      changes to:  (VARS CLSTREAMSCOMS)
                   (FUNCTIONS %%MAKE-INITIAL-STRING-STREAM-CONTENTS MAKE-SYNONYM-STREAM 
                          MAKE-BROADCAST-STREAM MAKE-CONCATENATED-STREAM MAKE-TWO-WAY-STREAM 
                          MAKE-ECHO-STREAM WITH-INPUT-FROM-STRING WITH-OUTPUT-TO-STRING)
                   (FNS %%INITIALIZE-CLSTREAM-TYPES)

      previous date: "10-Oct-86 13:55:53" {ERIS}<LISPCORE>SOURCES>CLSTREAMS.;8)


(* "
Copyright (c) 1985, 1986 by Xerox Corporation.  All rights reserved.
")

(PRETTYCOMPRINT CLSTREAMSCOMS)

(RPAQQ CLSTREAMSCOMS ((* ;;; 
                      "Implements a number of stream functions from CommonLisp.  See CLtL chapter 21"
                         )
                      (COMS (* ;; "documented functions and macros")
                            (FUNCTIONS OPEN CLOSE)
                            (FUNCTIONS STREAM-ELEMENT-TYPE INPUT-STREAM-P OUTPUT-STREAM-P)
                            (COMS (FUNCTIONS FILE-STREAM-POSITION)
                                  (SETFS FILE-STREAM-POSITION))
                            (FUNCTIONS MAKE-SYNONYM-STREAM MAKE-BROADCAST-STREAM 
                                   MAKE-CONCATENATED-STREAM MAKE-TWO-WAY-STREAM MAKE-ECHO-STREAM 
                                   MAKE-STRING-INPUT-STREAM)
                            (FUNCTIONS %%MAKE-INITIAL-STRING-STREAM-CONTENTS)
                            (FUNCTIONS WITH-OPEN-STREAM WITH-INPUT-FROM-STRING WITH-OUTPUT-TO-STRING 
                                   WITH-OPEN-FILE)
                            (FUNCTIONS MAKE-STRING-OUTPUT-STREAM MAKE-FILL-POINTER-OUTPUT-STREAM 
                                   GET-OUTPUT-STREAM-STRING \STRING-STREAM-OUTCHARFN 
                                   \ADJUSTABLE-STRING-STREAM-OUTCHARFN))
                      (COMS (* ;; "helpers")
                            (FUNCTIONS %%NEW-FILE PREDICT-NAME)
                            (DECLARE: EVAL@COMPILE DONTCOPY (FUNCTIONS INTERLISP-ACCESS)))
                      (COMS (* ;; "methods for the special devices")
                            (FNS %%BROADCAST-STREAM-DEVICE-BOUT %%BROADCAST-STREAM-DEVICE-OUTCHARFN 
                                 %%BROADCAST-STREAM-DEVICE-CLOSEFILE 
                                 %%BROADCAST-STREAM-DEVICE-FORCEOUTPUT)
                            (FNS %%CONCATENATED-STREAM-DEVICE-BIN 
                                 %%CONCATENATED-STREAM-DEVICE-CLOSEFILE 
                                 %%CONCATENATED-STREAM-DEVICE-EOFP 
                                 %%CONCATENATED-STREAM-DEVICE-PEEKBIN)
                            (FNS %%ECHO-STREAM-DEVICE-BIN)
                            (FNS %%SYNONYM-STREAM-DEVICE-BIN %%SYNONYM-STREAM-DEVICE-BOUT 
                                 %%SYNONYM-STREAM-DEVICE-OUTCHARFN %%SYNONYM-STREAM-DEVICE-CLOSEFILE 
                                 %%SYNONYM-STREAM-DEVICE-EOFP %%SYNONYM-STREAM-DEVICE-FORCEOUTPUT 
                                 %%SYNONYM-STREAM-DEVICE-GETFILEINFO %%SYNONYM-STREAM-DEVICE-PEEKBIN 
                                 %%SYNONYM-STREAM-DEVICE-READP %%SYNONYM-STREAM-DEVICE-BACKFILEPTR 
                                 %%SYNONYM-STREAM-DEVICE-SETFILEINFO)
                            (FNS %%TWO-WAY-STREAM-DEVICE-BIN %%TWO-WAY-STREAM-DEVICE-BOUT 
                                 %%TWO-WAY-STREAM-DEVICE-OUTCHARFN %%TWO-WAY-STREAM-DEVICE-CLOSEFILE 
                                 %%TWO-WAY-STREAM-DEVICE-EOFP %%TWO-WAY-STREAM-DEVICE-BACKFILEPTR 
                                 %%TWO-WAY-STREAM-DEVICE-FORCEOUTPUT %%TWO-WAY-STREAM-DEVICE-PEEKBIN)
                            (FUNCTIONS %%FILL-POINTER-STREAM-DEVICE-CLOSEFILE 
                                   %%FILL-POINTER-STREAM-DEVICE-GETFILEPTR)
                            (GLOBALVARS %%SYNONYM-STREAM-DEVICE %%BROADCAST-STREAM-DEVICE 
                                   %%CONCATENATED-STREAM-DEVICE %%TWO-WAY-STREAM-DEVICE 
                                   \FILL-POINTER-STREAM-DEVICE))
                      (COMS (* ;; "helper stuff")
                            (FNS %%SYNONYM-STREAM-DEVICE-GET-STREAM))
                      [COMS (* ;; "package initialization")
                            (VARIABLES *TRACE-OUTPUT* *DEBUG-IO* *QUERY-IO* *TERMINAL-IO* 
                                   *ERROR-OUTPUT* *STANDARD-OUTPUT* *STANDARD-INPUT*)
                            (FUNCTIONS %%INITIALIZE-STANDARD-STREAMS)
                            (FNS %%INITIALIZE-CLSTREAM-TYPES)
                            (DECLARE: DONTEVAL@LOAD DOCOPY (*)
                                   (P (%%INITIALIZE-CLSTREAM-TYPES)
                                      (%%INITIALIZE-STANDARD-STREAMS]
                      (PROP FILETYPE CLSTREAMS)))



(* ;;; "Implements a number of stream functions from CommonLisp.  See CLtL chapter 21")




(* ;; "documented functions and macros")

(DEFUN OPEN (FILENAME &KEY (DIRECTION :INPUT)
                   (ELEMENT-TYPE (QUOTE STRING-CHAR))
                   (IF-EXISTS NIL EXISTS-P)
                   (IF-DOES-NOT-EXIST NIL DOES-NOT-EXIST-P)) 
                                                  (* ;;; "Return a stream which reads from or writes to Filename.  Defined keywords: :direction (one of :input, :output or :probe :element-type), Type of object to read or write, default String-Char, :if-exists (one of :error, :new-version, :overwrite, :append or nil), :if-does-not-exist (one of :error, :create or nil). See the manual for details.")
   (CL:UNLESS (MEMQ DIRECTION (QUOTE (:INPUT :OUTPUT :IO :PROBE)))
          (CL:ERROR "~S isn't a valid direction for open." DIRECTION))
   (CL:UNLESS (MEMQ ELEMENT-TYPE (QUOTE (STRING-CHAR UNSIGNED-BYTE CHARACTER :DEFAULT)))
          (CL:ERROR "~S isn't an implemented element-type for open." ELEMENT-TYPE))
   (LET ((PATHNAME (PATHNAME FILENAME))
         (FOR-INPUT (MEMQ DIRECTION (QUOTE (:IO :INPUT))))
         (FOR-OUTPUT (MEMQ DIRECTION (QUOTE (:IO :OUTPUT))))
         (ACCESS (INTERLISP-ACCESS DIRECTION))
         (STREAM NIL))                            (* ;;; 
                                 "Do hairy defaulting of :if-exists and :if-does-not-exist keywords.")
        (CL:UNLESS EXISTS-P (SETQ IF-EXISTS (CL:IF (EQ (PATHNAME-VERSION PATHNAME)
                                                       :NEWEST)
                                                   :NEW-VERSION :ERROR)))
        (CL:UNLESS DOES-NOT-EXIST-P (SETQ IF-DOES-NOT-EXIST (COND
                                                               ((OR (MEMQ IF-EXISTS
                                                                          (QUOTE (:OVERWRITE :APPEND)
                                                                                 ))
                                                                    (EQ DIRECTION :INPUT))
                                                                :ERROR)
                                                               ((EQ DIRECTION :PROBE)
                                                                NIL)
                                                               (T :CREATE))))
        (LOOP                                     (* ; 
                                        "See if the file exists and handle the existential keywords.")
              (LET* ((NAME (PREDICT-NAME PATHNAME))
                     (NAMESTRING (MKSTRING NAME)))
                    (if NAME
                        then                                 (* ; "file exists")
                             (if FOR-OUTPUT
                                 then                        (* ;; "open for output/both")
                                      (CASE IF-EXISTS (:ERROR (CERROR "write it anyway." 
                                                                     "File ~A already exists." 
                                                                     NAMESTRING)
                                                             (SETQ STREAM (OPENSTREAM NAMESTRING 
                                                                                 ACCESS))
                                                             (RETURN NIL))
                                            ((:NEW-VERSION :SUPERSEDE :RENAME :RENAME-AND-DELETE)
                                             (SETQ STREAM (OPENSTREAM NAMESTRING ACCESS (QUOTE NEW)))
                                             (RETURN NIL))
                                            (:OVERWRITE (SETQ STREAM (OPENSTREAM NAMESTRING ACCESS
                                                                            (QUOTE OLD)))
                                                   (RETURN NIL))
                                            (:APPEND (SETQ STREAM (OPENSTREAM NAMESTRING (QUOTE
                                                                                          APPEND)
                                                                         (QUOTE OLD)))
                                                   (RETURN NIL))
                                            ((NIL)
                                             (RETURN-FROM OPEN NIL))
                                            (T (CL:ERROR "~S is not a valid value for :if-exists." 
                                                      IF-EXISTS)))
                               elseif FOR-INPUT
                                 then                        (* ;; "open for input/both")
                                      (SETQ STREAM (OPENSTREAM NAMESTRING ACCESS (QUOTE OLD)))
                                      (RETURN NIL)
                               else                          (* ;; "open for probe")
                                    (SETQ STREAM (create STREAM
                                                        FULLFILENAME ← (FULLNAME NAMESTRING)))
                                    (RETURN NIL))
                      else                                   (* ;; "file does not exist")
                           (if FOR-OUTPUT
                               then (CASE IF-DOES-NOT-EXIST (:ERROR (CERROR "prompt for a new name." 
                                                                           "File ~A does not exist." 
                                                                           PATHNAME)
                                                                   (FORMAT *QUERY-IO* 
                                                                          "~&New file name: ")
                                                                   (SETQ PATHNAME (PATHNAME
                                                                                   (READ-LINE 
                                                                                          *QUERY-IO*)
                                                                                   )))
                                          (:CREATE (SETQ STREAM (OPENSTREAM PATHNAME ACCESS
                                                                       (QUOTE NEW)))
                                                 (RETURN NIL))
                                          ((NIL)
                                           (RETURN-FROM OPEN NIL))
                                          (T (CL:ERROR 
                                                    "~S is not a valid value for :if-does-not-exist." 
                                                    IF-DOES-NOT-EXIST)))
                             elseif FOR-INPUT
                               then (CASE IF-DOES-NOT-EXIST (:ERROR (CERROR "prompt for a new name." 
                                                                           "File ~A does not exist." 
                                                                           PATHNAME)
                                                                   (FORMAT *QUERY-IO* 
                                                                          "~&New file name: ")
                                                                   (SETQ PATHNAME (PATHNAME
                                                                                   (READ-LINE 
                                                                                          *QUERY-IO*)
                                                                                   )))
                                          (:CREATE (%%NEW-FILE PATHNAME))
                                          ((NIL)
                                           (RETURN-FROM OPEN NIL))
                                          (T (CL:ERROR 
                                                    "~S is not a valid value for :if-does-not-exist." 
                                                    IF-DOES-NOT-EXIST)))
                             else                            (* ; "Open for probe.")
                                  (RETURN NIL)))))
        STREAM))

(DEFUN CLOSE (STREAM &KEY ABORT) 
          
          (* * "Close a stream.  If ABORT, then don't keep the file")
 (if (STREAMP STREAM)
     then (if (OPENP STREAM)
              then 
          
          (* * "determine 'deletability' of stream's file before closing, as that trashes the info")

                   (LET ((ABORTABLE (AND (DIRTYABLE STREAM)
                                         (NOT (APPENDONLY STREAM)))))
                        (CLOSEF STREAM)
                        (if (AND ABORT ABORTABLE)
                            then                             (* 
       "eventually we will change device CLOSEF methods to take an ABORT arg.  For now, simulate it.")
                                 (DELFILE (NAMESTRING STREAM)))))
   else (ERROR "Closing a non-stream" STREAM))
 T)

(DEFUN STREAM-ELEMENT-TYPE (STREAM) (QUOTE UNSIGNED-BYTE))

(DEFUN INPUT-STREAM-P (STREAM) (CL:WHEN (NOT (STREAMP STREAM))
                                      (\ILLEGAL.ARG STREAM))
          
          (* * "we return T instead of the stream because Symbolics does")

                               (AND (\IOMODEP STREAM (QUOTE INPUT)
                                           T)
                                    T))

(DEFUN OUTPUT-STREAM-P (STREAM) (CL:WHEN (NOT (STREAMP STREAM))
                                       (\ILLEGAL.ARG STREAM))
          
          (* * "we return T instead of the stream because Symbolics does")

                                (AND (\IOMODEP STREAM (QUOTE OUTPUT)
                                            T)
                                     T))

(DEFUN FILE-STREAM-POSITION (STREAM) (GETFILEPTR STREAM))

(DEFSETF FILE-STREAM-POSITION SETFILEPTR)

(DEFUN MAKE-SYNONYM-STREAM (SYMBOL)               (* ;; 
                                    "A CommonLisp function for shadowing a stream.  See CLtL p.  329")
   (create STREAM
          DEVICE ← %%SYNONYM-STREAM-DEVICE
          ACCESS ← (QUOTE BOTH)
          F1 ← SYMBOL
          OUTCHARFN ← (FUNCTION %%SYNONYM-STREAM-DEVICE-OUTCHARFN)
          CHARSET ← 255))

(DEFUN MAKE-BROADCAST-STREAM (&REST STREAMS)      (* ;; 
                                    "CommonLisp function to make a `splitter' stream.  See CLtL p329")
   (create STREAM
          DEVICE ← %%BROADCAST-STREAM-DEVICE
          ACCESS ← (QUOTE OUTPUT)
          F1 ← STREAMS
          OUTCHARFN ← (FUNCTION %%BROADCAST-STREAM-DEVICE-OUTCHARFN)
          CHARSET ← 255))

(DEFUN MAKE-CONCATENATED-STREAM (&REST STREAMS)   (* ;; 
          "A CommonLisp function for concatenating several input streams together.  See CLtL p.  329")
   (create STREAM
          DEVICE ← %%CONCATENATED-STREAM-DEVICE
          ACCESS ← (QUOTE INPUT)
          F1 ← STREAMS
          CHARSET ← 255))

(DEFUN MAKE-TWO-WAY-STREAM (INPUT-STREAM OUTPUT-STREAM) 
                                                  (* ;; 
                         "A CommonLisp function for splicing together two streams.  See CLtL p.  329")
   (create STREAM
          DEVICE ← %%TWO-WAY-STREAM-DEVICE
          ACCESS ← (QUOTE BOTH)
          F1 ← INPUT-STREAM
          F2 ← OUTPUT-STREAM
          OUTCHARFN ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-OUTCHARFN)
          CHARSET ← 255))

(DEFUN MAKE-ECHO-STREAM (INPUT-STREAM OUTPUT-STREAM) 
                                                  (* ;; 
                         "A CommonLisp function for splicing together two streams.  See CLtL p.  329")
   (create STREAM
          DEVICE ← %%ECHO-STREAM-DEVICE
          ACCESS ← (QUOTE BOTH)
          F1 ← INPUT-STREAM
          F2 ← OUTPUT-STREAM
          OUTCHARFN ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-OUTCHARFN)
          CHARSET ← 255))

(DEFUN MAKE-STRING-INPUT-STREAM (STRING &OPTIONAL (START 0 STARTP)
                                       (END NIL ENDP)) 
          
          (* * "A CommonLisp function for producing a stream from a string.  See CLtL p.  330")
 (OPENSTRINGSTREAM (if (OR STARTP ENDP)
                       then (SUBSEQ STRING START (if ENDP
                                                     then END
                                                   else (CL:LENGTH STRING)))
                     else STRING)
        (QUOTE INPUT)))

(DEFUN %%MAKE-INITIAL-STRING-STREAM-CONTENTS NIL (MAKE-ARRAY 128 :ELEMENT-TYPE (QUOTE STRING-CHAR)
                                                        :ADJUSTABLE T :FILL-POINTER 0))

(DEFMACRO WITH-OPEN-STREAM ((VAR STREAM)
                            &BODY
                            (BODY DECLS)) (LET ((ABORTP (GENSYM)))
                                               (BQUOTE (LET (((\, VAR)
                                                              (\, STREAM))
                                                             ((\, ABORTP)
                                                              T))
                                                            (\,@ DECLS)
                                                            (UNWIND-PROTECT
                                                             (MULTIPLE-VALUE-PROG1
                                                              (PROGN (\,@ BODY))
                                                              (SETQ (\, ABORTP)
                                                               NIL))
                                                             (CLOSE (\, VAR)
                                                                    :ABORT
                                                                    (\, ABORTP)))))))

(DEFMACRO WITH-INPUT-FROM-STRING ((VAR STRING &KEY (INDEX NIL INDEXP)
                                       (START 0 STARTP)
                                       (END NIL ENDP))
                                  &BODY
                                  (BODY DECLS))
   (BQUOTE (LET (((\, VAR)
                  (MAKE-STRING-INPUT-STREAM (\, STRING)
                         (\,@ (if STARTP
                                  then (if ENDP
                                           then (LIST START END)
                                         else (LIST START))
                                else (if ENDP
                                         then (LIST NIL END)))))))
                (\,@ DECLS)
                (PROG1 (PROGN (\,@ BODY))
                       (\,@ (if INDEXP
                                then (BQUOTE ((SETF (\, INDEX)
                                                    (+ (\, START)
                                                       (GETFILEPTR (\, VAR))))))
                              else NIL))))))

(DEFMACRO WITH-OUTPUT-TO-STRING ((VAR &OPTIONAL (STRING NIL ST-P))
                                 &BODY
                                 (FORMS DECLS)) (COND
                                                   (ST-P (BQUOTE (LET (((\, VAR)
                                                                        (
                                                                      MAKE-FILL-POINTER-OUTPUT-STREAM
                                                                         (\, STRING))))
                                                                      (\,@ DECLS)
                                                                      (PROGN (\,@ FORMS)))))
                                                   (T (BQUOTE (LET (((\, VAR)
                                                                     (MAKE-STRING-OUTPUT-STREAM)))
                                                                   (\,@ DECLS)
                                                                   (PROGN (\,@ FORMS)
                                                                          (GET-OUTPUT-STREAM-STRING
                                                                           (\, VAR))))))))

(DEFMACRO WITH-OPEN-FILE ((VAR &REST OPEN-ARGS)
                          &BODY
                          (FORMS DECLS))          (* ;;; "The file whose name is File-Name is opened using the OPEN-ARGS and bound to the variable VAR. The Forms are executed, and when they terminate, normally or otherwise, the file is closed.")
   (LET ((ABORTP (GENSYM)))
        (BQUOTE (LET (((\, VAR)
                       (OPEN (\,@ OPEN-ARGS)))
                      ((\, ABORTP)
                       T))
                     (\,@ DECLS)
                     (UNWIND-PROTECT (MULTIPLE-VALUE-PROG1 (PROGN (\,@ FORMS))
                                            (SETQ (\, ABORTP)
                                             NIL))
                            (CLOSE (\, VAR)
                                   :ABORT
                                   (\, ABORTP)))))))

(DEFUN MAKE-STRING-OUTPUT-STREAM NIL 
          
          (* * "A function for producing a string stream. See also the function get-output-stream-string.  Also, see CLtL p.  330")

                                     (MAKE-FILL-POINTER-OUTPUT-STREAM))

(DEFUN MAKE-FILL-POINTER-OUTPUT-STREAM (&OPTIONAL (STRING (%%MAKE-INITIAL-STRING-STREAM-CONTENTS)))
   (DECLARE (GLOBALVARS \FILL-POINTER-STREAM-DEVICE))
   (if (NOT (ARRAY-HAS-FILL-POINTER-P STRING))
       then (\ILLEGAL.ARG STRING)
     else (LET ((STREAM (create STREAM
                               DEVICE ← \FILL-POINTER-STREAM-DEVICE
                               F1 ← STRING
                               ACCESS ← (QUOTE OUTPUT))))
               (STREAMPROP STREAM (QUOTE STRING-OUTPUT-STREAM)
                      T)
               (replace (STREAM OUTCHARFN) of STREAM with (if (ADJUSTABLE-ARRAY-P STRING)
                                                              then (FUNCTION 
                                                                  \ADJUSTABLE-STRING-STREAM-OUTCHARFN
                                                                    )
                                                            else (FUNCTION \STRING-STREAM-OUTCHARFN))
                      )
               (replace (STREAM STRMBOUTFN) of STREAM with (FUNCTION \OUTCHAR))
               STREAM)))

(DEFUN GET-OUTPUT-STREAM-STRING (STRING-OUTPUT-STREAM) 
          
          (* * "A CommonLisp function for getting the contents of the buffer created by a call to make-string-output-stream.  See CLtL p.  330")
 (if (NOT (STREAMPROP STRING-OUTPUT-STREAM (QUOTE STRING-OUTPUT-STREAM)))
     then (ERROR "Stream not a string-output-stream" STRING-OUTPUT-STREAM)
   else (PROG1 (fetch (STREAM F1) of STRING-OUTPUT-STREAM)
               (replace (STREAM F1) of STRING-OUTPUT-STREAM with (
                                                                %%MAKE-INITIAL-STRING-STREAM-CONTENTS
                                                                  )))))

(DEFUN \STRING-STREAM-OUTCHARFN (STREAM CHAR) (IF (EQ CHAR (CHARCODE EOL))
                                                  THEN (REPLACE (STREAM CHARPOSITION) OF STREAM
                                                          WITH 0)
                                                ELSE (ADD (FETCH (STREAM CHARPOSITION) OF STREAM)
                                                          1))
                                              (VECTOR-PUSH (CL:CHARACTER CHAR)
                                                     (FETCH (STREAM F1) OF STREAM)))

(DEFUN \ADJUSTABLE-STRING-STREAM-OUTCHARFN (STREAM CHAR) (IF (EQ CHAR (CHARCODE EOL))
                                                             THEN (REPLACE (STREAM CHARPOSITION)
                                                                     OF STREAM WITH 0)
                                                           ELSE (ADD (FETCH (STREAM CHARPOSITION)
                                                                        OF STREAM)
                                                                     1))
                                                         (VECTOR-PUSH-EXTEND (CL:CHARACTER CHAR)
                                                                (FETCH (STREAM F1) OF STREAM)))




(* ;; "helpers")

(DEFUN %%NEW-FILE (FILENAME) (CLOSEF (OPENSTREAM FILENAME (QUOTE OUTPUT)
                                            (QUOTE NEW))))

(DEFUN PREDICT-NAME (PATHNAME) (LET ((PATH (PROBE-FILE PATHNAME)))
                                    (IF PATH
                                        THEN (NAMESTRING PATH))))

(DECLARE: EVAL@COMPILE DONTCOPY 
(DEFMACRO INTERLISP-ACCESS (DIRECTION) (BQUOTE (CASE (\, DIRECTION)
                                                     (:INPUT (QUOTE INPUT))
                                                     (:OUTPUT (QUOTE OUTPUT))
                                                     (:IO (QUOTE BOTH))
                                                     NIL)))

)



(* ;; "methods for the special devices")

(DEFINEQ

(%%BROADCAST-STREAM-DEVICE-BOUT
  [LAMBDA (STREAM BYTE)                                      (* hdj "17-Apr-86 18:08")
          
          (* * The BOUT method for the broadcast-stream device)

    (for S in (fetch F1 of STREAM) do (\BOUT S BYTE))
    BYTE])

(%%BROADCAST-STREAM-DEVICE-OUTCHARFN
  [LAMBDA (STREAM CHARCODE)                                  (* hdj "10-Oct-86 13:48")
                                                            (* ;; "outcharfn for broadcast streams")
    (if (EQ CHARCODE (CHARCODE EOL))
        then (replace (STREAM CHARPOSITION) of STREAM with 0)
      else (add (fetch (STREAM CHARPOSITION) of STREAM)
                1))
    (for S in (fetch (STREAM F1) of STREAM) do (\OUTCHAR S CHARCODE))
    CHARCODE])

(%%BROADCAST-STREAM-DEVICE-CLOSEFILE
  [LAMBDA (STREAM)                                           (* hdj "26-Mar-86 16:28")
          
          (* * The CLOSEFILE method for the broadcast-stream device)

    (replace ACCESS of STREAM with NIL)
    (replace F1 of STREAM with NIL)
    STREAM])

(%%BROADCAST-STREAM-DEVICE-FORCEOUTPUT
  [LAMBDA (stream waitForFinish?)                            (* smL "14-Aug-85 15:55")
          
          (* * The FORCEOUTPUT method for the broadcast-stream device)

    (for s in (fetch F1 of stream) do (FORCEOUTPUT s waitForFinish?])
)
(DEFINEQ

(%%CONCATENATED-STREAM-DEVICE-BIN
  [LAMBDA (stream)                                           (* smL "14-Aug-85 16:52")
          
          (* * The BIN method for the concatenated-stream device)

    (while (fetch F1 of stream) do [if (EOFP (CAR (fetch F1 of stream)))
                                       then (CLOSEF (pop (fetch F1 of stream)))
                                     else (RETURN (\BIN (CAR (fetch F1 of stream]
       finally                                               (* the EOF case)
             (\EOF.ACTION stream])

(%%CONCATENATED-STREAM-DEVICE-CLOSEFILE
  [LAMBDA (stream)                                           (* smL "14-Aug-85 16:53")
          
          (* * The CLOSEFILE method for the concatenated-stream device)

    (replace ACCESS of stream with NIL)
    (for s in (fetch F1 of stream) do (CLOSEF s))
    (replace F1 of stream with NIL)
    stream])

(%%CONCATENATED-STREAM-DEVICE-EOFP
  [LAMBDA (stream)                                           (* smL "14-Aug-85 16:53")
          
          (* * The EOFP method for the concatenated-stream device)

    (while (fetch F1 of stream) do (if (EOFP (CAR (fetch F1 of stream)))
                                       then (CLOSEF (pop (fetch F1 of stream)))
                                     else (RETURN NIL)) finally 
                                                             (* the EOF case)
                                                              (RETURN T])

(%%CONCATENATED-STREAM-DEVICE-PEEKBIN
  [LAMBDA (stream noErrorFlg?)                               (* smL "14-Aug-85 16:53")
          
          (* * The PEEKBIN method for the concatenated-stream device)

    (while (fetch F1 of stream) do [if (EOFP (CAR (fetch F1 of stream)))
                                       then (CLOSEF (pop (fetch F1 of stream)))
                                     else (RETURN (\PEEKBIN (CAR (fetch F1 of stream]
       finally                                               (* the EOF case)
             (if noErrorFlg?
                 then (RETURN NIL)
               else (\EOF.ACTION stream])
)
(DEFINEQ

(%%ECHO-STREAM-DEVICE-BIN
  [LAMBDA (STREAM)                                           (* hdj "21-Apr-86 18:33")
          
          (* * The BIN method for the echo-stream device)

    (LET ((BYTE (%%TWO-WAY-STREAM-DEVICE-BIN STREAM)))
         (\BOUT STREAM BYTE)
         BYTE])
)
(DEFINEQ

(%%SYNONYM-STREAM-DEVICE-BIN
  [LAMBDA (STREAM)                                           (* hdj "19-Mar-86 17:19")
          
          (* * The BIN method for the synonym-stream device.)

    (\BIN (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM])

(%%SYNONYM-STREAM-DEVICE-BOUT
  [LAMBDA (STREAM BYTE)                                      (* hdj "19-Mar-86 17:20")
          
          (* * The BOUT method for the synonym-stream device.)

    (\BOUT (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           BYTE])

(%%SYNONYM-STREAM-DEVICE-OUTCHARFN
  [LAMBDA (STREAM CHARCODE)                                  (* hdj "10-Oct-86 13:49")
                                                             (* ;; " OUTCHARFN for synonym streams")
    (if (EQ CHARCODE (CHARCODE EOL))
        then (replace (STREAM CHARPOSITION) of STREAM with 0)
      else (add (fetch (STREAM CHARPOSITION) of STREAM)
                1))
    (\OUTCHAR (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           CHARCODE])

(%%SYNONYM-STREAM-DEVICE-CLOSEFILE
  [LAMBDA (STREAM)                                           (* hdj "19-Mar-86 17:14")
          
          (* * the CLOSEFILE method for the synonym-stream device)

    (replace F1 of STREAM with NIL)
    STREAM])

(%%SYNONYM-STREAM-DEVICE-EOFP
  [LAMBDA (STREAM)                                           (* hdj "19-Mar-86 17:20")
          
          (* * The EOFP method for the synonym-stream device.)

    (\EOFP (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM])

(%%SYNONYM-STREAM-DEVICE-FORCEOUTPUT
  [LAMBDA (STREAM WAITFORFINISH)                             (* hdj "19-Mar-86 17:09")
          
          (* * The FORCEOUTPUT method for the synonym-stream device.)

    (FORCEOUTPUT (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           WAITFORFINISH])

(%%SYNONYM-STREAM-DEVICE-GETFILEINFO
  [LAMBDA (STREAM ATTRIBUTE DEVICE)                          (* hdj "19-Mar-86 17:10")
          
          (* * The GETFILEINFO method for the synonym-stream device.)

    (GETFILEINFO (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           ATTRIBUTE])

(%%SYNONYM-STREAM-DEVICE-PEEKBIN
  [LAMBDA (STREAM NOERRORFLG?)                               (* hdj "19-Mar-86 17:12")
          
          (* * The PEEKBIN method for the synonym-stream device)

    (\PEEKBIN (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           NOERRORFLG?])

(%%SYNONYM-STREAM-DEVICE-READP
  [LAMBDA (STREAM FLG)
    (READP (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           FLG])

(%%SYNONYM-STREAM-DEVICE-BACKFILEPTR
  [LAMBDA (STREAM)                                           (* hdj "26-Aug-86 17:35")
    (\BACKFILEPTR (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM])

(%%SYNONYM-STREAM-DEVICE-SETFILEINFO
  [LAMBDA (STREAM ATTRIBUTE VALUE DEVICE)                    (* hdj "19-Mar-86 17:17")
          
          (* * The SETFILEINFO method for the synonym-stream device.)

    (SETFILEINFO (%%SYNONYM-STREAM-DEVICE-GET-STREAM STREAM)
           ATTRIBUTE VALUE])
)
(DEFINEQ

(%%TWO-WAY-STREAM-DEVICE-BIN
  [LAMBDA (stream)                                           (* smL "14-Aug-85 16:44")
          
          (* * The BIN method for the two-way-stream device)

    (\BIN (fetch F1 of stream])

(%%TWO-WAY-STREAM-DEVICE-BOUT
  [LAMBDA (STREAM BYTE)                                      (* hdj "17-Sep-86 15:28")
                                                       (* ;; " the BOUT method for two-way streams")
    (\BOUT (fetch F2 of STREAM)
           BYTE])

(%%TWO-WAY-STREAM-DEVICE-OUTCHARFN
  [LAMBDA (STREAM CHARCODE)                                  (* hdj "10-Oct-86 13:48")
                                                             (* ;; "outcharfn for two-way streams")
    (if (EQ CHARCODE (CHARCODE EOL))
        then (replace (STREAM CHARPOSITION) of STREAM with 0)
      else (add (fetch (STREAM CHARPOSITION) of STREAM)
                1))
    (\OUTCHAR (fetch (STREAM F2) of STREAM)
           CHARCODE])

(%%TWO-WAY-STREAM-DEVICE-CLOSEFILE
  [LAMBDA (stream)                                           (* smL "14-Aug-85 17:02")
          
          (* * The CLOSEFILE method for the two-way-stream device)

    (replace ACCESS of stream with NIL)
    (CLOSEF? (fetch F1 of stream))
    (replace F1 of stream with NIL)
    (CLOSEF? (fetch F2 of stream))
    (replace F2 of stream with NIL)
    stream])

(%%TWO-WAY-STREAM-DEVICE-EOFP
  [LAMBDA (stream)                                           (* smL "14-Aug-85 16:47")
          
          (* * The EOFP method for the two-way-stream device)

    (\EOFP (fetch F1 of stream])

(%%TWO-WAY-STREAM-DEVICE-BACKFILEPTR
  [LAMBDA (STREAM)                                           (* hdj "15-Sep-86 15:02")
    (\BACKFILEPTR (fetch (STREAM F1) of STREAM])

(%%TWO-WAY-STREAM-DEVICE-FORCEOUTPUT
  [LAMBDA (stream waitForFinish?)                            (* smL "14-Aug-85 16:49")
          
          (* * the FORCEOUTPUT method for the two-way-stream device)

    (FORCEOUTPUT (fetch F2 of stream)
           waitForFinish?])

(%%TWO-WAY-STREAM-DEVICE-PEEKBIN
  [LAMBDA (stream noErrorFlg?)                               (* smL "14-Aug-85 16:46")
          
          (* * The PEEKBIN method for the two-way-stream device)

    (\PEEKBIN (fetch F1 of stream)
           noErrorFlg?])
)
(DEFUN %%FILL-POINTER-STREAM-DEVICE-CLOSEFILE (STREAM) 
          
          (* * "the CLOSEFILE method for the fill-pointer-string-stream device")
 (replace F1 of STREAM with NIL)
 STREAM)

(DEFUN %%FILL-POINTER-STREAM-DEVICE-GETFILEPTR (STREAM) (CL:LENGTH (fetch (STREAM F1) of STREAM)))

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS %%SYNONYM-STREAM-DEVICE %%BROADCAST-STREAM-DEVICE %%CONCATENATED-STREAM-DEVICE 
       %%TWO-WAY-STREAM-DEVICE \FILL-POINTER-STREAM-DEVICE)
)



(* ;; "helper stuff")

(DEFINEQ

(%%SYNONYM-STREAM-DEVICE-GET-STREAM
  [LAMBDA (stream)                                           (* hdj "19-Mar-86 14:59")
          
          (* * given a synonym-stream, find out what it is currently tracking)
          
          (* * this should be a macro)

    (SYMBOL-VALUE (fetch (STREAM F1) of stream])
)



(* ;; "package initialization")

(DEFVAR *TRACE-OUTPUT* )

(DEFVAR *DEBUG-IO* )

(DEFVAR *QUERY-IO* )

(DEFVAR *TERMINAL-IO* )

(DEFVAR *ERROR-OUTPUT* )

(DEFVAR *STANDARD-OUTPUT* )

(DEFVAR *STANDARD-INPUT* )

(DEFUN %%INITIALIZE-STANDARD-STREAMS NIL                     (*)
                                         (SETQ *QUERY-IO* (MAKE-TWO-WAY-STREAM (MAKE-SYNONYM-STREAM
                                                                                (QUOTE \LINEBUF.OFD))
                                                                 (MAKE-SYNONYM-STREAM (QUOTE 
                                                                                            \TERM.OFD
                                                                                             ))))
                                         (SETQ *DEBUG-IO* *QUERY-IO*)
                                         (SETQ *TERMINAL-IO* *QUERY-IO*)
                                         (SETQ *ERROR-OUTPUT* (MAKE-SYNONYM-STREAM (QUOTE \TERM.OFD))
                                          )
                                         (SETQ *STANDARD-OUTPUT* (MAKE-SYNONYM-STREAM (QUOTE 
                                                                                         \PRIMOUT.OFD
                                                                                             )))
                                         (SETQ *STANDARD-INPUT* (MAKE-SYNONYM-STREAM (QUOTE 
                                                                                          \PRIMIN.OFD
                                                                                            )))
                                         (SETQ *TRACE-OUTPUT* (MAKE-SYNONYM-STREAM (QUOTE \TERM.OFD))
                                          ))

(DEFINEQ

(%%INITIALIZE-CLSTREAM-TYPES
  [LAMBDA NIL                                                (* bvm: "10-Oct-86 23:40")
                                                  (* ;; "Initialize the CLSTREAMS package.  This sets up some file devices for the functions make-two-way-stream-device, etc.  See CLtL chapter 21")
    (SETQ %%BROADCAST-STREAM-DEVICE
     (create FDEV
            DEVICENAME ← (QUOTE BROADCAST-STREAM-DEVICE)
            RESETABLE ← NIL
            RANDOMACCESSP ← NIL
            NODIRECTORIES ← T
            BUFFERED ← NIL
            PAGEMAPPED ← NIL
            FDBINABLE ← NIL
            FDBOUTABLE ← NIL
            FDEXTENDABLE ← NIL
            DEVICEINFO ← NIL
            HOSTNAMEP ← (FUNCTION NILL)
            EVENTFN ← (FUNCTION NILL)
            DIRECTORYNAMEP ← (FUNCTION NILL)
            REOPENFILE ← (FUNCTION NILL)
            CLOSEFILE ← (FUNCTION %%BROADCAST-STREAM-DEVICE-CLOSEFILE)
            GETFILENAME ← (FUNCTION NILL)
            DELETEFILE ← (FUNCTION NILL)
            GENERATEFILES ← (FUNCTION \GENERATENOFILES)
            RENAMEFILE ← (FUNCTION NILL)
            BIN ← (FUNCTION NILL)
            BOUT ← (FUNCTION %%BROADCAST-STREAM-DEVICE-BOUT)
            PEEKBIN ← (FUNCTION NILL)
            READP ← (FUNCTION NILL)
            EOFP ← (FUNCTION TRUE)
            BLOCKIN ← (FUNCTION \GENERIC.BINS)
            BLOCKOUT ← (FUNCTION NILL)
            FORCEOUTPUT ← (FUNCTION %%BROADCAST-STREAM-DEVICE-FORCEOUTPUT)
            GETFILEINFO ← (FUNCTION NILL)
            SETFILEINFO ← (FUNCTION NILL)))
    (SETQ %%CONCATENATED-STREAM-DEVICE
     (create FDEV
            DEVICENAME ← (QUOTE CONCATENATED-STREAM-DEVICE)
            RESETABLE ← NIL
            RANDOMACCESSP ← NIL
            NODIRECTORIES ← T
            BUFFERED ← NIL
            PAGEMAPPED ← NIL
            FDBINABLE ← NIL
            FDBOUTABLE ← NIL
            FDEXTENDABLE ← NIL
            DEVICEINFO ← NIL
            HOSTNAMEP ← (FUNCTION NILL)
            EVENTFN ← (FUNCTION NILL)
            DIRECTORYNAMEP ← (FUNCTION NILL)
            REOPENFILE ← (FUNCTION NILL)
            CLOSEFILE ← (FUNCTION %%CONCATENATED-STREAM-DEVICE-CLOSEFILE)
            GETFILENAME ← (FUNCTION NILL)
            DELETEFILE ← (FUNCTION NILL)
            GENERATEFILES ← (FUNCTION \GENERATENOFILES)
            RENAMEFILE ← (FUNCTION NILL)
            BIN ← (FUNCTION %%CONCATENATED-STREAM-DEVICE-BIN)
            BOUT ← (FUNCTION NILL)
            PEEKBIN ← (FUNCTION %%CONCATENATED-STREAM-DEVICE-PEEKBIN)
            READP ← (FUNCTION \GENERIC.READP)
            EOFP ← (FUNCTION %%CONCATENATED-STREAM-DEVICE-EOFP)
            BLOCKIN ← (FUNCTION \GENERIC.BINS)
            BLOCKOUT ← (FUNCTION NILL)
            FORCEOUTPUT ← (FUNCTION NILL)
            GETFILEINFO ← (FUNCTION NILL)
            SETFILEINFO ← (FUNCTION NILL)))
    (SETQ %%TWO-WAY-STREAM-DEVICE
     (create FDEV
            DEVICENAME ← (QUOTE TWO-WAY-STREAM-DEVICE)
            RESETABLE ← NIL
            RANDOMACCESSP ← NIL
            NODIRECTORIES ← T
            BUFFERED ← NIL
            PAGEMAPPED ← NIL
            FDBINABLE ← NIL
            FDBOUTABLE ← NIL
            FDEXTENDABLE ← NIL
            DEVICEINFO ← NIL
            HOSTNAMEP ← (FUNCTION NILL)
            EVENTFN ← (FUNCTION NILL)
            DIRECTORYNAMEP ← (FUNCTION NILL)
            REOPENFILE ← (FUNCTION NILL)
            CLOSEFILE ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-CLOSEFILE)
            GETFILENAME ← (FUNCTION NILL)
            DELETEFILE ← (FUNCTION NILL)
            GENERATEFILES ← (FUNCTION \GENERATENOFILES)
            RENAMEFILE ← (FUNCTION NILL)
            BIN ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-BIN)
            BOUT ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-BOUT)
            PEEKBIN ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-PEEKBIN)
            READP ← (FUNCTION \GENERIC.READP)
            BACKFILEPTR ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-BACKFILEPTR)
            EOFP ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-EOFP)
            BLOCKIN ← (FUNCTION \GENERIC.BINS)
            BLOCKOUT ← (FUNCTION \GENERIC.BOUTS)
            FORCEOUTPUT ← (FUNCTION %%TWO-WAY-STREAM-DEVICE-FORCEOUTPUT)
            GETFILEINFO ← (FUNCTION NILL)
            SETFILEINFO ← (FUNCTION NILL)))
    (SETQ %%ECHO-STREAM-DEVICE (create FDEV using %%TWO-WAY-STREAM-DEVICE DEVICENAME ← (QUOTE 
                                                                                   ECHO-STREAM-DEVICE
                                                                                              )
                                                  BIN ← (FUNCTION %%ECHO-STREAM-DEVICE-BIN)))
    (SETQ %%SYNONYM-STREAM-DEVICE
     (create FDEV
            DEVICENAME ← (QUOTE SYNONYM-STREAM-DEVICE)
            RESETABLE ← NIL
            RANDOMACCESSP ← NIL
            NODIRECTORIES ← T
            BUFFERED ← NIL
            PAGEMAPPED ← NIL
            FDBINABLE ← NIL
            FDBOUTABLE ← NIL
            FDEXTENDABLE ← NIL
            DEVICEINFO ← NIL
            HOSTNAMEP ← (FUNCTION NILL)
            EVENTFN ← (FUNCTION NILL)
            DIRECTORYNAMEP ← (FUNCTION NILL)
            REOPENFILE ← (FUNCTION NILL)
            CLOSEFILE ← (FUNCTION %%SYNONYM-STREAM-DEVICE-CLOSEFILE)
            GETFILENAME ← (FUNCTION NILL)
            DELETEFILE ← (FUNCTION NILL)
            GENERATEFILES ← (FUNCTION \GENERATENOFILES)
            RENAMEFILE ← (FUNCTION NILL)
            BIN ← (FUNCTION %%SYNONYM-STREAM-DEVICE-BIN)
            BOUT ← (FUNCTION %%SYNONYM-STREAM-DEVICE-BOUT)
            PEEKBIN ← (FUNCTION %%SYNONYM-STREAM-DEVICE-PEEKBIN)
            READP ← (FUNCTION %%SYNONYM-STREAM-DEVICE-READP)
            BACKFILEPTR ← (FUNCTION %%SYNONYM-STREAM-DEVICE-BACKFILEPTR)
            EOFP ← (FUNCTION %%SYNONYM-STREAM-DEVICE-EOFP)
            BLOCKIN ← (FUNCTION \GENERIC.BINS)
            BLOCKOUT ← (FUNCTION \GENERIC.BOUTS)
            FORCEOUTPUT ← (FUNCTION %%SYNONYM-STREAM-DEVICE-FORCEOUTPUT)
            GETFILEINFO ← (FUNCTION %%SYNONYM-STREAM-DEVICE-GETFILEINFO)
            SETFILEINFO ← (FUNCTION %%SYNONYM-STREAM-DEVICE-SETFILEINFO)))
    (SETQ \FILL-POINTER-STREAM-DEVICE
     (create FDEV
            DEVICENAME ← (QUOTE FILL-POINTER-STREAM-DEVICE)
            RESETABLE ← NIL
            RANDOMACCESSP ← NIL
            NODIRECTORIES ← T
            BUFFERED ← NIL
            PAGEMAPPED ← NIL
            FDBINABLE ← NIL
            FDBOUTABLE ← NIL
            FDEXTENDABLE ← NIL
            DEVICEINFO ← NIL
            HOSTNAMEP ← (FUNCTION NILL)
            EVENTFN ← (FUNCTION NILL)
            DIRECTORYNAMEP ← (FUNCTION NILL)
            OPENFILE ← (FUNCTION NILL)
            REOPENFILE ← (FUNCTION NILL)
            CLOSEFILE ← (FUNCTION %%FILL-POINTER-STREAM-DEVICE-CLOSEFILE)
            GETFILENAME ← (FUNCTION NILL)
            DELETEFILE ← (FUNCTION NILL)
            GENERATEFILES ← (FUNCTION \GENERATENOFILES)
            RENAMEFILE ← (FUNCTION NILL)
            BIN ← (FUNCTION \ILLEGAL.DEVICEOP)
            BOUT ← (FUNCTION NILL)
            PEEKBIN ← (FUNCTION \ILLEGAL.DEVICEOP)
            READP ← (FUNCTION \ILLEGAL.DEVICEOP)
            EOFP ← (FUNCTION NILL)
            BLOCKIN ← (FUNCTION \ILLEGAL.DEVICEOP)
            BLOCKOUT ← (FUNCTION \GENERIC.BOUTS)
            FORCEOUTPUT ← (FUNCTION NILL)
            GETFILEPTR ← (FUNCTION %%FILL-POINTER-STREAM-DEVICE-GETFILEPTR)
            SETFILEINFO ← (FUNCTION \ILLEGAL.DEVICEOP])
)
(DECLARE: DONTEVAL@LOAD DOCOPY 
(%%INITIALIZE-CLSTREAM-TYPES)
(%%INITIALIZE-STANDARD-STREAMS)
)

(PUTPROPS CLSTREAMS FILETYPE COMPILE-FILE)
(PUTPROPS CLSTREAMS COPYRIGHT ("Xerox Corporation" 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (26360 27880 (%%BROADCAST-STREAM-DEVICE-BOUT 26370 . 26665) (
%%BROADCAST-STREAM-DEVICE-OUTCHARFN 26667 . 27227) (%%BROADCAST-STREAM-DEVICE-CLOSEFILE 27229 . 27562)
 (%%BROADCAST-STREAM-DEVICE-FORCEOUTPUT 27564 . 27878)) (27881 30297 (%%CONCATENATED-STREAM-DEVICE-BIN
 27891 . 28517) (%%CONCATENATED-STREAM-DEVICE-CLOSEFILE 28519 . 28928) (
%%CONCATENATED-STREAM-DEVICE-EOFP 28930 . 29572) (%%CONCATENATED-STREAM-DEVICE-PEEKBIN 29574 . 30295))
 (30298 30612 (%%ECHO-STREAM-DEVICE-BIN 30308 . 30610)) (30613 33845 (%%SYNONYM-STREAM-DEVICE-BIN 
30623 . 30887) (%%SYNONYM-STREAM-DEVICE-BOUT 30889 . 31173) (%%SYNONYM-STREAM-DEVICE-OUTCHARFN 31175
 . 31712) (%%SYNONYM-STREAM-DEVICE-CLOSEFILE 31714 . 31991) (%%SYNONYM-STREAM-DEVICE-EOFP 31993 . 
32260) (%%SYNONYM-STREAM-DEVICE-FORCEOUTPUT 32262 . 32575) (%%SYNONYM-STREAM-DEVICE-GETFILEINFO 32577
 . 32886) (%%SYNONYM-STREAM-DEVICE-PEEKBIN 32888 . 33187) (%%SYNONYM-STREAM-DEVICE-READP 33189 . 33322
) (%%SYNONYM-STREAM-DEVICE-BACKFILEPTR 33324 . 33526) (%%SYNONYM-STREAM-DEVICE-SETFILEINFO 33528 . 
33843)) (33846 36413 (%%TWO-WAY-STREAM-DEVICE-BIN 33856 . 34100) (%%TWO-WAY-STREAM-DEVICE-BOUT 34102
 . 34397) (%%TWO-WAY-STREAM-DEVICE-OUTCHARFN 34399 . 34925) (%%TWO-WAY-STREAM-DEVICE-CLOSEFILE 34927
 . 35390) (%%TWO-WAY-STREAM-DEVICE-EOFP 35392 . 35639) (%%TWO-WAY-STREAM-DEVICE-BACKFILEPTR 35641 . 
35833) (%%TWO-WAY-STREAM-DEVICE-FORCEOUTPUT 35835 . 36129) (%%TWO-WAY-STREAM-DEVICE-PEEKBIN 36131 . 
36411)) (36956 37308 (%%SYNONYM-STREAM-DEVICE-GET-STREAM 36966 . 37306)) (39145 46632 (
%%INITIALIZE-CLSTREAM-TYPES 39155 . 46630)))))
STOP