3 ;;; This code is in the public domain.
5 ;;; The cmucl implementation of simple-streams was done by Paul Foley,
6 ;;; who placed the code in the public domain. Sbcl port by Rudi
10 (defpackage sb-simple-streams
12 (:import-from
#:sb-kernel
#:ansi-stream
#:charpos
#:line-length
)
13 (:import-from
#:sb-gray
#:fundamental-stream
)
15 ;; FIXME: Using deffoo! or equivalent might be nicer.
16 (:implement
#:common-lisp
#:sb-kernel
#:sb-int
)
17 (:export
;; Stream classes
21 #:SINGLE-CHANNEL-SIMPLE-STREAM
22 #:DIRECT-SIMPLE-STREAM
23 #:BUFFER-INPUT-SIMPLE-STREAM
24 #:BUFFER-OUTPUT-SIMPLE-STREAM
27 #:MAPPED-FILE-SIMPLE-STREAM
28 #:DUAL-CHANNEL-SIMPLE-STREAM
29 #:TERMINAL-SIMPLE-STREAM
30 #:SOCKET-SIMPLE-STREAM
31 #:SOCKET-BASE-SIMPLE-STREAM
32 #:HIPER-SOCKET-SIMPLE-STREAM
33 #:STRING-SIMPLE-STREAM
35 #:STRING-INPUT-SIMPLE-STREAM
36 #:STRING-OUTPUT-SIMPLE-STREAM
37 #:FILL-POINTER-OUTPUT-SIMPLE-STREAM
38 #:LIMITED-STRING-OUTPUT-SIMPLE-STREAM
40 #:ANNOTATION-OUTPUT-SIMPLE-STREAM
42 #:*STANDARD-INPUT
* #:*STANDARD-OUTPUT
* #:*ERROR-OUTPUT
*
43 #:*QUERY-IO
* #:*DEBUG-IO
* #:*TRACE-OUTPUT
* #:*TERMINAL-IO
*
45 #:STREAM-INPUT-HANDLE
#:STREAM-OUTPUT-HANDLE
47 ;; Device-level functions
48 #:DEVICE-OPEN
#:DEVICE-CLOSE
#:DEVICE-BUFFER-LENGTH
49 #:DEVICE-FILE-POSITION
#:DEVICE-FILE-LENGTH
#:DEVICE-READ
50 #:DEVICE-CLEAR-INPUT
#:DEVICE-WRITE
#:DEVICE-CLEAR-OUTPUT
51 #:DEVICE-EXTEND
#:DEVICE-FINISH-RECORD
52 ;; Implementation functions/macros
53 #:WITH-STREAM-CLASS
#:SM
#:FUNCALL-STM-HANDLER
54 #:FUNCALL-STM-HANDLER-2
#:ADD-STREAM-INSTANCE-FLAGS
55 #:REMOVE-STREAM-INSTANCE-FLAGS
56 ;; User-level functions (mostly reexported from COMMON-LISP)
57 #:PARSE-FILESPEC
#:DEFINE-FILESPEC
#:DEFAULT-OPEN-CLASS
#:OPEN
58 #:CLOSE
#:READ-BYTE
#:READ-CHAR
#:READ-CHAR-NO-HANG
#:UNREAD-CHAR
59 #:PEEK-CHAR
#:LISTEN
#:READ-LINE
#:READ-SEQUENCE
#:CLEAR-INPUT
60 #:WRITE-BYTE
#:WRITE-CHAR
#:WRITE-STRING
#:WRITE-SEQUENCE
#:TERPRI
61 #:FRESH-LINE
#:FINISH-OUTPUT
#:FORCE-OUTPUT
#:CLEAR-OUTPUT
62 #:FILE-POSITION
#:FILE-LENGTH
#:LINE-LENGTH
#:CHARPOS
63 #:STREAM-ELEMENT-TYPE
#:STREAM-EXTERNAL-FORMAT
#:STREAMP
64 #:OPEN-STREAM-P
#:INPUT-STREAM-P
#:OUTPUT-STREAM-P
65 #:INTERACTIVE-STREAM-P
#:READ-VECTOR
#:WRITE-VECTOR
#:READ-OCTETS
66 #:WRITE-OCTETS
#:DEF-STREAM-CLASS
#:WAIT-FOR-INPUT-AVAILABLE
67 ;; higher level things (reexported from COMMON-LISP)
68 #:WITH-OPEN-FILE
#:WITH-OPEN-STREAM
#:FORMAT
#:PPRINT
#:PRIN1
69 #:PRIN1-TO-STRING
#:PRINC
#:PRINC-TO-STRING
#:PRINT
#:READ
70 #:READ-DELIMITED-LIST
#:READ-FROM-STRING
#:WRITE
#:WRITE-LINE
71 #:WRITE-TO-STRING
#:READ-PRESERVING-WHITESPACE
))
75 (defgeneric stream-file-position
(stream &optional position
))
76 (defgeneric stream-file-length
(stream))
77 (export '(stream-file-position stream-file-length
))