Started ZETA-STREAMS.
[iolib/alendvai.git] / io.streams / zeta / classes.lisp
blob470a8fcc579b1457f8404086aff8ab20b334df0e
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Indent-tabs-mode: NIL -*-
2 ;;;
3 ;;; classes.lisp --- Zeta streams classes.
4 ;;;
5 ;;; Copyright (C) 2006-2008, Stelian Ionescu <sionescu@common-lisp.net>
6 ;;;
7 ;;; This code is free software; you can redistribute it and/or
8 ;;; modify it under the terms of the version 2.1 of
9 ;;; the GNU Lesser General Public License as published by
10 ;;; the Free Software Foundation, as clarified by the
11 ;;; preamble found here:
12 ;;; http://opensource.franz.com/preamble.html
13 ;;;
14 ;;; This program is distributed in the hope that it will be useful,
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU Lesser General
20 ;;; Public License along with this library; if not, write to the
21 ;;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22 ;;; Boston, MA 02110-1301, USA
24 (in-package :io.zeta-streams)
26 ;;;; Types
28 (deftype ub8 () '(unsigned-byte 8))
29 (deftype ub16 () '(unsigned-byte 16))
30 (deftype ub32 () '(unsigned-byte 32))
31 (deftype sb8 () '(signed-byte 8))
32 (deftype sb16 () '(signed-byte 16))
33 (deftype sb32 () '(signed-byte 32))
35 (deftype ub8-sarray (&optional (size '*))
36 `(simple-array ub8 (,size)))
38 (deftype ub8-vector () '(vector ub8))
40 (deftype ub16-sarray (&optional (size '*))
41 `(simple-array ub16 (,size)))
43 ;;;; Buffers
45 ;;; almost 128 MB: large enough for a stream buffer,
46 ;;; but small enough to fit into a fixnum
47 (deftype iobuf-index () '(unsigned-byte 27))
48 (deftype iobuf-length () '(integer 0 #.(expt 2 27)))
50 (deftype iobuf-buffer () '(simple-array ub8 (*)))
52 (defstruct (iobuf (:constructor %make-iobuf ()))
53 (data (make-array 0 :element-type 'ub8)
54 :type iobuf-buffer)
55 (size 0 :type iobuf-length)
56 (start 0 :type iobuf-index)
57 (end 0 :type iobuf-index))
59 ;;;; Stream Classes
61 (deftype stream-position () '(unsigned-byte 64))
63 (defclass zeta-stream () ())
65 (defclass single-channel-zeta-stream (zeta-stream)
66 ())
68 (defclass dual-channel-zeta-stream (zeta-stream)
69 ())
71 (defclass memory-buffer-zeta-stream (zeta-stream)
72 ())