Commit dc4c6e87 authored by Maxime Perrotin's avatar Maxime Perrotin

Improve iteration of enumerated arrays

parent 43bca318
package body ASN1_Iterators.Generic_Basic is
procedure Initialize (self: in out Basic_ASN1_Iterator) is
begin
--Self.Value := create;
Self.Value.Initialize;
end;
......
......@@ -16,7 +16,7 @@ package ASN1_Iterators.Generic_Enumerated is
function Has_Elem (Value: Sort) return Boolean;
-- function Has_Elem (Value: Sort) return Boolean is (Value <= Sort'Last);
function Elem_First return Sort is (Sort'First);
function Elem_First return Sort is (Elem_Init); -- Sort'First);
function Elem_Next (Value: Sort) return Sort is
(if Is_Last then Sort'Last else Sort'Succ (Value));
......
......@@ -28,13 +28,13 @@ package body ASN1_Iterators.Generic_Fixed_SeqOf is
Ptr_elem : P.Iterator_Ptr := P.Ptr(Item.Ptr.FirstIt);
begin
-- Initialize the iterator (Compute first value)
Item.Ptr.FirstIt := P.Iterator(Item.Ptr.FirstVal.Iterate);
Ptr_elem := P.First(Item.Ptr.FirstIt);
Item.Ptr.Value.Data(1) := P.Elem_Value(Item.Ptr.FirstVal,
Item.Ptr.FirstIt := P.Iterator (Item.Ptr.FirstVal.Iterate);
Ptr_elem := P.First (Item.Ptr.FirstIt);
Item.Ptr.Value.Data(1) := P.Elem_Value (Item.Ptr.FirstVal,
Ptr_elem);
if Item.Ptr.Length > 1 then
Item.Ptr.Value.Data(2 .. Item.Ptr.Length) :=
Item.Ptr.RestIt.Ptr.Value.Data(1..Item.Ptr.RestIt.Ptr.Length);
Item.Ptr.Value.Data (2 .. Item.Ptr.Length) :=
Item.Ptr.RestIt.Ptr.Value.Data (1 .. Item.Ptr.RestIt.Ptr.Length);
end if;
return Item.Ptr;
end;
......
......@@ -3,7 +3,7 @@ with Ada.Iterator_Interfaces;
with Ada.Finalization;
use Ada.Finalization;
with ASN1_Iterators.Generic_Fixed_SeqOF,
with ASN1_Iterators.Generic_Fixed_SeqOf,
ASN1_Iterators.Generic_Integer,
ASN1_Iterators.Generic_Basic;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment