Better version autodetection.
[wine] / rc / parser.h
1 /*
2  *
3  * Copyright  Martin von Loewis, 1994
4  *
5  */
6
7 /* resource types */
8 enum rt {acc,bmp,cur,dlg,fnt,ico,men,rdt,str};
9 /* generic resource
10    Bytes can be inserted at arbitrary positions, the data field (res) 
11    grows as required. As the dialog header contains the number of 
12    controls, this number is generated in num_entries. If n_type if 0,
13    the resource name is i_name, and s_name otherwise. Top level
14    resources are linked via next. All gen_res objects are linked via
15    g_prev, g_next for debugging purposes. space is the length of res,
16    size is the used part of res.
17    As most bison rules are right recursive, new items are usually 
18    inserted at the beginning
19 */   
20 typedef struct gen_res{
21         int size,space;
22         int num_entries;
23         enum rt type;
24         union{
25                 int i_name;
26                 char* s_name;
27         }n;
28         int n_type; /*0 - integer, 1 = string*/
29         struct gen_res *next;
30         struct gen_res *g_prev,*g_next;
31         unsigned char res[0];
32 } gen_res;
33
34 /* control/dialog style. or collects styles, and collects NOT styles */
35 typedef struct rc_style{
36         int and, or;
37 }rc_style;
38
39 /* create a new resource */
40 gen_res *new_res(void);
41 /* double the space of the resource */
42 gen_res* grow(gen_res*);
43 /* insert byte array at the beginning, increase count */
44 gen_res* insert_at_beginning(gen_res*,char*,int);
45 /* insert byte array at offset */
46 gen_res* insert_bytes(gen_res*,char*,int,int);
47 /* delete bytes at offset */
48 gen_res* delete_bytes(gen_res*,int,int);
49 /* create a new style */
50 rc_style* new_style(void);
51 /* convert \t to tab etc. */
52 char* parse_c_string(char*);
53 /* get the resources type, convert dlg to "DIALOG" and so on */
54 char* get_typename(gen_res*);
55
56 gen_res* add_accelerator(int,int,int,gen_res*);
57 gen_res* add_string_accelerator(char*,int,int,gen_res*);
58 gen_res* add_ascii_accelerator(int,int,int,gen_res*);
59 gen_res* add_vk_accelerator(int,int,int,gen_res*);
60
61 gen_res* new_dialog(void);
62 gen_res* dialog_style(rc_style*,gen_res*);
63 int dialog_get_menu(gen_res*);
64 int dialog_get_class(gen_res*);
65 int dialog_get_caption(gen_res*);
66 int dialog_get_fontsize(gen_res*);
67 gen_res* dialog_caption(char*,gen_res*);
68 gen_res* dialog_font(short,char*,gen_res*);
69 gen_res* dialog_class(char*,gen_res*);
70 gen_res* dialog_menu_id(short,gen_res*);
71 gen_res* dialog_menu_str(char*,gen_res*);
72 gen_res* create_control_desc(int,int,int,int,int,rc_style*);
73 gen_res* label_control_desc(char*,gen_res*);
74 gen_res* create_generic_control(char*,int,char*,rc_style*,int,int,int,int);
75 gen_res* add_control(int,int,gen_res*,gen_res*);
76 gen_res* add_icon(char*,int,int,int,gen_res*,gen_res*);
77 gen_res* add_generic_control(gen_res*,gen_res*);
78 gen_res* make_dialog(gen_res*,int,int,int,int,gen_res*);
79
80 gen_res *hex_to_raw(char*,gen_res*);
81 gen_res *int_to_raw(int,gen_res*);
82 gen_res *make_font(gen_res*);
83 gen_res *make_raw(gen_res*);
84 gen_res *make_bitmap(gen_res*);
85 gen_res *make_icon(gen_res*);
86 gen_res *make_cursor(gen_res*);
87 gen_res *load_file(char*);
88
89 gen_res *add_menuitem(char*,int,int,gen_res*);
90 gen_res *add_popup(char*,short,gen_res*,gen_res*);
91 gen_res *make_menu(gen_res*);
92
93 gen_res *add_resource(gen_res*,gen_res*);
94
95 void add_str_tbl_elm(int,char*);
96
97 void create_output(gen_res*);
98 void set_out_file(char*);
99
100 #define CT_BUTTON       0x80
101 #define CT_EDIT         0x81
102 #define CT_STATIC       0x82
103 #define CT_LISTBOX      0x83
104 #define CT_SCROLLBAR 0x84
105 #define CT_COMBOBOX     0x85
106
107 extern int verbose;
108