File: libnumeric.h

package info (click to toggle)
python-numarray 1.5.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,668 kB
  • ctags: 11,384
  • sloc: ansic: 113,864; python: 22,422; makefile: 197; sh: 11
file content (243 lines) | stat: -rw-r--r-- 12,195 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

/*   W     W   AAA   RRRR   N   N  III  N   N   GGG   !!!
**   W     W  A   A  R   R  NN  N   I   NN  N  G   G  !!!
**   W  W  W  AAAAA  RRRR   N N N   I   N N N  G       !
**    W W W   A   A  R   R  N  NN   I   N  NN  G  GG
**     W W    A   A  R   R  N   N  III  N   N   GGG   !!!
**
** WARNING: This file is program generated by genapi.py.
**
** DO NOT EDIT THIS FILE! Any changes made to this file will be lost!
*/

#ifndef _libnumeric
#define _libnumeric



#ifdef __cplusplus
extern "C" {
#endif

/* Header file for libnumeric */

#if !defined(_libnumeric_MODULE)

/*
Extensions constructed from seperate compilation units can access the
C-API defined here by defining "libnumeric_UNIQUE_SYMBOL" to a global
name unique to the extension.  Doing this circumvents the requirement
to import libnumeric into each compilation unit, but is nevertheless
mildly discouraged as "outside the Python norm" and potentially
leading to problems.  Looking around at "existing Python art", most
extension modules are monolithic C files, and likely for good reason.
*/

#if defined(libnumeric_UNIQUE_SYMBOL)
#define libnumeric_API libnumeric_UNIQUE_SYMBOL
#endif

/* C API address pointer */ 
#if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY)
extern void **libnumeric_API;
#else
#if defined(libnumeric_UNIQUE_SYMBOL)
void **libnumeric_API;
#else
static void **libnumeric_API;
#endif
#endif

#define _import_libnumeric()                                                  \
      {                                                                     \
        PyObject *module = PyImport_ImportModule("numarray.libnumeric");     \
        if (module != NULL) {                                               \
          PyObject *module_dict = PyModule_GetDict(module);                 \
          PyObject *c_api_object =                                          \
                 PyDict_GetItemString(module_dict, "_C_API");               \
          if (c_api_object && PyCObject_Check(c_api_object)) {              \
            libnumeric_API = (void **)PyCObject_AsVoidPtr(c_api_object);      \
          } else {                                                          \
            PyErr_Format(PyExc_ImportError,                                 \
                         "Can't get API for module 'numarray.libnumeric'");  \
          }                                                                 \
        }                                                                   \
      }
      
#define import_libnumeric() _import_libnumeric(); if (PyErr_Occurred()) { PyErr_Print(); Py_FatalError("numarray.libnumeric failed to import... exiting.\n"); }
      
#endif


#define libnumeric_FatalApiError (Py_FatalError("Call to API function without first calling import_libnumeric() in " __FILE__), NULL)
      

/* Macros defining components of function prototypes */



#ifdef _libnumeric_MODULE
  /* This section is used when compiling libnumeric */

static PyObject *_Error;
  

static PyObject *  PyArray_Type  (void);

static int  XXX_PyArray_SetNumericOps  (PyObject *);

static int  XXX_PyArray_INCREF  (PyArrayObject *ap);

static int  XXX_PyArray_XDECREF  (PyArrayObject *ap);

static PyObject *  XXX_PyArrayError  (void);

static void  XXX_PyArray_SetStringFunction  (PyObject *op, int repr);

static PyArray_Descr *  PyArray_DescrFromType  (int);

static PyObject *  PyArray_Cast  (PyArrayObject *, int);

static int  PyArray_CanCastSafely  (int fromtype, int totype);

static int  PyArray_ObjectType  (PyObject *object, int min_type);

static int  _PyArray_multiply_list  (int *lp, int n);

static int  PyArray_Size  (PyObject *);

static PyObject *  PyArray_FromDims  (int, int *, int);

static PyObject *  PyArray_FromDimsAndData  (int, int *, int, char *);

static PyObject *  PyArray_ContiguousFromObject  (PyObject *, int, int, int);

static PyObject *  PyArray_CopyFromObject  (PyObject *, int, int, int);

static PyObject *  PyArray_FromObject  (PyObject *, int, int, int);

static PyObject *  PyArray_Return  (PyArrayObject *);

static PyObject *  PyArray_Reshape  (PyArrayObject *ap, PyObject *shape);

static PyObject *  PyArray_Copy  (PyArrayObject *ap);

static PyObject *  PyArray_Take  (PyObject *ap, PyObject *items, int axis);

static int  PyArray_As1D  (PyObject **op, char **ptr, int *d1, int typecode);

static int  PyArray_As2D  (PyObject **op, char ***ptr, int *d1, int *d2, int typecode);

static int  PyArray_Free  (PyObject *op, char *ptr);

static PyObject *  XXX_PyArray_FromDimsAndDataAndDescr  (int, int *, PyArray_Descr *, char *);

static int  PyArray_Converter  (PyObject *, PyObject **);

static PyObject *  PyArray_Put  (PyObject *ap, PyObject *items, PyObject* values);

static PyObject *  PyArray_PutMask  (PyObject *ap, PyObject *mask, PyObject* values);

static int  PyArray_CopyArray  (PyArrayObject *dest, PyArrayObject *src);

static int  PyArray_ValidType  (int type);

static PyObject *  PyArray_GetItem  (PyArrayObject *a, char *where);

static int  PyArray_SetItem  (PyArrayObject *a, char *where, PyObject *what);

static char *  PyArray_Zero  (PyArrayObject *a);

static char *  PyArray_One  (PyArrayObject *a);

static int  _PyArray_compare_lists  (int *l1, int *l2, int n);

static int  PyArray_Check  (PyObject *o);

  
#else
  /* This section is used in modules that use libnumeric */

#define  PyArray_Type (libnumeric_API ? (*(PyObject * (*)  (void) ) libnumeric_API[ 0 ]) : (*(PyObject * (*)  (void) ) libnumeric_FatalApiError))

#define  XXX_PyArray_SetNumericOps (libnumeric_API ? (*(int (*)  (PyObject *) ) libnumeric_API[ 1 ]) : (*(int (*)  (PyObject *) ) libnumeric_FatalApiError))

#define  XXX_PyArray_INCREF (libnumeric_API ? (*(int (*)  (PyArrayObject *ap) ) libnumeric_API[ 2 ]) : (*(int (*)  (PyArrayObject *ap) ) libnumeric_FatalApiError))

#define  XXX_PyArray_XDECREF (libnumeric_API ? (*(int (*)  (PyArrayObject *ap) ) libnumeric_API[ 3 ]) : (*(int (*)  (PyArrayObject *ap) ) libnumeric_FatalApiError))

#define  XXX_PyArrayError (libnumeric_API ? (*(PyObject * (*)  (void) ) libnumeric_API[ 4 ]) : (*(PyObject * (*)  (void) ) libnumeric_FatalApiError))

#define  XXX_PyArray_SetStringFunction (libnumeric_API ? (*(void (*)  (PyObject *op, int repr) ) libnumeric_API[ 5 ]) : (*(void (*)  (PyObject *op, int repr) ) libnumeric_FatalApiError))

#define  PyArray_DescrFromType (libnumeric_API ? (*(PyArray_Descr * (*)  (int) ) libnumeric_API[ 6 ]) : (*(PyArray_Descr * (*)  (int) ) libnumeric_FatalApiError))

#define  PyArray_Cast (libnumeric_API ? (*(PyObject * (*)  (PyArrayObject *, int) ) libnumeric_API[ 7 ]) : (*(PyObject * (*)  (PyArrayObject *, int) ) libnumeric_FatalApiError))

#define  PyArray_CanCastSafely (libnumeric_API ? (*(int (*)  (int fromtype, int totype) ) libnumeric_API[ 8 ]) : (*(int (*)  (int fromtype, int totype) ) libnumeric_FatalApiError))

#define  PyArray_ObjectType (libnumeric_API ? (*(int (*)  (PyObject *object, int min_type) ) libnumeric_API[ 9 ]) : (*(int (*)  (PyObject *object, int min_type) ) libnumeric_FatalApiError))

#define  _PyArray_multiply_list (libnumeric_API ? (*(int (*)  (int *lp, int n) ) libnumeric_API[ 10 ]) : (*(int (*)  (int *lp, int n) ) libnumeric_FatalApiError))

#define  PyArray_Size (libnumeric_API ? (*(int (*)  (PyObject *) ) libnumeric_API[ 11 ]) : (*(int (*)  (PyObject *) ) libnumeric_FatalApiError))

#define  PyArray_FromDims (libnumeric_API ? (*(PyObject * (*)  (int, int *, int) ) libnumeric_API[ 12 ]) : (*(PyObject * (*)  (int, int *, int) ) libnumeric_FatalApiError))

#define  PyArray_FromDimsAndData (libnumeric_API ? (*(PyObject * (*)  (int, int *, int, char *) ) libnumeric_API[ 13 ]) : (*(PyObject * (*)  (int, int *, int, char *) ) libnumeric_FatalApiError))

#define  PyArray_ContiguousFromObject (libnumeric_API ? (*(PyObject * (*)  (PyObject *, int, int, int) ) libnumeric_API[ 14 ]) : (*(PyObject * (*)  (PyObject *, int, int, int) ) libnumeric_FatalApiError))

#define  PyArray_CopyFromObject (libnumeric_API ? (*(PyObject * (*)  (PyObject *, int, int, int) ) libnumeric_API[ 15 ]) : (*(PyObject * (*)  (PyObject *, int, int, int) ) libnumeric_FatalApiError))

#define  PyArray_FromObject (libnumeric_API ? (*(PyObject * (*)  (PyObject *, int, int, int) ) libnumeric_API[ 16 ]) : (*(PyObject * (*)  (PyObject *, int, int, int) ) libnumeric_FatalApiError))

#define  PyArray_Return (libnumeric_API ? (*(PyObject * (*)  (PyArrayObject *) ) libnumeric_API[ 17 ]) : (*(PyObject * (*)  (PyArrayObject *) ) libnumeric_FatalApiError))

#define  PyArray_Reshape (libnumeric_API ? (*(PyObject * (*)  (PyArrayObject *ap, PyObject *shape) ) libnumeric_API[ 18 ]) : (*(PyObject * (*)  (PyArrayObject *ap, PyObject *shape) ) libnumeric_FatalApiError))

#define  PyArray_Copy (libnumeric_API ? (*(PyObject * (*)  (PyArrayObject *ap) ) libnumeric_API[ 19 ]) : (*(PyObject * (*)  (PyArrayObject *ap) ) libnumeric_FatalApiError))

#define  PyArray_Take (libnumeric_API ? (*(PyObject * (*)  (PyObject *ap, PyObject *items, int axis) ) libnumeric_API[ 20 ]) : (*(PyObject * (*)  (PyObject *ap, PyObject *items, int axis) ) libnumeric_FatalApiError))

#define  PyArray_As1D (libnumeric_API ? (*(int (*)  (PyObject **op, char **ptr, int *d1, int typecode) ) libnumeric_API[ 21 ]) : (*(int (*)  (PyObject **op, char **ptr, int *d1, int typecode) ) libnumeric_FatalApiError))

#define  PyArray_As2D (libnumeric_API ? (*(int (*)  (PyObject **op, char ***ptr, int *d1, int *d2, int typecode) ) libnumeric_API[ 22 ]) : (*(int (*)  (PyObject **op, char ***ptr, int *d1, int *d2, int typecode) ) libnumeric_FatalApiError))

#define  PyArray_Free (libnumeric_API ? (*(int (*)  (PyObject *op, char *ptr) ) libnumeric_API[ 23 ]) : (*(int (*)  (PyObject *op, char *ptr) ) libnumeric_FatalApiError))

#define  XXX_PyArray_FromDimsAndDataAndDescr (libnumeric_API ? (*(PyObject * (*)  (int, int *, PyArray_Descr *, char *) ) libnumeric_API[ 24 ]) : (*(PyObject * (*)  (int, int *, PyArray_Descr *, char *) ) libnumeric_FatalApiError))

#define  PyArray_Converter (libnumeric_API ? (*(int (*)  (PyObject *, PyObject **) ) libnumeric_API[ 25 ]) : (*(int (*)  (PyObject *, PyObject **) ) libnumeric_FatalApiError))

#define  PyArray_Put (libnumeric_API ? (*(PyObject * (*)  (PyObject *ap, PyObject *items, PyObject* values) ) libnumeric_API[ 26 ]) : (*(PyObject * (*)  (PyObject *ap, PyObject *items, PyObject* values) ) libnumeric_FatalApiError))

#define  PyArray_PutMask (libnumeric_API ? (*(PyObject * (*)  (PyObject *ap, PyObject *mask, PyObject* values) ) libnumeric_API[ 27 ]) : (*(PyObject * (*)  (PyObject *ap, PyObject *mask, PyObject* values) ) libnumeric_FatalApiError))

#define  PyArray_CopyArray (libnumeric_API ? (*(int (*)  (PyArrayObject *dest, PyArrayObject *src) ) libnumeric_API[ 28 ]) : (*(int (*)  (PyArrayObject *dest, PyArrayObject *src) ) libnumeric_FatalApiError))

#define  PyArray_ValidType (libnumeric_API ? (*(int (*)  (int type) ) libnumeric_API[ 29 ]) : (*(int (*)  (int type) ) libnumeric_FatalApiError))

#define  PyArray_GetItem (libnumeric_API ? (*(PyObject * (*)  (PyArrayObject *a, char *where) ) libnumeric_API[ 30 ]) : (*(PyObject * (*)  (PyArrayObject *a, char *where) ) libnumeric_FatalApiError))

#define  PyArray_SetItem (libnumeric_API ? (*(int (*)  (PyArrayObject *a, char *where, PyObject *what) ) libnumeric_API[ 31 ]) : (*(int (*)  (PyArrayObject *a, char *where, PyObject *what) ) libnumeric_FatalApiError))

#define  PyArray_Zero (libnumeric_API ? (*(char * (*)  (PyArrayObject *a) ) libnumeric_API[ 32 ]) : (*(char * (*)  (PyArrayObject *a) ) libnumeric_FatalApiError))

#define  PyArray_One (libnumeric_API ? (*(char * (*)  (PyArrayObject *a) ) libnumeric_API[ 33 ]) : (*(char * (*)  (PyArrayObject *a) ) libnumeric_FatalApiError))

#define  _PyArray_compare_lists (libnumeric_API ? (*(int (*)  (int *l1, int *l2, int n) ) libnumeric_API[ 34 ]) : (*(int (*)  (int *l1, int *l2, int n) ) libnumeric_FatalApiError))

#define  PyArray_Check (libnumeric_API ? (*(int (*)  (PyObject *o) ) libnumeric_API[ 35 ]) : (*(int (*)  (PyObject *o) ) libnumeric_FatalApiError))

#endif

  /* Total number of C API pointers */
#define libnumeric_API_pointers 36

#ifdef __cplusplus
}
#endif

#endif /* !defined(_libnumeric) */