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