/* <array> dictstack <subarray> */ static int zdictstack(i_ctx_t *i_ctx_p) { os_ptr op = osp; uint count = ref_stack_count(&d_stack); if (!level2_enabled) count--; /* see dstack.h */ if (!r_is_array(op)) return_op_typecheck(op); if (r_size(op) < count) return_error(e_rangecheck); if (!r_has_type_attrs(op, t_array, a_write)) return_error(e_invalidaccess); return ref_stack_store(&d_stack, op, count, 0, 0, true, idmemory, "dictstack"); }
/* <obj_0> ... <obj_n-1> <array> astore <array> */ static int zastore(i_ctx_t *i_ctx_p) { os_ptr op = osp; uint size; int code; if (!r_is_array(op)) return_op_typecheck(op); size = r_size(op); /* Amazingly, the following is valid: 0 array noaccess astore */ if (size == 0) return 0; if (!r_has_type_attrs(op, t_array, a_write)) return_error(gs_error_invalidaccess); if (size > op - osbot) { /* The store operation might involve other stack segments. */ ref arr; if (size >= ref_stack_count(&o_stack)) return_error(gs_error_stackunderflow); arr = *op; code = ref_stack_store(&o_stack, &arr, size, 1, 0, true, idmemory, "astore"); if (code < 0) return code; ref_stack_pop(&o_stack, size); *ref_stack_index(&o_stack, 0) = arr; } else { code = refcpy_to_old(op, 0, op - size, size, idmemory, "astore"); if (code < 0) return code; op[-(int)size] = *op; pop(size); } return 0; }