/* windres.h -- header file for windres program.
- Copyright 1997 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-#include <ansidecl.h>
+#include "ansidecl.h"
/* This is the header file for the windres program. It defines
structures and declares functions used within the program. */
+#include "winduni.h"
+
/* We represent resources internally as a tree, similar to the tree
used in the .rsrc section of a COFF file. The root is a
res_directory structure. */
struct
{
/* Length of the name. */
- unsigned short length;
+ int length;
/* Pointer to the name, which is a Unicode string. */
- unsigned short *name;
+ unichar *name;
} n;
/* If the named field is zero, this is the ID. */
unsigned long id;
struct
{
unsigned long length;
- unsigned char *data;
+ const unsigned char *data;
} data;
struct accelerator *acc;
struct cursor *cursor;
struct dialog *dialog;
struct fontdir *fontdir;
struct group_icon *group_icon;
- struct menuitem *menu;
- struct rcdata_data *rcdata;
+ struct menu *menu;
+ struct rcdata_item *rcdata;
struct stringtable *stringtable;
- struct rcdata_data *userdata;
+ struct rcdata_item *userdata;
struct versioninfo *versioninfo;
} u;
/* Information from a res file. */
struct res_coff_info coff_info;
};
+#define SUBLANG_SHIFT 10
+
/* Memory flags in the memflags field of a struct res_resource. */
#define MEMFLAG_MOVEABLE 0x10
#define RT_STRING 6
#define RT_FONTDIR 7
#define RT_FONT 8
-#define RT_ACCELERATORS 9
+#define RT_ACCELERATOR 9
#define RT_RCDATA 10
#define RT_MESSAGETABLE 11
#define RT_GROUP_CURSOR 12
#define RT_GROUP_ICON 14
#define RT_VERSION 16
#define RT_DLGINCLUDE 17
-#define RT_PLUGPLAY 18
-#define RT_VXD 19
+#define RT_PLUGPLAY 19
+#define RT_VXD 20
#define RT_ANICURSOR 21
#define RT_ANIICON 22
/* Length of bitmap data. */
unsigned long length;
/* Data. */
- unsigned char *data;
+ const unsigned char *data;
};
/* A group_cursor resource is a list of group_cursor structures. */
/* Class name. */
struct res_id class;
/* Caption. */
- char *caption;
+ unichar *caption;
/* Font point size. */
unsigned short pointsize;
/* Font name. */
- char *font;
+ unichar *font;
/* Extended information for a dialogex. */
struct dialog_ex *ex;
/* Controls. */
/* Font weight. */
unsigned short weight;
/* Whether the font is italic. */
- unsigned short italic;
+ unsigned char italic;
+ /* Character set. */
+ unsigned char charset;
};
/* Window style flags, from the winsup Defines.h header file. These
/* Associated text. */
struct res_id text;
/* Extra data for the window procedure. */
- struct rcdata_data *data;
+ struct rcdata_item *data;
/* Help ID. Only used in an extended dialog. */
unsigned long help;
};
short index;
/* Length of font information. */
unsigned long length;
- /* Font information. */
- unsigned char *data;
+ /* Font information. */
+ const unsigned char *data;
};
/* A group_icon resource is a list of group_icon structures. */
unsigned short index;
};
+/* A menu resource. */
+
+struct menu
+{
+ /* List of menuitems. */
+ struct menuitem *items;
+ /* Help ID. I don't think there is any way to set this in an rc
+ file, but it can appear in the binary format. */
+ unsigned long help;
+};
+
/* A menu resource is a list of menuitem structures. */
struct menuitem
unsigned long state;
/* Id. */
unsigned short id;
- /* Text. */
- char *text;
+ /* Unicode text. */
+ unichar *text;
/* Popup menu items for a popup. */
struct menuitem *popup;
/* Help ID. This is only used in a menuex. */
#define MENUITEM_POPUP 0x010
#define MENUITEM_MENUBARBREAK 0x020
#define MENUITEM_MENUBREAK 0x040
+#define MENUITEM_ENDMENU 0x080
#define MENUITEM_HELP 0x4000
-/* An rcdata resource is a pointer to an rcdata_data structure. */
-
-struct rcdata_data
-{
- /* First data item. */
- struct rcdata_item *first;
- /* Last data item. */
- struct rcdata_item *last;
-};
-
-/* For an rcdata resource we keep a list of rcdata_item structures. */
+/* An rcdata resource is a pointer to a list of rcdata_item
+ structures. */
struct rcdata_item
{
{
unsigned int word;
unsigned long dword;
- char *string;
- unsigned short *wstring;
struct
{
unsigned long length;
- unsigned char *data;
+ const char *s;
+ } string;
+ struct
+ {
+ unsigned long length;
+ const unichar *w;
+ } wstring;
+ struct
+ {
+ unsigned long length;
+ const unsigned char *data;
} buffer;
} u;
};
struct
{
/* Length of string. */
- unsigned short length;
+ int length;
/* String data if length > 0. */
- unsigned short *string;
+ unichar *string;
} strings[16];
};
struct
{
/* Language. */
- unsigned short *language;
+ unichar *language;
/* Strings. */
struct ver_stringinfo *strings;
} string;
struct
{
/* Key. */
- unsigned short *key;
+ unichar *key;
/* Values. */
struct ver_varinfo *var;
} var;
/* Next string. */
struct ver_stringinfo *next;
/* Key. */
- unsigned short *key;
+ unichar *key;
/* Value. */
- unsigned short *value;
+ unichar *value;
};
/* A list of variable version information. */
unsigned short charset;
};
+/* This structure is used when converting resource information to
+ binary. */
+
+struct bindata
+{
+ /* Next data. */
+ struct bindata *next;
+ /* Length of data. */
+ unsigned long length;
+ /* Data. */
+ unsigned char *data;
+};
+
+extern int verbose;
+
/* Function declarations. */
extern struct res_directory *read_rc_file
- PARAMS ((const char *, const char *, const char *, int));
-extern struct res_directory *read_res_file PARAMS ((const char *));
-extern struct res_directory *read_coff_rsrc
- PARAMS ((const char *, const char *));
-extern void write_rc_file
- PARAMS ((const char *, const struct res_directory *));
-extern void write_res_file
- PARAMS ((const char *, const struct res_directory *));
+ (const char *, const char *, const char *, int, int);
+extern struct res_directory *read_res_file (const char *);
+extern struct res_directory *read_coff_rsrc (const char *, const char *);
+extern void write_rc_file (const char *, const struct res_directory *);
+extern void write_res_file (const char *, const struct res_directory *);
extern void write_coff_file
- PARAMS ((const char *, const char *, const struct res_directory *));
+ (const char *, const char *, const struct res_directory *);
-extern FILE *open_file_search
- PARAMS ((const char *, const char *, const char *, char **));
+extern struct res_resource *bin_to_res
+ (struct res_id, const unsigned char *, unsigned long, int);
+extern struct bindata *res_to_bin (const struct res_resource *, int);
-/* Resource ID handling. */
+extern FILE *open_file_search
+ (const char *, const char *, const char *, char **);
-extern int res_id_cmp PARAMS ((struct res_id, struct res_id));
-extern void res_id_print PARAMS ((FILE *, struct res_id, int));
-extern void res_ids_print PARAMS ((FILE *, int, const struct res_id *));
-extern void res_string_to_id PARAMS ((struct res_id *, const char *));
+extern void *res_alloc (size_t);
+extern void *reswr_alloc (size_t);
-/* Unicode support. */
+/* Resource ID handling. */
-extern void unicode_from_ascii
- PARAMS ((unsigned short *, unsigned short **, const char *));
-extern void unicode_print PARAMS ((FILE *, const unsigned short *, int));
+extern int res_id_cmp (struct res_id, struct res_id);
+extern void res_id_print (FILE *, struct res_id, int);
+extern void res_ids_print (FILE *, int, const struct res_id *);
+extern void res_string_to_id (struct res_id *, const char *);
/* Manipulation of the resource tree. */
extern struct res_resource *define_resource
- PARAMS ((struct res_directory **, int, const struct res_id *, int));
+ (struct res_directory **, int, const struct res_id *, int);
extern struct res_resource *define_standard_resource
- PARAMS ((struct res_directory **, int, struct res_id, int, int));
+ (struct res_directory **, int, struct res_id, int, int);
-extern int extended_dialog PARAMS ((const struct dialog *));
-extern int extended_menu PARAMS ((const struct menuitem *));
+extern int extended_dialog (const struct dialog *);
+extern int extended_menu (const struct menu *);
/* Communication between the rc file support and the parser and lexer. */
extern FILE *yyin;
extern char *rc_filename;
extern int rc_lineno;
-extern int yyparse PARAMS ((void));
-extern int yylex PARAMS ((void));
-extern void yyerror PARAMS ((const char *));
-extern void rcparse_warning PARAMS ((const char *));
-extern void rcparse_set_language PARAMS ((int));
+
+extern int yyparse (void);
+extern int yylex (void);
+extern void yyerror (const char *);
+extern void rcparse_warning (const char *);
+extern void rcparse_set_language (int);
+extern void rcparse_discard_strings (void);
+extern void rcparse_rcdata (void);
+extern void rcparse_normal (void);
extern void define_accelerator
- PARAMS ((struct res_id, const struct res_res_info *, struct accelerator *));
+ (struct res_id, const struct res_res_info *, struct accelerator *);
extern void define_bitmap
- PARAMS ((struct res_id, const struct res_res_info *, const char *));
+ (struct res_id, const struct res_res_info *, const char *);
extern void define_cursor
- PARAMS ((struct res_id, const struct res_res_info *, const char *));
+ (struct res_id, const struct res_res_info *, const char *);
extern void define_dialog
- PARAMS ((struct res_id, const struct res_res_info *, const struct dialog *));
+ (struct res_id, const struct res_res_info *, const struct dialog *);
extern struct dialog_control *define_control
- PARAMS ((char *, unsigned long, unsigned long, unsigned long,
- unsigned long, unsigned long, unsigned long, unsigned long,
- unsigned long));
+ (const struct res_id, unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
+extern struct dialog_control *define_icon_control
+ (struct res_id, unsigned long, unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, struct rcdata_item *, struct dialog_ex *);
extern void define_font
- PARAMS ((struct res_id, const struct res_res_info *, const char *));
+ (struct res_id, const struct res_res_info *, const char *);
extern void define_icon
- PARAMS ((struct res_id, const struct res_res_info *, const char *));
+ (struct res_id, const struct res_res_info *, const char *);
extern void define_menu
- PARAMS ((struct res_id, const struct res_res_info *, struct menuitem *));
+ (struct res_id, const struct res_res_info *, struct menuitem *);
extern struct menuitem *define_menuitem
- PARAMS ((char *, int, unsigned long, unsigned long, unsigned long,
- struct menuitem *));
+ (const char *, int, unsigned long, unsigned long, unsigned long,
+ struct menuitem *);
extern void define_messagetable
- PARAMS ((struct res_id, const struct res_res_info *, const char *));
+ (struct res_id, const struct res_res_info *, const char *);
extern void define_rcdata
- PARAMS ((struct res_id, const struct res_res_info *, struct rcdata_data *));
-extern struct rcdata_data *append_rcdata_item
- PARAMS ((struct rcdata_data *, struct rcdata_item *));
-extern struct rcdata_data *append_rcdata_string
- PARAMS ((struct rcdata_data *, char *));
-extern struct rcdata_data *append_rcdata_number
- PARAMS ((struct rcdata_data *, unsigned long, int));
+ (struct res_id, const struct res_res_info *, struct rcdata_item *);
+extern struct rcdata_item *define_rcdata_string
+ (const char *, unsigned long);
+extern struct rcdata_item *define_rcdata_number (unsigned long, int);
extern void define_stringtable
- PARAMS ((const struct res_res_info *, unsigned long, char *));
+ (const struct res_res_info *, unsigned long, const char *);
extern void define_user_data
- PARAMS ((struct res_id, struct res_id, const struct res_res_info *,
- struct rcdata_data *));
+ (struct res_id, struct res_id, const struct res_res_info *,
+ struct rcdata_item *);
extern void define_user_file
- PARAMS ((struct res_id, struct res_id, const struct res_res_info *,
- const char *));
+ (struct res_id, struct res_id, const struct res_res_info *, const char *);
extern void define_versioninfo
- PARAMS ((struct res_id, int, struct fixed_versioninfo *,
- struct ver_info *));
+ (struct res_id, int, struct fixed_versioninfo *, struct ver_info *);
extern struct ver_info *append_ver_stringfileinfo
- PARAMS ((struct ver_info *, char *, struct ver_stringinfo *));
+ (struct ver_info *, const char *, struct ver_stringinfo *);
extern struct ver_info *append_ver_varfileinfo
- PARAMS ((struct ver_info *, char *, struct ver_varinfo *));
+ (struct ver_info *, const char *, struct ver_varinfo *);
extern struct ver_stringinfo *append_verval
- PARAMS ((struct ver_stringinfo *, char *, char *));
+ (struct ver_stringinfo *, const char *, const char *);
extern struct ver_varinfo *append_vertrans
- PARAMS ((struct ver_varinfo *, unsigned long, unsigned long));
+ (struct ver_varinfo *, unsigned long, unsigned long);