epanet-plus 0.2.1__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docs/conf.py +67 -0
- epanet-msx-src/dispersion.h +27 -0
- epanet-msx-src/hash.c +107 -0
- epanet-msx-src/hash.h +28 -0
- epanet-msx-src/include/epanetmsx.h +104 -0
- epanet-msx-src/include/epanetmsx_export.h +42 -0
- epanet-msx-src/mathexpr.c +937 -0
- epanet-msx-src/mathexpr.h +39 -0
- epanet-msx-src/mempool.c +204 -0
- epanet-msx-src/mempool.h +24 -0
- epanet-msx-src/msxchem.c +1285 -0
- epanet-msx-src/msxcompiler.c +368 -0
- epanet-msx-src/msxdict.h +42 -0
- epanet-msx-src/msxdispersion.c +586 -0
- epanet-msx-src/msxerr.c +116 -0
- epanet-msx-src/msxfile.c +260 -0
- epanet-msx-src/msxfuncs.c +175 -0
- epanet-msx-src/msxfuncs.h +35 -0
- epanet-msx-src/msxinp.c +1504 -0
- epanet-msx-src/msxout.c +398 -0
- epanet-msx-src/msxproj.c +791 -0
- epanet-msx-src/msxqual.c +2011 -0
- epanet-msx-src/msxrpt.c +400 -0
- epanet-msx-src/msxtank.c +422 -0
- epanet-msx-src/msxtoolkit.c +1164 -0
- epanet-msx-src/msxtypes.h +551 -0
- epanet-msx-src/msxutils.c +524 -0
- epanet-msx-src/msxutils.h +56 -0
- epanet-msx-src/newton.c +158 -0
- epanet-msx-src/newton.h +34 -0
- epanet-msx-src/rk5.c +287 -0
- epanet-msx-src/rk5.h +39 -0
- epanet-msx-src/ros2.c +293 -0
- epanet-msx-src/ros2.h +35 -0
- epanet-msx-src/smatrix.c +816 -0
- epanet-msx-src/smatrix.h +29 -0
- epanet-src/AUTHORS +60 -0
- epanet-src/LICENSE +21 -0
- epanet-src/enumstxt.h +151 -0
- epanet-src/epanet.c +5937 -0
- epanet-src/epanet2.c +961 -0
- epanet-src/epanet2.def +131 -0
- epanet-src/errors.dat +79 -0
- epanet-src/flowbalance.c +186 -0
- epanet-src/funcs.h +219 -0
- epanet-src/genmmd.c +1000 -0
- epanet-src/hash.c +177 -0
- epanet-src/hash.h +28 -0
- epanet-src/hydcoeffs.c +1303 -0
- epanet-src/hydraul.c +1164 -0
- epanet-src/hydsolver.c +781 -0
- epanet-src/hydstatus.c +442 -0
- epanet-src/include/epanet2.h +466 -0
- epanet-src/include/epanet2_2.h +1962 -0
- epanet-src/include/epanet2_enums.h +518 -0
- epanet-src/inpfile.c +884 -0
- epanet-src/input1.c +672 -0
- epanet-src/input2.c +970 -0
- epanet-src/input3.c +2265 -0
- epanet-src/leakage.c +527 -0
- epanet-src/mempool.c +146 -0
- epanet-src/mempool.h +24 -0
- epanet-src/output.c +853 -0
- epanet-src/project.c +1691 -0
- epanet-src/quality.c +695 -0
- epanet-src/qualreact.c +800 -0
- epanet-src/qualroute.c +696 -0
- epanet-src/report.c +1559 -0
- epanet-src/rules.c +1500 -0
- epanet-src/smatrix.c +871 -0
- epanet-src/text.h +508 -0
- epanet-src/types.h +928 -0
- epanet-src/util/cstr_helper.c +59 -0
- epanet-src/util/cstr_helper.h +38 -0
- epanet-src/util/errormanager.c +92 -0
- epanet-src/util/errormanager.h +39 -0
- epanet-src/util/filemanager.c +212 -0
- epanet-src/util/filemanager.h +81 -0
- epanet-src/validate.c +408 -0
- epanet.cpython-311-darwin.so +0 -0
- epanet_plus/VERSION +1 -0
- epanet_plus/__init__.py +8 -0
- epanet_plus/epanet_plus.c +118 -0
- epanet_plus/epanet_toolkit.py +2833 -0
- epanet_plus/epanet_wrapper.py +2434 -0
- epanet_plus/include/epanet_plus.h +9 -0
- epanet_plus-0.2.1.dist-info/METADATA +157 -0
- epanet_plus-0.2.1.dist-info/RECORD +106 -0
- epanet_plus-0.2.1.dist-info/WHEEL +6 -0
- epanet_plus-0.2.1.dist-info/licenses/LICENSE +21 -0
- epanet_plus-0.2.1.dist-info/top_level.txt +11 -0
- examples/basic_usage.py +35 -0
- examples/epanet_msx.py +35 -0
- python-extension/ext.c +344 -0
- python-extension/pyepanet.c +2771 -0
- python-extension/pyepanet.h +144 -0
- python-extension/pyepanet2.c +2453 -0
- python-extension/pyepanet2.h +142 -0
- python-extension/pyepanet_plus.c +43 -0
- python-extension/pyepanet_plus.h +4 -0
- python-extension/pyepanetmsx.c +524 -0
- python-extension/pyepanetmsx.h +35 -0
- tests/test_epanet.py +18 -0
- tests/test_epanetmsx.py +38 -0
- tests/test_epyt.py +115 -0
- tests/test_load_inp_from_buffer.py +59 -0
|
@@ -0,0 +1,2771 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
#include "epanet2_2.h"
|
|
3
|
+
#include "types.h"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
PyObject* method_EN_createproject(PyObject* self, PyObject* Py_UNUSED(args))
|
|
10
|
+
{
|
|
11
|
+
EN_Project ph;
|
|
12
|
+
int err = EN_createproject(&ph);
|
|
13
|
+
|
|
14
|
+
return Py_BuildValue("(iK)", err, (uintptr_t)&(*ph));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
PyObject* method_EN_deleteproject(PyObject* self, PyObject* args)
|
|
18
|
+
{
|
|
19
|
+
uintptr_t ptr;
|
|
20
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
21
|
+
return NULL;
|
|
22
|
+
}
|
|
23
|
+
EN_Project ph = (EN_Project) ptr;
|
|
24
|
+
|
|
25
|
+
PyObject* err = PyLong_FromLong(EN_deleteproject(ph));
|
|
26
|
+
|
|
27
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
28
|
+
Py_DECREF(err);
|
|
29
|
+
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
PyObject* method_EN_init(PyObject* self, PyObject* args)
|
|
34
|
+
{
|
|
35
|
+
uintptr_t ptr;
|
|
36
|
+
char* rptFile = NULL;
|
|
37
|
+
char* outFile = NULL;
|
|
38
|
+
int unitsType, headLossType;
|
|
39
|
+
|
|
40
|
+
if(!PyArg_ParseTuple(args, "Kssii", &ptr, &rptFile, &outFile, &unitsType, &headLossType)) {
|
|
41
|
+
return NULL;
|
|
42
|
+
}
|
|
43
|
+
EN_Project ph = (EN_Project) ptr;
|
|
44
|
+
|
|
45
|
+
PyObject* err = PyLong_FromLong(EN_init(ph, rptFile, outFile, unitsType, headLossType));
|
|
46
|
+
|
|
47
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
48
|
+
Py_DECREF(err);
|
|
49
|
+
|
|
50
|
+
return r;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
PyObject* method_EN_open(PyObject* self, PyObject* args)
|
|
54
|
+
{
|
|
55
|
+
uintptr_t ptr;
|
|
56
|
+
char* inpFile = NULL;
|
|
57
|
+
char* rptFile = NULL;
|
|
58
|
+
char* outFile = NULL;
|
|
59
|
+
|
|
60
|
+
if(!PyArg_ParseTuple(args, "Ksss", &ptr, &inpFile, &rptFile, &outFile)) {
|
|
61
|
+
return NULL;
|
|
62
|
+
}
|
|
63
|
+
EN_Project ph = (EN_Project) ptr;
|
|
64
|
+
|
|
65
|
+
PyObject* err = PyLong_FromLong(EN_open(ph, inpFile, rptFile, outFile));
|
|
66
|
+
|
|
67
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
68
|
+
Py_DECREF(err);
|
|
69
|
+
|
|
70
|
+
return r;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
PyObject* method_EN_openX(PyObject* self, PyObject* args)
|
|
74
|
+
{
|
|
75
|
+
uintptr_t ptr;
|
|
76
|
+
char* inpFile = NULL;
|
|
77
|
+
char* rptFile = NULL;
|
|
78
|
+
char* outFile = NULL;
|
|
79
|
+
|
|
80
|
+
if(!PyArg_ParseTuple(args, "Ksss", &ptr, &inpFile, &rptFile, &outFile)) {
|
|
81
|
+
return NULL;
|
|
82
|
+
}
|
|
83
|
+
EN_Project ph = (EN_Project) ptr;
|
|
84
|
+
|
|
85
|
+
PyObject* err = PyLong_FromLong(EN_openX(ph, inpFile, rptFile, outFile));
|
|
86
|
+
|
|
87
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
88
|
+
Py_DECREF(err);
|
|
89
|
+
|
|
90
|
+
return r;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
PyObject* method_EN_gettitle(PyObject* self, PyObject* args)
|
|
94
|
+
{
|
|
95
|
+
uintptr_t ptr;
|
|
96
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
97
|
+
return NULL;
|
|
98
|
+
}
|
|
99
|
+
EN_Project ph = (EN_Project) ptr;
|
|
100
|
+
|
|
101
|
+
char out_line1[TITLELEN + 1];
|
|
102
|
+
char out_line2[TITLELEN + 1];
|
|
103
|
+
char out_line3[TITLELEN + 1];
|
|
104
|
+
PyObject* err = PyLong_FromLong(EN_gettitle(ph, &out_line1[0], &out_line2[0], &out_line3[0]));
|
|
105
|
+
PyObject* pyOutLine1 = PyUnicode_FromString(&out_line1[0]);
|
|
106
|
+
PyObject* pyOutLine2 = PyUnicode_FromString(&out_line2[0]);
|
|
107
|
+
PyObject* pyOutLine3 = PyUnicode_FromString(&out_line3[0]);
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
PyObject* r = PyTuple_Pack(4, err, pyOutLine1, pyOutLine2, pyOutLine3);
|
|
111
|
+
Py_DECREF(err);
|
|
112
|
+
Py_DECREF(pyOutLine1);
|
|
113
|
+
Py_DECREF(pyOutLine2);
|
|
114
|
+
Py_DECREF(pyOutLine3);
|
|
115
|
+
|
|
116
|
+
return r;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
PyObject* method_EN_settitle(PyObject* self, PyObject* args)
|
|
120
|
+
{
|
|
121
|
+
uintptr_t ptr;
|
|
122
|
+
char* line1 = NULL;
|
|
123
|
+
char* line2 = NULL;
|
|
124
|
+
char* line3 = NULL;
|
|
125
|
+
if(!PyArg_ParseTuple(args, "Ksss", &ptr, &line1, &line2, &line3)) {
|
|
126
|
+
return NULL;
|
|
127
|
+
}
|
|
128
|
+
EN_Project ph = (EN_Project) ptr;
|
|
129
|
+
|
|
130
|
+
PyObject* err = PyLong_FromLong(EN_settitle(ph, line1, line2, line3));
|
|
131
|
+
|
|
132
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
133
|
+
Py_DECREF(err);
|
|
134
|
+
|
|
135
|
+
return r;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
PyObject* method_EN_getcomment(PyObject* self, PyObject* args)
|
|
139
|
+
{
|
|
140
|
+
uintptr_t ptr;
|
|
141
|
+
int object, index;
|
|
142
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &object, &index)) {
|
|
143
|
+
return NULL;
|
|
144
|
+
}
|
|
145
|
+
EN_Project ph = (EN_Project) ptr;
|
|
146
|
+
|
|
147
|
+
char out_comment[MAXLINE + 1];
|
|
148
|
+
PyObject* err = PyLong_FromLong(EN_getcomment(ph, object, index, &out_comment[0]));
|
|
149
|
+
PyObject* pyOutComment = PyUnicode_FromString(&out_comment[0]);
|
|
150
|
+
|
|
151
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutComment);
|
|
152
|
+
Py_DECREF(err);
|
|
153
|
+
Py_DECREF(pyOutComment);
|
|
154
|
+
|
|
155
|
+
return r;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
PyObject* method_EN_setcomment(PyObject* self, PyObject* args)
|
|
159
|
+
{
|
|
160
|
+
uintptr_t ptr;
|
|
161
|
+
int object, index;
|
|
162
|
+
char* comment = NULL;
|
|
163
|
+
if(!PyArg_ParseTuple(args, "Kiis", &ptr, &object, &index, &comment)) {
|
|
164
|
+
return NULL;
|
|
165
|
+
}
|
|
166
|
+
EN_Project ph = (EN_Project) ptr;
|
|
167
|
+
|
|
168
|
+
PyObject* err = PyLong_FromLong(EN_setcomment(ph, object, index, comment));
|
|
169
|
+
|
|
170
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
171
|
+
Py_DECREF(err);
|
|
172
|
+
|
|
173
|
+
return r;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
PyObject* method_EN_getcount(PyObject* self, PyObject* args)
|
|
177
|
+
{
|
|
178
|
+
uintptr_t ptr;
|
|
179
|
+
int object;
|
|
180
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &object)) {
|
|
181
|
+
return NULL;
|
|
182
|
+
}
|
|
183
|
+
EN_Project ph = (EN_Project) ptr;
|
|
184
|
+
|
|
185
|
+
int count;
|
|
186
|
+
PyObject* err = PyLong_FromLong(EN_getcount(ph, object, &count));
|
|
187
|
+
PyObject* pyCount = PyLong_FromLong(count);
|
|
188
|
+
|
|
189
|
+
PyObject* r = PyTuple_Pack(2, err, pyCount);
|
|
190
|
+
Py_DECREF(err);
|
|
191
|
+
Py_DECREF(pyCount);
|
|
192
|
+
|
|
193
|
+
return r;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
PyObject* method_EN_saveinpfile(PyObject* self, PyObject* args)
|
|
197
|
+
{
|
|
198
|
+
uintptr_t ptr;
|
|
199
|
+
char* filename = NULL;
|
|
200
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &filename)) {
|
|
201
|
+
return NULL;
|
|
202
|
+
}
|
|
203
|
+
EN_Project ph = (EN_Project) ptr;
|
|
204
|
+
|
|
205
|
+
PyObject* err = PyLong_FromLong(EN_saveinpfile(ph, filename));
|
|
206
|
+
|
|
207
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
208
|
+
Py_DECREF(err);
|
|
209
|
+
|
|
210
|
+
return r;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
PyObject* method_EN_close(PyObject* self, PyObject* args)
|
|
214
|
+
{
|
|
215
|
+
uintptr_t ptr;
|
|
216
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
217
|
+
return NULL;
|
|
218
|
+
}
|
|
219
|
+
EN_Project ph = (EN_Project) ptr;
|
|
220
|
+
|
|
221
|
+
PyObject* err = PyLong_FromLong(EN_close(ph));
|
|
222
|
+
|
|
223
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
224
|
+
Py_DECREF(err);
|
|
225
|
+
|
|
226
|
+
return r;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
PyObject* method_EN_solveH(PyObject* self, PyObject* args)
|
|
230
|
+
{
|
|
231
|
+
uintptr_t ptr;
|
|
232
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
233
|
+
return NULL;
|
|
234
|
+
}
|
|
235
|
+
EN_Project ph = (EN_Project) ptr;
|
|
236
|
+
|
|
237
|
+
PyObject* err = PyLong_FromLong(EN_solveH(ph));
|
|
238
|
+
|
|
239
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
240
|
+
Py_DECREF(err);
|
|
241
|
+
|
|
242
|
+
return r;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
PyObject* method_EN_usehydfile(PyObject* self, PyObject* args)
|
|
246
|
+
{
|
|
247
|
+
uintptr_t ptr;
|
|
248
|
+
char* filename = NULL;
|
|
249
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &filename)) {
|
|
250
|
+
return NULL;
|
|
251
|
+
}
|
|
252
|
+
EN_Project ph = (EN_Project) ptr;
|
|
253
|
+
|
|
254
|
+
PyObject* err = PyLong_FromLong(EN_usehydfile(ph, filename));
|
|
255
|
+
|
|
256
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
257
|
+
Py_DECREF(err);
|
|
258
|
+
|
|
259
|
+
return r;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
PyObject* method_EN_openH(PyObject* self, PyObject* args)
|
|
263
|
+
{
|
|
264
|
+
uintptr_t ptr;
|
|
265
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
266
|
+
return NULL;
|
|
267
|
+
}
|
|
268
|
+
EN_Project ph = (EN_Project) ptr;
|
|
269
|
+
|
|
270
|
+
PyObject* err = PyLong_FromLong(EN_openH(ph));
|
|
271
|
+
|
|
272
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
273
|
+
Py_DECREF(err);
|
|
274
|
+
|
|
275
|
+
return r;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
PyObject* method_EN_initH(PyObject* self, PyObject* args)
|
|
279
|
+
{
|
|
280
|
+
uintptr_t ptr;
|
|
281
|
+
int initFlag;
|
|
282
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &initFlag)) {
|
|
283
|
+
return NULL;
|
|
284
|
+
}
|
|
285
|
+
EN_Project ph = (EN_Project) ptr;
|
|
286
|
+
|
|
287
|
+
PyObject* err = PyLong_FromLong(EN_initH(ph, initFlag));
|
|
288
|
+
|
|
289
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
290
|
+
Py_DECREF(err);
|
|
291
|
+
|
|
292
|
+
return r;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
PyObject* method_EN_runH(PyObject* self, PyObject* args)
|
|
296
|
+
{
|
|
297
|
+
uintptr_t ptr;
|
|
298
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
299
|
+
return NULL;
|
|
300
|
+
}
|
|
301
|
+
EN_Project ph = (EN_Project) ptr;
|
|
302
|
+
|
|
303
|
+
long currentTime;
|
|
304
|
+
PyObject* err = PyLong_FromLong(EN_runH(ph, ¤tTime));
|
|
305
|
+
PyObject* pyCurrentTime = PyLong_FromLong(currentTime);
|
|
306
|
+
|
|
307
|
+
PyObject* r = PyTuple_Pack(2, err, pyCurrentTime);
|
|
308
|
+
Py_DECREF(err);
|
|
309
|
+
Py_DECREF(pyCurrentTime);
|
|
310
|
+
|
|
311
|
+
return r;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
PyObject* method_EN_nextH(PyObject* self, PyObject* args)
|
|
315
|
+
{
|
|
316
|
+
uintptr_t ptr;
|
|
317
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
318
|
+
return NULL;
|
|
319
|
+
}
|
|
320
|
+
EN_Project ph = (EN_Project) ptr;
|
|
321
|
+
|
|
322
|
+
long tStep;
|
|
323
|
+
PyObject* err = PyLong_FromLong(EN_nextH(ph, &tStep));
|
|
324
|
+
PyObject* pyTStep = PyLong_FromLong(tStep);
|
|
325
|
+
|
|
326
|
+
PyObject* r = PyTuple_Pack(2, err, pyTStep);
|
|
327
|
+
Py_DECREF(err);
|
|
328
|
+
Py_DECREF(pyTStep);
|
|
329
|
+
|
|
330
|
+
return r;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
PyObject* method_EN_saveH(PyObject* self, PyObject* args)
|
|
334
|
+
{
|
|
335
|
+
uintptr_t ptr;
|
|
336
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
337
|
+
return NULL;
|
|
338
|
+
}
|
|
339
|
+
EN_Project ph = (EN_Project) ptr;
|
|
340
|
+
|
|
341
|
+
PyObject* err = PyLong_FromLong(EN_saveH(ph));
|
|
342
|
+
|
|
343
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
344
|
+
Py_DECREF(err);
|
|
345
|
+
|
|
346
|
+
return r;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
PyObject* method_EN_savehydfile(PyObject* self, PyObject* args)
|
|
350
|
+
{
|
|
351
|
+
uintptr_t ptr;
|
|
352
|
+
char* filename = NULL;
|
|
353
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &filename)) {
|
|
354
|
+
return NULL;
|
|
355
|
+
}
|
|
356
|
+
EN_Project ph = (EN_Project) ptr;
|
|
357
|
+
|
|
358
|
+
PyObject* err = PyLong_FromLong(EN_savehydfile(ph, filename));
|
|
359
|
+
|
|
360
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
361
|
+
Py_DECREF(err);
|
|
362
|
+
|
|
363
|
+
return r;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
PyObject* method_EN_closeH(PyObject* self, PyObject* args)
|
|
367
|
+
{
|
|
368
|
+
uintptr_t ptr;
|
|
369
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
370
|
+
return NULL;
|
|
371
|
+
}
|
|
372
|
+
EN_Project ph = (EN_Project) ptr;
|
|
373
|
+
|
|
374
|
+
PyObject* err = PyLong_FromLong(EN_closeH(ph));
|
|
375
|
+
|
|
376
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
377
|
+
Py_DECREF(err);
|
|
378
|
+
|
|
379
|
+
return r;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
PyObject* method_EN_solveQ(PyObject* self, PyObject* args)
|
|
383
|
+
{
|
|
384
|
+
uintptr_t ptr;
|
|
385
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
386
|
+
return NULL;
|
|
387
|
+
}
|
|
388
|
+
EN_Project ph = (EN_Project) ptr;
|
|
389
|
+
|
|
390
|
+
PyObject* err = PyLong_FromLong(EN_solveQ(ph));
|
|
391
|
+
|
|
392
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
393
|
+
Py_DECREF(err);
|
|
394
|
+
|
|
395
|
+
return r;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
PyObject* method_EN_openQ(PyObject* self, PyObject* args)
|
|
399
|
+
{
|
|
400
|
+
uintptr_t ptr;
|
|
401
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
402
|
+
return NULL;
|
|
403
|
+
}
|
|
404
|
+
EN_Project ph = (EN_Project) ptr;
|
|
405
|
+
|
|
406
|
+
PyObject* err = PyLong_FromLong(EN_openQ(ph));
|
|
407
|
+
|
|
408
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
409
|
+
Py_DECREF(err);
|
|
410
|
+
|
|
411
|
+
return r;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
PyObject* method_EN_initQ(PyObject* self, PyObject* args)
|
|
415
|
+
{
|
|
416
|
+
uintptr_t ptr;
|
|
417
|
+
int saveFlag;
|
|
418
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &saveFlag)) {
|
|
419
|
+
return NULL;
|
|
420
|
+
}
|
|
421
|
+
EN_Project ph = (EN_Project) ptr;
|
|
422
|
+
|
|
423
|
+
PyObject* err = PyLong_FromLong(EN_initQ(ph, saveFlag));
|
|
424
|
+
|
|
425
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
426
|
+
Py_DECREF(err);
|
|
427
|
+
|
|
428
|
+
return r;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
PyObject* method_EN_runQ(PyObject* self, PyObject* args)
|
|
432
|
+
{
|
|
433
|
+
uintptr_t ptr;
|
|
434
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
435
|
+
return NULL;
|
|
436
|
+
}
|
|
437
|
+
EN_Project ph = (EN_Project) ptr;
|
|
438
|
+
|
|
439
|
+
long currentTime;
|
|
440
|
+
PyObject* err = PyLong_FromLong(EN_runQ(ph, ¤tTime));
|
|
441
|
+
PyObject* pyCurrentTime = PyLong_FromLong(currentTime);
|
|
442
|
+
|
|
443
|
+
PyObject* r = PyTuple_Pack(2, err, pyCurrentTime);
|
|
444
|
+
Py_DECREF(err);
|
|
445
|
+
Py_DECREF(pyCurrentTime);
|
|
446
|
+
|
|
447
|
+
return r;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
PyObject* method_EN_nextQ(PyObject* self, PyObject* args)
|
|
451
|
+
{
|
|
452
|
+
uintptr_t ptr;
|
|
453
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
454
|
+
return NULL;
|
|
455
|
+
}
|
|
456
|
+
EN_Project ph = (EN_Project) ptr;
|
|
457
|
+
|
|
458
|
+
long tStep;
|
|
459
|
+
PyObject* err = PyLong_FromLong(EN_nextQ(ph, &tStep));
|
|
460
|
+
PyObject* pyTStep = PyLong_FromLong(tStep);
|
|
461
|
+
|
|
462
|
+
PyObject* r = PyTuple_Pack(2, err, pyTStep);
|
|
463
|
+
Py_DECREF(err);
|
|
464
|
+
Py_DECREF(pyTStep);
|
|
465
|
+
|
|
466
|
+
return r;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
PyObject* method_EN_stepQ(PyObject* self, PyObject* args)
|
|
470
|
+
{
|
|
471
|
+
uintptr_t ptr;
|
|
472
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
473
|
+
return NULL;
|
|
474
|
+
}
|
|
475
|
+
EN_Project ph = (EN_Project) ptr;
|
|
476
|
+
|
|
477
|
+
long timeLeft;
|
|
478
|
+
PyObject* err = PyLong_FromLong(EN_stepQ(ph, &timeLeft));
|
|
479
|
+
PyObject* pyTimeLeft = PyLong_FromLong(timeLeft);
|
|
480
|
+
|
|
481
|
+
PyObject* r = PyTuple_Pack(2, err, pyTimeLeft);
|
|
482
|
+
Py_DECREF(err);
|
|
483
|
+
Py_DECREF(pyTimeLeft);
|
|
484
|
+
|
|
485
|
+
return r;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
PyObject* method_EN_closeQ(PyObject* self, PyObject* args)
|
|
489
|
+
{
|
|
490
|
+
uintptr_t ptr;
|
|
491
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
492
|
+
return NULL;
|
|
493
|
+
}
|
|
494
|
+
EN_Project ph = (EN_Project) ptr;
|
|
495
|
+
|
|
496
|
+
PyObject* err = PyLong_FromLong(EN_closeQ(ph));
|
|
497
|
+
|
|
498
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
499
|
+
Py_DECREF(err);
|
|
500
|
+
|
|
501
|
+
return r;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
PyObject* method_EN_writeline(PyObject* self, PyObject* args)
|
|
505
|
+
{
|
|
506
|
+
uintptr_t ptr;
|
|
507
|
+
char* line = NULL;
|
|
508
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &line)) {
|
|
509
|
+
return NULL;
|
|
510
|
+
}
|
|
511
|
+
EN_Project ph = (EN_Project) ptr;
|
|
512
|
+
|
|
513
|
+
PyObject* err = PyLong_FromLong(EN_writeline(ph, line));
|
|
514
|
+
|
|
515
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
516
|
+
Py_DECREF(err);
|
|
517
|
+
|
|
518
|
+
return r;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
PyObject* method_EN_report(PyObject* self, PyObject* args)
|
|
522
|
+
{
|
|
523
|
+
uintptr_t ptr;
|
|
524
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
525
|
+
return NULL;
|
|
526
|
+
}
|
|
527
|
+
EN_Project ph = (EN_Project) ptr;
|
|
528
|
+
|
|
529
|
+
PyObject* err = PyLong_FromLong(EN_report(ph));
|
|
530
|
+
|
|
531
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
532
|
+
Py_DECREF(err);
|
|
533
|
+
|
|
534
|
+
return r;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
PyObject* method_EN_copyreport(PyObject* self, PyObject* args)
|
|
538
|
+
{
|
|
539
|
+
uintptr_t ptr;
|
|
540
|
+
char* filename = NULL;
|
|
541
|
+
if(!PyArg_ParseTuple(args, "K", &ptr, &filename)) {
|
|
542
|
+
return NULL;
|
|
543
|
+
}
|
|
544
|
+
EN_Project ph = (EN_Project) ptr;
|
|
545
|
+
|
|
546
|
+
PyObject* err = PyLong_FromLong(EN_copyreport(ph, filename));
|
|
547
|
+
|
|
548
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
549
|
+
Py_DECREF(err);
|
|
550
|
+
|
|
551
|
+
return r;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
PyObject* method_EN_clearreport(PyObject* self, PyObject* args)
|
|
555
|
+
{
|
|
556
|
+
uintptr_t ptr;
|
|
557
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
558
|
+
return NULL;
|
|
559
|
+
}
|
|
560
|
+
EN_Project ph = (EN_Project) ptr;
|
|
561
|
+
|
|
562
|
+
PyObject* err = PyLong_FromLong(EN_clearreport(ph));
|
|
563
|
+
|
|
564
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
565
|
+
Py_DECREF(err);
|
|
566
|
+
|
|
567
|
+
return r;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
PyObject* method_EN_resetreport(PyObject* self, PyObject* args)
|
|
571
|
+
{
|
|
572
|
+
uintptr_t ptr;
|
|
573
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
574
|
+
return NULL;
|
|
575
|
+
}
|
|
576
|
+
EN_Project ph = (EN_Project) ptr;
|
|
577
|
+
|
|
578
|
+
PyObject* err = PyLong_FromLong(EN_resetreport(ph));
|
|
579
|
+
|
|
580
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
581
|
+
Py_DECREF(err);
|
|
582
|
+
|
|
583
|
+
return r;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
PyObject* method_EN_setreport(PyObject* self, PyObject* args)
|
|
587
|
+
{
|
|
588
|
+
uintptr_t ptr;
|
|
589
|
+
char* format = NULL;
|
|
590
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &format)) {
|
|
591
|
+
return NULL;
|
|
592
|
+
}
|
|
593
|
+
EN_Project ph = (EN_Project) ptr;
|
|
594
|
+
|
|
595
|
+
PyObject* err = PyLong_FromLong(EN_setreport(ph, format));
|
|
596
|
+
|
|
597
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
598
|
+
Py_DECREF(err);
|
|
599
|
+
|
|
600
|
+
return r;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
PyObject* method_EN_setstatusreport(PyObject* self, PyObject* args)
|
|
604
|
+
{
|
|
605
|
+
uintptr_t ptr;
|
|
606
|
+
int level;
|
|
607
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &level)) {
|
|
608
|
+
return NULL;
|
|
609
|
+
}
|
|
610
|
+
EN_Project ph = (EN_Project) ptr;
|
|
611
|
+
|
|
612
|
+
PyObject* err = PyLong_FromLong(EN_setstatusreport(ph, level));
|
|
613
|
+
|
|
614
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
615
|
+
Py_DECREF(err);
|
|
616
|
+
|
|
617
|
+
return r;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
PyObject* method_EN_getversion(PyObject* self, PyObject* args)
|
|
621
|
+
{
|
|
622
|
+
int version;
|
|
623
|
+
PyObject* err = PyLong_FromLong(EN_getversion(&version));
|
|
624
|
+
PyObject* pyVersion = PyLong_FromLong(version);
|
|
625
|
+
|
|
626
|
+
PyObject* r = PyTuple_Pack(2, err, pyVersion);
|
|
627
|
+
Py_DECREF(err);
|
|
628
|
+
Py_DECREF(pyVersion);
|
|
629
|
+
|
|
630
|
+
return r;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
PyObject* method_EN_geterror(PyObject* self, PyObject* args)
|
|
634
|
+
{
|
|
635
|
+
int errcode;
|
|
636
|
+
if(!PyArg_ParseTuple(args, "i", &errcode)) {
|
|
637
|
+
return NULL;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
char out_errmsg[MAXMSG + 1];
|
|
641
|
+
PyObject* err = PyLong_FromLong(EN_geterror(errcode, &out_errmsg[0], MAXMSG + 1));
|
|
642
|
+
PyObject* pyOutErrmsg = PyUnicode_FromString(&out_errmsg[0]);
|
|
643
|
+
|
|
644
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutErrmsg);
|
|
645
|
+
Py_DECREF(err);
|
|
646
|
+
Py_DECREF(pyOutErrmsg);
|
|
647
|
+
|
|
648
|
+
return r;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
PyObject* method_EN_getstatistic(PyObject* self, PyObject* args)
|
|
652
|
+
{
|
|
653
|
+
uintptr_t ptr;
|
|
654
|
+
int type;
|
|
655
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &type)) {
|
|
656
|
+
return NULL;
|
|
657
|
+
}
|
|
658
|
+
EN_Project ph = (EN_Project) ptr;
|
|
659
|
+
|
|
660
|
+
double value;
|
|
661
|
+
PyObject* err = PyLong_FromLong(EN_getstatistic(ph, type, &value));
|
|
662
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
663
|
+
|
|
664
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
665
|
+
Py_DECREF(err);
|
|
666
|
+
Py_DECREF(pyValue);
|
|
667
|
+
|
|
668
|
+
return r;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
PyObject* method_EN_getresultindex(PyObject* self, PyObject* args)
|
|
672
|
+
{
|
|
673
|
+
int type, index, value;
|
|
674
|
+
uintptr_t ptr;
|
|
675
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &type, &index)) {
|
|
676
|
+
return NULL;
|
|
677
|
+
}
|
|
678
|
+
EN_Project ph = (EN_Project) ptr;
|
|
679
|
+
|
|
680
|
+
PyObject* err = PyLong_FromLong(EN_getresultindex(ph, type, index, &value));
|
|
681
|
+
PyObject* pyValue = PyLong_FromLong(value);
|
|
682
|
+
|
|
683
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
684
|
+
Py_DECREF(err);
|
|
685
|
+
Py_DECREF(pyValue);
|
|
686
|
+
|
|
687
|
+
return r;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
PyObject* method_EN_getoption(PyObject* self, PyObject* args)
|
|
691
|
+
{
|
|
692
|
+
uintptr_t ptr;
|
|
693
|
+
int option;
|
|
694
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &option)) {
|
|
695
|
+
return NULL;
|
|
696
|
+
}
|
|
697
|
+
EN_Project ph = (EN_Project) ptr;
|
|
698
|
+
|
|
699
|
+
double value;
|
|
700
|
+
PyObject* err = PyLong_FromLong(EN_getoption(ph, option, &value));
|
|
701
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
702
|
+
|
|
703
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
704
|
+
Py_DECREF(err);
|
|
705
|
+
Py_DECREF(pyValue);
|
|
706
|
+
|
|
707
|
+
return r;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
PyObject* method_EN_setoption(PyObject* self, PyObject* args)
|
|
711
|
+
{
|
|
712
|
+
uintptr_t ptr;
|
|
713
|
+
int option;
|
|
714
|
+
double value;
|
|
715
|
+
if(!PyArg_ParseTuple(args, "Kid", &ptr, &option, &value)) {
|
|
716
|
+
return NULL;
|
|
717
|
+
}
|
|
718
|
+
EN_Project ph = (EN_Project) ptr;
|
|
719
|
+
|
|
720
|
+
PyObject* err = PyLong_FromLong(EN_setoption(ph, option, value));
|
|
721
|
+
|
|
722
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
723
|
+
Py_DECREF(err);
|
|
724
|
+
|
|
725
|
+
return r;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
PyObject* method_EN_getflowunits(PyObject* self, PyObject* args)
|
|
729
|
+
{
|
|
730
|
+
uintptr_t ptr;
|
|
731
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
732
|
+
return NULL;
|
|
733
|
+
}
|
|
734
|
+
EN_Project ph = (EN_Project) ptr;
|
|
735
|
+
|
|
736
|
+
int units;
|
|
737
|
+
PyObject* err = PyLong_FromLong(EN_getflowunits(ph, &units));
|
|
738
|
+
PyObject* pyUnits = PyLong_FromLong(units);
|
|
739
|
+
|
|
740
|
+
PyObject* r = PyTuple_Pack(2, err, pyUnits);
|
|
741
|
+
Py_DECREF(err);
|
|
742
|
+
Py_DECREF(pyUnits);
|
|
743
|
+
|
|
744
|
+
return r;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
PyObject* method_EN_setflowunits(PyObject* self, PyObject* args)
|
|
748
|
+
{
|
|
749
|
+
uintptr_t ptr;
|
|
750
|
+
int units;
|
|
751
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &units)) {
|
|
752
|
+
return NULL;
|
|
753
|
+
}
|
|
754
|
+
EN_Project ph = (EN_Project) ptr;
|
|
755
|
+
|
|
756
|
+
PyObject* err = PyLong_FromLong(EN_setflowunits(ph, units));
|
|
757
|
+
|
|
758
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
759
|
+
Py_DECREF(err);
|
|
760
|
+
|
|
761
|
+
return r;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
PyObject* method_EN_gettimeparam(PyObject* self, PyObject* args)
|
|
765
|
+
{
|
|
766
|
+
uintptr_t ptr;
|
|
767
|
+
int param;
|
|
768
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, ¶m)) {
|
|
769
|
+
return NULL;
|
|
770
|
+
}
|
|
771
|
+
EN_Project ph = (EN_Project) ptr;
|
|
772
|
+
|
|
773
|
+
long value;
|
|
774
|
+
PyObject* err = PyLong_FromLong(EN_gettimeparam(ph, param, &value));
|
|
775
|
+
PyObject* pyValue = PyLong_FromLong(value);
|
|
776
|
+
|
|
777
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
778
|
+
Py_DECREF(err);
|
|
779
|
+
Py_DECREF(pyValue);
|
|
780
|
+
|
|
781
|
+
return r;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
PyObject* method_EN_settimeparam(PyObject* self, PyObject* args)
|
|
785
|
+
{
|
|
786
|
+
uintptr_t ptr;
|
|
787
|
+
int param;
|
|
788
|
+
long value;
|
|
789
|
+
if(!PyArg_ParseTuple(args, "Kil", &ptr, ¶m, &value)) {
|
|
790
|
+
return NULL;
|
|
791
|
+
}
|
|
792
|
+
EN_Project ph = (EN_Project) ptr;
|
|
793
|
+
|
|
794
|
+
PyObject* err = PyLong_FromLong(EN_settimeparam(ph, param, value));
|
|
795
|
+
|
|
796
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
797
|
+
Py_DECREF(err);
|
|
798
|
+
|
|
799
|
+
return r;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
PyObject* method_EN_getqualinfo(PyObject* self, PyObject* args)
|
|
803
|
+
{
|
|
804
|
+
uintptr_t ptr;
|
|
805
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
806
|
+
return NULL;
|
|
807
|
+
}
|
|
808
|
+
EN_Project ph = (EN_Project) ptr;
|
|
809
|
+
|
|
810
|
+
int qualType, traceNode;
|
|
811
|
+
char out_chemName[MAXID + 1];
|
|
812
|
+
char out_chemUnits[MAXID + 1];
|
|
813
|
+
PyObject* err = PyLong_FromLong(EN_getqualinfo(ph, &qualType, &out_chemName[0], &out_chemUnits[0], &traceNode));
|
|
814
|
+
PyObject* pyQualType = PyLong_FromLong(qualType);
|
|
815
|
+
PyObject* pyChemName = PyUnicode_FromString(&out_chemName[0]);
|
|
816
|
+
PyObject* pyChemUnits = PyUnicode_FromString(&out_chemUnits[0]);
|
|
817
|
+
PyObject* pyTraceNode = PyLong_FromLong(traceNode);
|
|
818
|
+
|
|
819
|
+
PyObject* r = PyTuple_Pack(5, err, pyQualType, pyChemName, pyChemUnits, pyTraceNode);
|
|
820
|
+
Py_DECREF(err);
|
|
821
|
+
Py_DECREF(pyQualType);
|
|
822
|
+
Py_DECREF(pyChemName);
|
|
823
|
+
Py_DECREF(pyChemUnits);
|
|
824
|
+
Py_DECREF(pyTraceNode);
|
|
825
|
+
|
|
826
|
+
return r;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
PyObject* method_EN_getqualtype(PyObject* self, PyObject* args)
|
|
830
|
+
{
|
|
831
|
+
uintptr_t ptr;
|
|
832
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
833
|
+
return NULL;
|
|
834
|
+
}
|
|
835
|
+
EN_Project ph = (EN_Project) ptr;
|
|
836
|
+
|
|
837
|
+
int qualType, traceNode;
|
|
838
|
+
PyObject* err = PyLong_FromLong(EN_getqualtype(ph, &qualType, &traceNode));
|
|
839
|
+
PyObject* pyQualType = PyLong_FromLong(qualType);
|
|
840
|
+
PyObject* pyTraceNode = PyLong_FromLong(traceNode);
|
|
841
|
+
|
|
842
|
+
PyObject* r = PyTuple_Pack(3, err, pyQualType, pyTraceNode);
|
|
843
|
+
Py_DECREF(err);
|
|
844
|
+
Py_DECREF(pyQualType);
|
|
845
|
+
Py_DECREF(pyTraceNode);
|
|
846
|
+
|
|
847
|
+
return r;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
PyObject* method_EN_setqualtype(PyObject* self, PyObject* args)
|
|
851
|
+
{
|
|
852
|
+
uintptr_t ptr;
|
|
853
|
+
int qualType;
|
|
854
|
+
char* chemName = NULL;
|
|
855
|
+
char* chemUnits = NULL;
|
|
856
|
+
char* traceNode = NULL;
|
|
857
|
+
if(!PyArg_ParseTuple(args, "Kisss", &ptr, &qualType, &chemName, &chemUnits, &traceNode)) {
|
|
858
|
+
return NULL;
|
|
859
|
+
}
|
|
860
|
+
EN_Project ph = (EN_Project) ptr;
|
|
861
|
+
|
|
862
|
+
PyObject* err = PyLong_FromLong(EN_setqualtype(ph, qualType, chemName, chemUnits, traceNode));
|
|
863
|
+
|
|
864
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
865
|
+
Py_DECREF(err);
|
|
866
|
+
|
|
867
|
+
return r;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
PyObject* method_EN_addnode(PyObject* self, PyObject* args)
|
|
871
|
+
{
|
|
872
|
+
uintptr_t ptr;
|
|
873
|
+
char* id = NULL;
|
|
874
|
+
int nodeType;
|
|
875
|
+
if(!PyArg_ParseTuple(args, "Ksi", &ptr, &id, &nodeType)) {
|
|
876
|
+
return NULL;
|
|
877
|
+
}
|
|
878
|
+
EN_Project ph = (EN_Project) ptr;
|
|
879
|
+
|
|
880
|
+
int index;
|
|
881
|
+
PyObject* err = PyLong_FromLong(EN_addnode(ph, id, nodeType, &index));
|
|
882
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
883
|
+
|
|
884
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
885
|
+
Py_DECREF(err);
|
|
886
|
+
Py_DECREF(pyIndex);
|
|
887
|
+
|
|
888
|
+
return r;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
PyObject* method_EN_deletenode(PyObject* self, PyObject* args)
|
|
892
|
+
{
|
|
893
|
+
uintptr_t ptr;
|
|
894
|
+
int index, actionCode;
|
|
895
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &actionCode)) {
|
|
896
|
+
return NULL;
|
|
897
|
+
}
|
|
898
|
+
EN_Project ph = (EN_Project) ptr;
|
|
899
|
+
|
|
900
|
+
PyObject* err = PyLong_FromLong(EN_deletenode(ph, index, actionCode));
|
|
901
|
+
|
|
902
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
903
|
+
Py_DECREF(err);
|
|
904
|
+
|
|
905
|
+
return r;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
PyObject* method_EN_getnodeindex(PyObject* self, PyObject* args)
|
|
909
|
+
{
|
|
910
|
+
uintptr_t ptr;
|
|
911
|
+
char* id = NULL;
|
|
912
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &id)) {
|
|
913
|
+
return NULL;
|
|
914
|
+
}
|
|
915
|
+
EN_Project ph = (EN_Project) ptr;
|
|
916
|
+
|
|
917
|
+
int index;
|
|
918
|
+
PyObject* err = PyLong_FromLong(EN_getnodeindex(ph, id, &index));
|
|
919
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
920
|
+
|
|
921
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
922
|
+
Py_DECREF(err);
|
|
923
|
+
Py_DECREF(pyIndex);
|
|
924
|
+
|
|
925
|
+
return r;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
PyObject* method_EN_getnodeid(PyObject* self, PyObject* args)
|
|
929
|
+
{
|
|
930
|
+
uintptr_t ptr;
|
|
931
|
+
int index;
|
|
932
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
933
|
+
return NULL;
|
|
934
|
+
}
|
|
935
|
+
EN_Project ph = (EN_Project) ptr;
|
|
936
|
+
|
|
937
|
+
char out_id[MAXID + 1];
|
|
938
|
+
PyObject* err = PyLong_FromLong(EN_getnodeid(ph, index, &out_id[0]));
|
|
939
|
+
PyObject* pyOutId = PyUnicode_FromString(&out_id[0]);
|
|
940
|
+
|
|
941
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutId);
|
|
942
|
+
Py_DECREF(err);
|
|
943
|
+
Py_DECREF(pyOutId);
|
|
944
|
+
|
|
945
|
+
return r;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
PyObject* method_EN_setnodeid(PyObject* self, PyObject* args)
|
|
949
|
+
{
|
|
950
|
+
uintptr_t ptr;
|
|
951
|
+
int index;
|
|
952
|
+
char* newid = NULL;
|
|
953
|
+
if(!PyArg_ParseTuple(args, "Kis", &ptr, &index, &newid)) {
|
|
954
|
+
return NULL;
|
|
955
|
+
}
|
|
956
|
+
EN_Project ph = (EN_Project) ptr;
|
|
957
|
+
|
|
958
|
+
PyObject* err = PyLong_FromLong(EN_setnodeid(ph, index, newid));
|
|
959
|
+
|
|
960
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
961
|
+
Py_DECREF(err);
|
|
962
|
+
|
|
963
|
+
return r;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
PyObject* method_EN_getnodetype(PyObject* self, PyObject* args)
|
|
967
|
+
{
|
|
968
|
+
uintptr_t ptr;
|
|
969
|
+
int index;
|
|
970
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
971
|
+
return NULL;
|
|
972
|
+
}
|
|
973
|
+
EN_Project ph = (EN_Project) ptr;
|
|
974
|
+
|
|
975
|
+
int nodeType;
|
|
976
|
+
PyObject* err = PyLong_FromLong(EN_getnodetype(ph, index, &nodeType));
|
|
977
|
+
PyObject* pyNodeType = PyLong_FromLong(nodeType);
|
|
978
|
+
|
|
979
|
+
PyObject* r = PyTuple_Pack(2, err, pyNodeType);
|
|
980
|
+
Py_DECREF(err);
|
|
981
|
+
Py_DECREF(pyNodeType);
|
|
982
|
+
|
|
983
|
+
return r;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
PyObject* method_EN_getnodevalue(PyObject* self, PyObject* args)
|
|
987
|
+
{
|
|
988
|
+
uintptr_t ptr;
|
|
989
|
+
int index, property;
|
|
990
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &property)) {
|
|
991
|
+
return NULL;
|
|
992
|
+
}
|
|
993
|
+
EN_Project ph = (EN_Project) ptr;
|
|
994
|
+
|
|
995
|
+
double value;
|
|
996
|
+
PyObject* err = PyLong_FromLong(EN_getnodevalue(ph, index, property, &value));
|
|
997
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
998
|
+
|
|
999
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
1000
|
+
Py_DECREF(err);
|
|
1001
|
+
Py_DECREF(pyValue);
|
|
1002
|
+
|
|
1003
|
+
return r;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
PyObject* method_EN_setnodevalue(PyObject* self, PyObject* args)
|
|
1007
|
+
{
|
|
1008
|
+
uintptr_t ptr;
|
|
1009
|
+
int index, property;
|
|
1010
|
+
double value;
|
|
1011
|
+
if(!PyArg_ParseTuple(args, "Kiid", &ptr, &index, &property, &value)) {
|
|
1012
|
+
return NULL;
|
|
1013
|
+
}
|
|
1014
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1015
|
+
|
|
1016
|
+
PyObject* err = PyLong_FromLong(EN_setnodevalue(ph, index, property, value));
|
|
1017
|
+
|
|
1018
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1019
|
+
Py_DECREF(err);
|
|
1020
|
+
|
|
1021
|
+
return r;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
PyObject* method_EN_setjuncdata(PyObject* self, PyObject* args)
|
|
1025
|
+
{
|
|
1026
|
+
uintptr_t ptr;
|
|
1027
|
+
int index;
|
|
1028
|
+
double elev, dmnd;
|
|
1029
|
+
char* dmndpat = NULL;
|
|
1030
|
+
if(!PyArg_ParseTuple(args, "Kidds", &ptr, &index, &elev, &dmnd, &dmndpat)) {
|
|
1031
|
+
return NULL;
|
|
1032
|
+
}
|
|
1033
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1034
|
+
|
|
1035
|
+
PyObject* err = PyLong_FromLong(EN_setjuncdata(ph, index, elev, dmnd, dmndpat));
|
|
1036
|
+
|
|
1037
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1038
|
+
Py_DECREF(err);
|
|
1039
|
+
|
|
1040
|
+
return r;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
PyObject* method_EN_settankdata(PyObject* self, PyObject* args)
|
|
1044
|
+
{
|
|
1045
|
+
uintptr_t ptr;
|
|
1046
|
+
int index;
|
|
1047
|
+
double elev, initlvl, minlvl, maxlvl, diam, minvol;
|
|
1048
|
+
char* volcurve = NULL;
|
|
1049
|
+
if(!PyArg_ParseTuple(args, "Kidddddds", &ptr, &index, &elev, &initlvl, &minlvl, &maxlvl, &diam, &minvol, &volcurve)) {
|
|
1050
|
+
return NULL;
|
|
1051
|
+
}
|
|
1052
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1053
|
+
|
|
1054
|
+
PyObject* err = PyLong_FromLong(EN_settankdata(ph, index, elev, initlvl, minlvl, maxlvl, diam, minvol, volcurve));
|
|
1055
|
+
|
|
1056
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1057
|
+
Py_DECREF(err);
|
|
1058
|
+
|
|
1059
|
+
return r;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
PyObject* method_EN_getcoord(PyObject* self, PyObject* args)
|
|
1063
|
+
{
|
|
1064
|
+
uintptr_t ptr;
|
|
1065
|
+
int index;
|
|
1066
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1067
|
+
return NULL;
|
|
1068
|
+
}
|
|
1069
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1070
|
+
|
|
1071
|
+
double x, y;
|
|
1072
|
+
PyObject* err = PyLong_FromLong(EN_getcoord(ph, index, &x, &y));
|
|
1073
|
+
PyObject* pyX = PyFloat_FromDouble(x);
|
|
1074
|
+
PyObject* pyY = PyFloat_FromDouble(y);
|
|
1075
|
+
|
|
1076
|
+
PyObject* r = PyTuple_Pack(3, err, pyX, pyY);
|
|
1077
|
+
Py_DECREF(err);
|
|
1078
|
+
Py_DECREF(pyX);
|
|
1079
|
+
Py_DECREF(pyY);
|
|
1080
|
+
|
|
1081
|
+
return r;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
PyObject* method_EN_setcoord(PyObject* self, PyObject* args)
|
|
1085
|
+
{
|
|
1086
|
+
uintptr_t ptr;
|
|
1087
|
+
int index;
|
|
1088
|
+
double x, y;
|
|
1089
|
+
if(!PyArg_ParseTuple(args, "Kidd", &ptr, &index, &x, &y)) {
|
|
1090
|
+
return NULL;
|
|
1091
|
+
}
|
|
1092
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1093
|
+
|
|
1094
|
+
PyObject* err = PyLong_FromLong(EN_setcoord(ph, index, x, y));
|
|
1095
|
+
|
|
1096
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1097
|
+
Py_DECREF(err);
|
|
1098
|
+
|
|
1099
|
+
return r;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
PyObject* method_EN_getdemandmodel(PyObject* self, PyObject* args)
|
|
1103
|
+
{
|
|
1104
|
+
uintptr_t ptr;
|
|
1105
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
1106
|
+
return NULL;
|
|
1107
|
+
}
|
|
1108
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1109
|
+
|
|
1110
|
+
int type;
|
|
1111
|
+
double pmin, preq, pexp;
|
|
1112
|
+
PyObject* err = PyLong_FromLong(EN_getdemandmodel(ph, &type, &pmin, &preq, &pexp));
|
|
1113
|
+
PyObject* pyType = PyLong_FromLong(type);
|
|
1114
|
+
PyObject* pyPMin = PyFloat_FromDouble(pmin);
|
|
1115
|
+
PyObject* pyPReq = PyFloat_FromDouble(preq);
|
|
1116
|
+
PyObject* pyPExp = PyFloat_FromDouble(pexp);
|
|
1117
|
+
|
|
1118
|
+
PyObject* r = PyTuple_Pack(5, err, pyType, pyPMin, pyPReq, pyPExp);
|
|
1119
|
+
Py_DECREF(err);
|
|
1120
|
+
Py_DECREF(pyType);
|
|
1121
|
+
Py_DECREF(pyPMin);
|
|
1122
|
+
Py_DECREF(pyPReq);
|
|
1123
|
+
Py_DECREF(pyPExp);
|
|
1124
|
+
|
|
1125
|
+
return r;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
PyObject* method_EN_setdemandmodel(PyObject* self, PyObject* args)
|
|
1129
|
+
{
|
|
1130
|
+
uintptr_t ptr;
|
|
1131
|
+
int type;
|
|
1132
|
+
double pmin, preq, pexp;
|
|
1133
|
+
if(!PyArg_ParseTuple(args, "Kiddd", &ptr, &type, &pmin, &preq, &pexp)) {
|
|
1134
|
+
return NULL;
|
|
1135
|
+
}
|
|
1136
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1137
|
+
|
|
1138
|
+
PyObject* err = PyLong_FromLong(EN_setdemandmodel(ph, type, pmin, preq, pexp));
|
|
1139
|
+
|
|
1140
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1141
|
+
Py_DECREF(err);
|
|
1142
|
+
|
|
1143
|
+
return r;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
PyObject* method_EN_adddemand(PyObject* self, PyObject* args)
|
|
1147
|
+
{
|
|
1148
|
+
uintptr_t ptr;
|
|
1149
|
+
int nodeIndex;
|
|
1150
|
+
double baseDemand;
|
|
1151
|
+
char* demandPattern = NULL;
|
|
1152
|
+
char* demandName = NULL;
|
|
1153
|
+
if(!PyArg_ParseTuple(args, "Kidss", &ptr, &nodeIndex, &baseDemand, &demandPattern, &demandName)) {
|
|
1154
|
+
return NULL;
|
|
1155
|
+
}
|
|
1156
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1157
|
+
|
|
1158
|
+
PyObject* err = PyLong_FromLong(EN_adddemand(ph, nodeIndex, baseDemand, demandPattern, demandName));
|
|
1159
|
+
|
|
1160
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1161
|
+
Py_DECREF(err);
|
|
1162
|
+
|
|
1163
|
+
return r;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
PyObject* method_EN_deletedemand(PyObject* self, PyObject* args)
|
|
1167
|
+
{
|
|
1168
|
+
uintptr_t ptr;
|
|
1169
|
+
int nodeIndex, demandIndex;
|
|
1170
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &nodeIndex, &demandIndex)) {
|
|
1171
|
+
return NULL;
|
|
1172
|
+
}
|
|
1173
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1174
|
+
|
|
1175
|
+
PyObject* err = PyLong_FromLong(EN_deletedemand(ph, nodeIndex, demandIndex));
|
|
1176
|
+
|
|
1177
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1178
|
+
Py_DECREF(err);
|
|
1179
|
+
|
|
1180
|
+
return r;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
PyObject* method_EN_getdemandindex(PyObject* self, PyObject* args)
|
|
1184
|
+
{
|
|
1185
|
+
uintptr_t ptr;
|
|
1186
|
+
int nodeIndex;
|
|
1187
|
+
char* demandName = NULL;
|
|
1188
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &nodeIndex, &demandName)) {
|
|
1189
|
+
return NULL;
|
|
1190
|
+
}
|
|
1191
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1192
|
+
|
|
1193
|
+
int demandIndex;
|
|
1194
|
+
PyObject* err = PyLong_FromLong(EN_getdemandindex(ph, nodeIndex, demandName, &demandIndex));
|
|
1195
|
+
PyObject* pyDemandIndex = PyLong_FromLong(demandIndex);
|
|
1196
|
+
|
|
1197
|
+
PyObject* r = PyTuple_Pack(2, err, pyDemandIndex);
|
|
1198
|
+
Py_DECREF(err);
|
|
1199
|
+
Py_DECREF(pyDemandIndex);
|
|
1200
|
+
|
|
1201
|
+
return r;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
PyObject* method_EN_getnumdemands(PyObject* self, PyObject* args)
|
|
1205
|
+
{
|
|
1206
|
+
uintptr_t ptr;
|
|
1207
|
+
int nodeIndex;
|
|
1208
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &nodeIndex)) {
|
|
1209
|
+
return NULL;
|
|
1210
|
+
}
|
|
1211
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1212
|
+
|
|
1213
|
+
int numDemands;
|
|
1214
|
+
PyObject* err = PyLong_FromLong(EN_getnumdemands(ph, nodeIndex, &numDemands));
|
|
1215
|
+
PyObject* pyNumDemands = PyLong_FromLong(numDemands);
|
|
1216
|
+
|
|
1217
|
+
PyObject* r = PyTuple_Pack(2, err, pyNumDemands);
|
|
1218
|
+
Py_DECREF(err);
|
|
1219
|
+
Py_DECREF(pyNumDemands);
|
|
1220
|
+
|
|
1221
|
+
return r;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
PyObject* method_EN_getbasedemand(PyObject* self, PyObject* args)
|
|
1225
|
+
{
|
|
1226
|
+
uintptr_t ptr;
|
|
1227
|
+
int nodeIndex, demandIndex;
|
|
1228
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &nodeIndex, &demandIndex)) {
|
|
1229
|
+
return NULL;
|
|
1230
|
+
}
|
|
1231
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1232
|
+
|
|
1233
|
+
double baseDemand;
|
|
1234
|
+
PyObject* err = PyLong_FromLong(EN_getbasedemand(ph, nodeIndex, demandIndex, &baseDemand));
|
|
1235
|
+
PyObject* pyBaseDemand = PyFloat_FromDouble(baseDemand);
|
|
1236
|
+
|
|
1237
|
+
PyObject* r = PyTuple_Pack(2, err, pyBaseDemand);
|
|
1238
|
+
Py_DECREF(err);
|
|
1239
|
+
Py_DECREF(pyBaseDemand);
|
|
1240
|
+
|
|
1241
|
+
return r;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
PyObject* method_EN_setbasedemand(PyObject* self, PyObject* args)
|
|
1245
|
+
{
|
|
1246
|
+
uintptr_t ptr;
|
|
1247
|
+
int nodeIndex, demandIndex;
|
|
1248
|
+
double baseDemand;
|
|
1249
|
+
if(!PyArg_ParseTuple(args, "Kiid", &ptr, &nodeIndex, &demandIndex, &baseDemand)) {
|
|
1250
|
+
return NULL;
|
|
1251
|
+
}
|
|
1252
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1253
|
+
|
|
1254
|
+
PyObject* err = PyLong_FromLong(EN_setbasedemand(ph, nodeIndex, demandIndex, baseDemand));
|
|
1255
|
+
|
|
1256
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1257
|
+
Py_DECREF(err);
|
|
1258
|
+
|
|
1259
|
+
return r;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
PyObject* method_EN_getdemandpattern(PyObject* self, PyObject* args)
|
|
1263
|
+
{
|
|
1264
|
+
uintptr_t ptr;
|
|
1265
|
+
int nodeIndex, demandIndex;
|
|
1266
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &nodeIndex, &demandIndex)) {
|
|
1267
|
+
return NULL;
|
|
1268
|
+
}
|
|
1269
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1270
|
+
|
|
1271
|
+
int patIndex;
|
|
1272
|
+
PyObject* err = PyLong_FromLong(EN_getdemandpattern(ph, nodeIndex, demandIndex, &patIndex));
|
|
1273
|
+
PyObject* pyPatIndex = PyLong_FromLong(patIndex);
|
|
1274
|
+
|
|
1275
|
+
PyObject* r = PyTuple_Pack(2, err, pyPatIndex);
|
|
1276
|
+
Py_DECREF(err);
|
|
1277
|
+
Py_DECREF(pyPatIndex);
|
|
1278
|
+
|
|
1279
|
+
return r;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
PyObject* method_EN_setdemandpattern(PyObject* self, PyObject* args)
|
|
1283
|
+
{
|
|
1284
|
+
uintptr_t ptr;
|
|
1285
|
+
int nodeIndex, demandIndex, patIndex;
|
|
1286
|
+
if(!PyArg_ParseTuple(args, "Kiii", &ptr, &nodeIndex, &demandIndex, &patIndex)) {
|
|
1287
|
+
return NULL;
|
|
1288
|
+
}
|
|
1289
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1290
|
+
|
|
1291
|
+
PyObject* err = PyLong_FromLong(EN_setdemandpattern(ph, nodeIndex, demandIndex, patIndex));
|
|
1292
|
+
|
|
1293
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1294
|
+
Py_DECREF(err);
|
|
1295
|
+
|
|
1296
|
+
return r;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
PyObject* method_EN_getdemandname(PyObject* self, PyObject* args)
|
|
1300
|
+
{
|
|
1301
|
+
uintptr_t ptr;
|
|
1302
|
+
int nodeIndex, demandIndex;
|
|
1303
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &nodeIndex, &demandIndex)) {
|
|
1304
|
+
return NULL;
|
|
1305
|
+
}
|
|
1306
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1307
|
+
|
|
1308
|
+
char out_demandName[MAXID + 1];
|
|
1309
|
+
PyObject* err = PyLong_FromLong(EN_getdemandname(ph, nodeIndex, demandIndex, &out_demandName[0]));
|
|
1310
|
+
PyObject* pyOutDemandName = PyUnicode_FromString(&out_demandName[0]);
|
|
1311
|
+
|
|
1312
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutDemandName);
|
|
1313
|
+
Py_DECREF(err);
|
|
1314
|
+
Py_DECREF(pyOutDemandName);
|
|
1315
|
+
|
|
1316
|
+
return r;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
PyObject* method_EN_setdemandname(PyObject* self, PyObject* args)
|
|
1320
|
+
{
|
|
1321
|
+
uintptr_t ptr;
|
|
1322
|
+
int nodeIndex, demandIndex;
|
|
1323
|
+
char* demandName = NULL;
|
|
1324
|
+
if(!PyArg_ParseTuple(args, "Kiis", &ptr, &nodeIndex, &demandIndex, &demandName)) {
|
|
1325
|
+
return NULL;
|
|
1326
|
+
}
|
|
1327
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1328
|
+
|
|
1329
|
+
PyObject* err = PyLong_FromLong(EN_setdemandname(ph, nodeIndex, demandIndex, demandName));
|
|
1330
|
+
|
|
1331
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1332
|
+
Py_DECREF(err);
|
|
1333
|
+
|
|
1334
|
+
return r;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
PyObject* method_EN_addlink(PyObject* self, PyObject* args)
|
|
1338
|
+
{
|
|
1339
|
+
uintptr_t ptr;
|
|
1340
|
+
char* id = NULL;
|
|
1341
|
+
int linkType;
|
|
1342
|
+
char* fromNode = NULL;
|
|
1343
|
+
char* toNode = NULL;
|
|
1344
|
+
if(!PyArg_ParseTuple(args, "Ksiss", &ptr, &id, &linkType, &fromNode, &toNode)) {
|
|
1345
|
+
return NULL;
|
|
1346
|
+
}
|
|
1347
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1348
|
+
|
|
1349
|
+
int index;
|
|
1350
|
+
PyObject* err = PyLong_FromLong(EN_addlink(ph, id, linkType, fromNode, toNode, &index));
|
|
1351
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
1352
|
+
|
|
1353
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
1354
|
+
Py_DECREF(err);
|
|
1355
|
+
Py_DECREF(pyIndex);
|
|
1356
|
+
|
|
1357
|
+
return r;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
PyObject* method_EN_deletelink(PyObject* self, PyObject* args)
|
|
1361
|
+
{
|
|
1362
|
+
uintptr_t ptr;
|
|
1363
|
+
int index, actionCode;
|
|
1364
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &actionCode)) {
|
|
1365
|
+
return NULL;
|
|
1366
|
+
}
|
|
1367
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1368
|
+
|
|
1369
|
+
PyObject* err = PyLong_FromLong(EN_deletelink(ph, index, actionCode));
|
|
1370
|
+
|
|
1371
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1372
|
+
Py_DECREF(err);
|
|
1373
|
+
|
|
1374
|
+
return r;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
PyObject* method_EN_getlinkindex(PyObject* self, PyObject* args)
|
|
1378
|
+
{
|
|
1379
|
+
uintptr_t ptr;
|
|
1380
|
+
char* id = NULL;
|
|
1381
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &id)) {
|
|
1382
|
+
return NULL;
|
|
1383
|
+
}
|
|
1384
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1385
|
+
|
|
1386
|
+
int index;
|
|
1387
|
+
PyObject* err = PyLong_FromLong(EN_getlinkindex(ph, id, &index));
|
|
1388
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
1389
|
+
|
|
1390
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
1391
|
+
Py_DECREF(err);
|
|
1392
|
+
Py_DECREF(pyIndex);
|
|
1393
|
+
|
|
1394
|
+
return r;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
PyObject* method_EN_getlinkid(PyObject* self, PyObject* args)
|
|
1398
|
+
{
|
|
1399
|
+
uintptr_t ptr;
|
|
1400
|
+
int index;
|
|
1401
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1402
|
+
return NULL;
|
|
1403
|
+
}
|
|
1404
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1405
|
+
|
|
1406
|
+
char out_id[MAXID + 1];
|
|
1407
|
+
PyObject* err = PyLong_FromLong(EN_getlinkid(ph, index, &out_id[0]));
|
|
1408
|
+
PyObject* pyOutId = PyUnicode_FromString(&out_id[0]);
|
|
1409
|
+
|
|
1410
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutId);
|
|
1411
|
+
Py_DECREF(err);
|
|
1412
|
+
Py_DECREF(pyOutId);
|
|
1413
|
+
|
|
1414
|
+
return r;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
PyObject* method_EN_setlinkid(PyObject* self, PyObject* args)
|
|
1418
|
+
{
|
|
1419
|
+
uintptr_t ptr;
|
|
1420
|
+
int index;
|
|
1421
|
+
char* newid = NULL;
|
|
1422
|
+
if(!PyArg_ParseTuple(args, "Kis", &ptr, &index, &newid)) {
|
|
1423
|
+
return NULL;
|
|
1424
|
+
}
|
|
1425
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1426
|
+
|
|
1427
|
+
PyObject* err = PyLong_FromLong(EN_setlinkid(ph, index, newid));
|
|
1428
|
+
|
|
1429
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1430
|
+
Py_DECREF(err);
|
|
1431
|
+
|
|
1432
|
+
return r;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
PyObject* method_EN_getlinktype(PyObject* self, PyObject* args)
|
|
1436
|
+
{
|
|
1437
|
+
uintptr_t ptr;
|
|
1438
|
+
int index;
|
|
1439
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1440
|
+
return NULL;
|
|
1441
|
+
}
|
|
1442
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1443
|
+
|
|
1444
|
+
int linkType;
|
|
1445
|
+
PyObject* err = PyLong_FromLong(EN_getlinktype(ph, index, &linkType));
|
|
1446
|
+
PyObject* pyLinkType = PyLong_FromLong(linkType);
|
|
1447
|
+
|
|
1448
|
+
PyObject* r = PyTuple_Pack(2, err, pyLinkType);
|
|
1449
|
+
Py_DECREF(err);
|
|
1450
|
+
Py_DECREF(pyLinkType);
|
|
1451
|
+
|
|
1452
|
+
return r;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
PyObject* method_EN_setlinktype(PyObject* self, PyObject* args)
|
|
1456
|
+
{
|
|
1457
|
+
uintptr_t ptr;
|
|
1458
|
+
int inout_index, linkType, actionCode;
|
|
1459
|
+
if(!PyArg_ParseTuple(args, "Kiii", &ptr, &inout_index, &linkType, &actionCode)) {
|
|
1460
|
+
return NULL;
|
|
1461
|
+
}
|
|
1462
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1463
|
+
|
|
1464
|
+
PyObject* err = PyLong_FromLong(EN_setlinktype(ph, &inout_index, linkType, actionCode));
|
|
1465
|
+
PyObject* pyInoutIndex = PyLong_FromLong(inout_index);
|
|
1466
|
+
|
|
1467
|
+
PyObject* r = PyTuple_Pack(2, err, pyInoutIndex);
|
|
1468
|
+
Py_DECREF(err);
|
|
1469
|
+
Py_DECREF(pyInoutIndex);
|
|
1470
|
+
|
|
1471
|
+
return r;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
PyObject* method_EN_getlinknodes(PyObject* self, PyObject* args)
|
|
1475
|
+
{
|
|
1476
|
+
uintptr_t ptr;
|
|
1477
|
+
int index;
|
|
1478
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1479
|
+
return NULL;
|
|
1480
|
+
}
|
|
1481
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1482
|
+
|
|
1483
|
+
int node1, node2;
|
|
1484
|
+
PyObject* err = PyLong_FromLong(EN_getlinknodes(ph, index, &node1, &node2));
|
|
1485
|
+
PyObject* pyNode1 = PyLong_FromLong(node1);
|
|
1486
|
+
PyObject* pyNode2 = PyLong_FromLong(node2);
|
|
1487
|
+
|
|
1488
|
+
PyObject* r = PyTuple_Pack(3, err, pyNode1, pyNode2);
|
|
1489
|
+
Py_DECREF(err);
|
|
1490
|
+
Py_DECREF(pyNode1);
|
|
1491
|
+
Py_DECREF(pyNode2);
|
|
1492
|
+
|
|
1493
|
+
return r;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
PyObject* method_EN_setlinknodes(PyObject* self, PyObject* args)
|
|
1497
|
+
{
|
|
1498
|
+
uintptr_t ptr;
|
|
1499
|
+
int index, node1, node2;
|
|
1500
|
+
if(!PyArg_ParseTuple(args, "Kiii", &ptr, &index, &node1, &node2)) {
|
|
1501
|
+
return NULL;
|
|
1502
|
+
}
|
|
1503
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1504
|
+
|
|
1505
|
+
PyObject* err = PyLong_FromLong(EN_setlinknodes(ph, index, node1, node2));
|
|
1506
|
+
|
|
1507
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1508
|
+
Py_DECREF(err);
|
|
1509
|
+
|
|
1510
|
+
return r;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
PyObject* method_EN_getlinkvalue(PyObject* self, PyObject* args)
|
|
1514
|
+
{
|
|
1515
|
+
uintptr_t ptr;
|
|
1516
|
+
int index, property;
|
|
1517
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &property)) {
|
|
1518
|
+
return NULL;
|
|
1519
|
+
}
|
|
1520
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1521
|
+
|
|
1522
|
+
double value;
|
|
1523
|
+
PyObject* err = PyLong_FromLong(EN_getlinkvalue(ph, index, property, &value));
|
|
1524
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
1525
|
+
|
|
1526
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
1527
|
+
Py_DECREF(err);
|
|
1528
|
+
Py_DECREF(pyValue);
|
|
1529
|
+
|
|
1530
|
+
return r;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
PyObject* method_EN_setlinkvalue(PyObject* self, PyObject* args)
|
|
1534
|
+
{
|
|
1535
|
+
uintptr_t ptr;
|
|
1536
|
+
int index, property;
|
|
1537
|
+
double value;
|
|
1538
|
+
if(!PyArg_ParseTuple(args, "Kiid", &ptr, &index, &property, &value)) {
|
|
1539
|
+
return NULL;
|
|
1540
|
+
}
|
|
1541
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1542
|
+
|
|
1543
|
+
PyObject* err = PyLong_FromLong(EN_setlinkvalue(ph, index, property, value));
|
|
1544
|
+
|
|
1545
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1546
|
+
Py_DECREF(err);
|
|
1547
|
+
|
|
1548
|
+
return r;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
PyObject* method_EN_setpipedata(PyObject* self, PyObject* args)
|
|
1552
|
+
{
|
|
1553
|
+
uintptr_t ptr;
|
|
1554
|
+
int index;
|
|
1555
|
+
double length, diam, rough, mloss;
|
|
1556
|
+
if(!PyArg_ParseTuple(args, "Kidddd", &ptr, &index, &length, &diam, &rough, &mloss)) {
|
|
1557
|
+
return NULL;
|
|
1558
|
+
}
|
|
1559
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1560
|
+
|
|
1561
|
+
PyObject* err = PyLong_FromLong(EN_setpipedata(ph, index, length, diam, rough, mloss));
|
|
1562
|
+
|
|
1563
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1564
|
+
Py_DECREF(err);
|
|
1565
|
+
|
|
1566
|
+
return r;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
PyObject* method_EN_getvertexcount(PyObject* self, PyObject* args)
|
|
1570
|
+
{
|
|
1571
|
+
uintptr_t ptr;
|
|
1572
|
+
int index;
|
|
1573
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1574
|
+
return NULL;
|
|
1575
|
+
}
|
|
1576
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1577
|
+
|
|
1578
|
+
int count;
|
|
1579
|
+
PyObject* err = PyLong_FromLong(EN_getvertexcount(ph, index, &count));
|
|
1580
|
+
PyObject* pyCount = PyLong_FromLong(count);
|
|
1581
|
+
|
|
1582
|
+
PyObject* r = PyTuple_Pack(2, err, pyCount);
|
|
1583
|
+
Py_DECREF(err);
|
|
1584
|
+
Py_DECREF(pyCount);
|
|
1585
|
+
|
|
1586
|
+
return r;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
PyObject* method_EN_getvertex(PyObject* self, PyObject* args)
|
|
1590
|
+
{
|
|
1591
|
+
uintptr_t ptr;
|
|
1592
|
+
int index, vertex;
|
|
1593
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &vertex)) {
|
|
1594
|
+
return NULL;
|
|
1595
|
+
}
|
|
1596
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1597
|
+
|
|
1598
|
+
double x, y;
|
|
1599
|
+
PyObject* err = PyLong_FromLong(EN_getvertex(ph, index, vertex, &x, &y));
|
|
1600
|
+
PyObject* pyX = PyFloat_FromDouble(x);
|
|
1601
|
+
PyObject* pyY = PyFloat_FromDouble(y);
|
|
1602
|
+
|
|
1603
|
+
PyObject* r = PyTuple_Pack(3, err, pyX, pyY);
|
|
1604
|
+
Py_DECREF(err);
|
|
1605
|
+
Py_DECREF(pyX);
|
|
1606
|
+
Py_DECREF(pyY);
|
|
1607
|
+
|
|
1608
|
+
return r;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
PyObject* method_EN_setvertices(PyObject* self, PyObject* args)
|
|
1612
|
+
{
|
|
1613
|
+
uintptr_t ptr;
|
|
1614
|
+
int index;
|
|
1615
|
+
double* x = NULL;
|
|
1616
|
+
double* y = NULL;
|
|
1617
|
+
int count;
|
|
1618
|
+
if(!PyArg_ParseTuple(args, "KiOOi", &ptr, &index, &x, &y, &count)) {
|
|
1619
|
+
return NULL;
|
|
1620
|
+
}
|
|
1621
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1622
|
+
|
|
1623
|
+
double* xRaw = (double*) malloc(sizeof(double) * count);
|
|
1624
|
+
double* yRaw = (double*) malloc(sizeof(double) * count);
|
|
1625
|
+
|
|
1626
|
+
for(int i=0; i != count; i++) {
|
|
1627
|
+
xRaw[i] = PyFloat_AsDouble(PyList_GET_ITEM(x, i));
|
|
1628
|
+
yRaw[i] = PyFloat_AsDouble(PyList_GET_ITEM(y, i));
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
PyObject* err = PyLong_FromLong(EN_setvertices(ph, index, xRaw, yRaw, count));
|
|
1632
|
+
free(xRaw);
|
|
1633
|
+
free(yRaw);
|
|
1634
|
+
|
|
1635
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1636
|
+
Py_DECREF(err);
|
|
1637
|
+
|
|
1638
|
+
return r;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
PyObject* method_EN_getpumptype(PyObject* self, PyObject* args)
|
|
1642
|
+
{
|
|
1643
|
+
uintptr_t ptr;
|
|
1644
|
+
int linkIndex;
|
|
1645
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &linkIndex)) {
|
|
1646
|
+
return NULL;
|
|
1647
|
+
}
|
|
1648
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1649
|
+
|
|
1650
|
+
int pumpType;
|
|
1651
|
+
PyObject* err = PyLong_FromLong(EN_getpumptype(ph, linkIndex, &pumpType));
|
|
1652
|
+
PyObject* pyPumpType = PyLong_FromLong(pumpType);
|
|
1653
|
+
|
|
1654
|
+
PyObject* r = PyTuple_Pack(2, err, pyPumpType);
|
|
1655
|
+
Py_DECREF(err);
|
|
1656
|
+
Py_DECREF(pyPumpType);
|
|
1657
|
+
|
|
1658
|
+
return r;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
PyObject* method_EN_getheadcurveindex(PyObject* self, PyObject* args)
|
|
1662
|
+
{
|
|
1663
|
+
uintptr_t ptr;
|
|
1664
|
+
int linkIndex;
|
|
1665
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &linkIndex)) {
|
|
1666
|
+
return NULL;
|
|
1667
|
+
}
|
|
1668
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1669
|
+
|
|
1670
|
+
int curveIndex;
|
|
1671
|
+
PyObject* err = PyLong_FromLong(EN_getheadcurveindex(ph, linkIndex, &curveIndex));
|
|
1672
|
+
PyObject* pyCurveIndex = PyLong_FromLong(curveIndex);
|
|
1673
|
+
|
|
1674
|
+
PyObject* r = PyTuple_Pack(2, err, pyCurveIndex);
|
|
1675
|
+
Py_DECREF(err);
|
|
1676
|
+
Py_DECREF(pyCurveIndex);
|
|
1677
|
+
|
|
1678
|
+
return r;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
PyObject* method_EN_setheadcurveindex(PyObject* self, PyObject* args)
|
|
1682
|
+
{
|
|
1683
|
+
uintptr_t ptr;
|
|
1684
|
+
int linkIndex, curveIndex;
|
|
1685
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &linkIndex, &curveIndex)) {
|
|
1686
|
+
return NULL;
|
|
1687
|
+
}
|
|
1688
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1689
|
+
|
|
1690
|
+
PyObject* err = PyLong_FromLong(EN_setheadcurveindex(ph, linkIndex, curveIndex));
|
|
1691
|
+
|
|
1692
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1693
|
+
Py_DECREF(err);
|
|
1694
|
+
|
|
1695
|
+
return r;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
PyObject* method_EN_addpattern(PyObject* self, PyObject* args)
|
|
1699
|
+
{
|
|
1700
|
+
uintptr_t ptr;
|
|
1701
|
+
char* id = NULL;
|
|
1702
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &id)) {
|
|
1703
|
+
return NULL;
|
|
1704
|
+
}
|
|
1705
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1706
|
+
|
|
1707
|
+
PyObject* err = PyLong_FromLong(EN_addpattern(ph, id));
|
|
1708
|
+
|
|
1709
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1710
|
+
Py_DECREF(err);
|
|
1711
|
+
|
|
1712
|
+
return r;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
PyObject* method_EN_deletepattern(PyObject* self, PyObject* args)
|
|
1716
|
+
{
|
|
1717
|
+
uintptr_t ptr;
|
|
1718
|
+
int index;
|
|
1719
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1720
|
+
return NULL;
|
|
1721
|
+
}
|
|
1722
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1723
|
+
|
|
1724
|
+
PyObject* err = PyLong_FromLong(EN_deletepattern(ph, index));
|
|
1725
|
+
|
|
1726
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1727
|
+
Py_DECREF(err);
|
|
1728
|
+
|
|
1729
|
+
return r;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
PyObject* method_EN_getpatternindex(PyObject* self, PyObject* args)
|
|
1733
|
+
{
|
|
1734
|
+
uintptr_t ptr;
|
|
1735
|
+
char* id = NULL;
|
|
1736
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &id)) {
|
|
1737
|
+
return NULL;
|
|
1738
|
+
}
|
|
1739
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1740
|
+
|
|
1741
|
+
int index;
|
|
1742
|
+
PyObject* err = PyLong_FromLong(EN_getpatternindex(ph, id, &index));
|
|
1743
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
1744
|
+
|
|
1745
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
1746
|
+
Py_DECREF(err);
|
|
1747
|
+
Py_DECREF(pyIndex);
|
|
1748
|
+
|
|
1749
|
+
return r;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
PyObject* method_EN_getpatternid(PyObject* self, PyObject* args)
|
|
1753
|
+
{
|
|
1754
|
+
uintptr_t ptr;
|
|
1755
|
+
int index;
|
|
1756
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1757
|
+
return NULL;
|
|
1758
|
+
}
|
|
1759
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1760
|
+
|
|
1761
|
+
char out_id[MAXID + 1];
|
|
1762
|
+
PyObject* err = PyLong_FromLong(EN_getpatternid(ph, index, &out_id[0]));
|
|
1763
|
+
PyObject* pyOutId = PyUnicode_FromString(&out_id[0]);
|
|
1764
|
+
|
|
1765
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutId);
|
|
1766
|
+
Py_DECREF(err);
|
|
1767
|
+
Py_DECREF(pyOutId);
|
|
1768
|
+
|
|
1769
|
+
return r;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
PyObject* method_EN_setpatternid(PyObject* self, PyObject* args)
|
|
1773
|
+
{
|
|
1774
|
+
uintptr_t ptr;
|
|
1775
|
+
int index;
|
|
1776
|
+
char* id = NULL;
|
|
1777
|
+
if(!PyArg_ParseTuple(args, "Kis", &ptr, &index, &id)) {
|
|
1778
|
+
return NULL;
|
|
1779
|
+
}
|
|
1780
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1781
|
+
|
|
1782
|
+
PyObject* err = PyLong_FromLong(EN_setpatternid(ph, index, id));
|
|
1783
|
+
|
|
1784
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1785
|
+
Py_DECREF(err);
|
|
1786
|
+
|
|
1787
|
+
return r;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
PyObject* method_EN_getpatternlen(PyObject* self, PyObject* args)
|
|
1791
|
+
{
|
|
1792
|
+
uintptr_t ptr;
|
|
1793
|
+
int index;
|
|
1794
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1795
|
+
return NULL;
|
|
1796
|
+
}
|
|
1797
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1798
|
+
|
|
1799
|
+
int len;
|
|
1800
|
+
PyObject* err = PyLong_FromLong(EN_getpatternlen(ph, index, &len));
|
|
1801
|
+
PyObject* pyLen = PyLong_FromLong(len);
|
|
1802
|
+
|
|
1803
|
+
PyObject* r = PyTuple_Pack(2, err, pyLen);
|
|
1804
|
+
Py_DECREF(err);
|
|
1805
|
+
Py_DECREF(pyLen);
|
|
1806
|
+
|
|
1807
|
+
return r;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
PyObject* method_EN_getpatternvalue(PyObject* self, PyObject* args)
|
|
1811
|
+
{
|
|
1812
|
+
uintptr_t ptr;
|
|
1813
|
+
int index, period;
|
|
1814
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &period)) {
|
|
1815
|
+
return NULL;
|
|
1816
|
+
}
|
|
1817
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1818
|
+
|
|
1819
|
+
double value;
|
|
1820
|
+
PyObject* err = PyLong_FromLong(EN_getpatternvalue(ph, index, period, &value));
|
|
1821
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
1822
|
+
|
|
1823
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
1824
|
+
Py_DECREF(err);
|
|
1825
|
+
Py_DECREF(pyValue);
|
|
1826
|
+
|
|
1827
|
+
return r;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
PyObject* method_EN_setpatternvalue(PyObject* self, PyObject* args)
|
|
1831
|
+
{
|
|
1832
|
+
uintptr_t ptr;
|
|
1833
|
+
int index, period;
|
|
1834
|
+
double value;
|
|
1835
|
+
if(!PyArg_ParseTuple(args, "Kiid", &ptr, &index, &period, &value)) {
|
|
1836
|
+
return NULL;
|
|
1837
|
+
}
|
|
1838
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1839
|
+
|
|
1840
|
+
PyObject* err = PyLong_FromLong(EN_setpatternvalue(ph, index, period, value));
|
|
1841
|
+
|
|
1842
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1843
|
+
Py_DECREF(err);
|
|
1844
|
+
|
|
1845
|
+
return r;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
PyObject* method_EN_getaveragepatternvalue(PyObject* self, PyObject* args)
|
|
1849
|
+
{
|
|
1850
|
+
uintptr_t ptr;
|
|
1851
|
+
int index;
|
|
1852
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1853
|
+
return NULL;
|
|
1854
|
+
}
|
|
1855
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1856
|
+
|
|
1857
|
+
double value;
|
|
1858
|
+
PyObject* err = PyLong_FromLong(EN_getaveragepatternvalue(ph, index, &value));
|
|
1859
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
1860
|
+
|
|
1861
|
+
PyObject* r = PyTuple_Pack(2, err, pyValue);
|
|
1862
|
+
Py_DECREF(err);
|
|
1863
|
+
Py_DECREF(pyValue);
|
|
1864
|
+
|
|
1865
|
+
return r;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
PyObject* method_EN_setpattern(PyObject* self, PyObject* args)
|
|
1869
|
+
{
|
|
1870
|
+
uintptr_t ptr;
|
|
1871
|
+
int index;
|
|
1872
|
+
PyObject* values = NULL;
|
|
1873
|
+
int len;
|
|
1874
|
+
if(!PyArg_ParseTuple(args, "KiOi", &ptr, &index, &values, &len)) {
|
|
1875
|
+
return NULL;
|
|
1876
|
+
}
|
|
1877
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1878
|
+
|
|
1879
|
+
int numValues = PyList_Size(values);
|
|
1880
|
+
double* valuesRaw = (double*) malloc(sizeof(double) * numValues);
|
|
1881
|
+
for(int i=0; i != numValues; i++) {
|
|
1882
|
+
valuesRaw[i] = PyFloat_AsDouble(PyList_GET_ITEM(values, i));
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
PyObject* err = PyLong_FromLong(EN_setpattern(ph, index, valuesRaw, len));
|
|
1886
|
+
free(valuesRaw);
|
|
1887
|
+
|
|
1888
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1889
|
+
Py_DECREF(err);
|
|
1890
|
+
|
|
1891
|
+
return r;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
PyObject* method_EN_addcurve(PyObject* self, PyObject* args)
|
|
1895
|
+
{
|
|
1896
|
+
uintptr_t ptr;
|
|
1897
|
+
char* id = NULL;
|
|
1898
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &id)) {
|
|
1899
|
+
return NULL;
|
|
1900
|
+
}
|
|
1901
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1902
|
+
|
|
1903
|
+
PyObject* err = PyLong_FromLong(EN_addcurve(ph, id));
|
|
1904
|
+
|
|
1905
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1906
|
+
Py_DECREF(err);
|
|
1907
|
+
|
|
1908
|
+
return r;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
PyObject* method_EN_deletecurve(PyObject* self, PyObject* args)
|
|
1912
|
+
{
|
|
1913
|
+
uintptr_t ptr;
|
|
1914
|
+
int index;
|
|
1915
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1916
|
+
return NULL;
|
|
1917
|
+
}
|
|
1918
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1919
|
+
|
|
1920
|
+
PyObject* err = PyLong_FromLong(EN_deletecurve(ph, index));
|
|
1921
|
+
|
|
1922
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1923
|
+
Py_DECREF(err);
|
|
1924
|
+
|
|
1925
|
+
return r;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
PyObject* method_EN_getcurveindex(PyObject* self, PyObject* args)
|
|
1929
|
+
{
|
|
1930
|
+
uintptr_t ptr;
|
|
1931
|
+
char* id = NULL;
|
|
1932
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &id)) {
|
|
1933
|
+
return NULL;
|
|
1934
|
+
}
|
|
1935
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1936
|
+
|
|
1937
|
+
int index;
|
|
1938
|
+
PyObject* err = PyLong_FromLong(EN_getcurveindex(ph, id, &index));
|
|
1939
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
1940
|
+
|
|
1941
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
1942
|
+
Py_DECREF(err);
|
|
1943
|
+
Py_DECREF(pyIndex);
|
|
1944
|
+
|
|
1945
|
+
return r;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
PyObject* method_EN_getcurveid(PyObject* self, PyObject* args)
|
|
1949
|
+
{
|
|
1950
|
+
uintptr_t ptr;
|
|
1951
|
+
int index;
|
|
1952
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1953
|
+
return NULL;
|
|
1954
|
+
}
|
|
1955
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1956
|
+
|
|
1957
|
+
char out_id[MAXID + 1];
|
|
1958
|
+
PyObject* err = PyLong_FromLong(EN_getcurveid(ph, index, &out_id[0]));
|
|
1959
|
+
PyObject* pyOutId = PyUnicode_FromString(&out_id[0]);
|
|
1960
|
+
|
|
1961
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutId);
|
|
1962
|
+
Py_DECREF(err);
|
|
1963
|
+
Py_DECREF(pyOutId);
|
|
1964
|
+
|
|
1965
|
+
return r;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
PyObject* method_EN_setcurveid(PyObject* self, PyObject* args)
|
|
1969
|
+
{
|
|
1970
|
+
uintptr_t ptr;
|
|
1971
|
+
int index;
|
|
1972
|
+
char* id = NULL;
|
|
1973
|
+
if(!PyArg_ParseTuple(args, "Kis", &ptr, &index, &id)) {
|
|
1974
|
+
return NULL;
|
|
1975
|
+
}
|
|
1976
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1977
|
+
|
|
1978
|
+
PyObject* err = PyLong_FromLong(EN_setcurveid(ph, index, id));
|
|
1979
|
+
|
|
1980
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
1981
|
+
Py_DECREF(err);
|
|
1982
|
+
|
|
1983
|
+
return r;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
PyObject* method_EN_getcurvelen(PyObject* self, PyObject* args)
|
|
1987
|
+
{
|
|
1988
|
+
uintptr_t ptr;
|
|
1989
|
+
int index;
|
|
1990
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
1991
|
+
return NULL;
|
|
1992
|
+
}
|
|
1993
|
+
EN_Project ph = (EN_Project) ptr;
|
|
1994
|
+
|
|
1995
|
+
int len;
|
|
1996
|
+
PyObject* err = PyLong_FromLong(EN_getcurvelen(ph, index, &len));
|
|
1997
|
+
PyObject* pyLen = PyLong_FromLong(len);
|
|
1998
|
+
|
|
1999
|
+
PyObject* r = PyTuple_Pack(2, err, pyLen);
|
|
2000
|
+
Py_DECREF(err);
|
|
2001
|
+
Py_DECREF(pyLen);
|
|
2002
|
+
|
|
2003
|
+
return r;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
PyObject* method_EN_getcurvetype(PyObject* self, PyObject* args)
|
|
2007
|
+
{
|
|
2008
|
+
uintptr_t ptr;
|
|
2009
|
+
int index;
|
|
2010
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2011
|
+
return NULL;
|
|
2012
|
+
}
|
|
2013
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2014
|
+
|
|
2015
|
+
int type;
|
|
2016
|
+
PyObject* err = PyLong_FromLong(EN_getcurvetype(ph, index, &type));
|
|
2017
|
+
PyObject* pyType = PyLong_FromLong(type);
|
|
2018
|
+
|
|
2019
|
+
PyObject* r = PyTuple_Pack(2, err, pyType);
|
|
2020
|
+
Py_DECREF(err);
|
|
2021
|
+
Py_DECREF(pyType);
|
|
2022
|
+
|
|
2023
|
+
return r;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
PyObject* method_EN_getcurvevalue(PyObject* self, PyObject* args)
|
|
2027
|
+
{
|
|
2028
|
+
uintptr_t ptr;
|
|
2029
|
+
int curveIndex, pointIndex;
|
|
2030
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &curveIndex, &pointIndex)) {
|
|
2031
|
+
return NULL;
|
|
2032
|
+
}
|
|
2033
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2034
|
+
|
|
2035
|
+
double x, y;
|
|
2036
|
+
PyObject* err = PyLong_FromLong(EN_getcurvevalue(ph, curveIndex, pointIndex, &x, &y));
|
|
2037
|
+
PyObject* pyX = PyFloat_FromDouble(x);
|
|
2038
|
+
PyObject* pyY = PyFloat_FromDouble(y);
|
|
2039
|
+
|
|
2040
|
+
PyObject* r = PyTuple_Pack(3, err, pyX, pyY);
|
|
2041
|
+
Py_DECREF(err);
|
|
2042
|
+
Py_DECREF(pyX);
|
|
2043
|
+
Py_DECREF(pyY);
|
|
2044
|
+
|
|
2045
|
+
return r;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
PyObject* method_EN_setcurvevalue(PyObject* self, PyObject* args)
|
|
2049
|
+
{
|
|
2050
|
+
uintptr_t ptr;
|
|
2051
|
+
int curveIndex, pointIndex;
|
|
2052
|
+
double x, y;
|
|
2053
|
+
if(!PyArg_ParseTuple(args, "Kiidd", &ptr, &curveIndex, &pointIndex, &x, &y)) {
|
|
2054
|
+
return NULL;
|
|
2055
|
+
}
|
|
2056
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2057
|
+
|
|
2058
|
+
PyObject* err = PyLong_FromLong(EN_setcurvevalue(ph, curveIndex, pointIndex, x, y));
|
|
2059
|
+
|
|
2060
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2061
|
+
Py_DECREF(err);
|
|
2062
|
+
|
|
2063
|
+
return r;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
PyObject* method_EN_getcurve(PyObject* self, PyObject* args)
|
|
2067
|
+
{
|
|
2068
|
+
uintptr_t ptr;
|
|
2069
|
+
int index;
|
|
2070
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2071
|
+
return NULL;
|
|
2072
|
+
}
|
|
2073
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2074
|
+
|
|
2075
|
+
int len;
|
|
2076
|
+
int errcode = EN_getcurvelen(ph, index, &len);
|
|
2077
|
+
if(errcode != 0) {
|
|
2078
|
+
PyObject* err = PyLong_FromLong(errcode);
|
|
2079
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2080
|
+
Py_DECREF(err);
|
|
2081
|
+
|
|
2082
|
+
return r;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
char out_id[MAXID + 1];
|
|
2086
|
+
int nPoints;
|
|
2087
|
+
double* xValues = (double*) PyMem_Calloc(len, sizeof(double));
|
|
2088
|
+
double* yValues = (double*) PyMem_Calloc(len, sizeof(double));
|
|
2089
|
+
PyObject* err = PyLong_FromLong(EN_getcurve(ph, index, &out_id[0], &nPoints, xValues, yValues));
|
|
2090
|
+
|
|
2091
|
+
PyObject* xValuesList = PyList_New(nPoints);
|
|
2092
|
+
PyObject* yValuesList = PyList_New(nPoints);
|
|
2093
|
+
|
|
2094
|
+
for(int i=0; i != nPoints; i++) {
|
|
2095
|
+
PyList_SetItem(xValuesList, i, PyFloat_FromDouble(xValues[i]));
|
|
2096
|
+
PyList_SetItem(yValuesList, i, PyFloat_FromDouble(yValues[i]));
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
PyMem_Free(xValues);
|
|
2100
|
+
PyMem_Free(yValues);
|
|
2101
|
+
|
|
2102
|
+
PyObject* r = PyTuple_Pack(3, err, xValuesList, yValuesList);
|
|
2103
|
+
Py_DECREF(xValuesList);
|
|
2104
|
+
Py_DECREF(yValuesList);
|
|
2105
|
+
Py_DECREF(err);
|
|
2106
|
+
|
|
2107
|
+
return r;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
PyObject* method_EN_setcurve(PyObject* self, PyObject* args)
|
|
2111
|
+
{
|
|
2112
|
+
uintptr_t ptr;
|
|
2113
|
+
int index, nPoints;
|
|
2114
|
+
PyObject* xValues = NULL;
|
|
2115
|
+
PyObject* yValues = NULL;
|
|
2116
|
+
if(!PyArg_ParseTuple(args, "KiOOi", &ptr, &index, &xValues, &yValues, &nPoints)) {
|
|
2117
|
+
return NULL;
|
|
2118
|
+
}
|
|
2119
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2120
|
+
|
|
2121
|
+
double* xValuesRaw = (double*) malloc(sizeof(double) * nPoints);
|
|
2122
|
+
double* yValuesRaw = (double*) malloc(sizeof(double) * nPoints);
|
|
2123
|
+
|
|
2124
|
+
for(int i=0; i != nPoints; i++) {
|
|
2125
|
+
xValuesRaw[i] = PyFloat_AsDouble(PyList_GET_ITEM(xValues, i));
|
|
2126
|
+
yValuesRaw[i] = PyFloat_AsDouble(PyList_GET_ITEM(yValues, i));
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
PyObject* err = PyLong_FromLong(EN_setcurve(ph, index, xValuesRaw, yValuesRaw, nPoints));
|
|
2130
|
+
free(xValuesRaw);
|
|
2131
|
+
free(yValuesRaw);
|
|
2132
|
+
|
|
2133
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2134
|
+
Py_DECREF(err);
|
|
2135
|
+
|
|
2136
|
+
return r;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
PyObject* method_EN_addcontrol(PyObject* self, PyObject* args)
|
|
2140
|
+
{
|
|
2141
|
+
uintptr_t ptr;
|
|
2142
|
+
int type, linkIndex, nodeIndex;
|
|
2143
|
+
double setting, level;
|
|
2144
|
+
if(!PyArg_ParseTuple(args, "Kiidid", &ptr, &type, &linkIndex, &setting, &nodeIndex, &level)) {
|
|
2145
|
+
return NULL;
|
|
2146
|
+
}
|
|
2147
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2148
|
+
|
|
2149
|
+
int index;
|
|
2150
|
+
PyObject* err = PyLong_FromLong(EN_addcontrol(ph, type, linkIndex, setting, nodeIndex, level, &index));
|
|
2151
|
+
PyObject* pyIndex = PyLong_FromLong(index);
|
|
2152
|
+
|
|
2153
|
+
PyObject* r = PyTuple_Pack(2, err, pyIndex);
|
|
2154
|
+
Py_DECREF(err);
|
|
2155
|
+
Py_DECREF(pyIndex);
|
|
2156
|
+
|
|
2157
|
+
return r;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
PyObject* method_EN_deletecontrol(PyObject* self, PyObject* args)
|
|
2161
|
+
{
|
|
2162
|
+
uintptr_t ptr;
|
|
2163
|
+
int index;
|
|
2164
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2165
|
+
return NULL;
|
|
2166
|
+
}
|
|
2167
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2168
|
+
|
|
2169
|
+
PyObject* err = PyLong_FromLong(EN_deletecontrol(ph, index));
|
|
2170
|
+
|
|
2171
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2172
|
+
Py_DECREF(err);
|
|
2173
|
+
|
|
2174
|
+
return r;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
PyObject* method_EN_getcontrol(PyObject* self, PyObject* args)
|
|
2178
|
+
{
|
|
2179
|
+
uintptr_t ptr;
|
|
2180
|
+
int index;
|
|
2181
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2182
|
+
return NULL;
|
|
2183
|
+
}
|
|
2184
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2185
|
+
|
|
2186
|
+
int type, linkIndex, nodeIndex;
|
|
2187
|
+
double setting, level;
|
|
2188
|
+
PyObject* err = PyLong_FromLong(EN_getcontrol(ph, index, &type, &linkIndex, &setting, &nodeIndex, &level));
|
|
2189
|
+
PyObject* pyType = PyLong_FromLong(type);
|
|
2190
|
+
PyObject* pyLinkIndex = PyLong_FromLong(linkIndex);
|
|
2191
|
+
PyObject* pySetting = PyFloat_FromDouble(setting);
|
|
2192
|
+
PyObject* pyNodeIndex = PyLong_FromLong(nodeIndex);
|
|
2193
|
+
PyObject* pyLevel = PyFloat_FromDouble(level);
|
|
2194
|
+
|
|
2195
|
+
PyObject* r = PyTuple_Pack(6, err, pyType, pyLinkIndex, pySetting, pyNodeIndex, pyLevel);
|
|
2196
|
+
Py_DECREF(err);
|
|
2197
|
+
Py_DECREF(pyType);
|
|
2198
|
+
Py_DECREF(pyLinkIndex);
|
|
2199
|
+
Py_DECREF(pySetting);
|
|
2200
|
+
Py_DECREF(pyNodeIndex);
|
|
2201
|
+
Py_DECREF(pyLevel);
|
|
2202
|
+
|
|
2203
|
+
return r;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
PyObject* method_EN_setcontrol(PyObject* self, PyObject* args)
|
|
2207
|
+
{
|
|
2208
|
+
uintptr_t ptr;
|
|
2209
|
+
int index, type, linkIndex, nodeIndex;
|
|
2210
|
+
double setting, level;
|
|
2211
|
+
if(!PyArg_ParseTuple(args, "Kiiidid", &ptr, &index, &type, &linkIndex, &setting, &nodeIndex, &level)) {
|
|
2212
|
+
return NULL;
|
|
2213
|
+
}
|
|
2214
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2215
|
+
|
|
2216
|
+
PyObject* err = PyLong_FromLong(EN_setcontrol(ph, index, type, linkIndex, setting, nodeIndex, level));
|
|
2217
|
+
|
|
2218
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2219
|
+
Py_DECREF(err);
|
|
2220
|
+
|
|
2221
|
+
return r;
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
PyObject* method_EN_addrule(PyObject* self, PyObject* args)
|
|
2225
|
+
{
|
|
2226
|
+
uintptr_t ptr;
|
|
2227
|
+
char* rule = NULL;
|
|
2228
|
+
if(!PyArg_ParseTuple(args, "Ks", &ptr, &rule)) {
|
|
2229
|
+
return NULL;
|
|
2230
|
+
}
|
|
2231
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2232
|
+
|
|
2233
|
+
PyObject* err = PyLong_FromLong(EN_addrule(ph, rule));
|
|
2234
|
+
|
|
2235
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2236
|
+
Py_DECREF(err);
|
|
2237
|
+
|
|
2238
|
+
return r;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
PyObject* method_EN_deleterule(PyObject* self, PyObject* args)
|
|
2242
|
+
{
|
|
2243
|
+
uintptr_t ptr;
|
|
2244
|
+
int index;
|
|
2245
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2246
|
+
return NULL;
|
|
2247
|
+
}
|
|
2248
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2249
|
+
|
|
2250
|
+
PyObject* err = PyLong_FromLong(EN_deleterule(ph, index));
|
|
2251
|
+
|
|
2252
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2253
|
+
Py_DECREF(err);
|
|
2254
|
+
|
|
2255
|
+
return r;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
PyObject* method_EN_getrule(PyObject* self, PyObject* args)
|
|
2259
|
+
{
|
|
2260
|
+
uintptr_t ptr;
|
|
2261
|
+
int index;
|
|
2262
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2263
|
+
return NULL;
|
|
2264
|
+
}
|
|
2265
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2266
|
+
|
|
2267
|
+
int nPremises, nThenActions, nElseActions;
|
|
2268
|
+
double priority;
|
|
2269
|
+
PyObject* err = PyLong_FromLong(EN_getrule(ph, index, &nPremises, &nThenActions, &nElseActions, &priority));
|
|
2270
|
+
PyObject* pyNPremises = PyLong_FromLong(nPremises);
|
|
2271
|
+
PyObject* pyNThenActions = PyLong_FromLong(nThenActions);
|
|
2272
|
+
PyObject* pyNElseActions = PyLong_FromLong(nElseActions);
|
|
2273
|
+
PyObject* pyPriority = PyFloat_FromDouble(priority);
|
|
2274
|
+
|
|
2275
|
+
PyObject* r = PyTuple_Pack(5, err, pyNPremises, pyNThenActions, pyNElseActions, pyPriority);
|
|
2276
|
+
Py_DECREF(err);
|
|
2277
|
+
Py_DECREF(pyNPremises);
|
|
2278
|
+
Py_DECREF(pyNThenActions);
|
|
2279
|
+
Py_DECREF(pyNElseActions);
|
|
2280
|
+
Py_DECREF(pyPriority);
|
|
2281
|
+
|
|
2282
|
+
return r;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
PyObject* method_EN_getruleID(PyObject* self, PyObject* args)
|
|
2286
|
+
{
|
|
2287
|
+
uintptr_t ptr;
|
|
2288
|
+
int index;
|
|
2289
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2290
|
+
return NULL;
|
|
2291
|
+
}
|
|
2292
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2293
|
+
|
|
2294
|
+
char out_id[MAXID + 1];
|
|
2295
|
+
PyObject* err = PyLong_FromLong(EN_getruleID(ph, index, &out_id[0]));
|
|
2296
|
+
PyObject* pyOutId = PyUnicode_FromString(&out_id[0]);
|
|
2297
|
+
|
|
2298
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutId);
|
|
2299
|
+
Py_DECREF(err);
|
|
2300
|
+
Py_DECREF(pyOutId);
|
|
2301
|
+
|
|
2302
|
+
return r;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
PyObject* method_EN_getpremise(PyObject* self, PyObject* args)
|
|
2306
|
+
{
|
|
2307
|
+
uintptr_t ptr;
|
|
2308
|
+
int ruleIndex, premiseIndex;
|
|
2309
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &ruleIndex, &premiseIndex)) {
|
|
2310
|
+
return NULL;
|
|
2311
|
+
}
|
|
2312
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2313
|
+
|
|
2314
|
+
int logop, object, objIndex, variable, relop, status;
|
|
2315
|
+
double value;
|
|
2316
|
+
PyObject* err = PyLong_FromLong(EN_getpremise(ph, ruleIndex, premiseIndex, &logop, &object, &objIndex, &variable, &relop, &status, &value));
|
|
2317
|
+
PyObject* pyLogop = PyLong_FromLong(logop);
|
|
2318
|
+
PyObject* pyObject = PyLong_FromLong(object);
|
|
2319
|
+
PyObject* pyObjIndex = PyLong_FromLong(objIndex);
|
|
2320
|
+
PyObject* pyVariable = PyLong_FromLong(variable);
|
|
2321
|
+
PyObject* pyRelop = PyLong_FromLong(relop);
|
|
2322
|
+
PyObject* pyStatus = PyLong_FromLong(status);
|
|
2323
|
+
PyObject* pyValue = PyFloat_FromDouble(value);
|
|
2324
|
+
|
|
2325
|
+
PyObject* r = PyTuple_Pack(8, err, pyLogop, pyObject, pyObjIndex, pyVariable, pyRelop, pyStatus, pyValue);
|
|
2326
|
+
Py_DECREF(err);
|
|
2327
|
+
Py_DECREF(pyLogop);
|
|
2328
|
+
Py_DECREF(pyObject);
|
|
2329
|
+
Py_DECREF(pyObjIndex);
|
|
2330
|
+
Py_DECREF(pyVariable);
|
|
2331
|
+
Py_DECREF(pyRelop);
|
|
2332
|
+
Py_DECREF(pyStatus);
|
|
2333
|
+
Py_DECREF(pyValue);
|
|
2334
|
+
|
|
2335
|
+
return r;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
PyObject* method_EN_setpremise(PyObject* self, PyObject* args)
|
|
2339
|
+
{
|
|
2340
|
+
uintptr_t ptr;
|
|
2341
|
+
int ruleIndex, premiseIndex, logop, object, objIndex, variable, relop, status;
|
|
2342
|
+
double value;
|
|
2343
|
+
if(!PyArg_ParseTuple(args, "Kiiiiiiiid", &ptr, &ruleIndex, &premiseIndex, &logop, &object, &objIndex, &variable, &relop, &status, &value)) {
|
|
2344
|
+
return NULL;
|
|
2345
|
+
}
|
|
2346
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2347
|
+
|
|
2348
|
+
PyObject* err = PyLong_FromLong(EN_setpremise(ph, ruleIndex, premiseIndex, logop, object, objIndex, variable, relop, status, value));
|
|
2349
|
+
|
|
2350
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2351
|
+
Py_DECREF(err);
|
|
2352
|
+
|
|
2353
|
+
return r;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
PyObject* method_EN_setpremiseindex(PyObject* self, PyObject* args)
|
|
2357
|
+
{
|
|
2358
|
+
uintptr_t ptr;
|
|
2359
|
+
int ruleIndex, premiseIndex, objIndex;
|
|
2360
|
+
if(!PyArg_ParseTuple(args, "Kiii", &ptr, &ruleIndex, &premiseIndex, &objIndex)) {
|
|
2361
|
+
return NULL;
|
|
2362
|
+
}
|
|
2363
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2364
|
+
|
|
2365
|
+
PyObject* err = PyLong_FromLong(EN_setpremiseindex(ph, ruleIndex, premiseIndex, objIndex));
|
|
2366
|
+
|
|
2367
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2368
|
+
Py_DECREF(err);
|
|
2369
|
+
|
|
2370
|
+
return r;
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
PyObject* method_EN_setpremisestatus(PyObject* self, PyObject* args)
|
|
2374
|
+
{
|
|
2375
|
+
uintptr_t ptr;
|
|
2376
|
+
int ruleIndex, premiseIndex, status;
|
|
2377
|
+
if(!PyArg_ParseTuple(args, "Kiii", &ptr, &ruleIndex, &premiseIndex, &status)) {
|
|
2378
|
+
return NULL;
|
|
2379
|
+
}
|
|
2380
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2381
|
+
|
|
2382
|
+
PyObject* err = PyLong_FromLong(EN_setpremisestatus(ph, ruleIndex, premiseIndex, status));
|
|
2383
|
+
|
|
2384
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2385
|
+
Py_DECREF(err);
|
|
2386
|
+
|
|
2387
|
+
return r;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
PyObject* method_EN_setpremisevalue(PyObject* self, PyObject* args)
|
|
2391
|
+
{
|
|
2392
|
+
uintptr_t ptr;
|
|
2393
|
+
int ruleIndex, premiseIndex;
|
|
2394
|
+
double value;
|
|
2395
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &ruleIndex, &premiseIndex, &value)) {
|
|
2396
|
+
return NULL;
|
|
2397
|
+
}
|
|
2398
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2399
|
+
|
|
2400
|
+
PyObject* err = PyLong_FromLong(EN_setpremisevalue(ph, ruleIndex, premiseIndex, value));
|
|
2401
|
+
|
|
2402
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2403
|
+
Py_DECREF(err);
|
|
2404
|
+
|
|
2405
|
+
return r;
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
PyObject* method_EN_getthenaction(PyObject* self, PyObject* args)
|
|
2409
|
+
{
|
|
2410
|
+
uintptr_t ptr;
|
|
2411
|
+
int ruleIndex, actionIndex;
|
|
2412
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &ruleIndex, &actionIndex)) {
|
|
2413
|
+
return NULL;
|
|
2414
|
+
}
|
|
2415
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2416
|
+
|
|
2417
|
+
int linkIndex, status;
|
|
2418
|
+
double setting;
|
|
2419
|
+
PyObject* err = PyLong_FromLong(EN_getthenaction(ph, ruleIndex, actionIndex, &linkIndex, &status, &setting));
|
|
2420
|
+
PyObject* pyLinkIndex = PyLong_FromLong(linkIndex);
|
|
2421
|
+
PyObject* pyStatus = PyLong_FromLong(status);
|
|
2422
|
+
PyObject* pySetting = PyLong_FromLong(setting);
|
|
2423
|
+
|
|
2424
|
+
PyObject* r = PyTuple_Pack(4, err, pyLinkIndex, pyStatus, pySetting);
|
|
2425
|
+
Py_DECREF(err);
|
|
2426
|
+
Py_DECREF(pyLinkIndex);
|
|
2427
|
+
Py_DECREF(pyStatus);
|
|
2428
|
+
Py_DECREF(pySetting);
|
|
2429
|
+
|
|
2430
|
+
return r;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
PyObject* method_EN_setthenaction(PyObject* self, PyObject* args)
|
|
2434
|
+
{
|
|
2435
|
+
uintptr_t ptr;
|
|
2436
|
+
int ruleIndex, actionIndex, linkIndex, status;
|
|
2437
|
+
double setting;
|
|
2438
|
+
if(!PyArg_ParseTuple(args, "Kiiiid", &ptr, &ruleIndex, &actionIndex, &linkIndex, &status, &setting)) {
|
|
2439
|
+
return NULL;
|
|
2440
|
+
}
|
|
2441
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2442
|
+
|
|
2443
|
+
PyObject* err = PyLong_FromLong(EN_setthenaction(ph, ruleIndex, actionIndex, linkIndex, status, setting));
|
|
2444
|
+
|
|
2445
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2446
|
+
Py_DECREF(err);
|
|
2447
|
+
|
|
2448
|
+
return r;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
PyObject* method_EN_getelseaction(PyObject* self, PyObject* args)
|
|
2452
|
+
{
|
|
2453
|
+
uintptr_t ptr;
|
|
2454
|
+
int ruleIndex, actionIndex;
|
|
2455
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &ruleIndex, &actionIndex)) {
|
|
2456
|
+
return NULL;
|
|
2457
|
+
}
|
|
2458
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2459
|
+
|
|
2460
|
+
int linkIndex, status;
|
|
2461
|
+
double setting;
|
|
2462
|
+
PyObject* err = PyLong_FromLong(EN_getelseaction(ph, ruleIndex, actionIndex, &linkIndex, &status, &setting));
|
|
2463
|
+
PyObject* pyLinkIndex = PyLong_FromLong(linkIndex);
|
|
2464
|
+
PyObject* pyStatus = PyLong_FromLong(status);
|
|
2465
|
+
PyObject* pySetting = PyFloat_FromDouble(setting);
|
|
2466
|
+
|
|
2467
|
+
PyObject* r = PyTuple_Pack(4, err, pyLinkIndex, pyStatus, pySetting);
|
|
2468
|
+
Py_DECREF(err);
|
|
2469
|
+
Py_DECREF(pyLinkIndex);
|
|
2470
|
+
Py_DECREF(pyStatus);
|
|
2471
|
+
Py_DECREF(pySetting);
|
|
2472
|
+
|
|
2473
|
+
return r;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
PyObject* method_EN_setelseaction(PyObject* self, PyObject* args)
|
|
2477
|
+
{
|
|
2478
|
+
uintptr_t ptr;
|
|
2479
|
+
int ruleIndex, actionIndex, linkIndex, status;
|
|
2480
|
+
double setting;
|
|
2481
|
+
if(!PyArg_ParseTuple(args, "Kiiiid", &ptr, &ruleIndex, &actionIndex, &linkIndex, &status, &setting)) {
|
|
2482
|
+
return NULL;
|
|
2483
|
+
}
|
|
2484
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2485
|
+
|
|
2486
|
+
PyObject* err = PyLong_FromLong(EN_setelseaction(ph, ruleIndex, actionIndex, linkIndex, status, setting));
|
|
2487
|
+
|
|
2488
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2489
|
+
Py_DECREF(err);
|
|
2490
|
+
|
|
2491
|
+
return r;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
PyObject* method_EN_setrulepriority(PyObject* self, PyObject* args)
|
|
2495
|
+
{
|
|
2496
|
+
uintptr_t ptr;
|
|
2497
|
+
int index;
|
|
2498
|
+
double priority;
|
|
2499
|
+
if(!PyArg_ParseTuple(args, "Kid", &ptr, &index, &priority)) {
|
|
2500
|
+
return NULL;
|
|
2501
|
+
}
|
|
2502
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2503
|
+
|
|
2504
|
+
PyObject* err = PyLong_FromLong(EN_setrulepriority(ph, index, priority));
|
|
2505
|
+
|
|
2506
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2507
|
+
Py_DECREF(err);
|
|
2508
|
+
|
|
2509
|
+
return r;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
PyObject* method_EN_gettag(PyObject* self, PyObject* args)
|
|
2513
|
+
{
|
|
2514
|
+
uintptr_t ptr;
|
|
2515
|
+
int object, index;
|
|
2516
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &object, &index)) {
|
|
2517
|
+
return NULL;
|
|
2518
|
+
}
|
|
2519
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2520
|
+
|
|
2521
|
+
char tag[MAXID + 1];
|
|
2522
|
+
PyObject* err = PyLong_FromLong(EN_gettag(ph, object, index, &tag[0]));
|
|
2523
|
+
PyObject* pyTag = PyUnicode_FromString(&tag[0]);
|
|
2524
|
+
|
|
2525
|
+
PyObject* r = PyTuple_Pack(2, err, pyTag);
|
|
2526
|
+
Py_DECREF(err);
|
|
2527
|
+
Py_DECREF(pyTag);
|
|
2528
|
+
|
|
2529
|
+
return r;
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
PyObject* method_EN_settag(PyObject* self, PyObject* args)
|
|
2533
|
+
{
|
|
2534
|
+
uintptr_t ptr;
|
|
2535
|
+
int object, index;
|
|
2536
|
+
char* tag = NULL;
|
|
2537
|
+
if(!PyArg_ParseTuple(args, "Kiis", &ptr, &object, &index, &tag)) {
|
|
2538
|
+
return NULL;
|
|
2539
|
+
}
|
|
2540
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2541
|
+
|
|
2542
|
+
PyObject* err = PyLong_FromLong(EN_settag(ph, object, index, tag));
|
|
2543
|
+
|
|
2544
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2545
|
+
Py_DECREF(err);
|
|
2546
|
+
|
|
2547
|
+
return r;
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
PyObject* method_EN_timetonextevent(PyObject* self, PyObject* args)
|
|
2551
|
+
{
|
|
2552
|
+
uintptr_t ptr;
|
|
2553
|
+
if(!PyArg_ParseTuple(args, "K", &ptr)) {
|
|
2554
|
+
return NULL;
|
|
2555
|
+
}
|
|
2556
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2557
|
+
|
|
2558
|
+
int eventType, elemIndex;
|
|
2559
|
+
long duration;
|
|
2560
|
+
PyObject* err = PyLong_FromLong(EN_timetonextevent(ph, &eventType, &duration, &elemIndex));
|
|
2561
|
+
PyObject* pyEventType = PyLong_FromLong(eventType);
|
|
2562
|
+
PyObject* pyDuration = PyLong_FromLong(duration);
|
|
2563
|
+
PyObject* pyElemIndex = PyLong_FromLong(elemIndex);
|
|
2564
|
+
|
|
2565
|
+
PyObject* r = PyTuple_Pack(4, err, pyEventType, pyDuration, pyElemIndex);
|
|
2566
|
+
Py_DECREF(err);
|
|
2567
|
+
Py_DECREF(pyEventType);
|
|
2568
|
+
Py_DECREF(pyDuration);
|
|
2569
|
+
Py_DECREF(pyElemIndex);
|
|
2570
|
+
|
|
2571
|
+
return r;
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
PyObject* method_EN_getnodevalues(PyObject* self, PyObject* args)
|
|
2575
|
+
{
|
|
2576
|
+
uintptr_t ptr;
|
|
2577
|
+
int property;
|
|
2578
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &property)) {
|
|
2579
|
+
return NULL;
|
|
2580
|
+
}
|
|
2581
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2582
|
+
|
|
2583
|
+
int numNodes;
|
|
2584
|
+
int errcode = EN_getcount(ph, EN_NODECOUNT, &numNodes);
|
|
2585
|
+
if(errcode != 0) {
|
|
2586
|
+
PyObject* err = PyLong_FromLong(errcode);
|
|
2587
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2588
|
+
Py_DECREF(err);
|
|
2589
|
+
|
|
2590
|
+
return r;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
double* values = (double*) malloc(sizeof(double) * numNodes);
|
|
2594
|
+
PyObject* err = PyLong_FromLong(EN_getnodevalues(ph, property, values));
|
|
2595
|
+
|
|
2596
|
+
PyObject* valuesList = PyList_New(numNodes);
|
|
2597
|
+
for(int i=0; i != numNodes; i++) {
|
|
2598
|
+
PyList_SET_ITEM(valuesList, i, PyFloat_FromDouble(values[i]));
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
free(values);
|
|
2602
|
+
|
|
2603
|
+
PyObject* r = PyTuple_Pack(2, err, valuesList);
|
|
2604
|
+
Py_DECREF(valuesList);
|
|
2605
|
+
Py_DECREF(err);
|
|
2606
|
+
|
|
2607
|
+
return r;
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
PyObject* method_EN_getlinkvalues(PyObject* self, PyObject* args)
|
|
2611
|
+
{
|
|
2612
|
+
uintptr_t ptr;
|
|
2613
|
+
int property;
|
|
2614
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &property)) {
|
|
2615
|
+
return NULL;
|
|
2616
|
+
}
|
|
2617
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2618
|
+
|
|
2619
|
+
int numLinks;
|
|
2620
|
+
int errcode = EN_getcount(ph, EN_LINKCOUNT, &numLinks);
|
|
2621
|
+
if(errcode != 0) {
|
|
2622
|
+
PyObject* err = PyLong_FromLong(errcode);
|
|
2623
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2624
|
+
Py_DECREF(err);
|
|
2625
|
+
|
|
2626
|
+
return r;
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
double* value = (double*) malloc(sizeof(double) * numLinks);
|
|
2630
|
+
PyObject* err = PyLong_FromLong(EN_getlinkvalues(ph, property, value));
|
|
2631
|
+
|
|
2632
|
+
PyObject* valuesList = PyList_New(numLinks);
|
|
2633
|
+
for(int i=0; i != numLinks; i++) {
|
|
2634
|
+
PyList_SET_ITEM(valuesList, i, PyFloat_FromDouble(value[i]));
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
free(value);
|
|
2638
|
+
|
|
2639
|
+
PyObject* r = PyTuple_Pack(2, err, valuesList);
|
|
2640
|
+
Py_DECREF(valuesList);
|
|
2641
|
+
Py_DECREF(err);
|
|
2642
|
+
|
|
2643
|
+
return r;
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2646
|
+
PyObject* method_EN_setvertex(PyObject* self, PyObject* args)
|
|
2647
|
+
{
|
|
2648
|
+
uintptr_t ptr;
|
|
2649
|
+
int index, vertex;
|
|
2650
|
+
double x, y;
|
|
2651
|
+
if(!PyArg_ParseTuple(args, "Kiidd", &ptr, &index, &vertex, &x, &y)) {
|
|
2652
|
+
return NULL;
|
|
2653
|
+
}
|
|
2654
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2655
|
+
|
|
2656
|
+
PyObject* err = PyLong_FromLong(EN_setvertex(ph, index, vertex, x, y));
|
|
2657
|
+
|
|
2658
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2659
|
+
Py_DECREF(err);
|
|
2660
|
+
|
|
2661
|
+
return r;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
PyObject* method_EN_loadpatternfile(PyObject* self, PyObject* args)
|
|
2665
|
+
{
|
|
2666
|
+
uintptr_t ptr;
|
|
2667
|
+
char* filename = NULL;
|
|
2668
|
+
char* id = NULL;
|
|
2669
|
+
if(!PyArg_ParseTuple(args, "Kss", &ptr, &filename, &id)) {
|
|
2670
|
+
return NULL;
|
|
2671
|
+
}
|
|
2672
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2673
|
+
|
|
2674
|
+
PyObject* err = PyLong_FromLong(EN_loadpatternfile(ph, filename, id));
|
|
2675
|
+
|
|
2676
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2677
|
+
Py_DECREF(err);
|
|
2678
|
+
|
|
2679
|
+
return r;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
PyObject* method_EN_setcurvetype(PyObject* self, PyObject* args)
|
|
2683
|
+
{
|
|
2684
|
+
uintptr_t ptr;
|
|
2685
|
+
int index, type;
|
|
2686
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &type)) {
|
|
2687
|
+
return NULL;
|
|
2688
|
+
}
|
|
2689
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2690
|
+
|
|
2691
|
+
PyObject* err = PyLong_FromLong(EN_setcurvetype(ph, index, type));
|
|
2692
|
+
|
|
2693
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2694
|
+
Py_DECREF(err);
|
|
2695
|
+
|
|
2696
|
+
return r;
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
PyObject* method_EN_getcontrolenabled(PyObject* self, PyObject* args)
|
|
2700
|
+
{
|
|
2701
|
+
uintptr_t ptr;
|
|
2702
|
+
int index;
|
|
2703
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2704
|
+
return NULL;
|
|
2705
|
+
}
|
|
2706
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2707
|
+
|
|
2708
|
+
int out_enabled;
|
|
2709
|
+
PyObject* err = PyLong_FromLong(EN_getcontrolenabled(ph, index, &out_enabled));
|
|
2710
|
+
PyObject* pyOutEnabled = PyLong_FromLong(out_enabled);
|
|
2711
|
+
|
|
2712
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutEnabled);
|
|
2713
|
+
Py_DECREF(err);
|
|
2714
|
+
Py_DECREF(pyOutEnabled);
|
|
2715
|
+
|
|
2716
|
+
return r;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
PyObject* method_EN_setcontrolenabled(PyObject* self, PyObject* args)
|
|
2720
|
+
{
|
|
2721
|
+
uintptr_t ptr;
|
|
2722
|
+
int index, enabled;
|
|
2723
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &enabled)) {
|
|
2724
|
+
return NULL;
|
|
2725
|
+
}
|
|
2726
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2727
|
+
|
|
2728
|
+
PyObject* err = PyLong_FromLong(EN_setcontrolenabled(ph, index, enabled));
|
|
2729
|
+
|
|
2730
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2731
|
+
Py_DECREF(err);
|
|
2732
|
+
|
|
2733
|
+
return r;
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
PyObject* method_EN_getruleenabled(PyObject* self, PyObject* args)
|
|
2737
|
+
{
|
|
2738
|
+
uintptr_t ptr;
|
|
2739
|
+
int index;
|
|
2740
|
+
if(!PyArg_ParseTuple(args, "Ki", &ptr, &index)) {
|
|
2741
|
+
return NULL;
|
|
2742
|
+
}
|
|
2743
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2744
|
+
|
|
2745
|
+
int out_enabled;
|
|
2746
|
+
PyObject* err = PyLong_FromLong(EN_getruleenabled(ph, index, &out_enabled));
|
|
2747
|
+
PyObject* pyOutEnabled = PyLong_FromLong(out_enabled);
|
|
2748
|
+
|
|
2749
|
+
PyObject* r = PyTuple_Pack(2, err, pyOutEnabled);
|
|
2750
|
+
Py_DECREF(err);
|
|
2751
|
+
Py_DECREF(pyOutEnabled);
|
|
2752
|
+
|
|
2753
|
+
return r;
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
PyObject* method_EN_setruleenabled(PyObject* self, PyObject* args)
|
|
2757
|
+
{
|
|
2758
|
+
uintptr_t ptr;
|
|
2759
|
+
int index, enabled;
|
|
2760
|
+
if(!PyArg_ParseTuple(args, "Kii", &ptr, &index, &enabled)) {
|
|
2761
|
+
return NULL;
|
|
2762
|
+
}
|
|
2763
|
+
EN_Project ph = (EN_Project) ptr;
|
|
2764
|
+
|
|
2765
|
+
PyObject* err = PyLong_FromLong(EN_setruleenabled(ph, index, enabled));
|
|
2766
|
+
|
|
2767
|
+
PyObject* r = PyTuple_Pack(1, err);
|
|
2768
|
+
Py_DECREF(err);
|
|
2769
|
+
|
|
2770
|
+
return r;
|
|
2771
|
+
}
|