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