patch #7303
[mldonkey.git] / src / utils / cdk / bzlib.ml
blob949866ec1a686cd837e3b390dd05f0d9a5812949
2 type bzlib_error = BZ_CONFIG_ERROR | BZ_SEQUENCE_ERROR | BZ_PARAM_ERROR
3 | BZ_MEM_ERROR | BZ_DATA_ERROR | BZ_DATA_ERROR_MAGIC
4 | BZ_UNKNOWN_ERROR
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
17 let _ =
18 Callback.register_exception "Bzlib.Error" (Error("",BZ_CONFIG_ERROR))
20 type stream
22 type action = BZ_RUN | BZ_FLUSH | BZ_FINISH
24 external compress_init: int -> int -> int -> stream = "camlzip_bzCompressInit"
25 external compress:
26 stream -> string -> int -> int -> string -> int -> int -> action
27 -> bool * int * int
28 = "camlzip_bzCompress_bytecode" "camlzip_bzCompress"
29 external compress_end: stream -> unit = "camlzip_bzCompressEnd"
32 external decompress_init: int -> bool -> stream = "camlzip_bzDecompressInit"
33 external decompress:
34 stream -> string -> int -> int -> string -> 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"