Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
92466481
Commit
92466481
authored
Jun 23, 2014
by
Laurent MEYER
Browse files
Merge remote-tracking branch 'remotes/upstream/master'
parents
fb809717
f850ebf0
Changes
4
Hide whitespace changes
Inline
Side-by-side
AdaGenerator.py
View file @
92466481
...
...
@@ -1515,6 +1515,7 @@ def path_type(path):
continue
# Sequence, Choice (case insensitive)
if
current
.
kind
in
(
'SequenceType'
,
'ChoiceType'
):
#print list(Helper.sorted_fields(current))
elem_asn1
=
elem
.
replace
(
'_'
,
'-'
).
lower
()
type_idx
,
=
(
c
for
c
in
current
.
Children
if
c
.
lower
()
==
elem_asn1
)
...
...
Helper.py
View file @
92466481
...
...
@@ -11,6 +11,8 @@
inner_labels_to_floating(process) : remove labels from transitions
map_input_state(process) -> mapping: create a mapping
input-state-transition
sorted_fields(SEQ/CHOICE) : returns the ordered list of fields
of an ASN.1 SEQUENCE or CHOICE type
Copyright (c) 2012-2014 European Space Agency
...
...
@@ -19,6 +21,7 @@
Contact: maxime.perrotin@esa.int
"""
import
operator
import
logging
from
itertools
import
chain
from
collections
import
defaultdict
...
...
@@ -30,7 +33,7 @@ import ogAST
LOG
=
logging
.
getLogger
(
__name__
)
__all__
=
[
'flatten'
,
'rename_everything'
,
'inner_labels_to_floating'
,
'map_input_state'
]
'map_input_state'
,
'sorted_fields'
]
def
map_input_state
(
process
):
...
...
@@ -436,3 +439,12 @@ def find_labels(trans):
[
slice
(
idx
+
1
,
len
(
trans
.
actions
))])
new_fl
.
transition
.
terminator
=
trans
.
terminator
yield
new_fl
def
sorted_fields
(
atype
):
''' Return the sorted list of a SEQUENCE or CHOICE type fields '''
if
atype
.
kind
not
in
(
'SequenceType'
,
'ChoiceType'
):
raise
TypeError
(
'Not a SEQUENCE nor a CHOICE'
)
tmp
=
([
k
,
val
.
Line
,
val
.
CharPositionInLine
]
for
k
,
val
in
atype
.
Children
.
viewitems
())
return
(
x
[
0
]
for
x
in
sorted
(
tmp
,
key
=
operator
.
itemgetter
(
1
,
2
)))
tests/regression/test12/Makefile
View file @
92466481
...
...
@@ -6,7 +6,7 @@ generate-code:
compile
:
generate-code
asn1.exe
-Ada
dataview-uniq.asn
-typePrefix
asn1Scc
-equal
gnatmake
-c
-gnat2012
*
.adb
&&
echo
'All OK!'
gnatmake
-c
*
.adb
&&
echo
'All OK!'
#gcc -c test.c
#gnatbind -n trafficlight.ali
#gnatlink -o testcase test.o trafficlight.ali -lgnat -lm
...
...
tests/regression/test3/dataview-uniq.asn
View file @
92466481
...
...
@@ -22,8 +22,8 @@ IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
FCE-SGM-EEPROM ::= SEQUENCE {
sit-1 FCE-SIT-1,
sit-2 FCE-SIT-2,
sit-3 FCE-SIT-3,
sit-2 FCE-SIT-2,
sit-4 FCE-SIT-4
}
...
...
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