#include "php_psi_stdinc.h"
#include "data.h"
#include "call.h"
+#include "calc.h"
#include <assert.h>
case PSI_LET_TMP:
{
- struct psi_let_stmt *let_temp = psi_impl_get_let(frame->impl,
- val->data.var);
+ struct psi_impl *impl = psi_call_frame_get_impl(frame);
+ struct psi_let_stmt *let_temp = psi_impl_get_let(impl, val->data.var);
struct psi_call_frame_symbol *temp_arg;
temp_arg = psi_call_frame_fetch_symbol(frame, let_temp->exp->var);
case PSI_LET_CALLOC:
{
- zend_long n = psi_long_num_exp(val->data.alloc->nmemb, frame);
- zend_long s = psi_long_num_exp(val->data.alloc->size, frame);
- void *tmp = *psi_call_frame_push_auto(frame,
- safe_emalloc(n, s, sizeof(void *)));
+ zend_long n = psi_long_num_exp(val->data.alloc->nmemb, frame, NULL);
+ zend_long s = psi_long_num_exp(val->data.alloc->size, frame, NULL);
+ void *tmp;
+
+ if (val->data.alloc->static_memory) {
+ tmp = safe_pemalloc(n, s, sizeof(void *), 1);
+ } else {
+ tmp = *psi_call_frame_push_auto(frame, safe_emalloc(n, s, sizeof(void *)));
+ }
memset(tmp, 0, n * s + sizeof(void *));
frame_sym->temp_val.ptr = tmp;
break;
case PSI_LET_NUMEXP:
- frame_sym->temp_val.zend.lval = psi_long_num_exp(val->data.num, frame);
+ {
+ impl_val res;
+ token_t val_type = psi_decl_type_get_real(val->var->arg->type)->type;
+ token_t res_type = psi_num_exp_exec(val->data.num, &res, frame, NULL);
+
+ if (val_type == res_type) {
+ frame_sym->temp_val = res;
+ } else {
+ psi_calc_cast(res_type, &res, val_type, &frame_sym->temp_val);
+ }
+ }
break;
case PSI_LET_CALLBACK: