blob: b963a06af17b00164d1adf625672397429e45e8e [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001
Guido van Rossum3f5da241990-12-20 15:06:42 +00002/* Interfaces to parse and execute pieces of python code */
3
Fred Drake3cf4d2b2000-07-09 00:55:06 +00004#ifndef Py_PYTHONRUN_H
5#define Py_PYTHONRUN_H
6#ifdef __cplusplus
7extern "C" {
8#endif
Guido van Rossum57d8e3f1997-07-19 19:50:52 +00009
Fred Drake3cf4d2b2000-07-09 00:55:06 +000010DL_IMPORT(void) Py_SetProgramName(char *);
11DL_IMPORT(char *) Py_GetProgramName(void);
Guido van Rossum66d4b901998-02-06 22:28:05 +000012
Fred Drake3cf4d2b2000-07-09 00:55:06 +000013DL_IMPORT(void) Py_SetPythonHome(char *);
14DL_IMPORT(char *) Py_GetPythonHome(void);
Guido van Rossum3f5da241990-12-20 15:06:42 +000015
Fred Drake3cf4d2b2000-07-09 00:55:06 +000016DL_IMPORT(void) Py_Initialize(void);
17DL_IMPORT(void) Py_Finalize(void);
18DL_IMPORT(int) Py_IsInitialized(void);
19DL_IMPORT(PyThreadState *) Py_NewInterpreter(void);
20DL_IMPORT(void) Py_EndInterpreter(PyThreadState *);
Guido van Rossum3f5da241990-12-20 15:06:42 +000021
Fred Drake3cf4d2b2000-07-09 00:55:06 +000022DL_IMPORT(int) PyRun_AnyFile(FILE *, char *);
Guido van Rossum0df002c2000-08-27 19:21:52 +000023DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int);
Guido van Rossum3f5da241990-12-20 15:06:42 +000024
Fred Drake3cf4d2b2000-07-09 00:55:06 +000025DL_IMPORT(int) PyRun_SimpleString(char *);
26DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *);
Guido van Rossum0df002c2000-08-27 19:21:52 +000027DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int);
Fred Drake3cf4d2b2000-07-09 00:55:06 +000028DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *);
29DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *);
Guido van Rossum3f5da241990-12-20 15:06:42 +000030
Fred Drake3cf4d2b2000-07-09 00:55:06 +000031DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int);
32DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int);
Guido van Rossum3f5da241990-12-20 15:06:42 +000033
Fred Drake3cf4d2b2000-07-09 00:55:06 +000034DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *);
35DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *);
Guido van Rossum0df002c2000-08-27 19:21:52 +000036DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int,
37 PyObject *, PyObject *, int);
Guido van Rossum5b722181993-03-30 17:46:03 +000038
Fred Drake3cf4d2b2000-07-09 00:55:06 +000039DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int);
Guido van Rossum3f5da241990-12-20 15:06:42 +000040
Fred Drake3cf4d2b2000-07-09 00:55:06 +000041DL_IMPORT(void) PyErr_Print(void);
42DL_IMPORT(void) PyErr_PrintEx(int);
Guido van Rossumc6cf1dd1994-09-07 14:35:10 +000043
Fred Drake3cf4d2b2000-07-09 00:55:06 +000044DL_IMPORT(int) Py_AtExit(void (*func)(void));
Guido van Rossuma3309961993-07-28 09:05:47 +000045
Fred Drake3cf4d2b2000-07-09 00:55:06 +000046DL_IMPORT(void) Py_Exit(int);
47
48DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *);
Guido van Rossum5c4998b1997-02-14 19:51:34 +000049
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000050/* In getpath.c */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000051DL_IMPORT(char *) Py_GetProgramFullPath(void);
52DL_IMPORT(char *) Py_GetPrefix(void);
53DL_IMPORT(char *) Py_GetExecPrefix(void);
54DL_IMPORT(char *) Py_GetPath(void);
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000055
56/* In their own files */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000057DL_IMPORT(const char *) Py_GetVersion(void);
58DL_IMPORT(const char *) Py_GetPlatform(void);
59DL_IMPORT(const char *) Py_GetCopyright(void);
60DL_IMPORT(const char *) Py_GetCompiler(void);
61DL_IMPORT(const char *) Py_GetBuildInfo(void);
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000062
Guido van Rossum29e46a91997-08-02 02:56:48 +000063/* Internal -- various one-time initializations */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000064DL_IMPORT(PyObject *) _PyBuiltin_Init(void);
65DL_IMPORT(PyObject *) _PySys_Init(void);
66DL_IMPORT(void) _PyImport_Init(void);
67DL_IMPORT(void) init_exceptions(void);
Guido van Rossum29e46a91997-08-02 02:56:48 +000068
Guido van Rossum8e5e4461997-08-12 14:57:21 +000069/* Various internal finalizers */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000070DL_IMPORT(void) fini_exceptions(void);
71DL_IMPORT(void) _PyImport_Fini(void);
72DL_IMPORT(void) PyMethod_Fini(void);
73DL_IMPORT(void) PyFrame_Fini(void);
74DL_IMPORT(void) PyCFunction_Fini(void);
75DL_IMPORT(void) PyTuple_Fini(void);
76DL_IMPORT(void) PyString_Fini(void);
77DL_IMPORT(void) PyInt_Fini(void);
78DL_IMPORT(void) PyFloat_Fini(void);
79DL_IMPORT(void) PyOS_FiniInterrupts(void);
Guido van Rossum8e5e4461997-08-12 14:57:21 +000080
Guido van Rossum3fb1aea1997-08-12 15:14:22 +000081/* Stuff with no proper home (yet) */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000082DL_IMPORT(char *) PyOS_Readline(char *);
83extern DL_IMPORT(int) (*PyOS_InputHook)(void);
84extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *);
Fredrik Lundh2f15b252000-08-27 19:15:31 +000085
86/* Stack size, in "pointers" (so we get extra safety margins
87 on 64-bit platforms). On a 32-bit platform, this translates
88 to a 8k margin. */
89#define PYOS_STACK_MARGIN 2048
90
Trent Mick0a7af402000-10-11 17:18:11 +000091#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
Fredrik Lundh2f15b252000-08-27 19:15:31 +000092/* Enable stack checking under Microsoft C */
93#define USE_STACKCHECK
94#endif
95
Jack Jansen275abb32000-08-07 21:00:42 +000096#ifdef USE_STACKCHECK
Fredrik Lundh2f15b252000-08-27 19:15:31 +000097/* Check that we aren't overflowing our stack */
98DL_IMPORT(int) PyOS_CheckStack(void);
Jack Jansen275abb32000-08-07 21:00:42 +000099#endif
Guido van Rossum3fb1aea1997-08-12 15:14:22 +0000100
Guido van Rossumc7247ce2000-09-16 16:31:31 +0000101/* Signals */
102typedef void (*PyOS_sighandler_t)(int);
103DL_IMPORT(PyOS_sighandler_t) PyOS_getsig(int);
104DL_IMPORT(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
105
106
Guido van Rossuma3309961993-07-28 09:05:47 +0000107#ifdef __cplusplus
108}
109#endif
110#endif /* !Py_PYTHONRUN_H */