WIDL: write uuid of library in header

Jacek Caban jack at itma.pwr.wroc.pl
Fri Mar 4 14:34:29 CST 2005


My last patch didn't check if we have to write header file
before writing guid. Use this one insted.

Changelog:
    Write uuid of library in header


-------------- next part --------------
Index: tools/widl/header.c
===================================================================
RCS file: /home/wine/wine/tools/widl/header.c,v
retrieving revision 1.33
diff -u -p -r1.33 header.c
--- tools/widl/header.c	23 Feb 2005 20:31:07 -0000	1.33
+++ tools/widl/header.c	4 Mar 2005 19:15:17 -0000
@@ -80,6 +80,16 @@ int is_void(type_t *t, var_t *v)
   return 0;
 }
 
+void write_guid(const char *guid_prefix, const char *name, UUID *uuid)
+{
+  if (!uuid) return;
+  fprintf(header, "DEFINE_GUID(%s_%s, 0x%08lx, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
+        "0x%02x,0x%02x,0x%02x,0x%02x,0x%02x);\n",
+        guid_prefix, name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0],
+        uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5],
+        uuid->Data4[6], uuid->Data4[7]);
+}
+
 static void write_pident(FILE *h, var_t *v)
 {
   int c;
@@ -428,6 +438,13 @@ void write_externdef(var_t *v)
   fprintf(header, ";\n\n");
 }
 
+void write_library(char *name, attr_t *attr) {
+  UUID *uuid = get_attrp(attr, ATTR_UUID);
+  fprintf(header, "\n");
+  write_guid("LIBID", name, uuid);
+  fprintf(header, "\n");
+}
+
 /********** INTERFACES **********/
 
 int is_object(attr_t *a)
@@ -694,14 +711,6 @@ void write_forward(type_t *iface)
     fprintf(header, "#endif\n\n" );
     iface->written = TRUE;
   }
-}
-
-void write_guid(const char *guid_prefix, const char *name, UUID *uuid)
-{
-  if (!uuid) return;
-  fprintf(header, "DEFINE_GUID(%s_%s, 0x%08lx, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x);\n",
-          guid_prefix, name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1],
-          uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7]);
 }
 
 void write_iface_guid(type_t *iface)
Index: tools/widl/header.h
===================================================================
RCS file: /home/wine/wine/tools/widl/header.h,v
retrieving revision 1.7
diff -u -p -r1.7 header.h
--- tools/widl/header.h	11 Oct 2004 19:54:37 -0000	1.7
+++ tools/widl/header.h	4 Mar 2005 19:15:17 -0000
@@ -40,5 +40,6 @@ extern void write_typedef(type_t *type, 
 extern void write_expr(FILE *h, expr_t *e);
 extern void write_constdef(var_t *v);
 extern void write_externdef(var_t *v);
+extern void write_library(char *name, attr_t *attr);
 
 #endif
Index: tools/widl/parser.y
===================================================================
RCS file: /home/wine/wine/tools/widl/parser.y,v
retrieving revision 1.42
diff -u -p -r1.42 parser.y
--- tools/widl/parser.y	23 Feb 2005 21:03:15 -0000	1.42
+++ tools/widl/parser.y	4 Mar 2005 19:15:18 -0000
@@ -270,7 +270,8 @@ import:   import_start imp_statements aE
 
 libraryhdr: tLIBRARY aIDENTIFIER		{ $$ = $2; }
 	;
-library_start: attributes libraryhdr '{'	{ start_typelib($2, $1); }
+library_start: attributes libraryhdr '{'	{ start_typelib($2, $1);
+						  if (!parse_only && do_header) write_library($2, $1); }
 	;
 librarydef: library_start imp_statements '}'	{ end_typelib(); }
 	;



More information about the wine-patches mailing list