]>
Commit | Line | Data |
---|---|---|
006fecd5 | 1 | \r |
2 | /* File object interface */\r | |
3 | \r | |
4 | #ifndef Py_FILEOBJECT_H\r | |
5 | #define Py_FILEOBJECT_H\r | |
6 | #ifdef __cplusplus\r | |
7 | extern "C" {\r | |
8 | #endif\r | |
9 | \r | |
10 | typedef struct {\r | |
11 | PyObject_HEAD\r | |
12 | FILE *f_fp;\r | |
13 | PyObject *f_name;\r | |
14 | PyObject *f_mode;\r | |
15 | int (*f_close)(FILE *);\r | |
16 | int f_softspace; /* Flag used by 'print' command */\r | |
17 | int f_binary; /* Flag which indicates whether the file is\r | |
18 | open in binary (1) or text (0) mode */\r | |
19 | char* f_buf; /* Allocated readahead buffer */\r | |
20 | char* f_bufend; /* Points after last occupied position */\r | |
21 | char* f_bufptr; /* Current buffer position */\r | |
22 | char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */\r | |
23 | int f_univ_newline; /* Handle any newline convention */\r | |
24 | int f_newlinetypes; /* Types of newlines seen */\r | |
25 | int f_skipnextlf; /* Skip next \n */\r | |
26 | PyObject *f_encoding;\r | |
27 | PyObject *f_errors;\r | |
28 | PyObject *weakreflist; /* List of weak references */\r | |
29 | int unlocked_count; /* Num. currently running sections of code\r | |
30 | using f_fp with the GIL released. */\r | |
31 | int readable;\r | |
32 | int writable;\r | |
33 | } PyFileObject;\r | |
34 | \r | |
35 | PyAPI_DATA(PyTypeObject) PyFile_Type;\r | |
36 | \r | |
37 | #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)\r | |
38 | #define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type)\r | |
39 | \r | |
40 | PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);\r | |
41 | PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);\r | |
42 | PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);\r | |
43 | PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors);\r | |
44 | PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,\r | |
45 | int (*)(FILE *));\r | |
46 | PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);\r | |
47 | PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *);\r | |
48 | PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *);\r | |
49 | PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);\r | |
50 | PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);\r | |
51 | PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);\r | |
52 | PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);\r | |
53 | PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);\r | |
54 | PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);\r | |
55 | \r | |
56 | /* The default encoding used by the platform file system APIs\r | |
57 | If non-NULL, this is different than the default encoding for strings\r | |
58 | */\r | |
59 | PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;\r | |
60 | \r | |
61 | /* Routines to replace fread() and fgets() which accept any of \r, \n\r | |
62 | or \r\n as line terminators.\r | |
63 | */\r | |
64 | #define PY_STDIOTEXTMODE "b"\r | |
65 | char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);\r | |
66 | size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);\r | |
67 | \r | |
68 | /* A routine to do sanity checking on the file mode string. returns\r | |
69 | non-zero on if an exception occurred\r | |
70 | */\r | |
71 | int _PyFile_SanitizeMode(char *mode);\r | |
72 | \r | |
73 | //#if defined _MSC_VER && _MSC_VER >= 1400\r | |
74 | /* A routine to check if a file descriptor is valid on Windows. Returns 0\r | |
75 | * and sets errno to EBADF if it isn't. This is to avoid Assertions\r | |
76 | * from various functions in the Windows CRT beginning with\r | |
77 | * Visual Studio 2005\r | |
78 | */\r | |
79 | //int _PyVerify_fd(int fd);\r | |
80 | //#elif defined _MSC_VER && _MSC_VER >= 1200\r | |
81 | /* fdopen doesn't set errno EBADF and crashes for large fd on debug build */\r | |
82 | //#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)\r | |
83 | //#else\r | |
84 | #define _PyVerify_fd(A) (1) /* dummy */\r | |
85 | //#endif\r | |
86 | \r | |
87 | #ifdef __cplusplus\r | |
88 | }\r | |
89 | #endif\r | |
90 | #endif /* !Py_FILEOBJECT_H */\r |