Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 02027be

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Move more constants from System.mo to Autoconf.mo
Belonging to [master]: - #3018
1 parent 5db7684 commit 02027be

23 files changed

+131
-178
lines changed

Compiler/BackEnd/OpenTURNS.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,9 @@ public function getFullSharePath
686686
algorithm
687687
strFullSharePath :=
688688
Settings.getInstallationDirectoryPath() +
689-
System.pathDelimiter() +
689+
Autoconf.pathDelimiter +
690690
cStrSharePath +
691-
System.pathDelimiter();
691+
Autoconf.pathDelimiter;
692692
end getFullSharePath;
693693

694694
public function getFullShareFileName

Compiler/FrontEnd/ClassLoader.mo

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ encapsulated package ClassLoader
4343
import Absyn;
4444

4545
protected
46+
import Autoconf;
4647
import BaseHashTable;
4748
import Config;
4849
import Debug;
@@ -103,7 +104,7 @@ algorithm
103104
/* Simple names: Just load the file if it can be found in $OPENMODELICALIBRARY */
104105
case (Absyn.IDENT(name = classname),_,mp,_)
105106
equation
106-
gd = System.groupDelimiter();
107+
gd = Autoconf.groupDelimiter;
107108
mps = System.strtok(mp, gd);
108109
p = loadClassFromMps(classname, priorityList, mps, encoding, requireExactVersion, encrypted);
109110
checkOnLoadMessage(p);
@@ -112,7 +113,7 @@ algorithm
112113
/* Qualified names: First check if it is defined in a file pack.mo */
113114
case (Absyn.QUALIFIED(name = pack),_,mp,_)
114115
equation
115-
gd = System.groupDelimiter();
116+
gd = Autoconf.groupDelimiter;
116117
mps = System.strtok(mp, gd);
117118
p = loadClassFromMps(pack, priorityList, mps, encoding, requireExactVersion, encrypted);
118119
checkOnLoadMessage(p);
@@ -190,7 +191,7 @@ algorithm
190191

191192
case (_,_,_,false,_)
192193
equation
193-
pd = System.pathDelimiter();
194+
pd = Autoconf.pathDelimiter;
194195
/* Check for path/package.encoding; OpenModelica extension */
195196
encodingfile = stringAppendList({path,pd,"package.encoding"});
196197
encoding = System.trimChar(System.trimChar(if System.regularFileExists(encodingfile) then System.readFile(encodingfile) else Util.getOptionOrDefault(optEncoding,"UTF-8"),"\n")," ");
@@ -202,7 +203,7 @@ algorithm
202203
case (_,_,_,true,_)
203204
equation
204205
/* Check for path/package.encoding; OpenModelica extension */
205-
pd = System.pathDelimiter();
206+
pd = Autoconf.pathDelimiter;
206207
encodingfile = stringAppendList({path,pd,name,pd,"package.encoding"});
207208
encoding = System.trimChar(System.trimChar(if System.regularFileExists(encodingfile) then System.readFile(encodingfile) else Util.getOptionOrDefault(optEncoding,"UTF-8"),"\n")," ");
208209

@@ -236,7 +237,7 @@ protected function getAllFilesFromDirectory
236237
output list<String> files;
237238
protected
238239
list<String> subdirs;
239-
String pd = System.pathDelimiter();
240+
String pd = Autoconf.pathDelimiter;
240241
algorithm
241242
if encrypted then
242243
files := (dir + pd + "package.moc") :: listAppend(list(dir + pd + f for f in System.mocFiles(dir)), acc);
@@ -275,7 +276,7 @@ algorithm
275276
list<Absyn.Annotation> ann;
276277
case (_,pack,mp,within_)
277278
equation
278-
pd = System.pathDelimiter();
279+
pd = Autoconf.pathDelimiter;
279280
mp_1 = stringAppendList({mp,pd,pack});
280281
packagefile = stringAppendList({mp_1,pd,if encrypted then "package.moc" else "package.mo"});
281282
orderfile = stringAppendList({mp_1,pd,"package.order"});
@@ -355,7 +356,7 @@ algorithm
355356

