fileobject.h 1.5 KB

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