Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 28.0% 1133 / 0 / 4041
Functions: -% 0 / 1 / 1
Branches: 42.6% 80 / 0 / 188

build_cmake/OMCompiler/Compiler/generated-mo/Template/CodegenXML.mo
Line Branch Exec Source
1 encapsulated package CodegenXML
2 "
3 file: CodegenXML.mo
4 package: CodegenXML
5 description: Generated by Susan.
6 "
7
8 public import Tpl;
9
10 public import SimCodeVar;
11 public import HashTableCrefSimVar;
12 public import SimCode;
13 public import SimCodeFunction;
14 public import SimCodeCodegenUtil;
15 public import SimCodeFunctionUtil;
16 public import BackendDAE;
17 public import System;
18 public import Autoconf;
19 protected import Absyn;
20 protected import AbsynUtil;
21 public import MMath;
22 public import DAE;
23 public import ClassInf;
24 public import ClassInfUtil;
25 protected import SCode;
26 protected import SCodeDump;
27 public import StringUtil;
28 public import Util;
29 public import List;
30 public import ComponentReferenceBasics;
31 public import ComponentReference;
32 public import Expression;
33 protected import ExpressionDump;
34 public import ExpressionBasics;
35 public import Config;
36 public import Testsuite;
37 public import Flags;
38 public import FlagsUtil;
39 public import Settings;
40 public import Patternm;
41 public import Error;
42 public import Values;
43 public import ValuesUtil;
44 public import DAEDump;
45 public import Algorithm;
46 protected import ElementSource;
47 public import DAEUtil;
48 public import TypesDump;
49 public import Types;
50 public import HashTableCrIListArray;
51 protected import ExpressionDumpTpl;
52
53 public function translateModel
54 input Tpl.Text in_txt;
55 input SimCode.SimCode in_a_simCode;
56
57 output Tpl.Text out_txt;
58 algorithm
59 out_txt :=
60 match(in_txt, in_a_simCode)
61 local
62 Tpl.Text txt;
63 Absyn.Path i_modelInfo_name;
64 SimCode.SimCode i_simCode;
65 Tpl.Text txt_1;
66 Tpl.Text txt_0;
67
68 case ( txt,
69 (i_simCode as SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(name = i_modelInfo_name))) )
70 algorithm
71 4 txt_0 := generateXml(Tpl.emptyTxt, i_simCode);
72 4 txt_1 := dotPathXml(Tpl.emptyTxt, i_modelInfo_name);
73 4 txt_1 := Tpl.writeTok(txt_1, Tpl.ST_STRING(".xml"));
74 4 Tpl.textFile(txt_0, Tpl.textString(txt_1));
75 then txt;
76
77 case ( txt,
78 _ )
79 then txt;
80 end match;
81 end translateModel;
82
83 public function generateXml
84 input Tpl.Text in_txt;
85 input SimCode.SimCode in_a_simCode;
86
87 output Tpl.Text out_txt;
88 algorithm
89 out_txt :=
90 match(in_txt, in_a_simCode)
91 local
92 Tpl.Text txt;
93 list<DAE.ClassAttributes> i_classAttributes;
94 list<SimCodeFunction.Function> i_modelInfo_functions;
95 list<SimCodeFunction.RecordDeclaration> i_recordDecls;
96 list<SimCode.SimEqSystem> i_initialEquations;
97 list<SimCode.SimEqSystem> i_allEquations;
98 SimCode.ModelInfo i_modelInfo;
99 Option<SimCode.SimulationSettings> i_simulationSettingsOpt;
100 SimCode.SimCode i_simCode;
101 Tpl.Text l_prefix;
102 String ret_1;
103 Tpl.Text l_guid;
104
105 case ( txt,
106 (i_simCode as SimCode.SIMCODE(modelInfo = (i_modelInfo as SimCode.MODELINFO(functions = i_modelInfo_functions)), simulationSettingsOpt = i_simulationSettingsOpt, allEquations = i_allEquations, initialEquations = i_initialEquations, recordDecls = i_recordDecls, classAttributes = i_classAttributes)) )
107 algorithm
108 4 ret_1 := System.getUUIDStr();
109 4 l_guid := Tpl.writeStr(Tpl.emptyTxt, ret_1);
110 4 l_prefix := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("https://github.com/JModelica/JModelica/tree/master/XML"));
111 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
112 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
113 "<OpenModelicaModelDescription\n"
114 }, true));
115 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
116 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("xmlns:exp=\""));
117 4 txt := Tpl.writeText(txt, l_prefix);
118 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
119 "/daeExpressions.xsd\"\n",
120 "xmlns:equ=\""
121 }, false));
122 4 txt := Tpl.writeText(txt, l_prefix);
123 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
124 "/daeEquations.xsd\"\n",
125 "xmlns:fun=\""
126 }, false));
127 4 txt := Tpl.writeText(txt, l_prefix);
128 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
129 "/daeFunctions.xsd\"\n",
130 "xmlns:opt=\""
131 }, false));
132 4 txt := Tpl.writeText(txt, l_prefix);
133 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
134 "/daeOptimization.xsd\"\n",
135 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
136 }, true));
137 4 txt := modelDescriptionXml(txt, i_simCode, Tpl.textString(l_guid));
138 4 txt := Tpl.softNewLine(txt);
139 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
140 ">\n",
141 "\n"
142 }, true));
143 4 txt := vendorAnnotationsXml(txt, i_simCode);
144 4 txt := Tpl.softNewLine(txt);
145 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
146 4 txt := defaultExperiment(txt, i_simulationSettingsOpt);
147 4 txt := Tpl.softNewLine(txt);
148 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
149 4 txt := modelVariablesXml(txt, i_modelInfo);
150 4 txt := Tpl.softNewLine(txt);
151 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
152 4 txt := bindingEquationsXml(txt, i_modelInfo);
153 4 txt := Tpl.softNewLine(txt);
154 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
155 4 txt := equationsXml(txt, i_allEquations);
156 4 txt := Tpl.softNewLine(txt);
157 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
158 4 txt := initialEquationsXml(txt, i_modelInfo, i_initialEquations);
159 4 txt := Tpl.softNewLine(txt);
160 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
161 4 txt := algorithmicEquationsXml(txt, i_allEquations);
162 4 txt := Tpl.softNewLine(txt);
163 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
164 4 txt := recordsXml(txt, i_recordDecls);
165 4 txt := Tpl.softNewLine(txt);
166 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
167 4 txt := functionsXml(txt, i_modelInfo_functions);
168 4 txt := Tpl.softNewLine(txt);
169 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
170 4 txt := objectiveFunctionXml(txt, i_classAttributes, i_simCode);
171 4 txt := Tpl.softNewLine(txt);
172 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
173 4 txt := Tpl.popBlock(txt);
174 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</OpenModelicaModelDescription>"));
175 then txt;
176
177 case ( txt,
178 _ )
179 then txt;
180 end match;
181 end generateXml;
182
183 public function vendorAnnotationsXml
184 input Tpl.Text in_txt;
185 input SimCode.SimCode in_a_simCode;
186
187 output Tpl.Text out_txt;
188 algorithm
189 out_txt :=
190 match(in_txt, in_a_simCode)
191 local
192 Tpl.Text txt;
193 String ret_1;
194 Tpl.Text l_generationTool;
195
196 case ( txt,
197 SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(varInfo = SimCode.VARINFO(numZeroCrossings = _))) )
198 algorithm
199 4 l_generationTool := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("OpenModelica Compiler "));
200 4 ret_1 := Settings.getVersionNr();
201 4 l_generationTool := Tpl.writeStr(l_generationTool, ret_1);
202 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<VendorAnnotations>\n"));
203 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
204 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Tool name=\""));
205 4 txt := Tpl.writeText(txt, l_generationTool);
206 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"> </Tool>\n"));
207 4 txt := Tpl.popBlock(txt);
208 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</VendorAnnotations>"));
209 then txt;
210
211 case ( txt,
212 _ )
213 then txt;
214 end match;
215 end vendorAnnotationsXml;
216
217 public function modelDescriptionXml
218 input Tpl.Text in_txt;
219 input SimCode.SimCode in_a_simCode;
220 input String in_a_guid;
221
222 output Tpl.Text out_txt;
223 algorithm
224 out_txt :=
225 match(in_txt, in_a_simCode, in_a_guid)
226 local
227 Tpl.Text txt;
228 String a_guid;
229 Integer i_modelInfo_varInfo_numZeroCrossings;
230 Integer i_modelInfo_varInfo_numStateVars;
231 String i_fileNamePrefix;
232 Absyn.Path i_modelInfo_name;
233 Tpl.Text l_numberOfEventIndicators;
234 Tpl.Text l_numberOfContinuousStates;
235 Tpl.Text l_variableNamingConvention;
236 Util.DateTime ret_8;
237 Tpl.Text l_generationDateAndTime;
238 Tpl.Text l_version;
239 Tpl.Text l_author;
240 Tpl.Text l_description;
241 String ret_3;
242 Tpl.Text l_modelIdentifier;
243 Tpl.Text l_modelName;
244 Tpl.Text l_fmiVersion;
245
246 case ( txt,
247 SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(varInfo = SimCode.VARINFO(numStateVars = i_modelInfo_varInfo_numStateVars, numZeroCrossings = i_modelInfo_varInfo_numZeroCrossings), name = i_modelInfo_name), fileNamePrefix = i_fileNamePrefix),
248 a_guid )
249 algorithm
250 4 l_fmiVersion := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("1.0"));
251 4 l_modelName := dotPathXml(Tpl.emptyTxt, i_modelInfo_name);
252 4 ret_3 := System.stringReplace(i_fileNamePrefix, ".", "_");
253 4 l_modelIdentifier := Tpl.writeStr(Tpl.emptyTxt, ret_3);
254 l_description := Tpl.emptyTxt;
255 l_author := Tpl.emptyTxt;
256 l_version := Tpl.emptyTxt;
257 4 ret_8 := Util.getCurrentDateTime();
258 4 l_generationDateAndTime := xsdateTimeXml(Tpl.emptyTxt, ret_8);
259 4 l_variableNamingConvention := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("structured"));
260 4 l_numberOfContinuousStates := Tpl.writeStr(Tpl.emptyTxt, intString(i_modelInfo_varInfo_numStateVars));
261 4 l_numberOfEventIndicators := Tpl.writeStr(Tpl.emptyTxt, intString(i_modelInfo_varInfo_numZeroCrossings));
262 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("fmiVersion=\""));
263 4 txt := Tpl.writeText(txt, l_fmiVersion);
264 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
265 "\"\n",
266 "modelName=\""
267 }, false));
268 4 txt := Tpl.writeText(txt, l_modelName);
269 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
270 "\"\n",
271 "modelIdentifier=\""
272 }, false));
273 4 txt := Tpl.writeText(txt, l_modelIdentifier);
274 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
275 "\"\n",
276 "guid=\"{"
277 }, false));
278 4 txt := Tpl.writeStr(txt, a_guid);
279 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
280 "}\"\n",
281 "generationDateAndTime=\""
282 }, false));
283 4 txt := Tpl.writeText(txt, l_generationDateAndTime);
284 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
285 "\"\n",
286 "variableNamingConvention=\""
287 }, false));
288 4 txt := Tpl.writeText(txt, l_variableNamingConvention);
289 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
290 "\"\n",
291 "numberOfContinuousStates=\""
292 }, false));
293 4 txt := Tpl.writeText(txt, l_numberOfContinuousStates);
294 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
295 "\"\n",
296 "numberOfEventIndicators=\""
297 }, false));
298 4 txt := Tpl.writeText(txt, l_numberOfEventIndicators);
299 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
300 then txt;
301
302 case ( txt,
303 _,
304 _ )
305 then txt;
306 end match;
307 end modelDescriptionXml;
308
309 public function xsdateTimeXml
310 input Tpl.Text in_txt;
311 input Util.DateTime in_a_dt;
312
313 output Tpl.Text out_txt;
314 algorithm
315 out_txt :=
316 match(in_txt, in_a_dt)
317 local
318 Tpl.Text txt;
319 Integer i_sec;
320 Integer i_min;
321 Integer i_hour;
322 Integer i_mday;
323 Integer i_mon;
324 Integer i_year;
325 String ret_4;
326 String ret_3;
327 String ret_2;
328 String ret_1;
329 String ret_0;
330
331 case ( txt,
332 Util.DATETIME(year = i_year, mon = i_mon, mday = i_mday, hour = i_hour, min = i_min, sec = i_sec) )
333 algorithm
334 4 txt := Tpl.writeStr(txt, intString(i_year));
335 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("-"));
336 4 ret_0 := SimCodeFunctionUtil.twodigit(i_mon);
337 4 txt := Tpl.writeStr(txt, ret_0);
338 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("-"));
339 4 ret_1 := SimCodeFunctionUtil.twodigit(i_mday);
340 4 txt := Tpl.writeStr(txt, ret_1);
341 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("T"));
342 4 ret_2 := SimCodeFunctionUtil.twodigit(i_hour);
343 4 txt := Tpl.writeStr(txt, ret_2);
344 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING(":"));
345 4 ret_3 := SimCodeFunctionUtil.twodigit(i_min);
346 4 txt := Tpl.writeStr(txt, ret_3);
347 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING(":"));
348 4 ret_4 := SimCodeFunctionUtil.twodigit(i_sec);
349 4 txt := Tpl.writeStr(txt, ret_4);
350 then txt;
351
352 case ( txt,
353 _ )
354 then txt;
355 end match;
356 end xsdateTimeXml;
357
358 public function defaultExperiment
359 input Tpl.Text in_txt;
360 input Option<SimCode.SimulationSettings> in_a_simulationSettingsOpt;
361
362 output Tpl.Text out_txt;
363 algorithm
364 out_txt :=
365 match(in_txt, in_a_simulationSettingsOpt)
366 local
367 Tpl.Text txt;
368 Real i_de_tolerance;
369 Real i_de_stopTime;
370 Real i_de_startTime;
371
372 case ( txt,
373 SOME(SimCode.SIMULATION_SETTINGS(startTime = i_de_startTime, stopTime = i_de_stopTime, tolerance = i_de_tolerance)) )
374 algorithm
375 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<DefaultExperiment startTime=\""));
376 4 txt := Tpl.writeStr(txt, realString(i_de_startTime));
377 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" stopTime=\""));
378 4 txt := Tpl.writeStr(txt, realString(i_de_stopTime));
379 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" tolerance=\""));
380 4 txt := Tpl.writeStr(txt, realString(i_de_tolerance));
381 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" />"));
382 then txt;
383
384 case ( txt,
385 _ )
386 then txt;
387 end match;
388 end defaultExperiment;
389
390 protected function lm_50
391 input output Tpl.Text txt;
392 input list<SimCodeVar.SimVar> items;
393 algorithm
394
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 for lstElt_50 in items loop
395 txt := match lstElt_50
396 local
397 SimCodeVar.SimVar i_var;
398
399 case i_var
400 algorithm
401 10 txt := ScalarVariableXml(txt, i_var);
402 10 txt := Tpl.nextIter(txt);
403 then txt;
404 end match;
405 end for;
406 end lm_50;
407
408 protected function lm_51
409 input output Tpl.Text txt;
410 input list<SimCodeVar.SimVar> items;
411 algorithm
412
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 for lstElt_51 in items loop
413 txt := match lstElt_51
414 local
415 SimCodeVar.SimVar i_var;
416
417 case i_var
418 algorithm
419 10 txt := ScalarVariableXml(txt, i_var);
420 10 txt := Tpl.nextIter(txt);
421 then txt;
422 end match;
423 end for;
424 end lm_51;
425
426 protected function lm_52
427 input output Tpl.Text txt;
428 input list<SimCodeVar.SimVar> items;
429 algorithm
430
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 4 times.
42 for lstElt_52 in items loop
431 txt := match lstElt_52
432 local
433 SimCodeVar.SimVar i_var;
434
435 case i_var
436 algorithm
437 38 txt := ScalarVariableXml(txt, i_var);
438 38 txt := Tpl.nextIter(txt);
439 then txt;
440 end match;
441 end for;
442 end lm_52;
443
444 protected function lm_53
445 input output Tpl.Text txt;
446 input list<SimCodeVar.SimVar> items;
447 algorithm
448
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_53 in items loop
449 txt := match lstElt_53
450 local
451 SimCodeVar.SimVar i_var;
452
453 case i_var
454 algorithm
455 ✗ txt := ScalarVariableXml(txt, i_var);
456 ✗ txt := Tpl.nextIter(txt);
457 then txt;
458 end match;
459 end for;
460 end lm_53;
461
462 protected function lm_54
463 input output Tpl.Text txt;
464 input list<SimCodeVar.SimVar> items;
465 algorithm
466
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_54 in items loop
467 txt := match lstElt_54
468 local
469 SimCodeVar.SimVar i_var;
470
471 case i_var
472 algorithm
473 ✗ txt := ScalarVariableXml(txt, i_var);
474 ✗ txt := Tpl.nextIter(txt);
475 then txt;
476 end match;
477 end for;
478 end lm_54;
479
480 protected function lm_55
481 input output Tpl.Text txt;
482 input list<SimCodeVar.SimVar> items;
483 algorithm
484
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 for lstElt_55 in items loop
485 txt := match lstElt_55
486 local
487 SimCodeVar.SimVar i_var;
488
489 case i_var
490 algorithm
491 4 txt := ScalarVariableXml(txt, i_var);
492 4 txt := Tpl.nextIter(txt);
493 then txt;
494 end match;
495 end for;
496 end lm_55;
497
498 protected function lm_56
499 input output Tpl.Text txt;
500 input list<SimCodeVar.SimVar> items;
501 algorithm
502
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_56 in items loop
503 txt := match lstElt_56
504 local
505 SimCodeVar.SimVar i_var;
506
507 case i_var
508 algorithm
509 ✗ txt := ScalarVariableXml(txt, i_var);
510 ✗ txt := Tpl.nextIter(txt);
511 then txt;
512 end match;
513 end for;
514 end lm_56;
515
516 protected function lm_57
517 input output Tpl.Text txt;
518 input list<SimCodeVar.SimVar> items;
519 algorithm
520
2/2
✓ Branch 0 taken 46 times.
✓ Branch 1 taken 4 times.
50 for lstElt_57 in items loop
521 txt := match lstElt_57
522 local
523 SimCodeVar.SimVar i_var;
524
525 case i_var
526 algorithm
527 46 txt := ScalarVariableXml(txt, i_var);
528 46 txt := Tpl.nextIter(txt);
529 then txt;
530 end match;
531 end for;
532 end lm_57;
533
534 protected function lm_58
535 input output Tpl.Text txt;
536 input list<SimCodeVar.SimVar> items;
537 algorithm
538
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_58 in items loop
539 txt := match lstElt_58
540 local
541 SimCodeVar.SimVar i_var;
542
543 case i_var
544 algorithm
545 ✗ txt := ScalarVariableXml(txt, i_var);
546 ✗ txt := Tpl.nextIter(txt);
547 then txt;
548 end match;
549 end for;
550 end lm_58;
551
552 protected function lm_59
553 input output Tpl.Text txt;
554 input list<SimCodeVar.SimVar> items;
555 algorithm
556
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_59 in items loop
557 txt := match lstElt_59
558 local
559 SimCodeVar.SimVar i_var;
560
561 case i_var
562 algorithm
563 ✗ txt := ScalarVariableXml(txt, i_var);
564 ✗ txt := Tpl.nextIter(txt);
565 then txt;
566 end match;
567 end for;
568 end lm_59;
569
570 protected function lm_60
571 input output Tpl.Text txt;
572 input list<SimCodeVar.SimVar> items;
573 algorithm
574
2/2
✓ Branch 0 taken 63 times.
✓ Branch 1 taken 4 times.
67 for lstElt_60 in items loop
575 txt := match lstElt_60
576 local
577 SimCodeVar.SimVar i_var;
578
579 case i_var
580 algorithm
581 63 txt := ScalarVariableXml(txt, i_var);
582 63 txt := Tpl.nextIter(txt);
583 then txt;
584 end match;
585 end for;
586 end lm_60;
587
588 protected function lm_61
589 input output Tpl.Text txt;
590 input list<SimCodeVar.SimVar> items;
591 algorithm
592
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 for lstElt_61 in items loop
593 txt := match lstElt_61
594 local
595 SimCodeVar.SimVar i_var;
596
597 case i_var
598 algorithm
599 10 txt := ScalarVariableXml(txt, i_var);
600 10 txt := Tpl.nextIter(txt);
601 then txt;
602 end match;
603 end for;
604 end lm_61;
605
606 protected function lm_62
607 input output Tpl.Text txt;
608 input list<SimCodeVar.SimVar> items;
609 algorithm
610
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
16 for lstElt_62 in items loop
611 txt := match lstElt_62
612 local
613 SimCodeVar.SimVar i_var;
614
615 case i_var
616 algorithm
617 12 txt := ScalarVariableXml(txt, i_var);
618 12 txt := Tpl.nextIter(txt);
619 then txt;
620 end match;
621 end for;
622 end lm_62;
623
624 protected function lm_63
625 input output Tpl.Text txt;
626 input list<SimCodeVar.SimVar> items;
627 algorithm
628
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_63 in items loop
629 txt := match lstElt_63
630 local
631 SimCodeVar.SimVar i_var;
632
633 case i_var
634 algorithm
635 ✗ txt := ScalarVariableXml(txt, i_var);
636 ✗ txt := Tpl.nextIter(txt);
637 then txt;
638 end match;
639 end for;
640 end lm_63;
641
642 protected function lm_64
643 input output Tpl.Text txt;
644 input list<SimCodeVar.SimVar> items;
645 algorithm
646
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_64 in items loop
647 txt := match lstElt_64
648 local
649 SimCodeVar.SimVar i_var;
650
651 case i_var
652 algorithm
653 ✗ txt := ScalarVariableXml(txt, i_var);
654 ✗ txt := Tpl.nextIter(txt);
655 then txt;
656 end match;
657 end for;
658 end lm_64;
659
660 protected function lm_65
661 input output Tpl.Text txt;
662 input list<SimCodeVar.SimVar> items;
663 algorithm
664
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_65 in items loop
665 txt := match lstElt_65
666 local
667 SimCodeVar.SimVar i_var;
668
669 case i_var
670 algorithm
671 ✗ txt := ScalarVariableXml(txt, i_var);
672 ✗ txt := Tpl.nextIter(txt);
673 then txt;
674 end match;
675 end for;
676 end lm_65;
677
678 protected function lm_66
679 input output Tpl.Text txt;
680 input list<SimCodeVar.SimVar> items;
681 algorithm
682
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_66 in items loop
683 txt := match lstElt_66
684 local
685 SimCodeVar.SimVar i_var;
686
687 case i_var
688 algorithm
689 ✗ txt := ScalarVariableXml(txt, i_var);
690 ✗ txt := Tpl.nextIter(txt);
691 then txt;
692 end match;
693 end for;
694 end lm_66;
695
696 protected function lm_67
697 input output Tpl.Text txt;
698 input list<SimCodeVar.SimVar> items;
699 algorithm
700
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
5 for lstElt_67 in items loop
701 txt := match lstElt_67
702 local
703 SimCodeVar.SimVar i_var;
704
705 case i_var
706 algorithm
707 1 txt := ScalarVariableXml(txt, i_var);
708 1 txt := Tpl.nextIter(txt);
709 then txt;
710 end match;
711 end for;
712 end lm_67;
713
714 protected function lm_68
715 input output Tpl.Text txt;
716 input list<SimCodeVar.SimVar> items;
717 algorithm
718
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_68 in items loop
719 txt := match lstElt_68
720 local
721 SimCodeVar.SimVar i_var;
722
723 case i_var
724 algorithm
725 ✗ txt := ScalarVariableXml(txt, i_var);
726 ✗ txt := Tpl.nextIter(txt);
727 then txt;
728 end match;
729 end for;
730 end lm_68;
731
732 protected function lm_69
733 input output Tpl.Text txt;
734 input list<SimCodeVar.SimVar> items;
735 algorithm
736
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_69 in items loop
737 txt := match lstElt_69
738 local
739 SimCodeVar.SimVar i_var;
740
741 case i_var
742 algorithm
743 ✗ txt := ScalarVariableXml(txt, i_var);
744 ✗ txt := Tpl.nextIter(txt);
745 then txt;
746 end match;
747 end for;
748 end lm_69;
749
750 protected function lm_70
751 input output Tpl.Text txt;
752 input list<SimCodeVar.SimVar> items;
753 algorithm
754
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_70 in items loop
755 txt := match lstElt_70
756 local
757 SimCodeVar.SimVar i_var;
758
759 case i_var
760 algorithm
761 ✗ txt := ScalarVariableXml(txt, i_var);
762 ✗ txt := Tpl.nextIter(txt);
763 then txt;
764 end match;
765 end for;
766 end lm_70;
767
768 public function modelVariablesXml
769 input Tpl.Text in_txt;
770 input SimCode.ModelInfo in_a_modelInfo;
771
772 output Tpl.Text out_txt;
773 algorithm
774 out_txt :=
775 match(in_txt, in_a_modelInfo)
776 local
777 Tpl.Text txt;
778 list<SimCodeVar.SimVar> i_vars_stringConstVars;
779 list<SimCodeVar.SimVar> i_vars_boolConstVars;
780 list<SimCodeVar.SimVar> i_vars_intConstVars;
781 list<SimCodeVar.SimVar> i_vars_constVars;
782 list<SimCodeVar.SimVar> i_vars_extObjVars;
783 list<SimCodeVar.SimVar> i_vars_stringAliasVars;
784 list<SimCodeVar.SimVar> i_vars_stringParamVars;
785 list<SimCodeVar.SimVar> i_vars_stringAlgVars;
786 list<SimCodeVar.SimVar> i_vars_boolParamVars;
787 list<SimCodeVar.SimVar> i_vars_intParamVars;
788 list<SimCodeVar.SimVar> i_vars_paramVars;
789 list<SimCodeVar.SimVar> i_vars_boolAliasVars;
790 list<SimCodeVar.SimVar> i_vars_intAliasVars;
791 list<SimCodeVar.SimVar> i_vars_aliasVars;
792 list<SimCodeVar.SimVar> i_vars_outputVars;
793 list<SimCodeVar.SimVar> i_vars_boolAlgVars;
794 list<SimCodeVar.SimVar> i_vars_intAlgVars;
795 list<SimCodeVar.SimVar> i_vars_discreteAlgVars;
796 list<SimCodeVar.SimVar> i_vars_algVars;
797 list<SimCodeVar.SimVar> i_vars_derivativeVars;
798 list<SimCodeVar.SimVar> i_vars_stateVars;
799
800 case ( txt,
801 SimCode.MODELINFO(vars = SimCodeVar.SIMVARS(stateVars = i_vars_stateVars, derivativeVars = i_vars_derivativeVars, algVars = i_vars_algVars, discreteAlgVars = i_vars_discreteAlgVars, intAlgVars = i_vars_intAlgVars, boolAlgVars = i_vars_boolAlgVars, outputVars = i_vars_outputVars, aliasVars = i_vars_aliasVars, intAliasVars = i_vars_intAliasVars, boolAliasVars = i_vars_boolAliasVars, paramVars = i_vars_paramVars, intParamVars = i_vars_intParamVars, boolParamVars = i_vars_boolParamVars, stringAlgVars = i_vars_stringAlgVars, stringParamVars = i_vars_stringParamVars, stringAliasVars = i_vars_stringAliasVars, extObjVars = i_vars_extObjVars, constVars = i_vars_constVars, intConstVars = i_vars_intConstVars, boolConstVars = i_vars_boolConstVars, stringConstVars = i_vars_stringConstVars)) )
802 algorithm
803 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<ModelVariables>\n"));
804 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
805 4 txt := lm_50(txt, i_vars_stateVars);
806 4 txt := Tpl.popIter(txt);
807 4 txt := Tpl.softNewLine(txt);
808 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
809 4 txt := lm_51(txt, i_vars_derivativeVars);
810 4 txt := Tpl.popIter(txt);
811 4 txt := Tpl.softNewLine(txt);
812 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
813 4 txt := lm_52(txt, i_vars_algVars);
814 4 txt := Tpl.popIter(txt);
815 4 txt := Tpl.softNewLine(txt);
816 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
817 4 txt := lm_53(txt, i_vars_discreteAlgVars);
818 4 txt := Tpl.popIter(txt);
819 4 txt := Tpl.softNewLine(txt);
820 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
821 4 txt := lm_54(txt, i_vars_intAlgVars);
822 4 txt := Tpl.popIter(txt);
823 4 txt := Tpl.softNewLine(txt);
824 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
825 4 txt := lm_55(txt, i_vars_boolAlgVars);
826 4 txt := Tpl.popIter(txt);
827 4 txt := Tpl.softNewLine(txt);
828 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
829 4 txt := lm_56(txt, i_vars_outputVars);
830 4 txt := Tpl.popIter(txt);
831 4 txt := Tpl.softNewLine(txt);
832 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
833 4 txt := lm_57(txt, i_vars_aliasVars);
834 4 txt := Tpl.popIter(txt);
835 4 txt := Tpl.softNewLine(txt);
836 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
837 4 txt := lm_58(txt, i_vars_intAliasVars);
838 4 txt := Tpl.popIter(txt);
839 4 txt := Tpl.softNewLine(txt);
840 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
841 4 txt := lm_59(txt, i_vars_boolAliasVars);
842 4 txt := Tpl.popIter(txt);
843 4 txt := Tpl.softNewLine(txt);
844 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
845 4 txt := lm_60(txt, i_vars_paramVars);
846 4 txt := Tpl.popIter(txt);
847 4 txt := Tpl.softNewLine(txt);
848 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
849 4 txt := lm_61(txt, i_vars_intParamVars);
850 4 txt := Tpl.popIter(txt);
851 4 txt := Tpl.softNewLine(txt);
852 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
853 4 txt := lm_62(txt, i_vars_boolParamVars);
854 4 txt := Tpl.popIter(txt);
855 4 txt := Tpl.softNewLine(txt);
856 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
857 4 txt := lm_63(txt, i_vars_stringAlgVars);
858 4 txt := Tpl.popIter(txt);
859 4 txt := Tpl.softNewLine(txt);
860 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
861 4 txt := lm_64(txt, i_vars_stringParamVars);
862 4 txt := Tpl.popIter(txt);
863 4 txt := Tpl.softNewLine(txt);
864 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
865 4 txt := lm_65(txt, i_vars_stringAliasVars);
866 4 txt := Tpl.popIter(txt);
867 4 txt := Tpl.softNewLine(txt);
868 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
869 4 txt := lm_66(txt, i_vars_extObjVars);
870 4 txt := Tpl.popIter(txt);
871 4 txt := Tpl.softNewLine(txt);
872 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
873 4 txt := lm_67(txt, i_vars_constVars);
874 4 txt := Tpl.popIter(txt);
875 4 txt := Tpl.softNewLine(txt);
876 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
877 4 txt := lm_68(txt, i_vars_intConstVars);
878 4 txt := Tpl.popIter(txt);
879 4 txt := Tpl.softNewLine(txt);
880 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
881 4 txt := lm_69(txt, i_vars_boolConstVars);
882 4 txt := Tpl.popIter(txt);
883 4 txt := Tpl.softNewLine(txt);
884 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
885 4 txt := lm_70(txt, i_vars_stringConstVars);
886 4 txt := Tpl.popIter(txt);
887 4 txt := Tpl.softNewLine(txt);
888 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ModelVariables>"));
889 4 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
890 then txt;
891
892 case ( txt,
893 _ )
894 then txt;
895 end match;
896 end modelVariablesXml;
897
898 public function ScalarVariableXml
899 input Tpl.Text in_txt;
900 input SimCodeVar.SimVar in_a_simVar;
901
902 output Tpl.Text out_txt;
903 algorithm
904 out_txt :=
905 match(in_txt, in_a_simVar)
906 local
907 Tpl.Text txt;
908 SimCodeVar.SimVar i_simVar;
909
910 case ( txt,
911 (i_simVar as SimCodeVar.SIMVAR(name = _)) )
912 algorithm
913 194 txt := ScalarVariableAttributesXml(txt, i_simVar);
914 then txt;
915
916 case ( txt,
917 _ )
918 then txt;
919 end match;
920 end ScalarVariableXml;
921
922 protected function fun_73
923 input Tpl.Text in_txt;
924 input String in_a_comment;
925
926 output Tpl.Text out_txt;
927 algorithm
928 out_txt :=
929 match(in_txt, in_a_comment)
930 local
931 Tpl.Text txt;
932 String i_comment;
933 String ret_0;
934
935 case ( txt,
936 "" )
937 then txt;
938
939 case ( txt,
940 i_comment )
941 algorithm
942 162 txt := Tpl.writeTok(txt, Tpl.ST_STRING("description=\""));
943 162 ret_0 := Util.escapeModelicaStringToXmlString(i_comment);
944 162 txt := Tpl.writeStr(txt, ret_0);
945 162 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
946 then txt;
947 end match;
948 end fun_73;
949
950 public function ScalarVariableAttributesXml
951 input Tpl.Text in_txt;
952 input SimCodeVar.SimVar in_a_simVar;
953
954 output Tpl.Text out_txt;
955 algorithm
956 out_txt :=
957 match(in_txt, in_a_simVar)
958 local
959 Tpl.Text txt;
960 Boolean i_isFixed;
961 Option<DAE.Exp> i_initialValue;
962 Option<DAE.Exp> i_maxValue;
963 Option<DAE.Exp> i_minValue;
964 String i_displayUnit;
965 String i_unit;
966 DAE.Type i_type__;
967 DAE.ComponentRef i_name;
968 Option<SimCodeVar.Causality> i_causality;
969 SimCodeVar.AliasVariable i_aliasvar;
970 String i_comment;
971 BackendDAE.VarKind i_varKind;
972 Tpl.Text l_variableCategory;
973 Tpl.Text l_caus;
974 Tpl.Text l_alias;
975 Tpl.Text l_description;
976 Tpl.Text l_variability;
977 Integer ret_1;
978 Tpl.Text l_valueReference;
979
980 case ( txt,
981 SimCodeVar.SIMVAR(varKind = i_varKind, comment = i_comment, aliasvar = i_aliasvar, causality = i_causality, name = i_name, type_ = i_type__, unit = i_unit, displayUnit = i_displayUnit, minValue = i_minValue, maxValue = i_maxValue, initialValue = i_initialValue, isFixed = i_isFixed) )
982 algorithm
983 194 ret_1 := System.tmpTick();
984 194 l_valueReference := Tpl.writeStr(Tpl.emptyTxt, intString(ret_1));
985 194 l_variability := getVariablityXml(Tpl.emptyTxt, i_varKind);
986 194 l_description := fun_73(Tpl.emptyTxt, i_comment);
987 194 l_alias := getAliasVarXml(Tpl.emptyTxt, i_aliasvar);
988 194 l_caus := getCausalityXml(Tpl.emptyTxt, i_causality);
989 194 l_variableCategory := variableCategoryXml(Tpl.emptyTxt, i_varKind);
990 194 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
991 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<ScalarVariable name=\""));
992 194 txt := crefStrXml(txt, i_name);
993 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" "));
994 194 txt := Tpl.writeText(txt, l_description);
995 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" valueReference=\""));
996 194 txt := Tpl.writeText(txt, l_valueReference);
997 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" variability=\""));
998 194 txt := Tpl.writeText(txt, l_variability);
999 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" causality=\""));
1000 194 txt := Tpl.writeText(txt, l_caus);
1001 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" alias=\""));
1002 194 txt := Tpl.writeText(txt, l_alias);
1003 194 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\">\n"));
1004 194 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1005 194 txt := ScalarVariableTypeXml(txt, i_type__, i_unit, i_displayUnit, i_minValue, i_maxValue, i_initialValue, i_isFixed);
1006 194 txt := Tpl.softNewLine(txt);
1007 194 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<QualifiedName>\n"));
1008 194 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1009 194 txt := qualifiedNamePartXml(txt, i_name);
1010 194 txt := Tpl.softNewLine(txt);
1011 194 txt := Tpl.popBlock(txt);
1012 194 txt := Tpl.writeTok(txt, Tpl.ST_LINE("</QualifiedName>\n"));
1013 194 txt := Tpl.popBlock(txt);
1014 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
1015 "<isLinearTimedVariables>\n",
1016 " <TimePoint index=\"0\" isLinear=\"true\"/>\n",
1017 "</isLinearTimedVariables>\n"
1018 }, true));
1019 194 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1020 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<VariableCategory>"));
1021 194 txt := Tpl.writeText(txt, l_variableCategory);
1022 194 txt := Tpl.writeTok(txt, Tpl.ST_LINE("</VariableCategory>\n"));
1023 194 txt := Tpl.popBlock(txt);
1024 194 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</ScalarVariable>"));
1025 194 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
1026 194 txt := Tpl.popBlock(txt);
1027 then txt;
1028
1029 case ( txt,
1030 _ )
1031 then txt;
1032 end match;
1033 end ScalarVariableAttributesXml;
1034
1035 public function getCausalityXml
1036 input Tpl.Text in_txt;
1037 input Option<SimCodeVar.Causality> in_a_c;
1038
1039 output Tpl.Text out_txt;
1040 algorithm
1041 out_txt :=
1042 match(in_txt, in_a_c)
1043 local
1044 Tpl.Text txt;
1045
1046 case ( txt,
1047 SOME(SimCodeVar.NONECAUS()) )
1048 algorithm
1049 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("none"));
1050 then txt;
1051
1052 case ( txt,
1053 SOME(SimCodeVar.OUTPUT()) )
1054 algorithm
1055 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("output"));
1056 then txt;
1057
1058 case ( txt,
1059 SOME(SimCodeVar.INPUT()) )
1060 algorithm
1061 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("input"));
1062 then txt;
1063
1064 case ( txt,
1065 SOME(SimCodeVar.LOCAL()) )
1066 algorithm
1067 109 txt := Tpl.writeTok(txt, Tpl.ST_STRING("local"));
1068 then txt;
1069
1070 case ( txt,
1071 SOME(SimCodeVar.PARAMETER()) )
1072 algorithm
1073 50 txt := Tpl.writeTok(txt, Tpl.ST_STRING("parameter"));
1074 then txt;
1075
1076 case ( txt,
1077 SOME(SimCodeVar.CALCULATED_PARAMETER()) )
1078 algorithm
1079 35 txt := Tpl.writeTok(txt, Tpl.ST_STRING("calculatedParameter"));
1080 then txt;
1081
1082 case ( txt,
1083 _ )
1084 algorithm
1085 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("internal"));
1086 then txt;
1087 end match;
1088 end getCausalityXml;
1089
1090 public function getVariablityXml
1091 input Tpl.Text in_txt;
1092 input BackendDAE.VarKind in_a_varKind;
1093
1094 output Tpl.Text out_txt;
1095 algorithm
1096 out_txt :=
1097 match(in_txt, in_a_varKind)
1098 local
1099 Tpl.Text txt;
1100
1101 case ( txt,
1102 BackendDAE.DISCRETE() )
1103 algorithm
1104 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("discrete"));
1105 then txt;
1106
1107 case ( txt,
1108 BackendDAE.PARAM() )
1109 algorithm
1110 85 txt := Tpl.writeTok(txt, Tpl.ST_STRING("parameter"));
1111 then txt;
1112
1113 case ( txt,
1114 BackendDAE.CONST() )
1115 algorithm
1116 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("constant"));
1117 then txt;
1118
1119 case ( txt,
1120 _ )
1121 algorithm
1122 104 txt := Tpl.writeTok(txt, Tpl.ST_STRING("continuous"));
1123 then txt;
1124 end match;
1125 end getVariablityXml;
1126
1127 public function getAliasVarXml
1128 input Tpl.Text in_txt;
1129 input SimCodeVar.AliasVariable in_a_aliasvar;
1130
1131 output Tpl.Text out_txt;
1132 algorithm
1133 out_txt :=
1134 match(in_txt, in_a_aliasvar)
1135 local
1136 Tpl.Text txt;
1137 DAE.ComponentRef i_varName;
1138
1139 case ( txt,
1140 SimCodeVar.NOALIAS() )
1141 algorithm
1142 148 txt := Tpl.writeTok(txt, Tpl.ST_STRING("noAlias"));
1143 then txt;
1144
1145 case ( txt,
1146 SimCodeVar.ALIAS(varName = i_varName) )
1147 algorithm
1148 42 txt := crefStrXml(txt, i_varName);
1149 then txt;
1150
1151 case ( txt,
1152 SimCodeVar.NEGATEDALIAS(varName = i_varName) )
1153 algorithm
1154 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("-"));
1155 4 txt := crefStrXml(txt, i_varName);
1156 then txt;
1157
1158 case ( txt,
1159 _ )
1160 then txt;
1161 end match;
1162 end getAliasVarXml;
1163
1164 public function variableCategoryXml
1165 input Tpl.Text in_txt;
1166 input BackendDAE.VarKind in_a_varKind;
1167
1168 output Tpl.Text out_txt;
1169 algorithm
1170 out_txt :=
1171 match(in_txt, in_a_varKind)
1172 local
1173 Tpl.Text txt;
1174 Absyn.Path i_fullClassName;
1175
1176 case ( txt,
1177 BackendDAE.VARIABLE() )
1178 algorithm
1179 78 txt := Tpl.writeTok(txt, Tpl.ST_STRING("algebraic"));
1180 then txt;
1181
1182 case ( txt,
1183 BackendDAE.STATE(index = _) )
1184 algorithm
1185 10 txt := Tpl.writeTok(txt, Tpl.ST_STRING("state"));
1186 then txt;
1187
1188 case ( txt,
1189 BackendDAE.STATE_DER() )
1190 algorithm
1191 10 txt := Tpl.writeTok(txt, Tpl.ST_STRING("derivative"));
1192 then txt;
1193
1194 case ( txt,
1195 BackendDAE.DUMMY_DER() )
1196 algorithm
1197 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("algebraic"));
1198 then txt;
1199
1200 case ( txt,
1201 BackendDAE.DUMMY_STATE() )
1202 algorithm
1203 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("algebraic"));
1204 then txt;
1205
1206 case ( txt,
1207 BackendDAE.DISCRETE() )
1208 algorithm
1209 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("algebraic"));
1210 then txt;
1211
1212 case ( txt,
1213 BackendDAE.PARAM() )
1214 algorithm
1215 85 txt := Tpl.writeTok(txt, Tpl.ST_STRING("independentParameter"));
1216 then txt;
1217
1218 case ( txt,
1219 BackendDAE.CONST() )
1220 algorithm
1221 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("independentConstant"));
1222 then txt;
1223
1224 case ( txt,
1225 BackendDAE.EXTOBJ(fullClassName = i_fullClassName) )
1226 algorithm
1227 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("externalObject_"));
1228 ✗ txt := dotPathXml(txt, i_fullClassName);
1229 then txt;
1230
1231 case ( txt,
1232 BackendDAE.JAC_VAR() )
1233 algorithm
1234 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("jacobianVar"));
1235 then txt;
1236
1237 case ( txt,
1238 BackendDAE.JAC_TMP_VAR() )
1239 algorithm
1240 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("jacobianTmpVar"));
1241 then txt;
1242
1243 case ( txt,
1244 _ )
1245 algorithm
1246 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 283, 14), "Unexpected simVarTypeName varKind");
1247 then txt;
1248 end match;
1249 end variableCategoryXml;
1250
1251 public function ScalarVariableTypeXml
1252 input Tpl.Text in_txt;
1253 input DAE.Type in_a_type__;
1254 input String in_a_unit;
1255 input String in_a_displayUnit;
1256 input Option<DAE.Exp> in_a_minValue;
1257 input Option<DAE.Exp> in_a_maxValue;
1258 input Option<DAE.Exp> in_a_initialValue;
1259 input Boolean in_a_isFixed;
1260
1261 output Tpl.Text out_txt;
1262 algorithm
1263 out_txt :=
1264 match(in_txt, in_a_type__, in_a_unit, in_a_displayUnit, in_a_minValue, in_a_maxValue, in_a_initialValue, in_a_isFixed)
1265 local
1266 Tpl.Text txt;
1267 String a_unit;
1268 String a_displayUnit;
1269 Option<DAE.Exp> a_minValue;
1270 Option<DAE.Exp> a_maxValue;
1271 Option<DAE.Exp> a_initialValue;
1272 Boolean a_isFixed;
1273
1274 case ( txt,
1275 DAE.T_INTEGER(varLst = _),
1276 _,
1277 _,
1278 a_minValue,
1279 a_maxValue,
1280 a_initialValue,
1281 a_isFixed )
1282 algorithm
1283 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Integer "));
1284 1 txt := ScalarVariableTypeCommonAttributeXml(txt, a_initialValue, a_isFixed);
1285 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1286 1 txt := ScalarVariableTypeMinAttribute(txt, a_minValue);
1287 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1288 1 txt := ScalarVariableTypeMaxAttribute(txt, a_maxValue);
1289 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1290 then txt;
1291
1292 case ( txt,
1293 DAE.T_REAL(varLst = _),
1294 a_unit,
1295 a_displayUnit,
1296 a_minValue,
1297 a_maxValue,
1298 a_initialValue,
1299 a_isFixed )
1300 algorithm
1301 168 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Real "));
1302 168 txt := ScalarVariableTypeCommonAttributeXml(txt, a_initialValue, a_isFixed);
1303 168 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1304 168 txt := ScalarVariableTypeMinAttribute(txt, a_minValue);
1305 168 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1306 168 txt := ScalarVariableTypeMaxAttribute(txt, a_maxValue);
1307 168 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
1308 168 txt := ScalarVariableTypeRealAttributeXml(txt, a_unit, a_displayUnit);
1309 168 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1310 then txt;
1311
1312 case ( txt,
1313 DAE.T_BOOL(varLst = _),
1314 _,
1315 _,
1316 _,
1317 _,
1318 a_initialValue,
1319 a_isFixed )
1320 algorithm
1321 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Boolean "));
1322 16 txt := ScalarVariableTypeCommonAttributeXml(txt, a_initialValue, a_isFixed);
1323 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1324 then txt;
1325
1326 case ( txt,
1327 DAE.T_STRING(varLst = _),
1328 _,
1329 _,
1330 _,
1331 _,
1332 a_initialValue,
1333 a_isFixed )
1334 algorithm
1335 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<String "));
1336 ✗ txt := ScalarVariableTypeCommonAttributeXml(txt, a_initialValue, a_isFixed);
1337 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1338 then txt;
1339
1340 case ( txt,
1341 DAE.T_ENUMERATION(index = _),
1342 _,
1343 _,
1344 _,
1345 _,
1346 a_initialValue,
1347 a_isFixed )
1348 algorithm
1349 9 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<Real "));
1350 9 txt := ScalarVariableTypeCommonAttributeXml(txt, a_initialValue, a_isFixed);
1351 9 txt := Tpl.writeTok(txt, Tpl.ST_STRING("/>"));
1352 then txt;
1353
1354 case ( txt,
1355 _,
1356 _,
1357 _,
1358 _,
1359 _,
1360 _,
1361 _ )
1362 algorithm
1363 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("UNKOWN_TYPE"));
1364 then txt;
1365 end match;
1366 end ScalarVariableTypeXml;
1367
1368 protected function fun_80
1369 input Tpl.Text in_txt;
1370 input Boolean in_mArg;
1371 input Boolean in_a_isFixed;
1372 input DAE.Exp in_a_exp;
1373
1374 output Tpl.Text out_txt;
1375 algorithm
1376 out_txt :=
1377 match(in_txt, in_mArg, in_a_isFixed, in_a_exp)
1378 local
1379 Tpl.Text txt;
1380 Boolean a_isFixed;
1381 DAE.Exp a_exp;
1382
1383 case ( txt,
1384 false,
1385 _,
1386 _ )
1387 then txt;
1388
1389 case ( txt,
1390 _,
1391 a_isFixed,
1392 a_exp )
1393 algorithm
1394 106 txt := Tpl.writeTok(txt, Tpl.ST_STRING("start=\""));
1395 106 txt := initValXml(txt, a_exp);
1396 106 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\" fixed=\""));
1397 106 txt := Tpl.writeStr(txt, Tpl.booleanString(a_isFixed));
1398 106 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1399 then txt;
1400 end match;
1401 end fun_80;
1402
1403 public function ScalarVariableTypeCommonAttributeXml
1404 input Tpl.Text in_txt;
1405 input Option<DAE.Exp> in_a_initialValue;
1406 input Boolean in_a_isFixed;
1407
1408 output Tpl.Text out_txt;
1409 algorithm
1410 out_txt :=
1411 match(in_txt, in_a_initialValue, in_a_isFixed)
1412 local
1413 Tpl.Text txt;
1414 Boolean a_isFixed;
1415 DAE.Exp i_exp;
1416 Boolean ret_2;
1417 Boolean ret_1;
1418 Boolean ret_0;
1419
1420 case ( txt,
1421 SOME(i_exp),
1422 a_isFixed )
1423 algorithm
1424 108 ret_0 := Expression.isEvaluatedConst(i_exp);
1425 108 ret_1 := Expression.isCref(i_exp);
1426 108 ret_2 := boolOr(ret_0, ret_1);
1427 108 txt := fun_80(txt, ret_2, a_isFixed, i_exp);
1428 then txt;
1429
1430 case ( txt,
1431 _,
1432 _ )
1433 then txt;
1434 end match;
1435 end ScalarVariableTypeCommonAttributeXml;
1436
1437 public function ScalarVariableTypeMinAttribute
1438 input Tpl.Text in_txt;
1439 input Option<DAE.Exp> in_a_minValue;
1440
1441 output Tpl.Text out_txt;
1442 algorithm
1443 out_txt :=
1444 match(in_txt, in_a_minValue)
1445 local
1446 Tpl.Text txt;
1447 DAE.Exp i_exp;
1448
1449 case ( txt,
1450 SOME(i_exp) )
1451 algorithm
1452 21 txt := Tpl.writeTok(txt, Tpl.ST_STRING("min=\""));
1453 21 txt := initValXml(txt, i_exp);
1454 21 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1455 then txt;
1456
1457 case ( txt,
1458 _ )
1459 then txt;
1460 end match;
1461 end ScalarVariableTypeMinAttribute;
1462
1463 public function ScalarVariableTypeMaxAttribute
1464 input Tpl.Text in_txt;
1465 input Option<DAE.Exp> in_a_maxValue;
1466
1467 output Tpl.Text out_txt;
1468 algorithm
1469 out_txt :=
1470 match(in_txt, in_a_maxValue)
1471 local
1472 Tpl.Text txt;
1473 DAE.Exp i_exp;
1474
1475 case ( txt,
1476 SOME(i_exp) )
1477 algorithm
1478 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("max=\""));
1479 ✗ txt := initValXml(txt, i_exp);
1480 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1481 then txt;
1482
1483 case ( txt,
1484 _ )
1485 then txt;
1486 end match;
1487 end ScalarVariableTypeMaxAttribute;
1488
1489 protected function fun_84
1490 input Tpl.Text in_txt;
1491 input Boolean in_a_bool;
1492
1493 output Tpl.Text out_txt;
1494 algorithm
1495 out_txt :=
1496 match(in_txt, in_a_bool)
1497 local
1498 Tpl.Text txt;
1499
1500 case ( txt,
1501 false )
1502 algorithm
1503 11 txt := Tpl.writeTok(txt, Tpl.ST_STRING("0"));
1504 then txt;
1505
1506 case ( txt,
1507 _ )
1508 algorithm
1509 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("1"));
1510 then txt;
1511 end match;
1512 end fun_84;
1513
1514 public function initValXml
1515 input Tpl.Text in_txt;
1516 input DAE.Exp in_a_initialValue;
1517
1518 output Tpl.Text out_txt;
1519 algorithm
1520 out_txt :=
1521 match(in_txt, in_a_initialValue)
1522 local
1523 Tpl.Text txt;
1524 DAE.ComponentRef i_componentRef;
1525 Integer i_index;
1526 Boolean i_bool;
1527 String i_string;
1528 Real i_real;
1529 Integer i_integer;
1530 String ret_0;
1531
1532 case ( txt,
1533 DAE.ICONST(integer = i_integer) )
1534 algorithm
1535 2 txt := Tpl.writeStr(txt, intString(i_integer));
1536 then txt;
1537
1538 case ( txt,
1539 DAE.RCONST(real = i_real) )
1540 algorithm
1541 96 txt := Tpl.writeStr(txt, realString(i_real));
1542 then txt;
1543
1544 case ( txt,
1545 DAE.SCONST(string = i_string) )
1546 algorithm
1547 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("&quot;"));
1548 ✗ ret_0 := Util.escapeModelicaStringToXmlString(i_string);
1549 ✗ txt := Tpl.writeStr(txt, ret_0);
1550 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("&quot;"));
1551 then txt;
1552
1553 case ( txt,
1554 DAE.BCONST(bool = i_bool) )
1555 algorithm
1556 12 txt := fun_84(txt, i_bool);
1557 then txt;
1558
1559 case ( txt,
1560 DAE.ENUM_LITERAL(index = i_index) )
1561 algorithm
1562 9 txt := Tpl.writeStr(txt, intString(i_index));
1563 then txt;
1564
1565 case ( txt,
1566 DAE.CREF(componentRef = i_componentRef) )
1567 algorithm
1568 8 txt := crefStrXml(txt, i_componentRef);
1569 then txt;
1570
1571 case ( txt,
1572 _ )
1573 algorithm
1574 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*ERROR* initial value of unknown type"));
1575 then txt;
1576 end match;
1577 end initValXml;
1578
1579 protected function fun_86
1580 input Tpl.Text in_txt;
1581 input String in_a_unit;
1582
1583 output Tpl.Text out_txt;
1584 algorithm
1585 out_txt :=
1586 match(in_txt, in_a_unit)
1587 local
1588 Tpl.Text txt;
1589 String i_unit;
1590 String ret_0;
1591
1592 case ( txt,
1593 "" )
1594 then txt;
1595
1596 case ( txt,
1597 i_unit )
1598 algorithm
1599 79 txt := Tpl.writeTok(txt, Tpl.ST_STRING("unit=\""));
1600 79 ret_0 := Util.escapeModelicaStringToXmlString(i_unit);
1601 79 txt := Tpl.writeStr(txt, ret_0);
1602 79 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1603 then txt;
1604 end match;
1605 end fun_86;
1606
1607 protected function fun_87
1608 input Tpl.Text in_txt;
1609 input String in_a_displayUnit;
1610
1611 output Tpl.Text out_txt;
1612 algorithm
1613 out_txt :=
1614 match(in_txt, in_a_displayUnit)
1615 local
1616 Tpl.Text txt;
1617 String i_displayUnit;
1618 String ret_0;
1619
1620 case ( txt,
1621 "" )
1622 then txt;
1623
1624 case ( txt,
1625 i_displayUnit )
1626 algorithm
1627 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("displayUnit=\""));
1628 18 ret_0 := Util.escapeModelicaStringToXmlString(i_displayUnit);
1629 18 txt := Tpl.writeStr(txt, ret_0);
1630 18 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
1631 then txt;
1632 end match;
1633 end fun_87;
1634
1635 public function ScalarVariableTypeRealAttributeXml
1636 input Tpl.Text txt;
1637 input String a_unit;
1638 input String a_displayUnit;
1639
1640 output Tpl.Text out_txt;
1641 protected
1642 Tpl.Text l_displayUnit__;
1643 Tpl.Text l_unit__;
1644 algorithm
1645 168 l_unit__ := fun_86(Tpl.emptyTxt, a_unit);
1646 168 l_displayUnit__ := fun_87(Tpl.emptyTxt, a_displayUnit);
1647 168 out_txt := Tpl.writeText(txt, l_unit__);
1648 168 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING(" "));
1649 168 out_txt := Tpl.writeText(out_txt, l_displayUnit__);
1650 end ScalarVariableTypeRealAttributeXml;
1651
1652 protected function fun_89
1653 input Tpl.Text in_txt;
1654 input SimCodeFunction.Context in_a_context;
1655 input DAE.ComponentRef in_a_cr;
1656
1657 output Tpl.Text out_txt;
1658 algorithm
1659 out_txt :=
1660 match(in_txt, in_a_context, in_a_cr)
1661 local
1662 Tpl.Text txt;
1663 DAE.ComponentRef a_cr;
1664 String ret_1;
1665 Tpl.Text txt_0;
1666
1667 case ( txt,
1668 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
1669 a_cr )
1670 algorithm
1671 4 txt_0 := crefStrXml(Tpl.emptyTxt, a_cr);
1672 4 ret_1 := System.unquoteIdentifier(Tpl.textString(txt_0));
1673 4 txt := Tpl.writeStr(txt, ret_1);
1674 then txt;
1675
1676 case ( txt,
1677 _,
1678 a_cr )
1679 algorithm
1680 ✗ txt := crefXml(txt, a_cr);
1681 then txt;
1682 end match;
1683 end fun_89;
1684
1685 public function contextCrefXml
1686 input Tpl.Text txt;
1687 input DAE.ComponentRef a_cr;
1688 input SimCodeFunction.Context a_context;
1689
1690 output Tpl.Text out_txt;
1691 algorithm
1692 4 out_txt := fun_89(txt, a_context, a_cr);
1693 end contextCrefXml;
1694
1695 protected function fun_91
1696 input Tpl.Text in_txt;
1697 input SimCodeFunction.Context in_a_context;
1698 input DAE.Ident in_a_name;
1699
1700 output Tpl.Text out_txt;
1701 algorithm
1702 out_txt :=
1703 match(in_txt, in_a_context, in_a_name)
1704 local
1705 Tpl.Text txt;
1706 DAE.Ident a_name;
1707
1708 case ( txt,
1709 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
1710 a_name )
1711 algorithm
1712 ✗ txt := Tpl.writeStr(txt, a_name);
1713 then txt;
1714
1715 case ( txt,
1716 _,
1717 a_name )
1718 algorithm
1719 ✗ txt := Tpl.writeStr(txt, a_name);
1720 then txt;
1721 end match;
1722 end fun_91;
1723
1724 public function contextIteratorNameXml
1725 input Tpl.Text txt;
1726 input DAE.Ident a_name;
1727 input SimCodeFunction.Context a_context;
1728
1729 output Tpl.Text out_txt;
1730 algorithm
1731 ✗ out_txt := fun_91(txt, a_context, a_name);
1732 end contextIteratorNameXml;
1733
1734 public function crefXml
1735 input Tpl.Text in_txt;
1736 input DAE.ComponentRef in_a_cr;
1737
1738 output Tpl.Text out_txt;
1739 algorithm
1740 out_txt :=
1741 match(in_txt, in_a_cr)
1742 local
1743 Tpl.Text txt;
1744 DAE.ComponentRef i_cr;
1745
1746 case ( txt,
1747 (i_cr as DAE.CREF_IDENT(ident = "xloc")) )
1748 algorithm
1749 ✗ txt := crefStrXml(txt, i_cr);
1750 then txt;
1751
1752 case ( txt,
1753 DAE.CREF_IDENT(ident = "time") )
1754 algorithm
1755 8 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:Time>time</exp:Time>"));
1756 then txt;
1757
1758 case ( txt,
1759 DAE.WILD() )
1760 then txt;
1761
1762 case ( txt,
1763 i_cr )
1764 algorithm
1765 337 txt := crefToXmlStr(txt, i_cr);
1766 then txt;
1767 end match;
1768 end crefXml;
1769
1770 protected function fun_94
1771 input Tpl.Text in_txt;
1772 input Boolean in_mArg;
1773 input list<DAE.Subscript> in_a_subscriptLst;
1774 input DAE.Ident in_a_ident;
1775
1776 output Tpl.Text out_txt;
1777 algorithm
1778 out_txt :=
1779 match(in_txt, in_mArg, in_a_subscriptLst, in_a_ident)
1780 local
1781 Tpl.Text txt;
1782 list<DAE.Subscript> a_subscriptLst;
1783 DAE.Ident a_ident;
1784
1785 case ( txt,
1786 true,
1787 _,
1788 a_ident )
1789 algorithm
1790 585 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
1791 585 txt := Tpl.writeStr(txt, a_ident);
1792 585 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
1793 then txt;
1794
1795 case ( txt,
1796 _,
1797 a_subscriptLst,
1798 a_ident )
1799 algorithm
1800 32 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
1801 32 txt := Tpl.writeStr(txt, a_ident);
1802 32 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\">\n"));
1803 32 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1804 32 txt := arraysubscriptsStrXml(txt, a_subscriptLst);
1805 32 txt := Tpl.softNewLine(txt);
1806 32 txt := Tpl.popBlock(txt);
1807 32 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:QualifiedNamePart>"));
1808 then txt;
1809 end match;
1810 end fun_94;
1811
1812 protected function fun_95
1813 input Tpl.Text in_txt;
1814 input Boolean in_mArg;
1815 input list<DAE.Subscript> in_a_subscriptLst;
1816 input DAE.ComponentRef in_a_componentRef;
1817 input DAE.Ident in_a_ident;
1818
1819 output Tpl.Text out_txt;
1820 algorithm
1821 out_txt :=
1822 match(in_txt, in_mArg, in_a_subscriptLst, in_a_componentRef, in_a_ident)
1823 local
1824 Tpl.Text txt;
1825 list<DAE.Subscript> a_subscriptLst;
1826 DAE.ComponentRef a_componentRef;
1827 DAE.Ident a_ident;
1828
1829 case ( txt,
1830 true,
1831 _,
1832 a_componentRef,
1833 a_ident )
1834 algorithm
1835 731 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
1836 731 txt := Tpl.writeStr(txt, a_ident);
1837 731 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
1838 731 txt := qualifiedNamePartXml(txt, a_componentRef);
1839 then txt;
1840
1841 case ( txt,
1842 _,
1843 a_subscriptLst,
1844 a_componentRef,
1845 a_ident )
1846 algorithm
1847 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
1848 ✗ txt := Tpl.writeStr(txt, a_ident);
1849 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\">\n"));
1850 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1851 ✗ txt := arraysubscriptsStrXml(txt, a_subscriptLst);
1852 ✗ txt := Tpl.softNewLine(txt);
1853 ✗ txt := Tpl.popBlock(txt);
1854 ✗ txt := qualifiedNamePartXml(txt, a_componentRef);
1855 ✗ txt := Tpl.softNewLine(txt);
1856 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:QualifiedNamePart>"));
1857 then txt;
1858 end match;
1859 end fun_95;
1860
1861 public function qualifiedNamePartXml
1862 input Tpl.Text in_txt;
1863 input DAE.ComponentRef in_a_cr;
1864
1865 output Tpl.Text out_txt;
1866 algorithm
1867 out_txt :=
1868 match(in_txt, in_a_cr)
1869 local
1870 Tpl.Text txt;
1871 DAE.ComponentRef i_componentRef;
1872 DAE.Ident i_ident;
1873 list<DAE.Subscript> i_subscriptLst;
1874 Boolean ret_2;
1875 Boolean ret_1;
1876 Tpl.Text l_arrayTest;
1877
1878 case ( txt,
1879 DAE.CREF_IDENT(subscriptLst = i_subscriptLst, ident = i_ident) )
1880 algorithm
1881 617 l_arrayTest := arraysubscriptsStrXml(Tpl.emptyTxt, i_subscriptLst);
1882 617 ret_1 := Tpl.isEmpty(l_arrayTest);
1883 617 txt := fun_94(txt, ret_1, i_subscriptLst, i_ident);
1884 then txt;
1885
1886 case ( txt,
1887 DAE.CREF_QUAL(ident = "$DER", componentRef = i_componentRef) )
1888 algorithm
1889 12 txt := qualifiedNamePartXml(txt, i_componentRef);
1890 then txt;
1891
1892 case ( txt,
1893 DAE.CREF_QUAL(subscriptLst = i_subscriptLst, ident = i_ident, componentRef = i_componentRef) )
1894 algorithm
1895 731 l_arrayTest := arraysubscriptsStrXml(Tpl.emptyTxt, i_subscriptLst);
1896 731 ret_2 := Tpl.isEmpty(l_arrayTest);
1897 731 txt := fun_95(txt, ret_2, i_subscriptLst, i_componentRef, i_ident);
1898 then txt;
1899
1900 case ( txt,
1901 _ )
1902 algorithm
1903 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("CREF_NOT_IDENT_OR_QUAL"));
1904 then txt;
1905 end match;
1906 end qualifiedNamePartXml;
1907
1908 protected function lm_97
1909 input output Tpl.Text txt;
1910 input list<DAE.Subscript> items;
1911 algorithm
1912
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 64 times.
128 for lstElt_97 in items loop
1913 txt := match lstElt_97
1914 local
1915 DAE.Subscript i_s;
1916
1917 case i_s
1918 algorithm
1919 64 txt := arraysubscriptStrXml(txt, i_s);
1920 64 txt := Tpl.nextIter(txt);
1921 then txt;
1922 end match;
1923 end for;
1924 end lm_97;
1925
1926 public function arraysubscriptsStrXml
1927 input Tpl.Text in_txt;
1928 input list<DAE.Subscript> in_a_subscripts;
1929
1930 output Tpl.Text out_txt;
1931 algorithm
1932 out_txt :=
1933 match(in_txt, in_a_subscripts)
1934 local
1935 Tpl.Text txt;
1936 list<DAE.Subscript> i_subscripts;
1937
1938 case ( txt,
1939 {} )
1940 then txt;
1941
1942 case ( txt,
1943 i_subscripts )
1944 algorithm
1945 64 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:ArraySubscripts>\n"));
1946 64 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1947 64 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
1948 64 txt := lm_97(txt, i_subscripts);
1949 64 txt := Tpl.popIter(txt);
1950 64 txt := Tpl.softNewLine(txt);
1951 64 txt := Tpl.popBlock(txt);
1952 64 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:ArraySubscripts>"));
1953 then txt;
1954 end match;
1955 end arraysubscriptsStrXml;
1956
1957 public function arraysubscriptStrXml
1958 input Tpl.Text in_txt;
1959 input DAE.Subscript in_a_subscript;
1960
1961 output Tpl.Text out_txt;
1962 algorithm
1963 out_txt :=
1964 match(in_txt, in_a_subscript)
1965 local
1966 Tpl.Text txt;
1967 Integer i_i;
1968
1969 case ( txt,
1970 DAE.INDEX(exp = DAE.ICONST(integer = i_i)) )
1971 algorithm
1972 64 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:IndexExpression>\n"));
1973 64 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1974 64 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:IntegerLiteral>"));
1975 64 txt := Tpl.writeStr(txt, intString(i_i));
1976 64 txt := Tpl.writeTok(txt, Tpl.ST_LINE("</exp:IntegerLiteral>\n"));
1977 64 txt := Tpl.popBlock(txt);
1978 64 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:IndexExpression>"));
1979 then txt;
1980
1981 case ( txt,
1982 DAE.SLICE(exp = DAE.ICONST(integer = i_i)) )
1983 algorithm
1984 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:IndexExpression>\n"));
1985 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
1986 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:IntegerLiteral>"));
1987 ✗ txt := Tpl.writeStr(txt, intString(i_i));
1988 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</exp:IntegerLiteral>\n"));
1989 ✗ txt := Tpl.popBlock(txt);
1990 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:IndexExpression>"));
1991 then txt;
1992
1993 case ( txt,
1994 DAE.WHOLEDIM() )
1995 algorithm
1996 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("WHOLEDIM"));
1997 then txt;
1998
1999 case ( txt,
2000 _ )
2001 algorithm
2002 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("UNKNOWN_SUBSCRIPT"));
2003 then txt;
2004 end match;
2005 end arraysubscriptStrXml;
2006
2007 public function crefToXmlStr
2008 input Tpl.Text in_txt;
2009 input DAE.ComponentRef in_a_cr;
2010
2011 output Tpl.Text out_txt;
2012 algorithm
2013 out_txt :=
2014 match(in_txt, in_a_cr)
2015 local
2016 Tpl.Text txt;
2017 String i_instant;
2018 DAE.ComponentRef i_componentRef;
2019 DAE.ComponentRef i_cr;
2020
2021 case ( txt,
2022 (i_cr as DAE.CREF_IDENT(ident = _)) )
2023 algorithm
2024 50 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Identifier>\n"));
2025 50 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2026 50 txt := qualifiedNamePartXml(txt, i_cr);
2027 50 txt := Tpl.softNewLine(txt);
2028 50 txt := Tpl.popBlock(txt);
2029 50 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Identifier>"));
2030 then txt;
2031
2032 case ( txt,
2033 DAE.CREF_QUAL(ident = "$DER", componentRef = i_componentRef) )
2034 algorithm
2035 28 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Der>\n"));
2036 28 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2037 28 txt := crefToXmlStr(txt, i_componentRef);
2038 28 txt := Tpl.softNewLine(txt);
2039 28 txt := Tpl.popBlock(txt);
2040 28 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Der>"));
2041 then txt;
2042
2043 case ( txt,
2044 (i_cr as DAE.CREF_QUAL(ident = _)) )
2045 algorithm
2046 288 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Identifier>\n"));
2047 288 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2048 288 txt := qualifiedNamePartXml(txt, i_cr);
2049 288 txt := Tpl.softNewLine(txt);
2050 288 txt := Tpl.popBlock(txt);
2051 288 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Identifier>"));
2052 then txt;
2053
2054 case ( txt,
2055 DAE.OPTIMICA_ATTR_INST_CREF(componentRef = i_componentRef, instant = i_instant) )
2056 algorithm
2057 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:TimedVariable timePointIndex = \"0\">\n"));
2058 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2059 ✗ txt := crefToXmlStr(txt, i_componentRef);
2060 ✗ txt := Tpl.softNewLine(txt);
2061 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:Instant>"));
2062 ✗ txt := Tpl.writeStr(txt, i_instant);
2063 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</exp:Instant>\n"));
2064 ✗ txt := Tpl.popBlock(txt);
2065 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:TimedVariable>"));
2066 then txt;
2067
2068 case ( txt,
2069 DAE.WILD() )
2070 then txt;
2071
2072 case ( txt,
2073 _ )
2074 algorithm
2075 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("CREF_NOT_IDENT_OR_QUAL"));
2076 then txt;
2077 end match;
2078 end crefToXmlStr;
2079
2080 public function crefStrXml
2081 input Tpl.Text in_txt;
2082 input DAE.ComponentRef in_a_cr;
2083
2084 output Tpl.Text out_txt;
2085 algorithm
2086 out_txt :=
2087 match(in_txt, in_a_cr)
2088 local
2089 Tpl.Text txt;
2090 DAE.ComponentRef i_componentRef;
2091 list<DAE.Subscript> i_subscriptLst;
2092 DAE.Ident i_ident;
2093
2094 case ( txt,
2095 DAE.CREF_IDENT(ident = i_ident, subscriptLst = i_subscriptLst) )
2096 algorithm
2097 252 txt := Tpl.writeStr(txt, i_ident);
2098 252 txt := subscriptsStrXml(txt, i_subscriptLst);
2099 then txt;
2100
2101 case ( txt,
2102 DAE.CREF_QUAL(ident = "$DER", componentRef = i_componentRef) )
2103 algorithm
2104 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING("der("));
2105 12 txt := crefStrXml(txt, i_componentRef);
2106 12 txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
2107 then txt;
2108
2109 case ( txt,
2110 DAE.CREF_QUAL(ident = "$PRE", componentRef = i_componentRef) )
2111 algorithm
2112 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("pre("));
2113 ✗ txt := crefStrXml(txt, i_componentRef);
2114 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
2115 then txt;
2116
2117 case ( txt,
2118 DAE.CREF_QUAL(ident = i_ident, subscriptLst = i_subscriptLst, componentRef = i_componentRef) )
2119 algorithm
2120 315 txt := Tpl.writeStr(txt, i_ident);
2121 315 txt := subscriptsStrXml(txt, i_subscriptLst);
2122 315 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
2123 315 txt := crefStrXml(txt, i_componentRef);
2124 then txt;
2125
2126 case ( txt,
2127 _ )
2128 algorithm
2129 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("CREF_NOT_IDENT_OR_QUAL"));
2130 then txt;
2131 end match;
2132 end crefStrXml;
2133
2134 protected function fun_102
2135 input Tpl.Text in_txt;
2136 input SimCodeFunction.Context in_a_context;
2137 input DAE.ComponentRef in_a_cr;
2138
2139 output Tpl.Text out_txt;
2140 algorithm
2141 out_txt :=
2142 match(in_txt, in_a_context, in_a_cr)
2143 local
2144 Tpl.Text txt;
2145 DAE.ComponentRef a_cr;
2146
2147 case ( txt,
2148 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
2149 a_cr )
2150 algorithm
2151 ✗ txt := arrayCrefStrXml(txt, a_cr);
2152 then txt;
2153
2154 case ( txt,
2155 _,
2156 a_cr )
2157 algorithm
2158 ✗ txt := arrayCrefXmlStr(txt, a_cr);
2159 then txt;
2160 end match;
2161 end fun_102;
2162
2163 public function contextArrayCrefXml
2164 input Tpl.Text txt;
2165 input DAE.ComponentRef a_cr;
2166 input SimCodeFunction.Context a_context;
2167
2168 output Tpl.Text out_txt;
2169 algorithm
2170 ✗ out_txt := fun_102(txt, a_context, a_cr);
2171 end contextArrayCrefXml;
2172
2173 public function arrayCrefXmlStr
2174 input Tpl.Text txt;
2175 input DAE.ComponentRef a_cr;
2176
2177 output Tpl.Text out_txt;
2178 algorithm
2179 ✗ out_txt := arrayCrefXmlStr2(txt, a_cr);
2180 end arrayCrefXmlStr;
2181
2182 public function arrayCrefXmlStr2
2183 input Tpl.Text in_txt;
2184 input DAE.ComponentRef in_a_cr;
2185
2186 output Tpl.Text out_txt;
2187 algorithm
2188 out_txt :=
2189 match(in_txt, in_a_cr)
2190 local
2191 Tpl.Text txt;
2192 DAE.ComponentRef i_componentRef;
2193 list<DAE.Subscript> i_subscriptLst;
2194 DAE.Ident i_ident;
2195 String ret_1;
2196 String ret_0;
2197
2198 case ( txt,
2199 DAE.CREF_IDENT(ident = i_ident) )
2200 algorithm
2201 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:QualifiedName>\n"));
2202 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2203 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
2204 ✗ ret_0 := System.unquoteIdentifier(i_ident);
2205 ✗ txt := Tpl.writeStr(txt, ret_0);
2206 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\">"));
2207 ✗ txt := Tpl.popBlock(txt);
2208 then txt;
2209
2210 case ( txt,
2211 DAE.CREF_QUAL(ident = i_ident, subscriptLst = i_subscriptLst, componentRef = i_componentRef) )
2212 algorithm
2213 ✗ ret_1 := System.unquoteIdentifier(i_ident);
2214 ✗ txt := Tpl.writeStr(txt, ret_1);
2215 ✗ txt := subscriptsStrXml(txt, i_subscriptLst);
2216 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("$P"));
2217 ✗ txt := arrayCrefXmlStr2(txt, i_componentRef);
2218 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("testing array"));
2219 then txt;
2220
2221 case ( txt,
2222 _ )
2223 algorithm
2224 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("CREF_NOT_IDENT_OR_QUAL"));
2225 then txt;
2226 end match;
2227 end arrayCrefXmlStr2;
2228
2229 public function arrayCrefStrXml
2230 input Tpl.Text in_txt;
2231 input DAE.ComponentRef in_a_cr;
2232
2233 output Tpl.Text out_txt;
2234 algorithm
2235 out_txt :=
2236 match(in_txt, in_a_cr)
2237 local
2238 Tpl.Text txt;
2239 DAE.ComponentRef i_componentRef;
2240 DAE.Ident i_ident;
2241
2242 case ( txt,
2243 DAE.CREF_IDENT(ident = i_ident) )
2244 algorithm
2245 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Identifier>\n"));
2246 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2247 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamepart name =\""));
2248 ✗ txt := Tpl.writeStr(txt, i_ident);
2249 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
2250 ✗ txt := Tpl.popBlock(txt);
2251 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Identifier>"));
2252 then txt;
2253
2254 case ( txt,
2255 DAE.CREF_QUAL(ident = i_ident, componentRef = i_componentRef) )
2256 algorithm
2257 ✗ txt := Tpl.writeStr(txt, i_ident);
2258 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
2259 ✗ txt := arrayCrefStrXml(txt, i_componentRef);
2260 then txt;
2261
2262 case ( txt,
2263 _ )
2264 algorithm
2265 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("CREF_NOT_IDENT_OR_QUAL"));
2266 then txt;
2267 end match;
2268 end arrayCrefStrXml;
2269
2270 protected function lm_107
2271 input output Tpl.Text txt;
2272 input list<DAE.Subscript> items;
2273 algorithm
2274
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 13 times.
26 for lstElt_107 in items loop
2275 txt := match lstElt_107
2276 local
2277 DAE.Subscript i_s;
2278
2279 case i_s
2280 algorithm
2281 13 txt := subscriptStrXml(txt, i_s);
2282 13 txt := Tpl.nextIter(txt);
2283 then txt;
2284 end match;
2285 end for;
2286 end lm_107;
2287
2288 public function subscriptsStrXml
2289 input Tpl.Text in_txt;
2290 input list<DAE.Subscript> in_a_subscripts;
2291
2292 output Tpl.Text out_txt;
2293 algorithm
2294 out_txt :=
2295 match(in_txt, in_a_subscripts)
2296 local
2297 Tpl.Text txt;
2298 list<DAE.Subscript> i_subscripts;
2299
2300 case ( txt,
2301 {} )
2302 then txt;
2303
2304 case ( txt,
2305 i_subscripts )
2306 algorithm
2307 13 txt := Tpl.writeTok(txt, Tpl.ST_STRING("["));
2308 13 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(",")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2309 13 txt := lm_107(txt, i_subscripts);
2310 13 txt := Tpl.popIter(txt);
2311 13 txt := Tpl.writeTok(txt, Tpl.ST_STRING("]"));
2312 then txt;
2313 end match;
2314 end subscriptsStrXml;
2315
2316 public function subscriptStrXml
2317 input Tpl.Text in_txt;
2318 input DAE.Subscript in_a_subscript;
2319
2320 output Tpl.Text out_txt;
2321 algorithm
2322 out_txt :=
2323 match(in_txt, in_a_subscript)
2324 local
2325 Tpl.Text txt;
2326 Integer i_i;
2327
2328 case ( txt,
2329 DAE.INDEX(exp = DAE.ICONST(integer = i_i)) )
2330 algorithm
2331 13 txt := Tpl.writeStr(txt, intString(i_i));
2332 then txt;
2333
2334 case ( txt,
2335 DAE.SLICE(exp = DAE.ICONST(integer = i_i)) )
2336 algorithm
2337 ✗ txt := Tpl.writeStr(txt, intString(i_i));
2338 then txt;
2339
2340 case ( txt,
2341 DAE.WHOLEDIM() )
2342 algorithm
2343 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("WHOLEDIM"));
2344 then txt;
2345
2346 case ( txt,
2347 _ )
2348 algorithm
2349 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("UNKNOWN_SUBSCRIPT"));
2350 then txt;
2351 end match;
2352 end subscriptStrXml;
2353
2354 public function expCrefXml
2355 input Tpl.Text in_txt;
2356 input DAE.Exp in_a_ecr;
2357
2358 output Tpl.Text out_txt;
2359 algorithm
2360 out_txt :=
2361 match(in_txt, in_a_ecr)
2362 local
2363 Tpl.Text txt;
2364 DAE.ComponentRef i_arg_componentRef;
2365 DAE.ComponentRef i_componentRef;
2366
2367 case ( txt,
2368 DAE.CREF(componentRef = i_componentRef) )
2369 algorithm
2370 ✗ txt := crefXml(txt, i_componentRef);
2371 then txt;
2372
2373 case ( txt,
2374 DAE.CALL(path = Absyn.IDENT(name = "der"), expLst = {DAE.CREF(componentRef = i_arg_componentRef)}) )
2375 algorithm
2376 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Der>\n"));
2377 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2378 ✗ txt := crefXml(txt, i_arg_componentRef);
2379 ✗ txt := Tpl.softNewLine(txt);
2380 ✗ txt := Tpl.popBlock(txt);
2381 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Der>"));
2382 then txt;
2383
2384 case ( txt,
2385 _ )
2386 algorithm
2387 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("ERROR_NOT_A_CREF"));
2388 then txt;
2389 end match;
2390 end expCrefXml;
2391
2392 public function crefFunctionNameXml
2393 input Tpl.Text in_txt;
2394 input DAE.ComponentRef in_a_cr;
2395
2396 output Tpl.Text out_txt;
2397 algorithm
2398 out_txt :=
2399 match(in_txt, in_a_cr)
2400 local
2401 Tpl.Text txt;
2402 DAE.ComponentRef i_componentRef;
2403 DAE.Ident i_ident;
2404 String ret_3;
2405 String ret_2;
2406 String ret_1;
2407 String ret_0;
2408
2409 case ( txt,
2410 DAE.CREF_IDENT(ident = i_ident) )
2411 algorithm
2412 ✗ ret_0 := System.unquoteIdentifier(i_ident);
2413 ✗ ret_1 := System.stringReplace(ret_0, "_", "__");
2414 ✗ txt := Tpl.writeStr(txt, ret_1);
2415 then txt;
2416
2417 case ( txt,
2418 DAE.CREF_QUAL(ident = i_ident, componentRef = i_componentRef) )
2419 algorithm
2420 ✗ ret_2 := System.unquoteIdentifier(i_ident);
2421 ✗ ret_3 := System.stringReplace(ret_2, "_", "__");
2422 ✗ txt := Tpl.writeStr(txt, ret_3);
2423 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_"));
2424 ✗ txt := crefFunctionNameXml(txt, i_componentRef);
2425 then txt;
2426
2427 case ( txt,
2428 _ )
2429 then txt;
2430 end match;
2431 end crefFunctionNameXml;
2432
2433 public function dotPathXml
2434 input Tpl.Text in_txt;
2435 input Absyn.Path in_a_path;
2436
2437 output Tpl.Text out_txt;
2438 algorithm
2439 out_txt :=
2440 match(in_txt, in_a_path)
2441 local
2442 Tpl.Text txt;
2443 String i_name_1;
2444 Absyn.Path i_path;
2445 Absyn.Ident i_name;
2446
2447 case ( txt,
2448 Absyn.QUALIFIED(name = i_name, path = i_path) )
2449 algorithm
2450 7 txt := Tpl.writeStr(txt, i_name);
2451 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
2452 7 txt := dotPathXml(txt, i_path);
2453 then txt;
2454
2455 case ( txt,
2456 Absyn.IDENT(name = i_name_1) )
2457 algorithm
2458 11 txt := Tpl.writeStr(txt, i_name_1);
2459 then txt;
2460
2461 case ( txt,
2462 Absyn.FULLYQUALIFIED(path = i_path) )
2463 algorithm
2464 ✗ txt := dotPathXml(txt, i_path);
2465 then txt;
2466
2467 case ( txt,
2468 _ )
2469 then txt;
2470 end match;
2471 end dotPathXml;
2472
2473 public function replaceDotAndUnderscoreXml
2474 input Tpl.Text in_txt;
2475 input String in_a_str;
2476
2477 output Tpl.Text out_txt;
2478 algorithm
2479 out_txt :=
2480 match(in_txt, in_a_str)
2481 local
2482 Tpl.Text txt;
2483 String i_name;
2484 String ret_4;
2485 String ret_3;
2486 Tpl.Text l_str__underscores;
2487 String ret_1;
2488 Tpl.Text l_str__dots;
2489
2490 case ( txt,
2491 i_name )
2492 algorithm
2493 ✗ ret_1 := System.stringReplace(i_name, ".", "_");
2494 ✗ l_str__dots := Tpl.writeStr(Tpl.emptyTxt, ret_1);
2495 ✗ ret_3 := System.stringReplace(Tpl.textString(l_str__dots), "_", "__");
2496 ✗ l_str__underscores := Tpl.writeStr(Tpl.emptyTxt, ret_3);
2497 ✗ ret_4 := System.unquoteIdentifier(Tpl.textString(l_str__underscores));
2498 ✗ txt := Tpl.writeStr(txt, ret_4);
2499 then txt;
2500 end match;
2501 end replaceDotAndUnderscoreXml;
2502
2503 public function underscorePathXml
2504 input Tpl.Text in_txt;
2505 input Absyn.Path in_a_path;
2506
2507 output Tpl.Text out_txt;
2508 algorithm
2509 out_txt :=
2510 match(in_txt, in_a_path)
2511 local
2512 Tpl.Text txt;
2513 String i_name_1;
2514 Absyn.Path i_path;
2515 Absyn.Ident i_name;
2516
2517 case ( txt,
2518 Absyn.QUALIFIED(name = i_name, path = i_path) )
2519 algorithm
2520 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
2521 2 txt := Tpl.writeStr(txt, i_name);
2522 2 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
2523 2 txt := underscorePathXml(txt, i_path);
2524 then txt;
2525
2526 case ( txt,
2527 Absyn.IDENT(name = i_name_1) )
2528 algorithm
2529 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
2530 7 txt := Tpl.writeStr(txt, i_name_1);
2531 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
2532 then txt;
2533
2534 case ( txt,
2535 Absyn.FULLYQUALIFIED(path = i_path) )
2536 algorithm
2537 ✗ txt := underscorePathXml(txt, i_path);
2538 then txt;
2539
2540 case ( txt,
2541 _ )
2542 then txt;
2543 end match;
2544 end underscorePathXml;
2545
2546 protected function lm_115
2547 input output Tpl.Text txt;
2548 input list<SimCodeVar.SimVar> items;
2549 algorithm
2550
2/2
✓ Branch 0 taken 63 times.
✓ Branch 1 taken 4 times.
67 for lstElt_115 in items loop
2551 txt := match lstElt_115
2552 local
2553 SimCodeVar.SimVar i_var;
2554
2555 case i_var
2556 algorithm
2557 63 txt := bindingEquationXml(txt, i_var);
2558 63 txt := Tpl.nextIter(txt);
2559 then txt;
2560 end match;
2561 end for;
2562 end lm_115;
2563
2564 protected function lm_116
2565 input output Tpl.Text txt;
2566 input list<SimCodeVar.SimVar> items;
2567 algorithm
2568
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 for lstElt_116 in items loop
2569 txt := match lstElt_116
2570 local
2571 SimCodeVar.SimVar i_var;
2572
2573 case i_var
2574 algorithm
2575 10 txt := bindingEquationXml(txt, i_var);
2576 10 txt := Tpl.nextIter(txt);
2577 then txt;
2578 end match;
2579 end for;
2580 end lm_116;
2581
2582 protected function lm_117
2583 input output Tpl.Text txt;
2584 input list<SimCodeVar.SimVar> items;
2585 algorithm
2586
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
16 for lstElt_117 in items loop
2587 txt := match lstElt_117
2588 local
2589 SimCodeVar.SimVar i_var;
2590
2591 case i_var
2592 algorithm
2593 12 txt := bindingEquationXml(txt, i_var);
2594 12 txt := Tpl.nextIter(txt);
2595 then txt;
2596 end match;
2597 end for;
2598 end lm_117;
2599
2600 protected function lm_118
2601 input output Tpl.Text txt;
2602 input list<SimCodeVar.SimVar> items;
2603 algorithm
2604
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_118 in items loop
2605 txt := match lstElt_118
2606 local
2607 SimCodeVar.SimVar i_var;
2608
2609 case i_var
2610 algorithm
2611 ✗ txt := bindingEquationXml(txt, i_var);
2612 ✗ txt := Tpl.nextIter(txt);
2613 then txt;
2614 end match;
2615 end for;
2616 end lm_118;
2617
2618 public function bindingEquationsXml
2619 input Tpl.Text in_txt;
2620 input SimCode.ModelInfo in_a_modelInfo;
2621
2622 output Tpl.Text out_txt;
2623 algorithm
2624 out_txt :=
2625 match(in_txt, in_a_modelInfo)
2626 local
2627 Tpl.Text txt;
2628 list<SimCodeVar.SimVar> i_vars_stringParamVars;
2629 list<SimCodeVar.SimVar> i_vars_boolParamVars;
2630 list<SimCodeVar.SimVar> i_vars_intParamVars;
2631 list<SimCodeVar.SimVar> i_vars_paramVars;
2632
2633 case ( txt,
2634 SimCode.MODELINFO(varInfo = SimCode.VARINFO(numStateVars = _), vars = SimCodeVar.SIMVARS(paramVars = i_vars_paramVars, intParamVars = i_vars_intParamVars, boolParamVars = i_vars_boolParamVars, stringParamVars = i_vars_stringParamVars)) )
2635 algorithm
2636 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<equ:BindingEquations>\n"));
2637 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
2638 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2639 4 txt := lm_115(txt, i_vars_paramVars);
2640 4 txt := Tpl.popIter(txt);
2641 4 txt := Tpl.softNewLine(txt);
2642 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2643 4 txt := lm_116(txt, i_vars_intParamVars);
2644 4 txt := Tpl.popIter(txt);
2645 4 txt := Tpl.softNewLine(txt);
2646 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2647 4 txt := lm_117(txt, i_vars_boolParamVars);
2648 4 txt := Tpl.popIter(txt);
2649 4 txt := Tpl.softNewLine(txt);
2650 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2651 4 txt := lm_118(txt, i_vars_stringParamVars);
2652 4 txt := Tpl.popIter(txt);
2653 4 txt := Tpl.softNewLine(txt);
2654 4 txt := Tpl.popBlock(txt);
2655 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</equ:BindingEquations>"));
2656 then txt;
2657
2658 case ( txt,
2659 _ )
2660 then txt;
2661 end match;
2662 end bindingEquationsXml;
2663
2664 protected function fun_120
2665 input Tpl.Text in_txt;
2666 input Option<DAE.Exp> in_a_initialValue;
2667 input Tpl.Text in_a_varName;
2668
2669 output Tpl.Text out_txt;
2670 algorithm
2671 out_txt :=
2672 match(in_txt, in_a_initialValue, in_a_varName)
2673 local
2674 Tpl.Text txt;
2675 Tpl.Text a_varName;
2676 DAE.Exp i_exp;
2677 Tpl.Text l_preExp;
2678 Tpl.Text l_varDecls;
2679
2680 case ( txt,
2681 SOME(i_exp),
2682 a_varName )
2683 algorithm
2684 85 l_varDecls := Tpl.emptyTxt;
2685 85 l_preExp := Tpl.emptyTxt;
2686 85 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
2687 "<equ:BindingEquation>\n",
2688 " <equ:Parameter>\n"
2689 }, true));
2690 85 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
2691 85 txt := Tpl.writeText(txt, a_varName);
2692 85 txt := Tpl.softNewLine(txt);
2693 85 txt := Tpl.popBlock(txt);
2694 85 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
2695 " </equ:Parameter>\n",
2696 " <equ:BindingExp>\n"
2697 }, true));
2698 85 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
2699 85 (txt, l_preExp, l_varDecls) := daeExpXml(txt, i_exp, SimCodeFunction.contextOther, l_preExp, l_varDecls);
2700 85 txt := Tpl.softNewLine(txt);
2701 85 txt := Tpl.popBlock(txt);
2702 85 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
2703 " </equ:BindingExp>\n",
2704 "</equ:BindingEquation>"
2705 }, false));
2706 85 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
2707 then txt;
2708
2709 case ( txt,
2710 _,
2711 _ )
2712 then txt;
2713 end match;
2714 end fun_120;
2715
2716 public function bindingEquationXml
2717 input Tpl.Text in_txt;
2718 input SimCodeVar.SimVar in_a_var;
2719
2720 output Tpl.Text out_txt;
2721 algorithm
2722 out_txt :=
2723 match(in_txt, in_a_var)
2724 local
2725 Tpl.Text txt;
2726 Option<DAE.Exp> i_initialValue;
2727 DAE.ComponentRef i_name;
2728 Tpl.Text l_varName;
2729
2730 case ( txt,
2731 SimCodeVar.SIMVAR(name = i_name, initialValue = i_initialValue) )
2732 algorithm
2733 85 l_varName := qualifiedNamePartXml(Tpl.emptyTxt, i_name);
2734 85 txt := fun_120(txt, i_initialValue, l_varName);
2735 then txt;
2736
2737 case ( txt,
2738 _ )
2739 then txt;
2740 end match;
2741 end bindingEquationXml;
2742
2743 protected function lm_122
2744 input output Tpl.Text txt;
2745 input list<SimCode.SimEqSystem> items;
2746 input output Tpl.Text a_tmp;
2747 input output Tpl.Text a_varDecls;
2748 algorithm
2749
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 4 times.
46 for lstElt_122 in items loop
2750 (txt, a_tmp, a_varDecls) := match lstElt_122
2751 local
2752 SimCode.SimEqSystem i_eq;
2753
2754 case i_eq
2755 algorithm
2756 42 (txt, a_varDecls, a_tmp) := equation_Xml(txt, i_eq, SimCodeFunction.contextSimulationDiscrete, a_varDecls, a_tmp);
2757 42 txt := Tpl.nextIter(txt);
2758 then (txt, a_tmp, a_varDecls);
2759 end match;
2760 end for;
2761 end lm_122;
2762
2763 public function equationsXml
2764 input Tpl.Text txt;
2765 input list<SimCode.SimEqSystem> a_allEquationsPlusWhen;
2766
2767 output Tpl.Text out_txt;
2768 protected
2769 Tpl.Text l_eqs;
2770 Tpl.Text l_tmp;
2771 Tpl.Text l_jens;
2772 Tpl.Text l_varDecls;
2773 algorithm
2774 4 l_varDecls := Tpl.emptyTxt;
2775 4 System.tmpTickReset(0);
2776 l_jens := Tpl.emptyTxt;
2777 4 l_tmp := Tpl.emptyTxt;
2778 4 l_eqs := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2779 4 (l_eqs, l_tmp, l_varDecls) := lm_122(l_eqs, a_allEquationsPlusWhen, l_tmp, l_varDecls);
2780 4 l_eqs := Tpl.popIter(l_eqs);
2781 4 out_txt := Tpl.writeTok(txt, Tpl.ST_LINE("<equ:DynamicEquations>\n"));
2782 4 out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(2));
2783 4 out_txt := Tpl.writeText(out_txt, l_tmp);
2784 4 out_txt := Tpl.softNewLine(out_txt);
2785 4 out_txt := Tpl.writeText(out_txt, l_eqs);
2786 4 out_txt := Tpl.softNewLine(out_txt);
2787 4 out_txt := Tpl.popBlock(out_txt);
2788 4 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("</equ:DynamicEquations>"));
2789 end equationsXml;
2790
2791 protected function lm_124
2792 input output Tpl.Text txt;
2793 input list<SimCode.SimEqSystem> items;
2794 input output Tpl.Text a_varDecls;
2795 algorithm
2796
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 4 times.
46 for lstElt_124 in items loop
2797 (txt, a_varDecls) := match lstElt_124
2798 local
2799 SimCode.SimEqSystem i_eq;
2800
2801 case i_eq
2802 algorithm
2803 42 (txt, a_varDecls) := equationAlgorithmXml(txt, i_eq, SimCodeFunction.contextSimulationDiscrete, a_varDecls);
2804 42 txt := Tpl.nextIter(txt);
2805 then (txt, a_varDecls);
2806 end match;
2807 end for;
2808 end lm_124;
2809
2810 public function algorithmicEquationsXml
2811 input Tpl.Text txt;
2812 input list<SimCode.SimEqSystem> a_allEquations;
2813
2814 output Tpl.Text out_txt;
2815 protected
2816 Tpl.Text l_algs;
2817 Tpl.Text l_varDecls;
2818 algorithm
2819 4 l_varDecls := Tpl.emptyTxt;
2820 4 l_algs := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2821 4 (l_algs, l_varDecls) := lm_124(l_algs, a_allEquations, l_varDecls);
2822 4 l_algs := Tpl.popIter(l_algs);
2823 4 out_txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Algorithm>\n"));
2824 4 out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(2));
2825 4 out_txt := Tpl.writeText(out_txt, l_algs);
2826 4 out_txt := Tpl.softNewLine(out_txt);
2827 4 out_txt := Tpl.popBlock(out_txt);
2828 4 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("</fun:Algorithm>"));
2829 end algorithmicEquationsXml;
2830
2831 protected function lm_126
2832 input output Tpl.Text txt;
2833 input list<DAE.Statement> items;
2834 input output Tpl.Text a_varDecls;
2835 algorithm
2836
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 for lstElt_126 in items loop
2837 (txt, a_varDecls) := match lstElt_126
2838 local
2839 DAE.Statement i_stmt;
2840
2841 case i_stmt
2842 algorithm
2843 2 (txt, a_varDecls) := algStatementXml(txt, i_stmt, SimCodeFunction.contextFunction, a_varDecls);
2844 2 txt := Tpl.nextIter(txt);
2845 then (txt, a_varDecls);
2846 end match;
2847 end for;
2848 end lm_126;
2849
2850 protected function fun_127
2851 input Tpl.Text in_txt;
2852 input SimCode.SimEqSystem in_a_eq;
2853 input Tpl.Text in_a_varDecls;
2854
2855 output Tpl.Text out_txt;
2856 output Tpl.Text out_a_varDecls;
2857 algorithm
2858 (out_txt, out_a_varDecls) :=
2859 match(in_txt, in_a_eq, in_a_varDecls)
2860 local
2861 Tpl.Text txt;
2862 Tpl.Text a_varDecls;
2863 list<DAE.Statement> i_statements;
2864 Tpl.Text l_alg;
2865
2866 case ( txt,
2867 SimCode.SES_ALGORITHM(statements = i_statements),
2868 a_varDecls )
2869 algorithm
2870 2 l_alg := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
2871 2 (l_alg, a_varDecls) := lm_126(l_alg, i_statements, a_varDecls);
2872 2 l_alg := Tpl.popIter(l_alg);
2873 2 txt := Tpl.writeText(txt, l_alg);
2874 2 then (txt, a_varDecls);
2875
2876 case ( txt,
2877 _,
2878 a_varDecls )
2879 then (txt, a_varDecls);
2880 end match;
2881 end fun_127;
2882
2883 public function equationAlgorithmXml
2884 input Tpl.Text txt;
2885 input SimCode.SimEqSystem a_eq;
2886 input SimCodeFunction.Context a_context;
2887 input Tpl.Text a_varDecls;
2888
2889 output Tpl.Text out_txt;
2890 output Tpl.Text out_a_varDecls;
2891 algorithm
2892 42 (out_txt, out_a_varDecls) := fun_127(txt, a_eq, a_varDecls);
2893 end equationAlgorithmXml;
2894
2895 protected function lm_129
2896 input output Tpl.Text txt;
2897 input list<SimCode.SimEqSystem> items;
2898 input output Tpl.Text a_tmp;
2899 input output Tpl.Text a_varDecls;
2900 algorithm
2901
2/2
✓ Branch 0 taken 65 times.
✓ Branch 1 taken 4 times.
69 for lstElt_129 in items loop
2902 (txt, a_tmp, a_varDecls) := match lstElt_129
2903 local
2904 SimCode.SimEqSystem i_eq;
2905
2906 case i_eq
2907 algorithm
2908 65 (txt, a_varDecls, a_tmp) := equation_Xml(txt, i_eq, SimCodeFunction.contextSimulationDiscrete, a_varDecls, a_tmp);
2909 65 txt := Tpl.nextIter(txt);
2910 then (txt, a_tmp, a_varDecls);
2911 end match;
2912 end for;
2913 end lm_129;
2914
2915 protected function lm_130
2916 input output Tpl.Text txt;
2917 input list<SimCodeVar.SimVar> items;
2918 algorithm
2919
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 for lstElt_130 in items loop
2920 txt := match lstElt_130
2921 local
2922 SimCodeVar.SimVar i_var;
2923
2924 case i_var
2925 algorithm
2926 10 txt := initialEquationXml(txt, i_var);
2927 10 txt := Tpl.nextIter(txt);
2928 then txt;
2929 end match;
2930 end for;
2931 end lm_130;
2932
2933 protected function lm_131
2934 input output Tpl.Text txt;
2935 input list<SimCodeVar.SimVar> items;
2936 algorithm
2937
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
14 for lstElt_131 in items loop
2938 txt := match lstElt_131
2939 local
2940 SimCodeVar.SimVar i_var;
2941
2942 case i_var
2943 algorithm
2944 10 txt := initialEquationXml(txt, i_var);
2945 10 txt := Tpl.nextIter(txt);
2946 then txt;
2947 end match;
2948 end for;
2949 end lm_131;
2950
2951 protected function lm_132
2952 input output Tpl.Text txt;
2953 input list<SimCodeVar.SimVar> items;
2954 algorithm
2955
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 4 times.
42 for lstElt_132 in items loop
2956 txt := match lstElt_132
2957 local
2958 SimCodeVar.SimVar i_var;
2959
2960 case i_var
2961 algorithm
2962 38 txt := initialEquationXml(txt, i_var);
2963 38 txt := Tpl.nextIter(txt);
2964 then txt;
2965 end match;
2966 end for;
2967 end lm_132;
2968
2969 protected function lm_133
2970 input output Tpl.Text txt;
2971 input list<SimCodeVar.SimVar> items;
2972 algorithm
2973
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_133 in items loop
2974 txt := match lstElt_133
2975 local
2976 SimCodeVar.SimVar i_var;
2977
2978 case i_var
2979 algorithm
2980 ✗ txt := initialEquationXml(txt, i_var);
2981 ✗ txt := Tpl.nextIter(txt);
2982 then txt;
2983 end match;
2984 end for;
2985 end lm_133;
2986
2987 protected function lm_134
2988 input output Tpl.Text txt;
2989 input list<SimCodeVar.SimVar> items;
2990 algorithm
2991
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_134 in items loop
2992 txt := match lstElt_134
2993 local
2994 SimCodeVar.SimVar i_var;
2995
2996 case i_var
2997 algorithm
2998 ✗ txt := initialEquationXml(txt, i_var);
2999 ✗ txt := Tpl.nextIter(txt);
3000 then txt;
3001 end match;
3002 end for;
3003 end lm_134;
3004
3005 protected function lm_135
3006 input output Tpl.Text txt;
3007 input list<SimCodeVar.SimVar> items;
3008 algorithm
3009
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 for lstElt_135 in items loop
3010 txt := match lstElt_135
3011 local
3012 SimCodeVar.SimVar i_var;
3013
3014 case i_var
3015 algorithm
3016 4 txt := initialEquationXml(txt, i_var);
3017 4 txt := Tpl.nextIter(txt);
3018 then txt;
3019 end match;
3020 end for;
3021 end lm_135;
3022
3023 protected function lm_136
3024 input output Tpl.Text txt;
3025 input list<SimCodeVar.SimVar> items;
3026 algorithm
3027
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_136 in items loop
3028 txt := match lstElt_136
3029 local
3030 SimCodeVar.SimVar i_var;
3031
3032 case i_var
3033 algorithm
3034 ✗ txt := initialEquationXml(txt, i_var);
3035 ✗ txt := Tpl.nextIter(txt);
3036 then txt;
3037 end match;
3038 end for;
3039 end lm_136;
3040
3041 public function initialEquationsXml
3042 input Tpl.Text in_txt;
3043 input SimCode.ModelInfo in_a_modelInfo;
3044 input list<SimCode.SimEqSystem> in_a_initialEqs;
3045
3046 output Tpl.Text out_txt;
3047 algorithm
3048 out_txt :=
3049 match(in_txt, in_a_modelInfo, in_a_initialEqs)
3050 local
3051 Tpl.Text txt;
3052 list<SimCode.SimEqSystem> a_initialEqs;
3053 list<SimCodeVar.SimVar> i_vars_stringAlgVars;
3054 list<SimCodeVar.SimVar> i_vars_boolAlgVars;
3055 list<SimCodeVar.SimVar> i_vars_intAlgVars;
3056 list<SimCodeVar.SimVar> i_vars_discreteAlgVars;
3057 list<SimCodeVar.SimVar> i_vars_algVars;
3058 list<SimCodeVar.SimVar> i_vars_derivativeVars;
3059 list<SimCodeVar.SimVar> i_vars_stateVars;
3060 Tpl.Text l_eqs;
3061 Tpl.Text l_tmp;
3062 Tpl.Text l_jens;
3063 Tpl.Text l_varDecls;
3064
3065 case ( txt,
3066 SimCode.MODELINFO(varInfo = SimCode.VARINFO(numStateVars = _), vars = SimCodeVar.SIMVARS(stateVars = i_vars_stateVars, derivativeVars = i_vars_derivativeVars, algVars = i_vars_algVars, discreteAlgVars = i_vars_discreteAlgVars, intAlgVars = i_vars_intAlgVars, boolAlgVars = i_vars_boolAlgVars, stringAlgVars = i_vars_stringAlgVars)),
3067 a_initialEqs )
3068 algorithm
3069 4 l_varDecls := Tpl.emptyTxt;
3070 4 System.tmpTickReset(0);
3071 l_jens := Tpl.emptyTxt;
3072 4 l_tmp := Tpl.emptyTxt;
3073 4 l_eqs := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3074 4 (l_eqs, l_tmp, l_varDecls) := lm_129(l_eqs, a_initialEqs, l_tmp, l_varDecls);
3075 4 l_eqs := Tpl.popIter(l_eqs);
3076 4 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<equ:InitialEquations>\n"));
3077 4 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3078 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3079 4 txt := lm_130(txt, i_vars_stateVars);
3080 4 txt := Tpl.popIter(txt);
3081 4 txt := Tpl.softNewLine(txt);
3082 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3083 4 txt := lm_131(txt, i_vars_derivativeVars);
3084 4 txt := Tpl.popIter(txt);
3085 4 txt := Tpl.softNewLine(txt);
3086 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3087 4 txt := lm_132(txt, i_vars_algVars);
3088 4 txt := Tpl.popIter(txt);
3089 4 txt := Tpl.softNewLine(txt);
3090 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3091 4 txt := lm_133(txt, i_vars_discreteAlgVars);
3092 4 txt := Tpl.popIter(txt);
3093 4 txt := Tpl.softNewLine(txt);
3094 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3095 4 txt := lm_134(txt, i_vars_intAlgVars);
3096 4 txt := Tpl.popIter(txt);
3097 4 txt := Tpl.softNewLine(txt);
3098 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3099 4 txt := lm_135(txt, i_vars_boolAlgVars);
3100 4 txt := Tpl.popIter(txt);
3101 4 txt := Tpl.softNewLine(txt);
3102 4 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3103 4 txt := lm_136(txt, i_vars_stringAlgVars);
3104 4 txt := Tpl.popIter(txt);
3105 4 txt := Tpl.softNewLine(txt);
3106 4 txt := Tpl.writeText(txt, l_tmp);
3107 4 txt := Tpl.softNewLine(txt);
3108 4 txt := Tpl.writeText(txt, l_eqs);
3109 4 txt := Tpl.softNewLine(txt);
3110 4 txt := Tpl.popBlock(txt);
3111 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</equ:InitialEquations>"));
3112 then txt;
3113
3114 case ( txt,
3115 _,
3116 _ )
3117 then txt;
3118 end match;
3119 end initialEquationsXml;
3120
3121 protected function fun_138
3122 input Tpl.Text in_txt;
3123 input Option<DAE.Exp> in_a_initialValue;
3124 input Tpl.Text in_a_identName;
3125
3126 output Tpl.Text out_txt;
3127 algorithm
3128 out_txt :=
3129 match(in_txt, in_a_initialValue, in_a_identName)
3130 local
3131 Tpl.Text txt;
3132 Tpl.Text a_identName;
3133 DAE.Exp i_exp;
3134 Tpl.Text l_preExp;
3135 Tpl.Text l_varDecls;
3136
3137 case ( txt,
3138 SOME(i_exp),
3139 a_identName )
3140 algorithm
3141 22 l_varDecls := Tpl.emptyTxt;
3142 22 l_preExp := Tpl.emptyTxt;
3143 22 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
3144 "<equ:Equation>\n",
3145 " <exp:Sub>\n"
3146 }, true));
3147 22 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
3148 22 txt := Tpl.writeText(txt, a_identName);
3149 22 txt := Tpl.softNewLine(txt);
3150 22 (txt, l_preExp, l_varDecls) := daeExpXml(txt, i_exp, SimCodeFunction.contextOther, l_preExp, l_varDecls);
3151 22 txt := Tpl.softNewLine(txt);
3152 22 txt := Tpl.popBlock(txt);
3153 22 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
3154 " </exp:Sub>\n",
3155 "</equ:Equation>"
3156 }, false));
3157 22 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
3158 then txt;
3159
3160 case ( txt,
3161 _,
3162 _ )
3163 then txt;
3164 end match;
3165 end fun_138;
3166
3167 public function initialEquationXml
3168 input Tpl.Text in_txt;
3169 input SimCodeVar.SimVar in_a_var;
3170
3171 output Tpl.Text out_txt;
3172 algorithm
3173 out_txt :=
3174 match(in_txt, in_a_var)
3175 local
3176 Tpl.Text txt;
3177 Option<DAE.Exp> i_initialValue;
3178 DAE.ComponentRef i_name;
3179 Tpl.Text l_identName;
3180
3181 case ( txt,
3182 SimCodeVar.SIMVAR(name = i_name, initialValue = i_initialValue) )
3183 algorithm
3184 62 l_identName := crefXml(Tpl.emptyTxt, i_name);
3185 62 txt := fun_138(txt, i_initialValue, l_identName);
3186 then txt;
3187
3188 case ( txt,
3189 _ )
3190 then txt;
3191 end match;
3192 end initialEquationXml;
3193
3194 protected function fun_140
3195 input Tpl.Text in_txt;
3196 input SimCode.SimEqSystem in_a_eq;
3197 input Tpl.Text in_a_varD;
3198 input SimCodeFunction.Context in_a_context;
3199
3200 output Tpl.Text out_txt;
3201 output Tpl.Text out_a_varD;
3202 algorithm
3203 (out_txt, out_a_varD) :=
3204 match(in_txt, in_a_eq, in_a_varD, in_a_context)
3205 local
3206 Tpl.Text txt;
3207 Tpl.Text a_varD;
3208 SimCodeFunction.Context a_context;
3209 SimCode.SimEqSystem i_e;
3210
3211 case ( txt,
3212 (i_e as SimCode.SES_SIMPLE_ASSIGN(index = _)),
3213 a_varD,
3214 a_context )
3215 algorithm
3216 75 (txt, a_varD) := equationSimpleAssignXml(txt, i_e, a_context, a_varD);
3217 then (txt, a_varD);
3218
3219 case ( txt,
3220 (i_e as SimCode.SES_SIMPLE_ASSIGN_CONSTRAINTS(index = _)),
3221 a_varD,
3222 a_context )
3223 algorithm
3224 ✗ (txt, a_varD) := equationSimpleAssignXml(txt, i_e, a_context, a_varD);
3225 then (txt, a_varD);
3226
3227 case ( txt,
3228 (i_e as SimCode.SES_ARRAY_CALL_ASSIGN(index = _)),
3229 a_varD,
3230 a_context )
3231 algorithm
3232 ✗ (txt, a_varD) := equationArrayCallAssignXml(txt, i_e, a_context, a_varD);
3233 then (txt, a_varD);
3234
3235 case ( txt,
3236 SimCode.SES_IFEQUATION(index = _),
3237 a_varD,
3238 _ )
3239 algorithm
3240 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("IfEquation Assign Not implemente yet"));
3241 ✗ then (txt, a_varD);
3242
3243 case ( txt,
3244 (i_e as SimCode.SES_LINEAR(lSystem = _)),
3245 a_varD,
3246 a_context )
3247 algorithm
3248 ✗ (txt, a_varD) := equationLinearXml(txt, i_e, a_context, a_varD);
3249 then (txt, a_varD);
3250
3251 case ( txt,
3252 (i_e as SimCode.SES_NONLINEAR(nlSystem = _)),
3253 a_varD,
3254 a_context )
3255 algorithm
3256 1 (txt, a_varD) := equationNonlinearXml(txt, i_e, a_context, a_varD);
3257 then (txt, a_varD);
3258
3259 case ( txt,
3260 SimCode.SES_WHEN(index = _),
3261 a_varD,
3262 _ )
3263 algorithm
3264 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
3265 ✗ then (txt, a_varD);
3266
3267 case ( txt,
3268 SimCode.SES_ALIAS(aliasOf = _),
3269 a_varD,
3270 _ )
3271 algorithm
3272 26 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
3273 26 then (txt, a_varD);
3274
3275 case ( txt,
3276 _,
3277 a_varD,
3278 _ )
3279 algorithm
3280 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("NOT IMPLEMENTED EQUATION"));
3281 ✗ then (txt, a_varD);
3282 end match;
3283 end fun_140;
3284
3285 public function equation_Xml
3286 input Tpl.Text in_txt;
3287 input SimCode.SimEqSystem in_a_eq;
3288 input SimCodeFunction.Context in_a_context;
3289 input Tpl.Text in_a_varDecls;
3290 input Tpl.Text in_a_eqs;
3291
3292 output Tpl.Text out_txt;
3293 output Tpl.Text out_a_varDecls;
3294 output Tpl.Text out_a_eqs;
3295 algorithm
3296 (out_txt, out_a_varDecls, out_a_eqs) :=
3297 match(in_txt, in_a_eq, in_a_context, in_a_varDecls, in_a_eqs)
3298 local
3299 Tpl.Text txt;
3300 SimCodeFunction.Context a_context;
3301 Tpl.Text a_varDecls;
3302 Tpl.Text a_eqs;
3303 SimCode.SimEqSystem i_eq;
3304 SimCode.SimEqSystem i_e;
3305 Tpl.Text l_x;
3306 Tpl.Text l_varD;
3307 Tpl.Text l_tmp;
3308 Integer ret_1;
3309 Tpl.Text l_ix;
3310
3311 case ( txt,
3312 SimCode.SES_MIXED(index = _),
3313 _,
3314 a_varDecls,
3315 a_eqs )
3316 algorithm
3317 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" MIXED EQUATION NOT IMPLEMENTED "));
3318 ✗ then (txt, a_varDecls, a_eqs);
3319
3320 case ( txt,
3321 SimCode.SES_ALGORITHM(statements = {}),
3322 _,
3323 a_varDecls,
3324 a_eqs )
3325 algorithm
3326 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
3327 ✗ then (txt, a_varDecls, a_eqs);
3328
3329 case ( txt,
3330 SimCode.SES_ALGORITHM(index = _),
3331 _,
3332 a_varDecls,
3333 a_eqs )
3334 algorithm
3335 4 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
3336 4 then (txt, a_varDecls, a_eqs);
3337
3338 case ( txt,
3339 (i_e as SimCode.SES_WHEN(index = _)),
3340 a_context,
3341 a_varDecls,
3342 a_eqs )
3343 algorithm
3344 1 (txt, a_varDecls) := equationWhenXml(txt, i_e, a_context, a_varDecls);
3345 1 then (txt, a_varDecls, a_eqs);
3346
3347 case ( txt,
3348 i_eq,
3349 a_context,
3350 a_varDecls,
3351 a_eqs )
3352 algorithm
3353 102 ret_1 := System.tmpTickIndex(10);
3354 102 l_ix := Tpl.writeStr(Tpl.emptyTxt, intString(ret_1));
3355 l_tmp := Tpl.emptyTxt;
3356 102 l_varD := Tpl.emptyTxt;
3357 102 (l_x, l_varD) := fun_140(Tpl.emptyTxt, i_eq, l_varD, a_context);
3358 102 a_eqs := Tpl.writeTok(a_eqs, Tpl.ST_STRING_LIST({
3359 "<equ:Equation>\n",
3360 " <exp:Sub>\n"
3361 }, true));
3362 102 a_eqs := Tpl.pushBlock(a_eqs, Tpl.BT_INDENT(4));
3363 102 a_eqs := Tpl.writeText(a_eqs, l_x);
3364 102 a_eqs := Tpl.softNewLine(a_eqs);
3365 102 a_eqs := Tpl.popBlock(a_eqs);
3366 102 a_eqs := Tpl.writeTok(a_eqs, Tpl.ST_STRING_LIST({
3367 " </exp:Sub>\n",
3368 "</equ:Equation>"
3369 }, false));
3370 102 a_eqs := Tpl.writeTok(a_eqs, Tpl.ST_NEW_LINE());
3371 102 then (txt, a_varDecls, a_eqs);
3372 end match;
3373 end equation_Xml;
3374
3375 public function old_equation_Xml
3376 input Tpl.Text in_txt;
3377 input SimCode.SimEqSystem in_a_eq;
3378 input SimCodeFunction.Context in_a_context;
3379 input Tpl.Text in_a_varDecls;
3380
3381 output Tpl.Text out_txt;
3382 output Tpl.Text out_a_varDecls;
3383 algorithm
3384 (out_txt, out_a_varDecls) :=
3385 match(in_txt, in_a_eq, in_a_context, in_a_varDecls)
3386 local
3387 Tpl.Text txt;
3388 SimCodeFunction.Context a_context;
3389 Tpl.Text a_varDecls;
3390 SimCode.SimEqSystem i_e;
3391
3392 case ( txt,
3393 (i_e as SimCode.SES_MIXED(index = _)),
3394 a_context,
3395 a_varDecls )
3396 algorithm
3397 ✗ (txt, a_varDecls) := equationSimpleAssignXml(txt, i_e, a_context, a_varDecls);
3398 then (txt, a_varDecls);
3399
3400 case ( txt,
3401 (i_e as SimCode.SES_SIMPLE_ASSIGN(index = _)),
3402 a_context,
3403 a_varDecls )
3404 algorithm
3405 ✗ (txt, a_varDecls) := equationSimpleAssignXml(txt, i_e, a_context, a_varDecls);
3406 then (txt, a_varDecls);
3407
3408 case ( txt,
3409 (i_e as SimCode.SES_SIMPLE_ASSIGN_CONSTRAINTS(index = _)),
3410 a_context,
3411 a_varDecls )
3412 algorithm
3413 ✗ (txt, a_varDecls) := equationSimpleAssignXml(txt, i_e, a_context, a_varDecls);
3414 then (txt, a_varDecls);
3415
3416 case ( txt,
3417 (i_e as SimCode.SES_ARRAY_CALL_ASSIGN(index = _)),
3418 a_context,
3419 a_varDecls )
3420 algorithm
3421 ✗ (txt, a_varDecls) := equationArrayCallAssignXml(txt, i_e, a_context, a_varDecls);
3422 then (txt, a_varDecls);
3423
3424 case ( txt,
3425 SimCode.SES_ALGORITHM(index = _),
3426 _,
3427 a_varDecls )
3428 algorithm
3429 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
3430 ✗ then (txt, a_varDecls);
3431
3432 case ( txt,
3433 SimCode.SES_LINEAR(lSystem = _),
3434 _,
3435 a_varDecls )
3436 algorithm
3437 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" equations are not implemented yet"));
3438 ✗ then (txt, a_varDecls);
3439
3440 case ( txt,
3441 SimCode.SES_NONLINEAR(nlSystem = _),
3442 _,
3443 a_varDecls )
3444 algorithm
3445 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("equations are not implemented yet "));
3446 ✗ then (txt, a_varDecls);
3447
3448 case ( txt,
3449 (i_e as SimCode.SES_WHEN(index = _)),
3450 a_context,
3451 a_varDecls )
3452 algorithm
3453 ✗ (txt, a_varDecls) := equationWhenXml(txt, i_e, a_context, a_varDecls);
3454 then (txt, a_varDecls);
3455
3456 case ( txt,
3457 _,
3458 _,
3459 a_varDecls )
3460 algorithm
3461 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("NOT IMPLEMENTED EQUATION"));
3462 ✗ then (txt, a_varDecls);
3463 end match;
3464 end old_equation_Xml;
3465
3466 protected function fun_143
3467 input Tpl.Text in_txt;
3468 input Boolean in_mArg;
3469 input Tpl.Text in_a_preExp;
3470 input Tpl.Text in_a_expPart;
3471
3472 output Tpl.Text out_txt;
3473 algorithm
3474 out_txt :=
3475 match(in_txt, in_mArg, in_a_preExp, in_a_expPart)
3476 local
3477 Tpl.Text txt;
3478 Tpl.Text a_preExp;
3479 Tpl.Text a_expPart;
3480
3481 case ( txt,
3482 true,
3483 _,
3484 a_expPart )
3485 algorithm
3486 68 txt := Tpl.writeText(txt, a_expPart);
3487 then txt;
3488
3489 case ( txt,
3490 _,
3491 a_preExp,
3492 _ )
3493 algorithm
3494 7 txt := Tpl.writeText(txt, a_preExp);
3495 then txt;
3496 end match;
3497 end fun_143;
3498
3499 protected function fun_144
3500 input Tpl.Text in_txt;
3501 input Boolean in_mArg;
3502 input Tpl.Text in_a_preExp;
3503 input Tpl.Text in_a_expPart;
3504
3505 output Tpl.Text out_txt;
3506 algorithm
3507 out_txt :=
3508 match(in_txt, in_mArg, in_a_preExp, in_a_expPart)
3509 local
3510 Tpl.Text txt;
3511 Tpl.Text a_preExp;
3512 Tpl.Text a_expPart;
3513
3514 case ( txt,
3515 true,
3516 _,
3517 a_expPart )
3518 algorithm
3519 ✗ txt := Tpl.writeText(txt, a_expPart);
3520 then txt;
3521
3522 case ( txt,
3523 _,
3524 a_preExp,
3525 _ )
3526 algorithm
3527 ✗ txt := Tpl.writeText(txt, a_preExp);
3528 then txt;
3529 end match;
3530 end fun_144;
3531
3532 public function equationSimpleAssignXml
3533 input Tpl.Text in_txt;
3534 input SimCode.SimEqSystem in_a_eq;
3535 input SimCodeFunction.Context in_a_context;
3536 input Tpl.Text in_a_varDecls;
3537
3538 output Tpl.Text out_txt;
3539 output Tpl.Text out_a_varDecls;
3540 algorithm
3541 (out_txt, out_a_varDecls) :=
3542 match(in_txt, in_a_eq, in_a_context, in_a_varDecls)
3543 local
3544 Tpl.Text txt;
3545 SimCodeFunction.Context a_context;
3546 Tpl.Text a_varDecls;
3547 DAE.ComponentRef i_cref;
3548 DAE.Exp i_exp;
3549 Boolean ret_4;
3550 Boolean ret_3;
3551 Tpl.Text l_result;
3552 Tpl.Text l_expPart;
3553 Tpl.Text l_preExp;
3554
3555 case ( txt,
3556 SimCode.SES_SIMPLE_ASSIGN(exp = i_exp, cref = i_cref),
3557 a_context,
3558 a_varDecls )
3559 algorithm
3560 75 l_preExp := Tpl.emptyTxt;
3561 75 (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
3562 75 ret_3 := Tpl.isEmpty(l_preExp);
3563 75 l_result := fun_143(Tpl.emptyTxt, ret_3, l_preExp, l_expPart);
3564 75 txt := crefXml(txt, i_cref);
3565 75 txt := Tpl.softNewLine(txt);
3566 75 txt := Tpl.writeText(txt, l_result);
3567 75 then (txt, a_varDecls);
3568
3569 case ( txt,
3570 SimCode.SES_SIMPLE_ASSIGN_CONSTRAINTS(exp = i_exp, cref = i_cref),
3571 a_context,
3572 a_varDecls )
3573 algorithm
3574 ✗ l_preExp := Tpl.emptyTxt;
3575 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
3576 ✗ ret_4 := Tpl.isEmpty(l_preExp);
3577 ✗ l_result := fun_144(Tpl.emptyTxt, ret_4, l_preExp, l_expPart);
3578 ✗ txt := crefXml(txt, i_cref);
3579 ✗ txt := Tpl.softNewLine(txt);
3580 ✗ txt := Tpl.writeText(txt, l_result);
3581 ✗ then (txt, a_varDecls);
3582
3583 case ( txt,
3584 _,
3585 _,
3586 a_varDecls )
3587 then (txt, a_varDecls);
3588 end match;
3589 end equationSimpleAssignXml;
3590
3591 protected function fun_146
3592 input Tpl.Text in_txt;
3593 input String in_mArg;
3594 input DAE.Exp in_a_eqn_exp;
3595 input DAE.ComponentRef in_a_lhs_componentRef;
3596 input Tpl.Text in_a_expPart;
3597
3598 output Tpl.Text out_txt;
3599 algorithm
3600 out_txt :=
3601 match(in_txt, in_mArg, in_a_eqn_exp, in_a_lhs_componentRef, in_a_expPart)
3602 local
3603 Tpl.Text txt;
3604 DAE.Exp a_eqn_exp;
3605 DAE.ComponentRef a_lhs_componentRef;
3606 Tpl.Text a_expPart;
3607 Tpl.Text txt_0;
3608
3609 case ( txt,
3610 "boolean",
3611 _,
3612 a_lhs_componentRef,
3613 a_expPart )
3614 algorithm
3615 ✗ txt := Tpl.writeText(txt, a_expPart);
3616 ✗ txt := Tpl.softNewLine(txt);
3617 ✗ txt := crefXml(txt, a_lhs_componentRef);
3618 then txt;
3619
3620 case ( txt,
3621 "integer",
3622 _,
3623 a_lhs_componentRef,
3624 a_expPart )
3625 algorithm
3626 ✗ txt := Tpl.writeText(txt, a_expPart);
3627 ✗ txt := Tpl.softNewLine(txt);
3628 ✗ txt := crefXml(txt, a_lhs_componentRef);
3629 then txt;
3630
3631 case ( txt,
3632 "real",
3633 _,
3634 a_lhs_componentRef,
3635 a_expPart )
3636 algorithm
3637 ✗ txt := crefXml(txt, a_lhs_componentRef);
3638 ✗ txt := Tpl.softNewLine(txt);
3639 ✗ txt := Tpl.writeText(txt, a_expPart);
3640 then txt;
3641
3642 case ( txt,
3643 _,
3644 a_eqn_exp,
3645 _,
3646 _ )
3647 algorithm
3648 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("No runtime support for this sort of array call: "));
3649 ✗ txt_0 := ExpressionDumpTpl.dumpExp(txt_0, a_eqn_exp, "\"");
3650 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 850, 14), Tpl.textString(txt_0));
3651 then txt;
3652 end match;
3653 end fun_146;
3654
3655 public function equationArrayCallAssignXml
3656 input Tpl.Text in_txt;
3657 input SimCode.SimEqSystem in_a_eq;
3658 input SimCodeFunction.Context in_a_context;
3659 input Tpl.Text in_a_varDecls;
3660
3661 output Tpl.Text out_txt;
3662 output Tpl.Text out_a_varDecls;
3663 algorithm
3664 (out_txt, out_a_varDecls) :=
3665 match(in_txt, in_a_eq, in_a_context, in_a_varDecls)
3666 local
3667 Tpl.Text txt;
3668 SimCodeFunction.Context a_context;
3669 Tpl.Text a_varDecls;
3670 DAE.ComponentRef i_lhs_componentRef;
3671 DAE.Exp i_eqn_exp;
3672 DAE.Exp i_exp;
3673 String str_3;
3674 Tpl.Text txt_2;
3675 Tpl.Text l_expPart;
3676 Tpl.Text l_preExp;
3677
3678 case ( txt,
3679 SimCode.SES_ARRAY_CALL_ASSIGN(lhs = DAE.CREF(componentRef = i_lhs_componentRef), exp = (i_eqn_exp as i_exp)),
3680 a_context,
3681 a_varDecls )
3682 algorithm
3683 ✗ l_preExp := Tpl.emptyTxt;
3684 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
3685 ✗ txt_2 := expTypeFromExpShortXml(Tpl.emptyTxt, i_eqn_exp);
3686 ✗ str_3 := Tpl.textString(txt_2);
3687 ✗ txt := fun_146(txt, str_3, i_eqn_exp, i_lhs_componentRef, l_expPart);
3688 ✗ then (txt, a_varDecls);
3689
3690 case ( txt,
3691 _,
3692 _,
3693 a_varDecls )
3694 then (txt, a_varDecls);
3695 end match;
3696 end equationArrayCallAssignXml;
3697
3698 protected function lm_148
3699 input output Tpl.Text txt;
3700 input list<tuple<Integer, Integer, SimCode.SimEqSystem>> items;
3701 input output Tpl.Text a_varDecls;
3702 input SimCodeFunction.Context a_context;
3703 algorithm
3704 ✗ for lstElt_148 in items loop
3705 (txt, a_varDecls) := match lstElt_148
3706 local
3707 DAE.Exp i_eq_exp;
3708 Tpl.Text l_expPart;
3709 Tpl.Text l_preExp;
3710
3711 case (_, _, SimCode.SES_RESIDUAL(exp = i_eq_exp))
3712 algorithm
3713 ✗ l_preExp := Tpl.emptyTxt;
3714 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_eq_exp, a_context, l_preExp, a_varDecls);
3715 ✗ txt := Tpl.writeText(txt, l_preExp);
3716 ✗ txt := Tpl.softNewLine(txt);
3717 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3718 ✗ txt := Tpl.writeText(txt, l_expPart);
3719 ✗ txt := Tpl.popBlock(txt);
3720 ✗ txt := Tpl.nextIter(txt);
3721 ✗ then (txt, a_varDecls);
3722
3723 case _
3724 ✗ then (txt, a_varDecls);
3725 end match;
3726 end for;
3727 end lm_148;
3728
3729 protected function lm_149
3730 input output Tpl.Text txt;
3731 input list<DAE.Exp> items;
3732 input output Tpl.Text a_varDecls;
3733 input SimCodeFunction.Context a_context;
3734 algorithm
3735 ✗ for lstElt_149 in items loop
3736 (txt, a_varDecls) := match lstElt_149
3737 local
3738 DAE.Exp i_exp;
3739 Tpl.Text l_expPart;
3740 Tpl.Text l_preExp;
3741
3742 case i_exp
3743 algorithm
3744 ✗ l_preExp := Tpl.emptyTxt;
3745 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
3746 ✗ txt := Tpl.writeText(txt, l_preExp);
3747 ✗ txt := Tpl.softNewLine(txt);
3748 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(3));
3749 ✗ txt := Tpl.writeText(txt, l_expPart);
3750 ✗ txt := Tpl.popBlock(txt);
3751 ✗ txt := Tpl.nextIter(txt);
3752 then (txt, a_varDecls);
3753 end match;
3754 end for;
3755 end lm_149;
3756
3757 public function equationLinearXml
3758 input Tpl.Text in_txt;
3759 input SimCode.SimEqSystem in_a_eq;
3760 input SimCodeFunction.Context in_a_context;
3761 input Tpl.Text in_a_varDecls;
3762
3763 output Tpl.Text out_txt;
3764 output Tpl.Text out_a_varDecls;
3765 algorithm
3766 (out_txt, out_a_varDecls) :=
3767 match(in_txt, in_a_eq, in_a_context, in_a_varDecls)
3768 local
3769 Tpl.Text txt;
3770 SimCodeFunction.Context a_context;
3771 Tpl.Text a_varDecls;
3772 list<DAE.Exp> i_ls_beqs;
3773 list<tuple<Integer, Integer, SimCode.SimEqSystem>> i_ls_simJac;
3774
3775 case ( txt,
3776 SimCode.SES_LINEAR(lSystem = SimCode.LINEARSYSTEM(simJac = i_ls_simJac, beqs = i_ls_beqs)),
3777 a_context,
3778 a_varDecls )
3779 algorithm
3780 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3781 ✗ (txt, a_varDecls) := lm_148(txt, i_ls_simJac, a_varDecls, a_context);
3782 ✗ txt := Tpl.popIter(txt);
3783 ✗ txt := Tpl.softNewLine(txt);
3784 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3785 ✗ (txt, a_varDecls) := lm_149(txt, i_ls_beqs, a_varDecls, a_context);
3786 ✗ txt := Tpl.popIter(txt);
3787 ✗ then (txt, a_varDecls);
3788
3789 case ( txt,
3790 _,
3791 _,
3792 a_varDecls )
3793 then (txt, a_varDecls);
3794 end match;
3795 end equationLinearXml;
3796
3797 protected function lm_151
3798 input output Tpl.Text txt;
3799 input list<SimCode.SimEqSystem> items;
3800 input output Tpl.Text a_tmp;
3801 input output Tpl.Text a_varDecls;
3802 algorithm
3803
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 for lstElt_151 in items loop
3804 (txt, a_tmp, a_varDecls) := match lstElt_151
3805 local
3806 SimCode.SimEqSystem i_eq2;
3807
3808 case i_eq2
3809 algorithm
3810 1 (txt, a_varDecls, a_tmp) := functionExtraResidualsPreBody(txt, i_eq2, a_varDecls, a_tmp);
3811 1 txt := Tpl.nextIter(txt);
3812 then (txt, a_tmp, a_varDecls);
3813 end match;
3814 end for;
3815 end lm_151;
3816
3817 protected function lm_152
3818 input output Tpl.Text txt;
3819 input list<SimCode.SimEqSystem> items;
3820 input output Tpl.Text a_varDecls;
3821 algorithm
3822
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 for lstElt_152 in items loop
3823 (txt, a_varDecls) := match lstElt_152
3824 local
3825 DAE.Exp i_eq2_exp;
3826 Tpl.Text l_expPart;
3827 Tpl.Text l_preExp;
3828
3829 case SimCode.SES_RESIDUAL(exp = i_eq2_exp)
3830 algorithm
3831 1 l_preExp := Tpl.emptyTxt;
3832 1 (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_eq2_exp, SimCodeFunction.contextSimulationDiscrete, l_preExp, a_varDecls);
3833 1 txt := Tpl.writeText(txt, l_preExp);
3834 1 txt := Tpl.softNewLine(txt);
3835 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
3836 1 txt := Tpl.writeText(txt, l_expPart);
3837 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
3838 1 txt := Tpl.popBlock(txt);
3839 1 txt := Tpl.nextIter(txt);
3840 1 then (txt, a_varDecls);
3841
3842 case _
3843 ✗ then (txt, a_varDecls);
3844 end match;
3845 end for;
3846 end lm_152;
3847
3848 protected function fun_153
3849 input Tpl.Text in_txt;
3850 input SimCode.SimEqSystem in_a_eq;
3851
3852 output Tpl.Text out_txt;
3853 algorithm
3854 out_txt :=
3855 match(in_txt, in_a_eq)
3856 local
3857 Tpl.Text txt;
3858 list<SimCode.SimEqSystem> i_nls_eqs;
3859 Tpl.Text l_body;
3860 Tpl.Text l_prebody;
3861 Tpl.Text l_tmp;
3862 Tpl.Text l_varDecls;
3863
3864 case ( txt,
3865 SimCode.SES_NONLINEAR(nlSystem = SimCode.NONLINEARSYSTEM(eqs = i_nls_eqs)) )
3866 algorithm
3867 1 l_varDecls := Tpl.emptyTxt;
3868 1 l_tmp := Tpl.emptyTxt;
3869 1 l_prebody := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3870 1 (l_prebody, l_tmp, l_varDecls) := lm_151(l_prebody, i_nls_eqs, l_tmp, l_varDecls);
3871 1 l_prebody := Tpl.popIter(l_prebody);
3872 1 l_body := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
3873 1 (l_body, l_varDecls) := lm_152(l_body, i_nls_eqs, l_varDecls);
3874 1 l_body := Tpl.popIter(l_body);
3875 1 txt := Tpl.writeText(txt, l_tmp);
3876 1 txt := Tpl.softNewLine(txt);
3877 1 txt := Tpl.writeText(txt, l_prebody);
3878 1 txt := Tpl.softNewLine(txt);
3879 1 txt := Tpl.writeText(txt, l_body);
3880 then txt;
3881
3882 case ( txt,
3883 _ )
3884 then txt;
3885 end match;
3886 end fun_153;
3887
3888 public function equationNonlinearXml
3889 input Tpl.Text txt;
3890 input SimCode.SimEqSystem a_eq;
3891 input SimCodeFunction.Context a_context;
3892 input Tpl.Text a_varDecls;
3893
3894 output Tpl.Text out_txt;
3895 output Tpl.Text out_a_varDecls;
3896 algorithm
3897 1 out_txt := fun_153(txt, a_eq);
3898 out_a_varDecls := a_varDecls;
3899 end equationNonlinearXml;
3900
3901 public function functionExtraResidualsPreBody
3902 input Tpl.Text in_txt;
3903 input SimCode.SimEqSystem in_a_eq;
3904 input Tpl.Text in_a_varDecls;
3905 input Tpl.Text in_a_eqs;
3906
3907 output Tpl.Text out_txt;
3908 output Tpl.Text out_a_varDecls;
3909 output Tpl.Text out_a_eqs;
3910 algorithm
3911 (out_txt, out_a_varDecls, out_a_eqs) :=
3912 match(in_txt, in_a_eq, in_a_varDecls, in_a_eqs)
3913 local
3914 Tpl.Text txt;
3915 Tpl.Text a_varDecls;
3916 Tpl.Text a_eqs;
3917 SimCode.SimEqSystem i_eq;
3918
3919 case ( txt,
3920 SimCode.SES_RESIDUAL(index = _),
3921 a_varDecls,
3922 a_eqs )
3923 1 then (txt, a_varDecls, a_eqs);
3924
3925 case ( txt,
3926 i_eq,
3927 a_varDecls,
3928 a_eqs )
3929 algorithm
3930 ✗ (txt, a_varDecls, a_eqs) := equation_Xml(txt, i_eq, SimCodeFunction.contextSimulationDiscrete, a_varDecls, a_eqs);
3931 then (txt, a_varDecls, a_eqs);
3932 end match;
3933 end functionExtraResidualsPreBody;
3934
3935 protected function lm_156
3936 input output Tpl.Text txt;
3937 input list<DAE.ComponentRef> items;
3938 input output Tpl.Text a_helpInits;
3939 algorithm
3940
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 for lstElt_156 in items loop
3941 (txt, a_helpInits) := match lstElt_156
3942 local
3943 DAE.ComponentRef i_e;
3944 Tpl.Text l_helpInit;
3945
3946 case i_e
3947 algorithm
3948 1 l_helpInit := crefToXmlStr(Tpl.emptyTxt, i_e);
3949 1 a_helpInits := Tpl.writeText(a_helpInits, l_helpInit);
3950 1 a_helpInits := Tpl.writeTok(a_helpInits, Tpl.ST_NEW_LINE());
3951 1 txt := Tpl.nextIter(txt);
3952 then (txt, a_helpInits);
3953 end match;
3954 end for;
3955 end lm_156;
3956
3957 protected function fun_157
3958 input Tpl.Text in_txt;
3959 input Boolean in_mArg;
3960 input Tpl.Text in_a_preExp;
3961 input Tpl.Text in_a_helpInits;
3962
3963 output Tpl.Text out_txt;
3964 algorithm
3965 out_txt :=
3966 match(in_txt, in_mArg, in_a_preExp, in_a_helpInits)
3967 local
3968 Tpl.Text txt;
3969 Tpl.Text a_preExp;
3970 Tpl.Text a_helpInits;
3971
3972 case ( txt,
3973 true,
3974 _,
3975 a_helpInits )
3976 algorithm
3977 1 txt := Tpl.writeText(txt, a_helpInits);
3978 then txt;
3979
3980 case ( txt,
3981 _,
3982 a_preExp,
3983 _ )
3984 algorithm
3985 ✗ txt := Tpl.writeText(txt, a_preExp);
3986 then txt;
3987 end match;
3988 end fun_157;
3989
3990 protected function lm_158
3991 input output Tpl.Text txt;
3992 input list<DAE.ComponentRef> items;
3993 input output Tpl.Text a_helpInits;
3994 algorithm
3995 ✗ for lstElt_158 in items loop
3996 (txt, a_helpInits) := match lstElt_158
3997 local
3998 DAE.ComponentRef i_e;
3999 Tpl.Text l_helpInit;
4000
4001 case i_e
4002 algorithm
4003 ✗ l_helpInit := crefToXmlStr(Tpl.emptyTxt, i_e);
4004 ✗ a_helpInits := Tpl.writeText(a_helpInits, l_helpInit);
4005 ✗ a_helpInits := Tpl.writeTok(a_helpInits, Tpl.ST_NEW_LINE());
4006 ✗ txt := Tpl.nextIter(txt);
4007 then (txt, a_helpInits);
4008 end match;
4009 end for;
4010 end lm_158;
4011
4012 protected function fun_159
4013 input Tpl.Text in_txt;
4014 input Boolean in_mArg;
4015 input Tpl.Text in_a_preExp;
4016 input Tpl.Text in_a_helpInits;
4017
4018 output Tpl.Text out_txt;
4019 algorithm
4020 out_txt :=
4021 match(in_txt, in_mArg, in_a_preExp, in_a_helpInits)
4022 local
4023 Tpl.Text txt;
4024 Tpl.Text a_preExp;
4025 Tpl.Text a_helpInits;
4026
4027 case ( txt,
4028 true,
4029 _,
4030 a_helpInits )
4031 algorithm
4032 ✗ txt := Tpl.writeText(txt, a_helpInits);
4033 then txt;
4034
4035 case ( txt,
4036 _,
4037 a_preExp,
4038 _ )
4039 algorithm
4040 ✗ txt := Tpl.writeText(txt, a_preExp);
4041 then txt;
4042 end match;
4043 end fun_159;
4044
4045 public function equationWhenXml
4046 input Tpl.Text in_txt;
4047 input SimCode.SimEqSystem in_a_eq;
4048 input SimCodeFunction.Context in_a_context;
4049 input Tpl.Text in_a_varDecls;
4050
4051 output Tpl.Text out_txt;
4052 output Tpl.Text out_a_varDecls;
4053 algorithm
4054 (out_txt, out_a_varDecls) :=
4055 match(in_txt, in_a_eq, in_a_context, in_a_varDecls)
4056 local
4057 Tpl.Text txt;
4058 SimCodeFunction.Context a_context;
4059 Tpl.Text a_varDecls;
4060 SimCode.SimEqSystem i_elseWhenEq;
4061 list<BackendDAE.WhenOperator> i_whenStmtLst;
4062 list<DAE.ComponentRef> i_conditions;
4063 Boolean ret_7;
4064 Tpl.Text l_elseWhen;
4065 Boolean ret_5;
4066 Tpl.Text l_cond;
4067 Tpl.Text l_body;
4068 Tpl.Text l_helpIf;
4069 Tpl.Text l_helpInits;
4070 Tpl.Text l_preExp;
4071
4072 case ( txt,
4073 SimCode.SES_WHEN(whenStmtLst = i_whenStmtLst, conditions = i_conditions, elseWhen = NONE()),
4074 a_context,
4075 a_varDecls )
4076 algorithm
4077 1 l_preExp := Tpl.emptyTxt;
4078 1 l_helpInits := Tpl.emptyTxt;
4079 1 l_helpIf := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4080 1 (l_helpIf, l_helpInits) := lm_156(l_helpIf, i_conditions, l_helpInits);
4081 1 l_helpIf := Tpl.popIter(l_helpIf);
4082 1 (l_body, a_varDecls) := whenOps(Tpl.emptyTxt, i_whenStmtLst, a_context, a_varDecls);
4083 1 ret_5 := Tpl.isEmpty(l_preExp);
4084 1 l_cond := fun_157(Tpl.emptyTxt, ret_5, l_preExp, l_helpInits);
4085 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4086 "<equ:When>\n",
4087 " <equ:Condition>\n"
4088 }, true));
4089 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4090 1 txt := Tpl.writeText(txt, l_cond);
4091 1 txt := Tpl.softNewLine(txt);
4092 1 txt := Tpl.popBlock(txt);
4093 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4094 " </equ:Condition>\n",
4095 " <equ:Equation>\n"
4096 }, true));
4097 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4098 1 txt := Tpl.writeText(txt, l_body);
4099 1 txt := Tpl.softNewLine(txt);
4100 1 txt := Tpl.popBlock(txt);
4101 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4102 " </equ:Equation>\n",
4103 "</equ:When>"
4104 }, false));
4105 1 then (txt, a_varDecls);
4106
4107 case ( txt,
4108 SimCode.SES_WHEN(whenStmtLst = i_whenStmtLst, conditions = i_conditions, elseWhen = SOME(i_elseWhenEq)),
4109 a_context,
4110 a_varDecls )
4111 algorithm
4112 ✗ l_preExp := Tpl.emptyTxt;
4113 ✗ l_helpInits := Tpl.emptyTxt;
4114 ✗ l_helpIf := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(" || ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4115 ✗ (l_helpIf, l_helpInits) := lm_158(l_helpIf, i_conditions, l_helpInits);
4116 ✗ l_helpIf := Tpl.popIter(l_helpIf);
4117 ✗ (l_body, a_varDecls) := whenOps(Tpl.emptyTxt, i_whenStmtLst, a_context, a_varDecls);
4118 ✗ (l_elseWhen, l_preExp, l_helpInits, a_varDecls) := equationElseWhenXml(Tpl.emptyTxt, i_elseWhenEq, a_context, l_preExp, l_helpInits, a_varDecls);
4119 ✗ ret_7 := Tpl.isEmpty(l_preExp);
4120 ✗ l_cond := fun_159(Tpl.emptyTxt, ret_7, l_preExp, l_helpInits);
4121 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4122 "<equ:When>\n",
4123 " <equ:Condition>\n"
4124 }, true));
4125 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4126 ✗ txt := Tpl.writeText(txt, l_cond);
4127 ✗ txt := Tpl.softNewLine(txt);
4128 ✗ txt := Tpl.popBlock(txt);
4129 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4130 " </equ:Condition>\n",
4131 " <equ:Equation>\n"
4132 }, true));
4133 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4134 ✗ txt := Tpl.writeText(txt, l_body);
4135 ✗ txt := Tpl.softNewLine(txt);
4136 ✗ txt := Tpl.popBlock(txt);
4137 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4138 " </equ:Equation>\n",
4139 "</equ:When>\n"
4140 }, true));
4141 ✗ txt := Tpl.writeText(txt, l_elseWhen);
4142 ✗ then (txt, a_varDecls);
4143
4144 case ( txt,
4145 _,
4146 _,
4147 a_varDecls )
4148 then (txt, a_varDecls);
4149 end match;
4150 end equationWhenXml;
4151
4152 protected function lm_161
4153 input output Tpl.Text txt;
4154 input list<DAE.ComponentRef> items;
4155 input output Tpl.Text a_helpInits;
4156 algorithm
4157 ✗ for lstElt_161 in items loop
4158 (txt, a_helpInits) := match lstElt_161
4159 local
4160 DAE.ComponentRef i_e;
4161 Tpl.Text l_helpInit;
4162
4163 case i_e
4164 algorithm
4165 ✗ l_helpInit := crefToXmlStr(Tpl.emptyTxt, i_e);
4166 ✗ a_helpInits := Tpl.writeText(a_helpInits, l_helpInit);
4167 ✗ a_helpInits := Tpl.writeTok(a_helpInits, Tpl.ST_NEW_LINE());
4168 ✗ txt := Tpl.nextIter(txt);
4169 then (txt, a_helpInits);
4170 end match;
4171 end for;
4172 end lm_161;
4173
4174 protected function fun_162
4175 input Tpl.Text in_txt;
4176 input Boolean in_mArg;
4177 input Tpl.Text in_a_preExp;
4178 input Tpl.Text in_a_helpInits;
4179
4180 output Tpl.Text out_txt;
4181 algorithm
4182 out_txt :=
4183 match(in_txt, in_mArg, in_a_preExp, in_a_helpInits)
4184 local
4185 Tpl.Text txt;
4186 Tpl.Text a_preExp;
4187 Tpl.Text a_helpInits;
4188
4189 case ( txt,
4190 true,
4191 _,
4192 a_helpInits )
4193 algorithm
4194 ✗ txt := Tpl.writeText(txt, a_helpInits);
4195 then txt;
4196
4197 case ( txt,
4198 _,
4199 a_preExp,
4200 _ )
4201 algorithm
4202 ✗ txt := Tpl.writeText(txt, a_preExp);
4203 then txt;
4204 end match;
4205 end fun_162;
4206
4207 protected function lm_163
4208 input output Tpl.Text txt;
4209 input list<DAE.ComponentRef> items;
4210 input output Tpl.Text a_helpInits;
4211 algorithm
4212 ✗ for lstElt_163 in items loop
4213 (txt, a_helpInits) := match lstElt_163
4214 local
4215 DAE.ComponentRef i_e;
4216 Tpl.Text l_helpInit;
4217
4218 case i_e
4219 algorithm
4220 ✗ l_helpInit := crefToXmlStr(Tpl.emptyTxt, i_e);
4221 ✗ a_helpInits := Tpl.writeText(a_helpInits, l_helpInit);
4222 ✗ a_helpInits := Tpl.writeTok(a_helpInits, Tpl.ST_NEW_LINE());
4223 ✗ txt := Tpl.nextIter(txt);
4224 then (txt, a_helpInits);
4225 end match;
4226 end for;
4227 end lm_163;
4228
4229 protected function fun_164
4230 input Tpl.Text in_txt;
4231 input Boolean in_mArg;
4232 input Tpl.Text in_a_preExp;
4233 input Tpl.Text in_a_helpInits;
4234
4235 output Tpl.Text out_txt;
4236 algorithm
4237 out_txt :=
4238 match(in_txt, in_mArg, in_a_preExp, in_a_helpInits)
4239 local
4240 Tpl.Text txt;
4241 Tpl.Text a_preExp;
4242 Tpl.Text a_helpInits;
4243
4244 case ( txt,
4245 true,
4246 _,
4247 a_helpInits )
4248 algorithm
4249 ✗ txt := Tpl.writeText(txt, a_helpInits);
4250 then txt;
4251
4252 case ( txt,
4253 _,
4254 a_preExp,
4255 _ )
4256 algorithm
4257 ✗ txt := Tpl.writeText(txt, a_preExp);
4258 then txt;
4259 end match;
4260 end fun_164;
4261
4262 public function equationElseWhenXml
4263 input Tpl.Text in_txt;
4264 input SimCode.SimEqSystem in_a_eq;
4265 input SimCodeFunction.Context in_a_context;
4266 input Tpl.Text in_a_preExp;
4267 input Tpl.Text in_a_helpInits;
4268 input Tpl.Text in_a_varDecls;
4269
4270 output Tpl.Text out_txt;
4271 output Tpl.Text out_a_preExp;
4272 output Tpl.Text out_a_helpInits;
4273 output Tpl.Text out_a_varDecls;
4274 algorithm
4275 (out_txt, out_a_preExp, out_a_helpInits, out_a_varDecls) :=
4276 match(in_txt, in_a_eq, in_a_context, in_a_preExp, in_a_helpInits, in_a_varDecls)
4277 local
4278 Tpl.Text txt;
4279 SimCodeFunction.Context a_context;
4280 Tpl.Text a_preExp;
4281 Tpl.Text a_helpInits;
4282 Tpl.Text a_varDecls;
4283 SimCode.SimEqSystem i_elseWhenEq;
4284 list<BackendDAE.WhenOperator> i_whenStmtLst;
4285 list<DAE.ComponentRef> i_conditions;
4286 Boolean ret_5;
4287 Tpl.Text l_elseWhen;
4288 Boolean ret_3;
4289 Tpl.Text l_cond;
4290 Tpl.Text l_body;
4291 Tpl.Text l_helpIf;
4292
4293 case ( txt,
4294 SimCode.SES_WHEN(whenStmtLst = i_whenStmtLst, conditions = i_conditions, elseWhen = NONE()),
4295 a_context,
4296 a_preExp,
4297 a_helpInits,
4298 a_varDecls )
4299 algorithm
4300 ✗ l_helpIf := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(" || ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4301 ✗ (l_helpIf, a_helpInits) := lm_161(l_helpIf, i_conditions, a_helpInits);
4302 ✗ l_helpIf := Tpl.popIter(l_helpIf);
4303 ✗ (l_body, a_varDecls) := whenOps(Tpl.emptyTxt, i_whenStmtLst, a_context, a_varDecls);
4304 ✗ ret_3 := Tpl.isEmpty(a_preExp);
4305 ✗ l_cond := fun_162(Tpl.emptyTxt, ret_3, a_preExp, a_helpInits);
4306 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4307 "<equ:ElseWhen>\n",
4308 " <equ:Condition>\n"
4309 }, true));
4310 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4311 ✗ txt := Tpl.writeText(txt, l_cond);
4312 ✗ txt := Tpl.softNewLine(txt);
4313 ✗ txt := Tpl.popBlock(txt);
4314 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4315 " </equ:Condition>\n",
4316 " <equ:Equation>\n"
4317 }, true));
4318 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4319 ✗ txt := Tpl.writeText(txt, l_body);
4320 ✗ txt := Tpl.softNewLine(txt);
4321 ✗ txt := Tpl.popBlock(txt);
4322 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4323 " </equ:Equation>\n",
4324 "</equ:ElseWhen>"
4325 }, false));
4326 ✗ then (txt, a_preExp, a_helpInits, a_varDecls);
4327
4328 case ( txt,
4329 SimCode.SES_WHEN(whenStmtLst = i_whenStmtLst, conditions = i_conditions, elseWhen = SOME(i_elseWhenEq)),
4330 a_context,
4331 a_preExp,
4332 a_helpInits,
4333 a_varDecls )
4334 algorithm
4335 ✗ l_helpIf := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(" || ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4336 ✗ (l_helpIf, a_helpInits) := lm_163(l_helpIf, i_conditions, a_helpInits);
4337 ✗ l_helpIf := Tpl.popIter(l_helpIf);
4338 ✗ (l_body, a_varDecls) := whenOps(Tpl.emptyTxt, i_whenStmtLst, a_context, a_varDecls);
4339 ✗ (l_elseWhen, a_preExp, a_helpInits, a_varDecls) := equationElseWhenXml(Tpl.emptyTxt, i_elseWhenEq, a_context, a_preExp, a_helpInits, a_varDecls);
4340 ✗ ret_5 := Tpl.isEmpty(a_preExp);
4341 ✗ l_cond := fun_164(Tpl.emptyTxt, ret_5, a_preExp, a_helpInits);
4342 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4343 "<equ:ElseWhen>\n",
4344 " <equ:Condition>\n"
4345 }, true));
4346 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4347 ✗ txt := Tpl.writeText(txt, l_cond);
4348 ✗ txt := Tpl.softNewLine(txt);
4349 ✗ txt := Tpl.popBlock(txt);
4350 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4351 " </equ:Condition>\n",
4352 " <equ:Equation>\n"
4353 }, true));
4354 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4355 ✗ txt := Tpl.writeText(txt, l_body);
4356 ✗ txt := Tpl.softNewLine(txt);
4357 ✗ txt := Tpl.popBlock(txt);
4358 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4359 " </equ:Equation>\n",
4360 "</equ:ElseWhen>\n"
4361 }, true));
4362 ✗ txt := Tpl.writeText(txt, l_elseWhen);
4363 ✗ then (txt, a_preExp, a_helpInits, a_varDecls);
4364
4365 case ( txt,
4366 _,
4367 _,
4368 a_preExp,
4369 a_helpInits,
4370 a_varDecls )
4371 then (txt, a_preExp, a_helpInits, a_varDecls);
4372 end match;
4373 end equationElseWhenXml;
4374
4375 protected function fun_166
4376 input Tpl.Text in_txt;
4377 input BackendDAE.WhenOperator in_a_whenOp;
4378 input Tpl.Text in_a_varDecls;
4379 input SimCodeFunction.Context in_a_context;
4380
4381 output Tpl.Text out_txt;
4382 output Tpl.Text out_a_varDecls;
4383 algorithm
4384 (out_txt, out_a_varDecls) :=
4385 match(in_txt, in_a_whenOp, in_a_varDecls, in_a_context)
4386 local
4387 Tpl.Text txt;
4388 Tpl.Text a_varDecls;
4389 SimCodeFunction.Context a_context;
4390 SourceInfo i_info;
4391 DAE.Exp i_condition;
4392 DAE.Exp i_message;
4393 DAE.ComponentRef i_stateVar;
4394 DAE.Exp i_value;
4395 DAE.ComponentRef i_cr;
4396 DAE.Exp i_right;
4397 Tpl.Text l_msgVar;
4398 Tpl.Text l_val;
4399 Tpl.Text l_exp;
4400 Tpl.Text l_preExp;
4401
4402 case ( txt,
4403 BackendDAE.ASSIGN(left = DAE.CREF(componentRef = i_cr), right = i_right),
4404 a_varDecls,
4405 a_context )
4406 algorithm
4407 ✗ l_preExp := Tpl.emptyTxt;
4408 ✗ (l_exp, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_right, a_context, l_preExp, a_varDecls);
4409 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" <exp:Sub>\n"));
4410 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4411 ✗ txt := crefXml(txt, i_cr);
4412 ✗ txt := Tpl.softNewLine(txt);
4413 ✗ txt := Tpl.writeText(txt, l_exp);
4414 ✗ txt := Tpl.softNewLine(txt);
4415 ✗ txt := Tpl.popBlock(txt);
4416 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" </exp:Sub>"));
4417 ✗ then (txt, a_varDecls);
4418
4419 case ( txt,
4420 BackendDAE.REINIT(value = i_value, stateVar = i_stateVar),
4421 a_varDecls,
4422 _ )
4423 algorithm
4424 1 l_preExp := Tpl.emptyTxt;
4425 1 (l_val, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_value, SimCodeFunction.contextSimulationDiscrete, l_preExp, a_varDecls);
4426 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Reinit>\n"));
4427 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4428 1 txt := crefXml(txt, i_stateVar);
4429 1 txt := Tpl.softNewLine(txt);
4430 1 txt := Tpl.writeText(txt, l_val);
4431 1 txt := Tpl.softNewLine(txt);
4432 1 txt := Tpl.popBlock(txt);
4433 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Reinit>"));
4434 1 then (txt, a_varDecls);
4435
4436 case ( txt,
4437 BackendDAE.TERMINATE(message = i_message),
4438 a_varDecls,
4439 _ )
4440 algorithm
4441 ✗ l_preExp := Tpl.emptyTxt;
4442 ✗ (l_msgVar, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_message, SimCodeFunction.contextSimulationDiscrete, l_preExp, a_varDecls);
4443 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
4444 ✗ txt := Tpl.writeText(txt, l_preExp);
4445 ✗ txt := Tpl.softNewLine(txt);
4446 ✗ txt := Tpl.writeText(txt, l_msgVar);
4447 ✗ txt := Tpl.popBlock(txt);
4448 ✗ then (txt, a_varDecls);
4449
4450 case ( txt,
4451 BackendDAE.ASSERT(source = DAE.SOURCE(info = i_info), condition = i_condition, message = i_message),
4452 a_varDecls,
4453 _ )
4454 algorithm
4455 ✗ (txt, a_varDecls) := assertCommonXml(txt, i_condition, i_message, SimCodeFunction.contextSimulationDiscrete, a_varDecls, i_info);
4456 then (txt, a_varDecls);
4457
4458 case ( txt,
4459 _,
4460 a_varDecls,
4461 _ )
4462 ✗ then (txt, a_varDecls);
4463 end match;
4464 end fun_166;
4465
4466 protected function lm_167
4467 input output Tpl.Text txt;
4468 input list<BackendDAE.WhenOperator> items;
4469 input output Tpl.Text a_varDecls;
4470 input SimCodeFunction.Context a_context;
4471 algorithm
4472
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 for lstElt_167 in items loop
4473 (txt, a_varDecls) := match lstElt_167
4474 local
4475 BackendDAE.WhenOperator i_whenOp;
4476
4477 case i_whenOp
4478 algorithm
4479 1 (txt, a_varDecls) := fun_166(txt, i_whenOp, a_varDecls, a_context);
4480 1 txt := Tpl.nextIter(txt);
4481 then (txt, a_varDecls);
4482 end match;
4483 end for;
4484 end lm_167;
4485
4486 public function whenOps
4487 input Tpl.Text txt;
4488 input list<BackendDAE.WhenOperator> a_whenOps;
4489 input SimCodeFunction.Context a_context;
4490 input Tpl.Text a_varDecls;
4491
4492 output Tpl.Text out_txt;
4493 output Tpl.Text out_a_varDecls;
4494 protected
4495 Tpl.Text l_body;
4496 algorithm
4497 1 l_body := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4498 1 (l_body, out_a_varDecls) := lm_167(l_body, a_whenOps, a_varDecls, a_context);
4499 1 l_body := Tpl.popIter(l_body);
4500 1 out_txt := Tpl.writeText(txt, l_body);
4501 end whenOps;
4502
4503 protected function lm_169
4504 input output Tpl.Text txt;
4505 input list<SimCodeFunction.RecordDeclaration> items;
4506 algorithm
4507
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_169 in items loop
4508 txt := match lstElt_169
4509 local
4510 SimCodeFunction.RecordDeclaration i_rd;
4511
4512 case i_rd
4513 algorithm
4514 ✗ txt := recordDeclarationXml(txt, i_rd);
4515 ✗ txt := Tpl.nextIter(txt);
4516 then txt;
4517 end match;
4518 end for;
4519 end lm_169;
4520
4521 public function recordsXml
4522 input Tpl.Text txt;
4523 input list<SimCodeFunction.RecordDeclaration> a_recordDecls;
4524
4525 output Tpl.Text out_txt;
4526 algorithm
4527 4 out_txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:RecordsList>\n"));
4528 4 out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(2));
4529 4 out_txt := Tpl.pushIter(out_txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4530 4 out_txt := lm_169(out_txt, a_recordDecls);
4531 4 out_txt := Tpl.popIter(out_txt);
4532 4 out_txt := Tpl.softNewLine(out_txt);
4533 4 out_txt := Tpl.popBlock(out_txt);
4534 4 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("</fun:RecordsList>"));
4535 end recordsXml;
4536
4537 protected function lm_171
4538 input output Tpl.Text txt;
4539 input list<SimCodeFunction.Variable> items;
4540 algorithm
4541 ✗ for lstElt_171 in items loop
4542 txt := match lstElt_171
4543 local
4544 SimCodeFunction.Variable i_var;
4545
4546 case i_var
4547 algorithm
4548 ✗ txt := recordBodyXml(txt, i_var);
4549 ✗ txt := Tpl.nextIter(txt);
4550 then txt;
4551 end match;
4552 end for;
4553 end lm_171;
4554
4555 public function recordDeclarationXml
4556 input Tpl.Text in_txt;
4557 input SimCodeFunction.RecordDeclaration in_a_recDecl;
4558
4559 output Tpl.Text out_txt;
4560 algorithm
4561 out_txt :=
4562 match(in_txt, in_a_recDecl)
4563 local
4564 Tpl.Text txt;
4565 list<SimCodeFunction.Variable> i_variables;
4566 String i_name;
4567
4568 case ( txt,
4569 SimCodeFunction.RECORD_DECL_FULL(name = i_name, variables = i_variables) )
4570 algorithm
4571 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4572 "<fun:Record>\n",
4573 " <fun:Name>\n"
4574 }, true));
4575 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4576 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name =\'"));
4577 ✗ txt := Tpl.writeStr(txt, i_name);
4578 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\'/>\n"));
4579 ✗ txt := Tpl.popBlock(txt);
4580 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:Name>\n"));
4581 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4582 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4583 ✗ txt := lm_171(txt, i_variables);
4584 ✗ txt := Tpl.popIter(txt);
4585 ✗ txt := Tpl.softNewLine(txt);
4586 ✗ txt := Tpl.popBlock(txt);
4587 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Record>"));
4588 then txt;
4589
4590 case ( txt,
4591 SimCodeFunction.RECORD_DECL_DEF(path = _) )
4592 algorithm
4593 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" Record Declaration definition is not yet implemented"));
4594 then txt;
4595
4596 case ( txt,
4597 _ )
4598 then txt;
4599 end match;
4600 end recordDeclarationXml;
4601
4602 public function recordBodyXml
4603 input Tpl.Text in_txt;
4604 input SimCodeFunction.Variable in_a_var;
4605
4606 output Tpl.Text out_txt;
4607 algorithm
4608 out_txt :=
4609 match(in_txt, in_a_var)
4610 local
4611 Tpl.Text txt;
4612 String i_name_1;
4613 DAE.ComponentRef i_var_name;
4614 SimCodeFunction.Variable i_var;
4615 DAE.ComponentRef i_name;
4616
4617 case ( txt,
4618 (i_var as SimCodeFunction.VARIABLE(ty = DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = _)), name = i_name)) )
4619 algorithm
4620 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4621 "<fun:Field type=\"Record\">\n",
4622 " <fun:Name>\n"
4623 }, true));
4624 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4625 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
4626 ✗ txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
4627 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
4628 ✗ txt := Tpl.popBlock(txt);
4629 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4630 " </fun:Name>\n",
4631 " <fun:Record>\n"
4632 }, true));
4633 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4634 ✗ txt := varTypeXml(txt, i_var);
4635 ✗ txt := Tpl.softNewLine(txt);
4636 ✗ txt := Tpl.popBlock(txt);
4637 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4638 " </fun:Record>\n",
4639 "</fun:Field>"
4640 }, false));
4641 then txt;
4642
4643 case ( txt,
4644 (i_var as SimCodeFunction.VARIABLE(name = i_var_name)) )
4645 algorithm
4646 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:Field type=\""));
4647 ✗ txt := varTypeXml(txt, i_var);
4648 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4649 "\">\n",
4650 " <fun:Name>\n"
4651 }, true));
4652 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4653 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
4654 ✗ txt := crefStrXml(txt, i_var_name);
4655 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
4656 ✗ txt := Tpl.popBlock(txt);
4657 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4658 " </fun:Name>\n",
4659 "</fun:Field>"
4660 }, false));
4661 then txt;
4662
4663 case ( txt,
4664 SimCodeFunction.FUNCTION_PTR(name = i_name_1) )
4665 algorithm
4666 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_fnptr "));
4667 ✗ txt := Tpl.writeStr(txt, i_name_1);
4668 then txt;
4669
4670 case ( txt,
4671 _ )
4672 then txt;
4673 end match;
4674 end recordBodyXml;
4675
4676 protected function lm_174
4677 input output Tpl.Text txt;
4678 input list<SimCodeFunction.Function> items;
4679 algorithm
4680
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
5 for lstElt_174 in items loop
4681 txt := match lstElt_174
4682 local
4683 SimCodeFunction.Function i_fn;
4684
4685 case i_fn
4686 algorithm
4687 1 txt := functionXml(txt, i_fn);
4688 1 txt := Tpl.nextIter(txt);
4689 then txt;
4690 end match;
4691 end for;
4692 end lm_174;
4693
4694 public function functionsXml
4695 input Tpl.Text txt;
4696 input list<SimCodeFunction.Function> a_functions;
4697
4698 output Tpl.Text out_txt;
4699 algorithm
4700 4 out_txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:FunctionsList>\n"));
4701 4 out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(2));
4702 4 out_txt := Tpl.pushIter(out_txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4703 4 out_txt := lm_174(out_txt, a_functions);
4704 4 out_txt := Tpl.popIter(out_txt);
4705 4 out_txt := Tpl.softNewLine(out_txt);
4706 4 out_txt := Tpl.popBlock(out_txt);
4707 4 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("</fun:FunctionsList>"));
4708 end functionsXml;
4709
4710 public function functionXml
4711 input Tpl.Text in_txt;
4712 input SimCodeFunction.Function in_a_fn;
4713
4714 output Tpl.Text out_txt;
4715 algorithm
4716 out_txt :=
4717 match(in_txt, in_a_fn)
4718 local
4719 Tpl.Text txt;
4720 SimCodeFunction.Function i_fn;
4721
4722 case ( txt,
4723 (i_fn as SimCodeFunction.FUNCTION(name = _)) )
4724 algorithm
4725 ✗ txt := regularFunctionXml(txt, i_fn);
4726 then txt;
4727
4728 case ( txt,
4729 (i_fn as SimCodeFunction.EXTERNAL_FUNCTION(name = _)) )
4730 algorithm
4731 1 txt := externalFunctionXml(txt, i_fn);
4732 then txt;
4733
4734 case ( txt,
4735 SimCodeFunction.RECORD_CONSTRUCTOR(name = _) )
4736 then txt;
4737
4738 case ( txt,
4739 _ )
4740 then txt;
4741 end match;
4742 end functionXml;
4743
4744 protected function lm_177
4745 input output Tpl.Text txt;
4746 input list<SimCodeFunction.Variable> items;
4747 algorithm
4748 ✗ for lstElt_177 in items loop
4749 txt := match lstElt_177
4750 local
4751 SimCodeFunction.Variable i_var;
4752
4753 case i_var
4754 algorithm
4755 ✗ txt := funOutputVariableXml(txt, i_var);
4756 ✗ txt := Tpl.nextIter(txt);
4757 then txt;
4758 end match;
4759 end for;
4760 end lm_177;
4761
4762 protected function lm_178
4763 input output Tpl.Text txt;
4764 input list<SimCodeFunction.Variable> items;
4765 algorithm
4766 ✗ for lstElt_178 in items loop
4767 txt := match lstElt_178
4768 local
4769 SimCodeFunction.Variable i_var;
4770
4771 case i_var
4772 algorithm
4773 ✗ txt := funArgDefinitionXml(txt, i_var);
4774 ✗ txt := Tpl.nextIter(txt);
4775 then txt;
4776 end match;
4777 end for;
4778 end lm_178;
4779
4780 public function regularFunctionXml
4781 input Tpl.Text in_txt;
4782 input SimCodeFunction.Function in_a_fn;
4783
4784 output Tpl.Text out_txt;
4785 algorithm
4786 out_txt :=
4787 match(in_txt, in_a_fn)
4788 local
4789 Tpl.Text txt;
4790 list<SimCodeFunction.Variable> i_functionArguments;
4791 list<SimCodeFunction.Variable> i_outVars;
4792 list<DAE.Statement> i_body;
4793 Absyn.Path i_name;
4794 Tpl.Text l_bodyPart;
4795 Tpl.Text l_varInits;
4796 Tpl.Text l_varDecls;
4797 Tpl.Text l_fname;
4798
4799 case ( txt,
4800 SimCodeFunction.FUNCTION(name = i_name, body = i_body, outVars = i_outVars, functionArguments = i_functionArguments) )
4801 algorithm
4802 ✗ System.tmpTickReset(1);
4803 ✗ l_fname := underscorePathXml(Tpl.emptyTxt, i_name);
4804 ✗ l_varDecls := Tpl.emptyTxt;
4805 l_varInits := Tpl.emptyTxt;
4806 ✗ (l_bodyPart, l_varDecls) := funStatementXml(Tpl.emptyTxt, i_body, l_varDecls);
4807 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4808 "<fun:Function>\n",
4809 " <fun:Name>\n"
4810 }, true));
4811 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4812 ✗ txt := Tpl.writeText(txt, l_fname);
4813 ✗ txt := Tpl.softNewLine(txt);
4814 ✗ txt := Tpl.popBlock(txt);
4815 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:Name>\n"));
4816 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4817 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4818 ✗ txt := lm_177(txt, i_outVars);
4819 ✗ txt := Tpl.popIter(txt);
4820 ✗ txt := Tpl.softNewLine(txt);
4821 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4822 ✗ txt := lm_178(txt, i_functionArguments);
4823 ✗ txt := Tpl.popIter(txt);
4824 ✗ txt := Tpl.softNewLine(txt);
4825 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Algorithm>\n"));
4826 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4827 ✗ txt := Tpl.writeText(txt, l_bodyPart);
4828 ✗ txt := Tpl.softNewLine(txt);
4829 ✗ txt := Tpl.popBlock(txt);
4830 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Algorithm>\n"));
4831 ✗ txt := Tpl.popBlock(txt);
4832 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Function>"));
4833 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
4834 then txt;
4835
4836 case ( txt,
4837 _ )
4838 then txt;
4839 end match;
4840 end regularFunctionXml;
4841
4842 protected function lm_180
4843 input output Tpl.Text txt;
4844 input list<SimCodeFunction.Variable> items;
4845 algorithm
4846
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 1 time.
2 for lstElt_180 in items loop
4847 txt := match lstElt_180
4848 local
4849 SimCodeFunction.Variable i_var;
4850
4851 case i_var
4852 algorithm
4853 1 txt := funOutputVariableXml(txt, i_var);
4854 1 txt := Tpl.nextIter(txt);
4855 then txt;
4856 end match;
4857 end for;
4858 end lm_180;
4859
4860 protected function lm_181
4861 input output Tpl.Text txt;
4862 input list<SimCodeFunction.Variable> items;
4863 algorithm
4864
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
4 for lstElt_181 in items loop
4865 txt := match lstElt_181
4866 local
4867 SimCodeFunction.Variable i_var;
4868
4869 case i_var
4870 algorithm
4871 3 txt := funArgDefinitionXml(txt, i_var);
4872 3 txt := Tpl.nextIter(txt);
4873 then txt;
4874 end match;
4875 end for;
4876 end lm_181;
4877
4878 public function externalFunctionXml
4879 input Tpl.Text in_txt;
4880 input SimCodeFunction.Function in_a_fn;
4881
4882 output Tpl.Text out_txt;
4883 algorithm
4884 out_txt :=
4885 match(in_txt, in_a_fn)
4886 local
4887 Tpl.Text txt;
4888 list<SimCodeFunction.Variable> i_funArgs;
4889 list<SimCodeFunction.Variable> i_outVars;
4890 SimCodeFunction.Function i_efn;
4891 Absyn.Path i_name;
4892 Tpl.Text l_callPart;
4893 Tpl.Text l_fname;
4894 Tpl.Text l_varDecls;
4895 Tpl.Text l_preExp;
4896
4897 case ( txt,
4898 (i_efn as SimCodeFunction.EXTERNAL_FUNCTION(name = i_name, outVars = i_outVars, funArgs = i_funArgs)) )
4899 algorithm
4900 1 System.tmpTickReset(1);
4901 1 l_preExp := Tpl.emptyTxt;
4902 1 l_varDecls := Tpl.emptyTxt;
4903 1 l_fname := underscorePathXml(Tpl.emptyTxt, i_name);
4904 1 (l_callPart, l_preExp, l_varDecls) := extFunCallXml(Tpl.emptyTxt, i_efn, l_preExp, l_varDecls);
4905 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4906 "<fun:Function>\n",
4907 " <fun:Name>\n"
4908 }, true));
4909 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4910 1 txt := Tpl.writeText(txt, l_fname);
4911 1 txt := Tpl.softNewLine(txt);
4912 1 txt := Tpl.popBlock(txt);
4913 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:Name>\n"));
4914 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4915 1 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4916 1 txt := lm_180(txt, i_outVars);
4917 1 txt := Tpl.popIter(txt);
4918 1 txt := Tpl.softNewLine(txt);
4919 1 txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
4920 1 txt := lm_181(txt, i_funArgs);
4921 1 txt := Tpl.popIter(txt);
4922 1 txt := Tpl.softNewLine(txt);
4923 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Algorithm>\n"));
4924 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
4925 1 txt := Tpl.writeText(txt, l_callPart);
4926 1 txt := Tpl.softNewLine(txt);
4927 1 txt := Tpl.popBlock(txt);
4928 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Algorithm>\n"));
4929 1 txt := Tpl.popBlock(txt);
4930 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Function>"));
4931 1 txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
4932 then txt;
4933
4934 case ( txt,
4935 _ )
4936 then txt;
4937 end match;
4938 end externalFunctionXml;
4939
4940 public function funArgNameXml
4941 input Tpl.Text in_txt;
4942 input SimCodeFunction.Variable in_a_var;
4943
4944 output Tpl.Text out_txt;
4945 algorithm
4946 out_txt :=
4947 match(in_txt, in_a_var)
4948 local
4949 Tpl.Text txt;
4950 String i_name_1;
4951 DAE.ComponentRef i_name;
4952
4953 case ( txt,
4954 SimCodeFunction.VARIABLE(name = i_name) )
4955 algorithm
4956 ✗ txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
4957 then txt;
4958
4959 case ( txt,
4960 SimCodeFunction.FUNCTION_PTR(name = i_name_1) )
4961 algorithm
4962 ✗ txt := Tpl.writeStr(txt, i_name_1);
4963 then txt;
4964
4965 case ( txt,
4966 _ )
4967 then txt;
4968 end match;
4969 end funArgNameXml;
4970
4971 public function funOutputVariableXml
4972 input Tpl.Text in_txt;
4973 input SimCodeFunction.Variable in_a_var;
4974
4975 output Tpl.Text out_txt;
4976 algorithm
4977 out_txt :=
4978 match(in_txt, in_a_var)
4979 local
4980 Tpl.Text txt;
4981 String i_name_1;
4982 SimCodeFunction.Variable i_var;
4983 DAE.ComponentRef i_name;
4984
4985 case ( txt,
4986 (i_var as SimCodeFunction.VARIABLE(ty = DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = _)), name = i_name)) )
4987 algorithm
4988 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4989 "<fun:OutputVariable type=\"Record\">\n",
4990 " <fun:Name>\n"
4991 }, true));
4992 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
4993 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
4994 ✗ txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
4995 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
4996 ✗ txt := Tpl.popBlock(txt);
4997 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
4998 " </fun:Name>\n",
4999 " <fun:Record>\n"
5000 }, true));
5001 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5002 ✗ txt := varTypeXml(txt, i_var);
5003 ✗ txt := Tpl.softNewLine(txt);
5004 ✗ txt := Tpl.popBlock(txt);
5005 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5006 " </fun:Record>\n",
5007 "</fun:OutputVariable>"
5008 }, false));
5009 then txt;
5010
5011 case ( txt,
5012 (i_var as SimCodeFunction.VARIABLE(name = i_name)) )
5013 algorithm
5014 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:OutputVariable type=\""));
5015 1 txt := varTypeXml(txt, i_var);
5016 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5017 "\">\n",
5018 " <fun:Name>\n"
5019 }, true));
5020 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5021 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
5022 1 txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
5023 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
5024 1 txt := Tpl.popBlock(txt);
5025 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5026 " </fun:Name>\n",
5027 "</fun:OutputVariable>"
5028 }, false));
5029 then txt;
5030
5031 case ( txt,
5032 SimCodeFunction.FUNCTION_PTR(name = i_name_1) )
5033 algorithm
5034 ✗ txt := Tpl.writeStr(txt, i_name_1);
5035 then txt;
5036
5037 case ( txt,
5038 _ )
5039 then txt;
5040 end match;
5041 end funOutputVariableXml;
5042
5043 public function funArgDefinitionXml
5044 input Tpl.Text in_txt;
5045 input SimCodeFunction.Variable in_a_var;
5046
5047 output Tpl.Text out_txt;
5048 algorithm
5049 out_txt :=
5050 match(in_txt, in_a_var)
5051 local
5052 Tpl.Text txt;
5053 String i_name_1;
5054 SimCodeFunction.Variable i_var;
5055 DAE.ComponentRef i_name;
5056
5057 case ( txt,
5058 (i_var as SimCodeFunction.VARIABLE(ty = DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = _)), name = i_name)) )
5059 algorithm
5060 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5061 "<fun:InputVariable type=\"Record\">\n",
5062 " <fun:Name>\n"
5063 }, true));
5064 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5065 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
5066 ✗ txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
5067 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
5068 ✗ txt := Tpl.popBlock(txt);
5069 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5070 " </fun:Name>\n",
5071 " <fun:Record>\n"
5072 }, true));
5073 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5074 ✗ txt := varTypeXml(txt, i_var);
5075 ✗ txt := Tpl.softNewLine(txt);
5076 ✗ txt := Tpl.popBlock(txt);
5077 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5078 " </fun:Record>\n",
5079 "</fun:InputVariable>"
5080 }, false));
5081 then txt;
5082
5083 case ( txt,
5084 (i_var as SimCodeFunction.VARIABLE(name = i_name)) )
5085 algorithm
5086 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:InputVariable type=\""));
5087 3 txt := varTypeXml(txt, i_var);
5088 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5089 "\">\n",
5090 " <fun:Name>\n"
5091 }, true));
5092 3 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5093 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
5094 3 txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
5095 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
5096 3 txt := Tpl.popBlock(txt);
5097 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5098 " </fun:Name>\n",
5099 "</fun:InputVariable>"
5100 }, false));
5101 then txt;
5102
5103 case ( txt,
5104 SimCodeFunction.FUNCTION_PTR(name = i_name_1) )
5105 algorithm
5106 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_fnptr "));
5107 ✗ txt := Tpl.writeStr(txt, i_name_1);
5108 then txt;
5109
5110 case ( txt,
5111 _ )
5112 then txt;
5113 end match;
5114 end funArgDefinitionXml;
5115
5116 public function funVarDeclarationsXml
5117 input Tpl.Text in_txt;
5118 input SimCodeFunction.Variable in_a_var;
5119
5120 output Tpl.Text out_txt;
5121 algorithm
5122 out_txt :=
5123 match(in_txt, in_a_var)
5124 local
5125 Tpl.Text txt;
5126 String i_name_1;
5127 DAE.ComponentRef i_name;
5128 SimCodeFunction.Variable i_var;
5129
5130 case ( txt,
5131 (i_var as SimCodeFunction.VARIABLE(name = i_name)) )
5132 algorithm
5133 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:protectedVariable type=\""));
5134 ✗ txt := varTypeXml(txt, i_var);
5135 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5136 "\">\n",
5137 " <fun:Name>\n"
5138 }, true));
5139 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
5140 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
5141 ✗ txt := contextCrefXml(txt, i_name, SimCodeFunction.contextFunction);
5142 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
5143 ✗ txt := Tpl.popBlock(txt);
5144 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5145 " </fun:Name>\n",
5146 "</fun:ProtectedVariable>"
5147 }, false));
5148 then txt;
5149
5150 case ( txt,
5151 SimCodeFunction.FUNCTION_PTR(name = i_name_1) )
5152 algorithm
5153 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_fnptr "));
5154 ✗ txt := Tpl.writeStr(txt, i_name_1);
5155 then txt;
5156
5157 case ( txt,
5158 _ )
5159 then txt;
5160 end match;
5161 end funVarDeclarationsXml;
5162
5163 protected function fun_187
5164 input Tpl.Text in_txt;
5165 input String in_a_language;
5166 input String in_a_name;
5167
5168 output Tpl.Text out_txt;
5169 algorithm
5170 out_txt :=
5171 match(in_txt, in_a_language, in_a_name)
5172 local
5173 Tpl.Text txt;
5174 String a_name;
5175 String i_language;
5176 Tpl.Text txt_0;
5177
5178 case ( txt,
5179 "C",
5180 a_name )
5181 algorithm
5182 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedName name=\""));
5183 ✗ txt := Tpl.writeStr(txt, a_name);
5184 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
5185 then txt;
5186
5187 case ( txt,
5188 "FORTRAN 77",
5189 a_name )
5190 algorithm
5191 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedName name=\""));
5192 ✗ txt := Tpl.writeStr(txt, a_name);
5193 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\"/>"));
5194 then txt;
5195
5196 case ( txt,
5197 i_language,
5198 _ )
5199 algorithm
5200 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Unsupport external language: "));
5201 ✗ txt_0 := Tpl.writeStr(txt_0, i_language);
5202 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1250, 14), Tpl.textString(txt_0));
5203 then txt;
5204 end match;
5205 end fun_187;
5206
5207 public function extFunctionNameXml
5208 input Tpl.Text txt;
5209 input String a_name;
5210 input String a_language;
5211
5212 output Tpl.Text out_txt;
5213 algorithm
5214 ✗ out_txt := fun_187(txt, a_language, a_name);
5215 end extFunctionNameXml;
5216
5217 protected function fun_189
5218 input Tpl.Text in_txt;
5219 input DAE.Type in_a_type;
5220 input Boolean in_a_isInput;
5221
5222 output Tpl.Text out_txt;
5223 algorithm
5224 out_txt :=
5225 match(in_txt, in_a_type, in_a_isInput)
5226 local
5227 Tpl.Text txt;
5228 Boolean a_isInput;
5229 DAE.Type i_type;
5230 Absyn.Path i_rname;
5231 DAE.Type i_ty;
5232 Tpl.Text txt_0;
5233 String ret_0;
5234
5235 case ( txt,
5236 DAE.T_INTEGER(varLst = _),
5237 _ )
5238 algorithm
5239 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
5240 then txt;
5241
5242 case ( txt,
5243 DAE.T_REAL(varLst = _),
5244 _ )
5245 algorithm
5246 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("double"));
5247 then txt;
5248
5249 case ( txt,
5250 DAE.T_STRING(varLst = _),
5251 _ )
5252 algorithm
5253 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("const char*"));
5254 then txt;
5255
5256 case ( txt,
5257 DAE.T_BOOL(varLst = _),
5258 _ )
5259 algorithm
5260 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
5261 then txt;
5262
5263 case ( txt,
5264 DAE.T_ENUMERATION(index = _),
5265 _ )
5266 algorithm
5267 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
5268 then txt;
5269
5270 case ( txt,
5271 DAE.T_ARRAY(ty = i_ty),
5272 a_isInput )
5273 algorithm
5274 ✗ txt := extTypeXml(txt, i_ty, a_isInput, true);
5275 then txt;
5276
5277 case ( txt,
5278 DAE.T_COMPLEX(complexClassType = ClassInf.EXTERNAL_OBJ(path = _)),
5279 _ )
5280 algorithm
5281 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("void *"));
5282 then txt;
5283
5284 case ( txt,
5285 DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = i_rname)),
5286 _ )
5287 algorithm
5288 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("struct "));
5289 ✗ txt := underscorePathXml(txt, i_rname);
5290 then txt;
5291
5292 case ( txt,
5293 DAE.T_METATYPE(ty = _),
5294 _ )
5295 algorithm
5296 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
5297 then txt;
5298
5299 case ( txt,
5300 DAE.T_METABOXED(ty = _),
5301 _ )
5302 algorithm
5303 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
5304 then txt;
5305
5306 case ( txt,
5307 i_type,
5308 _ )
5309 algorithm
5310 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Unknown external C type "));
5311 ✗ ret_0 := TypesDump.unparseType(i_type);
5312 ✗ txt_0 := Tpl.writeStr(txt_0, ret_0);
5313 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1268, 14), Tpl.textString(txt_0));
5314 then txt;
5315 end match;
5316 end fun_189;
5317
5318 protected function fun_190
5319 input Tpl.Text in_txt;
5320 input String in_mArg;
5321
5322 output Tpl.Text out_txt;
5323 algorithm
5324 out_txt :=
5325 match(in_txt, in_mArg)
5326 local
5327 Tpl.Text txt;
5328
5329 case ( txt,
5330 "const char*" )
5331 then txt;
5332
5333 case ( txt,
5334 _ )
5335 algorithm
5336 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("const "));
5337 then txt;
5338 end match;
5339 end fun_190;
5340
5341 protected function fun_191
5342 input Tpl.Text in_txt;
5343 input Boolean in_a_isArray;
5344 input Tpl.Text in_a_s;
5345
5346 output Tpl.Text out_txt;
5347 algorithm
5348 out_txt :=
5349 match(in_txt, in_a_isArray, in_a_s)
5350 local
5351 Tpl.Text txt;
5352 Tpl.Text a_s;
5353 String str_0;
5354
5355 case ( txt,
5356 false,
5357 a_s )
5358 algorithm
5359 ✗ txt := Tpl.writeText(txt, a_s);
5360 then txt;
5361
5362 case ( txt,
5363 _,
5364 a_s )
5365 algorithm
5366 ✗ str_0 := Tpl.textString(a_s);
5367 ✗ txt := fun_190(txt, str_0);
5368 ✗ txt := Tpl.writeText(txt, a_s);
5369 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*"));
5370 then txt;
5371 end match;
5372 end fun_191;
5373
5374 protected function fun_192
5375 input Tpl.Text in_txt;
5376 input Boolean in_a_isInput;
5377 input Boolean in_a_isArray;
5378 input Tpl.Text in_a_s;
5379
5380 output Tpl.Text out_txt;
5381 algorithm
5382 out_txt :=
5383 match(in_txt, in_a_isInput, in_a_isArray, in_a_s)
5384 local
5385 Tpl.Text txt;
5386 Boolean a_isArray;
5387 Tpl.Text a_s;
5388
5389 case ( txt,
5390 false,
5391 _,
5392 a_s )
5393 algorithm
5394 ✗ txt := Tpl.writeText(txt, a_s);
5395 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*"));
5396 then txt;
5397
5398 case ( txt,
5399 _,
5400 a_isArray,
5401 a_s )
5402 algorithm
5403 ✗ txt := fun_191(txt, a_isArray, a_s);
5404 then txt;
5405 end match;
5406 end fun_192;
5407
5408 protected function fun_193
5409 input Tpl.Text in_txt;
5410 input DAE.Type in_a_type;
5411 input Boolean in_a_isArray;
5412 input Boolean in_a_isInput;
5413 input Tpl.Text in_a_s;
5414
5415 output Tpl.Text out_txt;
5416 algorithm
5417 out_txt :=
5418 match(in_txt, in_a_type, in_a_isArray, in_a_isInput, in_a_s)
5419 local
5420 Tpl.Text txt;
5421 Boolean a_isArray;
5422 Boolean a_isInput;
5423 Tpl.Text a_s;
5424
5425 case ( txt,
5426 DAE.T_ARRAY(ty = _),
5427 _,
5428 _,
5429 a_s )
5430 algorithm
5431 ✗ txt := Tpl.writeText(txt, a_s);
5432 then txt;
5433
5434 case ( txt,
5435 _,
5436 a_isArray,
5437 a_isInput,
5438 a_s )
5439 algorithm
5440 ✗ txt := fun_192(txt, a_isInput, a_isArray, a_s);
5441 then txt;
5442 end match;
5443 end fun_193;
5444
5445 public function extTypeXml
5446 input Tpl.Text txt;
5447 input DAE.Type a_type;
5448 input Boolean a_isInput;
5449 input Boolean a_isArray;
5450
5451 output Tpl.Text out_txt;
5452 protected
5453 Tpl.Text l_s;
5454 algorithm
5455 ✗ l_s := fun_189(Tpl.emptyTxt, a_type, a_isInput);
5456 ✗ out_txt := fun_193(txt, a_type, a_isArray, a_isInput, l_s);
5457 end extTypeXml;
5458
5459 protected function fun_195
5460 input Tpl.Text in_txt;
5461 input DAE.Type in_a_type;
5462
5463 output Tpl.Text out_txt;
5464 algorithm
5465 out_txt :=
5466 match(in_txt, in_a_type)
5467 local
5468 Tpl.Text txt;
5469 DAE.Type i_type;
5470 Absyn.Path i_rname;
5471 DAE.Type i_ty;
5472 Tpl.Text txt_0;
5473 String ret_0;
5474
5475 case ( txt,
5476 DAE.T_INTEGER(varLst = _) )
5477 algorithm
5478 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
5479 then txt;
5480
5481 case ( txt,
5482 DAE.T_REAL(varLst = _) )
5483 algorithm
5484 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("double"));
5485 then txt;
5486
5487 case ( txt,
5488 DAE.T_STRING(varLst = _) )
5489 algorithm
5490 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("char"));
5491 then txt;
5492
5493 case ( txt,
5494 DAE.T_BOOL(varLst = _) )
5495 algorithm
5496 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
5497 then txt;
5498
5499 case ( txt,
5500 DAE.T_ENUMERATION(index = _) )
5501 algorithm
5502 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
5503 then txt;
5504
5505 case ( txt,
5506 DAE.T_ARRAY(ty = i_ty) )
5507 algorithm
5508 ✗ txt := extTypeF77Xml(txt, i_ty, true);
5509 then txt;
5510
5511 case ( txt,
5512 DAE.T_COMPLEX(complexClassType = ClassInf.EXTERNAL_OBJ(path = _)) )
5513 algorithm
5514 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("void*"));
5515 then txt;
5516
5517 case ( txt,
5518 DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = i_rname)) )
5519 algorithm
5520 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("struct "));
5521 ✗ txt := underscorePathXml(txt, i_rname);
5522 then txt;
5523
5524 case ( txt,
5525 DAE.T_METATYPE(ty = _) )
5526 algorithm
5527 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("void*"));
5528 then txt;
5529
5530 case ( txt,
5531 DAE.T_METABOXED(ty = _) )
5532 algorithm
5533 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("void*"));
5534 then txt;
5535
5536 case ( txt,
5537 i_type )
5538 algorithm
5539 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Unknown external F77 type "));
5540 ✗ ret_0 := TypesDump.unparseType(i_type);
5541 ✗ txt_0 := Tpl.writeStr(txt_0, ret_0);
5542 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1287, 14), Tpl.textString(txt_0));
5543 then txt;
5544 end match;
5545 end fun_195;
5546
5547 protected function fun_196
5548 input Tpl.Text in_txt;
5549 input Boolean in_a_isReference;
5550 input Tpl.Text in_a_s;
5551
5552 output Tpl.Text out_txt;
5553 algorithm
5554 out_txt :=
5555 match(in_txt, in_a_isReference, in_a_s)
5556 local
5557 Tpl.Text txt;
5558 Tpl.Text a_s;
5559
5560 case ( txt,
5561 false,
5562 a_s )
5563 algorithm
5564 ✗ txt := Tpl.writeText(txt, a_s);
5565 then txt;
5566
5567 case ( txt,
5568 _,
5569 a_s )
5570 algorithm
5571 ✗ txt := Tpl.writeText(txt, a_s);
5572 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*"));
5573 then txt;
5574 end match;
5575 end fun_196;
5576
5577 protected function fun_197
5578 input Tpl.Text in_txt;
5579 input DAE.Type in_a_type;
5580 input Boolean in_a_isReference;
5581 input Tpl.Text in_a_s;
5582
5583 output Tpl.Text out_txt;
5584 algorithm
5585 out_txt :=
5586 match(in_txt, in_a_type, in_a_isReference, in_a_s)
5587 local
5588 Tpl.Text txt;
5589 Boolean a_isReference;
5590 Tpl.Text a_s;
5591
5592 case ( txt,
5593 DAE.T_ARRAY(ty = _),
5594 _,
5595 a_s )
5596 algorithm
5597 ✗ txt := Tpl.writeText(txt, a_s);
5598 then txt;
5599
5600 case ( txt,
5601 _,
5602 a_isReference,
5603 a_s )
5604 algorithm
5605 ✗ txt := fun_196(txt, a_isReference, a_s);
5606 then txt;
5607 end match;
5608 end fun_197;
5609
5610 public function extTypeF77Xml
5611 input Tpl.Text txt;
5612 input DAE.Type a_type;
5613 input Boolean a_isReference;
5614
5615 output Tpl.Text out_txt;
5616 protected
5617 Tpl.Text l_s;
5618 algorithm
5619 ✗ l_s := fun_195(Tpl.emptyTxt, a_type);
5620 ✗ out_txt := fun_197(txt, a_type, a_isReference, l_s);
5621 end extTypeF77Xml;
5622
5623 protected function fun_199
5624 input Tpl.Text in_txt;
5625 input Boolean in_a_dotPath;
5626 input Absyn.Path in_a_name;
5627
5628 output Tpl.Text out_txt;
5629 algorithm
5630 out_txt :=
5631 match(in_txt, in_a_dotPath, in_a_name)
5632 local
5633 Tpl.Text txt;
5634 Absyn.Path a_name;
5635
5636 case ( txt,
5637 false,
5638 a_name )
5639 algorithm
5640 ✗ txt := underscorePathXml(txt, a_name);
5641 then txt;
5642
5643 case ( txt,
5644 _,
5645 a_name )
5646 algorithm
5647 ✗ txt := dotPathXml(txt, a_name);
5648 then txt;
5649 end match;
5650 end fun_199;
5651
5652 protected function fun_200
5653 input Tpl.Text in_txt;
5654 input Boolean in_a_dotPath;
5655 input Absyn.Path in_a_name;
5656
5657 output Tpl.Text out_txt;
5658 algorithm
5659 out_txt :=
5660 match(in_txt, in_a_dotPath, in_a_name)
5661 local
5662 Tpl.Text txt;
5663 Absyn.Path a_name;
5664
5665 case ( txt,
5666 false,
5667 a_name )
5668 algorithm
5669 ✗ txt := underscorePathXml(txt, a_name);
5670 then txt;
5671
5672 case ( txt,
5673 _,
5674 a_name )
5675 algorithm
5676 ✗ txt := dotPathXml(txt, a_name);
5677 then txt;
5678 end match;
5679 end fun_200;
5680
5681 protected function fun_201
5682 input Tpl.Text in_txt;
5683 input Boolean in_a_dotPath;
5684 input Absyn.Path in_a_name;
5685
5686 output Tpl.Text out_txt;
5687 algorithm
5688 out_txt :=
5689 match(in_txt, in_a_dotPath, in_a_name)
5690 local
5691 Tpl.Text txt;
5692 Absyn.Path a_name;
5693
5694 case ( txt,
5695 false,
5696 a_name )
5697 algorithm
5698 ✗ txt := underscorePathXml(txt, a_name);
5699 then txt;
5700
5701 case ( txt,
5702 _,
5703 a_name )
5704 algorithm
5705 ✗ txt := dotPathXml(txt, a_name);
5706 then txt;
5707 end match;
5708 end fun_201;
5709
5710 public function functionNameXml
5711 input Tpl.Text in_txt;
5712 input SimCodeFunction.Function in_a_fn;
5713 input Boolean in_a_dotPath;
5714
5715 output Tpl.Text out_txt;
5716 algorithm
5717 out_txt :=
5718 match(in_txt, in_a_fn, in_a_dotPath)
5719 local
5720 Tpl.Text txt;
5721 Boolean a_dotPath;
5722 Absyn.Path i_name;
5723
5724 case ( txt,
5725 SimCodeFunction.FUNCTION(name = i_name),
5726 a_dotPath )
5727 algorithm
5728 ✗ txt := fun_199(txt, a_dotPath, i_name);
5729 then txt;
5730
5731 case ( txt,
5732 SimCodeFunction.EXTERNAL_FUNCTION(name = i_name),
5733 a_dotPath )
5734 algorithm
5735 ✗ txt := fun_200(txt, a_dotPath, i_name);
5736 then txt;
5737
5738 case ( txt,
5739 SimCodeFunction.RECORD_CONSTRUCTOR(name = i_name),
5740 a_dotPath )
5741 algorithm
5742 ✗ txt := fun_201(txt, a_dotPath, i_name);
5743 then txt;
5744
5745 case ( txt,
5746 _,
5747 _ )
5748 then txt;
5749 end match;
5750 end functionNameXml;
5751
5752 public function extVarNameXml
5753 input Tpl.Text txt;
5754 input DAE.ComponentRef a_cr;
5755
5756 output Tpl.Text out_txt;
5757 algorithm
5758 4 out_txt := crefXml(txt, a_cr);
5759 end extVarNameXml;
5760
5761 protected function fun_204
5762 input Tpl.Text in_txt;
5763 input String in_a_language;
5764 input Tpl.Text in_a_varDecls;
5765 input Tpl.Text in_a_preExp;
5766 input SimCodeFunction.Function in_a_fun;
5767
5768 output Tpl.Text out_txt;
5769 output Tpl.Text out_a_varDecls;
5770 output Tpl.Text out_a_preExp;
5771 algorithm
5772 (out_txt, out_a_varDecls, out_a_preExp) :=
5773 match(in_txt, in_a_language, in_a_varDecls, in_a_preExp, in_a_fun)
5774 local
5775 Tpl.Text txt;
5776 Tpl.Text a_varDecls;
5777 Tpl.Text a_preExp;
5778 SimCodeFunction.Function a_fun;
5779
5780 case ( txt,
5781 "C",
5782 a_varDecls,
5783 a_preExp,
5784 a_fun )
5785 algorithm
5786 1 (txt, a_preExp, a_varDecls) := extFunCallCXml(txt, a_fun, a_preExp, a_varDecls);
5787 1 then (txt, a_varDecls, a_preExp);
5788
5789 case ( txt,
5790 "FORTRAN 77",
5791 a_varDecls,
5792 a_preExp,
5793 a_fun )
5794 algorithm
5795 ✗ (txt, a_preExp, a_varDecls) := extFunCallF77Xml(txt, a_fun, a_preExp, a_varDecls);
5796 ✗ then (txt, a_varDecls, a_preExp);
5797
5798 case ( txt,
5799 _,
5800 a_varDecls,
5801 a_preExp,
5802 _ )
5803 then (txt, a_varDecls, a_preExp);
5804 end match;
5805 end fun_204;
5806
5807 public function extFunCallXml
5808 input Tpl.Text in_txt;
5809 input SimCodeFunction.Function in_a_fun;
5810 input Tpl.Text in_a_preExp;
5811 input Tpl.Text in_a_varDecls;
5812
5813 output Tpl.Text out_txt;
5814 output Tpl.Text out_a_preExp;
5815 output Tpl.Text out_a_varDecls;
5816 algorithm
5817 (out_txt, out_a_preExp, out_a_varDecls) :=
5818 match(in_txt, in_a_fun, in_a_preExp, in_a_varDecls)
5819 local
5820 Tpl.Text txt;
5821 Tpl.Text a_preExp;
5822 Tpl.Text a_varDecls;
5823 SimCodeFunction.Function i_fun;
5824 String i_language;
5825
5826 case ( txt,
5827 (i_fun as SimCodeFunction.EXTERNAL_FUNCTION(language = i_language)),
5828 a_preExp,
5829 a_varDecls )
5830 algorithm
5831 1 (txt, a_varDecls, a_preExp) := fun_204(txt, i_language, a_varDecls, a_preExp, i_fun);
5832 1 then (txt, a_preExp, a_varDecls);
5833
5834 case ( txt,
5835 _,
5836 a_preExp,
5837 a_varDecls )
5838 then (txt, a_preExp, a_varDecls);
5839 end match;
5840 end extFunCallXml;
5841
5842 protected function lm_206
5843 input output Tpl.Text txt;
5844 input list<SimCodeFunction.SimExtArg> items;
5845 input output Tpl.Text a_varDecls;
5846 input output Tpl.Text a_preExp;
5847 algorithm
5848
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
4 for lstElt_206 in items loop
5849 (txt, a_varDecls, a_preExp) := match lstElt_206
5850 local
5851 SimCodeFunction.SimExtArg i_arg;
5852
5853 case i_arg
5854 algorithm
5855 3 (txt, a_preExp, a_varDecls) := extArgCXml(txt, i_arg, a_preExp, a_varDecls);
5856 3 txt := Tpl.nextIter(txt);
5857 then (txt, a_varDecls, a_preExp);
5858 end match;
5859 end for;
5860 end lm_206;
5861
5862 protected function fun_207
5863 input Tpl.Text in_txt;
5864 input SimCodeFunction.SimExtArg in_a_extReturn;
5865
5866 output Tpl.Text out_txt;
5867 algorithm
5868 out_txt :=
5869 match(in_txt, in_a_extReturn)
5870 local
5871 Tpl.Text txt;
5872 DAE.ComponentRef i_c;
5873
5874 case ( txt,
5875 SimCodeFunction.SIMEXTARG(cref = i_c) )
5876 algorithm
5877 1 txt := extVarNameXml(txt, i_c);
5878 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
5879 then txt;
5880
5881 case ( txt,
5882 _ )
5883 then txt;
5884 end match;
5885 end fun_207;
5886
5887 public function extFunCallCXml
5888 input Tpl.Text in_txt;
5889 input SimCodeFunction.Function in_a_fun;
5890 input Tpl.Text in_a_preExp;
5891 input Tpl.Text in_a_varDecls;
5892
5893 output Tpl.Text out_txt;
5894 output Tpl.Text out_a_preExp;
5895 output Tpl.Text out_a_varDecls;
5896 algorithm
5897 (out_txt, out_a_preExp, out_a_varDecls) :=
5898 match(in_txt, in_a_fun, in_a_preExp, in_a_varDecls)
5899 local
5900 Tpl.Text txt;
5901 Tpl.Text a_preExp;
5902 Tpl.Text a_varDecls;
5903 String i_extName;
5904 SimCodeFunction.SimExtArg i_extReturn;
5905 list<SimCodeFunction.SimExtArg> i_extArgs;
5906 Tpl.Text l_returnAssign;
5907 Tpl.Text l_args;
5908
5909 case ( txt,
5910 SimCodeFunction.EXTERNAL_FUNCTION(extArgs = i_extArgs, extReturn = i_extReturn, extName = i_extName),
5911 a_preExp,
5912 a_varDecls )
5913 algorithm
5914 1 l_args := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING_LIST({
5915 "\n",
5916 " "
5917 }, false)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
5918 1 (l_args, a_varDecls, a_preExp) := lm_206(l_args, i_extArgs, a_varDecls, a_preExp);
5919 1 l_args := Tpl.popIter(l_args);
5920 1 l_returnAssign := fun_207(Tpl.emptyTxt, i_extReturn);
5921 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
5922 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
5923 1 txt := Tpl.writeText(txt, l_returnAssign);
5924 1 txt := Tpl.softNewLine(txt);
5925 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5926 "<fun:Expression>\n",
5927 " <exp:FunctionCall>\n",
5928 " <exp:Name>\n"
5929 }, true));
5930 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
5931 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
5932 1 txt := Tpl.writeStr(txt, i_extName);
5933 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("\" />\n"));
5934 1 txt := Tpl.popBlock(txt);
5935 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5936 " </exp:Name>\n",
5937 " <exp:Arguments>\n"
5938 }, true));
5939 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
5940 1 txt := Tpl.writeText(txt, l_args);
5941 1 txt := Tpl.softNewLine(txt);
5942 1 txt := Tpl.popBlock(txt);
5943 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
5944 " </exp:Arguments>\n",
5945 " </exp:FunctionCall>\n",
5946 "</fun:Expression>\n"
5947 }, true));
5948 1 txt := Tpl.popBlock(txt);
5949 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
5950 1 then (txt, a_preExp, a_varDecls);
5951
5952 case ( txt,
5953 _,
5954 a_preExp,
5955 a_varDecls )
5956 then (txt, a_preExp, a_varDecls);
5957 end match;
5958 end extFunCallCXml;
5959
5960 protected function lm_209
5961 input output Tpl.Text txt;
5962 input list<SimCodeFunction.SimExtArg> items;
5963 input output Tpl.Text a_varDecls;
5964 input output Tpl.Text a_preExp;
5965 algorithm
5966 ✗ for lstElt_209 in items loop
5967 (txt, a_varDecls, a_preExp) := match lstElt_209
5968 local
5969 SimCodeFunction.SimExtArg i_arg;
5970
5971 case i_arg
5972 algorithm
5973 ✗ (txt, a_preExp, a_varDecls) := extArgF77Xml(txt, i_arg, a_preExp, a_varDecls);
5974 ✗ txt := Tpl.nextIter(txt);
5975 then (txt, a_varDecls, a_preExp);
5976 end match;
5977 end for;
5978 end lm_209;
5979
5980 protected function fun_210
5981 input Tpl.Text in_txt;
5982 input SimCodeFunction.SimExtArg in_a_extReturn;
5983
5984 output Tpl.Text out_txt;
5985 algorithm
5986 out_txt :=
5987 match(in_txt, in_a_extReturn)
5988 local
5989 Tpl.Text txt;
5990 DAE.ComponentRef i_c;
5991
5992 case ( txt,
5993 SimCodeFunction.SIMEXTARG(cref = i_c) )
5994 algorithm
5995 ✗ txt := extVarNameXml(txt, i_c);
5996 then txt;
5997
5998 case ( txt,
5999 _ )
6000 then txt;
6001 end match;
6002 end fun_210;
6003
6004 public function extFunCallF77Xml
6005 input Tpl.Text in_txt;
6006 input SimCodeFunction.Function in_a_fun;
6007 input Tpl.Text in_a_preExp;
6008 input Tpl.Text in_a_varDecls;
6009
6010 output Tpl.Text out_txt;
6011 output Tpl.Text out_a_preExp;
6012 output Tpl.Text out_a_varDecls;
6013 algorithm
6014 (out_txt, out_a_preExp, out_a_varDecls) :=
6015 match(in_txt, in_a_fun, in_a_preExp, in_a_varDecls)
6016 local
6017 Tpl.Text txt;
6018 Tpl.Text a_preExp;
6019 Tpl.Text a_varDecls;
6020 String i_extName;
6021 SimCodeFunction.SimExtArg i_extReturn;
6022 list<SimCodeFunction.SimExtArg> i_extArgs;
6023 Tpl.Text l_returnAssign;
6024 Tpl.Text l_args;
6025
6026 case ( txt,
6027 SimCodeFunction.EXTERNAL_FUNCTION(extArgs = i_extArgs, extReturn = i_extReturn, extName = i_extName),
6028 a_preExp,
6029 a_varDecls )
6030 algorithm
6031 ✗ l_args := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
6032 ✗ (l_args, a_varDecls, a_preExp) := lm_209(l_args, i_extArgs, a_varDecls, a_preExp);
6033 ✗ l_args := Tpl.popIter(l_args);
6034 ✗ l_returnAssign := fun_210(Tpl.emptyTxt, i_extReturn);
6035 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
6036 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6037 ✗ txt := Tpl.writeText(txt, l_returnAssign);
6038 ✗ txt := Tpl.softNewLine(txt);
6039 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6040 "<fun:Expression>\n",
6041 " <exp:FunctionCall>\n",
6042 " <exp:Name>\n"
6043 }, true));
6044 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
6045 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
6046 ✗ txt := Tpl.writeStr(txt, i_extName);
6047 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\" />\n"));
6048 ✗ txt := Tpl.popBlock(txt);
6049 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6050 " </exp:Name>\n",
6051 " <exp:Arguments>\n"
6052 }, true));
6053 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
6054 ✗ txt := Tpl.writeText(txt, l_args);
6055 ✗ txt := Tpl.softNewLine(txt);
6056 ✗ txt := Tpl.popBlock(txt);
6057 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6058 " </exp:Arguments>\n",
6059 " </exp:FunctionCall>\n",
6060 "</fun:Expression>\n"
6061 }, true));
6062 ✗ txt := Tpl.popBlock(txt);
6063 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
6064 ✗ then (txt, a_preExp, a_varDecls);
6065
6066 case ( txt,
6067 _,
6068 a_preExp,
6069 a_varDecls )
6070 then (txt, a_preExp, a_varDecls);
6071 end match;
6072 end extFunCallF77Xml;
6073
6074 public function extArgCXml
6075 input Tpl.Text in_txt;
6076 input SimCodeFunction.SimExtArg in_a_extArg;
6077 input Tpl.Text in_a_preExp;
6078 input Tpl.Text in_a_varDecls;
6079
6080 output Tpl.Text out_txt;
6081 output Tpl.Text out_a_preExp;
6082 output Tpl.Text out_a_varDecls;
6083 algorithm
6084 (out_txt, out_a_preExp, out_a_varDecls) :=
6085 match(in_txt, in_a_extArg, in_a_preExp, in_a_varDecls)
6086 local
6087 Tpl.Text txt;
6088 Tpl.Text a_preExp;
6089 Tpl.Text a_varDecls;
6090 DAE.Exp i_exp;
6091 DAE.ComponentRef i_c;
6092 Tpl.Text l_dim;
6093 Tpl.Text l_name;
6094
6095 case ( txt,
6096 SimCodeFunction.SIMEXTARG(cref = i_c, outputIndex = _, isArray = true, type_ = _),
6097 a_preExp,
6098 a_varDecls )
6099 algorithm
6100 ✗ txt := extVarNameXml(txt, i_c);
6101 ✗ then (txt, a_preExp, a_varDecls);
6102
6103 case ( txt,
6104 SimCodeFunction.SIMEXTARG(cref = i_c, isInput = _, outputIndex = 0, type_ = _),
6105 a_preExp,
6106 a_varDecls )
6107 algorithm
6108 3 txt := extVarNameXml(txt, i_c);
6109 3 then (txt, a_preExp, a_varDecls);
6110
6111 case ( txt,
6112 SimCodeFunction.SIMEXTARG(cref = i_c, isInput = _, outputIndex = _, type_ = _),
6113 a_preExp,
6114 a_varDecls )
6115 algorithm
6116 ✗ txt := extVarNameXml(txt, i_c);
6117 ✗ then (txt, a_preExp, a_varDecls);
6118
6119 case ( txt,
6120 SimCodeFunction.SIMEXTARGEXP(exp = i_exp),
6121 a_preExp,
6122 a_varDecls )
6123 algorithm
6124 ✗ (txt, a_preExp, a_varDecls) := daeExternalXmlExp(txt, i_exp, SimCodeFunction.contextFunction, a_preExp, a_varDecls);
6125 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("test daeexternal xml"));
6126 ✗ then (txt, a_preExp, a_varDecls);
6127
6128 case ( txt,
6129 SimCodeFunction.SIMEXTARGSIZE(cref = i_c, exp = i_exp),
6130 a_preExp,
6131 a_varDecls )
6132 algorithm
6133 ✗ l_name := extVarNameXml(Tpl.emptyTxt, i_c);
6134 ✗ (l_dim, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, SimCodeFunction.contextFunction, a_preExp, a_varDecls);
6135 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Size>\n"));
6136 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6137 ✗ txt := Tpl.writeText(txt, l_name);
6138 ✗ txt := Tpl.softNewLine(txt);
6139 ✗ txt := Tpl.writeText(txt, l_dim);
6140 ✗ txt := Tpl.softNewLine(txt);
6141 ✗ txt := Tpl.popBlock(txt);
6142 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Size>"));
6143 ✗ then (txt, a_preExp, a_varDecls);
6144
6145 case ( txt,
6146 _,
6147 a_preExp,
6148 a_varDecls )
6149 then (txt, a_preExp, a_varDecls);
6150 end match;
6151 end extArgCXml;
6152
6153 public function extArgF77Xml
6154 input Tpl.Text in_txt;
6155 input SimCodeFunction.SimExtArg in_a_extArg;
6156 input Tpl.Text in_a_preExp;
6157 input Tpl.Text in_a_varDecls;
6158
6159 output Tpl.Text out_txt;
6160 output Tpl.Text out_a_preExp;
6161 output Tpl.Text out_a_varDecls;
6162 algorithm
6163 (out_txt, out_a_preExp, out_a_varDecls) :=
6164 match(in_txt, in_a_extArg, in_a_preExp, in_a_varDecls)
6165 local
6166 Tpl.Text txt;
6167 Tpl.Text a_preExp;
6168 Tpl.Text a_varDecls;
6169 DAE.Exp i_exp;
6170 DAE.ComponentRef i_c;
6171 Tpl.Text l_name;
6172 Tpl.Text l_dim;
6173 Tpl.Text l_texp;
6174
6175 case ( txt,
6176 SimCodeFunction.SIMEXTARG(cref = i_c, isArray = true, type_ = _),
6177 a_preExp,
6178 a_varDecls )
6179 algorithm
6180 ✗ txt := extVarNameXml(txt, i_c);
6181 ✗ then (txt, a_preExp, a_varDecls);
6182
6183 case ( txt,
6184 SimCodeFunction.SIMEXTARG(cref = i_c, outputIndex = _, type_ = DAE.T_INTEGER(varLst = _)),
6185 a_preExp,
6186 a_varDecls )
6187 algorithm
6188 ✗ txt := extVarNameXml(txt, i_c);
6189 ✗ then (txt, a_preExp, a_varDecls);
6190
6191 case ( txt,
6192 SimCodeFunction.SIMEXTARG(cref = i_c, outputIndex = _, type_ = DAE.T_STRING(varLst = _)),
6193 a_preExp,
6194 a_varDecls )
6195 algorithm
6196 ✗ txt := extVarNameXml(txt, i_c);
6197 ✗ then (txt, a_preExp, a_varDecls);
6198
6199 case ( txt,
6200 SimCodeFunction.SIMEXTARG(cref = i_c, outputIndex = _, type_ = _),
6201 a_preExp,
6202 a_varDecls )
6203 algorithm
6204 ✗ txt := extVarNameXml(txt, i_c);
6205 ✗ then (txt, a_preExp, a_varDecls);
6206
6207 case ( txt,
6208 SimCodeFunction.SIMEXTARGEXP(exp = i_exp, type_ = DAE.T_STRING(varLst = _)),
6209 a_preExp,
6210 a_varDecls )
6211 algorithm
6212 ✗ (l_texp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, SimCodeFunction.contextFunction, a_preExp, a_varDecls);
6213 ✗ txt := Tpl.writeText(txt, l_texp);
6214 ✗ then (txt, a_preExp, a_varDecls);
6215
6216 case ( txt,
6217 SimCodeFunction.SIMEXTARGSIZE(cref = i_c, exp = i_exp),
6218 a_preExp,
6219 a_varDecls )
6220 algorithm
6221 ✗ (l_dim, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, SimCodeFunction.contextFunction, a_preExp, a_varDecls);
6222 ✗ l_name := extVarNameXml(Tpl.emptyTxt, i_c);
6223 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Size>\n"));
6224 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6225 ✗ txt := Tpl.writeText(txt, l_name);
6226 ✗ txt := Tpl.softNewLine(txt);
6227 ✗ txt := Tpl.writeText(txt, l_dim);
6228 ✗ txt := Tpl.softNewLine(txt);
6229 ✗ txt := Tpl.popBlock(txt);
6230 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Size>"));
6231 ✗ then (txt, a_preExp, a_varDecls);
6232
6233 case ( txt,
6234 _,
6235 a_preExp,
6236 a_varDecls )
6237 then (txt, a_preExp, a_varDecls);
6238 end match;
6239 end extArgF77Xml;
6240
6241 protected function lm_214
6242 input output Tpl.Text txt;
6243 input list<DAE.ClassAttributes> items;
6244 input SimCode.SimCode a_simCode;
6245 algorithm
6246
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 for lstElt_214 in items loop
6247 txt := match lstElt_214
6248 local
6249 DAE.ClassAttributes i_classAttribute;
6250
6251 case i_classAttribute
6252 algorithm
6253 ✗ txt := classAttributesXml(txt, i_classAttribute, a_simCode);
6254 ✗ txt := Tpl.nextIter(txt);
6255 then txt;
6256 end match;
6257 end for;
6258 end lm_214;
6259
6260 public function objectiveFunctionXml
6261 input Tpl.Text txt;
6262 input list<DAE.ClassAttributes> a_classAttributes;
6263 input SimCode.SimCode a_simCode;
6264
6265 output Tpl.Text out_txt;
6266 algorithm
6267 4 out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
6268 4 out_txt := lm_214(out_txt, a_classAttributes, a_simCode);
6269 4 out_txt := Tpl.popIter(out_txt);
6270 end objectiveFunctionXml;
6271
6272 protected function fun_216
6273 input Tpl.Text in_txt;
6274 input Option<DAE.Exp> in_a_objetiveE;
6275 input Tpl.Text in_a_varDecls;
6276 input Tpl.Text in_a_preExp;
6277
6278 output Tpl.Text out_txt;
6279 output Tpl.Text out_a_varDecls;
6280 output Tpl.Text out_a_preExp;
6281 algorithm
6282 (out_txt, out_a_varDecls, out_a_preExp) :=
6283 match(in_txt, in_a_objetiveE, in_a_varDecls, in_a_preExp)
6284 local
6285 Tpl.Text txt;
6286 Tpl.Text a_varDecls;
6287 Tpl.Text a_preExp;
6288 DAE.Exp i_exp;
6289
6290 case ( txt,
6291 SOME(i_exp),
6292 a_varDecls,
6293 a_preExp )
6294 algorithm
6295 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:ObjectiveFunction>\n"));
6296 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6297 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6298 ✗ txt := Tpl.softNewLine(txt);
6299 ✗ txt := Tpl.popBlock(txt);
6300 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:ObjectiveFunction>"));
6301 ✗ then (txt, a_varDecls, a_preExp);
6302
6303 case ( txt,
6304 _,
6305 a_varDecls,
6306 a_preExp )
6307 then (txt, a_varDecls, a_preExp);
6308 end match;
6309 end fun_216;
6310
6311 protected function fun_217
6312 input Tpl.Text in_txt;
6313 input Option<DAE.Exp> in_a_objectiveIntegrandE;
6314 input Tpl.Text in_a_varDecls;
6315 input Tpl.Text in_a_preExp;
6316
6317 output Tpl.Text out_txt;
6318 output Tpl.Text out_a_varDecls;
6319 output Tpl.Text out_a_preExp;
6320 algorithm
6321 (out_txt, out_a_varDecls, out_a_preExp) :=
6322 match(in_txt, in_a_objectiveIntegrandE, in_a_varDecls, in_a_preExp)
6323 local
6324 Tpl.Text txt;
6325 Tpl.Text a_varDecls;
6326 Tpl.Text a_preExp;
6327 DAE.Exp i_exp;
6328
6329 case ( txt,
6330 SOME(i_exp),
6331 a_varDecls,
6332 a_preExp )
6333 algorithm
6334 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:IntegrandObjectiveFunction>\n"));
6335 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6336 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6337 ✗ txt := Tpl.softNewLine(txt);
6338 ✗ txt := Tpl.popBlock(txt);
6339 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:IntegrandObjectiveFunction>"));
6340 ✗ then (txt, a_varDecls, a_preExp);
6341
6342 case ( txt,
6343 _,
6344 a_varDecls,
6345 a_preExp )
6346 then (txt, a_varDecls, a_preExp);
6347 end match;
6348 end fun_217;
6349
6350 protected function fun_218
6351 input Tpl.Text in_txt;
6352 input Option<DAE.Exp> in_a_startTimeE;
6353 input Tpl.Text in_a_varDecls;
6354 input Tpl.Text in_a_preExp;
6355
6356 output Tpl.Text out_txt;
6357 output Tpl.Text out_a_varDecls;
6358 output Tpl.Text out_a_preExp;
6359 algorithm
6360 (out_txt, out_a_varDecls, out_a_preExp) :=
6361 match(in_txt, in_a_startTimeE, in_a_varDecls, in_a_preExp)
6362 local
6363 Tpl.Text txt;
6364 Tpl.Text a_varDecls;
6365 Tpl.Text a_preExp;
6366 DAE.Exp i_exp;
6367
6368 case ( txt,
6369 SOME(i_exp),
6370 a_varDecls,
6371 a_preExp )
6372 algorithm
6373 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:IntervalStartTime>\n"));
6374 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6375 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<opt:Value>"));
6376 ✗ (txt, a_preExp, a_varDecls) := daeExpValueXml(txt, i_exp, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6377 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</opt:Value>\n"));
6378 ✗ txt := Tpl.popBlock(txt);
6379 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:IntervalStartTime>"));
6380 ✗ then (txt, a_varDecls, a_preExp);
6381
6382 case ( txt,
6383 _,
6384 a_varDecls,
6385 a_preExp )
6386 then (txt, a_varDecls, a_preExp);
6387 end match;
6388 end fun_218;
6389
6390 protected function fun_219
6391 input Tpl.Text in_txt;
6392 input Option<DAE.Exp> in_a_finalTimeE;
6393 input Tpl.Text in_a_varDecls;
6394 input Tpl.Text in_a_preExp;
6395
6396 output Tpl.Text out_txt;
6397 output Tpl.Text out_a_varDecls;
6398 output Tpl.Text out_a_preExp;
6399 algorithm
6400 (out_txt, out_a_varDecls, out_a_preExp) :=
6401 match(in_txt, in_a_finalTimeE, in_a_varDecls, in_a_preExp)
6402 local
6403 Tpl.Text txt;
6404 Tpl.Text a_varDecls;
6405 Tpl.Text a_preExp;
6406 DAE.Exp i_exp;
6407
6408 case ( txt,
6409 SOME(i_exp),
6410 a_varDecls,
6411 a_preExp )
6412 algorithm
6413 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:IntervalFinalTime>\n"));
6414 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6415 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<opt:Value>"));
6416 ✗ (txt, a_preExp, a_varDecls) := daeExpValueXml(txt, i_exp, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6417 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</opt:Value>\n"));
6418 ✗ txt := Tpl.popBlock(txt);
6419 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:IntervalFinalTime>"));
6420 ✗ then (txt, a_varDecls, a_preExp);
6421
6422 case ( txt,
6423 _,
6424 a_varDecls,
6425 a_preExp )
6426 then (txt, a_varDecls, a_preExp);
6427 end match;
6428 end fun_219;
6429
6430 protected function fun_220
6431 input Tpl.Text in_txt;
6432 input Option<DAE.Exp> in_a_startTimeE;
6433 input Tpl.Text in_a_varDecls;
6434 input Tpl.Text in_a_preExp;
6435
6436 output Tpl.Text out_txt;
6437 output Tpl.Text out_a_varDecls;
6438 output Tpl.Text out_a_preExp;
6439 algorithm
6440 (out_txt, out_a_varDecls, out_a_preExp) :=
6441 match(in_txt, in_a_startTimeE, in_a_varDecls, in_a_preExp)
6442 local
6443 Tpl.Text txt;
6444 Tpl.Text a_varDecls;
6445 Tpl.Text a_preExp;
6446 DAE.Exp i_exp;
6447
6448 case ( txt,
6449 SOME(i_exp),
6450 a_varDecls,
6451 a_preExp )
6452 algorithm
6453 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6454 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("index = \""));
6455 ✗ (txt, a_preExp, a_varDecls) := daeExpValueXml(txt, i_exp, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6456 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
6457 ✗ txt := Tpl.popBlock(txt);
6458 ✗ then (txt, a_varDecls, a_preExp);
6459
6460 case ( txt,
6461 _,
6462 a_varDecls,
6463 a_preExp )
6464 then (txt, a_varDecls, a_preExp);
6465 end match;
6466 end fun_220;
6467
6468 protected function fun_221
6469 input Tpl.Text in_txt;
6470 input Option<DAE.Exp> in_a_finalTimeE;
6471 input Tpl.Text in_a_varDecls;
6472 input Tpl.Text in_a_preExp;
6473
6474 output Tpl.Text out_txt;
6475 output Tpl.Text out_a_varDecls;
6476 output Tpl.Text out_a_preExp;
6477 algorithm
6478 (out_txt, out_a_varDecls, out_a_preExp) :=
6479 match(in_txt, in_a_finalTimeE, in_a_varDecls, in_a_preExp)
6480 local
6481 Tpl.Text txt;
6482 Tpl.Text a_varDecls;
6483 Tpl.Text a_preExp;
6484 DAE.Exp i_exp;
6485
6486 case ( txt,
6487 SOME(i_exp),
6488 a_varDecls,
6489 a_preExp )
6490 algorithm
6491 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6492 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("value = \""));
6493 ✗ (txt, a_preExp, a_varDecls) := daeExpValueXml(txt, i_exp, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6494 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
6495 ✗ txt := Tpl.popBlock(txt);
6496 ✗ then (txt, a_varDecls, a_preExp);
6497
6498 case ( txt,
6499 _,
6500 a_varDecls,
6501 a_preExp )
6502 then (txt, a_varDecls, a_preExp);
6503 end match;
6504 end fun_221;
6505
6506 protected function fun_222
6507 input Tpl.Text in_txt;
6508 input SimCode.SimCode in_a_simCode;
6509
6510 output Tpl.Text out_txt;
6511 algorithm
6512 out_txt :=
6513 match(in_txt, in_a_simCode)
6514 local
6515 Tpl.Text txt;
6516 list<DAE.Constraint> i_constraints;
6517
6518 case ( txt,
6519 SimCode.SIMCODE(modelInfo = SimCode.MODELINFO(name = _), constraints = i_constraints) )
6520 algorithm
6521 ✗ txt := constraintsXml(txt, i_constraints);
6522 then txt;
6523
6524 case ( txt,
6525 _ )
6526 then txt;
6527 end match;
6528 end fun_222;
6529
6530 public function classAttributesXml
6531 input Tpl.Text in_txt;
6532 input DAE.ClassAttributes in_a_classAttribute;
6533 input SimCode.SimCode in_a_simCode;
6534
6535 output Tpl.Text out_txt;
6536 algorithm
6537 out_txt :=
6538 match(in_txt, in_a_classAttribute, in_a_simCode)
6539 local
6540 Tpl.Text txt;
6541 SimCode.SimCode a_simCode;
6542 Option<DAE.Exp> i_finalTimeE;
6543 Option<DAE.Exp> i_startTimeE;
6544 Option<DAE.Exp> i_objectiveIntegrandE;
6545 Option<DAE.Exp> i_objetiveE;
6546 Tpl.Text l_constraints;
6547 Tpl.Text l_timePointValue;
6548 Tpl.Text l_timePointIndex;
6549 Tpl.Text l_finalTime;
6550 Tpl.Text l_startTime;
6551 Tpl.Text l_objectiveIntegrand;
6552 Tpl.Text l_objectiveFunction;
6553 Tpl.Text l_preExp;
6554 Tpl.Text l_varDecls;
6555
6556 case ( txt,
6557 DAE.OPTIMIZATION_ATTRS(objetiveE = i_objetiveE, objectiveIntegrandE = i_objectiveIntegrandE, startTimeE = i_startTimeE, finalTimeE = i_finalTimeE),
6558 a_simCode )
6559 algorithm
6560 ✗ l_varDecls := Tpl.emptyTxt;
6561 ✗ l_preExp := Tpl.emptyTxt;
6562 ✗ (l_objectiveFunction, l_varDecls, l_preExp) := fun_216(Tpl.emptyTxt, i_objetiveE, l_varDecls, l_preExp);
6563 ✗ (l_objectiveIntegrand, l_varDecls, l_preExp) := fun_217(Tpl.emptyTxt, i_objectiveIntegrandE, l_varDecls, l_preExp);
6564 ✗ (l_startTime, l_varDecls, l_preExp) := fun_218(Tpl.emptyTxt, i_startTimeE, l_varDecls, l_preExp);
6565 ✗ (l_finalTime, l_varDecls, l_preExp) := fun_219(Tpl.emptyTxt, i_finalTimeE, l_varDecls, l_preExp);
6566 ✗ (l_timePointIndex, l_varDecls, l_preExp) := fun_220(Tpl.emptyTxt, i_startTimeE, l_varDecls, l_preExp);
6567 ✗ (l_timePointValue, l_varDecls, l_preExp) := fun_221(Tpl.emptyTxt, i_finalTimeE, l_varDecls, l_preExp);
6568 ✗ l_constraints := fun_222(Tpl.emptyTxt, a_simCode);
6569 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:Optimization>\n"));
6570 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6571 ✗ txt := Tpl.writeText(txt, l_objectiveFunction);
6572 ✗ txt := Tpl.softNewLine(txt);
6573 ✗ txt := Tpl.writeText(txt, l_objectiveIntegrand);
6574 ✗ txt := Tpl.softNewLine(txt);
6575 ✗ txt := Tpl.writeText(txt, l_startTime);
6576 ✗ txt := Tpl.softNewLine(txt);
6577 ✗ txt := Tpl.writeText(txt, l_finalTime);
6578 ✗ txt := Tpl.softNewLine(txt);
6579 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:TimePoints>\n"));
6580 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6581 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<opt:TimePoint "));
6582 ✗ txt := Tpl.writeText(txt, l_timePointIndex);
6583 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" "));
6584 ✗ txt := Tpl.writeText(txt, l_timePointValue);
6585 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6586 ">\n",
6587 "</opt:TimePoint>\n"
6588 }, true));
6589 ✗ txt := Tpl.popBlock(txt);
6590 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
6591 "</opt:TimePoints>\n",
6592 "<opt:PathConstraints>\n"
6593 }, true));
6594 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
6595 ✗ txt := Tpl.writeText(txt, l_constraints);
6596 ✗ txt := Tpl.softNewLine(txt);
6597 ✗ txt := Tpl.popBlock(txt);
6598 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</opt:PathConstraints>\n"));
6599 ✗ txt := Tpl.popBlock(txt);
6600 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:Optimization>"));
6601 then txt;
6602
6603 case ( txt,
6604 _,
6605 _ )
6606 algorithm
6607 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1509, 16), "Unknown Optimization attribute");
6608 then txt;
6609 end match;
6610 end classAttributesXml;
6611
6612 protected function lm_224
6613 input output Tpl.Text txt;
6614 input list<DAE.Constraint> items;
6615 algorithm
6616 ✗ for lstElt_224 in items loop
6617 txt := match lstElt_224
6618 local
6619 DAE.Constraint i_constraint;
6620
6621 case i_constraint
6622 algorithm
6623 ✗ txt := constraintXml(txt, i_constraint);
6624 ✗ txt := Tpl.nextIter(txt);
6625 then txt;
6626 end match;
6627 end for;
6628 end lm_224;
6629
6630 public function constraintsXml
6631 input Tpl.Text txt;
6632 input list<DAE.Constraint> a_constraints;
6633
6634 output Tpl.Text out_txt;
6635 algorithm
6636 ✗ out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
6637 ✗ out_txt := lm_224(out_txt, a_constraints);
6638 ✗ out_txt := Tpl.popIter(out_txt);
6639 end constraintsXml;
6640
6641 protected function lm_226
6642 input output Tpl.Text txt;
6643 input list<DAE.Exp> items;
6644 input output Tpl.Text a_varDecls;
6645 input output Tpl.Text a_preExp;
6646 algorithm
6647 ✗ for lstElt_226 in items loop
6648 (txt, a_varDecls, a_preExp) := match lstElt_226
6649 local
6650 DAE.Exp i_constraint;
6651
6652 case i_constraint
6653 algorithm
6654 ✗ (txt, a_preExp, a_varDecls) := daeExpConstraintXml(txt, i_constraint, SimCodeFunction.contextSimulationDiscrete, a_preExp, a_varDecls);
6655 ✗ txt := Tpl.nextIter(txt);
6656 then (txt, a_varDecls, a_preExp);
6657 end match;
6658 end for;
6659 end lm_226;
6660
6661 public function constraintXml
6662 input Tpl.Text in_txt;
6663 input DAE.Constraint in_a_cons;
6664
6665 output Tpl.Text out_txt;
6666 algorithm
6667 out_txt :=
6668 match(in_txt, in_a_cons)
6669 local
6670 Tpl.Text txt;
6671 list<DAE.Exp> i_constraintLst;
6672 Tpl.Text l_constrain;
6673 Tpl.Text l_preExp;
6674 Tpl.Text l_varDecls;
6675
6676 case ( txt,
6677 DAE.CONSTRAINT_EXPS(constraintLst = i_constraintLst) )
6678 algorithm
6679 ✗ l_varDecls := Tpl.emptyTxt;
6680 ✗ l_preExp := Tpl.emptyTxt;
6681 ✗ l_constrain := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
6682 ✗ (l_constrain, l_varDecls, l_preExp) := lm_226(l_constrain, i_constraintLst, l_varDecls, l_preExp);
6683 ✗ l_constrain := Tpl.popIter(l_constrain);
6684 ✗ txt := Tpl.writeText(txt, l_constrain);
6685 then txt;
6686
6687 case ( txt,
6688 _ )
6689 algorithm
6690 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1532, 16), "Unknown Constraint List");
6691 then txt;
6692 end match;
6693 end constraintXml;
6694
6695 protected function lm_228
6696 input output Tpl.Text txt;
6697 input list<DAE.Statement> items;
6698 input output Tpl.Text a_varDecls;
6699 algorithm
6700 ✗ for lstElt_228 in items loop
6701 (txt, a_varDecls) := match lstElt_228
6702 local
6703 DAE.Statement i_stmt;
6704
6705 case i_stmt
6706 algorithm
6707 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, SimCodeFunction.contextFunction, a_varDecls);
6708 ✗ txt := Tpl.nextIter(txt);
6709 then (txt, a_varDecls);
6710 end match;
6711 end for;
6712 end lm_228;
6713
6714 public function funStatementXml
6715 input Tpl.Text txt;
6716 input list<DAE.Statement> a_statementLst;
6717 input Tpl.Text a_varDecls;
6718
6719 output Tpl.Text out_txt;
6720 output Tpl.Text out_a_varDecls;
6721 algorithm
6722 ✗ out_txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
6723 ✗ (out_txt, out_a_varDecls) := lm_228(out_txt, a_statementLst, a_varDecls);
6724 ✗ out_txt := Tpl.popIter(out_txt);
6725 end funStatementXml;
6726
6727 protected function fun_230
6728 input Tpl.Text in_txt;
6729 input DAE.Statement in_a_stmt;
6730 input Tpl.Text in_a_varDecls;
6731 input SimCodeFunction.Context in_a_context;
6732
6733 output Tpl.Text out_txt;
6734 output Tpl.Text out_a_varDecls;
6735 algorithm
6736 (out_txt, out_a_varDecls) :=
6737 match(in_txt, in_a_stmt, in_a_varDecls, in_a_context)
6738 local
6739 Tpl.Text txt;
6740 Tpl.Text a_varDecls;
6741 SimCodeFunction.Context a_context;
6742 DAE.Statement i_s;
6743
6744 case ( txt,
6745 (i_s as DAE.STMT_ASSIGN(type_ = _)),
6746 a_varDecls,
6747 a_context )
6748 algorithm
6749 ✗ (txt, a_varDecls) := algStmtAssignXml(txt, i_s, a_context, a_varDecls);
6750 then (txt, a_varDecls);
6751
6752 case ( txt,
6753 (i_s as DAE.STMT_ASSIGN_ARR(type_ = _)),
6754 a_varDecls,
6755 a_context )
6756 algorithm
6757 ✗ (txt, a_varDecls) := algStmtAssignArrXml(txt, i_s, a_context, a_varDecls);
6758 then (txt, a_varDecls);
6759
6760 case ( txt,
6761 (i_s as DAE.STMT_TUPLE_ASSIGN(type_ = _)),
6762 a_varDecls,
6763 a_context )
6764 algorithm
6765 ✗ (txt, a_varDecls) := algStmtTupleAssignXml(txt, i_s, a_context, a_varDecls);
6766 then (txt, a_varDecls);
6767
6768 case ( txt,
6769 (i_s as DAE.STMT_IF(exp = _)),
6770 a_varDecls,
6771 a_context )
6772 algorithm
6773 ✗ (txt, a_varDecls) := algStmtIfXml(txt, i_s, a_context, a_varDecls);
6774 then (txt, a_varDecls);
6775
6776 case ( txt,
6777 (i_s as DAE.STMT_FOR(type_ = _)),
6778 a_varDecls,
6779 a_context )
6780 algorithm
6781 ✗ (txt, a_varDecls) := algStmtForXml(txt, i_s, a_context, a_varDecls);
6782 then (txt, a_varDecls);
6783
6784 case ( txt,
6785 (i_s as DAE.STMT_WHILE(exp = _)),
6786 a_varDecls,
6787 a_context )
6788 algorithm
6789 ✗ (txt, a_varDecls) := algStmtWhileXml(txt, i_s, a_context, a_varDecls);
6790 then (txt, a_varDecls);
6791
6792 case ( txt,
6793 (i_s as DAE.STMT_ASSERT(cond = _)),
6794 a_varDecls,
6795 a_context )
6796 algorithm
6797 2 (txt, a_varDecls) := algStmtAssertXml(txt, i_s, a_context, a_varDecls);
6798 then (txt, a_varDecls);
6799
6800 case ( txt,
6801 (i_s as DAE.STMT_TERMINATE(msg = _)),
6802 a_varDecls,
6803 a_context )
6804 algorithm
6805 ✗ (txt, a_varDecls) := algStmtTerminateXml(txt, i_s, a_context, a_varDecls);
6806 then (txt, a_varDecls);
6807
6808 case ( txt,
6809 (i_s as DAE.STMT_WHEN(exp = _)),
6810 a_varDecls,
6811 a_context )
6812 algorithm
6813 ✗ (txt, a_varDecls) := algStmtWhenXml(txt, i_s, a_context, a_varDecls);
6814 then (txt, a_varDecls);
6815
6816 case ( txt,
6817 DAE.STMT_BREAK(source = _),
6818 a_varDecls,
6819 _ )
6820 algorithm
6821 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:Break/>"));
6822 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
6823 ✗ then (txt, a_varDecls);
6824
6825 case ( txt,
6826 DAE.STMT_RETURN(source = _),
6827 a_varDecls,
6828 _ )
6829 algorithm
6830 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:Return/>"));
6831 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
6832 ✗ then (txt, a_varDecls);
6833
6834 case ( txt,
6835 (i_s as DAE.STMT_NORETCALL(exp = _)),
6836 a_varDecls,
6837 a_context )
6838 algorithm
6839 ✗ (txt, a_varDecls) := algStmtNoretcallXml(txt, i_s, a_context, a_varDecls);
6840 then (txt, a_varDecls);
6841
6842 case ( txt,
6843 (i_s as DAE.STMT_REINIT(var = _)),
6844 a_varDecls,
6845 a_context )
6846 algorithm
6847 ✗ (txt, a_varDecls) := algStmtReinitXml(txt, i_s, a_context, a_varDecls);
6848 then (txt, a_varDecls);
6849
6850 case ( txt,
6851 _,
6852 a_varDecls,
6853 _ )
6854 algorithm
6855 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1562, 14), "ALG_STATEMENT NYI");
6856 ✗ then (txt, a_varDecls);
6857 end match;
6858 end fun_230;
6859
6860 public function algStatementXml
6861 input Tpl.Text txt;
6862 input DAE.Statement a_stmt;
6863 input SimCodeFunction.Context a_context;
6864 input Tpl.Text a_varDecls;
6865
6866 output Tpl.Text out_txt;
6867 output Tpl.Text out_a_varDecls;
6868 protected
6869 Tpl.Text l_res;
6870 algorithm
6871 2 (l_res, out_a_varDecls) := fun_230(Tpl.emptyTxt, a_stmt, a_varDecls, a_context);
6872 2 out_txt := Tpl.writeText(txt, l_res);
6873 end algStatementXml;
6874
6875 protected function fun_232
6876 input Tpl.Text in_txt;
6877 input DAE.Exp in_a_exp;
6878 input DAE.Exp in_a_val;
6879 input Tpl.Text in_a_varDecls;
6880 input SimCodeFunction.Context in_a_context;
6881
6882 output Tpl.Text out_txt;
6883 output Tpl.Text out_a_varDecls;
6884 algorithm
6885 (out_txt, out_a_varDecls) :=
6886 match(in_txt, in_a_exp, in_a_val, in_a_varDecls, in_a_context)
6887 local
6888 Tpl.Text txt;
6889 DAE.Exp a_val;
6890 Tpl.Text a_varDecls;
6891 SimCodeFunction.Context a_context;
6892 DAE.Subscript i_idx;
6893 DAE.Exp i_arr;
6894 Tpl.Text l_val1;
6895 Tpl.Text l_idx1;
6896 Tpl.Text l_arr1;
6897 Tpl.Text l_preExp;
6898
6899 case ( txt,
6900 DAE.ASUB(exp = i_arr, sub = {i_idx}),
6901 a_val,
6902 a_varDecls,
6903 a_context )
6904 algorithm
6905 ✗ l_preExp := Tpl.emptyTxt;
6906 ✗ (l_arr1, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_arr, a_context, l_preExp, a_varDecls);
6907 ✗ (l_idx1, l_preExp, a_varDecls) := daeSubscriptXML(Tpl.emptyTxt, i_idx, a_context, l_preExp, a_varDecls);
6908 ✗ (l_val1, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_val, a_context, l_preExp, a_varDecls);
6909 ✗ txt := Tpl.writeText(txt, l_preExp);
6910 ✗ txt := Tpl.softNewLine(txt);
6911 ✗ txt := Tpl.writeText(txt, l_arr1);
6912 ✗ txt := Tpl.softNewLine(txt);
6913 ✗ txt := Tpl.writeText(txt, l_idx1);
6914 ✗ txt := Tpl.softNewLine(txt);
6915 ✗ txt := Tpl.writeText(txt, l_val1);
6916 ✗ then (txt, a_varDecls);
6917
6918 case ( txt,
6919 _,
6920 _,
6921 a_varDecls,
6922 _ )
6923 then (txt, a_varDecls);
6924 end match;
6925 end fun_232;
6926
6927 protected function fun_233
6928 input Tpl.Text in_txt;
6929 input String in_mArg;
6930 input DAE.Exp in_a_exp1;
6931 input DAE.Exp in_a_val;
6932 input Tpl.Text in_a_varDecls;
6933 input SimCodeFunction.Context in_a_context;
6934 input DAE.Exp in_a_exp;
6935
6936 output Tpl.Text out_txt;
6937 output Tpl.Text out_a_varDecls;
6938 algorithm
6939 (out_txt, out_a_varDecls) :=
6940 match(in_txt, in_mArg, in_a_exp1, in_a_val, in_a_varDecls, in_a_context, in_a_exp)
6941 local
6942 Tpl.Text txt;
6943 DAE.Exp a_exp1;
6944 DAE.Exp a_val;
6945 Tpl.Text a_varDecls;
6946 SimCodeFunction.Context a_context;
6947 DAE.Exp a_exp;
6948 Tpl.Text l_expPart;
6949 Tpl.Text l_varPart;
6950 Tpl.Text l_preExp;
6951
6952 case ( txt,
6953 "metatype",
6954 _,
6955 a_val,
6956 a_varDecls,
6957 a_context,
6958 a_exp )
6959 algorithm
6960 ✗ (txt, a_varDecls) := fun_232(txt, a_exp, a_val, a_varDecls, a_context);
6961 then (txt, a_varDecls);
6962
6963 case ( txt,
6964 _,
6965 a_exp1,
6966 a_val,
6967 a_varDecls,
6968 a_context,
6969 _ )
6970 algorithm
6971 ✗ l_preExp := Tpl.emptyTxt;
6972 ✗ (l_varPart, l_preExp, a_varDecls) := daeExpAsubXml(Tpl.emptyTxt, a_exp1, a_context, l_preExp, a_varDecls);
6973 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_val, a_context, l_preExp, a_varDecls);
6974 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
6975 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6976 ✗ txt := Tpl.writeText(txt, l_varPart);
6977 ✗ txt := Tpl.softNewLine(txt);
6978 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Expression>\n"));
6979 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
6980 ✗ txt := Tpl.writeText(txt, l_expPart);
6981 ✗ txt := Tpl.softNewLine(txt);
6982 ✗ txt := Tpl.popBlock(txt);
6983 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Expression>\n"));
6984 ✗ txt := Tpl.popBlock(txt);
6985 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
6986 ✗ then (txt, a_varDecls);
6987 end match;
6988 end fun_233;
6989
6990 public function algStmtAssignXml
6991 input Tpl.Text in_txt;
6992 input DAE.Statement in_a_stmt;
6993 input SimCodeFunction.Context in_a_context;
6994 input Tpl.Text in_a_varDecls;
6995
6996 output Tpl.Text out_txt;
6997 output Tpl.Text out_a_varDecls;
6998 algorithm
6999 (out_txt, out_a_varDecls) :=
7000 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
7001 local
7002 Tpl.Text txt;
7003 SimCodeFunction.Context a_context;
7004 Tpl.Text a_varDecls;
7005 DAE.Exp i_val;
7006 DAE.Exp i_exp;
7007 DAE.Exp i_exp1;
7008 DAE.Exp i_e;
7009 Tpl.Text l_expPart2;
7010 Tpl.Text l_expPart1;
7011 String str_4;
7012 Tpl.Text txt_3;
7013 Tpl.Text l_varPart;
7014 Tpl.Text l_expPart;
7015 Tpl.Text l_preExp;
7016
7017 case ( txt,
7018 DAE.STMT_ASSIGN(exp1 = DAE.CREF(componentRef = DAE.WILD()), exp = i_e),
7019 a_context,
7020 a_varDecls )
7021 algorithm
7022 ✗ l_preExp := Tpl.emptyTxt;
7023 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, l_preExp, a_varDecls);
7024 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
7025 "<fun:Assign>\n",
7026 " <fun:Expression>\n"
7027 }, true));
7028 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
7029 ✗ txt := Tpl.writeText(txt, l_expPart);
7030 ✗ txt := Tpl.softNewLine(txt);
7031 ✗ txt := Tpl.popBlock(txt);
7032 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
7033 " </fun:Expression>\n",
7034 "</fun:Assign>"
7035 }, false));
7036 ✗ then (txt, a_varDecls);
7037
7038 case ( txt,
7039 DAE.STMT_ASSIGN(exp1 = (i_exp1 as DAE.CREF(ty = DAE.T_FUNCTION_REFERENCE_VAR(functionType = _))), exp = i_exp),
7040 a_context,
7041 a_varDecls )
7042 algorithm
7043 ✗ l_preExp := Tpl.emptyTxt;
7044 ✗ (l_varPart, l_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_exp1, a_context, l_preExp, a_varDecls);
7045 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
7046 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
7047 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7048 ✗ txt := Tpl.writeText(txt, l_varPart);
7049 ✗ txt := Tpl.softNewLine(txt);
7050 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Expression>\n"));
7051 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7052 ✗ txt := Tpl.writeText(txt, l_expPart);
7053 ✗ txt := Tpl.softNewLine(txt);
7054 ✗ txt := Tpl.popBlock(txt);
7055 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Expression>\n"));
7056 ✗ txt := Tpl.popBlock(txt);
7057 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
7058 ✗ then (txt, a_varDecls);
7059
7060 case ( txt,
7061 DAE.STMT_ASSIGN(exp1 = (i_exp1 as DAE.CREF(ty = DAE.T_FUNCTION_REFERENCE_FUNC(builtin = _))), exp = i_exp),
7062 a_context,
7063 a_varDecls )
7064 algorithm
7065 ✗ l_preExp := Tpl.emptyTxt;
7066 ✗ (l_varPart, l_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_exp1, a_context, l_preExp, a_varDecls);
7067 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
7068 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
7069 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7070 ✗ txt := Tpl.writeText(txt, l_varPart);
7071 ✗ txt := Tpl.softNewLine(txt);
7072 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Expression>\n"));
7073 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7074 ✗ txt := Tpl.writeText(txt, l_expPart);
7075 ✗ txt := Tpl.softNewLine(txt);
7076 ✗ txt := Tpl.popBlock(txt);
7077 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Expression>\n"));
7078 ✗ txt := Tpl.popBlock(txt);
7079 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
7080 ✗ then (txt, a_varDecls);
7081
7082 case ( txt,
7083 DAE.STMT_ASSIGN(exp1 = (i_exp1 as DAE.CREF(componentRef = _)), exp = i_exp),
7084 a_context,
7085 a_varDecls )
7086 algorithm
7087 ✗ l_preExp := Tpl.emptyTxt;
7088 ✗ (l_varPart, l_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_exp1, a_context, l_preExp, a_varDecls);
7089 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
7090 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
7091 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7092 ✗ txt := Tpl.writeText(txt, l_varPart);
7093 ✗ txt := Tpl.softNewLine(txt);
7094 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Expression>\n"));
7095 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7096 ✗ txt := Tpl.writeText(txt, l_expPart);
7097 ✗ txt := Tpl.softNewLine(txt);
7098 ✗ txt := Tpl.popBlock(txt);
7099 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Expression>\n"));
7100 ✗ txt := Tpl.popBlock(txt);
7101 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
7102 ✗ then (txt, a_varDecls);
7103
7104 case ( txt,
7105 DAE.STMT_ASSIGN(exp1 = (i_exp1 as DAE.ASUB(exp = _)), exp = (i_exp as i_val)),
7106 a_context,
7107 a_varDecls )
7108 algorithm
7109 ✗ txt_3 := expTypeFromExpShortXml(Tpl.emptyTxt, i_exp);
7110 ✗ str_4 := Tpl.textString(txt_3);
7111 ✗ (txt, a_varDecls) := fun_233(txt, str_4, i_exp1, i_val, a_varDecls, a_context, i_exp);
7112 then (txt, a_varDecls);
7113
7114 case ( txt,
7115 DAE.STMT_ASSIGN(exp1 = i_exp1, exp = i_exp),
7116 a_context,
7117 a_varDecls )
7118 algorithm
7119 ✗ l_preExp := Tpl.emptyTxt;
7120 ✗ (l_expPart1, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp1, a_context, l_preExp, a_varDecls);
7121 ✗ (l_expPart2, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
7122 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
7123 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7124 ✗ txt := Tpl.writeText(txt, l_expPart1);
7125 ✗ txt := Tpl.softNewLine(txt);
7126 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Expression>\n"));
7127 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7128 ✗ txt := Tpl.writeText(txt, l_expPart2);
7129 ✗ txt := Tpl.softNewLine(txt);
7130 ✗ txt := Tpl.popBlock(txt);
7131 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Expression>\n"));
7132 ✗ txt := Tpl.popBlock(txt);
7133 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
7134 ✗ then (txt, a_varDecls);
7135
7136 case ( txt,
7137 _,
7138 _,
7139 a_varDecls )
7140 ✗ then (txt, a_varDecls);
7141 end match;
7142 end algStmtAssignXml;
7143
7144 protected function fun_235
7145 input Tpl.Text in_txt;
7146 input Boolean in_mArg;
7147 input Tpl.Text in_a_varDecls;
7148 input Tpl.Text in_a_ispec;
7149 input Tpl.Text in_a_preExp;
7150 input SimCodeFunction.Context in_a_context;
7151 input DAE.ComponentRef in_a_cr;
7152 input Tpl.Text in_a_expPart;
7153 input DAE.Type in_a_t;
7154
7155 output Tpl.Text out_txt;
7156 output Tpl.Text out_a_varDecls;
7157 algorithm
7158 (out_txt, out_a_varDecls) :=
7159 match(in_txt, in_mArg, in_a_varDecls, in_a_ispec, in_a_preExp, in_a_context, in_a_cr, in_a_expPart, in_a_t)
7160 local
7161 Tpl.Text txt;
7162 Tpl.Text a_varDecls;
7163 Tpl.Text a_ispec;
7164 Tpl.Text a_preExp;
7165 SimCodeFunction.Context a_context;
7166 DAE.ComponentRef a_cr;
7167 Tpl.Text a_expPart;
7168 DAE.Type a_t;
7169
7170 case ( txt,
7171 true,
7172 a_varDecls,
7173 _,
7174 a_preExp,
7175 a_context,
7176 a_cr,
7177 a_expPart,
7178 a_t )
7179 algorithm
7180 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Assign>\n"));
7181 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7182 ✗ txt := copyArrayDataXml(txt, a_t, Tpl.textString(a_expPart), a_cr, a_context);
7183 ✗ txt := Tpl.softNewLine(txt);
7184 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Expression>\n"));
7185 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7186 ✗ txt := Tpl.writeText(txt, a_preExp);
7187 ✗ txt := Tpl.softNewLine(txt);
7188 ✗ txt := Tpl.popBlock(txt);
7189 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Expression>\n"));
7190 ✗ txt := Tpl.popBlock(txt);
7191 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Assign>"));
7192 ✗ then (txt, a_varDecls);
7193
7194 case ( txt,
7195 _,
7196 a_varDecls,
7197 a_ispec,
7198 a_preExp,
7199 a_context,
7200 a_cr,
7201 a_expPart,
7202 a_t )
7203 algorithm
7204 ✗ txt := Tpl.writeText(txt, a_preExp);
7205 ✗ txt := Tpl.softNewLine(txt);
7206 ✗ (txt, a_varDecls) := indexedAssignXml(txt, a_t, Tpl.textString(a_expPart), a_cr, Tpl.textString(a_ispec), a_context, a_varDecls);
7207 then (txt, a_varDecls);
7208 end match;
7209 end fun_235;
7210
7211 public function algStmtAssignArrXml
7212 input Tpl.Text in_txt;
7213 input DAE.Statement in_a_stmt;
7214 input SimCodeFunction.Context in_a_context;
7215 input Tpl.Text in_a_varDecls;
7216
7217 output Tpl.Text out_txt;
7218 output Tpl.Text out_a_varDecls;
7219 algorithm
7220 (out_txt, out_a_varDecls) :=
7221 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
7222 local
7223 Tpl.Text txt;
7224 SimCodeFunction.Context a_context;
7225 Tpl.Text a_varDecls;
7226 DAE.Type i_t;
7227 DAE.ComponentRef i_cr;
7228 DAE.Exp i_e;
7229 Boolean ret_3;
7230 Tpl.Text l_ispec;
7231 Tpl.Text l_expPart;
7232 Tpl.Text l_preExp;
7233
7234 case ( txt,
7235 DAE.STMT_ASSIGN_ARR(exp = i_e, lhs = DAE.CREF(componentRef = i_cr), type_ = i_t),
7236 a_context,
7237 a_varDecls )
7238 algorithm
7239 ✗ l_preExp := Tpl.emptyTxt;
7240 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, l_preExp, a_varDecls);
7241 ✗ (l_ispec, l_preExp, a_varDecls) := indexSpecFromCrefXml(Tpl.emptyTxt, i_cr, a_context, l_preExp, a_varDecls);
7242 ✗ ret_3 := Tpl.isEmpty(l_ispec);
7243 ✗ (txt, a_varDecls) := fun_235(txt, ret_3, a_varDecls, l_ispec, l_preExp, a_context, i_cr, l_expPart, i_t);
7244 then (txt, a_varDecls);
7245
7246 case ( txt,
7247 _,
7248 _,
7249 a_varDecls )
7250 ✗ then (txt, a_varDecls);
7251 end match;
7252 end algStmtAssignArrXml;
7253
7254 protected function fun_237
7255 input Tpl.Text in_txt;
7256 input SimCodeFunction.Context in_a_context;
7257 input String in_a_ispec;
7258 input String in_a_exp;
7259 input Tpl.Text in_a_cref;
7260
7261 output Tpl.Text out_txt;
7262 algorithm
7263 out_txt :=
7264 match(in_txt, in_a_context, in_a_ispec, in_a_exp, in_a_cref)
7265 local
7266 Tpl.Text txt;
7267 String a_ispec;
7268 String a_exp;
7269 Tpl.Text a_cref;
7270
7271 case ( txt,
7272 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
7273 _,
7274 _,
7275 a_cref )
7276 algorithm
7277 ✗ txt := Tpl.writeText(txt, a_cref);
7278 then txt;
7279
7280 case ( txt,
7281 _,
7282 a_ispec,
7283 a_exp,
7284 a_cref )
7285 algorithm
7286 ✗ txt := Tpl.writeStr(txt, a_exp);
7287 ✗ txt := Tpl.softNewLine(txt);
7288 ✗ txt := Tpl.writeStr(txt, a_ispec);
7289 ✗ txt := Tpl.softNewLine(txt);
7290 ✗ txt := Tpl.writeText(txt, a_cref);
7291 then txt;
7292 end match;
7293 end fun_237;
7294
7295 public function indexedAssignXml
7296 input Tpl.Text txt;
7297 input DAE.Type a_ty;
7298 input String a_exp;
7299 input DAE.ComponentRef a_cr;
7300 input String a_ispec;
7301 input SimCodeFunction.Context a_context;
7302 input Tpl.Text a_varDecls;
7303
7304 output Tpl.Text out_txt;
7305 output Tpl.Text out_a_varDecls;
7306 protected
7307 Tpl.Text l_cref;
7308 Tpl.Text l_type;
7309 algorithm
7310 ✗ l_type := expTypeArrayXml(Tpl.emptyTxt, a_ty);
7311 ✗ l_cref := contextArrayCrefXml(Tpl.emptyTxt, a_cr, a_context);
7312 ✗ out_txt := fun_237(txt, a_context, a_ispec, a_exp, l_cref);
7313 out_a_varDecls := a_varDecls;
7314 end indexedAssignXml;
7315
7316 protected function fun_239
7317 input Tpl.Text in_txt;
7318 input SimCodeFunction.Context in_a_context;
7319 input Tpl.Text in_a_cref;
7320
7321 output Tpl.Text out_txt;
7322 algorithm
7323 out_txt :=
7324 match(in_txt, in_a_context, in_a_cref)
7325 local
7326 Tpl.Text txt;
7327 Tpl.Text a_cref;
7328
7329 case ( txt,
7330 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
7331 a_cref )
7332 algorithm
7333 ✗ txt := Tpl.writeText(txt, a_cref);
7334 then txt;
7335
7336 case ( txt,
7337 _,
7338 a_cref )
7339 algorithm
7340 ✗ txt := Tpl.writeText(txt, a_cref);
7341 then txt;
7342 end match;
7343 end fun_239;
7344
7345 public function copyArrayDataXml
7346 input Tpl.Text txt;
7347 input DAE.Type a_ty;
7348 input String a_exp;
7349 input DAE.ComponentRef a_cr;
7350 input SimCodeFunction.Context a_context;
7351
7352 output Tpl.Text out_txt;
7353 protected
7354 Tpl.Text l_cref;
7355 Tpl.Text l_type;
7356 algorithm
7357 ✗ l_type := expTypeArrayXml(Tpl.emptyTxt, a_ty);
7358 ✗ l_cref := contextArrayCrefXml(Tpl.emptyTxt, a_cr, a_context);
7359 ✗ out_txt := fun_239(txt, a_context, l_cref);
7360 end copyArrayDataXml;
7361
7362 protected function lm_241
7363 input output Tpl.Text txt;
7364 input list<DAE.Exp> items;
7365 algorithm
7366 ✗ for lstElt_241 in items loop
7367 txt := match lstElt_241
7368 local
7369 DAE.Exp i_e;
7370
7371 case i_e
7372 algorithm
7373 ✗ txt := ExpressionDumpTpl.dumpExp(txt, i_e, "\"");
7374 ✗ txt := Tpl.nextIter(txt);
7375 then txt;
7376 end match;
7377 end for;
7378 end lm_241;
7379
7380 protected function lm_242
7381 input output Tpl.Text txt;
7382 input list<DAE.Exp> items;
7383 input output Tpl.Text a_varDecls;
7384 input output Tpl.Text a_afterExp;
7385 input SimCodeFunction.Context a_context;
7386 input Tpl.Text a_retStruct;
7387 algorithm
7388 ✗ for lstElt_242 in items loop
7389 (txt, a_varDecls, a_afterExp) := match lstElt_242
7390 local
7391 Integer x_i1;
7392 DAE.Exp i_cr;
7393 Tpl.Text l_rhsStr;
7394
7395 case i_cr
7396 algorithm
7397 ✗ x_i1 := Tpl.getIteri_i0(txt);
7398 ✗ l_rhsStr := Tpl.writeText(Tpl.emptyTxt, a_retStruct);
7399 ✗ l_rhsStr := Tpl.writeTok(l_rhsStr, Tpl.ST_STRING(".targ"));
7400 ✗ l_rhsStr := Tpl.writeStr(l_rhsStr, intString(x_i1));
7401 ✗ (txt, a_afterExp, a_varDecls) := writeLhsCrefXml(txt, i_cr, Tpl.textString(l_rhsStr), a_context, a_afterExp, a_varDecls);
7402 ✗ txt := Tpl.nextIter(txt);
7403 then (txt, a_varDecls, a_afterExp);
7404 end match;
7405 end for;
7406 end lm_242;
7407
7408 protected function lm_243
7409 input output Tpl.Text txt;
7410 input list<DAE.Exp> items;
7411 input output Tpl.Text a_varDecls;
7412 input output Tpl.Text a_afterExp;
7413 input SimCodeFunction.Context a_context;
7414 input Tpl.Text a_prefix;
7415 algorithm
7416 ✗ for lstElt_243 in items loop
7417 (txt, a_varDecls, a_afterExp) := match lstElt_243
7418 local
7419 Integer x_i1;
7420 DAE.Exp i_cr;
7421 Tpl.Text l_rhsStr;
7422
7423 case i_cr
7424 algorithm
7425 ✗ x_i1 := Tpl.getIteri_i0(txt);
7426 ✗ l_rhsStr := Tpl.writeText(Tpl.emptyTxt, a_prefix);
7427 ✗ l_rhsStr := Tpl.writeTok(l_rhsStr, Tpl.ST_STRING("_targ"));
7428 ✗ l_rhsStr := Tpl.writeStr(l_rhsStr, intString(x_i1));
7429 ✗ (txt, a_afterExp, a_varDecls) := writeLhsCrefXml(txt, i_cr, Tpl.textString(l_rhsStr), a_context, a_afterExp, a_varDecls);
7430 ✗ txt := Tpl.nextIter(txt);
7431 then (txt, a_varDecls, a_afterExp);
7432 end match;
7433 end for;
7434 end lm_243;
7435
7436 protected function fun_244
7437 input Tpl.Text in_txt;
7438 input String in_mArg;
7439
7440 output Tpl.Text out_txt;
7441 algorithm
7442 out_txt :=
7443 match(in_txt, in_mArg)
7444 local
7445 Tpl.Text txt;
7446
7447 case ( txt,
7448 "modelica_metatype" )
7449 algorithm
7450 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = NULL"));
7451 then txt;
7452
7453 case ( txt,
7454 _ )
7455 then txt;
7456 end match;
7457 end fun_244;
7458
7459 protected function fun_245
7460 input Tpl.Text in_txt;
7461 input String in_mArg;
7462 input Tpl.Text in_a_rhsStr;
7463
7464 output Tpl.Text out_txt;
7465 algorithm
7466 out_txt :=
7467 match(in_txt, in_mArg, in_a_rhsStr)
7468 local
7469 Tpl.Text txt;
7470 Tpl.Text a_rhsStr;
7471
7472 case ( txt,
7473 "modelica_metatype",
7474 a_rhsStr )
7475 algorithm
7476 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
7477 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("mmc_GC_add_root(&"));
7478 ✗ txt := Tpl.writeText(txt, a_rhsStr);
7479 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", mmc_GC_local_state, \""));
7480 ✗ txt := Tpl.writeText(txt, a_rhsStr);
7481 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("\");"));
7482 ✗ txt := Tpl.popBlock(txt);
7483 then txt;
7484
7485 case ( txt,
7486 _,
7487 _ )
7488 then txt;
7489 end match;
7490 end fun_245;
7491
7492 protected function lm_246
7493 input output Tpl.Text txt;
7494 input list<DAE.Exp> items;
7495 input output Tpl.Text a_varDecls;
7496 input Tpl.Text a_prefix;
7497 algorithm
7498 ✗ for lstElt_246 in items loop
7499 (txt, a_varDecls) := match lstElt_246
7500 local
7501 Integer x_i1;
7502 DAE.Exp i_cr;
7503 String str_5;
7504 Tpl.Text l_addRoot;
7505 String str_3;
7506 Tpl.Text l_initVar;
7507 Tpl.Text l_typ;
7508 Tpl.Text l_rhsStr;
7509
7510 case i_cr
7511 algorithm
7512 ✗ x_i1 := Tpl.getIteri_i0(txt);
7513 ✗ l_rhsStr := Tpl.writeText(Tpl.emptyTxt, a_prefix);
7514 ✗ l_rhsStr := Tpl.writeTok(l_rhsStr, Tpl.ST_STRING("_targ"));
7515 ✗ l_rhsStr := Tpl.writeStr(l_rhsStr, intString(x_i1));
7516 ✗ l_typ := expTypeFromExpModelicaXml(Tpl.emptyTxt, i_cr);
7517 ✗ str_3 := Tpl.textString(l_typ);
7518 ✗ l_initVar := fun_244(Tpl.emptyTxt, str_3);
7519 ✗ str_5 := Tpl.textString(l_typ);
7520 ✗ l_addRoot := fun_245(Tpl.emptyTxt, str_5, l_rhsStr);
7521 ✗ a_varDecls := Tpl.writeText(a_varDecls, l_typ);
7522 ✗ a_varDecls := Tpl.writeTok(a_varDecls, Tpl.ST_STRING(" "));
7523 ✗ a_varDecls := Tpl.writeText(a_varDecls, l_rhsStr);
7524 ✗ a_varDecls := Tpl.writeText(a_varDecls, l_initVar);
7525 ✗ a_varDecls := Tpl.writeTok(a_varDecls, Tpl.ST_STRING(";"));
7526 ✗ a_varDecls := Tpl.writeText(a_varDecls, l_addRoot);
7527 ✗ a_varDecls := Tpl.writeTok(a_varDecls, Tpl.ST_NEW_LINE());
7528 ✗ txt := Tpl.nextIter(txt);
7529 then (txt, a_varDecls);
7530 end match;
7531 end for;
7532 end lm_246;
7533
7534 public function algStmtTupleAssignXml
7535 input Tpl.Text in_txt;
7536 input DAE.Statement in_a_stmt;
7537 input SimCodeFunction.Context in_a_context;
7538 input Tpl.Text in_a_varDecls;
7539
7540 output Tpl.Text out_txt;
7541 output Tpl.Text out_a_varDecls;
7542 algorithm
7543 (out_txt, out_a_varDecls) :=
7544 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
7545 local
7546 Tpl.Text txt;
7547 SimCodeFunction.Context a_context;
7548 Tpl.Text a_varDecls;
7549 DAE.Exp i_exp;
7550 list<DAE.Exp> i_expExpLst;
7551 Integer ret_7;
7552 Tpl.Text l_prefix;
7553 Tpl.Text l_lhsCrefs;
7554 Tpl.Text l_retStruct;
7555 Tpl.Text l_marker;
7556 Tpl.Text l_crefs;
7557 Tpl.Text l_afterExp;
7558 Tpl.Text l_preExp;
7559
7560 case ( txt,
7561 DAE.STMT_TUPLE_ASSIGN(exp = (i_exp as DAE.CALL(path = _)), expExpLst = i_expExpLst),
7562 a_context,
7563 a_varDecls )
7564 algorithm
7565 ✗ l_preExp := Tpl.emptyTxt;
7566 ✗ l_afterExp := Tpl.emptyTxt;
7567 ✗ l_crefs := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
7568 ✗ l_crefs := lm_241(l_crefs, i_expExpLst);
7569 ✗ l_crefs := Tpl.popIter(l_crefs);
7570 ✗ l_marker := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("("));
7571 ✗ l_marker := Tpl.writeText(l_marker, l_crefs);
7572 ✗ l_marker := Tpl.writeTok(l_marker, Tpl.ST_STRING(") = "));
7573 ✗ l_marker := ExpressionDumpTpl.dumpExp(l_marker, i_exp, "\"");
7574 ✗ l_preExp := Tpl.writeTok(l_preExp, Tpl.ST_STRING("/* algStmtTupleAssign: preExp buffer created for "));
7575 ✗ l_preExp := Tpl.writeText(l_preExp, l_marker);
7576 ✗ l_preExp := Tpl.writeTok(l_preExp, Tpl.ST_STRING(" */"));
7577 ✗ l_preExp := Tpl.writeTok(l_preExp, Tpl.ST_NEW_LINE());
7578 ✗ l_afterExp := Tpl.writeTok(l_afterExp, Tpl.ST_STRING("/* algStmtTupleAssign: afterExp buffer created for "));
7579 ✗ l_afterExp := Tpl.writeText(l_afterExp, l_marker);
7580 ✗ l_afterExp := Tpl.writeTok(l_afterExp, Tpl.ST_STRING(" */"));
7581 ✗ l_afterExp := Tpl.writeTok(l_afterExp, Tpl.ST_NEW_LINE());
7582 ✗ (l_retStruct, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
7583 ✗ l_lhsCrefs := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(1, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
7584 ✗ (l_lhsCrefs, a_varDecls, l_afterExp) := lm_242(l_lhsCrefs, i_expExpLst, a_varDecls, l_afterExp, a_context, l_retStruct);
7585 ✗ l_lhsCrefs := Tpl.popIter(l_lhsCrefs);
7586 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
7587 "<fun:FunctionCallStatement>\n",
7588 " <fun:OutputArgument>\n"
7589 }, true));
7590 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
7591 ✗ txt := Tpl.writeText(txt, l_lhsCrefs);
7592 ✗ txt := Tpl.softNewLine(txt);
7593 ✗ txt := Tpl.popBlock(txt);
7594 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:OutputArgument>\n"));
7595 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7596 ✗ txt := Tpl.writeText(txt, l_retStruct);
7597 ✗ txt := Tpl.softNewLine(txt);
7598 ✗ txt := Tpl.popBlock(txt);
7599 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:FunctionCallStatement>"));
7600 ✗ then (txt, a_varDecls);
7601
7602 case ( txt,
7603 DAE.STMT_TUPLE_ASSIGN(exp = DAE.MATCHEXPRESSION(matchType = _), expExpLst = i_expExpLst),
7604 a_context,
7605 a_varDecls )
7606 algorithm
7607 ✗ l_preExp := Tpl.emptyTxt;
7608 ✗ l_afterExp := Tpl.emptyTxt;
7609 ✗ l_prefix := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("tmp"));
7610 ✗ ret_7 := System.tmpTick();
7611 ✗ l_prefix := Tpl.writeStr(l_prefix, intString(ret_7));
7612 ✗ l_lhsCrefs := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(1, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
7613 ✗ (l_lhsCrefs, a_varDecls, l_afterExp) := lm_243(l_lhsCrefs, i_expExpLst, a_varDecls, l_afterExp, a_context, l_prefix);
7614 ✗ l_lhsCrefs := Tpl.popIter(l_lhsCrefs);
7615 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(1, SOME(Tpl.ST_STRING("")), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
7616 ✗ (txt, a_varDecls) := lm_246(txt, i_expExpLst, a_varDecls, l_prefix);
7617 ✗ txt := Tpl.popIter(txt);
7618 ✗ txt := Tpl.softNewLine(txt);
7619 ✗ txt := Tpl.writeText(txt, l_preExp);
7620 ✗ txt := Tpl.softNewLine(txt);
7621 ✗ txt := Tpl.writeText(txt, l_lhsCrefs);
7622 ✗ txt := Tpl.softNewLine(txt);
7623 ✗ txt := Tpl.writeText(txt, l_afterExp);
7624 ✗ then (txt, a_varDecls);
7625
7626 case ( txt,
7627 _,
7628 _,
7629 a_varDecls )
7630 algorithm
7631 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 1755, 12), "algStmtTupleAssign failed");
7632 ✗ then (txt, a_varDecls);
7633 end match;
7634 end algStmtTupleAssignXml;
7635
7636 protected function fun_248
7637 input Tpl.Text in_txt;
7638 input SimCodeFunction.Context in_a_context;
7639 input Tpl.Text in_a_lhsStr;
7640
7641 output Tpl.Text out_txt;
7642 algorithm
7643 out_txt :=
7644 match(in_txt, in_a_context, in_a_lhsStr)
7645 local
7646 Tpl.Text txt;
7647 Tpl.Text a_lhsStr;
7648
7649 case ( txt,
7650 SimCodeFunction.SIMULATION_CONTEXT(genDiscrete = _),
7651 a_lhsStr )
7652 algorithm
7653 ✗ txt := Tpl.writeText(txt, a_lhsStr);
7654 then txt;
7655
7656 case ( txt,
7657 _,
7658 a_lhsStr )
7659 algorithm
7660 ✗ txt := Tpl.writeText(txt, a_lhsStr);
7661 then txt;
7662 end match;
7663 end fun_248;
7664
7665 protected function fun_249
7666 input Tpl.Text in_txt;
7667 input SimCodeFunction.Context in_a_context;
7668 input Tpl.Text in_a_lhsStr;
7669 input String in_a_rhsStr;
7670
7671 output Tpl.Text out_txt;
7672 algorithm
7673 out_txt :=
7674 match(in_txt, in_a_context, in_a_lhsStr, in_a_rhsStr)
7675 local
7676 Tpl.Text txt;
7677 Tpl.Text a_lhsStr;
7678 String a_rhsStr;
7679
7680 case ( txt,
7681 SimCodeFunction.SIMULATION_CONTEXT(genDiscrete = _),
7682 a_lhsStr,
7683 a_rhsStr )
7684 algorithm
7685 ✗ txt := Tpl.writeStr(txt, a_rhsStr);
7686 ✗ txt := Tpl.softNewLine(txt);
7687 ✗ txt := Tpl.writeText(txt, a_lhsStr);
7688 then txt;
7689
7690 case ( txt,
7691 _,
7692 a_lhsStr,
7693 _ )
7694 algorithm
7695 ✗ txt := Tpl.writeText(txt, a_lhsStr);
7696 then txt;
7697 end match;
7698 end fun_249;
7699
7700 public function writeLhsCrefXml
7701 input Tpl.Text in_txt;
7702 input DAE.Exp in_a_exp;
7703 input String in_a_rhsStr;
7704 input SimCodeFunction.Context in_a_context;
7705 input Tpl.Text in_a_preExp;
7706 input Tpl.Text in_a_varDecls;
7707
7708 output Tpl.Text out_txt;
7709 output Tpl.Text out_a_preExp;
7710 output Tpl.Text out_a_varDecls;
7711 algorithm
7712 (out_txt, out_a_preExp, out_a_varDecls) :=
7713 match(in_txt, in_a_exp, in_a_rhsStr, in_a_context, in_a_preExp, in_a_varDecls)
7714 local
7715 Tpl.Text txt;
7716 String a_rhsStr;
7717 SimCodeFunction.Context a_context;
7718 Tpl.Text a_preExp;
7719 Tpl.Text a_varDecls;
7720 DAE.Exp i_e;
7721 DAE.Exp i_exp;
7722 Tpl.Text l_lhsStr;
7723
7724 case ( txt,
7725 DAE.CREF(componentRef = DAE.WILD()),
7726 _,
7727 _,
7728 a_preExp,
7729 a_varDecls )
7730 algorithm
7731 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<fun:EmptyOutputArgument></fun:EmptyOutputArgument>"));
7732 ✗ then (txt, a_preExp, a_varDecls);
7733
7734 case ( txt,
7735 (i_exp as DAE.CREF(ty = DAE.T_ARRAY(ty = _))),
7736 _,
7737 a_context,
7738 a_preExp,
7739 a_varDecls )
7740 algorithm
7741 ✗ (l_lhsStr, a_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
7742 ✗ txt := fun_248(txt, a_context, l_lhsStr);
7743 ✗ then (txt, a_preExp, a_varDecls);
7744
7745 case ( txt,
7746 DAE.UNARY(exp = (i_e as DAE.CREF(ty = DAE.T_ARRAY(ty = _)))),
7747 a_rhsStr,
7748 a_context,
7749 a_preExp,
7750 a_varDecls )
7751 algorithm
7752 ✗ (l_lhsStr, a_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
7753 ✗ txt := fun_249(txt, a_context, l_lhsStr, a_rhsStr);
7754 ✗ then (txt, a_preExp, a_varDecls);
7755
7756 case ( txt,
7757 (i_exp as DAE.CREF(componentRef = _)),
7758 _,
7759 a_context,
7760 a_preExp,
7761 a_varDecls )
7762 algorithm
7763 ✗ (l_lhsStr, a_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
7764 ✗ txt := Tpl.writeText(txt, l_lhsStr);
7765 ✗ then (txt, a_preExp, a_varDecls);
7766
7767 case ( txt,
7768 DAE.UNARY(exp = (i_e as DAE.CREF(componentRef = _))),
7769 _,
7770 a_context,
7771 a_preExp,
7772 a_varDecls )
7773 algorithm
7774 ✗ (l_lhsStr, a_preExp, a_varDecls) := scalarLhsCrefXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
7775 ✗ txt := Tpl.writeText(txt, l_lhsStr);
7776 ✗ then (txt, a_preExp, a_varDecls);
7777
7778 case ( txt,
7779 i_exp,
7780 a_rhsStr,
7781 _,
7782 a_preExp,
7783 a_varDecls )
7784 algorithm
7785 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("/* SimCodeC.tpl template: writeLhsCref: UNHANDLED LHS\n"));
7786 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
7787 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("* "));
7788 ✗ txt := ExpressionDumpTpl.dumpExp(txt, i_exp, "\"");
7789 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
7790 ✗ txt := Tpl.writeStr(txt, a_rhsStr);
7791 ✗ txt := Tpl.softNewLine(txt);
7792 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*/"));
7793 ✗ txt := Tpl.popBlock(txt);
7794 ✗ then (txt, a_preExp, a_varDecls);
7795 end match;
7796 end writeLhsCrefXml;
7797
7798 protected function lm_251
7799 input output Tpl.Text txt;
7800 input list<DAE.Statement> items;
7801 input output Tpl.Text a_varDecls;
7802 input SimCodeFunction.Context a_context;
7803 algorithm
7804 ✗ for lstElt_251 in items loop
7805 (txt, a_varDecls) := match lstElt_251
7806 local
7807 DAE.Statement i_stmt;
7808
7809 case i_stmt
7810 algorithm
7811 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
7812 ✗ txt := Tpl.nextIter(txt);
7813 then (txt, a_varDecls);
7814 end match;
7815 end for;
7816 end lm_251;
7817
7818 public function algStmtIfXml
7819 input Tpl.Text in_txt;
7820 input DAE.Statement in_a_stmt;
7821 input SimCodeFunction.Context in_a_context;
7822 input Tpl.Text in_a_varDecls;
7823
7824 output Tpl.Text out_txt;
7825 output Tpl.Text out_a_varDecls;
7826 algorithm
7827 (out_txt, out_a_varDecls) :=
7828 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
7829 local
7830 Tpl.Text txt;
7831 SimCodeFunction.Context a_context;
7832 Tpl.Text a_varDecls;
7833 DAE.Else i_else__;
7834 list<DAE.Statement> i_statementLst;
7835 DAE.Exp i_exp;
7836 Tpl.Text l_condExp;
7837 Tpl.Text l_preExp;
7838
7839 case ( txt,
7840 DAE.STMT_IF(exp = i_exp, statementLst = i_statementLst, else_ = i_else__),
7841 a_context,
7842 a_varDecls )
7843 algorithm
7844 ✗ l_preExp := Tpl.emptyTxt;
7845 ✗ (l_condExp, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
7846 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
7847 "<fun:If>\n",
7848 " <fun:Condition>\n"
7849 }, true));
7850 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
7851 ✗ txt := Tpl.writeText(txt, l_condExp);
7852 ✗ txt := Tpl.softNewLine(txt);
7853 ✗ txt := Tpl.popBlock(txt);
7854 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
7855 " </fun:Condition>\n",
7856 " <fun:Statements>\n"
7857 }, true));
7858 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
7859 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
7860 ✗ (txt, a_varDecls) := lm_251(txt, i_statementLst, a_varDecls, a_context);
7861 ✗ txt := Tpl.popIter(txt);
7862 ✗ txt := Tpl.softNewLine(txt);
7863 ✗ txt := Tpl.popBlock(txt);
7864 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:Statements>\n"));
7865 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
7866 ✗ (txt, a_varDecls) := elseExprXml(txt, i_else__, a_context, a_varDecls);
7867 ✗ txt := Tpl.softNewLine(txt);
7868 ✗ txt := Tpl.popBlock(txt);
7869 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:If>"));
7870 ✗ then (txt, a_varDecls);
7871
7872 case ( txt,
7873 _,
7874 _,
7875 a_varDecls )
7876 then (txt, a_varDecls);
7877 end match;
7878 end algStmtIfXml;
7879
7880 public function algStmtForXml
7881 input Tpl.Text in_txt;
7882 input DAE.Statement in_a_stmt;
7883 input SimCodeFunction.Context in_a_context;
7884 input Tpl.Text in_a_varDecls;
7885
7886 output Tpl.Text out_txt;
7887 output Tpl.Text out_a_varDecls;
7888 algorithm
7889 (out_txt, out_a_varDecls) :=
7890 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
7891 local
7892 Tpl.Text txt;
7893 SimCodeFunction.Context a_context;
7894 Tpl.Text a_varDecls;
7895 DAE.Statement i_s;
7896
7897 case ( txt,
7898 (i_s as DAE.STMT_FOR(range = DAE.RANGE(ty = _))),
7899 a_context,
7900 a_varDecls )
7901 algorithm
7902 ✗ (txt, a_varDecls) := algStmtForRangeXml(txt, i_s, a_context, a_varDecls);
7903 then (txt, a_varDecls);
7904
7905 case ( txt,
7906 (i_s as DAE.STMT_FOR(type_ = _)),
7907 a_context,
7908 a_varDecls )
7909 algorithm
7910 ✗ (txt, a_varDecls) := algStmtForGenericXml(txt, i_s, a_context, a_varDecls);
7911 then (txt, a_varDecls);
7912
7913 case ( txt,
7914 _,
7915 _,
7916 a_varDecls )
7917 ✗ then (txt, a_varDecls);
7918 end match;
7919 end algStmtForXml;
7920
7921 protected function lm_254
7922 input output Tpl.Text txt;
7923 input list<DAE.Statement> items;
7924 input output Tpl.Text a_varDecls;
7925 input SimCodeFunction.Context a_context;
7926 algorithm
7927 ✗ for lstElt_254 in items loop
7928 (txt, a_varDecls) := match lstElt_254
7929 local
7930 DAE.Statement i_stmt;
7931
7932 case i_stmt
7933 algorithm
7934 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
7935 ✗ txt := Tpl.nextIter(txt);
7936 then (txt, a_varDecls);
7937 end match;
7938 end for;
7939 end lm_254;
7940
7941 public function algStmtForRangeXml
7942 input Tpl.Text in_txt;
7943 input DAE.Statement in_a_stmt;
7944 input SimCodeFunction.Context in_a_context;
7945 input Tpl.Text in_a_varDecls;
7946
7947 output Tpl.Text out_txt;
7948 output Tpl.Text out_a_varDecls;
7949 algorithm
7950 (out_txt, out_a_varDecls) :=
7951 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
7952 local
7953 Tpl.Text txt;
7954 SimCodeFunction.Context a_context;
7955 Tpl.Text a_varDecls;
7956 DAE.Ident i_iter;
7957 DAE.Exp i_rng;
7958 list<DAE.Statement> i_statementLst;
7959 Boolean i_iterIsArray;
7960 DAE.Type i_type__;
7961 Tpl.Text l_stmtStr;
7962 Tpl.Text l_identTypeShort;
7963 Tpl.Text l_identType;
7964
7965 case ( txt,
7966 DAE.STMT_FOR(range = (i_rng as DAE.RANGE(ty = _)), type_ = i_type__, iterIsArray = i_iterIsArray, statementLst = i_statementLst, iter = i_iter),
7967 a_context,
7968 a_varDecls )
7969 algorithm
7970 ✗ l_identType := expTypeXml(Tpl.emptyTxt, i_type__, i_iterIsArray);
7971 ✗ l_identTypeShort := expTypeShortXml(Tpl.emptyTxt, i_type__);
7972 ✗ l_stmtStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
7973 ✗ (l_stmtStr, a_varDecls) := lm_254(l_stmtStr, i_statementLst, a_varDecls, a_context);
7974 ✗ l_stmtStr := Tpl.popIter(l_stmtStr);
7975 ✗ (txt, l_stmtStr, a_varDecls) := algStmtForRange_implXml(txt, i_rng, i_iter, Tpl.textString(l_identType), Tpl.textString(l_identTypeShort), l_stmtStr, a_context, a_varDecls);
7976 ✗ then (txt, a_varDecls);
7977
7978 case ( txt,
7979 _,
7980 _,
7981 a_varDecls )
7982 then (txt, a_varDecls);
7983 end match;
7984 end algStmtForRangeXml;
7985
7986 protected function fun_256
7987 input Tpl.Text in_txt;
7988 input Option<DAE.Exp> in_a_step;
7989 input Tpl.Text in_a_varDecls;
7990 input Tpl.Text in_a_preExp;
7991 input SimCodeFunction.Context in_a_context;
7992
7993 output Tpl.Text out_txt;
7994 output Tpl.Text out_a_varDecls;
7995 output Tpl.Text out_a_preExp;
7996 algorithm
7997 (out_txt, out_a_varDecls, out_a_preExp) :=
7998 match(in_txt, in_a_step, in_a_varDecls, in_a_preExp, in_a_context)
7999 local
8000 Tpl.Text txt;
8001 Tpl.Text a_varDecls;
8002 Tpl.Text a_preExp;
8003 SimCodeFunction.Context a_context;
8004 DAE.Exp i_eo;
8005
8006 case ( txt,
8007 SOME(i_eo),
8008 a_varDecls,
8009 a_preExp,
8010 a_context )
8011 algorithm
8012 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_eo, a_context, a_preExp, a_varDecls);
8013 ✗ then (txt, a_varDecls, a_preExp);
8014
8015 case ( txt,
8016 _,
8017 a_varDecls,
8018 a_preExp,
8019 _ )
8020 then (txt, a_varDecls, a_preExp);
8021 end match;
8022 end fun_256;
8023
8024 protected function fun_257
8025 input Tpl.Text in_txt;
8026 input DAE.Exp in_a_range;
8027 input DAE.Ident in_a_iterator;
8028 input Tpl.Text in_a_body;
8029 input SimCodeFunction.Context in_a_context;
8030 input Tpl.Text in_a_varDecls;
8031
8032 output Tpl.Text out_txt;
8033 output Tpl.Text out_a_varDecls;
8034 algorithm
8035 (out_txt, out_a_varDecls) :=
8036 match(in_txt, in_a_range, in_a_iterator, in_a_body, in_a_context, in_a_varDecls)
8037 local
8038 Tpl.Text txt;
8039 DAE.Ident a_iterator;
8040 Tpl.Text a_body;
8041 SimCodeFunction.Context a_context;
8042 Tpl.Text a_varDecls;
8043 DAE.Exp i_stop;
8044 Option<DAE.Exp> i_step;
8045 DAE.Exp i_start;
8046 Tpl.Text l_stopValue;
8047 Tpl.Text l_stepValue;
8048 Tpl.Text l_startValue;
8049 Tpl.Text l_preExp;
8050 Tpl.Text l_iterName;
8051
8052 case ( txt,
8053 DAE.RANGE(start = i_start, step = i_step, stop = i_stop),
8054 a_iterator,
8055 a_body,
8056 a_context,
8057 a_varDecls )
8058 algorithm
8059 ✗ l_iterName := contextIteratorNameXml(Tpl.emptyTxt, a_iterator, a_context);
8060 ✗ l_preExp := Tpl.emptyTxt;
8061 ✗ (l_startValue, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_start, a_context, l_preExp, a_varDecls);
8062 ✗ (l_stepValue, a_varDecls, l_preExp) := fun_256(Tpl.emptyTxt, i_step, a_varDecls, l_preExp, a_context);
8063 ✗ (l_stopValue, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_stop, a_context, l_preExp, a_varDecls);
8064 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8065 "<fun:For>\n",
8066 " <fun:Index>\n",
8067 " <fun:IterationVariable>\n"
8068 }, true));
8069 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
8070 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
8071 ✗ txt := Tpl.writeText(txt, l_iterName);
8072 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("\"/>\n"));
8073 ✗ txt := Tpl.popBlock(txt);
8074 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8075 " </fun:IterationVariable>\n",
8076 " <fun:IterationSet>\n",
8077 " <exp:Range>\n"
8078 }, true));
8079 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(8));
8080 ✗ txt := Tpl.writeText(txt, l_startValue);
8081 ✗ txt := Tpl.softNewLine(txt);
8082 ✗ txt := Tpl.writeText(txt, l_stepValue);
8083 ✗ txt := Tpl.softNewLine(txt);
8084 ✗ txt := Tpl.writeText(txt, l_stopValue);
8085 ✗ txt := Tpl.softNewLine(txt);
8086 ✗ txt := Tpl.popBlock(txt);
8087 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8088 " </exp:Range>\n",
8089 " </fun:IterationSet>\n",
8090 " </fun:Index>\n",
8091 " <fun:Statements>\n"
8092 }, true));
8093 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
8094 ✗ txt := Tpl.writeText(txt, a_body);
8095 ✗ txt := Tpl.softNewLine(txt);
8096 ✗ txt := Tpl.popBlock(txt);
8097 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8098 " </fun:Statements>\n",
8099 "</fun:For>"
8100 }, false));
8101 ✗ then (txt, a_varDecls);
8102
8103 case ( txt,
8104 _,
8105 _,
8106 _,
8107 _,
8108 a_varDecls )
8109 then (txt, a_varDecls);
8110 end match;
8111 end fun_257;
8112
8113 public function algStmtForRange_implXml
8114 input Tpl.Text txt;
8115 input DAE.Exp a_range;
8116 input DAE.Ident a_iterator;
8117 input String a_type;
8118 input String a_shortType;
8119 input Tpl.Text a_body;
8120 input SimCodeFunction.Context a_context;
8121 input Tpl.Text a_varDecls;
8122
8123 output Tpl.Text out_txt;
8124 output Tpl.Text out_a_body;
8125 output Tpl.Text out_a_varDecls;
8126 algorithm
8127 ✗ (out_txt, out_a_varDecls) := fun_257(txt, a_range, a_iterator, a_body, a_context, a_varDecls);
8128 out_a_body := a_body;
8129 end algStmtForRange_implXml;
8130
8131 protected function lm_259
8132 input output Tpl.Text txt;
8133 input list<DAE.Statement> items;
8134 input output Tpl.Text a_varDecls;
8135 input SimCodeFunction.Context a_context;
8136 algorithm
8137 ✗ for lstElt_259 in items loop
8138 (txt, a_varDecls) := match lstElt_259
8139 local
8140 DAE.Statement i_stmt;
8141
8142 case i_stmt
8143 algorithm
8144 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
8145 ✗ txt := Tpl.nextIter(txt);
8146 then (txt, a_varDecls);
8147 end match;
8148 end for;
8149 end lm_259;
8150
8151 public function algStmtForGenericXml
8152 input Tpl.Text in_txt;
8153 input DAE.Statement in_a_stmt;
8154 input SimCodeFunction.Context in_a_context;
8155 input Tpl.Text in_a_varDecls;
8156
8157 output Tpl.Text out_txt;
8158 output Tpl.Text out_a_varDecls;
8159 algorithm
8160 (out_txt, out_a_varDecls) :=
8161 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
8162 local
8163 Tpl.Text txt;
8164 SimCodeFunction.Context a_context;
8165 Tpl.Text a_varDecls;
8166 DAE.Ident i_iter;
8167 DAE.Exp i_range;
8168 list<DAE.Statement> i_statementLst;
8169 Boolean i_iterIsArray;
8170 DAE.Type i_type__;
8171 Tpl.Text l_stmtStr;
8172 Tpl.Text l_arrayType;
8173 Tpl.Text l_iterType;
8174
8175 case ( txt,
8176 DAE.STMT_FOR(type_ = i_type__, iterIsArray = i_iterIsArray, statementLst = i_statementLst, range = i_range, iter = i_iter),
8177 a_context,
8178 a_varDecls )
8179 algorithm
8180 ✗ l_iterType := expTypeXml(Tpl.emptyTxt, i_type__, i_iterIsArray);
8181 ✗ l_arrayType := expTypeArrayXml(Tpl.emptyTxt, i_type__);
8182 ✗ l_stmtStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8183 ✗ (l_stmtStr, a_varDecls) := lm_259(l_stmtStr, i_statementLst, a_varDecls, a_context);
8184 ✗ l_stmtStr := Tpl.popIter(l_stmtStr);
8185 ✗ (txt, l_stmtStr, a_varDecls) := algStmtForGeneric_implXml(txt, i_range, i_iter, Tpl.textString(l_iterType), Tpl.textString(l_arrayType), i_iterIsArray, l_stmtStr, a_context, a_varDecls);
8186 ✗ then (txt, a_varDecls);
8187
8188 case ( txt,
8189 _,
8190 _,
8191 a_varDecls )
8192 then (txt, a_varDecls);
8193 end match;
8194 end algStmtForGenericXml;
8195
8196 public function algStmtForGeneric_implXml
8197 input Tpl.Text txt;
8198 input DAE.Exp a_exp;
8199 input DAE.Ident a_iterator;
8200 input String a_type;
8201 input String a_arrayType;
8202 input Boolean a_iterIsArray;
8203 input Tpl.Text a_body;
8204 input SimCodeFunction.Context a_context;
8205 input Tpl.Text a_varDecls;
8206
8207 output Tpl.Text out_txt;
8208 output Tpl.Text out_a_body;
8209 output Tpl.Text out_a_varDecls;
8210 protected
8211 Tpl.Text l_evar;
8212 Tpl.Text l_preExp;
8213 Tpl.Text l_iterName;
8214 algorithm
8215 ✗ l_iterName := contextIteratorNameXml(Tpl.emptyTxt, a_iterator, a_context);
8216 ✗ l_preExp := Tpl.emptyTxt;
8217 ✗ (l_evar, l_preExp, out_a_varDecls) := daeExpXml(Tpl.emptyTxt, a_exp, a_context, l_preExp, a_varDecls);
8218 ✗ out_txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8219 "<fun:For>\n",
8220 " <fun:Index>\n",
8221 " <fun:IterationVariable>\n"
8222 }, true));
8223 ✗ out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(6));
8224 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
8225 ✗ out_txt := Tpl.writeText(out_txt, l_iterName);
8226 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_LINE("\"/>\n"));
8227 ✗ out_txt := Tpl.popBlock(out_txt);
8228 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({
8229 " </fun:IterationVariable>\n",
8230 " <fun:IterationSet>\n",
8231 " <exp:Array>\n"
8232 }, true));
8233 ✗ out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(8));
8234 ✗ out_txt := Tpl.writeText(out_txt, l_preExp);
8235 ✗ out_txt := Tpl.softNewLine(out_txt);
8236 ✗ out_txt := Tpl.popBlock(out_txt);
8237 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({
8238 " </exp:Array>\n",
8239 " </fun:IterationSet>\n",
8240 " </fun:Index>\n",
8241 " <fun:Statements>\n"
8242 }, true));
8243 ✗ out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(6));
8244 ✗ out_txt := Tpl.writeText(out_txt, a_body);
8245 ✗ out_txt := Tpl.softNewLine(out_txt);
8246 ✗ out_txt := Tpl.popBlock(out_txt);
8247 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({
8248 " </fun:Statements>\n",
8249 "</fun:For>"
8250 }, false));
8251 out_a_body := a_body;
8252 end algStmtForGeneric_implXml;
8253
8254 protected function lm_262
8255 input output Tpl.Text txt;
8256 input list<DAE.Statement> items;
8257 input output Tpl.Text a_varDecls;
8258 input SimCodeFunction.Context a_context;
8259 algorithm
8260 ✗ for lstElt_262 in items loop
8261 (txt, a_varDecls) := match lstElt_262
8262 local
8263 DAE.Statement i_stmt;
8264
8265 case i_stmt
8266 algorithm
8267 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
8268 ✗ txt := Tpl.nextIter(txt);
8269 then (txt, a_varDecls);
8270 end match;
8271 end for;
8272 end lm_262;
8273
8274 public function algStmtWhileXml
8275 input Tpl.Text in_txt;
8276 input DAE.Statement in_a_stmt;
8277 input SimCodeFunction.Context in_a_context;
8278 input Tpl.Text in_a_varDecls;
8279
8280 output Tpl.Text out_txt;
8281 output Tpl.Text out_a_varDecls;
8282 algorithm
8283 (out_txt, out_a_varDecls) :=
8284 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
8285 local
8286 Tpl.Text txt;
8287 SimCodeFunction.Context a_context;
8288 Tpl.Text a_varDecls;
8289 list<DAE.Statement> i_statementLst;
8290 DAE.Exp i_exp;
8291 Tpl.Text l_var;
8292 Tpl.Text l_preExp;
8293
8294 case ( txt,
8295 DAE.STMT_WHILE(exp = i_exp, statementLst = i_statementLst),
8296 a_context,
8297 a_varDecls )
8298 algorithm
8299 ✗ l_preExp := Tpl.emptyTxt;
8300 ✗ (l_var, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
8301 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8302 "<fun:While>\n",
8303 " <fun:Condition>\n"
8304 }, true));
8305 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
8306 ✗ txt := Tpl.writeText(txt, l_var);
8307 ✗ txt := Tpl.softNewLine(txt);
8308 ✗ txt := Tpl.popBlock(txt);
8309 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8310 " </fun:Condition>\n",
8311 " <fun:Statements>\n"
8312 }, true));
8313 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
8314 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8315 ✗ (txt, a_varDecls) := lm_262(txt, i_statementLst, a_varDecls, a_context);
8316 ✗ txt := Tpl.popIter(txt);
8317 ✗ txt := Tpl.softNewLine(txt);
8318 ✗ txt := Tpl.popBlock(txt);
8319 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8320 " </fun:Statements>\n",
8321 "</fun:While>"
8322 }, false));
8323 ✗ then (txt, a_varDecls);
8324
8325 case ( txt,
8326 _,
8327 _,
8328 a_varDecls )
8329 then (txt, a_varDecls);
8330 end match;
8331 end algStmtWhileXml;
8332
8333 public function algStmtAssertXml
8334 input Tpl.Text in_txt;
8335 input DAE.Statement in_a_stmt;
8336 input SimCodeFunction.Context in_a_context;
8337 input Tpl.Text in_a_varDecls;
8338
8339 output Tpl.Text out_txt;
8340 output Tpl.Text out_a_varDecls;
8341 algorithm
8342 (out_txt, out_a_varDecls) :=
8343 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
8344 local
8345 Tpl.Text txt;
8346 SimCodeFunction.Context a_context;
8347 Tpl.Text a_varDecls;
8348 SourceInfo i_info;
8349 DAE.Exp i_msg;
8350 DAE.Exp i_cond;
8351
8352 case ( txt,
8353 DAE.STMT_ASSERT(source = DAE.SOURCE(info = i_info), cond = i_cond, msg = i_msg),
8354 a_context,
8355 a_varDecls )
8356 algorithm
8357 2 (txt, a_varDecls) := assertCommonXml(txt, i_cond, i_msg, a_context, a_varDecls, i_info);
8358 then (txt, a_varDecls);
8359
8360 case ( txt,
8361 _,
8362 _,
8363 a_varDecls )
8364 ✗ then (txt, a_varDecls);
8365 end match;
8366 end algStmtAssertXml;
8367
8368 public function algStmtTerminateXml
8369 input Tpl.Text in_txt;
8370 input DAE.Statement in_a_stmt;
8371 input SimCodeFunction.Context in_a_context;
8372 input Tpl.Text in_a_varDecls;
8373
8374 output Tpl.Text out_txt;
8375 output Tpl.Text out_a_varDecls;
8376 algorithm
8377 (out_txt, out_a_varDecls) :=
8378 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
8379 local
8380 Tpl.Text txt;
8381 SimCodeFunction.Context a_context;
8382 Tpl.Text a_varDecls;
8383 DAE.Exp i_msg;
8384 Tpl.Text l_msgVar;
8385 Tpl.Text l_preExp;
8386
8387 case ( txt,
8388 DAE.STMT_TERMINATE(msg = i_msg),
8389 a_context,
8390 a_varDecls )
8391 algorithm
8392 ✗ l_preExp := Tpl.emptyTxt;
8393 ✗ (l_msgVar, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_msg, a_context, l_preExp, a_varDecls);
8394 ✗ txt := Tpl.writeText(txt, l_preExp);
8395 ✗ txt := Tpl.softNewLine(txt);
8396 ✗ txt := Tpl.writeText(txt, l_msgVar);
8397 ✗ then (txt, a_varDecls);
8398
8399 case ( txt,
8400 _,
8401 _,
8402 a_varDecls )
8403 then (txt, a_varDecls);
8404 end match;
8405 end algStmtTerminateXml;
8406
8407 public function algStmtNoretcallXml
8408 input Tpl.Text in_txt;
8409 input DAE.Statement in_a_stmt;
8410 input SimCodeFunction.Context in_a_context;
8411 input Tpl.Text in_a_varDecls;
8412
8413 output Tpl.Text out_txt;
8414 output Tpl.Text out_a_varDecls;
8415 algorithm
8416 (out_txt, out_a_varDecls) :=
8417 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
8418 local
8419 Tpl.Text txt;
8420 SimCodeFunction.Context a_context;
8421 Tpl.Text a_varDecls;
8422 DAE.Exp i_exp;
8423 Tpl.Text l_expPart;
8424 Tpl.Text l_preExp;
8425
8426 case ( txt,
8427 DAE.STMT_NORETCALL(exp = i_exp),
8428 a_context,
8429 a_varDecls )
8430 algorithm
8431 ✗ l_preExp := Tpl.emptyTxt;
8432 ✗ (l_expPart, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
8433 ✗ txt := Tpl.writeText(txt, l_preExp);
8434 ✗ txt := Tpl.softNewLine(txt);
8435 ✗ txt := Tpl.writeText(txt, l_expPart);
8436 ✗ then (txt, a_varDecls);
8437
8438 case ( txt,
8439 _,
8440 _,
8441 a_varDecls )
8442 then (txt, a_varDecls);
8443 end match;
8444 end algStmtNoretcallXml;
8445
8446 protected function lm_267
8447 input output Tpl.Text txt;
8448 input list<DAE.ComponentRef> items;
8449 algorithm
8450 ✗ for lstElt_267 in items loop
8451 txt := match lstElt_267
8452 local
8453 DAE.ComponentRef i_e;
8454
8455 case i_e
8456 algorithm
8457 ✗ txt := crefToXmlStr(txt, i_e);
8458 ✗ txt := Tpl.nextIter(txt);
8459 then txt;
8460 end match;
8461 end for;
8462 end lm_267;
8463
8464 protected function lm_268
8465 input output Tpl.Text txt;
8466 input list<DAE.Statement> items;
8467 input output Tpl.Text a_varDecls;
8468 input SimCodeFunction.Context a_context;
8469 algorithm
8470 ✗ for lstElt_268 in items loop
8471 (txt, a_varDecls) := match lstElt_268
8472 local
8473 DAE.Statement i_stmt;
8474
8475 case i_stmt
8476 algorithm
8477 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
8478 ✗ txt := Tpl.nextIter(txt);
8479 then (txt, a_varDecls);
8480 end match;
8481 end for;
8482 end lm_268;
8483
8484 public function algStmtWhenXml
8485 input Tpl.Text in_txt;
8486 input DAE.Statement in_a_when;
8487 input SimCodeFunction.Context in_a_context;
8488 input Tpl.Text in_a_varDecls;
8489
8490 output Tpl.Text out_txt;
8491 output Tpl.Text out_a_varDecls;
8492 algorithm
8493 (out_txt, out_a_varDecls) :=
8494 match(in_txt, in_a_when, in_a_context, in_a_varDecls)
8495 local
8496 Tpl.Text txt;
8497 SimCodeFunction.Context a_context;
8498 Tpl.Text a_varDecls;
8499 Option<DAE.Statement> i_elseWhen;
8500 list<DAE.Statement> i_statementLst;
8501 list<DAE.ComponentRef> i_conditions;
8502 Tpl.Text l_else;
8503 Tpl.Text l_statements;
8504 Tpl.Text l_cond;
8505
8506 case ( txt,
8507 DAE.STMT_WHEN(conditions = i_conditions, statementLst = i_statementLst, elseWhen = i_elseWhen),
8508 a_context,
8509 a_varDecls )
8510 algorithm
8511 ✗ l_cond := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8512 ✗ l_cond := lm_267(l_cond, i_conditions);
8513 ✗ l_cond := Tpl.popIter(l_cond);
8514 ✗ l_statements := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8515 ✗ (l_statements, a_varDecls) := lm_268(l_statements, i_statementLst, a_varDecls, a_context);
8516 ✗ l_statements := Tpl.popIter(l_statements);
8517 ✗ (l_else, a_varDecls) := algStatementWhenElseXml(Tpl.emptyTxt, i_elseWhen, a_varDecls);
8518 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8519 "<fun:When>\n",
8520 " <fun:Condition>\n"
8521 }, true));
8522 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
8523 ✗ txt := Tpl.writeText(txt, l_cond);
8524 ✗ txt := Tpl.softNewLine(txt);
8525 ✗ txt := Tpl.popBlock(txt);
8526 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8527 " </fun:Condition>\n",
8528 " <fun:Statements>\n"
8529 }, true));
8530 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
8531 ✗ txt := Tpl.writeText(txt, l_statements);
8532 ✗ txt := Tpl.softNewLine(txt);
8533 ✗ txt := Tpl.popBlock(txt);
8534 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:Statements>\n"));
8535 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
8536 ✗ txt := Tpl.writeText(txt, l_else);
8537 ✗ txt := Tpl.popBlock(txt);
8538 ✗ then (txt, a_varDecls);
8539
8540 case ( txt,
8541 _,
8542 _,
8543 a_varDecls )
8544 then (txt, a_varDecls);
8545 end match;
8546 end algStmtWhenXml;
8547
8548 protected function lm_270
8549 input output Tpl.Text txt;
8550 input list<DAE.Statement> items;
8551 input output Tpl.Text a_varDecls;
8552 algorithm
8553 ✗ for lstElt_270 in items loop
8554 (txt, a_varDecls) := match lstElt_270
8555 local
8556 DAE.Statement i_stmt;
8557
8558 case i_stmt
8559 algorithm
8560 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, SimCodeFunction.contextSimulationDiscrete, a_varDecls);
8561 ✗ txt := Tpl.nextIter(txt);
8562 then (txt, a_varDecls);
8563 end match;
8564 end for;
8565 end lm_270;
8566
8567 protected function lm_271
8568 input output Tpl.Text txt;
8569 input list<DAE.ComponentRef> items;
8570 algorithm
8571 ✗ for lstElt_271 in items loop
8572 txt := match lstElt_271
8573 local
8574 DAE.ComponentRef i_e;
8575
8576 case i_e
8577 algorithm
8578 ✗ txt := crefToXmlStr(txt, i_e);
8579 ✗ txt := Tpl.nextIter(txt);
8580 then txt;
8581 end match;
8582 end for;
8583 end lm_271;
8584
8585 public function algStatementWhenElseXml
8586 input Tpl.Text in_txt;
8587 input Option<DAE.Statement> in_a_stmt;
8588 input Tpl.Text in_a_varDecls;
8589
8590 output Tpl.Text out_txt;
8591 output Tpl.Text out_a_varDecls;
8592 algorithm
8593 (out_txt, out_a_varDecls) :=
8594 match(in_txt, in_a_stmt, in_a_varDecls)
8595 local
8596 Tpl.Text txt;
8597 Tpl.Text a_varDecls;
8598 list<DAE.ComponentRef> i_when_conditions;
8599 Option<DAE.Statement> i_when_elseWhen;
8600 list<DAE.Statement> i_when_statementLst;
8601 Tpl.Text l_elseCondStr;
8602 Tpl.Text l_else;
8603 Tpl.Text l_statements;
8604
8605 case ( txt,
8606 SOME(DAE.STMT_WHEN(statementLst = i_when_statementLst, elseWhen = i_when_elseWhen, conditions = i_when_conditions)),
8607 a_varDecls )
8608 algorithm
8609 ✗ l_statements := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8610 ✗ (l_statements, a_varDecls) := lm_270(l_statements, i_when_statementLst, a_varDecls);
8611 ✗ l_statements := Tpl.popIter(l_statements);
8612 ✗ (l_else, a_varDecls) := algStatementWhenElseXml(Tpl.emptyTxt, i_when_elseWhen, a_varDecls);
8613 ✗ l_elseCondStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING_LIST({
8614 "\n",
8615 " "
8616 }, false)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8617 ✗ l_elseCondStr := lm_271(l_elseCondStr, i_when_conditions);
8618 ✗ l_elseCondStr := Tpl.popIter(l_elseCondStr);
8619 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Condition>\n"));
8620 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
8621 ✗ txt := Tpl.writeText(txt, l_elseCondStr);
8622 ✗ txt := Tpl.softNewLine(txt);
8623 ✗ txt := Tpl.popBlock(txt);
8624 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8625 "</fun:Condition>\n",
8626 "<fun:Statements>\n"
8627 }, true));
8628 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
8629 ✗ txt := Tpl.writeText(txt, l_statements);
8630 ✗ txt := Tpl.softNewLine(txt);
8631 ✗ txt := Tpl.popBlock(txt);
8632 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:Statements>\n"));
8633 ✗ txt := Tpl.writeText(txt, l_else);
8634 ✗ txt := Tpl.softNewLine(txt);
8635 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:When>"));
8636 ✗ then (txt, a_varDecls);
8637
8638 case ( txt,
8639 _,
8640 a_varDecls )
8641 then (txt, a_varDecls);
8642 end match;
8643 end algStatementWhenElseXml;
8644
8645 public function algStmtReinitXml
8646 input Tpl.Text in_txt;
8647 input DAE.Statement in_a_stmt;
8648 input SimCodeFunction.Context in_a_context;
8649 input Tpl.Text in_a_varDecls;
8650
8651 output Tpl.Text out_txt;
8652 output Tpl.Text out_a_varDecls;
8653 algorithm
8654 (out_txt, out_a_varDecls) :=
8655 match(in_txt, in_a_stmt, in_a_context, in_a_varDecls)
8656 local
8657 Tpl.Text txt;
8658 SimCodeFunction.Context a_context;
8659 Tpl.Text a_varDecls;
8660 DAE.Exp i_value;
8661 DAE.Exp i_var;
8662 Tpl.Text l_expPart2;
8663 Tpl.Text l_expPart1;
8664 Tpl.Text l_preExp;
8665
8666 case ( txt,
8667 DAE.STMT_REINIT(var = i_var, value = i_value),
8668 a_context,
8669 a_varDecls )
8670 algorithm
8671 ✗ l_preExp := Tpl.emptyTxt;
8672 ✗ (l_expPart1, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_var, a_context, l_preExp, a_varDecls);
8673 ✗ (l_expPart2, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_value, a_context, l_preExp, a_varDecls);
8674 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Reinit>\n"));
8675 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
8676 ✗ txt := Tpl.writeText(txt, l_expPart1);
8677 ✗ txt := Tpl.softNewLine(txt);
8678 ✗ txt := Tpl.writeText(txt, l_expPart2);
8679 ✗ txt := Tpl.softNewLine(txt);
8680 ✗ txt := Tpl.popBlock(txt);
8681 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Reinit>"));
8682 ✗ then (txt, a_varDecls);
8683
8684 case ( txt,
8685 _,
8686 _,
8687 a_varDecls )
8688 then (txt, a_varDecls);
8689 end match;
8690 end algStmtReinitXml;
8691
8692 public function indexSpecFromCrefXml
8693 input Tpl.Text in_txt;
8694 input DAE.ComponentRef in_a_cr;
8695 input SimCodeFunction.Context in_a_context;
8696 input Tpl.Text in_a_preExp;
8697 input Tpl.Text in_a_varDecls;
8698
8699 output Tpl.Text out_txt;
8700 output Tpl.Text out_a_preExp;
8701 output Tpl.Text out_a_varDecls;
8702 algorithm
8703 (out_txt, out_a_preExp, out_a_varDecls) :=
8704 match(in_txt, in_a_cr, in_a_context, in_a_preExp, in_a_varDecls)
8705 local
8706 Tpl.Text txt;
8707 SimCodeFunction.Context a_context;
8708 Tpl.Text a_preExp;
8709 Tpl.Text a_varDecls;
8710 list<DAE.Subscript> i_subs;
8711
8712 case ( txt,
8713 DAE.CREF_IDENT(subscriptLst = (i_subs as _ :: _)),
8714 a_context,
8715 a_preExp,
8716 a_varDecls )
8717 algorithm
8718 ✗ (txt, a_preExp, a_varDecls) := daeExpCrefRhsIndexSpecXml(txt, i_subs, a_context, a_preExp, a_varDecls);
8719 then (txt, a_preExp, a_varDecls);
8720
8721 case ( txt,
8722 _,
8723 _,
8724 a_preExp,
8725 a_varDecls )
8726 ✗ then (txt, a_preExp, a_varDecls);
8727 end match;
8728 end indexSpecFromCrefXml;
8729
8730 protected function lm_275
8731 input output Tpl.Text txt;
8732 input list<DAE.Statement> items;
8733 input output Tpl.Text a_varDecls;
8734 input SimCodeFunction.Context a_context;
8735 algorithm
8736 ✗ for lstElt_275 in items loop
8737 (txt, a_varDecls) := match lstElt_275
8738 local
8739 DAE.Statement i_stmt;
8740
8741 case i_stmt
8742 algorithm
8743 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
8744 ✗ txt := Tpl.nextIter(txt);
8745 then (txt, a_varDecls);
8746 end match;
8747 end for;
8748 end lm_275;
8749
8750 protected function lm_276
8751 input output Tpl.Text txt;
8752 input list<DAE.Statement> items;
8753 input output Tpl.Text a_varDecls;
8754 input SimCodeFunction.Context a_context;
8755 algorithm
8756 ✗ for lstElt_276 in items loop
8757 (txt, a_varDecls) := match lstElt_276
8758 local
8759 DAE.Statement i_stmt;
8760
8761 case i_stmt
8762 algorithm
8763 ✗ (txt, a_varDecls) := algStatementXml(txt, i_stmt, a_context, a_varDecls);
8764 ✗ txt := Tpl.nextIter(txt);
8765 then (txt, a_varDecls);
8766 end match;
8767 end for;
8768 end lm_276;
8769
8770 public function elseExprXml
8771 input Tpl.Text in_txt;
8772 input DAE.Else in_a_else__;
8773 input SimCodeFunction.Context in_a_context;
8774 input Tpl.Text in_a_varDecls;
8775
8776 output Tpl.Text out_txt;
8777 output Tpl.Text out_a_varDecls;
8778 algorithm
8779 (out_txt, out_a_varDecls) :=
8780 match(in_txt, in_a_else__, in_a_context, in_a_varDecls)
8781 local
8782 Tpl.Text txt;
8783 SimCodeFunction.Context a_context;
8784 Tpl.Text a_varDecls;
8785 DAE.Else i_else__;
8786 list<DAE.Statement> i_statementLst;
8787 DAE.Exp i_exp;
8788 Tpl.Text l_condExp;
8789 Tpl.Text l_preExp;
8790
8791 case ( txt,
8792 DAE.NOELSE(),
8793 _,
8794 a_varDecls )
8795 then (txt, a_varDecls);
8796
8797 case ( txt,
8798 DAE.ELSEIF(exp = i_exp, statementLst = i_statementLst, else_ = i_else__),
8799 a_context,
8800 a_varDecls )
8801 algorithm
8802 ✗ l_preExp := Tpl.emptyTxt;
8803 ✗ (l_condExp, l_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, l_preExp, a_varDecls);
8804 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
8805 "<fun:ElseIf>\n",
8806 " <fun:Condition>\n"
8807 }, true));
8808 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
8809 ✗ txt := Tpl.writeText(txt, l_condExp);
8810 ✗ txt := Tpl.softNewLine(txt);
8811 ✗ txt := Tpl.popBlock(txt);
8812 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" </fun:Condition>\n"));
8813 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
8814 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8815 ✗ (txt, a_varDecls) := lm_275(txt, i_statementLst, a_varDecls, a_context);
8816 ✗ txt := Tpl.popIter(txt);
8817 ✗ txt := Tpl.softNewLine(txt);
8818 ✗ txt := Tpl.popBlock(txt);
8819 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("</fun:ElseIf>\n"));
8820 ✗ (txt, a_varDecls) := elseExprXml(txt, i_else__, a_context, a_varDecls);
8821 then (txt, a_varDecls);
8822
8823 case ( txt,
8824 DAE.ELSE(statementLst = i_statementLst),
8825 a_context,
8826 a_varDecls )
8827 algorithm
8828 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<fun:Else>\n"));
8829 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
8830 ✗ txt := Tpl.pushIter(txt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
8831 ✗ (txt, a_varDecls) := lm_276(txt, i_statementLst, a_varDecls, a_context);
8832 ✗ txt := Tpl.popIter(txt);
8833 ✗ txt := Tpl.softNewLine(txt);
8834 ✗ txt := Tpl.popBlock(txt);
8835 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</fun:Else>"));
8836 ✗ then (txt, a_varDecls);
8837
8838 case ( txt,
8839 _,
8840 _,
8841 a_varDecls )
8842 then (txt, a_varDecls);
8843 end match;
8844 end elseExprXml;
8845
8846 protected function fun_278
8847 input Tpl.Text in_txt;
8848 input Boolean in_mArg;
8849 input DAE.ComponentRef in_a_ecr_componentRef;
8850 input Tpl.Text in_a_varDecls;
8851 input Tpl.Text in_a_preExp;
8852 input SimCodeFunction.Context in_a_context;
8853 input DAE.Exp in_a_ecr;
8854
8855 output Tpl.Text out_txt;
8856 output Tpl.Text out_a_varDecls;
8857 output Tpl.Text out_a_preExp;
8858 algorithm
8859 (out_txt, out_a_varDecls, out_a_preExp) :=
8860 match(in_txt, in_mArg, in_a_ecr_componentRef, in_a_varDecls, in_a_preExp, in_a_context, in_a_ecr)
8861 local
8862 Tpl.Text txt;
8863 DAE.ComponentRef a_ecr_componentRef;
8864 Tpl.Text a_varDecls;
8865 Tpl.Text a_preExp;
8866 SimCodeFunction.Context a_context;
8867 DAE.Exp a_ecr;
8868
8869 case ( txt,
8870 false,
8871 _,
8872 a_varDecls,
8873 a_preExp,
8874 a_context,
8875 a_ecr )
8876 algorithm
8877 ✗ (txt, a_preExp, a_varDecls) := daeExpCrefLhsXml(txt, a_ecr, a_context, a_preExp, a_varDecls);
8878 ✗ then (txt, a_varDecls, a_preExp);
8879
8880 case ( txt,
8881 _,
8882 a_ecr_componentRef,
8883 a_varDecls,
8884 a_preExp,
8885 _,
8886 _ )
8887 algorithm
8888 ✗ txt := crefXml(txt, a_ecr_componentRef);
8889 ✗ then (txt, a_varDecls, a_preExp);
8890 end match;
8891 end fun_278;
8892
8893 public function scalarLhsCrefXml
8894 input Tpl.Text in_txt;
8895 input DAE.Exp in_a_ecr;
8896 input SimCodeFunction.Context in_a_context;
8897 input Tpl.Text in_a_preExp;
8898 input Tpl.Text in_a_varDecls;
8899
8900 output Tpl.Text out_txt;
8901 output Tpl.Text out_a_preExp;
8902 output Tpl.Text out_a_varDecls;
8903 algorithm
8904 (out_txt, out_a_preExp, out_a_varDecls) :=
8905 match(in_txt, in_a_ecr, in_a_context, in_a_preExp, in_a_varDecls)
8906 local
8907 Tpl.Text txt;
8908 SimCodeFunction.Context a_context;
8909 Tpl.Text a_preExp;
8910 Tpl.Text a_varDecls;
8911 DAE.Exp i_ecr;
8912 DAE.ComponentRef i_ecr_componentRef;
8913 DAE.ComponentRef i_cr;
8914 Boolean ret_0;
8915
8916 case ( txt,
8917 DAE.CREF(componentRef = i_cr, ty = DAE.T_FUNCTION_REFERENCE_VAR(functionType = _)),
8918 _,
8919 a_preExp,
8920 a_varDecls )
8921 algorithm
8922 ✗ txt := crefStrXml(txt, i_cr);
8923 then (txt, a_preExp, a_varDecls);
8924
8925 case ( txt,
8926 (i_ecr as DAE.CREF(componentRef = (i_ecr_componentRef as DAE.CREF_IDENT(ident = _)))),
8927 a_context,
8928 a_preExp,
8929 a_varDecls )
8930 algorithm
8931 ✗ ret_0 := SimCodeFunctionUtil.crefNoSub(i_ecr_componentRef);
8932 ✗ (txt, a_varDecls, a_preExp) := fun_278(txt, ret_0, i_ecr_componentRef, a_varDecls, a_preExp, a_context, i_ecr);
8933 ✗ then (txt, a_preExp, a_varDecls);
8934
8935 case ( txt,
8936 DAE.CREF(componentRef = (i_ecr_componentRef as DAE.CREF_QUAL(ident = _))),
8937 _,
8938 a_preExp,
8939 a_varDecls )
8940 algorithm
8941 ✗ txt := crefXml(txt, i_ecr_componentRef);
8942 then (txt, a_preExp, a_varDecls);
8943
8944 case ( txt,
8945 DAE.CREF(componentRef = DAE.WILD()),
8946 _,
8947 a_preExp,
8948 a_varDecls )
8949 then (txt, a_preExp, a_varDecls);
8950
8951 case ( txt,
8952 _,
8953 _,
8954 a_preExp,
8955 a_varDecls )
8956 algorithm
8957 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("ONLY_IDENT_OR_QUAL_CREF_SUPPORTED_SLHS"));
8958 then (txt, a_preExp, a_varDecls);
8959 end match;
8960 end scalarLhsCrefXml;
8961
8962 protected function fun_280
8963 input Tpl.Text in_txt;
8964 input Boolean in_mArg;
8965 input Tpl.Text in_a_e;
8966 input Tpl.Text in_a_preExp;
8967
8968 output Tpl.Text out_txt;
8969 algorithm
8970 out_txt :=
8971 match(in_txt, in_mArg, in_a_e, in_a_preExp)
8972 local
8973 Tpl.Text txt;
8974 Tpl.Text a_e;
8975 Tpl.Text a_preExp;
8976
8977 case ( txt,
8978 true,
8979 _,
8980 a_preExp )
8981 algorithm
8982 14 txt := Tpl.writeText(txt, a_preExp);
8983 then txt;
8984
8985 case ( txt,
8986 _,
8987 a_e,
8988 _ )
8989 algorithm
8990 474 txt := Tpl.writeText(txt, a_e);
8991 then txt;
8992 end match;
8993 end fun_280;
8994
8995 protected function fun_281
8996 input Tpl.Text in_txt;
8997 input Boolean in_mArg;
8998 input Tpl.Text in_a_preExp;
8999 input Tpl.Text in_a_eStr1;
9000
9001 output Tpl.Text out_txt;
9002 algorithm
9003 out_txt :=
9004 match(in_txt, in_mArg, in_a_preExp, in_a_eStr1)
9005 local
9006 Tpl.Text txt;
9007 Tpl.Text a_preExp;
9008 Tpl.Text a_eStr1;
9009
9010 case ( txt,
9011 false,
9012 _,
9013 a_eStr1 )
9014 algorithm
9015 474 txt := Tpl.writeText(txt, a_eStr1);
9016 then txt;
9017
9018 case ( txt,
9019 _,
9020 a_preExp,
9021 _ )
9022 algorithm
9023 14 txt := Tpl.writeText(txt, a_preExp);
9024 then txt;
9025 end match;
9026 end fun_281;
9027
9028 public function daeExpXml
9029 input Tpl.Text txt;
9030 input DAE.Exp a_exp;
9031 input SimCodeFunction.Context a_context;
9032 input Tpl.Text a_preExp;
9033 input Tpl.Text a_varDecls;
9034
9035 output Tpl.Text out_txt;
9036 output Tpl.Text out_a_preExp;
9037 output Tpl.Text out_a_varDecls;
9038 protected
9039 Boolean ret_5;
9040 Integer ret_4;
9041 Tpl.Text l_eStr2;
9042 Boolean ret_2;
9043 Tpl.Text l_eStr1;
9044 Tpl.Text l_e;
9045 algorithm
9046 488 (l_e, out_a_preExp, out_a_varDecls) := daeExpXml_dispatch(Tpl.emptyTxt, a_exp, a_context, a_preExp, a_varDecls);
9047 488 ret_2 := Tpl.isEmpty(l_e);
9048 488 l_eStr1 := fun_280(Tpl.emptyTxt, ret_2, l_e, out_a_preExp);
9049 488 ret_4 := System.stringFind(Tpl.textString(l_eStr1), "tmp");
9050 488 ret_5 := intEq(0, ret_4);
9051 488 l_eStr2 := fun_281(Tpl.emptyTxt, ret_5, out_a_preExp, l_eStr1);
9052 488 out_txt := Tpl.writeText(txt, l_eStr2);
9053 end daeExpXml;
9054
9055 protected function fun_283
9056 input Tpl.Text in_txt;
9057 input Boolean in_a_bool;
9058
9059 output Tpl.Text out_txt;
9060 algorithm
9061 out_txt :=
9062 match(in_txt, in_a_bool)
9063 local
9064 Tpl.Text txt;
9065
9066 case ( txt,
9067 false )
9068 algorithm
9069 13 txt := Tpl.writeTok(txt, Tpl.ST_STRING("0"));
9070 then txt;
9071
9072 case ( txt,
9073 _ )
9074 algorithm
9075 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("1"));
9076 then txt;
9077 end match;
9078 end fun_283;
9079
9080 public function daeExpXml_dispatch
9081 input Tpl.Text in_txt;
9082 input DAE.Exp in_a_exp;
9083 input SimCodeFunction.Context in_a_context;
9084 input Tpl.Text in_a_preExp;
9085 input Tpl.Text in_a_varDecls;
9086
9087 output Tpl.Text out_txt;
9088 output Tpl.Text out_a_preExp;
9089 output Tpl.Text out_a_varDecls;
9090 algorithm
9091 (out_txt, out_a_preExp, out_a_varDecls) :=
9092 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
9093 local
9094 Tpl.Text txt;
9095 SimCodeFunction.Context a_context;
9096 Tpl.Text a_preExp;
9097 Tpl.Text a_varDecls;
9098 DAE.Exp i_exp;
9099 DAE.Exp i_e;
9100 Integer i_index;
9101 Boolean i_bool;
9102 String i_string;
9103 Real i_real;
9104 Integer i_integer;
9105 Tpl.Text txt_0;
9106
9107 case ( txt,
9108 DAE.ICONST(integer = i_integer),
9109 _,
9110 a_preExp,
9111 a_varDecls )
9112 algorithm
9113 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:IntegerLiteral>"));
9114 7 txt := Tpl.writeStr(txt, intString(i_integer));
9115 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:IntegerLiteral>"));
9116 7 then (txt, a_preExp, a_varDecls);
9117
9118 case ( txt,
9119 DAE.RCONST(real = i_real),
9120 _,
9121 a_preExp,
9122 a_varDecls )
9123 algorithm
9124 103 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:RealLiteral>"));
9125 103 txt := Tpl.writeStr(txt, realString(i_real));
9126 103 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:RealLiteral>"));
9127 103 then (txt, a_preExp, a_varDecls);
9128
9129 case ( txt,
9130 DAE.SCONST(string = i_string),
9131 a_context,
9132 a_preExp,
9133 a_varDecls )
9134 algorithm
9135 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:StringLiteral>"));
9136 5 (txt, a_preExp, a_varDecls) := daeExpSconstXml(txt, i_string, a_context, a_preExp, a_varDecls);
9137 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:StringLiteral>"));
9138 5 then (txt, a_preExp, a_varDecls);
9139
9140 case ( txt,
9141 DAE.BCONST(bool = i_bool),
9142 _,
9143 a_preExp,
9144 a_varDecls )
9145 algorithm
9146 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:BooleanLiteral>"));
9147 16 txt := fun_283(txt, i_bool);
9148 16 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:BooleanLiteral>"));
9149 16 then (txt, a_preExp, a_varDecls);
9150
9151 case ( txt,
9152 DAE.ENUM_LITERAL(index = i_index),
9153 _,
9154 a_preExp,
9155 a_varDecls )
9156 algorithm
9157 9 txt := Tpl.writeStr(txt, intString(i_index));
9158 9 then (txt, a_preExp, a_varDecls);
9159
9160 case ( txt,
9161 (i_e as DAE.CREF(componentRef = _)),
9162 a_context,
9163 a_preExp,
9164 a_varDecls )
9165 algorithm
9166 202 (txt, a_preExp, a_varDecls) := daeExpCrefRhsXml(txt, i_e, a_context, a_preExp, a_varDecls);
9167 then (txt, a_preExp, a_varDecls);
9168
9169 case ( txt,
9170 (i_e as DAE.BINARY(exp1 = _)),
9171 a_context,
9172 a_preExp,
9173 a_varDecls )
9174 algorithm
9175 98 (txt, a_preExp, a_varDecls) := daeExpBinaryXml(txt, i_e, a_context, a_preExp, a_varDecls);
9176 then (txt, a_preExp, a_varDecls);
9177
9178 case ( txt,
9179 (i_e as DAE.UNARY(operator = _)),
9180 a_context,
9181 a_preExp,
9182 a_varDecls )
9183 algorithm
9184 3 (txt, a_preExp, a_varDecls) := daeExpUnaryXml(txt, i_e, a_context, a_preExp, a_varDecls);
9185 then (txt, a_preExp, a_varDecls);
9186
9187 case ( txt,
9188 (i_e as DAE.LBINARY(exp1 = _)),
9189 a_context,
9190 a_preExp,
9191 a_varDecls )
9192 algorithm
9193 ✗ (txt, a_preExp, a_varDecls) := daeExpLbinaryXml(txt, i_e, a_context, a_preExp, a_varDecls);
9194 then (txt, a_preExp, a_varDecls);
9195
9196 case ( txt,
9197 (i_e as DAE.LUNARY(operator = _)),
9198 a_context,
9199 a_preExp,
9200 a_varDecls )
9201 algorithm
9202 ✗ (txt, a_preExp, a_varDecls) := daeExpLunaryXml(txt, i_e, a_context, a_preExp, a_varDecls);
9203 then (txt, a_preExp, a_varDecls);
9204
9205 case ( txt,
9206 (i_e as DAE.RELATION(exp1 = _)),
9207 a_context,
9208 a_preExp,
9209 a_varDecls )
9210 algorithm
9211 16 (txt, a_preExp, a_varDecls) := daeExpRelationXml(txt, i_e, a_context, a_preExp, a_varDecls);
9212 then (txt, a_preExp, a_varDecls);
9213
9214 case ( txt,
9215 (i_e as DAE.IFEXP(expCond = _)),
9216 a_context,
9217 a_preExp,
9218 a_varDecls )
9219 algorithm
9220 14 (txt, a_preExp, a_varDecls) := daeExpIfXml(txt, i_e, a_context, a_preExp, a_varDecls);
9221 then (txt, a_preExp, a_varDecls);
9222
9223 case ( txt,
9224 (i_e as DAE.CALL(path = _)),
9225 a_context,
9226 a_preExp,
9227 a_varDecls )
9228 algorithm
9229 11 (txt, a_preExp, a_varDecls) := daeExpCallXml(txt, i_e, a_context, a_preExp, a_varDecls);
9230 then (txt, a_preExp, a_varDecls);
9231
9232 case ( txt,
9233 (i_e as DAE.ARRAY(ty = _)),
9234 a_context,
9235 a_preExp,
9236 a_varDecls )
9237 algorithm
9238 ✗ (txt, a_preExp, a_varDecls) := daeExpArrayXml(txt, i_e, a_context, a_preExp, a_varDecls);
9239 then (txt, a_preExp, a_varDecls);
9240
9241 case ( txt,
9242 (i_e as DAE.MATRIX(ty = _)),
9243 a_context,
9244 a_preExp,
9245 a_varDecls )
9246 algorithm
9247 ✗ (txt, a_preExp, a_varDecls) := daeExpMatrixXml(txt, i_e, a_context, a_preExp, a_varDecls);
9248 then (txt, a_preExp, a_varDecls);
9249
9250 case ( txt,
9251 (i_e as DAE.RANGE(ty = _)),
9252 a_context,
9253 a_preExp,
9254 a_varDecls )
9255 algorithm
9256 ✗ (txt, a_preExp, a_varDecls) := daeExpRangeXml(txt, i_e, a_context, a_preExp, a_varDecls);
9257 then (txt, a_preExp, a_varDecls);
9258
9259 case ( txt,
9260 (i_e as DAE.CAST(ty = _)),
9261 a_context,
9262 a_preExp,
9263 a_varDecls )
9264 algorithm
9265 ✗ (txt, a_preExp, a_varDecls) := daeExpCastXml(txt, i_e, a_context, a_preExp, a_varDecls);
9266 then (txt, a_preExp, a_varDecls);
9267
9268 case ( txt,
9269 (i_e as DAE.ASUB(exp = _)),
9270 a_context,
9271 a_preExp,
9272 a_varDecls )
9273 algorithm
9274 ✗ (txt, a_preExp, a_varDecls) := daeExpAsubXml(txt, i_e, a_context, a_preExp, a_varDecls);
9275 then (txt, a_preExp, a_varDecls);
9276
9277 case ( txt,
9278 DAE.TSUB(exp = i_exp),
9279 a_context,
9280 a_preExp,
9281 a_varDecls )
9282 algorithm
9283 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_preExp, a_varDecls);
9284 then (txt, a_preExp, a_varDecls);
9285
9286 case ( txt,
9287 (i_e as DAE.SIZE(exp = _)),
9288 a_context,
9289 a_preExp,
9290 a_varDecls )
9291 algorithm
9292 ✗ (txt, a_preExp, a_varDecls) := daeExpSizeXml(txt, i_e, a_context, a_preExp, a_varDecls);
9293 then (txt, a_preExp, a_varDecls);
9294
9295 case ( txt,
9296 DAE.TUPLE(PR = _),
9297 _,
9298 a_preExp,
9299 a_varDecls )
9300 algorithm
9301 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Tuple Not yet Implemented"));
9302 ✗ then (txt, a_preExp, a_varDecls);
9303
9304 case ( txt,
9305 (i_e as DAE.BOX(exp = _)),
9306 a_context,
9307 a_preExp,
9308 a_varDecls )
9309 algorithm
9310 ✗ (txt, a_preExp, a_varDecls) := daeExpBoxXml(txt, i_e, a_context, a_preExp, a_varDecls);
9311 then (txt, a_preExp, a_varDecls);
9312
9313 case ( txt,
9314 (i_e as DAE.UNBOX(exp = _)),
9315 a_context,
9316 a_preExp,
9317 a_varDecls )
9318 algorithm
9319 ✗ (txt, a_preExp, a_varDecls) := daeExpUnboxXml(txt, i_e, a_context, a_preExp, a_varDecls);
9320 then (txt, a_preExp, a_varDecls);
9321
9322 case ( txt,
9323 (i_e as DAE.SHARED_LITERAL(index = _)),
9324 a_context,
9325 a_preExp,
9326 a_varDecls )
9327 algorithm
9328 4 (txt, a_preExp, a_varDecls) := daeExpSharedLiteralXml(txt, i_e, a_context, a_preExp, a_varDecls);
9329 then (txt, a_preExp, a_varDecls);
9330
9331 case ( txt,
9332 i_exp,
9333 _,
9334 a_preExp,
9335 a_varDecls )
9336 algorithm
9337 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Unknown expression: "));
9338 ✗ txt_0 := ExpressionDumpTpl.dumpExp(txt_0, i_exp, "\"");
9339 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2141, 14), Tpl.textString(txt_0));
9340 ✗ then (txt, a_preExp, a_varDecls);
9341 end match;
9342 end daeExpXml_dispatch;
9343
9344 protected function fun_285
9345 input Tpl.Text in_txt;
9346 input DAE.Exp in_a_exp;
9347
9348 output Tpl.Text out_txt;
9349 algorithm
9350 out_txt :=
9351 match(in_txt, in_a_exp)
9352 local
9353 Tpl.Text txt;
9354 Real i_real;
9355 Integer i_integer;
9356
9357 case ( txt,
9358 DAE.ICONST(integer = i_integer) )
9359 algorithm
9360 ✗ txt := Tpl.writeStr(txt, intString(i_integer));
9361 then txt;
9362
9363 case ( txt,
9364 DAE.RCONST(real = i_real) )
9365 algorithm
9366 ✗ txt := Tpl.writeStr(txt, realString(i_real));
9367 then txt;
9368
9369 case ( txt,
9370 _ )
9371 then txt;
9372 end match;
9373 end fun_285;
9374
9375 public function daeExpValueXml
9376 input Tpl.Text txt;
9377 input DAE.Exp a_exp;
9378 input SimCodeFunction.Context a_context;
9379 input Tpl.Text a_preExp;
9380 input Tpl.Text a_varDecls;
9381
9382 output Tpl.Text out_txt;
9383 output Tpl.Text out_a_preExp;
9384 output Tpl.Text out_a_varDecls;
9385 algorithm
9386 ✗ out_txt := fun_285(txt, a_exp);
9387 out_a_preExp := a_preExp;
9388 out_a_varDecls := a_varDecls;
9389 end daeExpValueXml;
9390
9391 protected function fun_287
9392 input Tpl.Text in_txt;
9393 input DAE.Type in_mArg;
9394 input DAE.Exp in_a_exp;
9395 input SimCodeFunction.Context in_a_context;
9396 input Tpl.Text in_a_preExp;
9397 input Tpl.Text in_a_varDecls;
9398
9399 output Tpl.Text out_txt;
9400 output Tpl.Text out_a_preExp;
9401 output Tpl.Text out_a_varDecls;
9402 algorithm
9403 (out_txt, out_a_preExp, out_a_varDecls) :=
9404 match(in_txt, in_mArg, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
9405 local
9406 Tpl.Text txt;
9407 DAE.Exp a_exp;
9408 SimCodeFunction.Context a_context;
9409 Tpl.Text a_preExp;
9410 Tpl.Text a_varDecls;
9411
9412 case ( txt,
9413 DAE.T_ARRAY(ty = _),
9414 a_exp,
9415 a_context,
9416 a_preExp,
9417 a_varDecls )
9418 algorithm
9419 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, a_exp, a_context, a_preExp, a_varDecls);
9420 then (txt, a_preExp, a_varDecls);
9421
9422 case ( txt,
9423 _,
9424 _,
9425 _,
9426 a_preExp,
9427 a_varDecls )
9428 ✗ then (txt, a_preExp, a_varDecls);
9429 end match;
9430 end fun_287;
9431
9432 public function daeExternalXmlExp
9433 input Tpl.Text txt;
9434 input DAE.Exp a_exp;
9435 input SimCodeFunction.Context a_context;
9436 input Tpl.Text a_preExp;
9437 input Tpl.Text a_varDecls;
9438
9439 output Tpl.Text out_txt;
9440 output Tpl.Text out_a_preExp;
9441 output Tpl.Text out_a_varDecls;
9442 protected
9443 DAE.Type ret_0;
9444 algorithm
9445 ✗ ret_0 := Expression.typeof(a_exp);
9446 ✗ (out_txt, out_a_preExp, out_a_varDecls) := fun_287(txt, ret_0, a_exp, a_context, a_preExp, a_varDecls);
9447 end daeExternalXmlExp;
9448
9449 public function daeExpSconstXml
9450 input Tpl.Text txt;
9451 input String a_string;
9452 input SimCodeFunction.Context a_context;
9453 input Tpl.Text a_preExp;
9454 input Tpl.Text a_varDecls;
9455
9456 output Tpl.Text out_txt;
9457 output Tpl.Text out_a_preExp;
9458 output Tpl.Text out_a_varDecls;
9459 protected
9460 String ret_0;
9461 algorithm
9462 5 out_txt := Tpl.writeTok(txt, Tpl.ST_STRING("\""));
9463 5 ret_0 := Util.escapeModelicaStringToXmlString(a_string);
9464 5 out_txt := Tpl.writeStr(out_txt, ret_0);
9465 5 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("\""));
9466 out_a_preExp := a_preExp;
9467 out_a_varDecls := a_varDecls;
9468 end daeExpSconstXml;
9469
9470 protected function fun_290
9471 input Tpl.Text in_txt;
9472 input SimCodeFunction.Context in_a_context;
9473 input DAE.ComponentRef in_a_cr;
9474 input DAE.Type in_a_t;
9475 input Tpl.Text in_a_varDecls;
9476 input Tpl.Text in_a_preExp;
9477 input DAE.Exp in_a_exp;
9478
9479 output Tpl.Text out_txt;
9480 output Tpl.Text out_a_varDecls;
9481 output Tpl.Text out_a_preExp;
9482 algorithm
9483 (out_txt, out_a_varDecls, out_a_preExp) :=
9484 match(in_txt, in_a_context, in_a_cr, in_a_t, in_a_varDecls, in_a_preExp, in_a_exp)
9485 local
9486 Tpl.Text txt;
9487 DAE.ComponentRef a_cr;
9488 DAE.Type a_t;
9489 Tpl.Text a_varDecls;
9490 Tpl.Text a_preExp;
9491 DAE.Exp a_exp;
9492 SimCodeFunction.Context i_context;
9493
9494 case ( txt,
9495 (i_context as SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _)),
9496 _,
9497 _,
9498 a_varDecls,
9499 a_preExp,
9500 a_exp )
9501 algorithm
9502 ✗ (txt, a_preExp, a_varDecls) := daeExpCrefRhs2Xml(txt, a_exp, i_context, a_preExp, a_varDecls);
9503 ✗ then (txt, a_varDecls, a_preExp);
9504
9505 case ( txt,
9506 i_context,
9507 a_cr,
9508 a_t,
9509 a_varDecls,
9510 a_preExp,
9511 _ )
9512 algorithm
9513 ✗ (txt, a_preExp, a_varDecls) := daeExpRecordCrefRhsXml(txt, a_t, a_cr, i_context, a_preExp, a_varDecls);
9514 ✗ then (txt, a_varDecls, a_preExp);
9515 end match;
9516 end fun_290;
9517
9518 public function daeExpCrefRhsXml
9519 input Tpl.Text in_txt;
9520 input DAE.Exp in_a_exp;
9521 input SimCodeFunction.Context in_a_context;
9522 input Tpl.Text in_a_preExp;
9523 input Tpl.Text in_a_varDecls;
9524
9525 output Tpl.Text out_txt;
9526 output Tpl.Text out_a_preExp;
9527 output Tpl.Text out_a_varDecls;
9528 algorithm
9529 (out_txt, out_a_preExp, out_a_varDecls) :=
9530 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
9531 local
9532 Tpl.Text txt;
9533 SimCodeFunction.Context a_context;
9534 Tpl.Text a_preExp;
9535 Tpl.Text a_varDecls;
9536 DAE.ComponentRef i_cr;
9537 DAE.Type i_t;
9538 DAE.Exp i_exp;
9539
9540 case ( txt,
9541 (i_exp as DAE.CREF(componentRef = i_cr, ty = (i_t as DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = _))))),
9542 a_context,
9543 a_preExp,
9544 a_varDecls )
9545 algorithm
9546 ✗ (txt, a_varDecls, a_preExp) := fun_290(txt, a_context, i_cr, i_t, a_varDecls, a_preExp, i_exp);
9547 ✗ then (txt, a_preExp, a_varDecls);
9548
9549 case ( txt,
9550 DAE.CREF(componentRef = i_cr, ty = DAE.T_FUNCTION_REFERENCE_FUNC(builtin = _)),
9551 _,
9552 a_preExp,
9553 a_varDecls )
9554 algorithm
9555 ✗ txt := crefFunctionNameXml(txt, i_cr);
9556 ✗ then (txt, a_preExp, a_varDecls);
9557
9558 case ( txt,
9559 DAE.CREF(componentRef = i_cr, ty = DAE.T_FUNCTION_REFERENCE_VAR(functionType = _)),
9560 _,
9561 a_preExp,
9562 a_varDecls )
9563 algorithm
9564 ✗ txt := crefStrXml(txt, i_cr);
9565 ✗ then (txt, a_preExp, a_varDecls);
9566
9567 case ( txt,
9568 i_exp,
9569 a_context,
9570 a_preExp,
9571 a_varDecls )
9572 algorithm
9573 202 (txt, a_preExp, a_varDecls) := daeExpCrefRhs2Xml(txt, i_exp, a_context, a_preExp, a_varDecls);
9574 then (txt, a_preExp, a_varDecls);
9575 end match;
9576 end daeExpCrefRhsXml;
9577
9578 protected function lm_292
9579 input output Tpl.Text txt;
9580 input list<DAE.Subscript> items;
9581 input output Tpl.Text a_varDecls;
9582 input output Tpl.Text a_preExp;
9583 input SimCodeFunction.Context a_context;
9584 algorithm
9585 ✗ for lstElt_292 in items loop
9586 (txt, a_varDecls, a_preExp) := match lstElt_292
9587 local
9588 DAE.Exp i_exp;
9589
9590 case DAE.INDEX(exp = i_exp)
9591 algorithm
9592 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_preExp, a_varDecls);
9593 ✗ txt := Tpl.nextIter(txt);
9594 ✗ then (txt, a_varDecls, a_preExp);
9595
9596 case _
9597 ✗ then (txt, a_varDecls, a_preExp);
9598 end match;
9599 end for;
9600 end lm_292;
9601
9602 protected function lm_293
9603 input output Tpl.Text txt;
9604 input list<DAE.Subscript> items;
9605 input output Tpl.Text a_varDecls;
9606 input output Tpl.Text a_preExp;
9607 input SimCodeFunction.Context a_context;
9608 algorithm
9609 ✗ for lstElt_293 in items loop
9610 (txt, a_varDecls, a_preExp) := match lstElt_293
9611 local
9612 DAE.Exp i_exp;
9613
9614 case DAE.INDEX(exp = i_exp)
9615 algorithm
9616 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_preExp, a_varDecls);
9617 ✗ txt := Tpl.nextIter(txt);
9618 ✗ then (txt, a_varDecls, a_preExp);
9619
9620 case _
9621 ✗ then (txt, a_varDecls, a_preExp);
9622 end match;
9623 end for;
9624 end lm_293;
9625
9626 protected function fun_294
9627 input Tpl.Text in_txt;
9628 input DAE.Type in_mArg;
9629 input DAE.Exp in_a_ecr;
9630 input Tpl.Text in_a_varDecls;
9631 input Tpl.Text in_a_preExp;
9632 input SimCodeFunction.Context in_a_context;
9633 input DAE.ComponentRef in_a_cr;
9634 input Tpl.Text in_a_arrName;
9635
9636 output Tpl.Text out_txt;
9637 output Tpl.Text out_a_varDecls;
9638 output Tpl.Text out_a_preExp;
9639 algorithm
9640 (out_txt, out_a_varDecls, out_a_preExp) :=
9641 match(in_txt, in_mArg, in_a_ecr, in_a_varDecls, in_a_preExp, in_a_context, in_a_cr, in_a_arrName)
9642 local
9643 Tpl.Text txt;
9644 DAE.Exp a_ecr;
9645 Tpl.Text a_varDecls;
9646 Tpl.Text a_preExp;
9647 SimCodeFunction.Context a_context;
9648 DAE.ComponentRef a_cr;
9649 Tpl.Text a_arrName;
9650 DAE.Dimensions i_et_dims;
9651 Tpl.Text txt_1;
9652 list<DAE.Subscript> ret_0;
9653
9654 case ( txt,
9655 DAE.T_ARRAY(dims = i_et_dims),
9656 _,
9657 a_varDecls,
9658 a_preExp,
9659 a_context,
9660 a_cr,
9661 a_arrName )
9662 algorithm
9663 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(&"));
9664 ✗ txt := Tpl.writeText(txt, a_arrName);
9665 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")["));
9666 ✗ ret_0 := ComponentReferenceBasics.crefSubs(a_cr);
9667 ✗ (txt, a_preExp, a_varDecls) := threadDimSubListXml(txt, i_et_dims, ret_0, a_context, a_preExp, a_varDecls);
9668 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("]"));
9669 ✗ then (txt, a_varDecls, a_preExp);
9670
9671 case ( txt,
9672 _,
9673 a_ecr,
9674 a_varDecls,
9675 a_preExp,
9676 _,
9677 _,
9678 _ )
9679 algorithm
9680 ✗ txt_1 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Indexing non-array "));
9681 ✗ txt_1 := ExpressionDumpTpl.dumpExp(txt_1, a_ecr, "\"");
9682 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2256, 28), Tpl.textString(txt_1));
9683 ✗ then (txt, a_varDecls, a_preExp);
9684 end match;
9685 end fun_294;
9686
9687 protected function fun_295
9688 input Tpl.Text in_txt;
9689 input SimCodeFunction.Context in_a_context;
9690 input DAE.Exp in_a_ecr;
9691 input Tpl.Text in_a_arrName;
9692 input Tpl.Text in_a_varDecls;
9693 input Tpl.Text in_a_preExp;
9694 input DAE.ComponentRef in_a_cr;
9695
9696 output Tpl.Text out_txt;
9697 output Tpl.Text out_a_varDecls;
9698 output Tpl.Text out_a_preExp;
9699 algorithm
9700 (out_txt, out_a_varDecls, out_a_preExp) :=
9701 match(in_txt, in_a_context, in_a_ecr, in_a_arrName, in_a_varDecls, in_a_preExp, in_a_cr)
9702 local
9703 Tpl.Text txt;
9704 DAE.Exp a_ecr;
9705 Tpl.Text a_arrName;
9706 Tpl.Text a_varDecls;
9707 Tpl.Text a_preExp;
9708 DAE.ComponentRef a_cr;
9709 SimCodeFunction.Context i_context;
9710 DAE.Type ret_2;
9711 list<DAE.Subscript> ret_1;
9712 Tpl.Text l_dimsValuesStr;
9713
9714 case ( txt,
9715 (i_context as SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _)),
9716 _,
9717 a_arrName,
9718 a_varDecls,
9719 a_preExp,
9720 a_cr )
9721 algorithm
9722 ✗ ret_1 := ComponentReferenceBasics.crefSubs(a_cr);
9723 ✗ l_dimsValuesStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING_LIST({
9724 "\n",
9725 " "
9726 }, false)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
9727 ✗ (l_dimsValuesStr, a_varDecls, a_preExp) := lm_293(l_dimsValuesStr, ret_1, a_varDecls, a_preExp, i_context);
9728 ✗ l_dimsValuesStr := Tpl.popIter(l_dimsValuesStr);
9729 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Identifier>\n"));
9730 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
9731 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
9732 ✗ txt := Tpl.writeText(txt, a_arrName);
9733 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
9734 "\">\n",
9735 " <exp:ArraySubscripts>\n",
9736 " <exp:IndexExpression>\n"
9737 }, true));
9738 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
9739 ✗ txt := Tpl.writeText(txt, l_dimsValuesStr);
9740 ✗ txt := Tpl.softNewLine(txt);
9741 ✗ txt := Tpl.popBlock(txt);
9742 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
9743 " </exp:IndexExpression>\n",
9744 " </exp:ArraySubscripts>\n",
9745 "</exp:QualifiedNamePart>\n"
9746 }, true));
9747 ✗ txt := Tpl.popBlock(txt);
9748 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Identifier>"));
9749 ✗ then (txt, a_varDecls, a_preExp);
9750
9751 case ( txt,
9752 i_context,
9753 a_ecr,
9754 a_arrName,
9755 a_varDecls,
9756 a_preExp,
9757 a_cr )
9758 algorithm
9759 ✗ ret_2 := ComponentReference.crefLastType(a_cr);
9760 ✗ (txt, a_varDecls, a_preExp) := fun_294(txt, ret_2, a_ecr, a_varDecls, a_preExp, i_context, a_cr, a_arrName);
9761 then (txt, a_varDecls, a_preExp);
9762 end match;
9763 end fun_295;
9764
9765 protected function fun_296
9766 input Tpl.Text in_txt;
9767 input String in_mArg;
9768 input DAE.Exp in_a_ecr;
9769 input Tpl.Text in_a_arrName;
9770 input Tpl.Text in_a_varDecls;
9771 input Tpl.Text in_a_preExp;
9772 input SimCodeFunction.Context in_a_context;
9773 input DAE.ComponentRef in_a_cr;
9774
9775 output Tpl.Text out_txt;
9776 output Tpl.Text out_a_varDecls;
9777 output Tpl.Text out_a_preExp;
9778 algorithm
9779 (out_txt, out_a_varDecls, out_a_preExp) :=
9780 match(in_txt, in_mArg, in_a_ecr, in_a_arrName, in_a_varDecls, in_a_preExp, in_a_context, in_a_cr)
9781 local
9782 Tpl.Text txt;
9783 DAE.Exp a_ecr;
9784 Tpl.Text a_arrName;
9785 Tpl.Text a_varDecls;
9786 Tpl.Text a_preExp;
9787 SimCodeFunction.Context a_context;
9788 DAE.ComponentRef a_cr;
9789 list<DAE.Subscript> ret_1;
9790 Tpl.Text l_dimsValuesStr;
9791
9792 case ( txt,
9793 "metatype_array",
9794 _,
9795 a_arrName,
9796 a_varDecls,
9797 a_preExp,
9798 a_context,
9799 a_cr )
9800 algorithm
9801 ✗ ret_1 := ComponentReferenceBasics.crefSubs(a_cr);
9802 ✗ l_dimsValuesStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
9803 ✗ (l_dimsValuesStr, a_varDecls, a_preExp) := lm_292(l_dimsValuesStr, ret_1, a_varDecls, a_preExp, a_context);
9804 ✗ l_dimsValuesStr := Tpl.popIter(l_dimsValuesStr);
9805 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("arrayGet("));
9806 ✗ txt := Tpl.writeText(txt, a_arrName);
9807 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(","));
9808 ✗ txt := Tpl.writeText(txt, l_dimsValuesStr);
9809 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") /* DAE.CREF */"));
9810 ✗ then (txt, a_varDecls, a_preExp);
9811
9812 case ( txt,
9813 _,
9814 a_ecr,
9815 a_arrName,
9816 a_varDecls,
9817 a_preExp,
9818 a_context,
9819 a_cr )
9820 algorithm
9821 ✗ (txt, a_varDecls, a_preExp) := fun_295(txt, a_context, a_ecr, a_arrName, a_varDecls, a_preExp, a_cr);
9822 then (txt, a_varDecls, a_preExp);
9823 end match;
9824 end fun_296;
9825
9826 protected function fun_297
9827 input Tpl.Text in_txt;
9828 input Boolean in_mArg;
9829 input DAE.Exp in_a_ecr;
9830 input Tpl.Text in_a_preExp;
9831 input Tpl.Text in_a_varDecls;
9832 input DAE.Type in_a_ty;
9833 input SimCodeFunction.Context in_a_context;
9834 input DAE.ComponentRef in_a_cr;
9835
9836 output Tpl.Text out_txt;
9837 output Tpl.Text out_a_preExp;
9838 output Tpl.Text out_a_varDecls;
9839 algorithm
9840 (out_txt, out_a_preExp, out_a_varDecls) :=
9841 match(in_txt, in_mArg, in_a_ecr, in_a_preExp, in_a_varDecls, in_a_ty, in_a_context, in_a_cr)
9842 local
9843 Tpl.Text txt;
9844 DAE.Exp a_ecr;
9845 Tpl.Text a_preExp;
9846 Tpl.Text a_varDecls;
9847 DAE.Type a_ty;
9848 SimCodeFunction.Context a_context;
9849 DAE.ComponentRef a_cr;
9850 String str_9;
9851 Integer ret_8;
9852 list<DAE.Subscript> ret_7;
9853 Tpl.Text l_dimsLenStr;
9854 DAE.ComponentRef ret_5;
9855 list<DAE.Subscript> ret_4;
9856 Tpl.Text l_spec1;
9857 Tpl.Text l_tmp;
9858 Tpl.Text l_arrayType;
9859 Tpl.Text l_arrName;
9860
9861 case ( txt,
9862 false,
9863 _,
9864 a_preExp,
9865 a_varDecls,
9866 a_ty,
9867 a_context,
9868 a_cr )
9869 algorithm
9870 ✗ l_arrName := contextArrayCrefXml(Tpl.emptyTxt, a_cr, a_context);
9871 ✗ l_arrayType := expTypeArrayXml(Tpl.emptyTxt, a_ty);
9872 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arrayType), a_varDecls);
9873 ✗ ret_4 := ComponentReferenceBasics.crefSubs(a_cr);
9874 ✗ (l_spec1, a_preExp, a_varDecls) := daeExpCrefRhsIndexSpecXml(Tpl.emptyTxt, ret_4, a_context, a_preExp, a_varDecls);
9875 ✗ a_preExp := Tpl.writeText(a_preExp, l_arrName);
9876 ✗ a_preExp := Tpl.softNewLine(a_preExp);
9877 ✗ a_preExp := Tpl.writeText(a_preExp, l_spec1);
9878 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
9879 ✗ txt := Tpl.writeText(txt, l_tmp);
9880 ✗ then (txt, a_preExp, a_varDecls);
9881
9882 case ( txt,
9883 _,
9884 a_ecr,
9885 a_preExp,
9886 a_varDecls,
9887 a_ty,
9888 a_context,
9889 a_cr )
9890 algorithm
9891 ✗ ret_5 := ComponentReferenceBasics.crefStripLastSubs(a_cr);
9892 ✗ l_arrName := contextCrefXml(Tpl.emptyTxt, ret_5, a_context);
9893 ✗ l_arrayType := expTypeArrayXml(Tpl.emptyTxt, a_ty);
9894 ✗ ret_7 := ComponentReferenceBasics.crefSubs(a_cr);
9895 ✗ ret_8 := listLength(ret_7);
9896 ✗ l_dimsLenStr := Tpl.writeStr(Tpl.emptyTxt, intString(ret_8));
9897 ✗ str_9 := Tpl.textString(l_arrayType);
9898 ✗ (txt, a_varDecls, a_preExp) := fun_296(txt, str_9, a_ecr, l_arrName, a_varDecls, a_preExp, a_context, a_cr);
9899 ✗ then (txt, a_preExp, a_varDecls);
9900 end match;
9901 end fun_297;
9902
9903 protected function fun_298
9904 input Tpl.Text in_txt;
9905 input Boolean in_mArg;
9906 input DAE.ComponentRef in_a_ecr_componentRef;
9907 input DAE.Exp in_a_ecr;
9908 input Tpl.Text in_a_preExp;
9909 input Tpl.Text in_a_varDecls;
9910 input DAE.Type in_a_ty;
9911 input SimCodeFunction.Context in_a_context;
9912 input DAE.ComponentRef in_a_cr;
9913
9914 output Tpl.Text out_txt;
9915 output Tpl.Text out_a_preExp;
9916 output Tpl.Text out_a_varDecls;
9917 algorithm
9918 (out_txt, out_a_preExp, out_a_varDecls) :=
9919 match(in_txt, in_mArg, in_a_ecr_componentRef, in_a_ecr, in_a_preExp, in_a_varDecls, in_a_ty, in_a_context, in_a_cr)
9920 local
9921 Tpl.Text txt;
9922 DAE.ComponentRef a_ecr_componentRef;
9923 DAE.Exp a_ecr;
9924 Tpl.Text a_preExp;
9925 Tpl.Text a_varDecls;
9926 DAE.Type a_ty;
9927 SimCodeFunction.Context a_context;
9928 DAE.ComponentRef a_cr;
9929 Boolean ret_0;
9930
9931 case ( txt,
9932 false,
9933 _,
9934 a_ecr,
9935 a_preExp,
9936 a_varDecls,
9937 a_ty,
9938 a_context,
9939 a_cr )
9940 algorithm
9941 ✗ ret_0 := SimCodeFunctionUtil.crefSubIsScalar(a_cr);
9942 ✗ (txt, a_preExp, a_varDecls) := fun_297(txt, ret_0, a_ecr, a_preExp, a_varDecls, a_ty, a_context, a_cr);
9943 then (txt, a_preExp, a_varDecls);
9944
9945 case ( txt,
9946 _,
9947 a_ecr_componentRef,
9948 _,
9949 a_preExp,
9950 a_varDecls,
9951 _,
9952 _,
9953 _ )
9954 algorithm
9955 202 txt := crefXml(txt, a_ecr_componentRef);
9956 202 then (txt, a_preExp, a_varDecls);
9957 end match;
9958 end fun_298;
9959
9960 protected function fun_299
9961 input Tpl.Text in_txt;
9962 input Boolean in_mArg;
9963 input Tpl.Text in_a_box;
9964 input DAE.ComponentRef in_a_ecr_componentRef;
9965 input DAE.Exp in_a_ecr;
9966 input Tpl.Text in_a_preExp;
9967 input Tpl.Text in_a_varDecls;
9968 input DAE.Type in_a_ty;
9969 input SimCodeFunction.Context in_a_context;
9970 input DAE.ComponentRef in_a_cr;
9971
9972 output Tpl.Text out_txt;
9973 output Tpl.Text out_a_preExp;
9974 output Tpl.Text out_a_varDecls;
9975 algorithm
9976 (out_txt, out_a_preExp, out_a_varDecls) :=
9977 match(in_txt, in_mArg, in_a_box, in_a_ecr_componentRef, in_a_ecr, in_a_preExp, in_a_varDecls, in_a_ty, in_a_context, in_a_cr)
9978 local
9979 Tpl.Text txt;
9980 Tpl.Text a_box;
9981 DAE.ComponentRef a_ecr_componentRef;
9982 DAE.Exp a_ecr;
9983 Tpl.Text a_preExp;
9984 Tpl.Text a_varDecls;
9985 DAE.Type a_ty;
9986 SimCodeFunction.Context a_context;
9987 DAE.ComponentRef a_cr;
9988 Boolean ret_0;
9989
9990 case ( txt,
9991 true,
9992 _,
9993 a_ecr_componentRef,
9994 a_ecr,
9995 a_preExp,
9996 a_varDecls,
9997 a_ty,
9998 a_context,
9999 a_cr )
10000 algorithm
10001 202 ret_0 := SimCodeFunctionUtil.crefIsScalar(a_cr, a_context);
10002 202 (txt, a_preExp, a_varDecls) := fun_298(txt, ret_0, a_ecr_componentRef, a_ecr, a_preExp, a_varDecls, a_ty, a_context, a_cr);
10003 then (txt, a_preExp, a_varDecls);
10004
10005 case ( txt,
10006 _,
10007 a_box,
10008 _,
10009 _,
10010 a_preExp,
10011 a_varDecls,
10012 _,
10013 _,
10014 _ )
10015 algorithm
10016 ✗ txt := Tpl.writeText(txt, a_box);
10017 ✗ then (txt, a_preExp, a_varDecls);
10018 end match;
10019 end fun_299;
10020
10021 public function daeExpCrefRhs2Xml
10022 input Tpl.Text in_txt;
10023 input DAE.Exp in_a_ecr;
10024 input SimCodeFunction.Context in_a_context;
10025 input Tpl.Text in_a_preExp;
10026 input Tpl.Text in_a_varDecls;
10027
10028 output Tpl.Text out_txt;
10029 output Tpl.Text out_a_preExp;
10030 output Tpl.Text out_a_varDecls;
10031 algorithm
10032 (out_txt, out_a_preExp, out_a_varDecls) :=
10033 match(in_txt, in_a_ecr, in_a_context, in_a_preExp, in_a_varDecls)
10034 local
10035 Tpl.Text txt;
10036 SimCodeFunction.Context a_context;
10037 Tpl.Text a_preExp;
10038 Tpl.Text a_varDecls;
10039 DAE.ComponentRef i_ecr_componentRef;
10040 DAE.Type i_ty;
10041 DAE.ComponentRef i_cr;
10042 DAE.Exp i_ecr;
10043 Tpl.Text txt_2;
10044 Boolean ret_1;
10045 Tpl.Text l_box;
10046
10047 case ( txt,
10048 (i_ecr as DAE.CREF(componentRef = (i_ecr_componentRef as i_cr), ty = i_ty)),
10049 a_context,
10050 a_preExp,
10051 a_varDecls )
10052 algorithm
10053 202 (l_box, a_preExp, a_varDecls) := daeExpCrefRhsArrayBoxXml(Tpl.emptyTxt, i_ecr, a_context, a_preExp, a_varDecls);
10054 202 ret_1 := Tpl.isEmpty(l_box);
10055 202 (txt, a_preExp, a_varDecls) := fun_299(txt, ret_1, l_box, i_ecr_componentRef, i_ecr, a_preExp, a_varDecls, i_ty, a_context, i_cr);
10056 then (txt, a_preExp, a_varDecls);
10057
10058 case ( txt,
10059 i_ecr,
10060 _,
10061 a_preExp,
10062 a_varDecls )
10063 algorithm
10064 ✗ txt_2 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("daeExpCrefRhs2: UNHANDLED EXPRESSION: "));
10065 ✗ txt_2 := ExpressionDumpTpl.dumpExp(txt_2, i_ecr, "\"");
10066 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2273, 11), Tpl.textString(txt_2));
10067 ✗ then (txt, a_preExp, a_varDecls);
10068 end match;
10069 end daeExpCrefRhs2Xml;
10070
10071 protected function fun_301
10072 input Tpl.Text in_txt;
10073 input DAE.Dimension in_a_dim;
10074
10075 output Tpl.Text out_txt;
10076 algorithm
10077 out_txt :=
10078 match(in_txt, in_a_dim)
10079 local
10080 Tpl.Text txt;
10081 Integer i_size;
10082 Integer i_integer;
10083
10084 case ( txt,
10085 DAE.DIM_INTEGER(integer = i_integer) )
10086 algorithm
10087 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*"));
10088 ✗ txt := Tpl.writeStr(txt, intString(i_integer));
10089 then txt;
10090
10091 case ( txt,
10092 DAE.DIM_ENUM(size = i_size) )
10093 algorithm
10094 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*"));
10095 ✗ txt := Tpl.writeStr(txt, intString(i_size));
10096 then txt;
10097
10098 case ( txt,
10099 _ )
10100 algorithm
10101 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2292, 22), "Non-constant dimension in simulation context");
10102 then txt;
10103 end match;
10104 end fun_301;
10105
10106 protected function lm_302
10107 input output Tpl.Text txt;
10108 input list<DAE.Dimension> items;
10109 algorithm
10110 ✗ for lstElt_302 in items loop
10111 txt := match lstElt_302
10112 local
10113 DAE.Dimension i_dim;
10114
10115 case i_dim
10116 algorithm
10117 ✗ txt := fun_301(txt, i_dim);
10118 then txt;
10119 end match;
10120 end for;
10121 end lm_302;
10122
10123 protected function fun_303
10124 input Tpl.Text in_txt;
10125 input list<DAE.Subscript> in_a_subrest;
10126 input Tpl.Text in_a_varDecls;
10127 input Tpl.Text in_a_preExp;
10128 input SimCodeFunction.Context in_a_context;
10129 input list<DAE.Dimension> in_a_dimrest;
10130
10131 output Tpl.Text out_txt;
10132 output Tpl.Text out_a_varDecls;
10133 output Tpl.Text out_a_preExp;
10134 algorithm
10135 (out_txt, out_a_varDecls, out_a_preExp) :=
10136 match(in_txt, in_a_subrest, in_a_varDecls, in_a_preExp, in_a_context, in_a_dimrest)
10137 local
10138 Tpl.Text txt;
10139 Tpl.Text a_varDecls;
10140 Tpl.Text a_preExp;
10141 SimCodeFunction.Context a_context;
10142 list<DAE.Dimension> a_dimrest;
10143 list<DAE.Subscript> i_subrest;
10144
10145 case ( txt,
10146 {},
10147 a_varDecls,
10148 a_preExp,
10149 _,
10150 _ )
10151 then (txt, a_varDecls, a_preExp);
10152
10153 case ( txt,
10154 i_subrest,
10155 a_varDecls,
10156 a_preExp,
10157 a_context,
10158 a_dimrest )
10159 algorithm
10160 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("+"));
10161 ✗ (txt, a_preExp, a_varDecls) := threadDimSubListXml(txt, a_dimrest, i_subrest, a_context, a_preExp, a_varDecls);
10162 ✗ then (txt, a_varDecls, a_preExp);
10163 end match;
10164 end fun_303;
10165
10166 protected function fun_304
10167 input Tpl.Text in_txt;
10168 input list<DAE.Dimension> in_a_dims;
10169 input list<DAE.Subscript> in_a_subrest;
10170 input Tpl.Text in_a_varDecls;
10171 input Tpl.Text in_a_preExp;
10172 input SimCodeFunction.Context in_a_context;
10173 input DAE.Exp in_a_sub_exp;
10174
10175 output Tpl.Text out_txt;
10176 output Tpl.Text out_a_varDecls;
10177 output Tpl.Text out_a_preExp;
10178 algorithm
10179 (out_txt, out_a_varDecls, out_a_preExp) :=
10180 match(in_txt, in_a_dims, in_a_subrest, in_a_varDecls, in_a_preExp, in_a_context, in_a_sub_exp)
10181 local
10182 Tpl.Text txt;
10183 list<DAE.Subscript> a_subrest;
10184 Tpl.Text a_varDecls;
10185 Tpl.Text a_preExp;
10186 SimCodeFunction.Context a_context;
10187 DAE.Exp a_sub_exp;
10188 list<DAE.Dimension> i_dimrest;
10189 Tpl.Text l_estr;
10190
10191 case ( txt,
10192 _ :: i_dimrest,
10193 a_subrest,
10194 a_varDecls,
10195 a_preExp,
10196 a_context,
10197 a_sub_exp )
10198 algorithm
10199 ✗ (l_estr, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_sub_exp, a_context, a_preExp, a_varDecls);
10200 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(("));
10201 ✗ txt := Tpl.writeText(txt, l_estr);
10202 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
10203 ✗ txt := lm_302(txt, i_dimrest);
10204 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
10205 ✗ (txt, a_varDecls, a_preExp) := fun_303(txt, a_subrest, a_varDecls, a_preExp, a_context, i_dimrest);
10206 then (txt, a_varDecls, a_preExp);
10207
10208 case ( txt,
10209 _,
10210 _,
10211 a_varDecls,
10212 a_preExp,
10213 _,
10214 _ )
10215 algorithm
10216 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2294, 18), "Less subscripts that dimensions in indexing cref? That\'s odd!");
10217 ✗ then (txt, a_varDecls, a_preExp);
10218 end match;
10219 end fun_304;
10220
10221 protected function fun_305
10222 input Tpl.Text in_txt;
10223 input list<DAE.Subscript> in_a_subs;
10224 input list<DAE.Dimension> in_a_dims;
10225 input SimCodeFunction.Context in_a_context;
10226 input Tpl.Text in_a_preExp;
10227 input Tpl.Text in_a_varDecls;
10228
10229 output Tpl.Text out_txt;
10230 output Tpl.Text out_a_preExp;
10231 output Tpl.Text out_a_varDecls;
10232 algorithm
10233 (out_txt, out_a_preExp, out_a_varDecls) :=
10234 match(in_txt, in_a_subs, in_a_dims, in_a_context, in_a_preExp, in_a_varDecls)
10235 local
10236 Tpl.Text txt;
10237 list<DAE.Dimension> a_dims;
10238 SimCodeFunction.Context a_context;
10239 Tpl.Text a_preExp;
10240 Tpl.Text a_varDecls;
10241 list<DAE.Subscript> i_subrest;
10242 DAE.Exp i_sub_exp;
10243
10244 case ( txt,
10245 {},
10246 _,
10247 _,
10248 a_preExp,
10249 a_varDecls )
10250 algorithm
10251 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2280, 22), "Empty dimensions in indexing cref?");
10252 then (txt, a_preExp, a_varDecls);
10253
10254 case ( txt,
10255 DAE.INDEX(exp = i_sub_exp) :: i_subrest,
10256 a_dims,
10257 a_context,
10258 a_preExp,
10259 a_varDecls )
10260 algorithm
10261 ✗ (txt, a_varDecls, a_preExp) := fun_304(txt, a_dims, i_subrest, a_varDecls, a_preExp, a_context, i_sub_exp);
10262 ✗ then (txt, a_preExp, a_varDecls);
10263
10264 case ( txt,
10265 _,
10266 _,
10267 _,
10268 a_preExp,
10269 a_varDecls )
10270 algorithm
10271 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2295, 14), "Non-index subscript in indexing cref? That\'s odd!");
10272 then (txt, a_preExp, a_varDecls);
10273 end match;
10274 end fun_305;
10275
10276 public function threadDimSubListXml
10277 input Tpl.Text txt;
10278 input list<DAE.Dimension> a_dims;
10279 input list<DAE.Subscript> a_subs;
10280 input SimCodeFunction.Context a_context;
10281 input Tpl.Text a_preExp;
10282 input Tpl.Text a_varDecls;
10283
10284 output Tpl.Text out_txt;
10285 output Tpl.Text out_a_preExp;
10286 output Tpl.Text out_a_varDecls;
10287 algorithm
10288 ✗ (out_txt, out_a_preExp, out_a_varDecls) := fun_305(txt, a_subs, a_dims, a_context, a_preExp, a_varDecls);
10289 end threadDimSubListXml;
10290
10291 protected function fun_307
10292 input Tpl.Text in_txt;
10293 input DAE.Subscript in_a_sub;
10294 input Tpl.Text in_a_varDecls;
10295 input Tpl.Text in_a_preExp;
10296 input SimCodeFunction.Context in_a_context;
10297
10298 output Tpl.Text out_txt;
10299 output Tpl.Text out_a_varDecls;
10300 output Tpl.Text out_a_preExp;
10301 algorithm
10302 (out_txt, out_a_varDecls, out_a_preExp) :=
10303 match(in_txt, in_a_sub, in_a_varDecls, in_a_preExp, in_a_context)
10304 local
10305 Tpl.Text txt;
10306 Tpl.Text a_varDecls;
10307 Tpl.Text a_preExp;
10308 SimCodeFunction.Context a_context;
10309 DAE.Exp i_exp;
10310 Tpl.Text l_tmp;
10311 Tpl.Text l_str;
10312 Tpl.Text l_expPart;
10313
10314 case ( txt,
10315 DAE.INDEX(exp = i_exp),
10316 a_varDecls,
10317 a_preExp,
10318 a_context )
10319 algorithm
10320 ✗ (l_expPart, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
10321 ✗ l_str := Tpl.writeText(Tpl.emptyTxt, l_expPart);
10322 ✗ txt := Tpl.writeText(txt, l_str);
10323 ✗ then (txt, a_varDecls, a_preExp);
10324
10325 case ( txt,
10326 DAE.WHOLEDIM(),
10327 a_varDecls,
10328 a_preExp,
10329 _ )
10330 algorithm
10331 ✗ l_str := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("(1), (int*)0, \'W\'"));
10332 ✗ txt := Tpl.writeText(txt, l_str);
10333 ✗ then (txt, a_varDecls, a_preExp);
10334
10335 case ( txt,
10336 DAE.SLICE(exp = i_exp),
10337 a_varDecls,
10338 a_preExp,
10339 a_context )
10340 algorithm
10341 ✗ (l_expPart, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
10342 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_integer", a_varDecls);
10343 ✗ a_preExp := Tpl.writeText(a_preExp, l_tmp);
10344 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(" = size_of_dimension_integer_array(&"));
10345 ✗ a_preExp := Tpl.writeText(a_preExp, l_expPart);
10346 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", 1);"));
10347 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
10348 ✗ l_str := Tpl.writeText(Tpl.emptyTxt, l_tmp);
10349 ✗ l_str := Tpl.writeTok(l_str, Tpl.ST_STRING(", integer_array_make_index_array("));
10350 ✗ l_str := Tpl.writeText(l_str, l_expPart);
10351 ✗ l_str := Tpl.writeTok(l_str, Tpl.ST_STRING("), \'A\'"));
10352 ✗ txt := Tpl.writeText(txt, l_str);
10353 ✗ then (txt, a_varDecls, a_preExp);
10354
10355 case ( txt,
10356 _,
10357 a_varDecls,
10358 a_preExp,
10359 _ )
10360 then (txt, a_varDecls, a_preExp);
10361 end match;
10362 end fun_307;
10363
10364 protected function lm_308
10365 input output Tpl.Text txt;
10366 input list<DAE.Subscript> items;
10367 input output Tpl.Text a_varDecls;
10368 input output Tpl.Text a_preExp;
10369 input SimCodeFunction.Context a_context;
10370 algorithm
10371 ✗ for lstElt_308 in items loop
10372 (txt, a_varDecls, a_preExp) := match lstElt_308
10373 local
10374 DAE.Subscript i_sub;
10375
10376 case i_sub
10377 algorithm
10378 ✗ (txt, a_varDecls, a_preExp) := fun_307(txt, i_sub, a_varDecls, a_preExp, a_context);
10379 ✗ txt := Tpl.nextIter(txt);
10380 then (txt, a_varDecls, a_preExp);
10381 end match;
10382 end for;
10383 end lm_308;
10384
10385 public function daeExpCrefRhsIndexSpecXml
10386 input Tpl.Text txt;
10387 input list<DAE.Subscript> a_subs;
10388 input SimCodeFunction.Context a_context;
10389 input Tpl.Text a_preExp;
10390 input Tpl.Text a_varDecls;
10391
10392 output Tpl.Text out_txt;
10393 output Tpl.Text out_a_preExp;
10394 output Tpl.Text out_a_varDecls;
10395 protected
10396 Tpl.Text l_tmp;
10397 Tpl.Text l_idx__str;
10398 Integer ret_1;
10399 Tpl.Text l_nridx__str;
10400 algorithm
10401 ✗ ret_1 := listLength(a_subs);
10402 ✗ l_nridx__str := Tpl.writeStr(Tpl.emptyTxt, intString(ret_1));
10403 ✗ l_idx__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
10404 ✗ (l_idx__str, out_a_varDecls, out_a_preExp) := lm_308(l_idx__str, a_subs, a_varDecls, a_preExp, a_context);
10405 ✗ l_idx__str := Tpl.popIter(l_idx__str);
10406 ✗ (l_tmp, out_a_varDecls) := tempDeclXml(Tpl.emptyTxt, "index_spec_t", out_a_varDecls);
10407 ✗ out_a_preExp := Tpl.writeTok(out_a_preExp, Tpl.ST_STRING("create_index_spec(&"));
10408 ✗ out_a_preExp := Tpl.writeText(out_a_preExp, l_tmp);
10409 ✗ out_a_preExp := Tpl.writeTok(out_a_preExp, Tpl.ST_STRING(", "));
10410 ✗ out_a_preExp := Tpl.writeText(out_a_preExp, l_nridx__str);
10411 ✗ out_a_preExp := Tpl.writeTok(out_a_preExp, Tpl.ST_STRING(", "));
10412 ✗ out_a_preExp := Tpl.writeText(out_a_preExp, l_idx__str);
10413 ✗ out_a_preExp := Tpl.writeTok(out_a_preExp, Tpl.ST_STRING(");"));
10414 ✗ out_a_preExp := Tpl.writeTok(out_a_preExp, Tpl.ST_NEW_LINE());
10415 ✗ out_txt := Tpl.writeText(txt, l_tmp);
10416 end daeExpCrefRhsIndexSpecXml;
10417
10418 protected function lm_310
10419 input output Tpl.Text txt;
10420 input DAE.Dimensions items;
10421 algorithm
10422 ✗ for lstElt_310 in items loop
10423 txt := match lstElt_310
10424 local
10425 DAE.Dimension i_dim;
10426
10427 case i_dim
10428 algorithm
10429 ✗ txt := dimensionXml(txt, i_dim);
10430 ✗ txt := Tpl.nextIter(txt);
10431 then txt;
10432 end match;
10433 end for;
10434 end lm_310;
10435
10436 protected function fun_311
10437 input Tpl.Text in_txt;
10438 input SimCodeFunction.Context in_a_context;
10439 input DAE.ComponentRef in_a_ecr_componentRef;
10440 input Tpl.Text in_a_preExp;
10441 input DAE.Dimensions in_a_dims;
10442 input Tpl.Text in_a_varDecls;
10443 input DAE.Type in_a_aty;
10444
10445 output Tpl.Text out_txt;
10446 output Tpl.Text out_a_preExp;
10447 output Tpl.Text out_a_varDecls;
10448 algorithm
10449 (out_txt, out_a_preExp, out_a_varDecls) :=
10450 match(in_txt, in_a_context, in_a_ecr_componentRef, in_a_preExp, in_a_dims, in_a_varDecls, in_a_aty)
10451 local
10452 Tpl.Text txt;
10453 DAE.ComponentRef a_ecr_componentRef;
10454 Tpl.Text a_preExp;
10455 DAE.Dimensions a_dims;
10456 Tpl.Text a_varDecls;
10457 DAE.Type a_aty;
10458 Tpl.Text l_type;
10459 Tpl.Text l_dimsValuesStr;
10460 Integer ret_3;
10461 Tpl.Text l_dimsLenStr;
10462 Tpl.Text txt_1;
10463 Tpl.Text l_tmpArr;
10464
10465 case ( txt,
10466 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
10467 _,
10468 a_preExp,
10469 _,
10470 a_varDecls,
10471 _ )
10472 then (txt, a_preExp, a_varDecls);
10473
10474 case ( txt,
10475 _,
10476 a_ecr_componentRef,
10477 a_preExp,
10478 a_dims,
10479 a_varDecls,
10480 a_aty )
10481 algorithm
10482 ✗ txt_1 := expTypeArrayXml(Tpl.emptyTxt, a_aty);
10483 ✗ (l_tmpArr, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(txt_1), a_varDecls);
10484 ✗ ret_3 := listLength(a_dims);
10485 ✗ l_dimsLenStr := Tpl.writeStr(Tpl.emptyTxt, intString(ret_3));
10486 ✗ l_dimsValuesStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
10487 ✗ l_dimsValuesStr := lm_310(l_dimsValuesStr, a_dims);
10488 ✗ l_dimsValuesStr := Tpl.popIter(l_dimsValuesStr);
10489 ✗ l_type := expTypeShortXml(Tpl.emptyTxt, a_aty);
10490 ✗ a_preExp := arrayCrefXmlStr(a_preExp, a_ecr_componentRef);
10491 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
10492 ✗ txt := Tpl.writeText(txt, l_tmpArr);
10493 ✗ then (txt, a_preExp, a_varDecls);
10494 end match;
10495 end fun_311;
10496
10497 public function daeExpCrefRhsArrayBoxXml
10498 input Tpl.Text in_txt;
10499 input DAE.Exp in_a_ecr;
10500 input SimCodeFunction.Context in_a_context;
10501 input Tpl.Text in_a_preExp;
10502 input Tpl.Text in_a_varDecls;
10503
10504 output Tpl.Text out_txt;
10505 output Tpl.Text out_a_preExp;
10506 output Tpl.Text out_a_varDecls;
10507 algorithm
10508 (out_txt, out_a_preExp, out_a_varDecls) :=
10509 match(in_txt, in_a_ecr, in_a_context, in_a_preExp, in_a_varDecls)
10510 local
10511 Tpl.Text txt;
10512 SimCodeFunction.Context a_context;
10513 Tpl.Text a_preExp;
10514 Tpl.Text a_varDecls;
10515 DAE.ComponentRef i_ecr_componentRef;
10516 DAE.Dimensions i_dims;
10517 DAE.Type i_aty;
10518
10519 case ( txt,
10520 DAE.CREF(ty = DAE.T_ARRAY(ty = i_aty, dims = i_dims), componentRef = i_ecr_componentRef),
10521 a_context,
10522 a_preExp,
10523 a_varDecls )
10524 algorithm
10525 ✗ (txt, a_preExp, a_varDecls) := fun_311(txt, a_context, i_ecr_componentRef, a_preExp, i_dims, a_varDecls, i_aty);
10526 then (txt, a_preExp, a_varDecls);
10527
10528 case ( txt,
10529 _,
10530 _,
10531 a_preExp,
10532 a_varDecls )
10533 202 then (txt, a_preExp, a_varDecls);
10534 end match;
10535 end daeExpCrefRhsArrayBoxXml;
10536
10537 protected function lm_313
10538 input output Tpl.Text txt;
10539 input list<DAE.Var> items;
10540 input output Tpl.Text a_varDecls;
10541 input output Tpl.Text a_preExp;
10542 input SimCodeFunction.Context a_context;
10543 input DAE.ComponentRef a_cr;
10544 algorithm
10545 ✗ for lstElt_313 in items loop
10546 (txt, a_varDecls, a_preExp) := match lstElt_313
10547 local
10548 DAE.Var i_v;
10549 DAE.Exp ret_0;
10550
10551 case i_v
10552 algorithm
10553 ✗ ret_0 := SimCodeFunctionUtil.makeCrefRecordExp(a_cr, i_v);
10554 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, ret_0, a_context, a_preExp, a_varDecls);
10555 ✗ txt := Tpl.nextIter(txt);
10556 then (txt, a_varDecls, a_preExp);
10557 end match;
10558 end for;
10559 end lm_313;
10560
10561 public function daeExpRecordCrefRhsXml
10562 input Tpl.Text in_txt;
10563 input DAE.Type in_a_ty;
10564 input DAE.ComponentRef in_a_cr;
10565 input SimCodeFunction.Context in_a_context;
10566 input Tpl.Text in_a_preExp;
10567 input Tpl.Text in_a_varDecls;
10568
10569 output Tpl.Text out_txt;
10570 output Tpl.Text out_a_preExp;
10571 output Tpl.Text out_a_varDecls;
10572 algorithm
10573 (out_txt, out_a_preExp, out_a_varDecls) :=
10574 match(in_txt, in_a_ty, in_a_cr, in_a_context, in_a_preExp, in_a_varDecls)
10575 local
10576 Tpl.Text txt;
10577 DAE.ComponentRef a_cr;
10578 SimCodeFunction.Context a_context;
10579 Tpl.Text a_preExp;
10580 Tpl.Text a_varDecls;
10581 list<DAE.Var> i_var__lst;
10582 Tpl.Text l_vars;
10583
10584 case ( txt,
10585 DAE.T_COMPLEX(complexClassType = _, varLst = i_var__lst),
10586 a_cr,
10587 a_context,
10588 a_preExp,
10589 a_varDecls )
10590 algorithm
10591 ✗ l_vars := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING_LIST({
10592 "\n",
10593 " "
10594 }, false)), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
10595 ✗ (l_vars, a_varDecls, a_preExp) := lm_313(l_vars, i_var__lst, a_varDecls, a_preExp, a_context, a_cr);
10596 ✗ l_vars := Tpl.popIter(l_vars);
10597 ✗ txt := Tpl.writeText(txt, l_vars);
10598 ✗ then (txt, a_preExp, a_varDecls);
10599
10600 case ( txt,
10601 _,
10602 _,
10603 _,
10604 a_preExp,
10605 a_varDecls )
10606 then (txt, a_preExp, a_varDecls);
10607 end match;
10608 end daeExpRecordCrefRhsXml;
10609
10610 protected function fun_315
10611 input Tpl.Text in_txt;
10612 input SimCodeFunction.Context in_a_context;
10613 input DAE.ComponentRef in_a_cr;
10614 input DAE.Type in_a_t;
10615 input Tpl.Text in_a_varDecls;
10616 input Tpl.Text in_a_afterExp;
10617 input DAE.Exp in_a_exp;
10618
10619 output Tpl.Text out_txt;
10620 output Tpl.Text out_a_varDecls;
10621 output Tpl.Text out_a_afterExp;
10622 algorithm
10623 (out_txt, out_a_varDecls, out_a_afterExp) :=
10624 match(in_txt, in_a_context, in_a_cr, in_a_t, in_a_varDecls, in_a_afterExp, in_a_exp)
10625 local
10626 Tpl.Text txt;
10627 DAE.ComponentRef a_cr;
10628 DAE.Type a_t;
10629 Tpl.Text a_varDecls;
10630 Tpl.Text a_afterExp;
10631 DAE.Exp a_exp;
10632 SimCodeFunction.Context i_context;
10633
10634 case ( txt,
10635 (i_context as SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _)),
10636 _,
10637 _,
10638 a_varDecls,
10639 a_afterExp,
10640 a_exp )
10641 algorithm
10642 ✗ (txt, a_afterExp, a_varDecls) := daeExpCrefLhs2Xml(txt, a_exp, i_context, a_afterExp, a_varDecls);
10643 ✗ then (txt, a_varDecls, a_afterExp);
10644
10645 case ( txt,
10646 i_context,
10647 a_cr,
10648 a_t,
10649 a_varDecls,
10650 a_afterExp,
10651 _ )
10652 algorithm
10653 ✗ (txt, a_afterExp, a_varDecls) := daeExpRecordCrefLhsXml(txt, a_t, a_cr, i_context, a_afterExp, a_varDecls);
10654 ✗ then (txt, a_varDecls, a_afterExp);
10655 end match;
10656 end fun_315;
10657
10658 public function daeExpCrefLhsXml
10659 input Tpl.Text in_txt;
10660 input DAE.Exp in_a_exp;
10661 input SimCodeFunction.Context in_a_context;
10662 input Tpl.Text in_a_afterExp;
10663 input Tpl.Text in_a_varDecls;
10664
10665 output Tpl.Text out_txt;
10666 output Tpl.Text out_a_afterExp;
10667 output Tpl.Text out_a_varDecls;
10668 algorithm
10669 (out_txt, out_a_afterExp, out_a_varDecls) :=
10670 match(in_txt, in_a_exp, in_a_context, in_a_afterExp, in_a_varDecls)
10671 local
10672 Tpl.Text txt;
10673 SimCodeFunction.Context a_context;
10674 Tpl.Text a_afterExp;
10675 Tpl.Text a_varDecls;
10676 DAE.ComponentRef i_cr;
10677 DAE.Type i_t;
10678 DAE.Exp i_exp;
10679
10680 case ( txt,
10681 (i_exp as DAE.CREF(componentRef = i_cr, ty = (i_t as DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = _))))),
10682 a_context,
10683 a_afterExp,
10684 a_varDecls )
10685 algorithm
10686 ✗ (txt, a_varDecls, a_afterExp) := fun_315(txt, a_context, i_cr, i_t, a_varDecls, a_afterExp, i_exp);
10687 ✗ then (txt, a_afterExp, a_varDecls);
10688
10689 case ( txt,
10690 DAE.CREF(componentRef = i_cr, ty = DAE.T_FUNCTION_REFERENCE_FUNC(builtin = _)),
10691 _,
10692 a_afterExp,
10693 a_varDecls )
10694 algorithm
10695 ✗ txt := crefFunctionNameXml(txt, i_cr);
10696 ✗ then (txt, a_afterExp, a_varDecls);
10697
10698 case ( txt,
10699 DAE.CREF(componentRef = i_cr, ty = DAE.T_FUNCTION_REFERENCE_VAR(functionType = _)),
10700 _,
10701 a_afterExp,
10702 a_varDecls )
10703 algorithm
10704 ✗ txt := crefStrXml(txt, i_cr);
10705 ✗ then (txt, a_afterExp, a_varDecls);
10706
10707 case ( txt,
10708 i_exp,
10709 a_context,
10710 a_afterExp,
10711 a_varDecls )
10712 algorithm
10713 ✗ (txt, a_afterExp, a_varDecls) := daeExpCrefLhs2Xml(txt, i_exp, a_context, a_afterExp, a_varDecls);
10714 then (txt, a_afterExp, a_varDecls);
10715 end match;
10716 end daeExpCrefLhsXml;
10717
10718 protected function lm_317
10719 input output Tpl.Text txt;
10720 input list<DAE.Subscript> items;
10721 input output Tpl.Text a_varDecls;
10722 input output Tpl.Text a_afterExp;
10723 input SimCodeFunction.Context a_context;
10724 algorithm
10725 ✗ for lstElt_317 in items loop
10726 (txt, a_varDecls, a_afterExp) := match lstElt_317
10727 local
10728 DAE.Exp i_exp;
10729
10730 case DAE.INDEX(exp = i_exp)
10731 algorithm
10732 ✗ (txt, a_afterExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_afterExp, a_varDecls);
10733 ✗ txt := Tpl.nextIter(txt);
10734 ✗ then (txt, a_varDecls, a_afterExp);
10735
10736 case _
10737 ✗ then (txt, a_varDecls, a_afterExp);
10738 end match;
10739 end for;
10740 end lm_317;
10741
10742 protected function fun_318
10743 input Tpl.Text in_txt;
10744 input String in_mArg;
10745 input Tpl.Text in_a_dimsValuesStr;
10746 input Tpl.Text in_a_arrName;
10747
10748 output Tpl.Text out_txt;
10749 algorithm
10750 out_txt :=
10751 match(in_txt, in_mArg, in_a_dimsValuesStr, in_a_arrName)
10752 local
10753 Tpl.Text txt;
10754 Tpl.Text a_dimsValuesStr;
10755 Tpl.Text a_arrName;
10756
10757 case ( txt,
10758 "metatype_array",
10759 a_dimsValuesStr,
10760 a_arrName )
10761 algorithm
10762 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("arrayGet("));
10763 ✗ txt := Tpl.writeText(txt, a_arrName);
10764 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(","));
10765 ✗ txt := Tpl.writeText(txt, a_dimsValuesStr);
10766 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") /* DAE.CREF */"));
10767 then txt;
10768
10769 case ( txt,
10770 _,
10771 a_dimsValuesStr,
10772 a_arrName )
10773 algorithm
10774 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Identifier>\n"));
10775 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
10776 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:QualifiedNamePart name=\""));
10777 ✗ txt := Tpl.writeText(txt, a_arrName);
10778 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
10779 "\">\n",
10780 " <exp:ArraySubscripts>\n",
10781 " <exp:IndexExpression>\n"
10782 }, true));
10783 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(6));
10784 ✗ txt := Tpl.writeText(txt, a_dimsValuesStr);
10785 ✗ txt := Tpl.softNewLine(txt);
10786 ✗ txt := Tpl.popBlock(txt);
10787 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
10788 " </exp:IndexExpression>\n",
10789 " </exp:ArraySubscripts>\n",
10790 "</exp:QualifiedNamePart>\n"
10791 }, true));
10792 ✗ txt := Tpl.popBlock(txt);
10793 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Identifier>"));
10794 then txt;
10795 end match;
10796 end fun_318;
10797
10798 protected function fun_319
10799 input Tpl.Text in_txt;
10800 input Boolean in_mArg;
10801 input Tpl.Text in_a_varDecls;
10802 input DAE.Type in_a_ty;
10803 input SimCodeFunction.Context in_a_context;
10804 input DAE.ComponentRef in_a_cr;
10805 input DAE.Exp in_a_ecr;
10806 input Tpl.Text in_a_afterExp;
10807
10808 output Tpl.Text out_txt;
10809 output Tpl.Text out_a_varDecls;
10810 output Tpl.Text out_a_afterExp;
10811 algorithm
10812 (out_txt, out_a_varDecls, out_a_afterExp) :=
10813 match(in_txt, in_mArg, in_a_varDecls, in_a_ty, in_a_context, in_a_cr, in_a_ecr, in_a_afterExp)
10814 local
10815 Tpl.Text txt;
10816 Tpl.Text a_varDecls;
10817 DAE.Type a_ty;
10818 SimCodeFunction.Context a_context;
10819 DAE.ComponentRef a_cr;
10820 DAE.Exp a_ecr;
10821 Tpl.Text a_afterExp;
10822 String str_11;
10823 list<DAE.Subscript> ret_10;
10824 Tpl.Text l_dimsValuesStr;
10825 Integer ret_8;
10826 list<DAE.Subscript> ret_7;
10827 Tpl.Text l_dimsLenStr;
10828 DAE.ComponentRef ret_5;
10829 list<DAE.Subscript> ret_4;
10830 Tpl.Text l_spec1;
10831 Tpl.Text l_tmp;
10832 Tpl.Text l_arrayType;
10833 Tpl.Text l_arrName;
10834
10835 case ( txt,
10836 false,
10837 a_varDecls,
10838 a_ty,
10839 a_context,
10840 a_cr,
10841 a_ecr,
10842 a_afterExp )
10843 algorithm
10844 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("/* daeExpCrefLhs2 SLICE("));
10845 ✗ a_afterExp := ExpressionDumpTpl.dumpExp(a_afterExp, a_ecr, "\"");
10846 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(") afterExp */"));
10847 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
10848 ✗ l_arrName := contextArrayCrefXml(Tpl.emptyTxt, a_cr, a_context);
10849 ✗ l_arrayType := expTypeArrayXml(Tpl.emptyTxt, a_ty);
10850 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arrayType), a_varDecls);
10851 ✗ ret_4 := ComponentReferenceBasics.crefSubs(a_cr);
10852 ✗ (l_spec1, a_afterExp, a_varDecls) := daeExpCrefLhsIndexSpecXml(Tpl.emptyTxt, ret_4, a_context, a_afterExp, a_varDecls);
10853 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("indexed_assign_"));
10854 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_arrayType);
10855 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("(&"));
10856 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_tmp);
10857 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(", &"));
10858 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_arrName);
10859 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(", &"));
10860 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_spec1);
10861 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(");"));
10862 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
10863 ✗ txt := Tpl.writeText(txt, l_tmp);
10864 ✗ then (txt, a_varDecls, a_afterExp);
10865
10866 case ( txt,
10867 _,
10868 a_varDecls,
10869 a_ty,
10870 a_context,
10871 a_cr,
10872 a_ecr,
10873 a_afterExp )
10874 algorithm
10875 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("/* daeExpCrefLhs2 SCALAR("));
10876 ✗ a_afterExp := ExpressionDumpTpl.dumpExp(a_afterExp, a_ecr, "\"");
10877 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(") afterExp */"));
10878 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
10879 ✗ ret_5 := ComponentReferenceBasics.crefStripLastSubs(a_cr);
10880 ✗ l_arrName := contextCrefXml(Tpl.emptyTxt, ret_5, a_context);
10881 ✗ l_arrayType := expTypeArrayXml(Tpl.emptyTxt, a_ty);
10882 ✗ ret_7 := ComponentReferenceBasics.crefSubs(a_cr);
10883 ✗ ret_8 := listLength(ret_7);
10884 ✗ l_dimsLenStr := Tpl.writeStr(Tpl.emptyTxt, intString(ret_8));
10885 ✗ ret_10 := ComponentReferenceBasics.crefSubs(a_cr);
10886 ✗ l_dimsValuesStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
10887 ✗ (l_dimsValuesStr, a_varDecls, a_afterExp) := lm_317(l_dimsValuesStr, ret_10, a_varDecls, a_afterExp, a_context);
10888 ✗ l_dimsValuesStr := Tpl.popIter(l_dimsValuesStr);
10889 ✗ str_11 := Tpl.textString(l_arrayType);
10890 ✗ txt := fun_318(txt, str_11, l_dimsValuesStr, l_arrName);
10891 ✗ then (txt, a_varDecls, a_afterExp);
10892 end match;
10893 end fun_319;
10894
10895 protected function fun_320
10896 input Tpl.Text in_txt;
10897 input Boolean in_mArg;
10898 input Tpl.Text in_a_varDecls;
10899 input DAE.Type in_a_ty;
10900 input SimCodeFunction.Context in_a_context;
10901 input DAE.Exp in_a_ecr;
10902 input Tpl.Text in_a_afterExp;
10903 input DAE.ComponentRef in_a_cr;
10904
10905 output Tpl.Text out_txt;
10906 output Tpl.Text out_a_varDecls;
10907 output Tpl.Text out_a_afterExp;
10908 algorithm
10909 (out_txt, out_a_varDecls, out_a_afterExp) :=
10910 match(in_txt, in_mArg, in_a_varDecls, in_a_ty, in_a_context, in_a_ecr, in_a_afterExp, in_a_cr)
10911 local
10912 Tpl.Text txt;
10913 Tpl.Text a_varDecls;
10914 DAE.Type a_ty;
10915 SimCodeFunction.Context a_context;
10916 DAE.Exp a_ecr;
10917 Tpl.Text a_afterExp;
10918 DAE.ComponentRef a_cr;
10919 Boolean ret_0;
10920
10921 case ( txt,
10922 false,
10923 a_varDecls,
10924 a_ty,
10925 a_context,
10926 a_ecr,
10927 a_afterExp,
10928 a_cr )
10929 algorithm
10930 ✗ ret_0 := SimCodeFunctionUtil.crefSubIsScalar(a_cr);
10931 ✗ (txt, a_varDecls, a_afterExp) := fun_319(txt, ret_0, a_varDecls, a_ty, a_context, a_cr, a_ecr, a_afterExp);
10932 then (txt, a_varDecls, a_afterExp);
10933
10934 case ( txt,
10935 _,
10936 a_varDecls,
10937 _,
10938 a_context,
10939 _,
10940 a_afterExp,
10941 a_cr )
10942 algorithm
10943 ✗ txt := contextCrefXml(txt, a_cr, a_context);
10944 ✗ then (txt, a_varDecls, a_afterExp);
10945 end match;
10946 end fun_320;
10947
10948 protected function fun_321
10949 input Tpl.Text in_txt;
10950 input Boolean in_mArg;
10951 input Tpl.Text in_a_box;
10952 input Tpl.Text in_a_varDecls;
10953 input DAE.Type in_a_ty;
10954 input DAE.Exp in_a_ecr;
10955 input Tpl.Text in_a_afterExp;
10956 input SimCodeFunction.Context in_a_context;
10957 input DAE.ComponentRef in_a_cr;
10958
10959 output Tpl.Text out_txt;
10960 output Tpl.Text out_a_varDecls;
10961 output Tpl.Text out_a_afterExp;
10962 algorithm
10963 (out_txt, out_a_varDecls, out_a_afterExp) :=
10964 match(in_txt, in_mArg, in_a_box, in_a_varDecls, in_a_ty, in_a_ecr, in_a_afterExp, in_a_context, in_a_cr)
10965 local
10966 Tpl.Text txt;
10967 Tpl.Text a_box;
10968 Tpl.Text a_varDecls;
10969 DAE.Type a_ty;
10970 DAE.Exp a_ecr;
10971 Tpl.Text a_afterExp;
10972 SimCodeFunction.Context a_context;
10973 DAE.ComponentRef a_cr;
10974 Boolean ret_0;
10975
10976 case ( txt,
10977 true,
10978 _,
10979 a_varDecls,
10980 a_ty,
10981 a_ecr,
10982 a_afterExp,
10983 a_context,
10984 a_cr )
10985 algorithm
10986 ✗ ret_0 := SimCodeFunctionUtil.crefIsScalar(a_cr, a_context);
10987 ✗ (txt, a_varDecls, a_afterExp) := fun_320(txt, ret_0, a_varDecls, a_ty, a_context, a_ecr, a_afterExp, a_cr);
10988 then (txt, a_varDecls, a_afterExp);
10989
10990 case ( txt,
10991 _,
10992 a_box,
10993 a_varDecls,
10994 _,
10995 _,
10996 a_afterExp,
10997 _,
10998 _ )
10999 algorithm
11000 ✗ txt := Tpl.writeText(txt, a_box);
11001 ✗ then (txt, a_varDecls, a_afterExp);
11002 end match;
11003 end fun_321;
11004
11005 public function daeExpCrefLhs2Xml
11006 input Tpl.Text in_txt;
11007 input DAE.Exp in_a_ecr;
11008 input SimCodeFunction.Context in_a_context;
11009 input Tpl.Text in_a_afterExp;
11010 input Tpl.Text in_a_varDecls;
11011
11012 output Tpl.Text out_txt;
11013 output Tpl.Text out_a_afterExp;
11014 output Tpl.Text out_a_varDecls;
11015 algorithm
11016 (out_txt, out_a_afterExp, out_a_varDecls) :=
11017 match(in_txt, in_a_ecr, in_a_context, in_a_afterExp, in_a_varDecls)
11018 local
11019 Tpl.Text txt;
11020 SimCodeFunction.Context a_context;
11021 Tpl.Text a_afterExp;
11022 Tpl.Text a_varDecls;
11023 DAE.Type i_ty;
11024 DAE.ComponentRef i_cr;
11025 DAE.Exp i_ecr;
11026 Boolean ret_1;
11027 Tpl.Text l_box;
11028
11029 case ( txt,
11030 (i_ecr as DAE.CREF(componentRef = i_cr, ty = i_ty)),
11031 a_context,
11032 a_afterExp,
11033 a_varDecls )
11034 algorithm
11035 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("/* daeExpCrefLhs2 begin afterExp ("));
11036 ✗ a_afterExp := ExpressionDumpTpl.dumpExp(a_afterExp, i_ecr, "\"");
11037 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(") */"));
11038 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
11039 ✗ (l_box, a_afterExp, a_varDecls) := daeExpCrefLhsArrayBoxXml(Tpl.emptyTxt, i_ecr, a_context, a_afterExp, a_varDecls);
11040 ✗ ret_1 := Tpl.isEmpty(l_box);
11041 ✗ (txt, a_varDecls, a_afterExp) := fun_321(txt, ret_1, l_box, a_varDecls, i_ty, i_ecr, a_afterExp, a_context, i_cr);
11042 ✗ then (txt, a_afterExp, a_varDecls);
11043
11044 case ( txt,
11045 i_ecr,
11046 _,
11047 a_afterExp,
11048 a_varDecls )
11049 algorithm
11050 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("/* daeExpCrefLhs2 UNHANDLED("));
11051 ✗ a_afterExp := ExpressionDumpTpl.dumpExp(a_afterExp, i_ecr, "\"");
11052 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(") afterExp */"));
11053 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
11054 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("/* SimCodeC.tpl template: daeExpCrefLhs2: UNHANDLED EXPRESSION:\n"));
11055 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1));
11056 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("* "));
11057 ✗ txt := ExpressionDumpTpl.dumpExp(txt, i_ecr, "\"");
11058 ✗ txt := Tpl.softNewLine(txt);
11059 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("*/"));
11060 ✗ txt := Tpl.popBlock(txt);
11061 ✗ then (txt, a_afterExp, a_varDecls);
11062 end match;
11063 end daeExpCrefLhs2Xml;
11064
11065 protected function fun_323
11066 input Tpl.Text in_txt;
11067 input DAE.Subscript in_a_sub;
11068 input Tpl.Text in_a_varDecls;
11069 input Tpl.Text in_a_afterExp;
11070 input SimCodeFunction.Context in_a_context;
11071
11072 output Tpl.Text out_txt;
11073 output Tpl.Text out_a_varDecls;
11074 output Tpl.Text out_a_afterExp;
11075 algorithm
11076 (out_txt, out_a_varDecls, out_a_afterExp) :=
11077 match(in_txt, in_a_sub, in_a_varDecls, in_a_afterExp, in_a_context)
11078 local
11079 Tpl.Text txt;
11080 Tpl.Text a_varDecls;
11081 Tpl.Text a_afterExp;
11082 SimCodeFunction.Context a_context;
11083 DAE.Exp i_exp;
11084 Tpl.Text l_tmp;
11085 Tpl.Text l_str;
11086 Tpl.Text l_expPart;
11087
11088 case ( txt,
11089 DAE.INDEX(exp = i_exp),
11090 a_varDecls,
11091 a_afterExp,
11092 a_context )
11093 algorithm
11094 ✗ (l_expPart, a_afterExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_afterExp, a_varDecls);
11095 ✗ l_str := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("(0), make_index_array(1, (int) "));
11096 ✗ l_str := Tpl.writeText(l_str, l_expPart);
11097 ✗ l_str := Tpl.writeTok(l_str, Tpl.ST_STRING("), \'S\'"));
11098 ✗ txt := Tpl.writeText(txt, l_str);
11099 ✗ then (txt, a_varDecls, a_afterExp);
11100
11101 case ( txt,
11102 DAE.WHOLEDIM(),
11103 a_varDecls,
11104 a_afterExp,
11105 _ )
11106 algorithm
11107 ✗ l_str := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("(1), (int*)0, \'W\'"));
11108 ✗ txt := Tpl.writeText(txt, l_str);
11109 ✗ then (txt, a_varDecls, a_afterExp);
11110
11111 case ( txt,
11112 DAE.SLICE(exp = i_exp),
11113 a_varDecls,
11114 a_afterExp,
11115 a_context )
11116 algorithm
11117 ✗ (l_expPart, a_afterExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_afterExp, a_varDecls);
11118 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_integer", a_varDecls);
11119 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_tmp);
11120 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(" = size_of_dimension_integer_array(&"));
11121 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_expPart);
11122 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(", 1);"));
11123 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
11124 ✗ l_str := Tpl.writeText(Tpl.emptyTxt, l_tmp);
11125 ✗ l_str := Tpl.writeTok(l_str, Tpl.ST_STRING(", integer_array_make_index_array("));
11126 ✗ l_str := Tpl.writeText(l_str, l_expPart);
11127 ✗ l_str := Tpl.writeTok(l_str, Tpl.ST_STRING("), \'A\'"));
11128 ✗ txt := Tpl.writeText(txt, l_str);
11129 ✗ then (txt, a_varDecls, a_afterExp);
11130
11131 case ( txt,
11132 _,
11133 a_varDecls,
11134 a_afterExp,
11135 _ )
11136 then (txt, a_varDecls, a_afterExp);
11137 end match;
11138 end fun_323;
11139
11140 protected function lm_324
11141 input output Tpl.Text txt;
11142 input list<DAE.Subscript> items;
11143 input output Tpl.Text a_varDecls;
11144 input output Tpl.Text a_afterExp;
11145 input SimCodeFunction.Context a_context;
11146 algorithm
11147 ✗ for lstElt_324 in items loop
11148 (txt, a_varDecls, a_afterExp) := match lstElt_324
11149 local
11150 DAE.Subscript i_sub;
11151
11152 case i_sub
11153 algorithm
11154 ✗ (txt, a_varDecls, a_afterExp) := fun_323(txt, i_sub, a_varDecls, a_afterExp, a_context);
11155 ✗ txt := Tpl.nextIter(txt);
11156 then (txt, a_varDecls, a_afterExp);
11157 end match;
11158 end for;
11159 end lm_324;
11160
11161 public function daeExpCrefLhsIndexSpecXml
11162 input Tpl.Text txt;
11163 input list<DAE.Subscript> a_subs;
11164 input SimCodeFunction.Context a_context;
11165 input Tpl.Text a_afterExp;
11166 input Tpl.Text a_varDecls;
11167
11168 output Tpl.Text out_txt;
11169 output Tpl.Text out_a_afterExp;
11170 output Tpl.Text out_a_varDecls;
11171 protected
11172 Tpl.Text l_tmp;
11173 Tpl.Text l_idx__str;
11174 Integer ret_1;
11175 Tpl.Text l_nridx__str;
11176 algorithm
11177 ✗ ret_1 := listLength(a_subs);
11178 ✗ l_nridx__str := Tpl.writeStr(Tpl.emptyTxt, intString(ret_1));
11179 ✗ l_idx__str := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
11180 ✗ (l_idx__str, out_a_varDecls, out_a_afterExp) := lm_324(l_idx__str, a_subs, a_varDecls, a_afterExp, a_context);
11181 ✗ l_idx__str := Tpl.popIter(l_idx__str);
11182 ✗ (l_tmp, out_a_varDecls) := tempDeclXml(Tpl.emptyTxt, "index_spec_t", out_a_varDecls);
11183 ✗ out_a_afterExp := Tpl.writeTok(out_a_afterExp, Tpl.ST_STRING("create_index_spec(&"));
11184 ✗ out_a_afterExp := Tpl.writeText(out_a_afterExp, l_tmp);
11185 ✗ out_a_afterExp := Tpl.writeTok(out_a_afterExp, Tpl.ST_STRING(", "));
11186 ✗ out_a_afterExp := Tpl.writeText(out_a_afterExp, l_nridx__str);
11187 ✗ out_a_afterExp := Tpl.writeTok(out_a_afterExp, Tpl.ST_STRING(", "));
11188 ✗ out_a_afterExp := Tpl.writeText(out_a_afterExp, l_idx__str);
11189 ✗ out_a_afterExp := Tpl.writeTok(out_a_afterExp, Tpl.ST_STRING(");"));
11190 ✗ out_a_afterExp := Tpl.writeTok(out_a_afterExp, Tpl.ST_NEW_LINE());
11191 ✗ out_txt := Tpl.writeText(txt, l_tmp);
11192 end daeExpCrefLhsIndexSpecXml;
11193
11194 protected function lm_326
11195 input output Tpl.Text txt;
11196 input DAE.Dimensions items;
11197 algorithm
11198 ✗ for lstElt_326 in items loop
11199 txt := match lstElt_326
11200 local
11201 DAE.Dimension i_dim;
11202
11203 case i_dim
11204 algorithm
11205 ✗ txt := dimensionXml(txt, i_dim);
11206 ✗ txt := Tpl.nextIter(txt);
11207 then txt;
11208 end match;
11209 end for;
11210 end lm_326;
11211
11212 protected function fun_327
11213 input Tpl.Text in_txt;
11214 input SimCodeFunction.Context in_a_context;
11215 input DAE.ComponentRef in_a_ecr_componentRef;
11216 input Tpl.Text in_a_afterExp;
11217 input DAE.Dimensions in_a_dims;
11218 input Tpl.Text in_a_varDecls;
11219 input DAE.Type in_a_aty;
11220
11221 output Tpl.Text out_txt;
11222 output Tpl.Text out_a_afterExp;
11223 output Tpl.Text out_a_varDecls;
11224 algorithm
11225 (out_txt, out_a_afterExp, out_a_varDecls) :=
11226 match(in_txt, in_a_context, in_a_ecr_componentRef, in_a_afterExp, in_a_dims, in_a_varDecls, in_a_aty)
11227 local
11228 Tpl.Text txt;
11229 DAE.ComponentRef a_ecr_componentRef;
11230 Tpl.Text a_afterExp;
11231 DAE.Dimensions a_dims;
11232 Tpl.Text a_varDecls;
11233 DAE.Type a_aty;
11234 Tpl.Text l_type;
11235 Tpl.Text l_dimsValuesStr;
11236 Integer ret_3;
11237 Tpl.Text l_dimsLenStr;
11238 Tpl.Text txt_1;
11239 Tpl.Text l_tmpArr;
11240
11241 case ( txt,
11242 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
11243 _,
11244 a_afterExp,
11245 _,
11246 a_varDecls,
11247 _ )
11248 then (txt, a_afterExp, a_varDecls);
11249
11250 case ( txt,
11251 _,
11252 a_ecr_componentRef,
11253 a_afterExp,
11254 a_dims,
11255 a_varDecls,
11256 a_aty )
11257 algorithm
11258 ✗ txt_1 := expTypeArrayXml(Tpl.emptyTxt, a_aty);
11259 ✗ (l_tmpArr, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(txt_1), a_varDecls);
11260 ✗ ret_3 := listLength(a_dims);
11261 ✗ l_dimsLenStr := Tpl.writeStr(Tpl.emptyTxt, intString(ret_3));
11262 ✗ l_dimsValuesStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
11263 ✗ l_dimsValuesStr := lm_326(l_dimsValuesStr, a_dims);
11264 ✗ l_dimsValuesStr := Tpl.popIter(l_dimsValuesStr);
11265 ✗ l_type := expTypeShortXml(Tpl.emptyTxt, a_aty);
11266 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_type);
11267 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("_array_create(&"));
11268 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_tmpArr);
11269 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(", ((modelica_"));
11270 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_type);
11271 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("*)&("));
11272 ✗ a_afterExp := arrayCrefXmlStr(a_afterExp, a_ecr_componentRef);
11273 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(")), "));
11274 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_dimsLenStr);
11275 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(", "));
11276 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_dimsValuesStr);
11277 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(");"));
11278 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
11279 ✗ txt := Tpl.writeText(txt, l_tmpArr);
11280 ✗ then (txt, a_afterExp, a_varDecls);
11281 end match;
11282 end fun_327;
11283
11284 public function daeExpCrefLhsArrayBoxXml
11285 input Tpl.Text in_txt;
11286 input DAE.Exp in_a_ecr;
11287 input SimCodeFunction.Context in_a_context;
11288 input Tpl.Text in_a_afterExp;
11289 input Tpl.Text in_a_varDecls;
11290
11291 output Tpl.Text out_txt;
11292 output Tpl.Text out_a_afterExp;
11293 output Tpl.Text out_a_varDecls;
11294 algorithm
11295 (out_txt, out_a_afterExp, out_a_varDecls) :=
11296 match(in_txt, in_a_ecr, in_a_context, in_a_afterExp, in_a_varDecls)
11297 local
11298 Tpl.Text txt;
11299 SimCodeFunction.Context a_context;
11300 Tpl.Text a_afterExp;
11301 Tpl.Text a_varDecls;
11302 DAE.ComponentRef i_ecr_componentRef;
11303 DAE.Dimensions i_dims;
11304 DAE.Type i_aty;
11305
11306 case ( txt,
11307 DAE.CREF(ty = DAE.T_ARRAY(ty = i_aty, dims = i_dims), componentRef = i_ecr_componentRef),
11308 a_context,
11309 a_afterExp,
11310 a_varDecls )
11311 algorithm
11312 ✗ (txt, a_afterExp, a_varDecls) := fun_327(txt, a_context, i_ecr_componentRef, a_afterExp, i_dims, a_varDecls, i_aty);
11313 then (txt, a_afterExp, a_varDecls);
11314
11315 case ( txt,
11316 _,
11317 _,
11318 a_afterExp,
11319 a_varDecls )
11320 ✗ then (txt, a_afterExp, a_varDecls);
11321 end match;
11322 end daeExpCrefLhsArrayBoxXml;
11323
11324 protected function lm_329
11325 input output Tpl.Text txt;
11326 input list<DAE.Var> items;
11327 input output Tpl.Text a_varDecls;
11328 input output Tpl.Text a_afterExp;
11329 input SimCodeFunction.Context a_context;
11330 input DAE.ComponentRef a_cr;
11331 algorithm
11332 ✗ for lstElt_329 in items loop
11333 (txt, a_varDecls, a_afterExp) := match lstElt_329
11334 local
11335 DAE.Var i_v;
11336 DAE.Exp ret_0;
11337
11338 case i_v
11339 algorithm
11340 ✗ ret_0 := SimCodeFunctionUtil.makeCrefRecordExp(a_cr, i_v);
11341 ✗ (txt, a_afterExp, a_varDecls) := daeExpXml(txt, ret_0, a_context, a_afterExp, a_varDecls);
11342 ✗ txt := Tpl.nextIter(txt);
11343 then (txt, a_varDecls, a_afterExp);
11344 end match;
11345 end for;
11346 end lm_329;
11347
11348 public function daeExpRecordCrefLhsXml
11349 input Tpl.Text in_txt;
11350 input DAE.Type in_a_ty;
11351 input DAE.ComponentRef in_a_cr;
11352 input SimCodeFunction.Context in_a_context;
11353 input Tpl.Text in_a_afterExp;
11354 input Tpl.Text in_a_varDecls;
11355
11356 output Tpl.Text out_txt;
11357 output Tpl.Text out_a_afterExp;
11358 output Tpl.Text out_a_varDecls;
11359 algorithm
11360 (out_txt, out_a_afterExp, out_a_varDecls) :=
11361 match(in_txt, in_a_ty, in_a_cr, in_a_context, in_a_afterExp, in_a_varDecls)
11362 local
11363 Tpl.Text txt;
11364 DAE.ComponentRef a_cr;
11365 SimCodeFunction.Context a_context;
11366 Tpl.Text a_afterExp;
11367 Tpl.Text a_varDecls;
11368 ClassInf.State i_record__state;
11369 list<DAE.Var> i_var__lst;
11370 Tpl.Text l_ret__var;
11371 Tpl.Text l_ret__type;
11372 Absyn.Path ret_2;
11373 Tpl.Text l_record__type__name;
11374 Tpl.Text l_vars;
11375
11376 case ( txt,
11377 DAE.T_COMPLEX(complexClassType = i_record__state, varLst = i_var__lst),
11378 a_cr,
11379 a_context,
11380 a_afterExp,
11381 a_varDecls )
11382 algorithm
11383 ✗ l_vars := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
11384 ✗ (l_vars, a_varDecls, a_afterExp) := lm_329(l_vars, i_var__lst, a_varDecls, a_afterExp, a_context, a_cr);
11385 ✗ l_vars := Tpl.popIter(l_vars);
11386 ✗ ret_2 := ClassInfUtil.getStateName(i_record__state);
11387 ✗ l_record__type__name := underscorePathXml(Tpl.emptyTxt, ret_2);
11388 ✗ l_ret__type := Tpl.writeText(Tpl.emptyTxt, l_record__type__name);
11389 ✗ l_ret__type := Tpl.writeTok(l_ret__type, Tpl.ST_STRING("_rettype"));
11390 ✗ (l_ret__var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_ret__type), a_varDecls);
11391 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_ret__var);
11392 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(" = _"));
11393 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_record__type__name);
11394 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING("("));
11395 ✗ a_afterExp := Tpl.writeText(a_afterExp, l_vars);
11396 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_STRING(");"));
11397 ✗ a_afterExp := Tpl.writeTok(a_afterExp, Tpl.ST_NEW_LINE());
11398 ✗ txt := Tpl.writeText(txt, l_ret__var);
11399 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("."));
11400 ✗ txt := Tpl.writeText(txt, l_ret__type);
11401 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_1"));
11402 ✗ then (txt, a_afterExp, a_varDecls);
11403
11404 case ( txt,
11405 _,
11406 _,
11407 _,
11408 a_afterExp,
11409 a_varDecls )
11410 then (txt, a_afterExp, a_varDecls);
11411 end match;
11412 end daeExpRecordCrefLhsXml;
11413
11414 protected function fun_331
11415 input Tpl.Text in_txt;
11416 input DAE.Type in_a_ty;
11417
11418 output Tpl.Text out_txt;
11419 algorithm
11420 out_txt :=
11421 match(in_txt, in_a_ty)
11422 local
11423 Tpl.Text txt;
11424
11425 case ( txt,
11426 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
11427 algorithm
11428 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11429 then txt;
11430
11431 case ( txt,
11432 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
11433 algorithm
11434 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11435 then txt;
11436
11437 case ( txt,
11438 _ )
11439 algorithm
11440 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real_array"));
11441 then txt;
11442 end match;
11443 end fun_331;
11444
11445 protected function fun_332
11446 input Tpl.Text in_txt;
11447 input DAE.Type in_a_ty;
11448
11449 output Tpl.Text out_txt;
11450 algorithm
11451 out_txt :=
11452 match(in_txt, in_a_ty)
11453 local
11454 Tpl.Text txt;
11455
11456 case ( txt,
11457 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
11458 algorithm
11459 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11460 then txt;
11461
11462 case ( txt,
11463 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
11464 algorithm
11465 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11466 then txt;
11467
11468 case ( txt,
11469 _ )
11470 algorithm
11471 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real_array"));
11472 then txt;
11473 end match;
11474 end fun_332;
11475
11476 protected function fun_333
11477 input Tpl.Text in_txt;
11478 input DAE.Type in_a_ty;
11479
11480 output Tpl.Text out_txt;
11481 algorithm
11482 out_txt :=
11483 match(in_txt, in_a_ty)
11484 local
11485 Tpl.Text txt;
11486
11487 case ( txt,
11488 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
11489 algorithm
11490 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11491 then txt;
11492
11493 case ( txt,
11494 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
11495 algorithm
11496 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11497 then txt;
11498
11499 case ( txt,
11500 _ )
11501 algorithm
11502 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real_array"));
11503 then txt;
11504 end match;
11505 end fun_333;
11506
11507 protected function fun_334
11508 input Tpl.Text in_txt;
11509 input DAE.Type in_a_ty;
11510
11511 output Tpl.Text out_txt;
11512 algorithm
11513 out_txt :=
11514 match(in_txt, in_a_ty)
11515 local
11516 Tpl.Text txt;
11517
11518 case ( txt,
11519 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
11520 algorithm
11521 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_scalar"));
11522 then txt;
11523
11524 case ( txt,
11525 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
11526 algorithm
11527 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_scalar"));
11528 then txt;
11529
11530 case ( txt,
11531 _ )
11532 algorithm
11533 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real_scalar"));
11534 then txt;
11535 end match;
11536 end fun_334;
11537
11538 protected function fun_335
11539 input Tpl.Text in_txt;
11540 input DAE.Type in_a_ty;
11541
11542 output Tpl.Text out_txt;
11543 algorithm
11544 out_txt :=
11545 match(in_txt, in_a_ty)
11546 local
11547 Tpl.Text txt;
11548
11549 case ( txt,
11550 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
11551 algorithm
11552 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer"));
11553 then txt;
11554
11555 case ( txt,
11556 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
11557 algorithm
11558 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer"));
11559 then txt;
11560
11561 case ( txt,
11562 _ )
11563 algorithm
11564 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real"));
11565 then txt;
11566 end match;
11567 end fun_335;
11568
11569 protected function fun_336
11570 input Tpl.Text in_txt;
11571 input DAE.Type in_a_ty;
11572
11573 output Tpl.Text out_txt;
11574 algorithm
11575 out_txt :=
11576 match(in_txt, in_a_ty)
11577 local
11578 Tpl.Text txt;
11579
11580 case ( txt,
11581 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
11582 algorithm
11583 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11584 then txt;
11585
11586 case ( txt,
11587 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
11588 algorithm
11589 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
11590 then txt;
11591
11592 case ( txt,
11593 _ )
11594 algorithm
11595 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real_array"));
11596 then txt;
11597 end match;
11598 end fun_336;
11599
11600 protected function fun_337
11601 input Tpl.Text in_txt;
11602 input DAE.Operator in_a_operator;
11603 input Tpl.Text in_a_varDecls;
11604 input Tpl.Text in_a_preExp;
11605 input SimCodeFunction.Context in_a_context;
11606 input DAE.Exp in_a_exp;
11607 input Tpl.Text in_a_e2;
11608 input Tpl.Text in_a_e1;
11609
11610 output Tpl.Text out_txt;
11611 output Tpl.Text out_a_varDecls;
11612 output Tpl.Text out_a_preExp;
11613 algorithm
11614 (out_txt, out_a_varDecls, out_a_preExp) :=
11615 match(in_txt, in_a_operator, in_a_varDecls, in_a_preExp, in_a_context, in_a_exp, in_a_e2, in_a_e1)
11616 local
11617 Tpl.Text txt;
11618 Tpl.Text a_varDecls;
11619 Tpl.Text a_preExp;
11620 SimCodeFunction.Context a_context;
11621 DAE.Exp a_exp;
11622 Tpl.Text a_e2;
11623 Tpl.Text a_e1;
11624 DAE.Type i_ty;
11625 Tpl.Text l_typeShort;
11626 Tpl.Text l_var;
11627 Tpl.Text l_type;
11628
11629 case ( txt,
11630 DAE.ADD(ty = _),
11631 a_varDecls,
11632 a_preExp,
11633 _,
11634 _,
11635 a_e2,
11636 a_e1 )
11637 algorithm
11638 28 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Add>\n"));
11639 28 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
11640 28 txt := Tpl.writeText(txt, a_e1);
11641 28 txt := Tpl.softNewLine(txt);
11642 28 txt := Tpl.writeText(txt, a_e2);
11643 28 txt := Tpl.softNewLine(txt);
11644 28 txt := Tpl.popBlock(txt);
11645 28 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Add>"));
11646 28 then (txt, a_varDecls, a_preExp);
11647
11648 case ( txt,
11649 DAE.SUB(ty = _),
11650 a_varDecls,
11651 a_preExp,
11652 _,
11653 _,
11654 a_e2,
11655 a_e1 )
11656 algorithm
11657 14 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Sub>\n"));
11658 14 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
11659 14 txt := Tpl.writeText(txt, a_e1);
11660 14 txt := Tpl.softNewLine(txt);
11661 14 txt := Tpl.writeText(txt, a_e2);
11662 14 txt := Tpl.softNewLine(txt);
11663 14 txt := Tpl.popBlock(txt);
11664 14 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Sub>"));
11665 14 then (txt, a_varDecls, a_preExp);
11666
11667 case ( txt,
11668 DAE.MUL(ty = _),
11669 a_varDecls,
11670 a_preExp,
11671 _,
11672 _,
11673 a_e2,
11674 a_e1 )
11675 algorithm
11676 36 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Mul>\n"));
11677 36 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
11678 36 txt := Tpl.writeText(txt, a_e1);
11679 36 txt := Tpl.softNewLine(txt);
11680 36 txt := Tpl.writeText(txt, a_e2);
11681 36 txt := Tpl.softNewLine(txt);
11682 36 txt := Tpl.popBlock(txt);
11683 36 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Mul>"));
11684 36 then (txt, a_varDecls, a_preExp);
11685
11686 case ( txt,
11687 DAE.DIV(ty = _),
11688 a_varDecls,
11689 a_preExp,
11690 _,
11691 _,
11692 a_e2,
11693 a_e1 )
11694 algorithm
11695 20 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Div>\n"));
11696 20 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
11697 20 txt := Tpl.writeText(txt, a_e1);
11698 20 txt := Tpl.softNewLine(txt);
11699 20 txt := Tpl.writeText(txt, a_e2);
11700 20 txt := Tpl.softNewLine(txt);
11701 20 txt := Tpl.popBlock(txt);
11702 20 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Div>"));
11703 20 then (txt, a_varDecls, a_preExp);
11704
11705 case ( txt,
11706 DAE.POW(ty = _),
11707 a_varDecls,
11708 a_preExp,
11709 _,
11710 _,
11711 a_e2,
11712 a_e1 )
11713 algorithm
11714 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Pow>\n"));
11715 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
11716 ✗ txt := Tpl.writeText(txt, a_e1);
11717 ✗ txt := Tpl.softNewLine(txt);
11718 ✗ txt := Tpl.writeText(txt, a_e2);
11719 ✗ txt := Tpl.softNewLine(txt);
11720 ✗ txt := Tpl.popBlock(txt);
11721 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Pow>"));
11722 ✗ then (txt, a_varDecls, a_preExp);
11723
11724 case ( txt,
11725 DAE.UMINUS(ty = _),
11726 a_varDecls,
11727 a_preExp,
11728 a_context,
11729 a_exp,
11730 _,
11731 _ )
11732 algorithm
11733 ✗ (txt, a_preExp, a_varDecls) := daeExpUnaryXml(txt, a_exp, a_context, a_preExp, a_varDecls);
11734 ✗ then (txt, a_varDecls, a_preExp);
11735
11736 case ( txt,
11737 DAE.ADD_ARR(ty = i_ty),
11738 a_varDecls,
11739 a_preExp,
11740 _,
11741 _,
11742 a_e2,
11743 a_e1 )
11744 algorithm
11745 ✗ l_type := fun_331(Tpl.emptyTxt, i_ty);
11746 ✗ (l_var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_type), a_varDecls);
11747 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Add>\n"));
11748 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
11749 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
11750 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11751 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
11752 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11753 ✗ a_preExp := Tpl.popBlock(a_preExp);
11754 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Add>"));
11755 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
11756 ✗ txt := Tpl.writeText(txt, l_var);
11757 ✗ then (txt, a_varDecls, a_preExp);
11758
11759 case ( txt,
11760 DAE.SUB_ARR(ty = i_ty),
11761 a_varDecls,
11762 a_preExp,
11763 _,
11764 _,
11765 a_e2,
11766 a_e1 )
11767 algorithm
11768 ✗ l_type := fun_332(Tpl.emptyTxt, i_ty);
11769 ✗ (l_var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_type), a_varDecls);
11770 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Sub>\n"));
11771 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
11772 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11773 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
11774 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11775 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Sub>"));
11776 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
11777 ✗ txt := Tpl.writeText(txt, l_var);
11778 ✗ then (txt, a_varDecls, a_preExp);
11779
11780 case ( txt,
11781 DAE.MUL_ARR(ty = _),
11782 a_varDecls,
11783 a_preExp,
11784 _,
11785 _,
11786 _,
11787 _ )
11788 algorithm
11789 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for MUL_ARR"));
11790 ✗ then (txt, a_varDecls, a_preExp);
11791
11792 case ( txt,
11793 DAE.DIV_ARR(ty = _),
11794 a_varDecls,
11795 a_preExp,
11796 _,
11797 _,
11798 _,
11799 _ )
11800 algorithm
11801 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for DIV_ARR"));
11802 ✗ then (txt, a_varDecls, a_preExp);
11803
11804 case ( txt,
11805 DAE.MUL_ARRAY_SCALAR(ty = i_ty),
11806 a_varDecls,
11807 a_preExp,
11808 _,
11809 _,
11810 a_e2,
11811 a_e1 )
11812 algorithm
11813 ✗ l_type := fun_333(Tpl.emptyTxt, i_ty);
11814 ✗ (l_var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_type), a_varDecls);
11815 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Mul>\n"));
11816 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
11817 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11818 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
11819 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11820 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Mul>"));
11821 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
11822 ✗ txt := Tpl.writeText(txt, l_var);
11823 ✗ then (txt, a_varDecls, a_preExp);
11824
11825 case ( txt,
11826 DAE.ADD_ARRAY_SCALAR(ty = _),
11827 a_varDecls,
11828 a_preExp,
11829 _,
11830 _,
11831 _,
11832 _ )
11833 algorithm
11834 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for ADD_ARRAY_SCALAR"));
11835 ✗ then (txt, a_varDecls, a_preExp);
11836
11837 case ( txt,
11838 DAE.SUB_SCALAR_ARRAY(ty = _),
11839 a_varDecls,
11840 a_preExp,
11841 _,
11842 _,
11843 _,
11844 _ )
11845 algorithm
11846 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for SUB_SCALAR_ARRAY"));
11847 ✗ then (txt, a_varDecls, a_preExp);
11848
11849 case ( txt,
11850 DAE.MUL_SCALAR_PRODUCT(ty = i_ty),
11851 a_varDecls,
11852 a_preExp,
11853 _,
11854 _,
11855 a_e2,
11856 a_e1 )
11857 algorithm
11858 ✗ l_type := fun_334(Tpl.emptyTxt, i_ty);
11859 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("mul_"));
11860 ✗ txt := Tpl.writeText(txt, l_type);
11861 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_product(&"));
11862 ✗ txt := Tpl.writeText(txt, a_e1);
11863 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", &"));
11864 ✗ txt := Tpl.writeText(txt, a_e2);
11865 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
11866 ✗ then (txt, a_varDecls, a_preExp);
11867
11868 case ( txt,
11869 DAE.MUL_MATRIX_PRODUCT(ty = i_ty),
11870 a_varDecls,
11871 a_preExp,
11872 _,
11873 _,
11874 a_e2,
11875 a_e1 )
11876 algorithm
11877 ✗ l_typeShort := fun_335(Tpl.emptyTxt, i_ty);
11878 ✗ l_type := Tpl.writeText(Tpl.emptyTxt, l_typeShort);
11879 ✗ l_type := Tpl.writeTok(l_type, Tpl.ST_STRING("_array"));
11880 ✗ (l_var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_type), a_varDecls);
11881 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Mul>\n"));
11882 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
11883 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11884 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
11885 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11886 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Mul>"));
11887 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
11888 ✗ txt := Tpl.writeText(txt, l_var);
11889 ✗ then (txt, a_varDecls, a_preExp);
11890
11891 case ( txt,
11892 DAE.DIV_ARRAY_SCALAR(ty = i_ty),
11893 a_varDecls,
11894 a_preExp,
11895 _,
11896 _,
11897 a_e2,
11898 a_e1 )
11899 algorithm
11900 ✗ l_type := fun_336(Tpl.emptyTxt, i_ty);
11901 ✗ (l_var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_type), a_varDecls);
11902 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Div>\n"));
11903 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
11904 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11905 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
11906 ✗ a_preExp := Tpl.softNewLine(a_preExp);
11907 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Div>"));
11908 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
11909 ✗ txt := Tpl.writeText(txt, l_var);
11910 ✗ then (txt, a_varDecls, a_preExp);
11911
11912 case ( txt,
11913 DAE.DIV_SCALAR_ARRAY(ty = _),
11914 a_varDecls,
11915 a_preExp,
11916 _,
11917 _,
11918 _,
11919 _ )
11920 algorithm
11921 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for DIV_SCALAR_ARRAY"));
11922 ✗ then (txt, a_varDecls, a_preExp);
11923
11924 case ( txt,
11925 DAE.POW_ARRAY_SCALAR(ty = _),
11926 a_varDecls,
11927 a_preExp,
11928 _,
11929 _,
11930 _,
11931 _ )
11932 algorithm
11933 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for POW_ARRAY_SCALAR"));
11934 ✗ then (txt, a_varDecls, a_preExp);
11935
11936 case ( txt,
11937 DAE.POW_SCALAR_ARRAY(ty = _),
11938 a_varDecls,
11939 a_preExp,
11940 _,
11941 _,
11942 _,
11943 _ )
11944 algorithm
11945 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for POW_SCALAR_ARRAY"));
11946 ✗ then (txt, a_varDecls, a_preExp);
11947
11948 case ( txt,
11949 DAE.POW_ARR(ty = _),
11950 a_varDecls,
11951 a_preExp,
11952 _,
11953 _,
11954 _,
11955 _ )
11956 algorithm
11957 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for POW_ARR"));
11958 ✗ then (txt, a_varDecls, a_preExp);
11959
11960 case ( txt,
11961 DAE.POW_ARR2(ty = _),
11962 a_varDecls,
11963 a_preExp,
11964 _,
11965 _,
11966 _,
11967 _ )
11968 algorithm
11969 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR for POW_ARR2"));
11970 ✗ then (txt, a_varDecls, a_preExp);
11971
11972 case ( txt,
11973 _,
11974 a_varDecls,
11975 a_preExp,
11976 _,
11977 _,
11978 _,
11979 _ )
11980 algorithm
11981 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpBinary:ERR"));
11982 ✗ then (txt, a_varDecls, a_preExp);
11983 end match;
11984 end fun_337;
11985
11986 public function daeExpBinaryXml
11987 input Tpl.Text in_txt;
11988 input DAE.Exp in_a_exp;
11989 input SimCodeFunction.Context in_a_context;
11990 input Tpl.Text in_a_preExp;
11991 input Tpl.Text in_a_varDecls;
11992
11993 output Tpl.Text out_txt;
11994 output Tpl.Text out_a_preExp;
11995 output Tpl.Text out_a_varDecls;
11996 algorithm
11997 (out_txt, out_a_preExp, out_a_varDecls) :=
11998 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
11999 local
12000 Tpl.Text txt;
12001 SimCodeFunction.Context a_context;
12002 Tpl.Text a_preExp;
12003 Tpl.Text a_varDecls;
12004 DAE.Exp i_exp;
12005 DAE.Operator i_operator;
12006 DAE.Exp i_exp2;
12007 DAE.Exp i_exp1;
12008 Tpl.Text l_e2;
12009 Tpl.Text l_e1;
12010
12011 case ( txt,
12012 (i_exp as DAE.BINARY(exp1 = i_exp1, exp2 = i_exp2, operator = i_operator)),
12013 a_context,
12014 a_preExp,
12015 a_varDecls )
12016 algorithm
12017 98 (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp1, a_context, a_preExp, a_varDecls);
12018 98 (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp2, a_context, a_preExp, a_varDecls);
12019 98 (txt, a_varDecls, a_preExp) := fun_337(txt, i_operator, a_varDecls, a_preExp, a_context, i_exp, l_e2, l_e1);
12020 98 then (txt, a_preExp, a_varDecls);
12021
12022 case ( txt,
12023 _,
12024 _,
12025 a_preExp,
12026 a_varDecls )
12027 then (txt, a_preExp, a_varDecls);
12028 end match;
12029 end daeExpBinaryXml;
12030
12031 protected function fun_339
12032 input Tpl.Text in_txt;
12033 input DAE.Operator in_a_operator;
12034 input Tpl.Text in_a_e;
12035
12036 output Tpl.Text out_txt;
12037 algorithm
12038 out_txt :=
12039 match(in_txt, in_a_operator, in_a_e)
12040 local
12041 Tpl.Text txt;
12042 Tpl.Text a_e;
12043
12044 case ( txt,
12045 DAE.UMINUS(ty = _),
12046 a_e )
12047 algorithm
12048 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE(" <exp:Neg>\n"));
12049 3 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
12050 3 txt := Tpl.writeText(txt, a_e);
12051 3 txt := Tpl.softNewLine(txt);
12052 3 txt := Tpl.popBlock(txt);
12053 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING(" </exp:Neg>"));
12054 then txt;
12055
12056 case ( txt,
12057 DAE.UMINUS_ARR(ty = DAE.T_ARRAY(ty = DAE.T_REAL(varLst = _))),
12058 a_e )
12059 algorithm
12060 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(" <exp:Neg>\n"));
12061 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
12062 ✗ txt := Tpl.writeText(txt, a_e);
12063 ✗ txt := Tpl.softNewLine(txt);
12064 ✗ txt := Tpl.popBlock(txt);
12065 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" </exp:Neg>"));
12066 then txt;
12067
12068 case ( txt,
12069 DAE.UMINUS_ARR(ty = _),
12070 _ )
12071 algorithm
12072 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2675, 34), "unary minus for non-real arrays not implemented");
12073 then txt;
12074
12075 case ( txt,
12076 _,
12077 _ )
12078 algorithm
12079 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 2676, 14), "daeExpUnary:ERR");
12080 then txt;
12081 end match;
12082 end fun_339;
12083
12084 public function daeExpUnaryXml
12085 input Tpl.Text in_txt;
12086 input DAE.Exp in_a_exp;
12087 input SimCodeFunction.Context in_a_context;
12088 input Tpl.Text in_a_preExp;
12089 input Tpl.Text in_a_varDecls;
12090
12091 output Tpl.Text out_txt;
12092 output Tpl.Text out_a_preExp;
12093 output Tpl.Text out_a_varDecls;
12094 algorithm
12095 (out_txt, out_a_preExp, out_a_varDecls) :=
12096 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
12097 local
12098 Tpl.Text txt;
12099 SimCodeFunction.Context a_context;
12100 Tpl.Text a_preExp;
12101 Tpl.Text a_varDecls;
12102 DAE.Operator i_operator;
12103 DAE.Exp i_exp;
12104 Tpl.Text l_e;
12105
12106 case ( txt,
12107 DAE.UNARY(exp = i_exp, operator = i_operator),
12108 a_context,
12109 a_preExp,
12110 a_varDecls )
12111 algorithm
12112 3 (l_e, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
12113 3 txt := fun_339(txt, i_operator, l_e);
12114 3 then (txt, a_preExp, a_varDecls);
12115
12116 case ( txt,
12117 _,
12118 _,
12119 a_preExp,
12120 a_varDecls )
12121 then (txt, a_preExp, a_varDecls);
12122 end match;
12123 end daeExpUnaryXml;
12124
12125 protected function fun_341
12126 input Tpl.Text in_txt;
12127 input DAE.Operator in_a_operator;
12128 input Tpl.Text in_a_e2;
12129 input Tpl.Text in_a_e1;
12130
12131 output Tpl.Text out_txt;
12132 algorithm
12133 out_txt :=
12134 match(in_txt, in_a_operator, in_a_e2, in_a_e1)
12135 local
12136 Tpl.Text txt;
12137 Tpl.Text a_e2;
12138 Tpl.Text a_e1;
12139
12140 case ( txt,
12141 DAE.AND(ty = _),
12142 a_e2,
12143 a_e1 )
12144 algorithm
12145 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:And>\n"));
12146 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12147 ✗ txt := Tpl.writeText(txt, a_e1);
12148 ✗ txt := Tpl.softNewLine(txt);
12149 ✗ txt := Tpl.writeText(txt, a_e2);
12150 ✗ txt := Tpl.softNewLine(txt);
12151 ✗ txt := Tpl.popBlock(txt);
12152 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:And>"));
12153 then txt;
12154
12155 case ( txt,
12156 DAE.OR(ty = _),
12157 a_e2,
12158 a_e1 )
12159 algorithm
12160 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Or>\n"));
12161 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12162 ✗ txt := Tpl.writeText(txt, a_e1);
12163 ✗ txt := Tpl.softNewLine(txt);
12164 ✗ txt := Tpl.writeText(txt, a_e2);
12165 ✗ txt := Tpl.softNewLine(txt);
12166 ✗ txt := Tpl.popBlock(txt);
12167 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Or>"));
12168 then txt;
12169
12170 case ( txt,
12171 _,
12172 _,
12173 _ )
12174 algorithm
12175 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpLbinary:ERR"));
12176 then txt;
12177 end match;
12178 end fun_341;
12179
12180 public function daeExpLbinaryXml
12181 input Tpl.Text in_txt;
12182 input DAE.Exp in_a_exp;
12183 input SimCodeFunction.Context in_a_context;
12184 input Tpl.Text in_a_preExp;
12185 input Tpl.Text in_a_varDecls;
12186
12187 output Tpl.Text out_txt;
12188 output Tpl.Text out_a_preExp;
12189 output Tpl.Text out_a_varDecls;
12190 algorithm
12191 (out_txt, out_a_preExp, out_a_varDecls) :=
12192 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
12193 local
12194 Tpl.Text txt;
12195 SimCodeFunction.Context a_context;
12196 Tpl.Text a_preExp;
12197 Tpl.Text a_varDecls;
12198 DAE.Operator i_operator;
12199 DAE.Exp i_exp2;
12200 DAE.Exp i_exp1;
12201 Tpl.Text l_e2;
12202 Tpl.Text l_e1;
12203
12204 case ( txt,
12205 DAE.LBINARY(exp1 = i_exp1, exp2 = i_exp2, operator = i_operator),
12206 a_context,
12207 a_preExp,
12208 a_varDecls )
12209 algorithm
12210 ✗ (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp1, a_context, a_preExp, a_varDecls);
12211 ✗ (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp2, a_context, a_preExp, a_varDecls);
12212 ✗ txt := fun_341(txt, i_operator, l_e2, l_e1);
12213 ✗ then (txt, a_preExp, a_varDecls);
12214
12215 case ( txt,
12216 _,
12217 _,
12218 a_preExp,
12219 a_varDecls )
12220 then (txt, a_preExp, a_varDecls);
12221 end match;
12222 end daeExpLbinaryXml;
12223
12224 protected function fun_343
12225 input Tpl.Text in_txt;
12226 input DAE.Operator in_a_operator;
12227 input Tpl.Text in_a_e;
12228
12229 output Tpl.Text out_txt;
12230 algorithm
12231 out_txt :=
12232 match(in_txt, in_a_operator, in_a_e)
12233 local
12234 Tpl.Text txt;
12235 Tpl.Text a_e;
12236
12237 case ( txt,
12238 DAE.NOT(ty = _),
12239 a_e )
12240 algorithm
12241 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Not>\n"));
12242 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12243 ✗ txt := Tpl.writeText(txt, a_e);
12244 ✗ txt := Tpl.softNewLine(txt);
12245 ✗ txt := Tpl.popBlock(txt);
12246 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Not>"));
12247 then txt;
12248
12249 case ( txt,
12250 _,
12251 _ )
12252 then txt;
12253 end match;
12254 end fun_343;
12255
12256 public function daeExpLunaryXml
12257 input Tpl.Text in_txt;
12258 input DAE.Exp in_a_exp;
12259 input SimCodeFunction.Context in_a_context;
12260 input Tpl.Text in_a_preExp;
12261 input Tpl.Text in_a_varDecls;
12262
12263 output Tpl.Text out_txt;
12264 output Tpl.Text out_a_preExp;
12265 output Tpl.Text out_a_varDecls;
12266 algorithm
12267 (out_txt, out_a_preExp, out_a_varDecls) :=
12268 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
12269 local
12270 Tpl.Text txt;
12271 SimCodeFunction.Context a_context;
12272 Tpl.Text a_preExp;
12273 Tpl.Text a_varDecls;
12274 DAE.Operator i_operator;
12275 DAE.Exp i_exp;
12276 Tpl.Text l_e;
12277
12278 case ( txt,
12279 DAE.LUNARY(exp = i_exp, operator = i_operator),
12280 a_context,
12281 a_preExp,
12282 a_varDecls )
12283 algorithm
12284 ✗ (l_e, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
12285 ✗ txt := fun_343(txt, i_operator, l_e);
12286 ✗ then (txt, a_preExp, a_varDecls);
12287
12288 case ( txt,
12289 _,
12290 _,
12291 a_preExp,
12292 a_varDecls )
12293 then (txt, a_preExp, a_varDecls);
12294 end match;
12295 end daeExpLunaryXml;
12296
12297 protected function fun_345
12298 input Tpl.Text in_txt;
12299 input DAE.Operator in_a_rel_operator;
12300 input Tpl.Text in_a_e2;
12301 input Tpl.Text in_a_e1;
12302
12303 output Tpl.Text out_txt;
12304 algorithm
12305 out_txt :=
12306 match(in_txt, in_a_rel_operator, in_a_e2, in_a_e1)
12307 local
12308 Tpl.Text txt;
12309 Tpl.Text a_e2;
12310 Tpl.Text a_e1;
12311
12312 case ( txt,
12313 DAE.LESS(ty = DAE.T_BOOL(varLst = _)),
12314 a_e2,
12315 a_e1 )
12316 algorithm
12317 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(!"));
12318 ✗ txt := Tpl.writeText(txt, a_e1);
12319 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && "));
12320 ✗ txt := Tpl.writeText(txt, a_e2);
12321 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
12322 then txt;
12323
12324 case ( txt,
12325 DAE.LESS(ty = DAE.T_STRING(varLst = _)),
12326 a_e2,
12327 a_e1 )
12328 algorithm
12329 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(stringCompare("));
12330 ✗ txt := Tpl.writeText(txt, a_e1);
12331 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
12332 ✗ txt := Tpl.writeText(txt, a_e2);
12333 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") < 0)"));
12334 then txt;
12335
12336 case ( txt,
12337 DAE.LESS(ty = _),
12338 a_e2,
12339 a_e1 )
12340 algorithm
12341 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:LogLt>\n"));
12342 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12343 ✗ txt := Tpl.writeText(txt, a_e1);
12344 ✗ txt := Tpl.softNewLine(txt);
12345 ✗ txt := Tpl.writeText(txt, a_e2);
12346 ✗ txt := Tpl.softNewLine(txt);
12347 ✗ txt := Tpl.popBlock(txt);
12348 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:LogLt>"));
12349 then txt;
12350
12351 case ( txt,
12352 DAE.GREATER(ty = DAE.T_BOOL(varLst = _)),
12353 a_e2,
12354 a_e1 )
12355 algorithm
12356 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
12357 ✗ txt := Tpl.writeText(txt, a_e1);
12358 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && !"));
12359 ✗ txt := Tpl.writeText(txt, a_e2);
12360 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
12361 then txt;
12362
12363 case ( txt,
12364 DAE.GREATER(ty = DAE.T_STRING(varLst = _)),
12365 a_e2,
12366 a_e1 )
12367 algorithm
12368 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(stringCompare("));
12369 ✗ txt := Tpl.writeText(txt, a_e1);
12370 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
12371 ✗ txt := Tpl.writeText(txt, a_e2);
12372 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") > 0)"));
12373 then txt;
12374
12375 case ( txt,
12376 DAE.GREATER(ty = _),
12377 a_e2,
12378 a_e1 )
12379 algorithm
12380 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:LogGt>\n"));
12381 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12382 ✗ txt := Tpl.writeText(txt, a_e1);
12383 ✗ txt := Tpl.softNewLine(txt);
12384 ✗ txt := Tpl.writeText(txt, a_e2);
12385 ✗ txt := Tpl.softNewLine(txt);
12386 ✗ txt := Tpl.popBlock(txt);
12387 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:LogGt>"));
12388 then txt;
12389
12390 case ( txt,
12391 DAE.LESSEQ(ty = DAE.T_BOOL(varLst = _)),
12392 a_e2,
12393 a_e1 )
12394 algorithm
12395 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(!"));
12396 ✗ txt := Tpl.writeText(txt, a_e1);
12397 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" || "));
12398 ✗ txt := Tpl.writeText(txt, a_e2);
12399 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
12400 then txt;
12401
12402 case ( txt,
12403 DAE.LESSEQ(ty = DAE.T_STRING(varLst = _)),
12404 a_e2,
12405 a_e1 )
12406 algorithm
12407 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(stringCompare("));
12408 ✗ txt := Tpl.writeText(txt, a_e1);
12409 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
12410 ✗ txt := Tpl.writeText(txt, a_e2);
12411 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") <= 0)"));
12412 then txt;
12413
12414 case ( txt,
12415 DAE.LESSEQ(ty = _),
12416 a_e2,
12417 a_e1 )
12418 algorithm
12419 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:LogLeq>\n"));
12420 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12421 ✗ txt := Tpl.writeText(txt, a_e1);
12422 ✗ txt := Tpl.softNewLine(txt);
12423 ✗ txt := Tpl.writeText(txt, a_e2);
12424 ✗ txt := Tpl.softNewLine(txt);
12425 ✗ txt := Tpl.popBlock(txt);
12426 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:LogLeq>"));
12427 then txt;
12428
12429 case ( txt,
12430 DAE.GREATEREQ(ty = DAE.T_BOOL(varLst = _)),
12431 a_e2,
12432 a_e1 )
12433 algorithm
12434 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
12435 ✗ txt := Tpl.writeText(txt, a_e1);
12436 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" || !"));
12437 ✗ txt := Tpl.writeText(txt, a_e2);
12438 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
12439 then txt;
12440
12441 case ( txt,
12442 DAE.GREATEREQ(ty = DAE.T_STRING(varLst = _)),
12443 a_e2,
12444 a_e1 )
12445 algorithm
12446 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(stringCompare("));
12447 ✗ txt := Tpl.writeText(txt, a_e1);
12448 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
12449 ✗ txt := Tpl.writeText(txt, a_e2);
12450 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") >= 0)"));
12451 then txt;
12452
12453 case ( txt,
12454 DAE.GREATEREQ(ty = _),
12455 a_e2,
12456 a_e1 )
12457 algorithm
12458 2 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:LogGeq>\n"));
12459 2 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12460 2 txt := Tpl.writeText(txt, a_e1);
12461 2 txt := Tpl.softNewLine(txt);
12462 2 txt := Tpl.writeText(txt, a_e2);
12463 2 txt := Tpl.softNewLine(txt);
12464 2 txt := Tpl.popBlock(txt);
12465 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:LogGeq>"));
12466 then txt;
12467
12468 case ( txt,
12469 DAE.EQUAL(ty = DAE.T_BOOL(varLst = _)),
12470 a_e2,
12471 a_e1 )
12472 algorithm
12473 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("((!"));
12474 ✗ txt := Tpl.writeText(txt, a_e1);
12475 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && !"));
12476 ✗ txt := Tpl.writeText(txt, a_e2);
12477 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") || ("));
12478 ✗ txt := Tpl.writeText(txt, a_e1);
12479 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && "));
12480 ✗ txt := Tpl.writeText(txt, a_e2);
12481 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("))"));
12482 then txt;
12483
12484 case ( txt,
12485 DAE.EQUAL(ty = DAE.T_STRING(varLst = _)),
12486 a_e2,
12487 a_e1 )
12488 algorithm
12489 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(stringEqual("));
12490 ✗ txt := Tpl.writeText(txt, a_e1);
12491 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
12492 ✗ txt := Tpl.writeText(txt, a_e2);
12493 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("))"));
12494 then txt;
12495
12496 case ( txt,
12497 DAE.EQUAL(ty = _),
12498 a_e2,
12499 a_e1 )
12500 algorithm
12501 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:LogEq>\n"));
12502 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12503 ✗ txt := Tpl.writeText(txt, a_e1);
12504 ✗ txt := Tpl.softNewLine(txt);
12505 ✗ txt := Tpl.writeText(txt, a_e2);
12506 ✗ txt := Tpl.softNewLine(txt);
12507 ✗ txt := Tpl.popBlock(txt);
12508 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:LogEq>"));
12509 then txt;
12510
12511 case ( txt,
12512 DAE.NEQUAL(ty = DAE.T_BOOL(varLst = _)),
12513 a_e2,
12514 a_e1 )
12515 algorithm
12516 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("((!"));
12517 ✗ txt := Tpl.writeText(txt, a_e1);
12518 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && "));
12519 ✗ txt := Tpl.writeText(txt, a_e2);
12520 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") || ("));
12521 ✗ txt := Tpl.writeText(txt, a_e1);
12522 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" && !"));
12523 ✗ txt := Tpl.writeText(txt, a_e2);
12524 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("))"));
12525 then txt;
12526
12527 case ( txt,
12528 DAE.NEQUAL(ty = DAE.T_STRING(varLst = _)),
12529 a_e2,
12530 a_e1 )
12531 algorithm
12532 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(!stringEqual("));
12533 ✗ txt := Tpl.writeText(txt, a_e1);
12534 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(", "));
12535 ✗ txt := Tpl.writeText(txt, a_e2);
12536 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("))"));
12537 then txt;
12538
12539 case ( txt,
12540 DAE.NEQUAL(ty = _),
12541 a_e2,
12542 a_e1 )
12543 algorithm
12544 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:LogNeq>\n"));
12545 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
12546 ✗ txt := Tpl.writeText(txt, a_e1);
12547 ✗ txt := Tpl.softNewLine(txt);
12548 ✗ txt := Tpl.writeText(txt, a_e2);
12549 ✗ txt := Tpl.softNewLine(txt);
12550 ✗ txt := Tpl.popBlock(txt);
12551 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:LogNeq>"));
12552 then txt;
12553
12554 case ( txt,
12555 _,
12556 _,
12557 _ )
12558 algorithm
12559 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("daeExpRelation:ERR"));
12560 then txt;
12561 end match;
12562 end fun_345;
12563
12564 protected function fun_346
12565 input Tpl.Text in_txt;
12566 input Boolean in_mArg;
12567 input Tpl.Text in_a_simRel;
12568 input DAE.Operator in_a_rel_operator;
12569 input DAE.Exp in_a_rel_exp2;
12570 input Tpl.Text in_a_varDecls;
12571 input Tpl.Text in_a_preExp;
12572 input SimCodeFunction.Context in_a_context;
12573 input DAE.Exp in_a_rel_exp1;
12574
12575 output Tpl.Text out_txt;
12576 output Tpl.Text out_a_varDecls;
12577 output Tpl.Text out_a_preExp;
12578 algorithm
12579 (out_txt, out_a_varDecls, out_a_preExp) :=
12580 match(in_txt, in_mArg, in_a_simRel, in_a_rel_operator, in_a_rel_exp2, in_a_varDecls, in_a_preExp, in_a_context, in_a_rel_exp1)
12581 local
12582 Tpl.Text txt;
12583 Tpl.Text a_simRel;
12584 DAE.Operator a_rel_operator;
12585 DAE.Exp a_rel_exp2;
12586 Tpl.Text a_varDecls;
12587 Tpl.Text a_preExp;
12588 SimCodeFunction.Context a_context;
12589 DAE.Exp a_rel_exp1;
12590 Tpl.Text l_e2;
12591 Tpl.Text l_e1;
12592
12593 case ( txt,
12594 true,
12595 _,
12596 a_rel_operator,
12597 a_rel_exp2,
12598 a_varDecls,
12599 a_preExp,
12600 a_context,
12601 a_rel_exp1 )
12602 algorithm
12603 2 (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp1, a_context, a_preExp, a_varDecls);
12604 2 (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp2, a_context, a_preExp, a_varDecls);
12605 2 txt := fun_345(txt, a_rel_operator, l_e2, l_e1);
12606 2 then (txt, a_varDecls, a_preExp);
12607
12608 case ( txt,
12609 _,
12610 a_simRel,
12611 _,
12612 _,
12613 a_varDecls,
12614 a_preExp,
12615 _,
12616 _ )
12617 algorithm
12618 14 txt := Tpl.writeText(txt, a_simRel);
12619 14 then (txt, a_varDecls, a_preExp);
12620 end match;
12621 end fun_346;
12622
12623 public function daeExpRelationXml
12624 input Tpl.Text in_txt;
12625 input DAE.Exp in_a_exp;
12626 input SimCodeFunction.Context in_a_context;
12627 input Tpl.Text in_a_preExp;
12628 input Tpl.Text in_a_varDecls;
12629
12630 output Tpl.Text out_txt;
12631 output Tpl.Text out_a_preExp;
12632 output Tpl.Text out_a_varDecls;
12633 algorithm
12634 (out_txt, out_a_preExp, out_a_varDecls) :=
12635 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
12636 local
12637 Tpl.Text txt;
12638 SimCodeFunction.Context a_context;
12639 Tpl.Text a_preExp;
12640 Tpl.Text a_varDecls;
12641 DAE.Operator i_rel_operator;
12642 DAE.Exp i_rel_exp2;
12643 DAE.Exp i_rel_exp1;
12644 DAE.Exp i_rel;
12645 Boolean ret_1;
12646 Tpl.Text l_simRel;
12647
12648 case ( txt,
12649 (i_rel as DAE.RELATION(exp1 = i_rel_exp1, exp2 = i_rel_exp2, operator = i_rel_operator)),
12650 a_context,
12651 a_preExp,
12652 a_varDecls )
12653 algorithm
12654 16 (l_simRel, a_preExp, a_varDecls) := daeExpRelationSimXml(Tpl.emptyTxt, i_rel, a_context, a_preExp, a_varDecls);
12655 16 ret_1 := Tpl.isEmpty(l_simRel);
12656 16 (txt, a_varDecls, a_preExp) := fun_346(txt, ret_1, l_simRel, i_rel_operator, i_rel_exp2, a_varDecls, a_preExp, a_context, i_rel_exp1);
12657 16 then (txt, a_preExp, a_varDecls);
12658
12659 case ( txt,
12660 _,
12661 _,
12662 a_preExp,
12663 a_varDecls )
12664 then (txt, a_preExp, a_varDecls);
12665 end match;
12666 end daeExpRelationXml;
12667
12668 protected function fun_348
12669 input Tpl.Text in_txt;
12670 input DAE.Operator in_a_rel_operator;
12671 input Tpl.Text in_a_res;
12672 input Tpl.Text in_a_e2;
12673 input Tpl.Text in_a_e1;
12674 input Tpl.Text in_a_preExp;
12675
12676 output Tpl.Text out_txt;
12677 output Tpl.Text out_a_preExp;
12678 algorithm
12679 (out_txt, out_a_preExp) :=
12680 match(in_txt, in_a_rel_operator, in_a_res, in_a_e2, in_a_e1, in_a_preExp)
12681 local
12682 Tpl.Text txt;
12683 Tpl.Text a_res;
12684 Tpl.Text a_e2;
12685 Tpl.Text a_e1;
12686 Tpl.Text a_preExp;
12687
12688 case ( txt,
12689 DAE.LESS(ty = _),
12690 a_res,
12691 a_e2,
12692 a_e1,
12693 a_preExp )
12694 algorithm
12695 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogLt>\n"));
12696 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12697 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12698 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12699 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12700 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12701 ✗ a_preExp := Tpl.popBlock(a_preExp);
12702 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLt>"));
12703 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12704 ✗ txt := Tpl.writeText(txt, a_res);
12705 then (txt, a_preExp);
12706
12707 case ( txt,
12708 DAE.LESSEQ(ty = _),
12709 a_res,
12710 a_e2,
12711 a_e1,
12712 a_preExp )
12713 algorithm
12714 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogLeq>\n"));
12715 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12716 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12717 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12718 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12719 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12720 ✗ a_preExp := Tpl.popBlock(a_preExp);
12721 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLeq>"));
12722 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12723 ✗ txt := Tpl.writeText(txt, a_res);
12724 then (txt, a_preExp);
12725
12726 case ( txt,
12727 DAE.GREATER(ty = _),
12728 a_res,
12729 a_e2,
12730 a_e1,
12731 a_preExp )
12732 algorithm
12733 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogGt>\n"));
12734 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12735 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12736 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12737 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12738 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12739 ✗ a_preExp := Tpl.popBlock(a_preExp);
12740 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGt>"));
12741 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12742 ✗ txt := Tpl.writeText(txt, a_res);
12743 then (txt, a_preExp);
12744
12745 case ( txt,
12746 DAE.GREATEREQ(ty = _),
12747 a_res,
12748 a_e2,
12749 a_e1,
12750 a_preExp )
12751 algorithm
12752 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogGeq>\n"));
12753 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12754 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12755 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12756 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12757 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12758 ✗ a_preExp := Tpl.popBlock(a_preExp);
12759 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGeq>"));
12760 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12761 ✗ txt := Tpl.writeText(txt, a_res);
12762 then (txt, a_preExp);
12763
12764 case ( txt,
12765 _,
12766 _,
12767 _,
12768 _,
12769 a_preExp )
12770 then (txt, a_preExp);
12771 end match;
12772 end fun_348;
12773
12774 protected function fun_349
12775 input Tpl.Text in_txt;
12776 input DAE.Operator in_a_rel_operator;
12777 input Tpl.Text in_a_res;
12778 input Tpl.Text in_a_e2;
12779 input Tpl.Text in_a_e1;
12780 input Tpl.Text in_a_preExp;
12781
12782 output Tpl.Text out_txt;
12783 output Tpl.Text out_a_preExp;
12784 algorithm
12785 (out_txt, out_a_preExp) :=
12786 match(in_txt, in_a_rel_operator, in_a_res, in_a_e2, in_a_e1, in_a_preExp)
12787 local
12788 Tpl.Text txt;
12789 Tpl.Text a_res;
12790 Tpl.Text a_e2;
12791 Tpl.Text a_e1;
12792 Tpl.Text a_preExp;
12793
12794 case ( txt,
12795 DAE.LESS(ty = _),
12796 a_res,
12797 a_e2,
12798 a_e1,
12799 a_preExp )
12800 algorithm
12801 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogLt>\n"));
12802 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
12803 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12804 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12805 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12806 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12807 ✗ a_preExp := Tpl.popBlock(a_preExp);
12808 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12809 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLt>"));
12810 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12811 ✗ a_preExp := Tpl.popBlock(a_preExp);
12812 ✗ txt := Tpl.writeText(txt, a_res);
12813 then (txt, a_preExp);
12814
12815 case ( txt,
12816 DAE.LESSEQ(ty = _),
12817 a_res,
12818 a_e2,
12819 a_e1,
12820 a_preExp )
12821 algorithm
12822 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogLeq>\n"));
12823 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
12824 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12825 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12826 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12827 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12828 ✗ a_preExp := Tpl.popBlock(a_preExp);
12829 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12830 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("<exp:LogLeq>"));
12831 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12832 ✗ a_preExp := Tpl.popBlock(a_preExp);
12833 ✗ txt := Tpl.writeText(txt, a_res);
12834 then (txt, a_preExp);
12835
12836 case ( txt,
12837 DAE.GREATER(ty = _),
12838 a_res,
12839 a_e2,
12840 a_e1,
12841 a_preExp )
12842 algorithm
12843 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogGt>\n"));
12844 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
12845 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12846 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12847 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12848 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12849 ✗ a_preExp := Tpl.popBlock(a_preExp);
12850 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12851 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGt>"));
12852 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12853 ✗ a_preExp := Tpl.popBlock(a_preExp);
12854 ✗ txt := Tpl.writeText(txt, a_res);
12855 then (txt, a_preExp);
12856
12857 case ( txt,
12858 DAE.GREATEREQ(ty = _),
12859 a_res,
12860 a_e2,
12861 a_e1,
12862 a_preExp )
12863 algorithm
12864 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogGeq>\n"));
12865 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
12866 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
12867 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12868 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
12869 ✗ a_preExp := Tpl.softNewLine(a_preExp);
12870 ✗ a_preExp := Tpl.popBlock(a_preExp);
12871 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12872 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGeq>"));
12873 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12874 ✗ a_preExp := Tpl.popBlock(a_preExp);
12875 ✗ txt := Tpl.writeText(txt, a_res);
12876 then (txt, a_preExp);
12877
12878 case ( txt,
12879 _,
12880 _,
12881 _,
12882 _,
12883 a_preExp )
12884 then (txt, a_preExp);
12885 end match;
12886 end fun_349;
12887
12888 protected function fun_350
12889 input Tpl.Text in_txt;
12890 input Option<tuple<DAE.Exp, Integer, Integer>> in_a_rel_optionExpisASUB;
12891 input DAE.Operator in_a_rel_operator;
12892 input DAE.Exp in_a_rel_exp2;
12893 input Tpl.Text in_a_varDecls;
12894 input Tpl.Text in_a_preExp;
12895 input SimCodeFunction.Context in_a_context;
12896 input DAE.Exp in_a_rel_exp1;
12897
12898 output Tpl.Text out_txt;
12899 output Tpl.Text out_a_varDecls;
12900 output Tpl.Text out_a_preExp;
12901 algorithm
12902 (out_txt, out_a_varDecls, out_a_preExp) :=
12903 match(in_txt, in_a_rel_optionExpisASUB, in_a_rel_operator, in_a_rel_exp2, in_a_varDecls, in_a_preExp, in_a_context, in_a_rel_exp1)
12904 local
12905 Tpl.Text txt;
12906 DAE.Operator a_rel_operator;
12907 DAE.Exp a_rel_exp2;
12908 Tpl.Text a_varDecls;
12909 Tpl.Text a_preExp;
12910 SimCodeFunction.Context a_context;
12911 DAE.Exp a_rel_exp1;
12912 DAE.Exp i_exp;
12913 Tpl.Text l_iterator;
12914 Tpl.Text l_res;
12915 Tpl.Text l_e2;
12916 Tpl.Text l_e1;
12917
12918 case ( txt,
12919 NONE(),
12920 a_rel_operator,
12921 a_rel_exp2,
12922 a_varDecls,
12923 a_preExp,
12924 a_context,
12925 a_rel_exp1 )
12926 algorithm
12927 ✗ (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp1, a_context, a_preExp, a_varDecls);
12928 ✗ (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp2, a_context, a_preExp, a_varDecls);
12929 ✗ (l_res, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_boolean", a_varDecls);
12930 ✗ (txt, a_preExp) := fun_348(txt, a_rel_operator, l_res, l_e2, l_e1, a_preExp);
12931 ✗ then (txt, a_varDecls, a_preExp);
12932
12933 case ( txt,
12934 SOME((i_exp, _, _)),
12935 a_rel_operator,
12936 a_rel_exp2,
12937 a_varDecls,
12938 a_preExp,
12939 a_context,
12940 a_rel_exp1 )
12941 algorithm
12942 ✗ (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp1, a_context, a_preExp, a_varDecls);
12943 ✗ (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp2, a_context, a_preExp, a_varDecls);
12944 ✗ (l_iterator, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
12945 ✗ (l_res, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_boolean", a_varDecls);
12946 ✗ (txt, a_preExp) := fun_349(txt, a_rel_operator, l_res, l_e2, l_e1, a_preExp);
12947 ✗ then (txt, a_varDecls, a_preExp);
12948
12949 case ( txt,
12950 _,
12951 _,
12952 _,
12953 a_varDecls,
12954 a_preExp,
12955 _,
12956 _ )
12957 then (txt, a_varDecls, a_preExp);
12958 end match;
12959 end fun_350;
12960
12961 protected function fun_351
12962 input Tpl.Text in_txt;
12963 input DAE.Operator in_a_rel_operator;
12964 input Tpl.Text in_a_res;
12965 input Tpl.Text in_a_e2;
12966 input Tpl.Text in_a_e1;
12967 input Tpl.Text in_a_preExp;
12968
12969 output Tpl.Text out_txt;
12970 output Tpl.Text out_a_preExp;
12971 algorithm
12972 (out_txt, out_a_preExp) :=
12973 match(in_txt, in_a_rel_operator, in_a_res, in_a_e2, in_a_e1, in_a_preExp)
12974 local
12975 Tpl.Text txt;
12976 Tpl.Text a_res;
12977 Tpl.Text a_e2;
12978 Tpl.Text a_e1;
12979 Tpl.Text a_preExp;
12980
12981 case ( txt,
12982 DAE.LESS(ty = _),
12983 a_res,
12984 a_e2,
12985 a_e1,
12986 a_preExp )
12987 algorithm
12988 9 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogLt>\n"));
12989 9 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
12990 9 a_preExp := Tpl.writeText(a_preExp, a_e1);
12991 9 a_preExp := Tpl.softNewLine(a_preExp);
12992 9 a_preExp := Tpl.writeText(a_preExp, a_e2);
12993 9 a_preExp := Tpl.softNewLine(a_preExp);
12994 9 a_preExp := Tpl.popBlock(a_preExp);
12995 9 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLt>"));
12996 9 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
12997 9 txt := Tpl.writeText(txt, a_res);
12998 then (txt, a_preExp);
12999
13000 case ( txt,
13001 DAE.LESSEQ(ty = _),
13002 a_res,
13003 a_e2,
13004 a_e1,
13005 a_preExp )
13006 algorithm
13007 1 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogLeq>\n"));
13008 1 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
13009 1 a_preExp := Tpl.writeText(a_preExp, a_e1);
13010 1 a_preExp := Tpl.softNewLine(a_preExp);
13011 1 a_preExp := Tpl.writeText(a_preExp, a_e2);
13012 1 a_preExp := Tpl.softNewLine(a_preExp);
13013 1 a_preExp := Tpl.popBlock(a_preExp);
13014 1 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLeq>"));
13015 1 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13016 1 txt := Tpl.writeText(txt, a_res);
13017 then (txt, a_preExp);
13018
13019 case ( txt,
13020 DAE.GREATER(ty = _),
13021 a_res,
13022 a_e2,
13023 a_e1,
13024 a_preExp )
13025 algorithm
13026 2 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogGt>\n"));
13027 2 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
13028 2 a_preExp := Tpl.writeText(a_preExp, a_e1);
13029 2 a_preExp := Tpl.softNewLine(a_preExp);
13030 2 a_preExp := Tpl.writeText(a_preExp, a_e2);
13031 2 a_preExp := Tpl.softNewLine(a_preExp);
13032 2 a_preExp := Tpl.popBlock(a_preExp);
13033 2 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGt>"));
13034 2 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13035 2 txt := Tpl.writeText(txt, a_res);
13036 then (txt, a_preExp);
13037
13038 case ( txt,
13039 DAE.GREATEREQ(ty = _),
13040 a_res,
13041 a_e2,
13042 a_e1,
13043 a_preExp )
13044 algorithm
13045 2 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:LogGeq>\n"));
13046 2 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
13047 2 a_preExp := Tpl.writeText(a_preExp, a_e1);
13048 2 a_preExp := Tpl.softNewLine(a_preExp);
13049 2 a_preExp := Tpl.writeText(a_preExp, a_e2);
13050 2 a_preExp := Tpl.softNewLine(a_preExp);
13051 2 a_preExp := Tpl.popBlock(a_preExp);
13052 2 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGeq>"));
13053 2 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13054 2 txt := Tpl.writeText(txt, a_res);
13055 then (txt, a_preExp);
13056
13057 case ( txt,
13058 _,
13059 _,
13060 _,
13061 _,
13062 a_preExp )
13063 then (txt, a_preExp);
13064 end match;
13065 end fun_351;
13066
13067 protected function fun_352
13068 input Tpl.Text in_txt;
13069 input DAE.Operator in_a_rel_operator;
13070 input Tpl.Text in_a_res;
13071 input Tpl.Text in_a_e2;
13072 input Tpl.Text in_a_e1;
13073 input Tpl.Text in_a_preExp;
13074
13075 output Tpl.Text out_txt;
13076 output Tpl.Text out_a_preExp;
13077 algorithm
13078 (out_txt, out_a_preExp) :=
13079 match(in_txt, in_a_rel_operator, in_a_res, in_a_e2, in_a_e1, in_a_preExp)
13080 local
13081 Tpl.Text txt;
13082 Tpl.Text a_res;
13083 Tpl.Text a_e2;
13084 Tpl.Text a_e1;
13085 Tpl.Text a_preExp;
13086
13087 case ( txt,
13088 DAE.LESS(ty = _),
13089 a_res,
13090 a_e2,
13091 a_e1,
13092 a_preExp )
13093 algorithm
13094 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogLt>\n"));
13095 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(6));
13096 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
13097 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13098 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
13099 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13100 ✗ a_preExp := Tpl.popBlock(a_preExp);
13101 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13102 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLt>"));
13103 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13104 ✗ a_preExp := Tpl.popBlock(a_preExp);
13105 ✗ txt := Tpl.writeText(txt, a_res);
13106 then (txt, a_preExp);
13107
13108 case ( txt,
13109 DAE.LESSEQ(ty = _),
13110 a_res,
13111 a_e2,
13112 a_e1,
13113 a_preExp )
13114 algorithm
13115 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogLeq>\n"));
13116 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(6));
13117 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
13118 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13119 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
13120 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13121 ✗ a_preExp := Tpl.popBlock(a_preExp);
13122 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13123 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogLeq>"));
13124 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13125 ✗ a_preExp := Tpl.popBlock(a_preExp);
13126 ✗ txt := Tpl.writeText(txt, a_res);
13127 then (txt, a_preExp);
13128
13129 case ( txt,
13130 DAE.GREATER(ty = _),
13131 a_res,
13132 a_e2,
13133 a_e1,
13134 a_preExp )
13135 algorithm
13136 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogGt>\n"));
13137 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(6));
13138 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
13139 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13140 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
13141 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13142 ✗ a_preExp := Tpl.popBlock(a_preExp);
13143 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13144 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGt>"));
13145 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13146 ✗ a_preExp := Tpl.popBlock(a_preExp);
13147 ✗ txt := Tpl.writeText(txt, a_res);
13148 then (txt, a_preExp);
13149
13150 case ( txt,
13151 DAE.GREATEREQ(ty = _),
13152 a_res,
13153 a_e2,
13154 a_e1,
13155 a_preExp )
13156 algorithm
13157 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(" <exp:LogGeq>\n"));
13158 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(6));
13159 ✗ a_preExp := Tpl.writeText(a_preExp, a_e1);
13160 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13161 ✗ a_preExp := Tpl.writeText(a_preExp, a_e2);
13162 ✗ a_preExp := Tpl.softNewLine(a_preExp);
13163 ✗ a_preExp := Tpl.popBlock(a_preExp);
13164 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13165 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:LogGeq>"));
13166 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
13167 ✗ a_preExp := Tpl.popBlock(a_preExp);
13168 ✗ txt := Tpl.writeText(txt, a_res);
13169 then (txt, a_preExp);
13170
13171 case ( txt,
13172 _,
13173 _,
13174 _,
13175 _,
13176 a_preExp )
13177 then (txt, a_preExp);
13178 end match;
13179 end fun_352;
13180
13181 protected function fun_353
13182 input Tpl.Text in_txt;
13183 input Option<tuple<DAE.Exp, Integer, Integer>> in_a_rel_optionExpisASUB;
13184 input DAE.Operator in_a_rel_operator;
13185 input DAE.Exp in_a_rel_exp2;
13186 input Tpl.Text in_a_varDecls;
13187 input Tpl.Text in_a_preExp;
13188 input SimCodeFunction.Context in_a_context;
13189 input DAE.Exp in_a_rel_exp1;
13190
13191 output Tpl.Text out_txt;
13192 output Tpl.Text out_a_varDecls;
13193 output Tpl.Text out_a_preExp;
13194 algorithm
13195 (out_txt, out_a_varDecls, out_a_preExp) :=
13196 match(in_txt, in_a_rel_optionExpisASUB, in_a_rel_operator, in_a_rel_exp2, in_a_varDecls, in_a_preExp, in_a_context, in_a_rel_exp1)
13197 local
13198 Tpl.Text txt;
13199 DAE.Operator a_rel_operator;
13200 DAE.Exp a_rel_exp2;
13201 Tpl.Text a_varDecls;
13202 Tpl.Text a_preExp;
13203 SimCodeFunction.Context a_context;
13204 DAE.Exp a_rel_exp1;
13205 DAE.Exp i_exp;
13206 Tpl.Text l_iterator;
13207 Tpl.Text l_res;
13208 Tpl.Text l_e2;
13209 Tpl.Text l_e1;
13210
13211 case ( txt,
13212 NONE(),
13213 a_rel_operator,
13214 a_rel_exp2,
13215 a_varDecls,
13216 a_preExp,
13217 a_context,
13218 a_rel_exp1 )
13219 algorithm
13220 14 (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp1, a_context, a_preExp, a_varDecls);
13221 14 (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp2, a_context, a_preExp, a_varDecls);
13222 14 (l_res, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_boolean", a_varDecls);
13223 14 (txt, a_preExp) := fun_351(txt, a_rel_operator, l_res, l_e2, l_e1, a_preExp);
13224 14 then (txt, a_varDecls, a_preExp);
13225
13226 case ( txt,
13227 SOME((i_exp, _, _)),
13228 a_rel_operator,
13229 a_rel_exp2,
13230 a_varDecls,
13231 a_preExp,
13232 a_context,
13233 a_rel_exp1 )
13234 algorithm
13235 ✗ (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp1, a_context, a_preExp, a_varDecls);
13236 ✗ (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp2, a_context, a_preExp, a_varDecls);
13237 ✗ (l_res, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_boolean", a_varDecls);
13238 ✗ (l_iterator, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
13239 ✗ (txt, a_preExp) := fun_352(txt, a_rel_operator, l_res, l_e2, l_e1, a_preExp);
13240 ✗ then (txt, a_varDecls, a_preExp);
13241
13242 case ( txt,
13243 _,
13244 _,
13245 _,
13246 a_varDecls,
13247 a_preExp,
13248 _,
13249 _ )
13250 then (txt, a_varDecls, a_preExp);
13251 end match;
13252 end fun_353;
13253
13254 protected function fun_354
13255 input Tpl.Text in_txt;
13256 input SimCodeFunction.Context in_a_context;
13257 input DAE.Operator in_a_rel_operator;
13258 input DAE.Exp in_a_rel_exp2;
13259 input Tpl.Text in_a_varDecls;
13260 input Tpl.Text in_a_preExp;
13261 input DAE.Exp in_a_rel_exp1;
13262 input Option<tuple<DAE.Exp, Integer, Integer>> in_a_rel_optionExpisASUB;
13263
13264 output Tpl.Text out_txt;
13265 output Tpl.Text out_a_varDecls;
13266 output Tpl.Text out_a_preExp;
13267 algorithm
13268 (out_txt, out_a_varDecls, out_a_preExp) :=
13269 match(in_txt, in_a_context, in_a_rel_operator, in_a_rel_exp2, in_a_varDecls, in_a_preExp, in_a_rel_exp1, in_a_rel_optionExpisASUB)
13270 local
13271 Tpl.Text txt;
13272 DAE.Operator a_rel_operator;
13273 DAE.Exp a_rel_exp2;
13274 Tpl.Text a_varDecls;
13275 Tpl.Text a_preExp;
13276 DAE.Exp a_rel_exp1;
13277 Option<tuple<DAE.Exp, Integer, Integer>> a_rel_optionExpisASUB;
13278 SimCodeFunction.Context i_context;
13279
13280 case ( txt,
13281 (i_context as SimCodeFunction.SIMULATION_CONTEXT(genDiscrete = false)),
13282 a_rel_operator,
13283 a_rel_exp2,
13284 a_varDecls,
13285 a_preExp,
13286 a_rel_exp1,
13287 a_rel_optionExpisASUB )
13288 algorithm
13289 ✗ (txt, a_varDecls, a_preExp) := fun_350(txt, a_rel_optionExpisASUB, a_rel_operator, a_rel_exp2, a_varDecls, a_preExp, i_context, a_rel_exp1);
13290 then (txt, a_varDecls, a_preExp);
13291
13292 case ( txt,
13293 (i_context as SimCodeFunction.SIMULATION_CONTEXT(genDiscrete = true)),
13294 a_rel_operator,
13295 a_rel_exp2,
13296 a_varDecls,
13297 a_preExp,
13298 a_rel_exp1,
13299 a_rel_optionExpisASUB )
13300 algorithm
13301 14 (txt, a_varDecls, a_preExp) := fun_353(txt, a_rel_optionExpisASUB, a_rel_operator, a_rel_exp2, a_varDecls, a_preExp, i_context, a_rel_exp1);
13302 then (txt, a_varDecls, a_preExp);
13303
13304 case ( txt,
13305 _,
13306 _,
13307 _,
13308 a_varDecls,
13309 a_preExp,
13310 _,
13311 _ )
13312 2 then (txt, a_varDecls, a_preExp);
13313 end match;
13314 end fun_354;
13315
13316 public function daeExpRelationSimXml
13317 input Tpl.Text in_txt;
13318 input DAE.Exp in_a_exp;
13319 input SimCodeFunction.Context in_a_context;
13320 input Tpl.Text in_a_preExp;
13321 input Tpl.Text in_a_varDecls;
13322
13323 output Tpl.Text out_txt;
13324 output Tpl.Text out_a_preExp;
13325 output Tpl.Text out_a_varDecls;
13326 algorithm
13327 (out_txt, out_a_preExp, out_a_varDecls) :=
13328 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
13329 local
13330 Tpl.Text txt;
13331 SimCodeFunction.Context a_context;
13332 Tpl.Text a_preExp;
13333 Tpl.Text a_varDecls;
13334 DAE.Operator i_rel_operator;
13335 DAE.Exp i_rel_exp2;
13336 DAE.Exp i_rel_exp1;
13337 Option<tuple<DAE.Exp, Integer, Integer>> i_rel_optionExpisASUB;
13338
13339 case ( txt,
13340 DAE.RELATION(optionExpisASUB = i_rel_optionExpisASUB, exp1 = i_rel_exp1, exp2 = i_rel_exp2, operator = i_rel_operator),
13341 a_context,
13342 a_preExp,
13343 a_varDecls )
13344 algorithm
13345 16 (txt, a_varDecls, a_preExp) := fun_354(txt, a_context, i_rel_operator, i_rel_exp2, a_varDecls, a_preExp, i_rel_exp1, i_rel_optionExpisASUB);
13346 16 then (txt, a_preExp, a_varDecls);
13347
13348 case ( txt,
13349 _,
13350 _,
13351 a_preExp,
13352 a_varDecls )
13353 then (txt, a_preExp, a_varDecls);
13354 end match;
13355 end daeExpRelationSimXml;
13356
13357 protected function fun_356
13358 input Tpl.Text in_txt;
13359 input DAE.Operator in_a_rel_operator;
13360 input Tpl.Text in_a_e2;
13361 input Tpl.Text in_a_e1;
13362
13363 output Tpl.Text out_txt;
13364 algorithm
13365 out_txt :=
13366 match(in_txt, in_a_rel_operator, in_a_e2, in_a_e1)
13367 local
13368 Tpl.Text txt;
13369 Tpl.Text a_e2;
13370 Tpl.Text a_e1;
13371
13372 case ( txt,
13373 DAE.EQUAL(ty = _),
13374 a_e2,
13375 a_e1 )
13376 algorithm
13377 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:ConstraintEqu>\n"));
13378 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
13379 ✗ txt := Tpl.writeText(txt, a_e1);
13380 ✗ txt := Tpl.softNewLine(txt);
13381 ✗ txt := Tpl.writeText(txt, a_e2);
13382 ✗ txt := Tpl.softNewLine(txt);
13383 ✗ txt := Tpl.popBlock(txt);
13384 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:ConstraintEqu>"));
13385 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
13386 then txt;
13387
13388 case ( txt,
13389 DAE.LESSEQ(ty = _),
13390 a_e2,
13391 a_e1 )
13392 algorithm
13393 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:ConstraintLeq>\n"));
13394 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
13395 ✗ txt := Tpl.writeText(txt, a_e1);
13396 ✗ txt := Tpl.softNewLine(txt);
13397 ✗ txt := Tpl.writeText(txt, a_e2);
13398 ✗ txt := Tpl.softNewLine(txt);
13399 ✗ txt := Tpl.popBlock(txt);
13400 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:ConstraintLeq>"));
13401 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
13402 then txt;
13403
13404 case ( txt,
13405 DAE.GREATEREQ(ty = _),
13406 a_e2,
13407 a_e1 )
13408 algorithm
13409 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<opt:ConstraintGeq>\n"));
13410 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
13411 ✗ txt := Tpl.writeText(txt, a_e1);
13412 ✗ txt := Tpl.softNewLine(txt);
13413 ✗ txt := Tpl.writeText(txt, a_e2);
13414 ✗ txt := Tpl.softNewLine(txt);
13415 ✗ txt := Tpl.popBlock(txt);
13416 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</opt:ConstraintGeq>"));
13417 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
13418 then txt;
13419
13420 case ( txt,
13421 _,
13422 _,
13423 _ )
13424 algorithm
13425 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" \"The XML schema does only support =, >= , <= operators for constraints\""));
13426 then txt;
13427 end match;
13428 end fun_356;
13429
13430 protected function fun_357
13431 input Tpl.Text in_txt;
13432 input Option<tuple<DAE.Exp, Integer, Integer>> in_a_rel_optionExpisASUB;
13433 input DAE.Operator in_a_rel_operator;
13434 input DAE.Exp in_a_rel_exp2;
13435 input Tpl.Text in_a_varDecls;
13436 input Tpl.Text in_a_preExp;
13437 input SimCodeFunction.Context in_a_context;
13438 input DAE.Exp in_a_rel_exp1;
13439
13440 output Tpl.Text out_txt;
13441 output Tpl.Text out_a_varDecls;
13442 output Tpl.Text out_a_preExp;
13443 algorithm
13444 (out_txt, out_a_varDecls, out_a_preExp) :=
13445 match(in_txt, in_a_rel_optionExpisASUB, in_a_rel_operator, in_a_rel_exp2, in_a_varDecls, in_a_preExp, in_a_context, in_a_rel_exp1)
13446 local
13447 Tpl.Text txt;
13448 DAE.Operator a_rel_operator;
13449 DAE.Exp a_rel_exp2;
13450 Tpl.Text a_varDecls;
13451 Tpl.Text a_preExp;
13452 SimCodeFunction.Context a_context;
13453 DAE.Exp a_rel_exp1;
13454 Tpl.Text l_res;
13455 Tpl.Text l_e2;
13456 Tpl.Text l_e1;
13457
13458 case ( txt,
13459 NONE(),
13460 a_rel_operator,
13461 a_rel_exp2,
13462 a_varDecls,
13463 a_preExp,
13464 a_context,
13465 a_rel_exp1 )
13466 algorithm
13467 ✗ (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp1, a_context, a_preExp, a_varDecls);
13468 ✗ (l_e2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_rel_exp2, a_context, a_preExp, a_varDecls);
13469 ✗ (l_res, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_boolean", a_varDecls);
13470 ✗ txt := fun_356(txt, a_rel_operator, l_e2, l_e1);
13471 ✗ then (txt, a_varDecls, a_preExp);
13472
13473 case ( txt,
13474 _,
13475 _,
13476 _,
13477 a_varDecls,
13478 a_preExp,
13479 _,
13480 _ )
13481 then (txt, a_varDecls, a_preExp);
13482 end match;
13483 end fun_357;
13484
13485 protected function fun_358
13486 input Tpl.Text in_txt;
13487 input SimCodeFunction.Context in_a_context;
13488 input DAE.Operator in_a_rel_operator;
13489 input DAE.Exp in_a_rel_exp2;
13490 input Tpl.Text in_a_varDecls;
13491 input Tpl.Text in_a_preExp;
13492 input DAE.Exp in_a_rel_exp1;
13493 input Option<tuple<DAE.Exp, Integer, Integer>> in_a_rel_optionExpisASUB;
13494
13495 output Tpl.Text out_txt;
13496 output Tpl.Text out_a_varDecls;
13497 output Tpl.Text out_a_preExp;
13498 algorithm
13499 (out_txt, out_a_varDecls, out_a_preExp) :=
13500 match(in_txt, in_a_context, in_a_rel_operator, in_a_rel_exp2, in_a_varDecls, in_a_preExp, in_a_rel_exp1, in_a_rel_optionExpisASUB)
13501 local
13502 Tpl.Text txt;
13503 DAE.Operator a_rel_operator;
13504 DAE.Exp a_rel_exp2;
13505 Tpl.Text a_varDecls;
13506 Tpl.Text a_preExp;
13507 DAE.Exp a_rel_exp1;
13508 Option<tuple<DAE.Exp, Integer, Integer>> a_rel_optionExpisASUB;
13509 SimCodeFunction.Context i_context;
13510
13511 case ( txt,
13512 (i_context as SimCodeFunction.SIMULATION_CONTEXT(genDiscrete = true)),
13513 a_rel_operator,
13514 a_rel_exp2,
13515 a_varDecls,
13516 a_preExp,
13517 a_rel_exp1,
13518 a_rel_optionExpisASUB )
13519 algorithm
13520 ✗ (txt, a_varDecls, a_preExp) := fun_357(txt, a_rel_optionExpisASUB, a_rel_operator, a_rel_exp2, a_varDecls, a_preExp, i_context, a_rel_exp1);
13521 then (txt, a_varDecls, a_preExp);
13522
13523 case ( txt,
13524 _,
13525 _,
13526 _,
13527 a_varDecls,
13528 a_preExp,
13529 _,
13530 _ )
13531 ✗ then (txt, a_varDecls, a_preExp);
13532 end match;
13533 end fun_358;
13534
13535 public function daeExpConstraintXml
13536 input Tpl.Text in_txt;
13537 input DAE.Exp in_a_exp;
13538 input SimCodeFunction.Context in_a_context;
13539 input Tpl.Text in_a_preExp;
13540 input Tpl.Text in_a_varDecls;
13541
13542 output Tpl.Text out_txt;
13543 output Tpl.Text out_a_preExp;
13544 output Tpl.Text out_a_varDecls;
13545 algorithm
13546 (out_txt, out_a_preExp, out_a_varDecls) :=
13547 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
13548 local
13549 Tpl.Text txt;
13550 SimCodeFunction.Context a_context;
13551 Tpl.Text a_preExp;
13552 Tpl.Text a_varDecls;
13553 DAE.Operator i_rel_operator;
13554 DAE.Exp i_rel_exp2;
13555 DAE.Exp i_rel_exp1;
13556 Option<tuple<DAE.Exp, Integer, Integer>> i_rel_optionExpisASUB;
13557
13558 case ( txt,
13559 DAE.RELATION(optionExpisASUB = i_rel_optionExpisASUB, exp1 = i_rel_exp1, exp2 = i_rel_exp2, operator = i_rel_operator),
13560 a_context,
13561 a_preExp,
13562 a_varDecls )
13563 algorithm
13564 ✗ (txt, a_varDecls, a_preExp) := fun_358(txt, a_context, i_rel_operator, i_rel_exp2, a_varDecls, a_preExp, i_rel_exp1, i_rel_optionExpisASUB);
13565 ✗ then (txt, a_preExp, a_varDecls);
13566
13567 case ( txt,
13568 _,
13569 _,
13570 a_preExp,
13571 a_varDecls )
13572 then (txt, a_preExp, a_varDecls);
13573 end match;
13574 end daeExpConstraintXml;
13575
13576 public function daeExpIfXml
13577 input Tpl.Text in_txt;
13578 input DAE.Exp in_a_exp;
13579 input SimCodeFunction.Context in_a_context;
13580 input Tpl.Text in_a_preExp;
13581 input Tpl.Text in_a_varDecls;
13582
13583 output Tpl.Text out_txt;
13584 output Tpl.Text out_a_preExp;
13585 output Tpl.Text out_a_varDecls;
13586 algorithm
13587 (out_txt, out_a_preExp, out_a_varDecls) :=
13588 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
13589 local
13590 Tpl.Text txt;
13591 SimCodeFunction.Context a_context;
13592 Tpl.Text a_preExp;
13593 Tpl.Text a_varDecls;
13594 DAE.Exp i_expElse;
13595 DAE.Exp i_expThen;
13596 DAE.Exp i_expCond;
13597 Tpl.Text l_eElse;
13598 Tpl.Text l_preExpElse;
13599 Tpl.Text l_eThen;
13600 Tpl.Text l_preExpThen;
13601 Tpl.Text l_resVar;
13602 Tpl.Text l_condExp;
13603 Tpl.Text l_preExpCond;
13604
13605 case ( txt,
13606 DAE.IFEXP(expCond = i_expCond, expThen = i_expThen, expElse = i_expElse),
13607 a_context,
13608 a_preExp,
13609 a_varDecls )
13610 algorithm
13611 14 l_preExpCond := Tpl.emptyTxt;
13612 14 (l_condExp, l_preExpCond, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_expCond, a_context, l_preExpCond, a_varDecls);
13613 l_resVar := Tpl.emptyTxt;
13614 14 l_preExpThen := Tpl.emptyTxt;
13615 14 (l_eThen, l_preExpThen, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_expThen, a_context, l_preExpThen, a_varDecls);
13616 14 l_preExpElse := Tpl.emptyTxt;
13617 14 (l_eElse, l_preExpElse, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_expElse, a_context, l_preExpElse, a_varDecls);
13618 14 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING_LIST({
13619 "<fun:If>\n",
13620 " <fun:Condition>\n"
13621 }, true));
13622 14 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13623 14 a_preExp := Tpl.writeText(a_preExp, l_condExp);
13624 14 a_preExp := Tpl.softNewLine(a_preExp);
13625 14 a_preExp := Tpl.popBlock(a_preExp);
13626 14 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING_LIST({
13627 " </fun:Condition>\n",
13628 " <fun:Statements>\n"
13629 }, true));
13630 14 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13631 14 a_preExp := Tpl.writeText(a_preExp, l_eThen);
13632 14 a_preExp := Tpl.softNewLine(a_preExp);
13633 14 a_preExp := Tpl.popBlock(a_preExp);
13634 14 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING_LIST({
13635 " </fun:Statements>\n",
13636 " <fun:Else>\n"
13637 }, true));
13638 14 a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(4));
13639 14 a_preExp := Tpl.writeText(a_preExp, l_eElse);
13640 14 a_preExp := Tpl.softNewLine(a_preExp);
13641 14 a_preExp := Tpl.popBlock(a_preExp);
13642 14 a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING_LIST({
13643 " </fun:Else>\n",
13644 "</fun:If>"
13645 }, false));
13646 14 txt := Tpl.writeText(txt, l_resVar);
13647 14 then (txt, a_preExp, a_varDecls);
13648
13649 case ( txt,
13650 _,
13651 _,
13652 a_preExp,
13653 a_varDecls )
13654 then (txt, a_preExp, a_varDecls);
13655 end match;
13656 end daeExpIfXml;
13657
13658 protected function fun_361
13659 input Tpl.Text in_txt;
13660 input DAE.Type in_a_ty;
13661
13662 output Tpl.Text out_txt;
13663 algorithm
13664 out_txt :=
13665 match(in_txt, in_a_ty)
13666 local
13667 Tpl.Text txt;
13668
13669 case ( txt,
13670 DAE.T_ARRAY(ty = DAE.T_INTEGER(varLst = _)) )
13671 algorithm
13672 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
13673 then txt;
13674
13675 case ( txt,
13676 DAE.T_ARRAY(ty = DAE.T_ENUMERATION(index = _)) )
13677 algorithm
13678 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer_array"));
13679 then txt;
13680
13681 case ( txt,
13682 _ )
13683 algorithm
13684 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real_array"));
13685 then txt;
13686 end match;
13687 end fun_361;
13688
13689 protected function fun_362
13690 input Tpl.Text in_txt;
13691 input Boolean in_mArg;
13692 input Tpl.Text in_a_var1;
13693
13694 output Tpl.Text out_txt;
13695 algorithm
13696 out_txt :=
13697 match(in_txt, in_mArg, in_a_var1)
13698 local
13699 Tpl.Text txt;
13700 Tpl.Text a_var1;
13701
13702 case ( txt,
13703 false,
13704 a_var1 )
13705 algorithm
13706 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("puts("));
13707 ✗ txt := Tpl.writeText(txt, a_var1);
13708 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
13709 then txt;
13710
13711 case ( txt,
13712 _,
13713 a_var1 )
13714 algorithm
13715 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("print("));
13716 ✗ txt := Tpl.writeText(txt, a_var1);
13717 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
13718 then txt;
13719 end match;
13720 end fun_362;
13721
13722 protected function lm_363
13723 input output Tpl.Text txt;
13724 input list<DAE.Exp> items;
13725 input output Tpl.Text a_varDecls;
13726 input output Tpl.Text a_preExp;
13727 input SimCodeFunction.Context a_context;
13728 algorithm
13729 ✗ for lstElt_363 in items loop
13730 (txt, a_varDecls, a_preExp) := match lstElt_363
13731 local
13732 DAE.Exp i_dim;
13733
13734 case i_dim
13735 algorithm
13736 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_dim, a_context, a_preExp, a_varDecls);
13737 ✗ txt := Tpl.nextIter(txt);
13738 then (txt, a_varDecls, a_preExp);
13739 end match;
13740 end for;
13741 end lm_363;
13742
13743 protected function lm_364
13744 input output Tpl.Text txt;
13745 input list<DAE.Exp> items;
13746 input output Tpl.Text a_varDecls;
13747 input output Tpl.Text a_preExp;
13748 input SimCodeFunction.Context a_context;
13749 algorithm
13750 ✗ for lstElt_364 in items loop
13751 (txt, a_varDecls, a_preExp) := match lstElt_364
13752 local
13753 DAE.Exp i_array;
13754
13755 case i_array
13756 algorithm
13757 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_array, a_context, a_preExp, a_varDecls);
13758 ✗ txt := Tpl.nextIter(txt);
13759 then (txt, a_varDecls, a_preExp);
13760 end match;
13761 end for;
13762 end lm_364;
13763
13764 protected function lm_365
13765 input output Tpl.Text txt;
13766 input list<DAE.Exp> items;
13767 input output Tpl.Text a_varDecls;
13768 input output Tpl.Text a_preExp;
13769 input SimCodeFunction.Context a_context;
13770 algorithm
13771
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 6 times.
23 for lstElt_365 in items loop
13772 (txt, a_varDecls, a_preExp) := match lstElt_365
13773 local
13774 DAE.Exp i_exp;
13775
13776 case i_exp
13777 algorithm
13778 17 (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_preExp, a_varDecls);
13779 17 txt := Tpl.nextIter(txt);
13780 then (txt, a_varDecls, a_preExp);
13781 end match;
13782 end for;
13783 end lm_365;
13784
13785 protected function fun_366
13786 input Tpl.Text in_txt;
13787 input Boolean in_mArg;
13788 input Tpl.Text in_a_preExp;
13789 input Tpl.Text in_a_argStr;
13790
13791 output Tpl.Text out_txt;
13792 algorithm
13793 out_txt :=
13794 match(in_txt, in_mArg, in_a_preExp, in_a_argStr)
13795 local
13796 Tpl.Text txt;
13797 Tpl.Text a_preExp;
13798 Tpl.Text a_argStr;
13799
13800 case ( txt,
13801 true,
13802 _,
13803 a_argStr )
13804 algorithm
13805 4 txt := Tpl.writeText(txt, a_argStr);
13806 then txt;
13807
13808 case ( txt,
13809 _,
13810 a_preExp,
13811 _ )
13812 algorithm
13813 2 txt := Tpl.writeText(txt, a_preExp);
13814 then txt;
13815 end match;
13816 end fun_366;
13817
13818 protected function fun_367
13819 input Tpl.Text in_txt;
13820 input DAE.Type in_a_attr_ty;
13821
13822 output Tpl.Text out_txt;
13823 algorithm
13824 out_txt :=
13825 match(in_txt, in_a_attr_ty)
13826 local
13827 Tpl.Text txt;
13828 DAE.Type i_attr_ty;
13829
13830 case ( txt,
13831 DAE.T_NORETCALL() )
13832 then txt;
13833
13834 case ( txt,
13835 i_attr_ty )
13836 algorithm
13837 5 txt := expTypeModelicaXml(txt, i_attr_ty);
13838 then txt;
13839 end match;
13840 end fun_367;
13841
13842 protected function fun_368
13843 input Tpl.Text in_txt;
13844 input Boolean in_a_attr_builtin;
13845 input DAE.Type in_a_attr_ty;
13846 input Tpl.Text in_a_funName;
13847
13848 output Tpl.Text out_txt;
13849 algorithm
13850 out_txt :=
13851 match(in_txt, in_a_attr_builtin, in_a_attr_ty, in_a_funName)
13852 local
13853 Tpl.Text txt;
13854 DAE.Type a_attr_ty;
13855 Tpl.Text a_funName;
13856
13857 case ( txt,
13858 false,
13859 _,
13860 a_funName )
13861 algorithm
13862 1 txt := Tpl.writeText(txt, a_funName);
13863 then txt;
13864
13865 case ( txt,
13866 _,
13867 a_attr_ty,
13868 _ )
13869 algorithm
13870 5 txt := fun_367(txt, a_attr_ty);
13871 then txt;
13872 end match;
13873 end fun_368;
13874
13875 protected function fun_369
13876 input Tpl.Text in_txt;
13877 input DAE.Type in_a_attr_ty;
13878 input Tpl.Text in_a_varDecls;
13879 input Tpl.Text in_a_retType;
13880
13881 output Tpl.Text out_txt;
13882 output Tpl.Text out_a_varDecls;
13883 algorithm
13884 (out_txt, out_a_varDecls) :=
13885 match(in_txt, in_a_attr_ty, in_a_varDecls, in_a_retType)
13886 local
13887 Tpl.Text txt;
13888 Tpl.Text a_varDecls;
13889 Tpl.Text a_retType;
13890
13891 case ( txt,
13892 DAE.T_NORETCALL(),
13893 a_varDecls,
13894 _ )
13895 ✗ then (txt, a_varDecls);
13896
13897 case ( txt,
13898 _,
13899 a_varDecls,
13900 a_retType )
13901 algorithm
13902 6 (txt, a_varDecls) := tempDeclXml(txt, Tpl.textString(a_retType), a_varDecls);
13903 then (txt, a_varDecls);
13904 end match;
13905 end fun_369;
13906
13907 protected function fun_370
13908 input Tpl.Text in_txt;
13909 input Boolean in_a_attr_builtin;
13910 input Tpl.Text in_a_builtinFunctionName;
13911 input Tpl.Text in_a_result;
13912 input Tpl.Text in_a_funName;
13913
13914 output Tpl.Text out_txt;
13915 algorithm
13916 out_txt :=
13917 match(in_txt, in_a_attr_builtin, in_a_builtinFunctionName, in_a_result, in_a_funName)
13918 local
13919 Tpl.Text txt;
13920 Tpl.Text a_builtinFunctionName;
13921 Tpl.Text a_result;
13922 Tpl.Text a_funName;
13923
13924 case ( txt,
13925 false,
13926 _,
13927 a_result,
13928 a_funName )
13929 algorithm
13930 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
13931 "<exp:FunctionCall>\n",
13932 " <exp:Name>\n"
13933 }, true));
13934 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
13935 1 txt := Tpl.writeText(txt, a_funName);
13936 1 txt := Tpl.softNewLine(txt);
13937 1 txt := Tpl.popBlock(txt);
13938 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
13939 " </exp:Name>\n",
13940 " <exp:Arguments>\n"
13941 }, true));
13942 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
13943 1 txt := Tpl.writeText(txt, a_result);
13944 1 txt := Tpl.softNewLine(txt);
13945 1 txt := Tpl.popBlock(txt);
13946 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
13947 " </exp:Arguments>\n",
13948 "</exp:FunctionCall>"
13949 }, false));
13950 then txt;
13951
13952 case ( txt,
13953 _,
13954 a_builtinFunctionName,
13955 a_result,
13956 _ )
13957 algorithm
13958 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("<exp:"));
13959 5 txt := Tpl.writeText(txt, a_builtinFunctionName);
13960 5 txt := Tpl.writeTok(txt, Tpl.ST_LINE(">\n"));
13961 5 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
13962 5 txt := Tpl.writeText(txt, a_result);
13963 5 txt := Tpl.softNewLine(txt);
13964 5 txt := Tpl.popBlock(txt);
13965 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:"));
13966 5 txt := Tpl.writeText(txt, a_builtinFunctionName);
13967 5 txt := Tpl.writeTok(txt, Tpl.ST_STRING(">"));
13968 then txt;
13969 end match;
13970 end fun_370;
13971
13972 protected function fun_371
13973 input Tpl.Text in_txt;
13974 input DAE.Exp in_a_exp;
13975 input Tpl.Text in_a_builtinFunctionName;
13976 input Tpl.Text in_a_result;
13977 input Tpl.Text in_a_funName;
13978
13979 output Tpl.Text out_txt;
13980 algorithm
13981 out_txt :=
13982 match(in_txt, in_a_exp, in_a_builtinFunctionName, in_a_result, in_a_funName)
13983 local
13984 Tpl.Text txt;
13985 Tpl.Text a_builtinFunctionName;
13986 Tpl.Text a_result;
13987 Tpl.Text a_funName;
13988 Boolean i_attr_builtin;
13989
13990 case ( txt,
13991 DAE.CALL(attr = DAE.CALL_ATTR(ty = DAE.T_NORETCALL())),
13992 _,
13993 _,
13994 _ )
13995 algorithm
13996 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("/* NORETCALL */"));
13997 then txt;
13998
13999 case ( txt,
14000 DAE.CALL(attr = DAE.CALL_ATTR(tuple_ = false, builtin = i_attr_builtin)),
14001 a_builtinFunctionName,
14002 a_result,
14003 a_funName )
14004 algorithm
14005 6 txt := fun_370(txt, i_attr_builtin, a_builtinFunctionName, a_result, a_funName);
14006 then txt;
14007
14008 case ( txt,
14009 _,
14010 _,
14011 a_result,
14012 a_funName )
14013 algorithm
14014 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
14015 "<exp:FunctionCall>\n",
14016 " <exp:Name>\n"
14017 }, true));
14018 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
14019 ✗ txt := Tpl.writeText(txt, a_funName);
14020 ✗ txt := Tpl.softNewLine(txt);
14021 ✗ txt := Tpl.popBlock(txt);
14022 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
14023 " </exp:Name>\n",
14024 " <exp:Arguments>\n"
14025 }, true));
14026 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(4));
14027 ✗ txt := Tpl.writeText(txt, a_result);
14028 ✗ txt := Tpl.softNewLine(txt);
14029 ✗ txt := Tpl.popBlock(txt);
14030 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
14031 " </exp:Arguments>\n",
14032 "</exp:FunctionCall>"
14033 }, false));
14034 then txt;
14035 end match;
14036 end fun_371;
14037
14038 public function daeExpCallXml
14039 input Tpl.Text in_txt;
14040 input DAE.Exp in_a_call;
14041 input SimCodeFunction.Context in_a_context;
14042 input Tpl.Text in_a_preExp;
14043 input Tpl.Text in_a_varDecls;
14044
14045 output Tpl.Text out_txt;
14046 output Tpl.Text out_a_preExp;
14047 output Tpl.Text out_a_varDecls;
14048 algorithm
14049 (out_txt, out_a_preExp, out_a_varDecls) :=
14050 match(in_txt, in_a_call, in_a_context, in_a_preExp, in_a_varDecls)
14051 local
14052 Tpl.Text txt;
14053 SimCodeFunction.Context a_context;
14054 Tpl.Text a_preExp;
14055 Tpl.Text a_varDecls;
14056 DAE.Type i_attr_ty;
14057 Boolean i_attr_builtin;
14058 Absyn.Path i_path;
14059 list<String> i_tail_vars;
14060 list<DAE.Exp> i_expLst;
14061 Integer i_i;
14062 DAE.Exp i_s1;
14063 DAE.Exp i_toBeCasted;
14064 DAE.Exp i_delayMax;
14065 DAE.Exp i_d;
14066 DAE.Exp i_v2;
14067 DAE.Exp i_v1;
14068 DAE.Exp i_n;
14069 DAE.Exp i_A;
14070 list<DAE.Exp> i_arrays;
14071 DAE.Exp i_dim;
14072 DAE.Exp i_call;
14073 list<DAE.Exp> i_dims;
14074 DAE.Exp i_val;
14075 DAE.Exp i_array;
14076 DAE.Exp i_e;
14077 DAE.Exp i_arg;
14078 DAE.ComponentRef i_arg_componentRef;
14079 DAE.Exp i_exp;
14080 DAE.Exp i_e3;
14081 DAE.Type i_ty;
14082 String i_string;
14083 DAE.Exp i_e2;
14084 DAE.Exp i_e1;
14085 Tpl.Text l_retVar;
14086 Tpl.Text l_retType;
14087 Tpl.Text l_funName;
14088 Tpl.Text l_builtinFunctionName;
14089 Boolean ret_35;
14090 Tpl.Text l_result;
14091 Tpl.Text l_preExp;
14092 Tpl.Text l_res;
14093 Tpl.Text l_expPart;
14094 Tpl.Text l_castedVar;
14095 Tpl.Text l_typeStr;
14096 Integer ret_28;
14097 Tpl.Text l_arrays__exp;
14098 Tpl.Text l_dim__exp;
14099 Tpl.Text txt_25;
14100 Integer ret_24;
14101 Tpl.Text l_dimsExp;
14102 Tpl.Text l_valExp;
14103 Tpl.Text txt_21;
14104 Tpl.Text txt_20;
14105 Tpl.Text l_tvar;
14106 Tpl.Text l_arr__tp__str;
14107 Tpl.Text l_expVar;
14108 Tpl.Text l_argStr;
14109 DAE.Exp ret_15;
14110 DAE.Exp ret_14;
14111 Tpl.Text l_retPre;
14112 Tpl.Text l_ty__str;
14113 Tpl.Text l_arr;
14114 Boolean ret_10;
14115 Tpl.Text txt_9;
14116 Tpl.Text txt_8;
14117 Tpl.Text txt_7;
14118 Tpl.Text txt_6;
14119 Tpl.Text l_var;
14120 Tpl.Text l_type;
14121 String ret_3;
14122 Tpl.Text l_var3;
14123 Tpl.Text l_var2;
14124 Tpl.Text l_var1;
14125
14126 case ( txt,
14127 DAE.CALL(path = Absyn.IDENT(name = "DIVISION"), expLst = {i_e1, i_e2, DAE.SCONST(string = i_string)}),
14128 a_context,
14129 a_preExp,
14130 a_varDecls )
14131 algorithm
14132 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14133 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14134 ✗ ret_3 := Util.escapeModelicaStringToXmlString(i_string);
14135 ✗ l_var3 := Tpl.writeStr(Tpl.emptyTxt, ret_3);
14136 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Div>\n"));
14137 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14138 ✗ txt := Tpl.writeText(txt, l_var1);
14139 ✗ txt := Tpl.softNewLine(txt);
14140 ✗ txt := Tpl.writeText(txt, l_var2);
14141 ✗ txt := Tpl.softNewLine(txt);
14142 ✗ txt := Tpl.popBlock(txt);
14143 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Div>"));
14144 ✗ then (txt, a_preExp, a_varDecls);
14145
14146 case ( txt,
14147 DAE.CALL(attr = DAE.CALL_ATTR(ty = i_ty), path = Absyn.IDENT(name = "DIVISION_ARRAY_SCALAR"), expLst = {i_e1, i_e2, (i_e3 as DAE.SHARED_LITERAL(index = _))}),
14148 a_context,
14149 a_preExp,
14150 a_varDecls )
14151 algorithm
14152 ✗ l_type := fun_361(Tpl.emptyTxt, i_ty);
14153 ✗ (l_var, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_type), a_varDecls);
14154 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14155 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14156 ✗ (l_var3, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e3, a_context, a_preExp, a_varDecls);
14157 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("division_alloc_"));
14158 ✗ a_preExp := Tpl.writeText(a_preExp, l_type);
14159 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("_scalar(&"));
14160 ✗ a_preExp := Tpl.writeText(a_preExp, l_var1);
14161 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14162 ✗ a_preExp := Tpl.writeText(a_preExp, l_var2);
14163 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14164 ✗ a_preExp := Tpl.writeText(a_preExp, l_var);
14165 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14166 ✗ a_preExp := Tpl.writeText(a_preExp, l_var3);
14167 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14168 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14169 ✗ txt := Tpl.writeText(txt, l_var);
14170 ✗ then (txt, a_preExp, a_varDecls);
14171
14172 case ( txt,
14173 (i_exp as DAE.CALL(path = Absyn.IDENT(name = "DIVISION_ARRAY_SCALAR"))),
14174 _,
14175 a_preExp,
14176 a_varDecls )
14177 algorithm
14178 ✗ txt_6 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Code generation does not support "));
14179 ✗ txt_6 := ExpressionDumpTpl.dumpExp(txt_6, i_exp, "\"");
14180 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3088, 11), Tpl.textString(txt_6));
14181 ✗ then (txt, a_preExp, a_varDecls);
14182
14183 case ( txt,
14184 DAE.CALL(path = Absyn.IDENT(name = "der"), expLst = {DAE.CREF(componentRef = i_arg_componentRef)}),
14185 _,
14186 a_preExp,
14187 a_varDecls )
14188 algorithm
14189 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Der>\n"));
14190 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14191 ✗ txt := crefXml(txt, i_arg_componentRef);
14192 ✗ txt := Tpl.softNewLine(txt);
14193 ✗ txt := Tpl.popBlock(txt);
14194 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Der>"));
14195 ✗ then (txt, a_preExp, a_varDecls);
14196
14197 case ( txt,
14198 DAE.CALL(path = Absyn.IDENT(name = "der"), expLst = {i_exp}),
14199 _,
14200 a_preExp,
14201 a_varDecls )
14202 algorithm
14203 ✗ txt_7 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Code generation does not support der("));
14204 ✗ txt_7 := ExpressionDumpTpl.dumpExp(txt_7, i_exp, "\"");
14205 ✗ txt_7 := Tpl.writeTok(txt_7, Tpl.ST_STRING(")"));
14206 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3097, 11), Tpl.textString(txt_7));
14207 ✗ then (txt, a_preExp, a_varDecls);
14208
14209 case ( txt,
14210 DAE.CALL(path = Absyn.IDENT(name = "pre"), expLst = {i_arg}),
14211 a_context,
14212 a_preExp,
14213 a_varDecls )
14214 algorithm
14215 1 (txt, a_preExp, a_varDecls) := daeExpCallPreXml(txt, i_arg, a_context, a_preExp, a_varDecls);
14216 then (txt, a_preExp, a_varDecls);
14217
14218 case ( txt,
14219 DAE.CALL(path = Absyn.IDENT(name = "edge"), expLst = {DAE.CREF(componentRef = i_arg_componentRef)}),
14220 _,
14221 a_preExp,
14222 a_varDecls )
14223 algorithm
14224 ✗ txt := crefXml(txt, i_arg_componentRef);
14225 ✗ then (txt, a_preExp, a_varDecls);
14226
14227 case ( txt,
14228 DAE.CALL(path = Absyn.IDENT(name = "edge"), expLst = {i_exp}),
14229 _,
14230 a_preExp,
14231 a_varDecls )
14232 algorithm
14233 ✗ txt_8 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Code generation does not support edge("));
14234 ✗ txt_8 := ExpressionDumpTpl.dumpExp(txt_8, i_exp, "\"");
14235 ✗ txt_8 := Tpl.writeTok(txt_8, Tpl.ST_STRING(")"));
14236 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3105, 11), Tpl.textString(txt_8));
14237 ✗ then (txt, a_preExp, a_varDecls);
14238
14239 case ( txt,
14240 DAE.CALL(path = Absyn.IDENT(name = "change"), expLst = {DAE.CREF(componentRef = i_arg_componentRef)}),
14241 _,
14242 a_preExp,
14243 a_varDecls )
14244 algorithm
14245 ✗ txt := crefXml(txt, i_arg_componentRef);
14246 ✗ then (txt, a_preExp, a_varDecls);
14247
14248 case ( txt,
14249 DAE.CALL(path = Absyn.IDENT(name = "change"), expLst = {i_exp}),
14250 _,
14251 a_preExp,
14252 a_varDecls )
14253 algorithm
14254 ✗ txt_9 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Code generation does not support change("));
14255 ✗ txt_9 := ExpressionDumpTpl.dumpExp(txt_9, i_exp, "\"");
14256 ✗ txt_9 := Tpl.writeTok(txt_9, Tpl.ST_STRING(")"));
14257 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3111, 11), Tpl.textString(txt_9));
14258 ✗ then (txt, a_preExp, a_varDecls);
14259
14260 case ( txt,
14261 DAE.CALL(path = Absyn.IDENT(name = "print"), expLst = {i_e1}),
14262 a_context,
14263 a_preExp,
14264 a_varDecls )
14265 algorithm
14266 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14267 ✗ ret_10 := Config.acceptMetaModelicaGrammar();
14268 ✗ txt := fun_362(txt, ret_10, l_var1);
14269 ✗ then (txt, a_preExp, a_varDecls);
14270
14271 case ( txt,
14272 DAE.CALL(path = Absyn.IDENT(name = "max"), attr = DAE.CALL_ATTR(ty = DAE.T_REAL(varLst = _)), expLst = {i_e1, i_e2}),
14273 a_context,
14274 a_preExp,
14275 a_varDecls )
14276 algorithm
14277 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14278 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14279 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Max>\n"));
14280 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14281 ✗ txt := Tpl.writeText(txt, l_var1);
14282 ✗ txt := Tpl.softNewLine(txt);
14283 ✗ txt := Tpl.writeText(txt, l_var2);
14284 ✗ txt := Tpl.softNewLine(txt);
14285 ✗ txt := Tpl.popBlock(txt);
14286 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Max>"));
14287 ✗ then (txt, a_preExp, a_varDecls);
14288
14289 case ( txt,
14290 DAE.CALL(path = Absyn.IDENT(name = "max"), expLst = {i_e1, i_e2}),
14291 a_context,
14292 a_preExp,
14293 a_varDecls )
14294 algorithm
14295 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14296 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14297 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Max>\n"));
14298 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14299 ✗ txt := Tpl.writeText(txt, l_var1);
14300 ✗ txt := Tpl.softNewLine(txt);
14301 ✗ txt := Tpl.writeText(txt, l_var2);
14302 ✗ txt := Tpl.softNewLine(txt);
14303 ✗ txt := Tpl.popBlock(txt);
14304 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Max>"));
14305 ✗ then (txt, a_preExp, a_varDecls);
14306
14307 case ( txt,
14308 DAE.CALL(path = Absyn.IDENT(name = "sum"), attr = DAE.CALL_ATTR(ty = i_ty), expLst = {i_e}),
14309 a_context,
14310 a_preExp,
14311 a_varDecls )
14312 algorithm
14313 ✗ (l_arr, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
14314 ✗ l_ty__str := expTypeArrayXml(Tpl.emptyTxt, i_ty);
14315 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("sum_"));
14316 ✗ txt := Tpl.writeText(txt, l_ty__str);
14317 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("(&"));
14318 ✗ txt := Tpl.writeText(txt, l_arr);
14319 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
14320 ✗ then (txt, a_preExp, a_varDecls);
14321
14322 case ( txt,
14323 DAE.CALL(path = Absyn.IDENT(name = "min"), attr = DAE.CALL_ATTR(ty = DAE.T_REAL(varLst = _)), expLst = {i_e1, i_e2}),
14324 a_context,
14325 a_preExp,
14326 a_varDecls )
14327 algorithm
14328 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14329 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14330 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Min>\n"));
14331 ✗ txt := Tpl.writeText(txt, l_var1);
14332 ✗ txt := Tpl.softNewLine(txt);
14333 ✗ txt := Tpl.writeText(txt, l_var2);
14334 ✗ txt := Tpl.softNewLine(txt);
14335 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Min>"));
14336 ✗ then (txt, a_preExp, a_varDecls);
14337
14338 case ( txt,
14339 DAE.CALL(path = Absyn.IDENT(name = "min"), expLst = {i_e1, i_e2}),
14340 a_context,
14341 a_preExp,
14342 a_varDecls )
14343 algorithm
14344 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14345 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14346 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Min>\n"));
14347 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14348 ✗ txt := Tpl.writeText(txt, l_var1);
14349 ✗ txt := Tpl.softNewLine(txt);
14350 ✗ txt := Tpl.writeText(txt, l_var2);
14351 ✗ txt := Tpl.softNewLine(txt);
14352 ✗ txt := Tpl.popBlock(txt);
14353 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Min>"));
14354 ✗ then (txt, a_preExp, a_varDecls);
14355
14356 case ( txt,
14357 DAE.CALL(path = Absyn.IDENT(name = "abs"), expLst = {i_e1}, attr = DAE.CALL_ATTR(ty = DAE.T_INTEGER(varLst = _))),
14358 a_context,
14359 a_preExp,
14360 a_varDecls )
14361 algorithm
14362 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14363 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Abs>\n"));
14364 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14365 ✗ txt := Tpl.writeText(txt, l_var1);
14366 ✗ txt := Tpl.softNewLine(txt);
14367 ✗ txt := Tpl.popBlock(txt);
14368 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Abs>"));
14369 ✗ then (txt, a_preExp, a_varDecls);
14370
14371 case ( txt,
14372 DAE.CALL(path = Absyn.IDENT(name = "abs"), expLst = {i_e1}),
14373 a_context,
14374 a_preExp,
14375 a_varDecls )
14376 algorithm
14377 3 (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14378 3 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Abs>\n"));
14379 3 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14380 3 txt := Tpl.writeText(txt, l_var1);
14381 3 txt := Tpl.softNewLine(txt);
14382 3 txt := Tpl.popBlock(txt);
14383 3 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Abs>"));
14384 3 then (txt, a_preExp, a_varDecls);
14385
14386 case ( txt,
14387 DAE.CALL(path = Absyn.IDENT(name = "sqrt"), expLst = {i_e1}, attr = DAE.CALL_ATTR(ty = _)),
14388 a_context,
14389 a_preExp,
14390 a_varDecls )
14391 algorithm
14392 1 ret_14 := SimCodeFunctionUtil.createAssertforSqrt(i_e1);
14393 1 ret_15 := SimCodeFunctionUtil.createDAEString("Model error: Argument of sqrt should be >= 0");
14394 1 (l_retPre, a_varDecls) := assertCommonXml(Tpl.emptyTxt, ret_14, ret_15, a_context, a_varDecls, Absyn.dummyInfo);
14395 1 (l_argStr, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14396 1 a_preExp := Tpl.writeText(a_preExp, l_retPre);
14397 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Sqrt>\n"));
14398 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14399 1 txt := Tpl.writeText(txt, l_argStr);
14400 1 txt := Tpl.softNewLine(txt);
14401 1 txt := Tpl.popBlock(txt);
14402 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Sqrt>"));
14403 1 then (txt, a_preExp, a_varDecls);
14404
14405 case ( txt,
14406 DAE.CALL(path = Absyn.IDENT(name = "div"), expLst = {i_e1, i_e2}, attr = DAE.CALL_ATTR(ty = DAE.T_INTEGER(varLst = _))),
14407 a_context,
14408 a_preExp,
14409 a_varDecls )
14410 algorithm
14411 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14412 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14413 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Div>\n"));
14414 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14415 ✗ txt := Tpl.writeText(txt, l_var1);
14416 ✗ txt := Tpl.softNewLine(txt);
14417 ✗ txt := Tpl.writeText(txt, l_var2);
14418 ✗ txt := Tpl.softNewLine(txt);
14419 ✗ txt := Tpl.popBlock(txt);
14420 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Div>"));
14421 ✗ then (txt, a_preExp, a_varDecls);
14422
14423 case ( txt,
14424 DAE.CALL(path = Absyn.IDENT(name = "div"), expLst = {i_e1, i_e2}),
14425 a_context,
14426 a_preExp,
14427 a_varDecls )
14428 algorithm
14429 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14430 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14431 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Div>\n"));
14432 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14433 ✗ txt := Tpl.writeText(txt, l_var1);
14434 ✗ txt := Tpl.softNewLine(txt);
14435 ✗ txt := Tpl.writeText(txt, l_var2);
14436 ✗ txt := Tpl.softNewLine(txt);
14437 ✗ txt := Tpl.popBlock(txt);
14438 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Div>"));
14439 ✗ then (txt, a_preExp, a_varDecls);
14440
14441 case ( txt,
14442 DAE.CALL(path = Absyn.IDENT(name = "mod"), expLst = {i_e1, i_e2}, attr = DAE.CALL_ATTR(ty = i_ty)),
14443 a_context,
14444 a_preExp,
14445 a_varDecls )
14446 algorithm
14447 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14448 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14449 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_mod_"));
14450 ✗ txt := expTypeShortXml(txt, i_ty);
14451 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
14452 ✗ txt := Tpl.writeText(txt, l_var1);
14453 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(","));
14454 ✗ txt := Tpl.writeText(txt, l_var2);
14455 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
14456 ✗ then (txt, a_preExp, a_varDecls);
14457
14458 case ( txt,
14459 DAE.CALL(path = Absyn.IDENT(name = "max"), attr = DAE.CALL_ATTR(ty = i_ty), expLst = {i_array}),
14460 a_context,
14461 a_preExp,
14462 a_varDecls )
14463 algorithm
14464 ✗ (l_expVar, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_array, a_context, a_preExp, a_varDecls);
14465 ✗ l_arr__tp__str := expTypeArrayXml(Tpl.emptyTxt, i_ty);
14466 ✗ txt_20 := expTypeModelicaXml(Tpl.emptyTxt, i_ty);
14467 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(txt_20), a_varDecls);
14468 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14469 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(" = max_"));
14470 ✗ a_preExp := Tpl.writeText(a_preExp, l_arr__tp__str);
14471 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
14472 ✗ a_preExp := Tpl.writeText(a_preExp, l_expVar);
14473 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14474 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14475 ✗ txt := Tpl.writeText(txt, l_tvar);
14476 ✗ then (txt, a_preExp, a_varDecls);
14477
14478 case ( txt,
14479 DAE.CALL(path = Absyn.IDENT(name = "min"), attr = DAE.CALL_ATTR(ty = i_ty), expLst = {i_array}),
14480 a_context,
14481 a_preExp,
14482 a_varDecls )
14483 algorithm
14484 ✗ (l_expVar, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_array, a_context, a_preExp, a_varDecls);
14485 ✗ l_arr__tp__str := expTypeArrayXml(Tpl.emptyTxt, i_ty);
14486 ✗ txt_21 := expTypeModelicaXml(Tpl.emptyTxt, i_ty);
14487 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(txt_21), a_varDecls);
14488 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14489 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(" = min_"));
14490 ✗ a_preExp := Tpl.writeText(a_preExp, l_arr__tp__str);
14491 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
14492 ✗ a_preExp := Tpl.writeText(a_preExp, l_expVar);
14493 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14494 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14495 ✗ txt := Tpl.writeText(txt, l_tvar);
14496 ✗ then (txt, a_preExp, a_varDecls);
14497
14498 case ( txt,
14499 DAE.CALL(path = Absyn.IDENT(name = "fill"), expLst = i_val :: i_dims, attr = DAE.CALL_ATTR(ty = i_ty)),
14500 a_context,
14501 a_preExp,
14502 a_varDecls )
14503 algorithm
14504 ✗ (l_valExp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_val, a_context, a_preExp, a_varDecls);
14505 ✗ l_dimsExp := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
14506 ✗ (l_dimsExp, a_varDecls, a_preExp) := lm_363(l_dimsExp, i_dims, a_varDecls, a_preExp, a_context);
14507 ✗ l_dimsExp := Tpl.popIter(l_dimsExp);
14508 ✗ l_ty__str := expTypeArrayXml(Tpl.emptyTxt, i_ty);
14509 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_ty__str), a_varDecls);
14510 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("fill_alloc_"));
14511 ✗ a_preExp := Tpl.writeText(a_preExp, l_ty__str);
14512 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
14513 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14514 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14515 ✗ a_preExp := Tpl.writeText(a_preExp, l_valExp);
14516 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14517 ✗ ret_24 := listLength(i_dims);
14518 ✗ a_preExp := Tpl.writeStr(a_preExp, intString(ret_24));
14519 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14520 ✗ a_preExp := Tpl.writeText(a_preExp, l_dimsExp);
14521 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14522 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14523 ✗ txt := Tpl.writeText(txt, l_tvar);
14524 ✗ then (txt, a_preExp, a_varDecls);
14525
14526 case ( txt,
14527 (i_call as DAE.CALL(path = Absyn.IDENT(name = "vector"))),
14528 _,
14529 a_preExp,
14530 a_varDecls )
14531 algorithm
14532 ✗ txt_25 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("vector() call does not have a C implementation "));
14533 ✗ txt_25 := ExpressionDumpTpl.dumpExp(txt_25, i_call, "\"");
14534 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3236, 11), Tpl.textString(txt_25));
14535 ✗ then (txt, a_preExp, a_varDecls);
14536
14537 case ( txt,
14538 DAE.CALL(path = Absyn.IDENT(name = "cat"), expLst = i_dim :: i_arrays, attr = DAE.CALL_ATTR(ty = i_ty)),
14539 a_context,
14540 a_preExp,
14541 a_varDecls )
14542 algorithm
14543 ✗ (l_dim__exp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_dim, a_context, a_preExp, a_varDecls);
14544 ✗ l_arrays__exp := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", &")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
14545 ✗ (l_arrays__exp, a_varDecls, a_preExp) := lm_364(l_arrays__exp, i_arrays, a_varDecls, a_preExp, a_context);
14546 ✗ l_arrays__exp := Tpl.popIter(l_arrays__exp);
14547 ✗ l_ty__str := expTypeArrayXml(Tpl.emptyTxt, i_ty);
14548 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_ty__str), a_varDecls);
14549 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("cat_alloc_"));
14550 ✗ a_preExp := Tpl.writeText(a_preExp, l_ty__str);
14551 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("("));
14552 ✗ a_preExp := Tpl.writeText(a_preExp, l_dim__exp);
14553 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14554 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14555 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14556 ✗ ret_28 := listLength(i_arrays);
14557 ✗ a_preExp := Tpl.writeStr(a_preExp, intString(ret_28));
14558 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14559 ✗ a_preExp := Tpl.writeText(a_preExp, l_arrays__exp);
14560 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14561 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14562 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(" where is cat2"));
14563 ✗ txt := Tpl.writeText(txt, l_tvar);
14564 ✗ then (txt, a_preExp, a_varDecls);
14565
14566 case ( txt,
14567 DAE.CALL(path = Absyn.IDENT(name = "promote"), expLst = {i_A, i_n}),
14568 a_context,
14569 a_preExp,
14570 a_varDecls )
14571 algorithm
14572 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_A, a_context, a_preExp, a_varDecls);
14573 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_n, a_context, a_preExp, a_varDecls);
14574 ✗ l_arr__tp__str := expTypeFromExpArrayXml(Tpl.emptyTxt, i_A);
14575 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arr__tp__str), a_varDecls);
14576 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("promote_alloc_"));
14577 ✗ a_preExp := Tpl.writeText(a_preExp, l_arr__tp__str);
14578 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
14579 ✗ a_preExp := Tpl.writeText(a_preExp, l_var1);
14580 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", "));
14581 ✗ a_preExp := Tpl.writeText(a_preExp, l_var2);
14582 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14583 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14584 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14585 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14586 ✗ txt := Tpl.writeText(txt, l_tvar);
14587 ✗ then (txt, a_preExp, a_varDecls);
14588
14589 case ( txt,
14590 DAE.CALL(path = Absyn.IDENT(name = "transpose"), expLst = {i_A}),
14591 a_context,
14592 a_preExp,
14593 a_varDecls )
14594 algorithm
14595 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_A, a_context, a_preExp, a_varDecls);
14596 ✗ l_arr__tp__str := expTypeFromExpArrayXml(Tpl.emptyTxt, i_A);
14597 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arr__tp__str), a_varDecls);
14598 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("transpose_alloc_"));
14599 ✗ a_preExp := Tpl.writeText(a_preExp, l_arr__tp__str);
14600 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
14601 ✗ a_preExp := Tpl.writeText(a_preExp, l_var1);
14602 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14603 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14604 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14605 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14606 ✗ txt := Tpl.writeText(txt, l_tvar);
14607 ✗ then (txt, a_preExp, a_varDecls);
14608
14609 case ( txt,
14610 DAE.CALL(path = Absyn.IDENT(name = "cross"), expLst = {i_v1, i_v2}),
14611 a_context,
14612 a_preExp,
14613 a_varDecls )
14614 algorithm
14615 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_v1, a_context, a_preExp, a_varDecls);
14616 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_v2, a_context, a_preExp, a_varDecls);
14617 ✗ l_arr__tp__str := expTypeFromExpArrayXml(Tpl.emptyTxt, i_v1);
14618 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arr__tp__str), a_varDecls);
14619 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("cross_alloc_"));
14620 ✗ a_preExp := Tpl.writeText(a_preExp, l_arr__tp__str);
14621 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
14622 ✗ a_preExp := Tpl.writeText(a_preExp, l_var1);
14623 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14624 ✗ a_preExp := Tpl.writeText(a_preExp, l_var2);
14625 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14626 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14627 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14628 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14629 ✗ txt := Tpl.writeText(txt, l_tvar);
14630 ✗ then (txt, a_preExp, a_varDecls);
14631
14632 case ( txt,
14633 DAE.CALL(path = Absyn.IDENT(name = "identity"), expLst = {i_A}),
14634 a_context,
14635 a_preExp,
14636 a_varDecls )
14637 algorithm
14638 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_A, a_context, a_preExp, a_varDecls);
14639 ✗ l_arr__tp__str := expTypeFromExpArrayXml(Tpl.emptyTxt, i_A);
14640 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arr__tp__str), a_varDecls);
14641 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("identity_alloc_"));
14642 ✗ a_preExp := Tpl.writeText(a_preExp, l_arr__tp__str);
14643 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("("));
14644 ✗ a_preExp := Tpl.writeText(a_preExp, l_var1);
14645 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
14646 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14647 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
14648 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14649 ✗ txt := Tpl.writeText(txt, l_tvar);
14650 ✗ then (txt, a_preExp, a_varDecls);
14651
14652 case ( txt,
14653 DAE.CALL(path = Absyn.IDENT(name = "rem"), expLst = {i_e1, i_e2}),
14654 a_context,
14655 a_preExp,
14656 a_varDecls )
14657 algorithm
14658 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e1, a_context, a_preExp, a_varDecls);
14659 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e2, a_context, a_preExp, a_varDecls);
14660 ✗ l_typeStr := expTypeFromExpShortXml(Tpl.emptyTxt, i_e1);
14661 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_rem_"));
14662 ✗ txt := Tpl.writeText(txt, l_typeStr);
14663 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("("));
14664 ✗ txt := Tpl.writeText(txt, l_var1);
14665 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(","));
14666 ✗ txt := Tpl.writeText(txt, l_var2);
14667 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(")"));
14668 ✗ then (txt, a_preExp, a_varDecls);
14669
14670 case ( txt,
14671 DAE.CALL(path = Absyn.IDENT(name = "delay"), expLst = {DAE.ICONST(integer = _), i_e, i_d, i_delayMax}),
14672 a_context,
14673 a_preExp,
14674 a_varDecls )
14675 algorithm
14676 ✗ (l_var1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
14677 ✗ (l_var2, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_d, a_context, a_preExp, a_varDecls);
14678 ✗ (l_var3, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_delayMax, a_context, a_preExp, a_varDecls);
14679 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Delay>\n"));
14680 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
14681 ✗ txt := Tpl.writeText(txt, l_var1);
14682 ✗ txt := Tpl.softNewLine(txt);
14683 ✗ txt := Tpl.writeText(txt, l_var2);
14684 ✗ txt := Tpl.softNewLine(txt);
14685 ✗ txt := Tpl.writeText(txt, l_var3);
14686 ✗ txt := Tpl.softNewLine(txt);
14687 ✗ txt := Tpl.popBlock(txt);
14688 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Delay>"));
14689 ✗ then (txt, a_preExp, a_varDecls);
14690
14691 case ( txt,
14692 DAE.CALL(path = Absyn.IDENT(name = "integer"), expLst = {i_toBeCasted}),
14693 a_context,
14694 a_preExp,
14695 a_varDecls )
14696 algorithm
14697 ✗ (l_castedVar, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_toBeCasted, a_context, a_preExp, a_varDecls);
14698 ✗ txt := Tpl.writeText(txt, l_castedVar);
14699 ✗ then (txt, a_preExp, a_varDecls);
14700
14701 case ( txt,
14702 DAE.CALL(path = Absyn.IDENT(name = "Integer"), expLst = {i_toBeCasted}),
14703 a_context,
14704 a_preExp,
14705 a_varDecls )
14706 algorithm
14707 ✗ (l_castedVar, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_toBeCasted, a_context, a_preExp, a_varDecls);
14708 ✗ txt := Tpl.writeText(txt, l_castedVar);
14709 ✗ then (txt, a_preExp, a_varDecls);
14710
14711 case ( txt,
14712 DAE.CALL(path = Absyn.IDENT(name = "clock"), expLst = {}),
14713 _,
14714 a_preExp,
14715 a_varDecls )
14716 algorithm
14717 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("mmc_clock()"));
14718 ✗ then (txt, a_preExp, a_varDecls);
14719
14720 case ( txt,
14721 DAE.CALL(path = Absyn.IDENT(name = "noEvent"), expLst = {i_e1}),
14722 a_context,
14723 a_preExp,
14724 a_varDecls )
14725 algorithm
14726 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_e1, a_context, a_preExp, a_varDecls);
14727 then (txt, a_preExp, a_varDecls);
14728
14729 case ( txt,
14730 DAE.CALL(path = Absyn.IDENT(name = "anyString"), expLst = {i_e1}),
14731 a_context,
14732 a_preExp,
14733 a_varDecls )
14734 algorithm
14735 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_e1, a_context, a_preExp, a_varDecls);
14736 then (txt, a_preExp, a_varDecls);
14737
14738 case ( txt,
14739 DAE.CALL(path = Absyn.IDENT(name = "mmc_get_field"), expLst = {i_s1, DAE.ICONST(integer = i_i)}),
14740 a_context,
14741 a_preExp,
14742 a_varDecls )
14743 algorithm
14744 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, "modelica_metatype", a_varDecls);
14745 ✗ (l_expPart, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_s1, a_context, a_preExp, a_varDecls);
14746 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
14747 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(" = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR("));
14748 ✗ a_preExp := Tpl.writeText(a_preExp, l_expPart);
14749 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("), "));
14750 ✗ a_preExp := Tpl.writeStr(a_preExp, intString(i_i));
14751 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("));"));
14752 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
14753 ✗ txt := Tpl.writeText(txt, l_tvar);
14754 ✗ then (txt, a_preExp, a_varDecls);
14755
14756 case ( txt,
14757 DAE.CALL(path = Absyn.IDENT(name = "mmc_unbox_record"), expLst = {_}, attr = DAE.CALL_ATTR(ty = _)),
14758 _,
14759 a_preExp,
14760 a_varDecls )
14761 algorithm
14762 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" \"mmc_unbox_record\" is not necessary"));
14763 ✗ then (txt, a_preExp, a_varDecls);
14764
14765 case ( txt,
14766 (i_exp as DAE.CALL(attr = DAE.CALL_ATTR(tailCall = DAE.TAIL(vars = i_tail_vars)), expLst = i_expLst)),
14767 a_context,
14768 a_preExp,
14769 a_varDecls )
14770 algorithm
14771 ✗ l_res := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("/* Tail recursive call "));
14772 ✗ l_res := ExpressionDumpTpl.dumpExp(l_res, i_exp, "\"");
14773 ✗ l_res := Tpl.writeTok(l_res, Tpl.ST_LINE(" */\n"));
14774 ✗ (l_res, a_preExp, a_varDecls) := daeExpTailCallXml(l_res, i_expLst, i_tail_vars, a_context, a_preExp, a_varDecls);
14775 ✗ l_res := Tpl.writeTok(l_res, Tpl.ST_STRING_LIST({
14776 "goto _tailrecursive;\n",
14777 "/* TODO: Make sure any eventual dead code below is never generated */"
14778 }, false));
14779 ✗ a_preExp := Tpl.writeText(a_preExp, l_res);
14780 ✗ then (txt, a_preExp, a_varDecls);
14781
14782 case ( txt,
14783 (i_exp as DAE.CALL(attr = DAE.CALL_ATTR(builtin = i_attr_builtin, ty = i_attr_ty), expLst = i_expLst, path = i_path)),
14784 a_context,
14785 a_preExp,
14786 a_varDecls )
14787 algorithm
14788 6 l_preExp := Tpl.emptyTxt;
14789 6 l_argStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
14790 6 (l_argStr, a_varDecls, l_preExp) := lm_365(l_argStr, i_expLst, a_varDecls, l_preExp, a_context);
14791 6 l_argStr := Tpl.popIter(l_argStr);
14792 6 ret_35 := Tpl.isEmpty(l_preExp);
14793 6 l_result := fun_366(Tpl.emptyTxt, ret_35, l_preExp, l_argStr);
14794 6 l_builtinFunctionName := builtinFunctionNameXml(Tpl.emptyTxt, i_path);
14795 6 l_funName := underscorePathXml(Tpl.emptyTxt, i_path);
14796 6 l_retType := fun_368(Tpl.emptyTxt, i_attr_builtin, i_attr_ty, l_funName);
14797 6 (l_retVar, a_varDecls) := fun_369(Tpl.emptyTxt, i_attr_ty, a_varDecls, l_retType);
14798 6 txt := fun_371(txt, i_exp, l_builtinFunctionName, l_result, l_funName);
14799 6 then (txt, a_preExp, a_varDecls);
14800
14801 case ( txt,
14802 _,
14803 _,
14804 a_preExp,
14805 a_varDecls )
14806 ✗ then (txt, a_preExp, a_varDecls);
14807 end match;
14808 end daeExpCallXml;
14809
14810 public function builtinFunctionNameXml
14811 input Tpl.Text in_txt;
14812 input Absyn.Path in_a_path;
14813
14814 output Tpl.Text out_txt;
14815 algorithm
14816 out_txt :=
14817 match(in_txt, in_a_path)
14818 local
14819 Tpl.Text txt;
14820 Absyn.Path i_path;
14821
14822 case ( txt,
14823 Absyn.IDENT(name = "DIVISION") )
14824 algorithm
14825 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Div"));
14826 then txt;
14827
14828 case ( txt,
14829 Absyn.IDENT(name = "ADDITION") )
14830 algorithm
14831 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Add"));
14832 then txt;
14833
14834 case ( txt,
14835 Absyn.IDENT(name = "SUBTRACTION") )
14836 algorithm
14837 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Sub"));
14838 then txt;
14839
14840 case ( txt,
14841 Absyn.IDENT(name = "POWER") )
14842 algorithm
14843 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Pow"));
14844 then txt;
14845
14846 case ( txt,
14847 Absyn.IDENT(name = "sin") )
14848 algorithm
14849 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Sin"));
14850 then txt;
14851
14852 case ( txt,
14853 Absyn.IDENT(name = "cos") )
14854 algorithm
14855 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Cos"));
14856 then txt;
14857
14858 case ( txt,
14859 Absyn.IDENT(name = "tan") )
14860 algorithm
14861 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Tan"));
14862 then txt;
14863
14864 case ( txt,
14865 Absyn.IDENT(name = "asin") )
14866 algorithm
14867 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Asin"));
14868 then txt;
14869
14870 case ( txt,
14871 Absyn.IDENT(name = "acos") )
14872 algorithm
14873 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Acos"));
14874 then txt;
14875
14876 case ( txt,
14877 Absyn.IDENT(name = "atan") )
14878 algorithm
14879 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Atan"));
14880 then txt;
14881
14882 case ( txt,
14883 Absyn.IDENT(name = "sinh") )
14884 algorithm
14885 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Sinh"));
14886 then txt;
14887
14888 case ( txt,
14889 Absyn.IDENT(name = "cosh") )
14890 algorithm
14891 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Cosh"));
14892 then txt;
14893
14894 case ( txt,
14895 Absyn.IDENT(name = "tanh") )
14896 algorithm
14897 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Tanh"));
14898 then txt;
14899
14900 case ( txt,
14901 Absyn.IDENT(name = "exp") )
14902 algorithm
14903 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Exp"));
14904 then txt;
14905
14906 case ( txt,
14907 Absyn.IDENT(name = "log") )
14908 algorithm
14909 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Log"));
14910 then txt;
14911
14912 case ( txt,
14913 Absyn.IDENT(name = "log10") )
14914 algorithm
14915 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Log10"));
14916 then txt;
14917
14918 case ( txt,
14919 Absyn.IDENT(name = "sqrt") )
14920 algorithm
14921 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Sqrt"));
14922 then txt;
14923
14924 case ( txt,
14925 Absyn.IDENT(name = "atan2") )
14926 algorithm
14927 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Atan2"));
14928 then txt;
14929
14930 case ( txt,
14931 Absyn.IDENT(name = "abs") )
14932 algorithm
14933 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Abs"));
14934 then txt;
14935
14936 case ( txt,
14937 Absyn.IDENT(name = "sign") )
14938 algorithm
14939 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Sign"));
14940 then txt;
14941
14942 case ( txt,
14943 Absyn.IDENT(name = "min") )
14944 algorithm
14945 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Min"));
14946 then txt;
14947
14948 case ( txt,
14949 Absyn.IDENT(name = "max") )
14950 algorithm
14951 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Max"));
14952 then txt;
14953
14954 case ( txt,
14955 Absyn.IDENT(name = "noEvent") )
14956 algorithm
14957 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("NoEvent"));
14958 then txt;
14959
14960 case ( txt,
14961 Absyn.IDENT(name = "array") )
14962 algorithm
14963 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Array"));
14964 then txt;
14965
14966 case ( txt,
14967 Absyn.IDENT(name = "sample") )
14968 algorithm
14969 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Sample"));
14970 then txt;
14971
14972 case ( txt,
14973 Absyn.IDENT(name = "smooth") )
14974 algorithm
14975 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("Smooth"));
14976 then txt;
14977
14978 case ( txt,
14979 Absyn.IDENT(name = "homotopy") )
14980 algorithm
14981 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("Homotopy"));
14982 then txt;
14983
14984 case ( txt,
14985 i_path )
14986 algorithm
14987 3 txt := dotPathXml(txt, i_path);
14988 then txt;
14989 end match;
14990 end builtinFunctionNameXml;
14991
14992 protected function fun_374
14993 input Tpl.Text in_txt;
14994 input Boolean in_mArg;
14995 input Tpl.Text in_a_varDecls;
14996 input Tpl.Text in_a_preExp;
14997 input SimCodeFunction.Context in_a_context;
14998 input list<String> in_a_vrest;
14999 input list<DAE.Exp> in_a_erest;
15000 input Tpl.Text in_a_exp;
15001 input String in_a_v;
15002
15003 output Tpl.Text out_txt;
15004 output Tpl.Text out_a_varDecls;
15005 output Tpl.Text out_a_preExp;
15006 algorithm
15007 (out_txt, out_a_varDecls, out_a_preExp) :=
15008 match(in_txt, in_mArg, in_a_varDecls, in_a_preExp, in_a_context, in_a_vrest, in_a_erest, in_a_exp, in_a_v)
15009 local
15010 Tpl.Text txt;
15011 Tpl.Text a_varDecls;
15012 Tpl.Text a_preExp;
15013 SimCodeFunction.Context a_context;
15014 list<String> a_vrest;
15015 list<DAE.Exp> a_erest;
15016 Tpl.Text a_exp;
15017 String a_v;
15018
15019 case ( txt,
15020 false,
15021 a_varDecls,
15022 a_preExp,
15023 a_context,
15024 a_vrest,
15025 a_erest,
15026 a_exp,
15027 a_v )
15028 algorithm
15029 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_"));
15030 ✗ txt := Tpl.writeStr(txt, a_v);
15031 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
15032 ✗ txt := Tpl.writeText(txt, a_exp);
15033 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
15034 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
15035 ✗ (txt, a_preExp, a_varDecls) := daeExpTailCallXml(txt, a_erest, a_vrest, a_context, a_preExp, a_varDecls);
15036 ✗ then (txt, a_varDecls, a_preExp);
15037
15038 case ( txt,
15039 _,
15040 a_varDecls,
15041 a_preExp,
15042 a_context,
15043 a_vrest,
15044 a_erest,
15045 _,
15046 _ )
15047 algorithm
15048 ✗ (txt, a_preExp, a_varDecls) := daeExpTailCallXml(txt, a_erest, a_vrest, a_context, a_preExp, a_varDecls);
15049 ✗ then (txt, a_varDecls, a_preExp);
15050 end match;
15051 end fun_374;
15052
15053 protected function fun_375
15054 input Tpl.Text in_txt;
15055 input DAE.Exp in_a_e;
15056 input Tpl.Text in_a_varDecls;
15057 input Tpl.Text in_a_preExp;
15058 input SimCodeFunction.Context in_a_context;
15059 input list<String> in_a_vrest;
15060 input list<DAE.Exp> in_a_erest;
15061 input Tpl.Text in_a_exp;
15062 input String in_a_v;
15063
15064 output Tpl.Text out_txt;
15065 output Tpl.Text out_a_varDecls;
15066 output Tpl.Text out_a_preExp;
15067 algorithm
15068 (out_txt, out_a_varDecls, out_a_preExp) :=
15069 match(in_txt, in_a_e, in_a_varDecls, in_a_preExp, in_a_context, in_a_vrest, in_a_erest, in_a_exp, in_a_v)
15070 local
15071 Tpl.Text txt;
15072 Tpl.Text a_varDecls;
15073 Tpl.Text a_preExp;
15074 SimCodeFunction.Context a_context;
15075 list<String> a_vrest;
15076 list<DAE.Exp> a_erest;
15077 Tpl.Text a_exp;
15078 String a_v;
15079 DAE.ComponentRef i_cr;
15080 Boolean ret_1;
15081 Tpl.Text txt_0;
15082
15083 case ( txt,
15084 DAE.CREF(componentRef = i_cr, ty = DAE.T_FUNCTION_REFERENCE_VAR(functionType = _)),
15085 a_varDecls,
15086 a_preExp,
15087 a_context,
15088 a_vrest,
15089 a_erest,
15090 a_exp,
15091 a_v )
15092 algorithm
15093 ✗ txt_0 := crefStrXml(Tpl.emptyTxt, i_cr);
15094 ✗ ret_1 := stringEq(a_v, Tpl.textString(txt_0));
15095 ✗ (txt, a_varDecls, a_preExp) := fun_374(txt, ret_1, a_varDecls, a_preExp, a_context, a_vrest, a_erest, a_exp, a_v);
15096 then (txt, a_varDecls, a_preExp);
15097
15098 case ( txt,
15099 _,
15100 a_varDecls,
15101 a_preExp,
15102 a_context,
15103 a_vrest,
15104 a_erest,
15105 a_exp,
15106 a_v )
15107 algorithm
15108 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_"));
15109 ✗ txt := Tpl.writeStr(txt, a_v);
15110 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
15111 ✗ txt := Tpl.writeText(txt, a_exp);
15112 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(";"));
15113 ✗ txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE());
15114 ✗ (txt, a_preExp, a_varDecls) := daeExpTailCallXml(txt, a_erest, a_vrest, a_context, a_preExp, a_varDecls);
15115 ✗ then (txt, a_varDecls, a_preExp);
15116 end match;
15117 end fun_375;
15118
15119 protected function fun_376
15120 input Tpl.Text in_txt;
15121 input list<String> in_a_vs;
15122 input list<DAE.Exp> in_a_erest;
15123 input Tpl.Text in_a_varDecls;
15124 input Tpl.Text in_a_preExp;
15125 input SimCodeFunction.Context in_a_context;
15126 input DAE.Exp in_a_e;
15127
15128 output Tpl.Text out_txt;
15129 output Tpl.Text out_a_varDecls;
15130 output Tpl.Text out_a_preExp;
15131 algorithm
15132 (out_txt, out_a_varDecls, out_a_preExp) :=
15133 match(in_txt, in_a_vs, in_a_erest, in_a_varDecls, in_a_preExp, in_a_context, in_a_e)
15134 local
15135 Tpl.Text txt;
15136 list<DAE.Exp> a_erest;
15137 Tpl.Text a_varDecls;
15138 Tpl.Text a_preExp;
15139 SimCodeFunction.Context a_context;
15140 DAE.Exp a_e;
15141 list<String> i_vrest;
15142 String i_v;
15143 Tpl.Text l_exp;
15144
15145 case ( txt,
15146 i_v :: i_vrest,
15147 a_erest,
15148 a_varDecls,
15149 a_preExp,
15150 a_context,
15151 a_e )
15152 algorithm
15153 ✗ (l_exp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, a_e, a_context, a_preExp, a_varDecls);
15154 ✗ (txt, a_varDecls, a_preExp) := fun_375(txt, a_e, a_varDecls, a_preExp, a_context, i_vrest, a_erest, l_exp, i_v);
15155 then (txt, a_varDecls, a_preExp);
15156
15157 case ( txt,
15158 _,
15159 _,
15160 a_varDecls,
15161 a_preExp,
15162 _,
15163 _ )
15164 ✗ then (txt, a_varDecls, a_preExp);
15165 end match;
15166 end fun_376;
15167
15168 public function daeExpTailCallXml
15169 input Tpl.Text in_txt;
15170 input list<DAE.Exp> in_a_es;
15171 input list<String> in_a_vs;
15172 input SimCodeFunction.Context in_a_context;
15173 input Tpl.Text in_a_preExp;
15174 input Tpl.Text in_a_varDecls;
15175
15176 output Tpl.Text out_txt;
15177 output Tpl.Text out_a_preExp;
15178 output Tpl.Text out_a_varDecls;
15179 algorithm
15180 (out_txt, out_a_preExp, out_a_varDecls) :=
15181 match(in_txt, in_a_es, in_a_vs, in_a_context, in_a_preExp, in_a_varDecls)
15182 local
15183 Tpl.Text txt;
15184 list<String> a_vs;
15185 SimCodeFunction.Context a_context;
15186 Tpl.Text a_preExp;
15187 Tpl.Text a_varDecls;
15188 list<DAE.Exp> i_erest;
15189 DAE.Exp i_e;
15190
15191 case ( txt,
15192 i_e :: i_erest,
15193 a_vs,
15194 a_context,
15195 a_preExp,
15196 a_varDecls )
15197 algorithm
15198 ✗ (txt, a_varDecls, a_preExp) := fun_376(txt, a_vs, i_erest, a_varDecls, a_preExp, a_context, i_e);
15199 ✗ then (txt, a_preExp, a_varDecls);
15200
15201 case ( txt,
15202 _,
15203 _,
15204 _,
15205 a_preExp,
15206 a_varDecls )
15207 then (txt, a_preExp, a_varDecls);
15208 end match;
15209 end daeExpTailCallXml;
15210
15211 public function daeExpCallBuiltinPrefixXml
15212 input Tpl.Text in_txt;
15213 input Boolean in_a_builtin;
15214
15215 output Tpl.Text out_txt;
15216 algorithm
15217 out_txt :=
15218 match(in_txt, in_a_builtin)
15219 local
15220 Tpl.Text txt;
15221
15222 case ( txt,
15223 true )
15224 then txt;
15225
15226 case ( txt,
15227 false )
15228 algorithm
15229 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_"));
15230 then txt;
15231
15232 case ( txt,
15233 _ )
15234 then txt;
15235 end match;
15236 end daeExpCallBuiltinPrefixXml;
15237
15238 protected function lm_379
15239 input output Tpl.Text txt;
15240 input list<DAE.Exp> items;
15241 input output Tpl.Text a_varDecls;
15242 input output Tpl.Text a_preExp;
15243 input SimCodeFunction.Context a_context;
15244 algorithm
15245 ✗ for lstElt_379 in items loop
15246 (txt, a_varDecls, a_preExp) := match lstElt_379
15247 local
15248 DAE.Exp i_e;
15249
15250 case i_e
15251 algorithm
15252 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_e, a_context, a_preExp, a_varDecls);
15253 ✗ txt := Tpl.nextIter(txt);
15254 then (txt, a_varDecls, a_preExp);
15255 end match;
15256 end for;
15257 end lm_379;
15258
15259 public function daeExpArrayXml
15260 input Tpl.Text in_txt;
15261 input DAE.Exp in_a_exp;
15262 input SimCodeFunction.Context in_a_context;
15263 input Tpl.Text in_a_preExp;
15264 input Tpl.Text in_a_varDecls;
15265
15266 output Tpl.Text out_txt;
15267 output Tpl.Text out_a_preExp;
15268 output Tpl.Text out_a_varDecls;
15269 algorithm
15270 (out_txt, out_a_preExp, out_a_varDecls) :=
15271 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
15272 local
15273 Tpl.Text txt;
15274 SimCodeFunction.Context a_context;
15275 Tpl.Text a_preExp;
15276 Tpl.Text a_varDecls;
15277 list<DAE.Exp> i_array;
15278 Tpl.Text l_params;
15279
15280 case ( txt,
15281 DAE.ARRAY(array = i_array),
15282 a_context,
15283 a_preExp,
15284 a_varDecls )
15285 algorithm
15286 ✗ l_params := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
15287 ✗ (l_params, a_varDecls, a_preExp) := lm_379(l_params, i_array, a_varDecls, a_preExp, a_context);
15288 ✗ l_params := Tpl.popIter(l_params);
15289 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Array>\n"));
15290 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
15291 ✗ a_preExp := Tpl.writeText(a_preExp, l_params);
15292 ✗ a_preExp := Tpl.softNewLine(a_preExp);
15293 ✗ a_preExp := Tpl.popBlock(a_preExp);
15294 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Array>"));
15295 ✗ txt := Tpl.writeText(txt, l_params);
15296 ✗ then (txt, a_preExp, a_varDecls);
15297
15298 case ( txt,
15299 _,
15300 _,
15301 a_preExp,
15302 a_varDecls )
15303 then (txt, a_preExp, a_varDecls);
15304 end match;
15305 end daeExpArrayXml;
15306
15307 protected function lm_381
15308 input output Tpl.Text txt;
15309 input list<list<DAE.Exp>> items;
15310 input output Tpl.Text a_vars2;
15311 input output Tpl.Text a_promote;
15312 input SimCodeFunction.Context a_context;
15313 input output Tpl.Text a_varDecls;
15314 input Tpl.Text a_arrayTypeStr;
15315 algorithm
15316 ✗ for lstElt_381 in items loop
15317 (txt, a_vars2, a_promote, a_varDecls) := match lstElt_381
15318 local
15319 list<DAE.Exp> i_row;
15320 Tpl.Text l_vars;
15321 Tpl.Text l_tmp;
15322
15323 case i_row
15324 algorithm
15325 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(a_arrayTypeStr), a_varDecls);
15326 ✗ (l_vars, a_promote, a_varDecls) := daeExpMatrixRowXml(Tpl.emptyTxt, i_row, Tpl.textString(a_arrayTypeStr), a_context, a_promote, a_varDecls);
15327 ✗ a_vars2 := Tpl.writeTok(a_vars2, Tpl.ST_STRING(", &"));
15328 ✗ a_vars2 := Tpl.writeText(a_vars2, l_tmp);
15329 ✗ txt := Tpl.nextIter(txt);
15330 then (txt, a_vars2, a_promote, a_varDecls);
15331 end match;
15332 end for;
15333 end lm_381;
15334
15335 public function daeExpMatrixXml
15336 input Tpl.Text in_txt;
15337 input DAE.Exp in_a_exp;
15338 input SimCodeFunction.Context in_a_context;
15339 input Tpl.Text in_a_preExp;
15340 input Tpl.Text in_a_varDecls;
15341
15342 output Tpl.Text out_txt;
15343 output Tpl.Text out_a_preExp;
15344 output Tpl.Text out_a_varDecls;
15345 algorithm
15346 (out_txt, out_a_preExp, out_a_varDecls) :=
15347 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
15348 local
15349 Tpl.Text txt;
15350 SimCodeFunction.Context a_context;
15351 Tpl.Text a_preExp;
15352 Tpl.Text a_varDecls;
15353 list<list<DAE.Exp>> i_m_matrix;
15354 DAE.Type i_m_ty;
15355 Tpl.Text l_tmp;
15356 Tpl.Text l_catAlloc;
15357 Tpl.Text l_promote;
15358 Tpl.Text l_vars2;
15359 Tpl.Text l_arrayTypeStr;
15360
15361 case ( txt,
15362 DAE.MATRIX(matrix = {{}}),
15363 _,
15364 a_preExp,
15365 a_varDecls )
15366 then (txt, a_preExp, a_varDecls);
15367
15368 case ( txt,
15369 DAE.MATRIX(matrix = {}),
15370 _,
15371 a_preExp,
15372 a_varDecls )
15373 then (txt, a_preExp, a_varDecls);
15374
15375 case ( txt,
15376 DAE.MATRIX(ty = i_m_ty, matrix = i_m_matrix),
15377 a_context,
15378 a_preExp,
15379 a_varDecls )
15380 algorithm
15381 ✗ l_arrayTypeStr := expTypeArrayXml(Tpl.emptyTxt, i_m_ty);
15382 ✗ l_vars2 := Tpl.emptyTxt;
15383 ✗ l_promote := Tpl.emptyTxt;
15384 ✗ l_catAlloc := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
15385 ✗ (l_catAlloc, l_vars2, l_promote, a_varDecls) := lm_381(l_catAlloc, i_m_matrix, l_vars2, l_promote, a_context, a_varDecls, l_arrayTypeStr);
15386 ✗ l_catAlloc := Tpl.popIter(l_catAlloc);
15387 ✗ a_preExp := Tpl.writeText(a_preExp, l_promote);
15388 ✗ a_preExp := Tpl.writeText(a_preExp, l_catAlloc);
15389 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
15390 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arrayTypeStr), a_varDecls);
15391 ✗ txt := Tpl.writeText(txt, l_tmp);
15392 ✗ then (txt, a_preExp, a_varDecls);
15393
15394 case ( txt,
15395 _,
15396 _,
15397 a_preExp,
15398 a_varDecls )
15399 then (txt, a_preExp, a_varDecls);
15400 end match;
15401 end daeExpMatrixXml;
15402
15403 protected function lm_383
15404 input output Tpl.Text txt;
15405 input list<DAE.Exp> items;
15406 input output Tpl.Text a_varLstStr;
15407 input String a_arrayTypeStr;
15408 input output Tpl.Text a_varDecls;
15409 input output Tpl.Text a_preExp;
15410 input SimCodeFunction.Context a_context;
15411 algorithm
15412 ✗ for lstElt_383 in items loop
15413 (txt, a_varLstStr, a_varDecls, a_preExp) := match lstElt_383
15414 local
15415 DAE.Exp i_e;
15416 Tpl.Text l_tmp;
15417 Tpl.Text l_expVar;
15418
15419 case i_e
15420 algorithm
15421 ✗ (l_expVar, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
15422 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, a_arrayTypeStr, a_varDecls);
15423 ✗ a_varLstStr := Tpl.writeTok(a_varLstStr, Tpl.ST_STRING(", &"));
15424 ✗ a_varLstStr := Tpl.writeText(a_varLstStr, l_tmp);
15425 ✗ txt := Tpl.writeText(txt, l_expVar);
15426 ✗ txt := Tpl.nextIter(txt);
15427 then (txt, a_varLstStr, a_varDecls, a_preExp);
15428 end match;
15429 end for;
15430 end lm_383;
15431
15432 public function daeExpMatrixRowXml
15433 input Tpl.Text txt;
15434 input list<DAE.Exp> a_row;
15435 input String a_arrayTypeStr;
15436 input SimCodeFunction.Context a_context;
15437 input Tpl.Text a_preExp;
15438 input Tpl.Text a_varDecls;
15439
15440 output Tpl.Text out_txt;
15441 output Tpl.Text out_a_preExp;
15442 output Tpl.Text out_a_varDecls;
15443 protected
15444 Tpl.Text l_preExp2;
15445 Tpl.Text l_varLstStr;
15446 algorithm
15447 ✗ l_varLstStr := Tpl.emptyTxt;
15448 ✗ l_preExp2 := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
15449 ✗ (l_preExp2, l_varLstStr, out_a_varDecls, out_a_preExp) := lm_383(l_preExp2, a_row, l_varLstStr, a_arrayTypeStr, a_varDecls, a_preExp, a_context);
15450 ✗ l_preExp2 := Tpl.popIter(l_preExp2);
15451 ✗ l_preExp2 := Tpl.writeTok(l_preExp2, Tpl.ST_NEW_LINE());
15452 ✗ out_a_preExp := Tpl.writeText(out_a_preExp, l_preExp2);
15453 ✗ out_txt := Tpl.writeText(txt, l_varLstStr);
15454 end daeExpMatrixRowXml;
15455
15456 protected function fun_385
15457 input Tpl.Text in_txt;
15458 input Option<DAE.Exp> in_a_step;
15459 input Tpl.Text in_a_varDecls;
15460 input Tpl.Text in_a_preExp;
15461 input SimCodeFunction.Context in_a_context;
15462
15463 output Tpl.Text out_txt;
15464 output Tpl.Text out_a_varDecls;
15465 output Tpl.Text out_a_preExp;
15466 algorithm
15467 (out_txt, out_a_varDecls, out_a_preExp) :=
15468 match(in_txt, in_a_step, in_a_varDecls, in_a_preExp, in_a_context)
15469 local
15470 Tpl.Text txt;
15471 Tpl.Text a_varDecls;
15472 Tpl.Text a_preExp;
15473 SimCodeFunction.Context a_context;
15474 DAE.Exp i_stepExp;
15475
15476 case ( txt,
15477 SOME(i_stepExp),
15478 a_varDecls,
15479 a_preExp,
15480 a_context )
15481 algorithm
15482 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_stepExp, a_context, a_preExp, a_varDecls);
15483 ✗ then (txt, a_varDecls, a_preExp);
15484
15485 case ( txt,
15486 _,
15487 a_varDecls,
15488 a_preExp,
15489 _ )
15490 algorithm
15491 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("1"));
15492 ✗ then (txt, a_varDecls, a_preExp);
15493 end match;
15494 end fun_385;
15495
15496 public function daeExpRangeXml
15497 input Tpl.Text in_txt;
15498 input DAE.Exp in_a_exp;
15499 input SimCodeFunction.Context in_a_context;
15500 input Tpl.Text in_a_preExp;
15501 input Tpl.Text in_a_varDecls;
15502
15503 output Tpl.Text out_txt;
15504 output Tpl.Text out_a_preExp;
15505 output Tpl.Text out_a_varDecls;
15506 algorithm
15507 (out_txt, out_a_preExp, out_a_varDecls) :=
15508 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
15509 local
15510 Tpl.Text txt;
15511 SimCodeFunction.Context a_context;
15512 Tpl.Text a_preExp;
15513 Tpl.Text a_varDecls;
15514 Option<DAE.Exp> i_step;
15515 DAE.Exp i_stop;
15516 DAE.Exp i_start;
15517 DAE.Type i_ty;
15518 Tpl.Text l_step__exp;
15519 Tpl.Text l_tmp;
15520 Tpl.Text l_stop__exp;
15521 Tpl.Text l_start__exp;
15522 Tpl.Text l_ty__str;
15523
15524 case ( txt,
15525 DAE.RANGE(ty = i_ty, start = i_start, stop = i_stop, step = i_step),
15526 a_context,
15527 a_preExp,
15528 a_varDecls )
15529 algorithm
15530 ✗ l_ty__str := expTypeArrayXml(Tpl.emptyTxt, i_ty);
15531 ✗ (l_start__exp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_start, a_context, a_preExp, a_varDecls);
15532 ✗ (l_stop__exp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_stop, a_context, a_preExp, a_varDecls);
15533 ✗ (l_tmp, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_ty__str), a_varDecls);
15534 ✗ (l_step__exp, a_varDecls, a_preExp) := fun_385(Tpl.emptyTxt, i_step, a_varDecls, a_preExp, a_context);
15535 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE("<exp:Range>\n"));
15536 ✗ a_preExp := Tpl.pushBlock(a_preExp, Tpl.BT_INDENT(2));
15537 ✗ a_preExp := Tpl.writeText(a_preExp, l_start__exp);
15538 ✗ a_preExp := Tpl.softNewLine(a_preExp);
15539 ✗ a_preExp := Tpl.writeText(a_preExp, l_step__exp);
15540 ✗ a_preExp := Tpl.softNewLine(a_preExp);
15541 ✗ a_preExp := Tpl.writeText(a_preExp, l_stop__exp);
15542 ✗ a_preExp := Tpl.softNewLine(a_preExp);
15543 ✗ a_preExp := Tpl.popBlock(a_preExp);
15544 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("</exp:Range>"));
15545 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
15546 ✗ txt := Tpl.writeText(txt, l_tmp);
15547 ✗ then (txt, a_preExp, a_varDecls);
15548
15549 case ( txt,
15550 _,
15551 _,
15552 a_preExp,
15553 a_varDecls )
15554 then (txt, a_preExp, a_varDecls);
15555 end match;
15556 end daeExpRangeXml;
15557
15558 protected function fun_387
15559 input Tpl.Text in_txt;
15560 input DAE.Type in_a_ty;
15561 input Tpl.Text in_a_preExp;
15562 input DAE.Exp in_a_exp;
15563 input Tpl.Text in_a_varDecls;
15564 input Tpl.Text in_a_expVar;
15565
15566 output Tpl.Text out_txt;
15567 output Tpl.Text out_a_preExp;
15568 output Tpl.Text out_a_varDecls;
15569 algorithm
15570 (out_txt, out_a_preExp, out_a_varDecls) :=
15571 match(in_txt, in_a_ty, in_a_preExp, in_a_exp, in_a_varDecls, in_a_expVar)
15572 local
15573 Tpl.Text txt;
15574 Tpl.Text a_preExp;
15575 DAE.Exp a_exp;
15576 Tpl.Text a_varDecls;
15577 Tpl.Text a_expVar;
15578 DAE.Type i_ty;
15579 Tpl.Text l_from;
15580 Tpl.Text l_to;
15581 Tpl.Text l_tvar;
15582 Tpl.Text l_arrayTypeStr;
15583
15584 case ( txt,
15585 DAE.T_INTEGER(varLst = _),
15586 a_preExp,
15587 _,
15588 a_varDecls,
15589 a_expVar )
15590 algorithm
15591 ✗ txt := Tpl.writeText(txt, a_expVar);
15592 ✗ then (txt, a_preExp, a_varDecls);
15593
15594 case ( txt,
15595 DAE.T_REAL(varLst = _),
15596 a_preExp,
15597 _,
15598 a_varDecls,
15599 a_expVar )
15600 algorithm
15601 ✗ txt := Tpl.writeText(txt, a_expVar);
15602 ✗ then (txt, a_preExp, a_varDecls);
15603
15604 case ( txt,
15605 DAE.T_ENUMERATION(index = _),
15606 a_preExp,
15607 _,
15608 a_varDecls,
15609 a_expVar )
15610 algorithm
15611 ✗ txt := Tpl.writeText(txt, a_expVar);
15612 ✗ then (txt, a_preExp, a_varDecls);
15613
15614 case ( txt,
15615 DAE.T_BOOL(varLst = _),
15616 a_preExp,
15617 _,
15618 a_varDecls,
15619 a_expVar )
15620 algorithm
15621 ✗ txt := Tpl.writeText(txt, a_expVar);
15622 ✗ then (txt, a_preExp, a_varDecls);
15623
15624 case ( txt,
15625 DAE.T_ARRAY(ty = i_ty),
15626 a_preExp,
15627 a_exp,
15628 a_varDecls,
15629 a_expVar )
15630 algorithm
15631 ✗ l_arrayTypeStr := expTypeArrayXml(Tpl.emptyTxt, i_ty);
15632 ✗ (l_tvar, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(l_arrayTypeStr), a_varDecls);
15633 ✗ l_to := expTypeShortXml(Tpl.emptyTxt, i_ty);
15634 ✗ l_from := expTypeFromExpShortXml(Tpl.emptyTxt, a_exp);
15635 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("cast_"));
15636 ✗ a_preExp := Tpl.writeText(a_preExp, l_from);
15637 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("_array_to_"));
15638 ✗ a_preExp := Tpl.writeText(a_preExp, l_to);
15639 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("(&"));
15640 ✗ a_preExp := Tpl.writeText(a_preExp, a_expVar);
15641 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(", &"));
15642 ✗ a_preExp := Tpl.writeText(a_preExp, l_tvar);
15643 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING(");"));
15644 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_NEW_LINE());
15645 ✗ txt := Tpl.writeText(txt, l_tvar);
15646 ✗ then (txt, a_preExp, a_varDecls);
15647
15648 case ( txt,
15649 _,
15650 a_preExp,
15651 _,
15652 a_varDecls,
15653 a_expVar )
15654 algorithm
15655 ✗ txt := Tpl.writeText(txt, a_expVar);
15656 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" /* could not cast, using the variable as it is */"));
15657 ✗ then (txt, a_preExp, a_varDecls);
15658 end match;
15659 end fun_387;
15660
15661 public function daeExpCastXml
15662 input Tpl.Text in_txt;
15663 input DAE.Exp in_a_exp;
15664 input SimCodeFunction.Context in_a_context;
15665 input Tpl.Text in_a_preExp;
15666 input Tpl.Text in_a_varDecls;
15667
15668 output Tpl.Text out_txt;
15669 output Tpl.Text out_a_preExp;
15670 output Tpl.Text out_a_varDecls;
15671 algorithm
15672 (out_txt, out_a_preExp, out_a_varDecls) :=
15673 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
15674 local
15675 Tpl.Text txt;
15676 SimCodeFunction.Context a_context;
15677 Tpl.Text a_preExp;
15678 Tpl.Text a_varDecls;
15679 DAE.Type i_ty;
15680 DAE.Exp i_exp;
15681 Tpl.Text l_expVar;
15682
15683 case ( txt,
15684 DAE.CAST(exp = i_exp, ty = i_ty),
15685 a_context,
15686 a_preExp,
15687 a_varDecls )
15688 algorithm
15689 ✗ (l_expVar, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
15690 ✗ (txt, a_preExp, a_varDecls) := fun_387(txt, i_ty, a_preExp, i_exp, a_varDecls, l_expVar);
15691 then (txt, a_preExp, a_varDecls);
15692
15693 case ( txt,
15694 _,
15695 _,
15696 a_preExp,
15697 a_varDecls )
15698 ✗ then (txt, a_preExp, a_varDecls);
15699 end match;
15700 end daeExpCastXml;
15701
15702 public function daeSubscriptXML
15703 input Tpl.Text in_txt;
15704 input DAE.Subscript in_a_sub;
15705 input SimCodeFunction.Context in_a_context;
15706 input Tpl.Text in_a_preExp;
15707 input Tpl.Text in_a_varDecls;
15708
15709 output Tpl.Text out_txt;
15710 output Tpl.Text out_a_preExp;
15711 output Tpl.Text out_a_varDecls;
15712 algorithm
15713 (out_txt, out_a_preExp, out_a_varDecls) :=
15714 match(in_txt, in_a_sub, in_a_context, in_a_preExp, in_a_varDecls)
15715 local
15716 Tpl.Text txt;
15717 SimCodeFunction.Context a_context;
15718 Tpl.Text a_preExp;
15719 Tpl.Text a_varDecls;
15720 DAE.Exp i_exp;
15721
15722 case ( txt,
15723 DAE.INDEX(exp = i_exp),
15724 a_context,
15725 a_preExp,
15726 a_varDecls )
15727 algorithm
15728 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_preExp, a_varDecls);
15729 then (txt, a_preExp, a_varDecls);
15730
15731 case ( txt,
15732 _,
15733 _,
15734 a_preExp,
15735 a_varDecls )
15736 algorithm
15737 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3580, 14), "non INDEX(_) (i.e., slice) subscripts probably should not reach here. Check indexedAssign template.");
15738 ✗ then (txt, a_preExp, a_varDecls);
15739 end match;
15740 end daeSubscriptXML;
15741
15742 protected function fun_390
15743 input Tpl.Text in_txt;
15744 input DAE.Exp in_a_inExp;
15745 input Tpl.Text in_a_varDecls;
15746 input Tpl.Text in_a_preExp;
15747 input SimCodeFunction.Context in_a_context;
15748
15749 output Tpl.Text out_txt;
15750 output Tpl.Text out_a_varDecls;
15751 output Tpl.Text out_a_preExp;
15752 algorithm
15753 (out_txt, out_a_varDecls, out_a_preExp) :=
15754 match(in_txt, in_a_inExp, in_a_varDecls, in_a_preExp, in_a_context)
15755 local
15756 Tpl.Text txt;
15757 Tpl.Text a_varDecls;
15758 Tpl.Text a_preExp;
15759 SimCodeFunction.Context a_context;
15760 DAE.Subscript i_idx;
15761 DAE.Exp i_e;
15762 Tpl.Text l_idx1;
15763 Tpl.Text l_e1;
15764
15765 case ( txt,
15766 DAE.ASUB(exp = i_e, sub = {i_idx}),
15767 a_varDecls,
15768 a_preExp,
15769 a_context )
15770 algorithm
15771 ✗ (l_e1, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
15772 ✗ (l_idx1, a_preExp, a_varDecls) := daeSubscriptXML(Tpl.emptyTxt, i_idx, a_context, a_preExp, a_varDecls);
15773 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("arrayGet("));
15774 ✗ txt := Tpl.writeText(txt, l_e1);
15775 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(","));
15776 ✗ txt := Tpl.writeText(txt, l_idx1);
15777 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") /* DAE.ASUB */"));
15778 ✗ then (txt, a_varDecls, a_preExp);
15779
15780 case ( txt,
15781 _,
15782 a_varDecls,
15783 a_preExp,
15784 _ )
15785 then (txt, a_varDecls, a_preExp);
15786 end match;
15787 end fun_390;
15788
15789 protected function lm_391
15790 input output Tpl.Text txt;
15791 input list<DAE.Exp> items;
15792 input Tpl.Text a_res;
15793 input SimCodeFunction.Context a_context;
15794 algorithm
15795 ✗ for lstElt_391 in items loop
15796 txt := match lstElt_391
15797 local
15798 Integer x_i1;
15799 DAE.Exp i_e;
15800 Tpl.Text l_v;
15801 Tpl.Text l_casePreExp;
15802 Tpl.Text l_caseVarDecls;
15803
15804 case i_e
15805 algorithm
15806 ✗ x_i1 := Tpl.getIteri_i0(txt);
15807 ✗ l_caseVarDecls := Tpl.emptyTxt;
15808 ✗ l_casePreExp := Tpl.emptyTxt;
15809 ✗ (l_v, l_casePreExp, l_caseVarDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, l_casePreExp, l_caseVarDecls);
15810 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("case "));
15811 ✗ txt := Tpl.writeStr(txt, intString(x_i1));
15812 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE(": {\n"));
15813 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
15814 ✗ txt := Tpl.writeText(txt, l_caseVarDecls);
15815 ✗ txt := Tpl.softNewLine(txt);
15816 ✗ txt := Tpl.writeText(txt, l_casePreExp);
15817 ✗ txt := Tpl.softNewLine(txt);
15818 ✗ txt := Tpl.writeText(txt, a_res);
15819 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" = "));
15820 ✗ txt := Tpl.writeText(txt, l_v);
15821 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
15822 ";\n",
15823 "break;\n"
15824 }, true));
15825 ✗ txt := Tpl.popBlock(txt);
15826 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("}"));
15827 ✗ txt := Tpl.nextIter(txt);
15828 then txt;
15829 end match;
15830 end for;
15831 end lm_391;
15832
15833 protected function fun_392
15834 input Tpl.Text in_txt;
15835 input SimCodeFunction.Context in_a_context;
15836 input Tpl.Text in_a_varDecls;
15837 input Tpl.Text in_a_preExp;
15838 input list<DAE.Subscript> in_a_subs;
15839 input DAE.Type in_a_ecr_ty;
15840 input Tpl.Text in_a_arrName;
15841
15842 output Tpl.Text out_txt;
15843 output Tpl.Text out_a_varDecls;
15844 output Tpl.Text out_a_preExp;
15845 algorithm
15846 (out_txt, out_a_varDecls, out_a_preExp) :=
15847 match(in_txt, in_a_context, in_a_varDecls, in_a_preExp, in_a_subs, in_a_ecr_ty, in_a_arrName)
15848 local
15849 Tpl.Text txt;
15850 Tpl.Text a_varDecls;
15851 Tpl.Text a_preExp;
15852 list<DAE.Subscript> a_subs;
15853 DAE.Type a_ecr_ty;
15854 Tpl.Text a_arrName;
15855 SimCodeFunction.Context i_context;
15856
15857 case ( txt,
15858 SimCodeFunction.FUNCTION_CONTEXT(cref_prefix = _),
15859 a_varDecls,
15860 a_preExp,
15861 _,
15862 _,
15863 a_arrName )
15864 algorithm
15865 ✗ txt := Tpl.writeText(txt, a_arrName);
15866 ✗ then (txt, a_varDecls, a_preExp);
15867
15868 case ( txt,
15869 i_context,
15870 a_varDecls,
15871 a_preExp,
15872 a_subs,
15873 a_ecr_ty,
15874 a_arrName )
15875 algorithm
15876 ✗ (txt, a_preExp, a_varDecls) := arrayScalarRhsXml(txt, a_ecr_ty, a_subs, Tpl.textString(a_arrName), i_context, a_preExp, a_varDecls);
15877 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Asub array scalar RHS"));
15878 ✗ then (txt, a_varDecls, a_preExp);
15879 end match;
15880 end fun_392;
15881
15882 protected function fun_393
15883 input Tpl.Text in_txt;
15884 input DAE.Exp in_a_inExp;
15885 input Tpl.Text in_a_preExp;
15886 input SimCodeFunction.Context in_a_context;
15887 input Tpl.Text in_a_varDecls;
15888
15889 output Tpl.Text out_txt;
15890 output Tpl.Text out_a_preExp;
15891 output Tpl.Text out_a_varDecls;
15892 algorithm
15893 (out_txt, out_a_preExp, out_a_varDecls) :=
15894 match(in_txt, in_a_inExp, in_a_preExp, in_a_context, in_a_varDecls)
15895 local
15896 Tpl.Text txt;
15897 Tpl.Text a_preExp;
15898 SimCodeFunction.Context a_context;
15899 Tpl.Text a_varDecls;
15900 DAE.Exp i_e;
15901 DAE.Type i_ecr_ty;
15902 list<DAE.Subscript> i_subs;
15903 DAE.Exp i_ecr;
15904 list<DAE.Exp> i_exp_array;
15905 DAE.Subscript i_idx;
15906 DAE.Exp i_exp;
15907 Tpl.Text txt_9;
15908 Tpl.Text l_exp;
15909 DAE.Exp ret_7;
15910 Tpl.Text l_arrName;
15911 Tpl.Text txt_5;
15912 Tpl.Text l_expl;
15913 Tpl.Text l_idx1;
15914 Tpl.Text txt_2;
15915 Tpl.Text l_res;
15916 Tpl.Text txt_0;
15917
15918 case ( txt,
15919 DAE.ASUB(exp = (i_exp as DAE.ASUB(exp = _))),
15920 a_preExp,
15921 _,
15922 a_varDecls )
15923 algorithm
15924 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Nested array subscripting *should* have been handled by the routine creating the asub, but for some reason it was not: "));
15925 ✗ txt_0 := ExpressionDumpTpl.dumpExp(txt_0, i_exp, "\"");
15926 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3600, 11), Tpl.textString(txt_0));
15927 ✗ then (txt, a_preExp, a_varDecls);
15928
15929 case ( txt,
15930 DAE.ASUB(exp = (i_exp as DAE.ARRAY(scalar = true, array = i_exp_array)), sub = {i_idx}),
15931 a_preExp,
15932 a_context,
15933 a_varDecls )
15934 algorithm
15935 ✗ txt_2 := expTypeFromExpModelicaXml(Tpl.emptyTxt, i_exp);
15936 ✗ (l_res, a_varDecls) := tempDeclXml(Tpl.emptyTxt, Tpl.textString(txt_2), a_varDecls);
15937 ✗ l_res := Tpl.writeTok(l_res, Tpl.ST_STRING(" asub tmp test"));
15938 ✗ (l_idx1, a_preExp, a_varDecls) := daeSubscriptXML(Tpl.emptyTxt, i_idx, a_context, a_preExp, a_varDecls);
15939 ✗ l_expl := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(1, NONE(), SOME(Tpl.ST_NEW_LINE()), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
15940 ✗ l_expl := lm_391(l_expl, i_exp_array, l_res, a_context);
15941 ✗ l_expl := Tpl.popIter(l_expl);
15942 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING("switch ("));
15943 ✗ a_preExp := Tpl.writeText(a_preExp, l_idx1);
15944 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_LINE(") { /* ASUB */\n"));
15945 ✗ a_preExp := Tpl.writeText(a_preExp, l_expl);
15946 ✗ a_preExp := Tpl.softNewLine(a_preExp);
15947 ✗ a_preExp := Tpl.writeTok(a_preExp, Tpl.ST_STRING_LIST({
15948 "default:\n",
15949 " assert(NULL == \"index out of bounds\");\n",
15950 "}"
15951 }, false));
15952 ✗ txt := Tpl.writeText(txt, l_res);
15953 ✗ then (txt, a_preExp, a_varDecls);
15954
15955 case ( txt,
15956 DAE.ASUB(exp = (i_exp as DAE.RANGE(ty = _)), sub = {_}),
15957 a_preExp,
15958 _,
15959 a_varDecls )
15960 algorithm
15961 ✗ txt_5 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("ASUB_EASY_CASE "));
15962 ✗ txt_5 := ExpressionDumpTpl.dumpExp(txt_5, i_exp, "\"");
15963 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3629, 11), Tpl.textString(txt_5));
15964 ✗ then (txt, a_preExp, a_varDecls);
15965
15966 case ( txt,
15967 DAE.ASUB(exp = (i_ecr as DAE.CREF(ty = i_ecr_ty)), sub = i_subs),
15968 a_preExp,
15969 a_context,
15970 a_varDecls )
15971 algorithm
15972 ✗ ret_7 := SimCodeFunctionUtil.buildCrefExpFromSubs(i_ecr, i_subs);
15973 ✗ (l_arrName, a_preExp, a_varDecls) := daeExpCrefRhsXml(Tpl.emptyTxt, ret_7, a_context, a_preExp, a_varDecls);
15974 ✗ (txt, a_varDecls, a_preExp) := fun_392(txt, a_context, a_varDecls, a_preExp, i_subs, i_ecr_ty, l_arrName);
15975 ✗ then (txt, a_preExp, a_varDecls);
15976
15977 case ( txt,
15978 DAE.ASUB(exp = i_e, sub = _),
15979 a_preExp,
15980 a_context,
15981 a_varDecls )
15982 algorithm
15983 ✗ (l_exp, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_e, a_context, a_preExp, a_varDecls);
15984 ✗ txt := Tpl.writeText(txt, l_exp);
15985 ✗ then (txt, a_preExp, a_varDecls);
15986
15987 case ( txt,
15988 i_exp,
15989 a_preExp,
15990 _,
15991 a_varDecls )
15992 algorithm
15993 ✗ txt_9 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("OTHER_ASUB "));
15994 ✗ txt_9 := ExpressionDumpTpl.dumpExp(txt_9, i_exp, "\"");
15995 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3644, 11), Tpl.textString(txt_9));
15996 ✗ then (txt, a_preExp, a_varDecls);
15997 end match;
15998 end fun_393;
15999
16000 protected function fun_394
16001 input Tpl.Text in_txt;
16002 input String in_mArg;
16003 input DAE.Exp in_a_inExp;
16004 input SimCodeFunction.Context in_a_context;
16005 input Tpl.Text in_a_preExp;
16006 input Tpl.Text in_a_varDecls;
16007
16008 output Tpl.Text out_txt;
16009 output Tpl.Text out_a_preExp;
16010 output Tpl.Text out_a_varDecls;
16011 algorithm
16012 (out_txt, out_a_preExp, out_a_varDecls) :=
16013 match(in_txt, in_mArg, in_a_inExp, in_a_context, in_a_preExp, in_a_varDecls)
16014 local
16015 Tpl.Text txt;
16016 DAE.Exp a_inExp;
16017 SimCodeFunction.Context a_context;
16018 Tpl.Text a_preExp;
16019 Tpl.Text a_varDecls;
16020
16021 case ( txt,
16022 "metatype",
16023 a_inExp,
16024 a_context,
16025 a_preExp,
16026 a_varDecls )
16027 algorithm
16028 ✗ (txt, a_varDecls, a_preExp) := fun_390(txt, a_inExp, a_varDecls, a_preExp, a_context);
16029 ✗ then (txt, a_preExp, a_varDecls);
16030
16031 case ( txt,
16032 _,
16033 a_inExp,
16034 a_context,
16035 a_preExp,
16036 a_varDecls )
16037 algorithm
16038 ✗ (txt, a_preExp, a_varDecls) := fun_393(txt, a_inExp, a_preExp, a_context, a_varDecls);
16039 then (txt, a_preExp, a_varDecls);
16040 end match;
16041 end fun_394;
16042
16043 public function daeExpAsubXml
16044 input Tpl.Text txt;
16045 input DAE.Exp a_inExp;
16046 input SimCodeFunction.Context a_context;
16047 input Tpl.Text a_preExp;
16048 input Tpl.Text a_varDecls;
16049
16050 output Tpl.Text out_txt;
16051 output Tpl.Text out_a_preExp;
16052 output Tpl.Text out_a_varDecls;
16053 protected
16054 String str_1;
16055 Tpl.Text txt_0;
16056 algorithm
16057 ✗ txt_0 := expTypeFromExpShortXml(Tpl.emptyTxt, a_inExp);
16058 ✗ str_1 := Tpl.textString(txt_0);
16059 ✗ (out_txt, out_a_preExp, out_a_varDecls) := fun_394(txt, str_1, a_inExp, a_context, a_preExp, a_varDecls);
16060 end daeExpAsubXml;
16061
16062 public function daeExpASubIndexXml
16063 input Tpl.Text in_txt;
16064 input DAE.Exp in_a_exp;
16065 input SimCodeFunction.Context in_a_context;
16066 input Tpl.Text in_a_preExp;
16067 input Tpl.Text in_a_varDecls;
16068
16069 output Tpl.Text out_txt;
16070 output Tpl.Text out_a_preExp;
16071 output Tpl.Text out_a_varDecls;
16072 algorithm
16073 (out_txt, out_a_preExp, out_a_varDecls) :=
16074 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
16075 local
16076 Tpl.Text txt;
16077 SimCodeFunction.Context a_context;
16078 Tpl.Text a_preExp;
16079 Tpl.Text a_varDecls;
16080 DAE.Exp i_exp;
16081 Integer i_index;
16082 Integer i_integer;
16083 Integer ret_1;
16084 Integer ret_0;
16085
16086 case ( txt,
16087 DAE.ICONST(integer = i_integer),
16088 _,
16089 a_preExp,
16090 a_varDecls )
16091 algorithm
16092 ✗ ret_0 := SimCodeFunctionUtil.incrementInt(i_integer, -1);
16093 ✗ txt := Tpl.writeStr(txt, intString(ret_0));
16094 ✗ then (txt, a_preExp, a_varDecls);
16095
16096 case ( txt,
16097 DAE.ENUM_LITERAL(index = i_index),
16098 _,
16099 a_preExp,
16100 a_varDecls )
16101 algorithm
16102 ✗ ret_1 := SimCodeFunctionUtil.incrementInt(i_index, -1);
16103 ✗ txt := Tpl.writeStr(txt, intString(ret_1));
16104 ✗ then (txt, a_preExp, a_varDecls);
16105
16106 case ( txt,
16107 i_exp,
16108 a_context,
16109 a_preExp,
16110 a_varDecls )
16111 algorithm
16112 ✗ (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp, a_context, a_preExp, a_varDecls);
16113 then (txt, a_preExp, a_varDecls);
16114 end match;
16115 end daeExpASubIndexXml;
16116
16117 protected function fun_397
16118 input Tpl.Text in_txt;
16119 input DAE.Exp in_a_exp;
16120
16121 output Tpl.Text out_txt;
16122 algorithm
16123 out_txt :=
16124 match(in_txt, in_a_exp)
16125 local
16126 Tpl.Text txt;
16127 DAE.Exp i_exp;
16128 DAE.ComponentRef i_cr_componentRef;
16129 Tpl.Text txt_0;
16130
16131 case ( txt,
16132 DAE.CREF(componentRef = i_cr_componentRef) )
16133 algorithm
16134 1 txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Pre>\n"));
16135 1 txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
16136 1 txt := crefXml(txt, i_cr_componentRef);
16137 1 txt := Tpl.softNewLine(txt);
16138 1 txt := Tpl.popBlock(txt);
16139 1 txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Pre>"));
16140 then txt;
16141
16142 case ( txt,
16143 DAE.ASUB(exp = DAE.CREF(componentRef = _), sub = {_}) )
16144 algorithm
16145 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(" \"case ASUB(exp = cr as CREF(__), sub = {sub_exp}) is not yet implemented\""));
16146 then txt;
16147
16148 case ( txt,
16149 i_exp )
16150 algorithm
16151 ✗ txt_0 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("Code generation does not support pre("));
16152 ✗ txt_0 := ExpressionDumpTpl.dumpExp(txt_0, i_exp, "\"");
16153 ✗ txt_0 := Tpl.writeTok(txt_0, Tpl.ST_STRING(")"));
16154 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3671, 11), Tpl.textString(txt_0));
16155 then txt;
16156 end match;
16157 end fun_397;
16158
16159 public function daeExpCallPreXml
16160 input Tpl.Text txt;
16161 input DAE.Exp a_exp;
16162 input SimCodeFunction.Context a_context;
16163 input Tpl.Text a_preExp;
16164 input Tpl.Text a_varDecls;
16165
16166 output Tpl.Text out_txt;
16167 output Tpl.Text out_a_preExp;
16168 output Tpl.Text out_a_varDecls;
16169 algorithm
16170 1 out_txt := fun_397(txt, a_exp);
16171 out_a_preExp := a_preExp;
16172 out_a_varDecls := a_varDecls;
16173 end daeExpCallPreXml;
16174
16175 public function daeExpSizeXml
16176 input Tpl.Text in_txt;
16177 input DAE.Exp in_a_exp;
16178 input SimCodeFunction.Context in_a_context;
16179 input Tpl.Text in_a_preExp;
16180 input Tpl.Text in_a_varDecls;
16181
16182 output Tpl.Text out_txt;
16183 output Tpl.Text out_a_preExp;
16184 output Tpl.Text out_a_varDecls;
16185 algorithm
16186 (out_txt, out_a_preExp, out_a_varDecls) :=
16187 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
16188 local
16189 Tpl.Text txt;
16190 SimCodeFunction.Context a_context;
16191 Tpl.Text a_preExp;
16192 Tpl.Text a_varDecls;
16193 DAE.Exp i_dim;
16194 DAE.Exp i_exp;
16195 Tpl.Text l_dimPart;
16196 Tpl.Text l_expPart;
16197
16198 case ( txt,
16199 DAE.SIZE(exp = (i_exp as DAE.CREF(componentRef = _)), sz = SOME(i_dim)),
16200 a_context,
16201 a_preExp,
16202 a_varDecls )
16203 algorithm
16204 ✗ (l_expPart, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp, a_context, a_preExp, a_varDecls);
16205 ✗ (l_dimPart, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_dim, a_context, a_preExp, a_varDecls);
16206 ✗ txt := Tpl.writeTok(txt, Tpl.ST_LINE("<exp:Size>\n"));
16207 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2));
16208 ✗ txt := Tpl.writeText(txt, l_expPart);
16209 ✗ txt := Tpl.softNewLine(txt);
16210 ✗ txt := Tpl.writeText(txt, l_dimPart);
16211 ✗ txt := Tpl.softNewLine(txt);
16212 ✗ txt := Tpl.popBlock(txt);
16213 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("</exp:Size>"));
16214 ✗ then (txt, a_preExp, a_varDecls);
16215
16216 case ( txt,
16217 _,
16218 _,
16219 a_preExp,
16220 a_varDecls )
16221 algorithm
16222 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("size(X) not implemented"));
16223 ✗ then (txt, a_preExp, a_varDecls);
16224 end match;
16225 end daeExpSizeXml;
16226
16227 public function daeExpBoxXml
16228 input Tpl.Text in_txt;
16229 input DAE.Exp in_a_exp;
16230 input SimCodeFunction.Context in_a_context;
16231 input Tpl.Text in_a_preExp;
16232 input Tpl.Text in_a_varDecls;
16233
16234 output Tpl.Text out_txt;
16235 output Tpl.Text out_a_preExp;
16236 output Tpl.Text out_a_varDecls;
16237 algorithm
16238 (out_txt, out_a_preExp, out_a_varDecls) :=
16239 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
16240 local
16241 Tpl.Text txt;
16242 SimCodeFunction.Context a_context;
16243 Tpl.Text a_preExp;
16244 Tpl.Text a_varDecls;
16245 DAE.Exp i_exp_exp;
16246 Tpl.Text l_res;
16247
16248 case ( txt,
16249 DAE.BOX(exp = i_exp_exp),
16250 a_context,
16251 a_preExp,
16252 a_varDecls )
16253 algorithm
16254 ✗ (l_res, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp_exp, a_context, a_preExp, a_varDecls);
16255 ✗ txt := Tpl.writeText(txt, l_res);
16256 ✗ then (txt, a_preExp, a_varDecls);
16257
16258 case ( txt,
16259 _,
16260 _,
16261 a_preExp,
16262 a_varDecls )
16263 then (txt, a_preExp, a_varDecls);
16264 end match;
16265 end daeExpBoxXml;
16266
16267 public function daeExpUnboxXml
16268 input Tpl.Text in_txt;
16269 input DAE.Exp in_a_exp;
16270 input SimCodeFunction.Context in_a_context;
16271 input Tpl.Text in_a_preExp;
16272 input Tpl.Text in_a_varDecls;
16273
16274 output Tpl.Text out_txt;
16275 output Tpl.Text out_a_preExp;
16276 output Tpl.Text out_a_varDecls;
16277 algorithm
16278 (out_txt, out_a_preExp, out_a_varDecls) :=
16279 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
16280 local
16281 Tpl.Text txt;
16282 SimCodeFunction.Context a_context;
16283 Tpl.Text a_preExp;
16284 Tpl.Text a_varDecls;
16285 DAE.Exp i_exp_exp;
16286 Tpl.Text l_res;
16287
16288 case ( txt,
16289 DAE.UNBOX(exp = i_exp_exp),
16290 a_context,
16291 a_preExp,
16292 a_varDecls )
16293 algorithm
16294 ✗ (l_res, a_preExp, a_varDecls) := daeExpXml(Tpl.emptyTxt, i_exp_exp, a_context, a_preExp, a_varDecls);
16295 ✗ txt := Tpl.writeText(txt, l_res);
16296 ✗ then (txt, a_preExp, a_varDecls);
16297
16298 case ( txt,
16299 _,
16300 _,
16301 a_preExp,
16302 a_varDecls )
16303 then (txt, a_preExp, a_varDecls);
16304 end match;
16305 end daeExpUnboxXml;
16306
16307 public function daeExpSharedLiteralXml
16308 input Tpl.Text in_txt;
16309 input DAE.Exp in_a_exp;
16310 input SimCodeFunction.Context in_a_context;
16311 input Tpl.Text in_a_preExp;
16312 input Tpl.Text in_a_varDecls;
16313
16314 output Tpl.Text out_txt;
16315 output Tpl.Text out_a_preExp;
16316 output Tpl.Text out_a_varDecls;
16317 algorithm
16318 (out_txt, out_a_preExp, out_a_varDecls) :=
16319 match(in_txt, in_a_exp, in_a_context, in_a_preExp, in_a_varDecls)
16320 local
16321 Tpl.Text txt;
16322 SimCodeFunction.Context a_context;
16323 Tpl.Text a_preExp;
16324 Tpl.Text a_varDecls;
16325 DAE.Exp i_exp_exp;
16326
16327 case ( txt,
16328 DAE.SHARED_LITERAL(exp = i_exp_exp),
16329 a_context,
16330 a_preExp,
16331 a_varDecls )
16332 algorithm
16333 4 (txt, a_preExp, a_varDecls) := daeExpXml(txt, i_exp_exp, a_context, a_preExp, a_varDecls);
16334 then (txt, a_preExp, a_varDecls);
16335
16336 case ( txt,
16337 _,
16338 _,
16339 a_preExp,
16340 a_varDecls )
16341 ✗ then (txt, a_preExp, a_varDecls);
16342 end match;
16343 end daeExpSharedLiteralXml;
16344
16345 protected function lm_403
16346 input output Tpl.Text txt;
16347 input list<DAE.Subscript> items;
16348 input output Tpl.Text a_varDecls;
16349 input output Tpl.Text a_preExp;
16350 input SimCodeFunction.Context a_context;
16351 algorithm
16352 ✗ for lstElt_403 in items loop
16353 (txt, a_varDecls, a_preExp) := match lstElt_403
16354 local
16355 DAE.Subscript i_sub;
16356
16357 case i_sub
16358 algorithm
16359 ✗ (txt, a_preExp, a_varDecls) := daeSubscriptXML(txt, i_sub, a_context, a_preExp, a_varDecls);
16360 ✗ txt := Tpl.nextIter(txt);
16361 then (txt, a_varDecls, a_preExp);
16362 end match;
16363 end for;
16364 end lm_403;
16365
16366 protected function fun_404
16367 input Tpl.Text in_txt;
16368 input String in_mArg;
16369 input Tpl.Text in_a_dimsValuesStr;
16370 input String in_a_arrName;
16371
16372 output Tpl.Text out_txt;
16373 algorithm
16374 out_txt :=
16375 match(in_txt, in_mArg, in_a_dimsValuesStr, in_a_arrName)
16376 local
16377 Tpl.Text txt;
16378 Tpl.Text a_dimsValuesStr;
16379 String a_arrName;
16380
16381 case ( txt,
16382 "metatype_array",
16383 a_dimsValuesStr,
16384 a_arrName )
16385 algorithm
16386 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("arrayGet("));
16387 ✗ txt := Tpl.writeStr(txt, a_arrName);
16388 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(","));
16389 ✗ txt := Tpl.writeText(txt, a_dimsValuesStr);
16390 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(") /*arrayScalarRhs*/"));
16391 then txt;
16392
16393 case ( txt,
16394 _,
16395 a_dimsValuesStr,
16396 _ )
16397 algorithm
16398 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
16399 " wrong LHS\n",
16400 " <exp:ArraySubscripts>\n",
16401 " <exp:IndexExpression>\n"
16402 }, true));
16403 ✗ txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(8));
16404 ✗ txt := Tpl.writeText(txt, a_dimsValuesStr);
16405 ✗ txt := Tpl.softNewLine(txt);
16406 ✗ txt := Tpl.popBlock(txt);
16407 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
16408 " </exp:IndexExpression>\n",
16409 " </exp:ArraySubscripts>\n",
16410 " </exp:QualifiedNamepart>\n",
16411 "</exp:QualifiedName>"
16412 }, false));
16413 then txt;
16414 end match;
16415 end fun_404;
16416
16417 public function arrayScalarRhsXml
16418 input Tpl.Text txt;
16419 input DAE.Type a_ty;
16420 input list<DAE.Subscript> a_subs;
16421 input String a_arrName;
16422 input SimCodeFunction.Context a_context;
16423 input Tpl.Text a_preExp;
16424 input Tpl.Text a_varDecls;
16425
16426 output Tpl.Text out_txt;
16427 output Tpl.Text out_a_preExp;
16428 output Tpl.Text out_a_varDecls;
16429 protected
16430 String str_4;
16431 Tpl.Text l_dimsValuesStr;
16432 Integer ret_2;
16433 Tpl.Text l_dimsLenStr;
16434 Tpl.Text l_arrayType;
16435 algorithm
16436 ✗ l_arrayType := expTypeArrayXml(Tpl.emptyTxt, a_ty);
16437 ✗ ret_2 := listLength(a_subs);
16438 ✗ l_dimsLenStr := Tpl.writeStr(Tpl.emptyTxt, intString(ret_2));
16439 ✗ l_dimsValuesStr := Tpl.pushIter(Tpl.emptyTxt, Tpl.ITER_OPTIONS(0, NONE(), SOME(Tpl.ST_STRING(", ")), 0, 0, Tpl.ST_NEW_LINE(), 0, Tpl.ST_NEW_LINE()));
16440 ✗ (l_dimsValuesStr, out_a_varDecls, out_a_preExp) := lm_403(l_dimsValuesStr, a_subs, a_varDecls, a_preExp, a_context);
16441 ✗ l_dimsValuesStr := Tpl.popIter(l_dimsValuesStr);
16442 ✗ str_4 := Tpl.textString(l_arrayType);
16443 ✗ out_txt := fun_404(txt, str_4, l_dimsValuesStr, a_arrName);
16444 end arrayScalarRhsXml;
16445
16446 public function outDeclXml
16447 input Tpl.Text txt;
16448 input String a_ty;
16449 input Tpl.Text a_varDecls;
16450
16451 output Tpl.Text out_txt;
16452 output Tpl.Text out_a_varDecls;
16453 protected
16454 Tpl.Text l_newVar;
16455 algorithm
16456 ✗ l_newVar := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("out"));
16457 ✗ out_a_varDecls := Tpl.writeStr(a_varDecls, a_ty);
16458 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_STRING(" "));
16459 ✗ out_a_varDecls := Tpl.writeText(out_a_varDecls, l_newVar);
16460 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_STRING(";"));
16461 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_NEW_LINE());
16462 ✗ out_txt := Tpl.writeText(txt, l_newVar);
16463 end outDeclXml;
16464
16465 protected function fun_407
16466 input Tpl.Text in_txt;
16467 input String in_a_ty;
16468 input Tpl.Text in_a_varDecls;
16469
16470 output Tpl.Text out_txt;
16471 output Tpl.Text out_a_varDecls;
16472 algorithm
16473 (out_txt, out_a_varDecls) :=
16474 match(in_txt, in_a_ty, in_a_varDecls)
16475 local
16476 Tpl.Text txt;
16477 Tpl.Text a_varDecls;
16478 String i_ty;
16479 Integer ret_4;
16480 Tpl.Text l_newVarIx;
16481 Integer ret_2;
16482 Integer ret_1;
16483 Integer ret_0;
16484
16485 case ( txt,
16486 "modelica_metatype",
16487 a_varDecls )
16488 algorithm
16489 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("tmpMeta["));
16490 ✗ ret_0 := System.tmpTickIndex(1);
16491 ✗ txt := Tpl.writeStr(txt, intString(ret_0));
16492 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("]"));
16493 then (txt, a_varDecls);
16494
16495 case ( txt,
16496 "metamodelica_string",
16497 a_varDecls )
16498 algorithm
16499 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("tmpMeta["));
16500 ✗ ret_1 := System.tmpTickIndex(1);
16501 ✗ txt := Tpl.writeStr(txt, intString(ret_1));
16502 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("]"));
16503 then (txt, a_varDecls);
16504
16505 case ( txt,
16506 "metamodelica_string_const",
16507 a_varDecls )
16508 algorithm
16509 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("tmpMeta["));
16510 ✗ ret_2 := System.tmpTickIndex(1);
16511 ✗ txt := Tpl.writeStr(txt, intString(ret_2));
16512 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("]"));
16513 then (txt, a_varDecls);
16514
16515 case ( txt,
16516 i_ty,
16517 a_varDecls )
16518 algorithm
16519 20 l_newVarIx := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("tmp"));
16520 20 ret_4 := System.tmpTick();
16521 20 l_newVarIx := Tpl.writeStr(l_newVarIx, intString(ret_4));
16522 20 a_varDecls := Tpl.writeStr(a_varDecls, i_ty);
16523 20 a_varDecls := Tpl.writeTok(a_varDecls, Tpl.ST_STRING(" "));
16524 20 a_varDecls := Tpl.writeText(a_varDecls, l_newVarIx);
16525 20 a_varDecls := Tpl.writeTok(a_varDecls, Tpl.ST_STRING(";"));
16526 20 a_varDecls := Tpl.writeTok(a_varDecls, Tpl.ST_NEW_LINE());
16527 20 txt := Tpl.writeText(txt, l_newVarIx);
16528 then (txt, a_varDecls);
16529 end match;
16530 end fun_407;
16531
16532 public function tempDeclXml
16533 input Tpl.Text txt;
16534 input String a_ty;
16535 input Tpl.Text a_varDecls;
16536
16537 output Tpl.Text out_txt;
16538 output Tpl.Text out_a_varDecls;
16539 protected
16540 Tpl.Text l_newVar;
16541 algorithm
16542 20 (l_newVar, out_a_varDecls) := fun_407(Tpl.emptyTxt, a_ty, a_varDecls);
16543 20 out_txt := Tpl.writeText(txt, l_newVar);
16544 end tempDeclXml;
16545
16546 public function tempDeclConstXml
16547 input Tpl.Text txt;
16548 input String a_ty;
16549 input String a_val;
16550 input Tpl.Text a_varDecls;
16551
16552 output Tpl.Text out_txt;
16553 output Tpl.Text out_a_varDecls;
16554 protected
16555 Integer ret_1;
16556 Tpl.Text l_newVar;
16557 algorithm
16558 ✗ l_newVar := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("tmp"));
16559 ✗ ret_1 := System.tmpTick();
16560 ✗ l_newVar := Tpl.writeStr(l_newVar, intString(ret_1));
16561 ✗ out_a_varDecls := Tpl.writeStr(a_varDecls, a_ty);
16562 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_STRING(" "));
16563 ✗ out_a_varDecls := Tpl.writeText(out_a_varDecls, l_newVar);
16564 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_STRING(" = "));
16565 ✗ out_a_varDecls := Tpl.writeStr(out_a_varDecls, a_val);
16566 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_STRING(";"));
16567 ✗ out_a_varDecls := Tpl.writeTok(out_a_varDecls, Tpl.ST_NEW_LINE());
16568 ✗ out_txt := Tpl.writeText(txt, l_newVar);
16569 end tempDeclConstXml;
16570
16571 protected function fun_410
16572 input Tpl.Text in_txt;
16573 input list<DAE.Dimension> in_a_instDims;
16574 input DAE.Type in_a_var_ty;
16575
16576 output Tpl.Text out_txt;
16577 algorithm
16578 out_txt :=
16579 match(in_txt, in_a_instDims, in_a_var_ty)
16580 local
16581 Tpl.Text txt;
16582 DAE.Type a_var_ty;
16583
16584 case ( txt,
16585 {},
16586 a_var_ty )
16587 algorithm
16588 4 txt := expTypeArrayIfXml(txt, a_var_ty);
16589 then txt;
16590
16591 case ( txt,
16592 _,
16593 a_var_ty )
16594 algorithm
16595 ✗ txt := expTypeArrayXml(txt, a_var_ty);
16596 then txt;
16597 end match;
16598 end fun_410;
16599
16600 public function varTypeXml
16601 input Tpl.Text in_txt;
16602 input SimCodeFunction.Variable in_a_var;
16603
16604 output Tpl.Text out_txt;
16605 algorithm
16606 out_txt :=
16607 match(in_txt, in_a_var)
16608 local
16609 Tpl.Text txt;
16610 DAE.Type i_var_ty;
16611 list<DAE.Dimension> i_instDims;
16612
16613 case ( txt,
16614 SimCodeFunction.VARIABLE(instDims = i_instDims, ty = i_var_ty) )
16615 algorithm
16616 4 txt := fun_410(txt, i_instDims, i_var_ty);
16617 then txt;
16618
16619 case ( txt,
16620 _ )
16621 then txt;
16622 end match;
16623 end varTypeXml;
16624
16625 public function varTypeBoxedXml
16626 input Tpl.Text in_txt;
16627 input SimCodeFunction.Variable in_a_var;
16628
16629 output Tpl.Text out_txt;
16630 algorithm
16631 out_txt :=
16632 match(in_txt, in_a_var)
16633 local
16634 Tpl.Text txt;
16635
16636 case ( txt,
16637 SimCodeFunction.VARIABLE(name = _) )
16638 algorithm
16639 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
16640 then txt;
16641
16642 case ( txt,
16643 SimCodeFunction.FUNCTION_PTR(name = _) )
16644 algorithm
16645 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_fnptr"));
16646 then txt;
16647
16648 case ( txt,
16649 _ )
16650 then txt;
16651 end match;
16652 end varTypeBoxedXml;
16653
16654 public function expTypeRWXml
16655 input Tpl.Text in_txt;
16656 input DAE.Type in_a_type;
16657
16658 output Tpl.Text out_txt;
16659 algorithm
16660 out_txt :=
16661 match(in_txt, in_a_type)
16662 local
16663 Tpl.Text txt;
16664 DAE.Type i_ty;
16665
16666 case ( txt,
16667 DAE.T_INTEGER(varLst = _) )
16668 algorithm
16669 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_INT"));
16670 then txt;
16671
16672 case ( txt,
16673 DAE.T_REAL(varLst = _) )
16674 algorithm
16675 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_REAL"));
16676 then txt;
16677
16678 case ( txt,
16679 DAE.T_STRING(varLst = _) )
16680 algorithm
16681 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_STRING"));
16682 then txt;
16683
16684 case ( txt,
16685 DAE.T_BOOL(varLst = _) )
16686 algorithm
16687 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_BOOL"));
16688 then txt;
16689
16690 case ( txt,
16691 DAE.T_ENUMERATION(index = _) )
16692 algorithm
16693 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_INT"));
16694 then txt;
16695
16696 case ( txt,
16697 DAE.T_ARRAY(ty = i_ty) )
16698 algorithm
16699 ✗ txt := expTypeRWXml(txt, i_ty);
16700 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("_ARRAY"));
16701 then txt;
16702
16703 case ( txt,
16704 DAE.T_COMPLEX(complexClassType = ClassInf.RECORD(path = _)) )
16705 algorithm
16706 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_RECORD"));
16707 then txt;
16708
16709 case ( txt,
16710 DAE.T_METATYPE(ty = _) )
16711 algorithm
16712 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_MMC"));
16713 then txt;
16714
16715 case ( txt,
16716 DAE.T_METABOXED(ty = _) )
16717 algorithm
16718 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("TYPE_DESC_MMC"));
16719 then txt;
16720
16721 case ( txt,
16722 _ )
16723 then txt;
16724 end match;
16725 end expTypeRWXml;
16726
16727 protected function fun_414
16728 input Tpl.Text in_txt;
16729 input Boolean in_mArg;
16730
16731 output Tpl.Text out_txt;
16732 algorithm
16733 out_txt :=
16734 match(in_txt, in_mArg)
16735 local
16736 Tpl.Text txt;
16737
16738 case ( txt,
16739 false )
16740 algorithm
16741 2 txt := Tpl.writeTok(txt, Tpl.ST_STRING("String"));
16742 then txt;
16743
16744 case ( txt,
16745 _ )
16746 algorithm
16747 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("MetaType"));
16748 then txt;
16749 end match;
16750 end fun_414;
16751
16752 public function expTypeShortXml
16753 input Tpl.Text in_txt;
16754 input DAE.Type in_a_type;
16755
16756 output Tpl.Text out_txt;
16757 algorithm
16758 out_txt :=
16759 match(in_txt, in_a_type)
16760 local
16761 Tpl.Text txt;
16762 DAE.Type i_type;
16763 ClassInf.State i_complexClassType;
16764 DAE.Type i_ty;
16765 Tpl.Text txt_2;
16766 String ret_2;
16767 Absyn.Path ret_1;
16768 Boolean ret_0;
16769
16770 case ( txt,
16771 DAE.T_INTEGER(varLst = _) )
16772 algorithm
16773 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Integer"));
16774 then txt;
16775
16776 case ( txt,
16777 DAE.T_REAL(varLst = _) )
16778 algorithm
16779 7 txt := Tpl.writeTok(txt, Tpl.ST_STRING("Real"));
16780 then txt;
16781
16782 case ( txt,
16783 DAE.T_STRING(varLst = _) )
16784 algorithm
16785 2 ret_0 := Config.acceptMetaModelicaGrammar();
16786 2 txt := fun_414(txt, ret_0);
16787 then txt;
16788
16789 case ( txt,
16790 DAE.T_BOOL(varLst = _) )
16791 algorithm
16792 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Boolean"));
16793 then txt;
16794
16795 case ( txt,
16796 DAE.T_ENUMERATION(index = _) )
16797 algorithm
16798 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Integer"));
16799 then txt;
16800
16801 case ( txt,
16802 DAE.T_ARRAY(ty = i_ty) )
16803 algorithm
16804 ✗ txt := expTypeShortXml(txt, i_ty);
16805 then txt;
16806
16807 case ( txt,
16808 DAE.T_COMPLEX(complexClassType = ClassInf.EXTERNAL_OBJ(path = _)) )
16809 algorithm
16810 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Complex"));
16811 then txt;
16812
16813 case ( txt,
16814 DAE.T_COMPLEX(complexClassType = i_complexClassType) )
16815 algorithm
16816 ✗ ret_1 := ClassInfUtil.getStateName(i_complexClassType);
16817 ✗ txt := underscorePathXml(txt, ret_1);
16818 then txt;
16819
16820 case ( txt,
16821 DAE.T_METATYPE(ty = _) )
16822 algorithm
16823 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("MetaType"));
16824 then txt;
16825
16826 case ( txt,
16827 DAE.T_METABOXED(ty = _) )
16828 algorithm
16829 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("MetaType"));
16830 then txt;
16831
16832 case ( txt,
16833 DAE.T_FUNCTION_REFERENCE_VAR(functionType = _) )
16834 algorithm
16835 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("fnptr"));
16836 then txt;
16837
16838 case ( txt,
16839 DAE.T_UNKNOWN() )
16840 algorithm
16841 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Complex"));
16842 then txt;
16843
16844 case ( txt,
16845 DAE.T_ANYTYPE(anyClassType = _) )
16846 algorithm
16847 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("Complex"));
16848 then txt;
16849
16850 case ( txt,
16851 i_type )
16852 algorithm
16853 ✗ txt_2 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("expTypeShortXml:"));
16854 ✗ ret_2 := TypesDump.unparseType(i_type);
16855 ✗ txt_2 := Tpl.writeStr(txt_2, ret_2);
16856 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3834, 14), Tpl.textString(txt_2));
16857 then txt;
16858 end match;
16859 end expTypeShortXml;
16860
16861 protected function fun_416
16862 input Tpl.Text in_txt;
16863 input Boolean in_a_array;
16864 input DAE.Type in_a_ty;
16865
16866 output Tpl.Text out_txt;
16867 algorithm
16868 out_txt :=
16869 match(in_txt, in_a_array, in_a_ty)
16870 local
16871 Tpl.Text txt;
16872 DAE.Type a_ty;
16873
16874 case ( txt,
16875 true,
16876 a_ty )
16877 algorithm
16878 ✗ txt := expTypeArrayXml(txt, a_ty);
16879 then txt;
16880
16881 case ( txt,
16882 false,
16883 a_ty )
16884 algorithm
16885 ✗ txt := expTypeModelicaXml(txt, a_ty);
16886 then txt;
16887
16888 case ( txt,
16889 _,
16890 _ )
16891 then txt;
16892 end match;
16893 end fun_416;
16894
16895 public function expTypeXml
16896 input Tpl.Text txt;
16897 input DAE.Type a_ty;
16898 input Boolean a_array;
16899
16900 output Tpl.Text out_txt;
16901 algorithm
16902 ✗ out_txt := fun_416(txt, a_array, a_ty);
16903 end expTypeXml;
16904
16905 public function expTypeModelicaXml
16906 input Tpl.Text txt;
16907 input DAE.Type a_ty;
16908
16909 output Tpl.Text out_txt;
16910 algorithm
16911 5 out_txt := expTypeFlagXml(txt, a_ty, 2);
16912 end expTypeModelicaXml;
16913
16914 public function expTypeArrayXml
16915 input Tpl.Text txt;
16916 input DAE.Type a_ty;
16917
16918 output Tpl.Text out_txt;
16919 algorithm
16920 ✗ out_txt := expTypeFlagXml(txt, a_ty, 3);
16921 end expTypeArrayXml;
16922
16923 public function expTypeArrayIfXml
16924 input Tpl.Text txt;
16925 input DAE.Type a_ty;
16926
16927 output Tpl.Text out_txt;
16928 algorithm
16929 4 out_txt := expTypeFlagXml(txt, a_ty, 4);
16930 end expTypeArrayIfXml;
16931
16932 public function expTypeFromExpShortXml
16933 input Tpl.Text txt;
16934 input DAE.Exp a_exp;
16935
16936 output Tpl.Text out_txt;
16937 algorithm
16938 ✗ out_txt := expTypeFromExpFlagXml(txt, a_exp, 1);
16939 end expTypeFromExpShortXml;
16940
16941 public function expTypeFromExpModelicaXml
16942 input Tpl.Text txt;
16943 input DAE.Exp a_exp;
16944
16945 output Tpl.Text out_txt;
16946 algorithm
16947 ✗ out_txt := expTypeFromExpFlagXml(txt, a_exp, 2);
16948 end expTypeFromExpModelicaXml;
16949
16950 public function expTypeFromExpArrayXml
16951 input Tpl.Text txt;
16952 input DAE.Exp a_exp;
16953
16954 output Tpl.Text out_txt;
16955 algorithm
16956 ✗ out_txt := expTypeFromExpFlagXml(txt, a_exp, 3);
16957 end expTypeFromExpArrayXml;
16958
16959 public function expTypeFromExpArrayIfXml
16960 input Tpl.Text txt;
16961 input DAE.Exp a_exp;
16962
16963 output Tpl.Text out_txt;
16964 algorithm
16965 ✗ out_txt := expTypeFromExpFlagXml(txt, a_exp, 4);
16966 end expTypeFromExpArrayIfXml;
16967
16968 protected function fun_425
16969 input Tpl.Text in_txt;
16970 input DAE.Type in_a_ty;
16971
16972 output Tpl.Text out_txt;
16973 algorithm
16974 out_txt :=
16975 match(in_txt, in_a_ty)
16976 local
16977 Tpl.Text txt;
16978 DAE.Type i_ty;
16979 ClassInf.State i_complexClassType;
16980 Absyn.Path ret_0;
16981
16982 case ( txt,
16983 DAE.T_COMPLEX(complexClassType = i_complexClassType) )
16984 algorithm
16985 ✗ ret_0 := ClassInfUtil.getStateName(i_complexClassType);
16986 ✗ txt := underscorePathXml(txt, ret_0);
16987 then txt;
16988
16989 case ( txt,
16990 i_ty )
16991 algorithm
16992 9 txt := expTypeShortXml(txt, i_ty);
16993 then txt;
16994 end match;
16995 end fun_425;
16996
16997 protected function fun_426
16998 input Tpl.Text in_txt;
16999 input DAE.Type in_a_ty;
17000
17001 output Tpl.Text out_txt;
17002 algorithm
17003 out_txt :=
17004 match(in_txt, in_a_ty)
17005 local
17006 Tpl.Text txt;
17007 DAE.Type i_ty;
17008
17009 case ( txt,
17010 (i_ty as DAE.T_COMPLEX(complexClassType = ClassInf.EXTERNAL_OBJ(path = _))) )
17011 algorithm
17012 ✗ txt := expTypeShortXml(txt, i_ty);
17013 then txt;
17014
17015 case ( txt,
17016 i_ty )
17017 algorithm
17018 9 txt := fun_425(txt, i_ty);
17019 then txt;
17020 end match;
17021 end fun_426;
17022
17023 protected function fun_427
17024 input Tpl.Text in_txt;
17025 input DAE.Type in_a_ty;
17026
17027 output Tpl.Text out_txt;
17028 algorithm
17029 out_txt :=
17030 match(in_txt, in_a_ty)
17031 local
17032 Tpl.Text txt;
17033 DAE.Type i_ty;
17034
17035 case ( txt,
17036 DAE.T_ARRAY(ty = i_ty) )
17037 algorithm
17038 ✗ txt := expTypeShortXml(txt, i_ty);
17039 then txt;
17040
17041 case ( txt,
17042 i_ty )
17043 algorithm
17044 4 txt := expTypeFlagXml(txt, i_ty, 2);
17045 then txt;
17046 end match;
17047 end fun_427;
17048
17049 protected function fun_428
17050 input Tpl.Text in_txt;
17051 input Integer in_a_flag;
17052 input DAE.Type in_a_ty;
17053
17054 output Tpl.Text out_txt;
17055 algorithm
17056 out_txt :=
17057 match(in_txt, in_a_flag, in_a_ty)
17058 local
17059 Tpl.Text txt;
17060 DAE.Type a_ty;
17061
17062 case ( txt,
17063 1,
17064 a_ty )
17065 algorithm
17066 ✗ txt := expTypeShortXml(txt, a_ty);
17067 then txt;
17068
17069 case ( txt,
17070 2,
17071 a_ty )
17072 algorithm
17073 9 txt := fun_426(txt, a_ty);
17074 then txt;
17075
17076 case ( txt,
17077 3,
17078 a_ty )
17079 algorithm
17080 ✗ txt := expTypeShortXml(txt, a_ty);
17081 then txt;
17082
17083 case ( txt,
17084 4,
17085 a_ty )
17086 algorithm
17087 4 txt := fun_427(txt, a_ty);
17088 then txt;
17089
17090 case ( txt,
17091 _,
17092 _ )
17093 then txt;
17094 end match;
17095 end fun_428;
17096
17097 public function expTypeFlagXml
17098 input Tpl.Text txt;
17099 input DAE.Type a_ty;
17100 input Integer a_flag;
17101
17102 output Tpl.Text out_txt;
17103 algorithm
17104 13 out_txt := fun_428(txt, a_flag, a_ty);
17105 end expTypeFlagXml;
17106
17107 protected function fun_430
17108 input Tpl.Text in_txt;
17109 input Integer in_a_flag;
17110
17111 output Tpl.Text out_txt;
17112 algorithm
17113 out_txt :=
17114 match(in_txt, in_a_flag)
17115 local
17116 Tpl.Text txt;
17117
17118 case ( txt,
17119 8 )
17120 algorithm
17121 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
17122 then txt;
17123
17124 case ( txt,
17125 1 )
17126 algorithm
17127 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer"));
17128 then txt;
17129
17130 case ( txt,
17131 _ )
17132 algorithm
17133 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_integer"));
17134 then txt;
17135 end match;
17136 end fun_430;
17137
17138 protected function fun_431
17139 input Tpl.Text in_txt;
17140 input Integer in_a_flag;
17141
17142 output Tpl.Text out_txt;
17143 algorithm
17144 out_txt :=
17145 match(in_txt, in_a_flag)
17146 local
17147 Tpl.Text txt;
17148
17149 case ( txt,
17150 1 )
17151 algorithm
17152 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("real"));
17153 then txt;
17154
17155 case ( txt,
17156 _ )
17157 algorithm
17158 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_real"));
17159 then txt;
17160 end match;
17161 end fun_431;
17162
17163 protected function fun_432
17164 input Tpl.Text in_txt;
17165 input Integer in_a_flag;
17166
17167 output Tpl.Text out_txt;
17168 algorithm
17169 out_txt :=
17170 match(in_txt, in_a_flag)
17171 local
17172 Tpl.Text txt;
17173
17174 case ( txt,
17175 1 )
17176 algorithm
17177 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("string"));
17178 then txt;
17179
17180 case ( txt,
17181 _ )
17182 algorithm
17183 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_string"));
17184 then txt;
17185 end match;
17186 end fun_432;
17187
17188 protected function fun_433
17189 input Tpl.Text in_txt;
17190 input Integer in_a_flag;
17191
17192 output Tpl.Text out_txt;
17193 algorithm
17194 out_txt :=
17195 match(in_txt, in_a_flag)
17196 local
17197 Tpl.Text txt;
17198
17199 case ( txt,
17200 1 )
17201 algorithm
17202 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("metatype"));
17203 then txt;
17204
17205 case ( txt,
17206 _ )
17207 algorithm
17208 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
17209 then txt;
17210 end match;
17211 end fun_433;
17212
17213 protected function fun_434
17214 input Tpl.Text in_txt;
17215 input Boolean in_mArg;
17216 input Integer in_a_flag;
17217
17218 output Tpl.Text out_txt;
17219 algorithm
17220 out_txt :=
17221 match(in_txt, in_mArg, in_a_flag)
17222 local
17223 Tpl.Text txt;
17224 Integer a_flag;
17225
17226 case ( txt,
17227 false,
17228 a_flag )
17229 algorithm
17230 ✗ txt := fun_432(txt, a_flag);
17231 then txt;
17232
17233 case ( txt,
17234 _,
17235 a_flag )
17236 algorithm
17237 ✗ txt := fun_433(txt, a_flag);
17238 then txt;
17239 end match;
17240 end fun_434;
17241
17242 protected function fun_435
17243 input Tpl.Text in_txt;
17244 input Integer in_a_flag;
17245
17246 output Tpl.Text out_txt;
17247 algorithm
17248 out_txt :=
17249 match(in_txt, in_a_flag)
17250 local
17251 Tpl.Text txt;
17252
17253 case ( txt,
17254 1 )
17255 algorithm
17256 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("boolean"));
17257 then txt;
17258
17259 case ( txt,
17260 _ )
17261 algorithm
17262 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
17263 then txt;
17264 end match;
17265 end fun_435;
17266
17267 protected function fun_436
17268 input Tpl.Text in_txt;
17269 input Integer in_a_flag;
17270
17271 output Tpl.Text out_txt;
17272 algorithm
17273 out_txt :=
17274 match(in_txt, in_a_flag)
17275 local
17276 Tpl.Text txt;
17277
17278 case ( txt,
17279 8 )
17280 algorithm
17281 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("int"));
17282 then txt;
17283
17284 case ( txt,
17285 1 )
17286 algorithm
17287 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("integer"));
17288 then txt;
17289
17290 case ( txt,
17291 _ )
17292 algorithm
17293 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_integer"));
17294 then txt;
17295 end match;
17296 end fun_436;
17297
17298 protected function fun_437
17299 input Tpl.Text in_txt;
17300 input Integer in_a_flag;
17301
17302 output Tpl.Text out_txt;
17303 algorithm
17304 out_txt :=
17305 match(in_txt, in_a_flag)
17306 local
17307 Tpl.Text txt;
17308
17309 case ( txt,
17310 1 )
17311 algorithm
17312 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("metatype"));
17313 then txt;
17314
17315 case ( txt,
17316 _ )
17317 algorithm
17318 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
17319 then txt;
17320 end match;
17321 end fun_437;
17322
17323 protected function fun_438
17324 input Tpl.Text in_txt;
17325 input Integer in_a_flag;
17326
17327 output Tpl.Text out_txt;
17328 algorithm
17329 out_txt :=
17330 match(in_txt, in_a_flag)
17331 local
17332 Tpl.Text txt;
17333
17334 case ( txt,
17335 1 )
17336 algorithm
17337 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("metatype"));
17338 then txt;
17339
17340 case ( txt,
17341 _ )
17342 algorithm
17343 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
17344 then txt;
17345 end match;
17346 end fun_438;
17347
17348 protected function fun_439
17349 input Tpl.Text in_txt;
17350 input Integer in_a_flag;
17351
17352 output Tpl.Text out_txt;
17353 algorithm
17354 out_txt :=
17355 match(in_txt, in_a_flag)
17356 local
17357 Tpl.Text txt;
17358
17359 case ( txt,
17360 1 )
17361 algorithm
17362 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("metatype"));
17363 then txt;
17364
17365 case ( txt,
17366 _ )
17367 algorithm
17368 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
17369 then txt;
17370 end match;
17371 end fun_439;
17372
17373 protected function fun_440
17374 input Tpl.Text in_txt;
17375 input Integer in_a_flag;
17376
17377 output Tpl.Text out_txt;
17378 algorithm
17379 out_txt :=
17380 match(in_txt, in_a_flag)
17381 local
17382 Tpl.Text txt;
17383
17384 case ( txt,
17385 1 )
17386 algorithm
17387 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("metatype"));
17388 then txt;
17389
17390 case ( txt,
17391 _ )
17392 algorithm
17393 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
17394 then txt;
17395 end match;
17396 end fun_440;
17397
17398 protected function fun_441
17399 input Tpl.Text in_txt;
17400 input Integer in_a_flag;
17401
17402 output Tpl.Text out_txt;
17403 algorithm
17404 out_txt :=
17405 match(in_txt, in_a_flag)
17406 local
17407 Tpl.Text txt;
17408
17409 case ( txt,
17410 1 )
17411 algorithm
17412 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("metatype"));
17413 then txt;
17414
17415 case ( txt,
17416 _ )
17417 algorithm
17418 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_metatype"));
17419 then txt;
17420 end match;
17421 end fun_441;
17422
17423 public function expTypeFromExpFlagXml
17424 input Tpl.Text in_txt;
17425 input DAE.Exp in_a_exp;
17426 input Integer in_a_flag;
17427
17428 output Tpl.Text out_txt;
17429 algorithm
17430 out_txt :=
17431 match(in_txt, in_a_exp, in_a_flag)
17432 local
17433 Tpl.Text txt;
17434 Integer a_flag;
17435 DAE.Exp i_c_exp;
17436 DAE.Exp i_e;
17437 DAE.Exp i_exp;
17438 DAE.Exp i_c;
17439 DAE.Type i_c_ty;
17440 DAE.Type i_attr_ty;
17441 DAE.Exp i_expThen;
17442 DAE.Operator i_e_operator;
17443 Tpl.Text txt_7;
17444 DAE.Type ret_6;
17445 DAE.Type ret_5;
17446 DAE.Type ret_4;
17447 DAE.Type ret_3;
17448 DAE.Type ret_2;
17449 DAE.Type ret_1;
17450 Boolean ret_0;
17451
17452 case ( txt,
17453 DAE.ICONST(integer = _),
17454 a_flag )
17455 algorithm
17456 ✗ txt := fun_430(txt, a_flag);
17457 then txt;
17458
17459 case ( txt,
17460 DAE.RCONST(real = _),
17461 a_flag )
17462 algorithm
17463 ✗ txt := fun_431(txt, a_flag);
17464 then txt;
17465
17466 case ( txt,
17467 DAE.SCONST(string = _),
17468 a_flag )
17469 algorithm
17470 ✗ ret_0 := Config.acceptMetaModelicaGrammar();
17471 ✗ txt := fun_434(txt, ret_0, a_flag);
17472 then txt;
17473
17474 case ( txt,
17475 DAE.BCONST(bool = _),
17476 a_flag )
17477 algorithm
17478 ✗ txt := fun_435(txt, a_flag);
17479 then txt;
17480
17481 case ( txt,
17482 DAE.ENUM_LITERAL(name = _),
17483 a_flag )
17484 algorithm
17485 ✗ txt := fun_436(txt, a_flag);
17486 then txt;
17487
17488 case ( txt,
17489 DAE.BINARY(operator = i_e_operator),
17490 a_flag )
17491 algorithm
17492 ✗ txt := expTypeFromOpFlagXml(txt, i_e_operator, a_flag);
17493 then txt;
17494
17495 case ( txt,
17496 DAE.UNARY(operator = i_e_operator),
17497 a_flag )
17498 algorithm
17499 ✗ txt := expTypeFromOpFlagXml(txt, i_e_operator, a_flag);
17500 then txt;
17501
17502 case ( txt,
17503 DAE.LBINARY(operator = i_e_operator),
17504 a_flag )
17505 algorithm
17506 ✗ txt := expTypeFromOpFlagXml(txt, i_e_operator, a_flag);
17507 then txt;
17508
17509 case ( txt,
17510 DAE.LUNARY(operator = i_e_operator),
17511 a_flag )
17512 algorithm
17513 ✗ txt := expTypeFromOpFlagXml(txt, i_e_operator, a_flag);
17514 then txt;
17515
17516 case ( txt,
17517 DAE.RELATION(operator = i_e_operator),
17518 a_flag )
17519 algorithm
17520 ✗ txt := expTypeFromOpFlagXml(txt, i_e_operator, a_flag);
17521 then txt;
17522
17523 case ( txt,
17524 DAE.IFEXP(expThen = i_expThen),
17525 a_flag )
17526 algorithm
17527 ✗ txt := expTypeFromExpFlagXml(txt, i_expThen, a_flag);
17528 then txt;
17529
17530 case ( txt,
17531 DAE.CALL(attr = DAE.CALL_ATTR(ty = i_attr_ty)),
17532 a_flag )
17533 algorithm
17534 ✗ txt := expTypeFlagXml(txt, i_attr_ty, a_flag);
17535 then txt;
17536
17537 case ( txt,
17538 DAE.ARRAY(ty = i_c_ty),
17539 a_flag )
17540 algorithm
17541 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17542 then txt;
17543
17544 case ( txt,
17545 DAE.MATRIX(ty = i_c_ty),
17546 a_flag )
17547 algorithm
17548 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17549 then txt;
17550
17551 case ( txt,
17552 DAE.RANGE(ty = i_c_ty),
17553 a_flag )
17554 algorithm
17555 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17556 then txt;
17557
17558 case ( txt,
17559 DAE.CAST(ty = i_c_ty),
17560 a_flag )
17561 algorithm
17562 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17563 then txt;
17564
17565 case ( txt,
17566 DAE.CREF(ty = i_c_ty),
17567 a_flag )
17568 algorithm
17569 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17570 then txt;
17571
17572 case ( txt,
17573 DAE.CODE(ty = i_c_ty),
17574 a_flag )
17575 algorithm
17576 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17577 then txt;
17578
17579 case ( txt,
17580 (i_c as DAE.ASUB(exp = _)),
17581 a_flag )
17582 algorithm
17583 ✗ ret_1 := Expression.typeof(i_c);
17584 ✗ txt := expTypeFlagXml(txt, ret_1, a_flag);
17585 then txt;
17586
17587 case ( txt,
17588 (i_exp as DAE.REDUCTION(reductionInfo = _)),
17589 a_flag )
17590 algorithm
17591 ✗ ret_2 := Expression.typeof(i_exp);
17592 ✗ txt := expTypeFlagXml(txt, ret_2, a_flag);
17593 then txt;
17594
17595 case ( txt,
17596 (i_e as DAE.BOX(exp = _)),
17597 a_flag )
17598 algorithm
17599 ✗ ret_3 := Expression.typeof(i_e);
17600 ✗ txt := expTypeFlagXml(txt, ret_3, a_flag);
17601 then txt;
17602
17603 case ( txt,
17604 (i_e as DAE.CONS(car = _)),
17605 a_flag )
17606 algorithm
17607 ✗ ret_4 := Expression.typeof(i_e);
17608 ✗ txt := expTypeFlagXml(txt, ret_4, a_flag);
17609 then txt;
17610
17611 case ( txt,
17612 (i_e as DAE.LIST(valList = _)),
17613 a_flag )
17614 algorithm
17615 ✗ ret_5 := Expression.typeof(i_e);
17616 ✗ txt := expTypeFlagXml(txt, ret_5, a_flag);
17617 then txt;
17618
17619 case ( txt,
17620 (i_e as DAE.SIZE(exp = _)),
17621 a_flag )
17622 algorithm
17623 ✗ ret_6 := Expression.typeof(i_e);
17624 ✗ txt := expTypeFlagXml(txt, ret_6, a_flag);
17625 then txt;
17626
17627 case ( txt,
17628 DAE.META_TUPLE(listExp = _),
17629 a_flag )
17630 algorithm
17631 ✗ txt := fun_437(txt, a_flag);
17632 then txt;
17633
17634 case ( txt,
17635 DAE.META_OPTION(exp = _),
17636 a_flag )
17637 algorithm
17638 ✗ txt := fun_438(txt, a_flag);
17639 then txt;
17640
17641 case ( txt,
17642 DAE.MATCHEXPRESSION(matchType = _),
17643 a_flag )
17644 algorithm
17645 ✗ txt := fun_439(txt, a_flag);
17646 then txt;
17647
17648 case ( txt,
17649 DAE.METARECORDCALL(path = _),
17650 a_flag )
17651 algorithm
17652 ✗ txt := fun_440(txt, a_flag);
17653 then txt;
17654
17655 case ( txt,
17656 DAE.BOX(exp = _),
17657 a_flag )
17658 algorithm
17659 ✗ txt := fun_441(txt, a_flag);
17660 then txt;
17661
17662 case ( txt,
17663 DAE.UNBOX(ty = i_c_ty),
17664 a_flag )
17665 algorithm
17666 ✗ txt := expTypeFlagXml(txt, i_c_ty, a_flag);
17667 then txt;
17668
17669 case ( txt,
17670 DAE.SHARED_LITERAL(exp = i_c_exp),
17671 a_flag )
17672 algorithm
17673 ✗ txt := expTypeFromExpFlagXml(txt, i_c_exp, a_flag);
17674 then txt;
17675
17676 case ( txt,
17677 i_exp,
17678 _ )
17679 algorithm
17680 ✗ txt_7 := Tpl.writeTok(Tpl.emptyTxt, Tpl.ST_STRING("expTypeFromExpFlag:"));
17681 ✗ txt_7 := ExpressionDumpTpl.dumpExp(txt_7, i_exp, "\"");
17682 ✗ txt := error(txt, Tpl.sourceInfo("CodegenXML.tpl", 3950, 14), Tpl.textString(txt_7));
17683 then txt;
17684 end match;
17685 end expTypeFromExpFlagXml;
17686
17687 protected function fun_443
17688 input Tpl.Text in_txt;
17689 input Integer in_a_flag;
17690
17691 output Tpl.Text out_txt;
17692 algorithm
17693 out_txt :=
17694 match(in_txt, in_a_flag)
17695 local
17696 Tpl.Text txt;
17697
17698 case ( txt,
17699 1 )
17700 algorithm
17701 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("boolean"));
17702 then txt;
17703
17704 case ( txt,
17705 _ )
17706 algorithm
17707 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
17708 then txt;
17709 end match;
17710 end fun_443;
17711
17712 protected function fun_444
17713 input Tpl.Text in_txt;
17714 input Integer in_a_flag;
17715
17716 output Tpl.Text out_txt;
17717 algorithm
17718 out_txt :=
17719 match(in_txt, in_a_flag)
17720 local
17721 Tpl.Text txt;
17722
17723 case ( txt,
17724 1 )
17725 algorithm
17726 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("boolean"));
17727 then txt;
17728
17729 case ( txt,
17730 _ )
17731 algorithm
17732 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
17733 then txt;
17734 end match;
17735 end fun_444;
17736
17737 protected function fun_445
17738 input Tpl.Text in_txt;
17739 input Integer in_a_flag;
17740
17741 output Tpl.Text out_txt;
17742 algorithm
17743 out_txt :=
17744 match(in_txt, in_a_flag)
17745 local
17746 Tpl.Text txt;
17747
17748 case ( txt,
17749 1 )
17750 algorithm
17751 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("boolean"));
17752 then txt;
17753
17754 case ( txt,
17755 _ )
17756 algorithm
17757 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("modelica_boolean"));
17758 then txt;
17759 end match;
17760 end fun_445;
17761
17762 public function expTypeFromOpFlagXml
17763 input Tpl.Text in_txt;
17764 input DAE.Operator in_a_op;
17765 input Integer in_a_flag;
17766
17767 output Tpl.Text out_txt;
17768 algorithm
17769 out_txt :=
17770 match(in_txt, in_a_op, in_a_flag)
17771 local
17772 Tpl.Text txt;
17773 Integer a_flag;
17774 DAE.Type i_o_ty;
17775
17776 case ( txt,
17777 DAE.ADD(ty = i_o_ty),
17778 a_flag )
17779 algorithm
17780 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17781 then txt;
17782
17783 case ( txt,
17784 DAE.SUB(ty = i_o_ty),
17785 a_flag )
17786 algorithm
17787 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17788 then txt;
17789
17790 case ( txt,
17791 DAE.MUL(ty = i_o_ty),
17792 a_flag )
17793 algorithm
17794 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17795 then txt;
17796
17797 case ( txt,
17798 DAE.DIV(ty = i_o_ty),
17799 a_flag )
17800 algorithm
17801 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17802 then txt;
17803
17804 case ( txt,
17805 DAE.POW(ty = i_o_ty),
17806 a_flag )
17807 algorithm
17808 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17809 then txt;
17810
17811 case ( txt,
17812 DAE.UMINUS(ty = i_o_ty),
17813 a_flag )
17814 algorithm
17815 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17816 then txt;
17817
17818 case ( txt,
17819 DAE.UMINUS_ARR(ty = i_o_ty),
17820 a_flag )
17821 algorithm
17822 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17823 then txt;
17824
17825 case ( txt,
17826 DAE.ADD_ARR(ty = i_o_ty),
17827 a_flag )
17828 algorithm
17829 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17830 then txt;
17831
17832 case ( txt,
17833 DAE.SUB_ARR(ty = i_o_ty),
17834 a_flag )
17835 algorithm
17836 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17837 then txt;
17838
17839 case ( txt,
17840 DAE.MUL_ARR(ty = i_o_ty),
17841 a_flag )
17842 algorithm
17843 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17844 then txt;
17845
17846 case ( txt,
17847 DAE.DIV_ARR(ty = i_o_ty),
17848 a_flag )
17849 algorithm
17850 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17851 then txt;
17852
17853 case ( txt,
17854 DAE.MUL_ARRAY_SCALAR(ty = i_o_ty),
17855 a_flag )
17856 algorithm
17857 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17858 then txt;
17859
17860 case ( txt,
17861 DAE.ADD_ARRAY_SCALAR(ty = i_o_ty),
17862 a_flag )
17863 algorithm
17864 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17865 then txt;
17866
17867 case ( txt,
17868 DAE.SUB_SCALAR_ARRAY(ty = i_o_ty),
17869 a_flag )
17870 algorithm
17871 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17872 then txt;
17873
17874 case ( txt,
17875 DAE.MUL_SCALAR_PRODUCT(ty = i_o_ty),
17876 a_flag )
17877 algorithm
17878 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17879 then txt;
17880
17881 case ( txt,
17882 DAE.MUL_MATRIX_PRODUCT(ty = i_o_ty),
17883 a_flag )
17884 algorithm
17885 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17886 then txt;
17887
17888 case ( txt,
17889 DAE.DIV_ARRAY_SCALAR(ty = i_o_ty),
17890 a_flag )
17891 algorithm
17892 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17893 then txt;
17894
17895 case ( txt,
17896 DAE.DIV_SCALAR_ARRAY(ty = i_o_ty),
17897 a_flag )
17898 algorithm
17899 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17900 then txt;
17901
17902 case ( txt,
17903 DAE.POW_ARRAY_SCALAR(ty = i_o_ty),
17904 a_flag )
17905 algorithm
17906 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17907 then txt;
17908
17909 case ( txt,
17910 DAE.POW_SCALAR_ARRAY(ty = i_o_ty),
17911 a_flag )
17912 algorithm
17913 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17914 then txt;
17915
17916 case ( txt,
17917 DAE.POW_ARR(ty = i_o_ty),
17918 a_flag )
17919 algorithm
17920 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17921 then txt;
17922
17923 case ( txt,
17924 DAE.POW_ARR2(ty = i_o_ty),
17925 a_flag )
17926 algorithm
17927 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17928 then txt;
17929
17930 case ( txt,
17931 DAE.LESS(ty = i_o_ty),
17932 a_flag )
17933 algorithm
17934 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17935 then txt;
17936
17937 case ( txt,
17938 DAE.LESSEQ(ty = i_o_ty),
17939 a_flag )
17940 algorithm
17941 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17942 then txt;
17943
17944 case ( txt,
17945 DAE.GREATER(ty = i_o_ty),
17946 a_flag )
17947 algorithm
17948 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17949 then txt;
17950
17951 case ( txt,
17952 DAE.GREATEREQ(ty = i_o_ty),
17953 a_flag )
17954 algorithm
17955 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17956 then txt;
17957
17958 case ( txt,
17959 DAE.EQUAL(ty = i_o_ty),
17960 a_flag )
17961 algorithm
17962 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17963 then txt;
17964
17965 case ( txt,
17966 DAE.NEQUAL(ty = i_o_ty),
17967 a_flag )
17968 algorithm
17969 ✗ txt := expTypeFlagXml(txt, i_o_ty, a_flag);
17970 then txt;
17971
17972 case ( txt,
17973 DAE.AND(ty = _),
17974 a_flag )
17975 algorithm
17976 ✗ txt := fun_443(txt, a_flag);
17977 then txt;
17978
17979 case ( txt,
17980 DAE.OR(ty = _),
17981 a_flag )
17982 algorithm
17983 ✗ txt := fun_444(txt, a_flag);
17984 then txt;
17985
17986 case ( txt,
17987 DAE.NOT(ty = _),
17988 a_flag )
17989 algorithm
17990 ✗ txt := fun_445(txt, a_flag);
17991 then txt;
17992
17993 case ( txt,
17994 _,
17995 _ )
17996 algorithm
17997 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("expTypeFromOpFlag:ERROR"));
17998 then txt;
17999 end match;
18000 end expTypeFromOpFlagXml;
18001
18002 public function dimensionXml
18003 input Tpl.Text in_txt;
18004 input DAE.Dimension in_a_d;
18005
18006 output Tpl.Text out_txt;
18007 algorithm
18008 out_txt :=
18009 match(in_txt, in_a_d)
18010 local
18011 Tpl.Text txt;
18012 Integer i_size;
18013 Integer i_integer;
18014
18015 case ( txt,
18016 DAE.DIM_INTEGER(integer = i_integer) )
18017 algorithm
18018 ✗ txt := Tpl.writeStr(txt, intString(i_integer));
18019 then txt;
18020
18021 case ( txt,
18022 DAE.DIM_ENUM(size = i_size) )
18023 algorithm
18024 ✗ txt := Tpl.writeStr(txt, intString(i_size));
18025 then txt;
18026
18027 case ( txt,
18028 DAE.DIM_UNKNOWN() )
18029 algorithm
18030 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING(":"));
18031 then txt;
18032
18033 case ( txt,
18034 _ )
18035 algorithm
18036 ✗ txt := Tpl.writeTok(txt, Tpl.ST_STRING("INVALID_DIMENSION"));
18037 then txt;
18038 end match;
18039 end dimensionXml;
18040
18041 public function assertCommonXml
18042 input Tpl.Text txt;
18043 input DAE.Exp a_condition;
18044 input DAE.Exp a_message;
18045 input SimCodeFunction.Context a_context;
18046 input Tpl.Text a_varDecls;
18047 input SourceInfo a_info;
18048
18049 output Tpl.Text out_txt;
18050 output Tpl.Text out_a_varDecls;
18051 protected
18052 Tpl.Text l_msgVar;
18053 Tpl.Text l_condVar;
18054 Tpl.Text l_preExpMsg;
18055 Tpl.Text l_preExpCond;
18056 algorithm
18057 3 l_preExpCond := Tpl.emptyTxt;
18058 3 l_preExpMsg := Tpl.emptyTxt;
18059 3 (l_condVar, l_preExpCond, out_a_varDecls) := daeExpXml(Tpl.emptyTxt, a_condition, a_context, l_preExpCond, a_varDecls);
18060 3 (l_msgVar, l_preExpMsg, out_a_varDecls) := daeExpXml(Tpl.emptyTxt, a_message, a_context, l_preExpMsg, out_a_varDecls);
18061 3 out_txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
18062 "<fun:Assertion>\n",
18063 " <fun:Condition>\n"
18064 }, true));
18065 3 out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(4));
18066 3 out_txt := Tpl.writeText(out_txt, l_condVar);
18067 3 out_txt := Tpl.softNewLine(out_txt);
18068 3 out_txt := Tpl.popBlock(out_txt);
18069 3 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({
18070 " </fun:Condition>\n",
18071 " <fun:Message>\n"
18072 }, true));
18073 3 out_txt := Tpl.pushBlock(out_txt, Tpl.BT_INDENT(4));
18074 3 out_txt := Tpl.writeText(out_txt, l_msgVar);
18075 3 out_txt := Tpl.softNewLine(out_txt);
18076 3 out_txt := Tpl.popBlock(out_txt);
18077 3 out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING_LIST({
18078 " </fun:Message>\n",
18079 "</fun:Assertion>"
18080 }, false));
18081 end assertCommonXml;
18082
18083 public function error
18084 input Tpl.Text txt;
18085 input SourceInfo a_srcInfo;
18086 input String a_errMessage;
18087
18088 output Tpl.Text out_txt;
18089 protected
18090 String ret_0;
18091 algorithm
18092 ✗ Tpl.addSourceTemplateError(a_errMessage, a_srcInfo);
18093 ✗ out_txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({
18094 "\n",
18095 "#error \""
18096 }, false));
18097 ✗ ret_0 := Error.infoStr(a_srcInfo);
18098 ✗ out_txt := Tpl.writeStr(out_txt, ret_0);
18099 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING(" "));
18100 ✗ out_txt := Tpl.writeStr(out_txt, a_errMessage);
18101 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("\""));
18102 ✗ out_txt := Tpl.writeTok(out_txt, Tpl.ST_NEW_LINE());
18103 end error;
18104
18105 annotation(__OpenModelica_Interface="codegen_xml");
18106 end CodegenXML;
18107