Skip to content

Commit 21f9126

Browse files
committed
Add header 'pylifecycle.h'.
1 parent 749e6ca commit 21f9126

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed

graalpython/com.oracle.graal.python.cext/include/Python.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
#include "pyhash.h"
100100
#include "import.h"
101101
#include "pycapsule.h"
102+
#include "pylifecycle.h"
102103

103104
// our impls
104105
#ifdef Py_True
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/* Copyright (c) 2018, Oracle and/or its affiliates.
2+
* Copyright (C) 1996-2017 Python Software Foundation
3+
*
4+
* Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
5+
*/
6+
7+
/* Interfaces to configure, query, create & destroy the Python runtime */
8+
9+
#ifndef Py_PYLIFECYCLE_H
10+
#define Py_PYLIFECYCLE_H
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
16+
PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
17+
18+
PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
19+
PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
20+
21+
#ifndef Py_LIMITED_API
22+
/* Only used by applications that embed the interpreter and need to
23+
* override the standard encoding determination mechanism
24+
*/
25+
PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
26+
const char *errors);
27+
#endif
28+
29+
PyAPI_FUNC(void) Py_Initialize(void);
30+
PyAPI_FUNC(void) Py_InitializeEx(int);
31+
#ifndef Py_LIMITED_API
32+
PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int);
33+
#endif
34+
PyAPI_FUNC(void) Py_Finalize(void);
35+
PyAPI_FUNC(int) Py_FinalizeEx(void);
36+
PyAPI_FUNC(int) Py_IsInitialized(void);
37+
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
38+
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
39+
40+
41+
/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
42+
* exit functions.
43+
*/
44+
#ifndef Py_LIMITED_API
45+
PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
46+
#endif
47+
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
48+
49+
PyAPI_FUNC(void) Py_Exit(int);
50+
51+
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
52+
#ifndef Py_LIMITED_API
53+
PyAPI_FUNC(void) _Py_RestoreSignals(void);
54+
55+
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
56+
#endif
57+
58+
/* Bootstrap __main__ (defined in Modules/main.c) */
59+
PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
60+
61+
/* In getpath.c */
62+
PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
63+
PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
64+
PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
65+
PyAPI_FUNC(wchar_t *) Py_GetPath(void);
66+
PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
67+
#ifdef MS_WINDOWS
68+
int _Py_CheckPython3();
69+
#endif
70+
71+
/* In their own files */
72+
PyAPI_FUNC(const char *) Py_GetVersion(void);
73+
PyAPI_FUNC(const char *) Py_GetPlatform(void);
74+
PyAPI_FUNC(const char *) Py_GetCopyright(void);
75+
PyAPI_FUNC(const char *) Py_GetCompiler(void);
76+
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
77+
#ifndef Py_LIMITED_API
78+
PyAPI_FUNC(const char *) _Py_gitidentifier(void);
79+
PyAPI_FUNC(const char *) _Py_gitversion(void);
80+
#endif
81+
82+
/* Internal -- various one-time initializations */
83+
#ifndef Py_LIMITED_API
84+
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
85+
PyAPI_FUNC(PyObject *) _PySys_Init(void);
86+
PyAPI_FUNC(void) _PyImport_Init(void);
87+
PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
88+
PyAPI_FUNC(void) _PyImportHooks_Init(void);
89+
PyAPI_FUNC(int) _PyFrame_Init(void);
90+
PyAPI_FUNC(int) _PyFloat_Init(void);
91+
PyAPI_FUNC(int) PyByteArray_Init(void);
92+
PyAPI_FUNC(void) _PyRandom_Init(void);
93+
#endif
94+
95+
/* Various internal finalizers */
96+
#ifndef Py_LIMITED_API
97+
PyAPI_FUNC(void) _PyExc_Fini(void);
98+
PyAPI_FUNC(void) _PyImport_Fini(void);
99+
PyAPI_FUNC(void) PyMethod_Fini(void);
100+
PyAPI_FUNC(void) PyFrame_Fini(void);
101+
PyAPI_FUNC(void) PyCFunction_Fini(void);
102+
PyAPI_FUNC(void) PyDict_Fini(void);
103+
PyAPI_FUNC(void) PyTuple_Fini(void);
104+
PyAPI_FUNC(void) PyList_Fini(void);
105+
PyAPI_FUNC(void) PySet_Fini(void);
106+
PyAPI_FUNC(void) PyBytes_Fini(void);
107+
PyAPI_FUNC(void) PyByteArray_Fini(void);
108+
PyAPI_FUNC(void) PyFloat_Fini(void);
109+
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
110+
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
111+
PyAPI_FUNC(void) _PyGC_Fini(void);
112+
PyAPI_FUNC(void) PySlice_Fini(void);
113+
PyAPI_FUNC(void) _PyType_Fini(void);
114+
PyAPI_FUNC(void) _PyRandom_Fini(void);
115+
PyAPI_FUNC(void) PyAsyncGen_Fini(void);
116+
117+
PyAPI_DATA(PyThreadState *) _Py_Finalizing;
118+
#endif
119+
120+
/* Signals */
121+
typedef void (*PyOS_sighandler_t)(int);
122+
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
123+
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
124+
125+
#ifndef Py_LIMITED_API
126+
/* Random */
127+
PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);
128+
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
129+
#endif /* !Py_LIMITED_API */
130+
131+
#ifdef __cplusplus
132+
}
133+
#endif
134+
#endif /* !Py_PYLIFECYCLE_H */

0 commit comments

Comments
 (0)