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.

171 lines
6.3 KiB

  1. /* Interfaces to parse and execute pieces of python code */
  2. #ifndef Py_PYTHONRUN_H
  3. #define Py_PYTHONRUN_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
  8. CO_FUTURE_WITH_STATEMENT)
  9. #define PyCF_MASK_OBSOLETE (CO_NESTED)
  10. #define PyCF_SOURCE_IS_UTF8 0x0100
  11. #define PyCF_DONT_IMPLY_DEDENT 0x0200
  12. #define PyCF_ONLY_AST 0x0400
  13. typedef struct {
  14. int cf_flags; /* bitmask of CO_xxx flags relevant to future */
  15. } PyCompilerFlags;
  16. PyAPI_FUNC(void) Py_SetProgramName(char *);
  17. PyAPI_FUNC(char *) Py_GetProgramName(void);
  18. PyAPI_FUNC(void) Py_SetPythonHome(char *);
  19. PyAPI_FUNC(char *) Py_GetPythonHome(void);
  20. PyAPI_FUNC(void) Py_Initialize(void);
  21. PyAPI_FUNC(void) Py_InitializeEx(int);
  22. PyAPI_FUNC(void) Py_Finalize(void);
  23. PyAPI_FUNC(int) Py_IsInitialized(void);
  24. PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
  25. PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
  26. PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
  27. PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
  28. PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
  29. PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
  30. PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
  31. PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
  32. PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *,
  33. int, PyCompilerFlags *flags,
  34. PyArena *);
  35. PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int,
  36. char *, char *,
  37. PyCompilerFlags *, int *,
  38. PyArena *);
  39. #define PyParser_SimpleParseString(S, B) \
  40. PyParser_SimpleParseStringFlags(S, B, 0)
  41. #define PyParser_SimpleParseFile(FP, S, B) \
  42. PyParser_SimpleParseFileFlags(FP, S, B, 0)
  43. PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
  44. int);
  45. PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
  46. int, int);
  47. PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
  48. PyObject *, PyCompilerFlags *);
  49. PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
  50. PyObject *, PyObject *, int,
  51. PyCompilerFlags *);
  52. #define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
  53. PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
  54. PyCompilerFlags *);
  55. PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
  56. PyAPI_FUNC(void) PyErr_Print(void);
  57. PyAPI_FUNC(void) PyErr_PrintEx(int);
  58. PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
  59. PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
  60. PyAPI_FUNC(void) Py_Exit(int);
  61. PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
  62. /* Bootstrap */
  63. PyAPI_FUNC(int) Py_Main(int argc, char **argv);
  64. /* Use macros for a bunch of old variants */
  65. #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
  66. #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
  67. #define PyRun_AnyFileEx(fp, name, closeit) \
  68. PyRun_AnyFileExFlags(fp, name, closeit, NULL)
  69. #define PyRun_AnyFileFlags(fp, name, flags) \
  70. PyRun_AnyFileExFlags(fp, name, 0, flags)
  71. #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
  72. #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
  73. #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
  74. #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
  75. #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
  76. #define PyRun_File(fp, p, s, g, l) \
  77. PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
  78. #define PyRun_FileEx(fp, p, s, g, l, c) \
  79. PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
  80. #define PyRun_FileFlags(fp, p, s, g, l, flags) \
  81. PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
  82. /* In getpath.c */
  83. PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
  84. PyAPI_FUNC(char *) Py_GetPrefix(void);
  85. PyAPI_FUNC(char *) Py_GetExecPrefix(void);
  86. PyAPI_FUNC(char *) Py_GetPath(void);
  87. /* In their own files */
  88. PyAPI_FUNC(const char *) Py_GetVersion(void);
  89. PyAPI_FUNC(const char *) Py_GetPlatform(void);
  90. PyAPI_FUNC(const char *) Py_GetCopyright(void);
  91. PyAPI_FUNC(const char *) Py_GetCompiler(void);
  92. PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
  93. PyAPI_FUNC(const char *) _Py_svnversion(void);
  94. PyAPI_FUNC(const char *) Py_SubversionRevision(void);
  95. PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
  96. /* Internal -- various one-time initializations */
  97. PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
  98. PyAPI_FUNC(PyObject *) _PySys_Init(void);
  99. PyAPI_FUNC(void) _PyImport_Init(void);
  100. PyAPI_FUNC(void) _PyExc_Init(void);
  101. PyAPI_FUNC(void) _PyImportHooks_Init(void);
  102. PyAPI_FUNC(int) _PyFrame_Init(void);
  103. PyAPI_FUNC(int) _PyInt_Init(void);
  104. PyAPI_FUNC(void) _PyFloat_Init(void);
  105. /* Various internal finalizers */
  106. PyAPI_FUNC(void) _PyExc_Fini(void);
  107. PyAPI_FUNC(void) _PyImport_Fini(void);
  108. PyAPI_FUNC(void) PyMethod_Fini(void);
  109. PyAPI_FUNC(void) PyFrame_Fini(void);
  110. PyAPI_FUNC(void) PyCFunction_Fini(void);
  111. PyAPI_FUNC(void) PyTuple_Fini(void);
  112. PyAPI_FUNC(void) PyList_Fini(void);
  113. PyAPI_FUNC(void) PySet_Fini(void);
  114. PyAPI_FUNC(void) PyString_Fini(void);
  115. PyAPI_FUNC(void) PyInt_Fini(void);
  116. PyAPI_FUNC(void) PyFloat_Fini(void);
  117. PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
  118. /* Stuff with no proper home (yet) */
  119. PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
  120. PyAPI_DATA(int) (*PyOS_InputHook)(void);
  121. PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
  122. PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
  123. /* Stack size, in "pointers" (so we get extra safety margins
  124. on 64-bit platforms). On a 32-bit platform, this translates
  125. to a 8k margin. */
  126. #define PYOS_STACK_MARGIN 2048
  127. #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
  128. /* Enable stack checking under Microsoft C */
  129. #define USE_STACKCHECK
  130. #endif
  131. #ifdef USE_STACKCHECK
  132. /* Check that we aren't overflowing our stack */
  133. PyAPI_FUNC(int) PyOS_CheckStack(void);
  134. #endif
  135. /* Signals */
  136. typedef void (*PyOS_sighandler_t)(int);
  137. PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
  138. PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif /* !Py_PYTHONRUN_H */