build_cmake/OMCompiler/Compiler/generated-mo/Template/NFInstDumpTpl.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | encapsulated package NFInstDumpTpl | ||
| 2 | " | ||
| 3 | file: NFInstDumpTpl.mo | ||
| 4 | package: NFInstDumpTpl | ||
| 5 | description: Generated by Susan. | ||
| 6 | " | ||
| 7 | |||
| 8 | public import Tpl; | ||
| 9 | |||
| 10 | protected import Absyn; | ||
| 11 | protected import DAE; | ||
| 12 | public import Expression; | ||
| 13 | public import NFInstDump; | ||
| 14 | public import NFInstPrefix; | ||
| 15 | public import NFInstTypes; | ||
| 16 | protected import AbsynDumpTpl; | ||
| 17 | protected import ExpressionDumpTpl; | ||
| 18 | |||
| 19 | public function dumpModel | ||
| 20 | input Tpl.Text txt; | ||
| 21 | input String a_name; | ||
| 22 | input NFInstTypes.Class a_cls; | ||
| 23 | |||
| 24 | output Tpl.Text out_txt; | ||
| 25 | algorithm | ||
| 26 | ✗ | out_txt := Tpl.writeTok(txt, Tpl.ST_STRING("class ")); | |
| 27 | ✗ | out_txt := Tpl.writeStr(out_txt, a_name); | |
| 28 | ✗ | out_txt := Tpl.softNewLine(out_txt); | |
| 29 | ✗ | out_txt := dumpClass(out_txt, a_cls); | |
| 30 | ✗ | out_txt := Tpl.softNewLine(out_txt); | |
| 31 | ✗ | out_txt := Tpl.writeTok(out_txt, Tpl.ST_STRING("end ")); | |
| 32 | ✗ | out_txt := Tpl.writeStr(out_txt, a_name); | |
| 33 | end dumpModel; | ||
| 34 | |||
| 35 | public function dumpComponent | ||
| 36 | input Tpl.Text in_txt; | ||
| 37 | input NFInstTypes.Component in_a_component; | ||
| 38 | |||
| 39 | output Tpl.Text out_txt; | ||
| 40 | algorithm | ||
| 41 | out_txt := | ||
| 42 | match(in_txt, in_a_component) | ||
| 43 | local | ||
| 44 | Tpl.Text txt; | ||
| 45 | Absyn.Path i_in; | ||
| 46 | DAE.Type i_ty; | ||
| 47 | NFInstTypes.Component i_component; | ||
| 48 | DAE.Type i_baseType; | ||
| 49 | NFInstTypes.Binding i_binding; | ||
| 50 | Absyn.Path i_name; | ||
| 51 | Tpl.Text l_inner__str; | ||
| 52 | Tpl.Text l_outer__str; | ||
| 53 | String ret_4; | ||
| 54 | Tpl.Text l_dims__str; | ||
| 55 | Tpl.Text l_ty__str; | ||
| 56 | Tpl.Text l_bind__str; | ||
| 57 | Tpl.Text l_name__str; | ||
| 58 | |||
| 59 | case ( txt, | ||
| 60 | (i_component as NFInstTypes.UNTYPED_COMPONENT(name = i_name, binding = i_binding, baseType = i_baseType)) ) | ||
| 61 | algorithm | ||
| 62 | ✗ | l_name__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name); | |
| 63 | ✗ | l_bind__str := dumpBinding(Tpl.emptyTxt, i_binding); | |
| 64 | ✗ | l_ty__str := ExpressionDumpTpl.dumpType(Tpl.emptyTxt, i_baseType); | |
| 65 | ✗ | ret_4 := NFInstDump.dumpUntypedComponentDims(i_component); | |
| 66 | ✗ | l_dims__str := Tpl.writeStr(Tpl.emptyTxt, ret_4); | |
| 67 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("{")); | |
| 68 | ✗ | txt := Tpl.writeText(txt, l_ty__str); | |
| 69 | ✗ | txt := Tpl.writeText(txt, l_dims__str); | |
| 70 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("} ")); | |
| 71 | ✗ | txt := Tpl.writeText(txt, l_name__str); | |
| 72 | ✗ | txt := Tpl.writeText(txt, l_bind__str); | |
| 73 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 74 | then txt; | ||
| 75 | |||
| 76 | case ( txt, | ||
| 77 | NFInstTypes.TYPED_COMPONENT(name = i_name, binding = i_binding, ty = i_ty) ) | ||
| 78 | algorithm | ||
| 79 | ✗ | l_name__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name); | |
| 80 | ✗ | l_bind__str := dumpBinding(Tpl.emptyTxt, i_binding); | |
| 81 | ✗ | l_ty__str := ExpressionDumpTpl.dumpType(Tpl.emptyTxt, i_ty); | |
| 82 | ✗ | txt := Tpl.writeText(txt, l_ty__str); | |
| 83 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" ")); | |
| 84 | ✗ | txt := Tpl.writeText(txt, l_name__str); | |
| 85 | ✗ | txt := Tpl.writeText(txt, l_bind__str); | |
| 86 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 87 | then txt; | ||
| 88 | |||
| 89 | case ( txt, | ||
| 90 | NFInstTypes.CONDITIONAL_COMPONENT(name = i_name) ) | ||
| 91 | algorithm | ||
| 92 | ✗ | l_name__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name); | |
| 93 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("conditional ")); | |
| 94 | ✗ | txt := Tpl.writeText(txt, l_name__str); | |
| 95 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 96 | then txt; | ||
| 97 | |||
| 98 | case ( txt, | ||
| 99 | NFInstTypes.DELETED_COMPONENT(name = i_name) ) | ||
| 100 | algorithm | ||
| 101 | ✗ | l_name__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name); | |
| 102 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("deleted ")); | |
| 103 | ✗ | txt := Tpl.writeText(txt, l_name__str); | |
| 104 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 105 | then txt; | ||
| 106 | |||
| 107 | case ( txt, | ||
| 108 | NFInstTypes.OUTER_COMPONENT(innerName = SOME(i_in), name = i_name) ) | ||
| 109 | algorithm | ||
| 110 | ✗ | l_outer__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name); | |
| 111 | ✗ | l_inner__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_in); | |
| 112 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("outer ")); | |
| 113 | ✗ | txt := Tpl.writeText(txt, l_outer__str); | |
| 114 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" -> ")); | |
| 115 | ✗ | txt := Tpl.writeText(txt, l_inner__str); | |
| 116 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 117 | then txt; | ||
| 118 | |||
| 119 | case ( txt, | ||
| 120 | NFInstTypes.OUTER_COMPONENT(name = i_name) ) | ||
| 121 | algorithm | ||
| 122 | ✗ | l_outer__str := AbsynDumpTpl.dumpPath(Tpl.emptyTxt, i_name); | |
| 123 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("outer ")); | |
| 124 | ✗ | txt := Tpl.writeText(txt, l_outer__str); | |
| 125 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 126 | then txt; | ||
| 127 | |||
| 128 | case ( txt, | ||
| 129 | _ ) | ||
| 130 | then txt; | ||
| 131 | end match; | ||
| 132 | end dumpComponent; | ||
| 133 | |||
| 134 | protected function fun_11 | ||
| 135 | input Tpl.Text in_txt; | ||
| 136 | input Boolean in_mArg; | ||
| 137 | |||
| 138 | output Tpl.Text out_txt; | ||
| 139 | algorithm | ||
| 140 | out_txt := | ||
| 141 | match(in_txt, in_mArg) | ||
| 142 | local | ||
| 143 | Tpl.Text txt; | ||
| 144 | |||
| 145 | case ( txt, | ||
| 146 | true ) | ||
| 147 | then txt; | ||
| 148 | |||
| 149 | case ( txt, | ||
| 150 | _ ) | ||
| 151 | algorithm | ||
| 152 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_NEW_LINE()); | |
| 153 | then txt; | ||
| 154 | end match; | ||
| 155 | end fun_11; | ||
| 156 | |||
| 157 | public function dumpElement | ||
| 158 | input Tpl.Text in_txt; | ||
| 159 | input NFInstTypes.Element in_a_element; | ||
| 160 | |||
| 161 | output Tpl.Text out_txt; | ||
| 162 | algorithm | ||
| 163 | out_txt := | ||
| 164 | match(in_txt, in_a_element) | ||
| 165 | local | ||
| 166 | Tpl.Text txt; | ||
| 167 | NFInstTypes.Class i_cls; | ||
| 168 | NFInstTypes.Component i_component; | ||
| 169 | Boolean ret_3; | ||
| 170 | Tpl.Text l_sep__str; | ||
| 171 | Tpl.Text l_cls__str; | ||
| 172 | Tpl.Text l_comp__str; | ||
| 173 | |||
| 174 | case ( txt, | ||
| 175 | NFInstTypes.ELEMENT(component = i_component, cls = i_cls) ) | ||
| 176 | algorithm | ||
| 177 | ✗ | l_comp__str := dumpComponent(Tpl.emptyTxt, i_component); | |
| 178 | ✗ | l_cls__str := dumpClass(Tpl.emptyTxt, i_cls); | |
| 179 | ✗ | ret_3 := Tpl.isEmpty(l_cls__str); | |
| 180 | ✗ | l_sep__str := fun_11(Tpl.emptyTxt, ret_3); | |
| 181 | ✗ | txt := Tpl.writeText(txt, l_comp__str); | |
| 182 | ✗ | txt := Tpl.writeText(txt, l_sep__str); | |
| 183 | ✗ | txt := Tpl.writeText(txt, l_cls__str); | |
| 184 | then txt; | ||
| 185 | |||
| 186 | case ( txt, | ||
| 187 | NFInstTypes.CONDITIONAL_ELEMENT(component = i_component) ) | ||
| 188 | algorithm | ||
| 189 | ✗ | l_comp__str := dumpComponent(Tpl.emptyTxt, i_component); | |
| 190 | ✗ | txt := Tpl.writeText(txt, l_comp__str); | |
| 191 | then txt; | ||
| 192 | |||
| 193 | case ( txt, | ||
| 194 | NFInstTypes.EXTENDED_ELEMENTS(cls = i_cls) ) | ||
| 195 | algorithm | ||
| 196 | ✗ | l_cls__str := dumpClass(Tpl.emptyTxt, i_cls); | |
| 197 | ✗ | txt := Tpl.writeText(txt, l_cls__str); | |
| 198 | then txt; | ||
| 199 | |||
| 200 | case ( txt, | ||
| 201 | _ ) | ||
| 202 | then txt; | ||
| 203 | end match; | ||
| 204 | end dumpElement; | ||
| 205 | |||
| 206 | protected function lm_13 | ||
| 207 | input output Tpl.Text txt; | ||
| 208 | input list<NFInstTypes.Element> items; | ||
| 209 | algorithm | ||
| 210 | ✗ | for lstElt_13 in items loop | |
| 211 | txt := match lstElt_13 | ||
| 212 | local | ||
| 213 | NFInstTypes.Element i_comp; | ||
| 214 | |||
| 215 | case i_comp | ||
| 216 | algorithm | ||
| 217 | ✗ | txt := dumpElement(txt, i_comp); | |
| 218 | ✗ | txt := Tpl.nextIter(txt); | |
| 219 | then txt; | ||
| 220 | end match; | ||
| 221 | end for; | ||
| 222 | end lm_13; | ||
| 223 | |||
| 224 | protected function lm_14 | ||
| 225 | input output Tpl.Text txt; | ||
| 226 | input list<NFInstTypes.Equation> items; | ||
| 227 | algorithm | ||
| 228 | ✗ | for lstElt_14 in items loop | |
| 229 | txt := match lstElt_14 | ||
| 230 | local | ||
| 231 | NFInstTypes.Equation i_ieq; | ||
| 232 | |||
| 233 | case i_ieq | ||
| 234 | algorithm | ||
| 235 | ✗ | txt := dumpEquation(txt, i_ieq); | |
| 236 | ✗ | txt := Tpl.nextIter(txt); | |
| 237 | then txt; | ||
| 238 | end match; | ||
| 239 | end for; | ||
| 240 | end lm_14; | ||
| 241 | |||
| 242 | protected function lm_15 | ||
| 243 | input output Tpl.Text txt; | ||
| 244 | input list<NFInstTypes.Equation> items; | ||
| 245 | algorithm | ||
| 246 | ✗ | for lstElt_15 in items loop | |
| 247 | txt := match lstElt_15 | ||
| 248 | local | ||
| 249 | NFInstTypes.Equation i_eq; | ||
| 250 | |||
| 251 | case i_eq | ||
| 252 | algorithm | ||
| 253 | ✗ | txt := dumpEquation(txt, i_eq); | |
| 254 | ✗ | txt := Tpl.nextIter(txt); | |
| 255 | then txt; | ||
| 256 | end match; | ||
| 257 | end for; | ||
| 258 | end lm_15; | ||
| 259 | |||
| 260 | protected function fun_16 | ||
| 261 | input Tpl.Text in_txt; | ||
| 262 | input Boolean in_mArg; | ||
| 263 | input Tpl.Text in_a_comp__str; | ||
| 264 | |||
| 265 | output Tpl.Text out_txt; | ||
| 266 | algorithm | ||
| 267 | out_txt := | ||
| 268 | match(in_txt, in_mArg, in_a_comp__str) | ||
| 269 | local | ||
| 270 | Tpl.Text txt; | ||
| 271 | Tpl.Text a_comp__str; | ||
| 272 | |||
| 273 | case ( txt, | ||
| 274 | true, | ||
| 275 | _ ) | ||
| 276 | then txt; | ||
| 277 | |||
| 278 | case ( txt, | ||
| 279 | _, | ||
| 280 | a_comp__str ) | ||
| 281 | algorithm | ||
| 282 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 283 | ✗ | txt := Tpl.writeText(txt, a_comp__str); | |
| 284 | ✗ | txt := Tpl.popBlock(txt); | |
| 285 | then txt; | ||
| 286 | end match; | ||
| 287 | end fun_16; | ||
| 288 | |||
| 289 | protected function fun_17 | ||
| 290 | input Tpl.Text in_txt; | ||
| 291 | input Boolean in_mArg; | ||
| 292 | |||
| 293 | output Tpl.Text out_txt; | ||
| 294 | algorithm | ||
| 295 | out_txt := | ||
| 296 | match(in_txt, in_mArg) | ||
| 297 | local | ||
| 298 | Tpl.Text txt; | ||
| 299 | |||
| 300 | case ( txt, | ||
| 301 | true ) | ||
| 302 | algorithm | ||
| 303 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end equation;")); | |
| 304 | then txt; | ||
| 305 | |||
| 306 | case ( txt, | ||
| 307 | _ ) | ||
| 308 | then txt; | ||
| 309 | end match; | ||
| 310 | end fun_17; | ||
| 311 | |||
| 312 | protected function fun_18 | ||
| 313 | input Tpl.Text in_txt; | ||
| 314 | input Boolean in_mArg; | ||
| 315 | input Tpl.Text in_a_eq__str; | ||
| 316 | input Tpl.Text in_a_ieq__str; | ||
| 317 | |||
| 318 | output Tpl.Text out_txt; | ||
| 319 | algorithm | ||
| 320 | out_txt := | ||
| 321 | match(in_txt, in_mArg, in_a_eq__str, in_a_ieq__str) | ||
| 322 | local | ||
| 323 | Tpl.Text txt; | ||
| 324 | Tpl.Text a_eq__str; | ||
| 325 | Tpl.Text a_ieq__str; | ||
| 326 | Boolean ret_0; | ||
| 327 | |||
| 328 | case ( txt, | ||
| 329 | true, | ||
| 330 | _, | ||
| 331 | _ ) | ||
| 332 | then txt; | ||
| 333 | |||
| 334 | case ( txt, | ||
| 335 | _, | ||
| 336 | a_eq__str, | ||
| 337 | a_ieq__str ) | ||
| 338 | algorithm | ||
| 339 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 340 | "\n", | ||
| 341 | "initial equation\n" | ||
| 342 | }, true)); | ||
| 343 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 344 | ✗ | txt := Tpl.writeText(txt, a_ieq__str); | |
| 345 | ✗ | txt := Tpl.softNewLine(txt); | |
| 346 | ✗ | txt := Tpl.popBlock(txt); | |
| 347 | ✗ | ret_0 := Tpl.isEmpty(a_eq__str); | |
| 348 | ✗ | txt := fun_17(txt, ret_0); | |
| 349 | then txt; | ||
| 350 | end match; | ||
| 351 | end fun_18; | ||
| 352 | |||
| 353 | protected function fun_19 | ||
| 354 | input Tpl.Text in_txt; | ||
| 355 | input Boolean in_mArg; | ||
| 356 | input Tpl.Text in_a_eq__str; | ||
| 357 | |||
| 358 | output Tpl.Text out_txt; | ||
| 359 | algorithm | ||
| 360 | out_txt := | ||
| 361 | match(in_txt, in_mArg, in_a_eq__str) | ||
| 362 | local | ||
| 363 | Tpl.Text txt; | ||
| 364 | Tpl.Text a_eq__str; | ||
| 365 | |||
| 366 | case ( txt, | ||
| 367 | true, | ||
| 368 | _ ) | ||
| 369 | then txt; | ||
| 370 | |||
| 371 | case ( txt, | ||
| 372 | _, | ||
| 373 | a_eq__str ) | ||
| 374 | algorithm | ||
| 375 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING_LIST({ | |
| 376 | "\n", | ||
| 377 | "equation\n" | ||
| 378 | }, true)); | ||
| 379 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 380 | ✗ | txt := Tpl.writeText(txt, a_eq__str); | |
| 381 | ✗ | txt := Tpl.softNewLine(txt); | |
| 382 | ✗ | txt := Tpl.popBlock(txt); | |
| 383 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end equation;")); | |
| 384 | then txt; | ||
| 385 | end match; | ||
| 386 | end fun_19; | ||
| 387 | |||
| 388 | public function dumpClass | ||
| 389 | input Tpl.Text in_txt; | ||
| 390 | input NFInstTypes.Class in_a_cls; | ||
| 391 | |||
| 392 | output Tpl.Text out_txt; | ||
| 393 | algorithm | ||
| 394 | out_txt := | ||
| 395 | match(in_txt, in_a_cls) | ||
| 396 | local | ||
| 397 | Tpl.Text txt; | ||
| 398 | list<NFInstTypes.Equation> i_equations; | ||
| 399 | list<NFInstTypes.Equation> i_initialEquations; | ||
| 400 | list<NFInstTypes.Element> i_components; | ||
| 401 | Boolean ret_8; | ||
| 402 | Tpl.Text l_eq__seq__str; | ||
| 403 | Boolean ret_6; | ||
| 404 | Tpl.Text l_ieq__seq__str; | ||
| 405 | Boolean ret_4; | ||
| 406 | Tpl.Text l_comp__seq__str; | ||
| 407 | Tpl.Text l_eq__str; | ||
| 408 | Tpl.Text l_ieq__str; | ||
| 409 | Tpl.Text l_comp__str; | ||
| 410 | |||
| 411 | case ( txt, | ||
| 412 | NFInstTypes.COMPLEX_CLASS(components = i_components, initialEquations = i_initialEquations, equations = i_equations) ) | ||
| 413 | algorithm | ||
| 414 | ✗ | l_comp__str := 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())); | |
| 415 | ✗ | l_comp__str := lm_13(l_comp__str, i_components); | |
| 416 | ✗ | l_comp__str := Tpl.popIter(l_comp__str); | |
| 417 | ✗ | l_ieq__str := 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())); | |
| 418 | ✗ | l_ieq__str := lm_14(l_ieq__str, i_initialEquations); | |
| 419 | ✗ | l_ieq__str := Tpl.popIter(l_ieq__str); | |
| 420 | ✗ | l_eq__str := 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())); | |
| 421 | ✗ | l_eq__str := lm_15(l_eq__str, i_equations); | |
| 422 | ✗ | l_eq__str := Tpl.popIter(l_eq__str); | |
| 423 | ✗ | ret_4 := Tpl.isEmpty(l_comp__str); | |
| 424 | ✗ | l_comp__seq__str := fun_16(Tpl.emptyTxt, ret_4, l_comp__str); | |
| 425 | ✗ | ret_6 := Tpl.isEmpty(l_ieq__str); | |
| 426 | ✗ | l_ieq__seq__str := fun_18(Tpl.emptyTxt, ret_6, l_eq__str, l_ieq__str); | |
| 427 | ✗ | ret_8 := Tpl.isEmpty(l_eq__str); | |
| 428 | ✗ | l_eq__seq__str := fun_19(Tpl.emptyTxt, ret_8, l_eq__str); | |
| 429 | ✗ | txt := Tpl.writeText(txt, l_comp__seq__str); | |
| 430 | ✗ | txt := Tpl.writeText(txt, l_ieq__seq__str); | |
| 431 | ✗ | txt := Tpl.writeText(txt, l_eq__seq__str); | |
| 432 | then txt; | ||
| 433 | |||
| 434 | case ( txt, | ||
| 435 | _ ) | ||
| 436 | then txt; | ||
| 437 | end match; | ||
| 438 | end dumpClass; | ||
| 439 | |||
| 440 | public function dumpExp | ||
| 441 | input Tpl.Text txt; | ||
| 442 | input DAE.Exp a_exp; | ||
| 443 | |||
| 444 | output Tpl.Text out_txt; | ||
| 445 | algorithm | ||
| 446 | ✗ | out_txt := ExpressionDumpTpl.dumpExp(txt, a_exp, "\""); | |
| 447 | end dumpExp; | ||
| 448 | |||
| 449 | protected function fun_22 | ||
| 450 | input Tpl.Text in_txt; | ||
| 451 | input Option<DAE.Exp> in_a_range; | ||
| 452 | |||
| 453 | output Tpl.Text out_txt; | ||
| 454 | algorithm | ||
| 455 | out_txt := | ||
| 456 | match(in_txt, in_a_range) | ||
| 457 | local | ||
| 458 | Tpl.Text txt; | ||
| 459 | DAE.Exp i_range__exp; | ||
| 460 | |||
| 461 | case ( txt, | ||
| 462 | SOME(i_range__exp) ) | ||
| 463 | algorithm | ||
| 464 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 465 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("in ")); | |
| 466 | ✗ | txt := dumpExp(txt, i_range__exp); | |
| 467 | ✗ | txt := Tpl.popBlock(txt); | |
| 468 | then txt; | ||
| 469 | |||
| 470 | case ( txt, | ||
| 471 | _ ) | ||
| 472 | then txt; | ||
| 473 | end match; | ||
| 474 | end fun_22; | ||
| 475 | |||
| 476 | protected function lm_23 | ||
| 477 | input output Tpl.Text txt; | ||
| 478 | input list<NFInstTypes.Equation> items; | ||
| 479 | algorithm | ||
| 480 | ✗ | for lstElt_23 in items loop | |
| 481 | txt := match lstElt_23 | ||
| 482 | local | ||
| 483 | NFInstTypes.Equation i_eq; | ||
| 484 | |||
| 485 | case i_eq | ||
| 486 | algorithm | ||
| 487 | ✗ | txt := dumpEquation(txt, i_eq); | |
| 488 | ✗ | txt := Tpl.nextIter(txt); | |
| 489 | then txt; | ||
| 490 | end match; | ||
| 491 | end for; | ||
| 492 | end lm_23; | ||
| 493 | |||
| 494 | public function dumpEquation | ||
| 495 | input Tpl.Text in_txt; | ||
| 496 | input NFInstTypes.Equation in_a_equation; | ||
| 497 | |||
| 498 | output Tpl.Text out_txt; | ||
| 499 | algorithm | ||
| 500 | out_txt := | ||
| 501 | match(in_txt, in_a_equation) | ||
| 502 | local | ||
| 503 | Tpl.Text txt; | ||
| 504 | DAE.Exp i_exp; | ||
| 505 | DAE.Exp i_reinitExp; | ||
| 506 | DAE.ComponentRef i_cref; | ||
| 507 | DAE.Exp i_message; | ||
| 508 | DAE.Exp i_condition; | ||
| 509 | Integer i_index; | ||
| 510 | String i_name; | ||
| 511 | list<NFInstTypes.Equation> i_body; | ||
| 512 | Option<DAE.Exp> i_range; | ||
| 513 | DAE.Type i_indexType; | ||
| 514 | DAE.Exp i_rhs; | ||
| 515 | DAE.Exp i_lhs; | ||
| 516 | Tpl.Text l_exp__str; | ||
| 517 | Tpl.Text l_cref__str; | ||
| 518 | Tpl.Text l_msg__str; | ||
| 519 | Tpl.Text l_cond__str; | ||
| 520 | Tpl.Text l_eql__str; | ||
| 521 | Tpl.Text l_range__str; | ||
| 522 | Tpl.Text l_ty__str; | ||
| 523 | DAE.Type ret_5; | ||
| 524 | Tpl.Text l_rhs__ty__str; | ||
| 525 | DAE.Type ret_3; | ||
| 526 | Tpl.Text l_lhs__ty__str; | ||
| 527 | Tpl.Text l_rhs__str; | ||
| 528 | Tpl.Text l_lhs__str; | ||
| 529 | |||
| 530 | case ( txt, | ||
| 531 | NFInstTypes.EQUALITY_EQUATION(lhs = i_lhs, rhs = i_rhs) ) | ||
| 532 | algorithm | ||
| 533 | ✗ | l_lhs__str := dumpExp(Tpl.emptyTxt, i_lhs); | |
| 534 | ✗ | l_rhs__str := dumpExp(Tpl.emptyTxt, i_rhs); | |
| 535 | ✗ | ret_3 := Expression.typeof(i_lhs); | |
| 536 | ✗ | l_lhs__ty__str := ExpressionDumpTpl.dumpType(Tpl.emptyTxt, ret_3); | |
| 537 | ✗ | ret_5 := Expression.typeof(i_rhs); | |
| 538 | ✗ | l_rhs__ty__str := ExpressionDumpTpl.dumpType(Tpl.emptyTxt, ret_5); | |
| 539 | ✗ | txt := Tpl.writeText(txt, l_lhs__str); | |
| 540 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" {")); | |
| 541 | ✗ | txt := Tpl.writeText(txt, l_lhs__ty__str); | |
| 542 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("} = {")); | |
| 543 | ✗ | txt := Tpl.writeText(txt, l_rhs__ty__str); | |
| 544 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("} ")); | |
| 545 | ✗ | txt := Tpl.writeText(txt, l_rhs__str); | |
| 546 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(";")); | |
| 547 | then txt; | ||
| 548 | |||
| 549 | case ( txt, | ||
| 550 | NFInstTypes.FOR_EQUATION(indexType = i_indexType, range = i_range, body = i_body, name = i_name, index = i_index) ) | ||
| 551 | algorithm | ||
| 552 | ✗ | l_ty__str := ExpressionDumpTpl.dumpType(Tpl.emptyTxt, i_indexType); | |
| 553 | ✗ | l_range__str := fun_22(Tpl.emptyTxt, i_range); | |
| 554 | ✗ | l_eql__str := 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())); | |
| 555 | ✗ | l_eql__str := lm_23(l_eql__str, i_body); | |
| 556 | ✗ | l_eql__str := Tpl.popIter(l_eql__str); | |
| 557 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("for {")); | |
| 558 | ✗ | txt := Tpl.writeText(txt, l_ty__str); | |
| 559 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("} ")); | |
| 560 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 561 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" /* index ")); | |
| 562 | ✗ | txt := Tpl.writeStr(txt, intString(i_index)); | |
| 563 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(" */")); | |
| 564 | ✗ | txt := Tpl.writeText(txt, l_range__str); | |
| 565 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_LINE(" loop\n")); | |
| 566 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(2)); | |
| 567 | ✗ | txt := Tpl.writeText(txt, l_eql__str); | |
| 568 | ✗ | txt := Tpl.softNewLine(txt); | |
| 569 | ✗ | txt := Tpl.popBlock(txt); | |
| 570 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("end for;")); | |
| 571 | then txt; | ||
| 572 | |||
| 573 | case ( txt, | ||
| 574 | NFInstTypes.IF_EQUATION(branches = _) ) | ||
| 575 | algorithm | ||
| 576 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("if equation;")); | |
| 577 | then txt; | ||
| 578 | |||
| 579 | case ( txt, | ||
| 580 | NFInstTypes.ASSERT_EQUATION(condition = i_condition, message = i_message) ) | ||
| 581 | algorithm | ||
| 582 | ✗ | l_cond__str := dumpExp(Tpl.emptyTxt, i_condition); | |
| 583 | ✗ | l_msg__str := dumpExp(Tpl.emptyTxt, i_message); | |
| 584 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("assert(")); | |
| 585 | ✗ | txt := Tpl.writeText(txt, l_cond__str); | |
| 586 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 587 | ✗ | txt := Tpl.writeText(txt, l_msg__str); | |
| 588 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(");")); | |
| 589 | then txt; | ||
| 590 | |||
| 591 | case ( txt, | ||
| 592 | NFInstTypes.TERMINATE_EQUATION(message = i_message) ) | ||
| 593 | algorithm | ||
| 594 | ✗ | l_msg__str := dumpExp(Tpl.emptyTxt, i_message); | |
| 595 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("terminate(")); | |
| 596 | ✗ | txt := Tpl.writeText(txt, l_msg__str); | |
| 597 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(");")); | |
| 598 | then txt; | ||
| 599 | |||
| 600 | case ( txt, | ||
| 601 | NFInstTypes.REINIT_EQUATION(cref = i_cref, reinitExp = i_reinitExp) ) | ||
| 602 | algorithm | ||
| 603 | ✗ | l_cref__str := ExpressionDumpTpl.dumpCref(Tpl.emptyTxt, i_cref); | |
| 604 | ✗ | l_exp__str := dumpExp(Tpl.emptyTxt, i_reinitExp); | |
| 605 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("reinit(")); | |
| 606 | ✗ | txt := Tpl.writeText(txt, l_cref__str); | |
| 607 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(", ")); | |
| 608 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 609 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(")")); | |
| 610 | then txt; | ||
| 611 | |||
| 612 | case ( txt, | ||
| 613 | NFInstTypes.NORETCALL_EQUATION(exp = i_exp) ) | ||
| 614 | algorithm | ||
| 615 | ✗ | txt := dumpExp(txt, i_exp); | |
| 616 | then txt; | ||
| 617 | |||
| 618 | case ( txt, | ||
| 619 | _ ) | ||
| 620 | algorithm | ||
| 621 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("dumpEquation: IMPLEMENT ME")); | |
| 622 | then txt; | ||
| 623 | end match; | ||
| 624 | end dumpEquation; | ||
| 625 | |||
| 626 | public function dumpBinding | ||
| 627 | input Tpl.Text in_txt; | ||
| 628 | input NFInstTypes.Binding in_a_binding; | ||
| 629 | |||
| 630 | output Tpl.Text out_txt; | ||
| 631 | algorithm | ||
| 632 | out_txt := | ||
| 633 | match(in_txt, in_a_binding) | ||
| 634 | local | ||
| 635 | Tpl.Text txt; | ||
| 636 | DAE.Type i_bindingType; | ||
| 637 | DAE.Exp i_bindingExp; | ||
| 638 | Absyn.Exp i_aexp; | ||
| 639 | Tpl.Text l_ty__str; | ||
| 640 | Tpl.Text l_exp__str; | ||
| 641 | |||
| 642 | case ( txt, | ||
| 643 | NFInstTypes.RAW_BINDING(bindingExp = i_aexp) ) | ||
| 644 | algorithm | ||
| 645 | ✗ | l_exp__str := AbsynDumpTpl.dumpExp(Tpl.emptyTxt, i_aexp); | |
| 646 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 647 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("= <RAW> ")); | |
| 648 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 649 | ✗ | txt := Tpl.popBlock(txt); | |
| 650 | then txt; | ||
| 651 | |||
| 652 | case ( txt, | ||
| 653 | NFInstTypes.UNTYPED_BINDING(bindingExp = i_bindingExp) ) | ||
| 654 | algorithm | ||
| 655 | ✗ | l_exp__str := dumpExp(Tpl.emptyTxt, i_bindingExp); | |
| 656 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 657 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("= ")); | |
| 658 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 659 | ✗ | txt := Tpl.popBlock(txt); | |
| 660 | then txt; | ||
| 661 | |||
| 662 | case ( txt, | ||
| 663 | NFInstTypes.TYPED_BINDING(bindingExp = i_bindingExp, bindingType = i_bindingType) ) | ||
| 664 | algorithm | ||
| 665 | ✗ | l_exp__str := dumpExp(Tpl.emptyTxt, i_bindingExp); | |
| 666 | ✗ | l_ty__str := ExpressionDumpTpl.dumpType(Tpl.emptyTxt, i_bindingType); | |
| 667 | ✗ | txt := Tpl.pushBlock(txt, Tpl.BT_INDENT(1)); | |
| 668 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("= (")); | |
| 669 | ✗ | txt := Tpl.writeText(txt, l_ty__str); | |
| 670 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(") ")); | |
| 671 | ✗ | txt := Tpl.writeText(txt, l_exp__str); | |
| 672 | ✗ | txt := Tpl.popBlock(txt); | |
| 673 | then txt; | ||
| 674 | |||
| 675 | case ( txt, | ||
| 676 | _ ) | ||
| 677 | then txt; | ||
| 678 | end match; | ||
| 679 | end dumpBinding; | ||
| 680 | |||
| 681 | protected function fun_26 | ||
| 682 | input Tpl.Text in_txt; | ||
| 683 | input DAE.Dimensions in_a_dims; | ||
| 684 | |||
| 685 | output Tpl.Text out_txt; | ||
| 686 | algorithm | ||
| 687 | out_txt := | ||
| 688 | match(in_txt, in_a_dims) | ||
| 689 | local | ||
| 690 | Tpl.Text txt; | ||
| 691 | DAE.Dimensions i_dims; | ||
| 692 | |||
| 693 | case ( txt, | ||
| 694 | {} ) | ||
| 695 | then txt; | ||
| 696 | |||
| 697 | case ( txt, | ||
| 698 | i_dims ) | ||
| 699 | algorithm | ||
| 700 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("[")); | |
| 701 | ✗ | txt := ExpressionDumpTpl.dumpDimensions(txt, i_dims); | |
| 702 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING("]")); | |
| 703 | then txt; | ||
| 704 | end match; | ||
| 705 | end fun_26; | ||
| 706 | |||
| 707 | protected function fun_27 | ||
| 708 | input Tpl.Text in_txt; | ||
| 709 | input Boolean in_mArg; | ||
| 710 | input Tpl.Text in_a_rest__str; | ||
| 711 | |||
| 712 | output Tpl.Text out_txt; | ||
| 713 | algorithm | ||
| 714 | out_txt := | ||
| 715 | match(in_txt, in_mArg, in_a_rest__str) | ||
| 716 | local | ||
| 717 | Tpl.Text txt; | ||
| 718 | Tpl.Text a_rest__str; | ||
| 719 | |||
| 720 | case ( txt, | ||
| 721 | true, | ||
| 722 | _ ) | ||
| 723 | then txt; | ||
| 724 | |||
| 725 | case ( txt, | ||
| 726 | _, | ||
| 727 | a_rest__str ) | ||
| 728 | algorithm | ||
| 729 | ✗ | txt := Tpl.writeText(txt, a_rest__str); | |
| 730 | ✗ | txt := Tpl.writeTok(txt, Tpl.ST_STRING(".")); | |
| 731 | then txt; | ||
| 732 | end match; | ||
| 733 | end fun_27; | ||
| 734 | |||
| 735 | public function dumpPrefix | ||
| 736 | input Tpl.Text in_txt; | ||
| 737 | input NFInstPrefix.Prefix in_a_prefix; | ||
| 738 | |||
| 739 | output Tpl.Text out_txt; | ||
| 740 | algorithm | ||
| 741 | out_txt := | ||
| 742 | match(in_txt, in_a_prefix) | ||
| 743 | local | ||
| 744 | Tpl.Text txt; | ||
| 745 | String i_name; | ||
| 746 | NFInstPrefix.Prefix i_restPrefix; | ||
| 747 | DAE.Dimensions i_dims; | ||
| 748 | Boolean ret_3; | ||
| 749 | Tpl.Text l_pre__str; | ||
| 750 | Tpl.Text l_rest__str; | ||
| 751 | Tpl.Text l_dims__str; | ||
| 752 | |||
| 753 | case ( txt, | ||
| 754 | NFInstPrefix.PREFIX(dims = i_dims, restPrefix = i_restPrefix, name = i_name) ) | ||
| 755 | algorithm | ||
| 756 | ✗ | l_dims__str := fun_26(Tpl.emptyTxt, i_dims); | |
| 757 | ✗ | l_rest__str := dumpPrefix(Tpl.emptyTxt, i_restPrefix); | |
| 758 | ✗ | ret_3 := Tpl.isEmpty(l_rest__str); | |
| 759 | ✗ | l_pre__str := fun_27(Tpl.emptyTxt, ret_3, l_rest__str); | |
| 760 | ✗ | txt := Tpl.writeText(txt, l_pre__str); | |
| 761 | ✗ | txt := Tpl.writeStr(txt, i_name); | |
| 762 | ✗ | txt := Tpl.writeText(txt, l_dims__str); | |
| 763 | then txt; | ||
| 764 | |||
| 765 | case ( txt, | ||
| 766 | _ ) | ||
| 767 | then txt; | ||
| 768 | end match; | ||
| 769 | end dumpPrefix; | ||
| 770 | |||
| 771 | public function dumpDimension | ||
| 772 | input Tpl.Text in_txt; | ||
| 773 | input NFInstTypes.Dimension in_a_dim; | ||
| 774 | |||
| 775 | output Tpl.Text out_txt; | ||
| 776 | algorithm | ||
| 777 | out_txt := | ||
| 778 | match(in_txt, in_a_dim) | ||
| 779 | local | ||
| 780 | Tpl.Text txt; | ||
| 781 | DAE.Dimension i_dimension; | ||
| 782 | |||
| 783 | case ( txt, | ||
| 784 | NFInstTypes.UNTYPED_DIMENSION(dimension = i_dimension) ) | ||
| 785 | algorithm | ||
| 786 | ✗ | txt := ExpressionDumpTpl.dumpDimension(txt, i_dimension); | |
| 787 | then txt; | ||
| 788 | |||
| 789 | case ( txt, | ||
| 790 | NFInstTypes.TYPED_DIMENSION(dimension = i_dimension) ) | ||
| 791 | algorithm | ||
| 792 | ✗ | txt := ExpressionDumpTpl.dumpDimension(txt, i_dimension); | |
| 793 | then txt; | ||
| 794 | |||
| 795 | case ( txt, | ||
| 796 | _ ) | ||
| 797 | then txt; | ||
| 798 | end match; | ||
| 799 | end dumpDimension; | ||
| 800 | |||
| 801 | public function errorMsg | ||
| 802 | input Tpl.Text txt; | ||
| 803 | input String a_errMessage; | ||
| 804 | |||
| 805 | output Tpl.Text out_txt; | ||
| 806 | algorithm | ||
| 807 | ✗ | Tpl.addTemplateError(a_errMessage); | |
| 808 | ✗ | out_txt := Tpl.writeStr(txt, a_errMessage); | |
| 809 | end errorMsg; | ||
| 810 | |||
| 811 | annotation(__OpenModelica_Interface="frontend"); | ||
| 812 | end NFInstDumpTpl; | ||
| 813 |