Commit 9dac7def authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

Merge branch 'master' into feature_buster

parents 125e864e 369e0722
Pipeline #2392 failed with stage
in 60 minutes and 30 seconds
...@@ -121,7 +121,7 @@ def calculateForNativeAndASN1SCC(absASN1SCCpath, autosrc, names, inputFiles): ...@@ -121,7 +121,7 @@ def calculateForNativeAndASN1SCC(absASN1SCCpath, autosrc, names, inputFiles):
cleaned = cleanNameAsAsn1cWants(asnTypename) cleaned = cleanNameAsAsn1cWants(asnTypename)
msgEncoderFile.write('static asn1Scc%s sizeof_%s;\n' % (cleaned, cleaned)) msgEncoderFile.write('static asn1Scc%s sizeof_%s;\n' % (cleaned, cleaned))
msgEncoderFile.write('char bytesEncoding_%s[asn1Scc%s_REQUIRED_BYTES_FOR_ENCODING];\n' % (cleaned, cleaned)) msgEncoderFile.write('char bytesEncoding_%s[asn1Scc%s_REQUIRED_BYTES_FOR_ENCODING];\n' % (cleaned, cleaned))
if acn != "": if acn != "" and node.hasAcnEncDec:
msgEncoderFile.write('char bytesAcnEncoding_%s[asn1Scc%s_REQUIRED_BYTES_FOR_ACN_ENCODING];\n' % (cleaned, cleaned)) msgEncoderFile.write('char bytesAcnEncoding_%s[asn1Scc%s_REQUIRED_BYTES_FOR_ACN_ENCODING];\n' % (cleaned, cleaned))
msgEncoderFile.close() msgEncoderFile.close()
...@@ -290,7 +290,12 @@ def main(): ...@@ -290,7 +290,12 @@ def main():
panic("'%s' is not a file!\n" % x) panic("'%s' is not a file!\n" % x)
aadlFile = args[-1] aadlFile = args[-1]
inputFiles = [os.path.abspath(x) for x in args[:-1]] inputFiles = [
os.path.relpath(x)
if 'tool-inst' not in x and not x.startswith('/tmp')
else x
for x in args[:-1]
]
def md5(filename): def md5(filename):
hash_md5 = hashlib.md5() hash_md5 = hashlib.md5()
...@@ -333,7 +338,7 @@ def main(): ...@@ -333,7 +338,7 @@ def main():
# Parse the ASN.1 files (skip the ACN ones) # Parse the ASN.1 files (skip the ACN ones)
asnFiles = [x for x in inputFiles if not x.lower().endswith('.acn')] asnFiles = [x for x in inputFiles if not x.lower().endswith('.acn')]
asnParser.ParseAsnFileList(asnFiles) asnParser.ParseAsnFileList(inputFiles)
autosrc = tempfile.mkdtemp(".asn1c") autosrc = tempfile.mkdtemp(".asn1c")
inform("Created temporary directory (%s) for auto-generated files...", autosrc) inform("Created temporary directory (%s) for auto-generated files...", autosrc)
absPathOfAADLfile = os.path.abspath(aadlFile) absPathOfAADLfile = os.path.abspath(aadlFile)
......
...@@ -113,6 +113,7 @@ class AsnNode: ...@@ -113,6 +113,7 @@ class AsnNode:
self._asnFilename = asnFilename self._asnFilename = asnFilename
self._lineno = -1 self._lineno = -1
self._isArtificial = False self._isArtificial = False
self.hasAcnEncDec = True
def Location(self) -> str: def Location(self) -> str:
return "file %s, line %d" % (self._asnFilename, int(self._lineno)) # pragma: no cover return "file %s, line %d" % (self._asnFilename, int(self._lineno)) # pragma: no cover
......
...@@ -403,7 +403,8 @@ def ParseAsnFileList(listOfFilenames: List[str]) -> None: # pylint: disable=inv ...@@ -403,7 +403,8 @@ def ParseAsnFileList(listOfFilenames: List[str]) -> None: # pylint: disable=inv
if projectCache is not None: if projectCache is not None:
filehash = hashlib.md5() filehash = hashlib.md5()
for each in sorted(listOfFilenames): for each in sorted(listOfFilenames):
filehash.update(open(each).read().encode('utf-8')) filehash.update(
open(each, "r", encoding="utf-8").read().encode('utf-8'))
# also hash the file path: it is used in the AST in XML, so it is # also hash the file path: it is used in the AST in XML, so it is
# not enough to hash the content of the ASN.1 files, as two sets # not enough to hash the content of the ASN.1 files, as two sets
# of files may have the same hash, that would lead to different XML # of files may have the same hash, that would lead to different XML
...@@ -821,6 +822,8 @@ def VisitTypeAssignment(newModule: Module, xmlTypeAssignment: Element) -> Tuple[ ...@@ -821,6 +822,8 @@ def VisitTypeAssignment(newModule: Module, xmlTypeAssignment: Element) -> Tuple[
newNode._isArtificial = isArtificial == "True" newNode._isArtificial = isArtificial == "True"
name = GetAttrCertainly(xmlTypeAssignment, "Name") name = GetAttrCertainly(xmlTypeAssignment, "Name")
g_adaUses.setdefault(newModule._id, set()).add(name) g_adaUses.setdefault(newModule._id, set()).add(name)
hasAcnEncDec = GetAttr(xmlType, "HasAcnEncDecFunction") or "False"
newNode.hasAcnEncDec = hasAcnEncDec != "False"
return (name, newNode) return (name, newNode)
......
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