RETVAL_NULL();
}
+impl_val *psi_let_void(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free) {
+ return tmp;
+}
+
void psi_to_zval(zval *return_value, set_value *set, impl_val *ret_val) {
RETVAL_ZVAL(ret_val->ptr, 1, 0);
}
case PSI_T_UINT16: tmp->u16 = intval; break;
case PSI_T_INT32: tmp->i32 = intval; break;
case PSI_T_UINT32: tmp->u32 = intval; break;
- case PSI_T_INT: tmp->ival = intval; break;
case PSI_T_INT64: tmp->i64 = intval; break;
case PSI_T_UINT64: tmp->u64 = intval; break;
+ case PSI_T_INT: tmp->ival = intval; break;
+ case PSI_T_LONG: tmp->lval = intval; break;
case PSI_T_FLOAT: tmp->fval = intval; break;
case PSI_T_DOUBLE: tmp->dval = intval; break;
#ifdef HAVE_LONG_DOUBLE
impl_val *psi_let_intval(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free)
{
zend_long intval;
- token_t real_type = type ? real_decl_type(type)->type : PSI_T_INT;
+ token_t real_type = type ? real_decl_type(type)->type : PSI_T_LONG;
if (iarg->type->type == PSI_T_INT) {
intval = iarg->val.zend.lval;
val->ival = zval_get_long(zv);
break;
case PSI_T_STRUCT:
- *tmp = *ptr = psi_array_to_struct(real->strct, HASH_OF(zv));
+ *tmp = *ptr = psi_array_to_struct(real->real.strct, HASH_OF(zv));
break;
}
}
decl_type *type = real_decl_type(spec->type);
switch (type->type) {
+ case PSI_T_FUNCTION:
+ break;
case PSI_T_FLOAT:
mem->fval = (float) zval_get_double(zv);
break;
return mem;
}
+void *psi_array_to_union(decl_union *u, HashTable *arr) {
+ size_t i;
+ char *mem = ecalloc(1, u->size + sizeof(void *));
+
+ if (arr) for (i = 0; i < u->args->count; ++i) {
+ decl_arg *darg = u->args->args[i];
+ zval *entry = zend_hash_str_find_ind(arr, darg->var->name, strlen(darg->var->name));
+
+ if (entry) {
+ impl_val val;
+ void *tmp = NULL;
+
+ memset(&tmp, 0, sizeof(tmp));
+ psi_from_zval(&val, darg, entry, &tmp);
+ memcpy(mem, &val, darg->layout->len);
+ if (tmp) {
+ ((void **)(mem + u->size))[0] = tmp;
+ }
+ /* first found entry wins */
+ break;
+ }
+ }
+
+ return mem;
+}
+
void psi_to_recursive(zval *return_value, set_value *set, impl_val *r_val)
{
set->outer.set->func->handler(return_value, set, r_val);
switch (real->type) {
case PSI_T_STRUCT:
- *to_free = tmp = psi_array_to_struct(real->strct, arr);
+ *to_free = tmp = psi_array_to_struct(real->real.strct, arr);
+ break;
+ case PSI_T_UNION:
+ *to_free = tmp = psi_array_to_union(real->real.unn, arr);
break;
EMPTY_SWITCH_DEFAULT_CASE();
}