blob: 6ec2994aa859b6fbcd71d12fd283733ea1d049ab [file] [log] [blame]
Guido van Rossumda5b8f22007-06-12 23:30:11 +00001/* File object interface (what's left of it -- see io.py) */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00002
Fred Drakeea9cb5a2000-07-09 00:20:36 +00003#ifndef Py_FILEOBJECT_H
4#define Py_FILEOBJECT_H
5#ifdef __cplusplus
6extern "C" {
7#endif
8
Guido van Rossumda5b8f22007-06-12 23:30:11 +00009#define PY_STDIOTEXTMODE "b"
Martin v. Löwisf6eebbb2002-03-15 17:42:16 +000010
Serhiy Storchakac6792272013-10-19 21:03:34 +030011PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
12 const char *, const char *,
13 const char *, int);
Mark Hammond91a681d2002-08-12 07:21:58 +000014PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
15PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
Mark Hammond91a681d2002-08-12 07:21:58 +000016PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
17PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
Guido van Rossuma3309961993-07-28 09:05:47 +000018
Mark Hammond26cffde42001-05-14 12:17:34 +000019/* The default encoding used by the platform file system APIs
Tim Peters058b1412002-04-21 07:29:14 +000020 If non-NULL, this is different than the default encoding for strings
Mark Hammond26cffde42001-05-14 12:17:34 +000021*/
Mark Hammond91a681d2002-08-12 07:21:58 +000022PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
Serhiy Storchaka637a09b2020-10-10 17:09:45 +030023#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
24PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
25#endif
Martin v. Löwis04dc25c2008-10-03 16:09:28 +000026PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
Mark Hammond26cffde42001-05-14 12:17:34 +000027
Serhiy Storchaka637a09b2020-10-10 17:09:45 +030028#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
29PyAPI_DATA(int) Py_UTF8Mode;
30#endif
31
Charles-François Nataliaa26b272011-08-28 17:51:43 +020032/* A routine to check if a file descriptor can be select()-ed. */
Antoine Pitrouf474c5a2017-07-18 17:05:03 +020033#ifdef _MSC_VER
34 /* On Windows, any socket fd can be select()-ed, no matter how high */
35 #define _PyIsSelectable_fd(FD) (1)
Charles-François Nataliaa26b272011-08-28 17:51:43 +020036#else
Antoine Pitrouf474c5a2017-07-18 17:05:03 +020037 #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE)
38#endif
Charles-François Nataliaa26b272011-08-28 17:51:43 +020039
Steve Dowerb82e17e2019-05-23 08:45:22 -070040#ifndef Py_LIMITED_API
41# define Py_CPYTHON_FILEOBJECT_H
42# include "cpython/fileobject.h"
43# undef Py_CPYTHON_FILEOBJECT_H
44#endif
45
Guido van Rossuma3309961993-07-28 09:05:47 +000046#ifdef __cplusplus
47}
48#endif
49#endif /* !Py_FILEOBJECT_H */