diff options
| author | Travis Oliphant <oliphant@enthought.com> | 2006-07-08 01:17:35 +0000 |
|---|---|---|
| committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-08 01:17:35 +0000 |
| commit | b6f0858d8b714f83e4c8a390fad310648cf0f823 (patch) | |
| tree | e1bc16017cc8cc8f83ab5a50d8a4465d04af4ef6 /numpy | |
| parent | 5694ae71ac969247b44951d2caa9820852ff6e21 (diff) | |
| download | numpy-b6f0858d8b714f83e4c8a390fad310648cf0f823.tar.gz | |
More f2py changes
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/f2py/cb_rules.py | 4 | ||||
| -rw-r--r-- | numpy/f2py/src/fortranobject.c | 40 | ||||
| -rw-r--r-- | numpy/f2py/tests/array_from_pyobj/tests/test_array_from_pyobj.py | 4 | ||||
| -rw-r--r-- | numpy/f2py/tests/array_from_pyobj/wrapmodule.c | 16 |
4 files changed, 32 insertions, 32 deletions
diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py index 40371a106..88de08abf 100644 --- a/numpy/f2py/cb_rules.py +++ b/numpy/f2py/cb_rules.py @@ -358,11 +358,11 @@ cb_arg_rules=[ 'pyobjfrom':[{debugcapi:'\tfprintf(stderr,"debug-capi:cb:#varname#\\n");'}, {isintent_c:"""\ \tif (#name#_nofargs>capi_i) { -\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname#_Dims,#atype#,NULL,(char*)#varname#,0,CARRAY_FLAGS,NULL); /*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname#_Dims,#atype#,NULL,(char*)#varname#,0,NPY_CARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ """, l_not(isintent_c):"""\ \tif (#name#_nofargs>capi_i) { -\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname#_Dims,#atype#,NULL,(char*)#varname#,0,FARRAY_FLAGS,NULL); /*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname#_Dims,#atype#,NULL,(char*)#varname#,0,NPY_FARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ """, }, """ diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c index 0b8beed0d..48f8b3247 100644 --- a/numpy/f2py/src/fortranobject.c +++ b/numpy/f2py/src/fortranobject.c @@ -118,15 +118,15 @@ fortran_doc (FortranDataDef def) { PyArray_Descr *d = PyArray_DescrFromType(def.type); if (sprintf(p,"%s'%c'-",p,d->type)==0) goto fail; if (def.data==NULL) { - if (sprintf(p,"%sarray(%" INTP_FMT,p,def.dims.d[0])==0) goto fail; + if (sprintf(p,"%sarray(%" NPY_INTP_FMT,p,def.dims.d[0])==0) goto fail; for(i=1;i<def.rank;++i) - if (sprintf(p,"%s,%" INTP_FMT,p,def.dims.d[i])==0) goto fail; + if (sprintf(p,"%s,%" NPY_INTP_FMT,p,def.dims.d[i])==0) goto fail; if (sprintf(p,"%s), not allocated",p)==0) goto fail; } else { if (def.rank>0) { - if (sprintf(p,"%sarray(%"INTP_FMT,p,def.dims.d[0])==0) goto fail; + if (sprintf(p,"%sarray(%"NPY_INTP_FMT,p,def.dims.d[0])==0) goto fail; for(i=1;i<def.rank;i++) - if (sprintf(p,"%s,%" INTP_FMT,p,def.dims.d[i])==0) goto fail; + if (sprintf(p,"%s,%" NPY_INTP_FMT,p,def.dims.d[i])==0) goto fail; if (sprintf(p,"%s)",p)==0) goto fail; } else { if (sprintf(p,"%sscalar",p)==0) goto fail; @@ -466,14 +466,14 @@ void dump_dims(int rank, npy_intp* dims) { int i; printf("["); for(i=0;i<rank;++i) { - printf("%3" INTP_FMT, dims[i]); + printf("%3" NPY_INTP_FMT, dims[i]); } printf("]\n"); } void dump_attrs(const PyArrayObject* arr) { int rank = arr->nd; npy_intp size = PyArray_Size((PyObject *)arr); - printf("\trank = %d, flags = %d, size = %" INTP_FMT "\n", + printf("\trank = %d, flags = %d, size = %" NPY_INTP_FMT "\n", rank,arr->flags,size); printf("\tstrides = "); dump_dims(rank,arr->strides); @@ -533,7 +533,7 @@ PyArrayObject* array_from_pyobj(const int type_num, sprintf(mess,"failed to create intent(cache|hide)|optional array" "-- must have defined dimensions but got ("); for(i=0;i<rank;++i) - sprintf(mess+strlen(mess),"%" INTP_FMT ",",dims[i]); + sprintf(mess+strlen(mess),"%" NPY_INTP_FMT ",",dims[i]); sprintf(mess+strlen(mess),")"); PyErr_SetString(PyExc_ValueError,mess); return NULL; @@ -653,7 +653,7 @@ PyArrayObject* array_from_pyobj(const int type_num, arr = (PyArrayObject *) \ PyArray_FromAny(obj,PyArray_DescrFromType(type_num), 0,0, ((intent & F2PY_INTENT_C)?NPY_CARRAY:NPY_FARRAY) \ - | FORCECAST, NULL); + | NPY_FORCECAST, NULL); if (arr==NULL) return NULL; if (check_and_fix_dimensions(arr,rank,dims)) @@ -688,8 +688,8 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *d for(i=0;i<arr->nd;++i) { if (dims[i] >= 0) { if (dims[i]!=arr->dimensions[i]) { - fprintf(stderr,"%d-th dimension must be fixed to %" INTP_FMT - " but got %" INTP_FMT "\n", + fprintf(stderr,"%d-th dimension must be fixed to %" NPY_INTP_FMT + " but got %" NPY_INTP_FMT "\n", i,dims[i], arr->dimensions[i]); return 1; } @@ -701,7 +701,7 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *d } for(i=arr->nd;i<rank;++i) if (dims[i]>1) { - fprintf(stderr,"%d-th dimension must be %" INTP_FMT + fprintf(stderr,"%d-th dimension must be %" NPY_INTP_FMT " but got 0 (not defined).\n", i,dims[i]); return 1; @@ -714,8 +714,8 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *d new_size *= dims[free_axe]; } if (new_size != arr_size) { - fprintf(stderr,"confused: new_size=%" INTP_FMT - ", arr_size=%" INTP_FMT " (maybe too many free" + fprintf(stderr,"confused: new_size=%" NPY_INTP_FMT + ", arr_size=%" NPY_INTP_FMT " (maybe too many free" " indices)\n", new_size,arr_size); return 1; } @@ -726,8 +726,8 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *d d = arr->dimensions[i]; if (dims[i]>=0) { if (d > 1 && d!=dims[i]) { - fprintf(stderr,"%d-th dimension must be fixed to %" INTP_FMT - " but got %" INTP_FMT "\n", + fprintf(stderr,"%d-th dimension must be fixed to %" NPY_INTP_FMT + " but got %" NPY_INTP_FMT "\n", i,dims[i],d); return 1; } @@ -754,8 +754,8 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *d else d = arr->dimensions[j++]; if (dims[i]>=0) { if (d>1 && d!=dims[i]) { - fprintf(stderr,"%d-th dimension must be fixed to %" INTP_FMT - " but got %" INTP_FMT " (real index=%d)\n", + fprintf(stderr,"%d-th dimension must be fixed to %" NPY_INTP_FMT + " but got %" NPY_INTP_FMT " (real index=%d)\n", i,dims[i],d,j-1); return 1; } @@ -772,12 +772,12 @@ int check_and_fix_dimensions(const PyArrayObject* arr,const int rank,npy_intp *d } for (i=0,size=1;i<rank;++i) size *= dims[i]; if (size != arr_size) { - fprintf(stderr,"confused: size=%" INTP_FMT ", arr_size=%" INTP_FMT + fprintf(stderr,"confused: size=%" NPY_INTP_FMT ", arr_size=%" NPY_INTP_FMT ", rank=%d, effrank=%d, arr.nd=%d, dims=[", size,arr_size,rank,effrank,arr->nd); - for (i=0;i<rank;++i) fprintf(stderr," %" INTP_FMT,dims[i]); + for (i=0;i<rank;++i) fprintf(stderr," %" NPY_INTP_FMT,dims[i]); fprintf(stderr," ], arr.dims=["); - for (i=0;i<arr->nd;++i) fprintf(stderr," %" INTP_FMT,arr->dimensions[i]); + for (i=0;i<arr->nd;++i) fprintf(stderr," %" NPY_INTP_FMT,arr->dimensions[i]); fprintf(stderr," ]\n"); return 1; } diff --git a/numpy/f2py/tests/array_from_pyobj/tests/test_array_from_pyobj.py b/numpy/f2py/tests/array_from_pyobj/tests/test_array_from_pyobj.py index 2a6ec85f7..a2478784a 100644 --- a/numpy/f2py/tests/array_from_pyobj/tests/test_array_from_pyobj.py +++ b/numpy/f2py/tests/array_from_pyobj/tests/test_array_from_pyobj.py @@ -18,8 +18,8 @@ def flags2names(flags): info = [] for flagname in ['CONTIGUOUS','FORTRAN','OWNDATA','ENSURECOPY', 'ENSUREARRAY','ALIGNED','NOTSWAPPED','WRITEABLE', - 'UPDATEIFCOPY','BEHAVED_FLAGS','BEHAVED_FLAGS_RO', - 'CARRAY_FLAGS','FARRAY_FLAGS' + 'UPDATEIFCOPY','BEHAVED','BEHAVED_RO', + 'CARRAY','FARRAY' ]: if abs(flags) & getattr(wrap,flagname): info.append(flagname) diff --git a/numpy/f2py/tests/array_from_pyobj/wrapmodule.c b/numpy/f2py/tests/array_from_pyobj/wrapmodule.c index 58d7e6da4..38a794a7d 100644 --- a/numpy/f2py/tests/array_from_pyobj/wrapmodule.c +++ b/numpy/f2py/tests/array_from_pyobj/wrapmodule.c @@ -174,14 +174,14 @@ PyMODINIT_FUNC initwrap(void) { PyDict_SetItemString(d, "WRITEABLE", PyInt_FromLong(WRITEABLE)); PyDict_SetItemString(d, "UPDATEIFCOPY", PyInt_FromLong(UPDATEIFCOPY)); - PyDict_SetItemString(d, "BEHAVED_FLAGS", PyInt_FromLong(BEHAVED_FLAGS)); - PyDict_SetItemString(d, "BEHAVED_NS_FLAGS", PyInt_FromLong(BEHAVED_NS_FLAGS)); - PyDict_SetItemString(d, "CARRAY_FLAGS", PyInt_FromLong(CARRAY_FLAGS)); - PyDict_SetItemString(d, "FARRAY_FLAGS", PyInt_FromLong(FARRAY_FLAGS)); - PyDict_SetItemString(d, "CARRAY_FLAGS_RO", PyInt_FromLong(CARRAY_FLAGS_RO)); - PyDict_SetItemString(d, "FARRAY_FLAGS_RO", PyInt_FromLong(FARRAY_FLAGS_RO)); - PyDict_SetItemString(d, "DEFAULT_FLAGS", PyInt_FromLong(DEFAULT_FLAGS)); - PyDict_SetItemString(d, "UPDATE_ALL_FLAGS", PyInt_FromLong(UPDATE_ALL_FLAGS)); + PyDict_SetItemString(d, "BEHAVED", PyInt_FromLong(NPY_BEHAVED)); + PyDict_SetItemString(d, "BEHAVED_NS", PyInt_FromLong(NPY_BEHAVED_NS)); + PyDict_SetItemString(d, "CARRAY", PyInt_FromLong(NPY_CARRAY)); + PyDict_SetItemString(d, "FARRAY", PyInt_FromLong(NPY_FARRAY)); + PyDict_SetItemString(d, "CARRAY_RO", PyInt_FromLong(NPY_CARRAY_RO)); + PyDict_SetItemString(d, "FARRAY_RO", PyInt_FromLong(NPY_FARRAY_RO)); + PyDict_SetItemString(d, "DEFAULT", PyInt_FromLong(NPY_DEFAULT)); + PyDict_SetItemString(d, "UPDATE_ALL", PyInt_FromLong(NPY_UPDATE_ALL)); if (PyErr_Occurred()) Py_FatalError("can't initialize module wrap"); |
