Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taste-model-checker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TASTE
taste-model-checker
Commits
d20683a4
Commit
d20683a4
authored
Dec 01, 2019
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on iterators
parent
40c02b44
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
246 additions
and
229 deletions
+246
-229
asn1-iterators/src/asn1_iterators-generic_basic.adb
asn1-iterators/src/asn1_iterators-generic_basic.adb
+3
-3
asn1-iterators/src/asn1_iterators-generic_basic.ads
asn1-iterators/src/asn1_iterators-generic_basic.ads
+29
-29
asn1-iterators/src/asn1_iterators-generic_enumerated.ads
asn1-iterators/src/asn1_iterators-generic_enumerated.ads
+13
-13
asn1-iterators/src/asn1_iterators-generic_fixed_seqof.adb
asn1-iterators/src/asn1_iterators-generic_fixed_seqof.adb
+2
-2
asn1-iterators/src/asn1_iterators-generic_fixed_seqof.ads
asn1-iterators/src/asn1_iterators-generic_fixed_seqof.ads
+40
-40
asn1-iterators/src/asn1_iterators-generic_integer.ads
asn1-iterators/src/asn1_iterators-generic_integer.ads
+17
-17
asn1-iterators/src/asn1_iterators-generic_seqof.adb
asn1-iterators/src/asn1_iterators-generic_seqof.adb
+1
-1
asn1-iterators/src/asn1_iterators-generic_seqof.ads
asn1-iterators/src/asn1_iterators-generic_seqof.ads
+57
-59
asn1-iterators/src/asn1_iterators-generic_unsigned_integer.ads
...iterators/src/asn1_iterators-generic_unsigned_integer.ads
+17
-17
asn1-iterators/src/asn1_iterators-iterable_seqof.adb
asn1-iterators/src/asn1_iterators-iterable_seqof.adb
+2
-2
asn1-iterators/src/asn1_iterators-simpletypes.ads
asn1-iterators/src/asn1_iterators-simpletypes.ads
+16
-16
asn1-iterators/src/asn1_iterators.ads
asn1-iterators/src/asn1_iterators.ads
+1
-1
asn1-iterators/test/asn1_iterators-myseq.adb
asn1-iterators/test/asn1_iterators-myseq.adb
+23
-23
asn1-iterators/test/asn1_iterators-myseq.ads
asn1-iterators/test/asn1_iterators-myseq.ads
+3
-6
asn1-iterators/test/test_generic.adb
asn1-iterators/test/test_generic.adb
+9
-0
asn1-iterators/test_generic.gpr
asn1-iterators/test_generic.gpr
+13
-0
No files found.
asn1-iterators/src/asn1_iterators-generic_basic.adb
View file @
d20683a4
...
...
@@ -16,10 +16,10 @@ package body ASN1_Iterators.Generic_Basic is
Self
.
Is_Valid
:=
True
;
end
;
function
Has_Element
(
Ptr
:
Iterator_Pt
r
)
return
Boolean
is
function
Has_Element
(
Ptr
:
Curso
r
)
return
Boolean
is
(
Ptr
.
Value
.
Has_Element
and
Ptr
.
Is_Valid
);
function
First
(
Item
:
Iterator
)
return
Iterator_Pt
r
is
function
First
(
Item
:
Iterator
)
return
Curso
r
is
begin
Item
.
Ptr
.
Value
.
First
;
-- Reset validity flag
...
...
@@ -28,7 +28,7 @@ package body ASN1_Iterators.Generic_Basic is
end
;
function
Next
(
Item
:
Iterator
;
Ptr
:
Iterator_Ptr
)
return
Iterator_Pt
r
is
Ptr
:
Cursor
)
return
Curso
r
is
pragma
Unreferenced
(
Item
);
begin
Ptr
.
Value
.
Next
;
...
...
asn1-iterators/src/asn1_iterators-generic_basic.ads
View file @
d20683a4
...
...
@@ -4,44 +4,44 @@ use Ada.Finalization;
with
ASN1_Iterators
.
SimpleTypes
;
generic
with
package
P
is
new
SimpleTypes
(
<>
);
with
package
P
is
new
SimpleTypes
(
<>
);
package
ASN1_Iterators
.
Generic_Basic
is
--
Provides an iterator for a basic type
subtype
Sort
is
P
.
Sort
;
--
Provides an iterator for a basic type
subtype
Sort
is
P
.
Sort
;
type
Basic_ASN1_Iterator
is
new
Controlled
with
record
Value
:
P
.
SimpleType
;
Is_Valid
:
Boolean
:=
True
;
end
record
with
Default_Iterator
=>
Iterate
,
Iterator_Element
=>
P
.
Sort
,
Constant_Indexing
=>
Elem_Value
;
type
Basic_ASN1_Iterator
is
new
Controlled
with
record
Value
:
P
.
SimpleType
;
Is_Valid
:
Boolean
:=
True
;
end
record
with
Default_Iterator
=>
Iterate
,
Iterator_Element
=>
P
.
Sort
,
Constant_Indexing
=>
Elem_Value
;
procedure
Initialize
(
self
:
in
out
Basic_ASN1_Iterator
);
procedure
Initialize
(
self
:
in
out
Basic_ASN1_Iterator
);
type
Iterator_Pt
r
is
access
all
Basic_ASN1_Iterator
;
type
Curso
r
is
access
all
Basic_ASN1_Iterator
;
function
Has_Element
(
Ptr
:
Iterator_Pt
r
)
return
Boolean
;
function
Has_Element
(
Ptr
:
Curso
r
)
return
Boolean
;
package
Iterators
is
new
Ada
.
Iterator_Interfaces
(
Iterator_Pt
r
,
Has_Element
);
package
Iterators
is
new
Ada
.
Iterator_Interfaces
(
Curso
r
,
Has_Element
);
type
Iterator
is
new
Iterators
.
Forward_Iterator
with
record
Ptr
:
Iterator_Pt
r
;
end
record
;
type
Iterator
is
new
Iterators
.
Forward_Iterator
with
record
Ptr
:
Curso
r
;
end
record
;
function
Ptr
(
Item
:
Iterator
)
return
Iterator_Pt
r
is
(
Item
.
Ptr
);
function
Ptr
(
Item
:
Iterator
)
return
Curso
r
is
(
Item
.
Ptr
);
overriding
function
First
(
Item
:
Iterator
)
return
Iterator_Pt
r
;
overriding
function
Next
(
Item
:
Iterator
;
Ptr
:
Iterator_Ptr
)
return
Iterator_Pt
r
;
overriding
function
First
(
Item
:
Iterator
)
return
Curso
r
;
overriding
function
Next
(
Item
:
Iterator
;
Ptr
:
Cursor
)
return
Curso
r
;
subtype
Forward_Iterator
is
Iterators
.
Forward_Iterator
'
Class
;
subtype
Forward_Iterator
is
Iterators
.
Forward_Iterator
'
Class
;
function
Iterate
(
Self
:
Basic_ASN1_Iterator
)
return
Forward_Iterator
;
function
Iterate
(
Self
:
Basic_ASN1_Iterator
)
return
Forward_Iterator
;
function
Elem_Value
(
Self
:
Basic_ASN1_Iterator
;
Ptr
:
Iterator_Pt
r
)
return
P
.
Sort
is
(
Ptr
.
Value
.
Element_Value
);
end
;
function
Elem_Value
(
Self
:
Basic_ASN1_Iterator
;
Ptr
:
Curso
r
)
return
P
.
Sort
is
(
Ptr
.
Value
.
Element_Value
);
end
ASN1_Iterators
.
Generic_Basic
;
asn1-iterators/src/asn1_iterators-generic_enumerated.ads
View file @
d20683a4
...
...
@@ -5,22 +5,22 @@ with Interfaces;
use
Interfaces
;
generic
type
Sort
is
(
<>
);
-- a discrete type, such as enumerated
type
Sort
is
(
<>
);
-- a discrete type, such as enumerated
package
ASN1_Iterators
.
Generic_Enumerated
is
function
Elem_Init
return
Sort
;
function
Elem_Init
return
Sort
;
function
Has_Elem
(
Value
:
Sort
)
return
Boolean
;
function
Elem_First
return
Sort
is
(
Sort
'
First
);
function
Elem_Next
(
Value
:
Sort
)
return
Sort
;
function
Has_Elem
(
Value
:
Sort
)
return
Boolean
;
function
Elem_First
return
Sort
is
(
Sort
'
First
);
function
Elem_Next
(
Value
:
Sort
)
return
Sort
;
package
Discrete_Type
is
new
SimpleTypes
(
Sort
=>
Sort
,
Elem_Init
=>
Elem_Init
,
Has_Elem
=>
Has_Elem
,
Elem_First
=>
Elem_First
,
Elem_Next
=>
Elem_Next
);
package
Discrete_Type
is
new
SimpleTypes
(
Sort
=>
Sort
,
Elem_Init
=>
Elem_Init
,
Has_Elem
=>
Has_Elem
,
Elem_First
=>
Elem_First
,
Elem_Next
=>
Elem_Next
);
package
It
is
new
Generic_Basic
(
P
=>
Discrete_Type
);
package
It
is
new
Generic_Basic
(
P
=>
Discrete_Type
);
subtype
Instance
is
It
.
Basic_ASN1_Iterator
;
end
;
subtype
Instance
is
It
.
Basic_ASN1_Iterator
;
end
ASN1_Iterators
.
Generic_Enumerated
;
asn1-iterators/src/asn1_iterators-generic_fixed_seqof.adb
View file @
d20683a4
...
...
@@ -25,7 +25,7 @@ package body ASN1_Iterators.Generic_Fixed_SeqOf is
function
First
(
Item
:
ASN1_SeqOf_It
)
return
ASN1_SeqOf_Ptr
is
Ptr_Elem
:
P
.
Iterator_Pt
r
:=
P
.
Ptr
(
Item
.
Ptr
.
FirstIt
);
Ptr_Elem
:
P
.
Curso
r
:=
P
.
Ptr
(
Item
.
Ptr
.
FirstIt
);
begin
-- Initialize the iterator (Compute first value)
Item
.
Ptr
.
FirstIt
:=
P
.
Iterator
(
Item
.
Ptr
.
FirstVal
.
Iterate
);
...
...
@@ -42,7 +42,7 @@ package body ASN1_Iterators.Generic_Fixed_SeqOf is
function
Next
(
Item
:
ASN1_SeqOf_It
;
Ptr
:
ASN1_SeqOf_Ptr
)
return
ASN1_SeqOf_Ptr
is
pragma
Unreferenced
(
Item
);
Ptr_elem
:
P
.
Iterator_Pt
r
:=
P
.
Ptr
(
Ptr
.
FirstIt
);
Ptr_elem
:
P
.
Curso
r
:=
P
.
Ptr
(
Ptr
.
FirstIt
);
begin
if
Ptr
.
Length
>
1
then
Ptr
.
RestIt
.
Ptr
:=
Ptr
.
RestIt
.
Next
(
Ptr
.
RestIt
.
Ptr
);
...
...
asn1-iterators/src/asn1_iterators-generic_fixed_seqof.ads
View file @
d20683a4
...
...
@@ -7,56 +7,56 @@ with ASN1_Iterators.Generic_Basic;
with
ASN1_Iterators
.
SimpleTypes
;
generic
with
package
P
is
new
Generic_Basic
(
<>
);
with
package
P
is
new
Generic_Basic
(
<>
);
package
ASN1_Iterators
.
Generic_Fixed_SeqOf
is
type
DataArray
is
array
(
natural
range
<>
)
of
P
.
Sort
;
type
SeqOf
(
Max
:
Natural
)
is
record
Length
:
Integer
;
Data
:
DataArray
(
1
..
Max
);
end
record
;
type
ASN1_SeqOf_Ptr
;
type
ASN1_SeqOf_It
;
type
ASN1_SeqOf
(
Size
:
Natural
)
is
new
Controlled
with
record
Length
:
Natural
:=
Size
;
Value
:
SeqOf
(
Size
);
--
First value
FirstVal
:
P
.
Basic_ASN1_Iterator
;
FirstIt
:
P
.
Iterator
;
-- The rest (recursive)
Rest
:
access
ASN1_SeqOf
;
RestIt
:
access
ASN1_SeqOf_It
;
end
record
type
DataArray
is
array
(
natural
range
<>
)
of
P
.
Sort
;
type
SeqOf
(
Max
:
Natural
)
is
record
Length
:
Integer
;
Data
:
DataArray
(
1
..
Max
);
end
record
;
type
ASN1_SeqOf_Ptr
;
type
ASN1_SeqOf_It
;
type
ASN1_SeqOf
(
Size
:
Natural
)
is
new
Controlled
with
record
Length
:
Natural
:=
Size
;
Value
:
SeqOf
(
Size
);
--
First value
FirstVal
:
P
.
Basic_ASN1_Iterator
;
FirstIt
:
P
.
Iterator
;
-- The rest (recursive)
Rest
:
access
ASN1_SeqOf
;
RestIt
:
access
ASN1_SeqOf_It
;
end
record
with
Default_Iterator
=>
Iterate
,
Iterator_Element
=>
SeqOf
,
Constant_Indexing
=>
Element_SeqOf_Value
;
type
ASN1_SeqOf_Ptr
is
access
all
ASN1_SeqOf
;
type
ASN1_SeqOf_Ptr
is
access
all
ASN1_SeqOf
;
-- Constructor (called automatically)
procedure
Initialize
(
Self
:
in
out
ASN1_SeqOf
);
-- Constructor (called automatically)
procedure
Initialize
(
Self
:
in
out
ASN1_SeqOf
);
function
Has_Element_SeqOf
(
Ptr
:
ASN1_SeqOf_Ptr
)
return
Boolean
;
function
Has_Element_SeqOf
(
Ptr
:
ASN1_SeqOf_Ptr
)
return
Boolean
;
package
Iterators_SeqOf
is
new
Ada
.
Iterator_Interfaces
(
ASN1_SeqOf_Ptr
,
Has_Element_SeqOf
);
package
Iterators_SeqOf
is
new
Ada
.
Iterator_Interfaces
(
ASN1_SeqOf_Ptr
,
Has_Element_SeqOf
);
type
ASN1_SeqOf_It
is
new
Iterators_SeqOf
.
Forward_Iterator
with
record
Ptr
:
ASN1_SeqOf_Ptr
;
end
record
;
type
ASN1_SeqOf_It
is
new
Iterators_SeqOf
.
Forward_Iterator
with
record
Ptr
:
ASN1_SeqOf_Ptr
;
end
record
;
overriding
function
First
(
Item
:
ASN1_SeqOf_It
)
return
ASN1_SeqOf_Ptr
;
overriding
function
Next
(
Item
:
ASN1_SeqOf_It
;
Ptr
:
ASN1_SeqOf_Ptr
)
return
ASN1_SeqOf_Ptr
;
overriding
function
First
(
Item
:
ASN1_SeqOf_It
)
return
ASN1_SeqOf_Ptr
;
overriding
function
Next
(
Item
:
ASN1_SeqOf_It
;
Ptr
:
ASN1_SeqOf_Ptr
)
return
ASN1_SeqOf_Ptr
;
function
Iterate
(
self
:
ASN1_SeqOf
)
return
ASN1_SeqOf_It
'
Class
;
-- Iterators_SeqOf.Forward_Iterator
'Class;
function
Iterate
(
self
:
ASN1_SeqOf
)
return
ASN1_SeqOf_It
'
Class
;
function
Element_SeqOf_Value
(
Self
:
ASN1_SeqOf
;
Ptr
:
ASN1_SeqOf_Ptr
)
return
SeqOf
is
(
self
.
Value
);
end
;
function
Element_SeqOf_Value
(
Self
:
ASN1_SeqOf
;
Ptr
:
ASN1_SeqOf_Ptr
)
return
SeqOf
is
(
self
.
Value
);
end
ASN1_Iterators
.
Generic_Fixed_SeqOf
;
asn1-iterators/src/asn1_iterators-generic_integer.ads
View file @
d20683a4
...
...
@@ -5,27 +5,27 @@ with Interfaces,
use
Interfaces
;
generic
Min
:
Interfaces
.
Integer_64
;
Max
:
Interfaces
.
Integer_64
;
Min
:
Interfaces
.
Integer_64
;
Max
:
Interfaces
.
Integer_64
;
package
ASN1_Iterators
.
Generic_Integer
is
function
Elem_Init
return
Interfaces
.
Integer_64
is
(
Min
);
function
Elem_Init
return
Interfaces
.
Integer_64
is
(
Min
);
function
Has_Elem
(
Value
:
Interfaces
.
Integer_64
)
return
Boolean
is
(
Value
<=
Max
);
function
Has_Elem
(
Value
:
Interfaces
.
Integer_64
)
return
Boolean
is
(
Value
<=
Max
);
function
Elem_First
return
Interfaces
.
Integer_64
is
(
Min
);
function
Elem_First
return
Interfaces
.
Integer_64
is
(
Min
);
function
Elem_Next
(
Value
:
Interfaces
.
Integer_64
)
return
Interfaces
.
Integer_64
is
(
Value
+
1
);
function
Elem_Next
(
Value
:
Interfaces
.
Integer_64
)
return
Interfaces
.
Integer_64
is
(
Value
+
1
);
package
Signed_Integer
is
new
SimpleTypes
(
Sort
=>
Interfaces
.
Integer_64
,
Elem_Init
=>
Elem_Init
,
Has_Elem
=>
Has_Elem
,
Elem_First
=>
Elem_First
,
Elem_Next
=>
Elem_Next
);
package
Signed_Integer
is
new
SimpleTypes
(
Sort
=>
Interfaces
.
Integer_64
,
Elem_Init
=>
Elem_Init
,
Has_Elem
=>
Has_Elem
,
Elem_First
=>
Elem_First
,
Elem_Next
=>
Elem_Next
);
package
It
is
new
Generic_Basic
(
P
=>
Signed_Integer
);
package
It
is
new
Generic_Basic
(
P
=>
Signed_Integer
);
subtype
Instance
is
It
.
Basic_ASN1_Iterator
;
end
;
subtype
Instance
is
It
.
Basic_ASN1_Iterator
;
end
ASN1_Iterators
.
Generic_Integer
;
asn1-iterators/src/asn1_iterators-generic_seqof.adb
View file @
d20683a4
...
...
@@ -39,7 +39,7 @@ package body ASN1_Iterators.Generic_SeqOf is
return
ASN1_Variable_SeqOf_Ptr
is
pragma
Unreferenced
(
Item
);
Ptr_elem
:
Length_Pkg
.
Iterator_Pt
r
:=
Length_Pkg
.
Ptr
(
Ptr
.
LenIt
);
Ptr_elem
:
Length_Pkg
.
Curso
r
:=
Length_Pkg
.
Ptr
(
Ptr
.
LenIt
);
begin
Ptr
.
RestIt
.
Ptr
:=
Ptr
.
RestIt
.
Next
(
Ptr
.
RestIt
.
Ptr
);
if
P
.
Has_Element_SeqOf
(
Ptr
.
RestIt
.
Ptr
)
then
...
...
asn1-iterators/src/asn1_iterators-generic_seqof.ads
View file @
d20683a4
...
...
@@ -10,73 +10,71 @@ with ASN1_Iterators.Generic_Fixed_SeqOf,
with
Interfaces
;
use
Interfaces
;
-- Iterator for a variable-size array of basic type
--
Iterator for a variable-size array of basic type
generic
Min
:
Natural
;
Max
:
Natural
;
with
package
Basic
is
new
Generic_Basic
(
<>
);
Min
:
Natural
;
Max
:
Natural
;
with
package
Basic
is
new
Generic_Basic
(
<>
);
package
ASN1_Iterators
.
Generic_SeqOf
is
P
ackage
P
is
new
Generic_Fixed_SeqOF
(
P
=>
Basic
);
--
Create an integer type with a range constraint to iterate on
package
Length_ty
is
new
Generic_Integer
(
Integer_64
(
Min
),
Integer_64
(
Max
));
--
Instantiate the package to iterate on the integer for the length
package
Length_Pkg
renames
Length_ty
.
It
;
type
ASN1_Variable_SeqOf_Ptr
is
private
;
subtype
MySeqOf
is
P
.
SeqOf
(
Max
);
type
ASN1_Variable_SeqOf
is
new
Controlled
with
record
Length
:
Natural
:=
Min
;
Value
:
MySeqOf
;
-- P.SeqOf(Max)
;
-- Iterate on the length
LenVal
:
Length_ty
.
Instance
;
LenIt
:
Length_Pkg
.
Iterator
;
-- And on the value
RestVal
:
access
P
.
ASN1_SeqOf
;
RestIt
:
access
P
.
ASN1_SeqOf_It
;
end
record
with
Default_Iterator
=>
Iterate
,
Iterator_Element
=>
MySeqOf
,
--P.
SeqOf,
Constant_Indexing
=>
Element_Variable_SeqOf_Value
;
-- Constructor (called automatically)
procedure
Initialize
(
self
:
in
out
ASN1_Variable_SeqOf
);
function
Has_Element_Variable_SeqOf
(
Ptr
:
ASN1_Variable_SeqOf_Ptr
)
return
Boolean
;
package
Iterators_Variable_SeqOf
is
new
Ada
.
Iterator_Interfaces
(
ASN1_Variable_SeqOf_Ptr
,
Has_Element_Variable_SeqOf
);
type
ASN1_Variable_SeqOf_It
is
new
Iterators_Variable_SeqOf
.
Forward_Iterator
with
record
Ptr
:
ASN1_Variable_SeqOf_Ptr
;
end
record
;
overriding
function
First
(
Item
:
ASN1_Variable_SeqOf_It
)
p
ackage
P
is
new
Generic_Fixed_SeqOF
(
P
=>
Basic
);
--
Create an integer type with a range constraint to iterate on
package
Length_ty
is
new
Generic_Integer
(
Integer_64
(
Min
),
Integer_64
(
Max
));
--
Instantiate the package to iterate on the integer for the length
package
Length_Pkg
renames
Length_ty
.
It
;
type
ASN1_Variable_SeqOf_Ptr
is
private
;
subtype
MySeqOf
is
P
.
SeqOf
(
Max
);
type
ASN1_Variable_SeqOf
is
new
Controlled
with
record
Length
:
Natural
:=
Min
;
Value
:
MySeqOf
;
-- Iterate on the length
LenVal
:
Length_ty
.
Instance
;
LenIt
:
Length_Pkg
.
Iterator
;
-- And on the value
RestVal
:
access
P
.
ASN1_SeqOf
;
RestIt
:
access
P
.
ASN1_SeqOf_It
;
end
record
with
Default_Iterator
=>
Iterate
,
Iterator_Element
=>
My
SeqOf
,
Constant_Indexing
=>
Element_Variable_SeqOf_Value
;
-- Constructor (called automatically)
procedure
Initialize
(
Self
:
in
out
ASN1_Variable_SeqOf
);
function
Has_Element_Variable_SeqOf
(
Ptr
:
ASN1_Variable_SeqOf_Ptr
)
return
Boolean
;
package
Iterators_Variable_SeqOf
is
new
Ada
.
Iterator_Interfaces
(
ASN1_Variable_SeqOf_Ptr
,
Has_Element_Variable_SeqOf
);
type
ASN1_Variable_SeqOf_It
is
new
Iterators_Variable_SeqOf
.
Forward_Iterator
with
record
Ptr
:
ASN1_Variable_SeqOf_Ptr
;
end
record
;
overriding
function
First
(
Item
:
ASN1_Variable_SeqOf_It
)
return
ASN1_Variable_SeqOf_Ptr
;
overriding
function
Next
(
Item
:
ASN1_Variable_SeqOf_It
;
Ptr
:
ASN1_Variable_SeqOf_Ptr
)
return
ASN1_Variable_SeqOf_Ptr
;
overriding
function
Next
(
Item
:
ASN1_Variable_SeqOf_It
;
Ptr
:
ASN1_Variable_SeqOf_Ptr
)
return
ASN1_Variable_SeqOf_Ptr
;
function
Iterate
(
self
:
ASN1_Variable_SeqOf
)
return
Iterators_Variable_SeqOf
.
Forward_Iterator
'
Class
;
function
Iterate
(
self
:
ASN1_Variable_SeqOf
)
return
Iterators_Variable_SeqOf
.
Forward_Iterator
'
Class
;
function
Element_Variable_SeqOf_Value
(
Self
:
ASN1_Variable_SeqOf
;
Ptr
:
ASN1_Variable_SeqOf_Ptr
)
--return P.SeqOf is (Self.Value);
function
Element_Variable_SeqOf_Value
(
Self
:
ASN1_Variable_SeqOf
;
Ptr
:
ASN1_Variable_SeqOf_Ptr
)
return
MySeqOf
is
(
Self
.
Value
);
subtype
Instance
is
ASN1_Variable_SeqOf
;
private
type
ASN1_Variable_SeqOf_Ptr
is
access
all
ASN1_Variable_SeqOf
;
subtype
Instance
is
ASN1_Variable_SeqOf
;
end
;
private
type
ASN1_Variable_SeqOf_Ptr
is
access
all
ASN1_Variable_SeqOf
;
end
ASN1_Iterators
.
Generic_SeqOF
;
asn1-iterators/src/asn1_iterators-generic_unsigned_integer.ads
View file @
d20683a4
...
...
@@ -5,24 +5,24 @@ with Interfaces;
use
Interfaces
;
generic
Min
:
Interfaces
.
Unsigned_64
;
Max
:
Interfaces
.
Unsigned_64
;
Min
:
Interfaces
.
Unsigned_64
;
Max
:
Interfaces
.
Unsigned_64
;
package
ASN1_Iterators
.
Generic_Unsigned_Integer
is
function
Elem_Init
return
Interfaces
.
Unsigned_64
is
(
Min
);
function
Has_Elem
(
Value
:
Interfaces
.
Unsigned_64
)
return
Boolean
is
(
Value
<=
Max
);
function
Elem_First
return
Interfaces
.
Unsigned_64
is
(
Min
);
function
Elem_Next
(
Value
:
Interfaces
.
Unsigned_64
)
return
Interfaces
.
Unsigned_64
is
(
Value
+
1
);
function
Elem_Init
return
Interfaces
.
Unsigned_64
is
(
Min
);
function
Has_Elem
(
Value
:
Interfaces
.
Unsigned_64
)
return
Boolean
is
(
Value
<=
Max
);
function
Elem_First
return
Interfaces
.
Unsigned_64
is
(
Min
);
function
Elem_Next
(
Value
:
Interfaces
.
Unsigned_64
)
return
Interfaces
.
Unsigned_64
is
(
Value
+
1
);
package
Unsigned_Type
is
new
SimpleTypes
(
Sort
=>
Interfaces
.
Unsigned_64
,
Elem_Init
=>
Elem_Init
,
Has_Elem
=>
Has_Elem
,
Elem_First
=>
Elem_First
,
Elem_Next
=>
Elem_Next
);
package
Unsigned_Type
is
new
SimpleTypes
(
Sort
=>
Interfaces
.
Unsigned_64
,
Elem_Init
=>
Elem_Init
,
Has_Elem
=>
Has_Elem
,
Elem_First
=>
Elem_First
,
Elem_Next
=>
Elem_Next
);
package
It
is
new
Generic_Basic
(
P
=>
Unsigned_Type
);
package
It
is
new
Generic_Basic
(
P
=>
Unsigned_Type
);
subtype
Instance
is
It
.
Basic_ASN1_Iterator
;
end
;
subtype
Instance
is
It
.
Basic_ASN1_Iterator
;
end
ASN1_Iterators
.
Generic_Unsigned_Integer
;
asn1-iterators/src/asn1_iterators-iterable_seqof.adb
View file @
d20683a4
...
...
@@ -17,7 +17,7 @@ package body ASN1_Iterators.Iterable_SeqOF is
end
;
function
First
(
It
:
in
out
ASN1_SequenceOf
)
return
Generic_SeqOf
is
-- Ptr_elem : P.
Iterator_Pt
r := P.Ptr(Item.Ptr.FirstIt);
-- Ptr_elem : P.
Curso
r := P.Ptr(Item.Ptr.FirstIt);
Ret
:
constant
Generic_SeqOf
:=
It
.
Value
;
begin
It
.
Value
.
Length
:=
It
.
Length
;
...
...
@@ -47,7 +47,7 @@ package body ASN1_Iterators.Iterable_SeqOF is
end
;
function
Next
(
It
:
ASN1_SequenceOf
)
return
Generic_SeqOf
is
--Ptr_elem : P.
Iterator_Pt
r := P.Ptr(Ptr.FirstIt);
--Ptr_elem : P.
Curso
r := P.Ptr(Ptr.FirstIt);
Temp
:
constant
Generic_SeqOf
:=
It
.
Value
;
begin
-- if Ptr.Length > 1 then
...
...
asn1-iterators/src/asn1_iterators-simpletypes.ads
View file @
d20683a4
generic
type
Sort
is
private
;
with
function
Elem_Init
return
Sort
;
with
function
Has_Elem
(
Value
:
Sort
)
return
Boolean
;
with
function
Elem_First
return
Sort
;
with
function
Elem_Next
(
Value
:
Sort
)
return
Sort
;
type
Sort
is
private
;
with
function
Elem_Init
return
Sort
;
with
function
Has_Elem
(
Value
:
Sort
)
return
Boolean
;
with
function
Elem_First
return
Sort
;
with
function
Elem_Next
(
Value
:
Sort
)
return
Sort
;
package
ASN1_Iterators
.
SimpleTypes
is
type
SimpleType
is
tagged
record
Value
:
Sort
;
end
record
;
type
SimpleType
is
tagged
record
Value
:
Sort
;
end
record
;
procedure
Initialize
(
Self
:
in
out
SimpleType
);
procedure
Initialize
(
Self
:
in
out
SimpleType
);
function
Has_Element
(
Self
:
in
out
SimpleType
)
return
Boolean
is
(
Has_Elem
(
Self
.
Value
));
function
Has_Element
(
Self
:
in
out
SimpleType
)
return
Boolean
is
(
Has_Elem
(
Self
.
Value
));
procedure
First
(
Self
:
in
out
SimpleType
);
procedure
First
(
Self
:
in
out
SimpleType
);
procedure
Next
(
Self
:
in
out
SimpleType
);
procedure
Next
(
Self
:
in
out
SimpleType
);
function
Element_Value
(
Self
:
in
out
SimpleType
)
return
Sort
is
(
Self
.
Value
);
end
;
function
Element_Value
(
Self
:
in
out
SimpleType
)
return
Sort
is
(
Self
.
Value
);
end
ASN1_Iterators
.
SimpleTypes
;
asn1-iterators/src/asn1_iterators.ads
View file @
d20683a4
package
ASN1_Iterators
is
Stop_Iteration
:
exception
;
end
;
end
ASN1_Iterators
;
asn1-iterators/test/asn1_iterators-myseq.adb
View file @
d20683a4
...
...
@@ -12,17 +12,17 @@ package body ASN1_Iterators.MySeq is
(
P_a
.
Has_Element
(
P_a
.
Ptr
(
Ptr
.
a_it
)));
function
Iterate
(
Self
:
ASN1_MySeq
)
return
ASN1_MySeq
'
Class
is
--Iterators_MySeq.Forward_Iterator'Class is
return
ASN1_MySeq
_It
'
Class
is
--Iterators_MySeq.Forward_Iterator'Class is
begin
return
I
:
ASN1_MySeq
do
return
I
:
ASN1_MySeq
_It
do
I
.
Ptr
:=
Self
'
Unrestricted_Access
;
end
return
;
end
;
function
First
(
Item
:
ASN1_MySeq_It
)
return
Cursor
is
Cursor_a
:
P_a
.
Iterator_Pt
r
:=
P_a
.
Ptr
(
Item
.
Ptr
.
a_it
);
Cursor_b
:
P_b
.
Iterator_Pt
r
:=
P_b
.
Ptr
(
Item
.
Ptr
.
b_it
);
Cursor_a
:
P_a
.
Curso
r
:=
P_a
.
Ptr
(
Item
.
Ptr
.
a_it
);
Cursor_b
:
P_b
.
Curso
r
:=
P_b
.
Ptr
(
Item
.
Ptr
.
b_it
);
begin
-- Initialize the iterator (Compute first value)
Item
.
Ptr
.
a_it
:=
P_a
.
Iterator
(
Item
.
Ptr
.
a_val
.
Iterate
);
...
...
@@ -34,26 +34,26 @@ package body ASN1_Iterators.MySeq is
return
Item
.
Ptr
;
end
;
function
Next
(
Item
:
ASN1_MySeq_It
;
Ptr
:
Cursor
)
return
Cursor
is
pragma
Unreferenced
(
Item
);
Ptr_elem_a
:
P_a
.
Iterator_Ptr
:=
P_a
.
Ptr
(
Ptr
.
a_it
);
-- ? (checkme)
Ptr_elem_b
:
P_b
.
Iterator_Ptr
:=
P_b
.
Ptr
(
Ptr
.
b_it
);
-- ?
begin
-- Exhaust b first, then a...
Ptr
.
b_it
.
Ptr
:=
Ptr
.
b_it
.
Next
(
Ptr
.
b_it
.
Ptr
);
if
Has_Element_MyEnum
(
Ptr
.
b_it
.
Ptr
)
then
Ptr
.
Value
.
b
:=
Ptr
.
b_it
.
Ptr
.
Value
.
b
;
else
-- Exhausted b: reset it, and iterate a by one element
Ptr
.
b_it
.
Ptr
:=
Ptr
.
b_it
.
First
;
Ptr_elem_a
:=
P_a
.
Next
(
Ptr
.
a_it
,
Ptr_elem_a
);
if
P_a
.
Has_Element
(
Ptr_elem_a
)
then
Ptr
.
Value
.
a
:=
P_a
.
Elem_Value
(
Ptr
.
a_val
,
Ptr_elem_a
);
function
Next
(
Item
:
ASN1_MySeq_It
;
Ptr
:
Cursor
)
return
Cursor
is
pragma
Unreferenced
(
Item
);
Ptr_elem_a
:
P_a
.
Cursor
:=
P_a
.
Ptr
(
Ptr
.
a_it
);
Ptr_elem_b
:
P_b
.
Cursor
:=
P_b
.
Ptr
(
Ptr
.
b_it
);
begin
-- Exhaust b first, then a...
Ptr
.
b_it
.
Ptr
:=
Ptr
.
b_it
.
Next
(
Ptr
.
b_it
.
Ptr
);
if
P_b
.
Has_Element
(
Ptr_elem_b
)
then
Ptr
.
Value
.
b
:=
P_b
.
Elem_Value
(
Ptr
.
b_val
,
Ptr_elem_b
);
else
-- Exhausted b: reset it, and iterate a by one element
Ptr
.
b_it
.
Ptr
:=
Ptr
.
b_it
.
First
;
Ptr_elem_a
:=
P_a
.
Next
(
Ptr
.
a_it
,
Ptr_elem_a
);