Natools

Check-in [f85deca432]
Login
Overview
Comment:smaz: add functions that return directly the filtered array
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f85deca432658aa36ae1247b103d99e5e7ab203b
User & Date: nat on 2016-09-17 19:15:37
Other Links: manifest | tags
Context
2016-09-18
21:06
smaz-tests: rewrite Roundtrip_Test to make both roundtrip directions check-in: 21fd02233a user: nat tags: trunk
2016-09-17
19:15
smaz: add functions that return directly the filtered array check-in: f85deca432 user: nat tags: trunk
2016-09-16
19:59
smaz: merge verbatim blocks when it improves compression check-in: 90bba135f9 user: nat tags: trunk
Changes

Modified src/natools-smaz.adb from [860a7091a3] to [17ad5eb887].

258
259
260
261
262
263
264












265
266
267
268
269
270
271
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283







+
+
+
+
+
+
+
+
+
+
+
+







               Verbatim_Length := Verbatim_Length - Block_Length;
               Beginning := Beginning + Block_Length;
            end loop Verbatim_Encode;
         end Verbatim_Block;
      end loop Main_Loop;
   end Compress;


   function Compress (Dict : in Dictionary; Input : in String)
     return Ada.Streams.Stream_Element_Array
   is
      Result : Ada.Streams.Stream_Element_Array
        (1 .. Compressed_Upper_Bound (Dict, Input) + 1);
      Last : Ada.Streams.Stream_Element_Offset;
   begin
      Compress (Dict, Input, Result, Last);
      return Result (Result'First .. Last);
   end Compress;


   function Decompressed_Length
     (Dict : in Dictionary;
      Input : in Ada.Streams.Stream_Element_Array)
     return Natural
   is
      Result : Natural := 0;
355
356
357
358
359
360
361













362
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387







+
+
+
+
+
+
+
+
+
+
+
+
+


            Append (Input (Input_Index + 1 .. Input_Index + Verbatim_Length));
            Input_Index := Input_Index + Verbatim_Length + 1;
         end if;
      end loop;
   end Decompress;


   function Decompress
     (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array)
     return String
   is
      Result : String (1 .. Decompressed_Length (Dict, Input));
      Last : Natural;
   begin
      Decompress (Dict, Input, Result, Last);
      pragma Assert (Last = Result'Last);
      return Result;
   end Decompress;

end Natools.Smaz;

Modified src/natools-smaz.ads from [13c2fce4a1] to [ddb34c3613].

50
51
52
53
54
55
56



57
58
59
60
61
62
63
64
65
66
67
68




69
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76







+
+
+












+
+
+
+


   procedure Compress
     (Dict : in Dictionary;
      Input : in String;
      Output_Buffer : out Ada.Streams.Stream_Element_Array;
      Output_Last : out Ada.Streams.Stream_Element_Offset);

   function Compress (Dict : in Dictionary; Input : in String)
     return Ada.Streams.Stream_Element_Array;


   function Decompressed_Length
     (Dict : in Dictionary;
      Input : in Ada.Streams.Stream_Element_Array)
     return Natural;

   procedure Decompress
     (Dict : in Dictionary;
      Input : in Ada.Streams.Stream_Element_Array;
      Output_Buffer : out String;
      Output_Last : out Natural);

   function Decompress
     (Dict : in Dictionary; Input : in Ada.Streams.Stream_Element_Array)
     return String;

end Natools.Smaz;