2 type bzlib_error
= BZ_CONFIG_ERROR
| BZ_SEQUENCE_ERROR
| BZ_PARAM_ERROR
3 | BZ_MEM_ERROR
| BZ_DATA_ERROR
| BZ_DATA_ERROR_MAGIC
6 let string_of_error = function
7 | BZ_CONFIG_ERROR
-> "Configuration Error"
8 | BZ_SEQUENCE_ERROR
-> "Sequence Error"
9 | BZ_PARAM_ERROR
-> "Invalid Parameter"
10 | BZ_MEM_ERROR
-> "Memory Error"
11 | BZ_DATA_ERROR
-> "Data Error in Bzip2 Stream"
12 | BZ_DATA_ERROR_MAGIC
-> "Bad Magic Number"
13 | BZ_UNKNOWN_ERROR
-> "Unknown"
15 exception Error
of string * bzlib_error
18 Callback.register_exception
"Bzlib.Error" (Error
("",BZ_CONFIG_ERROR
))
22 type action
= BZ_RUN
| BZ_FLUSH
| BZ_FINISH
24 external compress_init
: int -> int -> int -> stream
= "camlzip_bzCompressInit"
26 stream
-> string -> int -> int -> bytes
-> int -> int -> action
28 = "camlzip_bzCompress_bytecode" "camlzip_bzCompress"
29 external compress_end
: stream
-> unit = "camlzip_bzCompressEnd"
32 external decompress_init
: int -> bool -> stream
= "camlzip_bzDecompressInit"
34 stream
-> string -> int -> int -> bytes
-> int -> int -> bool * int * int
35 = "camlzip_bzDecompress_bytecode" "camlzip_bzDecompress"
36 external decompress_end
: stream
-> unit = "camlzip_bzDecompressEnd"
38 external bzlib_version
: unit -> string = "camlzip_bzlibversion"