annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/fileutils.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 #ifndef Py_FILEUTILS_H
jpayne@69 2 #define Py_FILEUTILS_H
jpayne@69 3 #ifdef __cplusplus
jpayne@69 4 extern "C" {
jpayne@69 5 #endif
jpayne@69 6
jpayne@69 7 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
jpayne@69 8 PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
jpayne@69 9 const char *arg,
jpayne@69 10 size_t *size);
jpayne@69 11
jpayne@69 12 PyAPI_FUNC(char*) Py_EncodeLocale(
jpayne@69 13 const wchar_t *text,
jpayne@69 14 size_t *error_pos);
jpayne@69 15
jpayne@69 16 PyAPI_FUNC(char*) _Py_EncodeLocaleRaw(
jpayne@69 17 const wchar_t *text,
jpayne@69 18 size_t *error_pos);
jpayne@69 19 #endif
jpayne@69 20
jpayne@69 21
jpayne@69 22 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000
jpayne@69 23 typedef enum {
jpayne@69 24 _Py_ERROR_UNKNOWN=0,
jpayne@69 25 _Py_ERROR_STRICT,
jpayne@69 26 _Py_ERROR_SURROGATEESCAPE,
jpayne@69 27 _Py_ERROR_REPLACE,
jpayne@69 28 _Py_ERROR_IGNORE,
jpayne@69 29 _Py_ERROR_BACKSLASHREPLACE,
jpayne@69 30 _Py_ERROR_SURROGATEPASS,
jpayne@69 31 _Py_ERROR_XMLCHARREFREPLACE,
jpayne@69 32 _Py_ERROR_OTHER
jpayne@69 33 } _Py_error_handler;
jpayne@69 34
jpayne@69 35 PyAPI_FUNC(_Py_error_handler) _Py_GetErrorHandler(const char *errors);
jpayne@69 36
jpayne@69 37 PyAPI_FUNC(int) _Py_DecodeLocaleEx(
jpayne@69 38 const char *arg,
jpayne@69 39 wchar_t **wstr,
jpayne@69 40 size_t *wlen,
jpayne@69 41 const char **reason,
jpayne@69 42 int current_locale,
jpayne@69 43 _Py_error_handler errors);
jpayne@69 44
jpayne@69 45 PyAPI_FUNC(int) _Py_EncodeLocaleEx(
jpayne@69 46 const wchar_t *text,
jpayne@69 47 char **str,
jpayne@69 48 size_t *error_pos,
jpayne@69 49 const char **reason,
jpayne@69 50 int current_locale,
jpayne@69 51 _Py_error_handler errors);
jpayne@69 52 #endif
jpayne@69 53
jpayne@69 54 #ifndef Py_LIMITED_API
jpayne@69 55 PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
jpayne@69 56
jpayne@69 57 #if defined(MS_WINDOWS) || defined(__APPLE__)
jpayne@69 58 /* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611).
jpayne@69 59 On macOS 10.13, read() and write() with more than INT_MAX bytes
jpayne@69 60 fail with EINVAL (bpo-24658). */
jpayne@69 61 # define _PY_READ_MAX INT_MAX
jpayne@69 62 # define _PY_WRITE_MAX INT_MAX
jpayne@69 63 #else
jpayne@69 64 /* write() should truncate the input to PY_SSIZE_T_MAX bytes,
jpayne@69 65 but it's safer to do it ourself to have a portable behaviour */
jpayne@69 66 # define _PY_READ_MAX PY_SSIZE_T_MAX
jpayne@69 67 # define _PY_WRITE_MAX PY_SSIZE_T_MAX
jpayne@69 68 #endif
jpayne@69 69
jpayne@69 70 #ifdef MS_WINDOWS
jpayne@69 71 struct _Py_stat_struct {
jpayne@69 72 unsigned long st_dev;
jpayne@69 73 uint64_t st_ino;
jpayne@69 74 unsigned short st_mode;
jpayne@69 75 int st_nlink;
jpayne@69 76 int st_uid;
jpayne@69 77 int st_gid;
jpayne@69 78 unsigned long st_rdev;
jpayne@69 79 __int64 st_size;
jpayne@69 80 time_t st_atime;
jpayne@69 81 int st_atime_nsec;
jpayne@69 82 time_t st_mtime;
jpayne@69 83 int st_mtime_nsec;
jpayne@69 84 time_t st_ctime;
jpayne@69 85 int st_ctime_nsec;
jpayne@69 86 unsigned long st_file_attributes;
jpayne@69 87 unsigned long st_reparse_tag;
jpayne@69 88 };
jpayne@69 89 #else
jpayne@69 90 # define _Py_stat_struct stat
jpayne@69 91 #endif
jpayne@69 92
jpayne@69 93 PyAPI_FUNC(int) _Py_fstat(
jpayne@69 94 int fd,
jpayne@69 95 struct _Py_stat_struct *status);
jpayne@69 96
jpayne@69 97 PyAPI_FUNC(int) _Py_fstat_noraise(
jpayne@69 98 int fd,
jpayne@69 99 struct _Py_stat_struct *status);
jpayne@69 100
jpayne@69 101 PyAPI_FUNC(int) _Py_stat(
jpayne@69 102 PyObject *path,
jpayne@69 103 struct stat *status);
jpayne@69 104
jpayne@69 105 PyAPI_FUNC(int) _Py_open(
jpayne@69 106 const char *pathname,
jpayne@69 107 int flags);
jpayne@69 108
jpayne@69 109 PyAPI_FUNC(int) _Py_open_noraise(
jpayne@69 110 const char *pathname,
jpayne@69 111 int flags);
jpayne@69 112
jpayne@69 113 PyAPI_FUNC(FILE *) _Py_wfopen(
jpayne@69 114 const wchar_t *path,
jpayne@69 115 const wchar_t *mode);
jpayne@69 116
jpayne@69 117 PyAPI_FUNC(FILE*) _Py_fopen(
jpayne@69 118 const char *pathname,
jpayne@69 119 const char *mode);
jpayne@69 120
jpayne@69 121 PyAPI_FUNC(FILE*) _Py_fopen_obj(
jpayne@69 122 PyObject *path,
jpayne@69 123 const char *mode);
jpayne@69 124
jpayne@69 125 PyAPI_FUNC(Py_ssize_t) _Py_read(
jpayne@69 126 int fd,
jpayne@69 127 void *buf,
jpayne@69 128 size_t count);
jpayne@69 129
jpayne@69 130 PyAPI_FUNC(Py_ssize_t) _Py_write(
jpayne@69 131 int fd,
jpayne@69 132 const void *buf,
jpayne@69 133 size_t count);
jpayne@69 134
jpayne@69 135 PyAPI_FUNC(Py_ssize_t) _Py_write_noraise(
jpayne@69 136 int fd,
jpayne@69 137 const void *buf,
jpayne@69 138 size_t count);
jpayne@69 139
jpayne@69 140 #ifdef HAVE_READLINK
jpayne@69 141 PyAPI_FUNC(int) _Py_wreadlink(
jpayne@69 142 const wchar_t *path,
jpayne@69 143 wchar_t *buf,
jpayne@69 144 /* Number of characters of 'buf' buffer
jpayne@69 145 including the trailing NUL character */
jpayne@69 146 size_t buflen);
jpayne@69 147 #endif
jpayne@69 148
jpayne@69 149 #ifdef HAVE_REALPATH
jpayne@69 150 PyAPI_FUNC(wchar_t*) _Py_wrealpath(
jpayne@69 151 const wchar_t *path,
jpayne@69 152 wchar_t *resolved_path,
jpayne@69 153 /* Number of characters of 'resolved_path' buffer
jpayne@69 154 including the trailing NUL character */
jpayne@69 155 size_t resolved_path_len);
jpayne@69 156 #endif
jpayne@69 157
jpayne@69 158 PyAPI_FUNC(wchar_t*) _Py_wgetcwd(
jpayne@69 159 wchar_t *buf,
jpayne@69 160 /* Number of characters of 'buf' buffer
jpayne@69 161 including the trailing NUL character */
jpayne@69 162 size_t buflen);
jpayne@69 163
jpayne@69 164 PyAPI_FUNC(int) _Py_get_inheritable(int fd);
jpayne@69 165
jpayne@69 166 PyAPI_FUNC(int) _Py_set_inheritable(int fd, int inheritable,
jpayne@69 167 int *atomic_flag_works);
jpayne@69 168
jpayne@69 169 PyAPI_FUNC(int) _Py_set_inheritable_async_safe(int fd, int inheritable,
jpayne@69 170 int *atomic_flag_works);
jpayne@69 171
jpayne@69 172 PyAPI_FUNC(int) _Py_dup(int fd);
jpayne@69 173
jpayne@69 174 #ifndef MS_WINDOWS
jpayne@69 175 PyAPI_FUNC(int) _Py_get_blocking(int fd);
jpayne@69 176
jpayne@69 177 PyAPI_FUNC(int) _Py_set_blocking(int fd, int blocking);
jpayne@69 178 #endif /* !MS_WINDOWS */
jpayne@69 179
jpayne@69 180 #endif /* Py_LIMITED_API */
jpayne@69 181
jpayne@69 182 #ifdef __cplusplus
jpayne@69 183 }
jpayne@69 184 #endif
jpayne@69 185 #endif /* !Py_FILEUTILS_H */