- Notifications
You must be signed in to change notification settings - Fork 31.7k
/
Copy pathpythonrun.h
181 lines (152 loc) · 7.06 KB
/
pythonrun.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/* Interfaces to parse and execute pieces of python code */
#ifndefPy_PYTHONRUN_H
#definePy_PYTHONRUN_H
#ifdef__cplusplus
extern"C" {
#endif
#definePyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
CO_FUTURE_UNICODE_LITERALS)
#definePyCF_MASK_OBSOLETE (CO_NESTED)
#definePyCF_SOURCE_IS_UTF8 0x0100
#definePyCF_DONT_IMPLY_DEDENT 0x0200
#definePyCF_ONLY_AST 0x0400
typedefstruct {
intcf_flags; /* bitmask of CO_xxx flags relevant to future */
} PyCompilerFlags;
PyAPI_FUNC(void) Py_SetProgramName(char*);
PyAPI_FUNC(char*) Py_GetProgramName(void);
PyAPI_FUNC(void) Py_SetPythonHome(char*);
PyAPI_FUNC(char*) Py_GetPythonHome(void);
PyAPI_FUNC(void) Py_Initialize(void);
PyAPI_FUNC(void) Py_InitializeEx(int);
PyAPI_FUNC(void) Py_Finalize(void);
PyAPI_FUNC(int) Py_IsInitialized(void);
PyAPI_FUNC(PyThreadState*) Py_NewInterpreter(void);
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState*);
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE*, constchar*, PyCompilerFlags*);
PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE*, constchar*, int, PyCompilerFlags*);
PyAPI_FUNC(int) PyRun_SimpleStringFlags(constchar*, PyCompilerFlags*);
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE*, constchar*, int, PyCompilerFlags*);
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE*, constchar*, PyCompilerFlags*);
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE*, constchar*, PyCompilerFlags*);
PyAPI_FUNC(struct_mod*) PyParser_ASTFromString(constchar*, constchar*,
int, PyCompilerFlags*flags,
PyArena*);
PyAPI_FUNC(struct_mod*) PyParser_ASTFromFile(FILE*, constchar*, int,
char*, char*,
PyCompilerFlags*, int*,
PyArena*);
#definePyParser_SimpleParseString(S, B) \
PyParser_SimpleParseStringFlags(S, B, 0)
#definePyParser_SimpleParseFile(FP, S, B) \
PyParser_SimpleParseFileFlags(FP, S, B, 0)
PyAPI_FUNC(struct_node*) PyParser_SimpleParseStringFlags(constchar*, int,
int);
PyAPI_FUNC(struct_node*) PyParser_SimpleParseFileFlags(FILE*, constchar*,
int, int);
PyAPI_FUNC(PyObject*) PyRun_StringFlags(constchar*, int, PyObject*,
PyObject*, PyCompilerFlags*);
PyAPI_FUNC(PyObject*) PyRun_FileExFlags(FILE*, constchar*, int,
PyObject*, PyObject*, int,
PyCompilerFlags*);
#definePy_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
PyAPI_FUNC(PyObject*) Py_CompileStringFlags(constchar*, constchar*, int,
PyCompilerFlags*);
PyAPI_FUNC(structsymtable*) Py_SymtableString(constchar*, constchar*, int);
PyAPI_FUNC(void) PyErr_Print(void);
PyAPI_FUNC(void) PyErr_PrintEx(int);
PyAPI_FUNC(void) PyErr_Display(PyObject*, PyObject*, PyObject*);
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
PyAPI_FUNC(void) Py_Exit(int);
PyAPI_FUNC(int) Py_FdIsInteractive(FILE*, constchar*);
/* Bootstrap */
PyAPI_FUNC(int) Py_Main(intargc, char**argv);
/* Use macros for a bunch of old variants */
#definePyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
#definePyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
#definePyRun_AnyFileEx(fp, name, closeit) \
PyRun_AnyFileExFlags(fp, name, closeit, NULL)
#definePyRun_AnyFileFlags(fp, name, flags) \
PyRun_AnyFileExFlags(fp, name, 0, flags)
#definePyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
#definePyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
#definePyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
#definePyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
#definePyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
#definePyRun_File(fp, p, s, g, l) \
PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
#definePyRun_FileEx(fp, p, s, g, l, c) \
PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
#definePyRun_FileFlags(fp, p, s, g, l, flags) \
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
/* In getpath.c */
PyAPI_FUNC(char*) Py_GetProgramFullPath(void);
PyAPI_FUNC(char*) Py_GetPrefix(void);
PyAPI_FUNC(char*) Py_GetExecPrefix(void);
PyAPI_FUNC(char*) Py_GetPath(void);
/* In their own files */
PyAPI_FUNC(constchar*) Py_GetVersion(void);
PyAPI_FUNC(constchar*) Py_GetPlatform(void);
PyAPI_FUNC(constchar*) Py_GetCopyright(void);
PyAPI_FUNC(constchar*) Py_GetCompiler(void);
PyAPI_FUNC(constchar*) Py_GetBuildInfo(void);
PyAPI_FUNC(constchar*) Py_SubversionRevision(void);
PyAPI_FUNC(constchar*) Py_SubversionShortBranch(void);
PyAPI_FUNC(constchar*) _Py_gitidentifier(void);
PyAPI_FUNC(constchar*) _Py_gitversion(void);
/* Internal -- various one-time initializations */
PyAPI_FUNC(PyObject*) _PyBuiltin_Init(void);
PyAPI_FUNC(PyObject*) _PySys_Init(void);
PyAPI_FUNC(void) _PyImport_Init(void);
PyAPI_FUNC(void) _PyExc_Init(void);
PyAPI_FUNC(void) _PyImportHooks_Init(void);
PyAPI_FUNC(int) _PyFrame_Init(void);
PyAPI_FUNC(int) _PyInt_Init(void);
PyAPI_FUNC(int) _PyLong_Init(void);
PyAPI_FUNC(void) _PyFloat_Init(void);
PyAPI_FUNC(int) PyByteArray_Init(void);
PyAPI_FUNC(void) _PyRandom_Init(void);
/* Various internal finalizers */
PyAPI_FUNC(void) _PyExc_Fini(void);
PyAPI_FUNC(void) _PyImport_Fini(void);
PyAPI_FUNC(void) PyMethod_Fini(void);
PyAPI_FUNC(void) PyFrame_Fini(void);
PyAPI_FUNC(void) PyCFunction_Fini(void);
PyAPI_FUNC(void) PyDict_Fini(void);
PyAPI_FUNC(void) PyTuple_Fini(void);
PyAPI_FUNC(void) PyList_Fini(void);
PyAPI_FUNC(void) PySet_Fini(void);
PyAPI_FUNC(void) PyString_Fini(void);
PyAPI_FUNC(void) PyInt_Fini(void);
PyAPI_FUNC(void) PyFloat_Fini(void);
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
PyAPI_FUNC(void) PyByteArray_Fini(void);
PyAPI_FUNC(void) _PyRandom_Fini(void);
/* Stuff with no proper home (yet) */
PyAPI_FUNC(char*) PyOS_Readline(FILE*, FILE*, char*);
PyAPI_DATA(int) (*PyOS_InputHook)(void);
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE*, FILE*, char*);
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
/* Stack size, in "pointers" (so we get extra safety margins
on 64-bit platforms). On a 32-bit platform, this translates
to an 8k margin. */
#definePYOS_STACK_MARGIN 2048
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) &&_MSC_VER >= 1300
/* Enable stack checking under Microsoft C */
#defineUSE_STACKCHECK
#endif
#ifdefUSE_STACKCHECK
/* Check that we aren't overflowing our stack */
PyAPI_FUNC(int) PyOS_CheckStack(void);
#endif
/* Signals */
typedefvoid (*PyOS_sighandler_t)(int);
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
/* Random */
PyAPI_FUNC(int) _PyOS_URandom (void*buffer, Py_ssize_tsize);
#ifdef__cplusplus
}
#endif
#endif/* !Py_PYTHONRUN_H */