-
Notifications
You must be signed in to change notification settings - Fork 298
/
openmodelica_types.h
155 lines (130 loc) · 4.78 KB
/
openmodelica_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE BSD NEW LICENSE OR THE
* GPL VERSION 3 LICENSE OR THE OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the OSMC (Open Source Modelica Consortium)
* Public License (OSMC-PL) are obtained from OSMC, either from the above
* address, from the URLs: http://www.openmodelica.org or
* http://www.ida.liu.se/projects/OpenModelica, and in the OpenModelica
* distribution. GNU version 3 is obtained from:
* http://www.gnu.org/copyleft/gpl.html. The New BSD License is obtained from:
* http://www.opensource.org/licenses/BSD-3-Clause.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS
* EXPRESSLY SET FORTH IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE
* CONDITIONS OF OSMC-PL.
*
*/
/* Typedefs and other things used all over the compiler, but does not pull in many other headers */
#ifndef OPENMODELICA_TYPES_H_
#define OPENMODELICA_TYPES_H_
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
typedef int integer;
typedef unsigned int uinteger;
#else
typedef long int integer;
typedef unsigned long int uinteger;
#endif
typedef double doublereal;
#define maxmacro(X,Y) X > Y ? X : Y
#define minmacro(X,Y) X > Y ? Y : X
typedef void* modelica_complex; /* currently only External objects are represented using modelica_complex.*/
typedef void* modelica_metatype; /* MetaModelica extension, added by sjoelund */
/* MetaModelica extension.
We actually store function-pointers in lists, etc...
So it needs to be void*. If we use a platform with different sizes of function-
pointers, some changes need to be done to code generation */
typedef void* modelica_fnptr;
/* When MetaModelica grammar is enabled, all strings are boxed */
typedef modelica_metatype modelica_string;
#if defined(_LP64) /* linux 64bit*/
#define MMC_SIZE_DBL 8
#define MMC_SIZE_INT 8
#define MMC_LOG2_SIZE_INT 3
#define PRINT_MMC_SINT_T "ld"
#define PRINT_MMC_UINT_T "lu"
typedef unsigned long mmc_uint_t;
typedef long mmc_sint_t;
#elif defined(_LLP64) || defined(_WIN64) || defined(__MINGW64__) /* windows 64bit */
#define MMC_SIZE_DBL 8
#define MMC_SIZE_INT 8
#define MMC_LOG2_SIZE_INT 3
#ifndef PRIu64
#define PRIu64 "I64u"
#endif
#ifndef PRId64
#define PRId64 "I64d"
#endif
#define PRINT_MMC_SINT_T PRId64
#define PRINT_MMC_UINT_T PRIu64
typedef unsigned long long mmc_uint_t;
typedef long long mmc_sint_t;
#else /* 32bit platforms */
#define MMC_SIZE_DBL 8
#define MMC_SIZE_INT 4
#define MMC_LOG2_SIZE_INT 2
#define PRINT_MMC_SINT_T "d"
#define PRINT_MMC_UINT_T "u"
typedef unsigned int mmc_uint_t;
typedef int mmc_sint_t;
#endif
typedef double m_real;
typedef mmc_sint_t m_integer;
typedef modelica_metatype m_string;
typedef signed char m_boolean;
typedef m_integer _index_t;
/* This structure holds indexes when subscripting an array.
* ndims - number of subscripts, E.g. A[1,{2,3},:] => ndims = 3
* dim_size - dimension size of each subscript, Eg. A[1,{2,3},:,{3}] => dim_size={1,2,0,1}
* spec_type - index type for each index, 'S' for scalar, 'A' for array, 'W' for whole dimension (:)
* Eg. A[1,{2,3},:,{3}] => spec_type = {'S','A','W','A'}.
* spec_type is required to be able to distinguish between {1} and 1 as an index.
* index - pointer to all indices (except of type 'W'), eg A[1,{2,3},:,{3}] => index -> {1,2,3,3}
*/
struct index_spec_s
{
_index_t ndims; /* number of indices/subscripts */
_index_t* dim_size; /* size for each subscript */
char* index_type; /* type of each subscript, any of 'S','A' or 'W' */
_index_t** index; /* all indices*/
};
typedef struct index_spec_s index_spec_t;
struct base_array_s
{
int ndims;
_index_t *dim_size;
void *data;
m_boolean flexible;
};
typedef struct base_array_s base_array_t;
typedef base_array_t string_array_t;
typedef signed char modelica_boolean;
typedef base_array_t boolean_array_t;
typedef double modelica_real;
typedef base_array_t real_array_t;
typedef m_integer modelica_integer;
typedef base_array_t integer_array_t;
typedef real_array_t real_array;
typedef integer_array_t integer_array;
typedef boolean_array_t boolean_array;
typedef string_array_t string_array;
#include "gc/omc_gc.h" /* for threadData_t */
#if defined(__cplusplus)
}
#endif
#endif