+ T.types = psi_plist_add(T.types, &def);
+ }
+ for (predef_const = &psi_predef_consts[0]; predef_const->type_tag; ++predef_const) {
+ struct psi_const_type *type = psi_const_type_init(predef_const->type_tag, predef_const->type_name);
+ struct psi_impl_def_val *val;
+ struct psi_const *constant;
+
+ switch (type->type) {
+ case PSI_T_INT:
+ val = psi_impl_def_val_init(PSI_T_INT, NULL);
+ val->ival.zend.lval = predef_const->value.lval;
+ break;
+ case PSI_T_STRING:
+ val = psi_impl_def_val_init(PSI_T_STRING, NULL);
+ val->ival.zend.str = zend_string_init(predef_const->value.ptr, strlen(predef_const->value.ptr), 1);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ constant = psi_const_init(type, predef_const->var_name, val);
+ T.consts = psi_plist_add(T.consts, &constant);
+ }
+ for (predef_composite = &psi_predef_composites[0]; predef_composite->type_tag; ++predef_composite) {
+ struct psi_predef_composite *member;
+ struct psi_decl_struct *dstruct;
+ struct psi_decl_union *dunion;
+ struct psi_plist *dargs = psi_plist_init((psi_plist_dtor) psi_decl_arg_free);
+
+ switch (predef_composite->type_tag) {
+ case PSI_T_STRUCT:
+ dstruct = psi_decl_struct_init(predef_composite->var_name, dargs);
+ dstruct->size = predef_composite->size;
+ dstruct->align = predef_composite->offset;
+ break;
+ case PSI_T_UNION:
+ dunion = psi_decl_union_init(predef_composite->var_name, dargs);
+ dunion->size = predef_composite->size;
+ dunion->align = predef_composite->offset;
+ break;
+ default:
+ assert(0);
+ }
+ for (member = &predef_composite[1]; member->type_tag; ++member) {
+ struct psi_decl_type *type;
+ struct psi_decl_var *dvar;
+ struct psi_decl_arg *darg;
+
+ type = psi_decl_type_init(member->type_tag, member->type_name);
+ dvar = psi_decl_var_init(member->var_name, member->pointer_level, member->array_size);
+ darg = psi_decl_arg_init(type, dvar);
+ darg->layout = psi_layout_init(member->offset, member->size, NULL);
+
+ switch (predef_composite->type_tag) {
+ case PSI_T_STRUCT:
+ dstruct->args = psi_plist_add(dstruct->args, &darg);
+ break;
+ case PSI_T_UNION:
+ dunion->args = psi_plist_add(dunion->args, &darg);