diff --git a/Compiler/BackEnd/SynchronousFeatures.mo b/Compiler/BackEnd/SynchronousFeatures.mo index 76f974d388..0481036f87 100644 --- a/Compiler/BackEnd/SynchronousFeatures.mo +++ b/Compiler/BackEnd/SynchronousFeatures.mo @@ -37,27 +37,29 @@ encapsulated package SynchronousFeatures - sub-clock partitioning" -public import Absyn; -public import BackendDAE; -public import DAE; - -protected import BackendDAEOptimize; -protected import BackendDAEUtil; -protected import BackendDump; -protected import ExpressionDump; -protected import BackendEquation; -protected import BackendVariable; -protected import ComponentReference; -protected import DAEUtil; -protected import DAEDump; -protected import Error; -protected import Flags; -protected import List; -protected import Util; -protected import Types; -protected import Expression; -protected import HashTable; -protected import MMath; +import Absyn; +import BackendDAE; +import DAE; + +protected +import BackendDAEOptimize; +import BackendDAEUtil; +import BackendDump; +import ExpressionDump; +import BackendEquation; +import BackendVariable; +import ComponentReference; +import DAEUtil; +import DAEDump; +import Error; +import Expression; +import Flags; +import Global; +import HashTable; +import List; +import MMath; +import Types; +import Util; // ============================================================================= // clock partitioning @@ -68,7 +70,14 @@ public function clockPartitioning "Finds independent partitions of the equation system by base-clock partitioning and TLM." input BackendDAE.BackendDAE inDAE; output BackendDAE.BackendDAE outDAE; +protected + Option isSynchronous; algorithm + isSynchronous := getGlobalRoot(Global.isSynchronous); + if isNone(isSynchronous) then + outDAE := inDAE; + return; + end if; outDAE := match inDAE local BackendDAE.EqSystem syst; diff --git a/Compiler/FrontEnd/Static.mo b/Compiler/FrontEnd/Static.mo index adf26c2b10..45fa132d82 100644 --- a/Compiler/FrontEnd/Static.mo +++ b/Compiler/FrontEnd/Static.mo @@ -6472,6 +6472,8 @@ public function elabBuiltinHandler output DAE.Exp outExp; output DAE.Properties outProperties; end HandlerFunc; +protected + Boolean isSynchronous=false; algorithm outHandler := match (inIdent) case "smooth" then elabBuiltinSmooth; @@ -6515,42 +6517,52 @@ algorithm case "Clock" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinClock; case "hold" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinHold; case "shiftSample" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinShiftSample; case "backSample" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinBackSample; case "noClock" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinNoClock; case "transition" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinTransition; case "initialState" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinInitialState; case "activeState" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinActiveState; case "ticksInState" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinTicksInState; case "timeInState" equation true = intGe(Flags.getConfigEnum(Flags.LANGUAGE_STANDARD), 33); + isSynchronous = true; then elabBuiltinTimeInState; case "sourceInfo" equation @@ -6569,6 +6581,9 @@ algorithm true = Config.acceptMetaModelicaGrammar(); then elabBuiltinIsPresent; end match; + if isSynchronous then + setGlobalRoot(Global.isSynchronous, SOME(true)); + end if; end elabBuiltinHandler; public function isBuiltinFunc "Returns true if the function name given as argument diff --git a/Compiler/Global/Global.mo b/Compiler/Global/Global.mo index b72dedf91a..52e9bd49d7 100644 --- a/Compiler/Global/Global.mo +++ b/Compiler/Global/Global.mo @@ -64,6 +64,7 @@ constant Integer currentInstVar = 22; constant Integer operatorOverloadingCache = 23; constant Integer optionSimCode = 24; constant Integer interactiveCache = 25; +constant Integer isSynchronous = 26; // indexes in System.tick // ---------------------- diff --git a/Compiler/Script/CevalScriptBackend.mo b/Compiler/Script/CevalScriptBackend.mo index fe382cb7e8..0c7a67a451 100644 --- a/Compiler/Script/CevalScriptBackend.mo +++ b/Compiler/Script/CevalScriptBackend.mo @@ -3027,6 +3027,7 @@ protected function runFrontEndWork output FCore.Graph env; output DAE.DAElist dae; algorithm + setGlobalRoot(Global.isSynchronous, NONE()); (cache,env,dae) := matchcontinue (inCache,inEnv,className) local Absyn.Restriction restriction; @@ -3473,29 +3474,29 @@ algorithm // create the path till packagetool str2 := stringAppendList({omhome,pd,"lib",pd,"omc",pd,"SEMLA",pd,"packagetool",str1}); if System.regularFileExists(str2) then - // create the list of arguments for packagetool - str3 := "-librarypath \"" + System.dirname(fileName) + "\" -version \"1.0\" -language \"3.2\" -encrypt \"true\""; - call := stringAppendList({str2," ",str3}); - logFile := "packagetool.log"; - // remove the logFile if it already exists. - if System.regularFileExists(logFile) then - System.removeFile(logFile); - end if; - // run the packagetool command - if 0 == System.systemCall(call, logFile) then - success := true; - else - success := false; - end if; - // read the logFile - if System.regularFileExists(logFile) then - commandOutput := System.readFile(logFile); - end if; - else - Error.addMessage(Error.ENCRYPTION_NOT_SUPPORTED, {str2}); + // create the list of arguments for packagetool + str3 := "-librarypath \"" + System.dirname(fileName) + "\" -version \"1.0\" -language \"3.2\" -encrypt \"true\""; + call := stringAppendList({str2," ",str3}); + logFile := "packagetool.log"; + // remove the logFile if it already exists. + if System.regularFileExists(logFile) then + System.removeFile(logFile); + end if; + // run the packagetool command + if 0 == System.systemCall(call, logFile) then + success := true; + else + success := false; + end if; + // read the logFile + if System.regularFileExists(logFile) then + commandOutput := System.readFile(logFile); + end if; + else + Error.addMessage(Error.ENCRYPTION_NOT_SUPPORTED, {str2}); commandOutput := ""; success := false; - end if; + end if; else Error.addMessage(Error.FILE_NOT_FOUND_ERROR, {fileName}); commandOutput := "";