pythonrun.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #ifndef Py_CPYTHON_PYTHONRUN_H
  2. # error "this header file must not be included directly"
  3. #endif
  4. PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
  5. PyAPI_FUNC(int) _PyRun_SimpleFileObject(
  6. FILE *fp,
  7. PyObject *filename,
  8. int closeit,
  9. PyCompilerFlags *flags);
  10. PyAPI_FUNC(int) PyRun_AnyFileExFlags(
  11. FILE *fp,
  12. const char *filename, /* decoded from the filesystem encoding */
  13. int closeit,
  14. PyCompilerFlags *flags);
  15. PyAPI_FUNC(int) _PyRun_AnyFileObject(
  16. FILE *fp,
  17. PyObject *filename,
  18. int closeit,
  19. PyCompilerFlags *flags);
  20. PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
  21. FILE *fp,
  22. const char *filename, /* decoded from the filesystem encoding */
  23. int closeit,
  24. PyCompilerFlags *flags);
  25. PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
  26. FILE *fp,
  27. const char *filename, /* decoded from the filesystem encoding */
  28. PyCompilerFlags *flags);
  29. PyAPI_FUNC(int) PyRun_InteractiveOneObject(
  30. FILE *fp,
  31. PyObject *filename,
  32. PyCompilerFlags *flags);
  33. PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
  34. FILE *fp,
  35. const char *filename, /* decoded from the filesystem encoding */
  36. PyCompilerFlags *flags);
  37. PyAPI_FUNC(int) _PyRun_InteractiveLoopObject(
  38. FILE *fp,
  39. PyObject *filename,
  40. PyCompilerFlags *flags);
  41. PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
  42. PyObject *, PyCompilerFlags *);
  43. PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
  44. FILE *fp,
  45. const char *filename, /* decoded from the filesystem encoding */
  46. int start,
  47. PyObject *globals,
  48. PyObject *locals,
  49. int closeit,
  50. PyCompilerFlags *flags);
  51. PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
  52. const char *str,
  53. const char *filename, /* decoded from the filesystem encoding */
  54. int start,
  55. PyCompilerFlags *flags,
  56. int optimize);
  57. PyAPI_FUNC(PyObject *) Py_CompileStringObject(
  58. const char *str,
  59. PyObject *filename, int start,
  60. PyCompilerFlags *flags,
  61. int optimize);
  62. #define Py_CompileString(str, p, s) Py_CompileStringExFlags((str), (p), (s), NULL, -1)
  63. #define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags((str), (p), (s), (f), -1)
  64. PyAPI_FUNC(const char *) _Py_SourceAsString(
  65. PyObject *cmd,
  66. const char *funcname,
  67. const char *what,
  68. PyCompilerFlags *cf,
  69. PyObject **cmd_copy);
  70. /* A function flavor is also exported by libpython. It is required when
  71. libpython is accessed directly rather than using header files which defines
  72. macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to
  73. export functions in pythonXX.dll. */
  74. PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l);
  75. PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name);
  76. PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit);
  77. PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
  78. PyAPI_FUNC(int) PyRun_SimpleString(const char *s);
  79. PyAPI_FUNC(int) PyRun_SimpleFile(FILE *f, const char *p);
  80. PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *f, const char *p, int c);
  81. PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *f, const char *p);
  82. PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *f, const char *p);
  83. PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l);
  84. PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c);
  85. PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags);
  86. /* Use macros for a bunch of old variants */
  87. #define PyRun_String(str, s, g, l) PyRun_StringFlags((str), (s), (g), (l), NULL)
  88. #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags((fp), (name), 0, NULL)
  89. #define PyRun_AnyFileEx(fp, name, closeit) \
  90. PyRun_AnyFileExFlags((fp), (name), (closeit), NULL)
  91. #define PyRun_AnyFileFlags(fp, name, flags) \
  92. PyRun_AnyFileExFlags((fp), (name), 0, (flags))
  93. #define PyRun_SimpleString(s) PyRun_SimpleStringFlags((s), NULL)
  94. #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags((f), (p), 0, NULL)
  95. #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags((f), (p), (c), NULL)
  96. #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags((f), (p), NULL)
  97. #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags((f), (p), NULL)
  98. #define PyRun_File(fp, p, s, g, l) \
  99. PyRun_FileExFlags((fp), (p), (s), (g), (l), 0, NULL)
  100. #define PyRun_FileEx(fp, p, s, g, l, c) \
  101. PyRun_FileExFlags((fp), (p), (s), (g), (l), (c), NULL)
  102. #define PyRun_FileFlags(fp, p, s, g, l, flags) \
  103. PyRun_FileExFlags((fp), (p), (s), (g), (l), 0, (flags))
  104. /* Stuff with no proper home (yet) */
  105. PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
  106. PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
  107. PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);