+ if (ops->init) {
+ ops->init(C);
+ }
+
+ 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_var *var = init_decl_var(predef_type->alias, 0, 0); /* FIXME: indirection */
+ decl_arg *def = init_decl_arg(type, var);
+
+ 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;
+ dstruct->align = predef_struct->offset;
+ 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_union = &psi_predef_unions[0]; predef_union->type_tag; ++predef_union) {
+ struct psi_predef_union *member;
+ decl_args *dargs = init_decl_args(NULL);
+ decl_union *dunion = init_decl_union(predef_union->var_name, dargs);
+
+ dunion->size = predef_union->size;
+ dunion->align = predef_union->offset;
+ for (member = &predef_union[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);
+ }