Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.2 KiB

  1. /* File object interface */
  2. #ifndef Py_FILEOBJECT_H
  3. #define Py_FILEOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct {
  8. PyObject_HEAD
  9. FILE *f_fp;
  10. PyObject *f_name;
  11. PyObject *f_mode;
  12. int (*f_close)(FILE *);
  13. int f_softspace; /* Flag used by 'print' command */
  14. int f_binary; /* Flag which indicates whether the file is
  15. open in binary (1) or text (0) mode */
  16. char* f_buf; /* Allocated readahead buffer */
  17. char* f_bufend; /* Points after last occupied position */
  18. char* f_bufptr; /* Current buffer position */
  19. char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */
  20. int f_univ_newline; /* Handle any newline convention */
  21. int f_newlinetypes; /* Types of newlines seen */
  22. int f_skipnextlf; /* Skip next \n */
  23. PyObject *f_encoding;
  24. PyObject *weakreflist; /* List of weak references */
  25. } PyFileObject;
  26. PyAPI_DATA(PyTypeObject) PyFile_Type;
  27. #define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)
  28. #define PyFile_CheckExact(op) ((op)->ob_type == &PyFile_Type)
  29. PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);
  30. PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);
  31. PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);
  32. PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,
  33. int (*)(FILE *));
  34. PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);
  35. PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);
  36. PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
  37. PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
  38. PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);
  39. PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
  40. PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
  41. /* The default encoding used by the platform file system APIs
  42. If non-NULL, this is different than the default encoding for strings
  43. */
  44. PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
  45. /* Routines to replace fread() and fgets() which accept any of \r, \n
  46. or \r\n as line terminators.
  47. */
  48. #define PY_STDIOTEXTMODE "b"
  49. char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
  50. size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* !Py_FILEOBJECT_H */