home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / mbclevel.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  93 lines

  1. /***
  2. *mbclevel.c - Tests if char is hiragana, katakana, alphabet or digit.
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       Tests for the various industry defined levels of Microsoft Kanji
  8. *       Code.
  9. *
  10. *******************************************************************************/
  11.  
  12. #ifdef _MBCS
  13.  
  14. #include <cruntime.h>
  15. #include <mbdata.h>
  16. #include <mbstring.h>
  17. #include <mbctype.h>
  18.  
  19.  
  20. /***
  21. *int _ismbcl0(c) - Tests if char is hiragana, katakana, alphabet or digit.
  22. *
  23. *Purpose:
  24. *       Tests if a given char is hiragana, katakana, alphabet, digit or symbol
  25. *       of Microsoft Kanji code.
  26. *
  27. *Entry:
  28. *       unsigned int c - Character to test.
  29. *
  30. *Exit:
  31. *       Returns non-zero if 0x8140 <= c <= 0x889E, else 0.
  32. *
  33. *Exceptions:
  34. *
  35. *******************************************************************************/
  36.  
  37. int __cdecl _ismbcl0(
  38.     unsigned int c
  39.     )
  40. {
  41.         return(__mbcodepage == _KANJI_CP && _ismbclegal(c) && c < 0x889f);
  42. }
  43.  
  44.  
  45. /***
  46. *int _ismbcl1(c) - Tests for 1st-level Microsoft Kanji code set.
  47. *
  48. *Purpose:
  49. *       Tests if a given char belongs to Microsoft 1st-level Kanji code set.
  50. *
  51. *Entry:
  52. *       unsigned int c - character to test.
  53. *
  54. *Exit:
  55. *       Returns non-zero if 1st-level, else 0.
  56. *
  57. *Exceptions:
  58. *
  59. *******************************************************************************/
  60.  
  61. int __cdecl _ismbcl1(
  62.     unsigned int c
  63.     )
  64. {
  65.         return(__mbcodepage == _KANJI_CP && _ismbclegal(c) && c >= 0x889f && c <= 0x9872);
  66. }
  67.  
  68.  
  69. /***
  70. *int _ismbcl2(c) - Tests for a 2nd-level Microsoft Kanji code character.
  71. *
  72. *Purpose:
  73. *       Tests if a given char belongs to the Microsoft 2nd-level Kanji code set.
  74. *
  75. *Entry:
  76. *       unsigned int c - character to test.
  77. *
  78. *Exit:
  79. *       Returns non-zero if 2nd-level, else 0.
  80. *
  81. *Exceptions:
  82. *
  83. *******************************************************************************/
  84.  
  85. int __cdecl _ismbcl2(
  86.     unsigned int c
  87.     )
  88. {
  89.         return(__mbcodepage == _KANJI_CP && _ismbclegal(c) && c >= 0x989f && c <= 0xEAA4);
  90. }
  91.  
  92. #endif  /* _MBCS */
  93.