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

  1. /***
  2. *mbdata.h - MBCS lib data
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       Defines data for use when building MBCS libs and routines
  8. *
  9. *       [Internal].
  10. *
  11. ****/
  12.  
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif  /* _MSC_VER > 1000 */
  16.  
  17. #ifndef _INC_MBDATA
  18. #define _INC_MBDATA
  19.  
  20. #ifndef _CRTBLD
  21. /*
  22.  * This is an internal C runtime header file. It is used when building
  23.  * the C runtimes only. It is not to be used as a public header file.
  24.  */
  25. #error ERROR: Use of C runtime library internal header file.
  26. #endif  /* _CRTBLD */
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif  /* __cplusplus */
  31.  
  32. #if defined (_WIN32)
  33.  
  34. #define NUM_ULINFO 6 /* multibyte full-width-latin upper/lower info */
  35.  
  36. #else  /* defined (_WIN32) */
  37.  
  38. #define NUM_ULINFO 12 /* multibyte full-width-latin upper/lower info */
  39.  
  40. #endif  /* defined (_WIN32) */
  41.  
  42. /* global variable to indicate current code page */
  43. extern int __mbcodepage;
  44.  
  45. /* global flag indicating if the current code page is a multibyte code page */
  46. extern int __ismbcodepage;
  47.  
  48. #if defined (_WIN32)
  49. /* global variable to indicate current LCID */
  50. extern int __mblcid;
  51. #endif  /* defined (_WIN32) */
  52.  
  53. /* global variable to indicate current full-width-latin upper/lower info */
  54. extern unsigned short __mbulinfo[NUM_ULINFO];
  55.  
  56. /*
  57.  * MBCS - Multi-Byte Character Set
  58.  */
  59.  
  60. /*
  61.  * general use macros for model dependent/independent versions.
  62.  */
  63.  
  64. #define _ISMBCP     (__ismbcodepage != 0)
  65. #define _ISNOTMBCP  (__ismbcodepage == 0)
  66.  
  67. #define _ISLEADBYTE(c)  _ismbblead(c)
  68. #define _ISTRAILBYTE(c) _ismbbtrail(c)
  69.  
  70. #define _ismbbtruelead(_lb,_ch) (!(_lb) && _ismbblead((_ch)))
  71.  
  72. /* internal use macros since tolower/toupper are locale-dependent */
  73. #define _mbbisupper(_c) ((_mbctype[(_c) + 1] & _SBUP) == _SBUP)
  74. #define _mbbislower(_c) ((_mbctype[(_c) + 1] & _SBLOW) == _SBLOW)
  75.  
  76. #define _mbbtolower(_c) (_mbbisupper(_c) ? _mbcasemap[_c] : _c)
  77. #define _mbbtoupper(_c) (_mbbislower(_c) ? _mbcasemap[_c] : _c)
  78.  
  79.  
  80. /* define full-width-latin upper/lower ranges */
  81.  
  82. #define _MBUPPERLOW1    __mbulinfo[0]
  83. #define _MBUPPERHIGH1   __mbulinfo[1]
  84. #define _MBCASEDIFF1    __mbulinfo[2]
  85.  
  86. #define _MBUPPERLOW2    __mbulinfo[3]
  87. #define _MBUPPERHIGH2   __mbulinfo[4]
  88. #define _MBCASEDIFF2    __mbulinfo[5]
  89.  
  90. #if !defined (_WIN32)
  91.  
  92. #define _MBLOWERLOW1    __mbulinfo[6]
  93. #define _MBLOWERHIGH1   __mbulinfo[7]
  94.  
  95. #define _MBLOWERLOW2    __mbulinfo[8]
  96. #define _MBLOWERHIGH2   __mbulinfo[9]
  97.  
  98. #define _MBDIGITLOW     __mbulinfo[10]
  99. #define _MBDIGITHIGH    __mbulinfo[11]
  100.  
  101. #endif  /* !defined (_WIN32) */
  102.  
  103. /* Kanji-specific ranges */
  104. #define _MBHIRALOW      0x829f  /* hiragana */
  105. #define _MBHIRAHIGH     0x82f1
  106.  
  107. #define _MBKATALOW      0x8340  /* katakana */
  108. #define _MBKATAHIGH     0x8396
  109. #define _MBKATAEXCEPT   0x837f  /* exception */
  110.  
  111. #define _MBKIGOULOW     0x8141  /* kanji punctuation */
  112. #define _MBKIGOUHIGH    0x81ac
  113. #define _MBKIGOUEXCEPT  0x817f  /* exception */
  114.  
  115. #ifdef __cplusplus
  116. }
  117. #endif  /* __cplusplus */
  118.  
  119. #endif  /* _INC_MBDATA */
  120.