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