lw-char-stream.lisp - clic - Clic is an command line interactive client for gop… | |
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
lw-char-stream.lisp (3652B) | |
--- | |
1 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 1… | |
2 ;;; $Header: /usr/local/cvsrep/flexi-streams/lw-char-stream.lisp,v 1.1 2… | |
3 | |
4 ;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved. | |
5 | |
6 ;;; Redistribution and use in source and binary forms, with or without | |
7 ;;; modification, are permitted provided that the following conditions | |
8 ;;; are met: | |
9 | |
10 ;;; * Redistributions of source code must retain the above copyright | |
11 ;;; notice, this list of conditions and the following disclaimer. | |
12 | |
13 ;;; * Redistributions in binary form must reproduce the above | |
14 ;;; copyright notice, this list of conditions and the following | |
15 ;;; disclaimer in the documentation and/or other materials | |
16 ;;; provided with the distribution. | |
17 | |
18 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED | |
19 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
20 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
21 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
22 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
24 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
26 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
27 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
28 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | |
30 (in-package :flexi-streams) | |
31 | |
32 (defclass flexi-char-output-stream (flexi-output-stream) | |
33 () | |
34 (:documentation "This class is for output streams where the | |
35 underlying stream is bivalent but not binary. It exists solely for | |
36 the purpose of optimizing output to binary streams on LispWorks. See | |
37 WRITE-BYTE*.")) | |
38 | |
39 (defclass flexi-char-input-stream (flexi-input-stream) | |
40 () | |
41 (:documentation "This class is for input streams where the | |
42 underlying stream is bivalent but not binary. It exists solely for | |
43 the purpose of optimizing input to binary streams on LispWorks. See | |
44 READ-BYTE*.")) | |
45 | |
46 (defclass flexi-char-io-stream (flexi-char-input-stream flexi-char-outpu… | |
47 () | |
48 (:documentation "This class is for bidirectional streams where the | |
49 underlying stream is bivalent but not binary. It exists solely for | |
50 the purpose of optimizing input and output from/to binary streams on | |
51 LispWorks. See READ-BYTE* and WRITE-BYTE*.")) | |
52 | |
53 (defmethod initialize-instance :after ((flexi-stream flexi-output-stream… | |
54 "Might change the class of FLEXI-STREAM for optimization purposes. | |
55 Only needed for LispWorks." | |
56 (declare #.*standard-optimize-settings*) | |
57 (declare (ignore initargs)) | |
58 (with-accessors ((stream flexi-stream-stream)) | |
59 flexi-stream | |
60 (unless (subtypep (stream-element-type stream) 'octet) | |
61 (change-class flexi-stream | |
62 (typecase flexi-stream | |
63 (flexi-io-stream 'flexi-char-io-stream) | |
64 (otherwise 'flexi-char-output-stream)))))) | |
65 | |
66 (defmethod initialize-instance :after ((flexi-stream flexi-input-stream)… | |
67 "Might change the class of FLEXI-STREAM for optimization purposes. | |
68 Only needed for LispWorks." | |
69 (declare #.*standard-optimize-settings*) | |
70 (declare (ignore initargs)) | |
71 (with-accessors ((stream flexi-stream-stream)) | |
72 flexi-stream | |
73 (unless (subtypep (stream-element-type stream) 'octet) | |
74 (change-class flexi-stream | |
75 (typecase flexi-stream | |
76 (flexi-io-stream 'flexi-char-io-stream) | |
77 (otherwise 'flexi-char-input-stream)))))) |