fileobject.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
  23. PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
  24. #endif
  25. PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
  26. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
  27. PyAPI_DATA(int) Py_UTF8Mode;
  28. #endif
  29. /* Internal API
  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. /* A routine to check if a file descriptor can be select()-ed. */
  37. #ifdef _MSC_VER
  38. /* On Windows, any socket fd can be select()-ed, no matter how high */
  39. #define _PyIsSelectable_fd(FD) (1)
  40. #else
  41. #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
  42. #endif
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif /* !Py_FILEOBJECT_H */