4 * Copyright 2002 Ove Kaaven
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
39 static int indentation = 0;
41 static void indent(FILE *h, int delta)
44 if (delta < 0) indentation += delta;
45 for (c=0; c<indentation; c++) fprintf(h, " ");
46 if (delta > 0) indentation += delta;
49 int is_attr(const attr_list_t *list, enum attr_type t)
52 if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
53 if (attr->type == t) return 1;
57 void *get_attrp(const attr_list_t *list, enum attr_type t)
60 if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
61 if (attr->type == t) return attr->u.pval;
65 unsigned long get_attrv(const attr_list_t *list, enum attr_type t)
68 if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
69 if (attr->type == t) return attr->u.ival;
73 int is_void(const type_t *t, const var_t *v)
75 if (v && v->ptr_level) return 0;
76 if (!t->type && !t->ref) return 1;
80 void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid)
83 fprintf(f, "DEFINE_GUID(%s_%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
84 "0x%02x,0x%02x,0x%02x,0x%02x,0x%02x);\n",
85 guid_prefix, name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0],
86 uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5],
87 uuid->Data4[6], uuid->Data4[7]);
90 static void write_pident(FILE *h, const var_t *v)
93 for (c=0; c<v->ptr_level; c++) {
96 if (v->name) fprintf(h, "%s", v->name);
99 void write_name(FILE *h, const var_t *v)
101 if (is_attr( v->attrs, ATTR_PROPGET ))
103 else if (is_attr( v->attrs, ATTR_PROPPUT ))
105 else if (is_attr( v->attrs, ATTR_PROPPUTREF ))
106 fprintf(h, "putref_" );
107 fprintf(h, "%s", v->name);
110 const char* get_name(const var_t *v)
115 void write_array(FILE *h, const expr_t *v, int field)
118 while (NEXT_LINK(v)) v = NEXT_LINK(v);
122 fprintf(h, "%ld", v->cval); /* statically sized array */
124 if (field) fprintf(h, "1"); /* dynamically sized array */
132 static void write_field(FILE *h, var_t *v)
137 write_type(h, v->type, NULL, v->tname);
143 /* not all C/C++ compilers support anonymous structs and unions */
144 switch (v->type->type) {
146 case RPC_FC_CVSTRUCT:
147 case RPC_FC_CPSTRUCT:
150 case RPC_FC_BOGUS_STRUCT:
151 case RPC_FC_ENCAPSULATED_UNION:
152 fprintf(h, " DUMMYSTRUCTNAME");
154 case RPC_FC_NON_ENCAPSULATED_UNION:
155 fprintf(h, " DUMMYUNIONNAME");
162 write_array(h, v->array, 1);
167 static void write_fields(FILE *h, var_t *v)
171 while (NEXT_LINK(v)) v = NEXT_LINK(v);
174 if (v == first) break;
179 static void write_enums(FILE *h, var_t *v)
182 while (NEXT_LINK(v)) v = NEXT_LINK(v);
189 write_expr(h, v->eval, 0);
199 int needs_space_after(type_t *t)
201 return t->kind == TKIND_ALIAS || ! is_ptr(t);
204 void write_type(FILE *h, type_t *t, const var_t *v, const char *n)
208 if (t->is_const) fprintf(h, "const ");
210 if (n) fprintf(h, "%s", n);
211 else if (t->kind == TKIND_ALIAS) fprintf(h, "%s", t->name);
213 if (t->sign > 0) fprintf(h, "signed ");
214 else if (t->sign < 0) fprintf(h, "unsigned ");
218 if (t->defined && !t->written && !t->ignore) {
219 if (t->name) fprintf(h, "enum %s {\n", t->name);
220 else fprintf(h, "enum {\n");
223 write_enums(h, t->fields);
227 else fprintf(h, "enum %s", t->name);
230 case RPC_FC_CVSTRUCT:
231 case RPC_FC_CPSTRUCT:
234 case RPC_FC_BOGUS_STRUCT:
235 case RPC_FC_ENCAPSULATED_UNION:
236 if (t->defined && !t->written && !t->ignore) {
237 if (t->name) fprintf(h, "struct %s {\n", t->name);
238 else fprintf(h, "struct {\n");
241 write_fields(h, t->fields);
245 else fprintf(h, "struct %s", t->name);
247 case RPC_FC_NON_ENCAPSULATED_UNION:
248 if (t->defined && !t->written && !t->ignore) {
249 if (t->name) fprintf(h, "union %s {\n", t->name);
250 else fprintf(h, "union {\n");
253 write_fields(h, t->fields);
257 else fprintf(h, "union %s", t->name);
263 if (t->ref) write_type(h, t->ref, NULL, t->name);
264 fprintf(h, "%s*", needs_space_after(t->ref) ? " " : "");
267 fprintf(h, "%s", t->name);
271 for (c=0; c<v->ptr_level; c++) {
280 struct user_type *next;
284 static struct user_type *user_type_list;
286 static int user_type_registered(const char *name)
288 struct user_type *ut;
289 for (ut = user_type_list; ut; ut = ut->next)
290 if (!strcmp(name, ut->name))
295 static void check_for_user_types(const var_t *v)
299 for (type = v->type; type; type = type->kind == TKIND_ALIAS ? type->orig : type->ref) {
300 const char *name = type->name;
301 if (type->user_types_registered) continue;
302 type->user_types_registered = 1;
303 if (is_attr(type->attrs, ATTR_WIREMARSHAL)) {
304 if (!user_type_registered(name))
306 struct user_type *ut = xmalloc(sizeof(struct user_type) + strlen(name));
307 strcpy(ut->name, name);
308 ut->next = user_type_list;
311 /* don't carry on parsing fields within this type as we are already
312 * using a wire marshaled type */
315 else if (type->fields)
317 const var_t *fields = type->fields;
318 while (NEXT_LINK(fields)) fields = NEXT_LINK(fields);
319 check_for_user_types(fields);
326 void write_user_types(void)
328 struct user_type *ut;
329 for (ut = user_type_list; ut; ut = ut->next)
331 const char *name = ut->name;
332 fprintf(header, "ULONG __RPC_USER %s_UserSize (ULONG *, ULONG, %s *);\n", name, name);
333 fprintf(header, "unsigned char * __RPC_USER %s_UserMarshal (ULONG *, unsigned char *, %s *);\n", name, name);
334 fprintf(header, "unsigned char * __RPC_USER %s_UserUnmarshal(ULONG *, unsigned char *, %s *);\n", name, name);
335 fprintf(header, "void __RPC_USER %s_UserFree (ULONG *, %s *);\n", name, name);
339 void write_typedef(type_t *type)
341 fprintf(header, "typedef ");
342 write_type(header, type->orig, NULL, NULL);
343 fprintf(header, "%s%s;\n", needs_space_after(type->orig) ? " " : "", type->name);
346 void write_expr(FILE *h, const expr_t *e, int brackets)
352 fprintf(h, "%ld", e->u.lval);
355 fprintf(h, "0x%lx", e->u.lval);
363 case EXPR_IDENTIFIER:
364 fprintf(h, "%s", e->u.sval);
368 write_expr(h, e->ref, 1);
372 write_expr(h, e->ref, 1);
376 write_expr(h, e->ref, 1);
380 write_type(h, e->u.tref->ref, NULL, e->u.tref->name);
382 write_expr(h, e->ref, 1);
385 fprintf(h, "sizeof(");
386 write_type(h, e->u.tref->ref, NULL, e->u.tref->name);
397 if (brackets) fprintf(h, "(");
398 write_expr(h, e->ref, 1);
400 case EXPR_SHL: fprintf(h, " << "); break;
401 case EXPR_SHR: fprintf(h, " >> "); break;
402 case EXPR_MUL: fprintf(h, " * "); break;
403 case EXPR_DIV: fprintf(h, " / "); break;
404 case EXPR_ADD: fprintf(h, " + "); break;
405 case EXPR_SUB: fprintf(h, " - "); break;
406 case EXPR_AND: fprintf(h, " & "); break;
407 case EXPR_OR: fprintf(h, " | "); break;
410 write_expr(h, e->u.ext, 1);
411 if (brackets) fprintf(h, ")");
414 if (brackets) fprintf(h, "(");
415 write_expr(h, e->ref, 1);
417 write_expr(h, e->u.ext, 1);
419 write_expr(h, e->ext2, 1);
420 if (brackets) fprintf(h, ")");
425 void write_constdef(const var_t *v)
427 fprintf(header, "#define %s (", get_name(v));
428 write_expr(header, v->eval, 0);
429 fprintf(header, ")\n\n");
432 void write_externdef(const var_t *v)
434 fprintf(header, "extern const ");
435 write_type(header, v->type, NULL, v->tname);
437 fprintf(header, " ");
438 write_pident(header, v);
440 fprintf(header, ";\n\n");
443 void write_library(const char *name, const attr_list_t *attr)
445 const UUID *uuid = get_attrp(attr, ATTR_UUID);
446 fprintf(header, "\n");
447 write_guid(header, "LIBID", name, uuid);
448 fprintf(header, "\n");
452 const var_t* get_explicit_handle_var(const func_t* func)
460 while (NEXT_LINK(var)) var = NEXT_LINK(var);
463 if (var->type->type == RPC_FC_BIND_PRIMITIVE)
466 var = PREV_LINK(var);
472 int has_out_arg_or_return(const func_t *func)
476 if (!is_void(func->def->type, NULL))
483 while (NEXT_LINK(var)) var = NEXT_LINK(var);
486 if (is_attr(var->attrs, ATTR_OUT))
489 var = PREV_LINK(var);
495 /********** INTERFACES **********/
497 int is_object(const attr_list_t *list)
500 if (list) LIST_FOR_EACH_ENTRY( attr, list, const attr_t, entry )
501 if (attr->type == ATTR_OBJECT || attr->type == ATTR_ODL) return 1;
505 int is_local(const attr_list_t *a)
507 return is_attr(a, ATTR_LOCAL);
510 const var_t *is_callas(const attr_list_t *a)
512 return get_attrp(a, ATTR_CALLAS);
515 static void write_method_macro(const type_t *iface, const char *name)
519 if (iface->ref) write_method_macro(iface->ref, name);
521 if (!iface->funcs) return;
523 fprintf(header, "/*** %s methods ***/\n", iface->name);
524 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
526 var_t *def = cur->def;
527 if (!is_callas(def->attrs)) {
528 var_t *arg = cur->args;
532 arg = NEXT_LINK(arg);
536 fprintf(header, "#define %s_", name);
537 write_name(header,def);
538 fprintf(header, "(p");
539 for (c=0; c<argc; c++)
540 fprintf(header, ",%c", c+'a');
541 fprintf(header, ") ");
543 fprintf(header, "(p)->lpVtbl->");
544 write_name(header, def);
545 fprintf(header, "(p");
546 for (c=0; c<argc; c++)
547 fprintf(header, ",%c", c+'a');
548 fprintf(header, ")\n");
553 void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent)
557 while (NEXT_LINK(arg))
558 arg = NEXT_LINK(arg);
566 fprintf(h, "%s* This", name);
576 else fprintf(h, ",");
578 write_type(h, arg->type, arg, arg->tname);
581 fprintf(h, " (STDMETHODCALLTYPE *");
584 write_args(h, arg->args, NULL, 0, FALSE);
589 if (needs_space_after(arg->type))
593 write_array(h, arg->array, 0);
594 arg = PREV_LINK(arg);
597 if (do_indent) indentation--;
600 static void write_cpp_method_def(const type_t *iface)
604 if (!iface->funcs) return;
606 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
608 var_t *def = cur->def;
609 if (!is_callas(def->attrs)) {
611 fprintf(header, "virtual ");
612 write_type(header, def->type, def, def->tname);
613 fprintf(header, " STDMETHODCALLTYPE ");
614 write_name(header, def);
615 fprintf(header, "(\n");
616 write_args(header, cur->args, iface->name, 2, TRUE);
617 fprintf(header, ") = 0;\n");
618 fprintf(header, "\n");
623 static void do_write_c_method_def(const type_t *iface, const char *name)
627 if (iface->ref) do_write_c_method_def(iface->ref, name);
629 if (!iface->funcs) return;
631 fprintf(header, "/*** %s methods ***/\n", iface->name);
632 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
634 const var_t *def = cur->def;
635 if (!is_callas(def->attrs)) {
637 write_type(header, def->type, def, def->tname);
638 fprintf(header, " (STDMETHODCALLTYPE *");
639 write_name(header, def);
640 fprintf(header, ")(\n");
641 write_args(header, cur->args, name, 1, TRUE);
642 fprintf(header, ");\n");
643 fprintf(header, "\n");
648 static void write_c_method_def(const type_t *iface)
650 do_write_c_method_def(iface, iface->name);
653 static void write_c_disp_method_def(const type_t *iface)
655 do_write_c_method_def(iface->ref, iface->name);
658 static void write_method_proto(const type_t *iface)
662 if (!iface->funcs) return;
663 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
665 const var_t *def = cur->def;
666 const var_t *cas = is_callas(def->attrs);
668 if (!is_local(def->attrs)) {
669 /* proxy prototype */
670 write_type(header, def->type, def, def->tname);
671 fprintf(header, " CALLBACK %s_", iface->name);
672 write_name(header, def);
673 fprintf(header, "_Proxy(\n");
674 write_args(header, cur->args, iface->name, 1, TRUE);
675 fprintf(header, ");\n");
677 fprintf(header, "void __RPC_STUB %s_", iface->name);
678 write_name(header,def);
679 fprintf(header, "_Stub(\n");
680 fprintf(header, " IRpcStubBuffer* This,\n");
681 fprintf(header, " IRpcChannelBuffer* pRpcChannelBuffer,\n");
682 fprintf(header, " PRPC_MESSAGE pRpcMessage,\n");
683 fprintf(header, " DWORD* pdwStubPhase);\n");
687 while (NEXT_LINK(args))
688 args = NEXT_LINK(args);
690 check_for_user_types(args);
694 LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
695 if (!strcmp(get_name(m->def), cas->name)) break;
696 if (&m->entry != iface->funcs) {
697 const var_t *mdef = m->def;
698 /* proxy prototype - use local prototype */
699 write_type(header, mdef->type, mdef, mdef->tname);
700 fprintf(header, " CALLBACK %s_", iface->name);
701 write_name(header, mdef);
702 fprintf(header, "_Proxy(\n");
703 write_args(header, m->args, iface->name, 1, TRUE);
704 fprintf(header, ");\n");
705 /* stub prototype - use remotable prototype */
706 write_type(header, def->type, def, def->tname);
707 fprintf(header, " __RPC_STUB %s_", iface->name);
708 write_name(header, mdef);
709 fprintf(header, "_Stub(\n");
710 write_args(header, cur->args, iface->name, 1, TRUE);
711 fprintf(header, ");\n");
714 parser_warning("invalid call_as attribute (%s -> %s)\n", get_name(def), cas->name);
720 static void write_function_proto(const type_t *iface)
722 const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
723 int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
724 const var_t* explicit_handle_var;
727 if (!iface->funcs) return;
728 LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry )
730 var_t *def = cur->def;
732 /* check for a defined binding handle */
733 explicit_handle_var = get_explicit_handle_var(cur);
734 if (explicit_handle) {
735 if (!explicit_handle_var) {
736 error("%s() does not define an explicit binding handle!\n", def->name);
739 } else if (implicit_handle) {
740 if (explicit_handle_var) {
741 error("%s() must not define a binding handle!\n", def->name);
746 /* FIXME: do we need to handle call_as? */
747 write_type(header, def->type, def, def->tname);
748 fprintf(header, " ");
749 write_name(header, def);
750 fprintf(header, "(\n");
752 write_args(header, cur->args, iface->name, 0, TRUE);
754 fprintf(header, " void");
755 fprintf(header, ");\n");
759 void write_forward(type_t *iface)
761 /* C/C++ forwards should only be written for object interfaces, so if we
762 * have a full definition we only write one if we find [object] among the
763 * attributes - however, if we don't have a full definition at this point
764 * (i.e. this is an IDL forward), then we also assume that it is an object
765 * interface, since non-object interfaces shouldn't need forwards */
766 if ((!iface->defined || is_object(iface->attrs) || is_attr(iface->attrs, ATTR_DISPINTERFACE))
767 && !iface->written) {
768 fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", iface->name);
769 fprintf(header, "#define __%s_FWD_DEFINED__\n", iface->name);
770 fprintf(header, "typedef interface %s %s;\n", iface->name, iface->name);
771 fprintf(header, "#endif\n\n" );
772 iface->written = TRUE;
776 static void write_iface_guid(const type_t *iface)
778 const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
779 write_guid(header, "IID", iface->name, uuid);
782 static void write_dispiface_guid(const type_t *iface)
784 const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
785 write_guid(header, "DIID", iface->name, uuid);
788 static void write_coclass_guid(type_t *cocl)
790 const UUID *uuid = get_attrp(cocl->attrs, ATTR_UUID);
791 write_guid(header, "CLSID", cocl->name, uuid);
794 static void write_com_interface(type_t *iface)
796 if (!iface->funcs && !iface->ref) {
797 parser_warning("%s has no methods", iface->name);
801 fprintf(header, "/*****************************************************************************\n");
802 fprintf(header, " * %s interface\n", iface->name);
803 fprintf(header, " */\n");
804 fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
805 fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
806 write_iface_guid(iface);
807 write_forward(iface);
809 fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n");
812 fprintf(header, "interface %s : public %s\n", iface->name, iface->ref->name);
813 fprintf(header, "{\n");
815 write_cpp_method_def(iface);
817 fprintf(header, "};\n");
821 fprintf(header, "interface %s\n", iface->name);
822 fprintf(header, "{\n");
823 fprintf(header, " BEGIN_INTERFACE\n");
824 fprintf(header, "\n");
826 write_cpp_method_def(iface);
828 fprintf(header, " END_INTERFACE\n");
829 fprintf(header, "};\n");
831 fprintf(header, "#else\n");
833 fprintf(header, "typedef struct %sVtbl {\n", iface->name);
835 fprintf(header, " BEGIN_INTERFACE\n");
836 fprintf(header, "\n");
837 write_c_method_def(iface);
839 fprintf(header, " END_INTERFACE\n");
840 fprintf(header, "} %sVtbl;\n", iface->name);
841 fprintf(header, "interface %s {\n", iface->name);
842 fprintf(header, " CONST_VTBL %sVtbl* lpVtbl;\n", iface->name);
843 fprintf(header, "};\n");
844 fprintf(header, "\n");
845 fprintf(header, "#ifdef COBJMACROS\n");
846 write_method_macro(iface, iface->name);
847 fprintf(header, "#endif\n");
848 fprintf(header, "\n");
849 fprintf(header, "#endif\n");
850 fprintf(header, "\n");
851 write_method_proto(iface);
852 fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
855 static void write_rpc_interface(const type_t *iface)
857 unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
858 const char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
859 static int allocate_written = 0;
861 if (!allocate_written)
863 allocate_written = 1;
864 fprintf(header, "void * __RPC_USER MIDL_user_allocate(size_t);\n");
865 fprintf(header, "void __RPC_USER MIDL_user_free(void *);\n\n");
868 fprintf(header, "/*****************************************************************************\n");
869 fprintf(header, " * %s interface (v%d.%d)\n", iface->name, LOWORD(ver), HIWORD(ver));
870 fprintf(header, " */\n");
871 fprintf(header,"#ifndef __%s_INTERFACE_DEFINED__\n", iface->name);
872 fprintf(header,"#define __%s_INTERFACE_DEFINED__\n\n", iface->name);
875 write_iface_guid(iface);
876 if (var) fprintf(header, "extern handle_t %s;\n", var);
879 fprintf(header, "extern RPC_IF_HANDLE %s_ClientIfHandle;\n", iface->name);
880 fprintf(header, "extern RPC_IF_HANDLE %s_ServerIfHandle;\n", iface->name);
884 fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_c_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver));
885 fprintf(header, "extern RPC_IF_HANDLE %s_v%d_%d_s_ifspec;\n", iface->name, LOWORD(ver), HIWORD(ver));
887 write_function_proto(iface);
889 fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
891 /* FIXME: server/client code */
894 void write_interface(type_t *iface)
896 if (is_object(iface->attrs))
897 write_com_interface(iface);
899 write_rpc_interface(iface);
902 void write_dispinterface(type_t *iface)
904 fprintf(header, "/*****************************************************************************\n");
905 fprintf(header, " * %s dispinterface\n", iface->name);
906 fprintf(header, " */\n");
907 fprintf(header,"#ifndef __%s_DISPINTERFACE_DEFINED__\n", iface->name);
908 fprintf(header,"#define __%s_DISPINTERFACE_DEFINED__\n\n", iface->name);
909 write_dispiface_guid(iface);
910 write_forward(iface);
912 fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n");
913 fprintf(header, "interface %s : public %s\n", iface->name, iface->ref->name);
914 fprintf(header, "{\n");
915 fprintf(header, "};\n");
916 fprintf(header, "#else\n");
918 fprintf(header, "typedef struct %sVtbl {\n", iface->name);
920 fprintf(header, " BEGIN_INTERFACE\n");
921 fprintf(header, "\n");
922 write_c_disp_method_def(iface);
924 fprintf(header, " END_INTERFACE\n");
925 fprintf(header, "} %sVtbl;\n", iface->name);
926 fprintf(header, "interface %s {\n", iface->name);
927 fprintf(header, " CONST_VTBL %sVtbl* lpVtbl;\n", iface->name);
928 fprintf(header, "};\n");
929 fprintf(header, "\n");
930 fprintf(header, "#ifdef COBJMACROS\n");
931 write_method_macro(iface->ref, iface->name);
932 fprintf(header, "#endif\n");
933 fprintf(header, "\n");
934 fprintf(header, "#endif\n");
935 fprintf(header, "\n");
936 fprintf(header,"#endif /* __%s_DISPINTERFACE_DEFINED__ */\n\n", iface->name);
939 void write_coclass(type_t *cocl)
941 fprintf(header, "/*****************************************************************************\n");
942 fprintf(header, " * %s coclass\n", cocl->name);
943 fprintf(header, " */\n\n");
944 write_coclass_guid(cocl);
945 fprintf(header, "\n");
948 void write_coclass_forward(type_t *cocl)
950 fprintf(header, "#ifndef __%s_FWD_DEFINED__\n", cocl->name);
951 fprintf(header, "#define __%s_FWD_DEFINED__\n", cocl->name);
952 fprintf(header, "typedef struct %s %s;\n", cocl->name, cocl->name);
953 fprintf(header, "#endif /* defined __%s_FWD_DEFINED__ */\n\n", cocl->name );