]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Modules / _io / _iomodule.h
CommitLineData
7eb75bcc
DM
1/*\r
2 * Declarations shared between the different parts of the io module\r
3 */\r
4\r
5/* ABCs */\r
6extern PyTypeObject PyIOBase_Type;\r
7extern PyTypeObject PyRawIOBase_Type;\r
8extern PyTypeObject PyBufferedIOBase_Type;\r
9extern PyTypeObject PyTextIOBase_Type;\r
10\r
11/* Concrete classes */\r
12extern PyTypeObject PyFileIO_Type;\r
13extern PyTypeObject PyBytesIO_Type;\r
14extern PyTypeObject PyStringIO_Type;\r
15extern PyTypeObject PyBufferedReader_Type;\r
16extern PyTypeObject PyBufferedWriter_Type;\r
17extern PyTypeObject PyBufferedRWPair_Type;\r
18extern PyTypeObject PyBufferedRandom_Type;\r
19extern PyTypeObject PyTextIOWrapper_Type;\r
20extern PyTypeObject PyIncrementalNewlineDecoder_Type;\r
21\r
22\r
23extern int _PyIO_ConvertSsize_t(PyObject *, void *);\r
24\r
25/* These functions are used as METH_NOARGS methods, are normally called\r
26 * with args=NULL, and return a new reference.\r
27 * BUT when args=Py_True is passed, they return a borrowed reference.\r
28 */\r
29extern PyObject* _PyIOBase_check_readable(PyObject *self, PyObject *args);\r
30extern PyObject* _PyIOBase_check_writable(PyObject *self, PyObject *args);\r
31extern PyObject* _PyIOBase_check_seekable(PyObject *self, PyObject *args);\r
32extern PyObject* _PyIOBase_check_closed(PyObject *self, PyObject *args);\r
33\r
34/* Helper for finalization.\r
35 This function will revive an object ready to be deallocated and try to\r
36 close() it. It returns 0 if the object can be destroyed, or -1 if it\r
37 is alive again. */\r
38extern int _PyIOBase_finalize(PyObject *self);\r
39\r
40/* Returns true if the given FileIO object is closed.\r
41 Doesn't check the argument type, so be careful! */\r
42extern int _PyFileIO_closed(PyObject *self);\r
43\r
44/* Shortcut to the core of the IncrementalNewlineDecoder.decode method */\r
45extern PyObject *_PyIncrementalNewlineDecoder_decode(\r
46 PyObject *self, PyObject *input, int final);\r
47\r
48/* Finds the first line ending between `start` and `end`.\r
49 If found, returns the index after the line ending and doesn't touch\r
50 `*consumed`.\r
51 If not found, returns -1 and sets `*consumed` to the number of characters\r
52 which can be safely put aside until another search.\r
53 \r
54 NOTE: for performance reasons, `end` must point to a NUL character ('\0'). \r
55 Otherwise, the function will scan further and return garbage. */\r
56extern Py_ssize_t _PyIO_find_line_ending(\r
57 int translated, int universal, PyObject *readnl,\r
58 Py_UNICODE *start, Py_UNICODE *end, Py_ssize_t *consumed);\r
59\r
60/* Return 1 if an EnvironmentError with errno == EINTR is set (and then\r
61 clears the error indicator), 0 otherwise.\r
62 Should only be called when PyErr_Occurred() is true.\r
63*/\r
64extern int _PyIO_trap_eintr(void);\r
65\r
66#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */\r
67\r
68typedef struct {\r
69 /* This is the equivalent of PyException_HEAD in 3.x */\r
70 PyObject_HEAD\r
71 PyObject *dict;\r
72 PyObject *args;\r
73 PyObject *message;\r
74\r
75 PyObject *myerrno;\r
76 PyObject *strerror;\r
77 PyObject *filename; /* Not used, but part of the IOError object */\r
78 Py_ssize_t written;\r
79} PyBlockingIOErrorObject;\r
80extern PyObject *PyExc_BlockingIOError;\r
81\r
82/*\r
83 * Offset type for positioning.\r
84 */\r
85\r
86/* Printing a variable of type off_t (with e.g., PyString_FromFormat)\r
87 correctly and without producing compiler warnings is surprisingly painful.\r
88 We identify an integer type whose size matches off_t and then: (1) cast the\r
89 off_t to that integer type and (2) use the appropriate conversion\r
90 specification. The cast is necessary: gcc complains about formatting a\r
91 long with "%lld" even when both long and long long have the same\r
92 precision. */\r
93\r
94#if defined(MS_WIN64) || defined(MS_WINDOWS)\r
95\r
96/* Windows uses long long for offsets */\r
97typedef PY_LONG_LONG Py_off_t;\r
98# define PyLong_AsOff_t PyLong_AsLongLong\r
99# define PyLong_FromOff_t PyLong_FromLongLong\r
100# define PY_OFF_T_MAX PY_LLONG_MAX\r
101# define PY_OFF_T_MIN PY_LLONG_MIN\r
102# define PY_OFF_T_COMPAT PY_LONG_LONG /* type compatible with off_t */\r
103# define PY_PRIdOFF "lld" /* format to use for that type */\r
104\r
105#else\r
106\r
107/* Other platforms use off_t */\r
108typedef off_t Py_off_t;\r
109#if (SIZEOF_OFF_T == SIZEOF_SIZE_T)\r
110# define PyLong_AsOff_t PyLong_AsSsize_t\r
111# define PyLong_FromOff_t PyLong_FromSsize_t\r
112# define PY_OFF_T_MAX PY_SSIZE_T_MAX\r
113# define PY_OFF_T_MIN PY_SSIZE_T_MIN\r
114# define PY_OFF_T_COMPAT Py_ssize_t\r
115# define PY_PRIdOFF "zd"\r
116#elif (HAVE_LONG_LONG && SIZEOF_OFF_T == SIZEOF_LONG_LONG)\r
117# define PyLong_AsOff_t PyLong_AsLongLong\r
118# define PyLong_FromOff_t PyLong_FromLongLong\r
119# define PY_OFF_T_MAX PY_LLONG_MAX\r
120# define PY_OFF_T_MIN PY_LLONG_MIN\r
121# define PY_OFF_T_COMPAT PY_LONG_LONG\r
122# define PY_PRIdOFF "lld"\r
123#elif (SIZEOF_OFF_T == SIZEOF_LONG)\r
124# define PyLong_AsOff_t PyLong_AsLong\r
125# define PyLong_FromOff_t PyLong_FromLong\r
126# define PY_OFF_T_MAX LONG_MAX\r
127# define PY_OFF_T_MIN LONG_MIN\r
128# define PY_OFF_T_COMPAT long\r
129# define PY_PRIdOFF "ld"\r
130#else\r
131# error off_t does not match either size_t, long, or long long!\r
132#endif\r
133\r
134#endif\r
135\r
136extern Py_off_t PyNumber_AsOff_t(PyObject *item, PyObject *err);\r
137\r
138/* Implementation details */\r
139\r
140extern PyObject *_PyIO_os_module;\r
141extern PyObject *_PyIO_locale_module;\r
142extern PyObject *_PyIO_unsupported_operation;\r
143\r
144extern PyObject *_PyIO_str_close;\r
145extern PyObject *_PyIO_str_closed;\r
146extern PyObject *_PyIO_str_decode;\r
147extern PyObject *_PyIO_str_encode;\r
148extern PyObject *_PyIO_str_fileno;\r
149extern PyObject *_PyIO_str_flush;\r
150extern PyObject *_PyIO_str_getstate;\r
151extern PyObject *_PyIO_str_isatty;\r
152extern PyObject *_PyIO_str_newlines;\r
153extern PyObject *_PyIO_str_nl;\r
154extern PyObject *_PyIO_str_read;\r
155extern PyObject *_PyIO_str_read1;\r
156extern PyObject *_PyIO_str_readable;\r
157extern PyObject *_PyIO_str_readinto;\r
158extern PyObject *_PyIO_str_readline;\r
159extern PyObject *_PyIO_str_reset;\r
160extern PyObject *_PyIO_str_seek;\r
161extern PyObject *_PyIO_str_seekable;\r
162extern PyObject *_PyIO_str_setstate;\r
163extern PyObject *_PyIO_str_tell;\r
164extern PyObject *_PyIO_str_truncate;\r
165extern PyObject *_PyIO_str_writable;\r
166extern PyObject *_PyIO_str_write;\r
167\r
168extern PyObject *_PyIO_empty_str;\r
169extern PyObject *_PyIO_empty_bytes;\r
170extern PyObject *_PyIO_zero;\r