travis: update
[m6w6/ext-psi] / src / types / let_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_LET_VAL_H
27 #define PSI_TYPES_LET_VAL_H
28
29 struct psi_data;
30 struct psi_call_frame;
31 struct psi_impl;
32 struct psi_decl_var;
33 struct psi_num_exp;
34 struct psi_let_calloc;
35 struct psi_let_callback;
36 struct psi_let_func;
37
38 enum psi_let_exp_kind {
39 PSI_LET_NULL,
40 PSI_LET_NUMEXP,
41 PSI_LET_CALLOC,
42 PSI_LET_CALLBACK,
43 PSI_LET_FUNC,
44 PSI_LET_TMP,
45 };
46
47 struct psi_let_exp {
48 enum psi_let_exp_kind kind;
49 struct psi_let_exp *outer;
50 struct psi_decl_var *var;
51 union {
52 struct psi_num_exp *num;
53 struct psi_let_calloc *alloc;
54 struct psi_let_callback *callback;
55 struct psi_let_func *func;
56 struct psi_decl_var *var;
57 } data;
58 unsigned is_reference:1;
59 };
60
61
62 struct psi_let_exp *psi_let_exp_init(enum psi_let_exp_kind kind, void *data);
63 struct psi_let_exp *psi_let_exp_init_ex(struct psi_decl_var *var, enum psi_let_exp_kind kind, void *data);
64 void psi_let_exp_free(struct psi_let_exp **let_ptr);
65 void psi_let_exp_dump(struct psi_dump *dump, struct psi_let_exp *exp, unsigned level, int last);
66
67 void *psi_let_exp_exec(struct psi_let_exp *exp, struct psi_decl_arg *darg, void *actual_location, size_t actual_size, struct psi_call_frame *frame);
68 bool psi_let_exp_validate(struct psi_data *data, struct psi_let_exp *exp, struct psi_validate_scope *scope);
69
70 struct psi_let_func *psi_let_exp_get_func(struct psi_let_exp *exp);
71 struct psi_impl_var *psi_let_exp_get_impl_var(struct psi_let_exp *exp);
72 struct psi_decl_var *psi_let_exp_get_decl_var(struct psi_let_exp *val);
73 zend_string *psi_let_exp_get_decl_var_name(struct psi_let_exp *exp);
74
75 #endif