Next: , Previous: bimap, Up: Top


7 bit_buffer

     %--------------------------------------------------%
     % vim: ts=4 sw=4 et ft=mercury
     %--------------------------------------------------%
     % Copyright (C) 2007, 2009 The University of Melbourne
     % This file may only be copied under the terms of the GNU Library General
     % Public License - see the file COPYING.LIB in the Mercury distribution.
     %--------------------------------------------------%
     % File: bit_buffer.m.
     % Main author: stayl.
     % Stability: low.
     %
     % A bit buffer provides an interface between bit-oriented I/O requests
     % and byte-oriented streams.  The useful part of the interface is defined
     % in bit_buffer.read and bit_buffer.write.
     %
     % CAVEAT: the user is referred to the documentation in the header
     % of array.m regarding programming with unique objects (the compiler
     % does not currently recognise them, hence we are forced to use
     % non-unique modes until the situation is rectified; this places
     % a small burden on the programmer to ensure the correctness of his
     % code that would otherwise be assured by the compiler.)
     %
     %--------------------------------------------------%
     %--------------------------------------------------%
     
     :- module bit_buffer.
     :- interface.
     
     :- import_module bitmap.
     :- import_module stream.
     
     :- include_module bit_buffer.read.
     :- include_module bit_buffer.write.
     
         % An error_stream throws an `error_stream_error' exception if any of
         % its output methods are called, or returns an `error_stream_error'
         % if any of its input methods are called.
         %
     :- type error_stream ---> error_stream.
     :- type error_state ---> error_state.
     :- type error_stream_error ---> error_stream_error.
     :- instance stream.error(error_stream_error).
     :- instance stream.stream(error_stream, error_state).
     :- instance stream.input(error_stream, error_state).
     :- instance stream.bulk_reader(error_stream, byte_index, bitmap,
             error_state, error_stream_error).
     
     :- instance stream.output(error_stream, error_state).
     :- instance stream.writer(error_stream, bitmap.slice, error_state).
     
     %--------------------------------------------------%