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
ebf11fb3
Commit
ebf11fb3
authored
Dec 02, 2019
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate iterators for SEQUENCE
parent
f1cfa191
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
13 deletions
+68
-13
asn1-iterators/Makefile
asn1-iterators/Makefile
+2
-3
asn1-iterators/Makefile.old
asn1-iterators/Makefile.old
+31
-0
asn1-iterators/README.md
asn1-iterators/README.md
+2
-7
asn1-iterators/src/taste-asn1-iterators-OLD
asn1-iterators/src/taste-asn1-iterators-OLD
+0
-0
asn1-iterators/src/taste-asn1-iterators.py
asn1-iterators/src/taste-asn1-iterators.py
+32
-3
asn1-iterators/stg/README.md
asn1-iterators/stg/README.md
+1
-0
No files found.
asn1-iterators/Makefile
View file @
ebf11fb3
...
...
@@ -5,11 +5,10 @@ all:
@
echo
A testcase can be build from
source
with
"make test"
install
:
uninstall
mkdir
-p
obj
&&
rm
-f
obj/taste-asn1-iterators
&&
\
sed
's,$$PREFIX,
$(PREFIX)
,g'
src/taste-asn1-iterators
>
obj/taste-asn1-iterators
&&
\
chmod
+x obj/taste-asn1-iterators
mkdir
-p
obj
&&
cp
src/taste-asn1-iterators.py obj/taste-asn1-iterators
gprbuild
-p
asn1_iterators.gpr
gprinstall
-p
-XLIBRARY_TYPE
=
dynamic
--build-name
=
shared
--prefix
=
$(PREFIX)
asn1_iterators.gpr
rm
-rf
obj
@
echo
Do not forget to
export
ADA_PROJECT_PATH
=
$(PREFIX)
/share/gpr
test_build
:
clean install
...
...
asn1-iterators/Makefile.old
0 → 100644
View file @
ebf11fb3
PREFIX
?=
$(HOME)
/.local
all
:
@
echo
You can
install
with
"make install"
@
echo
A testcase can be build from
source
with
"make test"
install
:
uninstall
mkdir
-p
obj
&&
rm
-f
obj/taste-asn1-iterators
&&
\
sed
's,$$PREFIX,
$(PREFIX)
,g'
src/taste-asn1-iterators
>
obj/taste-asn1-iterators
&&
\
chmod
+x obj/taste-asn1-iterators
gprbuild
-p
asn1_iterators.gpr
gprinstall
-p
-XLIBRARY_TYPE
=
dynamic
--build-name
=
shared
--prefix
=
$(PREFIX)
asn1_iterators.gpr
@
echo
Do not forget to
export
ADA_PROJECT_PATH
=
$(PREFIX)
/share/gpr
test_build
:
clean install
mkdir
-p
build_test
cp test
/DataView.asn build_test
cd
build_test
&&
taste-asn1-iterators DataView.asn
gprbuild
-p
-P
test_generic.gpr
test
:
test_build
build_test/test_generic
uninstall
:
gprinstall
--uninstall
--prefix
=
$(PREFIX)
asn1_iterators
||
:
clean
:
gprclean test_generic.gpr
||
:
gprclean asn1_iterators.gpr
||
:
.PHONY
:
all clean install test test_build
asn1-iterators/README.md
View file @
ebf11fb3
asn1-iterators
==============
(c) 2016-201
7
European Space Agency
(c) 2016-201
9
European Space Agency
Author/Contact: Maxime.Perrotin@esa.int
Generic iterator functions in Ada for generating all combinations of values of ASN.1 data types
v0.1 support for INTEGER with a range and SEQUENCE OF INTEGER (fixed and variable size arrays)
test:
cd src
make
Support integer, enumerated, sequence, sequence of (fixed and variable sizes)
Work in progress... Part of the TASTE project.
asn1-iterators/src/taste-asn1-iterators
→
asn1-iterators/src/taste-asn1-iterators
-OLD
View file @
ebf11fb3
File moved
asn1-iterators/src/taste-asn1-iterators.py
View file @
ebf11fb3
...
...
@@ -13,6 +13,7 @@
"""
__version__
=
"3.0.0"
import
os
import
signal
import
argparse
import
traceback
...
...
@@ -265,6 +266,21 @@ def sequence_adb_template (sort: str, fields: dict) -> str:
end
{
sort
}
_Pkg;'''
def
top_ads_template
(
modules
:
List
[
str
])
->
str
:
''' Template for asn1_ada_iterators.ads '''
withs
=
(
f'''with
{
module
}
; use
{
module
}
; pragma Unreferenced (
{
module
}
);'''
for
module
in
modules
)
withs_str
=
'
\n
'
.
join
(
withs
)
return
f'''-- This file was generated by TASTE: DO NOT EDIT
{
withs_str
}
package ASN1_Ada_Iterators is
end;'''
def
ads_template
(
packages
:
List
[
str
])
->
str
:
''' Top-level template to generate the .ads file '''
return
f'''-- This file was generated by TASTE: DO NOT EDIT
...
...
@@ -434,6 +450,13 @@ def parse_args():
action
=
'store_true'
,
default
=
False
,
help
=
'Display debug information'
)
parser
.
add_argument
(
'-o'
,
'--output'
,
type
=
str
,
metavar
=
'folder'
,
default
=
'iterators'
,
help
=
'Set the output folder'
)
parser
.
add_argument
(
'files'
,
metavar
=
'file.asn'
,
...
...
@@ -465,7 +488,7 @@ def run(options):
# Parse the ASN.1 AST to know the types and generate the corresponding code
sorts
=
{}
for
module
,
types
in
ast
.
exportedTypes
.
items
():
modules
.
append
(
module
)
modules
.
append
(
module
.
replace
(
'-'
,
'_'
)
)
for
sort
in
types
:
sort_def
=
ast
.
types
[
sort
]
basic
=
parser
.
find_basic_type
(
sort_def
.
type
)
...
...
@@ -518,14 +541,20 @@ def run(options):
ads
=
ads_template
(
packages_ads
)
adb
=
adb_template
(
packages_adb
)
top_ads
=
top_ads_template
(
modules
)
out_folder
=
options
.
output
if
options
.
output
else
'.'
os
.
makedirs
(
out_folder
,
exist_ok
=
True
)
# Write the .ads
with
open
(
"
asn1_ada_iterators-iterators.ads"
,
"wb"
)
as
source
:
with
open
(
f"
{
out_folder
}
/
asn1_ada_iterators-iterators.ads"
,
"wb"
)
as
source
:
source
.
write
(
ads
.
encode
(
'latin1'
))
with
open
(
"
asn1_ada_iterators-iterators.adb"
,
"wb"
)
as
source
:
with
open
(
f"
{
out_folder
}
/
asn1_ada_iterators-iterators.adb"
,
"wb"
)
as
source
:
source
.
write
(
adb
.
encode
(
'latin1'
))
with
open
(
f"
{
out_folder
}
/asn1_ada_iterators.ads"
,
"wb"
)
as
source
:
source
.
write
(
top_ads
.
encode
(
'latin1'
))
def
main
():
''' Tool entry point '''
# Catch Ctrl-C to stop the app from the console
...
...
asn1-iterators/stg/README.md
0 → 100644
View file @
ebf11fb3
this folder is DEPRECATED, the code is now generated from python
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment