bitfield support
[m6w6/ext-psi] / src / marshal.c
index 87abf98444948801ab8e25cb405ba12927afe38c..e7ffc67f335304d00d7a13f79f3fb18e78dee6c4 100644 (file)
@@ -99,18 +99,26 @@ zend_internal_arg_info *psi_internal_arginfo(struct psi_impl *impl)
        aip = calloc(argc + 1 + !!impl->func->vararg, sizeof(*aip));
 
        fi = (zend_internal_function_info *) &aip[0];
+#ifdef ZEND_TYPE_ENCODE
+       fi->type = ZEND_TYPE_ENCODE(psi_internal_type(impl->func->return_type), 1);
+#else
        fi->allow_null = 1;
+       fi->type_hint = psi_internal_type(impl->func->return_type);
+#endif
        fi->required_num_args = psi_impl_num_min_args(impl);
        fi->return_reference = impl->func->return_reference;
-       fi->type_hint = psi_internal_type(impl->func->return_type);
 
        if (impl->func->vararg) {
                struct psi_impl_arg *vararg = impl->func->vararg;
                zend_internal_arg_info *ai = &aip[argc];
 
                ai->name = vararg->var->name;
+#ifdef ZEND_TYPE_ENCODE
+               ai->type = ZEND_TYPE_ENCODE(psi_internal_type(vararg->type), 1);
+#else
                ai->allow_null = 1;
                ai->type_hint = psi_internal_type(vararg->type);
+#endif
                if (vararg->var->reference) {
                        ai->pass_by_reference = 1;
                }
@@ -121,12 +129,15 @@ zend_internal_arg_info *psi_internal_arginfo(struct psi_impl *impl)
                zend_internal_arg_info *ai = &aip[i];
 
                ai->name = iarg->var->name;
+#ifdef ZEND_TYPE_ENCODE
+               ai->type = ZEND_TYPE_ENCODE(psi_internal_type(iarg->type), 1);
+#else
+               ai->allow_null = 1;
                ai->type_hint = psi_internal_type(iarg->type);
+#endif
                if (iarg->var->reference) {
                        ai->pass_by_reference = 1;
                }
-               /* FIXME: if (iarg->var->reference || (iarg->def && iarg->def->type == PSI_T_NULL)) */
-               ai->allow_null = 1;
        }
 
        return aip;
@@ -387,7 +398,7 @@ void psi_set_to_stringl(zval *return_value, struct psi_set_exp *set, impl_val *r
                struct psi_set_exp *sub_exp;
 
                psi_plist_get(set->inner, 0, &sub_exp);
-               RETVAL_STRINGL(str, psi_long_num_exp(sub_exp->data.num, frame));
+               RETVAL_STRINGL(str, psi_long_num_exp(sub_exp->data.num, frame, NULL));
        } else {
                RETVAL_EMPTY_STRING();
        }
@@ -404,8 +415,6 @@ impl_val *psi_let_strval(impl_val *tmp, struct psi_decl_type *spec, token_t impl
                } else {
                        tmp->ptr = "";
                }
-       } else if (0 && Z_TYPE_P(zvalue) == IS_STRING) {
-               tmp->ptr = Z_STRVAL_P(zvalue);
        } else {
                zend_string *zs = zval_get_string(zvalue);
                tmp->ptr = estrdup(zs->val);
@@ -450,12 +459,14 @@ impl_val *psi_let_strlen(impl_val *tmp, struct psi_decl_type *spec, token_t impl
        return tmp;
 }
 
+#if 0
 static impl_val *iterate(impl_val *val, size_t size, unsigned i, impl_val *tmp)
 {
        memset(tmp, 0, sizeof(*tmp));
        memcpy(tmp, ((char *) val) + size * i, size);
        return tmp;
 }
+#endif
 
 /*
  * set $ivar = to_array(dvar,
@@ -519,7 +530,7 @@ void psi_set_to_array_counted(zval *return_value, struct psi_set_exp *set, impl_
        }
 
        psi_plist_get(set->inner, 0, &sub_exp);
-       count = psi_long_num_exp(sub_exp->data.num, frame);
+       count = psi_long_num_exp(sub_exp->data.num, frame, NULL);
        psi_plist_get(set->inner, 1, &sub_exp);
 
        for (ptr = (char *) ret_val; 0 < count--; ptr += size) {