Make stream FDs nonblocking by default, various fixes.
[iolib.git] / src / base / pkgdcl.lisp
blob73dfb784fb6b80daebb9debb3c34e5c00aa59b1c
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; --- Package definition.
4 ;;;
6 (in-package :common-lisp-user)
8 (defpackage :iolib.base
9 (:use #:common-lisp :alexandria)
10 (:shadow #:defun #:defmethod #:defmacro #:define-compiler-macro #:defconstant)
11 (:export
12 ;; Conditions
13 #:bug #:iolib-bug
14 #:subtype-error #:subtype-error-datum #:subtype-error-expected-supertype
15 ;; Debugging
16 #:*safety-checks*
17 #:debug-only #:debug-only*
18 #:production-only #:production-only*
19 ;; Types
20 #:function-designator
21 #:character-designator
22 #:sb8 #:sb16 #:sb32 #:sb64
23 #:ub8 #:ub16 #:ub32 #:ub64
24 #:ub8-sarray #:ub16-sarray #:ub32-sarray #:ub64-sarray
25 #:ub8-vector #:ub16-vector #:ub32-vector #:ub64-vector
26 ;; RETURN*
27 #:return* #:lambda* #:defun #:defmethod
28 #:defmacro #:define-compiler-macro
29 ;; Definitions
30 #:defconstant
31 ;; DEFOBSOLETE
32 #:defobsolete
33 #:signal-obsolete
34 #:deprecation-warning
35 #:deprecation-warning-function-name
36 #:deprecation-warning-type
37 #:deprecation-warning-reason
38 ;; Reader utils
39 #:define-syntax
40 #:enable-reader-macro #:enable-reader-macro*
41 #:disable-reader-macro #:disable-reader-macro*
42 #:define-literal-reader
43 #:unknown-literal-syntax #:unknown-literal-syntax-name
44 ;; SPLIT-SEQUENCE
45 #:split-sequence #:split-sequence-if #:split-sequence-if-not
46 ;; Misc
47 #:function-name #:function-name-p
48 #:check-bounds #:join #:shrink-vector
49 ;; Matching
50 #:multiple-value-case #:flags-case
51 ;; Time
52 #:timeout-designator #:positive-timeout-designator
53 #:decode-timeout #:normalize-timeout #:clamp-timeout
56 (flet ((gather-external-symbols (&rest packages)
57 (let (symbols)
58 (with-package-iterator (iterator packages :external)
59 (loop (multiple-value-bind (morep symbol) (iterator)
60 (unless morep (return))
61 (pushnew (intern (string symbol) :iolib.base)
62 symbols))))
63 symbols)))
64 (export (gather-external-symbols :common-lisp :alexandria :iolib.base)
65 :iolib.base))
68 ;;;-------------------------------------------------------------------------
69 ;;; GRAY stream symbols
70 ;;;-------------------------------------------------------------------------
72 #+cmu
73 (eval-when (:compile-toplevel :load-toplevel :execute)
74 (require :gray-streams))
76 #+allegro
77 (eval-when (:compile-toplevel :load-toplevel :execute)
78 (unless (fboundp 'stream:stream-write-string)
79 (require "streamc.fasl")))
81 (eval-when (:compile-toplevel :load-toplevel :execute)
82 (defvar *gray-stream-symbols*
83 '(#:fundamental-stream #:fundamental-input-stream
84 #:fundamental-output-stream #:fundamental-character-stream
85 #:fundamental-binary-stream #:fundamental-character-input-stream
86 #:fundamental-character-output-stream
87 #:fundamental-binary-input-stream
88 #:fundamental-binary-output-stream #:stream-read-char
89 #:stream-unread-char #:stream-read-char-no-hang
90 #:stream-peek-char #:stream-listen #:stream-read-line
91 #:stream-clear-input #:stream-write-char #:stream-line-column
92 #:stream-start-line-p #:stream-write-string #:stream-terpri
93 #:stream-fresh-line #:stream-finish-output #:stream-force-output
94 #:stream-clear-output #:stream-advance-to-column
95 #:stream-read-byte #:stream-write-byte))
97 (defparameter *gray-stream-package*
98 #+allegro :excl
99 #+(or cmu scl) :ext
100 #+(or clisp ecl) :gray
101 #+(or ccl openmcl) :ccl
102 #+lispworks :stream
103 #+sbcl :sb-gray
104 #-(or allegro cmu scl clisp ecl ccl openmcl lispworks sbcl)
105 (error "Your CL implementation isn't supported.")))
107 (eval-when (:compile-toplevel :load-toplevel :execute)
108 (import (mapcar #'(lambda (s) (intern (string s) *gray-stream-package*))
109 *gray-stream-symbols*)
110 :iolib.base)
111 (export (mapcar (lambda (s) (intern (string s) :iolib.base))
112 (list* '#:trivial-gray-stream-mixin
113 '#:stream-read-sequence
114 '#:stream-write-sequence
115 '#:stream-file-position
116 *gray-stream-symbols*))
117 :iolib.base))