Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 90.0% 9 / 0 / 10
Functions: -% 0 / 1 / 1
Branches: -% 0 / 0 / 0

OMCompiler/Compiler/Script/BackendInterfaceImplementation.mo
Line Branch Exec Source
1 /*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF AGPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL
14 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the OSMC (Open Source Modelica Consortium)
17 * Public License (OSMC-PL) are obtained from OSMC, either from the above
18 * address, from the URLs:
19 * http://www.openmodelica.org or
20 * https://github.com/OpenModelica/ or
21 * http://www.ida.liu.se/projects/OpenModelica,
22 * and in the OpenModelica distribution.
23 *
24 * GNU AGPL version 3 is obtained from:
25 * https://www.gnu.org/licenses/licenses.html#GPL
26 *
27 * This program is distributed WITHOUT ANY WARRANTY; without
28 * even the implied warranty of MERCHANTABILITY or FITNESS
29 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
30 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
31 *
32 * See the full OSMC Public License conditions for more details.
33 *
34 */
35
36 encapsulated package BackendInterfaceImplementation
37 " file: BackendInterfaceImplementation.mo
38 package: BackendInterfaceImplementation
39 description: Interface functions used to separate frontend and backend."
40
41 public import Absyn;
42 public import DAE;
43 public import FCore;
44 public import Values;
45
46 protected
47 import BackendInterface;
48 import BackendCevalInterface;
49 import CevalScript;
50 import RewriteRules;
51 import StaticScript;
52 import SymbolTable;
53 import InstHashTable;
54
55 public function initializeBackendInterface
56 algorithm
57 2677 BackendInterface.initializeBackendInterface(BackendInterface.BACKEND_INTERFACE_FUNCTIONS(
58 noRewriteRulesFrontEnd,
59 rewriteFrontEnd,
60 appendLibrary,
61 InstHashTable.init));
62 2677 BackendCevalInterface.initializeBackendInterface(BackendCevalInterface.BACKEND_INTERFACE_FUNCTIONS(
63 cevalInteractiveFunctions,
64 cevalCallFunction,
65 elabCallInteractive));
66 end initializeBackendInterface;
67
68 protected
69
70 function cevalInteractiveFunctions
71 input FCore.Cache inCache;
72 input FCore.Graph inEnv;
73 input DAE.Exp inExp;
74 input Absyn.Msg inMsg;
75 input Integer inNumIter;
76 output FCore.Cache outCache;
77 output Values.Value outValue;
78 algorithm
79 11333 (outCache, outValue) := CevalScript.cevalInteractiveFunctions( inCache, inEnv, inExp, inMsg, inNumIter);
80 end cevalInteractiveFunctions;
81
82 function cevalCallFunction
83 input FCore.Cache inCache;
84 input FCore.Graph inEnv;
85 input DAE.Exp inExp;
86 input list<Values.Value> inValues;
87 input Boolean inImplInst;
88 input Absyn.Msg inMsg;
89 input Integer inNumIter = 1;
90 output FCore.Cache outCache;
91 output Values.Value outValue;
92 algorithm
93 64295 (outCache, outValue) := CevalScript.cevalCallFunction(inCache, inEnv, inExp, inValues, inImplInst, inMsg, inNumIter);
94 end cevalCallFunction;
95
96 function elabCallInteractive "Note: elabCall_InteractiveFunction is set in the error buffer; the called function should pop it"
97 input FCore.Cache inCache;
98 input FCore.Graph inEnv;
99 input Absyn.ComponentRef inCref;
100 input list<Absyn.Exp> inExps;
101 input list<Absyn.NamedArg> inNamedArgs;
102 input Boolean inImplInst;
103 input DAE.Prefix inPrefix;
104 input SourceInfo inInfo;
105 output FCore.Cache outCache;
106 output DAE.Exp outExp;
107 output DAE.Properties outProperties;
108 algorithm
109 2660 (outCache, outExp, outProperties) :=
110 StaticScript.elabCallInteractive(inCache, inEnv, inCref, inExps, inNamedArgs, inImplInst, inPrefix, inInfo);
111 end elabCallInteractive;
112
113 function noRewriteRulesFrontEnd
114 output Boolean noRules;
115 algorithm
116 2357736 noRules := RewriteRules.noRewriteRulesFrontEnd();
117 end noRewriteRulesFrontEnd;
118
119 function rewriteFrontEnd
120 input Absyn.Exp inExp;
121 output Absyn.Exp outExp;
122 output Boolean isChanged;
123 algorithm
124 ✗ (outExp,isChanged) := RewriteRules.rewriteFrontEnd(inExp);
125 end rewriteFrontEnd;
126
127 function appendLibrary
128 input Absyn.Path modelName;
129 input String modelicaPath;
130 output Absyn.Program program;
131 output Boolean success;
132 algorithm
133 403 program := SymbolTable.getAbsyn();
134 806 (program, success) := CevalScript.loadModel({(modelName, "", {"default"}, false)},
135 modelicaPath, program, true, true, true, false);
136 403 SymbolTable.setAbsyn(program);
137 end appendLibrary;
138
139 annotation(__OpenModelica_Interface="backend_main");
140 end BackendInterfaceImplementation;
141