mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
50 lines
1.4 KiB
OpenEdge ABL
50 lines
1.4 KiB
OpenEdge ABL
%module pyqmckl
|
|
/* Define SWIGWORDSIZE in order to properly align long integers on 64-bit system */
|
|
#define SWIGWORDSIZE64
|
|
%{
|
|
#define SWIG_FILE_WITH_INIT
|
|
/* Include the headers in the wrapper code */
|
|
#include "qmckl.h"
|
|
%}
|
|
|
|
|
|
/* Include stdint to recognize types from stdint.h */
|
|
%include <stdint.i>
|
|
|
|
/* Include typemaps to play with input/output re-casting (e.g. C pointers) */
|
|
%include typemaps.i
|
|
|
|
%apply int *OUTPUT { qmckl_exit_code *exit_code};
|
|
|
|
/* Avoid passing file_name length as an additiona argument */
|
|
%apply (char *STRING, int LENGTH) { (const char* file_name, const int64_t size_max) };
|
|
|
|
/* For functions that return strings */
|
|
%include <cstring.i>
|
|
|
|
%cstring_bounded_output(char* function_name, 1024);
|
|
%cstring_bounded_output(char* message, 1024);
|
|
|
|
/* This block is needed make SWIG convert NumPy arrays to/from from the C pointer and size_max argument.
|
|
NOTE: `numpy.i` interface file is not part of SWIG but it is included in the numpy distribution (under numpy/tools/swig/numpy.i)
|
|
*/
|
|
%include "numpy.i"
|
|
|
|
%init %{
|
|
import_array();
|
|
%}
|
|
|
|
/* Typemaps below change the type of numpy array dimensions from int to int64_t */
|
|
%numpy_typemaps(double, NPY_DOUBLE, int64_t)
|
|
%numpy_typemaps(float, NPY_FLOAT, int64_t)
|
|
%numpy_typemaps(int32_t, NPY_INT32, int64_t)
|
|
%numpy_typemaps(int64_t, NPY_INT64, int64_t)
|
|
|
|
/* Include typemaps generated by the process.py */
|
|
%include pyqmckl_include.i
|
|
|
|
|
|
/* Parse the header files to generate wrappers */
|
|
%include "qmckl.h"
|
|
|