| 180 | } |
| 181 | |
| 182 | PyObject * |
| 183 | PyFortranObject_NewAsAttr(FortranDataDef *defs) |
| 184 | { /* used for calling F90 module routines */ |
| 185 | PyFortranObject *fp = NULL; |
| 186 | fp = PyObject_New(PyFortranObject, &PyFortran_Type); |
| 187 | if (fp == NULL) |
| 188 | return NULL; |
| 189 | if ((fp->dict = PyDict_New()) == NULL) { |
| 190 | PyObject_Del(fp); |
| 191 | return NULL; |
| 192 | } |
| 193 | fp->len = 1; |
| 194 | fp->defs = defs; |
| 195 | if (defs->rank == -1) { |
| 196 | PyDict_SetItemString(fp->dict, "__name__", PyUnicode_FromFormat("function %s", defs->name)); |
| 197 | } else if (defs->rank == 0) { |
| 198 | PyDict_SetItemString(fp->dict, "__name__", PyUnicode_FromFormat("scalar %s", defs->name)); |
| 199 | } else { |
| 200 | PyDict_SetItemString(fp->dict, "__name__", PyUnicode_FromFormat("array %s", defs->name)); |
| 201 | } |
| 202 | return (PyObject *)fp; |
| 203 | } |
| 204 | |
| 205 | /* Fortran methods */ |
| 206 |
no outgoing calls
no test coverage detected