1991-02-19 08:39:46 -04:00
|
|
|
|
1990-12-20 11:06:42 -04:00
|
|
|
/* Interfaces to parse and execute pieces of python code */
|
|
|
|
|
2000-07-08 21:55:06 -03:00
|
|
|
#ifndef Py_PYTHONRUN_H
|
|
|
|
#define Py_PYTHONRUN_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
|
2006-03-01 12:55:42 -04:00
|
|
|
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
|
2010-12-26 21:49:31 -04:00
|
|
|
PyAPI_FUNC(int) PyRun_AnyFileExFlags(
|
|
|
|
FILE *fp,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
int closeit,
|
|
|
|
PyCompilerFlags *flags);
|
|
|
|
PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
|
|
|
|
FILE *fp,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
int closeit,
|
|
|
|
PyCompilerFlags *flags);
|
|
|
|
PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
|
|
|
|
FILE *fp,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
PyCompilerFlags *flags);
|
2013-11-06 13:41:07 -04:00
|
|
|
PyAPI_FUNC(int) PyRun_InteractiveOneObject(
|
|
|
|
FILE *fp,
|
|
|
|
PyObject *filename,
|
|
|
|
PyCompilerFlags *flags);
|
2010-12-26 21:49:31 -04:00
|
|
|
PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
|
|
|
|
FILE *fp,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
PyCompilerFlags *flags);
|
|
|
|
|
|
|
|
PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
|
|
|
|
const char *s,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
int start,
|
|
|
|
PyCompilerFlags *flags,
|
|
|
|
PyArena *arena);
|
2013-08-26 17:28:21 -03:00
|
|
|
PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject(
|
|
|
|
const char *s,
|
|
|
|
PyObject *filename,
|
|
|
|
int start,
|
|
|
|
PyCompilerFlags *flags,
|
|
|
|
PyArena *arena);
|
2010-12-26 21:49:31 -04:00
|
|
|
PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
|
|
|
|
FILE *fp,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
const char* enc,
|
|
|
|
int start,
|
2015-12-25 14:01:53 -04:00
|
|
|
const char *ps1,
|
|
|
|
const char *ps2,
|
2010-12-26 21:49:31 -04:00
|
|
|
PyCompilerFlags *flags,
|
|
|
|
int *errcode,
|
|
|
|
PyArena *arena);
|
2013-08-26 17:28:21 -03:00
|
|
|
PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
|
|
|
|
FILE *fp,
|
|
|
|
PyObject *filename,
|
|
|
|
const char* enc,
|
|
|
|
int start,
|
2015-12-25 14:01:53 -04:00
|
|
|
const char *ps1,
|
|
|
|
const char *ps2,
|
2013-08-26 17:28:21 -03:00
|
|
|
PyCompilerFlags *flags,
|
|
|
|
int *errcode,
|
|
|
|
PyArena *arena);
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PyParser_SimpleParseString
|
2005-10-20 16:59:25 -03:00
|
|
|
#define PyParser_SimpleParseString(S, B) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyParser_SimpleParseStringFlags(S, B, 0)
|
2005-10-20 16:59:25 -03:00
|
|
|
#define PyParser_SimpleParseFile(FP, S, B) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyParser_SimpleParseFileFlags(FP, S, B, 0)
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2010-05-09 12:52:27 -03:00
|
|
|
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
|
2012-06-03 02:07:47 -03:00
|
|
|
int);
|
2016-12-27 08:57:39 -04:00
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
2012-06-03 02:07:47 -03:00
|
|
|
PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
|
|
|
|
const char *,
|
|
|
|
int, int);
|
2016-12-27 08:57:39 -04:00
|
|
|
#endif
|
2002-12-11 10:04:59 -04:00
|
|
|
PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
|
2012-06-03 02:07:47 -03:00
|
|
|
int, int);
|
1990-12-20 11:06:42 -04:00
|
|
|
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2010-05-09 12:52:27 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
|
|
|
|
PyObject *, PyCompilerFlags *);
|
2005-10-20 16:59:25 -03:00
|
|
|
|
2010-12-26 21:49:31 -04:00
|
|
|
PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
|
|
|
|
FILE *fp,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
int start,
|
|
|
|
PyObject *globals,
|
|
|
|
PyObject *locals,
|
|
|
|
int closeit,
|
|
|
|
PyCompilerFlags *flags);
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2005-10-20 16:59:25 -03:00
|
|
|
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifdef Py_LIMITED_API
|
2010-12-04 08:00:49 -04:00
|
|
|
PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
|
2010-12-03 16:14:31 -04:00
|
|
|
#else
|
2010-12-04 06:26:46 -04:00
|
|
|
#define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
|
|
|
|
#define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
|
2010-12-26 21:49:31 -04:00
|
|
|
PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
|
|
|
|
const char *str,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
int start,
|
|
|
|
PyCompilerFlags *flags,
|
|
|
|
int optimize);
|
2013-08-26 17:28:21 -03:00
|
|
|
PyAPI_FUNC(PyObject *) Py_CompileStringObject(
|
|
|
|
const char *str,
|
|
|
|
PyObject *filename, int start,
|
|
|
|
PyCompilerFlags *flags,
|
|
|
|
int optimize);
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2010-12-26 21:49:31 -04:00
|
|
|
PyAPI_FUNC(struct symtable *) Py_SymtableString(
|
|
|
|
const char *str,
|
|
|
|
const char *filename, /* decoded from the filesystem encoding */
|
|
|
|
int start);
|
2014-01-03 16:36:49 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2013-08-26 17:28:21 -03:00
|
|
|
PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
|
|
|
|
const char *str,
|
|
|
|
PyObject *filename,
|
|
|
|
int start);
|
2014-01-03 16:36:49 -04:00
|
|
|
#endif
|
1993-03-30 13:46:03 -04:00
|
|
|
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(void) PyErr_Print(void);
|
|
|
|
PyAPI_FUNC(void) PyErr_PrintEx(int);
|
|
|
|
PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
|
1990-12-20 11:06:42 -04:00
|
|
|
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2005-10-20 16:59:25 -03:00
|
|
|
/* Use macros for a bunch of old variants */
|
|
|
|
#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
|
|
|
|
#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
|
|
|
|
#define PyRun_AnyFileEx(fp, name, closeit) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyRun_AnyFileExFlags(fp, name, closeit, NULL)
|
2005-10-20 16:59:25 -03:00
|
|
|
#define PyRun_AnyFileFlags(fp, name, flags) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyRun_AnyFileExFlags(fp, name, 0, flags)
|
2005-10-23 07:53:06 -03:00
|
|
|
#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
|
2005-10-20 16:59:25 -03:00
|
|
|
#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
|
|
|
|
#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
|
|
|
|
#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
|
|
|
|
#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
|
|
|
|
#define PyRun_File(fp, p, s, g, l) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
|
2005-10-20 16:59:25 -03:00
|
|
|
#define PyRun_FileEx(fp, p, s, g, l, c) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
|
2005-10-20 16:59:25 -03:00
|
|
|
#define PyRun_FileFlags(fp, p, s, g, l, flags) \
|
2010-05-09 12:52:27 -03:00
|
|
|
PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2005-10-20 16:59:25 -03:00
|
|
|
|
1997-08-12 12:14:22 -03:00
|
|
|
/* Stuff with no proper home (yet) */
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2013-10-19 15:03:34 -03:00
|
|
|
PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2002-08-12 10:06:35 -03:00
|
|
|
PyAPI_DATA(int) (*PyOS_InputHook)(void);
|
2013-10-19 15:03:34 -03:00
|
|
|
PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
|
2010-12-03 16:14:31 -04:00
|
|
|
#ifndef Py_LIMITED_API
|
2004-08-09 12:02:30 -03:00
|
|
|
PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
|
2010-12-03 16:14:31 -04:00
|
|
|
#endif
|
2000-08-27 16:15:31 -03:00
|
|
|
|
|
|
|
/* Stack size, in "pointers" (so we get extra safety margins
|
|
|
|
on 64-bit platforms). On a 32-bit platform, this translates
|
2016-05-08 10:53:41 -03:00
|
|
|
to an 8k margin. */
|
2000-08-27 16:15:31 -03:00
|
|
|
#define PYOS_STACK_MARGIN 2048
|
|
|
|
|
2008-06-12 22:09:34 -03:00
|
|
|
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
|
2000-08-27 16:15:31 -03:00
|
|
|
/* Enable stack checking under Microsoft C */
|
|
|
|
#define USE_STACKCHECK
|
|
|
|
#endif
|
|
|
|
|
2000-08-07 18:00:42 -03:00
|
|
|
#ifdef USE_STACKCHECK
|
2000-08-27 16:15:31 -03:00
|
|
|
/* Check that we aren't overflowing our stack */
|
2002-08-12 04:21:58 -03:00
|
|
|
PyAPI_FUNC(int) PyOS_CheckStack(void);
|
2000-08-07 18:00:42 -03:00
|
|
|
#endif
|
1997-08-12 12:14:22 -03:00
|
|
|
|
1993-07-28 06:05:47 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_PYTHONRUN_H */
|