1/* windres.h -- header file for windres program.
2   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
3   Free Software Foundation, Inc.
4   Written by Ian Lance Taylor, Cygnus Support.
5
6   This file is part of GNU Binutils.
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2 of the License, or
11   (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21   02110-1301, USA.  */
22
23#include "ansidecl.h"
24
25/* This is the header file for the windres program.  It defines
26   structures and declares functions used within the program.  */
27
28#include "winduni.h"
29
30/* We represent resources internally as a tree, similar to the tree
31   used in the .rsrc section of a COFF file.  The root is a
32   res_directory structure.  */
33
34struct res_directory
35{
36  /* Resource flags.  According to the MS docs, this is currently
37     always zero.  */
38  unsigned long characteristics;
39  /* Time/date stamp.  */
40  unsigned long time;
41  /* Major version number.  */
42  unsigned short major;
43  /* Minor version number.  */
44  unsigned short minor;
45  /* Directory entries.  */
46  struct res_entry *entries;
47};
48
49/* A resource ID is stored in a res_id structure.  */
50
51struct res_id
52{
53  /* Non-zero if this entry has a name rather than an ID.  */
54  unsigned int named : 1;
55  union
56  {
57    /* If the named field is non-zero, this is the name.  */
58    struct
59    {
60      /* Length of the name.  */
61      int length;
62      /* Pointer to the name, which is a Unicode string.  */
63      unichar *name;
64    } n;
65    /* If the named field is zero, this is the ID.  */
66    unsigned long id;
67  } u;
68};
69
70/* Each entry in the tree is a res_entry structure.  We mix
71   directories and resources because in a COFF file all entries in a
72   directory are sorted together, whether the entries are
73   subdirectories or resources.  */
74
75struct res_entry
76{
77  /* Next entry.  */
78  struct res_entry *next;
79  /* Resource ID.  */
80  struct res_id id;
81  /* Non-zero if this entry is a subdirectory rather than a leaf.  */
82  unsigned int subdir : 1;
83  union
84  {
85    /* If the subdir field is non-zero, this is a pointer to the
86       subdirectory.  */
87    struct res_directory *dir;
88    /* If the subdir field is zero, this is a pointer to the resource
89       data.  */
90    struct res_resource *res;
91  } u;
92};
93
94/* Types of resources.  */
95
96enum res_type
97{
98  RES_TYPE_UNINITIALIZED,
99  RES_TYPE_ACCELERATOR,
100  RES_TYPE_BITMAP,
101  RES_TYPE_CURSOR,
102  RES_TYPE_GROUP_CURSOR,
103  RES_TYPE_DIALOG,
104  RES_TYPE_FONT,
105  RES_TYPE_FONTDIR,
106  RES_TYPE_ICON,
107  RES_TYPE_GROUP_ICON,
108  RES_TYPE_MENU,
109  RES_TYPE_MESSAGETABLE,
110  RES_TYPE_RCDATA,
111  RES_TYPE_STRINGTABLE,
112  RES_TYPE_USERDATA,
113  RES_TYPE_VERSIONINFO
114};
115
116/* A res file and a COFF file store information differently.  The
117   res_info structures holds data which in a res file is stored with
118   each resource, but in a COFF file is stored elsewhere.  */
119
120struct res_res_info
121{
122  /* Language.  In a COFF file, the third level of the directory is
123     keyed by the language, so the language of a resource is defined
124     by its location in the resource tree.  */
125  unsigned short language;
126  /* Characteristics of the resource.  Entirely user defined.  In a
127     COFF file, the res_directory structure has a characteristics
128     field, but I don't know if it's related to the one in the res
129     file.  */
130  unsigned long characteristics;
131  /* Version of the resource.  Entirely user defined.  In a COFF file,
132     the res_directory structure has a characteristics field, but I
133     don't know if it's related to the one in the res file.  */
134  unsigned long version;
135  /* Memory flags.  This is a combination of the MEMFLAG values
136     defined below.  Most of these values are historical, and are not
137     meaningful for win32.  I don't think there is any way to store
138     this information in a COFF file.  */
139  unsigned short memflags;
140};
141
142/* Each resource in a COFF file has some information which can does
143   not appear in a res file.  */
144
145struct res_coff_info
146{
147  /* The code page used for the data.  I don't really know what this
148     should be.  */
149  unsigned long codepage;
150  /* A resource entry in a COFF file has a reserved field, which we
151     record here when reading a COFF file.  When writing a COFF file,
152     we set this field to zero.  */
153  unsigned long reserved;
154};
155
156/* Resource data is stored in a res_resource structure.  */
157
158struct res_resource
159{
160  /* The type of resource.  */
161  enum res_type type;
162  /* The data for the resource.  */
163  union
164  {
165    struct
166    {
167      unsigned long length;
168      const unsigned char *data;
169    } data;
170    struct accelerator *acc;
171    struct cursor *cursor;
172    struct group_cursor *group_cursor;
173    struct dialog *dialog;
174    struct fontdir *fontdir;
175    struct group_icon *group_icon;
176    struct menu *menu;
177    struct rcdata_item *rcdata;
178    struct stringtable *stringtable;
179    struct rcdata_item *userdata;
180    struct versioninfo *versioninfo;
181  } u;
182  /* Information from a res file.  */
183  struct res_res_info res_info;
184  /* Information from a COFF file.  */
185  struct res_coff_info coff_info;
186};
187
188#define SUBLANG_SHIFT 10
189
190/* Memory flags in the memflags field of a struct res_resource.  */
191
192#define MEMFLAG_MOVEABLE	0x10
193#define MEMFLAG_PURE		0x20
194#define MEMFLAG_PRELOAD		0x40
195#define MEMFLAG_DISCARDABLE	0x1000
196
197/* Standard resource type codes.  These are used in the ID field of a
198   res_entry structure.  */
199
200#define RT_CURSOR		 1
201#define RT_BITMAP		 2
202#define RT_ICON			 3
203#define RT_MENU			 4
204#define RT_DIALOG		 5
205#define RT_STRING		 6
206#define RT_FONTDIR		 7
207#define RT_FONT			 8
208#define RT_ACCELERATOR		 9
209#define RT_RCDATA		10
210#define RT_MESSAGETABLE		11
211#define RT_GROUP_CURSOR		12
212#define RT_GROUP_ICON		14
213#define RT_VERSION		16
214#define RT_DLGINCLUDE		17
215#define RT_PLUGPLAY		19
216#define RT_VXD			20
217#define RT_ANICURSOR		21
218#define RT_ANIICON		22
219
220/* An accelerator resource is a linked list of these structures.  */
221
222struct accelerator
223{
224  /* Next accelerator.  */
225  struct accelerator *next;
226  /* Flags.  A combination of the ACC values defined below.  */
227  unsigned short flags;
228  /* Key value.  */
229  unsigned short key;
230  /* Resource ID.  */
231  unsigned short id;
232};
233
234/* Accelerator flags in the flags field of a struct accelerator.
235   These are the same values that appear in a res file.  I hope.  */
236
237#define ACC_VIRTKEY	0x01
238#define ACC_NOINVERT	0x02
239#define ACC_SHIFT	0x04
240#define ACC_CONTROL	0x08
241#define ACC_ALT		0x10
242#define ACC_LAST	0x80
243
244/* A cursor resource.  */
245
246struct cursor
247{
248  /* X coordinate of hotspot.  */
249  short xhotspot;
250  /* Y coordinate of hotspot.  */
251  short yhotspot;
252  /* Length of bitmap data.  */
253  unsigned long length;
254  /* Data.  */
255  const unsigned char *data;
256};
257
258/* A group_cursor resource is a list of group_cursor structures.  */
259
260struct group_cursor
261{
262  /* Next cursor in group.  */
263  struct group_cursor *next;
264  /* Width.  */
265  unsigned short width;
266  /* Height.  */
267  unsigned short height;
268  /* Planes.  */
269  unsigned short planes;
270  /* Bits per pixel.  */
271  unsigned short bits;
272  /* Number of bytes in cursor resource.  */
273  unsigned long bytes;
274  /* Index of cursor resource.  */
275  unsigned short index;
276};
277
278/* A dialog resource.  */
279
280struct dialog
281{
282  /* Basic window style.  */
283  unsigned long style;
284  /* Extended window style.  */
285  unsigned long exstyle;
286  /* X coordinate.  */
287  unsigned short x;
288  /* Y coordinate.  */
289  unsigned short y;
290  /* Width.  */
291  unsigned short width;
292  /* Height.  */
293  unsigned short height;
294  /* Menu name.  */
295  struct res_id menu;
296  /* Class name.  */
297  struct res_id class;
298  /* Caption.  */
299  unichar *caption;
300  /* Font point size.  */
301  unsigned short pointsize;
302  /* Font name.  */
303  unichar *font;
304  /* Extended information for a dialogex.  */
305  struct dialog_ex *ex;
306  /* Controls.  */
307  struct dialog_control *controls;
308};
309
310/* An extended dialog has additional information.  */
311
312struct dialog_ex
313{
314  /* Help ID.  */
315  unsigned long help;
316  /* Font weight.  */
317  unsigned short weight;
318  /* Whether the font is italic.  */
319  unsigned char italic;
320  /* Character set.  */
321  unsigned char charset;
322};
323
324/* Window style flags, from the winsup Defines.h header file.  These
325   can appear in the style field of a struct dialog or a struct
326   dialog_control.  */
327
328#define CW_USEDEFAULT	(0x80000000)
329#define WS_BORDER	(0x800000L)
330#define WS_CAPTION	(0xc00000L)
331#define WS_CHILD	(0x40000000L)
332#define WS_CHILDWINDOW	(0x40000000L)
333#define WS_CLIPCHILDREN	(0x2000000L)
334#define WS_CLIPSIBLINGS	(0x4000000L)
335#define WS_DISABLED	(0x8000000L)
336#define WS_DLGFRAME	(0x400000L)
337#define WS_GROUP	(0x20000L)
338#define WS_HSCROLL	(0x100000L)
339#define WS_ICONIC	(0x20000000L)
340#define WS_MAXIMIZE	(0x1000000L)
341#define WS_MAXIMIZEBOX	(0x10000L)
342#define WS_MINIMIZE	(0x20000000L)
343#define WS_MINIMIZEBOX	(0x20000L)
344#define WS_OVERLAPPED	(0L)
345#define WS_OVERLAPPEDWINDOW	(0xcf0000L)
346#define WS_POPUP	(0x80000000L)
347#define WS_POPUPWINDOW	(0x80880000L)
348#define WS_SIZEBOX	(0x40000L)
349#define WS_SYSMENU	(0x80000L)
350#define WS_TABSTOP	(0x10000L)
351#define WS_THICKFRAME	(0x40000L)
352#define WS_TILED	(0L)
353#define WS_TILEDWINDOW	(0xcf0000L)
354#define WS_VISIBLE	(0x10000000L)
355#define WS_VSCROLL	(0x200000L)
356#define MDIS_ALLCHILDSTYLES	(0x1)
357#define BS_3STATE	(0x5L)
358#define BS_AUTO3STATE	(0x6L)
359#define BS_AUTOCHECKBOX	(0x3L)
360#define BS_AUTORADIOBUTTON	(0x9L)
361#define BS_BITMAP	(0x80L)
362#define BS_BOTTOM	(0x800L)
363#define BS_CENTER	(0x300L)
364#define BS_CHECKBOX	(0x2L)
365#define BS_DEFPUSHBUTTON	(0x1L)
366#define BS_GROUPBOX	(0x7L)
367#define BS_ICON	(0x40L)
368#define BS_LEFT	(0x100L)
369#define BS_LEFTTEXT	(0x20L)
370#define BS_MULTILINE	(0x2000L)
371#define BS_NOTIFY	(0x4000L)
372#define BS_OWNERDRAW	(0xbL)
373#define BS_PUSHBOX	(0xcL)		/* FIXME!  What should this be?  */
374#define BS_PUSHBUTTON	(0L)
375#define BS_PUSHLIKE	(0x1000L)
376#define BS_RADIOBUTTON	(0x4L)
377#define BS_RIGHT	(0x200L)
378#define BS_RIGHTBUTTON	(0x20L)
379#define BS_TEXT	(0L)
380#define BS_TOP	(0x400L)
381#define BS_USERBUTTON	(0x8L)
382#define BS_VCENTER	(0xc00L)
383#define CBS_AUTOHSCROLL	(0x40L)
384#define CBS_DISABLENOSCROLL	(0x800L)
385#define CBS_DROPDOWN	(0x2L)
386#define CBS_DROPDOWNLIST	(0x3L)
387#define CBS_HASSTRINGS	(0x200L)
388#define CBS_LOWERCASE	(0x4000L)
389#define CBS_NOINTEGRALHEIGHT	(0x400L)
390#define CBS_OEMCONVERT	(0x80L)
391#define CBS_OWNERDRAWFIXED	(0x10L)
392#define CBS_OWNERDRAWVARIABLE	(0x20L)
393#define CBS_SIMPLE	(0x1L)
394#define CBS_SORT	(0x100L)
395#define CBS_UPPERCASE	(0x2000L)
396#define ES_AUTOHSCROLL	(0x80L)
397#define ES_AUTOVSCROLL	(0x40L)
398#define ES_CENTER	(0x1L)
399#define ES_LEFT	(0L)
400#define ES_LOWERCASE	(0x10L)
401#define ES_MULTILINE	(0x4L)
402#define ES_NOHIDESEL	(0x100L)
403#define ES_NUMBER	(0x2000L)
404#define ES_OEMCONVERT	(0x400L)
405#define ES_PASSWORD	(0x20L)
406#define ES_READONLY	(0x800L)
407#define ES_RIGHT	(0x2L)
408#define ES_UPPERCASE	(0x8L)
409#define ES_WANTRETURN	(0x1000L)
410#define LBS_DISABLENOSCROLL	(0x1000L)
411#define LBS_EXTENDEDSEL	(0x800L)
412#define LBS_HASSTRINGS	(0x40L)
413#define LBS_MULTICOLUMN	(0x200L)
414#define LBS_MULTIPLESEL	(0x8L)
415#define LBS_NODATA	(0x2000L)
416#define LBS_NOINTEGRALHEIGHT	(0x100L)
417#define LBS_NOREDRAW	(0x4L)
418#define LBS_NOSEL	(0x4000L)
419#define LBS_NOTIFY	(0x1L)
420#define LBS_OWNERDRAWFIXED	(0x10L)
421#define LBS_OWNERDRAWVARIABLE	(0x20L)
422#define LBS_SORT	(0x2L)
423#define LBS_STANDARD	(0xa00003L)
424#define LBS_USETABSTOPS	(0x80L)
425#define LBS_WANTKEYBOARDINPUT	(0x400L)
426#define SBS_BOTTOMALIGN	(0x4L)
427#define SBS_HORZ	(0L)
428#define SBS_LEFTALIGN	(0x2L)
429#define SBS_RIGHTALIGN	(0x4L)
430#define SBS_SIZEBOX	(0x8L)
431#define SBS_SIZEBOXBOTTOMRIGHTALIGN	(0x4L)
432#define SBS_SIZEBOXTOPLEFTALIGN	(0x2L)
433#define SBS_SIZEGRIP	(0x10L)
434#define SBS_TOPALIGN	(0x2L)
435#define SBS_VERT	(0x1L)
436#define SS_BITMAP	(0xeL)
437#define SS_BLACKFRAME	(0x7L)
438#define SS_BLACKRECT	(0x4L)
439#define SS_CENTER	(0x1L)
440#define SS_CENTERIMAGE	(0x200L)
441#define SS_ENHMETAFILE	(0xfL)
442#define SS_ETCHEDFRAME	(0x12L)
443#define SS_ETCHEDHORZ	(0x10L)
444#define SS_ETCHEDVERT	(0x11L)
445#define SS_GRAYFRAME	(0x8L)
446#define SS_GRAYRECT	(0x5L)
447#define SS_ICON	(0x3L)
448#define SS_LEFT	(0L)
449#define SS_LEFTNOWORDWRAP	(0xcL)
450#define SS_NOPREFIX	(0x80L)
451#define SS_NOTIFY	(0x100L)
452#define SS_OWNERDRAW	(0xdL)
453#define SS_REALSIZEIMAGE	(0x800L)
454#define SS_RIGHT	(0x2L)
455#define SS_RIGHTJUST	(0x400L)
456#define SS_SIMPLE	(0xbL)
457#define SS_SUNKEN	(0x1000L)
458#define SS_USERITEM     (0xaL)
459#define SS_WHITEFRAME	(0x9L)
460#define SS_WHITERECT	(0x6L)
461#define DS_3DLOOK	(0x4L)
462#define DS_ABSALIGN	(0x1L)
463#define DS_CENTER	(0x800L)
464#define DS_CENTERMOUSE	(0x1000L)
465#define DS_CONTEXTHELP	(0x2000L)
466#define DS_CONTROL	(0x400L)
467#define DS_FIXEDSYS	(0x8L)
468#define DS_LOCALEDIT	(0x20L)
469#define DS_MODALFRAME	(0x80L)
470#define DS_NOFAILCREATE	(0x10L)
471#define DS_NOIDLEMSG	(0x100L)
472#define DS_SETFONT	(0x40L)
473#define DS_SETFOREGROUND	(0x200L)
474#define DS_SYSMODAL	(0x2L)
475
476/* A dialog control.  */
477
478struct dialog_control
479{
480  /* Next control.  */
481  struct dialog_control *next;
482  /* ID.  */
483  unsigned short id;
484  /* Style.  */
485  unsigned long style;
486  /* Extended style.  */
487  unsigned long exstyle;
488  /* X coordinate.  */
489  unsigned short x;
490  /* Y coordinate.  */
491  unsigned short y;
492  /* Width.  */
493  unsigned short width;
494  /* Height.  */
495  unsigned short height;
496  /* Class name.  */
497  struct res_id class;
498  /* Associated text.  */
499  struct res_id text;
500  /* Extra data for the window procedure.  */
501  struct rcdata_item *data;
502  /* Help ID.  Only used in an extended dialog.  */
503  unsigned long help;
504};
505
506/* Control classes.  These can be used as the ID field in a struct
507   dialog_control.  */
508
509#define CTL_BUTTON	0x80
510#define CTL_EDIT	0x81
511#define CTL_STATIC	0x82
512#define CTL_LISTBOX	0x83
513#define CTL_SCROLLBAR	0x84
514#define CTL_COMBOBOX	0x85
515
516/* A fontdir resource is a list of fontdir structures.  */
517
518struct fontdir
519{
520  struct fontdir *next;
521  /* Index of font entry.  */
522  short index;
523  /* Length of font information.  */
524  unsigned long length;
525  /* Font information.  */
526  const unsigned char *data;
527};
528
529/* A group_icon resource is a list of group_icon structures.  */
530
531struct group_icon
532{
533  /* Next icon in group.  */
534  struct group_icon *next;
535  /* Width.  */
536  unsigned char width;
537  /* Height.  */
538  unsigned char height;
539  /* Color count.  */
540  unsigned char colors;
541  /* Planes.  */
542  unsigned short planes;
543  /* Bits per pixel.  */
544  unsigned short bits;
545  /* Number of bytes in cursor resource.  */
546  unsigned long bytes;
547  /* Index of cursor resource.  */
548  unsigned short index;
549};
550
551/* A menu resource.  */
552
553struct menu
554{
555  /* List of menuitems.  */
556  struct menuitem *items;
557  /* Help ID.  I don't think there is any way to set this in an rc
558     file, but it can appear in the binary format.  */
559  unsigned long help;
560};
561
562/* A menu resource is a list of menuitem structures.  */
563
564struct menuitem
565{
566  /* Next menuitem.  */
567  struct menuitem *next;
568  /* Type.  In a normal menu, rather than a menuex, this is the flags
569     field.  */
570  unsigned long type;
571  /* State.  This is only used in a menuex.  */
572  unsigned long state;
573  /* Id.  */
574  unsigned short id;
575  /* Unicode text.  */
576  unichar *text;
577  /* Popup menu items for a popup.  */
578  struct menuitem *popup;
579  /* Help ID.  This is only used in a menuex.  */
580  unsigned long help;
581};
582
583/* Menu item flags.  These can appear in the flags field of a struct
584   menuitem.  */
585
586#define MENUITEM_GRAYED		0x001
587#define MENUITEM_INACTIVE	0x002
588#define MENUITEM_BITMAP		0x004
589#define MENUITEM_OWNERDRAW	0x100
590#define MENUITEM_CHECKED	0x008
591#define MENUITEM_POPUP		0x010
592#define MENUITEM_MENUBARBREAK	0x020
593#define MENUITEM_MENUBREAK	0x040
594#define MENUITEM_ENDMENU	0x080
595#define MENUITEM_HELP	       0x4000
596
597/* An rcdata resource is a pointer to a list of rcdata_item
598   structures.  */
599
600struct rcdata_item
601{
602  /* Next data item.  */
603  struct rcdata_item *next;
604  /* Type of data.  */
605  enum
606  {
607    RCDATA_WORD,
608    RCDATA_DWORD,
609    RCDATA_STRING,
610    RCDATA_WSTRING,
611    RCDATA_BUFFER
612  } type;
613  union
614  {
615    unsigned int word;
616    unsigned long dword;
617    struct
618    {
619      unsigned long length;
620      const char *s;
621    } string;
622    struct
623    {
624      unsigned long length;
625      const unichar *w;
626    } wstring;
627    struct
628    {
629      unsigned long length;
630      const unsigned char *data;
631    } buffer;
632  } u;
633};
634
635/* A stringtable resource is a pointer to a stringtable structure.  */
636
637struct stringtable
638{
639  /* Each stringtable resource is a list of 16 unicode strings.  */
640  struct
641  {
642    /* Length of string.  */
643    int length;
644    /* String data if length > 0.  */
645    unichar *string;
646  } strings[16];
647};
648
649/* A versioninfo resource points to a versioninfo structure.  */
650
651struct versioninfo
652{
653  /* Fixed version information.  */
654  struct fixed_versioninfo *fixed;
655  /* Variable version information.  */
656  struct ver_info *var;
657};
658
659/* The fixed portion of a versioninfo resource.  */
660
661struct fixed_versioninfo
662{
663  /* The file version, which is two 32 bit integers.  */
664  unsigned long file_version_ms;
665  unsigned long file_version_ls;
666  /* The product version, which is two 32 bit integers.  */
667  unsigned long product_version_ms;
668  unsigned long product_version_ls;
669  /* The file flags mask.  */
670  unsigned long file_flags_mask;
671  /* The file flags.  */
672  unsigned long file_flags;
673  /* The OS type.  */
674  unsigned long file_os;
675  /* The file type.  */
676  unsigned long file_type;
677  /* The file subtype.  */
678  unsigned long file_subtype;
679  /* The date, which in Windows is two 32 bit integers.  */
680  unsigned long file_date_ms;
681  unsigned long file_date_ls;
682};
683
684/* A list of variable version information.  */
685
686struct ver_info
687{
688  /* Next item.  */
689  struct ver_info *next;
690  /* Type of data.  */
691  enum { VERINFO_STRING, VERINFO_VAR } type;
692  union
693  {
694    /* StringFileInfo data.  */
695    struct
696    {
697      /* Language.  */
698      unichar *language;
699      /* Strings.  */
700      struct ver_stringinfo *strings;
701    } string;
702    /* VarFileInfo data.  */
703    struct
704    {
705      /* Key.  */
706      unichar *key;
707      /* Values.  */
708      struct ver_varinfo *var;
709    } var;
710  } u;
711};
712
713/* A list of string version information.  */
714
715struct ver_stringinfo
716{
717  /* Next string.  */
718  struct ver_stringinfo *next;
719  /* Key.  */
720  unichar *key;
721  /* Value.  */
722  unichar *value;
723};
724
725/* A list of variable version information.  */
726
727struct ver_varinfo
728{
729  /* Next item.  */
730  struct ver_varinfo *next;
731  /* Language ID.  */
732  unsigned short language;
733  /* Character set ID.  */
734  unsigned short charset;
735};
736
737/* This structure is used when converting resource information to
738   binary.  */
739
740struct bindata
741{
742  /* Next data.  */
743  struct bindata *next;
744  /* Length of data.  */
745  unsigned long length;
746  /* Data.  */
747  unsigned char *data;
748};
749
750extern int verbose;
751
752/* Function declarations.  */
753
754extern struct res_directory *read_rc_file
755  (const char *, const char *, const char *, int, int);
756extern struct res_directory *read_res_file (const char *);
757extern struct res_directory *read_coff_rsrc (const char *, const char *);
758extern void write_rc_file (const char *, const struct res_directory *);
759extern void write_res_file (const char *, const struct res_directory *);
760extern void write_coff_file
761  (const char *, const char *, const struct res_directory *);
762
763extern struct res_resource *bin_to_res
764  (struct res_id, const unsigned char *, unsigned long, int);
765extern struct bindata *res_to_bin (const struct res_resource *, int);
766
767extern FILE *open_file_search
768  (const char *, const char *, const char *, char **);
769
770extern void *res_alloc (size_t);
771extern void *reswr_alloc (size_t);
772
773/* Resource ID handling.  */
774
775extern int res_id_cmp (struct res_id, struct res_id);
776extern void res_id_print (FILE *, struct res_id, int);
777extern void res_ids_print (FILE *, int, const struct res_id *);
778extern void res_string_to_id (struct res_id *, const char *);
779
780/* Manipulation of the resource tree.  */
781
782extern struct res_resource *define_resource
783  (struct res_directory **, int, const struct res_id *, int);
784extern struct res_resource *define_standard_resource
785  (struct res_directory **, int, struct res_id, int, int);
786
787extern int extended_dialog (const struct dialog *);
788extern int extended_menu (const struct menu *);
789
790/* Communication between the rc file support and the parser and lexer.  */
791
792extern int yydebug;
793extern FILE *yyin;
794extern char *rc_filename;
795extern int rc_lineno;
796
797extern int yyparse (void);
798extern int yylex (void);
799extern void yyerror (const char *);
800extern void rcparse_warning (const char *);
801extern void rcparse_set_language (int);
802extern void rcparse_discard_strings (void);
803extern void rcparse_rcdata (void);
804extern void rcparse_normal (void);
805
806extern void define_accelerator
807  (struct res_id, const struct res_res_info *, struct accelerator *);
808extern void define_bitmap
809  (struct res_id, const struct res_res_info *, const char *);
810extern void define_cursor
811  (struct res_id, const struct res_res_info *, const char *);
812extern void define_dialog
813  (struct res_id, const struct res_res_info *, const struct dialog *);
814extern struct dialog_control *define_control
815  (const struct res_id, unsigned long, unsigned long, unsigned long,
816   unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
817extern struct dialog_control *define_icon_control
818  (struct res_id, unsigned long, unsigned long, unsigned long, unsigned long,
819   unsigned long, unsigned long, struct rcdata_item *, struct dialog_ex *);
820extern void define_font
821  (struct res_id, const struct res_res_info *, const char *);
822extern void define_icon
823  (struct res_id, const struct res_res_info *, const char *);
824extern void define_menu
825  (struct res_id, const struct res_res_info *, struct menuitem *);
826extern struct menuitem *define_menuitem
827  (const char *, int, unsigned long, unsigned long, unsigned long,
828   struct menuitem *);
829extern void define_messagetable
830  (struct res_id, const struct res_res_info *, const char *);
831extern void define_rcdata
832  (struct res_id, const struct res_res_info *, struct rcdata_item *);
833extern void define_rcdata_file
834  (struct res_id, const struct res_res_info *, const char *);
835extern struct rcdata_item *define_rcdata_string
836  (const char *, unsigned long);
837extern struct rcdata_item *define_rcdata_number (unsigned long, int);
838extern void define_stringtable
839  (const struct res_res_info *, unsigned long, const char *);
840extern void define_user_data
841  (struct res_id, struct res_id, const struct res_res_info *,
842   struct rcdata_item *);
843extern void define_user_file
844  (struct res_id, struct res_id, const struct res_res_info *, const char *);
845extern void define_versioninfo
846  (struct res_id, int, struct fixed_versioninfo *, struct ver_info *);
847extern struct ver_info *append_ver_stringfileinfo
848  (struct ver_info *, const char *, struct ver_stringinfo *);
849extern struct ver_info *append_ver_varfileinfo
850  (struct ver_info *, const char *, struct ver_varinfo *);
851extern struct ver_stringinfo *append_verval
852  (struct ver_stringinfo *, const char *, const char *);
853extern struct ver_varinfo *append_vertrans
854  (struct ver_varinfo *, unsigned long, unsigned long);
855