fileobject.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. /* The default encoding used by the platform file system APIs
  16. If non-NULL, this is different than the default encoding for strings
  17. */
  18. Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
  19. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
  20. Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
  21. #endif
  22. Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
  23. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
  24. Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_UTF8Mode;
  25. #endif
  26. /* A routine to check if a file descriptor can be select()-ed. */
  27. #ifdef _MSC_VER
  28. /* On Windows, any socket fd can be select()-ed, no matter how high */
  29. #define _PyIsSelectable_fd(FD) (1)
  30. #else
  31. #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
  32. #endif
  33. #ifndef Py_LIMITED_API
  34. # define Py_CPYTHON_FILEOBJECT_H
  35. # include "cpython/fileobject.h"
  36. # undef Py_CPYTHON_FILEOBJECT_H
  37. #endif
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* !Py_FILEOBJECT_H */