#ifdef OMC_BASE_FILE
#define OMC_FILE OMC_BASE_FILE
#else
#define OMC_FILE "/home/mahge/dev/OpenModelica/OMCompiler/Compiler/boot/build/tmp/ValuesUtil.c"
#endif
#include "omc_simulation_settings.h"
#include "ValuesUtil.h"
#define _OMC_LIT0_data ","
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT0,1,_OMC_LIT0_data);
#define _OMC_LIT0 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT0)
#define _OMC_LIT1_data "\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT1,1,_OMC_LIT1_data);
#define _OMC_LIT1 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT1)
#define _OMC_LIT2_data "failtrace"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT2,9,_OMC_LIT2_data);
#define _OMC_LIT2 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT2)
#define _OMC_LIT3_data "Sets whether to print a failtrace or not."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT3,41,_OMC_LIT3_data);
#define _OMC_LIT3 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT3)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT4,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT3}};
#define _OMC_LIT4 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT4)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT5,5,3) {&Flags_DebugFlag_DEBUG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1)),_OMC_LIT2,MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),_OMC_LIT4}};
#define _OMC_LIT5 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT5)
#define _OMC_LIT6_data "- ValuesUtil.unparsePtolemySet2 failed on v1: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT6,46,_OMC_LIT6_data);
#define _OMC_LIT6 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT6)
#define _OMC_LIT7_data " and v2: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT7,9,_OMC_LIT7_data);
#define _OMC_LIT7 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT7)
#define _OMC_LIT8_data "DataSet: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT8,9,_OMC_LIT8_data);
#define _OMC_LIT8 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT8)
#define _OMC_LIT9_data "#Ptolemy Plot generated by OpenModelica\nTitleText: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT9,51,_OMC_LIT9_data);
#define _OMC_LIT9 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT9)
#define _OMC_LIT10_data "    "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT10,4,_OMC_LIT10_data);
#define _OMC_LIT10 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT10)
#define _OMC_LIT11_data " = "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT11,3,_OMC_LIT11_data);
#define _OMC_LIT11 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT11)
#define _OMC_LIT12_data ",\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT12,2,_OMC_LIT12_data);
#define _OMC_LIT12 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT12)
#define _OMC_LIT13_data "ValuesUtil.valRecordString failed:\nids: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT13,40,_OMC_LIT13_data);
#define _OMC_LIT13 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT13)
#define _OMC_LIT14_data ", "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT14,2,_OMC_LIT14_data);
#define _OMC_LIT14 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT14)
#define _OMC_LIT15_data "\nvals: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT15,7,_OMC_LIT15_data);
#define _OMC_LIT15 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT15)
#define _OMC_LIT16_data "messages"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT16,8,_OMC_LIT16_data);
#define _OMC_LIT16 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT16)
#define _OMC_LIT17_data "resultFile"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT17,10,_OMC_LIT17_data);
#define _OMC_LIT17 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT17)
#define _OMC_LIT18_data "\""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT18,1,_OMC_LIT18_data);
#define _OMC_LIT18 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT18)
#define _OMC_LIT19_data "false"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT19,5,_OMC_LIT19_data);
#define _OMC_LIT19 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT19)
#define _OMC_LIT20_data "true"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT20,4,_OMC_LIT20_data);
#define _OMC_LIT20 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT20)
#define _OMC_LIT21_data "."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT21,1,_OMC_LIT21_data);
#define _OMC_LIT21 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT21)
#define _OMC_LIT22_data "{"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT22,1,_OMC_LIT22_data);
#define _OMC_LIT22 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT22)
#define _OMC_LIT23_data "}"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT23,1,_OMC_LIT23_data);
#define _OMC_LIT23 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT23)
#define _OMC_LIT24_data "("
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT24,1,_OMC_LIT24_data);
#define _OMC_LIT24 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT24)
#define _OMC_LIT25_data ")"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT25,1,_OMC_LIT25_data);
#define _OMC_LIT25 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT25)
#define _OMC_LIT26_data "record SimulationResult\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT26,24,_OMC_LIT26_data);
#define _OMC_LIT26 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT26)
#define _OMC_LIT27_data "shortOutput"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT27,11,_OMC_LIT27_data);
#define _OMC_LIT27 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT27)
#define _OMC_LIT28_data "Enables short output of the simulate() command. Useful for tools like OMNotebook."
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT28,81,_OMC_LIT28_data);
#define _OMC_LIT28 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT28)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT29,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT28}};
#define _OMC_LIT29 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT29)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT30,5,3) {&Flags_DebugFlag_DEBUG__FLAG__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(60)),_OMC_LIT27,MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),_OMC_LIT29}};
#define _OMC_LIT30 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT30)
#define _OMC_LIT31_data "end SimulationResult;"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT31,21,_OMC_LIT31_data);
#define _OMC_LIT31 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT31)
#define _OMC_LIT32_data "record "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT32,7,_OMC_LIT32_data);
#define _OMC_LIT32 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT32)
#define _OMC_LIT33_data "end "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT33,4,_OMC_LIT33_data);
#define _OMC_LIT33 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT33)
#define _OMC_LIT34_data ";"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT34,1,_OMC_LIT34_data);
#define _OMC_LIT34 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT34)
#define _OMC_LIT35_data "SOME("
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT35,5,_OMC_LIT35_data);
#define _OMC_LIT35 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT35)
#define _OMC_LIT36_data "NONE()"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT36,6,_OMC_LIT36_data);
#define _OMC_LIT36 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT36)
#define _OMC_LIT37_data "#("
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT37,2,_OMC_LIT37_data);
#define _OMC_LIT37 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT37)
#define _OMC_LIT38_data "Code("
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT38,5,_OMC_LIT38_data);
#define _OMC_LIT38 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT38)
#define _OMC_LIT39_data "meta_array("
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT39,11,_OMC_LIT39_data);
#define _OMC_LIT39 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT39)
#define _OMC_LIT40_data " /* ENUM: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT40,10,_OMC_LIT40_data);
#define _OMC_LIT40 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT40)
#define _OMC_LIT41_data " */"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT41,3,_OMC_LIT41_data);
#define _OMC_LIT41 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT41)
#define _OMC_LIT42_data "fail()"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT42,6,_OMC_LIT42_data);
#define _OMC_LIT42 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT42)
#define _OMC_LIT43_data "/* <EMPTY(scope: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT43,17,_OMC_LIT43_data);
#define _OMC_LIT43 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT43)
#define _OMC_LIT44_data ", name: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT44,8,_OMC_LIT44_data);
#define _OMC_LIT44 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT44)
#define _OMC_LIT45_data ", ty: "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT45,6,_OMC_LIT45_data);
#define _OMC_LIT45 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT45)
#define _OMC_LIT46_data ")> */"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT46,5,_OMC_LIT46_data);
#define _OMC_LIT46 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT46)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT47,1,5) {&ErrorTypes_MessageType_TRANSLATION__desc,}};
#define _OMC_LIT47 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT47)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT48,1,4) {&ErrorTypes_Severity_ERROR__desc,}};
#define _OMC_LIT48 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT48)
#define _OMC_LIT49_data "Internal error %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT49,17,_OMC_LIT49_data);
#define _OMC_LIT49 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT49)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT50,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT49}};
#define _OMC_LIT50 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT50)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT51,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(63)),_OMC_LIT47,_OMC_LIT48,_OMC_LIT50}};
#define _OMC_LIT51 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT51)
#define _OMC_LIT52_data "ValuesUtil.valString2 failed"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT52,28,_OMC_LIT52_data);
#define _OMC_LIT52 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT52)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT53,2,1) {_OMC_LIT52,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT53 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT53)
#define _OMC_LIT54_data "SimulationResult"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT54,16,_OMC_LIT54_data);
#define _OMC_LIT54 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT54)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT55,2,1) {MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT55 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT55)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT56,3,8) {&Values_Value_ARRAY__desc,MMC_REFSTRUCTLIT(mmc_nil),_OMC_LIT55}};
#define _OMC_LIT56 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT56)
#define _OMC_LIT57_data "ValuesUtil.crossProduct failed"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT57,30,_OMC_LIT57_data);
#define _OMC_LIT57 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT57)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT58,2,1) {_OMC_LIT57,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT58 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT58)
#define _OMC_LIT59_data "Values.multScalarProduct failed\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT59,32,_OMC_LIT59_data);
#define _OMC_LIT59 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT59)
#define _OMC_LIT60_data "Division by zero in %s / %s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT60,27,_OMC_LIT60_data);
#define _OMC_LIT60 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT60)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT61,2,3) {&Gettext_TranslatableContent_gettext__desc,_OMC_LIT60}};
#define _OMC_LIT61 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT61)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT62,5,3) {&ErrorTypes_Message_MESSAGE__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(15)),_OMC_LIT47,_OMC_LIT48,_OMC_LIT61}};
#define _OMC_LIT62 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT62)
#define _OMC_LIT63_data "0"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT63,1,_OMC_LIT63_data);
#define _OMC_LIT63 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT63)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT64,1,11) {&DAE_Type_T__UNKNOWN__desc,}};
#define _OMC_LIT64 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT64)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT65,4,19) {&DAE_Exp_ARRAY__desc,_OMC_LIT64,MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT65 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT65)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT66,2,3) {&DAE_Dimension_DIM__INTEGER__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(1))}};
#define _OMC_LIT66 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT66)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT67,2,26) {&DAE_Type_T__METABOXED__desc,_OMC_LIT64}};
#define _OMC_LIT67 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT67)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT68,2,34) {&DAE_Exp_META__OPTION__desc,MMC_REFSTRUCTLIT(mmc_none)}};
#define _OMC_LIT68 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT68)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT69,2,31) {&DAE_Exp_LIST__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT69 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT69)
#define _OMC_LIT70_data "listArrayLiteral"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT70,16,_OMC_LIT70_data);
#define _OMC_LIT70 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT70)
#define _OMC_LIT71_data "fail"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT71,4,_OMC_LIT71_data);
#define _OMC_LIT71 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT71)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT72,2,4) {&Absyn_Path_IDENT__desc,_OMC_LIT71}};
#define _OMC_LIT72 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT72)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT73,1,7) {&DAE_InlineType_NO__INLINE__desc,}};
#define _OMC_LIT73 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT73)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT74,1,3) {&DAE_TailCall_NO__TAIL__desc,}};
#define _OMC_LIT74 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT74)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT75,8,3) {&DAE_CallAttributes_CALL__ATTR__desc,_OMC_LIT64,MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_IMMEDIATE(MMC_TAGFIXNUM(1)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),MMC_IMMEDIATE(MMC_TAGFIXNUM(0)),_OMC_LIT73,_OMC_LIT74}};
#define _OMC_LIT75 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT75)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT76,4,16) {&DAE_Exp_CALL__desc,_OMC_LIT72,MMC_REFSTRUCTLIT(mmc_nil),_OMC_LIT75}};
#define _OMC_LIT76 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT76)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT77,2,22) {&DAE_Exp_TUPLE__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT77 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT77)
#define _OMC_LIT78_data "ValuesUtil.valueExp failed for "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT78,31,_OMC_LIT78_data);
#define _OMC_LIT78 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT78)
#define _OMC_LIT79_data " "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT79,1,_OMC_LIT79_data);
#define _OMC_LIT79 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT79)
#define _OMC_LIT80_data "i"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT80,1,_OMC_LIT80_data);
#define _OMC_LIT80 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT80)
#define _OMC_LIT81_data "r"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT81,1,_OMC_LIT81_data);
#define _OMC_LIT81 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT81)
#define _OMC_LIT82_data "s"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT82,1,_OMC_LIT82_data);
#define _OMC_LIT82 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT82)
#define _OMC_LIT83_data "b"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT83,1,_OMC_LIT83_data);
#define _OMC_LIT83 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT83)
#define _OMC_LIT84_data "{}"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT84,2,_OMC_LIT84_data);
#define _OMC_LIT84 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT84)
#define _OMC_LIT85_data "error"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT85,5,_OMC_LIT85_data);
#define _OMC_LIT85 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT85)
#define _OMC_LIT86_data "# "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT86,2,_OMC_LIT86_data);
#define _OMC_LIT86 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT86)
#define _OMC_LIT87_data "["
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT87,1,_OMC_LIT87_data);
#define _OMC_LIT87 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT87)
#define _OMC_LIT88_data "# i!\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT88,5,_OMC_LIT88_data);
#define _OMC_LIT88 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT88)
#define _OMC_LIT89_data "# r!\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT89,5,_OMC_LIT89_data);
#define _OMC_LIT89 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT89)
#define _OMC_LIT90_data "# s! 1 "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT90,7,_OMC_LIT90_data);
#define _OMC_LIT90 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT90)
#define _OMC_LIT91_data " \n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT91,2,_OMC_LIT91_data);
#define _OMC_LIT91 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT91)
#define _OMC_LIT92_data ""
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT92,0,_OMC_LIT92_data);
#define _OMC_LIT92 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT92)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT93,1,3) {&ExpressionSimplifyTypes_IntOp_MULOP__desc,}};
#define _OMC_LIT93 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT93)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT94,1,4) {&ExpressionSimplifyTypes_IntOp_DIVOP__desc,}};
#define _OMC_LIT94 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT94)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT95,1,7) {&ExpressionSimplifyTypes_IntOp_POWOP__desc,}};
#define _OMC_LIT95 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT95)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT96,1,5) {&ExpressionSimplifyTypes_IntOp_ADDOP__desc,}};
#define _OMC_LIT96 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT96)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT97,1,6) {&ExpressionSimplifyTypes_IntOp_SUBOP__desc,}};
#define _OMC_LIT97 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT97)
static const MMC_DEFREALLIT(_OMC_LIT_STRUCT98,0.0);
#define _OMC_LIT98 MMC_REFREALLIT(_OMC_LIT_STRUCT98)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT99,2,4) {&Values_Value_REAL__desc,_OMC_LIT98}};
#define _OMC_LIT99 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT99)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT100,2,3) {&Values_Value_INTEGER__desc,MMC_IMMEDIATE(MMC_TAGFIXNUM(0))}};
#define _OMC_LIT100 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT100)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT101,1,6) {&DAE_ConnectorType_NON__CONNECTOR__desc,}};
#define _OMC_LIT101 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT101)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT102,1,5) {&SCode_Parallelism_NON__PARALLEL__desc,}};
#define _OMC_LIT102 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT102)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT103,1,3) {&SCode_Variability_VAR__desc,}};
#define _OMC_LIT103 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT103)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT104,1,5) {&Absyn_Direction_BIDIR__desc,}};
#define _OMC_LIT104 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT104)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT105,1,6) {&Absyn_InnerOuter_NOT__INNER__OUTER__desc,}};
#define _OMC_LIT105 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT105)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT106,1,3) {&SCode_Visibility_PUBLIC__desc,}};
#define _OMC_LIT106 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT106)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT107,7,3) {&DAE_Attributes_ATTR__desc,_OMC_LIT101,_OMC_LIT102,_OMC_LIT103,_OMC_LIT104,_OMC_LIT105,_OMC_LIT106}};
#define _OMC_LIT107 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT107)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT108,1,3) {&DAE_Binding_UNBOUND__desc,}};
#define _OMC_LIT108 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT108)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT109,2,3) {&DAE_Type_T__INTEGER__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT109 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT109)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT110,2,4) {&DAE_Type_T__REAL__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT110 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT110)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT111,2,6) {&DAE_Type_T__BOOL__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT111 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT111)
static const MMC_DEFSTRUCTLIT(_OMC_LIT_STRUCT112,2,5) {&DAE_Type_T__STRING__desc,MMC_REFSTRUCTLIT(mmc_nil)}};
#define _OMC_LIT112 MMC_REFSTRUCTLIT(_OMC_LIT_STRUCT112)
#define _OMC_LIT113_data "valueExpType on "
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT113,16,_OMC_LIT113_data);
#define _OMC_LIT113 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT113)
#define _OMC_LIT114_data " not implemented yet\n"
static const MMC_DEFSTRINGLIT(_OMC_LIT_STRUCT114,21,_OMC_LIT114_data);
#define _OMC_LIT114 MMC_REFSTRINGLIT(_OMC_LIT_STRUCT114)
#include "util/modelica.h"
#include "ValuesUtil_includes.h"
#if !defined(PROTECTED_FUNCTION_STATIC)
#define PROTECTED_FUNCTION_STATIC
#endif
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_unparsePtolemySet2(threadData_t *threadData, modelica_metatype _inValue1, modelica_metatype _inValue2);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePtolemySet2,2,0) {(void*) boxptr_ValuesUtil_unparsePtolemySet2,0}};
#define boxvar_ValuesUtil_unparsePtolemySet2 MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePtolemySet2)
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_unparsePtolemySet(threadData_t *threadData, modelica_metatype _v1, modelica_metatype _v2, modelica_string _varname);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePtolemySet,2,0) {(void*) boxptr_ValuesUtil_unparsePtolemySet,0}};
#define boxvar_ValuesUtil_unparsePtolemySet MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePtolemySet)
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_unparsePtolemyValues(threadData_t *threadData, modelica_metatype _inValue, modelica_metatype _inValueLst, modelica_metatype _inStringLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePtolemyValues,2,0) {(void*) boxptr_ValuesUtil_unparsePtolemyValues,0}};
#define boxvar_ValuesUtil_unparsePtolemyValues MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePtolemyValues)
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_valListString(threadData_t *threadData, modelica_metatype _inValueLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_valListString,2,0) {(void*) boxptr_ValuesUtil_valListString,0}};
#define boxvar_ValuesUtil_valListString MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_valListString)
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_valRecordString(threadData_t *threadData, modelica_metatype _inValues, modelica_metatype _inIds);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_valRecordString,2,0) {(void*) boxptr_ValuesUtil_valRecordString,0}};
#define boxvar_ValuesUtil_valRecordString MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_valRecordString)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_filterSimulationResults(threadData_t *threadData, modelica_boolean _filter, modelica_metatype _inValues, modelica_metatype _inIds, modelica_metatype _valacc, modelica_metatype _idacc, modelica_metatype *out_outIds);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ValuesUtil_filterSimulationResults(threadData_t *threadData, modelica_metatype _filter, modelica_metatype _inValues, modelica_metatype _inIds, modelica_metatype _valacc, modelica_metatype _idacc, modelica_metatype *out_outIds);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_filterSimulationResults,2,0) {(void*) boxptr_ValuesUtil_filterSimulationResults,0}};
#define boxvar_ValuesUtil_filterSimulationResults MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_filterSimulationResults)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_matrixStripFirstColumn(threadData_t *threadData, modelica_metatype _inValueLst, modelica_metatype *out_outValueLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_matrixStripFirstColumn,2,0) {(void*) boxptr_ValuesUtil_matrixStripFirstColumn,0}};
#define boxvar_ValuesUtil_matrixStripFirstColumn MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_matrixStripFirstColumn)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_valueExpArray(threadData_t *threadData, modelica_metatype _values, modelica_metatype _inDims, modelica_metatype _originalExp);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_valueExpArray,2,0) {(void*) boxptr_ValuesUtil_valueExpArray,0}};
#define boxvar_ValuesUtil_valueExpArray MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_valueExpArray)
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseDimSizes(threadData_t *threadData, modelica_metatype _inValueLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseDimSizes,2,0) {(void*) boxptr_ValuesUtil_unparseDimSizes,0}};
#define boxvar_ValuesUtil_unparseDimSizes MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseDimSizes)
PROTECTED_FUNCTION_STATIC modelica_integer omc_ValuesUtil_unparseNumDims(threadData_t *threadData, modelica_metatype _inValueLst, modelica_integer _inInteger);
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ValuesUtil_unparseNumDims(threadData_t *threadData, modelica_metatype _inValueLst, modelica_metatype _inInteger);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseNumDims,2,0) {(void*) boxptr_ValuesUtil_unparseNumDims,0}};
#define boxvar_ValuesUtil_unparseNumDims MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseNumDims)
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparsePrimType(threadData_t *threadData, modelica_metatype _inValueLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePrimType,2,0) {(void*) boxptr_ValuesUtil_unparsePrimType,0}};
#define boxvar_ValuesUtil_unparsePrimType MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparsePrimType)
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseArrayDescription(threadData_t *threadData, modelica_metatype _lst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseArrayDescription,2,0) {(void*) boxptr_ValuesUtil_unparseArrayDescription,0}};
#define boxvar_ValuesUtil_unparseArrayDescription MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseArrayDescription)
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseDescription(threadData_t *threadData, modelica_metatype _inValueLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseDescription,2,0) {(void*) boxptr_ValuesUtil_unparseDescription,0}};
#define boxvar_ValuesUtil_unparseDescription MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseDescription)
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseValueNumbers(threadData_t *threadData, modelica_metatype _inValueLst);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseValueNumbers,2,0) {(void*) boxptr_ValuesUtil_unparseValueNumbers,0}};
#define boxvar_ValuesUtil_unparseValueNumbers MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_unparseValueNumbers)
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_valueExpTypeExpVar(threadData_t *threadData, modelica_metatype _etp, modelica_string _name);
static const MMC_DEFSTRUCTLIT(boxvar_lit_ValuesUtil_valueExpTypeExpVar,2,0) {(void*) boxptr_ValuesUtil_valueExpTypeExpVar,0}};
#define boxvar_ValuesUtil_valueExpTypeExpVar MMC_REFSTRUCTLIT(boxvar_lit_ValuesUtil_valueExpTypeExpVar)
DLLExport
modelica_metatype omc_ValuesUtil_fixZeroSizeArray(threadData_t *threadData, modelica_metatype __omcQ_24in_5Fe, modelica_metatype _ty)
{
modelica_metatype _e = NULL;
modelica_metatype tmpMeta[5] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_e = __omcQ_24in_5Fe;
{
modelica_metatype tmp3_1;
tmp3_1 = _e;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,16,3) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],6,2) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],8,0) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (0 != tmp5) goto tmp2_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
if (!listEmpty(tmpMeta[4])) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[2] = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _ty, mmc_mk_boolean((!omc_Types_isArray(threadData, omc_Types_unliftArray(threadData, _ty)))), tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 1: {
tmpMeta[0] = _e;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_e = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _e;
}
DLLExport
modelica_metatype omc_ValuesUtil_typeConvertRecord(threadData_t *threadData, modelica_metatype _inValue, modelica_metatype _inType)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outValue = _inValue;
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _outValue;
tmp3_2 = _inType;
{
modelica_metatype _ty = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,10,4) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,9,3) == 0) goto tmp2_end;
{
modelica_metatype __omcQ_24tmpVar1;
modelica_metatype* tmp5;
modelica_metatype __omcQ_24tmpVar0;
int tmp6;
modelica_metatype _var_loopVar = 0;
modelica_metatype _var;
modelica_metatype _val_loopVar = 0;
modelica_metatype _val;
_var_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inType), 3)));
_val_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_outValue), 3)));
tmpMeta[3] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar1 = tmpMeta[3];
tmp5 = &__omcQ_24tmpVar1;
while(1) {
tmp6 = 2;
if (!listEmpty(_var_loopVar)) {
_var = MMC_CAR(_var_loopVar);
_var_loopVar = MMC_CDR(_var_loopVar);
tmp6--;
}if (!listEmpty(_val_loopVar)) {
_val = MMC_CAR(_val_loopVar);
_val_loopVar = MMC_CDR(_val_loopVar);
tmp6--;
}
if (tmp6 == 0) {
__omcQ_24tmpVar0 = omc_ValuesUtil_typeConvertRecord(threadData, _val, omc_Types_getVarType(threadData, _var));
*tmp5 = mmc_mk_cons(__omcQ_24tmpVar0,0);
tmp5 = &MMC_CDR(*tmp5);
} else if (tmp6 == 2) {
break;
} else {
goto goto_1;
}
}
*tmp5 = mmc_mk_nil();
tmpMeta[2] = __omcQ_24tmpVar1;
}
tmpMeta[1] = MMC_TAGPTR(mmc_alloc_words(6));
memcpy(MMC_UNTAGPTR(tmpMeta[1]), MMC_UNTAGPTR(_outValue), 6*sizeof(modelica_metatype));
((modelica_metatype*)MMC_UNTAGPTR(tmpMeta[1]))[3] = tmpMeta[2];
_outValue = tmpMeta[1];
tmpMeta[0] = _outValue;
goto tmp2_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(((modelica_real)mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_outValue), 2)))))));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,6,2) == 0) goto tmp2_end;
_ty = omc_Expression_unliftArray(threadData, _inType);
{
modelica_metatype __omcQ_24tmpVar3;
modelica_metatype* tmp7;
modelica_metatype __omcQ_24tmpVar2;
int tmp8;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_outValue), 2)));
tmpMeta[3] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar3 = tmpMeta[3];
tmp7 = &__omcQ_24tmpVar3;
while(1) {
tmp8 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp8--;
}
if (tmp8 == 0) {
__omcQ_24tmpVar2 = omc_ValuesUtil_typeConvertRecord(threadData, _v, _ty);
*tmp7 = mmc_mk_cons(__omcQ_24tmpVar2,0);
tmp7 = &MMC_CDR(*tmp7);
} else if (tmp8 == 1) {
break;
} else {
goto goto_1;
}
}
*tmp7 = mmc_mk_nil();
tmpMeta[2] = __omcQ_24tmpVar3;
}
tmpMeta[1] = MMC_TAGPTR(mmc_alloc_words(4));
memcpy(MMC_UNTAGPTR(tmpMeta[1]), MMC_UNTAGPTR(_outValue), 4*sizeof(modelica_metatype));
((modelica_metatype*)MMC_UNTAGPTR(tmpMeta[1]))[2] = tmpMeta[2];
_outValue = tmpMeta[1];
tmpMeta[0] = _outValue;
goto tmp2_done;
}
case 3: {
tmpMeta[0] = _outValue;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_boolean omc_ValuesUtil_isEmpty(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outIsEmpty;
modelica_boolean tmp1 = 0;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValue;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,16,4) == 0) goto tmp3_end;
tmp1 = 1;
goto tmp3_done;
}
case 1: {
tmp1 = 0;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outIsEmpty = tmp1;
_return: OMC_LABEL_UNUSED
return _outIsEmpty;
}
modelica_metatype boxptr_ValuesUtil_isEmpty(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outIsEmpty;
modelica_metatype out_outIsEmpty;
_outIsEmpty = omc_ValuesUtil_isEmpty(threadData, _inValue);
out_outIsEmpty = mmc_mk_icon(_outIsEmpty);
return out_outIsEmpty;
}
DLLExport
modelica_metatype omc_ValuesUtil_liftValueList(threadData_t *threadData, modelica_metatype _inValue, modelica_metatype _inDimensions)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outValue = _inValue;
{
modelica_metatype _dim;
for (tmpMeta[0] = listReverse(_inDimensions); !listEmpty(tmpMeta[0]); tmpMeta[0]=MMC_CDR(tmpMeta[0]))
{
_dim = MMC_CAR(tmpMeta[0]);
_outValue = omc_ValuesUtil_makeArray(threadData, omc_List_fill(threadData, _outValue, omc_Expression_dimensionSize(threadData, _dim)));
}
}
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_arrayContainsEmpty(threadData_t *threadData, modelica_metatype _inValues)
{
modelica_metatype _outOptValue = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outOptValue = mmc_mk_none();
{
modelica_metatype _val;
for (tmpMeta[0] = _inValues; !listEmpty(tmpMeta[0]); tmpMeta[0]=MMC_CDR(tmpMeta[0]))
{
_val = MMC_CAR(tmpMeta[0]);
_outOptValue = omc_ValuesUtil_containsEmpty(threadData, _val);
if(isSome(_outOptValue))
{
break;
}
}
}
_return: OMC_LABEL_UNUSED
return _outOptValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_containsEmpty(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outEmptyVal = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
int tmp3;
{
switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
case 19: {
tmpMeta[0] = mmc_mk_some(_inValue);
goto tmp2_done;
}
case 8: {
tmpMeta[0] = omc_ValuesUtil_arrayContainsEmpty(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inValue), 2))));
goto tmp2_done;
}
case 13: {
tmpMeta[0] = omc_ValuesUtil_arrayContainsEmpty(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inValue), 3))));
goto tmp2_done;
}
case 11: {
tmpMeta[0] = omc_ValuesUtil_arrayContainsEmpty(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inValue), 2))));
goto tmp2_done;
}
default:
tmp2_default: OMC_LABEL_UNUSED; {
tmpMeta[0] = mmc_mk_none();
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outEmptyVal = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outEmptyVal;
}
DLLExport
modelica_metatype omc_ValuesUtil_arrayOrListVals(threadData_t *threadData, modelica_metatype _v, modelica_boolean _boxIfUnboxed)
{
modelica_metatype _vals = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_boolean tmp3_2;
tmp3_1 = _v;
tmp3_2 = _boxIfUnboxed;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 3; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vals = tmpMeta[1];
tmpMeta[0] = _vals;
goto tmp2_done;
}
case 1: {
if (1 != tmp3_2) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vals = tmpMeta[1];
tmpMeta[0] = omc_List_map(threadData, _vals, boxvar_ValuesUtil_boxIfUnboxedVal);
goto tmp2_done;
}
case 2: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vals = tmpMeta[1];
tmpMeta[0] = _vals;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_vals = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _vals;
}
modelica_metatype boxptr_ValuesUtil_arrayOrListVals(threadData_t *threadData, modelica_metatype _v, modelica_metatype _boxIfUnboxed)
{
modelica_integer tmp1;
modelica_metatype _vals = NULL;
tmp1 = mmc_unbox_integer(_boxIfUnboxed);
_vals = omc_ValuesUtil_arrayOrListVals(threadData, _v, tmp1);
return _vals;
}
DLLExport
modelica_metatype omc_ValuesUtil_unboxIfBoxedVal(threadData_t *threadData, modelica_metatype _iv)
{
modelica_metatype _ov = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _iv;
{
modelica_metatype _v = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,14,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_v = tmpMeta[1];
tmpMeta[0] = _v;
goto tmp2_done;
}
case 1: {
tmpMeta[0] = _iv;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_ov = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _ov;
}
DLLExport
modelica_metatype omc_ValuesUtil_boxIfUnboxedVal(threadData_t *threadData, modelica_metatype _v)
{
modelica_metatype _ov = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _v;
{
int tmp3;
{
switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
case 3: {
tmpMeta[1] = mmc_mk_box2(17, &Values_Value_META__BOX__desc, _v);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 4: {
tmpMeta[1] = mmc_mk_box2(17, &Values_Value_META__BOX__desc, _v);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 6: {
tmpMeta[1] = mmc_mk_box2(17, &Values_Value_META__BOX__desc, _v);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
default:
tmp2_default: OMC_LABEL_UNUSED; {
tmpMeta[0] = _v;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_ov = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _ov;
}
DLLExport
modelica_string omc_ValuesUtil_printCodeVariableName(threadData_t *threadData, modelica_metatype _val)
{
modelica_string _str = NULL;
modelica_string tmp1 = 0;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _val;
{
modelica_metatype _cr = NULL;
modelica_metatype _exp = NULL;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,12,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],6,1) == 0) goto tmp3_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_exp = tmpMeta[1];
tmp1 = omc_Dump_printExpStr(threadData, _exp);
goto tmp3_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,12,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],1,1) == 0) goto tmp3_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_cr = tmpMeta[1];
tmp1 = omc_Dump_printComponentRefStr(threadData, _cr);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_str = tmp1;
_return: OMC_LABEL_UNUSED
return _str;
}
DLLExport
modelica_metatype omc_ValuesUtil_getPath(threadData_t *threadData, modelica_metatype _val)
{
modelica_metatype _path = NULL;
modelica_metatype _code = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _val;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],12,1) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_code = tmpMeta[1];
tmpMeta[0] = _code;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],0,1) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_path = tmpMeta[1];
_return: OMC_LABEL_UNUSED
return _path;
}
DLLExport
modelica_metatype omc_ValuesUtil_getCode(threadData_t *threadData, modelica_metatype _val)
{
modelica_metatype _code = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _val;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],12,1) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_code = tmpMeta[1];
_return: OMC_LABEL_UNUSED
return _code;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeCodeTypeName(threadData_t *threadData, modelica_metatype _path)
{
modelica_metatype _val = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(3, &Absyn_CodeNode_C__TYPENAME__desc, _path);
tmpMeta[1] = mmc_mk_box2(15, &Values_Value_CODE__desc, tmpMeta[0]);
_val = tmpMeta[1];
_return: OMC_LABEL_UNUSED
return _val;
}
DLLExport
modelica_string omc_ValuesUtil_extractValueString(threadData_t *threadData, modelica_metatype _val)
{
modelica_string _str = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _val;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],2,1) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_str = tmpMeta[1];
_return: OMC_LABEL_UNUSED
return _str;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueDimensions(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outDimensions = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
_dims = tmpMeta[1];
tmpMeta[0] = _dims;
goto tmp2_done;
}
case 1: {
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outDimensions = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outDimensions;
}
DLLExport
modelica_integer omc_ValuesUtil_valueInteger(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_integer _outInteger;
modelica_integer tmp1 = 0;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValue;
{
modelica_integer _i;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 4; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
modelica_integer tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp6 = mmc_unbox_integer(tmpMeta[0]);
_i = tmp6;
tmp1 = _i;
goto tmp3_done;
}
case 1: {
modelica_integer tmp7;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,4,2) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 3));
tmp7 = mmc_unbox_integer(tmpMeta[0]);
_i = tmp7;
tmp1 = _i;
goto tmp3_done;
}
case 2: {
modelica_integer tmp8;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp8 = mmc_unbox_integer(tmpMeta[0]);
if (1 != tmp8) goto tmp3_end;
tmp1 = ((modelica_integer) 1);
goto tmp3_done;
}
case 3: {
modelica_integer tmp9;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,3,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp9 = mmc_unbox_integer(tmpMeta[0]);
if (0 != tmp9) goto tmp3_end;
tmp1 = ((modelica_integer) 0);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outInteger = tmp1;
_return: OMC_LABEL_UNUSED
return _outInteger;
}
modelica_metatype boxptr_ValuesUtil_valueInteger(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_integer _outInteger;
modelica_metatype out_outInteger;
_outInteger = omc_ValuesUtil_valueInteger(threadData, _inValue);
out_outInteger = mmc_mk_icon(_outInteger);
return out_outInteger;
}
DLLExport
modelica_metatype omc_ValuesUtil_nthnthArrayelt(threadData_t *threadData, modelica_metatype _inLst, modelica_metatype _inValue, modelica_metatype _lastValue)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[5] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;modelica_metatype tmp3_3;
tmp3_1 = _inLst;
tmp3_2 = _inValue;
tmp3_3 = _lastValue;
{
modelica_boolean _b;
modelica_integer _n;
modelica_metatype _res = NULL;
modelica_metatype _preRes = NULL;
modelica_metatype _vlst = NULL;
modelica_metatype _vlst2 = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
_preRes = tmp3_3;
tmpMeta[0] = _preRes;
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[2] = MMC_CAR(tmp3_1);
tmpMeta[3] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],0,1) == 0) goto tmp2_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[4]);
_vlst = tmpMeta[1];
_n = tmp5;
_vlst2 = tmpMeta[3];
_res = listGet(_vlst, _n);
_inLst = _vlst2;
_inValue = _res;
_lastValue = _res;
goto _tailrecursive;
goto tmp2_done;
}
case 2: {
modelica_integer tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[2] = MMC_CAR(tmp3_1);
tmpMeta[3] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],4,2) == 0) goto tmp2_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 3));
tmp6 = mmc_unbox_integer(tmpMeta[4]);
_vlst = tmpMeta[1];
_n = tmp6;
_vlst2 = tmpMeta[3];
_res = listGet(_vlst, _n);
_inLst = _vlst2;
_inValue = _res;
_lastValue = _res;
goto _tailrecursive;
goto tmp2_done;
}
case 3: {
modelica_integer tmp7;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[2] = MMC_CAR(tmp3_1);
tmpMeta[3] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],3,1) == 0) goto tmp2_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
tmp7 = mmc_unbox_integer(tmpMeta[4]);
_vlst = tmpMeta[1];
_b = tmp7;
_vlst2 = tmpMeta[3];
_res = listGet(_vlst, (_b?((modelica_integer) 2):((modelica_integer) 1)));
_inLst = _vlst2;
_inValue = _res;
_lastValue = _res;
goto _tailrecursive;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_string omc_ValuesUtil_printValStr(threadData_t *threadData, modelica_metatype _v)
{
modelica_string _s = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_s = omc_ValuesUtil_valString(threadData, _v);
_return: OMC_LABEL_UNUSED
return _s;
}
DLLExport
void omc_ValuesUtil_printVal(threadData_t *threadData, modelica_metatype _v)
{
modelica_string _s = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_s = omc_ValuesUtil_valString(threadData, _v);
omc_Print_printBuf(threadData, _s);
_return: OMC_LABEL_UNUSED
return;
}
DLLExport
modelica_metatype omc_ValuesUtil_reverseMatrix(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_metatype _lst_1 = NULL;
modelica_metatype _lst_2 = NULL;
modelica_metatype _lst = NULL;
modelica_metatype _value = NULL;
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
_lst = tmpMeta[1];
_dims = tmpMeta[2];
_lst_1 = omc_List_map(threadData, _lst, boxvar_ValuesUtil_reverseMatrix);
_lst_2 = listReverse(_lst_1);
tmpMeta[1] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _lst_2, _dims);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
_value = tmp3_1;
tmpMeta[0] = _value;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 2) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_unparsePtolemySet2(threadData_t *threadData, modelica_metatype _inValue1, modelica_metatype _inValue2)
{
modelica_metatype tmpMeta[6] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;volatile modelica_metatype tmp3_2;
tmp3_1 = _inValue1;
tmp3_2 = _inValue2;
{
modelica_metatype _v1 = NULL;
modelica_metatype _v2 = NULL;
modelica_metatype _v1s = NULL;
modelica_metatype _v2s = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 3; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (!listEmpty(tmpMeta[0])) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
if (!listEmpty(tmpMeta[1])) goto tmp2_end;
tmp3 += 1;
goto tmp2_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (listEmpty(tmpMeta[0])) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmpMeta[0]);
tmpMeta[2] = MMC_CDR(tmpMeta[0]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
if (listEmpty(tmpMeta[3])) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
_v1 = tmpMeta[1];
_v1s = tmpMeta[2];
_v2 = tmpMeta[4];
_v2s = tmpMeta[5];
omc_ValuesUtil_valString2(threadData, _v1);
omc_Print_printBuf(threadData, _OMC_LIT0);
omc_ValuesUtil_valString2(threadData, _v2);
omc_Print_printBuf(threadData, _OMC_LIT1);
tmpMeta[0] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[1] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _v1s, tmpMeta[0]);
tmpMeta[2] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _v2s, tmpMeta[2]);
omc_ValuesUtil_unparsePtolemySet2(threadData, tmpMeta[1], tmpMeta[3]);
goto tmp2_done;
}
case 2: {
modelica_boolean tmp5;
_v1 = tmp3_1;
tmp5 = omc_Flags_isSet(threadData, _OMC_LIT5);
if (1 != tmp5) goto goto_1;
tmpMeta[0] = stringAppend(_OMC_LIT6,omc_ValuesUtil_printValStr(threadData, _v1));
tmpMeta[1] = stringAppend(tmpMeta[0],_OMC_LIT7);
tmpMeta[2] = stringAppend(tmpMeta[1],omc_ValuesUtil_printValStr(threadData, _v1));
omc_Debug_traceln(threadData, tmpMeta[2]);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 3) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
;
_return: OMC_LABEL_UNUSED
return;
}
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_unparsePtolemySet(threadData_t *threadData, modelica_metatype _v1, modelica_metatype _v2, modelica_string _varname)
{
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_cons(_OMC_LIT8, mmc_mk_cons(_varname, mmc_mk_cons(_OMC_LIT1, MMC_REFSTRUCTLIT(mmc_nil))));
omc_Print_printBuf(threadData, stringAppendList(tmpMeta[0]));
omc_ValuesUtil_unparsePtolemySet2(threadData, _v1, _v2);
_return: OMC_LABEL_UNUSED
return;
}
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_unparsePtolemyValues(threadData_t *threadData, modelica_metatype _inValue, modelica_metatype _inValueLst, modelica_metatype _inStringLst)
{
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;modelica_metatype tmp3_3;
tmp3_1 = _inValue;
tmp3_2 = _inValueLst;
tmp3_3 = _inStringLst;
{
modelica_string _v1 = NULL;
modelica_metatype _t = NULL;
modelica_metatype _s1 = NULL;
modelica_metatype _xs = NULL;
modelica_metatype _vs = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_2)) goto tmp2_end;
goto tmp2_done;
}
case 1: {
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[0] = MMC_CAR(tmp3_2);
tmpMeta[1] = MMC_CDR(tmp3_2);
if (listEmpty(tmp3_3)) goto tmp2_end;
tmpMeta[2] = MMC_CAR(tmp3_3);
tmpMeta[3] = MMC_CDR(tmp3_3);
_s1 = tmpMeta[0];
_xs = tmpMeta[1];
_v1 = tmpMeta[2];
_vs = tmpMeta[3];
_t = tmp3_1;
omc_ValuesUtil_unparsePtolemySet(threadData, _t, _s1, _v1);
_inValue = _t;
_inValueLst = _xs;
_inStringLst = _vs;
goto _tailrecursive;
;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
;
_return: OMC_LABEL_UNUSED
return;
}
DLLExport
modelica_integer omc_ValuesUtil_writePtolemyplotDataset(threadData_t *threadData, modelica_string _inString1, modelica_metatype _inValue2, modelica_metatype _inStringLst3, modelica_string _inString4)
{
modelica_integer _outInteger;
modelica_integer tmp1 = 0;
modelica_metatype tmpMeta[5] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_string tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;modelica_string tmp4_4;
tmp4_1 = _inString1;
tmp4_2 = _inValue2;
tmp4_3 = _inStringLst3;
tmp4_4 = _inString4;
{
modelica_string _str = NULL;
modelica_string _filename = NULL;
modelica_string _message = NULL;
modelica_metatype _t = NULL;
modelica_metatype _rest = NULL;
modelica_metatype _varnames = NULL;
modelica_integer _handle;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 1; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_3)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_3);
tmpMeta[1] = MMC_CDR(tmp4_3);
if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,5,2) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
if (listEmpty(tmpMeta[2])) goto tmp3_end;
tmpMeta[3] = MMC_CAR(tmpMeta[2]);
tmpMeta[4] = MMC_CDR(tmpMeta[2]);
_varnames = tmpMeta[1];
_t = tmpMeta[3];
_rest = tmpMeta[4];
_filename = tmp4_1;
_message = tmp4_4;
_handle = omc_Print_saveAndClearBuf(threadData);
omc_Print_printBuf(threadData, _OMC_LIT9);
omc_Print_printBuf(threadData, _message);
omc_Print_printBuf(threadData, _OMC_LIT1);
omc_ValuesUtil_unparsePtolemyValues(threadData, _t, _rest, _varnames);
_str = omc_Print_getString(threadData);
omc_Print_restoreBuf(threadData, _handle);
omc_System_writeFile(threadData, _filename, _str);
tmp1 = ((modelica_integer) 0);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outInteger = tmp1;
_return: OMC_LABEL_UNUSED
return _outInteger;
}
modelica_metatype boxptr_ValuesUtil_writePtolemyplotDataset(threadData_t *threadData, modelica_metatype _inString1, modelica_metatype _inValue2, modelica_metatype _inStringLst3, modelica_metatype _inString4)
{
modelica_integer _outInteger;
modelica_metatype out_outInteger;
_outInteger = omc_ValuesUtil_writePtolemyplotDataset(threadData, _inString1, _inValue2, _inStringLst3, _inString4);
out_outInteger = mmc_mk_icon(_outInteger);
return out_outInteger;
}
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_valListString(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inValueLst;
{
modelica_metatype _v = NULL;
modelica_metatype _vs = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 3; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
goto tmp2_done;
}
case 1: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[0] = MMC_CAR(tmp3_1);
tmpMeta[1] = MMC_CDR(tmp3_1);
if (!listEmpty(tmpMeta[1])) goto tmp2_end;
_v = tmpMeta[0];
omc_ValuesUtil_valString2(threadData, _v);
goto tmp2_done;
}
case 2: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[0] = MMC_CAR(tmp3_1);
tmpMeta[1] = MMC_CDR(tmp3_1);
_v = tmpMeta[0];
_vs = tmpMeta[1];
omc_ValuesUtil_valString2(threadData, _v);
omc_Print_printBuf(threadData, _OMC_LIT0);
_inValueLst = _vs;
goto _tailrecursive;
;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
;
_return: OMC_LABEL_UNUSED
return;
}
PROTECTED_FUNCTION_STATIC void omc_ValuesUtil_valRecordString(threadData_t *threadData, modelica_metatype _inValues, modelica_metatype _inIds)
{
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;volatile modelica_metatype tmp3_2;
tmp3_1 = _inValues;
tmp3_2 = _inIds;
{
modelica_string _id = NULL;
modelica_metatype _x = NULL;
modelica_metatype _xs = NULL;
modelica_metatype _ids = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmp3 += 2;
goto tmp2_done;
}
case 1: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[0] = MMC_CAR(tmp3_1);
tmpMeta[1] = MMC_CDR(tmp3_1);
if (listEmpty(tmpMeta[1])) goto tmp2_end;
tmpMeta[2] = MMC_CAR(tmpMeta[1]);
tmpMeta[3] = MMC_CDR(tmpMeta[1]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
_x = tmpMeta[0];
_xs = tmpMeta[1];
_id = tmpMeta[4];
_ids = tmpMeta[5];
tmp3 += 1;
omc_Print_printBuf(threadData, _OMC_LIT10);
omc_Print_printBuf(threadData, _id);
omc_Print_printBuf(threadData, _OMC_LIT11);
omc_ValuesUtil_valString2(threadData, _x);
omc_Print_printBuf(threadData, _OMC_LIT12);
omc_ValuesUtil_valRecordString(threadData, _xs, _ids);
goto tmp2_done;
}
case 2: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[0] = MMC_CAR(tmp3_1);
tmpMeta[1] = MMC_CDR(tmp3_1);
if (!listEmpty(tmpMeta[1])) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[2] = MMC_CAR(tmp3_2);
tmpMeta[3] = MMC_CDR(tmp3_2);
if (!listEmpty(tmpMeta[3])) goto tmp2_end;
_x = tmpMeta[0];
_id = tmpMeta[2];
omc_Print_printBuf(threadData, _OMC_LIT10);
omc_Print_printBuf(threadData, _id);
omc_Print_printBuf(threadData, _OMC_LIT11);
omc_ValuesUtil_valString2(threadData, _x);
omc_Print_printBuf(threadData, _OMC_LIT1);
goto tmp2_done;
}
case 3: {
_xs = tmp3_1;
_ids = tmp3_2;
tmpMeta[0] = stringAppend(_OMC_LIT13,stringDelimitList(_ids, _OMC_LIT14));
tmpMeta[1] = stringAppend(tmpMeta[0],_OMC_LIT15);
tmpMeta[2] = stringAppend(tmpMeta[1],stringDelimitList(omc_List_map(threadData, _xs, boxvar_ValuesUtil_valString), _OMC_LIT14));
tmpMeta[3] = stringAppend(tmpMeta[2],_OMC_LIT1);
fputs(MMC_STRINGDATA(tmpMeta[3]),stdout);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 4) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
;
_return: OMC_LABEL_UNUSED
return;
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_filterSimulationResults(threadData_t *threadData, modelica_boolean _filter, modelica_metatype _inValues, modelica_metatype _inIds, modelica_metatype _valacc, modelica_metatype _idacc, modelica_metatype *out_outIds)
{
modelica_metatype _outValues = NULL;
modelica_metatype _outIds = NULL;
modelica_metatype tmpMeta[7] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_boolean tmp4_1;modelica_metatype tmp4_2;modelica_metatype tmp4_3;
tmp4_1 = _filter;
tmp4_2 = _inValues;
tmp4_3 = _inIds;
{
modelica_metatype _v = NULL;
modelica_metatype _vrest = NULL;
modelica_string _id = NULL;
modelica_string _str = NULL;
modelica_metatype _idrest = NULL;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 5; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (!listEmpty(tmp4_2)) goto tmp3_end;
if (!listEmpty(tmp4_3)) goto tmp3_end;
tmpMeta[0+0] = listReverse(_valacc);
tmpMeta[0+1] = listReverse(_idacc);
goto tmp3_done;
}
case 1: {
if (1 != tmp4_1) goto tmp3_end;
if (listEmpty(tmp4_2)) goto tmp3_end;
tmpMeta[2] = MMC_CAR(tmp4_2);
tmpMeta[3] = MMC_CDR(tmp4_2);
if (listEmpty(tmp4_3)) goto tmp3_end;
tmpMeta[4] = MMC_CAR(tmp4_3);
tmpMeta[5] = MMC_CDR(tmp4_3);
if (8 != MMC_STRLEN(tmpMeta[4]) || strcmp(MMC_STRINGDATA(_OMC_LIT16), MMC_STRINGDATA(tmpMeta[4])) != 0) goto tmp3_end;
_v = tmpMeta[2];
_vrest = tmpMeta[3];
_id = tmpMeta[4];
_idrest = tmpMeta[5];
tmpMeta[2] = mmc_mk_cons(_v, _valacc);
tmpMeta[3] = mmc_mk_cons(_id, _idacc);
_inValues = _vrest;
_inIds = _idrest;
_valacc = tmpMeta[2];
_idacc = tmpMeta[3];
goto _tailrecursive;
goto tmp3_done;
}
case 2: {
if (1 != tmp4_1) goto tmp3_end;
if (listEmpty(tmp4_2)) goto tmp3_end;
tmpMeta[2] = MMC_CAR(tmp4_2);
tmpMeta[3] = MMC_CDR(tmp4_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],2,1) == 0) goto tmp3_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
if (listEmpty(tmp4_3)) goto tmp3_end;
tmpMeta[5] = MMC_CAR(tmp4_3);
tmpMeta[6] = MMC_CDR(tmp4_3);
if (10 != MMC_STRLEN(tmpMeta[5]) || strcmp(MMC_STRINGDATA(_OMC_LIT17), MMC_STRINGDATA(tmpMeta[5])) != 0) goto tmp3_end;
_str = tmpMeta[4];
_vrest = tmpMeta[3];
_id = tmpMeta[5];
_idrest = tmpMeta[6];
_str = omc_System_basename(threadData, _str);
tmpMeta[3] = mmc_mk_box2(5, &Values_Value_STRING__desc, _str);
tmpMeta[2] = mmc_mk_cons(tmpMeta[3], _valacc);
tmpMeta[4] = mmc_mk_cons(_id, _idacc);
_inValues = _vrest;
_inIds = _idrest;
_valacc = tmpMeta[2];
_idacc = tmpMeta[4];
goto _tailrecursive;
goto tmp3_done;
}
case 3: {
if (1 != tmp4_1) goto tmp3_end;
if (listEmpty(tmp4_2)) goto tmp3_end;
tmpMeta[2] = MMC_CAR(tmp4_2);
tmpMeta[3] = MMC_CDR(tmp4_2);
if (listEmpty(tmp4_3)) goto tmp3_end;
tmpMeta[4] = MMC_CAR(tmp4_3);
tmpMeta[5] = MMC_CDR(tmp4_3);
_vrest = tmpMeta[3];
_idrest = tmpMeta[5];
_inValues = _vrest;
_inIds = _idrest;
goto _tailrecursive;
goto tmp3_done;
}
case 4: {
if (0 != tmp4_1) goto tmp3_end;
tmpMeta[0+0] = _inValues;
tmpMeta[0+1] = _inIds;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outValues = tmpMeta[0+0];
_outIds = tmpMeta[0+1];
_return: OMC_LABEL_UNUSED
if (out_outIds) { *out_outIds = _outIds; }
return _outValues;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ValuesUtil_filterSimulationResults(threadData_t *threadData, modelica_metatype _filter, modelica_metatype _inValues, modelica_metatype _inIds, modelica_metatype _valacc, modelica_metatype _idacc, modelica_metatype *out_outIds)
{
modelica_integer tmp1;
modelica_metatype _outValues = NULL;
tmp1 = mmc_unbox_integer(_filter);
_outValues = omc_ValuesUtil_filterSimulationResults(threadData, tmp1, _inValues, _inIds, _valacc, _idacc, out_outIds);
return _outValues;
}
DLLExport
void omc_ValuesUtil_valString2(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype tmpMeta[6] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_string _s = NULL;
modelica_string _s_1 = NULL;
modelica_string _recordName = NULL;
modelica_string _tyStr = NULL;
modelica_string _scope = NULL;
modelica_string _name = NULL;
modelica_integer _n;
modelica_real _x;
modelica_metatype _xs = NULL;
modelica_metatype _vs = NULL;
modelica_metatype _r = NULL;
modelica_metatype _c = NULL;
modelica_metatype _p = NULL;
modelica_metatype _recordPath = NULL;
modelica_metatype _ids = NULL;
modelica_metatype _cr = NULL;
modelica_metatype _path = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 26; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp5 = mmc_unbox_integer(tmpMeta[0]);
_n = tmp5;
tmp3 += 24;
_s = intString(_n);
omc_Print_printBuf(threadData, _s);
goto tmp2_done;
}
case 1: {
modelica_real tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp6 = mmc_unbox_real(tmpMeta[0]);
_x = tmp6;
tmp3 += 23;
_s = realString(_x);
omc_Print_printBuf(threadData, _s);
goto tmp2_done;
}
case 2: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,2,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_s = tmpMeta[0];
tmp3 += 22;
_s = omc_System_escapedString(threadData, _s, 0);
tmpMeta[0] = mmc_mk_cons(_OMC_LIT18, mmc_mk_cons(_s, mmc_mk_cons(_OMC_LIT18, MMC_REFSTRUCTLIT(mmc_nil))));
_s_1 = stringAppendList(tmpMeta[0]);
omc_Print_printBuf(threadData, _s_1);
goto tmp2_done;
}
case 3: {
modelica_integer tmp7;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,3,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp7 = mmc_unbox_integer(tmpMeta[0]);
if (0 != tmp7) goto tmp2_end;
tmp3 += 21;
omc_Print_printBuf(threadData, _OMC_LIT19);
goto tmp2_done;
}
case 4: {
modelica_integer tmp8;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,3,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp8 = mmc_unbox_integer(tmpMeta[0]);
if (1 != tmp8) goto tmp2_end;
tmp3 += 20;
omc_Print_printBuf(threadData, _OMC_LIT20);
goto tmp2_done;
}
case 5: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,4,2) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_p = tmpMeta[0];
tmp3 += 15;
_s = omc_AbsynUtil_pathString(threadData, _p, _OMC_LIT21, 1, 0);
omc_Print_printBuf(threadData, _s);
goto tmp2_done;
}
case 6: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vs = tmpMeta[0];
tmp3 += 18;
omc_Print_printBuf(threadData, _OMC_LIT22);
omc_ValuesUtil_valListString(threadData, _vs);
omc_Print_printBuf(threadData, _OMC_LIT23);
goto tmp2_done;
}
case 7: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,8,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (!listEmpty(tmpMeta[0])) goto tmp2_end;
goto tmp2_done;
}
case 8: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,8,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vs = tmpMeta[0];
tmp3 += 16;
omc_Print_printBuf(threadData, _OMC_LIT24);
omc_ValuesUtil_valListString(threadData, _vs);
omc_Print_printBuf(threadData, _OMC_LIT25);
goto tmp2_done;
}
case 9: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,9,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (!listEmpty(tmpMeta[0])) goto tmp2_end;
goto tmp2_done;
}
case 10: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,9,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vs = tmpMeta[0];
tmp3 += 14;
omc_Print_printBuf(threadData, _OMC_LIT24);
omc_ValuesUtil_valListString(threadData, _vs);
omc_Print_printBuf(threadData, _OMC_LIT25);
goto tmp2_done;
}
case 11: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,10,4) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
if (16 != MMC_STRLEN(tmpMeta[1]) || strcmp(MMC_STRINGDATA(_OMC_LIT54), MMC_STRINGDATA(tmpMeta[1])) != 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
_xs = tmpMeta[2];
_ids = tmpMeta[3];
omc_Print_printBuf(threadData, _OMC_LIT26);
tmpMeta[0] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
_xs = omc_ValuesUtil_filterSimulationResults(threadData, omc_Flags_isSet(threadData, _OMC_LIT30), _xs, _ids, tmpMeta[0], tmpMeta[1] ,&_ids);
omc_ValuesUtil_valRecordString(threadData, _xs, _ids);
omc_Print_printBuf(threadData, _OMC_LIT31);
goto tmp2_done;
}
case 12: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,10,4) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
_recordPath = tmpMeta[0];
_xs = tmpMeta[1];
_ids = tmpMeta[2];
tmp3 += 12;
_recordName = omc_AbsynUtil_pathStringNoQual(threadData, _recordPath, _OMC_LIT21, 0, 0);
tmpMeta[0] = stringAppend(_OMC_LIT32,_recordName);
tmpMeta[1] = stringAppend(tmpMeta[0],_OMC_LIT1);
omc_Print_printBuf(threadData, tmpMeta[1]);
omc_ValuesUtil_valRecordString(threadData, _xs, _ids);
tmpMeta[0] = stringAppend(_OMC_LIT33,_recordName);
tmpMeta[1] = stringAppend(tmpMeta[0],_OMC_LIT34);
omc_Print_printBuf(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 13: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,11,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (optionNone(tmpMeta[0])) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 1));
_r = tmpMeta[1];
tmp3 += 11;
omc_Print_printBuf(threadData, _OMC_LIT35);
omc_ValuesUtil_valString2(threadData, _r);
omc_Print_printBuf(threadData, _OMC_LIT25);
goto tmp2_done;
}
case 14: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,11,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (!optionNone(tmpMeta[0])) goto tmp2_end;
tmp3 += 10;
omc_Print_printBuf(threadData, _OMC_LIT36);
goto tmp2_done;
}
case 15: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,14,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_r = tmpMeta[0];
tmp3 += 9;
omc_Print_printBuf(threadData, _OMC_LIT37);
omc_ValuesUtil_valString2(threadData, _r);
omc_Print_printBuf(threadData, _OMC_LIT25);
goto tmp2_done;
}
case 16: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,12,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_path = tmpMeta[1];
tmp3 += 1;
omc_Print_printBuf(threadData, omc_AbsynUtil_pathString(threadData, _path, _OMC_LIT21, 1, 0));
goto tmp2_done;
}
case 17: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,12,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_cr = tmpMeta[1];
omc_Print_printBuf(threadData, omc_AbsynUtil_printComponentRefStr(threadData, _cr));
goto tmp2_done;
}
case 18: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,12,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_c = tmpMeta[0];
tmp3 += 6;
omc_Print_printBuf(threadData, _OMC_LIT38);
omc_Print_printBuf(threadData, omc_Dump_printCodeStr(threadData, _c));
omc_Print_printBuf(threadData, _OMC_LIT25);
goto tmp2_done;
}
case 19: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vs = tmpMeta[0];
tmp3 += 5;
omc_Print_printBuf(threadData, _OMC_LIT22);
omc_ValuesUtil_valListString(threadData, _vs);
omc_Print_printBuf(threadData, _OMC_LIT23);
goto tmp2_done;
}
case 20: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,7,1) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vs = tmpMeta[0];
tmp3 += 4;
omc_Print_printBuf(threadData, _OMC_LIT39);
omc_ValuesUtil_valListString(threadData, _vs);
omc_Print_printBuf(threadData, _OMC_LIT25);
goto tmp2_done;
}
case 21: {
modelica_integer tmp9;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,4,2) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmp9 = mmc_unbox_integer(tmpMeta[1]);
_p = tmpMeta[0];
_n = tmp9;
tmp3 += 3;
tmpMeta[0] = stringAppend(intString(_n),_OMC_LIT40);
tmpMeta[1] = stringAppend(tmpMeta[0],omc_AbsynUtil_pathString(threadData, _p, _OMC_LIT21, 1, 0));
tmpMeta[2] = stringAppend(tmpMeta[1],_OMC_LIT41);
_s = tmpMeta[2];
omc_Print_printBuf(threadData, _s);
goto tmp2_done;
}
case 22: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,13,0) == 0) goto tmp2_end;
tmp3 += 2;
goto tmp2_done;
}
case 23: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,15,0) == 0) goto tmp2_end;
tmp3 += 1;
omc_Print_printBuf(threadData, _OMC_LIT42);
goto tmp2_done;
}
case 24: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,16,4) == 0) goto tmp2_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 5));
_scope = tmpMeta[0];
_name = tmpMeta[1];
_tyStr = tmpMeta[2];
tmpMeta[0] = stringAppend(_OMC_LIT43,_scope);
tmpMeta[1] = stringAppend(tmpMeta[0],_OMC_LIT44);
tmpMeta[2] = stringAppend(tmpMeta[1],_name);
tmpMeta[3] = stringAppend(tmpMeta[2],_OMC_LIT45);
tmpMeta[4] = stringAppend(tmpMeta[3],_tyStr);
tmpMeta[5] = stringAppend(tmpMeta[4],_OMC_LIT46);
omc_Print_printBuf(threadData, tmpMeta[5]);
goto tmp2_done;
}
case 25: {
omc_Error_addMessage(threadData, _OMC_LIT51, _OMC_LIT53);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 26) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
;
_return: OMC_LABEL_UNUSED
return;
}
DLLExport
modelica_string omc_ValuesUtil_valString(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_string _outString = NULL;
modelica_integer _handle;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_handle = omc_Print_saveAndClearBuf(threadData);
omc_ValuesUtil_valString2(threadData, _inValue);
_outString = omc_Print_getString(threadData);
omc_Print_restoreBuf(threadData, _handle);
_return: OMC_LABEL_UNUSED
return _outString;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeRealMatrix(threadData_t *threadData, modelica_metatype _inReals)
{
modelica_metatype _outArray = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outArray = omc_ValuesUtil_makeArray(threadData, omc_List_map(threadData, _inReals, boxvar_ValuesUtil_makeRealArray));
_return: OMC_LABEL_UNUSED
return _outArray;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeRealArray(threadData_t *threadData, modelica_metatype _inReals)
{
modelica_metatype _outArray = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outArray = omc_ValuesUtil_makeArray(threadData, omc_List_map(threadData, _inReals, boxvar_ValuesUtil_makeReal));
_return: OMC_LABEL_UNUSED
return _outArray;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeIntArray(threadData_t *threadData, modelica_metatype _inInts)
{
modelica_metatype _outArray = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outArray = omc_ValuesUtil_makeArray(threadData, omc_List_map(threadData, _inInts, boxvar_ValuesUtil_makeInteger));
_return: OMC_LABEL_UNUSED
return _outArray;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeStringArray(threadData_t *threadData, modelica_metatype _inReals)
{
modelica_metatype _outArray = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_outArray = omc_ValuesUtil_makeArray(threadData, omc_List_map(threadData, _inReals, boxvar_ValuesUtil_makeString));
_return: OMC_LABEL_UNUSED
return _outArray;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeArray(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;
tmp3_1 = _inValueLst;
{
modelica_integer _i1;
modelica_metatype _il = NULL;
modelica_metatype _vlst = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
_vlst = tmp3_1;
_il = tmpMeta[3];
_i1 = listLength(_vlst);
tmpMeta[1] = mmc_mk_cons(mmc_mk_integer(_i1), _il);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _vlst, tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 1: {
_vlst = tmp3_1;
_i1 = listLength(_vlst);
tmpMeta[1] = mmc_mk_cons(mmc_mk_integer(_i1), MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _vlst, tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 2) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeList(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(9, &Values_Value_LIST__desc, _inValueLst);
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeTuple(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(11, &Values_Value_TUPLE__desc, _inValueLst);
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeString(threadData_t *threadData, modelica_string _s)
{
modelica_metatype _v = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(5, &Values_Value_STRING__desc, _s);
_v = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _v;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeInteger(threadData_t *threadData, modelica_integer _i)
{
modelica_metatype _v = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_i));
_v = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _v;
}
modelica_metatype boxptr_ValuesUtil_makeInteger(threadData_t *threadData, modelica_metatype _i)
{
modelica_integer tmp1;
modelica_metatype _v = NULL;
tmp1 = mmc_unbox_integer(_i);
_v = omc_ValuesUtil_makeInteger(threadData, tmp1);
return _v;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeReal(threadData_t *threadData, modelica_real _r)
{
modelica_metatype _v = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_r));
_v = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _v;
}
modelica_metatype boxptr_ValuesUtil_makeReal(threadData_t *threadData, modelica_metatype _r)
{
modelica_real tmp1;
modelica_metatype _v = NULL;
tmp1 = mmc_unbox_real(_r);
_v = omc_ValuesUtil_makeReal(threadData, tmp1);
return _v;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeBoolean(threadData_t *threadData, modelica_boolean _b)
{
modelica_metatype _v = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box2(6, &Values_Value_BOOL__desc, mmc_mk_boolean(_b));
_v = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _v;
}
modelica_metatype boxptr_ValuesUtil_makeBoolean(threadData_t *threadData, modelica_metatype _b)
{
modelica_integer tmp1;
modelica_metatype _v = NULL;
tmp1 = mmc_unbox_integer(_b);
_v = omc_ValuesUtil_makeBoolean(threadData, tmp1);
return _v;
}
DLLExport
modelica_metatype omc_ValuesUtil_arrayScalar(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _inValue;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
if (listEmpty(tmpMeta[1])) MMC_THROW_INTERNAL();
tmpMeta[2] = MMC_CAR(tmpMeta[1]);
tmpMeta[3] = MMC_CDR(tmpMeta[1]);
if (!listEmpty(tmpMeta[3])) MMC_THROW_INTERNAL();
_outValue = tmpMeta[2];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_arrayValues(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_metatype _v_lst = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 1; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_v_lst = tmpMeta[1];
tmpMeta[0] = _v_lst;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
modelica_metatype omc_ValuesUtil_intlistToValue(threadData_t *threadData, modelica_metatype _inIntegerLst)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[6] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inIntegerLst;
{
modelica_metatype _res = NULL;
modelica_integer _i;
modelica_integer _len;
modelica_metatype _lst = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[0] = _OMC_LIT56;
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
modelica_integer tmp6;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
tmp5 = mmc_unbox_integer(tmpMeta[1]);
_i = tmp5;
_lst = tmpMeta[2];
tmpMeta[1] = omc_ValuesUtil_intlistToValue(threadData, _lst);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmpMeta[3])) goto goto_1;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
tmp6 = mmc_unbox_integer(tmpMeta[4]);
if (!listEmpty(tmpMeta[5])) goto goto_1;
_res = tmpMeta[2];
_len = tmp6;
_len = ((modelica_integer) 1) + _len;
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_i));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res);
tmpMeta[3] = mmc_mk_cons(mmc_mk_integer(_len), MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[4] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, tmpMeta[1], tmpMeta[3]);
tmpMeta[0] = tmpMeta[4];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_matrixStripFirstColumn(threadData_t *threadData, modelica_metatype _inValueLst, modelica_metatype *out_outValueLst)
{
modelica_metatype _outValue = NULL;
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[10] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_metatype _resl = NULL;
modelica_metatype _resl2 = NULL;
modelica_metatype _vrest = NULL;
modelica_metatype _rest = NULL;
modelica_metatype _v1 = NULL;
modelica_integer _i;
modelica_integer _dim;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
modelica_integer tmp6;
modelica_integer tmp7;
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[2] = MMC_CAR(tmp4_1);
tmpMeta[3] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],5,2) == 0) goto tmp3_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
if (listEmpty(tmpMeta[4])) goto tmp3_end;
tmpMeta[5] = MMC_CAR(tmpMeta[4]);
tmpMeta[6] = MMC_CDR(tmpMeta[4]);
tmpMeta[7] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 3));
if (listEmpty(tmpMeta[7])) goto tmp3_end;
tmpMeta[8] = MMC_CAR(tmpMeta[7]);
tmpMeta[9] = MMC_CDR(tmpMeta[7]);
tmp6 = mmc_unbox_integer(tmpMeta[8]);
if (!listEmpty(tmpMeta[9])) goto tmp3_end;
_v1 = tmpMeta[5];
_vrest = tmpMeta[6];
_dim = tmp6;
_rest = tmpMeta[3];
tmpMeta[3] = omc_ValuesUtil_matrixStripFirstColumn(threadData, _rest, &tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],5,2) == 0) goto goto_2;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 2));
tmpMeta[5] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 3));
if (listEmpty(tmpMeta[5])) goto goto_2;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
tmp7 = mmc_unbox_integer(tmpMeta[6]);
if (!listEmpty(tmpMeta[7])) goto goto_2;
_resl = tmpMeta[4];
_i = tmp7;
_resl2 = tmpMeta[2];
_i = ((modelica_integer) 1) + _i;
_dim = ((modelica_integer) -1) + _dim;
tmpMeta[2] = mmc_mk_cons(_v1, _resl);
tmpMeta[3] = mmc_mk_cons(mmc_mk_integer(_i), MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[4] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, tmpMeta[2], tmpMeta[3]);
tmpMeta[6] = mmc_mk_cons(mmc_mk_integer(_dim), MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[7] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _vrest, tmpMeta[6]);
tmpMeta[5] = mmc_mk_cons(tmpMeta[7], _resl2);
tmpMeta[0+0] = tmpMeta[4];
tmpMeta[0+1] = tmpMeta[5];
goto tmp3_done;
}
case 1: {
if (!listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[2] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0+0] = _OMC_LIT56;
tmpMeta[0+1] = tmpMeta[2];
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outValue = tmpMeta[0+0];
_outValueLst = tmpMeta[0+1];
_return: OMC_LABEL_UNUSED
if (out_outValueLst) { *out_outValueLst = _outValueLst; }
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_multMatrix(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[6] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_metatype _res1 = NULL;
modelica_metatype _res2 = NULL;
modelica_metatype _v1lst = NULL;
modelica_metatype _rest1 = NULL;
modelica_metatype _m2 = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],5,2) == 0) goto tmp2_end;
_v1lst = tmpMeta[3];
_rest1 = tmpMeta[2];
_m2 = tmp3_2;
_res1 = omc_ValuesUtil_multScalarProduct(threadData, _v1lst, _m2);
_res2 = omc_ValuesUtil_multMatrix(threadData, _rest1, _m2);
tmpMeta[1] = mmc_mk_cons(_res1, _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
modelica_metatype omc_ValuesUtil_crossProduct(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[19] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_integer _ix1;
modelica_integer _ix2;
modelica_integer _ix3;
modelica_integer _iy1;
modelica_integer _iy2;
modelica_integer _iy3;
modelica_integer _iz1;
modelica_integer _iz2;
modelica_integer _iz3;
modelica_real _x1;
modelica_real _x2;
modelica_real _x3;
modelica_real _y1;
modelica_real _y2;
modelica_real _y3;
modelica_real _z1;
modelica_real _z2;
modelica_real _z3;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 3; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_real tmp5;
modelica_real tmp6;
modelica_real tmp7;
modelica_real tmp8;
modelica_real tmp9;
modelica_real tmp10;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmpMeta[2])) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmpMeta[2]);
tmpMeta[5] = MMC_CDR(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp6 = mmc_unbox_real(tmpMeta[6]);
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[7] = MMC_CAR(tmpMeta[5]);
tmpMeta[8] = MMC_CDR(tmpMeta[5]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[7],1,1) == 0) goto tmp2_end;
tmpMeta[9] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[7]), 2));
tmp7 = mmc_unbox_real(tmpMeta[9]);
if (!listEmpty(tmpMeta[8])) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[10] = MMC_CAR(tmp3_2);
tmpMeta[11] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[10],1,1) == 0) goto tmp2_end;
tmpMeta[12] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[10]), 2));
tmp8 = mmc_unbox_real(tmpMeta[12]);
if (listEmpty(tmpMeta[11])) goto tmp2_end;
tmpMeta[13] = MMC_CAR(tmpMeta[11]);
tmpMeta[14] = MMC_CDR(tmpMeta[11]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[13],1,1) == 0) goto tmp2_end;
tmpMeta[15] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[13]), 2));
tmp9 = mmc_unbox_real(tmpMeta[15]);
if (listEmpty(tmpMeta[14])) goto tmp2_end;
tmpMeta[16] = MMC_CAR(tmpMeta[14]);
tmpMeta[17] = MMC_CDR(tmpMeta[14]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[16],1,1) == 0) goto tmp2_end;
tmpMeta[18] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[16]), 2));
tmp10 = mmc_unbox_real(tmpMeta[18]);
if (!listEmpty(tmpMeta[17])) goto tmp2_end;
_x1 = tmp5;
_x2 = tmp6;
_x3 = tmp7;
_y1 = tmp8;
_y2 = tmp9;
_y3 = tmp10;
_z1 = (_x2) * (_y3) - ((_x3) * (_y2));
_z2 = (_x3) * (_y1) - ((_x1) * (_y3));
_z3 = (_x1) * (_y2) - ((_x2) * (_y1));
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_z1));
tmpMeta[3] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_z2));
tmpMeta[4] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_z3));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], mmc_mk_cons(tmpMeta[3], mmc_mk_cons(tmpMeta[4], MMC_REFSTRUCTLIT(mmc_nil))));
tmpMeta[0] = omc_ValuesUtil_makeArray(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 1: {
modelica_integer tmp11;
modelica_integer tmp12;
modelica_integer tmp13;
modelica_integer tmp14;
modelica_integer tmp15;
modelica_integer tmp16;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp11 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmpMeta[2])) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmpMeta[2]);
tmpMeta[5] = MMC_CDR(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp12 = mmc_unbox_integer(tmpMeta[6]);
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[7] = MMC_CAR(tmpMeta[5]);
tmpMeta[8] = MMC_CDR(tmpMeta[5]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[7],0,1) == 0) goto tmp2_end;
tmpMeta[9] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[7]), 2));
tmp13 = mmc_unbox_integer(tmpMeta[9]);
if (!listEmpty(tmpMeta[8])) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[10] = MMC_CAR(tmp3_2);
tmpMeta[11] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[10],0,1) == 0) goto tmp2_end;
tmpMeta[12] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[10]), 2));
tmp14 = mmc_unbox_integer(tmpMeta[12]);
if (listEmpty(tmpMeta[11])) goto tmp2_end;
tmpMeta[13] = MMC_CAR(tmpMeta[11]);
tmpMeta[14] = MMC_CDR(tmpMeta[11]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[13],0,1) == 0) goto tmp2_end;
tmpMeta[15] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[13]), 2));
tmp15 = mmc_unbox_integer(tmpMeta[15]);
if (listEmpty(tmpMeta[14])) goto tmp2_end;
tmpMeta[16] = MMC_CAR(tmpMeta[14]);
tmpMeta[17] = MMC_CDR(tmpMeta[14]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[16],0,1) == 0) goto tmp2_end;
tmpMeta[18] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[16]), 2));
tmp16 = mmc_unbox_integer(tmpMeta[18]);
if (!listEmpty(tmpMeta[17])) goto tmp2_end;
_ix1 = tmp11;
_ix2 = tmp12;
_ix3 = tmp13;
_iy1 = tmp14;
_iy2 = tmp15;
_iy3 = tmp16;
_iz1 = (_ix2) * (_iy3) - ((_ix3) * (_iy2));
_iz2 = (_ix3) * (_iy1) - ((_ix1) * (_iy3));
_iz3 = (_ix1) * (_iy2) - ((_ix2) * (_iy1));
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_iz1));
tmpMeta[3] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_iz2));
tmpMeta[4] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_iz3));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], mmc_mk_cons(tmpMeta[3], mmc_mk_cons(tmpMeta[4], MMC_REFSTRUCTLIT(mmc_nil))));
tmpMeta[0] = omc_ValuesUtil_makeArray(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 2: {
omc_Error_addMessage(threadData, _OMC_LIT51, _OMC_LIT58);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_multScalarProduct(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[11] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;volatile modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_integer _i1;
modelica_integer _i2;
modelica_integer _res;
modelica_integer _v1;
modelica_integer _v2;
modelica_integer _dim;
modelica_metatype _v1lst = NULL;
modelica_metatype _v2lst = NULL;
modelica_metatype _vres = NULL;
modelica_metatype _rest = NULL;
modelica_metatype _vlst = NULL;
modelica_metatype _col = NULL;
modelica_metatype _mat_1 = NULL;
modelica_metatype _vals = NULL;
modelica_metatype _mat = NULL;
modelica_metatype _sres = NULL;
modelica_metatype _v = NULL;
modelica_metatype _dims = NULL;
modelica_real _r1;
modelica_real _r2;
modelica_real _rres;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 13; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_integer tmp5;
modelica_integer tmp6;
modelica_integer tmp7;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmpMeta[2])) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmpMeta[2]);
tmpMeta[5] = MMC_CDR(tmpMeta[2]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmp3_2);
tmpMeta[7] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[6],0,1) == 0) goto tmp2_end;
tmpMeta[8] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[6]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[8]);
if (listEmpty(tmpMeta[7])) goto tmp2_end;
tmpMeta[9] = MMC_CAR(tmpMeta[7]);
tmpMeta[10] = MMC_CDR(tmpMeta[7]);
_i1 = tmp5;
_v1lst = tmpMeta[2];
_i2 = tmp6;
_v2lst = tmpMeta[7];
tmp3 += 11;
_i1 = (_i1) * (_i2);
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _v1lst, _v2lst);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp7 = mmc_unbox_integer(tmpMeta[2]);
_i2 = tmp7;
_res = _i1 + _i2;
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_res));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp8;
modelica_integer tmp9;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp8 = mmc_unbox_integer(tmpMeta[3]);
if (!listEmpty(tmpMeta[2])) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp9 = mmc_unbox_integer(tmpMeta[6]);
if (!listEmpty(tmpMeta[5])) goto tmp2_end;
_v1 = tmp8;
_v2 = tmp9;
tmp3 += 10;
_res = (_v1) * (_v2);
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_res));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp10;
modelica_real tmp11;
modelica_real tmp12;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp10 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmpMeta[2])) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmpMeta[2]);
tmpMeta[5] = MMC_CDR(tmpMeta[2]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmp3_2);
tmpMeta[7] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[6],1,1) == 0) goto tmp2_end;
tmpMeta[8] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[6]), 2));
tmp11 = mmc_unbox_real(tmpMeta[8]);
if (listEmpty(tmpMeta[7])) goto tmp2_end;
tmpMeta[9] = MMC_CAR(tmpMeta[7]);
tmpMeta[10] = MMC_CDR(tmpMeta[7]);
_r1 = tmp10;
_v1lst = tmpMeta[2];
_r2 = tmp11;
_v2lst = tmpMeta[7];
tmp3 += 9;
_r1 = (_r1) * (_r2);
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _v1lst, _v2lst);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp12 = mmc_unbox_real(tmpMeta[2]);
_r2 = tmp12;
_rres = _r1 + _r2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rres));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
modelica_real tmp13;
modelica_real tmp14;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp13 = mmc_unbox_real(tmpMeta[3]);
if (!listEmpty(tmpMeta[2])) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp14 = mmc_unbox_real(tmpMeta[6]);
if (!listEmpty(tmpMeta[5])) goto tmp2_end;
_r1 = tmp13;
_r2 = tmp14;
tmp3 += 8;
_rres = (_r1) * (_r2);
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rres));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 4: {
modelica_integer tmp15;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
_v2lst = tmpMeta[3];
_rest = tmpMeta[2];
_vlst = tmp3_2;
tmp3 += 7;
_sres = omc_ValuesUtil_multScalarProduct(threadData, _v2lst, _vlst);
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _rest, _vlst);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmpMeta[3])) goto goto_1;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
tmp15 = mmc_unbox_integer(tmpMeta[4]);
_vres = tmpMeta[2];
_dim = tmp15;
_dims = tmpMeta[5];
_dim = ((modelica_integer) 1) + _dim;
tmpMeta[1] = mmc_mk_cons(_sres, _vres);
tmpMeta[2] = mmc_mk_cons(mmc_mk_integer(_dim), _dims);
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, tmpMeta[1], tmpMeta[2]);
tmpMeta[0] = tmpMeta[3];
goto tmp2_done;
}
case 5: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_2);
tmpMeta[2] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmp3 += 6;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = omc_ValuesUtil_makeArray(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 6: {
modelica_integer tmp16;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
_v2lst = tmpMeta[3];
_rest = tmpMeta[2];
_vlst = tmp3_2;
tmp3 += 5;
_sres = omc_ValuesUtil_multScalarProduct(threadData, _v2lst, _vlst);
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _rest, _vlst);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmpMeta[3])) goto goto_1;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
tmp16 = mmc_unbox_integer(tmpMeta[4]);
_vres = tmpMeta[2];
_dim = tmp16;
_dims = tmpMeta[5];
_dim = ((modelica_integer) 1) + _dim;
tmpMeta[1] = mmc_mk_cons(_sres, _vres);
tmpMeta[2] = mmc_mk_cons(mmc_mk_integer(_dim), _dims);
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, tmpMeta[1], tmpMeta[2]);
tmpMeta[0] = tmpMeta[3];
goto tmp2_done;
}
case 7: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_2);
tmpMeta[2] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmp3 += 4;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = omc_ValuesUtil_makeArray(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 8: {
modelica_integer tmp17;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[3] = MMC_CAR(tmp3_2);
tmpMeta[4] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],5,2) == 0) goto tmp2_end;
tmpMeta[5] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 2));
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
if (listEmpty(tmpMeta[7])) goto tmp2_end;
tmpMeta[8] = MMC_CAR(tmpMeta[7]);
tmpMeta[9] = MMC_CDR(tmpMeta[7]);
_vlst = tmp3_1;
_mat = tmp3_2;
tmp3 += 3;
tmpMeta[2] = omc_ValuesUtil_matrixStripFirstColumn(threadData, _mat, &tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],5,2) == 0) goto goto_1;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
_col = tmpMeta[3];
_mat_1 = tmpMeta[1];
_v = omc_ValuesUtil_multScalarProduct(threadData, _vlst, _col);
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _vlst, _mat_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmpMeta[3])) goto goto_1;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
tmp17 = mmc_unbox_integer(tmpMeta[4]);
_vals = tmpMeta[2];
_dim = tmp17;
_dims = tmpMeta[5];
tmpMeta[1] = mmc_mk_cons(_v, _vals);
tmpMeta[2] = mmc_mk_cons(mmc_mk_integer(_dim), _dims);
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, tmpMeta[1], tmpMeta[2]);
tmpMeta[0] = tmpMeta[3];
goto tmp2_done;
}
case 9: {
modelica_integer tmp18;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[3] = MMC_CAR(tmp3_2);
tmpMeta[4] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],5,2) == 0) goto tmp2_end;
tmpMeta[5] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 2));
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
if (!listEmpty(tmpMeta[7])) goto tmp2_end;
_vlst = tmp3_1;
_mat = tmp3_2;
tmp3 += 2;
tmpMeta[1] = omc_ValuesUtil_matrixStripFirstColumn(threadData, _mat, NULL);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
_col = tmpMeta[2];
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _vlst, _col);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp18 = mmc_unbox_integer(tmpMeta[2]);
_i1 = tmp18;
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_i1));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[0] = omc_ValuesUtil_makeArray(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 10: {
modelica_integer tmp19;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[3] = MMC_CAR(tmp3_2);
tmpMeta[4] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],5,2) == 0) goto tmp2_end;
tmpMeta[5] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 2));
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
if (listEmpty(tmpMeta[7])) goto tmp2_end;
tmpMeta[8] = MMC_CAR(tmpMeta[7]);
tmpMeta[9] = MMC_CDR(tmpMeta[7]);
_vlst = tmp3_1;
_mat = tmp3_2;
tmp3 += 1;
tmpMeta[2] = omc_ValuesUtil_matrixStripFirstColumn(threadData, _mat, &tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],5,2) == 0) goto goto_1;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
_col = tmpMeta[3];
_mat_1 = tmpMeta[1];
_v = omc_ValuesUtil_multScalarProduct(threadData, _vlst, _col);
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _vlst, _mat_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmpMeta[3])) goto goto_1;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
tmp19 = mmc_unbox_integer(tmpMeta[4]);
_vals = tmpMeta[2];
_dim = tmp19;
_dims = tmpMeta[5];
_dim = ((modelica_integer) 1) + _dim;
tmpMeta[1] = mmc_mk_cons(_v, _vals);
tmpMeta[2] = mmc_mk_cons(mmc_mk_integer(_dim), _dims);
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, tmpMeta[1], tmpMeta[2]);
tmpMeta[0] = tmpMeta[3];
goto tmp2_done;
}
case 11: {
modelica_real tmp20;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[3] = MMC_CAR(tmp3_2);
tmpMeta[4] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],5,2) == 0) goto tmp2_end;
tmpMeta[5] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 2));
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
if (!listEmpty(tmpMeta[7])) goto tmp2_end;
_vlst = tmp3_1;
_mat = tmp3_2;
tmpMeta[1] = omc_ValuesUtil_matrixStripFirstColumn(threadData, _mat, NULL);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
_col = tmpMeta[2];
tmpMeta[1] = omc_ValuesUtil_multScalarProduct(threadData, _vlst, _col);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp20 = mmc_unbox_real(tmpMeta[2]);
_r1 = tmp20;
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_r1));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[0] = omc_ValuesUtil_makeArray(threadData, tmpMeta[1]);
goto tmp2_done;
}
case 12: {
modelica_boolean tmp21;
tmp21 = omc_Flags_isSet(threadData, _OMC_LIT5);
if (1 != tmp21) goto goto_1;
omc_Debug_trace(threadData, _OMC_LIT59);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 13) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_powArrayeltScalar(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar5;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar4;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar5 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar5;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_powArrayeltScalar(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valuePow(threadData, _scalarValue, _v);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar4 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar4,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar5;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_powScalarArrayelt(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar7;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar6;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar7 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar7;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_powScalarArrayelt(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valuePow(threadData, _scalarValue, _v);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar6 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar6,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar7;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_divArrayeltScalar(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar9;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar8;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar9 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar9;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_divArrayeltScalar(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valueDivide(threadData, _v, _scalarValue);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar8 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar8,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar9;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_divScalarArrayelt(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar11;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar10;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar11 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar11;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_divScalarArrayelt(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valueDivide(threadData, _scalarValue, _v);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar10 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar10,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar11;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_subArrayeltScalar(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar13;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar12;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar13 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar13;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_subArrayeltScalar(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valueSubtract(threadData, _v, _scalarValue);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar12 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar12,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar13;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_subScalarArrayelt(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar15;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar14;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar15 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar15;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_subScalarArrayelt(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valueSubtract(threadData, _scalarValue, _v);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar14 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar14,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar15;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_addScalarArrayelt(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar17;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar16;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar17 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar17;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_addScalarArrayelt(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valueSum(threadData, _scalarValue, _v);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar16 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar16,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar17;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_multScalarArrayelt(threadData_t *threadData, modelica_metatype _scalarValue, modelica_metatype _arrayValues)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype __omcQ_24tmpVar19;
modelica_metatype* tmp1;
modelica_metatype __omcQ_24tmpVar18;
int tmp6;
modelica_metatype _v_loopVar = 0;
modelica_metatype _v;
_v_loopVar = _arrayValues;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar19 = tmpMeta[1];
tmp1 = &__omcQ_24tmpVar19;
while(1) {
tmp6 = 1;
if (!listEmpty(_v_loopVar)) {
_v = MMC_CAR(_v_loopVar);
_v_loopVar = MMC_CDR(_v_loopVar);
tmp6--;
}
if (tmp6 == 0) {
{
modelica_metatype tmp4_1;
tmp4_1 = _v;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmpMeta[3] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, omc_ValuesUtil_multScalarArrayelt(threadData, _scalarValue, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 2)))), (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_v), 3))));
tmpMeta[2] = tmpMeta[3];
goto tmp3_done;
}
case 1: {
tmpMeta[2] = omc_ValuesUtil_valueMultiply(threadData, _scalarValue, _v);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}__omcQ_24tmpVar18 = tmpMeta[2];
*tmp1 = mmc_mk_cons(__omcQ_24tmpVar18,0);
tmp1 = &MMC_CDR(*tmp1);
} else if (tmp6 == 1) {
break;
} else {
MMC_THROW_INTERNAL();
}
}
*tmp1 = mmc_mk_nil();
tmpMeta[0] = __omcQ_24tmpVar19;
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_sumArrayelt(threadData_t *threadData, modelica_metatype _values)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_result = omc_ValuesUtil_sumArray(threadData, listHead(_values));
{
modelica_metatype _v;
for (tmpMeta[0] = listRest(_values); !listEmpty(tmpMeta[0]); tmpMeta[0]=MMC_CDR(tmpMeta[0]))
{
_v = MMC_CAR(tmpMeta[0]);
_result = omc_ValuesUtil_valueSum(threadData, omc_ValuesUtil_sumArray(threadData, _v), _result);
}
}
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_sumArray(threadData_t *threadData, modelica_metatype _value)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _value;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[0] = omc_ValuesUtil_sumArrayelt(threadData, (MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value), 2))));
goto tmp2_done;
}
case 1: {
tmpMeta[0] = _value;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_valuePow(threadData_t *threadData, modelica_metatype _value1, modelica_metatype _value2)
{
modelica_metatype _result = NULL;
modelica_real tmp1;
modelica_real tmp2;
modelica_real tmp3;
modelica_real tmp4;
modelica_real tmp5;
modelica_real tmp6;
modelica_real tmp7;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmp1 = omc_ValuesUtil_valueReal(threadData, _value1);
tmp2 = omc_ValuesUtil_valueReal(threadData, _value2);
if(tmp1 < 0.0 && tmp2 != 0.0)
{
tmp4 = modf(tmp2, &tmp5);
if(tmp4 > 0.5)
{
tmp4 -= 1.0;
tmp5 += 1.0;
}
else if(tmp4 < -0.5)
{
tmp4 += 1.0;
tmp5 -= 1.0;
}
if(fabs(tmp4) < 1e-10)
tmp3 = pow(tmp1, tmp5);
else
{
tmp7 = modf(1.0/tmp2, &tmp6);
if(tmp7 > 0.5)
{
tmp7 -= 1.0;
tmp6 += 1.0;
}
else if(tmp7 < -0.5)
{
tmp7 += 1.0;
tmp6 -= 1.0;
}
if(fabs(tmp7) < 1e-10 && ((unsigned long)tmp6 & 1))
{
tmp3 = -pow(-tmp1, tmp4)*pow(tmp1, tmp5);
}
else
{
MMC_THROW_INTERNAL();
}
}
}
else
{
tmp3 = pow(tmp1, tmp2);
}
if(isnan(tmp3) || isinf(tmp3))
{
MMC_THROW_INTERNAL();
}tmpMeta[0] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(tmp3));
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueDivide(threadData_t *threadData, modelica_metatype _value1, modelica_metatype _value2)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _value2;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 3; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp5 = mmc_unbox_integer(tmpMeta[1]);
if (0 != tmp5) goto tmp2_end;
tmpMeta[1] = mmc_mk_cons(_OMC_LIT63, mmc_mk_cons(intString(mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value2), 2))))), MMC_REFSTRUCTLIT(mmc_nil)));
omc_Error_addMessage(threadData, _OMC_LIT62, tmpMeta[1]);
goto goto_1;
goto tmp2_done;
}
case 1: {
modelica_real tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp6 = mmc_unbox_real(tmpMeta[1]);
if (0.0 != tmp6) goto tmp2_end;
tmpMeta[1] = mmc_mk_cons(_OMC_LIT63, mmc_mk_cons(realString(mmc_unbox_real((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value2), 2))))), MMC_REFSTRUCTLIT(mmc_nil)));
omc_Error_addMessage(threadData, _OMC_LIT62, tmpMeta[1]);
goto goto_1;
goto tmp2_done;
}
case 2: {
modelica_real tmp7;
tmp7 = omc_ValuesUtil_valueReal(threadData, _value2);
if (tmp7 == 0) {goto goto_1;}
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real((omc_ValuesUtil_valueReal(threadData, _value1)) / tmp7));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueMultiply(threadData_t *threadData, modelica_metatype _value1, modelica_metatype _value2)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _value1;
tmp3_2 = _value2;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer((mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value1), 2))))) * (mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value2), 2)))))));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real((omc_ValuesUtil_valueReal(threadData, _value1)) * (omc_ValuesUtil_valueReal(threadData, _value2))));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueSubtract(threadData_t *threadData, modelica_metatype _value1, modelica_metatype _value2)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _value1;
tmp3_2 = _value2;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value1), 2)))) - (mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value2), 2)))))));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(omc_ValuesUtil_valueReal(threadData, _value1) - omc_ValuesUtil_valueReal(threadData, _value2)));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueSum(threadData_t *threadData, modelica_metatype _value1, modelica_metatype _value2)
{
modelica_metatype _result = NULL;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _value1;
tmp3_2 = _value2;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 3; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value1), 2)))) + mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value2), 2))))));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,2,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,2,1) == 0) goto tmp2_end;
tmpMeta[1] = stringAppend((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value1), 2))),(MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_value2), 2))));
tmpMeta[2] = mmc_mk_box2(5, &Values_Value_STRING__desc, tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 2: {
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(omc_ValuesUtil_valueReal(threadData, _value1) + omc_ValuesUtil_valueReal(threadData, _value2)));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_result = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _result;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueNeg(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_real _r_1;
modelica_real _r;
modelica_integer _i_1;
modelica_integer _i;
modelica_metatype _vlst_1 = NULL;
modelica_metatype _vlst = NULL;
modelica_metatype _dims = NULL;
int tmp3;
{
switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
case 4: {
modelica_real tmp4;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp4 = mmc_unbox_real(tmpMeta[1]);
_r = tmp4;
_r_1 = (-_r);
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_r_1));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp5 = mmc_unbox_integer(tmpMeta[1]);
_i = tmp5;
_i_1 = (-_i);
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_i_1));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 8: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
_vlst = tmpMeta[1];
_dims = tmpMeta[2];
_vlst_1 = omc_List_map(threadData, _vlst, boxvar_ValuesUtil_valueNeg);
tmpMeta[1] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _vlst_1, _dims);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_matrixValueReals(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outReals = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_metatype _vals = NULL;
modelica_metatype _reals = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vals = tmpMeta[1];
tmpMeta[0] = omc_List_map(threadData, _vals, boxvar_ValuesUtil_arrayValueReals);
goto tmp2_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vals = tmpMeta[1];
_reals = omc_ValuesUtil_valueReals(threadData, _vals);
tmpMeta[0] = omc_List_map(threadData, _reals, boxvar_List_create);
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 2) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outReals = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outReals;
}
DLLExport
modelica_metatype omc_ValuesUtil_arrayValueReals(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outReal = NULL;
modelica_metatype _vals = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _inValue;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_vals = tmpMeta[1];
_outReal = omc_ValuesUtil_valueReals(threadData, _vals);
_return: OMC_LABEL_UNUSED
return _outReal;
}
DLLExport
modelica_metatype omc_ValuesUtil_arrayValueInts(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outReal = NULL;
modelica_metatype _vals = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _inValue;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_vals = tmpMeta[1];
_outReal = omc_List_map(threadData, _vals, boxvar_ValuesUtil_valueInteger);
_return: OMC_LABEL_UNUSED
return _outReal;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueReals(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _outReal = NULL;
modelica_metatype tmpMeta[4] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_real _r;
modelica_metatype _rest = NULL;
modelica_metatype _res = NULL;
modelica_integer _i;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
tmp3 += 3;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_real tmp5;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_real(tmpMeta[3]);
_r = tmp5;
_rest = tmpMeta[2];
tmp3 += 1;
_res = omc_ValuesUtil_valueReals(threadData, _rest);
tmpMeta[1] = mmc_mk_cons(mmc_mk_real(_r), _res);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_integer tmp6;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[3]);
_i = tmp6;
_rest = tmpMeta[2];
_r = ((modelica_real)_i);
_res = omc_ValuesUtil_valueReals(threadData, _rest);
tmpMeta[1] = mmc_mk_cons(mmc_mk_real(_r), _res);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
_rest = tmpMeta[2];
tmpMeta[0] = omc_ValuesUtil_valueReals(threadData, _rest);
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 4) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outReal = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outReal;
}
DLLExport
modelica_boolean omc_ValuesUtil_valueBool(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outBool;
modelica_integer tmp1;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _inValue;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],3,1) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
tmp1 = mmc_unbox_integer(tmpMeta[1]);
_outBool = tmp1;
_return: OMC_LABEL_UNUSED
return _outBool;
}
modelica_metatype boxptr_ValuesUtil_valueBool(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outBool;
modelica_metatype out_outBool;
_outBool = omc_ValuesUtil_valueBool(threadData, _inValue);
out_outBool = mmc_mk_icon(_outBool);
return out_outBool;
}
DLLExport
modelica_real omc_ValuesUtil_valueReal(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_real _outReal;
modelica_real tmp1 = 0;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValue;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
tmp1 = mmc_unbox_real((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inValue), 2))));
goto tmp3_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
tmp1 = ((modelica_real)mmc_unbox_integer((MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(_inValue), 2)))));
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outReal = tmp1;
_return: OMC_LABEL_UNUSED
return _outReal;
}
modelica_metatype boxptr_ValuesUtil_valueReal(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_real _outReal;
modelica_metatype out_outReal;
_outReal = omc_ValuesUtil_valueReal(threadData, _inValue);
out_outReal = mmc_mk_rcon(_outReal);
return out_outReal;
}
static modelica_metatype closure0_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure1_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure2_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_valueExpArray(threadData_t *threadData, modelica_metatype _values, modelica_metatype _inDims, modelica_metatype _originalExp)
{
modelica_metatype _outExp = NULL;
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;volatile modelica_metatype tmp3_2;volatile modelica_metatype tmp3_3;
tmp3_1 = _values;
tmp3_2 = _inDims;
tmp3_3 = _originalExp;
{
modelica_metatype _v = NULL;
modelica_metatype _xs = NULL;
modelica_metatype _xs2 = NULL;
modelica_metatype _explist = NULL;
modelica_metatype _exps1 = NULL;
modelica_metatype _dims = NULL;
modelica_metatype _int_dims = NULL;
modelica_metatype _t = NULL;
modelica_metatype _vt = NULL;
modelica_integer _dim;
modelica_boolean _b;
modelica_metatype _mexpl = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 6; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[0] = _OMC_LIT65;
goto tmp2_done;
}
case 1: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
tmp3 += 4;
_dims = omc_List_map(threadData, _inDims, boxvar_Expression_intDimension);
tmpMeta[1] = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _OMC_LIT64, _dims);
tmpMeta[2] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[3] = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, tmpMeta[1], mmc_mk_boolean(0), tmpMeta[2]);
tmpMeta[0] = tmpMeta[3];
goto tmp2_done;
}
case 2: {
modelica_integer tmp5;
modelica_boolean tmp6;
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_2);
tmpMeta[2] = MMC_CDR(tmp3_2);
tmp5 = mmc_unbox_integer(tmpMeta[1]);
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[3] = MMC_CAR(tmp3_1);
tmpMeta[4] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],5,2) == 0) goto tmp2_end;
tmpMeta[5] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 2));
if (listEmpty(tmpMeta[5])) goto tmp2_end;
tmpMeta[6] = MMC_CAR(tmpMeta[5]);
tmpMeta[7] = MMC_CDR(tmpMeta[5]);
_dim = tmp5;
_int_dims = tmpMeta[2];
_v = tmpMeta[6];
_xs = tmpMeta[7];
_xs2 = tmpMeta[4];
tmp6 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmpMeta[1] = _v;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_7;
tmp6 = 1;
goto goto_7;
goto_7:;
MMC_CATCH_INTERNAL(mmc_jumper)
if (tmp6) {goto goto_1;}
tmpMeta[1] = mmc_mk_cons(_v, _xs);
tmpMeta[2] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, tmpMeta[1], (modelica_fnptr) mmc_mk_box2(0,closure0_ValuesUtil_valueExp,tmpMeta[2]));
tmpMeta[1] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _xs2, _int_dims);
tmpMeta[2] = omc_ValuesUtil_valueExp(threadData, tmpMeta[1], mmc_mk_none());
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[2],17,3) == 0) goto goto_1;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[2]), 4));
_t = tmpMeta[3];
_mexpl = tmpMeta[4];
tmpMeta[1] = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
_t = omc_Expression_arrayDimensionSetFirst(threadData, _t, tmpMeta[1]);
tmpMeta[1] = mmc_mk_cons(_explist, _mexpl);
tmpMeta[2] = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _t, mmc_mk_integer(_dim), tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 3: {
modelica_boolean tmp8;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
if (listEmpty(tmpMeta[3])) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmpMeta[3]);
tmpMeta[5] = MMC_CDR(tmpMeta[3]);
if (!listEmpty(tmpMeta[2])) goto tmp2_end;
_v = tmpMeta[4];
_xs = tmpMeta[5];
tmp8 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmpMeta[1] = _v;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto goto_9;
tmp8 = 1;
goto goto_9;
goto_9:;
MMC_CATCH_INTERNAL(mmc_jumper)
if (tmp8) {goto goto_1;}
tmpMeta[1] = mmc_mk_cons(_v, _xs);
_dim = listLength(tmpMeta[1]);
tmpMeta[1] = mmc_mk_cons(_v, _xs);
tmpMeta[2] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, tmpMeta[1], (modelica_fnptr) mmc_mk_box2(0,closure1_ValuesUtil_valueExp,tmpMeta[2]));
_vt = omc_Types_typeOfValue(threadData, _v);
_t = omc_Types_simplifyType(threadData, _vt);
tmpMeta[1] = mmc_mk_cons(_v, _xs);
_dim = listLength(tmpMeta[1]);
tmpMeta[1] = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
_t = omc_Expression_liftArrayR(threadData, _t, tmpMeta[1]);
_t = omc_Expression_liftArrayR(threadData, _t, _OMC_LIT66);
tmpMeta[1] = mmc_mk_cons(_explist, MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[2] = mmc_mk_box4(20, &DAE_Exp_MATRIX__desc, _t, mmc_mk_integer(_dim), tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 4: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (optionNone(tmp3_3)) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_3), 1));
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[3],16,3) == 0) goto tmp2_end;
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[3]), 4));
_v = tmpMeta[1];
_xs = tmpMeta[2];
_exps1 = tmpMeta[4];
{
modelica_metatype __omcQ_24tmpVar21;
modelica_metatype* tmp10;
modelica_metatype __omcQ_24tmpVar20;
int tmp11;
modelica_metatype _e2_loopVar = 0;
modelica_metatype _e2;
modelica_metatype _e1_loopVar = 0;
modelica_metatype _e1;
_e2_loopVar = _exps1;
_e1_loopVar = _values;
tmpMeta[2] = MMC_REFSTRUCTLIT(mmc_nil);
__omcQ_24tmpVar21 = tmpMeta[2];
tmp10 = &__omcQ_24tmpVar21;
while(1) {
tmp11 = 2;
if (!listEmpty(_e2_loopVar)) {
_e2 = MMC_CAR(_e2_loopVar);
_e2_loopVar = MMC_CDR(_e2_loopVar);
tmp11--;
}if (!listEmpty(_e1_loopVar)) {
_e1 = MMC_CAR(_e1_loopVar);
_e1_loopVar = MMC_CDR(_e1_loopVar);
tmp11--;
}
if (tmp11 == 0) {
__omcQ_24tmpVar20 = omc_ValuesUtil_valueExp(threadData, _e1, mmc_mk_some(_e2));
*tmp10 = mmc_mk_cons(__omcQ_24tmpVar20,0);
tmp10 = &MMC_CDR(*tmp10);
} else if (tmp11 == 2) {
break;
} else {
goto goto_1;
}
}
*tmp10 = mmc_mk_nil();
tmpMeta[1] = __omcQ_24tmpVar21;
}
_explist = tmpMeta[1];
_vt = omc_Types_typeOfValue(threadData, _v);
_t = omc_Types_simplifyType(threadData, _vt);
tmpMeta[1] = mmc_mk_cons(_v, _xs);
_dim = listLength(tmpMeta[1]);
tmpMeta[1] = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
_t = omc_Expression_liftArrayR(threadData, _t, tmpMeta[1]);
_b = omc_Types_isArray(threadData, _vt);
_b = (!_b);
tmpMeta[1] = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _t, mmc_mk_boolean(_b), _explist);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 5: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
_v = tmpMeta[1];
_xs = tmpMeta[2];
tmpMeta[1] = mmc_mk_cons(_v, _xs);
tmpMeta[2] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, tmpMeta[1], (modelica_fnptr) mmc_mk_box2(0,closure2_ValuesUtil_valueExp,tmpMeta[2]));
_vt = omc_Types_typeOfValue(threadData, _v);
_t = omc_Types_simplifyType(threadData, _vt);
tmpMeta[1] = mmc_mk_cons(_v, _xs);
_dim = listLength(tmpMeta[1]);
tmpMeta[1] = mmc_mk_box2(3, &DAE_Dimension_DIM__INTEGER__desc, mmc_mk_integer(_dim));
_t = omc_Expression_liftArrayR(threadData, _t, tmpMeta[1]);
_b = omc_Types_isArray(threadData, _vt);
_b = (!_b);
tmpMeta[1] = mmc_mk_box4(19, &DAE_Exp_ARRAY__desc, _t, mmc_mk_boolean(_b), _explist);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 6) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outExp = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outExp;
}
static modelica_metatype closure3_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure4_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure5_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure6_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure7_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure8_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}static modelica_metatype closure9_ValuesUtil_valueExp(threadData_t *thData, modelica_metatype closure, modelica_metatype inValue)
{
modelica_metatype originalExp = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(closure),1));
return boxptr_ValuesUtil_valueExp(thData, inValue, originalExp);
}
DLLExport
modelica_metatype omc_ValuesUtil_valueExp(threadData_t *threadData, modelica_metatype _inValue, modelica_metatype _originalExp)
{
modelica_metatype _outExp = NULL;
modelica_metatype tmpMeta[5] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_metatype _explist = NULL;
modelica_metatype _vt = NULL;
modelica_metatype _t = NULL;
modelica_metatype _e = NULL;
modelica_metatype _v = NULL;
modelica_metatype _vallist = NULL;
modelica_metatype _typelist = NULL;
modelica_metatype _int_dims = NULL;
modelica_integer _i;
modelica_real _r;
modelica_string _s = NULL;
modelica_string _scope = NULL;
modelica_string _name = NULL;
modelica_string _tyStr = NULL;
modelica_boolean _b;
modelica_metatype _expl = NULL;
modelica_metatype _tpl = NULL;
modelica_metatype _namelst = NULL;
modelica_metatype _varlst = NULL;
modelica_integer _ix;
modelica_metatype _path = NULL;
modelica_metatype _code = NULL;
modelica_metatype _valType = NULL;
modelica_metatype _ety = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 23; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp5 = mmc_unbox_integer(tmpMeta[1]);
_i = tmp5;
tmpMeta[1] = mmc_mk_box2(3, &DAE_Exp_ICONST__desc, mmc_mk_integer(_i));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_real tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp6 = mmc_unbox_real(tmpMeta[1]);
_r = tmp6;
tmpMeta[1] = mmc_mk_box2(4, &DAE_Exp_RCONST__desc, mmc_mk_real(_r));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,2,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_s = tmpMeta[1];
tmpMeta[1] = mmc_mk_box2(5, &DAE_Exp_SCONST__desc, _s);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
modelica_integer tmp7;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,3,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp7 = mmc_unbox_integer(tmpMeta[1]);
_b = tmp7;
tmpMeta[1] = mmc_mk_box2(6, &DAE_Exp_BCONST__desc, mmc_mk_boolean(_b));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 4: {
modelica_integer tmp8;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,4,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmp8 = mmc_unbox_integer(tmpMeta[2]);
_path = tmpMeta[1];
_i = tmp8;
tmpMeta[1] = mmc_mk_box3(8, &DAE_Exp_ENUM__LITERAL__desc, _path, mmc_mk_integer(_i));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 5: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
_vallist = tmpMeta[1];
_int_dims = tmpMeta[2];
tmpMeta[0] = omc_ValuesUtil_valueExpArray(threadData, _vallist, _int_dims, _originalExp);
goto tmp2_done;
}
case 6: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,8,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vallist = tmpMeta[1];
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure3_ValuesUtil_valueExp,tmpMeta[1]));
tmpMeta[1] = mmc_mk_box2(22, &DAE_Exp_TUPLE__desc, _explist);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 7: {
modelica_integer tmp9;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,10,4) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 5));
tmp9 = mmc_unbox_integer(tmpMeta[4]);
if (-1 != tmp9) goto tmp2_end;
_path = tmpMeta[1];
_vallist = tmpMeta[2];
_namelst = tmpMeta[3];
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_expl = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure4_ValuesUtil_valueExp,tmpMeta[1]));
_tpl = omc_List_map(threadData, _expl, boxvar_Expression_typeof);
_varlst = omc_List_threadMap(threadData, _namelst, _tpl, boxvar_Expression_makeVar);
tmpMeta[1] = mmc_mk_box2(6, &ClassInf_State_RECORD__desc, _path);
tmpMeta[2] = mmc_mk_box4(12, &DAE_Type_T__COMPLEX__desc, tmpMeta[1], _varlst, mmc_mk_none());
_t = tmpMeta[2];
tmpMeta[1] = mmc_mk_box5(17, &DAE_Exp_RECORD__desc, _path, _expl, _namelst, _t);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 8: {
modelica_integer tmp10;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,4,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmp10 = mmc_unbox_integer(tmpMeta[2]);
_path = tmpMeta[1];
_ix = tmp10;
tmpMeta[1] = mmc_mk_box3(8, &DAE_Exp_ENUM__LITERAL__desc, _path, mmc_mk_integer(_ix));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 9: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,8,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vallist = tmpMeta[1];
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure5_ValuesUtil_valueExp,tmpMeta[1]));
tmpMeta[1] = mmc_mk_box2(22, &DAE_Exp_TUPLE__desc, _explist);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 10: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,11,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (optionNone(tmpMeta[1])) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 1));
_v = tmpMeta[2];
_e = omc_ValuesUtil_valueExp(threadData, _v, mmc_mk_none());
_e = omc_Types_matchType(threadData, _e, omc_Types_typeOfValue(threadData, _v), _OMC_LIT67, 1, NULL);
tmpMeta[1] = mmc_mk_box2(34, &DAE_Exp_META__OPTION__desc, mmc_mk_some(_e));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 11: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,11,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (!optionNone(tmpMeta[1])) goto tmp2_end;
tmpMeta[0] = _OMC_LIT68;
goto tmp2_done;
}
case 12: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,9,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vallist = tmpMeta[1];
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure6_ValuesUtil_valueExp,tmpMeta[1]));
_typelist = omc_List_map(threadData, _vallist, boxvar_Types_typeOfValue);
_explist = omc_Types_matchTypeTuple(threadData, _explist, _typelist, omc_List_map(threadData, _typelist, boxvar_Types_boxIfUnboxedType), 1, NULL);
tmpMeta[1] = mmc_mk_box2(33, &DAE_Exp_META__TUPLE__desc, _explist);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 13: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
if (!listEmpty(tmpMeta[1])) goto tmp2_end;
tmpMeta[0] = _OMC_LIT69;
goto tmp2_done;
}
case 14: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,6,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vallist = tmpMeta[1];
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure7_ValuesUtil_valueExp,tmpMeta[1]));
_typelist = omc_List_map(threadData, _vallist, boxvar_Types_typeOfValue);
_vt = omc_Types_boxIfUnboxedType(threadData, omc_List_reduce(threadData, _typelist, boxvar_Types_superType));
_explist = omc_Types_matchTypes(threadData, _explist, _typelist, _vt, 1, NULL);
tmpMeta[1] = mmc_mk_box2(31, &DAE_Exp_LIST__desc, _explist);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 15: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,7,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_vallist = tmpMeta[1];
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure8_ValuesUtil_valueExp,tmpMeta[1]));
_typelist = omc_List_map(threadData, _vallist, boxvar_Types_typeOfValue);
_vt = omc_Types_boxIfUnboxedType(threadData, omc_List_reduce(threadData, _typelist, boxvar_Types_superType));
_explist = omc_Types_matchTypes(threadData, _explist, _typelist, _vt, 1, NULL);
tmpMeta[2] = mmc_mk_box2(31, &DAE_Exp_LIST__desc, _explist);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], MMC_REFSTRUCTLIT(mmc_nil));
tmpMeta[3] = mmc_mk_box2(25, &DAE_Type_T__METAARRAY__desc, _vt);
tmpMeta[0] = omc_Expression_makeBuiltinCall(threadData, _OMC_LIT70, tmpMeta[1], tmpMeta[3], 0);
goto tmp2_done;
}
case 16: {
modelica_integer tmp11;
modelica_boolean tmp12;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,10,4) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 5));
tmp11 = mmc_unbox_integer(tmpMeta[4]);
_path = tmpMeta[1];
_vallist = tmpMeta[2];
_namelst = tmpMeta[3];
_ix = tmp11;
tmp12 = (_ix >= ((modelica_integer) 0));
if (1 != tmp12) goto goto_1;
tmpMeta[1] = mmc_mk_box1(0, mmc_mk_none());
_explist = omc_List_map(threadData, _vallist, (modelica_fnptr) mmc_mk_box2(0,closure9_ValuesUtil_valueExp,tmpMeta[1]));
_typelist = omc_List_map(threadData, _vallist, boxvar_Types_typeOfValue);
_explist = omc_Types_matchTypeTuple(threadData, _explist, _typelist, omc_List_map(threadData, _typelist, boxvar_Types_boxIfUnboxedType), 1, NULL);
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[2] = mmc_mk_box6(35, &DAE_Exp_METARECORDCALL__desc, _path, _explist, _namelst, mmc_mk_integer(_ix), tmpMeta[1]);
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 17: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,15,0) == 0) goto tmp2_end;
tmpMeta[0] = _OMC_LIT76;
goto tmp2_done;
}
case 18: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,14,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_v = tmpMeta[1];
_e = omc_ValuesUtil_valueExp(threadData, _v, mmc_mk_none());
tmpMeta[1] = mmc_mk_box2(37, &DAE_Exp_BOX__desc, _e);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 19: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,12,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_code = tmpMeta[1];
tmpMeta[1] = mmc_mk_box3(28, &DAE_Exp_CODE__desc, _code, _OMC_LIT64);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 20: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,16,4) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 5));
_scope = tmpMeta[1];
_name = tmpMeta[2];
_valType = tmpMeta[3];
_tyStr = tmpMeta[4];
if(isSome(_originalExp))
{
tmpMeta[1] = _originalExp;
if (optionNone(tmpMeta[1])) goto goto_1;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 1));
_e = tmpMeta[2];
}
else
{
_ety = omc_Types_simplifyType(threadData, omc_Types_typeOfValue(threadData, _valType));
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[2] = mmc_mk_box4(4, &DAE_ComponentRef_CREF__IDENT__desc, _name, _ety, tmpMeta[1]);
tmpMeta[3] = mmc_mk_box5(29, &DAE_Exp_EMPTY__desc, _scope, tmpMeta[2], _ety, _tyStr);
_e = tmpMeta[3];
}
tmpMeta[0] = _e;
goto tmp2_done;
}
case 21: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,13,0) == 0) goto tmp2_end;
tmpMeta[0] = _OMC_LIT77;
goto tmp2_done;
}
case 22: {
_v = tmp3_1;
tmpMeta[1] = stringAppend(_OMC_LIT78,omc_ValuesUtil_valString(threadData, _v));
_s = tmpMeta[1];
tmpMeta[1] = mmc_mk_cons(_s, MMC_REFSTRUCTLIT(mmc_nil));
omc_Error_addMessage(threadData, _OMC_LIT51, tmpMeta[1]);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outExp = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outExp;
}
DLLExport
modelica_metatype omc_ValuesUtil_expValue(threadData_t *threadData, modelica_metatype _inExp)
{
modelica_metatype _outValue = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _inExp;
{
modelica_integer _i;
modelica_real _r;
modelica_boolean _b;
modelica_string _s = NULL;
int tmp3;
{
switch (MMC_SWITCH_CAST(valueConstructor(tmp3_1))) {
case 3: {
modelica_integer tmp4;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp4 = mmc_unbox_integer(tmpMeta[1]);
_i = tmp4;
tmpMeta[1] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_i));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 4: {
modelica_real tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp5 = mmc_unbox_real(tmpMeta[1]);
_r = tmp5;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_r));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 5: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,2,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_s = tmpMeta[1];
tmpMeta[1] = mmc_mk_box2(5, &Values_Value_STRING__desc, _s);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 6: {
modelica_integer tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,3,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp6 = mmc_unbox_integer(tmpMeta[1]);
_b = tmp6;
tmpMeta[1] = mmc_mk_box2(6, &Values_Value_BOOL__desc, mmc_mk_boolean(_b));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValue = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValue;
}
DLLExport
modelica_metatype omc_ValuesUtil_powElementwiseArrayelt(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_metatype _reslst = NULL;
modelica_metatype _res2 = NULL;
modelica_metatype _v1lst = NULL;
modelica_metatype _rest1 = NULL;
modelica_metatype _v2lst = NULL;
modelica_metatype _rest2 = NULL;
modelica_integer _i1;
modelica_integer _i2;
modelica_real _res;
modelica_real _r1;
modelica_real _r2;
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[5] = MMC_CAR(tmp3_2);
tmpMeta[6] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[5],5,2) == 0) goto tmp2_end;
tmpMeta[7] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[5]), 2));
_v1lst = tmpMeta[3];
_dims = tmpMeta[4];
_rest1 = tmpMeta[2];
_v2lst = tmpMeta[7];
_rest2 = tmpMeta[6];
_reslst = omc_ValuesUtil_powElementwiseArrayelt(threadData, _v1lst, _v2lst);
_res2 = omc_ValuesUtil_powElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _reslst, _dims);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
modelica_integer tmp6;
modelica_real tmp7;
modelica_real tmp8;
modelica_real tmp9;
modelica_real tmp10;
modelica_real tmp11;
modelica_real tmp12;
modelica_real tmp13;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[6]);
_i1 = tmp5;
_rest1 = tmpMeta[2];
_i2 = tmp6;
_rest2 = tmpMeta[5];
_r1 = ((modelica_real)_i1);
_r2 = ((modelica_real)_i2);
tmp7 = _r1;
tmp8 = _r2;
if(tmp7 < 0.0 && tmp8 != 0.0)
{
tmp10 = modf(tmp8, &tmp11);
if(tmp10 > 0.5)
{
tmp10 -= 1.0;
tmp11 += 1.0;
}
else if(tmp10 < -0.5)
{
tmp10 += 1.0;
tmp11 -= 1.0;
}
if(fabs(tmp10) < 1e-10)
tmp9 = pow(tmp7, tmp11);
else
{
tmp13 = modf(1.0/tmp8, &tmp12);
if(tmp13 > 0.5)
{
tmp13 -= 1.0;
tmp12 += 1.0;
}
else if(tmp13 < -0.5)
{
tmp13 += 1.0;
tmp12 -= 1.0;
}
if(fabs(tmp13) < 1e-10 && ((unsigned long)tmp12 & 1))
{
tmp9 = -pow(-tmp7, tmp10)*pow(tmp7, tmp11);
}
else
{
goto goto_1;
}
}
}
else
{
tmp9 = pow(tmp7, tmp8);
}
if(isnan(tmp9) || isinf(tmp9))
{
goto goto_1;
}
_res = tmp9;
_res2 = omc_ValuesUtil_powElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp14;
modelica_real tmp15;
modelica_real tmp16;
modelica_real tmp17;
modelica_real tmp18;
modelica_real tmp19;
modelica_real tmp20;
modelica_real tmp21;
modelica_real tmp22;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp14 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp15 = mmc_unbox_real(tmpMeta[6]);
_r1 = tmp14;
_rest1 = tmpMeta[2];
_r2 = tmp15;
_rest2 = tmpMeta[5];
tmp16 = _r1;
tmp17 = _r2;
if(tmp16 < 0.0 && tmp17 != 0.0)
{
tmp19 = modf(tmp17, &tmp20);
if(tmp19 > 0.5)
{
tmp19 -= 1.0;
tmp20 += 1.0;
}
else if(tmp19 < -0.5)
{
tmp19 += 1.0;
tmp20 -= 1.0;
}
if(fabs(tmp19) < 1e-10)
tmp18 = pow(tmp16, tmp20);
else
{
tmp22 = modf(1.0/tmp17, &tmp21);
if(tmp22 > 0.5)
{
tmp22 -= 1.0;
tmp21 += 1.0;
}
else if(tmp22 < -0.5)
{
tmp22 += 1.0;
tmp21 -= 1.0;
}
if(fabs(tmp22) < 1e-10 && ((unsigned long)tmp21 & 1))
{
tmp18 = -pow(-tmp16, tmp19)*pow(tmp16, tmp20);
}
else
{
goto goto_1;
}
}
}
else
{
tmp18 = pow(tmp16, tmp17);
}
if(isnan(tmp18) || isinf(tmp18))
{
goto goto_1;
}
_res = tmp18;
_res2 = omc_ValuesUtil_powElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
modelica_metatype omc_ValuesUtil_divElementwiseArrayelt(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_metatype _reslst = NULL;
modelica_metatype _res2 = NULL;
modelica_metatype _v1lst = NULL;
modelica_metatype _rest1 = NULL;
modelica_metatype _v2lst = NULL;
modelica_metatype _rest2 = NULL;
modelica_real _res;
modelica_real _r1;
modelica_real _r2;
modelica_integer _i1;
modelica_integer _i2;
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[5] = MMC_CAR(tmp3_2);
tmpMeta[6] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[5],5,2) == 0) goto tmp2_end;
tmpMeta[7] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[5]), 2));
_v1lst = tmpMeta[3];
_dims = tmpMeta[4];
_rest1 = tmpMeta[2];
_v2lst = tmpMeta[7];
_rest2 = tmpMeta[6];
_reslst = omc_ValuesUtil_divElementwiseArrayelt(threadData, _v1lst, _v2lst);
_res2 = omc_ValuesUtil_divElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _reslst, _dims);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
modelica_integer tmp6;
modelica_real tmp7;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[6]);
_i1 = tmp5;
_rest1 = tmpMeta[2];
_i2 = tmp6;
_rest2 = tmpMeta[5];
_r1 = ((modelica_real)_i1);
_r2 = ((modelica_real)_i2);
tmp7 = _r2;
if (tmp7 == 0) {goto goto_1;}
_res = (_r1) / tmp7;
_res2 = omc_ValuesUtil_divElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp8;
modelica_real tmp9;
modelica_real tmp10;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp8 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp9 = mmc_unbox_real(tmpMeta[6]);
_r1 = tmp8;
_rest1 = tmpMeta[2];
_r2 = tmp9;
_rest2 = tmpMeta[5];
tmp10 = _r2;
if (tmp10 == 0) {goto goto_1;}
_res = (_r1) / tmp10;
_res2 = omc_ValuesUtil_divElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
modelica_metatype omc_ValuesUtil_mulElementwiseArrayelt(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_metatype _reslst = NULL;
modelica_metatype _res2 = NULL;
modelica_metatype _v1lst = NULL;
modelica_metatype _rest1 = NULL;
modelica_metatype _v2lst = NULL;
modelica_metatype _rest2 = NULL;
modelica_integer _res;
modelica_integer _v1;
modelica_integer _v2;
modelica_metatype _dims = NULL;
modelica_real _rres;
modelica_real _r1;
modelica_real _r2;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[5] = MMC_CAR(tmp3_2);
tmpMeta[6] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[5],5,2) == 0) goto tmp2_end;
tmpMeta[7] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[5]), 2));
_v1lst = tmpMeta[3];
_dims = tmpMeta[4];
_rest1 = tmpMeta[2];
_v2lst = tmpMeta[7];
_rest2 = tmpMeta[6];
_reslst = omc_ValuesUtil_mulElementwiseArrayelt(threadData, _v1lst, _v2lst);
_res2 = omc_ValuesUtil_mulElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _reslst, _dims);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
modelica_integer tmp6;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[6]);
_v1 = tmp5;
_rest1 = tmpMeta[2];
_v2 = tmp6;
_rest2 = tmpMeta[5];
_res = (_v1) * (_v2);
_res2 = omc_ValuesUtil_mulElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp7;
modelica_real tmp8;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp7 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp8 = mmc_unbox_real(tmpMeta[6]);
_r1 = tmp7;
_rest1 = tmpMeta[2];
_r2 = tmp8;
_rest2 = tmpMeta[5];
_rres = (_r1) * (_r2);
_res2 = omc_ValuesUtil_mulElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rres));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
modelica_metatype omc_ValuesUtil_subElementwiseArrayelt(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_metatype _reslst = NULL;
modelica_metatype _res2 = NULL;
modelica_metatype _v1lst = NULL;
modelica_metatype _rest1 = NULL;
modelica_metatype _v2lst = NULL;
modelica_metatype _rest2 = NULL;
modelica_integer _res;
modelica_integer _v1;
modelica_integer _v2;
modelica_metatype _dims = NULL;
modelica_real _r1;
modelica_real _r2;
modelica_real _rres;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[5] = MMC_CAR(tmp3_2);
tmpMeta[6] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[5],5,2) == 0) goto tmp2_end;
tmpMeta[7] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[5]), 2));
_v1lst = tmpMeta[3];
_dims = tmpMeta[4];
_rest1 = tmpMeta[2];
_v2lst = tmpMeta[7];
_rest2 = tmpMeta[6];
_reslst = omc_ValuesUtil_subElementwiseArrayelt(threadData, _v1lst, _v2lst);
_res2 = omc_ValuesUtil_subElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _reslst, _dims);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
modelica_integer tmp6;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[6]);
_v1 = tmp5;
_rest1 = tmpMeta[2];
_v2 = tmp6;
_rest2 = tmpMeta[5];
_res = _v1 - _v2;
_res2 = omc_ValuesUtil_subElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp7;
modelica_real tmp8;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp7 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp8 = mmc_unbox_real(tmpMeta[6]);
_r1 = tmp7;
_rest1 = tmpMeta[2];
_r2 = tmp8;
_rest2 = tmpMeta[5];
_rres = _r1 - _r2;
_res2 = omc_ValuesUtil_subElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rres));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
modelica_metatype omc_ValuesUtil_addElementwiseArrayelt(threadData_t *threadData, modelica_metatype _inValueLst1, modelica_metatype _inValueLst2)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[8] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;
tmp3_1 = _inValueLst1;
tmp3_2 = _inValueLst2;
{
modelica_metatype _reslst = NULL;
modelica_metatype _res2 = NULL;
modelica_metatype _v1lst = NULL;
modelica_metatype _rest1 = NULL;
modelica_metatype _v2lst = NULL;
modelica_metatype _rest2 = NULL;
modelica_integer _res;
modelica_integer _v1;
modelica_integer _v2;
modelica_real _r1;
modelica_real _r2;
modelica_real _rres;
modelica_string _s1 = NULL;
modelica_string _s2 = NULL;
modelica_string _sres = NULL;
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 5; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[5] = MMC_CAR(tmp3_2);
tmpMeta[6] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[5],5,2) == 0) goto tmp2_end;
tmpMeta[7] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[5]), 2));
_v1lst = tmpMeta[3];
_dims = tmpMeta[4];
_rest1 = tmpMeta[2];
_v2lst = tmpMeta[7];
_rest2 = tmpMeta[6];
_reslst = omc_ValuesUtil_addElementwiseArrayelt(threadData, _v1lst, _v2lst);
_res2 = omc_ValuesUtil_addElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _reslst, _dims);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
modelica_integer tmp6;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],0,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[6]);
_v1 = tmp5;
_rest1 = tmpMeta[2];
_v2 = tmp6;
_rest2 = tmpMeta[5];
_res = _v1 + _v2;
_res2 = omc_ValuesUtil_addElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_res));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp7;
modelica_real tmp8;
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp7 = mmc_unbox_real(tmpMeta[3]);
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],1,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
tmp8 = mmc_unbox_real(tmpMeta[6]);
_r1 = tmp7;
_rest1 = tmpMeta[2];
_r2 = tmp8;
_rest2 = tmpMeta[5];
_rres = _r1 + _r2;
_res2 = omc_ValuesUtil_addElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rres));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (listEmpty(tmp3_1)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_1);
tmpMeta[2] = MMC_CDR(tmp3_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],2,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
if (listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[4] = MMC_CAR(tmp3_2);
tmpMeta[5] = MMC_CDR(tmp3_2);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[4],2,1) == 0) goto tmp2_end;
tmpMeta[6] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[4]), 2));
_s1 = tmpMeta[3];
_rest1 = tmpMeta[2];
_s2 = tmpMeta[6];
_rest2 = tmpMeta[5];
tmpMeta[1] = stringAppend(_s1,_s2);
_sres = tmpMeta[1];
_res2 = omc_ValuesUtil_addElementwiseArrayelt(threadData, _rest1, _rest2);
tmpMeta[2] = mmc_mk_box2(5, &Values_Value_STRING__desc, _sres);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _res2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 4: {
if (!listEmpty(tmp3_1)) goto tmp2_end;
if (!listEmpty(tmp3_2)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
DLLExport
void omc_ValuesUtil_writeToFileAsArgs(threadData_t *threadData, modelica_metatype _vallst, modelica_string _filename)
{
modelica_string _str = NULL;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_str = omc_ValuesUtil_unparseValues(threadData, _vallst);
omc_System_writeFile(threadData, _filename, _str);
_return: OMC_LABEL_UNUSED
return;
}
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseDimSizes(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_string _outString = NULL;
modelica_string tmp1 = 0;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_integer _i1;
modelica_integer _len;
modelica_string _s1 = NULL;
modelica_string _s2 = NULL;
modelica_string _s3 = NULL;
modelica_metatype _lst = NULL;
modelica_metatype _vals = NULL;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp3_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_lst = tmp4_1;
_vals = tmpMeta[2];
_i1 = listLength(_lst);
_s1 = intString(_i1);
tmpMeta[0] = stringAppend(_s1,_OMC_LIT79);
_s2 = tmpMeta[0];
_s3 = omc_ValuesUtil_unparseDimSizes(threadData, _vals);
tmpMeta[0] = stringAppend(_s2,_s3);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 1: {
_lst = tmp4_1;
_len = listLength(_lst);
tmp1 = intString(_len);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
tmp3_done:
(void)tmp4;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp3_done2;
goto_2:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp4 < 2) {
goto tmp3_top;
}
MMC_THROW_INTERNAL();
tmp3_done2:;
}
}
_outString = tmp1;
_return: OMC_LABEL_UNUSED
return _outString;
}
PROTECTED_FUNCTION_STATIC modelica_integer omc_ValuesUtil_unparseNumDims(threadData_t *threadData, modelica_metatype _inValueLst, modelica_integer _inInteger)
{
modelica_integer _outInteger;
modelica_integer tmp1 = 0;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_metatype _vals = NULL;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_vals = tmpMeta[2];
_inValueLst = _vals;
_inInteger = ((modelica_integer) 1) + _inInteger;
goto _tailrecursive;
goto tmp3_done;
}
case 1: {
tmp1 = ((modelica_integer) 1) + _inInteger;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outInteger = tmp1;
_return: OMC_LABEL_UNUSED
return _outInteger;
}
PROTECTED_FUNCTION_STATIC modelica_metatype boxptr_ValuesUtil_unparseNumDims(threadData_t *threadData, modelica_metatype _inValueLst, modelica_metatype _inInteger)
{
modelica_integer tmp1;
modelica_integer _outInteger;
modelica_metatype out_outInteger;
tmp1 = mmc_unbox_integer(_inInteger);
_outInteger = omc_ValuesUtil_unparseNumDims(threadData, _inValueLst, tmp1);
out_outInteger = mmc_mk_icon(_outInteger);
return out_outInteger;
}
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparsePrimType(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_string _outString = NULL;
modelica_string tmp1 = 0;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_metatype _elts = NULL;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 7; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_elts = tmpMeta[2];
_inValueLst = _elts;
goto _tailrecursive;
goto tmp3_done;
}
case 1: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],0,1) == 0) goto tmp3_end;
tmp1 = _OMC_LIT80;
goto tmp3_done;
}
case 2: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],1,1) == 0) goto tmp3_end;
tmp1 = _OMC_LIT81;
goto tmp3_done;
}
case 3: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],2,1) == 0) goto tmp3_end;
tmp1 = _OMC_LIT82;
goto tmp3_done;
}
case 4: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],3,1) == 0) goto tmp3_end;
tmp1 = _OMC_LIT83;
goto tmp3_done;
}
case 5: {
if (!listEmpty(tmp4_1)) goto tmp3_end;
tmp1 = _OMC_LIT84;
goto tmp3_done;
}
case 6: {
tmp1 = _OMC_LIT85;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outString = tmp1;
_return: OMC_LABEL_UNUSED
return _outString;
}
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseArrayDescription(threadData_t *threadData, modelica_metatype _lst)
{
modelica_string _str = NULL;
modelica_string _pt = NULL;
modelica_string _s1 = NULL;
modelica_string _s2 = NULL;
modelica_string _s3 = NULL;
modelica_string _s4 = NULL;
modelica_string _s5 = NULL;
modelica_string _s6 = NULL;
modelica_integer _i1;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
_pt = omc_ValuesUtil_unparsePrimType(threadData, _lst);
tmpMeta[0] = stringAppend(_OMC_LIT86,_pt);
_s1 = tmpMeta[0];
tmpMeta[0] = stringAppend(_s1,_OMC_LIT87);
_s2 = tmpMeta[0];
_i1 = omc_ValuesUtil_unparseNumDims(threadData, _lst, ((modelica_integer) 0));
_s3 = intString(_i1);
tmpMeta[0] = stringAppend(_s2,_s3);
_s4 = tmpMeta[0];
tmpMeta[0] = stringAppend(_s4,_OMC_LIT79);
_s5 = tmpMeta[0];
_s6 = omc_ValuesUtil_unparseDimSizes(threadData, _lst);
tmpMeta[0] = stringAppend(_s5,_s6);
_str = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _str;
}
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseDescription(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_string _outString = NULL;
modelica_string tmp1 = 0;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_string _s1 = NULL;
modelica_string _slenstr = NULL;
modelica_string _sval = NULL;
modelica_string _s2 = NULL;
modelica_string _s4 = NULL;
modelica_metatype _xs = NULL;
modelica_metatype _vallst = NULL;
modelica_integer _slen;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 5; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],0,1) == 0) goto tmp3_end;
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseDescription(threadData, _xs);
tmpMeta[0] = stringAppend(_OMC_LIT88,_s1);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 1: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],1,1) == 0) goto tmp3_end;
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseDescription(threadData, _xs);
tmpMeta[0] = stringAppend(_OMC_LIT89,_s1);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 2: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],2,1) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_sval = tmpMeta[2];
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseDescription(threadData, _xs);
_slen = stringLength(_sval);
_slenstr = intString(_slen);
tmpMeta[0] = mmc_mk_cons(_OMC_LIT90, mmc_mk_cons(_slenstr, mmc_mk_cons(_OMC_LIT1, mmc_mk_cons(_s1, MMC_REFSTRUCTLIT(mmc_nil)))));
tmp1 = stringAppendList(tmpMeta[0]);
goto tmp3_done;
}
case 3: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_vallst = tmpMeta[2];
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseDescription(threadData, _xs);
_s2 = omc_ValuesUtil_unparseArrayDescription(threadData, _vallst);
tmpMeta[0] = stringAppend(_s2,_s1);
_s4 = tmpMeta[0];
tmpMeta[0] = stringAppend(_s4,_OMC_LIT91);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 4: {
if (!listEmpty(tmp4_1)) goto tmp3_end;
tmp1 = _OMC_LIT92;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outString = tmp1;
_return: OMC_LABEL_UNUSED
return _outString;
}
DLLExport
modelica_boolean omc_ValuesUtil_safeLessEq(threadData_t *threadData, modelica_metatype _val1, modelica_metatype _val2)
{
modelica_boolean _outv;
modelica_boolean tmp1 = 0;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;modelica_metatype tmp4_2;
tmp4_1 = _val1;
tmp4_2 = _val2;
{
modelica_real _r1;
modelica_real _r2;
modelica_integer _i1;
modelica_integer _i2;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 4; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
modelica_real tmp6;
modelica_real tmp7;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp6 = mmc_unbox_real(tmpMeta[0]);
if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
tmp7 = mmc_unbox_real(tmpMeta[1]);
_r1 = tmp6;
_r2 = tmp7;
tmp1 = (_r1 <= _r2);
goto tmp3_done;
}
case 1: {
modelica_real tmp8;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp8 = mmc_unbox_real(tmpMeta[0]);
_r1 = tmp8;
_r2 = ((modelica_real)omc_ValuesUtil_valueInteger(threadData, _val2));
tmp1 = (_r1 <= _r2);
goto tmp3_done;
}
case 2: {
modelica_real tmp9;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_2,1,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_2), 2));
tmp9 = mmc_unbox_real(tmpMeta[0]);
_r2 = tmp9;
_r1 = ((modelica_real)omc_ValuesUtil_valueInteger(threadData, _val1));
tmp1 = (_r1 <= _r2);
goto tmp3_done;
}
case 3: {
_i1 = omc_ValuesUtil_valueInteger(threadData, _val1);
_i2 = omc_ValuesUtil_valueInteger(threadData, _val2);
tmp1 = (_i1 <= _i2);
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outv = tmp1;
_return: OMC_LABEL_UNUSED
return _outv;
}
modelica_metatype boxptr_ValuesUtil_safeLessEq(threadData_t *threadData, modelica_metatype _val1, modelica_metatype _val2)
{
modelica_boolean _outv;
modelica_metatype out_outv;
_outv = omc_ValuesUtil_safeLessEq(threadData, _val1, _val2);
out_outv = mmc_mk_icon(_outv);
return out_outv;
}
DLLExport
modelica_metatype omc_ValuesUtil_safeIntRealOp(threadData_t *threadData, modelica_metatype _val1, modelica_metatype _val2, modelica_metatype _op)
{
modelica_metatype _outv = NULL;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;volatile modelica_metatype tmp3_2;volatile modelica_metatype tmp3_3;
tmp3_1 = _val1;
tmp3_2 = _val2;
tmp3_3 = _op;
{
modelica_real _rv1;
modelica_real _rv2;
modelica_real _rv3;
modelica_integer _iv1;
modelica_integer _iv2;
modelica_metatype _e = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 22; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
modelica_integer tmp5;
modelica_integer tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp5 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp6 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,0,0) == 0) goto tmp2_end;
_iv1 = tmp5;
_iv2 = tmp6;
tmp3 += 21;
_e = omc_ExpressionSimplify_safeIntOp(threadData, _iv1, _iv2, _OMC_LIT93);
tmpMeta[0] = omc_ValuesUtil_expValue(threadData, _e);
goto tmp2_done;
}
case 1: {
modelica_real tmp7;
modelica_integer tmp8;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp7 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp8 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,0,0) == 0) goto tmp2_end;
_rv1 = tmp7;
_iv2 = tmp8;
tmp3 += 20;
_rv2 = ((modelica_real)_iv2);
_rv3 = (_rv1) * (_rv2);
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_integer tmp9;
modelica_real tmp10;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp9 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp10 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,0,0) == 0) goto tmp2_end;
_iv1 = tmp9;
_rv2 = tmp10;
tmp3 += 19;
_rv1 = ((modelica_real)_iv1);
_rv3 = (_rv1) * (_rv2);
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
modelica_real tmp11;
modelica_real tmp12;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp11 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp12 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,0,0) == 0) goto tmp2_end;
_rv1 = tmp11;
_rv2 = tmp12;
tmp3 += 18;
_rv3 = (_rv1) * (_rv2);
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 4: {
modelica_integer tmp13;
modelica_integer tmp14;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp13 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp14 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,1,0) == 0) goto tmp2_end;
_iv1 = tmp13;
_iv2 = tmp14;
tmp3 += 17;
_e = omc_ExpressionSimplify_safeIntOp(threadData, _iv1, _iv2, _OMC_LIT94);
tmpMeta[0] = omc_ValuesUtil_expValue(threadData, _e);
goto tmp2_done;
}
case 5: {
modelica_real tmp15;
modelica_integer tmp16;
modelica_real tmp17;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp15 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp16 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,1,0) == 0) goto tmp2_end;
_rv1 = tmp15;
_iv2 = tmp16;
tmp3 += 16;
_rv2 = ((modelica_real)_iv2);
tmp17 = _rv2;
if (tmp17 == 0) {goto goto_1;}
_rv3 = (_rv1) / tmp17;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 6: {
modelica_integer tmp18;
modelica_real tmp19;
modelica_real tmp20;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp18 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp19 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,1,0) == 0) goto tmp2_end;
_iv1 = tmp18;
_rv2 = tmp19;
tmp3 += 15;
_rv1 = ((modelica_real)_iv1);
tmp20 = _rv2;
if (tmp20 == 0) {goto goto_1;}
_rv3 = (_rv1) / tmp20;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 7: {
modelica_real tmp21;
modelica_real tmp22;
modelica_real tmp23;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp21 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp22 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,1,0) == 0) goto tmp2_end;
_rv1 = tmp21;
_rv2 = tmp22;
tmp3 += 14;
tmp23 = _rv2;
if (tmp23 == 0) {goto goto_1;}
_rv3 = (_rv1) / tmp23;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 8: {
modelica_integer tmp24;
modelica_integer tmp25;
modelica_boolean tmp26;
modelica_real tmp27;
modelica_real tmp28;
modelica_real tmp29;
modelica_real tmp30;
modelica_real tmp31;
modelica_real tmp32;
modelica_real tmp33;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp24 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp25 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,4,0) == 0) goto tmp2_end;
_iv1 = tmp24;
_iv2 = tmp25;
tmp26 = (_iv2 < ((modelica_integer) 0));
if (1 != tmp26) goto goto_1;
_rv1 = ((modelica_real)_iv1);
_rv2 = ((modelica_real)_iv2);
tmp27 = _rv1;
tmp28 = _rv2;
if(tmp27 < 0.0 && tmp28 != 0.0)
{
tmp30 = modf(tmp28, &tmp31);
if(tmp30 > 0.5)
{
tmp30 -= 1.0;
tmp31 += 1.0;
}
else if(tmp30 < -0.5)
{
tmp30 += 1.0;
tmp31 -= 1.0;
}
if(fabs(tmp30) < 1e-10)
tmp29 = pow(tmp27, tmp31);
else
{
tmp33 = modf(1.0/tmp28, &tmp32);
if(tmp33 > 0.5)
{
tmp33 -= 1.0;
tmp32 += 1.0;
}
else if(tmp33 < -0.5)
{
tmp33 += 1.0;
tmp32 -= 1.0;
}
if(fabs(tmp33) < 1e-10 && ((unsigned long)tmp32 & 1))
{
tmp29 = -pow(-tmp27, tmp30)*pow(tmp27, tmp31);
}
else
{
goto goto_1;
}
}
}
else
{
tmp29 = pow(tmp27, tmp28);
}
if(isnan(tmp29) || isinf(tmp29))
{
goto goto_1;
}
_rv3 = tmp29;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 9: {
modelica_integer tmp34;
modelica_integer tmp35;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp34 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp35 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,4,0) == 0) goto tmp2_end;
_iv1 = tmp34;
_iv2 = tmp35;
tmp3 += 12;
_e = omc_ExpressionSimplify_safeIntOp(threadData, _iv1, _iv2, _OMC_LIT95);
tmpMeta[0] = omc_ValuesUtil_expValue(threadData, _e);
goto tmp2_done;
}
case 10: {
modelica_real tmp36;
modelica_integer tmp37;
modelica_real tmp38;
modelica_real tmp39;
modelica_real tmp40;
modelica_real tmp41;
modelica_real tmp42;
modelica_real tmp43;
modelica_real tmp44;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp36 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp37 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,4,0) == 0) goto tmp2_end;
_rv1 = tmp36;
_iv2 = tmp37;
tmp3 += 11;
_rv2 = ((modelica_real)_iv2);
tmp38 = _rv1;
tmp39 = _rv2;
if(tmp38 < 0.0 && tmp39 != 0.0)
{
tmp41 = modf(tmp39, &tmp42);
if(tmp41 > 0.5)
{
tmp41 -= 1.0;
tmp42 += 1.0;
}
else if(tmp41 < -0.5)
{
tmp41 += 1.0;
tmp42 -= 1.0;
}
if(fabs(tmp41) < 1e-10)
tmp40 = pow(tmp38, tmp42);
else
{
tmp44 = modf(1.0/tmp39, &tmp43);
if(tmp44 > 0.5)
{
tmp44 -= 1.0;
tmp43 += 1.0;
}
else if(tmp44 < -0.5)
{
tmp44 += 1.0;
tmp43 -= 1.0;
}
if(fabs(tmp44) < 1e-10 && ((unsigned long)tmp43 & 1))
{
tmp40 = -pow(-tmp38, tmp41)*pow(tmp38, tmp42);
}
else
{
goto goto_1;
}
}
}
else
{
tmp40 = pow(tmp38, tmp39);
}
if(isnan(tmp40) || isinf(tmp40))
{
goto goto_1;
}
_rv3 = tmp40;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 11: {
modelica_integer tmp45;
modelica_real tmp46;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp45 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp46 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,4,0) == 0) goto tmp2_end;
_iv1 = tmp45;
_rv2 = tmp46;
_iv2 = ((modelica_integer)floor(_rv2));
_e = omc_ExpressionSimplify_safeIntOp(threadData, _iv1, _iv2, _OMC_LIT95);
tmpMeta[0] = omc_ValuesUtil_expValue(threadData, _e);
goto tmp2_done;
}
case 12: {
modelica_integer tmp47;
modelica_real tmp48;
modelica_real tmp49;
modelica_real tmp50;
modelica_real tmp51;
modelica_real tmp52;
modelica_real tmp53;
modelica_real tmp54;
modelica_real tmp55;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp47 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp48 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,4,0) == 0) goto tmp2_end;
_iv1 = tmp47;
_rv2 = tmp48;
tmp3 += 9;
_rv1 = ((modelica_real)_iv1);
tmp49 = _rv1;
tmp50 = _rv2;
if(tmp49 < 0.0 && tmp50 != 0.0)
{
tmp52 = modf(tmp50, &tmp53);
if(tmp52 > 0.5)
{
tmp52 -= 1.0;
tmp53 += 1.0;
}
else if(tmp52 < -0.5)
{
tmp52 += 1.0;
tmp53 -= 1.0;
}
if(fabs(tmp52) < 1e-10)
tmp51 = pow(tmp49, tmp53);
else
{
tmp55 = modf(1.0/tmp50, &tmp54);
if(tmp55 > 0.5)
{
tmp55 -= 1.0;
tmp54 += 1.0;
}
else if(tmp55 < -0.5)
{
tmp55 += 1.0;
tmp54 -= 1.0;
}
if(fabs(tmp55) < 1e-10 && ((unsigned long)tmp54 & 1))
{
tmp51 = -pow(-tmp49, tmp52)*pow(tmp49, tmp53);
}
else
{
goto goto_1;
}
}
}
else
{
tmp51 = pow(tmp49, tmp50);
}
if(isnan(tmp51) || isinf(tmp51))
{
goto goto_1;
}
_rv3 = tmp51;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 13: {
modelica_real tmp56;
modelica_real tmp57;
modelica_real tmp58;
modelica_real tmp59;
modelica_real tmp60;
modelica_real tmp61;
modelica_real tmp62;
modelica_real tmp63;
modelica_real tmp64;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp56 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp57 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,4,0) == 0) goto tmp2_end;
_rv1 = tmp56;
_rv2 = tmp57;
tmp3 += 8;
tmp58 = _rv1;
tmp59 = _rv2;
if(tmp58 < 0.0 && tmp59 != 0.0)
{
tmp61 = modf(tmp59, &tmp62);
if(tmp61 > 0.5)
{
tmp61 -= 1.0;
tmp62 += 1.0;
}
else if(tmp61 < -0.5)
{
tmp61 += 1.0;
tmp62 -= 1.0;
}
if(fabs(tmp61) < 1e-10)
tmp60 = pow(tmp58, tmp62);
else
{
tmp64 = modf(1.0/tmp59, &tmp63);
if(tmp64 > 0.5)
{
tmp64 -= 1.0;
tmp63 += 1.0;
}
else if(tmp64 < -0.5)
{
tmp64 += 1.0;
tmp63 -= 1.0;
}
if(fabs(tmp64) < 1e-10 && ((unsigned long)tmp63 & 1))
{
tmp60 = -pow(-tmp58, tmp61)*pow(tmp58, tmp62);
}
else
{
goto goto_1;
}
}
}
else
{
tmp60 = pow(tmp58, tmp59);
}
if(isnan(tmp60) || isinf(tmp60))
{
goto goto_1;
}
_rv3 = tmp60;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 14: {
modelica_integer tmp65;
modelica_integer tmp66;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp65 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp66 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,2,0) == 0) goto tmp2_end;
_iv1 = tmp65;
_iv2 = tmp66;
tmp3 += 7;
_e = omc_ExpressionSimplify_safeIntOp(threadData, _iv1, _iv2, _OMC_LIT96);
tmpMeta[0] = omc_ValuesUtil_expValue(threadData, _e);
goto tmp2_done;
}
case 15: {
modelica_real tmp67;
modelica_integer tmp68;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp67 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp68 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,2,0) == 0) goto tmp2_end;
_rv1 = tmp67;
_iv2 = tmp68;
tmp3 += 6;
_rv2 = ((modelica_real)_iv2);
_rv3 = _rv1 + _rv2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 16: {
modelica_integer tmp69;
modelica_real tmp70;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp69 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp70 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,2,0) == 0) goto tmp2_end;
_iv1 = tmp69;
_rv2 = tmp70;
tmp3 += 5;
_rv1 = ((modelica_real)_iv1);
_rv3 = _rv1 + _rv2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 17: {
modelica_real tmp71;
modelica_real tmp72;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp71 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp72 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,2,0) == 0) goto tmp2_end;
_rv1 = tmp71;
_rv2 = tmp72;
tmp3 += 4;
_rv3 = _rv1 + _rv2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 18: {
modelica_integer tmp73;
modelica_integer tmp74;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp73 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp74 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,3,0) == 0) goto tmp2_end;
_iv1 = tmp73;
_iv2 = tmp74;
tmp3 += 3;
_e = omc_ExpressionSimplify_safeIntOp(threadData, _iv1, _iv2, _OMC_LIT97);
tmpMeta[0] = omc_ValuesUtil_expValue(threadData, _e);
goto tmp2_done;
}
case 19: {
modelica_real tmp75;
modelica_integer tmp76;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp75 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp76 = mmc_unbox_integer(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,3,0) == 0) goto tmp2_end;
_rv1 = tmp75;
_iv2 = tmp76;
tmp3 += 2;
_rv2 = ((modelica_real)_iv2);
_rv3 = _rv1 - _rv2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 20: {
modelica_integer tmp77;
modelica_real tmp78;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp77 = mmc_unbox_integer(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp78 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,3,0) == 0) goto tmp2_end;
_iv1 = tmp77;
_rv2 = tmp78;
tmp3 += 1;
_rv1 = ((modelica_real)_iv1);
_rv3 = _rv1 - _rv2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 21: {
modelica_real tmp79;
modelica_real tmp80;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmp79 = mmc_unbox_real(tmpMeta[1]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_2), 2));
tmp80 = mmc_unbox_real(tmpMeta[2]);
if (mmc__uniontype__metarecord__typedef__equal(tmp3_3,3,0) == 0) goto tmp2_end;
_rv1 = tmp79;
_rv2 = tmp80;
_rv3 = _rv1 - _rv2;
tmpMeta[1] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rv3));
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 22) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_outv = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outv;
}
PROTECTED_FUNCTION_STATIC modelica_string omc_ValuesUtil_unparseValueNumbers(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_string _outString = NULL;
modelica_string tmp1 = 0;
modelica_metatype tmpMeta[3] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_string _s1 = NULL;
modelica_string _s2 = NULL;
modelica_string _istr = NULL;
modelica_string _sval = NULL;
modelica_metatype _lst = NULL;
modelica_metatype _xs = NULL;
modelica_integer _i;
modelica_real _r;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 7; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],8,1) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_lst = tmpMeta[2];
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseValueNumbers(threadData, _lst);
_s2 = omc_ValuesUtil_unparseValueNumbers(threadData, _xs);
tmpMeta[0] = stringAppend(_s1,_s2);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 1: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],9,1) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_lst = tmpMeta[2];
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseValueNumbers(threadData, _lst);
_s2 = omc_ValuesUtil_unparseValueNumbers(threadData, _xs);
tmpMeta[0] = stringAppend(_s1,_s2);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 2: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_lst = tmpMeta[2];
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseValueNumbers(threadData, _lst);
_s2 = omc_ValuesUtil_unparseValueNumbers(threadData, _xs);
tmpMeta[0] = stringAppend(_s1,_s2);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 3: {
modelica_integer tmp6;
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],0,1) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
tmp6 = mmc_unbox_integer(tmpMeta[2]);
_i = tmp6;
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseValueNumbers(threadData, _xs);
_istr = intString(_i);
tmpMeta[0] = stringAppend(_istr,_OMC_LIT79);
_s2 = tmpMeta[0];
tmpMeta[0] = stringAppend(_s2,_s1);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 4: {
modelica_real tmp7;
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],1,1) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
tmp7 = mmc_unbox_real(tmpMeta[2]);
_r = tmp7;
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseValueNumbers(threadData, _xs);
_istr = realString(_r);
tmpMeta[0] = stringAppend(_istr,_OMC_LIT79);
_s2 = tmpMeta[0];
tmpMeta[0] = stringAppend(_s2,_s1);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 5: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],2,1) == 0) goto tmp3_end;
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_sval = tmpMeta[2];
_xs = tmpMeta[1];
_s1 = omc_ValuesUtil_unparseValueNumbers(threadData, _xs);
tmpMeta[0] = stringAppend(_sval,_OMC_LIT79);
_s2 = tmpMeta[0];
tmpMeta[0] = stringAppend(_s2,_s1);
tmp1 = tmpMeta[0];
goto tmp3_done;
}
case 6: {
if (!listEmpty(tmp4_1)) goto tmp3_end;
tmp1 = _OMC_LIT92;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outString = tmp1;
_return: OMC_LABEL_UNUSED
return _outString;
}
DLLExport
modelica_string omc_ValuesUtil_unparseValues(threadData_t *threadData, modelica_metatype _inValueLst)
{
modelica_string _outString = NULL;
modelica_string tmp1 = 0;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValueLst;
{
modelica_string _s1 = NULL;
modelica_string _s2 = NULL;
modelica_string _s3 = NULL;
modelica_metatype _v = NULL;
modelica_metatype _vallst = NULL;
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (listEmpty(tmp4_1)) goto tmp3_end;
tmpMeta[0] = MMC_CAR(tmp4_1);
tmpMeta[1] = MMC_CDR(tmp4_1);
_v = tmpMeta[0];
_vallst = tmpMeta[1];
tmpMeta[0] = mmc_mk_cons(_v, MMC_REFSTRUCTLIT(mmc_nil));
_s1 = omc_ValuesUtil_unparseDescription(threadData, tmpMeta[0]);
tmpMeta[0] = mmc_mk_cons(_v, MMC_REFSTRUCTLIT(mmc_nil));
_s2 = omc_ValuesUtil_unparseValueNumbers(threadData, tmpMeta[0]);
_s3 = omc_ValuesUtil_unparseValues(threadData, _vallst);
tmpMeta[0] = mmc_mk_cons(_s1, mmc_mk_cons(_s2, mmc_mk_cons(_OMC_LIT1, mmc_mk_cons(_s3, MMC_REFSTRUCTLIT(mmc_nil)))));
tmp1 = stringAppendList(tmpMeta[0]);
goto tmp3_done;
}
case 1: {
if (!listEmpty(tmp4_1)) goto tmp3_end;
tmp1 = _OMC_LIT92;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outString = tmp1;
_return: OMC_LABEL_UNUSED
return _outString;
}
DLLExport
modelica_metatype omc_ValuesUtil_nthArrayelt(threadData_t *threadData, modelica_metatype _inValue, modelica_integer _inInteger)
{
modelica_metatype _outValue = NULL;
modelica_metatype _vlst = NULL;
modelica_metatype tmpMeta[2] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = _inValue;
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[0],5,2) == 0) MMC_THROW_INTERNAL();
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[0]), 2));
_vlst = tmpMeta[1];
_outValue = listGet(_vlst, _inInteger);
_return: OMC_LABEL_UNUSED
return _outValue;
}
modelica_metatype boxptr_ValuesUtil_nthArrayelt(threadData_t *threadData, modelica_metatype _inValue, modelica_metatype _inInteger)
{
modelica_integer tmp1;
modelica_metatype _outValue = NULL;
tmp1 = mmc_unbox_integer(_inInteger);
_outValue = omc_ValuesUtil_nthArrayelt(threadData, _inValue, tmp1);
return _outValue;
}
DLLExport
modelica_boolean omc_ValuesUtil_isRecord(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outBoolean;
modelica_boolean tmp1 = 0;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValue;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,10,4) == 0) goto tmp3_end;
tmp1 = 1;
goto tmp3_done;
}
case 1: {
tmp1 = 0;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outBoolean = tmp1;
_return: OMC_LABEL_UNUSED
return _outBoolean;
}
modelica_metatype boxptr_ValuesUtil_isRecord(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outBoolean;
modelica_metatype out_outBoolean;
_outBoolean = omc_ValuesUtil_isRecord(threadData, _inValue);
out_outBoolean = mmc_mk_icon(_outBoolean);
return out_outBoolean;
}
DLLExport
modelica_boolean omc_ValuesUtil_isArray(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outBoolean;
modelica_boolean tmp1 = 0;
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValue;
{
volatile mmc_switch_type tmp4;
int tmp5;
tmp4 = 0;
for (; tmp4 < 2; tmp4++) {
switch (MMC_SWITCH_CAST(tmp4)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,5,2) == 0) goto tmp3_end;
tmp1 = 1;
goto tmp3_done;
}
case 1: {
tmp1 = 0;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_outBoolean = tmp1;
_return: OMC_LABEL_UNUSED
return _outBoolean;
}
modelica_metatype boxptr_ValuesUtil_isArray(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _outBoolean;
modelica_metatype out_outBoolean;
_outBoolean = omc_ValuesUtil_isArray(threadData, _inValue);
out_outBoolean = mmc_mk_icon(_outBoolean);
return out_outBoolean;
}
DLLExport
modelica_metatype omc_ValuesUtil_makeZero(threadData_t *threadData, modelica_metatype _ty)
{
modelica_metatype _zero = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;
tmp3_1 = _ty;
{
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 2; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmpMeta[0] = _OMC_LIT99;
goto tmp2_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmpMeta[0] = _OMC_LIT100;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_zero = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _zero;
}
DLLExport
modelica_boolean omc_ValuesUtil_isZero(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _isZero;
modelica_boolean tmp1 = 0;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp4_1;
tmp4_1 = _inValue;
{
modelica_real _rval;
modelica_integer _ival;
int tmp4;
{
switch (MMC_SWITCH_CAST(valueConstructor(tmp4_1))) {
case 4: {
modelica_real tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,1,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp5 = mmc_unbox_real(tmpMeta[0]);
_rval = tmp5;
tmp1 = (_rval == 0.0);
goto tmp3_done;
}
case 3: {
modelica_integer tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp4_1,0,1) == 0) goto tmp3_end;
tmpMeta[0] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp4_1), 2));
tmp6 = mmc_unbox_integer(tmpMeta[0]);
_ival = tmp6;
tmp1 = (_ival == ((modelica_integer) 0));
goto tmp3_done;
}
default:
tmp3_default: OMC_LABEL_UNUSED; {
tmp1 = 0;
goto tmp3_done;
}
}
goto tmp3_end;
tmp3_end: ;
}
goto goto_2;
goto_2:;
MMC_THROW_INTERNAL();
goto tmp3_done;
tmp3_done:;
}
}
_isZero = tmp1;
_return: OMC_LABEL_UNUSED
return _isZero;
}
modelica_metatype boxptr_ValuesUtil_isZero(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_boolean _isZero;
modelica_metatype out_isZero;
_isZero = omc_ValuesUtil_isZero(threadData, _inValue);
out_isZero = mmc_mk_icon(_isZero);
return out_isZero;
}
PROTECTED_FUNCTION_STATIC modelica_metatype omc_ValuesUtil_valueExpTypeExpVar(threadData_t *threadData, modelica_metatype _etp, modelica_string _name)
{
modelica_metatype _expVar = NULL;
modelica_metatype tmpMeta[1] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
tmpMeta[0] = mmc_mk_box7(3, &DAE_Var_TYPES__VAR__desc, _name, _OMC_LIT107, _etp, _OMC_LIT108, mmc_mk_boolean(0), mmc_mk_none());
_expVar = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _expVar;
}
DLLExport
modelica_metatype omc_ValuesUtil_valueExpType(threadData_t *threadData, modelica_metatype _inValue)
{
modelica_metatype _tp = NULL;
modelica_metatype tmpMeta[5] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
volatile modelica_metatype tmp3_1;
tmp3_1 = _inValue;
{
modelica_metatype _path = NULL;
modelica_metatype _nameLst = NULL;
modelica_metatype _eltTp = NULL;
modelica_metatype _valLst = NULL;
modelica_metatype _eltTps = NULL;
modelica_metatype _varLst = NULL;
modelica_metatype _int_dims = NULL;
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
MMC_TRY_INTERNAL(mmc_jumper)
tmp2_top:
threadData->mmc_jumper = &new_mmc_jumper;
for (; tmp3 < 8; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
tmp3 += 6;
tmpMeta[0] = _OMC_LIT109;
goto tmp2_done;
}
case 1: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
tmp3 += 5;
tmpMeta[0] = _OMC_LIT110;
goto tmp2_done;
}
case 2: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,3,1) == 0) goto tmp2_end;
tmp3 += 4;
tmpMeta[0] = _OMC_LIT111;
goto tmp2_done;
}
case 3: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,2,1) == 0) goto tmp2_end;
tmp3 += 3;
tmpMeta[0] = _OMC_LIT112;
goto tmp2_done;
}
case 4: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,4,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
_path = tmpMeta[1];
tmp3 += 2;
_path = omc_AbsynUtil_pathPrefix(threadData, _path);
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[2] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[3] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[4] = mmc_mk_box6(8, &DAE_Type_T__ENUMERATION__desc, mmc_mk_none(), _path, tmpMeta[1], tmpMeta[2], tmpMeta[3]);
tmpMeta[0] = tmpMeta[4];
goto tmp2_done;
}
case 5: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,5,2) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
_valLst = tmpMeta[1];
_int_dims = tmpMeta[2];
tmp3 += 1;
_eltTp = omc_ValuesUtil_valueExpType(threadData, listHead(_valLst));
_dims = omc_List_map(threadData, _int_dims, boxvar_Expression_intDimension);
tmpMeta[1] = mmc_mk_box3(9, &DAE_Type_T__ARRAY__desc, _eltTp, _dims);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 6: {
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,10,4) == 0) goto tmp2_end;
tmpMeta[1] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 2));
tmpMeta[2] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 3));
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmp3_1), 4));
_path = tmpMeta[1];
_valLst = tmpMeta[2];
_nameLst = tmpMeta[3];
_eltTps = omc_List_map(threadData, _valLst, boxvar_ValuesUtil_valueExpType);
_varLst = omc_List_threadMap(threadData, _eltTps, _nameLst, boxvar_ValuesUtil_valueExpTypeExpVar);
tmpMeta[1] = mmc_mk_box2(6, &ClassInf_State_RECORD__desc, _path);
tmpMeta[2] = mmc_mk_box4(12, &DAE_Type_T__COMPLEX__desc, tmpMeta[1], _varLst, mmc_mk_none());
tmpMeta[0] = tmpMeta[2];
goto tmp2_done;
}
case 7: {
tmpMeta[1] = stringAppend(_OMC_LIT113,omc_ValuesUtil_valString(threadData, _inValue));
tmpMeta[2] = stringAppend(tmpMeta[1],_OMC_LIT114);
fputs(MMC_STRINGDATA(tmpMeta[2]),stdout);
goto goto_1;
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
tmp2_done:
(void)tmp3;
MMC_RESTORE_INTERNAL(mmc_jumper);
goto tmp2_done2;
goto_1:;
MMC_CATCH_INTERNAL(mmc_jumper);
if (++tmp3 < 8) {
goto tmp2_top;
}
MMC_THROW_INTERNAL();
tmp2_done2:;
}
}
_tp = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _tp;
}
DLLExport
modelica_metatype omc_ValuesUtil_typeConvert(threadData_t *threadData, modelica_metatype _inType1, modelica_metatype _inType2, modelica_metatype _inValueLst3)
{
modelica_metatype _outValueLst = NULL;
modelica_metatype tmpMeta[5] __attribute__((unused)) = {0};
MMC_SO();
_tailrecursive: OMC_LABEL_UNUSED
{
modelica_metatype tmp3_1;modelica_metatype tmp3_2;modelica_metatype tmp3_3;
tmp3_1 = _inType1;
tmp3_2 = _inType2;
tmp3_3 = _inValueLst3;
{
modelica_metatype _vallst = NULL;
modelica_metatype _vrest = NULL;
modelica_metatype _vallst2 = NULL;
modelica_metatype _vals = NULL;
modelica_real _rval;
modelica_real _r;
modelica_metatype _from = NULL;
modelica_metatype _to = NULL;
modelica_integer _i;
modelica_integer _ival;
modelica_metatype _dims = NULL;
volatile mmc_switch_type tmp3;
int tmp4;
tmp3 = 0;
for (; tmp3 < 4; tmp3++) {
switch (MMC_SWITCH_CAST(tmp3)) {
case 0: {
if (!listEmpty(tmp3_3)) goto tmp2_end;
tmpMeta[1] = MMC_REFSTRUCTLIT(mmc_nil);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 1: {
modelica_integer tmp5;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,0,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,1,1) == 0) goto tmp2_end;
if (listEmpty(tmp3_3)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_3);
tmpMeta[2] = MMC_CDR(tmp3_3);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],0,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp5 = mmc_unbox_integer(tmpMeta[3]);
_from = tmp3_1;
_to = tmp3_2;
_i = tmp5;
_vrest = tmpMeta[2];
_vallst = omc_ValuesUtil_typeConvert(threadData, _from, _to, _vrest);
_rval = ((modelica_real)_i);
tmpMeta[2] = mmc_mk_box2(4, &Values_Value_REAL__desc, mmc_mk_real(_rval));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _vallst);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 2: {
modelica_real tmp6;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_1,1,1) == 0) goto tmp2_end;
if (mmc__uniontype__metarecord__typedef__equal(tmp3_2,0,1) == 0) goto tmp2_end;
if (listEmpty(tmp3_3)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_3);
tmpMeta[2] = MMC_CDR(tmp3_3);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],1,1) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmp6 = mmc_unbox_real(tmpMeta[3]);
_from = tmp3_1;
_to = tmp3_2;
_r = tmp6;
_vrest = tmpMeta[2];
_vallst = omc_ValuesUtil_typeConvert(threadData, _from, _to, _vrest);
_ival = ((modelica_integer)floor(_r));
tmpMeta[2] = mmc_mk_box2(3, &Values_Value_INTEGER__desc, mmc_mk_integer(_ival));
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _vallst);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
case 3: {
if (listEmpty(tmp3_3)) goto tmp2_end;
tmpMeta[1] = MMC_CAR(tmp3_3);
tmpMeta[2] = MMC_CDR(tmp3_3);
if (mmc__uniontype__metarecord__typedef__equal(tmpMeta[1],5,2) == 0) goto tmp2_end;
tmpMeta[3] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 2));
tmpMeta[4] = MMC_FETCH(MMC_OFFSET(MMC_UNTAGPTR(tmpMeta[1]), 3));
_vals = tmpMeta[3];
_dims = tmpMeta[4];
_vrest = tmpMeta[2];
_from = tmp3_1;
_to = tmp3_2;
_vallst = omc_ValuesUtil_typeConvert(threadData, _from, _to, _vals);
_vallst2 = omc_ValuesUtil_typeConvert(threadData, _from, _to, _vrest);
tmpMeta[2] = mmc_mk_box3(8, &Values_Value_ARRAY__desc, _vallst, _dims);
tmpMeta[1] = mmc_mk_cons(tmpMeta[2], _vallst2);
tmpMeta[0] = tmpMeta[1];
goto tmp2_done;
}
}
goto tmp2_end;
tmp2_end: ;
}
goto goto_1;
goto_1:;
MMC_THROW_INTERNAL();
goto tmp2_done;
tmp2_done:;
}
}
_outValueLst = tmpMeta[0];
_return: OMC_LABEL_UNUSED
return _outValueLst;
}
