Leaked source code of windows server 2003
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.

105 lines
4.3 KiB

  1. /*
  2. ** charmap.h : P0 specific, also included by charmap.c
  3. ** it defines the mapping used to go from simple chars to these predefined
  4. ** values. this enables the compiler to use a compact switch stmt.
  5. ** they have been grouped in what is believed to be the most beneficial
  6. ** way, in that most switches will be checking those values which have
  7. ** been grouped together.
  8. */
  9. #define EOS_CHAR L'\0' /* end of string/buffer marker char */
  10. #define LX_WHITE 0
  11. #define LX_CR 1
  12. #define LX_SLASH 2 /* /, /=, comment start */
  13. #define LX_EOS 3
  14. #define LX_STAR 4 /* *, *=, comment stop */
  15. #define LX_NL 5
  16. #define LX_BACKSLASH 6
  17. #define LX_SQUOTE 7
  18. #define LX_DQUOTE 8
  19. #define LX_DOT 9 /* . ... */
  20. #define LX_BANG 10 /* ! != */
  21. #define LX_POUND 11 /* # ## */
  22. #define LX_PERCENT 12 /* % %= */
  23. #define LX_EQ 13 /* = == */
  24. #define LX_HAT 14 /* ^ ^= */
  25. #define LX_OR 15 /* | |= || */
  26. #define LX_AND 16 /* & && &= */
  27. #define LX_PLUS 17 /* + ++ += */
  28. #define LX_MINUS 18 /* - -- -= -> */
  29. #define LX_LT 19 /* < << <<= <= */
  30. #define LX_GT 20 /* > >= >> >>= */
  31. #define LX_LSHIFT 21 /* << */
  32. #define LX_RSHIFT 22 /* >> */
  33. #define LX_ILL 23
  34. #define LX_CBRACE 24
  35. #define LX_CBRACK 25
  36. #define LX_COLON 26
  37. #define LX_COMMA 27
  38. #define LX_CPAREN 28
  39. #define LX_NUMBER 29
  40. #define LX_OBRACE 30
  41. #define LX_OBRACK 31
  42. #define LX_OPAREN 32
  43. #define LX_QUEST 33
  44. #define LX_SEMI 34
  45. #define LX_TILDE 35
  46. #define LX_MACFORMAL 36
  47. #define LX_STRFORMAL 37
  48. #define LX_CHARFORMAL 38
  49. #define LX_NOEXPAND 39
  50. #define LX_ID 40
  51. #define LX_EACH 41
  52. #define LX_LEADBYTE 42
  53. #define LX_ASCII 43 /* to use for 'non-illegal' illegals */
  54. #define LX_BOM 44 /* Byte Order Mark */
  55. #define LX_FORMALMARK 0x01
  56. #define LX_FORMALSTR 0x02
  57. #define LX_FORMALCHAR 0x03
  58. #define LX_NOEXPANDMARK 0x04
  59. #define CONTROL_Z 0x1a
  60. /*
  61. ** Charmap is indexed with a character value plus the above offset
  62. */
  63. #define CHARMAP(c) GetCharMap(c)
  64. #define SETCHARMAP(c,val) SetCharMap(c, val)
  65. #define LX_IS_IDENT(c) (CHARMAP(c) == LX_ID)
  66. #define LX_IS_WHITE(c) (CHARMAP(c) == LX_WHITE)
  67. #define LX_IS_NUMBER(c) (CHARMAP(c) == LX_NUMBER)
  68. #define LXC_BDIGIT 0x01 /* 0 - 1 */
  69. #define LXC_ODIGIT 0x02 /* 0 - 7 */
  70. #define LXC_DIGIT 0x04 /* 0 - 9 */
  71. #define LXC_XDIGIT 0x08 /* a-f A-F 0-9 */
  72. #define LXC_ID 0x10 /* continuation is part of an identifier */
  73. #define LXC_RADIX 0x20 /* BbDdHhOoQq */
  74. #define LXC_WHITE 0x40 /* whitespace */
  75. #define LXC_SPECIAL 0x80 /* the char may have a special meaning */
  76. #define CONTMAP(c) GetContMap(c)
  77. #define SETCONTMAP(c, val) SetContMap(c, val)
  78. /*
  79. ** LXC_IS_ID(c) : is c part of an identifier
  80. */
  81. #define LXC_IS_BDIGIT(c) (CONTMAP(c) & LXC_BDIGIT)
  82. #define LXC_IS_ODIGIT(c) (CONTMAP(c) & LXC_ODIGIT)
  83. #define LXC_IS_DIGIT(c) (CONTMAP(c) & LXC_DIGIT)
  84. #define LXC_IS_XDIGIT(c) (CONTMAP(c) & LXC_XDIGIT)
  85. #define LXC_IS_IDENT(c) (CONTMAP(c) & LXC_ID)
  86. #define LXC_IS_RADIX(c) (CONTMAP(c) & LXC_RADIX)
  87. #define LXC_IS_WHITE(c) (CONTMAP(c) & LXC_WHITE)
  88. #define IS_SPECIAL(c) (CONTMAP(c) & LXC_SPECIAL)
  89. // Function prototypes
  90. WCHAR GetCharMap (WCHAR);
  91. void SetCharMap (WCHAR, WCHAR);
  92. WCHAR GetContMap (WCHAR);
  93. void SetContMap (WCHAR, WCHAR);
  94.