Merge branch 'slimconfigure'
[m6w6/ext-psi] / src / types / set_exp.h
1 /*******************************************************************************
2 Copyright (c) 2016, Michael Wallner <mike@php.net>.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
18 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *******************************************************************************/
25
26 #ifndef PSI_TYPES_SET_EXP_H
27 #define PSI_TYPES_SET_EXP_H
28
29 struct psi_data;
30 struct psi_plist;
31 struct psi_call_frame;
32 struct psi_let_exp;
33 struct psi_set_func;
34 struct psi_num_exp;
35 struct psi_impl;
36 struct psi_decl;
37 struct psi_validate_scope;
38
39 enum psi_set_exp_kind {
40 PSI_SET_FUNC,
41 PSI_SET_NUMEXP,
42 };
43
44 struct psi_set_exp {
45 enum psi_set_exp_kind kind;
46 struct psi_impl_var *var;
47 struct psi_set_exp *outer;
48 struct psi_plist *inner;
49 union {
50 struct psi_set_func *func;
51 struct psi_num_exp *num;
52 } data;
53 };
54
55 struct psi_set_exp *psi_set_exp_init(enum psi_set_exp_kind kind, void *data);
56 void psi_set_exp_free(struct psi_set_exp **exp_ptr);
57 void psi_set_exp_dump(int fd, struct psi_set_exp *set, unsigned level, int last);
58 void psi_set_exp_exec(struct psi_set_exp *val, struct psi_call_frame *frame);
59 void psi_set_exp_exec_ex(struct psi_set_exp *val, zval *zv, impl_val *iv, struct psi_call_frame *frame);
60 bool psi_set_exp_validate(struct psi_data *data, struct psi_set_exp *set, struct psi_validate_scope *scope);
61
62 struct psi_impl_var *psi_set_exp_get_impl_var(struct psi_set_exp *exp);
63 struct psi_decl_var *psi_set_exp_get_decl_var(struct psi_set_exp *exp);
64
65 #endif