Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 2 | /* Interfaces to parse and execute pieces of python code */ |
| 3 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 4 | #ifndef Py_PYTHONRUN_H |
| 5 | #define Py_PYTHONRUN_H |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 9 | |
Benjamin Peterson | 466a782 | 2009-07-02 21:44:01 +0000 | [diff] [blame] | 10 | #define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ |
| 11 | CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ |
| 12 | CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL) |
Benjamin Peterson | ffeaa88 | 2009-07-02 21:54:36 +0000 | [diff] [blame] | 13 | #define PyCF_MASK_OBSOLETE (CO_NESTED) |
Just van Rossum | 3aaf42c | 2003-02-10 08:21:10 +0000 | [diff] [blame] | 14 | #define PyCF_SOURCE_IS_UTF8 0x0100 |
Guido van Rossum | 4b499dd3 | 2003-02-13 22:07:59 +0000 | [diff] [blame] | 15 | #define PyCF_DONT_IMPLY_DEDENT 0x0200 |
Martin v. Löwis | bd260da | 2006-02-26 19:42:26 +0000 | [diff] [blame] | 16 | #define PyCF_ONLY_AST 0x0400 |
Benjamin Peterson | f5b5224 | 2009-03-02 23:31:26 +0000 | [diff] [blame] | 17 | #define PyCF_IGNORE_COOKIE 0x0800 |
Tim Peters | e2c18e9 | 2001-08-17 20:47:47 +0000 | [diff] [blame] | 18 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 19 | #ifndef Py_LIMITED_API |
Jeremy Hylton | 9f324e9 | 2001-03-01 22:59:14 +0000 | [diff] [blame] | 20 | typedef struct { |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 21 | int cf_flags; /* bitmask of CO_xxx flags relevant to future */ |
Jeremy Hylton | 9f324e9 | 2001-03-01 22:59:14 +0000 | [diff] [blame] | 22 | } PyCompilerFlags; |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 23 | #endif |
Jeremy Hylton | 9f324e9 | 2001-03-01 22:59:14 +0000 | [diff] [blame] | 24 | |
Martin v. Löwis | 790465f | 2008-04-05 20:41:37 +0000 | [diff] [blame] | 25 | PyAPI_FUNC(void) Py_SetProgramName(wchar_t *); |
| 26 | PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); |
Guido van Rossum | 66d4b90 | 1998-02-06 22:28:05 +0000 | [diff] [blame] | 27 | |
Martin v. Löwis | 790465f | 2008-04-05 20:41:37 +0000 | [diff] [blame] | 28 | PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *); |
| 29 | PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 30 | |
Nick Coghlan | 1805a62 | 2013-10-18 23:11:47 +1000 | [diff] [blame] | 31 | #ifndef Py_LIMITED_API |
| 32 | /* Only used by applications that embed the interpreter and need to |
| 33 | * override the standard encoding determination mechanism |
| 34 | */ |
Nick Coghlan | a0f074f | 2013-10-17 23:27:17 +1000 | [diff] [blame] | 35 | PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding, |
| 36 | const char *errors); |
Nick Coghlan | 1805a62 | 2013-10-18 23:11:47 +1000 | [diff] [blame] | 37 | #endif |
Nick Coghlan | a0f074f | 2013-10-17 23:27:17 +1000 | [diff] [blame] | 38 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 39 | PyAPI_FUNC(void) Py_Initialize(void); |
Martin v. Löwis | 336e85f | 2004-08-19 11:31:58 +0000 | [diff] [blame] | 40 | PyAPI_FUNC(void) Py_InitializeEx(int); |
Antoine Pitrou | e67f48c | 2012-06-19 22:29:35 +0200 | [diff] [blame] | 41 | #ifndef Py_LIMITED_API |
| 42 | PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int); |
| 43 | #endif |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 44 | PyAPI_FUNC(void) Py_Finalize(void); |
| 45 | PyAPI_FUNC(int) Py_IsInitialized(void); |
| 46 | PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); |
| 47 | PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 48 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 49 | #ifndef Py_LIMITED_API |
| 50 | PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); |
Martin v. Löwis | 056a69c | 2006-03-01 16:55:42 +0000 | [diff] [blame] | 51 | PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 52 | PyAPI_FUNC(int) PyRun_AnyFileExFlags( |
| 53 | FILE *fp, |
| 54 | const char *filename, /* decoded from the filesystem encoding */ |
| 55 | int closeit, |
| 56 | PyCompilerFlags *flags); |
| 57 | PyAPI_FUNC(int) PyRun_SimpleFileExFlags( |
| 58 | FILE *fp, |
| 59 | const char *filename, /* decoded from the filesystem encoding */ |
| 60 | int closeit, |
| 61 | PyCompilerFlags *flags); |
| 62 | PyAPI_FUNC(int) PyRun_InteractiveOneFlags( |
| 63 | FILE *fp, |
| 64 | const char *filename, /* decoded from the filesystem encoding */ |
| 65 | PyCompilerFlags *flags); |
Victor Stinner | 95701bd | 2013-11-06 18:41:07 +0100 | [diff] [blame] | 66 | PyAPI_FUNC(int) PyRun_InteractiveOneObject( |
| 67 | FILE *fp, |
| 68 | PyObject *filename, |
| 69 | PyCompilerFlags *flags); |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 70 | PyAPI_FUNC(int) PyRun_InteractiveLoopFlags( |
| 71 | FILE *fp, |
| 72 | const char *filename, /* decoded from the filesystem encoding */ |
| 73 | PyCompilerFlags *flags); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 74 | |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 75 | PyAPI_FUNC(struct _mod *) PyParser_ASTFromString( |
| 76 | const char *s, |
| 77 | const char *filename, /* decoded from the filesystem encoding */ |
| 78 | int start, |
| 79 | PyCompilerFlags *flags, |
| 80 | PyArena *arena); |
Victor Stinner | 14e461d | 2013-08-26 22:28:21 +0200 | [diff] [blame] | 81 | PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject( |
| 82 | const char *s, |
| 83 | PyObject *filename, |
| 84 | int start, |
| 85 | PyCompilerFlags *flags, |
| 86 | PyArena *arena); |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 87 | PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile( |
| 88 | FILE *fp, |
| 89 | const char *filename, /* decoded from the filesystem encoding */ |
| 90 | const char* enc, |
| 91 | int start, |
| 92 | char *ps1, |
| 93 | char *ps2, |
| 94 | PyCompilerFlags *flags, |
| 95 | int *errcode, |
| 96 | PyArena *arena); |
Victor Stinner | 14e461d | 2013-08-26 22:28:21 +0200 | [diff] [blame] | 97 | PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject( |
| 98 | FILE *fp, |
| 99 | PyObject *filename, |
| 100 | const char* enc, |
| 101 | int start, |
| 102 | char *ps1, |
| 103 | char *ps2, |
| 104 | PyCompilerFlags *flags, |
| 105 | int *errcode, |
| 106 | PyArena *arena); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 107 | #endif |
| 108 | |
| 109 | #ifndef PyParser_SimpleParseString |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 110 | #define PyParser_SimpleParseString(S, B) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 111 | PyParser_SimpleParseStringFlags(S, B, 0) |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 112 | #define PyParser_SimpleParseFile(FP, S, B) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 113 | PyParser_SimpleParseFileFlags(FP, S, B, 0) |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 114 | #endif |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 115 | PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, |
Eli Bendersky | 0813168 | 2012-06-03 08:07:47 +0300 | [diff] [blame] | 116 | int); |
| 117 | PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *, |
| 118 | const char *, |
| 119 | int, int); |
Martin v. Löwis | 95292d6 | 2002-12-11 14:04:59 +0000 | [diff] [blame] | 120 | PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, |
Eli Bendersky | 0813168 | 2012-06-03 08:07:47 +0300 | [diff] [blame] | 121 | int, int); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 122 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 123 | #ifndef Py_LIMITED_API |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 124 | PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, |
| 125 | PyObject *, PyCompilerFlags *); |
Guido van Rossum | 5b72218 | 1993-03-30 17:46:03 +0000 | [diff] [blame] | 126 | |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 127 | PyAPI_FUNC(PyObject *) PyRun_FileExFlags( |
| 128 | FILE *fp, |
| 129 | const char *filename, /* decoded from the filesystem encoding */ |
| 130 | int start, |
| 131 | PyObject *globals, |
| 132 | PyObject *locals, |
| 133 | int closeit, |
| 134 | PyCompilerFlags *flags); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 135 | #endif |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 136 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 137 | #ifdef Py_LIMITED_API |
Martin v. Löwis | 0d012f2 | 2010-12-04 12:00:49 +0000 | [diff] [blame] | 138 | PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 139 | #else |
Georg Brandl | 8334fd9 | 2010-12-04 10:26:46 +0000 | [diff] [blame] | 140 | #define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1) |
| 141 | #define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1) |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 142 | PyAPI_FUNC(PyObject *) Py_CompileStringExFlags( |
| 143 | const char *str, |
| 144 | const char *filename, /* decoded from the filesystem encoding */ |
| 145 | int start, |
| 146 | PyCompilerFlags *flags, |
| 147 | int optimize); |
Victor Stinner | 14e461d | 2013-08-26 22:28:21 +0200 | [diff] [blame] | 148 | PyAPI_FUNC(PyObject *) Py_CompileStringObject( |
| 149 | const char *str, |
| 150 | PyObject *filename, int start, |
| 151 | PyCompilerFlags *flags, |
| 152 | int optimize); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 153 | #endif |
Victor Stinner | 00676d1 | 2010-12-27 01:49:31 +0000 | [diff] [blame] | 154 | PyAPI_FUNC(struct symtable *) Py_SymtableString( |
| 155 | const char *str, |
| 156 | const char *filename, /* decoded from the filesystem encoding */ |
| 157 | int start); |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 158 | #ifndef Py_LIMITED_API |
Victor Stinner | 14e461d | 2013-08-26 22:28:21 +0200 | [diff] [blame] | 159 | PyAPI_FUNC(struct symtable *) Py_SymtableStringObject( |
| 160 | const char *str, |
| 161 | PyObject *filename, |
| 162 | int start); |
Martin v. Löwis | 1c0689c | 2014-01-03 21:36:49 +0100 | [diff] [blame] | 163 | #endif |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 164 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 165 | PyAPI_FUNC(void) PyErr_Print(void); |
| 166 | PyAPI_FUNC(void) PyErr_PrintEx(int); |
| 167 | PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); |
Guido van Rossum | c6cf1dd | 1994-09-07 14:35:10 +0000 | [diff] [blame] | 168 | |
Collin Winter | 670e692 | 2007-03-21 02:57:17 +0000 | [diff] [blame] | 169 | /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level |
| 170 | * exit functions. |
| 171 | */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 172 | #ifndef Py_LIMITED_API |
Collin Winter | 670e692 | 2007-03-21 02:57:17 +0000 | [diff] [blame] | 173 | PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void)); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 174 | #endif |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 175 | PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 176 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 177 | PyAPI_FUNC(void) Py_Exit(int); |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 178 | |
Gregory P. Smith | fb94c5f | 2010-03-14 06:49:55 +0000 | [diff] [blame] | 179 | /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 180 | #ifndef Py_LIMITED_API |
Gregory P. Smith | fb94c5f | 2010-03-14 06:49:55 +0000 | [diff] [blame] | 181 | PyAPI_FUNC(void) _Py_RestoreSignals(void); |
| 182 | |
Martin v. Löwis | 95292d6 | 2002-12-11 14:04:59 +0000 | [diff] [blame] | 183 | PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 184 | #endif |
Guido van Rossum | 5c4998b | 1997-02-14 19:51:34 +0000 | [diff] [blame] | 185 | |
Mark Hammond | fe51c6d | 2002-08-02 02:27:13 +0000 | [diff] [blame] | 186 | /* Bootstrap */ |
Martin v. Löwis | 790465f | 2008-04-05 20:41:37 +0000 | [diff] [blame] | 187 | PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); |
Mark Hammond | fe51c6d | 2002-08-02 02:27:13 +0000 | [diff] [blame] | 188 | |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 189 | #ifndef Py_LIMITED_API |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 190 | /* Use macros for a bunch of old variants */ |
| 191 | #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) |
| 192 | #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) |
| 193 | #define PyRun_AnyFileEx(fp, name, closeit) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 194 | PyRun_AnyFileExFlags(fp, name, closeit, NULL) |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 195 | #define PyRun_AnyFileFlags(fp, name, flags) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 196 | PyRun_AnyFileExFlags(fp, name, 0, flags) |
Mark Hammond | f3ddaee | 2005-10-23 10:53:06 +0000 | [diff] [blame] | 197 | #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 198 | #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) |
| 199 | #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) |
| 200 | #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) |
| 201 | #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) |
| 202 | #define PyRun_File(fp, p, s, g, l) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 203 | PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 204 | #define PyRun_FileEx(fp, p, s, g, l, c) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 205 | PyRun_FileExFlags(fp, p, s, g, l, c, NULL) |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 206 | #define PyRun_FileFlags(fp, p, s, g, l, flags) \ |
Antoine Pitrou | f95a1b3 | 2010-05-09 15:52:27 +0000 | [diff] [blame] | 207 | PyRun_FileExFlags(fp, p, s, g, l, 0, flags) |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 208 | #endif |
Jeremy Hylton | 3e0055f | 2005-10-20 19:59:25 +0000 | [diff] [blame] | 209 | |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 210 | /* In getpath.c */ |
Martin v. Löwis | 790465f | 2008-04-05 20:41:37 +0000 | [diff] [blame] | 211 | PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void); |
| 212 | PyAPI_FUNC(wchar_t *) Py_GetPrefix(void); |
| 213 | PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); |
| 214 | PyAPI_FUNC(wchar_t *) Py_GetPath(void); |
Kristján Valur Jónsson | 3b69db2 | 2010-09-27 05:32:54 +0000 | [diff] [blame] | 215 | PyAPI_FUNC(void) Py_SetPath(const wchar_t *); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 216 | #ifdef MS_WINDOWS |
| 217 | int _Py_CheckPython3(); |
| 218 | #endif |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 219 | |
| 220 | /* In their own files */ |
Mark Hammond | a290527 | 2002-07-29 13:42:14 +0000 | [diff] [blame] | 221 | PyAPI_FUNC(const char *) Py_GetVersion(void); |
| 222 | PyAPI_FUNC(const char *) Py_GetPlatform(void); |
| 223 | PyAPI_FUNC(const char *) Py_GetCopyright(void); |
| 224 | PyAPI_FUNC(const char *) Py_GetCompiler(void); |
| 225 | PyAPI_FUNC(const char *) Py_GetBuildInfo(void); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 226 | #ifndef Py_LIMITED_API |
Georg Brandl | 1ca2e79 | 2011-03-05 20:51:24 +0100 | [diff] [blame] | 227 | PyAPI_FUNC(const char *) _Py_hgidentifier(void); |
| 228 | PyAPI_FUNC(const char *) _Py_hgversion(void); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 229 | #endif |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 230 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 231 | /* Internal -- various one-time initializations */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 232 | #ifndef Py_LIMITED_API |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 233 | PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); |
| 234 | PyAPI_FUNC(PyObject *) _PySys_Init(void); |
| 235 | PyAPI_FUNC(void) _PyImport_Init(void); |
Brett Cannon | fd07415 | 2012-04-14 14:10:13 -0400 | [diff] [blame] | 236 | PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod); |
Just van Rossum | 52e14d6 | 2002-12-30 22:08:05 +0000 | [diff] [blame] | 237 | PyAPI_FUNC(void) _PyImportHooks_Init(void); |
Neal Norwitz | b2501f4 | 2002-12-31 03:42:13 +0000 | [diff] [blame] | 238 | PyAPI_FUNC(int) _PyFrame_Init(void); |
Victor Stinner | 1c8f059 | 2013-07-22 22:24:54 +0200 | [diff] [blame] | 239 | PyAPI_FUNC(int) _PyFloat_Init(void); |
Christian Heimes | 9c4756e | 2008-05-26 13:22:05 +0000 | [diff] [blame] | 240 | PyAPI_FUNC(int) PyByteArray_Init(void); |
Antoine Pitrou | 86838b0 | 2012-02-21 19:03:47 +0100 | [diff] [blame] | 241 | PyAPI_FUNC(void) _PyRandom_Init(void); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 242 | #endif |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 243 | |
Guido van Rossum | 8e5e446 | 1997-08-12 14:57:21 +0000 | [diff] [blame] | 244 | /* Various internal finalizers */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 245 | #ifndef Py_LIMITED_API |
Mark Hammond | a290527 | 2002-07-29 13:42:14 +0000 | [diff] [blame] | 246 | PyAPI_FUNC(void) _PyExc_Fini(void); |
| 247 | PyAPI_FUNC(void) _PyImport_Fini(void); |
| 248 | PyAPI_FUNC(void) PyMethod_Fini(void); |
| 249 | PyAPI_FUNC(void) PyFrame_Fini(void); |
| 250 | PyAPI_FUNC(void) PyCFunction_Fini(void); |
Christian Heimes | 77c02eb | 2008-02-09 02:18:51 +0000 | [diff] [blame] | 251 | PyAPI_FUNC(void) PyDict_Fini(void); |
Mark Hammond | a290527 | 2002-07-29 13:42:14 +0000 | [diff] [blame] | 252 | PyAPI_FUNC(void) PyTuple_Fini(void); |
Raymond Hettinger | fb09f0e | 2004-10-07 03:58:07 +0000 | [diff] [blame] | 253 | PyAPI_FUNC(void) PyList_Fini(void); |
Raymond Hettinger | d794666 | 2005-08-01 21:39:29 +0000 | [diff] [blame] | 254 | PyAPI_FUNC(void) PySet_Fini(void); |
Christian Heimes | 72b710a | 2008-05-26 13:28:38 +0000 | [diff] [blame] | 255 | PyAPI_FUNC(void) PyBytes_Fini(void); |
Christian Heimes | 9c4756e | 2008-05-26 13:22:05 +0000 | [diff] [blame] | 256 | PyAPI_FUNC(void) PyByteArray_Fini(void); |
Mark Hammond | a290527 | 2002-07-29 13:42:14 +0000 | [diff] [blame] | 257 | PyAPI_FUNC(void) PyFloat_Fini(void); |
| 258 | PyAPI_FUNC(void) PyOS_FiniInterrupts(void); |
Antoine Pitrou | 5f454a0 | 2013-05-06 21:15:57 +0200 | [diff] [blame] | 259 | PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void); |
Antoine Pitrou | 696e035 | 2010-08-08 22:18:46 +0000 | [diff] [blame] | 260 | PyAPI_FUNC(void) _PyGC_Fini(void); |
Antoine Pitrou | f34a0cd | 2011-11-18 20:14:34 +0100 | [diff] [blame] | 261 | PyAPI_FUNC(void) PySlice_Fini(void); |
Antoine Pitrou | 957a23b | 2013-05-04 20:45:02 +0200 | [diff] [blame] | 262 | PyAPI_FUNC(void) _PyType_Fini(void); |
Antoine Pitrou | 4879a96 | 2013-08-31 00:26:02 +0200 | [diff] [blame] | 263 | PyAPI_FUNC(void) _PyRandom_Fini(void); |
Antoine Pitrou | 0d5e52d | 2011-05-04 20:02:30 +0200 | [diff] [blame] | 264 | |
| 265 | PyAPI_DATA(PyThreadState *) _Py_Finalizing; |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 266 | #endif |
Guido van Rossum | 8e5e446 | 1997-08-12 14:57:21 +0000 | [diff] [blame] | 267 | |
Guido van Rossum | 3fb1aea | 1997-08-12 15:14:22 +0000 | [diff] [blame] | 268 | /* Stuff with no proper home (yet) */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 269 | #ifndef Py_LIMITED_API |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 270 | PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 271 | #endif |
Mark Hammond | 5d54667 | 2002-08-12 13:06:35 +0000 | [diff] [blame] | 272 | PyAPI_DATA(int) (*PyOS_InputHook)(void); |
Serhiy Storchaka | c679227 | 2013-10-19 21:03:34 +0300 | [diff] [blame] | 273 | PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *); |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 274 | #ifndef Py_LIMITED_API |
Jason Tishler | 0d2a75c | 2004-08-09 15:02:30 +0000 | [diff] [blame] | 275 | PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 276 | #endif |
Fredrik Lundh | 2f15b25 | 2000-08-27 19:15:31 +0000 | [diff] [blame] | 277 | |
| 278 | /* Stack size, in "pointers" (so we get extra safety margins |
| 279 | on 64-bit platforms). On a 32-bit platform, this translates |
| 280 | to a 8k margin. */ |
| 281 | #define PYOS_STACK_MARGIN 2048 |
| 282 | |
Amaury Forgeot d'Arc | 3d17a5c | 2008-06-13 01:09:34 +0000 | [diff] [blame] | 283 | #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 |
Fredrik Lundh | 2f15b25 | 2000-08-27 19:15:31 +0000 | [diff] [blame] | 284 | /* Enable stack checking under Microsoft C */ |
| 285 | #define USE_STACKCHECK |
| 286 | #endif |
| 287 | |
Jack Jansen | 275abb3 | 2000-08-07 21:00:42 +0000 | [diff] [blame] | 288 | #ifdef USE_STACKCHECK |
Fredrik Lundh | 2f15b25 | 2000-08-27 19:15:31 +0000 | [diff] [blame] | 289 | /* Check that we aren't overflowing our stack */ |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 290 | PyAPI_FUNC(int) PyOS_CheckStack(void); |
Jack Jansen | 275abb3 | 2000-08-07 21:00:42 +0000 | [diff] [blame] | 291 | #endif |
Guido van Rossum | 3fb1aea | 1997-08-12 15:14:22 +0000 | [diff] [blame] | 292 | |
Guido van Rossum | c7247ce | 2000-09-16 16:31:31 +0000 | [diff] [blame] | 293 | /* Signals */ |
| 294 | typedef void (*PyOS_sighandler_t)(int); |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 295 | PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); |
| 296 | PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); |
Guido van Rossum | c7247ce | 2000-09-16 16:31:31 +0000 | [diff] [blame] | 297 | |
Georg Brandl | 2daf6ae | 2012-02-20 19:54:16 +0100 | [diff] [blame] | 298 | /* Random */ |
| 299 | PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size); |
Guido van Rossum | c7247ce | 2000-09-16 16:31:31 +0000 | [diff] [blame] | 300 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 301 | #ifdef __cplusplus |
| 302 | } |
| 303 | #endif |
| 304 | #endif /* !Py_PYTHONRUN_H */ |