summaryrefslogtreecommitdiff
path: root/ace/ace_wchar.h
blob: 740100eb671fdd661a7ff5efb2b3529b44982141 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    ace_wchar.h
 *
 *  $Id$
 *
 *  @author Darrell Brunsch <brunsch@uci.edu>
 */
//=============================================================================

#ifndef ACE_WCHAR_H
#define ACE_WCHAR_H

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#if !defined(ACE_SIZEOF_WCHAR) || !defined (ACE_WCHAR_MAX)
#error Must define ACE_SIZEOF_WCHAR, ACE_WCHAR_MAX, \
and (maybe undefine) ACE_LACKS_BUILTIN_WCHAR_T in the config-<platform>.h. \
Typedef wchar_t, wint_t, and/or wctype_t in the config-<platform>.h \
or within the conditional #includes below if the platform does \
not supply them.
#endif

// Add includes and/or typedefs to get wchar_t, wint_t, and wctype_t.
# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
#    include /**/ <wchar.h>
# endif /* ACE_HAS_XPG4_MULTIBYPTE_CHAR */

# if defined (VXWORKS)
#   include /**/ <types/vxTypes.h>  /* For wchar_t */
#   include <stddef.h> /* For wint_t */
    typedef wchar_t wctype_t;
# elif defined (__Lynx__)
#   include /**/ <stdlib.h>  /* For wchar_t */
    typedef unsigned int wint_t;
    typedef wchar_t wctype_t;
# elif defined (ACE_OPENVMS)
#   include /**/ <wchar.h>
#   include /**/ <wctype.h>

# elif defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
    (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
#   include /**/ <cwchar>
#   include /**/ <cwctype>

# elif defined (ACE_HAS_WINCE)
#   include /**/ <wtypes.h>

# elif !defined (__BORLANDC__)
#   include /**/ <wchar.h>

# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */

#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
            (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
using std::size_t;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */

// Set the default behaviour for ACE_TEXT_WIDE to use the L-prefix
#if !defined (ACE_USES_L_PREFIX)
# define ACE_USES_L_PREFIX 1
#endif /* ACE_USES_L_PREFIX */

// Define the unicode/wchar related macros correctly

# if !defined (ACE_TEXT_WIDE)
#  if (ACE_USES_L_PREFIX == 1)
#    define ACE_TEXT_WIDE_I(STRING) L##STRING
#  else /* ACE_USES_L_PREFIX */
#    define ACE_TEXT_WIDE_I(STRING) STRING
#  endif /* ACE_USES_L_PREFIX */
#  define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING)
# endif /* ACE_TEXT_WIDE */

#if defined (ACE_LEGACY_MODE)
# define ACE_TEXT TEXT
#else /* ACE_LEGACY_MODE */
# define ACE_TEXT ACE_LIB_TEXT
#endif /* ACE_LEGACY_MODE */

// The OS_String module defines some wide-char functions that are not
// universally available. In particular, they're not part of the
// XPG4 Worldwide Portability Interface wide-character string handling
// functions. So, if ACE_HAS_XPG4_MULTIBYTE_CHAR is defined, note that
// these functions are missing.
#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)

#  if !defined (ACE_LACKS_ITOW)
#    define ACE_LACKS_ITOW
#  endif

#  if !defined (ACE_LACKS_WCSICMP)
#    define ACE_LACKS_WCSICMP
#  endif

#  if !defined (ACE_LACKS_WCSNICMP)
#    define ACE_LACKS_WCSNICMP
#  endif

#  if !defined (ACE_LACKS_WCSDUP)
#    define ACE_LACKS_WCSDUP
#  endif

#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */

#if defined (ACE_USES_WCHAR)
  typedef wchar_t ACE_TCHAR;
  typedef char ACE_ANTI_TCHAR;
  # define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE( STRING )
#else /* ACE_USES_WCHAR */
  typedef char ACE_TCHAR;
  typedef wchar_t ACE_ANTI_TCHAR;
  # define ACE_LIB_TEXT(STRING) STRING
#endif /* ACE_USES_WCHAR */

#if !defined (ACE_LACKS_DEPRECATED_MACROS)
  // Via compiler, sys headers, config-platform.h,
  // or this header we have a wchar_t
  #define ACE_HAS_WCHAR
  #undef ACE_LACKS_WCHAR_T
  // The wchar type is simpley wchar_t
  #define ACE_WCHAR_T wchar_t
  #define ACE_WINT_T wint_t
  #define ACE_WCHAR_T_TYPE wchar_t
  #define ACE_LACKS_NATIVR_WCHAR_T ACE_LACKS_BUILTIN_WCHAR_T
  namespace ACE_OS { typedef wchar_t WChar; }
#endif /* ACE_LACKS_DEPRECATED_MACROS */

// This package should only be included in the implementation files
// that use it.
#if defined (ACE_WIN32)
#include "ace/ace_wchar_win32_defs.h"
#endif

#endif /* ACE_WCHAR_H */