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