1b33c96954667ba382fa595baf7b31290bfdd517vboxsync----------------------------------------------------------------
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync-- ZLib for Ada thick binding. --
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync-- Open source license information is in the zlib.ads file. --
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync----------------------------------------------------------------
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync type Stream_Mode is (In_Stream, Out_Stream, Duplex);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync type Stream_Type is
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync new Ada.Streams.Root_Stream_Type with private;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync procedure Read
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync (Stream : in out Stream_Type;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync procedure Write
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync (Stream : in out Stream_Type;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync procedure Flush
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync (Stream : in out Stream_Type;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Mode : in Flush_Mode := Sync_Flush);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Flush the written data to the back stream,
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- all data placed to the compressor is flushing to the Back stream.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Should not be used untill necessary, becouse it is decreasing
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- compression.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync function Read_Total_In (Stream : in Stream_Type) return Count;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync pragma Inline (Read_Total_In);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Return total number of bytes read from back stream so far.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync function Read_Total_Out (Stream : in Stream_Type) return Count;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync pragma Inline (Read_Total_Out);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Return total number of bytes read so far.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync function Write_Total_In (Stream : in Stream_Type) return Count;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync pragma Inline (Write_Total_In);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Return total number of bytes written so far.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync function Write_Total_Out (Stream : in Stream_Type) return Count;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync pragma Inline (Write_Total_Out);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Return total number of bytes written to the back stream.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync procedure Create
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync (Stream : out Stream_Type;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Mode : in Stream_Mode;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Back : in Stream_Access;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Back_Compressed : in Boolean;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Level : in Compression_Level := Default_Compression;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Strategy : in Strategy_Type := Default_Strategy;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Header : in Header_Type := Default;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync := Default_Buffer_Size;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync := Default_Buffer_Size);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Create the Comression/Decompression stream.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- If mode is In_Stream then Write operation is disabled.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- If mode is Out_Stream then Read operation is disabled.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- If Back_Compressed is true then
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Data written to the Stream is compressing to the Back stream
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- and data read from the Stream is decompressed data from the Back stream.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- If Back_Compressed is false then
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Data written to the Stream is decompressing to the Back stream
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- and data read from the Stream is compressed data from the Back stream.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- !!! When the Need_Header is False ZLib-Ada is using undocumented
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync function Is_Open (Stream : Stream_Type) return Boolean;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync procedure Close (Stream : in out Stream_Type);
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync type Buffer_Access is access all Stream_Element_Array;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync type Stream_Type
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync is new Root_Stream_Type with
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Mode : Stream_Mode;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Buffer : Buffer_Access;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Rest_First : Stream_Element_Offset;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Rest_Last : Stream_Element_Offset;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Buffer for Read operation.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- We need to have this buffer in the record
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- becouse not all read data from back stream
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- could be processed during the read operation.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Buffer_Size : Stream_Element_Offset;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- Buffer size for write operation.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- We do not need to have this buffer
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- in the record becouse all data could be
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync -- processed in the write operation.
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Back : Stream_Access;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Reader : Filter_Type;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync Writer : Filter_Type;
1b33c96954667ba382fa595baf7b31290bfdd517vboxsync end record;