Commit b5954941 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

The last invocation of ASN1SCC: Attempt to replace the -AdaUses option with navigating the AST.

parent 4e87aed1
......@@ -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')
......
......@@ -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)
......
......@@ -11,7 +11,7 @@ from setuptools import setup, find_packages
setup(
name='dmt',
version="2.1.44",
version="2.1.45",
packages=find_packages(),
author='Thanassis Tsiodras',
author_email='Thanassis.Tsiodras@esa.int',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment