+++ /dev/null
-/** @file\r
- File object interface\r
-\r
- Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>\r
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#ifndef Py_FILEOBJECT_H\r
-#define Py_FILEOBJECT_H\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef struct {\r
- PyObject_HEAD\r
- FILE *f_fp;\r
- PyObject *f_name;\r
- PyObject *f_mode;\r
- int (*f_close)(FILE *);\r
- int f_softspace; /* Flag used by 'print' command */\r
- int f_binary; /* Flag which indicates whether the file is\r
- open in binary (1) or text (0) mode */\r
- char* f_buf; /* Allocated readahead buffer */\r
- char* f_bufend; /* Points after last occupied position */\r
- char* f_bufptr; /* Current buffer position */\r
- char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */\r
- int f_univ_newline; /* Handle any newline convention */\r
- int f_newlinetypes; /* Types of newlines seen */\r
- int f_skipnextlf; /* Skip next \n */\r
- PyObject *f_encoding;\r
- PyObject *f_errors;\r
- PyObject *weakreflist; /* List of weak references */\r
- int unlocked_count; /* Num. currently running sections of code\r
- using f_fp with the GIL released. */\r
- int readable;\r
- int writable;\r
-} PyFileObject;\r
-\r
-PyAPI_DATA(PyTypeObject) PyFile_Type;\r
-\r
-#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)\r
-#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type)\r
-\r
-PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);\r
-PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);\r
-PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);\r
-PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors);\r
-PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,\r
- int (*)(FILE *));\r
-PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);\r
-PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *);\r
-PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *);\r
-PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);\r
-PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);\r
-PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);\r
-PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);\r
-PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);\r
-PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);\r
-\r
-/* The default encoding used by the platform file system APIs\r
- If non-NULL, this is different than the default encoding for strings\r
-*/\r
-PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;\r
-\r
-/* Routines to replace fread() and fgets() which accept any of \r, \n\r
- or \r\n as line terminators.\r
-*/\r
-#define PY_STDIOTEXTMODE "b"\r
-char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);\r
-size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);\r
-\r
-/* A routine to do sanity checking on the file mode string. returns\r
- non-zero on if an exception occurred\r
-*/\r
-int _PyFile_SanitizeMode(char *mode);\r
-\r
-//#if defined _MSC_VER && _MSC_VER >= 1400\r
-/* A routine to check if a file descriptor is valid on Windows. Returns 0\r
- * and sets errno to EBADF if it isn't. This is to avoid Assertions\r
- * from various functions in the Windows CRT beginning with\r
- * Visual Studio 2005\r
- */\r
-//int _PyVerify_fd(int fd);\r
-//#elif defined _MSC_VER && _MSC_VER >= 1200\r
-/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */\r
-//#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)\r
-//#else\r
-#define _PyVerify_fd(A) (1) /* dummy */\r
-//#endif\r
-\r
-/* A routine to check if a file descriptor can be select()-ed. */\r
-#ifdef HAVE_SELECT\r
- #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE))\r
-#else\r
- #define _PyIsSelectable_fd(FD) (1)\r
-#endif /* HAVE_SELECT */\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif /* !Py_FILEOBJECT_H */\r