flush
[m6w6/ext-psi] / src / engine.c
index c3e95c524690b800758ab5f39e85ed2c9101fb76..a86cd0b62460e598d782912cb59dd6368fcbd99d 100644 (file)
@@ -28,7 +28,10 @@ size_t psi_t_alignment(token_t t)
        case PSI_T_DOUBLE:
                return ALIGNOF_DOUBLE;
        case PSI_T_POINTER:
+       case PSI_T_FUNCTION:
                return ALIGNOF_VOID_P;
+       case PSI_T_ENUM:
+               return ALIGNOF_INT;
        EMPTY_SWITCH_DEFAULT_CASE();
        }
        return 0;
@@ -51,27 +54,15 @@ size_t psi_t_size(token_t t)
        case PSI_T_DOUBLE:
                return SIZEOF_DOUBLE;
        case PSI_T_POINTER:
+       case PSI_T_FUNCTION:
                return SIZEOF_VOID_P;
+       case PSI_T_ENUM:
+               return SIZEOF_INT;
        EMPTY_SWITCH_DEFAULT_CASE();
        }
        return 0;
 }
 
-size_t psi_t_align(token_t t, size_t s)
-{
-       size_t a = psi_t_alignment(t);
-       return ((s - 1) | (a - 1)) + 1;
-}
-
-size_t psi_offset_padding(size_t diff, size_t alignment)
-{
-       if (diff && diff <= ((diff - 1) | (alignment -1)) + 1) {
-               diff = 0;
-       }
-
-       return diff;
-}
-
 int psi_internal_type(impl_type *type)
 {
        switch (type->type) {
@@ -202,6 +193,8 @@ static inline ZEND_RESULT_CODE psi_parse_args(zend_execute_data *execute_data, i
                        Z_PARAM_PROLOGUE(0);
                } else if (PSI_T_MIXED == iarg->type->type) {
                        Z_PARAM_PROLOGUE(0);
+               } else if (PSI_T_CALLABLE == iarg->type->type) {
+                       Z_PARAM_FUNC_EX(iarg->val.zend.cb.fci, iarg->val.zend.cb.fcc, 1, 0);
                } else {
                        error_code = ZPP_ERROR_FAILURE;
                        break;
@@ -332,6 +325,11 @@ static inline impl_val *psi_let_val(token_t let_func, impl_arg *iarg, impl_val *
                        arg_val->ptr = obj->data;
                }
                break;
+       case PSI_T_CBVAL:
+               if (iarg->type->type == PSI_T_CALLABLE) {
+                       
+               }
+               break;
        EMPTY_SWITCH_DEFAULT_CASE();
        }
        return arg_val;