|
Last change
on this file since 11972 was 11972, checked in by Eric.Larour, 14 years ago |
|
Reorganized Matlab and Python io.
Also added FetchData and WriteData routines in the Python io layer, essential to implementing the Python
wrappers. These rely on the NumPY C API. We let go of the boost Python bindings, which were conflicting
with the Numpy C API. Go back to the roots!
|
|
File size:
839 bytes
|
| Line | |
|---|
| 1 | /*!\file CheckNumPythonArguments.cpp:
|
|---|
| 2 | * \brief: check number of arguments and report an usage error message.
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #ifdef HAVE_CONFIG_H
|
|---|
| 6 | #include <config.h>
|
|---|
| 7 | #else
|
|---|
| 8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
|---|
| 9 | #endif
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 | #if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
|
|---|
| 13 |
|
|---|
| 14 | #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
|
|---|
| 15 | #define NO_IMPORT
|
|---|
| 16 |
|
|---|
| 17 | #include "../../toolkits/toolkits.h"
|
|---|
| 18 | #include "../../shared/Exceptions/exceptions.h"
|
|---|
| 19 | #include "../../include/include.h"
|
|---|
| 20 |
|
|---|
| 21 | int CheckNumPythonArguments(PyObject* inputs,int NRHS, void (*function)( void )){
|
|---|
| 22 |
|
|---|
| 23 | Py_ssize_t size=0;
|
|---|
| 24 |
|
|---|
| 25 | /*figure out size of tuple in input: */
|
|---|
| 26 | size=PyTuple_Size(inputs);
|
|---|
| 27 |
|
|---|
| 28 | /*check on requested size: */
|
|---|
| 29 | if (size==0){
|
|---|
| 30 | function();
|
|---|
| 31 | _error_("usage: see above");
|
|---|
| 32 | }
|
|---|
| 33 | else if (size!=NRHS ) {
|
|---|
| 34 | function();
|
|---|
| 35 | _error_("usage error.");
|
|---|
| 36 | }
|
|---|
| 37 | return 1;
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.