|
rpm-build |
0f2925 |
(*
|
|
rpm-build |
0f2925 |
* IO - Abstract input/output
|
|
rpm-build |
0f2925 |
* Copyright (C) 2003 Nicolas Cannasse
|
|
rpm-build |
0f2925 |
*
|
|
rpm-build |
0f2925 |
* This library is free software; you can redistribute it and/or
|
|
rpm-build |
0f2925 |
* modify it under the terms of the GNU Lesser General Public
|
|
rpm-build |
0f2925 |
* License as published by the Free Software Foundation; either
|
|
rpm-build |
0f2925 |
* version 2.1 of the License, or (at your option) any later version,
|
|
rpm-build |
0f2925 |
* with the special exception on linking described in file LICENSE.
|
|
rpm-build |
0f2925 |
*
|
|
rpm-build |
0f2925 |
* This library is distributed in the hope that it will be useful,
|
|
rpm-build |
0f2925 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
rpm-build |
0f2925 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
rpm-build |
0f2925 |
* Lesser General Public License for more details.
|
|
rpm-build |
0f2925 |
*
|
|
rpm-build |
0f2925 |
* You should have received a copy of the GNU Lesser General Public
|
|
rpm-build |
0f2925 |
* License along with this library; if not, write to the Free Software
|
|
rpm-build |
0f2925 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** High-order abstract I/O.
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
IO module simply deals with abstract inputs/outputs. It provides a
|
|
rpm-build |
0f2925 |
set of methods for working with these IO as well as several
|
|
rpm-build |
0f2925 |
constructors that enable to write to an underlying channel, buffer,
|
|
rpm-build |
0f2925 |
or enum.
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
open ExtBytes
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
type input
|
|
rpm-build |
0f2925 |
(** The abstract input type. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
type 'a output
|
|
rpm-build |
0f2925 |
(** The abstract output type, ['a] is the accumulator data, it is returned
|
|
rpm-build |
0f2925 |
when the [close_out] function is called. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
exception No_more_input
|
|
rpm-build |
0f2925 |
(** This exception is raised when reading on an input with the [read] or
|
|
rpm-build |
0f2925 |
[nread] functions while there is no available token to read. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
exception Input_closed
|
|
rpm-build |
0f2925 |
(** This exception is raised when reading on a closed input. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
exception Output_closed
|
|
rpm-build |
0f2925 |
(** This exception is raised when reading on a closed output. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** {6 Standard API} *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read : input -> char
|
|
rpm-build |
0f2925 |
(** Read a single char from an input or raise [No_more_input] if
|
|
rpm-build |
0f2925 |
no input available. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val nread : input -> int -> Bytes.t
|
|
rpm-build |
0f2925 |
(** [nread i n] reads a byte sequence of size up to [n] from an input.
|
|
rpm-build |
0f2925 |
The function will raise [No_more_input] if no input is available.
|
|
rpm-build |
0f2925 |
It will raise [Invalid_argument] if [n] < 0. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val really_nread : input -> int -> Bytes.t
|
|
rpm-build |
0f2925 |
(** [really_nread i n] reads a byte sequence of exactly [n] characters
|
|
rpm-build |
0f2925 |
from the input. Raises [No_more_input] if at least [n] characters are
|
|
rpm-build |
0f2925 |
not available. Raises [Invalid_argument] if [n] < 0. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val nread_string : input -> int -> string
|
|
rpm-build |
0f2925 |
(** as [nread], but reads a string. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val really_nread_string : input -> int -> string
|
|
rpm-build |
0f2925 |
(** as [really_nread], but reads a string. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val input : input -> Bytes.t -> int -> int -> int
|
|
rpm-build |
0f2925 |
(** [input i b p l] reads up to [l] characters from the given input, storing
|
|
rpm-build |
0f2925 |
them in buffer [b], starting at character number [p]. It returns the actual
|
|
rpm-build |
0f2925 |
number of characters read or raise [No_more_input] if no character can be
|
|
rpm-build |
0f2925 |
read. It will raise [Invalid_argument] if [p] and [l] do not designate a
|
|
rpm-build |
0f2925 |
valid subsequence of [b]. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val really_input : input -> Bytes.t -> int -> int -> int
|
|
rpm-build |
0f2925 |
(** [really_input i b p l] reads exactly [l] characters from the given input,
|
|
rpm-build |
0f2925 |
storing them in the buffer [b], starting at position [p]. For consistency with
|
|
rpm-build |
0f2925 |
{!IO.input} it returns [l]. Raises [No_more_input] if at [l] characters are
|
|
rpm-build |
0f2925 |
not available. Raises [Invalid_argument] if [p] and [l] do not designate a
|
|
rpm-build |
0f2925 |
valid subsequence of [b]. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val close_in : input -> unit
|
|
rpm-build |
0f2925 |
(** Close the input. It can no longer be read from. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write : 'a output -> char -> unit
|
|
rpm-build |
0f2925 |
(** Write a single char to an output. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val nwrite : 'a output -> Bytes.t -> unit
|
|
rpm-build |
0f2925 |
(** Write a byte sequence to an output. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val nwrite_string : 'a output -> string -> unit
|
|
rpm-build |
0f2925 |
(** Write a string to an output. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output : 'a output -> Bytes.t -> int -> int -> int
|
|
rpm-build |
0f2925 |
(** [output o b p l] writes up to [l] characters from byte sequence [b], starting at
|
|
rpm-build |
0f2925 |
offset [p]. It returns the number of characters written. It will raise
|
|
rpm-build |
0f2925 |
[Invalid_argument] if [p] and [l] do not designate a valid subsequence of [b]. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val really_output : 'a output -> Bytes.t -> int -> int -> int
|
|
rpm-build |
0f2925 |
(** [really_output o b p l] writes exactly [l] characters from byte sequence [b] onto
|
|
rpm-build |
0f2925 |
the the output, starting with the character at offset [p]. For consistency with
|
|
rpm-build |
0f2925 |
{!IO.output} it returns [l]. Raises [Invalid_argument] if [p] and [l] do not
|
|
rpm-build |
0f2925 |
designate a valid subsequence of [b]. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val flush : 'a output -> unit
|
|
rpm-build |
0f2925 |
(** Flush an output. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val close_out : 'a output -> 'a
|
|
rpm-build |
0f2925 |
(** Close the output and return its accumulator data.
|
|
rpm-build |
0f2925 |
It can no longer be written. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** {6 Creation of IO Inputs/Outputs} *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val input_string : string -> input
|
|
rpm-build |
0f2925 |
(** Create an input that will read from a string. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val input_bytes : Bytes.t -> input
|
|
rpm-build |
0f2925 |
(** Create an input that will read from a byte sequence. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output_string : unit -> string output
|
|
rpm-build |
0f2925 |
(** Create an output that will write into a string in an efficient way.
|
|
rpm-build |
0f2925 |
When closed, the output returns all the data written into it. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output_bytes : unit -> Bytes.t output
|
|
rpm-build |
0f2925 |
(** Create an output that will write into a byte sequence in an efficient way.
|
|
rpm-build |
0f2925 |
When closed, the output returns all the data written into it. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output_strings : unit -> string list output
|
|
rpm-build |
0f2925 |
(** Create an output that will write into a string in an efficient way.
|
|
rpm-build |
0f2925 |
When closed, the output returns all the data written into it.
|
|
rpm-build |
0f2925 |
Several strings are used in case the output size excess max_string_length
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val input_channel : in_channel -> input
|
|
rpm-build |
0f2925 |
(** Create an input that will read from a channel. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output_channel : out_channel -> unit output
|
|
rpm-build |
0f2925 |
(** Create an output that will write into a channel. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val input_enum : char Enum.t -> input
|
|
rpm-build |
0f2925 |
(** Create an input that will read from an [enum]. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output_enum : unit -> char Enum.t output
|
|
rpm-build |
0f2925 |
(** Create an output that will write into an [enum]. The
|
|
rpm-build |
0f2925 |
final enum is returned when the output is closed. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val create_in :
|
|
rpm-build |
0f2925 |
read:(unit -> char) ->
|
|
rpm-build |
0f2925 |
input:(Bytes.t -> int -> int -> int) -> close:(unit -> unit) -> input
|
|
rpm-build |
0f2925 |
(** Fully create an input by giving all the needed functions. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val create_out :
|
|
rpm-build |
0f2925 |
write:(char -> unit) ->
|
|
rpm-build |
0f2925 |
output:(Bytes.t -> int -> int -> int) ->
|
|
rpm-build |
0f2925 |
flush:(unit -> unit) -> close:(unit -> 'a) -> 'a output
|
|
rpm-build |
0f2925 |
(** Fully create an output by giving all the needed functions. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** {6 Utilities} *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val scanf : input -> ('a, 'b, 'c, 'd) Scanf.scanner
|
|
rpm-build |
0f2925 |
(** The scanf function works for any input. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val printf : 'a output -> ('b, unit, string, unit) format4 -> 'b
|
|
rpm-build |
0f2925 |
(** The printf function works for any output. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_all : input -> string
|
|
rpm-build |
0f2925 |
(** read all the contents of the input until [No_more_input] is raised. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val pipe : unit -> input * unit output
|
|
rpm-build |
0f2925 |
(** Create a pipe between an input and an ouput. Data written from
|
|
rpm-build |
0f2925 |
the output can be read from the input. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val pos_in : input -> input * (unit -> int)
|
|
rpm-build |
0f2925 |
(** Create an input that provide a count function of the number of Bytes.t
|
|
rpm-build |
0f2925 |
read from it. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val pos_out : 'a output -> 'a output * (unit -> int)
|
|
rpm-build |
0f2925 |
(** Create an output that provide a count function of the number of Bytes.t
|
|
rpm-build |
0f2925 |
written through it. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
external cast_output : 'a output -> unit output = "%identity"
|
|
rpm-build |
0f2925 |
(** You can safely transform any output to an unit output in a safe way
|
|
rpm-build |
0f2925 |
by using this function. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** {6 Binary files API}
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
Here is some API useful for working with binary files, in particular
|
|
rpm-build |
0f2925 |
binary files generated by C applications. By default, encoding of
|
|
rpm-build |
0f2925 |
multibyte integers is low-endian. The BigEndian module provide multibyte
|
|
rpm-build |
0f2925 |
operations with other encoding.
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
exception Overflow of string
|
|
rpm-build |
0f2925 |
(** Exception raised when a read or write operation cannot be completed. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_byte : input -> int
|
|
rpm-build |
0f2925 |
(** Read an unsigned 8-bit integer. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_signed_byte : input -> int
|
|
rpm-build |
0f2925 |
(** Read an signed 8-bit integer. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_ui16 : input -> int
|
|
rpm-build |
0f2925 |
(** Read an unsigned 16-bit word. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_i16 : input -> int
|
|
rpm-build |
0f2925 |
(** Read a signed 16-bit word. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_i31 : input -> int
|
|
rpm-build |
0f2925 |
(** Read a signed 32-bit integer. Raise [Overflow] if the
|
|
rpm-build |
0f2925 |
read integer cannot be represented as an OCaml 31-bit integer. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_i32 : input -> int
|
|
rpm-build |
0f2925 |
(** Deprecated, same as read_i31 *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_i32_as_int : input -> int
|
|
rpm-build |
0f2925 |
(** Read a signed 32-bit integer, represented as OCaml integer, wrapping around 31-bit int on 32-bit architecture *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_real_i32 : input -> int32
|
|
rpm-build |
0f2925 |
(** Read a signed 32-bit integer as an OCaml int32. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_i64 : input -> int64
|
|
rpm-build |
0f2925 |
(** Read a signed 64-bit integer as an OCaml int64. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_float32 : input -> float
|
|
rpm-build |
0f2925 |
(** Read an IEEE single precision floating point value (32 bits). *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_double : input -> float
|
|
rpm-build |
0f2925 |
(** Read an IEEE double precision floating point value (64 bits). *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_string : input -> string
|
|
rpm-build |
0f2925 |
(** Read a null-terminated string. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_bytes : input -> Bytes.t
|
|
rpm-build |
0f2925 |
(** Read a null-terminated byte sequence. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_line : input -> string
|
|
rpm-build |
0f2925 |
(** Read a LF or CRLF terminated string. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_byte : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
(** Write an unsigned 8-bit byte. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_ui16 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
(** Write an unsigned 16-bit word. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_i16 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
(** Write a signed 16-bit word. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_i31 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
(** Write a signed 31-bit integer as 4 bytes. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_i32 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
(** Write a signed 32-bit integer. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_real_i32 : 'a output -> int32 -> unit
|
|
rpm-build |
0f2925 |
(** Write an OCaml int32. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_i64 : 'a output -> int64 -> unit
|
|
rpm-build |
0f2925 |
(** Write an OCaml int64. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_float32 : 'a output -> float -> unit
|
|
rpm-build |
0f2925 |
(** Write an IEEE single precision floating point value (32 bits). *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_double : 'a output -> float -> unit
|
|
rpm-build |
0f2925 |
(** Write an IEEE double precision floating point value (64 bits). *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_string : 'a output -> string -> unit
|
|
rpm-build |
0f2925 |
(** Write a string and append an null character. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_bytes : 'a output -> Bytes.t -> unit
|
|
rpm-build |
0f2925 |
(** Write a byte sequence and append an null character. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_line : 'a output -> string -> unit
|
|
rpm-build |
0f2925 |
(** Write a line and append a LF (it might be converted
|
|
rpm-build |
0f2925 |
to CRLF on some systems depending on the underlying IO). *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** Same as operations above, but use big-endian encoding *)
|
|
rpm-build |
0f2925 |
module BigEndian :
|
|
rpm-build |
0f2925 |
sig
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_ui16 : input -> int
|
|
rpm-build |
0f2925 |
val read_i16 : input -> int
|
|
rpm-build |
0f2925 |
val read_i31 : input -> int
|
|
rpm-build |
0f2925 |
val read_i32 : input -> int
|
|
rpm-build |
0f2925 |
val read_i32_as_int : input -> int
|
|
rpm-build |
0f2925 |
val read_real_i32 : input -> int32
|
|
rpm-build |
0f2925 |
val read_i64 : input -> int64
|
|
rpm-build |
0f2925 |
val read_float32 : input -> float
|
|
rpm-build |
0f2925 |
val read_double : input -> float
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_ui16 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
val write_i16 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
val write_i31 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
val write_i32 : 'a output -> int -> unit
|
|
rpm-build |
0f2925 |
val write_real_i32 : 'a output -> int32 -> unit
|
|
rpm-build |
0f2925 |
val write_i64 : 'a output -> int64 -> unit
|
|
rpm-build |
0f2925 |
val write_float32 : 'a output -> float -> unit
|
|
rpm-build |
0f2925 |
val write_double : 'a output -> float -> unit
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
end
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** {6 Bits API}
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
This enable you to read and write from an IO bit-by-bit or several bits
|
|
rpm-build |
0f2925 |
at the same time.
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
type in_bits
|
|
rpm-build |
0f2925 |
type out_bits
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
exception Bits_error
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val input_bits : input -> in_bits
|
|
rpm-build |
0f2925 |
(** Read bits from an input *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val output_bits : 'a output -> out_bits
|
|
rpm-build |
0f2925 |
(** Write bits to an output *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val read_bits : in_bits -> int -> int
|
|
rpm-build |
0f2925 |
(** Read up to 31 bits, raise Bits_error if n < 0 or n > 31 *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val write_bits : out_bits -> nbits:int -> int -> unit
|
|
rpm-build |
0f2925 |
(** Write up to 31 bits represented as a value, raise Bits_error if nbits < 0
|
|
rpm-build |
0f2925 |
or nbits > 31 or the value representation excess nbits. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val flush_bits : out_bits -> unit
|
|
rpm-build |
0f2925 |
(** Flush remaining unwritten bits, adding up to 7 bits which values 0. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val drop_bits : in_bits -> unit
|
|
rpm-build |
0f2925 |
(** Drop up to 7 buffered bits and restart to next input character. *)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(** {6 Generic IO Object Wrappers}
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
Theses OO Wrappers have been written to provide easy support of ExtLib
|
|
rpm-build |
0f2925 |
IO by external librairies. If you want your library to support ExtLib
|
|
rpm-build |
0f2925 |
IO without actually requiring ExtLib to compile, you can should implement
|
|
rpm-build |
0f2925 |
the classes [in_channel], [out_channel], [poly_in_channel] and/or
|
|
rpm-build |
0f2925 |
[poly_out_channel] which are the common IO specifications established
|
|
rpm-build |
0f2925 |
for ExtLib, OCamlNet and Camomile.
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
(see http://www.ocaml-programming.de/tmp/IO-Classes.html for more details).
|
|
rpm-build |
0f2925 |
*)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
class in_channel : input ->
|
|
rpm-build |
0f2925 |
object
|
|
rpm-build |
0f2925 |
method input : Bytes.t -> int -> int -> int
|
|
rpm-build |
0f2925 |
method close_in : unit -> unit
|
|
rpm-build |
0f2925 |
end
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
class out_channel : 'a output ->
|
|
rpm-build |
0f2925 |
object
|
|
rpm-build |
0f2925 |
method output : Bytes.t -> int -> int -> int
|
|
rpm-build |
0f2925 |
method flush : unit -> unit
|
|
rpm-build |
0f2925 |
method close_out : unit -> unit
|
|
rpm-build |
0f2925 |
end
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
class in_chars : input ->
|
|
rpm-build |
0f2925 |
object
|
|
rpm-build |
0f2925 |
method get : unit -> char
|
|
rpm-build |
0f2925 |
method close_in : unit -> unit
|
|
rpm-build |
0f2925 |
end
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
class out_chars : 'a output ->
|
|
rpm-build |
0f2925 |
object
|
|
rpm-build |
0f2925 |
method put : char -> unit
|
|
rpm-build |
0f2925 |
method flush : unit -> unit
|
|
rpm-build |
0f2925 |
method close_out : unit -> unit
|
|
rpm-build |
0f2925 |
end
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
val from_in_channel : #in_channel -> input
|
|
rpm-build |
0f2925 |
val from_out_channel : #out_channel -> unit output
|
|
rpm-build |
0f2925 |
val from_in_chars : #in_chars -> input
|
|
rpm-build |
0f2925 |
val from_out_chars : #out_chars -> unit output
|