wmctypes.h 3.3 KB

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