flush
[m6w6/ext-psi] / src / context.h
1 #ifndef _PSI_CONTEXT_H
2 #define _PSI_CONTEXT_H
3
4 #include "parser.h"
5
6 #define PSI_ERROR 16
7 #define PSI_WARNING 32
8 typedef void (*PSI_ContextErrorFunc)(int type, const char *msg, ...);
9
10 typedef struct PSI_Context PSI_Context;
11 typedef struct PSI_ContextOps PSI_ContextOps;
12
13 struct PSI_ContextOps {
14 void (*init)(PSI_Context *C);
15 void (*dtor)(PSI_Context *C);
16 zend_function_entry *(*compile)(PSI_Context *C, PSI_Data *D);
17 };
18
19 struct PSI_Context {
20 void *context;
21 PSI_ContextErrorFunc error;
22 struct PSI_ContextOps *ops;
23 struct PSI_Data *data;
24 zend_function_entry **closures;
25 size_t count;
26 };
27
28 PSI_Context *PSI_ContextInit(PSI_Context *C, PSI_ContextOps *ops, PSI_ContextErrorFunc error);
29 void PSI_ContextBuild(PSI_Context *C, const char *path);
30 zend_function_entry *PSI_ContextCompile(PSI_Context *C, PSI_Data *D);
31 void PSI_ContextDtor(PSI_Context *C);
32 void PSI_ContextFree(PSI_Context **C);
33
34 #endif