projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
zval passthru
[m6w6/ext-psi]
/
src
/
parser.h
diff --git
a/src/parser.h
b/src/parser.h
index 3a00d6d766a5d75dea7a20fb7380c2aa2aae36c1..f16f8b853d717c3c49f463bd70f6e47580b59214 100644
(file)
--- a/
src/parser.h
+++ b/
src/parser.h
@@
-59,8
+59,8
@@
typedef union impl_val {
zend_string *str;
zend_fcall *cb;
} zend;
zend_string *str;
zend_fcall *cb;
} zend;
+ zval zval;
void *ptr;
void *ptr;
- uint8_t _dbg[sizeof(void *)];
} impl_val;
typedef struct decl_type {
} impl_val;
typedef struct decl_type {
@@
-157,7
+157,7
@@
typedef struct decl_arg {
decl_type *type;
decl_var *var;
decl_struct_layout *layout;
decl_type *type;
decl_var *var;
decl_struct_layout *layout;
- struct let_stmt *let;
+ struct let_stmt *let;
/* FIXME: decls must not point to impls !!! */
impl_val val;
void *ptr;
void *mem;
impl_val val;
void *ptr;
void *mem;
@@
-297,10
+297,6
@@
typedef struct decl_callinfo {
size_t argc;
void **args;
void **rval;
size_t argc;
void **args;
void **rval;
- struct {
- void *data;
- void (*dtor)(void *data);
- } closure;
} decl_callinfo;
typedef struct decl {
} decl_callinfo;
typedef struct decl {
@@
-481,6
+477,7
@@
static inline void free_impl_type(impl_type *type) {
typedef struct impl_var {
PSI_Token *token;
char *name;
typedef struct impl_var {
PSI_Token *token;
char *name;
+ struct impl_arg *arg;
unsigned reference:1;
} impl_var;
unsigned reference:1;
} impl_var;
@@
-601,6
+598,7
@@
static inline impl_arg *init_impl_arg(impl_type *type, impl_var *var, impl_def_v
impl_arg *arg = calloc(1, sizeof(*arg));
arg->type = type;
arg->var = var;
impl_arg *arg = calloc(1, sizeof(*arg));
arg->type = type;
arg->var = var;
+ arg->var->arg = arg;
arg->def = def;
return arg;
}
arg->def = def;
return arg;
}
@@
-902,6
+900,7
@@
static inline void free_let_calloc(let_calloc *alloc) {
typedef struct let_callback {
struct let_func *func;
struct set_values *args;
typedef struct let_callback {
struct let_func *func;
struct set_values *args;
+ decl *decl;
} let_callback;
static inline void free_let_func(struct let_func *func);
} let_callback;
static inline void free_let_func(struct let_func *func);
@@
-924,7
+923,7
@@
typedef struct let_func {
token_t type;
char *name;
impl_var *var;
token_t type;
char *name;
impl_var *var;
- impl_
arg *arg
;
+ impl_
val *(*handler)(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free)
;
} let_func;
static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
} let_func;
static inline let_func *init_let_func(token_t type, const char *name, impl_var *var) {
@@
-1087,9
+1086,10
@@
static inline set_value *init_set_value(set_func *func, decl_vars *vars) {
val->vars = vars;
return val;
}
val->vars = vars;
return val;
}
+
+static inline set_values *add_set_value(set_values *vals, set_value *val);
static inline set_value *add_inner_set_value(set_value *val, set_value *inner) {
static inline set_value *add_inner_set_value(set_value *val, set_value *inner) {
- val->inner->vals = realloc(val->inner->vals, ++val->inner->count * sizeof(*val->inner->vals));
- val->inner->vals[val->inner->count-1] = inner;
+ val->inner = add_set_value(val->inner, inner);
inner->outer.set = val;
return val;
}
inner->outer.set = val;
return val;
}
@@
-1102,11
+1102,7
@@
static inline void free_set_value(set_value *val) {
free_decl_vars(val->vars);
}
if (val->inner && (!val->outer.set || val->outer.set->inner != val->inner)) {
free_decl_vars(val->vars);
}
if (val->inner && (!val->outer.set || val->outer.set->inner != val->inner)) {
- size_t i;
- for (i = 0; i < val->inner->count; ++i) {
- free_set_value(val->inner->vals[i]);
- }
- free(val->inner->vals);
+ free_set_values(val->inner);
}
if (val->num) {
free_num_exp(val->num);
}
if (val->num) {
free_num_exp(val->num);
@@
-1125,6
+1121,9
@@
static inline set_values *init_set_values(set_value *val) {
}
static inline set_values *add_set_value(set_values *vals, set_value *val) {
}
static inline set_values *add_set_value(set_values *vals, set_value *val) {
+ if (!vals) {
+ vals = calloc(1, sizeof(*vals));
+ }
vals->vals = realloc(vals->vals, ++vals->count * sizeof(val));
vals->vals[vals->count-1] = val;
return vals;
vals->vals = realloc(vals->vals, ++vals->count * sizeof(val));
vals->vals[vals->count-1] = val;
return vals;
@@
-1132,6
+1131,11
@@
static inline set_values *add_set_value(set_values *vals, set_value *val) {
static inline void free_set_values(set_values *vals) {
if (vals->vals) {
static inline void free_set_values(set_values *vals) {
if (vals->vals) {
+ size_t i;
+
+ for (i = 0; i < vals->count; ++i) {
+ free_set_value(vals->vals[i]);
+ }
free(vals->vals);
}
free(vals);
free(vals->vals);
}
free(vals);