~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Include/pythonrun.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

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