98516acfa5f76884b1bda1791346cbc90e1f9bfd
[m6w6/ext-psi] / src / context.h
1 #ifndef _PSI_CONTEXT_H
2 #define _PSI_CONTEXT_H
3
4 struct psi_context;
5 struct psi_token;
6 struct psi_parser;
7 struct decl_callinfo;
8 struct impl_vararg;
9
10 #define PSI_PRINT_POINTER_LEVEL(l) l,"************************"
11 #define PSI_ERROR 16
12 #define PSI_WARNING 32
13 typedef void (*psi_context_error_func)(void *context, struct psi_token *token, int type, const char *msg, ...);
14
15
16 struct psi_context_ops {
17 void (*init)(struct psi_context *C);
18 void (*dtor)(struct psi_context *C);
19 zend_function_entry *(*compile)(struct psi_context *C);
20 void (*call)(struct psi_context *C, struct decl_callinfo *decl_call, struct impl_vararg *va);
21 };
22
23 #include "data.h"
24
25 struct psi_context {
26 PSI_DATA_MEMBERS;
27 void *context;
28 struct psi_context_ops *ops;
29 zend_function_entry *closures;
30 struct psi_data *data;
31 size_t count;
32 };
33
34 struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_ops *ops, psi_context_error_func error, unsigned flags);
35 void psi_context_build(struct psi_context *C, const char *path);
36 int psi_context_validate(struct psi_context *C, struct psi_parser *P);
37 int psi_context_validate_data(struct psi_data *C, struct psi_data *D);
38 zend_function_entry *psi_context_compile(struct psi_context *C);
39 void psi_context_call(struct psi_context *C, struct decl_callinfo *decl_call, struct impl_vararg *va);
40 void psi_context_dump(struct psi_context *C, int fd);
41 void psi_context_dtor(struct psi_context *C);
42 void psi_context_free(struct psi_context **C);
43
44 #endif