add travis support
[m6w6/ext-psi] / src / marshal.c
index 31ff9ba8f8f6fcafbafc4ffeaa36eb10cf2296d1..ce5cc2441702c75a40bf6438bbbe85f90f0751d2 100644 (file)
@@ -13,6 +13,17 @@ void psi_to_void(zval *return_value, set_value *set, impl_val *ret_val)
        RETVAL_NULL();
 }
 
+void psi_to_zval(zval *return_value, set_value *set, impl_val *ret_val) {
+       RETVAL_ZVAL(ret_val->ptr, 1, 0);
+}
+
+impl_val *psi_let_zval(impl_val *tmp, decl_type *type, impl_arg *iarg, void **to_free)
+{
+       *to_free = tmp->ptr = emalloc(sizeof(zval));
+       ZVAL_COPY_VALUE(tmp->ptr, iarg->_zv);
+       return tmp;
+}
+
 void psi_to_bool(zval *return_value, set_value *set, impl_val *ret_val)
 {
        psi_to_int(return_value, set, ret_val);
@@ -95,9 +106,10 @@ static inline impl_val *psi_val_intval(impl_val *tmp, token_t real_type, zend_lo
        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
@@ -112,7 +124,7 @@ static inline impl_val *psi_val_intval(impl_val *tmp, token_t real_type, zend_lo
 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;
@@ -322,7 +334,7 @@ void psi_from_zval_ex(impl_val **ptr, decl_arg *spec, token_t cast, zval *zv, vo
                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;
        }
 }
@@ -489,7 +501,7 @@ impl_val *psi_let_arrval(impl_val *tmp, decl_type *type, impl_arg *iarg, void **
 
        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;
        EMPTY_SWITCH_DEFAULT_CASE();
        }
@@ -526,3 +538,4 @@ impl_val *psi_let_objval(impl_val *tmp, decl_type *type, impl_arg *iarg, void **
 
        return tmp;
 }
+