X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fmarshal.c;h=e7ffc67f335304d00d7a13f79f3fb18e78dee6c4;hp=c771e79f246f4c401cf5d8c3e5de2e07e8cbf89f;hb=c101a4de2983791d5892e60d765b73b6b3ccf6f8;hpb=ddeb4918bce67ed63c5f4c8c4e250e92ebdef89d diff --git a/src/marshal.c b/src/marshal.c index c771e79..e7ffc67 100644 --- a/src/marshal.c +++ b/src/marshal.c @@ -99,7 +99,12 @@ 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; @@ -108,7 +113,12 @@ zend_internal_arg_info *psi_internal_arginfo(struct psi_impl *impl) 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; } @@ -119,7 +129,12 @@ 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; } @@ -383,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(); } @@ -444,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, @@ -513,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) {