[af03ddd] | 1 | /** |
---|
| 2 | This software was developed by the University of Tennessee as part of the |
---|
| 3 | Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
| 4 | project funded by the US National Science Foundation. |
---|
| 5 | |
---|
| 6 | If you use DANSE applications to do scientific research that leads to |
---|
| 7 | publication, we ask that you acknowledge the use of the software with the |
---|
| 8 | following sentence: |
---|
| 9 | |
---|
| 10 | "This work benefited from DANSE software developed under NSF award DMR-0520547." |
---|
| 11 | |
---|
| 12 | copyright 2008, University of Tennessee |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | /** [PYTHONCLASS] |
---|
| 16 | * |
---|
| 17 | * C extension |
---|
| 18 | * |
---|
| 19 | * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
| 20 | * DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE] |
---|
| 21 | * AND RE-RUN THE GENERATOR SCRIPT |
---|
| 22 | * |
---|
| 23 | */ |
---|
| 24 | |
---|
[812b901] | 25 | #define NO_IMPORT_ARRAY |
---|
| 26 | #define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans |
---|
| 27 | |
---|
[af03ddd] | 28 | extern "C" { |
---|
| 29 | #include <Python.h> |
---|
[812b901] | 30 | #include <arrayobject.h> |
---|
[af03ddd] | 31 | #include "structmember.h" |
---|
| 32 | #include <stdio.h> |
---|
| 33 | #include <stdlib.h> |
---|
| 34 | #include <math.h> |
---|
| 35 | #include <time.h> |
---|
| 36 | #include "[INCLUDE_FILE]" |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | #include "models.hh" |
---|
| 40 | #include "dispersion_visitor.hh" |
---|
| 41 | |
---|
| 42 | /// Error object for raised exceptions |
---|
| 43 | static PyObject * [PYTHONCLASS]Error = NULL; |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | // Class definition |
---|
| 47 | typedef struct { |
---|
| 48 | PyObject_HEAD |
---|
| 49 | /// Parameters |
---|
| 50 | PyObject * params; |
---|
| 51 | /// Dispersion parameters |
---|
| 52 | PyObject * dispersion; |
---|
| 53 | /// Underlying model object |
---|
| 54 | [CMODEL] * model; |
---|
| 55 | /// Log for unit testing |
---|
| 56 | PyObject * log; |
---|
| 57 | } [PYTHONCLASS]; |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | static void |
---|
| 61 | [PYTHONCLASS]_dealloc([PYTHONCLASS]* self) |
---|
| 62 | { |
---|
| 63 | self->ob_type->tp_free((PyObject*)self); |
---|
| 64 | [NUMERICAL_DEALLOC] |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | static PyObject * |
---|
| 68 | [PYTHONCLASS]_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
---|
| 69 | { |
---|
| 70 | [PYTHONCLASS] *self; |
---|
| 71 | |
---|
| 72 | self = ([PYTHONCLASS] *)type->tp_alloc(type, 0); |
---|
| 73 | |
---|
| 74 | return (PyObject *)self; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | static int |
---|
| 78 | [PYTHONCLASS]_init([PYTHONCLASS] *self, PyObject *args, PyObject *kwds) |
---|
| 79 | { |
---|
| 80 | if (self != NULL) { |
---|
| 81 | |
---|
| 82 | // Create parameters |
---|
| 83 | self->params = PyDict_New(); |
---|
| 84 | self->dispersion = PyDict_New(); |
---|
| 85 | self->model = new [CMODEL](); |
---|
| 86 | |
---|
| 87 | [INITDICTIONARY] |
---|
| 88 | |
---|
| 89 | // Create empty log |
---|
| 90 | self->log = PyDict_New(); |
---|
| 91 | |
---|
| 92 | [NUMERICAL_INIT] |
---|
| 93 | } |
---|
| 94 | return 0; |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | static PyMemberDef [PYTHONCLASS]_members[] = { |
---|
| 98 | {"params", T_OBJECT, offsetof([PYTHONCLASS], params), 0, |
---|
| 99 | "Parameters"}, |
---|
| 100 | {"dispersion", T_OBJECT, offsetof([PYTHONCLASS], dispersion), 0, |
---|
| 101 | "Dispersion parameters"}, |
---|
| 102 | {"log", T_OBJECT, offsetof([PYTHONCLASS], log), 0, |
---|
| 103 | "Log"}, |
---|
| 104 | {NULL} /* Sentinel */ |
---|
| 105 | }; |
---|
| 106 | |
---|
| 107 | /** Read double from PyObject |
---|
| 108 | @param p PyObject |
---|
| 109 | @return double |
---|
| 110 | */ |
---|
| 111 | double [PYTHONCLASS]_readDouble(PyObject *p) { |
---|
| 112 | if (PyFloat_Check(p)==1) { |
---|
| 113 | return (double)(((PyFloatObject *)(p))->ob_fval); |
---|
| 114 | } else if (PyInt_Check(p)==1) { |
---|
| 115 | return (double)(((PyIntObject *)(p))->ob_ival); |
---|
| 116 | } else if (PyLong_Check(p)==1) { |
---|
| 117 | return (double)PyLong_AsLong(p); |
---|
| 118 | } else { |
---|
| 119 | return 0.0; |
---|
| 120 | } |
---|
| 121 | } |
---|
[812b901] | 122 | /** |
---|
| 123 | * Function to call to evaluate model |
---|
| 124 | * @param args: input numpy array q[] |
---|
| 125 | * @return: numpy array object |
---|
| 126 | */ |
---|
| 127 | |
---|
| 128 | static PyObject *evaluateOneDim([CMODEL]* model, PyArrayObject *q){ |
---|
| 129 | PyArrayObject *result; |
---|
| 130 | |
---|
| 131 | // Check validity of array q , q must be of dimension 1, an array of double |
---|
| 132 | if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE) |
---|
| 133 | { |
---|
| 134 | //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num; |
---|
| 135 | //PyErr_SetString(PyExc_ValueError , message); |
---|
| 136 | return NULL; |
---|
| 137 | } |
---|
| 138 | result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions), |
---|
| 139 | PyArray_DOUBLE); |
---|
| 140 | if (result == NULL) { |
---|
| 141 | const char * message= "Could not create result "; |
---|
| 142 | PyErr_SetString(PyExc_RuntimeError , message); |
---|
| 143 | return NULL; |
---|
| 144 | } |
---|
| 145 | for (int i = 0; i < q->dimensions[0]; i++){ |
---|
| 146 | double q_value = *(double *)(q->data + i*q->strides[0]); |
---|
| 147 | double *result_value = (double *)(result->data + i*result->strides[0]); |
---|
| 148 | *result_value =(*model)(q_value); |
---|
| 149 | } |
---|
| 150 | return PyArray_Return(result); |
---|
| 151 | } |
---|
| 152 | /** |
---|
| 153 | * Function to call to evaluate model |
---|
| 154 | * @param args: input numpy array [q[],phi[]] |
---|
| 155 | * @return: numpy array object |
---|
| 156 | */ |
---|
| 157 | static PyObject * evaluateTwoDim( [CMODEL]* model, |
---|
| 158 | PyArrayObject *q, PyArrayObject *phi) |
---|
| 159 | { |
---|
| 160 | PyArrayObject *result; |
---|
| 161 | //check validity of input vectors |
---|
| 162 | if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE |
---|
| 163 | || phi->nd != 1 || phi->descr->type_num != PyArray_DOUBLE |
---|
| 164 | || phi->dimensions[0] != q->dimensions[0]){ |
---|
| 165 | |
---|
| 166 | //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num; |
---|
| 167 | //PyErr_SetString(PyExc_ValueError , message); |
---|
| 168 | return NULL; |
---|
| 169 | } |
---|
| 170 | result= (PyArrayObject *)PyArray_FromDims(q->nd,(int*)(q->dimensions), PyArray_DOUBLE); |
---|
[af03ddd] | 171 | |
---|
[812b901] | 172 | if (result == NULL){ |
---|
| 173 | const char * message= "Could not create result "; |
---|
| 174 | PyErr_SetString(PyExc_RuntimeError , message); |
---|
| 175 | return NULL; |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | for (int i = 0; i < q->dimensions[0]; i++) { |
---|
| 179 | double q_value = *(double *)(q->data + i*q->strides[0]); |
---|
| 180 | double phi_value = *(double *)(phi->data + i*phi->strides[0]); |
---|
| 181 | double *result_value = (double *)(result->data + i*result->strides[0]); |
---|
| 182 | if (q_value == 0) |
---|
| 183 | *result_value = 0.0; |
---|
| 184 | else |
---|
| 185 | *result_value = model->evaluate_rphi(q_value, phi_value); |
---|
| 186 | } |
---|
| 187 | return PyArray_Return(result); |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | /** |
---|
| 191 | * Function to call to evaluate model |
---|
| 192 | * @param args: input numpy array [x[],y[]] |
---|
| 193 | * @return: numpy array object |
---|
| 194 | */ |
---|
| 195 | static PyObject * evaluateTwoDimXY( [CMODEL]* model, |
---|
| 196 | PyArrayObject *x, PyArrayObject *y) |
---|
| 197 | { |
---|
| 198 | PyArrayObject *result; |
---|
| 199 | //check validity of input vectors |
---|
| 200 | if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE |
---|
| 201 | || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE |
---|
| 202 | || y->dimensions[0] != x->dimensions[0]){ |
---|
| 203 | |
---|
| 204 | //const char * message= "Invalid array: x->nd=%d,type_num=%d\n",x->nd,x->descr->type_num; |
---|
| 205 | //PyErr_SetString(PyExc_ValueError , message); |
---|
| 206 | return NULL; |
---|
| 207 | } |
---|
| 208 | result= (PyArrayObject *)PyArray_FromDims(x->nd,(int*)(x->dimensions), PyArray_DOUBLE); |
---|
[af03ddd] | 209 | |
---|
[812b901] | 210 | if (result == NULL){ |
---|
| 211 | const char * message= "Could not create result "; |
---|
| 212 | PyErr_SetString(PyExc_RuntimeError , message); |
---|
| 213 | return NULL; |
---|
| 214 | } |
---|
| 215 | |
---|
| 216 | for (int i = 0; i < x->dimensions[0]; i++) { |
---|
| 217 | double x_value = *(double *)(x->data + i*x->strides[0]); |
---|
| 218 | double y_value = *(double *)(y->data + i*y->strides[0]); |
---|
| 219 | double *result_value = (double *)(result->data + i*result->strides[0]); |
---|
| 220 | *result_value = (*model)(x_value, y_value); |
---|
| 221 | } |
---|
| 222 | return PyArray_Return(result); |
---|
| 223 | } |
---|
| 224 | |
---|
[af03ddd] | 225 | /** |
---|
| 226 | * Function to call to evaluate model |
---|
| 227 | * @param args: input q or [q,phi] |
---|
| 228 | * @return: function value |
---|
| 229 | */ |
---|
| 230 | static PyObject * run([PYTHONCLASS] *self, PyObject *args) { |
---|
| 231 | double q_value, phi_value; |
---|
| 232 | PyObject* pars; |
---|
| 233 | int npars; |
---|
| 234 | |
---|
| 235 | // Get parameters |
---|
| 236 | |
---|
| 237 | [READDICTIONARY] |
---|
| 238 | |
---|
| 239 | // Get input and determine whether we have to supply a 1D or 2D return value. |
---|
| 240 | if ( !PyArg_ParseTuple(args,"O",&pars) ) { |
---|
| 241 | PyErr_SetString([PYTHONCLASS]Error, |
---|
| 242 | "[PYTHONCLASS].run expects a q value."); |
---|
| 243 | return NULL; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | // Check params |
---|
| 247 | if( PyList_Check(pars)==1) { |
---|
| 248 | |
---|
| 249 | // Length of list should be 2 for I(q,phi) |
---|
| 250 | npars = PyList_GET_SIZE(pars); |
---|
| 251 | if(npars!=2) { |
---|
| 252 | PyErr_SetString([PYTHONCLASS]Error, |
---|
| 253 | "[PYTHONCLASS].run expects a double or a list of dimension 2."); |
---|
| 254 | return NULL; |
---|
| 255 | } |
---|
[812b901] | 256 | |
---|
[af03ddd] | 257 | // We have a vector q, get the q and phi values at which |
---|
| 258 | // to evaluate I(q,phi) |
---|
[812b901] | 259 | PyObject *q, *phi; |
---|
| 260 | q = PyList_GET_ITEM(pars,0); |
---|
| 261 | phi = PyList_GET_ITEM(pars,1); |
---|
| 262 | |
---|
| 263 | if (PyArray_Check(q) && PyArray_Check(phi)) { |
---|
| 264 | return evaluateTwoDim(self->model, (PyArrayObject*)q, (PyArrayObject*)phi); |
---|
| 265 | } else if (PyArray_Check(q) || PyArray_Check(phi)) { |
---|
| 266 | return NULL; |
---|
| 267 | } else { |
---|
| 268 | q_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,0)); |
---|
| 269 | phi_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,1)); |
---|
| 270 | // Skip zero |
---|
| 271 | if (q_value==0) { |
---|
| 272 | return Py_BuildValue("d",0.0); |
---|
| 273 | } |
---|
| 274 | return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value)); |
---|
| 275 | } |
---|
[af03ddd] | 276 | } else { |
---|
[812b901] | 277 | if (PyArray_Check(pars)) { |
---|
| 278 | return evaluateOneDim(self->model, (PyArrayObject*)pars); |
---|
| 279 | } else { |
---|
| 280 | // We have a scalar q, we will evaluate I(q) |
---|
[af03ddd] | 281 | q_value = [PYTHONCLASS]_readDouble(pars); |
---|
[812b901] | 282 | return Py_BuildValue("d",(*(self->model))(q_value)); |
---|
| 283 | } |
---|
| 284 | } |
---|
[af03ddd] | 285 | } |
---|
| 286 | |
---|
| 287 | /** |
---|
| 288 | * Function to call to evaluate model in cartesian coordinates |
---|
| 289 | * @param args: input q or [qx, qy]] |
---|
| 290 | * @return: function value |
---|
| 291 | */ |
---|
| 292 | static PyObject * runXY([PYTHONCLASS] *self, PyObject *args) { |
---|
| 293 | double qx_value, qy_value; |
---|
| 294 | PyObject* pars; |
---|
| 295 | int npars; |
---|
| 296 | |
---|
| 297 | // Get parameters |
---|
| 298 | |
---|
| 299 | [READDICTIONARY] |
---|
| 300 | |
---|
| 301 | // Get input and determine whether we have to supply a 1D or 2D return value. |
---|
| 302 | if ( !PyArg_ParseTuple(args,"O",&pars) ) { |
---|
| 303 | PyErr_SetString([PYTHONCLASS]Error, |
---|
| 304 | "[PYTHONCLASS].run expects a q value."); |
---|
| 305 | return NULL; |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | // Check params |
---|
| 309 | if( PyList_Check(pars)==1) { |
---|
| 310 | |
---|
| 311 | // Length of list should be 2 for I(qx, qy)) |
---|
| 312 | npars = PyList_GET_SIZE(pars); |
---|
| 313 | if(npars!=2) { |
---|
| 314 | PyErr_SetString([PYTHONCLASS]Error, |
---|
| 315 | "[PYTHONCLASS].run expects a double or a list of dimension 2."); |
---|
| 316 | return NULL; |
---|
| 317 | } |
---|
| 318 | // We have a vector q, get the qx and qy values at which |
---|
| 319 | // to evaluate I(qx,qy) |
---|
[812b901] | 320 | PyObject *x, *y; |
---|
| 321 | x = PyList_GET_ITEM(pars,0); |
---|
| 322 | y = PyList_GET_ITEM(pars,1); |
---|
| 323 | |
---|
| 324 | if (PyArray_Check(x) && PyArray_Check(y)) { |
---|
| 325 | |
---|
| 326 | return evaluateTwoDimXY(self->model, (PyArrayObject*)x, (PyArrayObject*)y); |
---|
| 327 | } else if (PyArray_Check(x) || PyArray_Check(y)) { |
---|
| 328 | return NULL; |
---|
| 329 | } else { |
---|
| 330 | qx_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,0)); |
---|
| 331 | qy_value = [PYTHONCLASS]_readDouble(PyList_GET_ITEM(pars,1)); |
---|
| 332 | return Py_BuildValue("d",(*(self->model))(qx_value,qy_value)); |
---|
| 333 | } |
---|
[af03ddd] | 334 | |
---|
| 335 | } else { |
---|
[812b901] | 336 | if (PyArray_Check(pars)) { |
---|
| 337 | return evaluateOneDim(self->model, (PyArrayObject*)pars); |
---|
| 338 | } else { |
---|
| 339 | // We have a scalar q, we will evaluate I(q) |
---|
| 340 | qx_value = [PYTHONCLASS]_readDouble(pars); |
---|
[af03ddd] | 341 | |
---|
[812b901] | 342 | return Py_BuildValue("d",(*(self->model))(qx_value)); |
---|
| 343 | } |
---|
[af03ddd] | 344 | } |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | static PyObject * reset([PYTHONCLASS] *self, PyObject *args) { |
---|
| 348 | [NUMERICAL_RESET] |
---|
| 349 | return Py_BuildValue("d",0.0); |
---|
| 350 | } |
---|
| 351 | |
---|
| 352 | static PyObject * set_dispersion([PYTHONCLASS] *self, PyObject *args) { |
---|
| 353 | PyObject * disp; |
---|
| 354 | const char * par_name; |
---|
| 355 | |
---|
| 356 | if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) { |
---|
| 357 | PyErr_SetString([PYTHONCLASS]Error, |
---|
| 358 | "[PYTHONCLASS].set_dispersion expects a DispersionModel object."); |
---|
| 359 | return NULL; |
---|
| 360 | } |
---|
| 361 | void *temp = PyCObject_AsVoidPtr(disp); |
---|
| 362 | DispersionModel * dispersion = static_cast<DispersionModel *>(temp); |
---|
| 363 | |
---|
| 364 | |
---|
| 365 | // Ugliness necessary to go from python to C |
---|
| 366 | [SET_DISPERSION] { |
---|
| 367 | PyErr_SetString([PYTHONCLASS]Error, |
---|
| 368 | "[PYTHONCLASS].set_dispersion expects a valid parameter name."); |
---|
| 369 | return NULL; |
---|
| 370 | } |
---|
| 371 | |
---|
| 372 | DispersionVisitor* visitor = new DispersionVisitor(); |
---|
| 373 | PyObject * disp_dict = PyDict_New(); |
---|
| 374 | dispersion->accept_as_source(visitor, dispersion, disp_dict); |
---|
| 375 | PyDict_SetItemString(self->dispersion, par_name, disp_dict); |
---|
| 376 | return Py_BuildValue("i",1); |
---|
| 377 | } |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | static PyMethodDef [PYTHONCLASS]_methods[] = { |
---|
| 381 | {"run", (PyCFunction)run , METH_VARARGS, |
---|
| 382 | "Evaluate the model at a given Q or Q, phi"}, |
---|
| 383 | {"runXY", (PyCFunction)runXY , METH_VARARGS, |
---|
| 384 | "Evaluate the model at a given Q or Qx, Qy"}, |
---|
| 385 | {"reset", (PyCFunction)reset , METH_VARARGS, |
---|
| 386 | "Reset pair correlation"}, |
---|
| 387 | {"set_dispersion", (PyCFunction)set_dispersion , METH_VARARGS, |
---|
| 388 | "Set the dispersion model for a given parameter"}, |
---|
| 389 | {NULL} |
---|
| 390 | }; |
---|
| 391 | |
---|
| 392 | static PyTypeObject [PYTHONCLASS]Type = { |
---|
| 393 | PyObject_HEAD_INIT(NULL) |
---|
| 394 | 0, /*ob_size*/ |
---|
| 395 | "[PYTHONCLASS]", /*tp_name*/ |
---|
| 396 | sizeof([PYTHONCLASS]), /*tp_basicsize*/ |
---|
| 397 | 0, /*tp_itemsize*/ |
---|
| 398 | (destructor)[PYTHONCLASS]_dealloc, /*tp_dealloc*/ |
---|
| 399 | 0, /*tp_print*/ |
---|
| 400 | 0, /*tp_getattr*/ |
---|
| 401 | 0, /*tp_setattr*/ |
---|
| 402 | 0, /*tp_compare*/ |
---|
| 403 | 0, /*tp_repr*/ |
---|
| 404 | 0, /*tp_as_number*/ |
---|
| 405 | 0, /*tp_as_sequence*/ |
---|
| 406 | 0, /*tp_as_mapping*/ |
---|
| 407 | 0, /*tp_hash */ |
---|
| 408 | 0, /*tp_call*/ |
---|
| 409 | 0, /*tp_str*/ |
---|
| 410 | 0, /*tp_getattro*/ |
---|
| 411 | 0, /*tp_setattro*/ |
---|
| 412 | 0, /*tp_as_buffer*/ |
---|
| 413 | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ |
---|
| 414 | "[PYTHONCLASS] objects", /* tp_doc */ |
---|
| 415 | 0, /* tp_traverse */ |
---|
| 416 | 0, /* tp_clear */ |
---|
| 417 | 0, /* tp_richcompare */ |
---|
| 418 | 0, /* tp_weaklistoffset */ |
---|
| 419 | 0, /* tp_iter */ |
---|
| 420 | 0, /* tp_iternext */ |
---|
| 421 | [PYTHONCLASS]_methods, /* tp_methods */ |
---|
| 422 | [PYTHONCLASS]_members, /* tp_members */ |
---|
| 423 | 0, /* tp_getset */ |
---|
| 424 | 0, /* tp_base */ |
---|
| 425 | 0, /* tp_dict */ |
---|
| 426 | 0, /* tp_descr_get */ |
---|
| 427 | 0, /* tp_descr_set */ |
---|
| 428 | 0, /* tp_dictoffset */ |
---|
| 429 | (initproc)[PYTHONCLASS]_init, /* tp_init */ |
---|
| 430 | 0, /* tp_alloc */ |
---|
| 431 | [PYTHONCLASS]_new, /* tp_new */ |
---|
| 432 | }; |
---|
| 433 | |
---|
| 434 | |
---|
| 435 | /** |
---|
| 436 | * Function used to add the model class to a module |
---|
| 437 | * @param module: module to add the class to |
---|
| 438 | */ |
---|
| 439 | void add[PYTHONCLASS](PyObject *module) { |
---|
| 440 | PyObject *d; |
---|
| 441 | |
---|
| 442 | if (PyType_Ready(&[PYTHONCLASS]Type) < 0) |
---|
| 443 | return; |
---|
| 444 | |
---|
| 445 | Py_INCREF(&[PYTHONCLASS]Type); |
---|
| 446 | PyModule_AddObject(module, "[PYTHONCLASS]", (PyObject *)&[PYTHONCLASS]Type); |
---|
| 447 | |
---|
| 448 | d = PyModule_GetDict(module); |
---|
| 449 | [PYTHONCLASS]Error = PyErr_NewException("[PYTHONCLASS].error", NULL, NULL); |
---|
| 450 | PyDict_SetItemString(d, "[PYTHONCLASS]Error", [PYTHONCLASS]Error); |
---|
| 451 | } |
---|