Coverage report: /home/ellis/.stash/quicklisp/dists/ultralisp/software/edicl-flexi-streams-20240429143708/io.lisp
Kind | Covered | All | % |
expression | 0 | 51 | 0.0 |
branch | 0 | 2 | 0.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*-
2
;;; $Header: /usr/local/cvsrep/flexi-streams/io.lisp,v 1.2 2008/05/20 23:44:45 edi Exp $
4
;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved.
6
;;; Redistribution and use in source and binary forms, with or without
7
;;; modification, are permitted provided that the following conditions
10
;;; * Redistributions of source code must retain the above copyright
11
;;; notice, this list of conditions and the following disclaimer.
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.
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.
30
(in-package :flexi-streams)
32
(defmethod reset-input-state ((flexi-io-stream flexi-io-stream))
33
"This method is used to clear any state associated with previous
34
input before output is attempted on the stream. It can fail if the
35
octet stack is not empty and the stream can't be `rewound'."
36
(declare #.*standard-optimize-settings*)
37
(with-accessors ((last-char-code flexi-stream-last-char-code)
38
(last-octet flexi-stream-last-octet)
39
(octet-stack flexi-stream-octet-stack)
40
(stream flexi-stream-stream))
43
(unless (maybe-rewind stream (length octet-stack))
44
(error 'flexi-stream-out-of-sync-error
45
:stream flexi-io-stream))
46
(setq octet-stack nil))
50
(defmethod stream-write-byte :before ((stream flexi-io-stream) byte)
51
(declare #.*standard-optimize-settings*)
52
(declare (ignore byte))
53
(reset-input-state stream))
55
(defmethod stream-write-char :before ((stream flexi-io-stream) char)
56
(declare #.*standard-optimize-settings*)
57
(declare (ignore char))
58
(reset-input-state stream))
60
(defmethod stream-write-sequence :before ((stream flexi-io-stream) sequence start end &key)
61
(declare #.*standard-optimize-settings*)
62
(declare (ignore sequence start end))
63
(reset-input-state stream))
65
(defmethod stream-clear-output :before ((stream flexi-io-stream))
66
(declare #.*standard-optimize-settings*)
67
(reset-input-state stream))
69
(defmethod reset-output-state ((flexi-io-stream flexi-io-stream))
70
"This method is used to clear any state associated with previous
71
output before the stream is used for input."
72
(declare #.*standard-optimize-settings*)
73
(with-accessors ((column flexi-stream-column))
77
(defmethod stream-read-byte :before ((stream flexi-io-stream))
78
(declare #.*standard-optimize-settings*)
79
(reset-output-state stream))
81
(defmethod stream-read-char :before ((stream flexi-io-stream))
82
(declare #.*standard-optimize-settings*)
83
(reset-output-state stream))
85
(defmethod stream-read-sequence :before ((stream flexi-io-stream) sequence start end &key)
86
(declare #.*standard-optimize-settings*)
87
(declare (ignore sequence start end))
88
(reset-output-state stream))
90
(defmethod stream-unread-char :before ((stream flexi-io-stream) char)
91
(declare #.*standard-optimize-settings*)
92
(declare (ignore char))
93
(reset-output-state stream))
95
(defmethod unread-byte :before (byte (stream flexi-io-stream))
96
(declare #.*standard-optimize-settings*)
97
(declare (ignore byte))
98
(reset-output-state stream))
100
(defmethod stream-clear-input :before ((stream flexi-io-stream))
101
(declare #.*standard-optimize-settings*)
102
(reset-output-state stream))
104
(defmethod write-byte* :after (byte (stream flexi-io-stream))
105
"Keep POSITION slot up to date even when performing output."
106
(declare #.*standard-optimize-settings*)
107
(declare (ignore byte))
108
(with-accessors ((position flexi-stream-position))