- ZEND_PARSE_PARAMETERS_START(psi_num_min_args(impl), impl->func->args->count)
- nextarg:
- iarg = impl->func->args->args[_i];
- if (iarg->def) {
- Z_PARAM_OPTIONAL;
- }
- if (PSI_T_BOOL == iarg->type->type) {
- if (iarg->def) {
- iarg->val.bval = iarg->def->type == PSI_T_TRUE ? 1 : 0;
- }
- Z_PARAM_BOOL(iarg->val.bval);
- } else if (PSI_T_INT == iarg->type->type) {
- if (iarg->def) {
- iarg->val.lval = zend_atol(iarg->def->text, strlen(iarg->def->text));
- }
- Z_PARAM_LONG(iarg->val.lval);
- } else if (PSI_T_FLOAT == iarg->type->type) {
- if (iarg->def) {
- iarg->val.dval = zend_strtod(iarg->def->text, NULL);
- }
- Z_PARAM_DOUBLE(iarg->val.dval);
- } else if (PSI_T_STRING == iarg->type->type) {
- struct {char *val; size_t len;} str;
- if (iarg->def) {
- /* FIXME */
- str.len = strlen(iarg->def->text) - 2;
- str.val = &iarg->def->text[1];
- }
- Z_PARAM_STR_EX(iarg->val.str, 1, 0);
- if (iarg->val.str) {
- zend_string_addref(iarg->val.str);
- } else if (iarg->def) {
- iarg->val.str = zend_string_init(str.val, str.len, 0);
- }
- } else if (PSI_T_ARRAY == iarg->type->type) {
- /* handled as _zv in let or set */
- Z_PARAM_PROLOGUE(0);
- } else {
- error_code = ZPP_ERROR_FAILURE;
- break;
- }
- iarg->_zv = _arg;
- if (_i < _max_num_args) {
- goto nextarg;
- }
- ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
-
- return SUCCESS;
-}
-
-impl_val *psi_do_let(decl_arg *darg)
-{
- impl_val *arg_val = &darg->let->out;
- impl_arg *iarg = darg->let->arg;
-
- if (!iarg) {
- /*
- * let foo = NULL;
- * let foo;
- */
- if (darg->var->array_size) {
- arg_val->ptr = ecalloc(darg->var->array_size, sizeof(*arg_val));
- darg->let->mem = arg_val->ptr;
- } else {
- memset(arg_val, 0, sizeof(*arg_val));
- }
- return arg_val;