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.

169 lines
4.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. //
  4. // Lextable.hpp
  5. //
  6. // History:
  7. // created 7/99 aarayas
  8. //
  9. // �1999 Microsoft Corporation
  10. //----------------------------------------------------------------------------
  11. #include "lextable.hpp"
  12. //+---------------------------------------------------------------------------
  13. //
  14. // Function: IsUpperPunctW
  15. //
  16. // Synopsis: Returns true if wc is a punctuation character in the upper
  17. // unicode range
  18. //
  19. // Parameters:
  20. //
  21. // Modifies:
  22. //
  23. // History: created 7/99 aarayas
  24. //
  25. // Notes:
  26. //
  27. //----------------------------------------------------------------------------
  28. BOOL IsUpperPunctW(const WCHAR wc)
  29. {
  30. BOOL fRet = FALSE;
  31. if ((wc & 0xff00) == 0x2000) // is Unicode punctuation
  32. {
  33. fRet = TRUE;
  34. }
  35. else
  36. {
  37. switch(wc)
  38. {
  39. case 0x01C3: // Yet another latin exclamation mark
  40. case 0x037E: // Greek question mark
  41. case 0x03D7: // greek question mark
  42. case 0x055C: // Armenian exclamation mark
  43. case 0x055E: // Armenian question mark
  44. case 0x0589: // armenian period
  45. case 0x061F: // Arabic question mark
  46. case 0x06d4: // arabic period
  47. case 0x2026: // horizontal ellipsis
  48. case 0x2029: // paragraph separator
  49. case 0x203C: // Double eclamation mark
  50. case 0x2762: // Heavy exclamation mark
  51. case 0x3002: // ideographic period
  52. case 0xFE52: // small period
  53. case 0xFE56: // Small question mark
  54. case 0xFE57: // Small exclamation mark
  55. case 0xFF01: // Fullwidth exclamation mark
  56. case 0xFF0E: // fullwidth period
  57. case 0xFF1F: // Fullwidth question mark
  58. case 0xFF61: // halfwidth ideographic period
  59. fRet = TRUE;
  60. break;
  61. }
  62. }
  63. return fRet;
  64. }
  65. //+---------------------------------------------------------------------------
  66. //
  67. // Function: IsUpperWordDelimW
  68. //
  69. // Synopsis: figures out whether an upper unicode char is a word delimiter
  70. //
  71. // Parameters:
  72. //
  73. // Modifies:
  74. //
  75. // History: created 7/99 aarayas
  76. //
  77. // Notes:
  78. //
  79. //----------------------------------------------------------------------------
  80. BOOL IsUpperWordDelimW(WCHAR wc)
  81. {
  82. return (wc & 0xfff0) == 0x2000 ||
  83. wc == 0x2026 || // ellipsis
  84. wc == 0x2013 || // en dash
  85. wc == 0x2014; // em dash
  86. }
  87. //+---------------------------------------------------------------------------
  88. //
  89. // Function: TWB_IsCharPunctW
  90. //
  91. // Synopsis: figures out whether charater is a punctuation
  92. //
  93. // Parameters:
  94. //
  95. // Modifies:
  96. //
  97. // History: created 7/99 aarayas
  98. //
  99. // Notes:
  100. //
  101. //----------------------------------------------------------------------------
  102. BOOL TWB_IsCharPunctW(WCHAR ch)
  103. {
  104. return INUPPERPAGES(ch) ? IsUpperPunctW(ch) : rgFlags[(UCHAR) ch] & Lex_PunctFlag;
  105. }
  106. //+---------------------------------------------------------------------------
  107. //
  108. // Function: TWB_IsCharPunctW
  109. //
  110. // Synopsis: figures out whether charater is a word delimiter
  111. //
  112. // Parameters:
  113. //
  114. // Modifies:
  115. //
  116. // History: created 7/99 aarayas
  117. //
  118. // Notes:
  119. //
  120. //----------------------------------------------------------------------------
  121. BOOL TWB_IsCharWordDelimW(WCHAR ch)
  122. {
  123. return INUPPERPAGES(ch) ? IsUpperWordDelimW(ch) : rgPunctFlags[(UCHAR) ch] & Lex_SpaceFlag;
  124. }
  125. //+---------------------------------------------------------------------------
  126. //
  127. // Function: IsThaiChar
  128. //
  129. // Synopsis: determine if the character is a Thai character
  130. //
  131. // Parameters:
  132. //
  133. // Modifies:
  134. //
  135. // History: created 7/99 aarayas
  136. //
  137. // Notes: 13/12/99 - take out Thai numbers as Thai Characters since
  138. // we want to consider them like english numbers.
  139. //
  140. //----------------------------------------------------------------------------
  141. bool IsThaiChar(const WCHAR wch)
  142. {
  143. return ( wch >= 0x0e01 && wch <= 0x0e59);
  144. }
  145. //+---------------------------------------------------------------------------
  146. //
  147. // Function: IsThaiNumeric
  148. //
  149. // Synopsis: determine if the character is a Thai character
  150. //
  151. // Parameters:
  152. //
  153. // Modifies:
  154. //
  155. // History: created 5/00 aarayas
  156. //
  157. //----------------------------------------------------------------------------
  158. bool IsThaiNumeric(const WCHAR wch)
  159. {
  160. return ( wch >= 0x0e50 && wch <= 0x0e59);
  161. }