Coverage report: /development/source/library/org/datagraph/spocq-shard/src/core/encoding/writer-stream.lisp

KindCoveredAll%
expression041 0.0
branch02 0.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 ;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10; Package: org.datagraph.spocq.implementation; -*-
2
 
3
 (in-package :org.datagraph.spocq.implementation)
4
 
5
 (defClass writer-stream (#+ALLEGRO excl::fundamental-binary-output-stream
6
                          #+CMU extensions:fundamental-binary-output-stream
7
                           #+LispWorks stream:fundamental-stream
8
                           #+digitool ccl::output-binary-stream
9
                           #+CormanLisp stream
10
                           #+clozure-common-lisp ccl:fundamental-binary-stream
11
                           #+sbcl sb-gray:fundamental-binary-output-stream)
12
   ((stream
13
     :initform (error "stream is required.") :initarg :stream)
14
    (writer-function
15
     :initarg :writer-function :initform (error "encoder is required.")
16
     :reader stream-writer-function)
17
    #+(or clisp CMU lispworks sbcl scl clozure-common-lisp)
18
    (direction :initarg :direction)
19
    (eol-sequence
20
     :initform #(#\return #\linefeed) :initarg :eol-sequence
21
     :reader stream-eol-sequence))
22
   (:default-initargs :direction :output
23
     #+CormanLisp :element-type #+CormanLisp 'unsigned-byte)
24
   (:documentation "An encoder-stream serves as a character output stream delegate to a binary stream
25
  and encodes the characters through the application of a provided writer function."))
26
 
27
 (defmethod stream-element-type ((stream writer-stream))
28
   'character)
29
 
30
 #-digitool
31
 (defmethod open-stream-p ((stream writer-stream))
32
   t)
33
 
34
 
35
 (defmethod stream-line-column ((stream writer-stream)) nil)
36
   
37
 (defmethod stream-terpri ((stream writer-stream))
38
   (let ((writer (stream-writer-function stream)))
39
     (funcall writer #\return)
40
     (funcall writer #\linefeed)))
41
 
42
 (defmethod stream-write-char ((stream writer-stream) (char character))
43
   (funcall (stream-writer-function stream) char))
44
 
45
 (defmethod stream-write-string ((stream writer-stream) string
46
                                 #-digitool &optional start end)
47
   (unless end (setf end (length string)))
48
   (let ((writer (stream-writer-function stream)))
49
     (do ((i (or start 0) (1+ i)))
50
         ((>= i end))
51
       (funcall writer (char string i)))
52
     string))
53
 
54
 
55
 (defmethod stream-tyo ((stream writer-stream) char)
56
   (funcall (stream-writer-function stream) char))