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.

95 lines
2.2 KiB

  1. /***
  2. *ismbcknj.c - contains the Kanji specific is* functions.
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Provide non-portable Kanji support for MBCS libs.
  8. *
  9. *Revision History:
  10. * 11-19-92 KRS Ported from 16-bit sources.
  11. * 09-24-93 CFW Removed #ifdef _KANJI
  12. * 10-05-93 GJF Replaced _CRTAPI1 with __cdecl.
  13. * 10-22-93 CFW Kanji-specific is*() functions return 0 outside Japan.
  14. *
  15. *******************************************************************************/
  16. #ifdef _MBCS
  17. #include <cruntime.h>
  18. #include <mbdata.h>
  19. #include <mbstring.h>
  20. #include <mbctype.h>
  21. /***
  22. *int _ismbchira(c) - test character for hiragana (Japanese)
  23. *
  24. *Purpose:
  25. * Test if the character c is a hiragana character.
  26. *
  27. *Entry:
  28. * unsigned int c - character to test
  29. *
  30. *Exit:
  31. * returns TRUE if CP == KANJI and character is hiragana, else FALSE
  32. *
  33. *Exceptions:
  34. *
  35. *******************************************************************************/
  36. int __cdecl _ismbchira(c)
  37. unsigned int c;
  38. {
  39. return(__mbcodepage == _KANJI_CP && c >= 0x829f && c <= 0x82f1);
  40. }
  41. /***
  42. *int _ismbckata(c) - test character for katakana (Japanese)
  43. *
  44. *Purpose:
  45. * Tests to see if the character c is a katakana character.
  46. *
  47. *Entry:
  48. * unsigned int c - character to test
  49. *
  50. *Exit:
  51. * Returns TRUE if CP == KANJI and c is a katakana character, else FALSE.
  52. *
  53. *Exceptions:
  54. *
  55. *******************************************************************************/
  56. int __cdecl _ismbckata(c)
  57. unsigned int c;
  58. {
  59. return(__mbcodepage == _KANJI_CP && c >= 0x8340 && c <= 0x8396 && c != 0x837f);
  60. }
  61. /***
  62. *int _ismbcsymbol(c) - Tests if char is punctuation or symbol of Microsoft Kanji
  63. * code.
  64. *
  65. *Purpose:
  66. * Returns non-zero if the character is kanji punctuation.
  67. *
  68. *Entry:
  69. * unsigned int c - character to be tested
  70. *
  71. *Exit:
  72. * Returns non-zero if CP == KANJI and the specified char is punctuation or symbol of
  73. * Microsoft Kanji code, else 0.
  74. *
  75. *Exceptions:
  76. *
  77. *******************************************************************************/
  78. int __cdecl _ismbcsymbol(c)
  79. unsigned int c;
  80. {
  81. return(__mbcodepage == _KANJI_CP && c >= 0x8141 && c <= 0x81ac && c != 0x817f);
  82. }
  83. #endif /* _MBCS */