356357
case CLASSLOAD(id)
357358
equation
358-
pd = System.pathDelimiter();
359+
pd = Autoconf.pathDelimiter;
359360
file = mp + pd + id + (if encrypted then "/package.moc" else "/package.mo");
360361
bDirectoryAndFileExists = System.directoryExists(mp + pd + id) and System.regularFileExists(file);
361362
if bDirectoryAndFileExists then
@@ -534,7 +535,7 @@ algorithm
534535
String pd,str;
535536
case (CLASSLOAD(str),_,_)
536537
equation
537-
pd = System.pathDelimiter();
538+
pd = Autoconf.pathDelimiter;
538539
Error.assertionOrAddSourceMessage(System.directoryExists(mp + pd + str) or System.regularFileExists(mp + pd + str + (if encrypted then ".moc" else ".mo")),Error.PACKAGE_ORDER_FILE_NOT_FOUND,{str},info);
539540
then ();
540541
else ();
@@ -549,7 +550,7 @@ protected function existPackage
549550
protected
550551
String pd;
551552
algorithm
552-
pd := System.pathDelimiter();
553+
pd := Autoconf.pathDelimiter;
553554
b := System.regularFileExists(mp + pd + name + pd + (if encrypted then "package.moc" else "package.mo"));
554555
end existPackage;
555556

Compiler/Script/CevalScript.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function compileModel "Compiles a model given a file-prefix, helper funct
222222
input list<String> makeVars = {};
223223
protected
224224
String omhome = Settings.getInstallationDirectoryPath(),omhome_1 = System.stringReplace(omhome, "\"", "");
225-
String pd = System.pathDelimiter();
225+
String pd = Autoconf.pathDelimiter;
226226
String cdWorkingDir,setMakeVars,libsfilename,libs_str,s_call,filename,winCompileMode,workDir = (if stringEq(workingDir, "") then "" else workingDir + pd);
227227
String fileDLL = workDir + fileprefix + Autoconf.dllExt,
228228
fileEXE = workDir + fileprefix + Autoconf.exeExt,
@@ -316,7 +316,7 @@ algorithm
316316
// send "" priority if that is it, don't send "default"
317317
// see https://trac.openmodelica.org/OpenModelica/ticket/2422
318318
// prio = if_(stringEq(prio,""), "default", prio);
319-
mp := System.realpath(dir + "/../") + System.groupDelimiter() + Settings.getModelicaPath(Config.getRunningTestsuite());
319+
mp := System.realpath(dir + "/../") + Autoconf.groupDelimiter + Settings.getModelicaPath(Config.getRunningTestsuite());
320320
(outProgram,true) := loadModel((Absyn.IDENT(cname),{prio},true)::{}, mp, p, true, true, checkUses, true, filename == "package.moc");
321321
return;
322322
end if;
@@ -376,7 +376,7 @@ algorithm
376376
(modelicaPath, forceLoad, notifyLoad, checkUses, requireExactVersion, encrypted) := inArg;
377377
if onlyCheckFirstModelicaPath then
378378
/* Using loadFile() */
379-
thisModelicaPath::_ := System.strtok(modelicaPath, System.groupDelimiter());
379+
thisModelicaPath::_ := System.strtok(modelicaPath, Autoconf.groupDelimiter);
380380
else
381381
thisModelicaPath := modelicaPath;
382382
end if;
@@ -3111,7 +3111,7 @@ algorithm
31113111
equation
31123112
(name::names) = System.strtok(name,".");
31133113
failure(_ = Interactive.getPathedClassInProgram(Absyn.IDENT(name),program));
3114-
gd = System.groupDelimiter();
3114+
gd = Autoconf.groupDelimiter;
31153115
mps = System.strtok(mp, gd);
31163116
(mp,name,isDir) = System.getLoadModelPath(name, {"default"}, mps);
31173117
mp = if isDir then mp + name else mp;

