Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | /*********************************************************** |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 2 | Copyright (c) 2000, BeOpen.com. |
| 3 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 4 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 5 | All rights reserved. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 6 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 7 | See the file "Misc/COPYRIGHT" for information on usage and |
| 8 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 9 | ******************************************************************/ |
| 10 | |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 11 | /* Interfaces to parse and execute pieces of python code */ |
| 12 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 13 | #ifndef Py_PYTHONRUN_H |
| 14 | #define Py_PYTHONRUN_H |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 18 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 19 | DL_IMPORT(void) Py_SetProgramName(char *); |
| 20 | DL_IMPORT(char *) Py_GetProgramName(void); |
Guido van Rossum | 66d4b90 | 1998-02-06 22:28:05 +0000 | [diff] [blame] | 21 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 22 | DL_IMPORT(void) Py_SetPythonHome(char *); |
| 23 | DL_IMPORT(char *) Py_GetPythonHome(void); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 24 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 25 | DL_IMPORT(void) Py_Initialize(void); |
| 26 | DL_IMPORT(void) Py_Finalize(void); |
| 27 | DL_IMPORT(int) Py_IsInitialized(void); |
| 28 | DL_IMPORT(PyThreadState *) Py_NewInterpreter(void); |
| 29 | DL_IMPORT(void) Py_EndInterpreter(PyThreadState *); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 30 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 31 | DL_IMPORT(int) PyRun_AnyFile(FILE *, char *); |
Guido van Rossum | 0df002c | 2000-08-27 19:21:52 +0000 | [diff] [blame] | 32 | DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 33 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 34 | DL_IMPORT(int) PyRun_SimpleString(char *); |
| 35 | DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *); |
Guido van Rossum | 0df002c | 2000-08-27 19:21:52 +0000 | [diff] [blame] | 36 | DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int); |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 37 | DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *); |
| 38 | DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 39 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 40 | DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int); |
| 41 | DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 42 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 43 | DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *); |
| 44 | DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *); |
Guido van Rossum | 0df002c | 2000-08-27 19:21:52 +0000 | [diff] [blame] | 45 | DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int, |
| 46 | PyObject *, PyObject *, int); |
Guido van Rossum | 5b72218 | 1993-03-30 17:46:03 +0000 | [diff] [blame] | 47 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 48 | DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 49 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 50 | DL_IMPORT(void) PyErr_Print(void); |
| 51 | DL_IMPORT(void) PyErr_PrintEx(int); |
Guido van Rossum | c6cf1dd | 1994-09-07 14:35:10 +0000 | [diff] [blame] | 52 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 53 | DL_IMPORT(int) Py_AtExit(void (*func)(void)); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 54 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 55 | DL_IMPORT(void) Py_Exit(int); |
| 56 | |
| 57 | DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *); |
Guido van Rossum | 5c4998b | 1997-02-14 19:51:34 +0000 | [diff] [blame] | 58 | |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 59 | /* In getpath.c */ |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 60 | DL_IMPORT(char *) Py_GetProgramFullPath(void); |
| 61 | DL_IMPORT(char *) Py_GetPrefix(void); |
| 62 | DL_IMPORT(char *) Py_GetExecPrefix(void); |
| 63 | DL_IMPORT(char *) Py_GetPath(void); |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 64 | |
| 65 | /* In their own files */ |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 66 | DL_IMPORT(const char *) Py_GetVersion(void); |
| 67 | DL_IMPORT(const char *) Py_GetPlatform(void); |
| 68 | DL_IMPORT(const char *) Py_GetCopyright(void); |
| 69 | DL_IMPORT(const char *) Py_GetCompiler(void); |
| 70 | DL_IMPORT(const char *) Py_GetBuildInfo(void); |
Guido van Rossum | 57d8e3f | 1997-07-19 19:50:52 +0000 | [diff] [blame] | 71 | |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 72 | /* Internal -- various one-time initializations */ |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 73 | DL_IMPORT(PyObject *) _PyBuiltin_Init(void); |
| 74 | DL_IMPORT(PyObject *) _PySys_Init(void); |
| 75 | DL_IMPORT(void) _PyImport_Init(void); |
| 76 | DL_IMPORT(void) init_exceptions(void); |
Guido van Rossum | 29e46a9 | 1997-08-02 02:56:48 +0000 | [diff] [blame] | 77 | |
Guido van Rossum | 8e5e446 | 1997-08-12 14:57:21 +0000 | [diff] [blame] | 78 | /* Various internal finalizers */ |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 79 | DL_IMPORT(void) fini_exceptions(void); |
| 80 | DL_IMPORT(void) _PyImport_Fini(void); |
| 81 | DL_IMPORT(void) PyMethod_Fini(void); |
| 82 | DL_IMPORT(void) PyFrame_Fini(void); |
| 83 | DL_IMPORT(void) PyCFunction_Fini(void); |
| 84 | DL_IMPORT(void) PyTuple_Fini(void); |
| 85 | DL_IMPORT(void) PyString_Fini(void); |
| 86 | DL_IMPORT(void) PyInt_Fini(void); |
| 87 | DL_IMPORT(void) PyFloat_Fini(void); |
| 88 | DL_IMPORT(void) PyOS_FiniInterrupts(void); |
Guido van Rossum | 8e5e446 | 1997-08-12 14:57:21 +0000 | [diff] [blame] | 89 | |
Guido van Rossum | 3fb1aea | 1997-08-12 15:14:22 +0000 | [diff] [blame] | 90 | /* Stuff with no proper home (yet) */ |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 91 | DL_IMPORT(char *) PyOS_Readline(char *); |
| 92 | extern DL_IMPORT(int) (*PyOS_InputHook)(void); |
| 93 | extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *); |
Fredrik Lundh | 2f15b25 | 2000-08-27 19:15:31 +0000 | [diff] [blame] | 94 | |
| 95 | /* Stack size, in "pointers" (so we get extra safety margins |
| 96 | on 64-bit platforms). On a 32-bit platform, this translates |
| 97 | to a 8k margin. */ |
| 98 | #define PYOS_STACK_MARGIN 2048 |
| 99 | |
| 100 | #if defined(WIN32) && defined(_MSC_VER) |
| 101 | /* Enable stack checking under Microsoft C */ |
| 102 | #define USE_STACKCHECK |
| 103 | #endif |
| 104 | |
Jack Jansen | 275abb3 | 2000-08-07 21:00:42 +0000 | [diff] [blame] | 105 | #ifdef USE_STACKCHECK |
Fredrik Lundh | 2f15b25 | 2000-08-27 19:15:31 +0000 | [diff] [blame] | 106 | /* Check that we aren't overflowing our stack */ |
| 107 | DL_IMPORT(int) PyOS_CheckStack(void); |
Jack Jansen | 275abb3 | 2000-08-07 21:00:42 +0000 | [diff] [blame] | 108 | #endif |
Guido van Rossum | 3fb1aea | 1997-08-12 15:14:22 +0000 | [diff] [blame] | 109 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 110 | #ifdef __cplusplus |
| 111 | } |
| 112 | #endif |
| 113 | #endif /* !Py_PYTHONRUN_H */ |