annotate src/zlib-1.2.8/contrib/ada/zlib-streams.ads @ 84:08ae793730bd

Add null config files
author Chris Cannam
date Mon, 02 Mar 2020 14:03:47 +0000
parents 5ea0608b923f
children
rev   line source
Chris@43 1 ----------------------------------------------------------------
Chris@43 2 -- ZLib for Ada thick binding. --
Chris@43 3 -- --
Chris@43 4 -- Copyright (C) 2002-2003 Dmitriy Anisimkov --
Chris@43 5 -- --
Chris@43 6 -- Open source license information is in the zlib.ads file. --
Chris@43 7 ----------------------------------------------------------------
Chris@43 8
Chris@43 9 -- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $
Chris@43 10
Chris@43 11 package ZLib.Streams is
Chris@43 12
Chris@43 13 type Stream_Mode is (In_Stream, Out_Stream, Duplex);
Chris@43 14
Chris@43 15 type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class;
Chris@43 16
Chris@43 17 type Stream_Type is
Chris@43 18 new Ada.Streams.Root_Stream_Type with private;
Chris@43 19
Chris@43 20 procedure Read
Chris@43 21 (Stream : in out Stream_Type;
Chris@43 22 Item : out Ada.Streams.Stream_Element_Array;
Chris@43 23 Last : out Ada.Streams.Stream_Element_Offset);
Chris@43 24
Chris@43 25 procedure Write
Chris@43 26 (Stream : in out Stream_Type;
Chris@43 27 Item : in Ada.Streams.Stream_Element_Array);
Chris@43 28
Chris@43 29 procedure Flush
Chris@43 30 (Stream : in out Stream_Type;
Chris@43 31 Mode : in Flush_Mode := Sync_Flush);
Chris@43 32 -- Flush the written data to the back stream,
Chris@43 33 -- all data placed to the compressor is flushing to the Back stream.
Chris@43 34 -- Should not be used untill necessary, becouse it is decreasing
Chris@43 35 -- compression.
Chris@43 36
Chris@43 37 function Read_Total_In (Stream : in Stream_Type) return Count;
Chris@43 38 pragma Inline (Read_Total_In);
Chris@43 39 -- Return total number of bytes read from back stream so far.
Chris@43 40
Chris@43 41 function Read_Total_Out (Stream : in Stream_Type) return Count;
Chris@43 42 pragma Inline (Read_Total_Out);
Chris@43 43 -- Return total number of bytes read so far.
Chris@43 44
Chris@43 45 function Write_Total_In (Stream : in Stream_Type) return Count;
Chris@43 46 pragma Inline (Write_Total_In);
Chris@43 47 -- Return total number of bytes written so far.
Chris@43 48
Chris@43 49 function Write_Total_Out (Stream : in Stream_Type) return Count;
Chris@43 50 pragma Inline (Write_Total_Out);
Chris@43 51 -- Return total number of bytes written to the back stream.
Chris@43 52
Chris@43 53 procedure Create
Chris@43 54 (Stream : out Stream_Type;
Chris@43 55 Mode : in Stream_Mode;
Chris@43 56 Back : in Stream_Access;
Chris@43 57 Back_Compressed : in Boolean;
Chris@43 58 Level : in Compression_Level := Default_Compression;
Chris@43 59 Strategy : in Strategy_Type := Default_Strategy;
Chris@43 60 Header : in Header_Type := Default;
Chris@43 61 Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset
Chris@43 62 := Default_Buffer_Size;
Chris@43 63 Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
Chris@43 64 := Default_Buffer_Size);
Chris@43 65 -- Create the Comression/Decompression stream.
Chris@43 66 -- If mode is In_Stream then Write operation is disabled.
Chris@43 67 -- If mode is Out_Stream then Read operation is disabled.
Chris@43 68
Chris@43 69 -- If Back_Compressed is true then
Chris@43 70 -- Data written to the Stream is compressing to the Back stream
Chris@43 71 -- and data read from the Stream is decompressed data from the Back stream.
Chris@43 72
Chris@43 73 -- If Back_Compressed is false then
Chris@43 74 -- Data written to the Stream is decompressing to the Back stream
Chris@43 75 -- and data read from the Stream is compressed data from the Back stream.
Chris@43 76
Chris@43 77 -- !!! When the Need_Header is False ZLib-Ada is using undocumented
Chris@43 78 -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers.
Chris@43 79
Chris@43 80 function Is_Open (Stream : Stream_Type) return Boolean;
Chris@43 81
Chris@43 82 procedure Close (Stream : in out Stream_Type);
Chris@43 83
Chris@43 84 private
Chris@43 85
Chris@43 86 use Ada.Streams;
Chris@43 87
Chris@43 88 type Buffer_Access is access all Stream_Element_Array;
Chris@43 89
Chris@43 90 type Stream_Type
Chris@43 91 is new Root_Stream_Type with
Chris@43 92 record
Chris@43 93 Mode : Stream_Mode;
Chris@43 94
Chris@43 95 Buffer : Buffer_Access;
Chris@43 96 Rest_First : Stream_Element_Offset;
Chris@43 97 Rest_Last : Stream_Element_Offset;
Chris@43 98 -- Buffer for Read operation.
Chris@43 99 -- We need to have this buffer in the record
Chris@43 100 -- becouse not all read data from back stream
Chris@43 101 -- could be processed during the read operation.
Chris@43 102
Chris@43 103 Buffer_Size : Stream_Element_Offset;
Chris@43 104 -- Buffer size for write operation.
Chris@43 105 -- We do not need to have this buffer
Chris@43 106 -- in the record becouse all data could be
Chris@43 107 -- processed in the write operation.
Chris@43 108
Chris@43 109 Back : Stream_Access;
Chris@43 110 Reader : Filter_Type;
Chris@43 111 Writer : Filter_Type;
Chris@43 112 end record;
Chris@43 113
Chris@43 114 end ZLib.Streams;