home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 September / dppcpro0998.iso / Rwc / Sybase / Install.exe / hpp.z / WCHAR.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  2.6 KB  |  113 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WCHAR_HPP_INCLUDED
  12. #define _WCHAR_HPP_INCLUDED
  13. #pragma once
  14.  
  15. /*
  16.  * Character codes should all start with "_"
  17.  */
  18.  
  19. #if defined( UNICODE ) || defined( _UNICODE )
  20.     #undef _UNICODE
  21.     #undef UNICODE
  22.     #define _UNICODE
  23.     #define UNICODE
  24. #endif
  25.  
  26. #if defined( SBCS ) || defined( _SBCS )
  27.     #undef _SBCS
  28.     #undef SBCS
  29.     #define _SBCS
  30.     #define SBCS
  31. #endif
  32.  
  33. /*
  34.  * If we're not Unicode or SBCS, we must be DBCS!
  35.  */
  36.  
  37. #if !defined( _UNICODE ) && !defined( _SBCS )
  38.     #undef _DBCS
  39.     #define _DBCS
  40. #endif
  41.  
  42. #if defined( DBCS ) || defined( _DBCS ) || defined( MBCS ) || defined( _MBCS )
  43.     #undef _DBCS
  44.     #undef DBCS
  45.     #undef _MBCS
  46.     #undef MBCS
  47.     #define _DBCS
  48.     #define DBCS
  49.     #define _MBCS
  50.     #define MBCS
  51. #endif
  52.  
  53.  
  54. /*
  55.  * Complain if multiple things are defined...
  56.  */
  57.  
  58. #ifdef _DEBUG
  59.     #if ( defined( _UNICODE ) && defined( _DBCS ) ) || \
  60.         ( defined( _UNICODE ) && defined( _SBCS ) ) || \
  61.         ( defined( _DBCS ) && defined( _SBCS ) )
  62.     #error "Too many character codes!"
  63.     #endif
  64. #endif
  65.  
  66. /*
  67.  * Define what a wchar_t is, if it hasn't already been defined...
  68.  */
  69.  
  70. #if defined( _WCHAR_T_DEFINED ) || defined( _WCHAR_T_DEFINED_ )
  71.     #undef _WCHAR_T_DEFINED
  72.     #undef _WCHAR_T_DEFINED__
  73. #else
  74.     typedef unsigned short wchar_t;
  75. #endif
  76.  
  77. #define _WCHAR_T_DEFINED_
  78. #define _WCHAR_T_DEFINED
  79.  
  80. typedef char    WAnsiChar;
  81. typedef wchar_t WUnicodeChar;
  82.  
  83. /*
  84.  * Define the WChar type
  85.  */
  86.  
  87. #ifdef _UNICODE
  88.     typedef WUnicodeChar WChar;
  89.  
  90.     #define __WTEXT(quote) L##quote
  91. #else
  92.     typedef WAnsiChar WChar;
  93.  
  94.     #define __WTEXT(quote) quote
  95. #endif
  96.  
  97. #ifdef _SBCS
  98.     typedef WAnsiChar WWidestChar;
  99. #else
  100.     typedef WUnicodeChar WWidestChar;  // handles DBCS too!
  101. #endif
  102.  
  103. typedef WChar       *WCharPtr;
  104. typedef const WChar *WCCharPtr;
  105.  
  106. typedef WWidestChar *WWidestCharPtr;
  107. typedef const WChar *WCWidestCharPtr;
  108.  
  109. #define WTEXT(quote) __WTEXT(quote)
  110. #define WCTEXT(quote) WTEXT(quote)      // for Code text only
  111.  
  112. #endif // _WCHAR_HPP_INCLUDED
  113.