OMCompiler/Compiler/NFFrontEnd/BaseModelica.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 BaseModelica | ||
| 37 | protected | ||
| 38 | import Flags; | ||
| 39 | |||
| 40 | public | ||
| 41 | type ScalarizeMode = enumeration( | ||
| 42 | SCALARIZED, | ||
| 43 | PARTIALLY_SCALARIZED, | ||
| 44 | NOT_SCALARIZED | ||
| 45 | ); | ||
| 46 | |||
| 47 | type RecordMode = enumeration( | ||
| 48 | WITH_RECORDS, | ||
| 49 | WITHOUT_RECORDS | ||
| 50 | ); | ||
| 51 | |||
| 52 | uniontype OutputFormat | ||
| 53 | record OUTPUT_FORMAT | ||
| 54 | ScalarizeMode scalarizeMode; | ||
| 55 | RecordMode recordMode; | ||
| 56 | Boolean moveBindings; | ||
| 57 | Boolean showConfidence; | ||
| 58 | end OUTPUT_FORMAT; | ||
| 59 | end OutputFormat; | ||
| 60 | |||
| 61 | constant OutputFormat defaultFormat = OutputFormat.OUTPUT_FORMAT( | ||
| 62 | ScalarizeMode.PARTIALLY_SCALARIZED, | ||
| 63 | RecordMode.WITH_RECORDS, | ||
| 64 | false, | ||
| 65 | false | ||
| 66 | ); | ||
| 67 | |||
| 68 | function formatFromFlags | ||
| 69 | output OutputFormat format = defaultFormat; | ||
| 70 | algorithm | ||
| 71 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 28 times.
|
32 | if not Flags.isSet(Flags.NF_SCALARIZE) then |
| 72 | 4 | format.scalarizeMode := ScalarizeMode.NOT_SCALARIZED; | |
| 73 | elseif Flags.isConfigFlagSet(Flags.BASE_MODELICA_OPTIONS, "scalarize") then | ||
| 74 | 5 | format.scalarizeMode := ScalarizeMode.SCALARIZED; | |
| 75 | format.recordMode := RecordMode.WITHOUT_RECORDS; | ||
| 76 | end if; | ||
| 77 | |||
| 78 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 32 times.
|
36 | for option in Flags.getConfigStringList(Flags.BASE_MODELICA_FORMAT) loop |
| 79 | () := match option | ||
| 80 | 1 | case "scalarized" algorithm format.scalarizeMode := ScalarizeMode.SCALARIZED; then (); | |
| 81 | ✗ | case "partiallyScalarized" algorithm format.scalarizeMode := ScalarizeMode.PARTIALLY_SCALARIZED; then (); | |
| 82 | ✗ | case "nonScalarized" algorithm format.scalarizeMode := ScalarizeMode.NOT_SCALARIZED; then (); | |
| 83 | 1 | case "withRecords" algorithm format.recordMode := RecordMode.WITH_RECORDS; then (); | |
| 84 | ✗ | case "withoutRecords" algorithm format.recordMode := RecordMode.WITHOUT_RECORDS; then (); | |
| 85 | 2 | case "showConfidence" algorithm format.showConfidence := true; then (); | |
| 86 | else (); | ||
| 87 | end match; | ||
| 88 | end for; | ||
| 89 | |||
| 90 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | format.moveBindings := Flags.isConfigFlagSet(Flags.BASE_MODELICA_OPTIONS, "moveBindings"); |
| 91 | end formatFromFlags; | ||
| 92 | |||
| 93 | function inlineFunctions | ||
| 94 | output Boolean enabled = Flags.isConfigFlagSet(Flags.BASE_MODELICA_OPTIONS, "inlineFunctions"); | ||
| 95 | end inlineFunctions; | ||
| 96 | |||
| 97 | annotation(__OpenModelica_Interface="nf_frontend"); | ||
| 98 | end BaseModelica; | ||
| 99 |