| 1 | /* File object interface (what's left of it -- see io.py) */ |
| 2 | |
| 3 | #ifndef Py_FILEOBJECT_H |
| 4 | #define Py_FILEOBJECT_H |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | #define PY_STDIOTEXTMODE "b" |
| 10 | |
| 11 | PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int, |
| 12 | const char *, const char *, |
| 13 | const char *, int); |
| 14 | PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); |
| 15 | PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); |
| 16 | PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); |
| 17 | PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); |
| 18 | #ifndef Py_LIMITED_API |
| 19 | PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); |
| 20 | #endif |
| 21 | |
| 22 | /* The default encoding used by the platform file system APIs |
| 23 | If non-NULL, this is different than the default encoding for strings |
| 24 | */ |
| 25 | PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; |
| 26 | PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; |
| 27 | |
| 28 | /* Internal API |
| 29 | |
| 30 | The std printer acts as a preliminary sys.stderr until the new io |
| 31 | infrastructure is in place. */ |
| 32 | #ifndef Py_LIMITED_API |
| 33 | PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); |
| 34 | PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; |
| 35 | #endif /* Py_LIMITED_API */ |
| 36 | |
| 37 | /* A routine to check if a file descriptor can be select()-ed. */ |
| 38 | #ifdef HAVE_SELECT |
| 39 | #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) |
| 40 | #else |
| 41 | #define _PyIsSelectable_fd(FD) (1) |
| 42 | #endif /* HAVE_SELECT */ |
| 43 | |
| 44 | #ifdef __cplusplus |
| 45 | } |
| 46 | #endif |
| 47 | #endif /* !Py_FILEOBJECT_H */ |
| 48 | |