2 * Generate .res format from a resource-tree
4 * Copyright 1998 Bertho A. Stultiens
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
21 * 05-May-2000 BS - Added code to support endian conversions. The
22 * extra functions also aid unaligned access, but
23 * this is not yet implemented.
24 * 25-May-1998 BS - Added simple unicode -> char conversion for resource
25 * names in .s and .h files.
48 r
= xmalloc(sizeof(res_t
));
49 r
->allocsize
= RES_BLOCKSIZE
;
52 r
->data
= xmalloc(RES_BLOCKSIZE
);
56 res_t
*grow_res(res_t
*r
, unsigned int add
)
59 r
->data
= xrealloc(r
->data
, r
->allocsize
);
64 *****************************************************************************
68 * Syntax : void put_byte(res_t *res, unsigned c)
69 * void put_word(res_t *res, unsigned w)
70 * void put_dword(res_t *res, unsigned d)
72 * res - Binary resource to put the data in
73 * c, w, d - Data to put
75 * Description : Put primitives that put an item in the binary resource.
76 * The data array grows automatically.
78 *****************************************************************************
80 void put_byte(res_t
*res
, unsigned c
)
82 if(res
->allocsize
- res
->size
< sizeof(char))
83 grow_res(res
, RES_BLOCKSIZE
);
84 res
->data
[res
->size
] = (char)c
;
85 res
->size
+= sizeof(char);
88 void put_word(res_t
*res
, unsigned w
)
90 if(res
->allocsize
- res
->size
< sizeof(WORD
))
91 grow_res(res
, RES_BLOCKSIZE
);
94 #ifdef WORDS_BIGENDIAN
98 res
->data
[res
->size
+0] = HIBYTE(w
);
99 res
->data
[res
->size
+1] = LOBYTE(w
);
102 #ifndef WORDS_BIGENDIAN
106 res
->data
[res
->size
+1] = HIBYTE(w
);
107 res
->data
[res
->size
+0] = LOBYTE(w
);
110 res
->size
+= sizeof(WORD
);
113 void put_dword(res_t
*res
, unsigned d
)
115 if(res
->allocsize
- res
->size
< sizeof(DWORD
))
116 grow_res(res
, RES_BLOCKSIZE
);
119 #ifdef WORDS_BIGENDIAN
123 res
->data
[res
->size
+0] = HIBYTE(HIWORD(d
));
124 res
->data
[res
->size
+1] = LOBYTE(HIWORD(d
));
125 res
->data
[res
->size
+2] = HIBYTE(LOWORD(d
));
126 res
->data
[res
->size
+3] = LOBYTE(LOWORD(d
));
129 #ifndef WORDS_BIGENDIAN
133 res
->data
[res
->size
+3] = HIBYTE(HIWORD(d
));
134 res
->data
[res
->size
+2] = LOBYTE(HIWORD(d
));
135 res
->data
[res
->size
+1] = HIBYTE(LOWORD(d
));
136 res
->data
[res
->size
+0] = LOBYTE(LOWORD(d
));
139 res
->size
+= sizeof(DWORD
);
142 static void put_pad(res_t
*res
)
144 while(res
->size
& 0x3)
149 *****************************************************************************
150 * Function : set_word
152 * Syntax : void set_word(res_t *res, int ofs, unsigned w)
153 * void set_dword(res_t *res, int ofs, unsigned d)
155 * res - Binary resource to put the data in
156 * ofs - Byte offset in data-array
159 * Description : Set the value of a binary resource data array to a
162 *****************************************************************************
164 static void set_word(res_t
*res
, int ofs
, unsigned w
)
168 #ifdef WORDS_BIGENDIAN
172 res
->data
[ofs
+0] = HIBYTE(w
);
173 res
->data
[ofs
+1] = LOBYTE(w
);
176 #ifndef WORDS_BIGENDIAN
180 res
->data
[ofs
+1] = HIBYTE(w
);
181 res
->data
[ofs
+0] = LOBYTE(w
);
186 static void set_dword(res_t
*res
, int ofs
, unsigned d
)
190 #ifdef WORDS_BIGENDIAN
194 res
->data
[ofs
+0] = HIBYTE(HIWORD(d
));
195 res
->data
[ofs
+1] = LOBYTE(HIWORD(d
));
196 res
->data
[ofs
+2] = HIBYTE(LOWORD(d
));
197 res
->data
[ofs
+3] = LOBYTE(LOWORD(d
));
200 #ifndef WORDS_BIGENDIAN
204 res
->data
[ofs
+3] = HIBYTE(HIWORD(d
));
205 res
->data
[ofs
+2] = LOBYTE(HIWORD(d
));
206 res
->data
[ofs
+1] = HIBYTE(LOWORD(d
));
207 res
->data
[ofs
+0] = LOBYTE(LOWORD(d
));
213 *****************************************************************************
214 * Function : get_dword
216 * res - Binary resource to put the data in
217 * ofs - Byte offset in data-array
218 * Output : The data in native endian
219 * Description : Get the value of a binary resource data array in native
222 *****************************************************************************
224 static DWORD
get_dword(res_t
*res
, int ofs
)
228 #ifdef WORDS_BIGENDIAN
232 return (res
->data
[ofs
+0] << 24)
233 | (res
->data
[ofs
+1] << 16)
234 | (res
->data
[ofs
+2] << 8)
237 #ifndef WORDS_BIGENDIAN
241 return (res
->data
[ofs
+3] << 24)
242 | (res
->data
[ofs
+2] << 16)
243 | (res
->data
[ofs
+1] << 8)
248 static res_t
*end_res(res_t
*res
, int ofs
)
250 set_dword( res
, ofs
, res
->size
- get_dword( res
, ofs
));
251 if (win32
) put_pad( res
);
256 *****************************************************************************
257 * Function : string_to_upper
258 * Syntax : void string_to_upper(string_t *str)
262 * Remarks : FIXME: codepages...
263 *****************************************************************************
265 static void string_to_upper(string_t
*str
)
269 if(str
->type
== str_char
)
271 for (i
= 0; i
< str
->size
; i
++)
272 if (str
->str
.cstr
[i
] >= 'a' && str
->str
.cstr
[i
] <= 'z') str
->str
.cstr
[i
] -= 32;
274 else if(str
->type
== str_unicode
)
276 for (i
= 0; i
< str
->size
; i
++)
277 if (str
->str
.wstr
[i
] >= 'a' && str
->str
.wstr
[i
] <= 'z') str
->str
.wstr
[i
] -= 32;
281 internal_error(__FILE__
, __LINE__
, "Invalid string type %d\n", str
->type
);
285 static int parse_accel_string( const string_t
*key
, int flags
)
289 if(key
->type
== str_char
)
291 if (key
->str
.cstr
[0] == '#') return 0; /* ignore message contexts */
292 if((flags
& WRC_AF_VIRTKEY
) &&
293 !((key
->str
.cstr
[0] >= 'A' && key
->str
.cstr
[0] <= 'Z') ||
294 (key
->str
.cstr
[0] >= '0' && key
->str
.cstr
[0] <= '9')))
296 print_location( &key
->loc
);
297 error("VIRTKEY code is not equal to ascii value\n");
300 if(key
->str
.cstr
[0] == '^' && (flags
& WRC_AF_CONTROL
) != 0)
302 print_location( &key
->loc
);
303 error("Cannot use both '^' and CONTROL modifier\n");
305 else if(key
->str
.cstr
[0] == '^')
307 if (key
->str
.cstr
[1] >= 'a' && key
->str
.cstr
[1] <= 'z')
308 keycode
= key
->str
.cstr
[1] - 'a' + 1;
309 else if (key
->str
.cstr
[1] >= 'A' && key
->str
.cstr
[1] <= 'Z')
310 keycode
= key
->str
.cstr
[1] - 'A' + 1;
313 print_location( &key
->loc
);
314 error("Control-code out of range\n");
318 keycode
= key
->str
.cstr
[0];
322 if (key
->str
.wstr
[0] == '#') return 0; /* ignore message contexts */
323 if((flags
& WRC_AF_VIRTKEY
) &&
324 !((key
->str
.wstr
[0] >= 'A' && key
->str
.wstr
[0] <= 'Z') ||
325 (key
->str
.wstr
[0] >= '0' && key
->str
.wstr
[0] <= '9')))
327 print_location( &key
->loc
);
328 error("VIRTKEY code is not equal to ascii value\n");
330 if(key
->str
.wstr
[0] == '^' && (flags
& WRC_AF_CONTROL
) != 0)
332 print_location( &key
->loc
);
333 error("Cannot use both '^' and CONTROL modifier\n");
335 else if(key
->str
.wstr
[0] == '^')
337 if (key
->str
.wstr
[1] >= 'a' && key
->str
.wstr
[1] <= 'z')
338 keycode
= key
->str
.wstr
[1] - 'a' + 1;
339 else if (key
->str
.wstr
[1] >= 'A' && key
->str
.wstr
[1] <= 'Z')
340 keycode
= key
->str
.wstr
[1] - 'A' + 1;
343 print_location( &key
->loc
);
344 error("Control-code out of range\n");
348 keycode
= key
->str
.wstr
[0];
354 *****************************************************************************
355 * Function : put_string
357 * res - Binary resource to put the data in
358 * str - String to put
359 * isterm - The string is '\0' terminated (disregard the string's
361 *****************************************************************************
363 static void put_string(res_t
*res
, const string_t
*str
, int isterm
, const language_t
*lang
)
371 if (lang
) codepage
= get_language_codepage( lang
->id
, lang
->sub
);
372 else codepage
= get_language_codepage( 0, 0 );
373 assert( codepage
!= -1 );
375 newstr
= convert_string_unicode( str
, codepage
);
376 if (str
->type
== str_char
&& check_valid_utf8( str
, codepage
))
378 print_location( &str
->loc
);
379 warning( "string \"%s\" seems to be UTF-8 but codepage %u is in use, maybe use --utf8?\n",
380 str
->str
.cstr
, codepage
);
382 if (!isterm
) put_word(res
, newstr
->size
);
383 for(cnt
= 0; cnt
< newstr
->size
; cnt
++)
385 WCHAR c
= newstr
->str
.wstr
[cnt
];
386 if (isterm
&& !c
) break;
389 if (isterm
) put_word(res
, 0);
394 if (str
->type
== str_unicode
)
395 internal_error(__FILE__
, __LINE__
, "Unicode string %s in 16-bit\n",
396 convert_string_utf8( str
, 0 ));
397 if (!isterm
) put_byte(res
, str
->size
);
398 for(cnt
= 0; cnt
< str
->size
; cnt
++)
400 char c
= str
->str
.cstr
[cnt
];
401 if (isterm
&& !c
) break;
404 if (isterm
) put_byte(res
, 0);
409 *****************************************************************************
410 * Function : put_name_id
411 * Syntax : void put_name_id(res_t *res, name_id_t *nid, int upcase, const language_t *lang)
416 *****************************************************************************
418 static void put_name_id(res_t
*res
, name_id_t
*nid
, int upcase
, const language_t
*lang
)
420 if(nid
->type
== name_ord
)
423 put_word(res
, 0xffff);
426 put_word(res
, (WORD
)nid
->name
.i_name
);
428 else if(nid
->type
== name_str
)
431 string_to_upper(nid
->name
.s_name
);
432 put_string(res
, nid
->name
.s_name
, TRUE
, lang
);
436 internal_error(__FILE__
, __LINE__
, "Invalid name_id type %d\n", nid
->type
);
441 *****************************************************************************
443 * Syntax : void put_lvc(res_t *res, lvc_t *lvc)
448 *****************************************************************************
450 static void put_lvc(res_t
*res
, lvc_t
*lvc
)
452 if(lvc
&& lvc
->language
)
453 put_word(res
, MAKELANGID(lvc
->language
->id
, lvc
->language
->sub
));
455 put_word(res
, 0); /* Neutral */
456 if(lvc
&& lvc
->version
)
457 put_dword(res
, *(lvc
->version
));
460 if(lvc
&& lvc
->characts
)
461 put_dword(res
, *(lvc
->characts
));
467 *****************************************************************************
468 * Function : put_raw_data
469 * Syntax : void put_raw_data(res_t *res, raw_data_t *raw, int offset)
474 *****************************************************************************
476 static void put_raw_data(res_t
*res
, raw_data_t
*raw
, int offset
)
478 unsigned int wsize
= raw
->size
- offset
;
479 if(res
->allocsize
- res
->size
< wsize
)
480 grow_res(res
, wsize
);
481 memcpy(&(res
->data
[res
->size
]), raw
->data
+ offset
, wsize
);
486 *****************************************************************************
487 * Function : put_res_header
488 * Syntax : input_res_header(res_t *res, int type, name_id_t *ntype,
489 * name_id_t *name, DWORD memopt, lvc_t *lvc)
492 * res - Binary resource descriptor to write to
493 * type - Resource identifier (if ntype == NULL)
494 * ntype - Name id of type
495 * name - Resource's name
496 * memopt - Resource's memory options to write
497 * lvc - Language, version and characteristics (win32 only)
498 * Output : An index to the resource size field. The resource size field
499 * contains the header size upon exit.
502 *****************************************************************************
504 static int put_res_header(res_t
*res
, int type
, name_id_t
*ntype
, name_id_t
*name
,
505 DWORD memopt
, lvc_t
*lvc
)
509 put_dword(res
, 0); /* We will overwrite these later */
513 put_word(res
, 0xffff); /* ResType */
517 put_name_id(res
, ntype
, TRUE
, lvc
->language
);
518 put_name_id(res
, name
, TRUE
, lvc
->language
); /* ResName */
520 put_dword(res
, 0); /* DataVersion */
521 put_word(res
, memopt
); /* Memory options */
522 put_lvc(res
, lvc
); /* Language, version and characts */
523 set_dword(res
, 0*sizeof(DWORD
), res
->size
); /* Set preliminary resource */
524 set_dword(res
, 1*sizeof(DWORD
), res
->size
); /* Set HeaderSize */
525 res
->dataidx
= res
->size
;
533 put_byte(res
, 0xff); /* ResType */
537 put_name_id(res
, ntype
, TRUE
, NULL
);
538 put_name_id(res
, name
, TRUE
, NULL
); /* ResName */
539 put_word(res
, memopt
); /* Memory options */
541 put_dword(res
, 0); /* ResSize overwritten later*/
542 set_dword(res
, tag
, res
->size
);
543 res
->dataidx
= res
->size
;
549 *****************************************************************************
550 * Function : accelerator2res
551 * Syntax : res_t *accelerator2res(name_id_t *name, accelerator_t *acc)
553 * name - Name/ordinal of the resource
554 * acc - The accelerator descriptor
555 * Output : New .res format structure
558 *****************************************************************************
560 static res_t
*accelerator2res(name_id_t
*name
, accelerator_t
*acc
)
565 assert(name
!= NULL
);
572 restag
= put_res_header(res
, WRC_RT_ACCELERATOR
, NULL
, name
, acc
->memopt
, &(acc
->lvc
));
576 if (ev
->str
) key
= parse_accel_string( ev
->str
, ev
->flags
);
577 put_word(res
, ev
->flags
| (ev
->next
? 0 : 0x80));
579 put_word(res
, ev
->id
);
580 put_word(res
, 0); /* Padding */
587 restag
= put_res_header(res
, WRC_RT_ACCELERATOR
, NULL
, name
, acc
->memopt
, NULL
);
591 if (ev
->str
) key
= parse_accel_string( ev
->str
, ev
->flags
);
592 put_byte(res
, ev
->flags
| (ev
->next
? 0 : 0x80));
594 put_word(res
, ev
->id
);
598 return end_res(res
, restag
);
602 *****************************************************************************
603 * Function : dialog2res
604 * Syntax : res_t *dialog2res(name_id_t *name, dialog_t *dlg)
606 * name - Name/ordinal of the resource
607 * dlg - The dialog descriptor
608 * Output : New .res format structure
611 *****************************************************************************
613 static res_t
*dialog2res(name_id_t
*name
, dialog_t
*dlg
)
620 assert(name
!= NULL
);
623 ctrl
= dlg
->controls
;
627 restag
= put_res_header(res
, WRC_RT_DIALOG
, NULL
, name
, dlg
->memopt
, &(dlg
->lvc
));
631 /* FIXME: MS doc says that the first word must contain 0xffff
632 * and the second 0x0001 to signal a DLGTEMPLATEEX. Borland's
633 * compiler reverses the two words.
634 * I don't know which one to choose, but I write it as Mr. B
637 put_word(res
, 1); /* Signature */
638 put_word(res
, 0xffff); /* DlgVer */
639 put_dword(res
, dlg
->gothelpid
? dlg
->helpid
: 0);
640 put_dword(res
, dlg
->gotexstyle
? dlg
->exstyle
->or_mask
: 0);
641 put_dword(res
, dlg
->gotstyle
? dlg
->style
->or_mask
: WS_POPUPWINDOW
);
645 put_dword(res
, dlg
->style
->or_mask
);
646 put_dword(res
, dlg
->gotexstyle
? dlg
->exstyle
->or_mask
: 0);
648 tag_nctrl
= res
->size
;
649 put_word(res
, 0); /* Number of controls */
650 put_word(res
, dlg
->x
);
651 put_word(res
, dlg
->y
);
652 put_word(res
, dlg
->width
);
653 put_word(res
, dlg
->height
);
655 put_name_id(res
, dlg
->menu
, FALSE
, dlg
->lvc
.language
);
659 put_name_id(res
, dlg
->dlgclass
, FALSE
, dlg
->lvc
.language
);
663 put_string(res
, dlg
->title
, TRUE
, dlg
->lvc
.language
);
668 put_word(res
, dlg
->font
->size
);
671 put_word(res
, dlg
->font
->weight
);
672 /* FIXME: ? TRUE should be sufficient to say that it's
673 * italic, but Borland's compiler says it's 0x0101.
674 * I just copy it here, and hope for the best.
676 put_word(res
, dlg
->font
->italic
? 0x0101 : 0);
678 put_string(res
, dlg
->font
->name
, TRUE
, dlg
->lvc
.language
);
680 else if (dlg
->style
->or_mask
& DS_SETFONT
) put_word( res
, 0x7fff );
687 put_dword(res
, ctrl
->gothelpid
? ctrl
->helpid
: 0);
688 put_dword(res
, ctrl
->gotexstyle
? ctrl
->exstyle
->or_mask
: 0);
689 /* FIXME: what is default control style? */
690 put_dword(res
, ctrl
->gotstyle
? ctrl
->style
->or_mask
: WS_CHILD
| WS_VISIBLE
);
694 /* FIXME: what is default control style? */
695 put_dword(res
, ctrl
->gotstyle
? ctrl
->style
->or_mask
: WS_CHILD
);
696 put_dword(res
, ctrl
->gotexstyle
? ctrl
->exstyle
->or_mask
: 0);
698 put_word(res
, ctrl
->x
);
699 put_word(res
, ctrl
->y
);
700 put_word(res
, ctrl
->width
);
701 put_word(res
, ctrl
->height
);
703 put_dword(res
, ctrl
->id
);
705 put_word(res
, ctrl
->id
);
707 put_name_id(res
, ctrl
->ctlclass
, FALSE
, dlg
->lvc
.language
);
709 internal_error(__FILE__
, __LINE__
, "Control has no control-class\n");
711 put_name_id(res
, ctrl
->title
, FALSE
, dlg
->lvc
.language
);
716 put_word(res
, ctrl
->extra
->size
);
717 put_raw_data(res
, ctrl
->extra
, 0);
727 /* Set number of controls */
728 set_word(res
, tag_nctrl
, (WORD
)nctrl
);
732 restag
= put_res_header(res
, WRC_RT_DIALOG
, NULL
, name
, dlg
->memopt
, NULL
);
734 put_dword(res
, dlg
->gotstyle
? dlg
->style
->or_mask
: WS_POPUPWINDOW
);
735 tag_nctrl
= res
->size
;
736 put_byte(res
, 0); /* Number of controls */
737 put_word(res
, dlg
->x
);
738 put_word(res
, dlg
->y
);
739 put_word(res
, dlg
->width
);
740 put_word(res
, dlg
->height
);
742 put_name_id(res
, dlg
->menu
, TRUE
, NULL
);
746 put_name_id(res
, dlg
->dlgclass
, TRUE
, NULL
);
750 put_string(res
, dlg
->title
, TRUE
, NULL
);
755 put_word(res
, dlg
->font
->size
);
756 put_string(res
, dlg
->font
->name
, TRUE
, NULL
);
761 put_word(res
, ctrl
->x
);
762 put_word(res
, ctrl
->y
);
763 put_word(res
, ctrl
->width
);
764 put_word(res
, ctrl
->height
);
765 put_word(res
, ctrl
->id
);
766 put_dword(res
, ctrl
->gotstyle
? ctrl
->style
->or_mask
: WS_CHILD
);
769 if(ctrl
->ctlclass
->type
== name_ord
770 && ctrl
->ctlclass
->name
.i_name
>= 0x80
771 && ctrl
->ctlclass
->name
.i_name
<= 0x85)
772 put_byte(res
, ctrl
->ctlclass
->name
.i_name
);
773 else if(ctrl
->ctlclass
->type
== name_str
)
774 put_name_id(res
, ctrl
->ctlclass
, FALSE
, NULL
);
776 error("Unknown control-class %04x\n", ctrl
->ctlclass
->name
.i_name
);
779 internal_error(__FILE__
, __LINE__
, "Control has no control-class\n");
781 put_name_id(res
, ctrl
->title
, FALSE
, NULL
);
785 /* FIXME: What is this extra byte doing here? */
791 /* Set number of controls */
792 ((char *)res
->data
)[tag_nctrl
] = (char)nctrl
;
794 return end_res(res
, restag
);
798 *****************************************************************************
799 * Function : menuitem2res
800 * Syntax : void menuitem2res(res_t *res, menu_item_t *item)
804 * Remarks : Self recursive
805 *****************************************************************************
807 static void menuitem2res(res_t
*res
, menu_item_t
*menitem
, const language_t
*lang
)
809 menu_item_t
*itm
= menitem
;
813 put_word(res
, itm
->state
| (itm
->popup
? MF_POPUP
: 0) | (!itm
->next
? MF_END
: 0));
815 put_word(res
, itm
->id
);
817 put_string(res
, itm
->name
, TRUE
, lang
);
820 if (win32
) put_word(res
, 0);
821 else put_byte(res
, 0);
824 menuitem2res(res
, itm
->popup
, lang
);
830 *****************************************************************************
831 * Function : menuexitem2res
832 * Syntax : void menuexitem2res(res_t *res, menuex_item_t *item)
836 * Remarks : Self recursive
837 *****************************************************************************
839 static void menuexitem2res(res_t
*res
, menu_item_t
*menitem
, const language_t
*lang
)
841 menu_item_t
*itm
= menitem
;
845 put_dword(res
, itm
->gottype
? itm
->type
: 0);
846 put_dword(res
, itm
->gotstate
? itm
->state
: 0);
847 put_dword(res
, itm
->gotid
? itm
->id
: 0);
848 put_word(res
, (itm
->popup
? 0x01 : 0) | (!itm
->next
? MF_END
: 0));
850 put_string(res
, itm
->name
, TRUE
, lang
);
856 put_dword(res
, itm
->gothelpid
? itm
->helpid
: 0);
857 menuexitem2res(res
, itm
->popup
, lang
);
865 *****************************************************************************
866 * Function : menu2res
867 * Syntax : res_t *menu2res(name_id_t *name, menu_t *men)
869 * name - Name/ordinal of the resource
870 * menex - The menuex descriptor
871 * Output : New .res format structure
874 *****************************************************************************
876 static res_t
*menu2res(name_id_t
*name
, menu_t
*men
)
880 assert(name
!= NULL
);
884 restag
= put_res_header(res
, WRC_RT_MENU
, NULL
, name
, men
->memopt
, &men
->lvc
);
889 put_word(res
, 1); /* Menuheader: Version */
890 put_word(res
, 4); /* Offset */
891 put_dword(res
, 0); /* HelpId */
893 menuexitem2res(res
, men
->items
, men
->lvc
.language
);
897 put_dword(res
, 0); /* Menuheader: Version and HeaderSize */
898 menuitem2res(res
, men
->items
, men
->lvc
.language
);
903 put_dword(res
, 0); /* Menuheader: Version and HeaderSize */
904 menuitem2res(res
, men
->items
, NULL
);
906 return end_res(res
, restag
);
910 *****************************************************************************
911 * Function : cursorgroup2res
912 * Syntax : res_t *cursorgroup2res(name_id_t *name, cursor_group_t *curg)
914 * name - Name/ordinal of the resource
915 * curg - The cursor descriptor
916 * Output : New .res format structure
919 *****************************************************************************
921 static res_t
*cursorgroup2res(name_id_t
*name
, cursor_group_t
*curg
)
926 assert(name
!= NULL
);
927 assert(curg
!= NULL
);
930 restag
= put_res_header(res
, WRC_RT_GROUP_CURSOR
, NULL
, name
, curg
->memopt
, &(curg
->lvc
));
932 put_word(res
, 0); /* Reserved */
933 /* FIXME: The ResType in the NEWHEADER structure should
934 * contain 14 according to the MS win32 doc. This is
935 * not the case with the BRC compiler and I really doubt
936 * the latter. Putting one here is compliant to win16 spec,
937 * but who knows the true value?
939 put_word(res
, 2); /* ResType */
940 put_word(res
, curg
->ncursor
);
942 for(cur
= curg
->cursorlist
; cur
; cur
= cur
->next
)
944 cur
= curg
->cursorlist
;
947 for(; cur
; cur
= cur
->prev
)
950 put_word(res
, cur
->width
);
951 /* FIXME: The height of a cursor is half the size of
952 * the bitmap's height. BRC puts the height from the
953 * BITMAPINFOHEADER here instead of the cursorfile's
954 * height. MS doesn't seem to care...
956 put_word(res
, cur
->height
);
957 /* FIXME: The next two are reversed in BRC and I don't
958 * know why. Probably a bug. But, we can safely ignore
959 * it because win16 does not support color cursors.
960 * A warning should have been generated by the parser.
962 put_word(res
, cur
->planes
);
963 put_word(res
, cur
->bits
);
964 /* FIXME: The +4 is the hotspot in the cursor resource.
965 * However, I could not find this in the documentation.
966 * The hotspot bytes must either be included or MS
969 put_dword(res
, cur
->data
->size
+4);
970 put_word(res
, cur
->id
);
973 return end_res(res
, restag
);
977 *****************************************************************************
978 * Function : cursor2res
979 * Syntax : res_t *cursor2res(cursor_t *cur)
981 * cur - The cursor descriptor
982 * Output : New .res format structure
985 *****************************************************************************
987 static res_t
*cursor2res(cursor_t
*cur
)
996 name
.type
= name_ord
;
997 name
.name
.i_name
= cur
->id
;
998 restag
= put_res_header(res
, WRC_RT_CURSOR
, NULL
, &name
, WRC_MO_MOVEABLE
| WRC_MO_DISCARDABLE
, &(cur
->lvc
));
999 put_word(res
, cur
->xhot
);
1000 put_word(res
, cur
->yhot
);
1001 put_raw_data(res
, cur
->data
, 0);
1003 return end_res(res
, restag
);
1007 *****************************************************************************
1008 * Function : icongroup2res
1009 * Syntax : res_t *icongroup2res(name_id_t *name, icon_group_t *icog)
1011 * name - Name/ordinal of the resource
1012 * icog - The icon group descriptor
1013 * Output : New .res format structure
1016 *****************************************************************************
1018 static res_t
*icongroup2res(name_id_t
*name
, icon_group_t
*icog
)
1023 assert(name
!= NULL
);
1024 assert(icog
!= NULL
);
1027 restag
= put_res_header(res
, WRC_RT_GROUP_ICON
, NULL
, name
, icog
->memopt
, &(icog
->lvc
));
1029 put_word(res
, 0); /* Reserved */
1030 /* FIXME: The ResType in the NEWHEADER structure should
1031 * contain 14 according to the MS win32 doc. This is
1032 * not the case with the BRC compiler and I really doubt
1033 * the latter. Putting one here is compliant to win16 spec,
1034 * but who knows the true value?
1036 put_word(res
, 1); /* ResType */
1037 put_word(res
, icog
->nicon
);
1038 for(ico
= icog
->iconlist
; ico
; ico
= ico
->next
)
1040 put_byte(res
, ico
->width
);
1041 put_byte(res
, ico
->height
);
1042 put_byte(res
, ico
->nclr
);
1043 put_byte(res
, 0); /* Reserved */
1044 put_word(res
, ico
->planes
);
1045 put_word(res
, ico
->bits
);
1046 put_dword(res
, ico
->data
->size
);
1047 put_word(res
, ico
->id
);
1050 return end_res(res
, restag
);
1054 *****************************************************************************
1055 * Function : icon2res
1056 * Syntax : res_t *icon2res(icon_t *ico)
1058 * ico - The icon descriptor
1059 * Output : New .res format structure
1062 *****************************************************************************
1064 static res_t
*icon2res(icon_t
*ico
)
1070 assert(ico
!= NULL
);
1073 name
.type
= name_ord
;
1074 name
.name
.i_name
= ico
->id
;
1075 restag
= put_res_header(res
, WRC_RT_ICON
, NULL
, &name
, WRC_MO_MOVEABLE
| WRC_MO_DISCARDABLE
, &(ico
->lvc
));
1076 put_raw_data(res
, ico
->data
, 0);
1078 return end_res(res
, restag
);
1082 *****************************************************************************
1083 * Function : anicurico2res
1084 * Syntax : res_t *anicurico2res(name_id_t *name, ani_curico_t *ani)
1086 * name - Name/ordinal of the resource
1087 * ani - The animated object descriptor
1088 * Output : New .res format structure
1090 * Remarks : The endian of the object's structures have been converted
1092 * There are rumors that win311 could handle animated stuff.
1093 * That is why they are generated for both win16 and win32
1095 *****************************************************************************
1097 static res_t
*anicurico2res(name_id_t
*name
, ani_curico_t
*ani
, enum res_e type
)
1101 assert(name
!= NULL
);
1102 assert(ani
!= NULL
);
1105 restag
= put_res_header(res
, type
== res_anicur
? WRC_RT_ANICURSOR
: WRC_RT_ANIICON
,
1106 NULL
, name
, ani
->memopt
, NULL
);
1107 put_raw_data(res
, ani
->data
, 0);
1108 return end_res(res
, restag
);
1112 *****************************************************************************
1113 * Function : bitmap2res
1114 * Syntax : res_t *bitmap2res(name_id_t *name, bitmap_t *bmp)
1116 * name - Name/ordinal of the resource
1117 * bmp - The bitmap descriptor
1118 * Output : New .res format structure
1120 * Remarks : The endian of the bitmap structures have been converted
1122 *****************************************************************************
1124 static res_t
*bitmap2res(name_id_t
*name
, bitmap_t
*bmp
)
1128 assert(name
!= NULL
);
1129 assert(bmp
!= NULL
);
1132 restag
= put_res_header(res
, WRC_RT_BITMAP
, NULL
, name
, bmp
->memopt
, &(bmp
->data
->lvc
));
1133 if(bmp
->data
->data
[0] == 'B'
1134 && bmp
->data
->data
[1] == 'M'
1135 && ((BITMAPFILEHEADER
*)bmp
->data
->data
)->bfSize
== bmp
->data
->size
1136 && bmp
->data
->size
>= sizeof(BITMAPFILEHEADER
))
1138 /* The File header is still attached, don't write it */
1139 put_raw_data(res
, bmp
->data
, sizeof(BITMAPFILEHEADER
));
1143 put_raw_data(res
, bmp
->data
, 0);
1145 return end_res(res
, restag
);
1149 *****************************************************************************
1150 * Function : font2res
1151 * Syntax : res_t *font2res(name_id_t *name, font_t *fnt)
1153 * name - Name/ordinal of the resource
1154 * fnt - The font descriptor
1155 * Output : New .res format structure
1157 * Remarks : The data has been prepared just after parsing.
1158 *****************************************************************************
1160 static res_t
*font2res(name_id_t
*name
, font_t
*fnt
)
1164 assert(name
!= NULL
);
1165 assert(fnt
!= NULL
);
1168 restag
= put_res_header(res
, WRC_RT_FONT
, NULL
, name
, fnt
->memopt
, &(fnt
->data
->lvc
));
1169 put_raw_data(res
, fnt
->data
, 0);
1170 return end_res(res
, restag
);
1174 *****************************************************************************
1175 * Function : fontdir2res
1176 * Syntax : res_t *fontdir2res(name_id_t *name, fontdir_t *fnd)
1178 * name - Name/ordinal of the resource
1179 * fntdir - The fontdir descriptor
1180 * Output : New .res format structure
1182 * Remarks : The data has been prepared just after parsing.
1183 *****************************************************************************
1185 static res_t
*fontdir2res(name_id_t
*name
, fontdir_t
*fnd
)
1189 assert(name
!= NULL
);
1190 assert(fnd
!= NULL
);
1193 restag
= put_res_header(res
, WRC_RT_FONTDIR
, NULL
, name
, fnd
->memopt
, &(fnd
->data
->lvc
));
1194 put_raw_data(res
, fnd
->data
, 0);
1195 return end_res(res
, restag
);
1199 *****************************************************************************
1200 * Function : html2res
1201 * Syntax : res_t *html2res(name_id_t *name, html_t *html)
1203 * name - Name/ordinal of the resource
1204 * rdt - The html descriptor
1205 * Output : New .res format structure
1208 *****************************************************************************
1210 static res_t
*html2res(name_id_t
*name
, html_t
*html
)
1214 assert(name
!= NULL
);
1215 assert(html
!= NULL
);
1218 restag
= put_res_header(res
, WRC_RT_HTML
, NULL
, name
, html
->memopt
, &(html
->data
->lvc
));
1219 put_raw_data(res
, html
->data
, 0);
1220 return end_res(res
, restag
);
1224 *****************************************************************************
1225 * Function : rcdata2res
1226 * Syntax : res_t *rcdata2res(name_id_t *name, rcdata_t *rdt)
1228 * name - Name/ordinal of the resource
1229 * rdt - The rcdata descriptor
1230 * Output : New .res format structure
1233 *****************************************************************************
1235 static res_t
*rcdata2res(name_id_t
*name
, rcdata_t
*rdt
)
1239 assert(name
!= NULL
);
1240 assert(rdt
!= NULL
);
1243 restag
= put_res_header(res
, WRC_RT_RCDATA
, NULL
, name
, rdt
->memopt
, &(rdt
->data
->lvc
));
1244 put_raw_data(res
, rdt
->data
, 0);
1245 return end_res(res
, restag
);
1249 *****************************************************************************
1250 * Function : messagetable2res
1251 * Syntax : res_t *messagetable2res(name_id_t *name, messagetable_t *msg)
1253 * name - Name/ordinal of the resource
1254 * msg - The messagetable descriptor
1255 * Output : New .res format structure
1257 * Remarks : The data has been converted to the appropriate endian
1258 * after it was parsed.
1259 *****************************************************************************
1261 static res_t
*messagetable2res(name_id_t
*name
, messagetable_t
*msg
)
1265 assert(name
!= NULL
);
1266 assert(msg
!= NULL
);
1269 restag
= put_res_header(res
, WRC_RT_MESSAGETABLE
, NULL
, name
, msg
->memopt
, &(msg
->data
->lvc
));
1270 put_raw_data(res
, msg
->data
, 0);
1271 return end_res(res
, restag
);
1275 *****************************************************************************
1276 * Function : stringtable2res
1277 * Syntax : res_t *stringtable2res(stringtable_t *stt)
1279 * stt - The stringtable descriptor
1280 * Output : New .res format structure
1283 *****************************************************************************
1285 static res_t
*stringtable2res(stringtable_t
*stt
)
1293 assert(stt
!= NULL
);
1296 for(; stt
; stt
= stt
->next
)
1300 warning("Empty internal stringtable\n");
1303 name
.type
= name_ord
;
1304 name
.name
.i_name
= (stt
->idbase
>> 4) + 1;
1305 restag
= put_res_header(res
, WRC_RT_STRING
, NULL
, &name
, stt
->memopt
, win32
? &(stt
->lvc
) : NULL
);
1306 for(i
= 0; i
< stt
->nentries
; i
++)
1308 if(stt
->entries
[i
].str
&& stt
->entries
[i
].str
->size
)
1310 put_string(res
, stt
->entries
[i
].str
, FALSE
, stt
->lvc
.language
);
1320 end_res(res
, restag
- lastsize
);
1321 lastsize
= res
->size
;
1327 *****************************************************************************
1328 * Function : user2res
1329 * Syntax : res_t *user2res(name_id_t *name, user_t *usr)
1331 * name - Name/ordinal of the resource
1332 * usr - The userresource descriptor
1333 * Output : New .res format structure
1336 *****************************************************************************
1338 static res_t
*user2res(name_id_t
*name
, user_t
*usr
)
1342 assert(name
!= NULL
);
1343 assert(usr
!= NULL
);
1346 restag
= put_res_header(res
, 0, usr
->type
, name
, usr
->memopt
, &(usr
->data
->lvc
));
1347 put_raw_data(res
, usr
->data
, 0);
1348 return end_res(res
, restag
);
1352 *****************************************************************************
1353 * Function : versionblock2res
1354 * Syntax : void versionblock2res(res_t *res, ver_block_t *blk)
1356 * res - Binary resource to write to
1357 * blk - The version block to be written
1360 * Remarks : Self recursive
1361 *****************************************************************************
1363 static void versionblock2res(res_t
*res
, ver_block_t
*blk
, int level
, const language_t
*lang
)
1372 blksizetag
= res
->size
;
1373 put_word(res
, 0); /* Will be overwritten later */
1376 put_word(res
, 0); /* level ? */
1377 put_string(res
, blk
->name
, TRUE
, NULL
);
1379 for(val
= blk
->values
; val
; val
= val
->next
)
1381 if(val
->type
== val_str
)
1383 valblksizetag
= res
->size
;
1384 put_word(res
, 0); /* Will be overwritten later */
1385 valvalsizetag
= res
->size
;
1386 put_word(res
, 0); /* Will be overwritten later */
1389 put_word(res
, level
);
1391 put_string(res
, val
->key
, TRUE
, NULL
);
1394 put_string(res
, val
->value
.str
, TRUE
, lang
);
1396 set_word(res
, valvalsizetag
, (WORD
)((res
->size
- tag
) >> 1));
1398 set_word(res
, valvalsizetag
, (WORD
)(res
->size
- tag
));
1399 set_word(res
, valblksizetag
, (WORD
)(res
->size
- valblksizetag
));
1402 else if(val
->type
== val_words
)
1404 valblksizetag
= res
->size
;
1405 put_word(res
, 0); /* Will be overwritten later */
1406 valvalsizetag
= res
->size
;
1407 put_word(res
, 0); /* Will be overwritten later */
1410 put_word(res
, level
);
1412 put_string(res
, val
->key
, TRUE
, NULL
);
1415 for(i
= 0; i
< val
->value
.words
->nwords
; i
++)
1417 put_word(res
, val
->value
.words
->words
[i
]);
1419 set_word(res
, valvalsizetag
, (WORD
)(res
->size
- tag
));
1420 set_word(res
, valblksizetag
, (WORD
)(res
->size
- valblksizetag
));
1423 else if(val
->type
== val_block
)
1425 versionblock2res(res
, val
->value
.block
, level
+1, lang
);
1429 internal_error(__FILE__
, __LINE__
, "Invalid value indicator %d in VERSIONINFO\n", val
->type
);
1434 set_word(res
, blksizetag
, (WORD
)(res
->size
- blksizetag
));
1438 *****************************************************************************
1439 * Function : versioninfo2res
1440 * Syntax : res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver)
1442 * name - Name/ordinal of the resource
1443 * ver - The versioninfo descriptor
1444 * Output : New .res format structure
1447 *****************************************************************************
1449 static res_t
*versioninfo2res(name_id_t
*name
, versioninfo_t
*ver
)
1451 static const char info
[] = "VS_VERSION_INFO";
1453 int restag
, rootblocksizetag
, valsizetag
, tag
;
1457 assert(name
!= NULL
);
1458 assert(ver
!= NULL
);
1461 restag
= put_res_header(res
, WRC_RT_VERSION
, NULL
, name
, ver
->memopt
, &(ver
->lvc
));
1462 rootblocksizetag
= res
->size
;
1463 put_word(res
, 0); /* BlockSize filled in later */
1464 valsizetag
= res
->size
;
1465 put_word(res
, 0); /* ValueSize filled in later*/
1468 put_word(res
, 0); /* Tree-level ? */
1469 for (i
= 0; i
< sizeof(info
); i
++) put_word(res
, info
[i
]);
1474 for (i
= 0; i
< sizeof(info
); i
++) put_byte(res
, info
[i
]);
1477 put_dword(res
, VS_FFI_SIGNATURE
);
1478 put_dword(res
, VS_FFI_STRUCVERSION
);
1479 put_dword(res
, (ver
->filever_maj1
<< 16) + (ver
->filever_maj2
& 0xffff));
1480 put_dword(res
, (ver
->filever_min1
<< 16) + (ver
->filever_min2
& 0xffff));
1481 put_dword(res
, (ver
->prodver_maj1
<< 16) + (ver
->prodver_maj2
& 0xffff));
1482 put_dword(res
, (ver
->prodver_min1
<< 16) + (ver
->prodver_min2
& 0xffff));
1483 put_dword(res
, ver
->fileflagsmask
);
1484 put_dword(res
, ver
->fileflags
);
1485 put_dword(res
, ver
->fileos
);
1486 put_dword(res
, ver
->filetype
);
1487 put_dword(res
, ver
->filesubtype
);
1488 put_dword(res
, 0); /* FileDateMS */
1489 put_dword(res
, 0); /* FileDateLS */
1491 set_word(res
, valsizetag
, (WORD
)(res
->size
- tag
));
1492 /* Descend into the blocks */
1493 for(blk
= ver
->blocks
; blk
; blk
= blk
->next
)
1494 versionblock2res(res
, blk
, 0, win32
? ver
->lvc
.language
: NULL
);
1495 /* Set root block's size */
1496 set_word(res
, rootblocksizetag
, (WORD
)(res
->size
- rootblocksizetag
));
1497 return end_res(res
, restag
);
1501 *****************************************************************************
1502 * Function : toolbaritem2res
1503 * Syntax : void toolbaritem2res(res_t *res, toolbar_item_t *tbitem)
1507 * Remarks : Self recursive
1508 *****************************************************************************
1510 static void toolbaritem2res(res_t
*res
, toolbar_item_t
*tbitem
)
1512 toolbar_item_t
*itm
= tbitem
;
1516 put_word(res
, itm
->id
);
1523 *****************************************************************************
1524 * Function : toolbar2res
1525 * Syntax : res_t *toolbar2res(name_id_t *name, toolbar_t *toolbar)
1527 * name - Name/ordinal of the resource
1528 * toolbar - The toolbar descriptor
1529 * Output : New .res format structure
1532 *****************************************************************************
1534 static res_t
*toolbar2res(name_id_t
*name
, toolbar_t
*toolbar
)
1538 assert(name
!= NULL
);
1539 assert(toolbar
!= NULL
);
1541 if (!win32
) return NULL
;
1544 restag
= put_res_header(res
, WRC_RT_TOOLBAR
, NULL
, name
, toolbar
->memopt
, &(toolbar
->lvc
));
1546 put_word(res
, 1); /* Menuheader: Version */
1547 put_word(res
, toolbar
->button_width
); /* (in pixels?) */
1548 put_word(res
, toolbar
->button_height
); /* (in pixels?) */
1549 put_word(res
, toolbar
->nitems
);
1551 toolbaritem2res(res
, toolbar
->items
);
1552 return end_res(res
, restag
);
1556 *****************************************************************************
1557 * Function : dlginit2res
1558 * Syntax : res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
1560 * name - Name/ordinal of the resource
1561 * rdt - The dlginit descriptor
1562 * Output : New .res format structure
1565 *****************************************************************************
1567 static res_t
*dlginit2res(name_id_t
*name
, dlginit_t
*dit
)
1571 assert(name
!= NULL
);
1572 assert(dit
!= NULL
);
1575 restag
= put_res_header(res
, WRC_RT_DLGINIT
, NULL
, name
, dit
->memopt
, &(dit
->data
->lvc
));
1576 put_raw_data(res
, dit
->data
, 0);
1577 return end_res(res
, restag
);
1581 *****************************************************************************
1582 * Function : prep_nid_for_label
1583 * Syntax : char *prep_nid_for_label(const name_id_t *nid)
1586 * Description : Converts a resource name into the first 32 (or less)
1587 * characters of the name with conversions.
1589 *****************************************************************************
1591 #define MAXNAMELEN 32
1592 char *prep_nid_for_label(const name_id_t
*nid
)
1594 static char buf
[MAXNAMELEN
+1];
1596 assert(nid
!= NULL
);
1598 if(nid
->type
== name_str
&& nid
->name
.s_name
->type
== str_unicode
)
1602 sptr
= nid
->name
.s_name
->str
.wstr
;
1604 for(i
= 0; *sptr
&& i
< MAXNAMELEN
; i
++)
1606 if((unsigned)*sptr
< 0x80 && isprint(*sptr
& 0xff))
1609 warning("Resourcename (str_unicode) contain unprintable characters or invalid translation, ignored\n");
1613 else if(nid
->type
== name_str
&& nid
->name
.s_name
->type
== str_char
)
1617 cptr
= nid
->name
.s_name
->str
.cstr
;
1619 for(i
= 0; *cptr
&& i
< MAXNAMELEN
; i
++)
1621 if((unsigned)*cptr
< 0x80 && isprint(*cptr
& 0xff))
1624 warning("Resourcename (str_char) contain unprintable characters, ignored\n");
1628 else if(nid
->type
== name_ord
)
1630 sprintf(buf
, "%u", nid
->name
.i_name
);
1634 internal_error(__FILE__
, __LINE__
, "Resource name_id with invalid type %d\n", nid
->type
);
1641 *****************************************************************************
1642 * Function : make_c_name
1643 * Syntax : char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan)
1646 * Description : Converts a resource name into a valid c-identifier in the
1649 *****************************************************************************
1651 char *make_c_name(const char *base
, const name_id_t
*nid
, const language_t
*lan
)
1653 char *buf
= prep_nid_for_label(nid
);
1654 return strmake( "_%s_%s_%d", base
, buf
, lan
? MAKELANGID(lan
->id
, lan
->sub
) : 0);
1658 *****************************************************************************
1659 * Function : get_c_typename
1660 * Syntax : const char *get_c_typename(enum res_e type)
1663 * Description : Convert resource enum to char string to be used in c-name
1666 *****************************************************************************
1668 const char *get_c_typename(enum res_e type
)
1672 case res_acc
: return "Acc";
1673 case res_anicur
:return "AniCur";
1674 case res_aniico
:return "AniIco";
1675 case res_bmp
: return "Bmp";
1676 case res_cur
: return "Cur";
1677 case res_curg
: return "CurGrp";
1678 case res_dlg
: return "Dlg";
1679 case res_fnt
: return "Fnt";
1680 case res_fntdir
:return "FntDir";
1681 case res_ico
: return "Ico";
1682 case res_icog
: return "IcoGrp";
1683 case res_men
: return "Men";
1684 case res_rdt
: return "RCDat";
1685 case res_stt
: return "StrTab";
1686 case res_usr
: return "Usr";
1687 case res_msg
: return "MsgTab";
1688 case res_ver
: return "VerInf";
1689 case res_toolbar
: return "TlBr";
1690 case res_dlginit
: return "DlgInit";
1691 default: return "Oops";
1696 *****************************************************************************
1697 * Function : resources2res
1698 * Syntax : void resources2res(resource_t *top)
1700 * top - The resource-tree to convert
1702 * Description : Convert logical resource descriptors into binary data
1704 *****************************************************************************
1706 void resources2res(resource_t
*top
)
1714 top
->binres
= accelerator2res(top
->name
, top
->res
.acc
);
1718 top
->binres
= bitmap2res(top
->name
, top
->res
.bmp
);
1722 top
->binres
= cursor2res(top
->res
.cur
);
1726 top
->binres
= cursorgroup2res(top
->name
, top
->res
.curg
);
1730 top
->binres
= dialog2res(top
->name
, top
->res
.dlg
);
1734 top
->binres
= font2res(top
->name
, top
->res
.fnt
);
1738 top
->binres
= fontdir2res(top
->name
, top
->res
.fnd
);
1742 top
->binres
= icon2res(top
->res
.ico
);
1746 top
->binres
= icongroup2res(top
->name
, top
->res
.icog
);
1750 top
->binres
= menu2res(top
->name
, top
->res
.men
);
1754 top
->binres
= html2res(top
->name
, top
->res
.html
);
1758 top
->binres
= rcdata2res(top
->name
, top
->res
.rdt
);
1762 top
->binres
= stringtable2res(top
->res
.stt
);
1766 top
->binres
= user2res(top
->name
, top
->res
.usr
);
1770 top
->binres
= messagetable2res(top
->name
, top
->res
.msg
);
1774 top
->binres
= versioninfo2res(top
->name
, top
->res
.ver
);
1778 top
->binres
= toolbar2res(top
->name
, top
->res
.tbt
);
1782 top
->binres
= dlginit2res(top
->name
, top
->res
.dlgi
);
1787 top
->binres
= anicurico2res(top
->name
, top
->res
.ani
, top
->type
);
1790 internal_error(__FILE__
, __LINE__
, "Unknown resource type encountered %d in binary res generation\n", top
->type
);
1792 top
->c_name
= make_c_name(get_c_typename(top
->type
), top
->name
, top
->lan
);