Commit 63522122 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

Add support for the help* attributes on type libraries.

parent 5d303100
......@@ -226,7 +226,11 @@ static struct keyword {
{"handle", tHANDLE},
{"handle_t", tHANDLET},
/* ... */
{"helpcontext", tHELPCONTEXT},
{"helpfile", tHELPFILE},
{"helpstring", tHELPSTRING},
{"helpstringcontext", tHELPSTRINGCONTEXT},
{"helpstringdll", tHELPSTRINGDLL},
/* ... */
{"hidden", tHIDDEN},
{"hyper", tHYPER},
......
......@@ -142,7 +142,8 @@ static type_t std_uhyper = { "MIDL_uhyper" };
%token tFLOAT
%token tHANDLE
%token tHANDLET
%token tHELPSTRING
%token tHELPCONTEXT tHELPFILE
%token tHELPSTRING tHELPSTRINGCONTEXT tHELPSTRINGDLL
%token tHIDDEN
%token tHYPER tID tIDEMPOTENT
%token tIIDIS
......@@ -358,7 +359,11 @@ attribute:
| tENTRY '(' aSTRING ')' { $$ = make_attrp(ATTR_ENTRY_STRING, $3); }
| tENTRY '(' expr_const ')' { $$ = make_attrp(ATTR_ENTRY_ORDINAL, $3); }
| tHANDLE { $$ = make_attr(ATTR_HANDLE); }
| tHELPCONTEXT '(' expr_const ')' { $$ = make_attrp(ATTR_HELPCONTEXT, $3); }
| tHELPFILE '(' aSTRING ')' { $$ = make_attrp(ATTR_HELPFILE, $3); }
| tHELPSTRING '(' aSTRING ')' { $$ = make_attrp(ATTR_HELPSTRING, $3); }
| tHELPSTRINGCONTEXT '(' expr_const ')' { $$ = make_attrp(ATTR_HELPSTRINGCONTEXT, $3); }
| tHELPSTRINGDLL '(' aSTRING ')' { $$ = make_attrp(ATTR_HELPSTRINGDLL, $3); }
| tHIDDEN { $$ = make_attr(ATTR_HIDDEN); }
| tID '(' expr_const ')' { $$ = make_attrp(ATTR_ID, $3); }
| tIDEMPOTENT { $$ = make_attr(ATTR_IDEMPOTENT); }
......
......@@ -70,7 +70,11 @@ enum attr_type
ATTR_ENTRY_STRING,
ATTR_ENTRY_ORDINAL,
ATTR_HANDLE,
ATTR_HELPCONTEXT,
ATTR_HELPFILE,
ATTR_HELPSTRING,
ATTR_HELPSTRINGCONTEXT,
ATTR_HELPSTRINGDLL,
ATTR_HIDDEN,
ATTR_ID,
ATTR_IDEMPOTENT,
......
......@@ -91,6 +91,8 @@ typedef struct _msft_typelib_t
INT *typelib_namehash_segment;
INT *typelib_guidhash_segment;
INT help_string_dll_offset;
struct _msft_typeinfo_t *typeinfos;
struct _msft_typeinfo_t *last_typeinfo;
} msft_typelib_t;
......@@ -1460,10 +1462,54 @@ static void set_doc_string(msft_typelib_t *typelib)
static void set_help_file_name(msft_typelib_t *typelib)
{
int offset;
offset = ctl2_alloc_string(typelib, "help file name");
if (offset == -1) return;
typelib->typelib_header.helpfile = offset;
typelib->typelib_header.varflags |= 0x10;
attr_t *attr;
for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) {
if(attr->type == ATTR_HELPFILE) {
offset = ctl2_alloc_string(typelib, attr->u.pval);
if (offset == -1) return;
typelib->typelib_header.helpfile = offset;
typelib->typelib_header.varflags |= 0x10;
}
}
return;
}
static void set_help_context(msft_typelib_t *typelib)
{
attr_t *attr;
for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) {
if(attr->type == ATTR_HELPCONTEXT) {
expr_t *expr = (expr_t *)attr->u.pval;
typelib->typelib_header.helpcontext = expr->cval;
}
}
return;
}
static void set_help_string_dll(msft_typelib_t *typelib)
{
int offset;
attr_t *attr;
for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) {
if(attr->type == ATTR_HELPSTRINGDLL) {
offset = ctl2_alloc_string(typelib, attr->u.pval);
if (offset == -1) return;
typelib->help_string_dll_offset = offset;
typelib->typelib_header.varflags |= 0x100;
}
}
return;
}
static void set_help_string_context(msft_typelib_t *typelib)
{
attr_t *attr;
for(attr = typelib->typelib->attrs; attr; attr = NEXT_LINK(attr)) {
if(attr->type == ATTR_HELPSTRINGCONTEXT) {
expr_t *expr = (expr_t *)attr->u.pval;
typelib->typelib_header.helpstringcontext = expr->cval;
}
}
return;
}
......@@ -1570,6 +1616,7 @@ static int save_all_changes(msft_typelib_t *typelib)
if (fd == -1) return retval;
filepos = sizeof(MSFT_Header) + sizeof(MSFT_SegDir);
if(typelib->typelib_header.varflags & 0x100) filepos += 4; /* helpstringdll */
filepos += typelib->typelib_header.nrtypeinfos * 4;
filepos += ctl2_finalize_segment(typelib, filepos, MSFT_SEG_TYPEINFO);
......@@ -1589,6 +1636,7 @@ static int save_all_changes(msft_typelib_t *typelib)
ctl2_finalize_typeinfos(typelib, filepos);
if (!ctl2_write_chunk(fd, &typelib->typelib_header, sizeof(typelib->typelib_header))) return retval;
if (!ctl2_write_chunk(fd, &typelib->help_string_dll_offset, sizeof(typelib->help_string_dll_offset))) return retval;
if (!ctl2_write_chunk(fd, typelib->typelib_typeinfo_offsets, typelib->typelib_header.nrtypeinfos * 4)) return retval;
if (!ctl2_write_chunk(fd, &typelib->typelib_segdir, sizeof(typelib->typelib_segdir))) return retval;
if (!ctl2_write_segment(typelib, fd, MSFT_SEG_TYPEINFO )) return retval;
......@@ -1649,12 +1697,15 @@ int create_msft_typelib(typelib_t *typelib)
set_lib_flags(msft);
set_lcid(msft);
/* set_help_file_name(msft);*/
set_help_file_name(msft);
set_doc_string(msft);
set_guid(msft);
set_version(msft);
set_name(msft);
set_help_context(msft);
set_help_string_dll(msft);
set_help_string_context(msft);
typelib_idx = 0;
for(entry = typelib->entry; NEXT_LINK(entry); entry = NEXT_LINK(entry))
;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment