home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / dbcsstr.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  5KB  |  169 lines

  1. /**********************************************
  2. *     Microsoft System Management Server      *
  3. *     Copyright(c) Microsoft Corp., 1994      *
  4. **********************************************/
  5.  
  6. /* DBCS definitions
  7. //    dbcsstr.h - Definistions about DBCS
  8. //
  9. // Purpose:
  10. //    contains DBCS unique table and
  11. //    definition of checking for DBCS character.
  12. //
  13. // Revision History:
  14. //    02/14/94    MSKK Tetsua Initial version
  15. //    03/22/94    MSKK Atsusk
  16. //                     change strupr to _strupr, strlwr to _strlwr, and so on.
  17. */
  18.  
  19. #ifndef _DBCSSTR_INCLUDED_
  20. #define _DBCSSTR_INCLUDED_
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25.  
  26. extern  unsigned char _DBCSLeadByteTable[];
  27.  
  28. #ifdef __TURBOC__
  29.   #if (__TURBOC__ < 0x300)
  30.     #define _OS2
  31.     #define _far far
  32.   #endif
  33. #endif
  34.  
  35. #if defined(_M_I86MM) || defined(_M_I86LM)    /* for MSC */ \
  36.  || defined(__MEDIUM__) || defined(__LARGE__) /* for TC/BC */   /* far code */
  37. #define __FAR__ _far
  38. #else
  39. #define __FAR__
  40. #endif
  41.  
  42. int __FAR__ WHATISCHAR( const char __FAR__ *, const unsigned int );
  43. int __FAR__ _GetSystemDrive( void );
  44.  
  45.  
  46. char __FAR__ * __FAR__ __mbsncpy( char __FAR__ *, const char __FAR__ *, int );
  47. char __FAR__ * __FAR__ __mbsncat( char __FAR__ *, const char __FAR__ *, int );
  48. int __FAR__ __mbsicmp( const char __FAR__ *, const char __FAR__ * );
  49. int __FAR__ __mbsnicmp( const char __FAR__ *, const char __FAR__ *, int );
  50.  
  51.  
  52. #define ISDBCS(c) ((_DBCSLeadByteTable)[(unsigned char) (c)])
  53. #ifndef _CHAR_DBCS_INCLUDED_
  54. #define _CHAR_DBCS_INCLUDED_
  55. #define CHAR_SBCS 0
  56. #define CHAR_DBCS_LEAD  1
  57. #define CHAR_DBCS_TAIL  2
  58. #endif  /* _CHAR_DBCS_INCLUDED_ */
  59.  
  60. //JAPAN start
  61. /* for Single Byte Japanese Character */
  62. #define ISKANA(c) (0x0A0 <= (c) && 0x0DF >= (c))
  63. //JAPAN end
  64.  
  65.  
  66. /*
  67. // The following string functions should use
  68. // multi-bytes string functions.
  69. // So, we should defined the followings.
  70. */
  71.  
  72. #if defined(_NTWIN) || defined(_NTCONSOLE) || defined(WIN32)
  73. #include  <mbstring.h>
  74. #define strstr(s1,s2) (char *)_mbsstr((unsigned char *)s1, (unsigned char *)s2)
  75. #define strchr(s1,i1) (char *)_mbschr((unsigned char *)s1, i1)
  76. #define strtok(s1,s2) (char *)_mbstok((unsigned char *)s1, (unsigned char *)s2)
  77. #define strcspn(s1,s2)  _mbscspn((unsigned char *)s1, (unsigned char *)s2)
  78. #define strpbrk(s1,s2)  (char *)_mbspbrk((unsigned char *)s1, (unsigned char *)s2)
  79. #define strspn(s1,s2) _mbsspn((unsigned char *)s1, (unsigned char *)s2)
  80. #define _strupr(s1) (char *)_mbsupr((unsigned char *)s1)
  81. #define _strlwr(s1) (char *)_mbslwr((unsigned char *)s1)
  82. #define _strrev(s1) (char *)_mbsrev((unsigned char *)s1)
  83. #define _stricmp(s1,s2) _mbsicmp((unsigned char *)s1, (unsigned char *)s2)
  84. #define _strcmpi(s1,s2) _mbsicmp((unsigned char *)s1, (unsigned char *)s2)
  85. #define strrchr(s1,i1)  (char *)_mbsrchr((unsigned char *)s1, i1)
  86. /*
  87. #define _strnicmp _mbsnicmp
  88. #define strlen  _mbslen
  89. #define strcat  _mbscat
  90. #define strcpy  _mbscpy
  91. #define strcmp  _mbscmp
  92. #define _strset _mbsset
  93. #define strncat _mbsncat
  94. #define strncpy _mbsncpy
  95. #define strncmp _mbsncmp
  96. #define _strnset  _mbsnset
  97. */
  98. #elif (defined(_DOS) || defined(_WINDOWS)) && !defined(_OS2)
  99. #include  <mbstring.h>
  100. #define strstr  _mbsstr
  101. #define strchr  _mbschr
  102. #define strtok  _mbstok
  103. #define strcspn _mbscspn
  104. #define strpbrk _mbspbrk
  105. #define strspn  _mbsspn
  106. #define _strupr _mbsupr
  107. #define _strlwr _mbslwr
  108. #define _strrev _mbsrev
  109. #define _stricmp  _mbsicmp
  110. #define _strcmpi  _mbsicmp
  111. #define strrchr _mbsrchr
  112. #define _fstrstr  _fmbsstr
  113. #define _fstrchr  _fmbschr
  114. #define _fstrtok  _fmbstok
  115. #define _fstrupr _fmbsupr
  116. #define _fstrlwr _fmbslwr
  117. #define _fstricmp  _fmbsicmp
  118. #define _fstrcmpi  _fmbsicmp
  119. #define _fstrrchr _fmbsrchr
  120. /*
  121. #define _strnicmp _mbsnicmp
  122. #define strlen  _mbslen
  123. #define strcat  _mbscat
  124. #define strcpy  _mbscpy
  125. #define strcmp  _mbscmp
  126. #define _strset _mbsset
  127. #define strncat _mbsncat
  128. #define strncpy _mbsncpy
  129. #define strncmp _mbsncmp
  130. #define _strnset  _mbsnset
  131. */
  132. #elif defined(_OS2)
  133. #include  <jstring.h>
  134. #define strstr
  135. #define strchr  jstrchr
  136. #define strtok  jstrtok
  137. #define strcspn
  138. #define strpbrk
  139. #define strspn
  140. #define _strupr
  141. #define _strlwr
  142. #define _strrev
  143. #define stricmp __mbsicmp
  144. #define strcmpi __mbsicmp
  145. #define _strnicmp
  146. #define strrchr
  147. /*
  148. #define strlen  _mbslen
  149. #define strcat  _mbscat
  150. #define strcpy  _mbscpy
  151. #define strcmp  _mbscmp
  152. #define _strset _mbsset
  153. #define strncat _mbsncat
  154. #define strncpy _mbsncpy
  155. #define strncmp _mbsncmp
  156. #define _strnset  _mbsnset
  157. */
  158. #else
  159. #error not defined _DOS, _OS2, or _NTWIN
  160. #endif
  161.  
  162. #ifdef __cplusplus
  163. }
  164. #endif
  165.  
  166. #endif  /* _DBCSSTR_INCLUDED_ */
  167.  
  168. /*** End of 'dbcsstr.h' ***/
  169.