home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / python2.4 / Numeric / ufuncobject.h < prev   
Encoding:
C/C++ Source or Header  |  2004-09-28  |  6.5 KB  |  202 lines

  1. #ifndef Py_UFUNCOBJECT_H
  2. #define Py_UFUNCOBJECT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. typedef void (VBinaryFunction) (char *, int, char *, int,
  8.                 char *, int, int, void *);
  9. typedef void (VUnaryFunction) (char *, int, char *, int, int, void *);
  10.  
  11. typedef void (*PyUFuncGenericFunction) (char **, int *, int *, void *);
  12.  
  13. typedef struct {
  14.   PyObject_HEAD
  15.     /* XXXX Add your own stuff here */
  16.   int *ranks, *canonical_ranks;
  17.   int nin, nout, nargs;
  18.   int identity;
  19.   PyUFuncGenericFunction *functions;
  20.   void **data;
  21.   int ntypes, nranks, attributes;
  22.   char *name, *types;
  23.   int check_return;
  24.   char *doc;
  25. } PyUFuncObject;
  26.  
  27. #define PyUFunc_Unbounded 120
  28. #define PyUFunc_One 1
  29. #define PyUFunc_Zero 0
  30. #define PyUFunc_None -1
  31.  
  32.  
  33. #define PyUFunc_Type_NUM 0
  34.  
  35. #define PyUFunc_FromFuncAndData_RET PyObject *
  36. #define PyUFunc_FromFuncAndData_PROTO (PyUFuncGenericFunction *func, void **data, char *types, int ntypes, int nin, int nout, int identity, char *name, char *doc, int check_return)
  37. #define PyUFunc_FromFuncAndData_NUM 1
  38.  
  39. #define PyUFunc_GenericFunction_RET int
  40. #define PyUFunc_GenericFunction_PROTO (PyUFuncObject *self, PyObject *args, PyArrayObject **mps)
  41. #define PyUFunc_GenericFunction_NUM 2
  42.  
  43. #define PyUFunc_f_f_As_d_d_RET void
  44. #define PyUFunc_f_f_As_d_d_PROTO (char **args, int *dimensions, int *steps, void *func)
  45. #define PyUFunc_f_f_As_d_d_NUM 3
  46.  
  47. #define PyUFunc_d_d_RET void
  48. #define PyUFunc_d_d_PROTO (char **args, int *dimensions, int *steps, void *func)
  49. #define PyUFunc_d_d_NUM 4
  50.  
  51. #define PyUFunc_F_F_As_D_D_RET void
  52. #define PyUFunc_F_F_As_D_D_PROTO (char **args, int *dimensions, int *steps, void *func)
  53. #define PyUFunc_F_F_As_D_D_NUM 5
  54.  
  55. #define PyUFunc_D_D_RET void
  56. #define PyUFunc_D_D_PROTO (char **args, int *dimensions, int *steps, void *func)
  57. #define PyUFunc_D_D_NUM 6
  58.  
  59. #define PyUFunc_O_O_RET void
  60. #define PyUFunc_O_O_PROTO (char **args, int *dimensions, int *steps, void *func)
  61. #define PyUFunc_O_O_NUM 7
  62.  
  63. #define PyUFunc_ff_f_As_dd_d_RET void
  64. #define PyUFunc_ff_f_As_dd_d_PROTO (char **args, int *dimensions, int *steps, void *func)
  65. #define PyUFunc_ff_f_As_dd_d_NUM 8
  66.  
  67. #define PyUFunc_dd_d_RET void
  68. #define PyUFunc_dd_d_PROTO (char **args, int *dimensions, int *steps, void *func)
  69. #define PyUFunc_dd_d_NUM 9
  70.  
  71. #define PyUFunc_FF_F_As_DD_D_RET void
  72. #define PyUFunc_FF_F_As_DD_D_PROTO (char **args, int *dimensions, int *steps, void *func)
  73. #define PyUFunc_FF_F_As_DD_D_NUM 10
  74.  
  75. #define PyUFunc_DD_D_RET void
  76. #define PyUFunc_DD_D_PROTO (char **args, int *dimensions, int *steps, void *func)
  77. #define PyUFunc_DD_D_NUM 11
  78.  
  79. #define PyUFunc_OO_O_RET void
  80. #define PyUFunc_OO_O_PROTO (char **args, int *dimensions, int *steps, void *func)
  81. #define PyUFunc_OO_O_NUM 12
  82.  
  83. #define PyUFunc_O_O_method_RET void
  84. #define PyUFunc_O_O_method_PROTO (char **args, int *dimensions, int *steps, void *func)
  85. #define PyUFunc_O_O_method_NUM 13
  86.  
  87. #define PyArray_Map_RET PyObject *
  88. #define PyArray_Map_PROTO (PyObject *function, PyObject *args)
  89. #define PyArray_Map_NUM 14
  90.  
  91. /* Total number of C API pointers */
  92. #define PyUFunc_API_pointers 15
  93.  
  94.  
  95. #ifdef _UFUNC_MODULE
  96.  
  97. extern PyTypeObject PyUFunc_Type;
  98.  
  99. #define PyUFunc_Check(op) ((op)->ob_type == &PyUFunc_Type)
  100.  
  101. extern PyUFunc_FromFuncAndData_RET PyUFunc_FromFuncAndData \
  102.        PyUFunc_FromFuncAndData_PROTO;
  103. extern PyUFunc_GenericFunction_RET PyUFunc_GenericFunction \
  104.        PyUFunc_GenericFunction_PROTO;
  105. extern PyUFunc_f_f_As_d_d_RET PyUFunc_f_f_As_d_d PyUFunc_f_f_As_d_d_PROTO;
  106. extern PyUFunc_d_d_RET PyUFunc_d_d PyUFunc_d_d_PROTO;
  107. extern PyUFunc_F_F_As_D_D_RET PyUFunc_F_F_As_D_D PyUFunc_F_F_As_D_D_PROTO;
  108. extern PyUFunc_D_D_RET PyUFunc_D_D PyUFunc_D_D_PROTO;
  109. extern PyUFunc_O_O_RET PyUFunc_O_O PyUFunc_O_O_PROTO;
  110. extern PyUFunc_ff_f_As_dd_d_RET PyUFunc_ff_f_As_dd_d PyUFunc_ff_f_As_dd_d_PROTO;
  111. extern PyUFunc_dd_d_RET PyUFunc_dd_d PyUFunc_dd_d_PROTO;
  112. extern PyUFunc_FF_F_As_DD_D_RET PyUFunc_FF_F_As_DD_D PyUFunc_FF_F_As_DD_D_PROTO;
  113. extern PyUFunc_DD_D_RET PyUFunc_DD_D PyUFunc_DD_D_PROTO;
  114. extern PyUFunc_OO_O_RET PyUFunc_OO_O PyUFunc_OO_O_PROTO;
  115. extern PyUFunc_O_O_method_RET PyUFunc_O_O_method PyUFunc_O_O_method_PROTO;
  116. extern PyArray_Map_RET PyArray_Map PyArray_Map_PROTO;
  117.  
  118. #else
  119.  
  120. #if defined(PY_UFUNC_UNIQUE_SYMBOL)
  121. #define PyUFunc_API PY_UFUNC_UNIQUE_SYMBOL
  122. #endif
  123.  
  124. /* C API address pointer */ 
  125. #if defined(NO_IMPORT) || defined(NO_IMPORT_UFUNC)
  126. extern void **PyUFunc_API;
  127. #else
  128. #if defined(PY_UFUNC_UNIQUE_SYMBOL)
  129. void **PyUFunc_API;
  130. #else
  131. static void **PyUFunc_API;
  132. #endif
  133. #endif
  134.  
  135. #define PyUFunc_Check(op) \
  136.    ((op)->ob_type == (PyTypeObject *)PyUFunc_API[PyUFunc_Type_NUM])
  137.  
  138. #define PyUFunc_Type *(PyTypeObject *)PyUFunc_API[PyUFunc_Type_NUM]
  139.  
  140. #define PyUFunc_FromFuncAndData \
  141.   (*(PyUFunc_FromFuncAndData_RET (*)PyUFunc_FromFuncAndData_PROTO) \
  142.    PyUFunc_API[PyUFunc_FromFuncAndData_NUM])
  143. #define PyUFunc_GenericFunction \
  144.   (*(PyUFunc_GenericFunction_RET (*)PyUFunc_GenericFunction_PROTO) \
  145.    PyUFunc_API[PyUFunc_GenericFunction_NUM])
  146. #define PyUFunc_f_f_As_d_d \
  147.   (*(PyUFunc_f_f_As_d_d_RET (*)PyUFunc_f_f_As_d_d_PROTO) \
  148.    PyUFunc_API[PyUFunc_f_f_As_d_d_NUM])
  149. #define PyUFunc_d_d \
  150.   (*(PyUFunc_d_d_RET (*)PyUFunc_d_d_PROTO) \
  151.    PyUFunc_API[PyUFunc_d_d_NUM])
  152. #define PyUFunc_F_F_As_D_D \
  153.   (*(PyUFunc_F_F_As_D_D_RET (*)PyUFunc_F_F_As_D_D_PROTO) \
  154.    PyUFunc_API[PyUFunc_F_F_As_D_D_NUM])
  155. #define PyUFunc_D_D \
  156.   (*(PyUFunc_D_D_RET (*)PyUFunc_D_D_PROTO) \
  157.    PyUFunc_API[PyUFunc_D_D_NUM])
  158. #define PyUFunc_O_O \
  159.   (*(PyUFunc_O_O_RET (*)PyUFunc_O_O_PROTO) \
  160.    PyUFunc_API[PyUFunc_O_O_NUM])
  161. #define PyUFunc_ff_f_As_dd_d \
  162.   (*(PyUFunc_ff_f_As_dd_d_RET (*)PyUFunc_ff_f_As_dd_d_PROTO) \
  163.    PyUFunc_API[PyUFunc_ff_f_As_dd_d_NUM])
  164. #define PyUFunc_dd_d \
  165.   (*(PyUFunc_dd_d_RET (*)PyUFunc_dd_d_PROTO) \
  166.    PyUFunc_API[PyUFunc_dd_d_NUM])
  167. #define PyUFunc_FF_F_As_DD_D \
  168.   (*(PyUFunc_FF_F_As_DD_D_RET (*)PyUFunc_FF_F_As_DD_D_PROTO) \
  169.    PyUFunc_API[PyUFunc_FF_F_As_DD_D_NUM])
  170. #define PyUFunc_DD_D \
  171.   (*(PyUFunc_DD_D_RET (*)PyUFunc_DD_D_PROTO) \
  172.    PyUFunc_API[PyUFunc_DD_D_NUM])
  173. #define PyUFunc_OO_O \
  174.   (*(PyUFunc_OO_O_RET (*)PyUFunc_OO_O_PROTO) \
  175.    PyUFunc_API[PyUFunc_OO_O_NUM])
  176. #define PyUFunc_O_O_method \
  177.   (*(PyUFunc_O_O_method_RET (*)PyUFunc_O_O_method_PROTO) \
  178.    PyUFunc_API[PyUFunc_O_O_method_NUM])
  179. #define PyArray_Map \
  180.   (*(PyArray_Map_RET (*)PyArray_Map_PROTO) \
  181.    PyUFunc_API[PyArray_Map_NUM])
  182.  
  183. #define import_ufunc() \
  184. { \
  185.   PyObject *numpy = PyImport_ImportModule("_numpy"); \
  186.   if (numpy != NULL) { \
  187.     PyObject *module_dict = PyModule_GetDict(numpy); \
  188.     PyObject *c_api_object = PyDict_GetItemString(module_dict, "_UFUNC_API"); \
  189.     if (PyCObject_Check(c_api_object)) { \
  190.       PyUFunc_API = (void **)PyCObject_AsVoidPtr(c_api_object); \
  191.     } \
  192.   } \
  193. }
  194.  
  195. #endif
  196.  
  197.  
  198. #ifdef __cplusplus
  199. }
  200. #endif
  201. #endif /* !Py_UFUNCOBJECT_H */
  202.