source: vendor/python/2.5/Include/pythonrun.h

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 6.3 KB
Line 
1
2/* Interfaces to parse and execute pieces of python code */
3
4#ifndef Py_PYTHONRUN_H
5#define Py_PYTHONRUN_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
11 CO_FUTURE_WITH_STATEMENT)
12#define PyCF_MASK_OBSOLETE (CO_NESTED)
13#define PyCF_SOURCE_IS_UTF8 0x0100
14#define PyCF_DONT_IMPLY_DEDENT 0x0200
15#define PyCF_ONLY_AST 0x0400
16
17typedef struct {
18 int cf_flags; /* bitmask of CO_xxx flags relevant to future */
19} PyCompilerFlags;
20
21PyAPI_FUNC(void) Py_SetProgramName(char *);
22PyAPI_FUNC(char *) Py_GetProgramName(void);
23
24PyAPI_FUNC(void) Py_SetPythonHome(char *);
25PyAPI_FUNC(char *) Py_GetPythonHome(void);
26
27PyAPI_FUNC(void) Py_Initialize(void);
28PyAPI_FUNC(void) Py_InitializeEx(int);
29PyAPI_FUNC(void) Py_Finalize(void);
30PyAPI_FUNC(int) Py_IsInitialized(void);
31PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
32PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
33
34PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
35PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
36PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
37PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *);
38PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *);
39PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *);
40
41PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *,
42 int, PyCompilerFlags *flags,
43 PyArena *);
44PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int,
45 char *, char *,
46 PyCompilerFlags *, int *,
47 PyArena *);
48#define PyParser_SimpleParseString(S, B) \
49 PyParser_SimpleParseStringFlags(S, B, 0)
50#define PyParser_SimpleParseFile(FP, S, B) \
51 PyParser_SimpleParseFileFlags(FP, S, B, 0)
52PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
53 int);
54PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
55 int, int);
56
57PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
58 PyObject *, PyCompilerFlags *);
59
60PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int,
61 PyObject *, PyObject *, int,
62 PyCompilerFlags *);
63
64#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL)
65PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int,
66 PyCompilerFlags *);
67PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int);
68
69PyAPI_FUNC(void) PyErr_Print(void);
70PyAPI_FUNC(void) PyErr_PrintEx(int);
71PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
72
73PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
74
75PyAPI_FUNC(void) Py_Exit(int);
76
77PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
78
79/* Bootstrap */
80PyAPI_FUNC(int) Py_Main(int argc, char **argv);
81
82/* Use macros for a bunch of old variants */
83#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
84#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
85#define PyRun_AnyFileEx(fp, name, closeit) \
86 PyRun_AnyFileExFlags(fp, name, closeit, NULL)
87#define PyRun_AnyFileFlags(fp, name, flags) \
88 PyRun_AnyFileExFlags(fp, name, 0, flags)
89#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
90#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
91#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
92#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
93#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
94#define PyRun_File(fp, p, s, g, l) \
95 PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
96#define PyRun_FileEx(fp, p, s, g, l, c) \
97 PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
98#define PyRun_FileFlags(fp, p, s, g, l, flags) \
99 PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
100
101/* In getpath.c */
102PyAPI_FUNC(char *) Py_GetProgramFullPath(void);
103PyAPI_FUNC(char *) Py_GetPrefix(void);
104PyAPI_FUNC(char *) Py_GetExecPrefix(void);
105PyAPI_FUNC(char *) Py_GetPath(void);
106
107/* In their own files */
108PyAPI_FUNC(const char *) Py_GetVersion(void);
109PyAPI_FUNC(const char *) Py_GetPlatform(void);
110PyAPI_FUNC(const char *) Py_GetCopyright(void);
111PyAPI_FUNC(const char *) Py_GetCompiler(void);
112PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
113PyAPI_FUNC(const char *) _Py_svnversion(void);
114PyAPI_FUNC(const char *) Py_SubversionRevision(void);
115PyAPI_FUNC(const char *) Py_SubversionShortBranch(void);
116
117/* Internal -- various one-time initializations */
118PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
119PyAPI_FUNC(PyObject *) _PySys_Init(void);
120PyAPI_FUNC(void) _PyImport_Init(void);
121PyAPI_FUNC(void) _PyExc_Init(void);
122PyAPI_FUNC(void) _PyImportHooks_Init(void);
123PyAPI_FUNC(int) _PyFrame_Init(void);
124PyAPI_FUNC(int) _PyInt_Init(void);
125PyAPI_FUNC(void) _PyFloat_Init(void);
126
127/* Various internal finalizers */
128PyAPI_FUNC(void) _PyExc_Fini(void);
129PyAPI_FUNC(void) _PyImport_Fini(void);
130PyAPI_FUNC(void) PyMethod_Fini(void);
131PyAPI_FUNC(void) PyFrame_Fini(void);
132PyAPI_FUNC(void) PyCFunction_Fini(void);
133PyAPI_FUNC(void) PyTuple_Fini(void);
134PyAPI_FUNC(void) PyList_Fini(void);
135PyAPI_FUNC(void) PySet_Fini(void);
136PyAPI_FUNC(void) PyString_Fini(void);
137PyAPI_FUNC(void) PyInt_Fini(void);
138PyAPI_FUNC(void) PyFloat_Fini(void);
139PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
140
141/* Stuff with no proper home (yet) */
142PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
143PyAPI_DATA(int) (*PyOS_InputHook)(void);
144PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *);
145PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
146
147/* Stack size, in "pointers" (so we get extra safety margins
148 on 64-bit platforms). On a 32-bit platform, this translates
149 to a 8k margin. */
150#define PYOS_STACK_MARGIN 2048
151
152#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
153/* Enable stack checking under Microsoft C */
154#define USE_STACKCHECK
155#endif
156
157#ifdef USE_STACKCHECK
158/* Check that we aren't overflowing our stack */
159PyAPI_FUNC(int) PyOS_CheckStack(void);
160#endif
161
162/* Signals */
163typedef void (*PyOS_sighandler_t)(int);
164PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
165PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
166
167
168#ifdef __cplusplus
169}
170#endif
171#endif /* !Py_PYTHONRUN_H */
Note: See TracBrowser for help on using the repository browser.