blob: bbf2903a397978ae0439e170797319ec7212a744 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001/***********************************************************
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00002Copyright (c) 2000, BeOpen.com.
3Copyright (c) 1995-2000, Corporation for National Research Initiatives.
4Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
5All rights reserved.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00006
Guido van Rossumfd71b9e2000-06-30 23:50:40 +00007See the file "Misc/COPYRIGHT" for information on usage and
8redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumf70e43a1991-02-19 12:39:46 +00009******************************************************************/
10
Guido van Rossum3f5da241990-12-20 15:06:42 +000011/* Interfaces to parse and execute pieces of python code */
12
Fred Drake3cf4d2b2000-07-09 00:55:06 +000013#ifndef Py_PYTHONRUN_H
14#define Py_PYTHONRUN_H
15#ifdef __cplusplus
16extern "C" {
17#endif
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000018
Fred Drake3cf4d2b2000-07-09 00:55:06 +000019DL_IMPORT(void) Py_SetProgramName(char *);
20DL_IMPORT(char *) Py_GetProgramName(void);
Guido van Rossum66d4b901998-02-06 22:28:05 +000021
Fred Drake3cf4d2b2000-07-09 00:55:06 +000022DL_IMPORT(void) Py_SetPythonHome(char *);
23DL_IMPORT(char *) Py_GetPythonHome(void);
Guido van Rossum3f5da241990-12-20 15:06:42 +000024
Fred Drake3cf4d2b2000-07-09 00:55:06 +000025DL_IMPORT(void) Py_Initialize(void);
26DL_IMPORT(void) Py_Finalize(void);
27DL_IMPORT(int) Py_IsInitialized(void);
28DL_IMPORT(PyThreadState *) Py_NewInterpreter(void);
29DL_IMPORT(void) Py_EndInterpreter(PyThreadState *);
Guido van Rossum3f5da241990-12-20 15:06:42 +000030
Fred Drake3cf4d2b2000-07-09 00:55:06 +000031DL_IMPORT(int) PyRun_AnyFile(FILE *, char *);
Guido van Rossum0df002c2000-08-27 19:21:52 +000032DL_IMPORT(int) PyRun_AnyFileEx(FILE *, char *, int);
Guido van Rossum3f5da241990-12-20 15:06:42 +000033
Fred Drake3cf4d2b2000-07-09 00:55:06 +000034DL_IMPORT(int) PyRun_SimpleString(char *);
35DL_IMPORT(int) PyRun_SimpleFile(FILE *, char *);
Guido van Rossum0df002c2000-08-27 19:21:52 +000036DL_IMPORT(int) PyRun_SimpleFileEx(FILE *, char *, int);
Fred Drake3cf4d2b2000-07-09 00:55:06 +000037DL_IMPORT(int) PyRun_InteractiveOne(FILE *, char *);
38DL_IMPORT(int) PyRun_InteractiveLoop(FILE *, char *);
Guido van Rossum3f5da241990-12-20 15:06:42 +000039
Fred Drake3cf4d2b2000-07-09 00:55:06 +000040DL_IMPORT(struct _node *) PyParser_SimpleParseString(char *, int);
41DL_IMPORT(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int);
Guido van Rossum3f5da241990-12-20 15:06:42 +000042
Fred Drake3cf4d2b2000-07-09 00:55:06 +000043DL_IMPORT(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *);
44DL_IMPORT(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *);
Guido van Rossum0df002c2000-08-27 19:21:52 +000045DL_IMPORT(PyObject *) PyRun_FileEx(FILE *, char *, int,
46 PyObject *, PyObject *, int);
Guido van Rossum5b722181993-03-30 17:46:03 +000047
Fred Drake3cf4d2b2000-07-09 00:55:06 +000048DL_IMPORT(PyObject *) Py_CompileString(char *, char *, int);
Guido van Rossum3f5da241990-12-20 15:06:42 +000049
Fred Drake3cf4d2b2000-07-09 00:55:06 +000050DL_IMPORT(void) PyErr_Print(void);
51DL_IMPORT(void) PyErr_PrintEx(int);
Guido van Rossumc6cf1dd1994-09-07 14:35:10 +000052
Fred Drake3cf4d2b2000-07-09 00:55:06 +000053DL_IMPORT(int) Py_AtExit(void (*func)(void));
Guido van Rossuma3309961993-07-28 09:05:47 +000054
Fred Drake3cf4d2b2000-07-09 00:55:06 +000055DL_IMPORT(void) Py_Exit(int);
56
57DL_IMPORT(int) Py_FdIsInteractive(FILE *, char *);
Guido van Rossum5c4998b1997-02-14 19:51:34 +000058
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000059/* In getpath.c */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000060DL_IMPORT(char *) Py_GetProgramFullPath(void);
61DL_IMPORT(char *) Py_GetPrefix(void);
62DL_IMPORT(char *) Py_GetExecPrefix(void);
63DL_IMPORT(char *) Py_GetPath(void);
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000064
65/* In their own files */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000066DL_IMPORT(const char *) Py_GetVersion(void);
67DL_IMPORT(const char *) Py_GetPlatform(void);
68DL_IMPORT(const char *) Py_GetCopyright(void);
69DL_IMPORT(const char *) Py_GetCompiler(void);
70DL_IMPORT(const char *) Py_GetBuildInfo(void);
Guido van Rossum57d8e3f1997-07-19 19:50:52 +000071
Guido van Rossum29e46a91997-08-02 02:56:48 +000072/* Internal -- various one-time initializations */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000073DL_IMPORT(PyObject *) _PyBuiltin_Init(void);
74DL_IMPORT(PyObject *) _PySys_Init(void);
75DL_IMPORT(void) _PyImport_Init(void);
76DL_IMPORT(void) init_exceptions(void);
Guido van Rossum29e46a91997-08-02 02:56:48 +000077
Guido van Rossum8e5e4461997-08-12 14:57:21 +000078/* Various internal finalizers */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000079DL_IMPORT(void) fini_exceptions(void);
80DL_IMPORT(void) _PyImport_Fini(void);
81DL_IMPORT(void) PyMethod_Fini(void);
82DL_IMPORT(void) PyFrame_Fini(void);
83DL_IMPORT(void) PyCFunction_Fini(void);
84DL_IMPORT(void) PyTuple_Fini(void);
85DL_IMPORT(void) PyString_Fini(void);
86DL_IMPORT(void) PyInt_Fini(void);
87DL_IMPORT(void) PyFloat_Fini(void);
88DL_IMPORT(void) PyOS_FiniInterrupts(void);
Guido van Rossum8e5e4461997-08-12 14:57:21 +000089
Guido van Rossum3fb1aea1997-08-12 15:14:22 +000090/* Stuff with no proper home (yet) */
Fred Drake3cf4d2b2000-07-09 00:55:06 +000091DL_IMPORT(char *) PyOS_Readline(char *);
92extern DL_IMPORT(int) (*PyOS_InputHook)(void);
93extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *);
Fredrik Lundh2f15b252000-08-27 19:15:31 +000094
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 Jansen275abb32000-08-07 21:00:42 +0000105#ifdef USE_STACKCHECK
Fredrik Lundh2f15b252000-08-27 19:15:31 +0000106/* Check that we aren't overflowing our stack */
107DL_IMPORT(int) PyOS_CheckStack(void);
Jack Jansen275abb32000-08-07 21:00:42 +0000108#endif
Guido van Rossum3fb1aea1997-08-12 15:14:22 +0000109
Guido van Rossuma3309961993-07-28 09:05:47 +0000110#ifdef __cplusplus
111}
112#endif
113#endif /* !Py_PYTHONRUN_H */