- ZEND_ASSERT(ops->call != NULL);
- ZEND_ASSERT(ops->compile != NULL);
-
- /* build up predefs in a temporary PSI_Data for validation */
- memset(&T, 0, sizeof(T));
- T.error = error;
-
- for (predef_type = &psi_predef_types[0]; predef_type->type_tag; ++predef_type) {
- decl_type *type = init_decl_type(predef_type->type_tag, predef_type->type_name);
- decl_typedef *def = init_decl_typedef(predef_type->alias, type);
-
- T.defs = add_decl_typedef(T.defs, def);
- }
- for (predef_const = &psi_predef_consts[0]; predef_const->type_tag; ++predef_const) {
- impl_def_val *val = init_impl_def_val(predef_const->val_type_tag, predef_const->val_text);
- const_type *type = init_const_type(predef_const->type_tag, predef_const->type_name);
- constant *constant = init_constant(type, predef_const->var_name, val);
-
- T.consts = add_constant(T.consts, constant);
- }
- for (predef_struct = &psi_predef_structs[0]; predef_struct->type_tag; ++predef_struct) {
- struct psi_predef_struct *member;
- decl_args *dargs = init_decl_args(NULL);
- decl_struct *dstruct = init_decl_struct(predef_struct->var_name, dargs);
-
- dstruct->size = predef_struct->size;
- for (member = &predef_struct[1]; member->type_tag; ++member) {
- decl_type *type;
- decl_var *dvar;
- decl_arg *darg;
-
- type = init_decl_type(member->type_tag, member->type_name);
- dvar = init_decl_var(member->var_name, member->pointer_level, member->array_size);
- darg = init_decl_arg(type, dvar);
- darg->layout = init_decl_struct_layout(member->offset, member->size);
- dargs = add_decl_arg(dargs, darg);
- }
-
- T.structs = add_decl_struct(T.structs, dstruct);
- predef_struct = member;
- }
- for (predef_decl = &psi_predef_decls[0]; predef_decl->type_tag; ++predef_decl) {
- struct psi_predef_decl *farg;
- decl_type *ftype = init_decl_type(predef_decl->type_tag, predef_decl->type_name);
- decl_var *fname = init_decl_var(predef_decl->var_name, predef_decl->pointer_level, predef_decl->array_size);
- decl_arg *func = init_decl_arg(ftype, fname);
- decl_args *args = init_decl_args(NULL);
- decl *decl = init_decl(init_decl_abi("default"), func, args);
-
- for (farg = &predef_decl[1]; farg->type_tag; ++farg) {
- decl_type *arg_type = init_decl_type(farg->type_tag, farg->type_name);
- decl_var *arg_var = init_decl_var(farg->var_name, farg->pointer_level, farg->array_size);
- decl_arg *darg = init_decl_arg(arg_type, arg_var);
- args = add_decl_arg(args, darg);
- }
-
- T.decls = add_decl(T.decls, decl);
- predef_decl = farg;
- }
-
- for (predef_decl = &psi_predef_vararg_decls[0]; predef_decl->type_tag; ++predef_decl) {
- struct psi_predef_decl *farg;
- decl_type *ftype = init_decl_type(predef_decl->type_tag, predef_decl->type_name);
- decl_var *fname = init_decl_var(predef_decl->var_name, predef_decl->pointer_level, predef_decl->array_size);
- decl_arg *func = init_decl_arg(ftype, fname);
- decl_args *args = init_decl_args(NULL);
- decl *decl = init_decl(init_decl_abi("default"), func, args);
-
- for (farg = &predef_decl[1]; farg->type_tag; ++farg) {
- decl_type *arg_type = init_decl_type(farg->type_tag, farg->type_name);
- decl_var *arg_var = init_decl_var(farg->var_name, farg->pointer_level, farg->array_size);
- decl_arg *darg = init_decl_arg(arg_type, arg_var);
- args = add_decl_arg(args, darg);
- }
- args->varargs = 1;
-
- T.decls = add_decl(T.decls, decl);
- predef_decl = farg;
- }
-
- PSI_ContextValidatePredef(C, &T);
-
- C->count = 1;
- C->data = malloc(sizeof(*C->data));
- PSI_DataExchange(C->data, &T);