Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
dmt
Commits
b5954941
Commit
b5954941
authored
Sep 29, 2019
by
Thanassis Tsiodras
Browse files
The last invocation of ASN1SCC: Attempt to replace the -AdaUses option with navigating the AST.
parent
4e87aed1
Changes
3
Hide whitespace changes
Inline
Side-by-side
dmt/asn2aadlPlus.py
View file @
b5954941
...
...
@@ -85,17 +85,20 @@ def calculateForNativeAndASN1SCC(absASN1SCCpath, autosrc, names, inputFiles):
inputASN1files
=
[
x
for
x
in
inputFiles
if
not
x
.
lower
().
endswith
(
'.acn'
)]
# Spawn ASN1SCC.exe compiler - for MacOS define a new sh file calling mono Asn1f2.exe
if
platform
.
system
()
==
"Windows"
or
platform
.
system
()
==
"Darwin"
:
mysystem
(
"%s -c -uPER -o
\"
%s
\"
%s %s"
%
(
absASN1SCCpath
,
autosrc
,
acn
,
'"'
+
'" "'
.
join
(
inputFiles
)
+
'"'
))
for
line
in
os
.
popen
(
"%s -AdaUses %s"
%
(
absASN1SCCpath
,
'" "'
.
join
(
inputASN1files
))):
g_AdaPackageNameOfType
[
line
.
split
(
':'
)[
0
]]
=
line
.
split
(
':'
)[
1
].
rstrip
()
else
:
cmd
=
"mono %s -c -uPER -fp AUTO -typePrefix asn1Scc -o
\"
%s
\"
%s %s"
%
(
absASN1SCCpath
,
autosrc
,
acn
,
'"'
+
'" "'
.
join
(
inputFiles
)
+
'"'
)
res
=
mysystem
(
cmd
)
if
res
!=
0
:
panic
(
"This command failed: %s
\n
"
%
cmd
)
for
line
in
os
.
popen
(
'mono %s -fp AUTO -typePrefix asn1Scc -AdaUses "%s"'
%
(
absASN1SCCpath
,
'" "'
.
join
(
inputASN1files
))):
g_AdaPackageNameOfType
[
line
.
split
(
':'
)[
0
]]
=
line
.
split
(
':'
)[
1
].
rstrip
()
# if platform.system() == "Windows" or platform.system() == "Darwin":
# mysystem("%s -c -uPER -o \"%s\" %s %s" % (absASN1SCCpath, autosrc, acn, '"' + '" "'.join(inputFiles) + '"'))
# for line in os.popen("%s -AdaUses %s" % (absASN1SCCpath, '" "'.join(inputASN1files))):
# g_AdaPackageNameOfType[line.split(':')[0]] = line.split(':')[1].rstrip()
# else:
# cmd = "mono %s -c -uPER -fp AUTO -typePrefix asn1Scc -o \"%s\" %s %s" % (absASN1SCCpath, autosrc, acn, '"' + '" "'.join(inputFiles) + '"')
# res = mysystem(cmd)
# if res != 0:
# panic("This command failed: %s\n" % cmd)
# for line in os.popen('mono %s -fp AUTO -typePrefix asn1Scc -AdaUses "%s"' % (absASN1SCCpath, '" "'.join(inputASN1files))):
# g_AdaPackageNameOfType[line.split(':')[0]] = line.split(':')[1].rstrip()
for
asnModuleID
,
setOfTypenames
in
asnParser
.
g_adaUses
.
items
():
for
typeName
in
setOfTypenames
:
g_AdaPackageNameOfType
[
typeName
]
=
asnModuleID
msgEncoderFile
=
open
(
autosrc
+
os
.
sep
+
base
+
".stats.c"
,
'w'
)
...
...
dmt/commonPy/asnParser.py
View file @
b5954941
...
...
@@ -57,7 +57,7 @@ from distutils import spawn
import
hashlib
import
xml.sax
# type: ignore
from
typing
import
IO
,
TypeVar
,
Type
,
Optional
,
Callable
,
Union
,
List
,
Dict
,
Tuple
,
Any
# NOQA pylint: disable=W0611
from
typing
import
IO
,
TypeVar
,
Type
,
Optional
,
Callable
,
Union
,
List
,
Set
,
Dict
,
Tuple
,
Any
# NOQA pylint: disable=W0611
from
.
import
configMT
from
.
import
utility
...
...
@@ -81,12 +81,14 @@ AST_TypenamesOfFile = Dict[Filename, List[str]] # pylint: disable=invalid-seque
AST_TypesOfFile
=
Dict
[
Filename
,
List
[
AsnNode
]]
# pylint: disable=invalid-sequence-index
AST_Leaftypes
=
Dict
[
Typename
,
str
]
AST_Modules
=
Dict
[
str
,
List
[
Typename
]]
# pylint: disable=invalid-sequence-index
AST_AdaUses
=
Dict
[
str
,
Set
[
Typename
]]
# pylint: disable=invalid-sequence-index
g_names
=
{}
# type: AST_Lookup
g_typesOfFile
=
{}
# type: AST_TypenamesOfFile
g_leafTypeDict
=
{}
# type: AST_Leaftypes
g_astOfFile
=
{}
# type: AST_TypesOfFile
g_modules
=
{}
# type: AST_Modules
g_adaUses
=
{}
# type: AST_AdaUses
g_checkedSoFarForKeywords
=
{}
# type: Dict[str, int]
...
...
@@ -808,6 +810,7 @@ def VisitTypeAssignment(newModule: Module, xmlTypeAssignment: Element) -> Tuple[
utility
.
panic
(
"You are using an older version of ASN1SCC - please upgrade."
)
newNode
.
_isArtificial
=
isArtificial
==
"True"
name
=
GetAttr
(
xmlTypeAssignment
,
"Name"
)
g_adaUses
.
setdefault
(
newModule
.
_id
,
set
()).
add
(
name
)
return
(
name
,
newNode
)
...
...
setup.py
View file @
b5954941
...
...
@@ -11,7 +11,7 @@ from setuptools import setup, find_packages
setup
(
name
=
'dmt'
,
version
=
"2.1.4
4
"
,
version
=
"2.1.4
5
"
,
packages
=
find_packages
(),
author
=
'Thanassis Tsiodras'
,
author_email
=
'Thanassis.Tsiodras@esa.int'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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