home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WCHAR.HPP < prev    next >
C/C++ Source or Header  |  1996-11-12  |  3KB  |  112 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.  
  14. /*
  15.  * Character codes should all start with "_"
  16.  */
  17.  
  18. #if defined( UNICODE ) || defined( _UNICODE )
  19.     #undef _UNICODE
  20.     #undef UNICODE
  21.     #define _UNICODE
  22.     #define UNICODE
  23. #endif
  24.  
  25. #if defined( SBCS ) || defined( _SBCS )
  26.     #undef _SBCS
  27.     #undef SBCS
  28.     #define _SBCS
  29.     #define SBCS
  30. #endif
  31.  
  32. /*
  33.  * If we're not Unicode or SBCS, we must be DBCS!
  34.  */
  35.  
  36. #if !defined( _UNICODE ) && !defined( _SBCS )
  37.     #undef _DBCS
  38.     #define _DBCS
  39. #endif
  40.  
  41. #if defined( DBCS ) || defined( _DBCS ) || defined( MBCS ) || defined( _MBCS )
  42.     #undef _DBCS
  43.     #undef DBCS
  44.     #undef _MBCS
  45.     #undef MBCS
  46.     #define _DBCS
  47.     #define DBCS
  48.     #define _MBCS
  49.     #define MBCS
  50. #endif
  51.  
  52.  
  53. /*
  54.  * Complain if multiple things are defined...
  55.  */
  56.  
  57. #ifdef _DEBUG
  58.     #if ( defined( _UNICODE ) && defined( _DBCS ) ) || \
  59.     ( defined( _UNICODE ) && defined( _SBCS ) ) || \
  60.     ( defined( _DBCS ) && defined( _SBCS ) )
  61.     #error "Too many character codes!"
  62.     #endif
  63. #endif
  64.  
  65. /*
  66.  * Define what a wchar_t is, if it hasn't already been defined...
  67.  */
  68.  
  69. #if defined( _WCHAR_T_DEFINED ) || defined( _WCHAR_T_DEFINED_ )
  70.     #undef _WCHAR_T_DEFINED
  71.     #undef _WCHAR_T_DEFINED__
  72. #else
  73.     typedef unsigned short wchar_t;
  74. #endif
  75.  
  76. #define _WCHAR_T_DEFINED_
  77. #define _WCHAR_T_DEFINED
  78.  
  79. typedef char    WAnsiChar;
  80. typedef wchar_t WUnicodeChar;
  81.  
  82. /*
  83.  * Define the WChar type
  84.  */
  85.  
  86. #ifdef _UNICODE
  87.     typedef WUnicodeChar WChar;
  88.  
  89.     #define __WTEXT(quote) L##quote
  90. #else
  91.     typedef WAnsiChar WChar;
  92.  
  93.     #define __WTEXT(quote) quote
  94. #endif
  95.  
  96. #ifdef _SBCS
  97.     typedef WAnsiChar WWidestChar;
  98. #else
  99.     typedef WUnicodeChar WWidestChar;  // handles DBCS too!
  100. #endif
  101.  
  102. typedef WChar       *WCharPtr;
  103. typedef const WChar *WCCharPtr;
  104.  
  105. typedef WWidestChar *WWidestCharPtr;
  106. typedef const WChar *WCWidestCharPtr;
  107.  
  108. #define WTEXT(quote) __WTEXT(quote)
  109. #define WCTEXT(quote) WTEXT(quote)    // for Code text only
  110.  
  111. #endif // _WCHAR_HPP_INCLUDED
  112.