pylifecycle.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* Interfaces to configure, query, create & destroy the Python runtime */
  2. #ifndef Py_PYLIFECYCLE_H
  3. #define Py_PYLIFECYCLE_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
  8. PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
  9. PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
  10. PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
  11. #ifndef Py_LIMITED_API
  12. /* Only used by applications that embed the interpreter and need to
  13. * override the standard encoding determination mechanism
  14. */
  15. PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
  16. const char *errors);
  17. #endif
  18. PyAPI_FUNC(void) Py_Initialize(void);
  19. PyAPI_FUNC(void) Py_InitializeEx(int);
  20. #ifndef Py_LIMITED_API
  21. PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int);
  22. #endif
  23. PyAPI_FUNC(void) Py_Finalize(void);
  24. PyAPI_FUNC(int) Py_IsInitialized(void);
  25. PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
  26. PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
  27. /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
  28. * exit functions.
  29. */
  30. #ifndef Py_LIMITED_API
  31. PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
  32. #endif
  33. PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
  34. PyAPI_FUNC(void) Py_Exit(int);
  35. /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
  36. #ifndef Py_LIMITED_API
  37. PyAPI_FUNC(void) _Py_RestoreSignals(void);
  38. PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
  39. #endif
  40. /* Bootstrap __main__ (defined in Modules/main.c) */
  41. PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
  42. /* In getpath.c */
  43. PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
  44. PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
  45. PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
  46. PyAPI_FUNC(wchar_t *) Py_GetPath(void);
  47. PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
  48. #ifdef MS_WINDOWS
  49. int _Py_CheckPython3();
  50. #endif
  51. /* In their own files */
  52. PyAPI_FUNC(const char *) Py_GetVersion(void);
  53. PyAPI_FUNC(const char *) Py_GetPlatform(void);
  54. PyAPI_FUNC(const char *) Py_GetCopyright(void);
  55. PyAPI_FUNC(const char *) Py_GetCompiler(void);
  56. PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
  57. #ifndef Py_LIMITED_API
  58. PyAPI_FUNC(const char *) _Py_hgidentifier(void);
  59. PyAPI_FUNC(const char *) _Py_hgversion(void);
  60. #endif
  61. /* Internal -- various one-time initializations */
  62. #ifndef Py_LIMITED_API
  63. PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
  64. PyAPI_FUNC(PyObject *) _PySys_Init(void);
  65. PyAPI_FUNC(void) _PyImport_Init(void);
  66. PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
  67. PyAPI_FUNC(void) _PyImportHooks_Init(void);
  68. PyAPI_FUNC(int) _PyFrame_Init(void);
  69. PyAPI_FUNC(int) _PyFloat_Init(void);
  70. PyAPI_FUNC(int) PyByteArray_Init(void);
  71. PyAPI_FUNC(void) _PyRandom_Init(void);
  72. #endif
  73. /* Various internal finalizers */
  74. #ifndef Py_LIMITED_API
  75. PyAPI_FUNC(void) _PyExc_Fini(void);
  76. PyAPI_FUNC(void) _PyImport_Fini(void);
  77. PyAPI_FUNC(void) PyMethod_Fini(void);
  78. PyAPI_FUNC(void) PyFrame_Fini(void);
  79. PyAPI_FUNC(void) PyCFunction_Fini(void);
  80. PyAPI_FUNC(void) PyDict_Fini(void);
  81. PyAPI_FUNC(void) PyTuple_Fini(void);
  82. PyAPI_FUNC(void) PyList_Fini(void);
  83. PyAPI_FUNC(void) PySet_Fini(void);
  84. PyAPI_FUNC(void) PyBytes_Fini(void);
  85. PyAPI_FUNC(void) PyByteArray_Fini(void);
  86. PyAPI_FUNC(void) PyFloat_Fini(void);
  87. PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
  88. PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
  89. PyAPI_FUNC(void) _PyGC_Fini(void);
  90. PyAPI_FUNC(void) PySlice_Fini(void);
  91. PyAPI_FUNC(void) _PyType_Fini(void);
  92. PyAPI_FUNC(void) _PyRandom_Fini(void);
  93. PyAPI_DATA(PyThreadState *) _Py_Finalizing;
  94. #endif
  95. /* Signals */
  96. typedef void (*PyOS_sighandler_t)(int);
  97. PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
  98. PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
  99. /* Random */
  100. PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size);
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* !Py_PYLIFECYCLE_H */