1 /*
2  * src/pl/plpython/plpy_main.h
3  */
4 
5 #ifndef PLPY_MAIN_H
6 #define PLPY_MAIN_H
7 
8 #include "plpy_procedure.h"
9 
10 /* the interpreter's globals dict */
11 extern PyObject *PLy_interp_globals;
12 
13 /*
14  * A stack of PL/Python execution contexts. Each time user-defined Python code
15  * is called, an execution context is created and put on the stack. After the
16  * Python code returns, the context is destroyed.
17  */
18 typedef struct PLyExecutionContext
19 {
20 	PLyProcedure *curr_proc;	/* the currently executing procedure */
21 	MemoryContext scratch_ctx;	/* a context for things like type I/O */
22 	struct PLyExecutionContext *next;	/* previous stack level */
23 } PLyExecutionContext;
24 
25 /* Get the current execution context */
26 extern PLyExecutionContext *PLy_current_execution_context(void);
27 
28 /* Get the scratch memory context for specified execution context */
29 extern MemoryContext PLy_get_scratch_context(PLyExecutionContext *context);
30 
31 #endif							/* PLPY_MAIN_H */
32