Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

345 lines
16 KiB

  1. /************************************************************************/
  2. /* */
  3. /* RCPP - Resource Compiler Pre-Processor for NT system */
  4. /* */
  5. /* CHARMAP.C - Character mapping arrays */
  6. /* */
  7. /* 06-Dec-90 w-BrianM Update for NT from PM SDK RCPP */
  8. /* */
  9. /************************************************************************/
  10. #include "rc.h"
  11. //#include "rcpptype.h"
  12. //#include "charmap.h"
  13. #define CHARMAP_SIZE 256
  14. WCHAR Charmap[CHARMAP_SIZE] = {
  15. LX_EOS, /* 0x0, <end of string marker> */
  16. LX_ILL, /* 0x1 */
  17. LX_ILL, /* 0x2 */
  18. LX_ILL, /* 0x3 */
  19. LX_ILL, /* 0x4 */
  20. LX_ILL, /* 0x5 */
  21. LX_ILL, /* 0x6 */
  22. LX_ILL, /* 0x7 */
  23. LX_ILL, /* 0x8 */
  24. LX_WHITE, /* <horizontal tab> */
  25. LX_NL, /* <newline> */
  26. LX_WHITE, /* <vertical tab> */
  27. LX_WHITE, /* <form feed> */
  28. LX_CR, /* <really a carriage return> */
  29. LX_ILL, /* 0xe */
  30. LX_ILL, /* 0xf */
  31. LX_ILL, /* 0x10 */
  32. LX_ILL, /* 0x11 */
  33. LX_ILL, /* 0x12 */
  34. LX_ILL, /* 0x13 */
  35. LX_ILL, /* 0x14 */
  36. LX_ILL, /* 0x15 */
  37. LX_ILL, /* 0x16 */
  38. LX_ILL, /* 0x17 */
  39. LX_ILL, /* 0x18 */
  40. LX_ILL, /* 0x19 */
  41. LX_EOS, /* 0x1a, ^Z */
  42. LX_ILL, /* 0x1b */
  43. LX_ILL, /* 0x1c */
  44. LX_ILL, /* 0x1d */
  45. LX_ILL, /* 0x1e */
  46. LX_ILL, /* 0x1f */
  47. LX_WHITE, /* 0x20 */
  48. LX_BANG, /* ! */
  49. LX_DQUOTE, /* " */
  50. LX_POUND, /* # */
  51. LX_ASCII, /* $ */
  52. LX_PERCENT, /* % */
  53. LX_AND, /* & */
  54. LX_SQUOTE, /* ' */
  55. LX_OPAREN, /* ( */
  56. LX_CPAREN, /* ) */
  57. LX_STAR, /* * */
  58. LX_PLUS, /* + */
  59. LX_COMMA, /* , */
  60. LX_MINUS, /* - */
  61. LX_DOT, /* . */
  62. LX_SLASH, /* / */
  63. LX_NUMBER, /* 0 */
  64. LX_NUMBER, /* 1 */
  65. LX_NUMBER, /* 2 */
  66. LX_NUMBER, /* 3 */
  67. LX_NUMBER, /* 4 */
  68. LX_NUMBER, /* 5 */
  69. LX_NUMBER, /* 6 */
  70. LX_NUMBER, /* 7 */
  71. LX_NUMBER, /* 8 */
  72. LX_NUMBER, /* 9 */
  73. LX_COLON, /* : */
  74. LX_SEMI, /* ; */
  75. LX_LT, /* < */
  76. LX_EQ, /* = */
  77. LX_GT, /* > */
  78. LX_QUEST, /* ? */
  79. LX_EACH, /* @ */
  80. LX_ID, /* A */
  81. LX_ID, /* B */
  82. LX_ID, /* C */
  83. LX_ID, /* D */
  84. LX_ID, /* E */
  85. LX_ID, /* F */
  86. LX_ID, /* G */
  87. LX_ID, /* H */
  88. LX_ID, /* I */
  89. LX_ID, /* J */
  90. LX_ID, /* K */
  91. LX_ID, /* L */
  92. LX_ID, /* M */
  93. LX_ID, /* N */
  94. LX_ID, /* O */
  95. LX_ID, /* P */
  96. LX_ID, /* Q */
  97. LX_ID, /* R */
  98. LX_ID, /* S */
  99. LX_ID, /* T */
  100. LX_ID, /* U */
  101. LX_ID, /* V */
  102. LX_ID, /* W */
  103. LX_ID, /* X */
  104. LX_ID, /* Y */
  105. LX_ID, /* Z */
  106. LX_OBRACK, /* [ */
  107. LX_EOS, /* \ */
  108. LX_CBRACK, /* ] */
  109. LX_HAT, /* ^ */
  110. LX_ID, /* _ */
  111. LX_ASCII, /* ` */
  112. LX_ID, /* a */
  113. LX_ID, /* b */
  114. LX_ID, /* c */
  115. LX_ID, /* d */
  116. LX_ID, /* e */
  117. LX_ID, /* f */
  118. LX_ID, /* g */
  119. LX_ID, /* h */
  120. LX_ID, /* i */
  121. LX_ID, /* j */
  122. LX_ID, /* k */
  123. LX_ID, /* l */
  124. LX_ID, /* m */
  125. LX_ID, /* n */
  126. LX_ID, /* o */
  127. LX_ID, /* p */
  128. LX_ID, /* q */
  129. LX_ID, /* r */
  130. LX_ID, /* s */
  131. LX_ID, /* t */
  132. LX_ID, /* u */
  133. LX_ID, /* v */
  134. LX_ID, /* w */
  135. LX_ID, /* x */
  136. LX_ID, /* y */
  137. LX_ID, /* z */
  138. LX_OBRACE, /* { */
  139. LX_OR, /* | */
  140. LX_CBRACE, /* } */
  141. LX_TILDE, /* ~ */
  142. LX_ILL, /* 0x7f */
  143. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  144. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  145. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  146. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  147. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  148. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  149. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  150. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  151. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  152. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  153. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  154. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  155. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  156. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  157. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  158. LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL, LX_ILL,
  159. };
  160. WCHAR Contmap[CHARMAP_SIZE] = {
  161. LXC_SPECIAL, /* 0x0, <end of string marker> */
  162. 0, /* 0x1 */
  163. 0, /* 0x2 */
  164. 0, /* 0x3 */
  165. 0, /* 0x4 */
  166. 0, /* 0x5 */
  167. 0, /* <end of buffer marker> */
  168. 0, /* 0x7 */
  169. 0, /* 0x8 */
  170. LXC_WHITE, /* <horizontal tab> */
  171. LXC_SPECIAL, /* <newline>, this is NOT considered whitespace */
  172. LXC_WHITE, /* <vertical tab> */
  173. LXC_WHITE, /* <form feed> */
  174. 0, /* <really a carriage return> */
  175. 0, /* 0xe */
  176. 0, /* 0xf */
  177. 0, /* 0x10 */
  178. 0, /* 0x11 */
  179. 0, /* 0x12 */
  180. 0, /* 0x13 */
  181. 0, /* 0x14 */
  182. 0, /* 0x15 */
  183. 0, /* 0x16 */
  184. 0, /* 0x17 */
  185. 0, /* 0x18 */
  186. 0, /* 0x19 */
  187. LXC_SPECIAL, /* 0x1a */
  188. 0, /* 0x1b */
  189. 0, /* 0x1c */
  190. 0, /* 0x1d */
  191. 0, /* 0x1e */
  192. 0, /* 0x1f */
  193. LXC_WHITE, /* 0x20 */
  194. 0, /* ! */
  195. 0, /* " */
  196. 0, /* # */
  197. 0, /* $ */
  198. 0, /* % */
  199. 0, /* & */
  200. 0, /* ' */
  201. 0, /* ( */
  202. 0, /* ) */
  203. LXC_SPECIAL, /* * */
  204. 0, /* + */
  205. 0, /* , */
  206. 0, /* - */
  207. 0, /* . */
  208. 0, /* / */
  209. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT | LXC_BDIGIT, /* 0 */
  210. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT | LXC_BDIGIT, /* 1 */
  211. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT, /* 2 */
  212. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT, /* 3 */
  213. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT, /* 4 */
  214. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT, /* 5 */
  215. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT, /* 6 */
  216. LXC_ID | LXC_XDIGIT | LXC_DIGIT | LXC_ODIGIT, /* 7 */
  217. LXC_ID | LXC_XDIGIT | LXC_DIGIT, /* 8 */
  218. LXC_ID | LXC_XDIGIT | LXC_DIGIT, /* 9 */
  219. 0, /* : */
  220. 0, /* ; */
  221. 0, /* < */
  222. 0, /* = */
  223. 0, /* > */
  224. 0, /* ? */
  225. 0, /* @ */
  226. LXC_ID | LXC_XDIGIT, /* A */
  227. LXC_ID | LXC_XDIGIT | LXC_RADIX, /* B */
  228. LXC_ID | LXC_XDIGIT, /* C */
  229. LXC_ID | LXC_XDIGIT | LXC_RADIX, /* D */
  230. LXC_ID | LXC_XDIGIT, /* E */
  231. LXC_ID | LXC_XDIGIT, /* F */
  232. LXC_ID, /* G */
  233. LXC_ID | LXC_RADIX, /* H */
  234. LXC_ID, /* I */
  235. LXC_ID, /* J */
  236. LXC_ID, /* K */
  237. LXC_ID, /* L */
  238. LXC_ID, /* M */
  239. LXC_ID, /* N */
  240. LXC_ID | LXC_RADIX, /* O */
  241. LXC_ID, /* P */
  242. LXC_ID | LXC_RADIX, /* Q */
  243. LXC_ID, /* R */
  244. LXC_ID, /* S */
  245. LXC_ID, /* T */
  246. LXC_ID, /* U */
  247. LXC_ID, /* V */
  248. LXC_ID, /* W */
  249. LXC_ID, /* X */
  250. LXC_ID, /* Y */
  251. LXC_ID, /* Z */
  252. 0, /* [ */
  253. 0, /* \ */
  254. 0, /* ] */
  255. 0, /* ^ */
  256. LXC_ID, /* _ */
  257. 0, /* ` */
  258. LXC_ID | LXC_XDIGIT, /* a */
  259. LXC_ID | LXC_XDIGIT | LXC_RADIX, /* b */
  260. LXC_ID | LXC_XDIGIT, /* c */
  261. LXC_ID | LXC_XDIGIT | LXC_RADIX, /* d */
  262. LXC_ID | LXC_XDIGIT, /* e */
  263. LXC_ID | LXC_XDIGIT, /* f */
  264. LXC_ID, /* g */
  265. LXC_ID | LXC_RADIX, /* h */
  266. LXC_ID, /* i */
  267. LXC_ID, /* j */
  268. LXC_ID, /* k */
  269. LXC_ID, /* l */
  270. LXC_ID, /* m */
  271. LXC_ID, /* n */
  272. LXC_ID | LXC_RADIX, /* o */
  273. LXC_ID, /* p */
  274. LXC_ID | LXC_RADIX, /* q */
  275. LXC_ID, /* r */
  276. LXC_ID, /* s */
  277. LXC_ID, /* t */
  278. LXC_ID, /* u */
  279. LXC_ID, /* v */
  280. LXC_ID, /* w */
  281. LXC_ID, /* x */
  282. LXC_ID, /* y */
  283. LXC_ID, /* z */
  284. 0, /* { */
  285. 0, /* | */
  286. 0, /* } */
  287. 0, /* ~ */
  288. 0, /* 0x7f */
  289. };
  290. WCHAR
  291. GetCharMap (
  292. WCHAR c
  293. )
  294. {
  295. if (c == 0xFEFF) // Byte Order Mark
  296. return (LX_BOM);
  297. else if (c > CHARMAP_SIZE)
  298. return (LX_ID); // character beyond the ANSI set
  299. return (Charmap[c]);
  300. }
  301. void
  302. SetCharMap (
  303. WCHAR c,
  304. WCHAR val
  305. )
  306. {
  307. if (c > CHARMAP_SIZE)
  308. return;
  309. Charmap[((UCHAR)(c))] = val;
  310. }
  311. WCHAR
  312. GetContMap (
  313. WCHAR c
  314. )
  315. {
  316. if (c > CHARMAP_SIZE)
  317. return (LXC_ID); // character beyong the ANSI set
  318. return (Contmap[c]);
  319. }
  320. void
  321. SetContMap (
  322. WCHAR c,
  323. WCHAR val
  324. )
  325. {
  326. if (c > CHARMAP_SIZE)
  327. return;
  328. Contmap[c] = val;
  329. }