home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / dbcsstr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  4.7 KB  |  171 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. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  21. #define _DBCSSTR_INCLUDED_
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. extern  unsigned char _DBCSLeadByteTable[];
  28.  
  29. #ifdef __TURBOC__
  30.   #if (__TURBOC__ < 0x300)
  31.     #define _OS2
  32.     #define _far far
  33.   #endif
  34. #endif
  35.  
  36. #if defined(_M_I86MM) || defined(_M_I86LM)    /* for MSC */ \
  37.  || defined(__MEDIUM__) || defined(__LARGE__) /* for TC/BC */   /* far code */
  38. #define __FAR__ _far
  39. #else
  40. #define __FAR__
  41. #endif
  42.  
  43. int __FAR__ WHATISCHAR( const char __FAR__ *, const unsigned int );
  44. int __FAR__ _GetSystemDrive( void );
  45.  
  46.  
  47. char __FAR__ * __FAR__ __mbsncpy( char __FAR__ *, const char __FAR__ *, int );
  48. char __FAR__ * __FAR__ __mbsncat( char __FAR__ *, const char __FAR__ *, int );
  49. int __FAR__ __mbsicmp( const char __FAR__ *, const char __FAR__ * );
  50. int __FAR__ __mbsnicmp( const char __FAR__ *, const char __FAR__ *, int );
  51.  
  52.  
  53. #define ISDBCS(c) ((_DBCSLeadByteTable)[(unsigned char) (c)])
  54. #ifndef _CHAR_DBCS_INCLUDED_
  55. #define _CHAR_DBCS_INCLUDED_
  56. #define CHAR_SBCS 0
  57. #define CHAR_DBCS_LEAD  1
  58. #define CHAR_DBCS_TAIL  2
  59. #endif  /* _CHAR_DBCS_INCLUDED_ */
  60.  
  61. //JAPAN start
  62. /* for Single Byte Japanese Character */
  63. #define ISKANA(c) (0x0A0 <= (c) && 0x0DF >= (c))
  64. //JAPAN end
  65.  
  66.  
  67. /*
  68. // The following string functions should use
  69. // multi-bytes string functions.
  70. // So, we should defined the followings.
  71. */
  72.  
  73. #if defined(_NTWIN) || defined(_NTCONSOLE) || defined(WIN32)
  74. #include  <mbstring.h>
  75. #define strstr(s1,s2) (char *)_mbsstr((unsigned char *)s1, (unsigned char *)s2)
  76. #define strchr(s1,i1) (char *)_mbschr((unsigned char *)s1, i1)
  77. #define strtok(s1,s2) (char *)_mbstok((unsigned char *)s1, (unsigned char *)s2)
  78. #define strcspn(s1,s2)  _mbscspn((unsigned char *)s1, (unsigned char *)s2)
  79. #define strpbrk(s1,s2)  (char *)_mbspbrk((unsigned char *)s1, (unsigned char *)s2)
  80. #define strspn(s1,s2) _mbsspn((unsigned char *)s1, (unsigned char *)s2)
  81. #define _strupr(s1) (char *)_mbsupr((unsigned char *)s1)
  82. #define _strlwr(s1) (char *)_mbslwr((unsigned char *)s1)
  83. #define _strrev(s1) (char *)_mbsrev((unsigned char *)s1)
  84. #define _stricmp(s1,s2) _mbsicmp((unsigned char *)s1, (unsigned char *)s2)
  85. #define _strcmpi(s1,s2) _mbsicmp((unsigned char *)s1, (unsigned char *)s2)
  86. #define strrchr(s1,i1)  (char *)_mbsrchr((unsigned char *)s1, i1)
  87. /*
  88. #define _strnicmp _mbsnicmp
  89. #define strlen  _mbslen
  90. #define strcat  _mbscat
  91. #define strcpy  _mbscpy
  92. #define strcmp  _mbscmp
  93. #define _strset _mbsset
  94. #define strncat _mbsncat
  95. #define strncpy _mbsncpy
  96. #define strncmp _mbsncmp
  97. #define _strnset  _mbsnset
  98. */
  99. #elif (defined(_DOS) || defined(_WINDOWS)) && !defined(_OS2)
  100. #include  <mbstring.h>
  101. #define strstr  _mbsstr
  102. #define strchr  _mbschr
  103. #define strtok  _mbstok
  104. #define strcspn _mbscspn
  105. #define strpbrk _mbspbrk
  106. #define strspn  _mbsspn
  107. #define _strupr _mbsupr
  108. #define _strlwr _mbslwr
  109. #define _strrev _mbsrev
  110. #define _stricmp  _mbsicmp
  111. #define _strcmpi  _mbsicmp
  112. #define strrchr _mbsrchr
  113. #define _fstrstr  _fmbsstr
  114. #define _fstrchr  _fmbschr
  115. #define _fstrtok  _fmbstok
  116. #define _fstrupr _fmbsupr
  117. #define _fstrlwr _fmbslwr
  118. #define _fstricmp  _fmbsicmp
  119. #define _fstrcmpi  _fmbsicmp
  120. #define _fstrrchr _fmbsrchr
  121. /*
  122. #define _strnicmp _mbsnicmp
  123. #define strlen  _mbslen
  124. #define strcat  _mbscat
  125. #define strcpy  _mbscpy
  126. #define strcmp  _mbscmp
  127. #define _strset _mbsset
  128. #define strncat _mbsncat
  129. #define strncpy _mbsncpy
  130. #define strncmp _mbsncmp
  131. #define _strnset  _mbsnset
  132. */
  133. #elif defined(_OS2)
  134. #include  <jstring.h>
  135. #define strstr
  136. #define strchr  jstrchr
  137. #define strtok  jstrtok
  138. #define strcspn
  139. #define strpbrk
  140. #define strspn
  141. #define _strupr
  142. #define _strlwr
  143. #define _strrev
  144. #define stricmp __mbsicmp
  145. #define strcmpi __mbsicmp
  146. #define _strnicmp
  147. #define strrchr
  148. /*
  149. #define strlen  _mbslen
  150. #define strcat  _mbscat
  151. #define strcpy  _mbscpy
  152. #define strcmp  _mbscmp
  153. #define _strset _mbsset
  154. #define strncat _mbsncat
  155. #define strncpy _mbsncpy
  156. #define strncmp _mbsncmp
  157. #define _strnset  _mbsnset
  158. */
  159. #else
  160. #error not defined _DOS, _OS2, or _NTWIN
  161. #endif
  162.  
  163. #ifdef __cplusplus
  164. }
  165. #endif
  166.  
  167. #pragma option pop /*P_O_Pop*/
  168. #endif  /* _DBCSSTR_INCLUDED_ */
  169.  
  170. /*** End of 'dbcsstr.h' ***/
  171.