Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 21
Functions: 0.0% 0 / 0 / 4
Branches: 0.0% 0 / 0 / 2

OMCompiler/SimulationRuntime/c/util/omc_box.c
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
29 #include "omc_box.h"
30 #include "base_array.h"
31 #include <stdarg.h>
32
33 #if defined(__cplusplus)
34 extern "C" {
35 #endif
36
37 ✗ void* omc_box_new_n(int nfields, int ctor, ...)
38 {
39 void **box;
40 va_list ap;
41 int i;
42
43 ✗ box = (void**) omc_rc_alloc((nfields + 1) * sizeof(void*));
44 ✗ box[0] = (void*) (intptr_t) ctor;
45 ✗ va_start(ap, ctor);
46 ✗ for (i = 1; i <= nfields; i++) {
47 ✗ box[i] = va_arg(ap, void*);
48 }
49 ✗ va_end(ap);
50 ✗ return box;
51 }
52
53 ✗ void* omc_mk_rcon(modelica_real r)
54 {
55 ✗ modelica_real *p = (modelica_real*) omc_rc_alloc(sizeof(modelica_real));
56 ✗ *p = r;
57 ✗ return p;
58 }
59
60 ✗ void* omc_mk_icon(modelica_integer i)
61 {
62 ✗ modelica_integer *p = (modelica_integer*) omc_rc_alloc(sizeof(modelica_integer));
63 ✗ *p = i;
64 ✗ return p;
65 }
66
67 ✗ void* omc_box_array(void *arr)
68 {
69 ✗ base_array_t *p = (base_array_t*) omc_rc_alloc(sizeof(base_array_t));
70 ✗ *p = *(base_array_t*) arr;
71 ✗ omc_array_retain(p);
72 ✗ return p;
73 }
74
75 #if defined(__cplusplus)
76 } /* end extern "C" */
77 #endif
78