File: /Users/paulross/dev/Python-3.6.2/Include/pythonrun.h

Green shading in the line number column means the source is part of the translation unit, red means it is conditionally excluded. Highlighted line numbers link to the translation unit page. Highlighted macros link to the macro page.

       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 (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \
      11:                    CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \
      12:                    CO_FUTURE_UNICODE_LITERALS | CO_FUTURE_BARRY_AS_BDFL | \
      13:                    CO_FUTURE_GENERATOR_STOP)
      14: #define PyCF_MASK_OBSOLETE (CO_NESTED)
      15: #define PyCF_SOURCE_IS_UTF8  0x0100
      16: #define PyCF_DONT_IMPLY_DEDENT 0x0200
      17: #define PyCF_ONLY_AST 0x0400
      18: #define PyCF_IGNORE_COOKIE 0x0800
      19: 
      20: #ifndef Py_LIMITED_API
      21: typedef struct {
      22:     int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
      23: } PyCompilerFlags;
      24: #endif
      25: 
      26: #ifndef Py_LIMITED_API
      27: PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
      28: PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
      29: PyAPI_FUNC(int) PyRun_AnyFileExFlags(
      30:     FILE *fp,
      31:     const char *filename,       /* decoded from the filesystem encoding */
      32:     int closeit,
      33:     PyCompilerFlags *flags);
      34: PyAPI_FUNC(int) PyRun_SimpleFileExFlags(
      35:     FILE *fp,
      36:     const char *filename,       /* decoded from the filesystem encoding */
      37:     int closeit,
      38:     PyCompilerFlags *flags);
      39: PyAPI_FUNC(int) PyRun_InteractiveOneFlags(
      40:     FILE *fp,
      41:     const char *filename,       /* decoded from the filesystem encoding */
      42:     PyCompilerFlags *flags);
      43: PyAPI_FUNC(int) PyRun_InteractiveOneObject(
      44:     FILE *fp,
      45:     PyObject *filename,
      46:     PyCompilerFlags *flags);
      47: PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(
      48:     FILE *fp,
      49:     const char *filename,       /* decoded from the filesystem encoding */
      50:     PyCompilerFlags *flags);
      51: 
      52: PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(
      53:     const char *s,
      54:     const char *filename,       /* decoded from the filesystem encoding */
      55:     int start,
      56:     PyCompilerFlags *flags,
      57:     PyArena *arena);
      58: PyAPI_FUNC(struct _mod *) PyParser_ASTFromStringObject(
      59:     const char *s,
      60:     PyObject *filename,
      61:     int start,
      62:     PyCompilerFlags *flags,
      63:     PyArena *arena);
      64: PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(
      65:     FILE *fp,
      66:     const char *filename,       /* decoded from the filesystem encoding */
      67:     const char* enc,
      68:     int start,
      69:     const char *ps1,
      70:     const char *ps2,
      71:     PyCompilerFlags *flags,
      72:     int *errcode,
      73:     PyArena *arena);
      74: PyAPI_FUNC(struct _mod *) PyParser_ASTFromFileObject(
      75:     FILE *fp,
      76:     PyObject *filename,
      77:     const char* enc,
      78:     int start,
      79:     const char *ps1,
      80:     const char *ps2,
      81:     PyCompilerFlags *flags,
      82:     int *errcode,
      83:     PyArena *arena);
      84: #endif
      85: 
      86: #ifndef PyParser_SimpleParseString
      87: #define PyParser_SimpleParseString(S, B) \
      88:     PyParser_SimpleParseStringFlags(S, B, 0)
      89: #define PyParser_SimpleParseFile(FP, S, B) \
      90:     PyParser_SimpleParseFileFlags(FP, S, B, 0)
      91: #endif
      92: PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int,
      93:                                                            int);
      94: #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
      95: PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *,
      96:                                                                    const char *,
      97:                                                                    int, int);
      98: #endif
      99: PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *,
     100:                                                          int, int);
     101: 
     102: #ifndef Py_LIMITED_API
     103: PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *,
     104:                                          PyObject *, PyCompilerFlags *);
     105: 
     106: PyAPI_FUNC(PyObject *) PyRun_FileExFlags(
     107:     FILE *fp,
     108:     const char *filename,       /* decoded from the filesystem encoding */
     109:     int start,
     110:     PyObject *globals,
     111:     PyObject *locals,
     112:     int closeit,
     113:     PyCompilerFlags *flags);
     114: #endif
     115: 
     116: #ifdef Py_LIMITED_API
     117: PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int);
     118: #else
     119: #define Py_CompileString(str, p, s) Py_CompileStringExFlags(str, p, s, NULL, -1)
     120: #define Py_CompileStringFlags(str, p, s, f) Py_CompileStringExFlags(str, p, s, f, -1)
     121: PyAPI_FUNC(PyObject *) Py_CompileStringExFlags(
     122:     const char *str,
     123:     const char *filename,       /* decoded from the filesystem encoding */
     124:     int start,
     125:     PyCompilerFlags *flags,
     126:     int optimize);
     127: PyAPI_FUNC(PyObject *) Py_CompileStringObject(
     128:     const char *str,
     129:     PyObject *filename, int start,
     130:     PyCompilerFlags *flags,
     131:     int optimize);
     132: #endif
     133: PyAPI_FUNC(struct symtable *) Py_SymtableString(
     134:     const char *str,
     135:     const char *filename,       /* decoded from the filesystem encoding */
     136:     int start);
     137: #ifndef Py_LIMITED_API
     138: PyAPI_FUNC(struct symtable *) Py_SymtableStringObject(
     139:     const char *str,
     140:     PyObject *filename,
     141:     int start);
     142: #endif
     143: 
     144: PyAPI_FUNC(void) PyErr_Print(void);
     145: PyAPI_FUNC(void) PyErr_PrintEx(int);
     146: PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *);
     147: 
     148: #ifndef Py_LIMITED_API
     149: /* Use macros for a bunch of old variants */
     150: #define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL)
     151: #define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL)
     152: #define PyRun_AnyFileEx(fp, name, closeit) \
     153:     PyRun_AnyFileExFlags(fp, name, closeit, NULL)
     154: #define PyRun_AnyFileFlags(fp, name, flags) \
     155:     PyRun_AnyFileExFlags(fp, name, 0, flags)
     156: #define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL)
     157: #define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL)
     158: #define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL)
     159: #define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL)
     160: #define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL)
     161: #define PyRun_File(fp, p, s, g, l) \
     162:     PyRun_FileExFlags(fp, p, s, g, l, 0, NULL)
     163: #define PyRun_FileEx(fp, p, s, g, l, c) \
     164:     PyRun_FileExFlags(fp, p, s, g, l, c, NULL)
     165: #define PyRun_FileFlags(fp, p, s, g, l, flags) \
     166:     PyRun_FileExFlags(fp, p, s, g, l, 0, flags)
     167: #endif
     168: 
     169: /* Stuff with no proper home (yet) */
     170: #ifndef Py_LIMITED_API
     171: PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, const char *);
     172: #endif
     173: PyAPI_DATA(int) (*PyOS_InputHook)(void);
     174: PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, const char *);
     175: #ifndef Py_LIMITED_API
     176: PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
     177: #endif
     178: 
     179: /* Stack size, in "pointers" (so we get extra safety margins
     180:    on 64-bit platforms).  On a 32-bit platform, this translates
     181:    to an 8k margin. */
     182: #define PYOS_STACK_MARGIN 2048
     183: 
     184: #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
     185: /* Enable stack checking under Microsoft C */
     186: #define USE_STACKCHECK
     187: #endif
     188: 
     189: #ifdef USE_STACKCHECK
     190: /* Check that we aren't overflowing our stack */
     191: PyAPI_FUNC(int) PyOS_CheckStack(void);
     192: #endif
     193: 
     194: #ifdef __cplusplus
     195: }
     196: #endif
     197: #endif /* !Py_PYTHONRUN_H */
     198: