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