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
dmt
Commits
8a81a9c2
Commit
8a81a9c2
authored
Dec 11, 2020
by
Thanassis Tsiodras
Browse files
Manually merge upgrades from feature_buster.
parent
cfca4001
Pipeline
#2889
failed with stage
in 34 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dmt/A_mappers/simulink_A_mapper.py
View file @
8a81a9c2
...
...
@@ -131,13 +131,13 @@ def DeclareCollection(node: AsnSequenceOrSetOf, name: str, internal: str) -> Non
for
i
in
range
(
0
,
node
.
_range
[
-
1
]):
g_outputFile
.
write
(
'%s_member_%02d=Simulink.BusElement;
\n
'
%
(
name
,
i
))
# Andreas(ESA) wants them to be called 'element_%02d'
g_outputFile
.
write
(
"%s_member_%02d.
N
ame='element_%02d';
\n
"
%
(
name
,
i
,
i
))
g_outputFile
.
write
(
"%s_member_%02d.
n
ame='element_%02d';
\n
"
%
(
name
,
i
,
i
))
g_outputFile
.
write
(
"%s_member_%02d.DataType='%s';
\n
"
%
(
name
,
i
,
internal
))
g_outputFile
.
write
(
"%s_member_%02d.
D
imensions=1;
\n\n
"
%
(
name
,
i
))
g_outputFile
.
write
(
"%s_member_%02d.
d
imensions=1;
\n\n
"
%
(
name
,
i
))
g_outputFile
.
write
(
'%s_member_length=Simulink.BusElement;
\n
'
%
name
)
g_outputFile
.
write
(
"%s_member_length.
N
ame='length';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.
n
ame='length';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.DataType='int32';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.
D
imensions=1;
\n\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.
d
imensions=1;
\n\n
"
%
name
)
g_outputFile
.
write
(
'%s=Simulink.Bus;
\n
'
%
name
)
g_outputFile
.
write
(
"%s.Elements = "
%
name
)
g_outputFile
.
write
(
'['
)
...
...
@@ -150,9 +150,9 @@ def DeclareCollection(node: AsnSequenceOrSetOf, name: str, internal: str) -> Non
def
DeclareSimpleCollection
(
node
:
Union
[
AsnString
,
AsnSequenceOf
,
AsnSetOf
],
name
:
str
,
internal
:
str
)
->
None
:
g_outputFile
.
write
(
'%s_member_data=Simulink.BusElement;
\n
'
%
name
)
g_outputFile
.
write
(
"%s_member_data.
N
ame='element_data';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_data.
n
ame='element_data';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_data.DataType='%s';
\n
"
%
(
name
,
internal
))
g_outputFile
.
write
(
"%s_member_data.
D
imensions=%d;
\n\n
"
%
(
name
,
node
.
_range
[
-
1
]))
g_outputFile
.
write
(
"%s_member_data.
d
imensions=%d;
\n\n
"
%
(
name
,
node
.
_range
[
-
1
]))
bNeedLength
=
False
if
len
(
node
.
_range
)
>
1
and
node
.
_range
[
0
]
!=
node
.
_range
[
1
]:
...
...
@@ -160,9 +160,9 @@ def DeclareSimpleCollection(node: Union[AsnString, AsnSequenceOf, AsnSetOf], nam
if
bNeedLength
:
g_outputFile
.
write
(
'%s_member_length=Simulink.BusElement;
\n
'
%
name
)
g_outputFile
.
write
(
"%s_member_length.
N
ame='length';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.
n
ame='length';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.DataType='int32';
\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.
D
imensions=1;
\n\n
"
%
name
)
g_outputFile
.
write
(
"%s_member_length.
d
imensions=1;
\n\n
"
%
name
)
g_outputFile
.
write
(
'%s=Simulink.Bus;
\n
'
%
name
)
g_outputFile
.
write
(
"%s.Elements = "
%
name
)
...
...
@@ -216,14 +216,14 @@ def CreateDeclarationForType(nodeTypename: str, names: AST_Lookup, leafTypeDict:
elemNo
+=
1
name
=
"%s_elem%02d"
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
elemNo
)
g_outputFile
.
write
(
name
+
"=Simulink.BusElement;
\n
"
)
g_outputFile
.
write
(
name
+
".
N
ame='choiceIdx';
\n
"
)
g_outputFile
.
write
(
name
+
".
n
ame='choiceIdx';
\n
"
)
g_outputFile
.
write
(
name
+
".DataType='uint8';
\n
"
)
g_outputFile
.
write
(
name
+
".
D
imensions=1;
\n\n
"
)
g_outputFile
.
write
(
name
+
".
d
imensions=1;
\n\n
"
)
for
child
in
node
.
_members
:
elemNo
+=
1
name
=
"%s_elem%02d"
%
(
CleanNameAsSimulinkWants
(
nodeTypename
),
elemNo
)
g_outputFile
.
write
(
name
+
"=Simulink.BusElement;
\n
"
)
g_outputFile
.
write
(
name
+
".
N
ame='%s';
\n
"
%
CleanNameAsSimulinkWants
(
child
[
0
]))
g_outputFile
.
write
(
name
+
".
n
ame='%s';
\n
"
%
CleanNameAsSimulinkWants
(
child
[
0
]))
# Since AliasType doesn't work well in the Matlab/Simulink typesystem,
# we have to change the simple fields to their native types.
...
...
@@ -262,7 +262,7 @@ def CreateDeclarationForType(nodeTypename: str, names: AST_Lookup, leafTypeDict:
panic
(
"Simulink_A_mapper: Unexpected category of child (%s)"
%
str
(
child
[
1
]))
# pragma: no cover
g_outputFile
.
write
(
name
+
".DataType='%s';
\n
"
%
mappedType
)
# Used to be -1 for strings and metaMembers, but requirements have changed (again :-)
g_outputFile
.
write
(
name
+
".
D
imensions=1;
\n\n
"
)
g_outputFile
.
write
(
name
+
".
d
imensions=1;
\n\n
"
)
g_outputFile
.
write
(
"%s = Simulink.Bus;
\n
"
%
CleanNameAsSimulinkWants
(
nodeTypename
))
g_outputFile
.
write
(
"%s.Elements = "
%
CleanNameAsSimulinkWants
(
nodeTypename
))
...
...
dmt/B_mappers/c_B_mapper.py
View file @
8a81a9c2
...
...
@@ -249,7 +249,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
self
.
C_SourceFile
.
write
(
"
\n
extern OssGlobal *g_world;
\n\n
"
)
self
.
C_HeaderFile
.
write
(
"#include
\"
%s.h
\"
// Space certified compiler generated
\n\n
"
%
self
.
asn_name
)
self
.
C_HeaderFile
.
write
(
"#include
\"
../../
build/
system_config.h
\"
// Choose ASN.1 Types to use
\n\n
"
)
self
.
C_HeaderFile
.
write
(
"#include
\"
../../system_config.h
\"
// Choose ASN.1 Types to use
\n\n
"
)
def
Encoder
(
self
,
nodeTypename
:
str
,
node
:
AsnNode
,
leafTypeDict
:
AST_Leaftypes
,
names
:
AST_Lookup
,
encoding
:
str
)
->
None
:
if
encoding
.
lower
()
not
in
self
.
supportedEncodings
:
...
...
dmt/B_mappers/simulink_B_mapper.py
View file @
8a81a9c2
...
...
@@ -445,7 +445,7 @@ class SimulinkGlueGenerator(SynchronousToolGlueGenerator):
panicWithCallStack
(
"%s not supported (yet?)
\n
"
%
str
(
param
.
_sourceElement
))
# pragma: no cover
return
dstSimulink
def
InitializeBlock
(
self
,
unused_modelingLanguage
:
str
,
unused_asnFile
:
str
,
sp
:
ApLevelContainer
,
unused_subProgramImplementation
:
str
,
maybeFVname
:
str
)
->
None
:
def
InitializeBlock
(
self
,
unused_modelingLanguage
:
str
,
unused_asnFile
:
str
,
unused_
sp
:
ApLevelContainer
,
unused_subProgramImplementation
:
str
,
maybeFVname
:
str
)
->
None
:
self
.
C_SourceFile
.
write
(
" static int initialized = 0;
\n
"
)
self
.
C_SourceFile
.
write
(
" if (!initialized) {
\n
"
)
self
.
C_SourceFile
.
write
(
" initialized = 1;
\n
"
)
...
...
dmt/commonPy/asnParser.py
View file @
8a81a9c2
...
...
@@ -95,9 +95,9 @@ g_adaUses = {} # type: AST_AdaUses
g_checkedSoFarForKeywords
=
{}
# type: Dict[str, int]
g_invalidKeywords
=
[
"active"
,
"adding"
,
"all"
,
"alternative"
,
"and"
,
"any"
,
"as"
,
"atleast"
,
"axioms"
,
"block"
,
"call"
,
"channel"
,
"comment"
,
"connect"
,
"connection"
,
"constant"
,
"constants"
,
"create"
,
"dcl"
,
"decision"
,
"default"
,
"else"
,
"endalternative"
,
"endblock"
,
"endchannel"
,
"endconnection"
,
"enddecision"
,
"endgenerator"
,
"endmacro"
,
"endnewtype"
,
"endoperator"
,
"endpackage"
,
"endprocedure"
,
"endprocess"
,
"endrefinement"
,
"endselect"
,
"endservice"
,
"endstate"
,
"endsubstructure"
,
"endsyntype"
,
"endsystem"
,
"env"
,
"error"
,
"export"
,
"exported"
,
"external"
,
"fi"
,
"finalized"
,
"for"
,
"fpar"
,
"from"
,
"gate"
,
"generator"
,
"if"
,
"import"
,
"imported"
,
"in"
,
"inherits"
,
"input"
,
"interface"
,
"join"
,
"literal"
,
"literals"
,
"macro"
,
"macrodefinition"
,
"macroid"
,
"map"
,
"mod"
,
"nameclass"
,
"newtype"
,
"nextstate"
,
"nodelay"
,
"noequality"
,
"none"
,
"not"
,
"now"
,
"offspring"
,
"operator"
,
"operators"
,
"or"
,
"ordering"
,
"out"
,
"output"
,
"package"
,
"parent"
,
"priority"
,
"procedure"
,
"process"
,
"provided"
,
"redefined"
,
"referenced"
,
"refinement"
,
"rem"
,
"remote"
,
"reset"
,
"return"
,
"returns"
,
"revealed"
,
"reverse"
,
"save"
,
"select"
,
"self"
,
"sender"
,
"service"
,
"set"
,
"signal"
,
"signallist"
,
"signalroute"
,
"signalset"
,
"spelling"
,
"start"
,
"stop"
,
"struct"
,
"substructure"
,
"synonym"
,
"syntype"
,
"system"
,
"task"
,
"then"
,
"this"
,
"to"
,
"type"
,
"use"
,
"via"
,
"view"
,
"viewed"
,
"virtual"
,
"with"
,
"xor"
,
"end"
,
"i"
,
"j"
,
"auto"
,
"const"
,
"active"
,
"adding"
,
"all"
,
"alternative"
,
"and"
,
"any"
,
"as"
,
"atleast"
,
"axioms"
,
"block"
,
"call"
,
"channel"
,
"comment"
,
"connect"
,
"connection"
,
"constant"
,
"constants"
,
"create"
,
"dcl"
,
"decision"
,
"default"
,
"else"
,
"endalternative"
,
"endblock"
,
"endchannel"
,
"endconnection"
,
"enddecision"
,
"endgenerator"
,
"endmacro"
,
"endnewtype"
,
"endoperator"
,
"endpackage"
,
"endprocedure"
,
"endprocess"
,
"endrefinement"
,
"endselect"
,
"endservice"
,
"endstate"
,
"endsubstructure"
,
"endsyntype"
,
"endsystem"
,
"env"
,
"error"
,
"export"
,
"exported"
,
"external"
,
"fi"
,
"finalized"
,
"for"
,
"fpar"
,
"from"
,
"gate"
,
"generator"
,
"if"
,
"import"
,
"imported"
,
"in"
,
"inherits"
,
"input"
,
"interface"
,
"join"
,
"literal"
,
"literals"
,
"macro"
,
"macrodefinition"
,
"macroid"
,
"map"
,
"mod"
,
"nameclass"
,
"newtype"
,
"nextstate"
,
"nodelay"
,
"noequality"
,
"none"
,
"not"
,
"now"
,
"offspring"
,
"operator"
,
"operators"
,
"or"
,
"ordering"
,
"out"
,
"output"
,
"package"
,
"parent"
,
"priority"
,
"procedure"
,
"process"
,
"provided"
,
"redefined"
,
"referenced"
,
"refinement"
,
"rem"
,
"remote"
,
"reset"
,
"return"
,
"returns"
,
"revealed"
,
"reverse"
,
"save"
,
"select"
,
"self"
,
"sender"
,
"service"
,
"set"
,
"signal"
,
"signallist"
,
"signalroute"
,
"signalset"
,
"spelling"
,
"start"
,
"state"
,
"stop"
,
"struct"
,
"substructure"
,
"synonym"
,
"syntype"
,
"system"
,
"task"
,
"then"
,
"this"
,
"to"
,
"type"
,
"use"
,
"via"
,
"view"
,
"viewed"
,
"virtual"
,
"with"
,
"xor"
,
"end"
,
"i"
,
"j"
,
"auto"
,
"const"
,
# From Nicolas Gillet/Astrium for SCADE
"abstract"
,
"activate"
,
"and"
,
"assume"
,
"automaton"
,
"bool"
,
"case"
,
"char"
,
"clock"
,
"const"
,
"default"
,
"div"
,
"do"
,
"else"
,
"elsif"
,
"emit"
,
"end"
,
"enum"
,
"every"
,
"false"
,
"fby"
,
"final"
,
"flatten"
,
"fold"
,
"foldi"
,
"foldw"
,
"foldwi"
,
"function"
,
"guarantee"
,
"group"
,
"if"
,
"imported"
,
"initial"
,
"int"
,
"is"
,
"last"
,
"let"
,
"make"
,
"map"
,
"mapfold"
,
"mapi"
,
"mapw"
,
"mapwi"
,
"match"
,
"merge"
,
"mod"
,
"node"
,
"not"
,
"numeric"
,
"of"
,
"onreset"
,
"open"
,
"or"
,
"package"
,
"parameter"
,
"pre"
,
"private"
,
"probe"
,
"public"
,
"real"
,
"restart"
,
"resume"
,
"returns"
,
"reverse"
,
"sensor"
,
"sig"
,
"specialize"
,
"synchro"
,
"tel"
,
"then"
,
"times"
,
"transpose"
,
"true"
,
"type"
,
"unless"
,
"until"
,
"var"
,
"when"
,
"where"
,
"with"
,
"xor"
,
"abstract"
,
"activate"
,
"and"
,
"assume"
,
"automaton"
,
"bool"
,
"case"
,
"char"
,
"clock"
,
"const"
,
"default"
,
"div"
,
"do"
,
"else"
,
"elsif"
,
"emit"
,
"end"
,
"enum"
,
"every"
,
"false"
,
"fby"
,
"final"
,
"flatten"
,
"fold"
,
"foldi"
,
"foldw"
,
"foldwi"
,
"function"
,
"guarantee"
,
"group"
,
"if"
,
"imported"
,
"initial"
,
"int"
,
"is"
,
"last"
,
"let"
,
"make"
,
"map"
,
"mapfold"
,
"mapi"
,
"mapw"
,
"mapwi"
,
"match"
,
"merge"
,
"mod"
,
"node"
,
"not"
,
"numeric"
,
"of"
,
"onreset"
,
"open"
,
"or"
,
"package"
,
"parameter"
,
"pre"
,
"private"
,
"probe"
,
"public"
,
"real"
,
"restart"
,
"resume"
,
"returns"
,
"reverse"
,
"sensor"
,
"sig"
,
"specialize"
,
"state"
,
"synchro"
,
"tel"
,
"then"
,
"times"
,
"transpose"
,
"true"
,
"type"
,
"unless"
,
"until"
,
"var"
,
"when"
,
"where"
,
"with"
,
"xor"
,
# From Maxime - ESA GNC Team
"open"
,
"close"
,
"flag"
,
"device"
,
"range"
,
"name"
]
...
...
@@ -744,6 +744,8 @@ def CommonSeqSetChoice(
opti
=
GetAttr
(
x
,
"Optional"
)
bAlwaysPresent
=
GetAttr
(
x
,
"bAlwaysPresent"
)
bAlwaysAbsent
=
GetAttr
(
x
,
"bAlwaysAbsent"
)
if
opti
and
opti
==
"True"
:
utility
.
warn
(
"OPTIONAL attribute ignored by A/B mappers (for field contained in %s,%s)"
%
(
newModule
.
_asnFilename
,
lineNo
))
enumID
=
GetAttr
(
x
,
"EnumID"
)
myMembers
.
append
([
GetAttr
(
x
,
"VarName"
),
GenericFactory
(
newModule
,
GetChild
(
x
,
"Type"
))])
myMembers
[
-
1
].
append
(
enumID
)
...
...
Write
Preview
Supports
Markdown
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