OMCompiler/SimulationRuntime/c/meta/meta_modelica_builtin_boxptr.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file belongs to the OpenModelica Run-Time System | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), c/o Linköpings | ||
| 5 | * universitet, Department of Computer and Information Science, SE-58183 Linköping, Sweden. All rights | ||
| 6 | * reserved. | ||
| 7 | * | ||
| 8 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE | ||
| 9 | * AGPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. ANY | ||
| 10 | * USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S | ||
| 11 | * ACCEPTANCE OF THE BSD NEW LICENSE OR THE OSMC PUBLIC LICENSE OR THE AGPL | ||
| 12 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 13 | * | ||
| 14 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) Public License | ||
| 15 | * (OSMC-PL) are obtained from OSMC, either from the above address, from the URLs: | ||
| 16 | * http://www.openmodelica.org or https://github.com/OpenModelica/ or | ||
| 17 | * http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica distribution. GNU | ||
| 18 | * AGPL version 3 is obtained from: https://www.gnu.org/licenses/licenses.html#GPL. The BSD NEW | ||
| 19 | * License is obtained from: http://www.opensource.org/licenses/BSD-3-Clause. | ||
| 20 | * | ||
| 21 | * This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY | ||
| 23 | * SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF | ||
| 24 | * OSMC-PL. | ||
| 25 | * | ||
| 26 | */ | ||
| 27 | |||
| 28 | /* Creates an implementation only if #define GEN_META_MODELICA_BUILTIN_BOXPTR is given. | ||
| 29 | * Else, we only create a header. | ||
| 30 | */ | ||
| 31 | #include "../util/utility.h" | ||
| 32 | #include "meta_modelica.h" | ||
| 33 | #include "meta_modelica_string.h" | ||
| 34 | |||
| 35 | #if !defined(META_MODELICA_BUILTIN_BOXPTR__H) || defined(GEN_META_MODELICA_BUILTIN_BOXPTR) | ||
| 36 | #define META_MODELICA_BUILTIN_BOXPTR__H | ||
| 37 | |||
| 38 | #if defined(__cplusplus) | ||
| 39 | extern "C" { | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #ifdef GEN_META_MODELICA_BUILTIN_BOXPTR | ||
| 43 | #define boxptr_unOp(name,box,unbox,op) modelica_metatype name(threadData_t *threadData, void* a) {return (void*)box(op(unbox(a)));} | ||
| 44 | #define boxptr_unOpThreadData(name,box,unbox,op) modelica_metatype name(threadData_t *threadData, void* a) {return (void*)box(op(threadData,unbox(a)));} | ||
| 45 | #define boxptr_binOp(name,box,unbox,op) modelica_metatype name(threadData_t *threadData, void* a, void* b) {return (void*)box((unbox(a)) op (unbox(b)));} | ||
| 46 | #define boxptr_binFn(name,box,unbox,fn) modelica_metatype name(threadData_t *threadData, void* a, void* b) {return (void*)box(fn((unbox(a)),(unbox(b))));} | ||
| 47 | #define boxptr_fn2ArgsThreadData(name,box,unbox1,unbox2,fn) modelica_metatype name(threadData_t *threadData, void* a, void* b) {return (void*)box(fn(threadData,(unbox1(a)),(unbox2(b))));} | ||
| 48 | #define boxptr_wrapper2Args(boxptr,name) modelica_metatype boxptr(threadData_t *threadData, void* a, void* b) {return name(a,b);} | ||
| 49 | #define boxptr_wrapper1Arg(boxptr,name) modelica_metatype boxptr(threadData_t *threadData, void* a) {return name(a);} | ||
| 50 | #else | ||
| 51 | #define boxptr_unOp(name,box,unbox,op) modelica_metatype name(threadData_t *, void*); | ||
| 52 | #define boxptr_unOpThreadData(name,box,unbox,op) modelica_metatype name(threadData_t *, void*); | ||
| 53 | #define boxptr_binOp(name,box,unbox,op) modelica_metatype name(threadData_t *, void*,void*); | ||
| 54 | #define boxptr_binFn(name,box,unbox,op) modelica_metatype name(threadData_t *, void*,void*); | ||
| 55 | #define boxptr_fn2ArgsThreadData(name,box,unbox1,unbox2,fn) modelica_metatype name(threadData_t *, void*,void*); | ||
| 56 | #define boxptr_wrapper2Args(boxptr,name) modelica_metatype boxptr(threadData_t *, void*,void*); | ||
| 57 | #define boxptr_wrapper1Arg(boxptr,name) modelica_metatype boxptr(threadData_t *, void*); | ||
| 58 | #endif | ||
| 59 | |||
| 60 |
2/2✓ Branch 0 taken 969 times.
✓ Branch 1 taken 1801 times.
|
2770 | boxptr_unOp(boxptr_boolNot,mmc_mk_bcon,mmc_unbox_boolean,!) |
| 61 |
3/4✓ Branch 0 taken 11825 times.
✓ Branch 1 taken 22183 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11825 times.
|
34008 | boxptr_binOp(boxptr_boolAnd,mmc_mk_bcon,mmc_unbox_boolean,&&) |
| 62 |
4/4✓ Branch 0 taken 1180879 times.
✓ Branch 1 taken 7315 times.
✓ Branch 2 taken 1116985 times.
✓ Branch 3 taken 63894 times.
|
1188194 | boxptr_binOp(boxptr_boolOr,mmc_mk_bcon,mmc_unbox_boolean,||) |
| 63 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 2 times.
|
35 | boxptr_binOp(boxptr_boolEq,mmc_mk_bcon,mmc_unbox_boolean,==) |
| 64 | 32464 | boxptr_unOp(boxptr_boolString,(void*),mmc_unbox_integer,boolString) | |
| 65 | 2004420 | boxptr_binOp(boxptr_intAdd,mmc_mk_icon,mmc_unbox_integer,+) | |
| 66 | 79951 | boxptr_binOp(boxptr_intSub,mmc_mk_icon,mmc_unbox_integer,-) | |
| 67 | 112416 | boxptr_binOp(boxptr_intMul,mmc_mk_icon,mmc_unbox_integer,*) | |
| 68 | ✗ | boxptr_binOp(boxptr_intDiv,mmc_mk_icon,mmc_unbox_integer,/) | |
| 69 |
1/2✓ Branch 0 taken 108 times.
✗ Branch 1 not taken.
|
108 | boxptr_binFn(boxptr_intMod,mmc_mk_icon,mmc_unbox_integer,modelica_integer_mod) |
| 70 | 757429 | boxptr_unOp(boxptr_intAbs,mmc_mk_icon,mmc_unbox_integer,labs) | |
| 71 | 47824 | boxptr_unOp(boxptr_intNeg,mmc_mk_icon,mmc_unbox_integer,-) | |
| 72 | 4599334 | boxptr_binFn(boxptr_intMin,mmc_mk_icon,mmc_unbox_integer,modelica_integer_min) | |
| 73 | 480319 | boxptr_binFn(boxptr_intMax,mmc_mk_icon,mmc_unbox_integer,modelica_integer_max) | |
| 74 |
2/2✓ Branch 0 taken 9225635 times.
✓ Branch 1 taken 7073990 times.
|
16299625 | boxptr_binOp(boxptr_intLt,mmc_mk_bcon,mmc_unbox_integer,<) |
| 75 |
2/2✓ Branch 0 taken 11962 times.
✓ Branch 1 taken 7656 times.
|
19618 | boxptr_binOp(boxptr_intLe,mmc_mk_bcon,mmc_unbox_integer,<=) |
| 76 |
2/2✓ Branch 0 taken 12832490 times.
✓ Branch 1 taken 2425231 times.
|
15257721 | boxptr_binOp(boxptr_intEq,mmc_mk_bcon,mmc_unbox_integer,==) |
| 77 | ✗ | boxptr_binOp(boxptr_intNe,mmc_mk_bcon,mmc_unbox_integer,!=) | |
| 78 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 4 times.
|
65 | boxptr_binOp(boxptr_intGe,mmc_mk_bcon,mmc_unbox_integer,>=) |
| 79 |
2/2✓ Branch 0 taken 383308 times.
✓ Branch 1 taken 811068 times.
|
1194376 | boxptr_binOp(boxptr_intGt,mmc_mk_bcon,mmc_unbox_integer,>) |
| 80 | 51 | boxptr_unOp(boxptr_intReal,mmc_mk_rcon,mmc_unbox_integer,(modelica_real)) | |
| 81 | 71116 | boxptr_unOp(boxptr_intString,(void*),mmc_unbox_integer,intString) | |
| 82 | |||
| 83 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | boxptr_unOp(boxptr_isNone,mmc_mk_bcon,(void*),MMC_OPTIONNONE) |
| 84 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 348130 times.
✓ Branch 2 taken 344381 times.
✓ Branch 3 taken 3749 times.
|
348130 | boxptr_unOp(boxptr_isSome,mmc_mk_bcon,(void*),MMC_OPTIONSOME) |
| 85 | |||
| 86 | 2255 | boxptr_binOp(boxptr_realAdd,mmc_mk_rcon,mmc_unbox_real,+) | |
| 87 | ✗ | boxptr_binOp(boxptr_realSub,mmc_mk_rcon,mmc_unbox_real,-) | |
| 88 | ✗ | boxptr_binOp(boxptr_realMul,mmc_mk_rcon,mmc_unbox_real,*) | |
| 89 | ✗ | boxptr_binOp(boxptr_realDiv,mmc_mk_rcon,mmc_unbox_real,/) | |
| 90 | ✗ | boxptr_binFn(boxptr_realMod,mmc_mk_rcon,mmc_unbox_real,modelica_real_mod) | |
| 91 | ✗ | boxptr_binFn(boxptr_realPow,mmc_mk_rcon,mmc_unbox_real,pow) | |
| 92 |
2/2✓ Branch 0 taken 163 times.
✓ Branch 1 taken 41 times.
|
367 | boxptr_binFn(boxptr_realMin,mmc_mk_rcon,mmc_unbox_real,modelica_real_min) |
| 93 |
2/2✓ Branch 0 taken 277 times.
✓ Branch 1 taken 208 times.
|
762 | boxptr_binFn(boxptr_realMax,mmc_mk_rcon,mmc_unbox_real,modelica_real_max) |
| 94 | ✗ | boxptr_unOp(boxptr_realAbs,mmc_mk_rcon,mmc_unbox_real,fabs) | |
| 95 | ✗ | boxptr_unOp(boxptr_realNeg,mmc_mk_rcon,mmc_unbox_real,-) | |
| 96 |
2/2✓ Branch 0 taken 3889 times.
✓ Branch 1 taken 89 times.
|
3978 | boxptr_binOp(boxptr_realLt,mmc_mk_bcon,mmc_unbox_real,<) |
| 97 | ✗ | boxptr_binOp(boxptr_realLe,mmc_mk_bcon,mmc_unbox_real,<=) | |
| 98 |
2/2✓ Branch 0 taken 1081 times.
✓ Branch 1 taken 104 times.
|
1185 | boxptr_binOp(boxptr_realEq,mmc_mk_bcon,mmc_unbox_real,==) |
| 99 | ✗ | boxptr_binOp(boxptr_realNe,mmc_mk_bcon,mmc_unbox_real,!=) | |
| 100 | ✗ | boxptr_binOp(boxptr_realGe,mmc_mk_bcon,mmc_unbox_real,>=) | |
| 101 |
2/2✓ Branch 0 taken 4219 times.
✓ Branch 1 taken 162 times.
|
4381 | boxptr_binOp(boxptr_realGt,mmc_mk_bcon,mmc_unbox_real,>) |
| 102 | ✗ | boxptr_unOp(boxptr_realInt,mmc_mk_icon,mmc_unbox_real,(modelica_integer)) | |
| 103 | ✗ | boxptr_unOp(boxptr_realString,(void*),mmc_unbox_real,realString) | |
| 104 | |||
| 105 | ✗ | boxptr_binFn(boxptr_stringCompare,mmc_mk_icon,(void*),mmc_stringCompare) | |
| 106 | |||
| 107 |
2/2✓ Branch 1 taken 4572713 times.
✓ Branch 2 taken 1256945 times.
|
5829658 | boxptr_binFn(boxptr_valueEq,mmc_mk_bcon,(void*),valueEq) |
| 108 | |||
| 109 | 79538 | boxptr_unOp(boxptr_listLength,mmc_mk_icon,(void*),listLength) | |
| 110 | |||
| 111 | ✗ | boxptr_unOp(boxptr_stringLength,mmc_mk_icon,(void*),stringLength) | |
| 112 | 3670 | boxptr_unOpThreadData(boxptr_stringInt,mmc_mk_icon,(void*),nobox_stringInt) | |
| 113 | ✗ | boxptr_unOpThreadData(boxptr_stringReal,mmc_mk_rcon,(void*),nobox_stringReal) | |
| 114 | ✗ | boxptr_unOpThreadData(boxptr_stringCharInt,mmc_mk_icon,(void*),nobox_stringCharInt) | |
| 115 | ✗ | boxptr_unOpThreadData(boxptr_intStringChar,(void*),mmc_unbox_integer,nobox_intStringChar) | |
| 116 |
4/4✓ Branch 0 taken 1783511 times.
✓ Branch 1 taken 4606379 times.
✓ Branch 3 taken 1137129 times.
✓ Branch 4 taken 646382 times.
|
6389890 | boxptr_binFn(boxptr_stringEq,mmc_mk_bcon,(void*),stringEqual) |
| 117 |
4/4✓ Branch 0 taken 29398 times.
✓ Branch 1 taken 1295364 times.
✓ Branch 3 taken 28938 times.
✓ Branch 4 taken 460 times.
|
1324762 | boxptr_binFn(boxptr_stringEqual,mmc_mk_bcon,(void*),stringEqual) |
| 118 | ✗ | boxptr_unOp(boxptr_stringHash,mmc_mk_icon,(void*),stringHash) | |
| 119 | 1493464 | boxptr_unOp(boxptr_stringHashDjb2,mmc_mk_icon,(void*),stringHashDjb2) | |
| 120 | ✗ | boxptr_unOp(boxptr_stringHashSdbm,mmc_mk_icon,(void*),stringHashSdbm) | |
| 121 | 142 | boxptr_wrapper2Args(boxptr_stringDelimitList,stringDelimitList) | |
| 122 | ✗ | boxptr_fn2ArgsThreadData(boxptr_stringGet,mmc_mk_icon,(void*),mmc_unbox_integer,nobox_stringGet) | |
| 123 | 15660 | boxptr_wrapper2Args(boxptr_stringAppend,stringAppend) | |
| 124 | 178 | boxptr_wrapper1Arg(boxptr_listReverse,listReverse) | |
| 125 | ✗ | boxptr_wrapper1Arg(boxptr_listReverseInPlace,listReverseInPlace) | |
| 126 | 15477 | boxptr_wrapper2Args(boxptr_listAppend,listAppend) | |
| 127 | ✗ | boxptr_wrapper2Args(boxptr_listAppendDestroy,listAppendDestroy) | |
| 128 | ✗ | boxptr_binFn(boxptr_listMember,mmc_mk_bcon,(void*),listMember) | |
| 129 |
2/2✓ Branch 0 taken 17007 times.
✓ Branch 1 taken 460985 times.
|
477992 | boxptr_unOp(boxptr_listEmpty,mmc_mk_bcon,(void*),MMC_NILTEST) |
| 130 | 1039613 | boxptr_fn2ArgsThreadData(boxptr_arrayGet,(void*),(void*),mmc_unbox_integer,nobox_arrayGet) | |
| 131 | 1098 | boxptr_wrapper1Arg(boxptr_arrayList,arrayList) | |
| 132 | 3 | boxptr_wrapper1Arg(boxptr_listArray,listArray) | |
| 133 | 1095 | boxptr_wrapper1Arg(boxptr_arrayCopy,arrayCopy) | |
| 134 | ✗ | boxptr_wrapper2Args(boxptr_arrayAppend,arrayAppend) | |
| 135 | ✗ | boxptr_unOpThreadData(boxptr_getGlobalRoot,(void*),mmc_unbox_integer,nobox_getGlobalRoot) | |
| 136 | ✗ | boxptr_unOp(boxptr_valueConstructor,mmc_mk_icon,(void*),valueConstructor) | |
| 137 | ✗ | boxptr_wrapper2Args(boxptr_cons,mmc_mk_cons) | |
| 138 | |||
| 139 | #undef boxptr_unOp | ||
| 140 | #undef boxptr_unOpThreadData | ||
| 141 | #undef boxptr_binOp | ||
| 142 | #undef boxptr_binFn | ||
| 143 | #undef boxptr_wrapper1Arg | ||
| 144 | #undef boxptr_wrapper2Args | ||
| 145 | #undef boxptr_fn2ArgsThreadData | ||
| 146 | |||
| 147 | #if defined(__cplusplus) | ||
| 148 | } | ||
| 149 | #endif | ||
| 150 | |||
| 151 | #endif | ||
| 152 |