Line 1... |
Line 1... |
/* resrc.c -- read and write Windows rc files.
|
/* resrc.c -- read and write Windows rc files.
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2011
|
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
Written by Ian Lance Taylor, Cygnus Support.
|
Written by Ian Lance Taylor, Cygnus Support.
|
Rewritten by Kai Tietz, Onevision.
|
Rewritten by Kai Tietz, Onevision.
|
|
|
This file is part of GNU Binutils.
|
This file is part of GNU Binutils.
|
Line 1589... |
Line 1589... |
/* Define a stringtable resource. This is called for each string
|
/* Define a stringtable resource. This is called for each string
|
which appears in a STRINGTABLE statement. */
|
which appears in a STRINGTABLE statement. */
|
|
|
void
|
void
|
define_stringtable (const rc_res_res_info *resinfo,
|
define_stringtable (const rc_res_res_info *resinfo,
|
rc_uint_type stringid, const unichar *string)
|
rc_uint_type stringid, const unichar *string, int len)
|
{
|
{
|
|
unichar *h;
|
rc_res_id id;
|
rc_res_id id;
|
rc_res_resource *r;
|
rc_res_resource *r;
|
|
|
id.named = 0;
|
id.named = 0;
|
id.u.id = (stringid >> 4) + 1;
|
id.u.id = (stringid >> 4) + 1;
|
Line 1614... |
Line 1615... |
r->u.stringtable->strings[i].string = NULL;
|
r->u.stringtable->strings[i].string = NULL;
|
}
|
}
|
|
|
r->res_info = *resinfo;
|
r->res_info = *resinfo;
|
}
|
}
|
|
h = (unichar *) res_alloc ((len + 1) * sizeof (unichar));
|
r->u.stringtable->strings[stringid & 0xf].length = unichar_len (string);
|
if (len)
|
r->u.stringtable->strings[stringid & 0xf].string = unichar_dup (string);
|
memcpy (h, string, len * sizeof (unichar));
|
|
h[len] = 0;
|
|
r->u.stringtable->strings[stringid & 0xf].length = (rc_uint_type) len;
|
|
r->u.stringtable->strings[stringid & 0xf].string = h;
|
}
|
}
|
|
|
void
|
void
|
define_toolbar (rc_res_id id, rc_res_res_info *resinfo, rc_uint_type width, rc_uint_type height,
|
define_toolbar (rc_res_id id, rc_res_res_info *resinfo, rc_uint_type width, rc_uint_type height,
|
rc_toolbar_item *items)
|
rc_toolbar_item *items)
|
Line 1801... |
Line 1805... |
}
|
}
|
|
|
/* Add string version info to a list of version information. */
|
/* Add string version info to a list of version information. */
|
|
|
rc_ver_info *
|
rc_ver_info *
|
append_ver_stringfileinfo (rc_ver_info *verinfo, const char *language,
|
append_ver_stringfileinfo (rc_ver_info *verinfo,
|
rc_ver_stringinfo *strings)
|
rc_ver_stringtable *stringtables)
|
{
|
{
|
rc_ver_info *vi, **pp;
|
rc_ver_info *vi, **pp;
|
|
|
vi = (rc_ver_info *) res_alloc (sizeof (rc_ver_info));
|
vi = (rc_ver_info *) res_alloc (sizeof (rc_ver_info));
|
vi->next = NULL;
|
vi->next = NULL;
|
vi->type = VERINFO_STRING;
|
vi->type = VERINFO_STRING;
|
unicode_from_ascii ((rc_uint_type *) NULL, &vi->u.string.language, language);
|
vi->u.string.stringtables = stringtables;
|
vi->u.string.strings = strings;
|
|
|
|
for (pp = &verinfo; *pp != NULL; pp = &(*pp)->next)
|
for (pp = &verinfo; *pp != NULL; pp = &(*pp)->next)
|
;
|
;
|
*pp = vi;
|
*pp = vi;
|
|
|
return verinfo;
|
return verinfo;
|
}
|
}
|
|
|
|
rc_ver_stringtable *
|
|
append_ver_stringtable (rc_ver_stringtable *stringtable,
|
|
const char *language,
|
|
rc_ver_stringinfo *strings)
|
|
{
|
|
rc_ver_stringtable *vst, **pp;
|
|
|
|
vst = (rc_ver_stringtable *) res_alloc (sizeof (rc_ver_stringtable));
|
|
vst->next = NULL;
|
|
unicode_from_ascii ((rc_uint_type *) NULL, &vst->language, language);
|
|
vst->strings = strings;
|
|
|
|
for (pp = &stringtable; *pp != NULL; pp = &(*pp)->next)
|
|
;
|
|
*pp = vst;
|
|
|
|
return stringtable;
|
|
}
|
|
|
/* Add variable version info to a list of version information. */
|
/* Add variable version info to a list of version information. */
|
|
|
rc_ver_info *
|
rc_ver_info *
|
append_ver_varfileinfo (rc_ver_info *verinfo, const unichar *key,
|
append_ver_varfileinfo (rc_ver_info *verinfo, const unichar *key,
|
rc_ver_varinfo *var)
|
rc_ver_varinfo *var)
|
Line 3262... |
Line 3284... |
{
|
{
|
switch (vi->type)
|
switch (vi->type)
|
{
|
{
|
case VERINFO_STRING:
|
case VERINFO_STRING:
|
{
|
{
|
|
const rc_ver_stringtable *vst;
|
const rc_ver_stringinfo *vs;
|
const rc_ver_stringinfo *vs;
|
|
|
fprintf (e, " BLOCK \"StringFileInfo\"\n");
|
fprintf (e, " BLOCK \"StringFileInfo\"\n");
|
fprintf (e, " BEGIN\n");
|
fprintf (e, " BEGIN\n");
|
|
|
|
for (vst = vi->u.string.stringtables; vst != NULL; vst = vst->next)
|
|
{
|
fprintf (e, " BLOCK ");
|
fprintf (e, " BLOCK ");
|
unicode_print_quoted (e, vi->u.string.language, -1);
|
unicode_print_quoted (e, vst->language, -1);
|
|
|
fprintf (e, "\n");
|
fprintf (e, "\n");
|
fprintf (e, " BEGIN\n");
|
fprintf (e, " BEGIN\n");
|
|
|
for (vs = vi->u.string.strings; vs != NULL; vs = vs->next)
|
for (vs = vst->strings; vs != NULL; vs = vs->next)
|
{
|
{
|
fprintf (e, " VALUE ");
|
fprintf (e, " VALUE ");
|
unicode_print_quoted (e, vs->key, -1);
|
unicode_print_quoted (e, vs->key, -1);
|
fprintf (e, ", ");
|
fprintf (e, ", ");
|
unicode_print_quoted (e, vs->value, -1);
|
unicode_print_quoted (e, vs->value, -1);
|
fprintf (e, "\n");
|
fprintf (e, "\n");
|
}
|
}
|
|
|
fprintf (e, " END\n");
|
fprintf (e, " END\n");
|
|
}
|
fprintf (e, " END\n");
|
fprintf (e, " END\n");
|
break;
|
break;
|
}
|
}
|
|
|
case VERINFO_VAR:
|
case VERINFO_VAR:
|