cleanup
[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);
17 void (*call)(PSI_Context *C, impl_val *ret_val, decl *decl);
18 };
19
20 struct PSI_Context {
21 PSI_DATA_MEMBERS;
22 void *context;
23 struct PSI_ContextOps *ops;
24 zend_function_entry *closures;
25 PSI_Data *data;
26 size_t count;
27 };
28
29 PSI_Context *PSI_ContextInit(PSI_Context *C, PSI_ContextOps *ops, PSI_ContextErrorFunc error);
30 void PSI_ContextBuild(PSI_Context *C, const char *path);
31 int PSI_ContextValidate(PSI_Context *C, PSI_Parser *P);
32 zend_function_entry *PSI_ContextCompile(PSI_Context *C);
33 void PSI_ContextCall(PSI_Context *C, impl_val *ret_val, decl *decl);
34 void PSI_ContextDtor(PSI_Context *C);
35 void PSI_ContextFree(PSI_Context **C);
36
37 #endif