The circular-streams Reference Manual

This is the circular-streams Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 04:36:27 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 circular-streams

Circularly readable streams for Common Lisp

Author

Tomohiro Matsuyama

License

LLGPL

Long Description

# Circular-Streams - Circularly readable streams for Common Lisp

[![Build Status](https://travis-ci.org/fukamachi/circular-streams.svg?branch=master)](https://travis-ci.org/fukamachi/circular-streams)
[![Coverage Status](https://coveralls.io/repos/github/fukamachi/circular-streams/badge.svg?branch=master)](https://coveralls.io/github/fukamachi/circular-streams?branch=master)

## Usage

(defparameter *stream*
(flex:make-in-memory-input-stream
#(72 101 108 108 111)))

(defparameter *circular-stream*
(make-circular-stream *stream*))

(read-char *circular-stream*) ;=> #\H
(read-char *circular-stream*) ;=> #\e
(read-char *circular-stream*) ;=> #\l
(read-char *circular-stream*) ;=> #\l
(read-char *circular-stream*) ;=> #\o
(read-char *circular-stream* nil :eof) ;=> :eof

(let ((buf (make-array 5 :adjustable t :fill-pointer 5)))
(read-sequence buf *circular-stream*)
(flex:octets-to-string buf))
;=> "Hello"

## Description

Circular-Streams allows you to read streams circularly by wrapping real streams. Once you reach end-of-file of a stream, it’s file position will be reset to 0 and you’re able to read it again.

Note this library can treat only octet streams which has a method ‘read-byte‘. This might be expanded in the future.

This library was originally written by Tomohiro Matsuyama as a part of [Clack](http://clacklisp.org), Eitaro Fukamachi ported it with some improvements.

## API Reference

### [Class] circular-input-stream

Class for circular input streams. ‘make-circular-input-stream‘ is available to create an instance.

### [Function] make-circular-stream

Creates ‘circular-input-stream‘ and returns it.

## Author

* Tomohiro Matsuyama (tomo@cx4a.org)
* Eitaro Fukamachi (e.arrows@gmail.com)

## Copyright

Copyright (c) 2011-2012 Tomohiro Matsuyama (tomo@cx4a.org)
Copyright (c) 2012-2016 Eitaro Fukamachi (e.arrows@gmail.com)

# License

Licensed under the LLGPL License.

# See Also

* [Gray streams](http://www.cliki.net/Gray%20streams)
* [trivial-gray-streams](http://www.cliki.net/trivial-gray-streams)

Version

0.1

Dependencies
  • fast-io (system).
  • trivial-gray-streams (system).
Source

circular-streams.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 circular-streams/src

Source

circular-streams.asd.

Parent Component

circular-streams (system).

Child Component

circular-streams.lisp (file).


4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 circular-streams/circular-streams.asd

Source

circular-streams.asd.

Parent Component

circular-streams (system).

ASDF Systems

circular-streams.

Packages

circular-streams-asd.


4.1.2 circular-streams/src/circular-streams.lisp

Source

circular-streams.asd.

Parent Component

src (module).

Packages

circular-streams.

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 circular-streams-asd

Source

circular-streams.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.2 circular-streams

Source

circular-streams.lisp.

Use List
  • common-lisp.
  • trivial-gray-streams.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Ordinary functions

Function: make-circular-input-stream (stream &key buffer)

Creates ‘circular-input-stream’ and returns it. If ‘:buffer’ is specified, the instance uses it as an internal buffer. You need this to reuse ‘circular-input-stream’ without saving itself.

Package

circular-streams.

Source

circular-streams.lisp.

Function: make-circular-stream (stream &key buffer)

Creates ‘circular-input-stream’ and returns it. If ‘:buffer’ is specified, the instance uses it as an internal buffer. You need this to reuse ‘circular-input-stream’ without saving itself.

Package

circular-streams.

Alias for

make-circular-input-stream.


6.1.2 Generic functions

Generic Reader: circular-stream-buffer (object)
Package

circular-streams.

Methods
Reader Method: circular-stream-buffer ((circular-input-stream circular-input-stream))

automatically generated reader method

Source

circular-streams.lisp.

Target Slot

buffer.

Generic Reader: circular-stream-position (object)
Package

circular-streams.

Methods
Reader Method: circular-stream-position ((circular-input-stream circular-input-stream))

automatically generated reader method

Source

circular-streams.lisp.

Target Slot

position.

Generic Writer: (setf circular-stream-position) (object)
Package

circular-streams.

Methods
Writer Method: (setf circular-stream-position) ((circular-input-stream circular-input-stream))

automatically generated writer method

Source

circular-streams.lisp.

Target Slot

position.

Generic Reader: circular-stream-stream (object)
Package

circular-streams.

Methods
Reader Method: circular-stream-stream ((circular-input-stream circular-input-stream))

automatically generated reader method

Source

circular-streams.lisp.

Target Slot

stream.


6.1.3 Standalone methods

Method: stream-element-type ((stream circular-input-stream))
Source

circular-streams.lisp.

Method: (setf stream-file-position) ((stream circular-input-stream))
Package

trivial-gray-streams.

Source

circular-streams.lisp.

Method: stream-file-position ((stream circular-input-stream))
Package

trivial-gray-streams.

Source

circular-streams.lisp.

Method: stream-listen ((stream circular-input-stream))
Package

sb-gray.

Source

circular-streams.lisp.

Method: stream-read-byte ((stream circular-input-stream))
Package

sb-gray.

Source

circular-streams.lisp.

Method: stream-read-char ((stream circular-input-stream))
Package

sb-gray.

Source

circular-streams.lisp.

Method: stream-read-line ((stream circular-input-stream))
Package

sb-gray.

Source

circular-streams.lisp.

Method: stream-read-sequence ((stream circular-input-stream) sequence start end &key)
Package

trivial-gray-streams.

Source

circular-streams.lisp.


6.1.4 Classes

Class: circular-input-stream

Class for circular input streams.

Package

circular-streams.

Source

circular-streams.lisp.

Direct superclasses
  • fundamental-binary-input-stream.
  • trivial-gray-stream-mixin.
Direct methods
Direct slots
Slot: stream
Package

common-lisp.

Initargs

:stream

Readers

circular-stream-stream.

Writers

This slot is read-only.

Slot: buffer
Initform

(fast-io:make-output-buffer)

Initargs

:buffer

Readers

circular-stream-buffer.

Writers

This slot is read-only.

Slot: position
Package

common-lisp.

Initform

0

Readers

circular-stream-position.

Writers

(setf circular-stream-position).


6.2 Internals


6.2.1 Ordinary functions

Function: extend-buffer (stream count)
Package

circular-streams.

Source

circular-streams.lisp.

Function: extend-buffer-one (stream)
Package

circular-streams.

Source

circular-streams.lisp.

Function: fast-buffer-aref (buffer index)
Package

circular-streams.

Source

circular-streams.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   E   F   G   M   S  
Index Entry  Section

(
(setf circular-stream-position): Public generic functions
(setf circular-stream-position): Public generic functions
(setf stream-file-position): Public standalone methods

C
circular-stream-buffer: Public generic functions
circular-stream-buffer: Public generic functions
circular-stream-position: Public generic functions
circular-stream-position: Public generic functions
circular-stream-stream: Public generic functions
circular-stream-stream: Public generic functions

E
extend-buffer: Private ordinary functions
extend-buffer-one: Private ordinary functions

F
fast-buffer-aref: Private ordinary functions
Function, extend-buffer: Private ordinary functions
Function, extend-buffer-one: Private ordinary functions
Function, fast-buffer-aref: Private ordinary functions
Function, make-circular-input-stream: Public ordinary functions
Function, make-circular-stream: Public ordinary functions

G
Generic Function, (setf circular-stream-position): Public generic functions
Generic Function, circular-stream-buffer: Public generic functions
Generic Function, circular-stream-position: Public generic functions
Generic Function, circular-stream-stream: Public generic functions

M
make-circular-input-stream: Public ordinary functions
make-circular-stream: Public ordinary functions
Method, (setf circular-stream-position): Public generic functions
Method, (setf stream-file-position): Public standalone methods
Method, circular-stream-buffer: Public generic functions
Method, circular-stream-position: Public generic functions
Method, circular-stream-stream: Public generic functions
Method, stream-element-type: Public standalone methods
Method, stream-file-position: Public standalone methods
Method, stream-listen: Public standalone methods
Method, stream-read-byte: Public standalone methods
Method, stream-read-char: Public standalone methods
Method, stream-read-line: Public standalone methods
Method, stream-read-sequence: Public standalone methods

S
stream-element-type: Public standalone methods
stream-file-position: Public standalone methods
stream-listen: Public standalone methods
stream-read-byte: Public standalone methods
stream-read-char: Public standalone methods
stream-read-line: Public standalone methods
stream-read-sequence: Public standalone methods


A.3 Variables

Jump to:   B   P   S  
Index Entry  Section

B
buffer: Public classes

P
position: Public classes

S
Slot, buffer: Public classes
Slot, position: Public classes
Slot, stream: Public classes
stream: Public classes