OMCompiler/Compiler/FrontEnd/BackendCevalInterface.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 BackendCevalInterface | ||
| 37 | " file: BackendCevalInterface.mo | ||
| 38 | package: BackendCevalInterface | ||
| 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 Global; | ||
| 49 | |||
| 50 | public | ||
| 51 | |||
| 52 | uniontype BackendInterfaceFunctions | ||
| 53 | record BACKEND_INTERFACE_FUNCTIONS | ||
| 54 | partialCevalInteractiveFunctions cevalInteractiveFunctions; | ||
| 55 | partialCevalCallFunction cevalCallFunction; | ||
| 56 | partialElabCallInteractive elabCallInteractive; | ||
| 57 | end BACKEND_INTERFACE_FUNCTIONS; | ||
| 58 | end BackendInterfaceFunctions; | ||
| 59 | |||
| 60 | public function initializeBackendInterface | ||
| 61 | input BackendInterfaceFunctions inFunctions; | ||
| 62 | algorithm | ||
| 63 | 2677 | setGlobalRoot(Global.backendCevalInterface, inFunctions); | |
| 64 | end initializeBackendInterface; | ||
| 65 | |||
| 66 | function cevalInteractiveFunctions | ||
| 67 | input FCore.Cache inCache; | ||
| 68 | input FCore.Graph inEnv; | ||
| 69 | input DAE.Exp inExp; | ||
| 70 | input Absyn.Msg inMsg; | ||
| 71 | input Integer inNumIter; | ||
| 72 | output FCore.Cache outCache; | ||
| 73 | output Values.Value outValue; | ||
| 74 | protected | ||
| 75 | BackendInterfaceFunctions functions; | ||
| 76 | partialCevalInteractiveFunctions func; | ||
| 77 | algorithm | ||
| 78 | 11333 | functions := getGlobalRoot(Global.backendCevalInterface); | |
| 79 | 11333 | func := functions.cevalInteractiveFunctions; | |
| 80 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11333 times.
|
11333 | (outCache,outValue) := func(inCache, inEnv, inExp, inMsg, inNumIter); |
| 81 | end cevalInteractiveFunctions; | ||
| 82 | |||
| 83 | function cevalCallFunction | ||
| 84 | input FCore.Cache inCache; | ||
| 85 | input FCore.Graph inEnv; | ||
| 86 | input DAE.Exp inExp; | ||
| 87 | input list<Values.Value> inValues; | ||
| 88 | input Boolean inImplInst; | ||
| 89 | input Absyn.Msg inMsg; | ||
| 90 | input Integer inNumIter = 1; | ||
| 91 | output FCore.Cache outCache; | ||
| 92 | output Values.Value outValue; | ||
| 93 | protected | ||
| 94 | BackendInterfaceFunctions functions; | ||
| 95 | partialCevalCallFunction func; | ||
| 96 | algorithm | ||
| 97 | 64295 | functions := getGlobalRoot(Global.backendCevalInterface); | |
| 98 | 64295 | func := functions.cevalCallFunction; | |
| 99 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 64295 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 5 taken 8919 times.
✓ Branch 6 taken 55376 times.
|
73214 | (outCache,outValue) := func(inCache, inEnv, inExp, inValues, inImplInst, inMsg, inNumIter); |
| 100 | end cevalCallFunction; | ||
| 101 | |||
| 102 | function elabCallInteractive "Note: elabCall_InteractiveFunction is set in the error buffer; the called function should pop it" | ||
| 103 | input FCore.Cache inCache; | ||
| 104 | input FCore.Graph inEnv; | ||
| 105 | input Absyn.ComponentRef inCref; | ||
| 106 | input list<Absyn.Exp> inExps; | ||
| 107 | input list<Absyn.NamedArg> inNamedArgs; | ||
| 108 | input Boolean inImplInst; | ||
| 109 | input DAE.Prefix inPrefix; | ||
| 110 | input SourceInfo inInfo; | ||
| 111 | output FCore.Cache outCache; | ||
| 112 | output DAE.Exp outExp; | ||
| 113 | output DAE.Properties outProperties; | ||
| 114 | protected | ||
| 115 | BackendInterfaceFunctions functions; | ||
| 116 | partialElabCallInteractive func; | ||
| 117 | algorithm | ||
| 118 | 2660 | functions := getGlobalRoot(Global.backendCevalInterface); | |
| 119 | 2660 | func := functions.elabCallInteractive; | |
| 120 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 2660 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 5 taken 53 times.
✓ Branch 6 taken 2607 times.
|
2713 | (outCache, outExp, outProperties) := func(inCache, inEnv, inCref, inExps, inNamedArgs, inImplInst, inPrefix, inInfo); |
| 121 | end elabCallInteractive; | ||
| 122 | |||
| 123 | partial function partialCevalInteractiveFunctions | ||
| 124 | input FCore.Cache inCache; | ||
| 125 | input FCore.Graph inEnv; | ||
| 126 | input DAE.Exp inExp; | ||
| 127 | input Absyn.Msg inMsg; | ||
| 128 | input Integer inNumIter; | ||
| 129 | output FCore.Cache outCache; | ||
| 130 | output Values.Value outValue; | ||
| 131 | end partialCevalInteractiveFunctions; | ||
| 132 | |||
| 133 | partial function partialCevalCallFunction | ||
| 134 | input FCore.Cache inCache; | ||
| 135 | input FCore.Graph inEnv; | ||
| 136 | input DAE.Exp inExp; | ||
| 137 | input list<Values.Value> inValues; | ||
| 138 | input Boolean inImplInst; | ||
| 139 | input Absyn.Msg inMsg; | ||
| 140 | input Integer inNumIter = 1; | ||
| 141 | output FCore.Cache outCache; | ||
| 142 | output Values.Value outValue; | ||
| 143 | end partialCevalCallFunction; | ||
| 144 | |||
| 145 | partial function partialElabCallInteractive "Note: elabCall_InteractiveFunction is set in the error buffer; the called function should pop it" | ||
| 146 | input FCore.Cache inCache; | ||
| 147 | input FCore.Graph inEnv; | ||
| 148 | input Absyn.ComponentRef inCref; | ||
| 149 | input list<Absyn.Exp> inExps; | ||
| 150 | input list<Absyn.NamedArg> inNamedArgs; | ||
| 151 | input Boolean inImplInst; | ||
| 152 | input DAE.Prefix inPrefix; | ||
| 153 | input SourceInfo inInfo; | ||
| 154 | output FCore.Cache outCache; | ||
| 155 | output DAE.Exp outExp; | ||
| 156 | output DAE.Properties outProperties; | ||
| 157 | end partialElabCallInteractive; | ||
| 158 | |||
| 159 | annotation(__OpenModelica_Interface="frontend"); | ||
| 160 | end BackendCevalInterface; | ||
| 161 |