From e6150fe20648e2f684a0a57f96e728b86538b176 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 5 Mar 2005 10:49:22 +0000 Subject: [PATCH] Write uuid of library in header. --- tools/widl/header.c | 25 +++++++++++++++++-------- tools/widl/header.h | 1 + tools/widl/parser.y | 3 ++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index fb00566cec9..212e42a4426 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -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) @@ -696,14 +713,6 @@ void write_forward(type_t *iface) } } -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) { UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); diff --git a/tools/widl/header.h b/tools/widl/header.h index bd69a736509..1f4141687f7 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -40,5 +40,6 @@ extern void write_typedef(type_t *type, var_t *names); 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 diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 4d4f6f1cb3e..8ca08cd7a0f 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -270,7 +270,8 @@ import: import_start imp_statements aEOF {} 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(); } ;