diff --git a/Compiler/Main/Main.mo b/Compiler/Main/Main.mo
index 877c7e72cb7..4d3c1d36479 100644
--- a/Compiler/Main/Main.mo
+++ b/Compiler/Main/Main.mo
@@ -441,7 +441,7 @@ algorithm
path = Absyn.stringPath(inLib);
mp = Settings.getModelicaPath(Config.getRunningTestsuite());
p = GlobalScriptUtil.getSymbolTableAST(inSymTab);
- (pnew, true) = CevalScript.loadModel({(path, {"default"})}, mp, p, true, true, true, false);
+ (pnew, true) = CevalScript.loadModel({(path, {"default"}, false)}, mp, p, true, true, true, false);
newst = GlobalScriptUtil.setSymbolTableAST(inSymTab, pnew);
then
newst;
diff --git a/Compiler/Script/CevalScript.mo b/Compiler/Script/CevalScript.mo
index 8111e4d580c..5c0ed99731d 100644
--- a/Compiler/Script/CevalScript.mo
+++ b/Compiler/Script/CevalScript.mo
@@ -323,7 +323,7 @@ algorithm
// see https://trac.openmodelica.org/OpenModelica/ticket/2422
// prio = if_(stringEq(prio,""), "default", prio);
mp = System.realpath(dir + "/../") + System.groupDelimiter() + Settings.getModelicaPath(Config.getRunningTestsuite());
- (p1,true) = loadModel((Absyn.IDENT(cname),{prio})::{}, mp, p, true, true, checkUses, true);
+ (p1,true) = loadModel((Absyn.IDENT(cname),{prio},true)::{}, mp, p, true, true, checkUses, true);
then p1;
case (_, _, _, _)
@@ -351,7 +351,7 @@ protected type LoadModelFoldArg =
tuple;
public function loadModel
- input list>> imodelsToLoad;
+ input list,Boolean /* Only use the first entry on the MODELICAPATH */>> imodelsToLoad;
input String modelicaPath;
input Absyn.Program ip;
input Boolean forceLoad;
@@ -367,28 +367,34 @@ algorithm
end loadModel;
protected function loadModel1
- input tuple> modelToLoad;
+ input tuple,Boolean> modelToLoad;
input LoadModelFoldArg inArg;
input tuple inTpl;
output tuple outTpl;
protected
- list>> modelsToLoad;
- Boolean b, b1, success, forceLoad, notifyLoad, checkUses, requireExactVersion;
+ list,Boolean>> modelsToLoad;
+ Boolean b, b1, success, forceLoad, notifyLoad, checkUses, requireExactVersion, onlyCheckFirstModelicaPath;
Absyn.Path path;
list versionsLst;
- String pathStr, versions, className, version, modelicaPath;
+ String pathStr, versions, className, version, modelicaPath, thisModelicaPath;
Absyn.Program p, pnew;
Error.MessageTokens msgTokens;
algorithm
- (path, versionsLst) := modelToLoad;
+ (path, versionsLst, onlyCheckFirstModelicaPath) := modelToLoad;
(modelicaPath, forceLoad, notifyLoad, checkUses, requireExactVersion) := inArg;
+ if onlyCheckFirstModelicaPath then
+ /* Using loadFile() */
+ thisModelicaPath::_ := System.strtok(modelicaPath, System.groupDelimiter());
+ else
+ thisModelicaPath := modelicaPath;
+ end if;
try
(p, success) := inTpl;
if checkModelLoaded(modelToLoad, p, forceLoad, NONE()) then
pnew := Absyn.PROGRAM({}, Absyn.TOP());
version := "";
else
- pnew := ClassLoader.loadClass(path, versionsLst, modelicaPath, NONE(), requireExactVersion);
+ pnew := ClassLoader.loadClass(path, versionsLst, thisModelicaPath, NONE(), requireExactVersion);
version := getPackageVersion(path, pnew);
b := not notifyLoad or forceLoad;
msgTokens := {Absyn.pathString(path), version};
@@ -406,7 +412,7 @@ algorithm
(p, _) := inTpl;
pathStr := Absyn.pathString(path);
versions := stringDelimitList(versionsLst, ",");
- msgTokens := {pathStr, versions, modelicaPath};
+ msgTokens := {pathStr, versions, thisModelicaPath};
if forceLoad then
Error.addMessage(Error.LOAD_MODEL, msgTokens);
outTpl := (p, false);
@@ -418,7 +424,7 @@ algorithm
end loadModel1;
protected function checkModelLoaded
- input tuple> tpl;
+ input tuple,Boolean> tpl;
input Absyn.Program p;
input Boolean forceLoad;
input Option failNonLoad;
@@ -432,14 +438,14 @@ algorithm
Absyn.Path path;
case (_,_,true,_) then false;
- case ((path,str1::_),_,false,_)
+ case ((path,str1::_,_),_,false,_)
equation
cdef = Interactive.getPathedClassInProgram(path,p);
ostr2 = Absyn.getNamedAnnotationInClass(cdef,Absyn.IDENT("version"),Interactive.getAnnotationStringValueOrFail);
checkValidVersion(path,str1,ostr2);
then true;
case (_,_,_,NONE()) then false;
- case ((path,_),_,_,SOME(str2))
+ case ((path,_,_),_,_,SOME(str2))
equation
str1 = Absyn.pathString(path);
Error.addMessage(Error.INST_NON_LOADED, {str1,str2});
@@ -1353,7 +1359,7 @@ algorithm
if b1 then
Config.setLanguageStandard(Config.versionStringToStd(str));
end if;
- (p,b) = loadModel({(path,strings)},mp,p,true,b,true,requireExactVersion);
+ (p,b) = loadModel({(path,strings,false)},mp,p,true,b,true,requireExactVersion);
if b1 then
Config.setLanguageStandard(oldLanguageStd);
end if;
diff --git a/Compiler/Script/CevalScriptBackend.mo b/Compiler/Script/CevalScriptBackend.mo
index 5acf7990d7b..b509c569e37 100644
--- a/Compiler/Script/CevalScriptBackend.mo
+++ b/Compiler/Script/CevalScriptBackend.mo
@@ -735,7 +735,7 @@ algorithm
GlobalScript.SimulationOptions defaulSimOpt;
SimCode.SimulationSettings simSettings;
Boolean dumpExtractionSteps, requireExactVersion;
- list>> uses;
+ list,Boolean>> uses;
Config.LanguageStandard oldLanguageStd;
SCode.Element cl;
list cls, elts;
@@ -1418,11 +1418,11 @@ algorithm
case (cache,env,"buildLabel",vals,st,_)
equation
- Flags.setConfigBool(Flags.GENERATE_LABELED_SIMCODE, true);
- //Flags.set(Flags.WRITE_TO_BUFFER,true);
- List.map_0(ClockIndexes.buildModelClocks,System.realtimeClear);
+ Flags.setConfigBool(Flags.GENERATE_LABELED_SIMCODE, true);
+ //Flags.set(Flags.WRITE_TO_BUFFER,true);
+ List.map_0(ClockIndexes.buildModelClocks,System.realtimeClear);
System.realtimeTick(ClockIndexes.RT_CLOCK_SIMULATE_TOTAL);
- (cache,st,compileDir,executable,_,_,initfilename,_,_) = buildModel(cache,env, vals, st, msg);
+ (cache,st,compileDir,executable,_,_,initfilename,_,_) = buildModel(cache,env, vals, st, msg);
then
(cache,ValuesUtil.makeArray({Values.STRING(executable),Values.STRING(initfilename)}),st);
@@ -1430,12 +1430,12 @@ algorithm
equation
Flags.setConfigBool(Flags.REDUCE_TERMS, true);
// Flags.setConfigBool(Flags.DISABLE_EXTRA_LABELING, true);
- Flags.setConfigBool(Flags.GENERATE_LABELED_SIMCODE, false);
- _=Flags.disableDebug(Flags.WRITE_TO_BUFFER);
- List.map_0(ClockIndexes.buildModelClocks,System.realtimeClear);
+ Flags.setConfigBool(Flags.GENERATE_LABELED_SIMCODE, false);
+ _=Flags.disableDebug(Flags.WRITE_TO_BUFFER);
+ List.map_0(ClockIndexes.buildModelClocks,System.realtimeClear);
System.realtimeTick(ClockIndexes.RT_CLOCK_SIMULATE_TOTAL);
- (cache,st,compileDir,executable,_,_,initfilename,_,_) = buildLabeledModel(cache,env, vals, st, msg);
+ (cache,st,compileDir,executable,_,_,initfilename,_,_) = buildLabeledModel(cache,env, vals, st, msg);
then
(cache,ValuesUtil.makeArray({Values.STRING(executable),Values.STRING(initfilename)}),st);
case(cache,env,"buildOpenTURNSInterface",vals,st,_)
@@ -2960,7 +2960,7 @@ algorithm
case (_, GlobalScript.SYMBOLTABLE(p,fp,ic,iv,cf,lf))
equation
str = Absyn.pathFirstIdent(className);
- (p,b) = CevalScript.loadModel({(Absyn.IDENT(str),{"default"})},Settings.getModelicaPath(Config.getRunningTestsuite()),p,true,true,true,false);
+ (p,b) = CevalScript.loadModel({(Absyn.IDENT(str),{"default"},false)},Settings.getModelicaPath(Config.getRunningTestsuite()),p,true,true,true,false);
Error.assertionOrAddSourceMessage(not b,Error.NOTIFY_NOT_LOADED,{str,"default"},Absyn.dummyInfo);
// print(stringDelimitList(list(Absyn.pathString(path) for path in Interactive.getTopClassnames(p)), ",") + "\n");
then GlobalScript.SYMBOLTABLE(p,fp,ic,iv,cf,lf);
@@ -7082,14 +7082,14 @@ algorithm
end searchClassNames;
protected function makeUsesArray
- input tuple> inTpl;
+ input tuple,Boolean> inTpl;
output Values.Value v;
algorithm
v := match inTpl
local
Absyn.Path p;
String pstr,ver;
- case ((p,{ver}))
+ case ((p,{ver},_))
equation
pstr = Absyn.pathString(p);
then ValuesUtil.makeArray({Values.STRING(pstr),Values.STRING(ver)});
diff --git a/Compiler/Script/Interactive.mo b/Compiler/Script/Interactive.mo
index 6bd4239a628..81af1ab1a2a 100644
--- a/Compiler/Script/Interactive.mo
+++ b/Compiler/Script/Interactive.mo
@@ -8916,9 +8916,9 @@ algorithm
/*update case*/(boolNot(intEq(l1_1, l2)) and isSome(item)) and success) then
parts2 = replacePublicList(parts, publst2);
else
- protlst = getProtectedList(parts);
- protlst2 = deleteOrUpdateComponentFromElementitems(name, protlst, item);
- parts2 = replaceProtectedList(parts, protlst2);
+ protlst = getProtectedList(parts);
+ protlst2 = deleteOrUpdateComponentFromElementitems(name, protlst, item);
+ parts2 = replaceProtectedList(parts, protlst2);
end if;
then
Absyn.CLASS(i,p,f,e,r,Absyn.CLASS_EXTENDS(bcpath,mod,cmt,parts2,ann),file_info);
@@ -11516,7 +11516,7 @@ public function getUsesAnnotation
string of values for the Documentation annotation for the class named by the
first argument."
input Absyn.Program p;
- output list>> usesStr;
+ output list,Boolean>> usesStr;
algorithm
usesStr := matchcontinue (p)
local
@@ -11538,23 +11538,23 @@ public function getUsesAnnotationOrDefault
first argument."
input Absyn.Program p;
input Boolean requireExactVersion;
- output list>> usesStr;
+ output list,Boolean>> usesStr;
protected
list paths;
list> strs;
algorithm
usesStr := getUsesAnnotation(p);
- paths := List.map(usesStr,Util.tuple21);
- strs := List.map(usesStr,Util.tuple22);
+ paths := List.map(usesStr,Util.tuple31);
+ strs := List.map(usesStr,Util.tuple32);
if not requireExactVersion then
strs := List.map1(strs,listAppend,{"default"});
end if;
- usesStr := List.threadTuple(paths,strs);
+ usesStr := list((p,s,false) threaded for p in paths, s in strs);
end getUsesAnnotationOrDefault;
protected function getUsesAnnotationString
input Option mod;
- output list>> usesStr;
+ output list,Boolean>> usesStr;
algorithm
usesStr := match (mod)
local
@@ -11568,13 +11568,13 @@ end getUsesAnnotationString;
protected function getUsesAnnotationString2
input list eltArgs;
- output list>> strs;
+ output list,Boolean>> strs;
algorithm
strs := match eltArgs
local
list xs;
String name, version;
- list>> ss;
+ list,Boolean>> ss;
Absyn.Info info;
case ({}) then {};
@@ -11585,13 +11585,13 @@ algorithm
})))::xs)
equation
ss = getUsesAnnotationString2(xs);
- then (Absyn.IDENT(name),{version})::ss;
+ then (Absyn.IDENT(name),{version},false)::ss;
case (Absyn.MODIFICATION(info = info, path = Absyn.IDENT(name = name))::xs)
equation
Error.addSourceMessage(Error.USES_MISSING_VERSION, {name}, info);
ss = getUsesAnnotationString2(xs);
- then (Absyn.IDENT(name),{"default"})::ss;
+ then (Absyn.IDENT(name),{"default"},false)::ss;
case (_::xs)
equation