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 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 27 PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; 28 #endif 29 PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; 30 31 /* Internal API 32 33 The std printer acts as a preliminary sys.stderr until the new io 34 infrastructure is in place. */ 35 #ifndef Py_LIMITED_API 36 PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); 37 PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; 38 #endif /* Py_LIMITED_API */ 39 40 /* A routine to check if a file descriptor can be select()-ed. */ 41 #ifdef HAVE_SELECT 42 #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) 43 #else 44 #define _PyIsSelectable_fd(FD) (1) 45 #endif /* HAVE_SELECT */ 46 47 #ifdef __cplusplus 48 } 49 #endif 50 #endif /* !Py_FILEOBJECT_H */ 51