annotate DEPENDENCIES/mingw32/Python27/Lib/site-packages/numpy/f2py/src/fortranobject.h @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents 2a2c65a20a8b
children
rev   line source
Chris@87 1 #ifndef Py_FORTRANOBJECT_H
Chris@87 2 #define Py_FORTRANOBJECT_H
Chris@87 3 #ifdef __cplusplus
Chris@87 4 extern "C" {
Chris@87 5 #endif
Chris@87 6
Chris@87 7 #include "Python.h"
Chris@87 8
Chris@87 9 #ifdef FORTRANOBJECT_C
Chris@87 10 #define NO_IMPORT_ARRAY
Chris@87 11 #endif
Chris@87 12 #define PY_ARRAY_UNIQUE_SYMBOL _npy_f2py_ARRAY_API
Chris@87 13 #include "numpy/arrayobject.h"
Chris@87 14
Chris@87 15 /*
Chris@87 16 * Python 3 support macros
Chris@87 17 */
Chris@87 18 #if PY_VERSION_HEX >= 0x03000000
Chris@87 19 #define PyString_Check PyBytes_Check
Chris@87 20 #define PyString_GET_SIZE PyBytes_GET_SIZE
Chris@87 21 #define PyString_AS_STRING PyBytes_AS_STRING
Chris@87 22 #define PyString_FromString PyBytes_FromString
Chris@87 23 #define PyUString_FromStringAndSize PyUnicode_FromStringAndSize
Chris@87 24 #define PyString_ConcatAndDel PyBytes_ConcatAndDel
Chris@87 25 #define PyString_AsString PyBytes_AsString
Chris@87 26
Chris@87 27 #define PyInt_Check PyLong_Check
Chris@87 28 #define PyInt_FromLong PyLong_FromLong
Chris@87 29 #define PyInt_AS_LONG PyLong_AsLong
Chris@87 30 #define PyInt_AsLong PyLong_AsLong
Chris@87 31
Chris@87 32 #define PyNumber_Int PyNumber_Long
Chris@87 33
Chris@87 34 #else
Chris@87 35
Chris@87 36 #define PyUString_FromStringAndSize PyString_FromStringAndSize
Chris@87 37 #endif
Chris@87 38
Chris@87 39
Chris@87 40 #ifdef F2PY_REPORT_ATEXIT
Chris@87 41 #include <sys/timeb.h>
Chris@87 42 extern void f2py_start_clock(void);
Chris@87 43 extern void f2py_stop_clock(void);
Chris@87 44 extern void f2py_start_call_clock(void);
Chris@87 45 extern void f2py_stop_call_clock(void);
Chris@87 46 extern void f2py_cb_start_clock(void);
Chris@87 47 extern void f2py_cb_stop_clock(void);
Chris@87 48 extern void f2py_cb_start_call_clock(void);
Chris@87 49 extern void f2py_cb_stop_call_clock(void);
Chris@87 50 extern void f2py_report_on_exit(int,void*);
Chris@87 51 #endif
Chris@87 52
Chris@87 53 #ifdef DMALLOC
Chris@87 54 #include "dmalloc.h"
Chris@87 55 #endif
Chris@87 56
Chris@87 57 /* Fortran object interface */
Chris@87 58
Chris@87 59 /*
Chris@87 60 123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
Chris@87 61
Chris@87 62 PyFortranObject represents various Fortran objects:
Chris@87 63 Fortran (module) routines, COMMON blocks, module data.
Chris@87 64
Chris@87 65 Author: Pearu Peterson <pearu@cens.ioc.ee>
Chris@87 66 */
Chris@87 67
Chris@87 68 #define F2PY_MAX_DIMS 40
Chris@87 69
Chris@87 70 typedef void (*f2py_set_data_func)(char*,npy_intp*);
Chris@87 71 typedef void (*f2py_void_func)(void);
Chris@87 72 typedef void (*f2py_init_func)(int*,npy_intp*,f2py_set_data_func,int*);
Chris@87 73
Chris@87 74 /*typedef void* (*f2py_c_func)(void*,...);*/
Chris@87 75
Chris@87 76 typedef void *(*f2pycfunc)(void);
Chris@87 77
Chris@87 78 typedef struct {
Chris@87 79 char *name; /* attribute (array||routine) name */
Chris@87 80 int rank; /* array rank, 0 for scalar, max is F2PY_MAX_DIMS,
Chris@87 81 || rank=-1 for Fortran routine */
Chris@87 82 struct {npy_intp d[F2PY_MAX_DIMS];} dims; /* dimensions of the array, || not used */
Chris@87 83 int type; /* PyArray_<type> || not used */
Chris@87 84 char *data; /* pointer to array || Fortran routine */
Chris@87 85 f2py_init_func func; /* initialization function for
Chris@87 86 allocatable arrays:
Chris@87 87 func(&rank,dims,set_ptr_func,name,len(name))
Chris@87 88 || C/API wrapper for Fortran routine */
Chris@87 89 char *doc; /* documentation string; only recommended
Chris@87 90 for routines. */
Chris@87 91 } FortranDataDef;
Chris@87 92
Chris@87 93 typedef struct {
Chris@87 94 PyObject_HEAD
Chris@87 95 int len; /* Number of attributes */
Chris@87 96 FortranDataDef *defs; /* An array of FortranDataDef's */
Chris@87 97 PyObject *dict; /* Fortran object attribute dictionary */
Chris@87 98 } PyFortranObject;
Chris@87 99
Chris@87 100 #define PyFortran_Check(op) (Py_TYPE(op) == &PyFortran_Type)
Chris@87 101 #define PyFortran_Check1(op) (0==strcmp(Py_TYPE(op)->tp_name,"fortran"))
Chris@87 102
Chris@87 103 extern PyTypeObject PyFortran_Type;
Chris@87 104 extern int F2PyDict_SetItemString(PyObject* dict, char *name, PyObject *obj);
Chris@87 105 extern PyObject * PyFortranObject_New(FortranDataDef* defs, f2py_void_func init);
Chris@87 106 extern PyObject * PyFortranObject_NewAsAttr(FortranDataDef* defs);
Chris@87 107
Chris@87 108 #if PY_VERSION_HEX >= 0x03000000
Chris@87 109
Chris@87 110 PyObject * F2PyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *));
Chris@87 111 void * F2PyCapsule_AsVoidPtr(PyObject *obj);
Chris@87 112 int F2PyCapsule_Check(PyObject *ptr);
Chris@87 113
Chris@87 114 #else
Chris@87 115
Chris@87 116 PyObject * F2PyCapsule_FromVoidPtr(void *ptr, void (*dtor)(void *));
Chris@87 117 void * F2PyCapsule_AsVoidPtr(PyObject *ptr);
Chris@87 118 int F2PyCapsule_Check(PyObject *ptr);
Chris@87 119
Chris@87 120 #endif
Chris@87 121
Chris@87 122 #define ISCONTIGUOUS(m) ((m)->flags & NPY_CONTIGUOUS)
Chris@87 123 #define F2PY_INTENT_IN 1
Chris@87 124 #define F2PY_INTENT_INOUT 2
Chris@87 125 #define F2PY_INTENT_OUT 4
Chris@87 126 #define F2PY_INTENT_HIDE 8
Chris@87 127 #define F2PY_INTENT_CACHE 16
Chris@87 128 #define F2PY_INTENT_COPY 32
Chris@87 129 #define F2PY_INTENT_C 64
Chris@87 130 #define F2PY_OPTIONAL 128
Chris@87 131 #define F2PY_INTENT_INPLACE 256
Chris@87 132 #define F2PY_INTENT_ALIGNED4 512
Chris@87 133 #define F2PY_INTENT_ALIGNED8 1024
Chris@87 134 #define F2PY_INTENT_ALIGNED16 2048
Chris@87 135
Chris@87 136 #define ARRAY_ISALIGNED(ARR, SIZE) ((size_t)(PyArray_DATA(ARR)) % (SIZE) == 0)
Chris@87 137 #define F2PY_ALIGN4(intent) (intent & F2PY_INTENT_ALIGNED4)
Chris@87 138 #define F2PY_ALIGN8(intent) (intent & F2PY_INTENT_ALIGNED8)
Chris@87 139 #define F2PY_ALIGN16(intent) (intent & F2PY_INTENT_ALIGNED16)
Chris@87 140
Chris@87 141 #define F2PY_GET_ALIGNMENT(intent) \
Chris@87 142 (F2PY_ALIGN4(intent) ? 4 : \
Chris@87 143 (F2PY_ALIGN8(intent) ? 8 : \
Chris@87 144 (F2PY_ALIGN16(intent) ? 16 : 1) ))
Chris@87 145 #define F2PY_CHECK_ALIGNMENT(arr, intent) ARRAY_ISALIGNED(arr, F2PY_GET_ALIGNMENT(intent))
Chris@87 146
Chris@87 147 extern PyArrayObject* array_from_pyobj(const int type_num,
Chris@87 148 npy_intp *dims,
Chris@87 149 const int rank,
Chris@87 150 const int intent,
Chris@87 151 PyObject *obj);
Chris@87 152 extern int copy_ND_array(const PyArrayObject *in, PyArrayObject *out);
Chris@87 153
Chris@87 154 #ifdef DEBUG_COPY_ND_ARRAY
Chris@87 155 extern void dump_attrs(const PyArrayObject* arr);
Chris@87 156 #endif
Chris@87 157
Chris@87 158
Chris@87 159 #ifdef __cplusplus
Chris@87 160 }
Chris@87 161 #endif
Chris@87 162 #endif /* !Py_FORTRANOBJECT_H */