Compiler/Script/CevalScriptBackend.mo

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ algorithm
15071507
result_file := stringAppendList(List.consOnTrue(not Config.getRunningTestsuite(),compileDir,{executable,"_res.",outputFormat_str}));
15081508
// result file might have been set by simflags (-r ...)
15091509
result_file := selectResultFile(result_file, simflags);
1510-
executableSuffixedExe := stringAppend(executable, getSimulationExtension(Config.simCodeTarget(),System.platform()));
1510+
executableSuffixedExe := stringAppend(executable, getSimulationExtension(Config.simCodeTarget(),Autoconf.platform));
15111511
logFile := stringAppend(executable,".log");
15121512
// adrpo: log file is deleted by buildModel! do NOT DELETE IT AGAIN!
15131513
// we should really have different log files for simulation/compilation!
@@ -1672,7 +1672,7 @@ algorithm
16721672
(cache,simSettings) = calculateSimulationSettings(cache,env,vals,msg);
16731673
SimCode.SIMULATION_SETTINGS(outputFormat = outputFormat_str) = simSettings;
16741674
result_file = stringAppendList(List.consOnTrue(not Config.getRunningTestsuite(),compileDir,{executable,"_res.",outputFormat_str}));
1675-
executableSuffixedExe = stringAppend(executable, getSimulationExtension(Config.simCodeTarget(),System.platform()));
1675+
executableSuffixedExe = stringAppend(executable, getSimulationExtension(Config.simCodeTarget(),Autoconf.platform));
16761676
logFile = stringAppend(executable,".log");
16771677
// adrpo: log file is deleted by buildModel! do NOT DELTE IT AGAIN!
16781678
// we should really have different log files for simulation/compilation!
@@ -1758,9 +1758,9 @@ algorithm
17581758
true = b; /* if something goes wrong while initializing */
17591759
fmiTypeDefinitionsList = listReverse(fmiTypeDefinitionsList);
17601760
fmiModelVariablesList = listReverse(fmiModelVariablesList);
1761-
s1 = System.tolower(System.platform());
1761+
s1 = System.tolower(Autoconf.platform);
17621762
str = Tpl.tplString(CodegenFMU.importFMUModelica, FMI.FMIIMPORT(s1, filename, workdir, fmiLogLevel, b2, fmiContext, fmiInstance, fmiInfo, fmiTypeDefinitionsList, fmiExperimentAnnotation, fmiModelVariablesInstance, fmiModelVariablesList, inputConnectors, outputConnectors));
1763-
pd = System.pathDelimiter();
1763+
pd = Autoconf.pathDelimiter;
17641764
str1 = FMI.getFMIModelIdentifier(fmiInfo);
17651765
str2 = FMI.getFMIType(fmiInfo);
17661766
str3 = FMI.getFMIVersion(fmiInfo);
@@ -1802,9 +1802,9 @@ algorithm
18021802
true = b; /* if something goes wrong while initializing */
18031803
fmiTypeDefinitionsList = listReverse(fmiTypeDefinitionsList);
18041804
fmiModelVariablesList = listReverse(fmiModelVariablesList);
1805-
s1 = System.tolower(System.platform());
1805+
s1 = System.tolower(Autoconf.platform);
18061806
str = Tpl.tplString(CodegenFMU.importFMUModelDescription, FMI.FMIIMPORT(s1, modeldescriptionfilename, workdir, fmiLogLevel, b2, fmiContext, fmiInstance, fmiInfo, fmiTypeDefinitionsList, fmiExperimentAnnotation, fmiModelVariablesInstance, fmiModelVariablesList, inputConnectors, outputConnectors));
1807-
pd = System.pathDelimiter();
1807+
pd = Autoconf.pathDelimiter;
18081808
str1 = FMI.getFMIModelIdentifier(fmiInfo);
18091809
str3 = FMI.getFMIVersion(fmiInfo);
18101810
outputFile = stringAppendList({workdir,pd,str1,"_Input_Output_FMU.mo"});
@@ -2192,7 +2192,7 @@ algorithm
21922192
case (cache,_,"getAvailableLibraries",{},_)
21932193
equation
21942194
mp = Settings.getModelicaPath(Config.getRunningTestsuite());
2195-
gd = System.groupDelimiter();
2195+
gd = Autoconf.groupDelimiter;
21962196
mps = System.strtok(mp, gd);
21972197
files = List.flatten(List.map(mps, System.moFiles));
21982198
dirs = List.flatten(List.map(mps, getLibrarySubdirectories));
@@ -2358,7 +2358,7 @@ algorithm
23582358
case (cache,_,"checkTaskGraph",{Values.STRING(filename),Values.STRING(filename_1)},_)
23592359
equation
23602360
pwd = System.pwd();
2361-
pd = System.pathDelimiter();
2361+
pd = Autoconf.pathDelimiter;
23622362
filename = if System.substring(filename,1,1) == "/" then filename else stringAppendList({pwd,pd,filename});
23632363
filename_1 = if System.substring(filename_1,1,1) == "/" then filename_1 else stringAppendList({pwd,pd,filename_1});
23642364
strings = TaskGraphResults.checkTaskGraph(filename, filename_1);
@@ -2372,7 +2372,7 @@ algorithm
23722372
case (cache,_,"checkCodeGraph",{Values.STRING(filename),Values.STRING(filename_1)},_)
23732373
equation
23742374
pwd = System.pwd();
2375-
pd = System.pathDelimiter();
2375+
pd = Autoconf.pathDelimiter;
23762376
filename = if System.substring(filename,1,1) == "/" then filename else stringAppendList({pwd,pd,filename});
23772377
filename_1 = if System.substring(filename_1,1,1) == "/" then filename_1 else stringAppendList({pwd,pd,filename_1});
23782378
strings = TaskGraphResults.checkCodeGraph(filename, filename_1);
@@ -2409,7 +2409,7 @@ algorithm
24092409
omhome = Settings.getInstallationDirectoryPath();
24102410
// get the simulation filename
24112411
(cache,filename) = cevalCurrentSimulationResultExp(cache,env,filename,msg);
2412-
pd = System.pathDelimiter();
2412+
pd = Autoconf.pathDelimiter;
24132413
// create absolute path of simulation result file
24142414
str1 = System.pwd() + pd + filename;
24152415
s1 = if Autoconf.os == "Windows_NT" then ".exe" else "";
@@ -2470,7 +2470,7 @@ algorithm
24702470
omhome = Settings.getInstallationDirectoryPath();
24712471
// get the simulation filename
24722472
(cache,filename) = cevalCurrentSimulationResultExp(cache,env,filename,msg);
2473-
pd = System.pathDelimiter();
2473+
pd = Autoconf.pathDelimiter;
24742474
// create absolute path of simulation result file
24752475
str1 = System.pwd() + pd + filename;
24762476
s1 = if Autoconf.os == "Windows_NT" then ".exe" else "";
@@ -2850,7 +2850,7 @@ algorithm
28502850
omhome = Settings.getInstallationDirectoryPath();
28512851
// get the simulation filename
28522852
(cache,filename) = cevalCurrentSimulationResultExp(cache,env,filename,msg);
2853-
pd = System.pathDelimiter();
2853+
pd = Autoconf.pathDelimiter;
28542854
// create absolute path of simulation result file
28552855
str1 = System.pwd() + pd + filename;
28562856
s1 = if Autoconf.os == "Windows_NT" then ".exe" else "";
@@ -2935,7 +2935,7 @@ protected function getLibrarySubdirectories "author: lochel
29352935
output list<String> outSubdirectories = {};
29362936
protected
29372937
list<String> allSubdirectories = System.subDirectories(inPath);
2938-
String pd = System.pathDelimiter();
2938+
String pd = Autoconf.pathDelimiter;
29392939
algorithm
29402940
for dir in allSubdirectories loop
29412941
if System.regularFileExists(inPath + pd + dir + pd + "package.mo") then
@@ -3363,8 +3363,8 @@ protected
33633363
algorithm
33643364
CC := System.getCCompiler();
33653365
CFLAGS := "-Os "+System.stringReplace(System.getCFlags(),"${MODELICAUSERCFLAGS}","");
3366-
LDFLAGS := ("-L"+dquote+Settings.getInstallationDirectoryPath()+"/lib/"+System.getTriple()+"/omc"+dquote+" "+
3367-
"-Wl,-rpath,"+dquote+Settings.getInstallationDirectoryPath()+"/lib/"+System.getTriple()+"/omc"+dquote+" "+
3366+
LDFLAGS := ("-L"+dquote+Settings.getInstallationDirectoryPath()+"/lib/"+Autoconf.triple+"/omc"+dquote+" "+
3367+
"-Wl,-rpath,"+dquote+Settings.getInstallationDirectoryPath()+"/lib/"+Autoconf.triple+"/omc"+dquote+" "+
33683368
System.getLDFlags()+" ");
33693369
if System.regularFileExists(logfile) then
33703370
System.removeFile(logfile);
@@ -3509,7 +3509,7 @@ algorithm
35093509
try
35103510
(success, cache, libs,_, _) := SimCodeMain.translateModel(SimCodeMain.TranslateModelKind.FMU(FMUVersion, FMUType, fmuTargetName), cache, inEnv, className, filenameprefix, addDummy, SOME(simSettings));
35113511
true := success;
3512-
outValue := Values.STRING((if not Config.getRunningTestsuite() then System.pwd() + System.pathDelimiter() else "") + fmuTargetName + ".fmu");
3512+
outValue := Values.STRING((if not Config.getRunningTestsuite() then System.pwd() + Autoconf.pathDelimiter else "") + fmuTargetName + ".fmu");
35133513
else
35143514
outValue := Values.STRING("");
35153515
return;
@@ -3582,7 +3582,7 @@ algorithm
35823582
if (System.regularFileExists(fileName)) then
35833583
// get OPENMODELICAHOME
35843584
omhome := Settings.getInstallationDirectoryPath();
3585-
pd := System.pathDelimiter();
3585+
pd := Autoconf.pathDelimiter;
35863586
ext := if Autoconf.os == "Windows_NT" then ".exe" else "";
35873587
if encrypt then
35883588
// create the path till packagetool
@@ -3645,7 +3645,7 @@ protected
36453645
Boolean success;
36463646
algorithm
36473647
(success,cache) := SimCodeMain.translateModel(SimCodeMain.TranslateModelKind.XML(),cache,env,className,fileNamePrefix,addDummy,inSimSettingsOpt);
3648-
outValue := Values.STRING(if success then ((if not Config.getRunningTestsuite() then System.pwd() + System.pathDelimiter() else "") + fileNamePrefix+".xml") else "");
3648+
outValue := Values.STRING(if success then ((if not Config.getRunningTestsuite() then System.pwd() + Autoconf.pathDelimiter else "") + fileNamePrefix+".xml") else "");
36493649
end translateModelXML;
36503650

36513651

@@ -5039,7 +5039,7 @@ algorithm
50395039
end if;
50405040
end if;
50415041

5042-
compileDir := System.pwd() + System.pathDelimiter();
5042+
compileDir := System.pwd() + Autoconf.pathDelimiter;
50435043
(cache,simSettings) := calculateSimulationSettings(cache, env, values, msg);
50445044
SimCode.SIMULATION_SETTINGS(method = method_str, outputFormat = outputFormat_str) := simSettings;
50455045

@@ -5264,7 +5264,7 @@ algorithm
52645264
p_class = Absyn.crefToPath(class_) "change to the saved files directory" ;
52655265
cdef = Interactive.getPathedClassInProgram(p_class, p);
52665266
filename = Absyn.classFilename(cdef);
5267-
pd = System.pathDelimiter();
5267+
pd = Autoconf.pathDelimiter;
52685268
(pd_1 :: _) = stringListStringChar(pd);
52695269
filename_1 = Util.stringSplitAtChar(filename, pd_1);
52705270
dir = List.stripLast(filename_1);
@@ -5275,7 +5275,7 @@ algorithm
52755275
equation
52765276
omhome = Settings.getInstallationDirectoryPath() "model not yet saved! change to $OPENMODELICAHOME/work" ;
52775277
omhome_1 = System.trim(omhome, "\"");
5278-
pd = System.pathDelimiter();
5278+
pd = Autoconf.pathDelimiter;
52795279
dir_1 = stringAppendList({"\"",omhome_1,pd,"work","\""});
52805280
then
52815281
dir_1;
@@ -5444,7 +5444,7 @@ algorithm
54445444
(cache, env, dae) = dumpXMLDAEFrontEnd(cache, env, classname);
54455445
description = DAEUtil.daeDescription(dae);
54465446

5447-
compileDir = System.pwd() + System.pathDelimiter();
5447+
compileDir = System.pwd() + Autoconf.pathDelimiter;
54485448
cname_str = Absyn.pathString(classname);
54495449
filenameprefix = if filenameprefix == "<default>" then cname_str else filenameprefix;
54505450

@@ -5484,7 +5484,7 @@ algorithm
54845484
(cache, env, dae) = dumpXMLDAEFrontEnd(cache, env, classname);
54855485
description = DAEUtil.daeDescription(dae);
54865486

5487-
compileDir = System.pwd() + System.pathDelimiter();
5487+
compileDir = System.pwd() + Autoconf.pathDelimiter;
54885488
cname_str = Absyn.pathString(classname);
54895489
filenameprefix = if filenameprefix == "<default>" then cname_str else filenameprefix;
54905490

@@ -5525,7 +5525,7 @@ algorithm
55255525
(cache, env, dae) = dumpXMLDAEFrontEnd(cache, env, classname);
55265526
description = DAEUtil.daeDescription(dae);
55275527

5528-
compileDir = System.pwd() + System.pathDelimiter();
5528+
compileDir = System.pwd() + Autoconf.pathDelimiter;
55295529
cname_str = Absyn.pathString(classname);
55305530
filenameprefix = if filenameprefix == "<default>" then cname_str else filenameprefix;
55315531

@@ -5564,7 +5564,7 @@ algorithm
55645564
(cache, env, dae) = dumpXMLDAEFrontEnd(cache, env, classname);
55655565
description = DAEUtil.daeDescription(dae);
55665566

5567-
compileDir = System.pwd() + System.pathDelimiter();
5567+
compileDir = System.pwd() + Autoconf.pathDelimiter;
55685568
cname_str = Absyn.pathString(classname);
55695569
filenameprefix = if filenameprefix == "<default>" then cname_str else filenameprefix;
55705570

Compiler/SimCode/SerializeModelInfo.mo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import SimCode;
4646

4747
protected
4848
import Algorithm;
49+
import Autoconf;
4950
import Config;
5051
import DAEDump;
5152
import Error;
@@ -77,7 +78,7 @@ algorithm
7778
case SimCode.SIMCODE(modelInfo=mi as SimCode.MODELINFO(vars=vars))
7879
equation
7980
if Config.simCodeTarget() == "omsic" then
80-
fileName = code.fullPathPrefix + System.pathDelimiter() + code.fileNamePrefix + "_info.json";
81+
fileName = code.fullPathPrefix + Autoconf.pathDelimiter + code.fileNamePrefix + "_info.json";
8182
else
8283
fileName = code.fileNamePrefix + "_info.json";
8384
end if;

0 commit comments

Comments
 (0)