From b6f0858d8b714f83e4c8a390fad310648cf0f823 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Sat, 8 Jul 2006 01:17:35 +0000 Subject: More f2py changes --- numpy/f2py/cb_rules.py | 4 +-- numpy/f2py/src/fortranobject.c | 40 +++++++++++----------- .../tests/test_array_from_pyobj.py | 4 +-- 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;i0) { - 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;ind; 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;ind;++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;i1) { - 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;ind); - for (i=0;ind;++i) fprintf(stderr," %" INTP_FMT,arr->dimensions[i]); + for (i=0;ind;++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"); -- cgit v1.2.1