You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
3.6 KiB

  1. #ifndef Py_FILEUTILS_H
  2. #define Py_FILEUTILS_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
  7. PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
  8. const char *arg,
  9. size_t *size);
  10. PyAPI_FUNC(char*) Py_EncodeLocale(
  11. const wchar_t *text,
  12. size_t *error_pos);
  13. PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
  14. const wchar_t *text,
  15. size_t *error_pos);
  16. #endif
  17. #ifdef Py_BUILD_CORE
  18. PyAPI_FUNC(int) _Py_DecodeUTF8Ex(
  19. const char *arg,
  20. Py_ssize_t arglen,
  21. wchar_t **wstr,
  22. size_t *wlen,
  23. const char **reason,
  24. int surrogateescape);
  25. PyAPI_FUNC(int) _Py_EncodeUTF8Ex(
  26. const wchar_t *text,
  27. char **str,
  28. size_t *error_pos,
  29. const char **reason,
  30. int raw_malloc,
  31. int surrogateescape);
  32. PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape(
  33. const char *arg,
  34. Py_ssize_t arglen);
  35. PyAPI_FUNC(int) _Py_DecodeLocaleEx(
  36. const char *arg,
  37. wchar_t **wstr,
  38. size_t *wlen,
  39. const char **reason,
  40. int current_locale,
  41. int surrogateescape);
  42. PyAPI_FUNC(int) _Py_EncodeLocaleEx(
  43. const wchar_t *text,
  44. char **str,
  45. size_t *error_pos,
  46. const char **reason,
  47. int current_locale,
  48. int surrogateescape);
  49. #endif
  50. #ifndef Py_LIMITED_API
  51. PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
  52. #ifdef MS_WINDOWS
  53. struct _Py_stat_struct {
  54. unsigned long st_dev;
  55. uint64_t st_ino;
  56. unsigned short st_mode;
  57. int st_nlink;
  58. int st_uid;
  59. int st_gid;
  60. unsigned long st_rdev;
  61. __int64 st_size;
  62. time_t st_atime;
  63. int st_atime_nsec;
  64. time_t st_mtime;
  65. int st_mtime_nsec;
  66. time_t st_ctime;
  67. int st_ctime_nsec;
  68. unsigned long st_file_attributes;
  69. };
  70. #else
  71. # define _Py_stat_struct stat
  72. #endif
  73. PyAPI_FUNC(int) _Py_fstat(
  74. int fd,
  75. struct _Py_stat_struct *status);
  76. PyAPI_FUNC(int) _Py_fstat_noraise(
  77. int fd,
  78. struct _Py_stat_struct *status);
  79. PyAPI_FUNC(int) _Py_stat(
  80. PyObject *path,
  81. struct stat *status);
  82. PyAPI_FUNC(int) _Py_open(
  83. const char *pathname,
  84. int flags);
  85. PyAPI_FUNC(int) _Py_open_noraise(
  86. const char *pathname,
  87. int flags);
  88. PyAPI_FUNC(FILE *) _Py_wfopen(
  89. const wchar_t *path,
  90. const wchar_t *mode);
  91. PyAPI_FUNC(FILE*) _Py_fopen(
  92. const char *pathname,
  93. const char *mode);
  94. PyAPI_FUNC(FILE*) _Py_fopen_obj(
  95. PyObject *path,
  96. const char *mode);
  97. PyAPI_FUNC(Py_ssize_t) _Py_read(
  98. int fd,
  99. void *buf,
  100. size_t count);
  101. PyAPI_FUNC(Py_ssize_t) _Py_write(
  102. int fd,
  103. const void *buf,
  104. size_t count);
  105. PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
  106. int fd,
  107. const void *buf,
  108. size_t count);
  109. #ifdef HAVE_READLINK
  110. PyAPI_FUNC(int) _Py_wreadlink(
  111. const wchar_t *path,
  112. wchar_t *buf,
  113. size_t bufsiz);
  114. #endif
  115. #ifdef HAVE_REALPATH
  116. PyAPI_FUNC(wchar_t*) _Py_wrealpath(
  117. const wchar_t *path,
  118. wchar_t *resolved_path,
  119. size_t resolved_path_size);
  120. #endif
  121. PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
  122. wchar_t *buf,
  123. size_t size);
  124. PyAPI_FUNC(int) _Py_get_inheritable(int fd);
  125. PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
  126. int *atomic_flag_works);
  127. PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable,
  128. int *atomic_flag_works);
  129. PyAPI_FUNC(int) _Py_dup(int fd);
  130. #ifndef MS_WINDOWS
  131. PyAPI_FUNC(int) _Py_get_blocking(int fd);
  132. PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
  133. #endif /* !MS_WINDOWS */
  134. PyAPI_FUNC(int) _Py_GetLocaleconvNumeric(
  135. PyObject **decimal_point,
  136. PyObject **thousands_sep,
  137. const char **grouping);
  138. #endif /* Py_LIMITED_API */
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif /* !Py_FILEUTILS_H */