Commit 51b6a945 authored by Maxime Perrotin's avatar Maxime Perrotin

Allow definition of external ASN1SCC flags

If user needs to add special flags when calling the ASN.1 compiler it is
now possible without changing the code of DMT
Only possible in combination with -Ada (for the moment)
parent 9f430d68
......@@ -46,9 +46,11 @@ def OnStartup(unused_modelingLanguage: str, asnFiles: List[str], outputDir: str,
asn1SccPath = spawn.find_executable('asn1.exe')
if not asn1SccPath:
panic("ASN1SCC seems to be missing from your system (asn1.exe not found in PATH).\n") # pragma: no cover
# allow externally-defined flags when calling the asn1 compiler (e.g. to set word size based on target)
extraFlags = os.getenv ("ASN1SCC_FLAGS") or ""
os.system(
("mono " if sys.platform.startswith('linux') else "") +
"\"{}\" -typePrefix asn1Scc -Ada -uPER -o \"".format(asn1SccPath) +
"\"{}\" -typePrefix asn1Scc -Ada {} -uPER -o \"".format(asn1SccPath, extraFlags) +
outputDir + "\" \"" + "\" \"".join(asnFiles) + "\"")
os.system("rm -f \"" + outputDir + "\"/*.adb")
......
......@@ -204,11 +204,13 @@ the scope of individual parameters (e.g. it needs access to all ASN.1
types). This used to cover Dumpable C/Ada Types and OG headers.'''
outputDir = commonPy.configMT.outputDir
asn1SccPath = spawn.find_executable('asn1.exe')
# allow externally-defined flags when calling the asn1 compiler (e.g. to set word size based on target)
extraFlags = os.getenv ("ASN1SCC_FLAGS") or ""
if asnFile is not None:
if not asn1SccPath:
panic("ASN1SCC seems not installed on your system (asn1.exe not found in PATH).\n") # pragma: no cover
os.system('mono "{}" -typePrefix asn1Scc -Ada -equal -o "{}" "{}"'
.format(asn1SccPath, outputDir, '" "'.join([asnFile])))
os.system('mono "{}" -typePrefix asn1Scc {} -Ada -equal -o "{}" "{}"'
.format(asn1SccPath, extraFlags, outputDir, '" "'.join([asnFile])))
def getSyncBackend(modelingLanguage: str) -> Sync_B_Mapper:
......
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