append(): Fixing the test for convertability after consultation with
[python/dscho.git] / Include / pythonrun.h
blob98965b52a66297ae4ae2088b8e48834d78ce7162
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 *, char *);
30 PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *, char *, int);
32 PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, char *, PyCompilerFlags *);
33 PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, char *, int, PyCompilerFlags *);
35 PyAPI_FUNC(int) PyRun_SimpleString(char *);
36 PyAPI_FUNC(int) PyRun_SimpleStringFlags(char *, PyCompilerFlags *);
37 PyAPI_FUNC(int) PyRun_SimpleFile(FILE *, char *);
38 PyAPI_FUNC(int) PyRun_SimpleFileEx(FILE *, char *, int);
39 PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, char *, int, PyCompilerFlags *);
40 PyAPI_FUNC(int) PyRun_InteractiveOne(FILE *, char *);
41 PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, char *, PyCompilerFlags *);
42 PyAPI_FUNC(int) PyRun_InteractiveLoop(FILE *, char *);
43 PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, char *, PyCompilerFlags *);
45 PyAPI_FUNC(struct _node *) PyParser_SimpleParseString(char *, int);
46 PyAPI_FUNC(struct _node *) PyParser_SimpleParseFile(FILE *, char *, int);
47 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(char *, int, int);
48 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(char *,
49 char *,
50 int,
51 int);
52 PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, char *,
53 int, int);
55 PyAPI_FUNC(PyObject *) PyRun_String(char *, int, PyObject *, PyObject *);
56 PyAPI_FUNC(PyObject *) PyRun_File(FILE *, char *, int, PyObject *, PyObject *);
57 PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *, char *, int,
58 PyObject *, PyObject *, int);
59 PyAPI_FUNC(PyObject *) PyRun_StringFlags(char *, int, PyObject *, PyObject *,
60 PyCompilerFlags *);
61 PyAPI_FUNC(PyObject *) PyRun_FileFlags(FILE *, char *, int, PyObject *,
62 PyObject *, PyCompilerFlags *);
63 PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, char *, int, PyObject *,
64 PyObject *, int, PyCompilerFlags *);
66 PyAPI_FUNC(PyObject *) Py_CompileString(char *, char *, int);
67 PyAPI_FUNC(PyObject *) Py_CompileStringFlags(char *, char *, int,
68 PyCompilerFlags *);
69 PyAPI_FUNC(struct symtable *) Py_SymtableString(char *, 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 *, 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);
103 /* Various internal finalizers */
104 PyAPI_FUNC(void) _PyExc_Fini(void);
105 PyAPI_FUNC(void) _PyImport_Fini(void);
106 PyAPI_FUNC(void) PyMethod_Fini(void);
107 PyAPI_FUNC(void) PyFrame_Fini(void);
108 PyAPI_FUNC(void) PyCFunction_Fini(void);
109 PyAPI_FUNC(void) PyTuple_Fini(void);
110 PyAPI_FUNC(void) PyString_Fini(void);
111 PyAPI_FUNC(void) PyInt_Fini(void);
112 PyAPI_FUNC(void) PyFloat_Fini(void);
113 PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
115 /* Stuff with no proper home (yet) */
116 PyAPI_FUNC(char *) PyOS_Readline(char *);
117 PyAPI_DATA(int) (*PyOS_InputHook)(void);
118 PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(char *);
120 /* Stack size, in "pointers" (so we get extra safety margins
121 on 64-bit platforms). On a 32-bit platform, this translates
122 to a 8k margin. */
123 #define PYOS_STACK_MARGIN 2048
125 #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
126 /* Enable stack checking under Microsoft C */
127 #define USE_STACKCHECK
128 #endif
130 #ifdef USE_STACKCHECK
131 /* Check that we aren't overflowing our stack */
132 PyAPI_FUNC(int) PyOS_CheckStack(void);
133 #endif
135 /* Signals */
136 typedef void (*PyOS_sighandler_t)(int);
137 PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
138 PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
141 #ifdef __cplusplus
143 #endif
144 #endif /* !Py_PYTHONRUN_H */