Natools

Check-in [b05bcfb847]
Login
Overview
Comment:smaz_implementations-base_64_tools: new primitive to check end of input
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b05bcfb847a89fcec717630ecba3a7aa5a53e8e0
User & Date: nat on 2017-02-26 21:43:05
Other Links: manifest | tags
Context
2017-02-27
21:27
smaz_implementations-base_64: check end-of-input in Read_Code check-in: 6c1f9bd682 user: nat tags: trunk
2017-02-26
21:43
smaz_implementations-base_64_tools: new primitive to check end of input check-in: b05bcfb847 user: nat tags: trunk
2017-02-25
20:45
smaz_generic: update semantics of Read_Code to signal end-of-input check-in: b9f0155723 user: nat tags: trunk
Changes

Modified src/natools-smaz_implementations-base_64_tools.adb from [7feeafd1f2] to [b2d369c239].

1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2016, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --

|







1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2016-2017, Natacha Porté                                   --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
224
225
226
227
228
229
230























231
232
233
234
235
236
237
         Offset := Offset + 1;
      end loop;

      Digit := Value (Input (Offset));
      Offset := Offset + 1;
   end Next_Digit;

























   function Symbol_Count (Input : Ada.Streams.Stream_Element_Array)
     return Ada.Streams.Stream_Element_Count
   is
      Result : Ada.Streams.Stream_Element_Count := 0;
   begin
      for S of Input loop







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
         Offset := Offset + 1;
      end loop;

      Digit := Value (Input (Offset));
      Offset := Offset + 1;
   end Next_Digit;


   procedure Next_Digit_Or_End
     (Input : in Ada.Streams.Stream_Element_Array;
      Offset : in out Ada.Streams.Stream_Element_Offset;
      Digit : out Base_64_Digit;
      Finished : out Boolean) is
   begin
      loop
         if Offset not in Input'Range then
            Finished := True;
            return;
         end if;

         exit when Input (Offset) in Base_64_Symbol;

         Offset := Offset + 1;
      end loop;

      Digit := Value (Input (Offset));
      Finished := False;
      Offset := Offset + 1;
   end Next_Digit_Or_End;


   function Symbol_Count (Input : Ada.Streams.Stream_Element_Array)
     return Ada.Streams.Stream_Element_Count
   is
      Result : Ada.Streams.Stream_Element_Count := 0;
   begin
      for S of Input loop

Modified src/natools-smaz_implementations-base_64_tools.ads from [e8183a18cc] to [4dab4c3f88].

1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2016, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --

|







1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2016-2017, Natacha Porté                                   --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
138
139
140
141
142
143
144





145
146
147
      Padding : out Single_Byte_Padding);


   procedure Next_Digit
     (Input : in Ada.Streams.Stream_Element_Array;
      Offset : in out Ada.Streams.Stream_Element_Offset;
      Digit : out Base_64_Digit);





      --  Look for the first valid symbol in Input from Offset, and decode it

end Natools.Smaz_Implementations.Base_64_Tools;







>
>
>
>
>



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
      Padding : out Single_Byte_Padding);


   procedure Next_Digit
     (Input : in Ada.Streams.Stream_Element_Array;
      Offset : in out Ada.Streams.Stream_Element_Offset;
      Digit : out Base_64_Digit);
   procedure Next_Digit_Or_End
     (Input : in Ada.Streams.Stream_Element_Array;
      Offset : in out Ada.Streams.Stream_Element_Offset;
      Digit : out Base_64_Digit;
      Finished : out Boolean);
      --  Look for the first valid symbol in Input from Offset, and decode it

end Natools.Smaz_Implementations.Base_64_Tools;