]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Modules/_io/_iomodule.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Modules / _io / _iomodule.h
CommitLineData
4710c53d 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\r
61#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */\r
62\r
63typedef struct {\r
64 /* This is the equivalent of PyException_HEAD in 3.x */\r
65 PyObject_HEAD\r
66 PyObject *dict;\r
67 PyObject *args;\r
68 PyObject *message;\r
69\r
70 PyObject *myerrno;\r
71 PyObject *strerror;\r
72 PyObject *filename; /* Not used, but part of the IOError object */\r
73 Py_ssize_t written;\r
74} PyBlockingIOErrorObject;\r
75PyAPI_DATA(PyObject *) PyExc_BlockingIOError;\r
76\r
77/*\r
78 * Offset type for positioning.\r
79 */\r
80\r
81/* Printing a variable of type off_t (with e.g., PyString_FromFormat)\r
82 correctly and without producing compiler warnings is surprisingly painful.\r
83 We identify an integer type whose size matches off_t and then: (1) cast the\r
84 off_t to that integer type and (2) use the appropriate conversion\r
85 specification. The cast is necessary: gcc complains about formatting a\r
86 long with "%lld" even when both long and long long have the same\r
87 precision. */\r
88\r
89#if defined(MS_WIN64) || defined(MS_WINDOWS)\r
90\r
91/* Windows uses long long for offsets */\r
92typedef PY_LONG_LONG Py_off_t;\r
93# define PyLong_AsOff_t PyLong_AsLongLong\r
94# define PyLong_FromOff_t PyLong_FromLongLong\r
95# define PY_OFF_T_MAX PY_LLONG_MAX\r
96# define PY_OFF_T_MIN PY_LLONG_MIN\r
97# define PY_OFF_T_COMPAT PY_LONG_LONG /* type compatible with off_t */\r
98# define PY_PRIdOFF "lld" /* format to use for that type */\r
99\r
100#else\r
101\r
102/* Other platforms use off_t */\r
103typedef off_t Py_off_t;\r
104#if (SIZEOF_OFF_T == SIZEOF_SIZE_T)\r
105# define PyLong_AsOff_t PyLong_AsSsize_t\r
106# define PyLong_FromOff_t PyLong_FromSsize_t\r
107# define PY_OFF_T_MAX PY_SSIZE_T_MAX\r
108# define PY_OFF_T_MIN PY_SSIZE_T_MIN\r
109# define PY_OFF_T_COMPAT Py_ssize_t\r
110# define PY_PRIdOFF "zd"\r
111#elif (HAVE_LONG_LONG && SIZEOF_OFF_T == SIZEOF_LONG_LONG)\r
112# define PyLong_AsOff_t PyLong_AsLongLong\r
113# define PyLong_FromOff_t PyLong_FromLongLong\r
114# define PY_OFF_T_MAX PY_LLONG_MAX\r
115# define PY_OFF_T_MIN PY_LLONG_MIN\r
116# define PY_OFF_T_COMPAT PY_LONG_LONG\r
117# define PY_PRIdOFF "lld"\r
118#elif (SIZEOF_OFF_T == SIZEOF_LONG)\r
119# define PyLong_AsOff_t PyLong_AsLong\r
120# define PyLong_FromOff_t PyLong_FromLong\r
121# define PY_OFF_T_MAX LONG_MAX\r
122# define PY_OFF_T_MIN LONG_MIN\r
123# define PY_OFF_T_COMPAT long\r
124# define PY_PRIdOFF "ld"\r
125#else\r
126# error off_t does not match either size_t, long, or long long!\r
127#endif\r
128\r
129#endif\r
130\r
131extern Py_off_t PyNumber_AsOff_t(PyObject *item, PyObject *err);\r
132\r
133/* Implementation details */\r
134\r
135extern PyObject *_PyIO_os_module;\r
136extern PyObject *_PyIO_locale_module;\r
137extern PyObject *_PyIO_unsupported_operation;\r
138\r
139extern PyObject *_PyIO_str_close;\r
140extern PyObject *_PyIO_str_closed;\r
141extern PyObject *_PyIO_str_decode;\r
142extern PyObject *_PyIO_str_encode;\r
143extern PyObject *_PyIO_str_fileno;\r
144extern PyObject *_PyIO_str_flush;\r
145extern PyObject *_PyIO_str_getstate;\r
146extern PyObject *_PyIO_str_isatty;\r
147extern PyObject *_PyIO_str_newlines;\r
148extern PyObject *_PyIO_str_nl;\r
149extern PyObject *_PyIO_str_read;\r
150extern PyObject *_PyIO_str_read1;\r
151extern PyObject *_PyIO_str_readable;\r
152extern PyObject *_PyIO_str_readinto;\r
153extern PyObject *_PyIO_str_readline;\r
154extern PyObject *_PyIO_str_reset;\r
155extern PyObject *_PyIO_str_seek;\r
156extern PyObject *_PyIO_str_seekable;\r
157extern PyObject *_PyIO_str_setstate;\r
158extern PyObject *_PyIO_str_tell;\r
159extern PyObject *_PyIO_str_truncate;\r
160extern PyObject *_PyIO_str_writable;\r
161extern PyObject *_PyIO_str_write;\r
162\r
163extern PyObject *_PyIO_empty_str;\r
164extern PyObject *_PyIO_empty_bytes;\r
165extern PyObject *_PyIO_zero;\r