fileobject.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
  19. PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
  20. /* A routine to check if a file descriptor can be select()-ed. */
  21. #ifdef _MSC_VER
  22. /* On Windows, any socket fd can be select()-ed, no matter how high */
  23. #define _PyIsSelectable_fd(FD) (1)
  24. #else
  25. #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
  26. #endif
  27. #ifndef Py_LIMITED_API
  28. # define Py_CPYTHON_FILEOBJECT_H
  29. # include "cpython/fileobject.h"
  30. # undef Py_CPYTHON_FILEOBJECT_H
  31. #endif
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif /* !Py_FILEOBJECT_H */