Release 1.5.29.
[wine] / tools / wmc / wmctypes.h
1 /*
2  * Main definitions and externals
3  *
4  * Copyright 2000 Bertho A. Stultiens (BS)
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WMC_WMCTYPES_H
22 #define __WMC_WMCTYPES_H
23
24 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27
28 /* Byteordering defines */
29 #define WMC_BO_NATIVE   0x00
30 #define WMC_BO_LITTLE   0x01
31 #define WMC_BO_BIG      0x02
32
33 #define WMC_LOBYTE(w)           ((WORD)(w) & 0xff)
34 #define WMC_HIBYTE(w)           (((WORD)(w) >> 8) & 0xff)
35 #define WMC_LOWORD(d)           ((DWORD)(d) & 0xffff)
36 #define WMC_HIWORD(d)           (((DWORD)(d) >> 16) & 0xffff)
37 #define BYTESWAP_WORD(w)        ((WORD)(((WORD)WMC_LOBYTE(w) << 8) + (WORD)WMC_HIBYTE(w)))
38 #define BYTESWAP_DWORD(d)       ((DWORD)(((DWORD)BYTESWAP_WORD(WMC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WMC_HIWORD(d)))))
39
40 /*
41  * Tokenizer types
42  */
43 typedef enum tok_enum {
44         tok_null = 0,
45         tok_keyword,
46         tok_severity,
47         tok_facility,
48         tok_language
49 } tok_e;
50
51 typedef struct token {
52         tok_e           type;
53         const WCHAR     *name;          /* Parsed name of token */
54         int             token;          /* Tokenvalue or language code */
55         int             codepage;
56         const WCHAR     *alias;         /* Alias or filename */
57         int             fixed;          /* Cleared if token may change */
58 } token_t;
59
60 typedef struct lan_cp {
61         int language;
62         int codepage;
63 } lan_cp_t;
64
65 typedef struct cp_xlat {
66         int     lan;
67         int     cpin;
68         int     cpout;
69 } cp_xlat_t;
70
71 typedef struct lanmsg {
72         int             lan;            /* Language code of message */
73         int             cp;             /* Codepage of message */
74         WCHAR           *msg;           /* Message text */
75         int             len;            /* Message length including trailing '\0' */
76         const char      *file;          /* File location for definition */
77         int             line;
78 } lanmsg_t;
79
80 typedef struct msg {
81         int             id;             /* Message ID */
82         unsigned        realid;         /* Combined message ID */
83         WCHAR           *sym;           /* Symbolic name */
84         int             sev;            /* Severity code */
85         int             fac;            /* Facility code */
86         lanmsg_t        **msgs;         /* Array message texts */
87         int             nmsgs;          /* Number of message texts in array */
88         int             base;           /* Base of number to print */
89         WCHAR           *cast;          /* Typecase to use */
90 } msg_t;
91
92 typedef enum {
93         nd_msg,
94         nd_comment
95 } node_e;
96
97 typedef struct node {
98         struct node     *next;
99         struct node     *prev;
100         node_e          type;
101         union {
102                 void    *all;
103                 WCHAR   *comment;
104                 msg_t   *msg;
105         } u;
106 } node_t;
107
108 typedef struct block {
109         unsigned        idlo;           /* Lowest ID in this set */
110         unsigned        idhi;           /* Highest ID in this set */
111         int             size;           /* Size of this set */
112         lanmsg_t        **msgs;         /* Array of messages in this set */
113         int             nmsg;           /* Number of array entries */
114 } block_t;
115
116 typedef struct lan_blk {
117         struct lan_blk  *next;          /* Linkage for languages */
118         struct lan_blk  *prev;
119         int             lan;            /* The language of this block */
120         int             version;        /* The resource version for auto-translated resources */
121         block_t         *blks;          /* Array of blocks for this language */
122         int             nblk;           /* Nr of blocks in array */
123 } lan_blk_t;
124
125 #endif