This commit was manufactured by cvs2svn to create tag 'r23a1-fork'.
[python/dscho.git] / Include / pythonrun.h
blobe65df9fcd0228d84d69d74d31a9c831153b94c84
2 /* Interfaces to parse and execute pieces of python code */
4 #ifndef Py_PYTHONRUN_H
5 #define Py_PYTHONRUN_H
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 #define PyCF_MASK (CO_FUTURE_DIVISION)
11 #define PyCF_MASK_OBSOLETE (CO_GENERATOR_ALLOWED | CO_NESTED)
13 typedef struct {
14 int cf_flags; /* bitmask of CO_xxx flags relevant to future */
15 } PyCompilerFlags;
17 PyAPI_FUNC(void) Py_SetProgramName(char *);
18 PyAPI_FUNC(char *) Py_GetProgramName(void);
20 PyAPI_FUNC(void) Py_SetPythonHome(char *);
21 PyAPI_FUNC(char *) Py_GetPythonHome(void);
23 PyAPI_FUNC(void) Py_Initialize(void);
24 PyAPI_FUNC(void) Py_Finalize(void);
25 PyAPI_FUNC(int) Py_IsInitialized(void);
26 PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
27 PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
29 PyAPI_FUNC(int) PyRun_AnyFile(FILE *, const char *);
30 PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, const char *, int);
32 PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
33 PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
35 PyAPI_FUNC(int) PyRun_SimpleString(const char *);
36 PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
37 PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, const char *);
38 PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, const char *, int);
39 PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
40 PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, const char *);
41 PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
42 PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, const char *);
43 PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
45 PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(const char *, int);
46 PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, const char *, int);
47 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int);
48 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
49 const char *,
50 int,
51 int);
52 PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
53 int, int);
55 PyAPI_FUNC(PyObject *) PyRun_String(const char *, int, PyObject *, PyObject *);
56 PyAPI_FUNC(PyObject *) PyRun_File(FILE *, const char *, int, PyObject *, PyObject *);
57 PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, const char *, int,
58 PyObject *, PyObject *, int);
59 PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, PyObject *,
60 PyCompilerFlags *);
61 PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, const char *, int, PyObject *,
62 PyObject *, PyCompilerFlags *);
63 PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, PyObject *,
64 PyObject *, int, PyCompilerFlags *);
66 PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
67 PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
68 PyCompilerFlags *);
69 PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
71 PyAPI_FUNC(void) PyErr_Print(void);
72 PyAPI_FUNC(void) PyErr_PrintEx(int);
73 PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
75 PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
77 PyAPI_FUNC(void) Py_Exit(int);
79 PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
81 /* Bootstrap */
82 PyAPI_FUNC(int) Py_Main(int argc, char **argv);
84 /* In getpath.c */
85 PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
86 PyAPI_FUNC(char *) Py_GetPrefix(void);
87 PyAPI_FUNC(char *) Py_GetExecPrefix(void);
88 PyAPI_FUNC(char *) Py_GetPath(void);
90 /* In their own files */
91 PyAPI_FUNC(const char *) Py_GetVersion(void);
92 PyAPI_FUNC(const char *) Py_GetPlatform(void);
93 PyAPI_FUNC(const char *) Py_GetCopyright(void);
94 PyAPI_FUNC(const char *) Py_GetCompiler(void);
95 PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
97 /* Internal -- various one-time initializations */
98 PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
99 PyAPI_FUNC(PyObject *) _PySys_Init(void);
100 PyAPI_FUNC(void) _PyImport_Init(void);
101 PyAPI_FUNC(void) _PyExc_Init(void);
102 PyAPI_FUNC(void) _PyImportHooks_Init(void);
103 PyAPI_FUNC(int) _PyFrame_Init(void);
105 /* Various internal finalizers */
106 PyAPI_FUNC(void) _PyExc_Fini(void);
107 PyAPI_FUNC(void) _PyImport_Fini(void);
108 PyAPI_FUNC(void) PyMethod_Fini(void);
109 PyAPI_FUNC(void) PyFrame_Fini(void);
110 PyAPI_FUNC(void) PyCFunction_Fini(void);
111 PyAPI_FUNC(void) PyTuple_Fini(void);
112 PyAPI_FUNC(void) PyString_Fini(void);
113 PyAPI_FUNC(void) PyInt_Fini(void);
114 PyAPI_FUNC(void) PyFloat_Fini(void);
115 PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
117 /* Stuff with no proper home (yet) */
118 PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
119 PyAPI_DATA(int) (*PyOS_InputHook)(void);
120 PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
122 /* Stack size, in "pointers" (so we get extra safety margins
123 on 64-bit platforms). On a 32-bit platform, this translates
124 to a 8k margin. */
125 #define PYOS_STACK_MARGIN 2048
127 #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
128 /* Enable stack checking under Microsoft C */
129 #define USE_STACKCHECK
130 #endif
132 #ifdef USE_STACKCHECK
133 /* Check that we aren't overflowing our stack */
134 PyAPI_FUNC(int) PyOS_CheckStack(void);
135 #endif
137 /* Signals */
138 typedef void (*PyOS_sighandler_t)(int);
139 PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
140 PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
143 #ifdef __cplusplus
145 #endif
146 #endif /* !Py_PYTHONRUN_H */