diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-08 00:49:35 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-08 00:49:35 +0000 |
commit | d1b492038476e0da520c97549e39c9284ae64e18 (patch) | |
tree | c2c94e9d551179c8552d5a4d7844db7a15f5993f /numpy/f2py | |
parent | a29b0e2bf884c5d43d07e5fe7c88344b6dd8bde8 (diff) | |
download | numpy-d1b492038476e0da520c97549e39c9284ae64e18.tar.gz |
Fix f2py to use new names
Diffstat (limited to 'numpy/f2py')
-rw-r--r-- | numpy/f2py/cb_rules.py | 2 | ||||
-rw-r--r-- | numpy/f2py/cfuncs.py | 50 | ||||
-rw-r--r-- | numpy/f2py/rules.py | 4 | ||||
-rw-r--r-- | numpy/f2py/src/fortranobject.c | 34 | ||||
-rw-r--r-- | numpy/f2py/src/fortranobject.h | 8 |
5 files changed, 49 insertions, 49 deletions
diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py index df74703ba..40371a106 100644 --- a/numpy/f2py/cb_rules.py +++ b/numpy/f2py/cb_rules.py @@ -349,7 +349,7 @@ cb_arg_rules=[ }, # Array ... { - 'decl':'\tintp #varname#_Dims[#rank#] = {#rank*[-1]#};', + 'decl':'\tnpy_intp #varname#_Dims[#rank#] = {#rank*[-1]#};', 'setdims':'\t#cbsetdims#;', '_check':isarray, '_depend':'' diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 81829f02c..f60113a04 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -294,17 +294,17 @@ cppmacros['TRYPYARRAYTEMPLATE']="""\ case PyArray_FLOAT: *(float *)(arr->data)=*v; break;\\ case PyArray_CDOUBLE: *(double *)(arr->data)=*v; break;\\ case PyArray_CFLOAT: *(float *)(arr->data)=*v; break;\\ - case PyArray_BOOL: *(Bool *)(arr->data)=(*v!=0); break;\\ + case PyArray_BOOL: *(npy_bool *)(arr->data)=(*v!=0); break;\\ case PyArray_UBYTE: *(unsigned char *)(arr->data)=*v; break;\\ case PyArray_BYTE: *(signed char *)(arr->data)=*v; break;\\ case PyArray_SHORT: *(short *)(arr->data)=*v; break;\\ - case PyArray_USHORT: *(ushort *)(arr->data)=*v; break;\\ - case PyArray_UINT: *(uint *)(arr->data)=*v; break;\\ - case PyArray_ULONG: *(ulong *)(arr->data)=*v; break;\\ - case PyArray_LONGLONG: *(longlong *)(arr->data)=*v; break;\\ - case PyArray_ULONGLONG: *(ulonglong *)(arr->data)=*v; break;\\ - case PyArray_LONGDOUBLE: *(longdouble *)(arr->data)=*v; break;\\ - case PyArray_CLONGDOUBLE: *(longdouble *)(arr->data)=*v; break;\\ + case PyArray_USHORT: *(npy_ushort *)(arr->data)=*v; break;\\ + case PyArray_UINT: *(npy_uint *)(arr->data)=*v; break;\\ + case PyArray_ULONG: *(npy_ulong *)(arr->data)=*v; break;\\ + case PyArray_LONGLONG: *(npy_longlong *)(arr->data)=*v; break;\\ + case PyArray_ULONGLONG: *(npy_ulonglong *)(arr->data)=*v; break;\\ + case PyArray_LONGDOUBLE: *(npy_longdouble *)(arr->data)=*v; break;\\ + case PyArray_CLONGDOUBLE: *(npy_longdouble *)(arr->data)=*v; break;\\ case PyArray_OBJECT: (arr->descr->f->setitem)(pyobj_from_ ## ctype ## 1(*v),arr->data, arr); break;\\ default: return -2;\\ };\\ @@ -334,17 +334,17 @@ cppmacros['TRYCOMPLEXPYARRAYTEMPLATE']="""\ case PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\ case PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\ case PyArray_BYTE: *(signed char *)(arr->data)=(*v).r; break;\\ - case PyArray_BOOL: *(Bool *)(arr->data)=((*v).r!=0 && (*v).i!=0)); break;\\ + case PyArray_BOOL: *(npy_bool *)(arr->data)=((*v).r!=0 && (*v).i!=0)); break;\\ case PyArray_UBYTE: *(unsigned char *)(arr->data)=(*v).r; break;\\ case PyArray_BYTE: *(signed char *)(arr->data)=(*v).r; break;\\ case PyArray_SHORT: *(short *)(arr->data)=(*v).r; break;\\ - case PyArray_USHORT: *(ushort *)(arr->data)=(*v).r; break;\\ - case PyArray_UINT: *(uint *)(arr->data)=(*v).r; break;\\ - case PyArray_ULONG: *(ulong *)(arr->data)=(*v).r; break;\\ - case PyArray_LONGLONG: *(longlong *)(arr->data)=(*v).r; break;\\ - case PyArray_ULONGLONG: *(ulonglong *)(arr->data)=(*v).r; break;\\ - case PyArray_LONGDOUBLE: *(longdouble *)(arr->data)=(*v).r; break;\\ - case PyArray_CLONGDOUBLE: *(longdouble *)(arr->data)=(*v).r;*(longdouble *)(arr->data+sizeof(longdouble))=(*v).i;break;\\ + case PyArray_USHORT: *(npy_ushort *)(arr->data)=(*v).r; break;\\ + case PyArray_UINT: *(npy_uint *)(arr->data)=(*v).r; break;\\ + case PyArray_ULONG: *(npy_ulong *)(arr->data)=(*v).r; break;\\ + case PyArray_LONGLONG: *(npy_longlong *)(arr->data)=(*v).r; break;\\ + case PyArray_ULONGLONG: *(npy_ulonglong *)(arr->data)=(*v).r; break;\\ + case PyArray_LONGDOUBLE: *(npy_longdouble *)(arr->data)=(*v).r; break;\\ + case PyArray_CLONGDOUBLE: *(npy_longdouble *)(arr->data)=(*v).r;*(npy_longdouble *)(arr->data+sizeof(npy_longdouble))=(*v).i;break;\\ case PyArray_OBJECT: (arr->descr->f->setitem)(pyobj_from_complex_ ## ctype ## 1((*v)),arr->data, arr); break;\\ default: return -2;\\ };\\ @@ -510,8 +510,8 @@ static int calcarrindextr(int *i,PyArrayObject *arr) { \treturn ii; }""" cfuncs['forcomb']="""\ -static struct { int nd;intp *d;int *i,*i_tr,tr; } forcombcache; -static int initforcomb(intp *dims,int nd,int tr) { +static struct { int nd;npy_intp *d;int *i,*i_tr,tr; } forcombcache; +static int initforcomb(npy_intp *dims,int nd,int tr) { int k; if (dims==NULL) return 0; if (nd<0) return 0; @@ -757,7 +757,7 @@ static int long_double_from_pyobj(long_double* v,PyObject *obj,const char *errme \t\t\treturn 1; \t\t} \t\telse if (PyArray_Check(obj) && PyArray_TYPE(obj)==PyArray_LONGDOUBLE) { -\t\t\t(*v) = *((longdouble *)PyArray_DATA(obj)) +\t\t\t(*v) = *((npy_longdouble *)PyArray_DATA(obj)) \t\t\treturn 1; \t\t} \t} @@ -830,8 +830,8 @@ static int complex_long_double_from_pyobj(complex_long_double* v,PyObject *obj,c \t\t\treturn 1; \t\t} \t\telse if (PyArray_Check(obj) && PyArray_TYPE(obj)==PyArray_CLONGDOUBLE) { -\t\t\t(*v).r = ((clongdouble *)PyArray_DATA(obj))->real; -\t\t\t(*v).i = ((clongdouble *)PyArray_DATA(obj))->imag; +\t\t\t(*v).r = ((npy_clongdouble *)PyArray_DATA(obj))->real; +\t\t\t(*v).i = ((npy_clongdouble *)PyArray_DATA(obj))->imag; \t\t\treturn 1; \t\t} \t} @@ -854,13 +854,13 @@ static int complex_double_from_pyobj(complex_double* v,PyObject *obj,const char \t} \tif (PyArray_IsScalar(obj, ComplexFloating)) { \t\tif (PyArray_IsScalar(obj, CFloat)) { -\t\t\tcfloat new; +\t\t\tnpy_cfloat new; \t\t\tPyArray_ScalarAsCtype(obj, &new); \t\t\t(*v).r = (double)new.real; \t\t\t(*v).i = (double)new.imag; \t\t} \t\telse if (PyArray_IsScalar(obj, CLongDouble)) { -\t\t\tclongdouble new; +\t\t\tnpy_clongdouble new; \t\t\tPyArray_ScalarAsCtype(obj, &new); \t\t\t(*v).r = (double)new.real; \t\t\t(*v).i = (double)new.imag; @@ -879,8 +879,8 @@ static int complex_double_from_pyobj(complex_double* v,PyObject *obj,const char \t\t\tarr = PyArray_FromScalar(obj, PyArray_DescrFromType(PyArray_CDOUBLE)); \t\t} \t\tif (arr==NULL) return 0; -\t\t(*v).r = ((cdouble *)PyArray_DATA(arr))->real; -\t\t(*v).i = ((cdouble *)PyArray_DATA(arr))->imag; +\t\t(*v).r = ((npy_cdouble *)PyArray_DATA(arr))->real; +\t\t(*v).i = ((npy_cdouble *)PyArray_DATA(arr))->imag; \t\treturn 1; \t} \t/* Python does not provide PyNumber_Complex function :-( */ diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 9d828aea2..5a2d224f8 100644 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -562,7 +562,7 @@ aux_rules=[ # Array { # Common 'decl':['\t#ctype# *#varname# = NULL;', - '\tintp #varname#_Dims[#rank#] = {#rank*[-1]#};', + '\tnpy_intp #varname#_Dims[#rank#] = {#rank*[-1]#};', '\tconst int #varname#_Rank = #rank#;', ], 'need':['len..',{hasinitvalue:'forcomb'},{hasinitvalue:'CFUNCSMESS'}], @@ -896,7 +896,7 @@ if (#varname#_capi==Py_None) { # Array { # Common 'decl':['\t#ctype# *#varname# = NULL;', - '\tintp #varname#_Dims[#rank#] = {#rank*[-1]#};', + '\tnpy_intp #varname#_Dims[#rank#] = {#rank*[-1]#};', '\tconst int #varname#_Rank = #rank#;', '\tPyArrayObject *capi_#varname#_tmp = NULL;', '\tint capi_#varname#_intent = 0;', diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c index 3e6ccb079..57fa658d4 100644 --- a/numpy/f2py/src/fortranobject.c +++ b/numpy/f2py/src/fortranobject.c @@ -145,7 +145,7 @@ fortran_doc (FortranDataDef def) { } static FortranDataDef *save_def; /* save pointer of an allocatable array */ -static void set_data(char *d,intp *f) { /* callback from Fortran */ +static void set_data(char *d,npy_intp *f) { /* callback from Fortran */ if (*f) /* In fortran f=allocated(d) */ save_def->data = d; else @@ -219,7 +219,7 @@ fortran_setattr(PyFortranObject *fp, char *name, PyObject *v) { return -1; } if (fp->defs[i].func!=NULL) { /* is allocatable array */ - intp dims[F2PY_MAX_DIMS]; + npy_intp dims[F2PY_MAX_DIMS]; int k; save_def = &fp->defs[i]; if (v!=Py_None) { /* set new value (reallocate if needed -- @@ -234,13 +234,13 @@ fortran_setattr(PyFortranObject *fp, char *name, PyObject *v) { (*(fp->defs[i].func))(&fp->defs[i].rank,dims,set_data,&flag); for(k=0;k<fp->defs[i].rank;k++) dims[k]=-1; } - memcpy(fp->defs[i].dims.d,dims,fp->defs[i].rank*sizeof(intp)); + memcpy(fp->defs[i].dims.d,dims,fp->defs[i].rank*sizeof(npy_intp)); } else { /* not allocatable array */ if ((arr = array_from_pyobj(fp->defs[i].type,fp->defs[i].dims.d,fp->defs[i].rank,F2PY_INTENT_IN,v))==NULL) return -1; } if (fp->defs[i].data!=NULL) { /* copy Python object to Fortran array */ - intp s = PyArray_MultiplyList(fp->defs[i].dims.d,arr->nd); + npy_intp s = PyArray_MultiplyList(fp->defs[i].dims.d,arr->nd); if (s==-1) s = PyArray_MultiplyList(arr->dimensions,arr->nd); if (s<0 || @@ -448,7 +448,7 @@ static void f2py_report_on_array_copy_fromany(void) { static int count_nonpos(const int rank, - const intp *dims) { + const npy_intp *dims) { int i=0,r=0; while (i<rank) { if (dims[i] <= 0) ++r; @@ -459,10 +459,10 @@ count_nonpos(const int rank, static int check_and_fix_dimensions(const PyArrayObject* arr, const int rank, - intp *dims); + npy_intp *dims); #ifdef DEBUG_COPY_ND_ARRAY -void dump_dims(int rank, intp* dims) { +void dump_dims(int rank, npy_intp* dims) { int i; printf("["); for(i=0;i<rank;++i) { @@ -472,7 +472,7 @@ void dump_dims(int rank, intp* dims) { } void dump_attrs(const PyArrayObject* arr) { int rank = arr->nd; - intp size = PyArray_Size((PyObject *)arr); + npy_intp size = PyArray_Size((PyObject *)arr); printf("\trank = %d, flags = %d, size = %" INTP_FMT "\n", rank,arr->flags,size); printf("\tstrides = "); @@ -487,8 +487,8 @@ void dump_attrs(const PyArrayObject* arr) { static int swap_arrays(PyArrayObject* arr1, PyArrayObject* arr2) { SWAPTYPE(arr1->data,arr2->data,char*); SWAPTYPE(arr1->nd,arr2->nd,int); - SWAPTYPE(arr1->dimensions,arr2->dimensions,intp*); - SWAPTYPE(arr1->strides,arr2->strides,intp*); + SWAPTYPE(arr1->dimensions,arr2->dimensions,npy_intp*); + SWAPTYPE(arr1->strides,arr2->strides,npy_intp*); SWAPTYPE(arr1->base,arr2->base,PyObject*); SWAPTYPE(arr1->descr,arr2->descr,PyArray_Descr*); SWAPTYPE(arr1->flags,arr2->flags,int); @@ -504,7 +504,7 @@ static int swap_arrays(PyArrayObject* arr1, PyArrayObject* arr2) { extern PyArrayObject* array_from_pyobj(const int type_num, - intp *dims, + npy_intp *dims, const int rank, const int intent, PyObject *obj) { @@ -668,20 +668,20 @@ PyArrayObject* array_from_pyobj(const int type_num, /*****************************************/ static -int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,intp *dims) { +int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *dims) { /* This function fills in blanks (that are -1\'s) in dims list using the dimensions from arr. It also checks that non-blank dims will match with the corresponding values in arr dimensions. */ - const intp arr_size = (arr->nd)?PyArray_Size((PyObject *)arr):1; + const npy_intp arr_size = (arr->nd)?PyArray_Size((PyObject *)arr):1; #ifdef DEBUG_COPY_ND_ARRAY dump_attrs(arr); printf("check_and_fix_dimensions:init: dims="); dump_dims(rank,dims); #endif if (rank > arr->nd) { /* [1,2] -> [[1],[2]]; 1 -> [[1]] */ - intp new_size = 1; + npy_intp new_size = 1; int free_axe = -1; int i; /* Fill dims where -1 or 0; check dimensions; calc new_size; */ @@ -721,7 +721,7 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,intp *dims) } } else if (rank==arr->nd) { int i; - intp d; + npy_intp d; for (i=0; i<rank; ++i) { d = arr->dimensions[i]; if (dims[i]>=0) { @@ -736,9 +736,9 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,intp *dims) } } else { /* [[1,2]] -> [[1],[2]] */ int i,j; - intp d; + npy_intp d; int effrank; - intp size; + npy_intp size; for (i=0,effrank=0;i<arr->nd;++i) if (arr->dimensions[i]>1) ++effrank; if (dims[rank-1]>=0) diff --git a/numpy/f2py/src/fortranobject.h b/numpy/f2py/src/fortranobject.h index 353b2a64b..73d4fad60 100644 --- a/numpy/f2py/src/fortranobject.h +++ b/numpy/f2py/src/fortranobject.h @@ -58,9 +58,9 @@ Author: Pearu Peterson <pearu@cens.ioc.ee> #define F2PY_MAX_DIMS 40 -typedef void (*f2py_set_data_func)(char*,intp*); +typedef void (*f2py_set_data_func)(char*,npy_intp*); typedef void (*f2py_void_func)(void); -typedef void (*f2py_init_func)(int*,intp*,f2py_set_data_func,int*); +typedef void (*f2py_init_func)(int*,npy_intp*,f2py_set_data_func,int*); /*typedef void* (*f2py_c_func)(void*,...);*/ @@ -70,7 +70,7 @@ typedef struct { char *name; /* attribute (array||routine) name */ int rank; /* array rank, 0 for scalar, max is F2PY_MAX_DIMS, || rank=-1 for Fortran routine */ - struct {intp d[F2PY_MAX_DIMS];} dims; /* dimensions of the array, || not used */ + struct {npy_intp d[F2PY_MAX_DIMS];} dims; /* dimensions of the array, || not used */ int type; /* PyArray_<type> || not used */ char *data; /* pointer to array || Fortran routine */ f2py_init_func func; /* initialization function for @@ -108,7 +108,7 @@ typedef struct { #define F2PY_INTENT_INPLACE 256 extern PyArrayObject* array_from_pyobj(const int type_num, - intp *dims, + npy_intp *dims, const int rank, const int intent, PyObject *obj); |