summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
Diffstat (limited to 'ace')
-rw-r--r--ace/ACE.cpp10
-rw-r--r--ace/ACE.h7
-rw-r--r--ace/ACE.inl6
-rw-r--r--ace/ARGV.cpp277
-rw-r--r--ace/ARGV.h48
-rw-r--r--ace/ARGV.inl307
-rw-r--r--ace/Arg_Shifter.cpp214
-rw-r--r--ace/Arg_Shifter.h40
-rw-r--r--ace/Argv_Type_Converter.cpp69
-rw-r--r--ace/Argv_Type_Converter.h20
-rw-r--r--ace/Argv_Type_Converter.inl16
-rw-r--r--ace/Auto_Event.cpp6
-rw-r--r--ace/Auto_Event.h2
-rw-r--r--ace/Basic_Stats.cpp30
-rw-r--r--ace/Basic_Stats.h5
-rw-r--r--ace/Basic_Types.h51
-rw-r--r--ace/CDR_Base.h8
-rw-r--r--ace/CE_Screen_Output.cpp4
-rw-r--r--ace/Default_Constants.h55
-rw-r--r--ace/Dev_Poll_Reactor.cpp2
-rw-r--r--ace/Dynamic_Service.inl2
-rw-r--r--ace/Env_Value_T.inl7
-rw-r--r--ace/FILE_Connector.cpp2
-rw-r--r--ace/Functor.h7
-rw-r--r--ace/Functor.inl8
-rw-r--r--ace/Functor_String.h4
-rw-r--r--ace/Functor_String.inl2
-rw-r--r--ace/Get_Opt.cpp663
-rw-r--r--ace/Get_Opt.h66
-rw-r--r--ace/Get_Opt.inl722
-rw-r--r--ace/Global_Macros.h2
-rw-r--r--ace/High_Res_Timer.cpp4
-rw-r--r--ace/High_Res_Timer.h3
-rw-r--r--ace/INET_Addr.cpp22
-rw-r--r--ace/INET_Addr.h12
-rw-r--r--ace/INET_Addr.inl17
-rw-r--r--ace/Lib_Find.cpp10
-rw-r--r--ace/Lib_Find.h2
-rw-r--r--ace/Local_Name_Space.cpp18
-rw-r--r--ace/Local_Name_Space.h8
-rw-r--r--ace/Local_Name_Space_T.cpp16
-rw-r--r--ace/Log_Msg.cpp44
-rw-r--r--ace/Log_Msg.h12
-rw-r--r--ace/Log_Msg_UNIX_Syslog.cpp17
-rw-r--r--ace/Log_Record.cpp2
-rw-r--r--ace/Logging_Strategy.cpp10
-rw-r--r--ace/MEM_Connector.cpp4
-rw-r--r--ace/Malloc_T.cpp6
-rw-r--r--ace/Malloc_T.h10
-rw-r--r--ace/Manual_Event.cpp6
-rw-r--r--ace/Manual_Event.h2
-rw-r--r--ace/Multihomed_INET_Addr.cpp8
-rw-r--r--ace/Multihomed_INET_Addr.h3
-rw-r--r--ace/Mutex.h5
-rw-r--r--ace/NT_Service.h2
-rw-r--r--ace/Name_Request_Reply.cpp24
-rw-r--r--ace/Name_Request_Reply.h18
-rw-r--r--ace/Naming_Context.cpp2
-rw-r--r--ace/OS_NS_Thread.cpp26
-rw-r--r--ace/OS_NS_Thread.h14
-rw-r--r--ace/OS_NS_Thread.inl24
-rw-r--r--ace/OS_NS_ctype.h50
-rw-r--r--ace/OS_NS_ctype.inl132
-rw-r--r--ace/OS_NS_dirent.inl4
-rw-r--r--ace/OS_NS_dlfcn.inl31
-rw-r--r--ace/OS_NS_fcntl.cpp6
-rw-r--r--ace/OS_NS_fcntl.h4
-rw-r--r--ace/OS_NS_stdio.cpp10
-rw-r--r--ace/OS_NS_stdio.h25
-rw-r--r--ace/OS_NS_stdio.inl102
-rw-r--r--ace/OS_NS_stdlib.cpp4
-rw-r--r--ace/OS_NS_stdlib.h35
-rw-r--r--ace/OS_NS_stdlib.inl114
-rw-r--r--ace/OS_NS_string.cpp65
-rw-r--r--ace/OS_NS_string.h125
-rw-r--r--ace/OS_NS_string.inl155
-rw-r--r--ace/OS_NS_strings.h4
-rw-r--r--ace/OS_NS_strings.inl6
-rw-r--r--ace/OS_NS_sys_mman.inl6
-rw-r--r--ace/OS_NS_sys_stat.h6
-rw-r--r--ace/OS_NS_sys_stat.inl23
-rw-r--r--ace/OS_NS_time.inl28
-rw-r--r--ace/OS_NS_unistd.cpp153
-rw-r--r--ace/OS_NS_unistd.h20
-rw-r--r--ace/OS_NS_unistd.inl56
-rw-r--r--ace/OS_NS_wchar.cpp103
-rw-r--r--ace/OS_NS_wchar.h103
-rw-r--r--ace/OS_NS_wchar.inl25
-rw-r--r--ace/OS_main.cpp2
-rw-r--r--ace/Object_Manager.h2
-rw-r--r--ace/Object_Manager_Base.cpp2
-rw-r--r--ace/Process.cpp15
-rw-r--r--ace/Process.h6
-rw-r--r--ace/Process.inl8
-rw-r--r--ace/Process_Mutex.cpp13
-rw-r--r--ace/Process_Mutex.h3
-rw-r--r--ace/Process_Semaphore.cpp2
-rw-r--r--ace/QoS/SOCK_Dgram_Mcast_QoS.cpp3
-rw-r--r--ace/Registry_Name_Space.cpp2
-rw-r--r--ace/Remote_Name_Space.cpp66
-rw-r--r--ace/SOCK_Dgram.cpp13
-rw-r--r--ace/SOCK_Dgram_Bcast.cpp2
-rw-r--r--ace/SOCK_Dgram_Mcast.cpp20
-rw-r--r--ace/SSL/SSL_Asynch_Stream.cpp66
-rw-r--r--ace/SSL/SSL_Context.cpp2
-rw-r--r--ace/SSL/SSL_SOCK_Stream.cpp2
-rw-r--r--ace/SString.cpp7
-rw-r--r--ace/SStringfwd.h4
-rw-r--r--ace/SV_Semaphore_Simple.cpp4
-rw-r--r--ace/SV_Semaphore_Simple.h5
-rw-r--r--ace/SV_Semaphore_Simple.inl4
-rw-r--r--ace/Service_Config.h12
-rw-r--r--ace/Service_Config.inl12
-rw-r--r--ace/Service_Manager.cpp4
-rw-r--r--ace/Shared_Memory_Pool.cpp4
-rw-r--r--ace/Singleton.cpp2
-rw-r--r--ace/Sock_Connect.cpp2
-rw-r--r--ace/Stats.cpp53
-rw-r--r--ace/Stats.h13
-rw-r--r--ace/Svc_Conf_y.cpp2
-rw-r--r--ace/UNIX_Addr.cpp2
-rw-r--r--ace/UNIX_Addr.h2
-rw-r--r--ace/UNIX_Addr.inl7
-rw-r--r--ace/ace_wchar.h305
-rw-r--r--ace/config-all.h3
-rw-r--r--ace/config-borland-common.h4
-rw-r--r--ace/config-doxygen.h3
-rw-r--r--ace/config-freebsd.h1
-rw-r--r--ace/config-hpux-11.00.h2
-rw-r--r--ace/config-linux-common.h18
-rw-r--r--ace/config-lynxos.h31
-rw-r--r--ace/config-macosx-panther.h3
-rw-r--r--ace/config-macosx-tiger.h3
-rw-r--r--ace/config-macosx.h3
-rw-r--r--ace/config-netbsd.h7
-rw-r--r--ace/config-pharlap.h1
-rw-r--r--ace/config-rtems.h2
-rw-r--r--ace/config-tandem-nsk-mips-v2.h3
-rw-r--r--ace/config-vxworks5.x.h9
-rw-r--r--ace/config-win32-common.h13
-rw-r--r--ace/config-win32-dmc.h2
-rw-r--r--ace/config-win32-ghs.h6
-rw-r--r--ace/config-win32-mingw.h3
-rw-r--r--ace/config-win32-msvc-7.h3
-rw-r--r--ace/config-win32-msvc-8.h3
-rw-r--r--ace/config-win32-msvc.h2
-rw-r--r--ace/config-win32-visualage.h3
-rw-r--r--ace/os_include/os_stddef.h6
148 files changed, 2173 insertions, 3042 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 872e4dfed74..058c5ba1051 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -354,7 +354,6 @@ ACE::hash_pjw (const char *str)
return ACE::hash_pjw (str, ACE_OS::strlen (str));
}
-#if defined (ACE_HAS_WCHAR)
u_long
ACE::hash_pjw (const wchar_t *str, size_t len)
{
@@ -384,7 +383,6 @@ ACE::hash_pjw (const wchar_t *str)
{
return ACE::hash_pjw (str, ACE_OS::strlen (str));
}
-#endif /* ACE_HAS_WCHAR */
#if !defined (ACE_HAS_WINCE)
ACE_TCHAR *
@@ -3331,7 +3329,6 @@ ACE::strndup (const char *str, size_t n)
return ACE_OS::strsncpy (s, str, len + 1);
}
-#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strndup (const wchar_t *str, size_t n)
{
@@ -3353,7 +3350,6 @@ ACE::strndup (const wchar_t *str, size_t n)
0);
return ACE_OS::strsncpy (s, str, len + 1);
}
-#endif /* ACE_HAS_WCHAR */
char *
ACE::strnnew (const char *str, size_t n)
@@ -3376,7 +3372,6 @@ ACE::strnnew (const char *str, size_t n)
return ACE_OS::strsncpy (s, str, len + 1);
}
-#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strnnew (const wchar_t *str, size_t n)
{
@@ -3397,7 +3392,6 @@ ACE::strnnew (const wchar_t *str, size_t n)
0);
return ACE_OS::strsncpy (s, str, len + 1);
}
-#endif /* ACE_HAS_WCHAR */
const char *
ACE::strend (const char *s)
@@ -3408,7 +3402,6 @@ ACE::strend (const char *s)
return s;
}
-#if defined ACE_HAS_WCHAR
const wchar_t *
ACE::strend (const wchar_t *s)
{
@@ -3417,7 +3410,6 @@ ACE::strend (const wchar_t *s)
return s;
}
-#endif
char *
ACE::strnew (const char *s)
@@ -3434,7 +3426,6 @@ ACE::strnew (const char *s)
return ACE_OS::strcpy (t, s);
}
-#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strnew (const wchar_t *s)
{
@@ -3449,7 +3440,6 @@ ACE::strnew (const wchar_t *s)
else
return ACE_OS::strcpy (t, s);
}
-#endif /* ACE_HAS_WCHAR */
inline static bool equal_char(char a, char b, bool case_sensitive)
{
diff --git a/ace/ACE.h b/ace/ACE.h
index ecafe8a3c36..581d239c41e 100644
--- a/ace/ACE.h
+++ b/ace/ACE.h
@@ -427,7 +427,6 @@ namespace ACE
/// @c ACE_OS::malloc to allocate the new string.
extern ACE_Export char *strnnew (const char *str, size_t n);
-#if defined (ACE_HAS_WCHAR)
extern ACE_Export const wchar_t *strend (const wchar_t *s);
extern ACE_Export wchar_t *strnew (const wchar_t *s);
@@ -438,8 +437,6 @@ namespace ACE
extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n);
-#endif /* ACE_HAS_WCHAR */
-
/**
* On Windows, determines if a specified pathname ends with ".exe"
* (not case sensitive). If on Windows and there is no ".exe" suffix,
@@ -536,13 +533,11 @@ namespace ACE
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const char *str, size_t len);
-#if defined (ACE_HAS_WCHAR)
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const wchar_t *str);
/// Computes the hash value of {str} using the "Hash PJW" routine.
extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len);
-#endif /* ACE_HAS_WCHAR */
/// Computes CRC-CCITT for the string.
extern ACE_Export ACE_UINT16 crc_ccitt(const char *str);
@@ -632,7 +627,7 @@ namespace ACE
ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num);
/// Hex conversion utility.
- ACE_NAMESPACE_INLINE_FUNCTION ACE_TCHAR nibble2hex (u_int n);
+ ACE_NAMESPACE_INLINE_FUNCTION char nibble2hex (u_int n);
/// Convert a hex character to its byte representation.
ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c);
diff --git a/ace/ACE.inl b/ace/ACE.inl
index f4e3c2e0cb2..a755557fe5c 100644
--- a/ace/ACE.inl
+++ b/ace/ACE.inl
@@ -303,7 +303,7 @@ ACE::log2 (u_long num)
return log;
}
-ACE_INLINE ACE_TCHAR
+ACE_INLINE char
ACE::nibble2hex (u_int n)
{
// Hexadecimal characters.
@@ -312,9 +312,9 @@ ACE::nibble2hex (u_int n)
// loads of warnings when inlining.
// problem (incorrect warning leftover from older GNU) has been reported as
// TSR to Windriver.
- const ACE_TCHAR hex_chars[] = ACE_LIB_TEXT ("0123456789abcdef");
+ const char hex_chars[] = "0123456789abcdef";
#else
- static const ACE_TCHAR hex_chars[] = ACE_LIB_TEXT ("0123456789abcdef");
+ static const char hex_chars[] = "0123456789abcdef";
#endif
// @@ UNICODE does this work?
diff --git a/ace/ARGV.cpp b/ace/ARGV.cpp
index 7ea5dd93694..72436de20d4 100644
--- a/ace/ARGV.cpp
+++ b/ace/ARGV.cpp
@@ -8,285 +8,16 @@
#include "ace/ARGV.inl"
#endif /* __ACE_INLINE__ */
-#include "ace/Log_Msg.h"
-#include "ace/OS_NS_unistd.h"
-#include "ace/OS_NS_string.h"
-#include "ace/OS_Memory.h"
-
ACE_RCSID(ace, ARGV, "$Id$")
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-ACE_ALLOC_HOOK_DEFINE (ACE_ARGV)
-
-void
-ACE_ARGV::dump (void) const
-{
-#if defined (ACE_HAS_DUMP)
- ACE_TRACE ("ACE_ARGV::dump");
-
- ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("argc_ = %d"), this->argc_));
-
- ACE_ARGV *this_obj = const_cast<ACE_ARGV *> (this);
-
- for (int i = 0; i < this->argc_; i++)
- ACE_DEBUG ((LM_DEBUG,
- ACE_LIB_TEXT ("\nargv_[%i] = %s"),
- i,
- this_obj->argv ()[i]));
-
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nbuf = %s\n"), this->buf_));
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
-#endif /* ACE_HAS_DUMP */
-}
-
-// Creates this->argv_ out of this->buf_. New memory is allocated for
-// each element of the array. This is used by the array-to-string
-// style constructor and for creating this->argv_ when in iterative
-// mode.
-
-int
-ACE_ARGV::string_to_argv (void)
-{
- ACE_TRACE ("ACE_ARGV::string_to_argv");
-
- return ACE_OS::string_to_argv (this->buf_,
- this->argc_,
- this->argv_,
- this->substitute_env_args_);
-}
-
-int
-ACE_ARGV::argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf)
-{
- return ACE_OS::argv_to_string (argv, buf);
-}
-
-ACE_ARGV::ACE_ARGV (const ACE_TCHAR buf[],
- bool substitute_env_args)
- : substitute_env_args_ (substitute_env_args),
- iterative_ (false),
- argc_ (0),
- argv_ (0),
- buf_ (0),
- length_ (0),
- queue_ ()
-{
- ACE_TRACE ("ACE_ARGV::ACE_ARGV ACE_TCHAR[] to ACE_TCHAR *[]");
-
- if (buf == 0 || buf[0] == 0)
- return;
-
- // Make an internal copy of the string.
- ACE_NEW (this->buf_,
- ACE_TCHAR[ACE_OS::strlen (buf) + 1]);
- ACE_OS::strcpy (this->buf_, buf);
-
- // Create this->argv_.
- if (this->string_to_argv () == -1)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("%p\n"),
- ACE_LIB_TEXT ("string_to_argv")));
-}
-
-ACE_ARGV::ACE_ARGV (ACE_TCHAR *argv[],
- bool substitute_env_args)
- : substitute_env_args_ (substitute_env_args),
- iterative_ (false),
- argc_ (0),
- argv_ (0),
- buf_ (0),
- length_ (0),
- queue_ ()
-{
- ACE_TRACE ("ACE_ARGV::ACE_ARGV ACE_TCHAR*[] to ACE_TCHAR[]");
-
- if (argv == 0 || argv[0] == 0)
- return;
-
- this->argc_ = ACE_OS::argv_to_string (argv, this->buf_, substitute_env_args);
-}
-
-ACE_ARGV::ACE_ARGV (ACE_TCHAR *first_argv[],
- ACE_TCHAR *second_argv[],
- bool substitute_env_args)
- : substitute_env_args_ (substitute_env_args),
- iterative_ (false),
- argc_ (0),
- argv_ (0),
- buf_ (0),
- length_ (0),
- queue_ ()
-{
- ACE_TRACE ("ACE_ARGV::ACE_ARGV ACE_TCHAR*[] + ACE_TCHAR *[] to ACE_TCHAR[]");
-
- int first_argc;
- int second_argc;
-
- ACE_TCHAR *first_buf;
- ACE_TCHAR *second_buf;
-
- // convert the first argv to a string
- first_argc = this->argv_to_string (first_argv, first_buf);
-
- // convert the second argv to a string
- second_argc = this->argv_to_string (second_argv, second_buf);
-
- // Add the number of arguments in both the argvs.
- this->argc_ = first_argc + second_argc;
-
- size_t buf_len =
- ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1;
-
- // Allocate memory to the lenght of the combined argv string.
- ACE_NEW (this->buf_,
- ACE_TCHAR[buf_len + 1]);
-
- // copy the first argv string to the buffer
- ACE_OS::strcpy (this->buf_, first_buf);
-
- // concatenate the second argv string to the buffer
- ACE_OS::strcat (this->buf_, second_buf);
-
- // Delete the first and second buffers
-
- delete [] first_buf;
-
- delete [] second_buf;
-}
-
-
-ACE_ARGV::ACE_ARGV (bool substitute_env_args)
- : substitute_env_args_ (substitute_env_args),
- iterative_ (true),
- argc_ (0),
- argv_ (0),
- buf_ (0),
- length_ (0),
- queue_ ()
-{
- ACE_TRACE ("ACE_ARGV::ACE_ARGV Iterative");
-
- // Nothing to do yet -- the user puts in arguments via add ()
-}
-
-int
-ACE_ARGV::add (const ACE_TCHAR *next_arg)
-{
- // Only allow this to work in the "iterative" verion -- the
- // ACE_ARGVs created with the one argument constructor.
- if (!this->iterative_)
- {
- errno = EINVAL;
- return -1;
- }
-
- // Put the new argument at the end of the queue.
- if (this->queue_.enqueue_tail (const_cast <ACE_TCHAR *> (next_arg)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_LIB_TEXT ("Can't add more to ARGV queue")),
- -1);
-
- this->length_ += ACE_OS::strlen (next_arg);
-
- this->argc_++;
-
- // Wipe argv_ and buf_ away so that they will be recreated if the
- // user calls argv () or buf ().
- if (this->argv_ != 0)
- {
- for (int i = 0; this->argv_[i] != 0; i++)
- ACE_OS::free ((void *) this->argv_[i]);
-
- delete [] this->argv_;
- this->argv_ = 0;
- }
-
- delete [] this->buf_;
- this->buf_ = 0;
-
- return 0;
-}
-
-int
-ACE_ARGV::add (ACE_TCHAR *argv[])
-{
- for (int i = 0; argv[i] != 0; i++)
- if (this->add (argv[i]) == -1)
- return -1;
-
- return 0;
-}
-
-// Free up argv_ and buf_
-
-ACE_ARGV::~ACE_ARGV (void)
-{
- ACE_TRACE ("ACE_ARGV::~ACE_ARGV");
-
- if (this->argv_ != 0)
- for (int i = 0; this->argv_[i] != 0; i++)
- ACE_OS::free ((void *) this->argv_[i]);
-
- delete [] this->argv_;
- delete [] this->buf_;
-}
-
-// Create buf_ out of the queue_. This is only used in the
-// "iterative" mode.
-
-int
-ACE_ARGV::create_buf_from_queue (void)
-{
- ACE_TRACE ("ACE_ARGV::create_buf_from_queue");
-
- // If the are no arguments, don't do anything
- if (this->argc_ <= 0)
- return -1;
-
- delete [] this->buf_;
-
- ACE_NEW_RETURN (this->buf_,
- ACE_TCHAR[this->length_ + this->argc_],
- -1);
-
- // Get an iterator over the queue
- ACE_Unbounded_Queue_Iterator<ACE_TCHAR *> iter (this->queue_);
-
- ACE_TCHAR **arg = 0;
- ACE_TCHAR *ptr = this->buf_;
- size_t len;
- int more = 0;
-
- while (!iter.done ())
- {
- // Get next argument from the queue.
- iter.next (arg);
-
- more = iter.advance ();
-
- len = ACE_OS::strlen (*arg);
-
- // Copy the argument into buf_
- ACE_OS::memcpy ((void *) ptr,
- (const void *) (*arg),
- len * sizeof (ACE_TCHAR));
- // Move the pointer down.
- ptr += len;
-
- // Put in an argument separating space.
- if (more != 0)
- *ptr++ = ' ';
- }
-
- // Put in the NUL terminator
- *ptr = '\0';
+ACE_RCSID(ace, ARGV, "$Id$")
- return 0;
-}
+#if !defined (__ACE_INLINE__)
+template class ACE_TARGV<ACE_TCHAR>;
+#endif /* __ACE_INLINE__ */
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/ARGV.h b/ace/ARGV.h
index 1f3350fd24e..f7ea995b62b 100644
--- a/ace/ARGV.h
+++ b/ace/ARGV.h
@@ -27,7 +27,7 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
- * @class ACE_ARGV
+ * @class ACE_TARGV
*
* @brief Builds a counted argument vector (ala argc/argv) from either
* a string or a set of separate tokens. This class preserves whitespace
@@ -43,7 +43,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
* For example, @c $HOME/file will not substitute the value of the HOME
* environment variable.
*/
-class ACE_Export ACE_ARGV
+template < typename CHAR_TYPE = char >
+class ACE_Export ACE_TARGV
{
public:
// = Initialization and termination.
@@ -60,7 +61,7 @@ public:
* its environment variable value in the resultant vector
* in place of the environment variable name.
*/
- ACE_ARGV (const ACE_TCHAR buf[],
+ ACE_TARGV (const CHAR_TYPE buf[],
bool substitute_env_args = true);
/**
@@ -79,7 +80,7 @@ public:
* its environment variable value in the resultant vector
* in place of the environment variable name.
*/
- ACE_ARGV (ACE_TCHAR *argv[],
+ ACE_TARGV (CHAR_TYPE *argv[],
bool substitute_env_args = true);
/**
@@ -96,8 +97,8 @@ public:
* variable value in the resultant vector in place
* of the environment variable name.
*/
- ACE_ARGV (ACE_TCHAR *first_argv[],
- ACE_TCHAR *second_argv[],
+ ACE_TARGV (CHAR_TYPE *first_argv[],
+ CHAR_TYPE *second_argv[],
bool substitute_env_args = true);
/**
@@ -105,10 +106,10 @@ public:
* of the add methods. This is referred to as the @i iterative method
* of adding arguments to this object.
*/
- ACE_ARGV (bool substitute_env_args = true);
+ ACE_TARGV (bool substitute_env_args = true);
/// Destructor.
- ~ACE_ARGV (void);
+ ~ACE_TARGV (void);
/** @name Accessor methods
*
@@ -123,14 +124,14 @@ public:
* @retval Pointer to the indexed string.
* @retval 0 if @a index is out of bounds.
*/
- const ACE_TCHAR *operator[] (size_t index);
+ const CHAR_TYPE *operator[] (size_t index);
/**
* Returns the current argument vector. The returned pointers are to data
* maintained internally to this class. Do not change or delete either the
* pointers or the memory to which they refer.
*/
- ACE_TCHAR **argv (void);
+ CHAR_TYPE **argv (void);
/// Returns the current number of arguments.
int argc (void) const;
@@ -140,7 +141,7 @@ public:
* pointer refers to memory maintained internally to this class. Do not
* change or delete it.
*/
- const ACE_TCHAR *buf (void);
+ const CHAR_TYPE *buf (void);
//@}
@@ -164,7 +165,7 @@ public:
* - EINVAL: This object is not in iterative mode.
* - ENOMEM: Not enough memory available to save @a next_arg.
*/
- int add (const ACE_TCHAR *next_arg);
+ int add (const CHAR_TYPE *next_arg);
/**
* Add an array of arguments. This only works in the iterative mode.
@@ -181,24 +182,24 @@ public:
* - EINVAL: This object is not in iterative mode.
* - ENOMEM: Not enough memory available to save @a next_arg.
*/
- int add (ACE_TCHAR *argv[]);
+ int add (CHAR_TYPE *argv[]);
private:
- /// Copy constructor not implemented.
- ACE_ARGV (const ACE_ARGV&);
+ /// Copy Constructor not implemented
+ ACE_TARGV (const ACE_TARGV&);
- /// Assignment operator not implemented.
- ACE_ARGV operator= (const ACE_ARGV&);
+ /// Assignment '=' operator not implemented
+ ACE_TARGV operator= (const ACE_TARGV&);
/// Creates buf_ from the queue of added args, deletes previous buf_.
int create_buf_from_queue (void);
- /// Converts buf_ into the ACE_TCHAR *argv[] format.
+ /// Converts buf_ into the CHAR_TYPE *argv[] format.
int string_to_argv (void);
/// Returns the string created from argv in buf and
/// returns the number of arguments.
- int argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf);
+ int argv_to_string (CHAR_TYPE **argv, CHAR_TYPE *&buf);
/// Replace args with environment variable values?
bool substitute_env_args_;
@@ -209,10 +210,10 @@ private:
int argc_;
/// The array of string arguments.
- ACE_TCHAR **argv_;
+ CHAR_TYPE **argv_;
/// Buffer containing the <argv> contents.
- ACE_TCHAR *buf_;
+ CHAR_TYPE *buf_;
/// Total length of the arguments in the queue, not counting
/// separating spaces
@@ -220,9 +221,11 @@ private:
/// Queue which keeps user supplied arguments. This is only
/// active in the "iterative" mode.
- ACE_Unbounded_Queue<ACE_TCHAR *> queue_;
+ ACE_Unbounded_Queue<CHAR_TYPE *> queue_;
};
+typedef ACE_TARGV<ACE_TCHAR> ACE_ARGV;
+
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -230,5 +233,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#include "ace/ARGV.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_ARGUMENT_VECTOR_H */
diff --git a/ace/ARGV.inl b/ace/ARGV.inl
index 599b1193e0d..88893fefe8b 100644
--- a/ace/ARGV.inl
+++ b/ace/ARGV.inl
@@ -2,36 +2,311 @@
// $Id$
#include "ace/Global_Macros.h"
+#include "ace/Log_Msg.h"
+#include "ace/OS_NS_unistd.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_Memory.h"
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+template < typename CHAR_TYPE > void
+ACE_TARGV<CHAR_TYPE>::dump (void) const
+{
+#if defined (ACE_HAS_DUMP)
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::dump");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("argc_ = %d"), this->argc_));
+
+ ACE_TARGV *this_obj = const_cast<ACE_TARGV *> (this);
+
+ for (int i = 0; i < this->argc_; i++)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("\nargv_[%i] = %s"),
+ i,
+ this_obj->argv ()[i]));
+
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nbuf = %s\n"), this->buf_));
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+#endif /* ACE_HAS_DUMP */
+}
+
+// Creates this->argv_ out of this->buf_. New memory is allocated for
+// each element of the array. This is used by the array-to-string
+// style constructor and for creating this->argv_ when in iterative
+// mode.
+
+template < typename CHAR_TYPE > int
+ACE_TARGV<CHAR_TYPE>::string_to_argv (void)
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::string_to_argv");
+
+ return ACE_OS::string_to_argv (this->buf_,
+ this->argc_,
+ this->argv_,
+ this->substitute_env_args_);
+}
+
+template < typename CHAR_TYPE > int
+ACE_TARGV<CHAR_TYPE>::argv_to_string (CHAR_TYPE **argv, CHAR_TYPE *&buf)
+{
+ return ACE_OS::argv_to_string (argv, buf);
+}
+
+template < typename CHAR_TYPE >
+ACE_TARGV<CHAR_TYPE>::ACE_TARGV (const CHAR_TYPE buf[],
+ bool substitute_env_args)
+ : substitute_env_args_ (substitute_env_args),
+ iterative_ (false),
+ argc_ (0),
+ argv_ (0),
+ buf_ (0),
+ length_ (0),
+ queue_ ()
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::ACE_TARGV CHAR_TYPE[] to CHAR_TYPE *[]");
+
+ if (buf == 0 || buf[0] == 0)
+ return;
+
+ // Make an internal copy of the string.
+ ACE_NEW (this->buf_,
+ CHAR_TYPE[ACE_OS::strlen (buf) + 1]);
+ ACE_OS::strcpy (this->buf_, buf);
+
+ // Create this->argv_.
+ if (this->string_to_argv () == -1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("%p\n"),
+ ACE_LIB_TEXT ("string_to_argv")));
+}
+
+template < typename CHAR_TYPE >
+ACE_TARGV<CHAR_TYPE>::ACE_TARGV (CHAR_TYPE *argv[],
+ bool substitute_env_args)
+ : substitute_env_args_ (substitute_env_args),
+ iterative_ (false),
+ argc_ (0),
+ argv_ (0),
+ buf_ (0),
+ length_ (0),
+ queue_ ()
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::ACE_TARGV CHAR_TYPE*[] to CHAR_TYPE[]");
+
+ if (argv == 0 || argv[0] == 0)
+ return;
+
+ this->argc_ = ACE_OS::argv_to_string (argv, this->buf_, substitute_env_args);
+}
+
+template < typename CHAR_TYPE >
+ACE_TARGV<CHAR_TYPE>::ACE_TARGV (CHAR_TYPE *first_argv[],
+ CHAR_TYPE *second_argv[],
+ bool substitute_env_args)
+ : substitute_env_args_ (substitute_env_args),
+ iterative_ (false),
+ argc_ (0),
+ argv_ (0),
+ buf_ (0),
+ length_ (0),
+ queue_ ()
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::ACE_TARGV CHAR_TYPE*[] + CHAR_TYPE *[] to CHAR_TYPE[]");
+
+ int first_argc;
+ int second_argc;
+
+ CHAR_TYPE *first_buf;
+ CHAR_TYPE *second_buf;
+
+ // convert the first argv to a string
+ first_argc = this->argv_to_string (first_argv, first_buf);
+
+ // convert the second argv to a string
+ second_argc = this->argv_to_string (second_argv, second_buf);
+
+ // Add the number of arguments in both the argvs.
+ this->argc_ = first_argc + second_argc;
+
+ size_t buf_len =
+ ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1;
+
+ // Allocate memory to the lenght of the combined argv string.
+ ACE_NEW (this->buf_,
+ CHAR_TYPE[buf_len + 1]);
+
+ // copy the first argv string to the buffer
+ ACE_OS::strcpy (this->buf_, first_buf);
+
+ // concatenate the second argv string to the buffer
+ ACE_OS::strcat (this->buf_, second_buf);
+
+ // Delete the first and second buffers
+
+ delete [] first_buf;
+
+ delete [] second_buf;
+}
+
+template < typename CHAR_TYPE >
+ACE_TARGV<CHAR_TYPE>::ACE_TARGV (bool substitute_env_args)
+ : substitute_env_args_ (substitute_env_args),
+ iterative_ (true),
+ argc_ (0),
+ argv_ (0),
+ buf_ (0),
+ length_ (0),
+ queue_ ()
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::ACE_TARGV Iterative");
+
+ // Nothing to do yet -- the user puts in arguments via add ()
+}
+
+template < typename CHAR_TYPE > int
+ACE_TARGV<CHAR_TYPE>::add (const CHAR_TYPE *next_arg)
+{
+ // Only allow this to work in the "iterative" verion -- the
+ // ACE_TARGVs created with the one argument constructor.
+ if (!this->iterative_)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ // Put the new argument at the end of the queue.
+ if (this->queue_.enqueue_tail (const_cast <CHAR_TYPE *> (next_arg)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_LIB_TEXT ("Can't add more to ARGV queue")),
+ -1);
+
+ this->length_ += ACE_OS::strlen (next_arg);
+
+ this->argc_++;
+
+ // Wipe argv_ and buf_ away so that they will be recreated if the
+ // user calls argv () or buf ().
+ if (this->argv_ != 0)
+ {
+ for (int i = 0; this->argv_[i] != 0; i++)
+ ACE_OS::free ((void *) this->argv_[i]);
+
+ delete [] this->argv_;
+ this->argv_ = 0;
+ }
+
+ delete [] this->buf_;
+ this->buf_ = 0;
+
+ return 0;
+}
+
+template < typename CHAR_TYPE > int
+ACE_TARGV<CHAR_TYPE>::add (CHAR_TYPE *argv[])
+{
+ for (int i = 0; argv[i] != 0; i++)
+ if (this->add (argv[i]) == -1)
+ return -1;
+
+ return 0;
+}
+
+// Free up argv_ and buf_
+template < typename CHAR_TYPE >
+ACE_TARGV<CHAR_TYPE>::~ACE_TARGV (void)
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::~ACE_TARGV");
+
+ if (this->argv_ != 0)
+ for (int i = 0; this->argv_[i] != 0; i++)
+ ACE_OS::free ((void *) this->argv_[i]);
+
+ delete [] this->argv_;
+ delete [] this->buf_;
+}
+
+// Create buf_ out of the queue_. This is only used in the
+// "iterative" mode.
+
+template < typename CHAR_TYPE > int
+ACE_TARGV<CHAR_TYPE>::create_buf_from_queue (void)
+{
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::create_buf_from_queue");
+
+ // If the are no arguments, don't do anything
+ if (this->argc_ <= 0)
+ return -1;
+
+ delete [] this->buf_;
+
+ ACE_NEW_RETURN (this->buf_,
+ CHAR_TYPE[this->length_ + this->argc_],
+ -1);
+
+ // Get an iterator over the queue
+ ACE_Unbounded_Queue_Iterator<CHAR_TYPE *> iter (this->queue_);
+
+ CHAR_TYPE **arg;
+ CHAR_TYPE *ptr = this->buf_;
+ size_t len;
+ int more = 0;
+
+ while (!iter.done ())
+ {
+ // Get next argument from the queue.
+ iter.next (arg);
+
+ more = iter.advance ();
+
+ len = ACE_OS::strlen (*arg);
+
+ // Copy the argument into buf_
+ ACE_OS::memcpy ((void *) ptr,
+ (const void *) (*arg),
+ len * sizeof (CHAR_TYPE));
+ // Move the pointer down.
+ ptr += len;
+
+ // Put in an argument separating space.
+ if (more != 0)
+ *ptr++ = ' ';
+ }
+
+ // Put in the NUL terminator
+ *ptr = '\0';
+
+ return 0;
+}
+
// Return the number of args
-ACE_INLINE int
-ACE_ARGV::argc (void) const
+template < typename CHAR_TYPE > int
+ACE_TARGV<CHAR_TYPE>::argc (void) const
{
- ACE_TRACE ("ACE_ARGV::argc");
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::argc");
return this->argc_;
}
// Return the arguments in a space-separated string
-ACE_INLINE const ACE_TCHAR *
-ACE_ARGV::buf (void)
+template < typename CHAR_TYPE > const CHAR_TYPE *
+ACE_TARGV<CHAR_TYPE>::buf (void)
{
- ACE_TRACE ("ACE_ARGV::buf");
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::buf");
if (this->buf_ == 0 && this->iterative_)
this->create_buf_from_queue ();
- return (const ACE_TCHAR *) this->buf_;
+ return (const CHAR_TYPE *) this->buf_;
}
// Return the arguments in an entry-per-argument array
-ACE_INLINE ACE_TCHAR **
-ACE_ARGV::argv (void)
+template < typename CHAR_TYPE > CHAR_TYPE **
+ACE_TARGV<CHAR_TYPE>::argv (void)
{
- ACE_TRACE ("ACE_ARGV::argv");
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::argv");
// Try to create the argv_ if it isn't there
if (this->argv_ == 0)
@@ -41,24 +316,24 @@ ACE_ARGV::argv (void)
// Convert buf_ to argv_
if (this->string_to_argv () == -1)
- return (ACE_TCHAR **) 0;
+ return (CHAR_TYPE **) 0;
}
- return (ACE_TCHAR **) this->argv_;
+ return (CHAR_TYPE **) this->argv_;
}
// Subscript operator.
-ACE_INLINE const ACE_TCHAR *
-ACE_ARGV::operator[] (size_t i)
+template < typename CHAR_TYPE > const CHAR_TYPE *
+ACE_TARGV<CHAR_TYPE>::operator[] (size_t i)
{
- ACE_TRACE ("ACE_ARGV::operator[]");
+ ACE_TRACE ("ACE_TARGV<CHAR_TYPE>::operator[]");
// Don't go out of bounds.
if (i >= static_cast<size_t> (this->argc_))
return 0;
- return (const ACE_TCHAR *) this->argv ()[i];
+ return (const CHAR_TYPE *) this->argv ()[i];
}
// Close versioned namespace, if enabled by the user.
diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp
index 3c2ebd9fe08..f29f2522ca7 100644
--- a/ace/Arg_Shifter.cpp
+++ b/ace/Arg_Shifter.cpp
@@ -1,212 +1,14 @@
#include "ace/Arg_Shifter.h"
-#include "ace/OS_NS_string.h"
-#include "ace/OS_NS_strings.h"
-#include "ace/OS_Errno.h"
-#include "ace/OS_Memory.h"
+
+#if !defined (__ACE_INLINE__)
+#include "ace/Arg_Shifter.inl"
+#endif /* __ACE_INLINE__ */
+
ACE_RCSID (ace,
Arg_Shifter,
"$Id$")
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-
-ACE_Arg_Shifter::ACE_Arg_Shifter (int& argc,
- const ACE_TCHAR** argv,
- const ACE_TCHAR** temp)
- : argc_ (argc),
- total_size_ (argc),
- temp_ (temp),
- argv_ (argv),
- current_index_ (0),
- back_ (argc - 1),
- front_ (0)
-{
- this->init ();
-}
-
-ACE_Arg_Shifter::ACE_Arg_Shifter (int& argc,
- ACE_TCHAR** argv,
- ACE_TCHAR** temp)
- : argc_ (argc),
- total_size_ (argc),
- temp_ ((const ACE_TCHAR **) temp),
- argv_ ((const ACE_TCHAR **) argv),
- current_index_ (0),
- back_ (argc - 1),
- front_ (0)
-{
- this->init ();
-}
-
-void
-ACE_Arg_Shifter::init (void)
-{
- // If not provided with one, allocate a temporary array.
- if (this->temp_ == 0)
- ACE_NEW (this->temp_,
- const ACE_TCHAR *[this->total_size_]);
-
- if (this->temp_ != 0)
- {
- // Fill the temporary array.
- this->argc_ = 0;
- for (int i = 0; i < this->total_size_; i++)
- {
- this->temp_[i] = this->argv_[i];
- this->argv_[i] = 0;
- }
- }
- else
- {
- // Allocation failed, prohibit iteration.
- this->current_index_ = this->argc_;
- this->front_ = this->argc_;
- }
-}
-
-ACE_Arg_Shifter::~ACE_Arg_Shifter (void)
-{
- // Delete the temporary vector.
- delete [] temp_;
-}
-
-const ACE_TCHAR *
-ACE_Arg_Shifter::get_current (void) const
-{
- const ACE_TCHAR * retval = 0;
-
- if (this->is_anything_left ())
- retval = this->temp_[current_index_];
-
- return retval;
-}
-
-const ACE_TCHAR *
-ACE_Arg_Shifter::get_the_parameter (const ACE_TCHAR *flag)
-{
- // the return 0's abound because this method
- // would otherwise be a deep if { } else { }
-
- // check to see if any arguments still exist
- if (!this->is_anything_left())
- return 0;
-
- // check to see if the flag is the argument
- int offset = this->cur_arg_strncasecmp (flag);
- if (offset == -1)
- return 0;
-
- if (offset == 0)
- {
- this->consume_arg ();
-
- if (!this->is_parameter_next())
- {
- return 0;
- }
- }
- // the paramter is in the middle somewhere...
- return this->temp_[current_index_] + offset;
-}
-
-int
-ACE_Arg_Shifter::cur_arg_strncasecmp (const ACE_TCHAR *flag)
-{
- // Check for a current argument
- if (this->is_anything_left())
- {
- size_t flag_length = ACE_OS::strlen (flag);
-
- // Check for presence of the flag
- if (ACE_OS::strncasecmp(this->temp_[current_index_],
- flag,
- flag_length) == 0)
- {
- if (ACE_OS::strlen(temp_[current_index_]) ==
- flag_length)
- {
- // match and lengths are equal
- return 0;
- }
- else
- {
- // matches, with more info to boot!
- size_t remaining = ACE_OS::strspn
- (this->temp_[current_index_] + flag_length,
- ACE_LIB_TEXT (" ")) + flag_length;
- return static_cast<int> (remaining);
- }
- }
- }
- // failure
- return -1;
-}
-
-int
-ACE_Arg_Shifter::consume_arg (int number)
-{
- int retval = 0;
-
- // Stick knowns at the end of the vector (consumed).
- if (this->is_anything_left() >= number)
- {
- for (int i = 0, j = this->back_ - (number - 1);
- i < number;
- ++i, ++j, ++this->current_index_)
- this->argv_[j] = this->temp_[this->current_index_];
-
- this->back_ -= number;
- retval = 1;
- }
-
- return retval;
-}
-
-int
-ACE_Arg_Shifter::ignore_arg (int number)
-{
- int retval = 0;
-
- // Keep unknowns at the head of the vector.
- if (this->is_anything_left () >= number)
- {
- for (int i = 0;
- i < number;
- i++, this->current_index_++, this->front_++)
- this->argv_[this->front_] = this->temp_[this->current_index_];
-
- retval = 1;
- this->argc_ += number;
- }
-
- return retval;
-}
-
-int
-ACE_Arg_Shifter::is_anything_left (void) const
-{
- return this->total_size_ - this->current_index_;
-}
-
-int
-ACE_Arg_Shifter::is_option_next (void) const
-{
- return this->is_anything_left () &&
- this->temp_[this->current_index_][0] == '-';
-}
-
-int
-ACE_Arg_Shifter::is_parameter_next (void) const
-{
- return this->is_anything_left ()
- && this->temp_[this->current_index_][0] != '-';
-}
-
-int
-ACE_Arg_Shifter::num_ignored_args (void) const
-{
- return this->front_;
-}
-
-ACE_END_VERSIONED_NAMESPACE_DECL
+#if !defined (__ACE_INLINE__)
+template class ACE_TArg_Shifter< ACE_TCHAR >;
+#endif /* __ACE_INLINE__ */
diff --git a/ace/Arg_Shifter.h b/ace/Arg_Shifter.h
index b75537a1338..32345386f44 100644
--- a/ace/Arg_Shifter.h
+++ b/ace/Arg_Shifter.h
@@ -39,7 +39,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
* has placed all the unknown arguments in their original order at
* the front of original @a argv.
*/
-class ACE_Export ACE_Arg_Shifter
+template < typename CHAR_TYPE = char >
+class ACE_Export ACE_TArg_Shifter
{
public:
// = Initialization and termination methods.
@@ -57,28 +58,28 @@ public:
* @param argv The argument vector to shift. The string pointers in
* the vector will be reordered to place the @a argc unconsumed
* arguments at the front of the vector.
- * @param temp A vector of @c ACE_TCHAR pointers at least @a argc
+ * @param temp A vector of @c CHAR_TYPE pointers at least @a argc
* elements long. The vector will be used for argument shifting as
* the specified @a argv vector is consumed. The vector must not
* be modified while this object exists. If this argument is 0
* (the default) the object will allocate and free the temporary
* vector transparently.
*/
- ACE_Arg_Shifter (int& argc,
- const ACE_TCHAR **argv,
- const ACE_TCHAR **temp = 0);
+ ACE_TArg_Shifter (int& argc,
+ const CHAR_TYPE **argv,
+ const CHAR_TYPE **temp = 0);
/// Same behavior as the preceding constructor, but without the
/// "const" qualifier.
- ACE_Arg_Shifter (int& argc,
- ACE_TCHAR **argv,
- ACE_TCHAR **temp = 0);
+ ACE_TArg_Shifter (int& argc,
+ CHAR_TYPE **argv,
+ CHAR_TYPE **temp = 0);
/// Destructor.
- ~ACE_Arg_Shifter (void);
+ ~ACE_TArg_Shifter (void);
/// Get the current head of the vector.
- const ACE_TCHAR *get_current (void) const;
+ const CHAR_TYPE *get_current (void) const;
/**
* If the @a flag matches the current_arg of arg shifter
@@ -112,7 +113,7 @@ public:
* together '-foobarflagVALUE', the flag is NOT consumed
* and the cur arg is left pointing to the entire flag/value pair
*/
- const ACE_TCHAR *get_the_parameter (const ACE_TCHAR* flag);
+ const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag);
/**
* Check if the current argument matches (case insensitive) <flag>
@@ -143,7 +144,7 @@ public:
* Case C: If neither of Case A or B is met (no match)
* then -1 is returned
*/
- int cur_arg_strncasecmp (const ACE_TCHAR *flag);
+ int cur_arg_strncasecmp (const CHAR_TYPE *flag);
/// Consume @a number argument(s) by sticking them/it on the end of
/// the vector.
@@ -169,10 +170,10 @@ public:
private:
/// Copy Constructor should not be used.
- ACE_Arg_Shifter (const ACE_Arg_Shifter&);
+ ACE_TArg_Shifter (const ACE_TArg_Shifter&);
/// Assignment '=' operator should not be used.
- ACE_Arg_Shifter operator= (const ACE_Arg_Shifter&);
+ ACE_TArg_Shifter operator= (const ACE_TArg_Shifter&);
/// Refactor the constructor logic.
void init (void);
@@ -184,10 +185,10 @@ private:
int total_size_;
/// The temporary array over which we traverse.
- const ACE_TCHAR **temp_;
+ const CHAR_TYPE **temp_;
/// The array in which the arguments are reordered.
- const ACE_TCHAR **argv_;
+ const CHAR_TYPE **argv_;
/// The element in <temp_> we're currently examining.
int current_index_;
@@ -201,8 +202,15 @@ private:
int front_;
};
+typedef ACE_TArg_Shifter< ACE_TCHAR > ACE_Arg_Shifter;
+
ACE_END_VERSIONED_NAMESPACE_DECL
+#if defined (__ACE_INLINE__)
+#include "ace/Arg_Shifter.inl"
+#endif /* __ACE_INLINE__ */
+
+
#include /**/ "ace/post.h"
#endif /* ACE_ARG_SHIFTER_H */
diff --git a/ace/Argv_Type_Converter.cpp b/ace/Argv_Type_Converter.cpp
index 2fca97a0671..78d2788c331 100644
--- a/ace/Argv_Type_Converter.cpp
+++ b/ace/Argv_Type_Converter.cpp
@@ -15,55 +15,47 @@ ACE_RCSID (ace,
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-#if defined (ACE_USES_WCHAR)
ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv)
- : saved_argc_ (argc)
- , char_argv_ (0)
- , wchar_argv_ (argv)
- , before_pass_argc_ (argc)
- , original_type_ (1)
- , wchar_passed_ (0)
- , char_passed_ (0)
+: saved_argc_ (argc)
+, char_argv_ (0)
+, wchar_argv_ (argv)
+, before_pass_argc_ (argc)
+, original_type_wchar_ (true)
+, wchar_passed_ (false)
+, char_passed_ (false)
{
this->initialize ();
for (int i = 0; i < argc; ++i)
{
this->char_argv_[i] =
- ACE_OS::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i]));
+ ACE::String_Conversion::Convert_Out< char >( argv[i] ).c_str();
}
}
-#endif // ACE_USES_WCHAR
ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, char** argv)
- : saved_argc_(argc)
- , char_argv_(argv)
-#if defined (ACE_USES_WCHAR)
- , wchar_argv_(0)
- , before_pass_argc_(argc)
- , original_type_(0)
- , wchar_passed_(0)
- , char_passed_(0)
+: saved_argc_(argc)
+, char_argv_(argv)
+, wchar_argv_(false)
+, before_pass_argc_(argc)
+, original_type_wchar_(false)
+, wchar_passed_(false)
+, char_passed_(false)
{
this->initialize();
for (int i = 0; i < argc; ++i)
{
this->wchar_argv_[i] =
- ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i]));
+ ACE::String_Conversion::Convert_Out< wchar_t >( argv[i] ).c_str();
}
}
-#else
-{
-}
-#endif // ACE_USES_WCHAR
ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
{
-#if defined (ACE_USES_WCHAR)
// selectively delete the 'copy' of argv
- if (this->original_type_)
+ if (this->original_type_wchar_)
{
// if original type is wchar_t
if (this->char_passed_)
@@ -72,7 +64,7 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
}
for (int i = 0; i < this->before_pass_argc_; ++i)
{
- ACE_OS::free (this->char_argv_[i]);
+ ACE::String_Conversion::Convert_Out<char>::free( this->char_argv_[i] );
}
delete [] this->char_argv_;
}
@@ -84,18 +76,16 @@ ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void)
}
for (int i = 0; i < this->before_pass_argc_; ++i)
{
- ACE_OS::free (this->wchar_argv_[i]);
+ ACE::String_Conversion::Convert_Out<wchar_t>::free( this->wchar_argv_[i] );
}
delete [] this->wchar_argv_;
}
-#endif // ACE_USES_WCHAR
}
-#if defined (ACE_USES_WCHAR)
void
ACE_Argv_Type_Converter::initialize (void)
{
- if (this->original_type_)
+ if (this->original_type_wchar_)
{ // make a copy of argv in 'char' type
// Create one more argv entry than original argc for the NULL.
ACE_NEW (char_argv_, char*[this->saved_argc_ + 1]);
@@ -120,14 +110,14 @@ ACE_Argv_Type_Converter::align_char_with_wchar (void)
{
// if n'th entries of both argv lists are different
if (ACE_OS::strcmp(this->char_argv_[wchar_argv_index],
- ACE_TEXT_ALWAYS_CHAR (match_argv)) != 0)
+ ACE_TEXT_TO_CHAR_IN (match_argv)) != 0)
{
// loop through the wchar argv list entries that are after
// wchar_argv_index
for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i)
{
if (ACE_OS::strcmp (this->char_argv_[i],
- ACE_TEXT_ALWAYS_CHAR (match_argv))
+ ACE_TEXT_TO_CHAR_IN (match_argv))
== 0)
{
// swap the pointers in the char argv list
@@ -156,7 +146,7 @@ ACE_Argv_Type_Converter::align_wchar_with_char (void)
{
// if n'th entries of both argv lists are different
if (ACE_OS::strcmp (
- ACE_TEXT_ALWAYS_CHAR (this->wchar_argv_[char_argv_index]),
+ ACE_TEXT_TO_CHAR_IN (this->wchar_argv_[char_argv_index]),
match_argv) != 0)
{
// loop through the wchar argv list entries that are after
@@ -164,7 +154,7 @@ ACE_Argv_Type_Converter::align_wchar_with_char (void)
for (int i = char_argv_index + 1; i < this->before_pass_argc_; ++i)
{
if (ACE_OS::strcmp (
- ACE_TEXT_ALWAYS_CHAR(this->wchar_argv_[i]),
+ ACE_TEXT_TO_CHAR_IN(this->wchar_argv_[i]),
match_argv) == 0) {
// swap the pointers in the char argv list
wchar_t* temp = this->wchar_argv_[char_argv_index];
@@ -188,23 +178,22 @@ ACE_Argv_Type_Converter::cleanup (void)
for (int i = this->saved_argc_; i < this->before_pass_argc_; ++i)
{
// Check whether it's ours to delete.
- if (original_type_ == 1)
+ if (original_type_wchar_ == true)
{
- ACE_OS::free (this->char_argv_[i]);
+ ACE::String_Conversion::Convert_Out<char>::free( this->char_argv_[i] );
this->char_argv_[i] = 0;
}
else
{
- ACE_OS::free (this->wchar_argv_[i]);
+ ACE::String_Conversion::Convert_Out<wchar_t>::free( this->wchar_argv_[i] );
this->wchar_argv_[i] = 0;
}
}
this->before_pass_argc_ = this->saved_argc_;
- this->wchar_passed_ = 0;
- this->char_passed_ = 0;
+ this->wchar_passed_ = false;
+ this->char_passed_ = false;
}
-#endif // ACE_USES_WCHAR
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Argv_Type_Converter.h b/ace/Argv_Type_Converter.h
index 89ba35c6220..381448af6ab 100644
--- a/ace/Argv_Type_Converter.h
+++ b/ace/Argv_Type_Converter.h
@@ -42,15 +42,16 @@ public:
ACE_Argv_Type_Converter (int &argc, char** argv);
-#if defined (ACE_USES_WCHAR)
ACE_Argv_Type_Converter (int &argc, wchar_t** argv);
-#endif // ACE_USES_WCHAR
~ACE_Argv_Type_Converter (void);
/// Returns the pointer of converted command line.
ACE_TCHAR** get_TCHAR_argv (void);
+ /// Returns the pointer of converted command line.
+ wchar_t** get_Wide_argv (void);
+
/// Returns the pointer of ASCII (char) command line.
char** get_ASCII_argv (void);
@@ -65,8 +66,6 @@ private:
/// Assignment '=' operator should not be used.
ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&);
-#if defined (ACE_USES_WCHAR)
-
/// Perform common initialization for two Ctor's.
void initialize (void);
@@ -80,17 +79,15 @@ private:
/// Clean up removed (comsumed) argv entries and reset the pass flags.
void cleanup (void);
-#endif // ACE_USES_WCHAR
private:
/// Original number of input paramter, same as 'argc'.
int &saved_argc_;
- /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR.
+ /// Data member pointer that contains converted argv in char.
char** char_argv_;
-#if defined (ACE_USES_WCHAR)
- /// Data member pointer that contains converted argv in ACE_TCHAR.
+ /// Data member pointer that contains converted argv in wchar_t.
wchar_t** wchar_argv_;
/// argc value before any argv has been passed.
@@ -98,14 +95,13 @@ private:
/// FALSE represents original argv passed in is char, and TRUE
/// represents wchar_t.
- const int original_type_;
+ const bool original_type_wchar_;
/// TRUE indicates wchar_t type argv has been passed.
- int wchar_passed_;
+ bool wchar_passed_;
/// TRUE indicates char type argv has been passed.
- int char_passed_;
-#endif /* ACE_USES_WCHAR */
+ bool char_passed_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Argv_Type_Converter.inl b/ace/Argv_Type_Converter.inl
index f56c83146b3..54b9ed2dfc1 100644
--- a/ace/Argv_Type_Converter.inl
+++ b/ace/Argv_Type_Converter.inl
@@ -8,6 +8,15 @@ ACE_INLINE ACE_TCHAR**
ACE_Argv_Type_Converter::get_TCHAR_argv (void)
{
#if defined (ACE_USES_WCHAR)
+ return get_Wide_argv ();
+#else
+ return get_ASCII_argv ();
+#endif
+}
+
+ACE_INLINE wchar_t**
+ACE_Argv_Type_Converter::get_Wide_argv (void)
+{
if (this->char_passed_)
{
this->align_wchar_with_char ();
@@ -15,22 +24,17 @@ ACE_Argv_Type_Converter::get_TCHAR_argv (void)
this->wchar_passed_ = true;
return this->wchar_argv_;
-#else
- return this->char_argv_;
-#endif // ACE_USES_WCHAR
}
ACE_INLINE char**
ACE_Argv_Type_Converter::get_ASCII_argv (void)
{
-#if defined (ACE_USES_WCHAR)
if (this->wchar_passed_)
{
this->align_char_with_wchar ();
}
- this->char_passed_ = 1;
-#endif // ACE_USES_WCHAR
+ this->char_passed_ = true;
return this->char_argv_;
}
diff --git a/ace/Auto_Event.cpp b/ace/Auto_Event.cpp
index 9e106ac8119..456ac2a4890 100644
--- a/ace/Auto_Event.cpp
+++ b/ace/Auto_Event.cpp
@@ -19,12 +19,11 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state,
: ACE_Event (0,
initial_state,
type,
- ACE_TEXT_CHAR_TO_TCHAR (name),
+ ACE_TEXT_TO_TCHAR_IN (name),
arg)
{
}
-#if defined (ACE_HAS_WCHAR)
ACE_Auto_Event::ACE_Auto_Event (int initial_state,
int type,
const wchar_t *name,
@@ -32,11 +31,10 @@ ACE_Auto_Event::ACE_Auto_Event (int initial_state,
: ACE_Event (0,
initial_state,
type,
- ACE_TEXT_WCHAR_TO_TCHAR (name),
+ ACE_TEXT_TO_TCHAR_IN (name),
arg)
{
}
-#endif /* ACE_HAS_WCHAR */
void
ACE_Auto_Event::dump (void) const
diff --git a/ace/Auto_Event.h b/ace/Auto_Event.h
index d7279a13150..db1a834e9c0 100644
--- a/ace/Auto_Event.h
+++ b/ace/Auto_Event.h
@@ -45,13 +45,11 @@ public:
const char *name = 0,
void *arg = 0);
-#if defined (ACE_HAS_WCHAR)
/// Constructor which will create auto event (wchar_t version)
ACE_Auto_Event (int initial_state,
int type,
const wchar_t *name,
void *arg = 0);
-#endif /* ACE_HAS_WCHAR */
/// Default dtor.
~ACE_Auto_Event (void);
diff --git a/ace/Basic_Stats.cpp b/ace/Basic_Stats.cpp
index f81b29bfcaa..e727d1c8224 100644
--- a/ace/Basic_Stats.cpp
+++ b/ace/Basic_Stats.cpp
@@ -46,7 +46,35 @@ ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs)
}
void
-ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg,
+ACE_Basic_Stats::dump_results (const char *msg,
+ ACE_UINT32 sf) const
+{
+#ifndef ACE_NLOGGING
+ if (this->samples_count () == 0u)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("%s : no data collected\n"), msg));
+ return;
+ }
+
+ ACE_UINT64 avg = this->sum_ / this->samples_count_;
+
+ ACE_UINT64 l_min = this->min_ / sf;
+ ACE_UINT64 l_max = this->max_ / sf;
+ ACE_UINT64 l_avg = avg / sf;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("%s latency : %Q[%d]/%Q/%Q[%d] (min/avg/max)\n"),
+ msg,
+ l_min, this->min_at_,
+ l_avg,
+ l_max, this->max_at_));
+
+#endif /* ACE_NLOGGING */
+}
+
+void
+ACE_Basic_Stats::dump_results (const wchar_t *msg,
ACE_UINT32 sf) const
{
#ifndef ACE_NLOGGING
diff --git a/ace/Basic_Stats.h b/ace/Basic_Stats.h
index 2dc50694e63..f0c8a0f3b38 100644
--- a/ace/Basic_Stats.h
+++ b/ace/Basic_Stats.h
@@ -55,7 +55,10 @@ public:
* high resolution timer samples are acquired in clock ticks, but often
* presented in microseconds.
*/
- void dump_results (const ACE_TCHAR *msg,
+ void dump_results (const char *msg,
+ ACE_UINT32 scale_factor) const;
+
+ void dump_results (const wchar_t *msg,
ACE_UINT32 scale_factor) const;
/// The number of samples
diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h
index abde82d342c..c3ee616356e 100644
--- a/ace/Basic_Types.h
+++ b/ace/Basic_Types.h
@@ -14,7 +14,6 @@
*
* Sizes of built-in types:
* - ACE_SIZEOF_CHAR
- * - ACE_SIZEOF_WCHAR
* - ACE_SIZEOF_SHORT
* - ACE_SIZEOF_INT
* - ACE_SIZEOF_LONG
@@ -83,23 +82,6 @@
// A char always has 1 byte, by definition.
# define ACE_SIZEOF_CHAR 1
-// Unfortunately, there isn't a portable way to determine the size of a wchar.
-// So we just define them on a platform basis. If the platform doesn't
-// define it and it's an XPG4 system, assume wchar_t is 4 bytes. Some code
-// uses ACE_SIZEOF_WCHAR in preprocessor statements, so sizeof() isn't valid.
-// If the platform config doesn't set this, and this guess is wrong,
-// Basic_Types_Test should catch the inconsistency.
-# if defined (ACE_HAS_WCHAR)
-# if !defined (ACE_SIZEOF_WCHAR)
-# if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
-# define ACE_SIZEOF_WCHAR 4
-# else
-// 0 so the Basic_Types test will catch this.
-# define ACE_SIZEOF_WCHAR 0
-# endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
-# endif /* !ACE_SIZEOF_WCHAR */
-# endif /* ACE_HAS_WCHAR */
-
// The number of bytes in a short.
# if !defined (ACE_SIZEOF_SHORT)
# if (USHRT_MAX) == 255U
@@ -271,17 +253,6 @@ typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility.
// Define a generic byte for use in codecs
typedef unsigned char ACE_Byte;
-// Define a pseudo wide character type when wchar is not supported so we
-// can support basic wide character string operations.
-
-# if defined (ACE_HAS_WCHAR) || defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
-# define ACE_WINT_T wint_t
-# define ACE_WCHAR_T wchar_t
-# else
-# define ACE_WINT_T ACE_UINT16
-# define ACE_WCHAR_T ACE_UINT16
-# endif /* ACE_HAS_WCHAR */
-
// The number of bytes in a void *.
# ifndef ACE_SIZEOF_VOID_P
# define ACE_SIZEOF_VOID_P ACE_SIZEOF_LONG
@@ -684,27 +655,34 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#if !defined (ACE_UINT64_FORMAT_SPECIFIER)
# if defined (PRIu64)
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%") ACE_LIB_TEXT (PRIu64)
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%" PRIu64
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
# elif ACE_SIZEOF_LONG == 8
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%lu"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
# else
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%llu")
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%llu"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
# endif /* defined (PRIu64) */
#endif /* ACE_UINT64_FORMAT_SPECIFIER */
#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
-# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
+# define ACE_SSIZE_T_FORMAT_SPECIFIER_A "%I64d"
+# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_A)
# else
-# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%d")
+# define ACE_SSIZE_T_FORMAT_SPECIFIER_A "%d"
+# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_A)
# endif /* ACE_WIN64 */
#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */
#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER)
# if defined (ACE_WIN64)
-# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
+# define ACE_SIZE_T_FORMAT_SPECIFIER_A "%I64u"
+# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
# else
-# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%u")
+# define ACE_SIZE_T_FORMAT_SPECIFIER_A "%u"
+# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
# endif /* ACE_WIN64 */
#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */
@@ -772,7 +750,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_INT16_MAX 0x7FFF
#define ACE_INT16_MIN -(ACE_INT16_MAX)-1
#define ACE_UINT16_MAX 0xFFFF
-#define ACE_WCHAR_MAX ACE_UINT16_MAX
#define ACE_INT32_MAX 0x7FFFFFFF
#define ACE_INT32_MIN -(ACE_INT32_MAX)-1
#define ACE_UINT32_MAX 0xFFFFFFFF
diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h
index eb0bedb5f15..10f88a7144e 100644
--- a/ace/CDR_Base.h
+++ b/ace/CDR_Base.h
@@ -167,10 +167,16 @@ public:
* avoid complaints from all compilers is to define them all.
*/
//@{
+
+# if !defined (ACE_CDR_WCHAR_OVERRIDE) || defined(ACE_USES_WCHAR)
+# undef ACE_CDR_WCHAR_OVERRIDE
+# define ACE_CDR_WCHAR_OVERRIDE wchar_t
+# endif
+
typedef bool Boolean;
typedef unsigned char Octet;
typedef char Char;
- typedef ACE_WCHAR_T WChar;
+ typedef ACE_CDR_WCHAR_OVERRIDE WChar;
typedef ACE_INT16 Short;
typedef ACE_UINT16 UShort;
typedef ACE_INT32 Long;
diff --git a/ace/CE_Screen_Output.cpp b/ace/CE_Screen_Output.cpp
index 3afc5325d9a..8a477b97a85 100644
--- a/ace/CE_Screen_Output.cpp
+++ b/ace/CE_Screen_Output.cpp
@@ -77,13 +77,13 @@ ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output)
{
- *this << ACE_TEXT_CHAR_TO_TCHAR(output);
+ *this << ACE_TEXT_TO_TCHAR_IN(output);
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output)
{
- *this << ACE_TEXT_CHAR_TO_TCHAR(output);
+ *this << ACE_TEXT_TO_TCHAR_IN(output);
return *this;
}
diff --git a/ace/Default_Constants.h b/ace/Default_Constants.h
index 59087649661..22d51fe8296 100644
--- a/ace/Default_Constants.h
+++ b/ace/Default_Constants.h
@@ -51,7 +51,8 @@
#endif /* ACE_DEFAULT_PAGEFILE_POOL_CHUNK */
#if !defined (ACE_DEFAULT_PAGEFILE_POOL_NAME)
-#define ACE_DEFAULT_PAGEFILE_POOL_NAME ACE_LIB_TEXT ("Default_ACE_Pagefile_Memory_Pool")
+#define ACE_DEFAULT_PAGEFILE_POOL_NAME_A "Default_ACE_Pagefile_Memory_Pool"
+#define ACE_DEFAULT_PAGEFILE_POOL_NAME ACE_LIB_TEXT (ACE_DEFAULT_PAGEFILE_POOL_NAME_A)
#endif /* ACE_DEFAULT_PAGEFILE_POOL_NAME */
#if !defined (ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY)
@@ -124,7 +125,8 @@
# endif /* ACE_DEFAULT_MAX_SOCKET_BUFSIZ */
# if !defined (ACE_DEFAULT_SERVER_PORT_STR)
-# define ACE_DEFAULT_SERVER_PORT_STR ACE_LIB_TEXT("20002")
+# define ACE_DEFAULT_SERVER_PORT_STR_A "20002"
+# define ACE_DEFAULT_SERVER_PORT_STR ACE_LIB_TEXT(ACE_DEFAULT_SERVER_PORT_STR_A)
# endif /* ACE_DEFAULT_SERVER_PORT_STR */
// Used for the Service_Directory test
@@ -199,9 +201,11 @@
// Used by the FIFO tests and the Client_Logging_Handler netsvc.
# if !defined (ACE_DEFAULT_RENDEZVOUS)
# if defined (ACE_HAS_STREAM_PIPES)
-# define ACE_DEFAULT_RENDEZVOUS ACE_LIB_TEXT("/tmp/fifo.ace")
+# define ACE_DEFAULT_RENDEZVOUS_A "/tmp/fifo.ace"
+# define ACE_DEFAULT_RENDEZVOUS ACE_LIB_TEXT(ACE_DEFAULT_RENDEZVOUS_A)
# else
-# define ACE_DEFAULT_RENDEZVOUS ACE_LIB_TEXT("localhost:20010")
+# define ACE_DEFAULT_RENDEZVOUS_A "localhost:20010"
+# define ACE_DEFAULT_RENDEZVOUS ACE_LIB_TEXT(ACE_DEFAULT_RENDEZVOUS_A)
# endif /* ACE_HAS_STREAM_PIPES */
# endif /* ACE_DEFAULT_RENDEZVOUS */
@@ -213,23 +217,27 @@
# if !defined (ACE_DEFAULT_LOGGER_KEY)
# if defined (ACE_HAS_STREAM_PIPES)
-# define ACE_DEFAULT_LOGGER_KEY ACE_LIB_TEXT ("/tmp/server_daemon")
+# define ACE_DEFAULT_LOGGER_KEY_A "/tmp/server_daemon"
+# define ACE_DEFAULT_LOGGER_KEY ACE_LIB_TEXT (ACE_DEFAULT_LOGGER_KEY_A)
# else
-# define ACE_DEFAULT_LOGGER_KEY ACE_LIB_TEXT ("localhost:20012")
+# define ACE_DEFAULT_LOGGER_KEY_A "localhost:20012"
+# define ACE_DEFAULT_LOGGER_KEY ACE_LIB_TEXT (ACE_DEFAULT_LOGGER_KEY_A)
# endif /* ACE_HAS_STREAM_PIPES */
# endif /* ACE_DEFAULT_LOGGER_KEY */
// The way to specify the local host for loopback IP. This is usually
// "localhost" but it may need changing on some platforms.
# if !defined (ACE_LOCALHOST)
-# define ACE_LOCALHOST ACE_LIB_TEXT ("localhost")
+# define ACE_LOCALHOST_A "localhost"
+# define ACE_LOCALHOST ACE_LIB_TEXT (ACE_LOCALHOST_A)
# endif
// This specification for an IPv6 localhost should work on all platforms
// supporting IPv6
# if defined (ACE_HAS_IPV6)
# if !defined (ACE_IPV6_LOCALHOST)
-# define ACE_IPV6_LOCALHOST ACE_LIB_TEXT ("::1")
+# define ACE_IPV6_LOCALHOST_A "::1"
+# define ACE_IPV6_LOCALHOST ACE_LIB_TEXT (ACE_IPV6_LOCALHOST_A)
# endif /* ACE_IPV6_LOCALHOST*/
#endif /* ACE_HAS_IPV6 */
@@ -237,14 +245,17 @@
// supporting IPv6
# if defined (ACE_HAS_IPV6)
# if !defined (ACE_IPV6_ANY)
-# define ACE_IPV6_ANY ACE_LIB_TEXT ("::")
+# define ACE_IPV6_ANY_A "::"
+# define ACE_IPV6_ANY ACE_LIB_TEXT (ACE_IPV6_ANY_A)
# endif /* ACE_IPV6_ANY*/
#endif /* ACE_HAS_IPV6 */
# if !defined (ACE_DEFAULT_SERVER_HOST)
# if defined (ACE_HAS_IPV6)
+# define ACE_DEFAULT_SERVER_HOST_A ACE_IPV6_LOCALHOST_A
# define ACE_DEFAULT_SERVER_HOST ACE_IPV6_LOCALHOST
# else /*ACE_HAS_IPV6*/
+# define ACE_DEFAULT_SERVER_HOST_A ACE_LOCALHOST_A
# define ACE_DEFAULT_SERVER_HOST ACE_LOCALHOST
# endif /*ACE_HAS_IPV6*/
# endif /* ACE_DEFAULT_SERVER_HOST */
@@ -435,10 +446,8 @@
#endif /* ACE_WIN32 */
// Define the Wide character and normal versions of some of the string macros
-#if defined (ACE_HAS_WCHAR)
# define ACE_DIRECTORY_SEPARATOR_STR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_STR_A)
# define ACE_DIRECTORY_SEPARATOR_CHAR_W ACE_TEXT_WIDE(ACE_DIRECTORY_SEPARATOR_CHAR_A)
-#endif /* ACE_HAS_WCHAR */
#define ACE_DIRECTORY_SEPARATOR_STR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_STR_A)
#define ACE_DIRECTORY_SEPARATOR_CHAR ACE_LIB_TEXT (ACE_DIRECTORY_SEPARATOR_CHAR_A)
@@ -471,10 +480,8 @@
#endif /* ACE_WIN32 */
// Define the Wide character and normal versions of some of the string macros
-#if defined (ACE_HAS_WCHAR)
# define ACE_PLATFORM_W ACE_TEXT_WIDE(ACE_PLATFORM_A)
# define ACE_PLATFORM_EXE_SUFFIX_W ACE_TEXT_WIDE(ACE_PLATFORM_EXE_SUFFIX_A)
-#endif /* ACE_HAS_WCHAR */
#define ACE_PLATFORM ACE_LIB_TEXT (ACE_PLATFORM_A)
#define ACE_PLATFORM_EXE_SUFFIX ACE_LIB_TEXT (ACE_PLATFORM_EXE_SUFFIX_A)
@@ -490,7 +497,8 @@
# endif /* __MINGW32__ */
#else /* !ACE_WIN32 */
# if !defined (ACE_LD_SEARCH_PATH)
-# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT ("LD_LIBRARY_PATH")
+# define ACE_LD_SEARCH_PATH_A "LD_LIBRARY_PATH"
+# define ACE_LD_SEARCH_PATH ACE_LIB_TEXT (ACE_LD_SEARCH_PATH_A)
# endif /* ACE_LD_SEARCH_PATH */
# if !defined (ACE_LD_SEARCH_PATH_SEPARATOR_STR)
# define ACE_LD_SEARCH_PATH_SEPARATOR_STR ACE_LIB_TEXT (":")
@@ -509,9 +517,11 @@
// Used for dynamic linking
# if !defined (ACE_DEFAULT_SVC_CONF)
# if (ACE_USES_CLASSIC_SVC_CONF == 1)
-# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf")
+# define ACE_DEFAULT_SVC_CONF_A ".\\svc.conf"
+# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (ACE_DEFAULT_SVC_CONF_A)
# else
-# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf.xml")
+# define ACE_DEFAULT_SVC_CONF_A ".\\svc.conf.xml"
+# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (ACE_DEFAULT_SVC_CONF_A)
# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */
# endif /* ACE_DEFAULT_SVC_CONF */
#endif /* ACE_WIN32 */
@@ -519,14 +529,17 @@
// Used for dynamic linking.
#if !defined (ACE_DEFAULT_SVC_CONF)
# if (ACE_USES_CLASSIC_SVC_CONF == 1)
-# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf")
+# define ACE_DEFAULT_SVC_CONF_A "./svc.conf"
+# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (ACE_DEFAULT_SVC_CONF_A)
# else
-# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf.xml")
+# define ACE_DEFAULT_SVC_CONF_A "./svc.conf.xml"
+# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (ACE_DEFAULT_SVC_CONF_A)
# endif /* ACE_USES_CLASSIC_SVC_CONF ==1 */
#endif /* ACE_DEFAULT_SVC_CONF */
#if !defined (ACE_LOGGER_KEY)
-# define ACE_LOGGER_KEY ACE_LIB_TEXT ("/tmp/server_daemon")
+# define ACE_LOGGER_KEY_A "/tmp/server_daemon"
+# define ACE_LOGGER_KEY ACE_LIB_TEXT (ACE_LOGGER_KEY_A)
#endif /* ACE_LOGGER_KEY */
// Theses defines are used by the ACE Name Server.
@@ -546,16 +559,12 @@
# else /* ACE_WIN32 */
# define ACE_DEFAULT_NAMESPACE_DIR_A "/tmp"
# endif /* ACE_WIN32 */
-# if defined (ACE_HAS_WCHAR)
# define ACE_DEFAULT_NAMESPACE_DIR_W ACE_TEXT_WIDE(ACE_DEFAULT_NAMESPACE_DIR_A)
-# endif /* ACE_HAS_WCHAR */
# define ACE_DEFAULT_NAMESPACE_DIR ACE_LIB_TEXT(ACE_DEFAULT_NAMESPACE_DIR_A)
#endif /* ACE_LEGACY_MODE */
-#if defined (ACE_HAS_WCHAR)
# define ACE_DEFAULT_LOCALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_LOCALNAME_A)
# define ACE_DEFAULT_GLOBALNAME_W ACE_TEXT_WIDE(ACE_DEFAULT_GLOBALNAME_A)
-#endif /* ACE_HAS_WCHAR */
#define ACE_DEFAULT_LOCALNAME ACE_LIB_TEXT (ACE_DEFAULT_LOCALNAME_A)
#define ACE_DEFAULT_GLOBALNAME ACE_LIB_TEXT (ACE_DEFAULT_GLOBALNAME_A)
diff --git a/ace/Dev_Poll_Reactor.cpp b/ace/Dev_Poll_Reactor.cpp
index fa61f2ae6c5..e5a783d938c 100644
--- a/ace/Dev_Poll_Reactor.cpp
+++ b/ace/Dev_Poll_Reactor.cpp
@@ -1384,7 +1384,7 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard)
}
else
{
- ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"), handle, revents));
+ ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("(%t) dispatch_io h %d unknown events 0x%x\n"), handle, revents));
// ACE_ASSERT (0);
}
diff --git a/ace/Dynamic_Service.inl b/ace/Dynamic_Service.inl
index 3980038ef3f..21fb05215e8 100644
--- a/ace/Dynamic_Service.inl
+++ b/ace/Dynamic_Service.inl
@@ -9,7 +9,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class TYPE> ACE_INLINE TYPE *
ACE_Dynamic_Service<TYPE>::instance (const ACE_ANTI_TCHAR *name)
{
- return instance (ACE_TEXT_CHAR_TO_TCHAR (name));
+ return instance (ACE_TEXT_TO_TCHAR_IN (name));
}
template <class TYPE> ACE_INLINE TYPE *
diff --git a/ace/Env_Value_T.inl b/ace/Env_Value_T.inl
index 63fe8df1f29..1af0296cf91 100644
--- a/ace/Env_Value_T.inl
+++ b/ace/Env_Value_T.inl
@@ -1,3 +1,4 @@
+// -*- C++ -*-
// $Id$
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -35,15 +36,9 @@ ACE_Env_Value<T>::open (const ACE_TCHAR *varname,
template <class T> ACE_INLINE void
ACE_Env_Value<T>::fetch_value (void)
{
-#if defined (ACE_WIN32)
const ACE_TCHAR *env = ACE_OS::getenv (this->varname_);
if (env != 0)
ACE_Convert (env, value_);
-#else
- char *nenv = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (this->varname_));
- if (nenv != 0)
- ACE_Convert (ACE_TEXT_CHAR_TO_TCHAR (nenv), this->value_);
-#endif
}
template <class T> ACE_INLINE const ACE_TCHAR*
diff --git a/ace/FILE_Connector.cpp b/ace/FILE_Connector.cpp
index c3991c309ea..cc471d5ce24 100644
--- a/ace/FILE_Connector.cpp
+++ b/ace/FILE_Connector.cpp
@@ -67,7 +67,7 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io,
handle = ACE_OS::mkstemp (filename); // mkstemp() replaces "XXXXXX"
if (handle == ACE_INVALID_HANDLE
- || new_io.addr_.set (ACE_TEXT_CHAR_TO_TCHAR (filename)) != 0)
+ || new_io.addr_.set (ACE_TEXT_TO_TCHAR_IN (filename)) != 0)
return -1;
new_io.set_handle (handle);
diff --git a/ace/Functor.h b/ace/Functor.h
index 01967e5f977..9cf8f200336 100644
--- a/ace/Functor.h
+++ b/ace/Functor.h
@@ -480,9 +480,7 @@ public:
const char *rhs) const;
};
-#if defined (ACE_HAS_WCHAR)
-
-# if ! defined (ACE_LACKS_NATIVE_WCHAR_T)
+# if ! defined (ACE_LACKS_BUILTIN_WCHAR_T)
/**
* @class ACE_Hash<wchar_t>
*
@@ -495,7 +493,7 @@ public:
/// Simply returns t
unsigned long operator () (wchar_t t) const;
};
-# endif /* ACE_LACKS_NATIVE_WCHAR_T */
+# endif /* ACE_LACKS_BUILTIN_WCHAR_T */
/**
* @class ACE_Hash<const wchar_t *>
*
@@ -581,7 +579,6 @@ public:
const wchar_t *rhs) const;
};
-#endif // ACE_HAS_WCHAR
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Functor.inl b/ace/Functor.inl
index 84e38313b02..c505ed328b3 100644
--- a/ace/Functor.inl
+++ b/ace/Functor.inl
@@ -56,13 +56,13 @@ ACE_Hash<char>::operator () (char t) const
return t;
}
-#if defined (ACE_HAS_WCHAR) && ! defined (ACE_LACKS_NATIVE_WCHAR_T)
+#if !defined (ACE_LACKS_BUILTIN_WCHAR_T)
ACE_INLINE unsigned long
ACE_Hash<wchar_t>::operator () (wchar_t t) const
{
return t;
}
-#endif /* ACE_HAS_WCHAR && ! ACE_LACKS_NATIVE_WCHAR_T */
+#endif /* ACE_LACKS_BUILTIN_WCHAR_T */
ACE_INLINE unsigned long
ACE_Hash<signed char>::operator () (signed char t) const
@@ -243,9 +243,6 @@ ACE_Less_Than<char *>::operator () (const char *lhs, const char *rhs) const
return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
}
-
-#if defined (ACE_HAS_WCHAR)
-
ACE_INLINE unsigned long
ACE_Hash<const wchar_t *>::operator () (const wchar_t *t) const
{
@@ -284,6 +281,5 @@ ACE_Less_Than<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) c
return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
}
-#endif // ACE_HAS_WCHAR
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Functor_String.h b/ace/Functor_String.h
index 6c68b026bd1..4becd6c4cf0 100644
--- a/ace/Functor_String.h
+++ b/ace/Functor_String.h
@@ -83,9 +83,6 @@ public:
const ACE_CString &rhs) const;
};
-
-#if defined (ACE_USES_WCHAR)
-
/**
* @class ACE_Equal_To<ACE_WString>
*
@@ -129,7 +126,6 @@ public:
const ACE_WString &rhs) const;
};
-#endif /*ACE_USES_WCHAR*/
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Functor_String.inl b/ace/Functor_String.inl
index 82e8775a718..a9d5f0597d6 100644
--- a/ace/Functor_String.inl
+++ b/ace/Functor_String.inl
@@ -29,7 +29,6 @@ ACE_Less_Than<ACE_CString>::operator () (const ACE_CString &lhs,
}
-#if defined (ACE_USES_WCHAR)
ACE_INLINE unsigned long
ACE_Hash<ACE_WString>::operator () (const ACE_WString &t) const
{
@@ -51,6 +50,5 @@ ACE_Less_Than<ACE_WString>::operator () (const ACE_WString &lhs,
return (lhs < rhs);
}
-#endif /*ACE_USES_WCHAR*/
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Get_Opt.cpp b/ace/Get_Opt.cpp
index db472fbbdd6..50e6d4fa07b 100644
--- a/ace/Get_Opt.cpp
+++ b/ace/Get_Opt.cpp
@@ -6,14 +6,6 @@
#include "ace/Get_Opt.inl"
#endif /* __ACE_INLINE__ */
-#include "ace/ACE.h"
-#include "ace/Log_Msg.h"
-#include "ace/SString.h"
-#include "ace/OS_Memory.h"
-#include "ace/OS_NS_string.h"
-#include "ace/OS_NS_ctype.h"
-#include "ace/OS_NS_stdlib.h"
-
ACE_RCSID (ace,
Get_Opt,
"$Id$")
@@ -87,652 +79,17 @@ ACE_RCSID (ace,
* POSSIBILITY OF SUCH DAMAGE.
*/
+// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-ACE_ALLOC_HOOK_DEFINE(ACE_Get_Opt)
-
-ACE_Get_Opt::ACE_Get_Opt (int argc,
- ACE_TCHAR **argv,
- const ACE_TCHAR *optstring,
- int skip,
- int report_errors,
- int ordering,
- int long_only)
- : argc_ (argc),
- argv_ (argv),
- optind (skip),
- opterr (report_errors),
- optarg (0),
- optstring_ (0),
- long_only_ (long_only),
- has_colon_ (0),
- last_option_ (0),
- nextchar_ (0),
- optopt_ (0),
- ordering_ (ordering),
- nonopt_start_ (optind),
- nonopt_end_ (optind),
- long_option_ (0)
-{
- ACE_TRACE ("ACE_Get_Opt::ACE_Get_Opt");
-
- ACE_NEW (this->optstring_, ACE_TString (optstring));
- ACE_NEW (this->last_option_, ACE_TString (ACE_LIB_TEXT ("")));
-
- // First check to see if POSIXLY_CORRECT was set.
- // Win32 is the only platform capable of wide-char env var.
-#if defined (ACE_WIN32)
- const ACE_TCHAR *env_check = ACE_LIB_TEXT ("POSIXLY_CORRECT");
-#else
- const char *env_check = "POSIXLY_CORRECT";
-#endif
- if (ACE_OS::getenv (env_check) != 0)
- this->ordering_ = REQUIRE_ORDER;
-
- // Now, check to see if any or the following were passed at
- // the begining of optstring: '+' same as POSIXLY_CORRECT;
- // '-' turns off POSIXLY_CORRECT; or ':' which signifies we
- // should return ':' if a parameter is missing for an option.
- // We use a loop here, since a combination of "{+|-}:" in any
- // order should be legal.
- int done = 0;
- int offset = 0;
- while (!done)
- {
- switch (optstring[offset++])
- {
- case '+':
- this->ordering_ = REQUIRE_ORDER;
- break;
- case '-':
- this->ordering_ = RETURN_IN_ORDER;
- break;
- case ':':
- this->has_colon_ = 1;
- break;
- default:
- // Quit as soon as we see something else...
- done = 1;
- break;
- }
- }
-}
-
-ACE_Get_Opt::~ACE_Get_Opt (void)
-{
- ACE_TRACE ("ACE_Get_Opt::~ACE_Get_Opt");
-
- size_t i = 0;
- size_t size = this->long_opts_.size ();
- ACE_Get_Opt_Long_Option *option = 0;
- for (i = 0; i < size; ++i)
- {
- int retval = this->long_opts_.get (option, i);
- if (retval != 0)
- {
- // Should never happen.
- retval = 0;
- continue;
- }
- if (option)
- {
- delete option;
- option = 0;
- }
- }
- delete this->optstring_;
- delete this->last_option_;
-}
-
-int
-ACE_Get_Opt::nextchar_i (void)
-{
- ACE_TRACE ("ACE_Get_Opt::nextchar_i");
-
- if (this->ordering_ == PERMUTE_ARGS)
- if (this->permute () == EOF)
- return EOF;
-
- // Update scanning pointer.
- if (this->optind >= this->argc_)
- {
- // We're done...
- this->nextchar_ = 0;
- return EOF;
- }
- else if (*(this->nextchar_ = this->argv_[this->optind]) != '-'
- || this->nextchar_[1] == '\0')
- {
- // We didn't get an option.
-
- if (this->ordering_ == REQUIRE_ORDER
- || this->ordering_ == PERMUTE_ARGS)
- // If we permuted or require the options to be in order, we're done.
- return EOF;
-
- // It must be RETURN_IN_ORDER...
- this->optarg = this->argv_[this->optind++];
- this->nextchar_ = 0;
- return 1;
- }
- else if (this->nextchar_[1] != 0
- && *++this->nextchar_ == '-'
- && this->nextchar_[1] == 0)
- {
- // Found "--" so we're done...
- ++this->optind;
- this->nextchar_ = 0;
- return EOF;
- }
-
- // If it's a long option, and we allow long options advance nextchar_.
- if (*this->nextchar_ == '-' && this->long_opts_.size () != 0)
- this->nextchar_++;
-
- return 0;
-}
-
-int
-ACE_Get_Opt::long_option_i (void)
-{
- ACE_TRACE ("ACE_Get_Opt::long_option_i");
-
- ACE_Get_Opt_Long_Option *p;
- ACE_TCHAR *s = this->nextchar_;
- int hits = 0;
- int exact = 0;
- ACE_Get_Opt_Long_Option *pfound = 0;
- int indfound = 0;
-
- // Advance to the end of the long option name so we can use
- // it to get the length for a string compare.
- while (*s && *s != '=')
- s++;
-
- size_t len = s - this->nextchar_;
- // set last_option_ to nextchar_, up to the '='.
- this->last_option (ACE_TString (this->nextchar_, len));
-
- size_t size = this->long_opts_.size ();
- u_int option_index = 0;
- for (option_index = 0; option_index < size ; option_index++)
- {
- p = this->long_opts_[option_index];
- ACE_ASSERT (p);
-
- if (!ACE_OS::strncmp (p->name_, this->nextchar_, len))
- {
- // Got at least a partial match.
- pfound = p;
- indfound = option_index;
- hits += 1;
- if (len == ACE_OS::strlen(p->name_))
- {
- // And in fact, it's an exact match, so let's use it.
- exact = 1;
- break;
- }
- }
- }
-
- if ((hits > 1) && !exact)
- {
- // Great, we found a match, but unfortunately we found more than
- // one and it wasn't exact.
- if (this->opterr)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("%s: option `%s' is ambiguous\n"),
- this->argv_[0], this->argv_[this->optind]));
- this->nextchar_ = 0;
- this->optind++;
- return '?';
- }
-
- if (pfound != 0)
- {
- // Okay, we found a good one (either a single hit or an exact match).
- option_index = indfound;
- this->optind++;
- if (*s)
- {
- // s must point to '=' which means there's an argument (well
- // close enough).
- if (pfound->has_arg_ != NO_ARG)
- // Good, we want an argument and here it is.
- this->optarg = ++s;
- else
- {
- // Whoops, we've got what looks like an argument, but we
- // don't want one.
- if (this->opterr)
- ACE_ERROR
- ((LM_ERROR,
- ACE_LIB_TEXT ("%s: long option `--%s' doesn't allow ")
- ACE_LIB_TEXT ("an argument\n"),
- this->argv_[0], pfound->name_));
- // The spec doesn't cover this, so we keep going and the program
- // doesn't know we ignored an argument if opt_err is off!!!
- }
- }
- else if (pfound->has_arg_ == ARG_REQUIRED)
- {
- // s didn't help us, but we need an argument. Note that
- // optional arguments for long options must use the "=" syntax,
- // so we won't get here in that case.
- if (this->optind < this->argc_)
- // We still have some elements left, so use the next one.
- this->optarg = this->argv_[this->optind++];
- else
- {
- // All out of elements, so we have to punt...
- if (this->opterr)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("%s: long option '--%s' requires ")
- ACE_LIB_TEXT ("an argument\n"),
- this->argv_[0], pfound->name_));
- this->nextchar_ = 0;
- this->optopt_ = pfound->val_; // Remember matching short equiv
- return this->has_colon_ ? ':' : '?';
- }
- }
- this->nextchar_ = 0;
- this->long_option_ = pfound;
- // Since val_ has to be either a valid short option or 0, this works
- // great. If the user really wants to know if a long option was passed.
- this->optopt_ = pfound->val_;
- return pfound->val_;
- }
- if (!this->long_only_ || this->argv_[this->optind][1] == '-'
- || this->optstring_->find (*this->nextchar_) == ACE_TString::npos)
- {
- // Okay, we couldn't find a long option. If it isn't long_only (which
- // means try the long first, and if not found try the short) or a long
- // signature was passed, e.g. "--", or it's not a short (not sure when
- // this could happen) it's an error.
- if (this->opterr)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("%s: illegal long option '--%s'\n"),
- this->argv_[0], this->nextchar_));
- this->nextchar_ = 0;
- this->optind++;
- return '?';
- }
- return this->short_option_i ();
-}
-
-int
-ACE_Get_Opt::short_option_i (void)
-{
- ACE_TRACE ("ACE_Get_Opt::short_option_i");
-
- /* Look at and handle the next option-character. */
- ACE_TCHAR opt = *this->nextchar_++;
- // Set last_option_ to opt
- this->last_option (opt);
-
- ACE_TCHAR *oli = 0;
- oli =
- const_cast<ACE_TCHAR*> (ACE_OS::strchr (this->optstring_->c_str (), opt));
-
- /* Increment `optind' when we start to process its last character. */
- if (*this->nextchar_ == '\0')
- ++this->optind;
-
- if (oli == 0 || opt == ':')
- {
- if (this->opterr)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("%s: illegal short option -- %c\n"),
- this->argv_[0], opt));
- return '?';
- }
- if (opt == 'W' && oli[1] == ';')
- {
- if (this->nextchar_[0] == 0)
- this->nextchar_ = this->argv_[this->optind];
- return long_option_i ();
- }
- this->optopt_ = oli[0]; // Remember the option that matched
- if (oli[1] == ':')
- {
- if (oli[2] == ':')
- {
- // Takes an optional argument, and since short option args must
- // must follow directly in the same argument, a NULL nextchar_
- // means we didn't get one.
- if (*this->nextchar_ != '\0')
- {
- this->optarg = this->nextchar_;
- this->optind++;
- }
- else
- this->optarg = 0;
- this->nextchar_ = 0;
- }
- else
- {
- // Takes a required argument.
- if (*this->nextchar_ != '\0')
- {
- // Found argument in same argv-element.
- this->optarg = this->nextchar_;
- this->optind++;
- }
- else if (this->optind == this->argc_)
- {
- // Ran out of arguments before finding required argument.
- if (this->opterr)
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("%s: short option requires ")
- ACE_LIB_TEXT ("an argument -- %c\n"),
- this->argv_[0], opt));
- opt = this->has_colon_ ? ':' : '?';
- }
- else
- // Use the next argv-element as the argument.
- this->optarg = this->argv_[this->optind++];
- this->nextchar_ = 0;
- }
- }
- return opt;
-}
-
-int
-ACE_Get_Opt::operator () (void)
-{
- ACE_TRACE ("ACE_Get_Opt_Long::operator");
-
- // First of all, make sure we reinitialize any pointers..
- this->optarg = 0;
- this->long_option_ = 0;
-
- if (this->argv_ == 0)
- {
- // It can happen, e.g., on VxWorks.
- this->optind = 0;
- return -1;
- }
-
- // We check this because we can string short options together if the
- // preceding one doesn't take an argument.
- if (this->nextchar_ == 0 || *this->nextchar_ == '\0')
- {
- int retval = this->nextchar_i ();
- if (retval != 0)
- return retval;
- }
-
- if (((this->argv_[this->optind][0] == '-')
- && (this->argv_[this->optind][1] == '-')) || this->long_only_)
- return this->long_option_i ();
-
- return this->short_option_i ();
-}
-
-int
-ACE_Get_Opt::long_option (const ACE_TCHAR *name,
- OPTION_ARG_MODE has_arg)
-{
- ACE_TRACE ("ACE_Get_Opt::long_option (const ACE_TCHAR *name, OPTION_ARG_MODE has_arg)");
- return this->long_option (name, 0, has_arg);
-}
-
-int
-ACE_Get_Opt::long_option (const ACE_TCHAR *name,
- int short_option,
- OPTION_ARG_MODE has_arg)
-{
- ACE_TRACE ("ACE_Get_Opt::long_option (const ACE_TCHAR *name, int short_option, OPTION_ARG_MODE has_arg)");
-
- // We only allow valid alpha-numeric characters as short options.
- // If short_options is not a valid alpha-numeric, we can still return it
- // when the long option is found, but won't allow the caller to pass it on
- // the command line (how could they?). The special case is 0, but since
- // we always return it, we let the caller worry about that.
-#if defined (_MSC_VER) && (_MSC_VER >= 1300)
- // For MSVC 7.x, we need to prevent "illegal" character getting into
- // isalnum, otherwise, it will crash the program.
- if (short_option > 0 &&
- short_option < 256 &&
- ACE_OS::ace_isalnum (static_cast<char> (short_option)) != 0)
-#else
- if (ACE_OS::ace_isalnum (short_option) != 0)
-#endif /* _MSC_VER && _MSC_VER >= 1300 */
- {
- // If the short_option already exists, make sure it matches, otherwise
- // add it.
- ACE_TCHAR *s = 0;
- if ((s = const_cast<ACE_TCHAR*> (
- ACE_OS::strchr (this->optstring_->c_str (),
- short_option))) != 0)
- {
- // Short option exists, so verify the argument options
- if (s[1] == ':')
- {
- if (s[2] == ':')
- {
- if (has_arg != ARG_OPTIONAL)
- {
- if (this->opterr)
- ACE_ERROR
- ((LM_ERROR,
- ACE_LIB_TEXT ("Existing short option '%c' takes ")
- ACE_LIB_TEXT ("optional argument; adding %s ")
- ACE_LIB_TEXT ("requires ARG_OPTIONAL\n"),
- short_option, name));
- return -1;
- }
- }
- else
- if (has_arg != ARG_REQUIRED)
- {
- if (this->opterr)
- ACE_ERROR
- ((LM_ERROR,
- ACE_LIB_TEXT ("Existing short option '%c' requires ")
- ACE_LIB_TEXT ("an argument; adding %s ")
- ACE_LIB_TEXT ("requires ARG_REQUIRED\n"),
- short_option, name));
- return -1;
- }
- }
- else if (has_arg != NO_ARG)
- {
- if (this->opterr)
- ACE_ERROR
- ((LM_ERROR,
- ACE_LIB_TEXT ("Existing short option '%c' does not ")
- ACE_LIB_TEXT ("accept an argument; adding %s ")
- ACE_LIB_TEXT ("requires NO_ARG\n"),
- short_option, name));
- return -1;
- }
- }
- else
- {
- // Didn't find short option, so add it...
- *this->optstring_ += (ACE_TCHAR) short_option;
- if (has_arg == ARG_REQUIRED)
- *this->optstring_ += ACE_LIB_TEXT (":");
- else if (has_arg == ARG_OPTIONAL)
- *this->optstring_ += ACE_LIB_TEXT ("::");
- }
- }
-
- ACE_Get_Opt_Long_Option *option =
- new ACE_Get_Opt_Long_Option (name, has_arg, short_option);
-
- if (!option)
- return -1;
-
- // Add to array
- size_t size = this->long_opts_.size ();
- if (this->long_opts_.size (size + 1) != 0
- || this->long_opts_.set (option, size) != 0)
- {
- delete option;
- ACE_ERROR_RETURN
- ((LM_ERROR, ACE_LIB_TEXT ("Could not add long option to array.\n")),
- -1);
- }
- return 0;
-}
-
-const ACE_TCHAR*
-ACE_Get_Opt::long_option (void) const
-{
- ACE_TRACE ("ACE_Get_Opt::long_option (void)");
- if (this->long_option_)
- return this->long_option_->name_;
- return 0;
-}
-
-const ACE_TCHAR*
-ACE_Get_Opt::last_option (void) const
-{
- return this->last_option_->c_str ();
-}
-
-void
-ACE_Get_Opt::last_option (const ACE_TString &last_option)
-{
- *this->last_option_ = last_option;
-}
-
-void
-ACE_Get_Opt::dump (void) const
-{
-#if defined (ACE_HAS_DUMP)
- ACE_TRACE ("ACE_Get_Opt::dump");
-
- ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")
- ACE_LIB_TEXT ("opstring_ = %s\n")
- ACE_LIB_TEXT ("long_only_ = %d\n")
- ACE_LIB_TEXT ("has_colon_ = %d\n")
- ACE_LIB_TEXT ("last_option_ = %s\n")
- ACE_LIB_TEXT ("nextchar_ = %s\n")
- ACE_LIB_TEXT ("optopt_ = %c\n")
- ACE_LIB_TEXT ("ordering_ = %d\n"),
- this->optstring_->c_str (),
- this->long_only_,
- this->has_colon_,
- this->last_option_->c_str (),
- this->nextchar_,
- this->optopt_,
- this->ordering_));
-
- // now loop through the
- size_t size = this->long_opts_.size ();
- for (u_int i = 0; i < size ; ++i)
- {
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")
- ACE_LIB_TEXT ("long_option name_ = %s\n")
- ACE_LIB_TEXT ("has_arg_ = %d\n")
- ACE_LIB_TEXT ("val_ = %d\n"),
- this->long_opts_[i]->name_,
- this->long_opts_[i]->has_arg_,
- this->long_opts_[i]->val_));
- }
- ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
-#endif /* ACE_HAS_DUMP */
-}
-
-void
-ACE_Get_Opt::permute_args (void)
-{
- ACE_TRACE ("ACE_Get_Opt::permute_args");
-
- u_long cyclelen, i, j, ncycle, nnonopts, nopts;
- u_long opt_end = this->optind;
- int cstart, pos = 0;
- ACE_TCHAR *swap = 0;
-
- nnonopts = this->nonopt_end_ - this->nonopt_start_;
- nopts = opt_end - this->nonopt_end_;
- ncycle = ACE::gcd (nnonopts, nopts);
- cyclelen = (opt_end - this->nonopt_start_) / ncycle;
-
- this->optind = this->optind - nnonopts;
-
- for (i = 0; i < ncycle; i++)
- {
- cstart = this->nonopt_end_ + i;
- pos = cstart;
- for (j = 0; j < cyclelen; j++)
- {
- if (pos >= this->nonopt_end_)
- pos -= nnonopts;
- else
- pos += nopts;
- swap = this->argv_[pos];
-
- ((ACE_TCHAR **)this->argv_)[pos] = argv_[cstart];
-
- ((ACE_TCHAR **)this->argv_)[cstart] = swap;
- }
- }
-}
-
-int
-ACE_Get_Opt::permute (void)
-{
- ACE_TRACE ("ACE_Get_Opt::permute");
-
- if (this->nonopt_start_ != this->nonopt_end_
- && this->nonopt_start_ != this->optind)
- this->permute_args ();
-
- this->nonopt_start_ = this->optind;
-
- // Skip over args untill we find the next option.
- while (this->optind < this->argc_
- && (this->argv_[this->optind][0] != '-'
- || this->argv_[this->optind][1] == '\0'))
- this->optind++;
-
- // Got an option, so mark this as the end of the non options.
- this->nonopt_end_ = this->optind;
-
- if (this->optind != this->argc_
- && ACE_OS::strcmp (this->argv_[this->optind],
- ACE_LIB_TEXT ("--")) == 0)
- {
- // We found the marker for the end of the options.
- this->optind++;
-
- if (this->nonopt_start_ != this->nonopt_end_
- && this->nonopt_end_ != this->optind)
- this->permute_args ();
- }
-
- if (this->optind == this->argc_)
- {
- if (this->nonopt_start_ != this->nonopt_end_)
- this->optind = this->nonopt_start_;
- return EOF;
- }
- return 0;
-}
-
-const ACE_TCHAR *
-ACE_Get_Opt::optstring (void) const
-{
- return this->optstring_->c_str ();
-}
-
-ACE_Get_Opt::ACE_Get_Opt_Long_Option::ACE_Get_Opt_Long_Option (
- const ACE_TCHAR *name,
- int has_arg,
- int val)
- : name_ (ACE::strnew (name)),
- has_arg_ (has_arg),
- val_ (val)
-{}
-
-ACE_Get_Opt::ACE_Get_Opt_Long_Option::~ACE_Get_Opt_Long_Option (void)
-{
- delete [] this->name_;
-}
+/**
+ * Templates cannot be exported. Only explicit instances can.
+ * This is also a way to restrict what instances will be
+ * publicly available.
+ */
+#if !defined (__ACE_INLINE__)
+ template class ACE_Get_Arg_Opt< ACE_TCHAR >;
+#endif /* __ACE_INLINE__ */
+// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Get_Opt.h b/ace/Get_Opt.h
index 73a18f6a051..2237dd412f9 100644
--- a/ace/Get_Opt.h
+++ b/ace/Get_Opt.h
@@ -30,20 +30,24 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/*
* These definitions are for backward compatibility with previous versions.
- * of ACE_Get_Opt.
+ * of ACE_Get_Arg_Opt.
*/
/**
- * @class ACE_Get_Opt
+ * @class ACE_Get_Arg_Opt
*
* @brief Iterator for parsing command-line arguments.
*
* This is a C++ wrapper for getopt(3c) and getopt_long(3c).
*/
-class ACE_Export ACE_Get_Opt
+template < typename CHAR_TYPE = char >
+class ACE_Export ACE_Get_Arg_Opt
{
public:
+ typedef CHAR_TYPE Char;
+ typedef ACE_String_Base<Char> String;
+
/// Mutually exclusive ordering values.
enum
{
@@ -169,16 +173,16 @@ public:
* xxx" will only find "xxx" as the argument for @e c if @a optstring is
* specified as @c "abc:" not @c "abc::".
*/
- ACE_Get_Opt (int argc,
- ACE_TCHAR **argv,
- const ACE_TCHAR *optstring = ACE_LIB_TEXT (""),
+ ACE_Get_Arg_Opt (int argc,
+ Char **argv,
+ const Char *optstring = 0,
int skip_args = 1,
int report_errors = 0,
int ordering = PERMUTE_ARGS,
int long_only = 0);
/// Default dtor.
- ~ACE_Get_Opt (void);
+ ~ACE_Get_Arg_Opt (void);
/**
* Scan elements of @a argv (whose length is @a argc) for short option
@@ -218,12 +222,14 @@ public:
*/
int operator () (void);
+ static int eof();
+
/**
* For communication from @c operator() to the caller. When
* @c operator() finds an option that takes an argument, the argument
* value is returned from this method, otherwise it returns 0.
*/
- ACE_TCHAR *opt_arg (void) const;
+ Char *opt_arg (void) const;
/**
* Returns the most recently matched option character. Especially
@@ -231,7 +237,7 @@ public:
* that's required, since this allows the caller to learn what option
* was specified without its required argument.
*/
- int opt_opt (void);
+ Char opt_opt (void);
/**
* Index in @a argv of the next element to be scanned. This is used
@@ -258,7 +264,7 @@ public:
* @retval 0 Success
* @retval -1 The long option can not be added.
*/
- int long_option (const ACE_TCHAR *name,
+ int long_option (const Char *name,
OPTION_ARG_MODE has_arg = NO_ARG);
/// Adds a long option with a corresponding short option.
@@ -275,32 +281,32 @@ public:
* @retval 0 Success
* @retval -1 The long option can not be added.
*/
- int long_option (const ACE_TCHAR *name,
+ int long_option (const Char *name,
int short_option,
OPTION_ARG_MODE has_arg = NO_ARG);
/// Returns the name of the long option found on the last call to
/// @c operator() or 0 if none was found.
- const ACE_TCHAR *long_option (void) const;
+ const Char *long_option (void) const;
/// The number of arguments in the internal @c argv_.
int argc (void) const;
/// Accessor for the internal @c argv_ pointer.
- ACE_TCHAR **argv (void) const;
+ Char **argv (void) const;
/// Accessor for the @c last_option that was processed. This allows
/// applications to know if the found option was a short or long
/// option, and is especially useful in cases where it was invalid
/// and the caller wants to print out the invalid value.
- const ACE_TCHAR *last_option (void) const;
+ const Char *last_option (void) const;
/// Dump the state of an object.
void dump (void) const;
/// Return the @a optstring. This is handy to verify that calls to
/// long_option added short options as expected.
- const ACE_TCHAR *optstring (void) const;
+ const Char *optstring (void) const;
public:
/*
@@ -325,7 +331,7 @@ public:
* write code that relies on this member being public; use the
* @c argv() accessor method instead.
*/
- ACE_TCHAR **argv_;
+ Char **argv_;
/// Index in @c argv_ of the next element to be scanned.
/**
@@ -354,18 +360,18 @@ public:
* write code that relies on this member being public; use the
* @c opt_arg() accessor method instead.
*/
- ACE_TCHAR *optarg;
+ Char *optarg;
private:
/**
* @class ACE_Get_Opt_Long_Option This class is for internal use
- * in the ACE_Get_Opt class, and is inaccessible to users.
+ * in the ACE_Get_Arg_Opt class, and is inaccessible to users.
*/
class ACE_Get_Opt_Long_Option
{
public:
/// ctor
- ACE_Get_Opt_Long_Option (const ACE_TCHAR *name,
+ ACE_Get_Opt_Long_Option (const Char *name,
int has_arg,
int val = 0);
@@ -375,7 +381,7 @@ private:
bool operator < (const ACE_Get_Opt_Long_Option &rhs);
/// Long option name.
- const ACE_TCHAR *name_;
+ const Char *name_;
/// Contains value for <OPTION_ARG_MODE>.
int has_arg_;
@@ -390,7 +396,7 @@ private:
};
/// Updates nextchar_.
- int nextchar_i (void);
+ Char nextchar_i (void);
/// Handles long options.
int long_option_i (void);
@@ -407,16 +413,12 @@ private:
int permute (void);
/// Set last_option.
- void last_option (const ACE_TString &s);
-
- // Disallow copying and assignment.
- ACE_Get_Opt (const ACE_Get_Opt &);
- ACE_Get_Opt &operator= (const ACE_Get_Opt &);
+ void last_option (const String &s);
private:
/// Holds the option string.
- ACE_TString *optstring_;
+ String *optstring_;
/// Treat all options as long options.
int long_only_;
@@ -428,7 +430,7 @@ private:
/// This is the last option, short or long, that was processed. This
/// is handy to have in cases where the option passed was invalid.
- ACE_TString *last_option_;
+ String *last_option_;
/**
* The next char to be scanned in the option-element in which the
@@ -437,7 +439,7 @@ private:
* If this is zero, or a null string, it means resume the scan
* by advancing to the next <argv>-element.
*/
- ACE_TCHAR *nextchar_;
+ Char *nextchar_;
/// Most recently matched short option character.
int optopt_;
@@ -462,13 +464,19 @@ private:
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
+ // Disallow copying and assignment.
+ ACE_UNIMPLEMENTED_FUNC (ACE_Get_Arg_Opt (const ACE_Get_Arg_Opt<CHAR_TYPE> &))
+ ACE_UNIMPLEMENTED_FUNC (ACE_Get_Arg_Opt &operator= (const ACE_Get_Arg_Opt<CHAR_TYPE> &))
};
+typedef ACE_Get_Arg_Opt< ACE_TCHAR > ACE_Get_Opt;
+
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/Get_Opt.inl"
#endif /* __ACE_INLINE__ */
+
#include /**/ "ace/post.h"
#endif /* ACE_GET_OPT_H */
diff --git a/ace/Get_Opt.inl b/ace/Get_Opt.inl
index cbe5f167e55..f22ce8ec987 100644
--- a/ace/Get_Opt.inl
+++ b/ace/Get_Opt.inl
@@ -2,40 +2,738 @@
//
// $Id$
+#include "ace/ACE.h"
+#include "ace/Log_Msg.h"
+#include "ace/SString.h"
+#include "ace/OS_Memory.h"
+#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_ctype.h"
+#include "ace/OS_NS_stdlib.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-ACE_INLINE bool
-ACE_Get_Opt::ACE_Get_Opt_Long_Option::operator < (const ACE_Get_Opt_Long_Option &rhs)
+ACE_ALLOC_HOOK_DEFINE(ACE_Get_Arg_Opt)
+
+template < typename CHAR_TYPE >
+ACE_Get_Arg_Opt<CHAR_TYPE>::ACE_Get_Arg_Opt (int argc,
+ Char **argv,
+ const Char *optstring,
+ int skip,
+ int report_errors,
+ int ordering,
+ int long_only)
+ : argc_ (argc),
+ argv_ (argv),
+ optind (skip),
+ opterr (report_errors),
+ optarg (0),
+ optstring_ (0),
+ long_only_ (long_only),
+ has_colon_ (0),
+ last_option_ (0),
+ nextchar_ (0),
+ optopt_ (0),
+ ordering_ (ordering),
+ nonopt_start_ (optind),
+ nonopt_end_ (optind),
+ long_option_ (0)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::ACE_Get_Arg_Opt");
+
+ if ( optstring != 0 )
+ ACE_NEW (this->optstring_, String (optstring));
+ else
+ ACE_NEW (this->optstring_, String);
+ ACE_NEW (this->last_option_, String);
+
+ // First check to see if POSIXLY_CORRECT was set.
+ // Win32 is the only platform capable of wide-char env var.
+#if defined (ACE_WIN32)
+ const ACE_TCHAR *env_check = ACE_LIB_TEXT ("POSIXLY_CORRECT");
+#else
+ const char *env_check = "POSIXLY_CORRECT";
+#endif
+ if (ACE_OS::getenv (env_check) != 0)
+ this->ordering_ = REQUIRE_ORDER;
+
+ // Now, check to see if any or the following were passed at
+ // the begining of optstring: '+' same as POSIXLY_CORRECT;
+ // '-' turns off POSIXLY_CORRECT; or ':' which signifies we
+ // should return ':' if a parameter is missing for an option.
+ // We use a loop here, since a combination of "{+|-}:" in any
+ // order should be legal.
+ int done = 0;
+ int offset = 0;
+ while (!done)
+ {
+ switch (optstring[offset++])
+ {
+ case ACE_LIB_TEXT('+'):
+ this->ordering_ = REQUIRE_ORDER;
+ break;
+ case ACE_LIB_TEXT('-'):
+ this->ordering_ = RETURN_IN_ORDER;
+ break;
+ case ACE_LIB_TEXT(':'):
+ this->has_colon_ = 1;
+ break;
+ default:
+ // Quit as soon as we see something else...
+ done = 1;
+ break;
+ }
+ }
+}
+
+template < typename CHAR_TYPE >
+ACE_Get_Arg_Opt<CHAR_TYPE>::~ACE_Get_Arg_Opt (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::~ACE_Get_Arg_Opt");
+
+ size_t i = 0;
+ size_t size = this->long_opts_.size ();
+ ACE_Get_Opt_Long_Option *option = 0;
+ for (i = 0; i < size; ++i)
+ {
+ int retval = this->long_opts_.get (option, i);
+ if (retval != 0)
+ {
+ // Should never happen.
+ retval = 0;
+ continue;
+ }
+ if (option)
+ {
+ delete option;
+ option = 0;
+ }
+ }
+ delete this->optstring_;
+ delete this->last_option_;
+}
+
+template < typename CHAR_TYPE >
+typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char
+ACE_Get_Arg_Opt<CHAR_TYPE>::nextchar_i (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::nextchar_i");
+
+ if (this->ordering_ == PERMUTE_ARGS)
+ if (this->permute () == eof())
+ return eof();
+
+ // Update scanning pointer.
+ if (this->optind >= this->argc_)
+ {
+ // We're done...
+ this->nextchar_ = 0;
+ return eof();
+ }
+ else if (*(this->nextchar_ = this->argv_[this->optind]) != ACE_LIB_TEXT('-')
+ || this->nextchar_[1] == ACE_LIB_TEXT('\0'))
+ {
+ // We didn't get an option.
+
+ if (this->ordering_ == REQUIRE_ORDER
+ || this->ordering_ == PERMUTE_ARGS)
+ // If we permuted or require the options to be in order, we're done.
+ return eof();
+
+ // It must be RETURN_IN_ORDER...
+ this->optarg = this->argv_[this->optind++];
+ this->nextchar_ = 0;
+ return 1;
+ }
+ else if (this->nextchar_[1] != 0
+ && *++this->nextchar_ == ACE_LIB_TEXT('-')
+ && this->nextchar_[1] == ACE_LIB_TEXT('\0'))
+ {
+ // Found "--" so we're done...
+ ++this->optind;
+ this->nextchar_ = 0;
+ return eof();
+ }
+
+ // If it's a long option, and we allow long options advance nextchar_.
+ if (*this->nextchar_ == ACE_LIB_TEXT('-') && this->long_opts_.size () != 0)
+ this->nextchar_++;
+
+ return ACE_LIB_TEXT('\0');
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::long_option_i (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::long_option_i");
+
+ ACE_Get_Opt_Long_Option *p;
+ Char *s = this->nextchar_;
+ int hits = 0;
+ int exact = 0;
+ ACE_Get_Opt_Long_Option *pfound = 0;
+ int indfound = 0;
+
+ // Advance to the end of the long option name so we can use
+ // it to get the length for a string compare.
+ while (*s && *s != ACE_LIB_TEXT('='))
+ s++;
+
+ size_t len = s - this->nextchar_;
+ // set last_option_ to nextchar_, up to the '='.
+ this->last_option (String (this->nextchar_, len));
+
+ size_t size = this->long_opts_.size ();
+ u_int option_index = 0;
+ for (option_index = 0; option_index < size ; option_index++)
+ {
+ p = this->long_opts_[option_index];
+ ACE_ASSERT (p);
+
+ if (!ACE_OS::strncmp (p->name_, this->nextchar_, len))
+ {
+ // Got at least a partial match.
+ pfound = p;
+ indfound = option_index;
+ hits += 1;
+ if (len == ACE_OS::strlen(p->name_))
+ {
+ // And in fact, it's an exact match, so let's use it.
+ exact = 1;
+ break;
+ }
+ }
+ }
+
+ if ((hits > 1) && !exact)
+ {
+ // Great, we found a match, but unfortunately we found more than
+ // one and it wasn't exact.
+ if (this->opterr)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("%s: option `%s' is ambiguous\n"),
+ this->argv_[0], this->argv_[this->optind]));
+ this->nextchar_ = 0;
+ this->optind++;
+ return ACE_LIB_TEXT('?');
+ }
+
+ if (pfound != 0)
+ {
+ // Okay, we found a good one (either a single hit or an exact match).
+ option_index = indfound;
+ this->optind++;
+ if (*s)
+ {
+ // s must point to '=' which means there's an argument (well
+ // close enough).
+ if (pfound->has_arg_ != NO_ARG)
+ // Good, we want an argument and here it is.
+ this->optarg = ++s;
+ else
+ {
+ // Whoops, we've got what looks like an argument, but we
+ // don't want one.
+ if (this->opterr)
+ ACE_ERROR
+ ((LM_ERROR,
+ ACE_LIB_TEXT ("%s: long option `--%s' doesn't allow ")
+ ACE_LIB_TEXT ("an argument\n"),
+ this->argv_[0], pfound->name_));
+ // The spec doesn't cover this, so we keep going and the program
+ // doesn't know we ignored an argument if opt_err is off!!!
+ }
+ }
+ else if (pfound->has_arg_ == ARG_REQUIRED)
+ {
+ // s didn't help us, but we need an argument. Note that
+ // optional arguments for long options must use the "=" syntax,
+ // so we won't get here in that case.
+ if (this->optind < this->argc_)
+ // We still have some elements left, so use the next one.
+ this->optarg = this->argv_[this->optind++];
+ else
+ {
+ // All out of elements, so we have to punt...
+ if (this->opterr)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("%s: long option '--%s' requires ")
+ ACE_LIB_TEXT ("an argument\n"),
+ this->argv_[0], pfound->name_));
+ this->nextchar_ = 0;
+ this->optopt_ = pfound->val_; // Remember matching short equiv
+ return this->has_colon_ ? ACE_LIB_TEXT(':') : ACE_LIB_TEXT('?');
+ }
+ }
+ this->nextchar_ = 0;
+ this->long_option_ = pfound;
+ // Since val_ has to be either a valid short option or 0, this works
+ // great. If the user really wants to know if a long option was passed.
+ this->optopt_ = pfound->val_;
+ return pfound->val_;
+ }
+ if (!this->long_only_ || this->argv_[this->optind][1] == ACE_LIB_TEXT('-')
+ || this->optstring_->find (*this->nextchar_) == String::npos)
+ {
+ // Okay, we couldn't find a long option. If it isn't long_only (which
+ // means try the long first, and if not found try the short) or a long
+ // signature was passed, e.g. "--", or it's not a short (not sure when
+ // this could happen) it's an error.
+ if (this->opterr)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("%s: illegal long option '--%s'\n"),
+ this->argv_[0], this->nextchar_));
+ this->nextchar_ = 0;
+ this->optind++;
+ return ACE_LIB_TEXT('?');
+ }
+ return this->short_option_i ();
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::short_option_i (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::short_option_i");
+
+ /* Look at and handle the next option-character. */
+ Char opt = *this->nextchar_++;
+ // Set last_option_ to opt
+ this->last_option (opt);
+
+ Char *oli = 0;
+ oli =
+ const_cast<Char*> (ACE_OS::strchr (this->optstring_->c_str (), opt));
+
+ /* Increment `optind' when we start to process its last character. */
+ if (*this->nextchar_ == ACE_LIB_TEXT('\0'))
+ ++this->optind;
+
+ if (oli == 0 || opt == ACE_LIB_TEXT(':'))
+ {
+ if (this->opterr)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("%s: illegal short option -- %c\n"),
+ this->argv_[0], opt));
+ return ACE_LIB_TEXT('?');
+ }
+ if (opt == ACE_LIB_TEXT('W') && oli[1] == ACE_LIB_TEXT(';'))
+ {
+ if (this->nextchar_[0] == 0)
+ this->nextchar_ = this->argv_[this->optind];
+ return long_option_i ();
+ }
+ this->optopt_ = oli[0]; // Remember the option that matched
+ if (oli[1] == ACE_LIB_TEXT(':'))
+ {
+ if (oli[2] == ACE_LIB_TEXT(':'))
+ {
+ // Takes an optional argument, and since short option args must
+ // must follow directly in the same argument, a NULL nextchar_
+ // means we didn't get one.
+ if (*this->nextchar_ != ACE_LIB_TEXT('\0'))
+ {
+ this->optarg = this->nextchar_;
+ this->optind++;
+ }
+ else
+ this->optarg = 0;
+ this->nextchar_ = 0;
+ }
+ else
+ {
+ // Takes a required argument.
+ if (*this->nextchar_ != ACE_LIB_TEXT('\0'))
+ {
+ // Found argument in same argv-element.
+ this->optarg = this->nextchar_;
+ this->optind++;
+ }
+ else if (this->optind == this->argc_)
+ {
+ // Ran out of arguments before finding required argument.
+ if (this->opterr)
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("%s: short option requires ")
+ ACE_LIB_TEXT ("an argument -- %c\n"),
+ this->argv_[0], opt));
+ opt = this->has_colon_ ? ACE_LIB_TEXT(':') : ACE_LIB_TEXT('?');
+ }
+ else
+ // Use the next argv-element as the argument.
+ this->optarg = this->argv_[this->optind++];
+ this->nextchar_ = 0;
+ }
+ }
+ return opt;
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::operator () (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::operator");
+
+ // First of all, make sure we reinitialize any pointers..
+ this->optarg = 0;
+ this->long_option_ = 0;
+
+ if (this->argv_ == 0)
+ {
+ // It can happen, e.g., on VxWorks.
+ this->optind = 0;
+ return -1;
+ }
+
+ // We check this because we can string short options together if the
+ // preceding one doesn't take an argument.
+ if (this->nextchar_ == 0 || *this->nextchar_ == ACE_LIB_TEXT('\0'))
+ {
+ int retval = this->nextchar_i ();
+ if (retval != 0)
+ return retval;
+ }
+
+ if (((this->argv_[this->optind][0] == ACE_LIB_TEXT('-'))
+ && (this->argv_[this->optind][1] == ACE_LIB_TEXT('-'))) || this->long_only_)
+ return this->long_option_i ();
+
+ return this->short_option_i ();
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::long_option (const Char *name,
+ OPTION_ARG_MODE has_arg)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::long_option (const Char *name, OPTION_ARG_MODE has_arg)");
+ return this->long_option (name, 0, has_arg);
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::long_option (const Char *name,
+ int short_option,
+ OPTION_ARG_MODE has_arg)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::long_option (const Char *name, int short_option, OPTION_ARG_MODE has_arg)");
+
+ // We only allow valid alpha-numeric characters as short options.
+ // If short_options is not a valid alpha-numeric, we can still return it
+ // when the long option is found, but won't allow the caller to pass it on
+ // the command line (how could they?). The special case is 0, but since
+ // we always return it, we let the caller worry about that.
+#if defined (_MSC_VER) && (_MSC_VER >= 1300)
+ // For MSVC 7.x, we need to prevent "illegal" character getting into
+ // isalnum, otherwise, it will crash the program.
+ if (short_option > 0 &&
+ short_option < 256 &&
+ ACE_OS::ace_isalnum (short_option) != 0)
+#else
+ if (ACE_OS::ace_isalnum (short_option) != 0)
+#endif /* _MSC_VER && _MSC_VER >= 1300 */
+ {
+ // If the short_option already exists, make sure it matches, otherwise
+ // add it.
+ Char *s = 0;
+ if ((s = const_cast<Char*> (
+ ACE_OS::strchr (this->optstring_->c_str (),
+ short_option))) != 0)
+ {
+ // Short option exists, so verify the argument options
+ if (s[1] == ACE_LIB_TEXT(':'))
+ {
+ if (s[2] == ACE_LIB_TEXT(':'))
+ {
+ if (has_arg != ARG_OPTIONAL)
+ {
+ if (this->opterr)
+ ACE_ERROR
+ ((LM_ERROR,
+ ACE_LIB_TEXT ("Existing short option '%c' takes ")
+ ACE_LIB_TEXT ("optional argument; adding %s ")
+ ACE_LIB_TEXT ("requires ARG_OPTIONAL\n"),
+ short_option, name));
+ return -1;
+ }
+ }
+ else
+ if (has_arg != ARG_REQUIRED)
+ {
+ if (this->opterr)
+ ACE_ERROR
+ ((LM_ERROR,
+ ACE_LIB_TEXT ("Existing short option '%c' requires ")
+ ACE_LIB_TEXT ("an argument; adding %s ")
+ ACE_LIB_TEXT ("requires ARG_REQUIRED\n"),
+ short_option, name));
+ return -1;
+ }
+ }
+ else if (has_arg != NO_ARG)
+ {
+ if (this->opterr)
+ ACE_ERROR
+ ((LM_ERROR,
+ ACE_LIB_TEXT ("Existing short option '%c' does not ")
+ ACE_LIB_TEXT ("accept an argument; adding %s ")
+ ACE_LIB_TEXT ("requires NO_ARG\n"),
+ short_option, name));
+ return -1;
+ }
+ }
+ else
+ {
+ // Didn't find short option, so add it...
+ *this->optstring_ += (Char) short_option;
+ if (has_arg == ARG_REQUIRED)
+ {
+ Char delim[3] = { ':', '\0' };
+ *this->optstring_ += delim;
+ }
+ else if (has_arg == ARG_OPTIONAL)
+ {
+ Char delim[3] = { ':', ':', '\0' };
+ *this->optstring_ += delim;
+ }
+ }
+ }
+
+ ACE_Get_Opt_Long_Option *option =
+ new ACE_Get_Opt_Long_Option (name, has_arg, short_option);
+
+ if (!option)
+ return -1;
+
+ // Add to array
+ size_t size = this->long_opts_.size ();
+ if (this->long_opts_.size (size + 1) != 0
+ || this->long_opts_.set (option, size) != 0)
+ {
+ delete option;
+ ACE_ERROR_RETURN
+ ((LM_ERROR, ACE_LIB_TEXT ("Could not add long option to array.\n")),
+ -1);
+ }
+ return 0;
+}
+
+template < typename CHAR_TYPE >
+const typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char*
+ACE_Get_Arg_Opt<CHAR_TYPE>::long_option (void) const
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::long_option (void)");
+ if (this->long_option_)
+ return this->long_option_->name_;
+ return 0;
+}
+
+template < typename CHAR_TYPE >
+const typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char*
+ACE_Get_Arg_Opt<CHAR_TYPE>::last_option (void) const
+{
+ return this->last_option_->c_str ();
+}
+
+template < typename CHAR_TYPE >
+void
+ACE_Get_Arg_Opt<CHAR_TYPE>::last_option (const typename ACE_Get_Arg_Opt<CHAR_TYPE>::String &last_option)
+{
+ *this->last_option_ = last_option;
+}
+
+template < typename CHAR_TYPE >
+void
+ACE_Get_Arg_Opt<CHAR_TYPE>::dump (void) const
+{
+#if defined (ACE_HAS_DUMP)
+ ACE_TRACE ("ACE_Get_Arg_Opt::dump");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")
+ ACE_LIB_TEXT ("opstring_ = %s\n")
+ ACE_LIB_TEXT ("long_only_ = %d\n")
+ ACE_LIB_TEXT ("has_colon_ = %d\n")
+ ACE_LIB_TEXT ("last_option_ = %s\n")
+ ACE_LIB_TEXT ("nextchar_ = %s\n")
+ ACE_LIB_TEXT ("optopt_ = %c\n")
+ ACE_LIB_TEXT ("ordering_ = %d\n"),
+ this->optstring_->c_str (),
+ this->long_only_,
+ this->has_colon_,
+ this->last_option_->c_str (),
+ this->nextchar_,
+ this->optopt_,
+ this->ordering_));
+
+ // now loop through the
+ size_t size = this->long_opts_.size ();
+ for (u_int i = 0; i < size ; ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")
+ ACE_LIB_TEXT ("long_option name_ = %s\n")
+ ACE_LIB_TEXT ("has_arg_ = %d\n")
+ ACE_LIB_TEXT ("val_ = %d\n"),
+ this->long_opts_[i]->name_,
+ this->long_opts_[i]->has_arg_,
+ this->long_opts_[i]->val_));
+ }
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+#endif /* ACE_HAS_DUMP */
+}
+
+template < typename CHAR_TYPE >
+void
+ACE_Get_Arg_Opt<CHAR_TYPE>::permute_args (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::permute_args");
+
+ int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
+ Char *swap;
+ int opt_end = this->optind;
+
+ nnonopts = this->nonopt_end_ - this->nonopt_start_;
+ nopts = opt_end - this->nonopt_end_;
+ ncycle = ACE::gcd (nnonopts, nopts);
+ cyclelen = (opt_end - this->nonopt_start_) / ncycle;
+
+ this->optind = this->optind - nnonopts;
+
+ for (i = 0; i < ncycle; i++)
+ {
+ cstart = this->nonopt_end_ + i;
+ pos = cstart;
+ for (j = 0; j < cyclelen; j++)
+ {
+ if (pos >= this->nonopt_end_)
+ pos -= nnonopts;
+ else
+ pos += nopts;
+ swap = this->argv_[pos];
+
+ ((Char **)this->argv_)[pos] = argv_[cstart];
+
+ ((Char **)this->argv_)[cstart] = swap;
+ }
+ }
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::permute (void)
+{
+ ACE_TRACE ("ACE_Get_Arg_Opt::permute");
+
+ if (this->nonopt_start_ != this->nonopt_end_
+ && this->nonopt_start_ != this->optind)
+ this->permute_args ();
+
+ this->nonopt_start_ = this->optind;
+
+ // Skip over args untill we find the next option.
+ while (this->optind < this->argc_
+ && (this->argv_[this->optind][0] != ACE_LIB_TEXT('-')
+ || this->argv_[this->optind][1] == ACE_LIB_TEXT('\0')))
+ this->optind++;
+
+ // Got an option, so mark this as the end of the non options.
+ this->nonopt_end_ = this->optind;
+
+ const Char doubleDash[] = { '-', '-', 0 };
+ if (this->optind != this->argc_
+ && ACE_OS::strcmp (this->argv_[this->optind],
+ doubleDash) == 0)
+ {
+ // We found the marker for the end of the options.
+ this->optind++;
+
+ if (this->nonopt_start_ != this->nonopt_end_
+ && this->nonopt_end_ != this->optind)
+ this->permute_args ();
+ }
+
+ if (this->optind == this->argc_)
+ {
+ if (this->nonopt_start_ != this->nonopt_end_)
+ this->optind = this->nonopt_start_;
+ return eof();
+ }
+ return 0;
+}
+
+template < typename CHAR_TYPE >
+const typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char *
+ACE_Get_Arg_Opt<CHAR_TYPE>::optstring (void) const
+{
+ return this->optstring_->c_str ();
+}
+
+template < typename CHAR_TYPE >
+ACE_Get_Arg_Opt<CHAR_TYPE>::ACE_Get_Opt_Long_Option::ACE_Get_Opt_Long_Option (
+ const Char *name,
+ int has_arg,
+ int val)
+ : name_ (ACE::strnew (name)),
+ has_arg_ (has_arg),
+ val_ (val)
+{}
+
+template < typename CHAR_TYPE >
+ACE_Get_Arg_Opt<CHAR_TYPE>::ACE_Get_Opt_Long_Option::~ACE_Get_Opt_Long_Option (void)
+{
+ delete [] this->name_;
+}
+
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::eof()
+{
+ // Since EOF may or may not be -1,
+ // we have to use EOF to maintain
+ // backwards compatibility.
+ return EOF;
+}
+
+// Accessors
+
+template < typename CHAR_TYPE >
+bool
+ACE_Get_Arg_Opt<CHAR_TYPE>::ACE_Get_Opt_Long_Option::operator < (const ACE_Get_Opt_Long_Option &rhs)
{
return this->name_ < rhs.name_;
}
-ACE_INLINE int
-ACE_Get_Opt::argc (void) const
+template < typename CHAR_TYPE >
+int
+ACE_Get_Arg_Opt<CHAR_TYPE>::argc (void) const
{
return this->argc_;
}
-ACE_INLINE ACE_TCHAR **
-ACE_Get_Opt::argv (void) const
+template < typename CHAR_TYPE >
+typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char **
+ACE_Get_Arg_Opt<CHAR_TYPE>::argv (void) const
{
return this->argv_;
}
-ACE_INLINE ACE_TCHAR*
-ACE_Get_Opt::opt_arg (void) const
+template < typename CHAR_TYPE >
+typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char*
+ACE_Get_Arg_Opt<CHAR_TYPE>::opt_arg (void) const
{
return this->optarg;
}
-ACE_INLINE int
-ACE_Get_Opt::opt_opt (void)
+template < typename CHAR_TYPE >
+typename ACE_Get_Arg_Opt<CHAR_TYPE>::Char
+ACE_Get_Arg_Opt<CHAR_TYPE>::opt_opt (void)
{
return this->optopt_;
}
-ACE_INLINE int &
-ACE_Get_Opt::opt_ind (void)
+template < typename CHAR_TYPE >
+int &
+ACE_Get_Arg_Opt<CHAR_TYPE>::opt_ind (void)
{
return this->optind;
}
diff --git a/ace/Global_Macros.h b/ace/Global_Macros.h
index 0dce353fa83..2f24a1c3646 100644
--- a/ace/Global_Macros.h
+++ b/ace/Global_Macros.h
@@ -78,7 +78,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_ITOA(X) #X
// Create a string of a server address with a "host:port" format.
-# define ACE_SERVER_ADDRESS(H,P) H ACE_TEXT(":") P
+# define ACE_SERVER_ADDRESS(H,P) H ACE_LIB_TEXT(":") P
// A couple useful inline functions for checking whether bits are
// enabled or disabled.
diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp
index 7bfd15db279..e83c6573c9c 100644
--- a/ace/High_Res_Timer.cpp
+++ b/ace/High_Res_Timer.cpp
@@ -521,12 +521,12 @@ ACE_High_Res_Timer::print_total (const ACE_TCHAR *str,
#endif /* !ACE_HAS_WINCE */
int
-ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env)
+ACE_High_Res_Timer::get_env_global_scale_factor (const char *env)
{
#if !defined (ACE_HAS_WINCE)
if (env != 0)
{
- const char *env_value = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (env));
+ const char *env_value = ACE_OS::getenv (env);
if (env_value != 0)
{
int value = ACE_OS::atoi (env_value);
diff --git a/ace/High_Res_Timer.h b/ace/High_Res_Timer.h
index 4e1bd89cf43..5359ddc70d3 100644
--- a/ace/High_Res_Timer.h
+++ b/ace/High_Res_Timer.h
@@ -138,8 +138,7 @@ public:
* This is basically a no-op on CE because there is no concept of
* environment variable on CE.
*/
- static int get_env_global_scale_factor (const ACE_TCHAR *env
- = ACE_LIB_TEXT ("ACE_SCALE_FACTOR"));
+ static int get_env_global_scale_factor (const char *env = "ACE_SCALE_FACTOR");
/**
* Set (and return, for info) the global scale factor by sleeping
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp
index 78e0557c9a5..bde2a17ae8e 100644
--- a/ace/INET_Addr.cpp
+++ b/ace/INET_Addr.cpp
@@ -51,7 +51,7 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[],
{
ACE_OS::sprintf (s,
ACE_LIB_TEXT ("%s:%d"),
- ACE_TEXT_CHAR_TO_TCHAR (ipaddr_format == 0
+ ACE_TEXT_TO_TCHAR_IN (ipaddr_format == 0
? this->get_host_name ()
: this->get_host_addr ()),
this->get_port_number ());
@@ -220,7 +220,6 @@ ACE_INET_Addr::ACE_INET_Addr (const char address[])
this->set (address);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[])
: ACE_Addr (this->determine_type(), sizeof (inet_addr_))
{
@@ -229,8 +228,6 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[])
this->set (address);
}
-#endif /* ACE_HAS_WCHAR */
-
// Copy constructor.
ACE_INET_Addr::ACE_INET_Addr (const ACE_INET_Addr &sa)
@@ -411,7 +408,7 @@ ACE_INET_Addr::set (const char port_name[],
int address_family = PF_UNSPEC;
# if defined (ACE_HAS_IPV6)
- if (ACE_OS::strcmp (ACE_TEXT_CHAR_TO_TCHAR(protocol), ACE_LIB_TEXT ("tcp6")) == 0)
+ if (ACE_OS::strcmp (ACE_TEXT_TO_TCHAR_IN(protocol), ACE_LIB_TEXT ("tcp6")) == 0)
address_family = AF_INET6;
# endif /* ACE_HAS_IPV6 */
@@ -463,12 +460,11 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"),
- ACE_TEXT_CHAR_TO_TCHAR ((host_name == 0) ?
+ ACE_TEXT_TO_TCHAR_IN ((host_name == 0) ?
"<unknown>" : host_name)));
#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
const wchar_t host_name[],
int address_family)
@@ -489,12 +485,11 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
#else /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr: %p\n"),
- ACE_TEXT_WCHAR_TO_TCHAR ((host_name == 0) ?
+ ACE_TEXT_TO_TCHAR_IN ((host_name == 0) ?
ACE_TEXT_WIDE ("<unknown>") :
host_name)));
#endif /* ! defined (ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS) */
}
-#endif /* ACE_HAS_WCHAR */
// Creates a ACE_INET_Addr from a sockaddr_in structure.
@@ -617,7 +612,6 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
-#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
const wchar_t host_name[],
const wchar_t protocol[])
@@ -631,7 +625,6 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
-#endif /* ACE_HAS_WCHAR */
// Creates a ACE_INET_Addr from a PORT_NAME and an Internet address.
@@ -649,7 +642,6 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
-#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
ACE_UINT32 inet_address,
const wchar_t protocol[])
@@ -663,7 +655,6 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[],
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
-#endif /* ACE_HAS_WCHAR */
ACE_INET_Addr::~ACE_INET_Addr (void)
{
@@ -702,7 +693,6 @@ ACE_INET_Addr::get_host_name (char hostname[],
return result;
}
-#if defined (ACE_HAS_WCHAR)
int
ACE_INET_Addr::get_host_name (wchar_t hostname[],
size_t len) const
@@ -720,12 +710,10 @@ ACE_INET_Addr::get_host_name (wchar_t hostname[],
// And copy it over, if successful
if (result == 0)
- ACE_OS::strcpy (hostname,
- ACE_Ascii_To_Wide (char_hostname).wchar_rep ());
+ ACE_OS::string_copy( hostname, char_hostname, MAXHOSTNAMELEN + 1 );
return result;
}
-#endif /* ACE_HAS_WCHAR */
// Return the character representation of the hostname.
diff --git a/ace/INET_Addr.h b/ace/INET_Addr.h
index 5dbc2e2274c..ab74a1bb276 100644
--- a/ace/INET_Addr.h
+++ b/ace/INET_Addr.h
@@ -90,7 +90,6 @@ public:
ACE_UINT32 ip_addr,
const char protocol[] = "tcp");
-#if defined (ACE_HAS_WCHAR)
ACE_INET_Addr (u_short port_number,
const wchar_t host_name[],
int address_family = AF_UNSPEC);
@@ -104,7 +103,6 @@ public:
ACE_INET_Addr (const wchar_t port_name[],
ACE_UINT32 ip_addr,
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
-#endif /* ACE_HAS_WCHAR */
/// Default dtor.
~ACE_INET_Addr (void);
@@ -172,7 +170,6 @@ public:
int set (const sockaddr_in *,
int len);
-#if defined (ACE_HAS_WCHAR)
int set (u_short port_number,
const wchar_t host_name[],
int encode = 1,
@@ -187,7 +184,6 @@ public:
const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp"));
int set (const wchar_t addr[]);
-#endif /* ACE_HAS_WCHAR */
/// Return a pointer to the underlying network address.
virtual void *get_addr (void) const;
@@ -222,12 +218,6 @@ public:
*/
virtual int string_to_addr (const char address[]);
-#if defined (ACE_HAS_WCHAR)
- /*
- virtual int string_to_addr (const char address[]);
- */
-#endif /* ACE_HAS_WCHAR */
-
/**
* Sets the port number without affecting the host name. If
* <encode> is enabled then <port_number> is converted into network
@@ -273,10 +263,8 @@ public:
int get_host_name (char hostname[],
size_t hostnamelen) const;
-#if defined (ACE_HAS_WCHAR)
int get_host_name (wchar_t hostname[],
size_t hostnamelen) const;
-#endif /* ACE_HAS_WCHAR */
/**
* Return the character representation of the hostname (this version
diff --git a/ace/INET_Addr.inl b/ace/INET_Addr.inl
index 583f3a8747e..3fa5c778e5a 100644
--- a/ace/INET_Addr.inl
+++ b/ace/INET_Addr.inl
@@ -120,7 +120,6 @@ ACE_INET_Addr::operator < (const ACE_INET_Addr &rhs) const
&& this->get_port_number () < rhs.get_port_number ());
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_INET_Addr::set (u_short port_number,
const wchar_t host_name[],
@@ -128,7 +127,7 @@ ACE_INET_Addr::set (u_short port_number,
int address_family)
{
return this->set (port_number,
- ACE_Wide_To_Ascii (host_name).char_rep (),
+ ACE_TEXT_TO_CHAR_IN (host_name),
encode,
address_family);
}
@@ -138,9 +137,9 @@ ACE_INET_Addr::set (const wchar_t port_name[],
const wchar_t host_name[],
const wchar_t protocol[])
{
- return this->set (ACE_Wide_To_Ascii (port_name).char_rep (),
- ACE_Wide_To_Ascii (host_name).char_rep (),
- ACE_Wide_To_Ascii (protocol).char_rep ());
+ return this->set (ACE_TEXT_TO_CHAR_IN (port_name),
+ ACE_TEXT_TO_CHAR_IN (host_name),
+ ACE_TEXT_TO_CHAR_IN (protocol));
}
ACE_INLINE int
@@ -148,19 +147,17 @@ ACE_INET_Addr::set (const wchar_t port_name[],
ACE_UINT32 ip_addr,
const wchar_t protocol[])
{
- return this->set (ACE_Wide_To_Ascii (port_name).char_rep (),
+ return this->set (ACE_TEXT_TO_CHAR_IN (port_name),
ip_addr,
- ACE_Wide_To_Ascii (protocol).char_rep ());
+ ACE_TEXT_TO_CHAR_IN (protocol));
}
ACE_INLINE int
ACE_INET_Addr::set (const wchar_t addr[])
{
- return this->set (ACE_Wide_To_Ascii (addr).char_rep ());
+ return this->set (ACE_TEXT_TO_CHAR_IN (addr));
}
-#endif /* ACE_HAS_WCHAR */
-
// Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY.
ACE_INLINE bool
ACE_INET_Addr::is_any (void) const
diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp
index 1d3929f710a..b0e4ddfdf2a 100644
--- a/ace/Lib_Find.cpp
+++ b/ace/Lib_Find.cpp
@@ -319,9 +319,8 @@ ACE::ldfind (const ACE_TCHAR* filename,
# else
// Wide-char, non-Windows only offers char * getenv. So capture
// it, translate to wide-char, and continue.
- ACE_Ascii_To_Wide wide_ldpath
- (ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH)));
- ld_path = wide_ldpath.wchar_rep ();
+ ACE::String_Conversion::Convert_In< ACE_TCHAR, ACE_ANTI_TCHAR > wide_ldpath(ACE_OS::getenv (ACE_LD_SEARCH_PATH_A));
+ ld_path = const_cast<ACE_TCHAR*>(wide_ldpath.c_str ());
# endif /* ACE_WIN32 || !ACE_USES_WCHAR */
# endif /* ACE_DEFAULT_LD_SEARCH_PATH */
@@ -562,7 +561,7 @@ ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len)
}
else
{
- ACE_OS::strcpy (buffer, ACE_TEXT_CHAR_TO_TCHAR (tmpdir));
+ ACE_OS::string_copy (buffer, tmpdir, buffer_len);
// Add a trailing slash because we cannot assume there is already one
// at the end. And having an extra one should not cause problems.
@@ -652,7 +651,6 @@ ACE::strsplit_r (char *str,
return result;
}
-#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE::strsplit_r (wchar_t *str,
const wchar_t *token,
@@ -702,6 +700,6 @@ ACE::strrepl (wchar_t *s, wchar_t search, wchar_t replace)
return replaced;
}
-#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Lib_Find.h b/ace/Lib_Find.h
index 418de3751de..8ca34d44367 100644
--- a/ace/Lib_Find.h
+++ b/ace/Lib_Find.h
@@ -88,7 +88,6 @@ namespace ACE
const char *token,
char *&next_start);
-#if defined (ACE_HAS_WCHAR)
/// As strrepl, but for wide characters.
extern ACE_Export size_t strrepl (wchar_t *s,
wchar_t search,
@@ -98,7 +97,6 @@ namespace ACE
extern ACE_Export wchar_t *strsplit_r (wchar_t *s,
const wchar_t *token,
wchar_t *&next_start);
-#endif /* ACE_HAS_WCHAR */
}
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp
index 2263d90cb46..1c58e14ae19 100644
--- a/ace/Local_Name_Space.cpp
+++ b/ace/Local_Name_Space.cpp
@@ -16,7 +16,7 @@ ACE_NS_String::~ACE_NS_String (void)
delete [] this->rep_;
}
-ACE_WCHAR_T *
+wchar_t *
ACE_NS_String::fast_rep (void) const
{
ACE_TRACE ("ACE_NS_String::fast_rep");
@@ -27,7 +27,7 @@ ACE_NS_String::operator ACE_NS_WString () const
{
ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString");
return ACE_NS_WString (this->rep_,
- (this->len_ / sizeof (ACE_WCHAR_T)) - 1);
+ (this->len_ / sizeof (wchar_t)) - 1);
}
size_t
@@ -42,7 +42,7 @@ ACE_NS_String::char_rep (void) const
{
ACE_TRACE ("ACE_NS_String::char_rep");
ACE_NS_WString w_string (this->rep_,
- (this->len_ / sizeof (ACE_WCHAR_T)) - 1);
+ (this->len_ / sizeof (wchar_t)) - 1);
return w_string.char_rep ();
}
@@ -55,7 +55,7 @@ ACE_NS_String::ACE_NS_String (void)
}
ACE_NS_String::ACE_NS_String (const ACE_NS_WString &s)
- : len_ ((s.length () + 1) * sizeof (ACE_WCHAR_T)),
+ : len_ ((s.length () + 1) * sizeof (wchar_t)),
rep_ (s.rep ()),
delete_rep_ (1)
{
@@ -76,8 +76,8 @@ ACE_NS_String::strstr (const ACE_NS_String &s) const
else
{
// They're smaller than we are...
- const size_t len = (this->len_ - s.len_) / sizeof (ACE_WCHAR_T);
- const size_t pat_len = s.len_ / sizeof (ACE_WCHAR_T) - 1;
+ const size_t len = (this->len_ - s.len_) / sizeof (wchar_t);
+ const size_t pat_len = s.len_ / sizeof (wchar_t) - 1;
for (size_t i = 0; i <= len; ++i)
{
@@ -112,8 +112,8 @@ ACE_NS_String::operator != (const ACE_NS_String &s) const
return !this->operator == (s);
}
-ACE_NS_String::ACE_NS_String (ACE_WCHAR_T *dst,
- const ACE_WCHAR_T *src,
+ACE_NS_String::ACE_NS_String (wchar_t *dst,
+ const wchar_t *src,
size_t bytes)
: len_ (bytes),
rep_ (dst),
@@ -127,7 +127,7 @@ u_long
ACE_NS_String::hash (void) const
{
return ACE::hash_pjw
- (reinterpret_cast<char *> (const_cast<ACE_WCHAR_T *> (this->rep_)),
+ (reinterpret_cast<char *> (const_cast<wchar_t *> (this->rep_)),
this->len_);
}
diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h
index 728ac8afb1c..fbb837824c8 100644
--- a/ace/Local_Name_Space.h
+++ b/ace/Local_Name_Space.h
@@ -44,8 +44,8 @@ public:
ACE_NS_String (void);
/// Initialization method.
- ACE_NS_String (ACE_WCHAR_T *dst,
- const ACE_WCHAR_T *src,
+ ACE_NS_String (wchar_t *dst,
+ const wchar_t *src,
size_t len);
/// Converts an ACE_NS_WString to an ACE_NS_String;
@@ -73,7 +73,7 @@ public:
size_t len (void) const;
/// Returns the underlying representation.
- ACE_WCHAR_T *fast_rep (void) const;
+ wchar_t *fast_rep (void) const;
/// Returns a hash value for this string.
u_long hash (void) const;
@@ -83,7 +83,7 @@ private:
size_t len_;
/// This actually points into shared/persistent memory.
- ACE_WCHAR_T *rep_;
+ wchar_t *rep_;
/// Should rep_ be deleted when destructed (only used
/// for WString conversions)
diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp
index b626f990dbb..87f5e51362e 100644
--- a/ace/Local_Name_Space_T.cpp
+++ b/ace/Local_Name_Space_T.cpp
@@ -138,8 +138,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i (
{
ACE_TRACE ("ACE_Local_Name_Space::shared_bind_i");
- const size_t name_len = (name.length () + 1) * sizeof (ACE_WCHAR_T);
- const size_t value_len = (value.length () + 1) * sizeof (ACE_WCHAR_T);
+ const size_t name_len = (name.length () + 1) * sizeof (wchar_t);
+ const size_t value_len = (value.length () + 1) * sizeof (wchar_t);
const size_t type_len = ACE_OS::strlen (type) + 1;
const size_t total_len = name_len + value_len + type_len;
char *ptr = (char *) this->allocator_->malloc (total_len);
@@ -150,12 +150,12 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind_i (
{
// Note that the value_rep *must* come first to make sure we can
// retrieve this pointer later on in unbind().
- ACE_WCHAR_T *value_rep = (ACE_WCHAR_T *) (ptr);
- ACE_WCHAR_T *name_rep = (ACE_WCHAR_T *) (ptr + value_len);
+ wchar_t *value_rep = (wchar_t *) (ptr);
+ wchar_t *name_rep = (wchar_t *) (ptr + value_len);
char *new_type = (char *) (ptr + value_len + name_len);
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> value_urep (value.rep ());
ACE_NS_String new_name (name_rep, name_urep.get (), name_len);
ACE_NS_String new_value (value_rep, value_urep.get (), value_len);
@@ -324,7 +324,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i (
value = nbc_string;
// Gets type and then the actual reprsentation which is a
- // ACE_WCHAR_T
+ // wchar_t
const char *temp = ns_internal.type ();
size_t len = ACE_OS::strlen (ns_internal.type ());
@@ -817,7 +817,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::dump_i (void) const
#endif /* ! ACE_NLOGGING */
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("key=%s\nvalue=%s\ntype=%s\n"),
- ACE_TEXT_CHAR_TO_TCHAR (key), ACE_TEXT_CHAR_TO_TCHAR (value), ACE_TEXT_CHAR_TO_TCHAR (type)));
+ ACE_TEXT_TO_TCHAR_IN (key), ACE_TEXT_TO_TCHAR_IN (value), ACE_TEXT_TO_TCHAR_IN (type)));
// We need to delete key and value since char_rep allocates
// memory for them
delete [] key;
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index 6939a455acc..31d32bb6ca4 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -919,8 +919,8 @@ ACE_Log_Msg::open (const ACE_TCHAR *prog_name,
* 'X': print as a hex number
* 'w': print a wide character
* 'W': print out a wide character string.
- * 'z': print an ACE_OS::WChar character
- * 'Z': print an ACE_OS::WChar character string
+ * 'z': print an wchar_t character
+ * 'Z': print an wchar_t character string
* '%': format a single percent sign, '%'
*/
ssize_t
@@ -942,7 +942,6 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority,
return result;
}
-#if defined (ACE_HAS_WCHAR)
/**
* Since this is the ANTI_TCHAR version, we need to convert
* the format string over.
@@ -958,14 +957,13 @@ ACE_Log_Msg::log (ACE_Log_Priority log_priority,
va_start (argp, format_str);
- ssize_t result = this->log (ACE_TEXT_ANTI_TO_TCHAR (format_str),
+ ssize_t result = this->log (ACE_TEXT_TO_TCHAR_IN (format_str),
log_priority,
argp);
va_end (argp);
return result;
}
-#endif /* ACE_HAS_WCHAR */
ssize_t
ACE_Log_Msg::log (const ACE_TCHAR *format_str,
@@ -1200,12 +1198,12 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
if (can_check)
this_len = ACE_OS::snprintf (bp, bspace, format,
this->file () ?
- ACE_TEXT_CHAR_TO_TCHAR (this->file ())
+ ACE_TEXT_TO_TCHAR_IN (this->file ())
: ACE_LIB_TEXT ("<unknown file>"));
else
this_len = ACE_OS::sprintf (bp, format,
this->file () ?
- ACE_TEXT_CHAR_TO_TCHAR (this->file ())
+ ACE_TEXT_TO_TCHAR_IN (this->file ())
: ACE_LIB_TEXT ("<unknown file>"));
ACE_UPDATE_COUNT (bspace, this_len);
break;
@@ -1261,11 +1259,11 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
if (can_check)
this_len = ACE_OS::snprintf
(bp, bspace, format, va_arg (argp, ACE_TCHAR *),
- ACE_TEXT_CHAR_TO_TCHAR (msg));
+ ACE_TEXT_TO_TCHAR_IN (msg));
else
this_len = ACE_OS::sprintf
(bp, format, va_arg (argp, ACE_TCHAR *),
- ACE_TEXT_CHAR_TO_TCHAR (msg));
+ ACE_TEXT_TO_TCHAR_IN (msg));
#if defined (ACE_WIN32)
}
else
@@ -1369,10 +1367,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
#endif
if (can_check)
this_len = ACE_OS::snprintf
- (bp, bspace, format, ACE_TEXT_CHAR_TO_TCHAR (msg));
+ (bp, bspace, format, ACE_TEXT_TO_TCHAR_IN (msg));
else
this_len = ACE_OS::sprintf
- (bp, format, ACE_TEXT_CHAR_TO_TCHAR (msg));
+ (bp, format, ACE_TEXT_TO_TCHAR_IN (msg));
#if defined (ACE_WIN32)
}
else
@@ -1716,26 +1714,30 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
# else /* ACE_USES_WCHAR */
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S"));
# endif /* ACE_USES_WCHAR */
+
if (can_check)
this_len = ACE_OS::snprintf
(bp, bspace, format, wstr ? wstr : ACE_LIB_TEXT ("(null)"));
else
this_len = ACE_OS::sprintf
(bp, format, wstr ? wstr : ACE_LIB_TEXT ("(null)"));
-#elif defined (ACE_HAS_WCHAR)
+
+#else
wchar_t *wchar_str = va_arg (argp, wchar_t *);
+
# if defined (HPUX)
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S"));
# else
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("ls"));
# endif /* HPUX */
+
if (can_check)
this_len = ACE_OS::snprintf
(bp, bspace, format, wchar_str);
else
this_len = ACE_OS::sprintf
(bp, format, wchar_str);
-#endif /* ACE_WIN32 / ACE_HAS_WCHAR */
+#endif /* ACE_WIN32 */
ACE_UPDATE_COUNT (bspace, this_len);
}
break;
@@ -1777,7 +1779,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
ACE_UPDATE_COUNT (bspace, this_len);
break;
- case 'z': // ACE_OS::WChar character
+ case 'z': // wchar_t character
{
// On some platforms sizeof (wchar_t) can be 2
// on the others 4 ...
@@ -1806,14 +1808,14 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
break;
}
- case 'Z': // ACE_OS::WChar character string
+ case 'Z': // wchar_t character string
{
- ACE_OS::WChar *wchar_str = va_arg (argp, ACE_OS::WChar*);
+ wchar_t *wchar_str = va_arg (argp, wchar_t*);
if (wchar_str == 0)
break;
wchar_t *wchar_t_str = 0;
- if (sizeof (ACE_OS::WChar) != sizeof (wchar_t))
+ if (sizeof (wchar_t) != sizeof (wchar_t))
{
size_t len = ACE_OS::wslen (wchar_str) + 1;
ACE_NEW_NORETURN(wchar_t_str, wchar_t[len]);
@@ -1836,19 +1838,19 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
# else /* ACE_USES_WCHAR */
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S"));
# endif /* ACE_USES_WCHAR */
-#elif defined (ACE_HAS_WCHAR)
+#else
# if defined (HPUX)
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S"));
# else
ACE_OS::strcpy (fp, ACE_LIB_TEXT ("ls"));
# endif /* HPUX */
-#endif /* ACE_WIN32 / ACE_HAS_WCHAR */
+#endif /* ACE_WIN32 */
if (can_check)
this_len = ACE_OS::snprintf
(bp, bspace, format, wchar_t_str);
else
this_len = ACE_OS::sprintf (bp, format, wchar_t_str);
- if(sizeof(ACE_OS::WChar) != sizeof(wchar_t))
+ if(sizeof(wchar_t) != sizeof(wchar_t))
{
delete wchar_t_str;
}
@@ -2581,7 +2583,6 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
return this->log_priority_enabled (log_priority);
}
-#if defined (ACE_USES_WCHAR)
int
ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
const wchar_t *,
@@ -2589,7 +2590,6 @@ ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority,
{
return this->log_priority_enabled (log_priority);
}
-#endif /* ACE_USES_WCHAR */
// ****************************************************************
diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h
index d1adb4cdc20..40811d66d99 100644
--- a/ace/Log_Msg.h
+++ b/ace/Log_Msg.h
@@ -425,7 +425,6 @@ public:
const char *,
...);
-#if defined (ACE_USES_WCHAR)
// We are not using ACE_TCHAR for this since ACE_HEX_DUMP
// doesn't take in a ACE_TCHAR. log_hexdump takes in a char
// string, so this must be able to take in a char string even
@@ -434,7 +433,6 @@ public:
int log_priority_enabled (ACE_Log_Priority log_priority,
const wchar_t *,
...);
-#endif /* ACE_USES_WCHAR */
/// Optimize reading of the pid (avoids a system call if the value is
/// cached...).
@@ -504,15 +502,13 @@ public:
* - 'W': print a wide character string
* - 'x': print as a hex number
* - 'X': print as a hex number
- * - 'z': print an ACE_OS::WChar character
- * - 'Z': print an ACE_OS::WChar character string
+ * - 'z': print an wchar_t character
+ * - 'Z': print an wchar_t character string
* - '%': print out a single percent sign, '%'
*/
- ssize_t log (ACE_Log_Priority priority, const ACE_TCHAR *format, ...);
+ ssize_t log (ACE_Log_Priority priority, const char *format, ...);
-#if defined (ACE_HAS_WCHAR)
- ssize_t log (ACE_Log_Priority priority, const ACE_ANTI_TCHAR *format, ...);
-#endif /* ACE_HAS_WCHAR */
+ ssize_t log (ACE_Log_Priority priority, const wchar_t *format, ...);
/**
* An alternative logging mechanism that makes it possible to
diff --git a/ace/Log_Msg_UNIX_Syslog.cpp b/ace/Log_Msg_UNIX_Syslog.cpp
index 23b90ef3c34..55adf75791b 100644
--- a/ace/Log_Msg_UNIX_Syslog.cpp
+++ b/ace/Log_Msg_UNIX_Syslog.cpp
@@ -43,15 +43,10 @@ ACE_Log_Msg_UNIX_Syslog::open (const ACE_TCHAR * logger_key)
// options LOG_CONS and LOG_PID to be set. There really should be a
// logging strategy option to control the syslog log options,
// however, we'll take the easy way out for now.
-#if defined (ACE_USES_WCHAR)
- openlog (ACE_TEXT_ALWAYS_CHAR (logger_key),
+ // const_cast?
+ ::openlog (const_cast<char *>(ACE_TEXT_TO_CHAR_IN(logger_key)),
LOG_CONS|LOG_PID,
ACE_DEFAULT_SYSLOG_FACILITY);
-#else
- openlog (const_cast<char *> (logger_key),
- LOG_CONS|LOG_PID,
- ACE_DEFAULT_SYSLOG_FACILITY);
-#endif /* ACE_USES_WCHAR */
// Enable logging of all syslog priorities. If logging of all
// priorities is not desired, use the ACE_Log_Msg::priority_mask()
@@ -117,12 +112,12 @@ ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record)
ACE_Log_Record::priority_name(ACE_Log_Priority(log_record.type()));
syslog (syslog_priority,
"%s: %s: %s",
- ACE_TEXT_ALWAYS_CHAR (date_and_time),
- ACE_TEXT_ALWAYS_CHAR (prio_name),
- ACE_TEXT_ALWAYS_CHAR (line));
+ ACE_TEXT_TO_CHAR_IN (date_and_time),
+ ACE_TEXT_TO_CHAR_IN (prio_name),
+ ACE_TEXT_TO_CHAR_IN (line));
}
else // No formatting required.
- syslog (syslog_priority, "%s", ACE_TEXT_ALWAYS_CHAR (line));
+ syslog (syslog_priority, "%s", ACE_TEXT_TO_CHAR_IN (line));
}
return 0;
diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp
index 3239252a00e..2fed56760da 100644
--- a/ace/Log_Record.cpp
+++ b/ace/Log_Record.cpp
@@ -299,7 +299,7 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[],
if (result == 0)
{
// Since ostream expects only chars, we cannot pass wchar_t's
- s << ACE_TEXT_ALWAYS_CHAR (verbose_msg);
+ s << ACE_TEXT_TO_CHAR_IN (verbose_msg);
s.flush ();
}
diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp
index 8e393a81e31..36033e2d60e 100644
--- a/ace/Logging_Strategy.cpp
+++ b/ace/Logging_Strategy.cpp
@@ -154,7 +154,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[])
this->interval_ = ACE_DEFAULT_LOGFILE_POLL_INTERVAL;
this->max_size_ = 0;
- ACE_Get_Opt get_opt (argc, argv,
+ ACE_Get_Arg_Opt<ACE_TCHAR> get_opt (argc, argv,
ACE_LIB_TEXT ("f:i:k:m:n:N:op:s:t:w"), 0);
for (int c; (c = get_opt ()) != -1; )
@@ -346,7 +346,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
{
ACE_NEW_RETURN
(output_file,
- ofstream (ACE_TEXT_ALWAYS_CHAR (this->filename_)),
+ ofstream (ACE_TEXT_TO_CHAR_IN (this->filename_)),
-1);
delete_ostream = 1;
}
@@ -354,7 +354,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[])
{
ACE_NEW_RETURN
(output_file,
- ofstream (ACE_TEXT_ALWAYS_CHAR (this->filename_),
+ ofstream (ACE_TEXT_TO_CHAR_IN (this->filename_),
ios::app | ios::out),
-1);
delete_ostream = 1;
@@ -439,7 +439,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
this->log_msg_->msg_ostream (output_file);
#else
- output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_),
+ output_file->open (ACE_TEXT_TO_CHAR_IN (this->filename_),
ios::out);
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
@@ -532,7 +532,7 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &,
this->log_msg_->msg_ostream (output_file);
#else
- output_file->open (ACE_TEXT_ALWAYS_CHAR (this->filename_),
+ output_file->open (ACE_TEXT_TO_CHAR_IN (this->filename_),
ios::out);
#endif /* ACE_LACKS_IOSTREAM_TOTALLY */
diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp
index a2e33cedc81..f5155b9d961 100644
--- a/ace/MEM_Connector.cpp
+++ b/ace/MEM_Connector.cpp
@@ -73,9 +73,9 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream,
ACE_LIB_TEXT ("(%P|%t) MEM_Connector can't connect ")
ACE_LIB_TEXT ("to %s:%d which is not a local endpoint ")
ACE_LIB_TEXT ("(local address is %s:%d)\n"),
- ACE_TEXT_CHAR_TO_TCHAR (remote_sap.get_host_name ()),
+ ACE_TEXT_TO_TCHAR_IN (remote_sap.get_host_name ()),
remote_sap.get_port_number (),
- ACE_TEXT_CHAR_TO_TCHAR (this->address_.get_host_name ()),
+ ACE_TEXT_TO_TCHAR_IN (this->address_.get_host_name ()),
this->address_.get_port_number ()),
-1);
else
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index d59436ac2b6..86560f5cea8 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -294,19 +294,17 @@ ACE_Allocator_Adapter<MALLOC>::protect (void *addr, size_t len, int flags)
template <class MALLOC>
ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const char *pool_name)
- : allocator_ (ACE_TEXT_CHAR_TO_TCHAR (pool_name))
+ : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name))
{
ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter");
}
-#if defined (ACE_HAS_WCHAR)
template <class MALLOC>
ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter (const wchar_t *pool_name)
- : allocator_ (ACE_TEXT_WCHAR_TO_TCHAR (pool_name))
+ : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name))
{
ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter");
}
-#endif /* ACE_HAS_WCHAR */
template <class MALLOC>
ACE_Allocator_Adapter<MALLOC>::~ACE_Allocator_Adapter (void)
diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h
index 021a13c2e58..79c92dfe99e 100644
--- a/ace/Malloc_T.h
+++ b/ace/Malloc_T.h
@@ -238,14 +238,13 @@ public:
ACE_Allocator_Adapter (const char *pool_name,
const char *lock_name,
MEMORY_POOL_OPTIONS options = 0)
- : allocator_ (ACE_TEXT_CHAR_TO_TCHAR (pool_name),
- ACE_TEXT_CHAR_TO_TCHAR (lock_name),
+ : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name),
+ ACE_TEXT_TO_TCHAR_IN (lock_name),
options)
{
ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter");
}
-#if defined (ACE_HAS_WCHAR)
/**
* Note that @a pool_name should be located in
* a directory with the appropriate visibility and protection so
@@ -261,13 +260,12 @@ public:
ACE_Allocator_Adapter (const wchar_t *pool_name,
const wchar_t *lock_name,
MEMORY_POOL_OPTIONS options = 0)
- : allocator_ (ACE_TEXT_WCHAR_TO_TCHAR (pool_name),
- ACE_TEXT_WCHAR_TO_TCHAR (lock_name),
+ : allocator_ (ACE_TEXT_TO_TCHAR_IN (pool_name),
+ ACE_TEXT_TO_TCHAR_IN (lock_name),
options)
{
ACE_TRACE ("ACE_Allocator_Adapter<MALLOC>::ACE_Allocator_Adapter");
}
-#endif /* ACE_HAS_WCHAR */
/// Destructor.
virtual ~ACE_Allocator_Adapter (void);
diff --git a/ace/Manual_Event.cpp b/ace/Manual_Event.cpp
index 57543a6d840..5acefac1109 100644
--- a/ace/Manual_Event.cpp
+++ b/ace/Manual_Event.cpp
@@ -18,12 +18,11 @@ ACE_Manual_Event::ACE_Manual_Event (int initial_state,
: ACE_Event (1,
initial_state,
type,
- ACE_TEXT_CHAR_TO_TCHAR (name),
+ ACE_TEXT_TO_TCHAR_IN (name),
arg)
{
}
-#if defined (ACE_HAS_WCHAR)
ACE_Manual_Event::ACE_Manual_Event (int initial_state,
int type,
const wchar_t *name,
@@ -31,11 +30,10 @@ ACE_Manual_Event::ACE_Manual_Event (int initial_state,
: ACE_Event (1,
initial_state,
type,
- ACE_TEXT_WCHAR_TO_TCHAR (name),
+ ACE_TEXT_TO_TCHAR_IN (name),
arg)
{
}
-#endif /* ACE_HAS_WCHAR */
void
ACE_Manual_Event::dump (void) const
diff --git a/ace/Manual_Event.h b/ace/Manual_Event.h
index 77de173788e..fd3b5743188 100644
--- a/ace/Manual_Event.h
+++ b/ace/Manual_Event.h
@@ -45,13 +45,11 @@ public:
const char *name = 0,
void *arg = 0);
-#if defined (ACE_HAS_WCHAR)
/// constructor which will create manual event (wchar_t version)
ACE_Manual_Event (int initial_state,
int type,
const wchar_t *name,
void *arg = 0);
-#endif /* ACE_HAS_WCHAR */
/// Default dtor.
~ACE_Manual_Event (void);
diff --git a/ace/Multihomed_INET_Addr.cpp b/ace/Multihomed_INET_Addr.cpp
index 152127daeb4..a24f98957e3 100644
--- a/ace/Multihomed_INET_Addr.cpp
+++ b/ace/Multihomed_INET_Addr.cpp
@@ -55,7 +55,7 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
if (ret) {
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("Invalid INET addr (%s:%u) will be ignored\n"),
- ACE_TEXT_CHAR_TO_TCHAR (secondary_host_names[i]), port_number));
+ ACE_TEXT_TO_TCHAR_IN (secondary_host_names[i]), port_number));
this->secondaries_.size(this->secondaries_.size() - 1);
}
else
@@ -66,7 +66,6 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
return;
}
-#if defined (ACE_HAS_WCHAR)
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
const wchar_t host_name[],
int encode,
@@ -91,7 +90,7 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
if (ret) {
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("Invalid INET addr (%s:%u) will be ignored\n"),
- ACE_TEXT_WCHAR_TO_TCHAR (secondary_host_names[i]), port_number));
+ ACE_TEXT_TO_TCHAR_IN (secondary_host_names[i]), port_number));
this->secondaries_.size(this->secondaries_.size() - 1);
}
else
@@ -101,7 +100,6 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
return;
}
-#endif /* ACE_HAS_WCHAR */
ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number,
ACE_UINT32 primary_ip_addr,
@@ -162,7 +160,6 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
return ACE_INET_Addr::set(port_number, host_name, encode, address_family);
}
-#if defined (ACE_HAS_WCHAR)
//
// WCHAR version of ::set
//
@@ -189,7 +186,6 @@ ACE_Multihomed_INET_Addr::set (u_short port_number,
return ACE_INET_Addr::set(port_number, host_name, encode, address_family);
}
-#endif /* ACE_HAS_WCHAR */
int
ACE_Multihomed_INET_Addr::set (u_short port_number,
diff --git a/ace/Multihomed_INET_Addr.h b/ace/Multihomed_INET_Addr.h
index a7a838395db..75799cf0077 100644
--- a/ace/Multihomed_INET_Addr.h
+++ b/ace/Multihomed_INET_Addr.h
@@ -81,7 +81,6 @@ public:
const ACE_UINT32 *secondary_ip_addrs = 0,
size_t size = 0);
-#if defined (ACE_HAS_WCHAR)
/**
* WCHAR versions of the methods that take char's as arguments.
*/
@@ -98,8 +97,6 @@ public:
const wchar_t *(secondary_host_names[]) = 0,
size_t size = 0);
-#endif /* ACE_HAS_WCHAR */
-
/// Use compiler-generated copy constructor.
/// Use compiler-generated assignment operator.
diff --git a/ace/Mutex.h b/ace/Mutex.h
index 278e0a9ab9d..61d4db02491 100644
--- a/ace/Mutex.h
+++ b/ace/Mutex.h
@@ -29,10 +29,7 @@
# define ACE_DEFAULT_MUTEX_A "ACE_MUTEX"
# endif /* ACE_DEFAULT_MUTEX_A */
-# if defined (ACE_HAS_WCHAR)
-# define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A)
-# endif /* ACE_HAS_WCHAR */
-
+# define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A)
# define ACE_DEFAULT_MUTEX ACE_LIB_TEXT (ACE_DEFAULT_MUTEX_A)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ace/NT_Service.h b/ace/NT_Service.h
index 6eba99986a4..99fc0f1f2ec 100644
--- a/ace/NT_Service.h
+++ b/ace/NT_Service.h
@@ -420,7 +420,7 @@ extern VOID WINAPI ace_nt_svc_main_##SVCNAME (DWORD dwArgc, \
#define ACE_NT_SERVICE_RUN(SVCNAME, SVCINSTANCE, RET) \
ACE_TEXT_SERVICE_TABLE_ENTRY _ace_nt_svc_table[2] = \
{ \
- ACE_NT_SERVICE_ENTRY(ACE_TEXT (#SVCNAME), SVCNAME), \
+ ACE_NT_SERVICE_ENTRY(ACE_LIB_TEXT (#SVCNAME), SVCNAME), \
{ 0, 0 } \
}; \
_ace_nt_svc_obj_##SVCNAME = SVCINSTANCE; \
diff --git a/ace/Name_Request_Reply.cpp b/ace/Name_Request_Reply.cpp
index f92bbf3c15d..7cee855d644 100644
--- a/ace/Name_Request_Reply.cpp
+++ b/ace/Name_Request_Reply.cpp
@@ -21,9 +21,9 @@ ACE_Name_Request::ACE_Name_Request (void)
ACE_Name_Request::ACE_Name_Request (
ACE_INT32 t, // Type of request.
- const ACE_WCHAR_T name[], // Name
+ const wchar_t name[], // Name
const ACE_UINT32 name_length, // size in bytes
- const ACE_WCHAR_T value[], //
+ const wchar_t value[], //
const ACE_UINT32 value_length, // size in bytes
const char type[], //
const ACE_UINT32 type_length, // size in bytes
@@ -52,8 +52,8 @@ ACE_Name_Request::ACE_Name_Request (
// Set up pointers and copy name value and type into request.
this->name_ = this->transfer_.data_;
- this->value_ = &this->name_[name_length / sizeof (ACE_WCHAR_T) ];
- this->type_ = (char *)(&this->value_[value_length / sizeof (ACE_WCHAR_T)]); //
+ this->value_ = &this->name_[name_length / sizeof (wchar_t) ];
+ this->type_ = (char *)(&this->value_[value_length / sizeof (wchar_t)]); //
(void) ACE_OS::memcpy (this->name_,
name,
@@ -199,7 +199,7 @@ ACE_Name_Request::timeout (const ACE_Time_Value timeout)
// = Set/get the name
-const ACE_WCHAR_T *
+const wchar_t *
ACE_Name_Request::name (void) const
{
ACE_TRACE ("ACE_Name_Request::name");
@@ -207,7 +207,7 @@ ACE_Name_Request::name (void) const
}
void
-ACE_Name_Request::name (const ACE_WCHAR_T *t)
+ACE_Name_Request::name (const wchar_t *t)
{
ACE_TRACE ("ACE_Name_Request::name");
(void) ACE_OS::memcpy (this->name_,
@@ -217,7 +217,7 @@ ACE_Name_Request::name (const ACE_WCHAR_T *t)
// = Set/get the value
-const ACE_WCHAR_T *
+const wchar_t *
ACE_Name_Request::value (void) const
{
ACE_TRACE ("ACE_Name_Request::value");
@@ -225,7 +225,7 @@ ACE_Name_Request::value (void) const
}
void
-ACE_Name_Request::value (const ACE_WCHAR_T *c)
+ACE_Name_Request::value (const wchar_t *c)
{
ACE_TRACE ("ACE_Name_Request::value");
@@ -265,7 +265,7 @@ ACE_Name_Request::encode (void *&buf)
size_t nv_data_len =
(this->transfer_.name_len_ + this->transfer_.value_len_)
- / sizeof (ACE_WCHAR_T);
+ / sizeof (wchar_t);
for (size_t i = 0; i < nv_data_len; i++)
this->transfer_.data_[i] =
@@ -303,15 +303,15 @@ ACE_Name_Request::decode (void)
size_t nv_data_len =
(this->transfer_.name_len_ + this->transfer_.value_len_)
- / sizeof (ACE_WCHAR_T);
+ / sizeof (wchar_t);
for (size_t i = 0; i < nv_data_len; i++)
this->transfer_.data_[i] =
ntohs (this->transfer_.data_[i]);
this->name_ = this->transfer_.data_;
- this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_WCHAR_T)];
- this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (ACE_WCHAR_T)]);
+ this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (wchar_t)];
+ this->type_ = (char *)(&this->value_[this->transfer_.value_len_ / sizeof (wchar_t)]);
this->type_[this->transfer_.type_len_] = '\0';
// Decode the variable-sized portion.
diff --git a/ace/Name_Request_Reply.h b/ace/Name_Request_Reply.h
index 07e4b61d95b..cb9173cd7bc 100644
--- a/ace/Name_Request_Reply.h
+++ b/ace/Name_Request_Reply.h
@@ -73,9 +73,9 @@ public:
/// Create a ACE_Name_Request message.
ACE_Name_Request (ACE_INT32 msg_type, // Type of request.
- const ACE_WCHAR_T name[], //
+ const wchar_t name[], //
const ACE_UINT32 name_length,
- const ACE_WCHAR_T value[],
+ const wchar_t value[],
const ACE_UINT32 value_length,
const char type[],
const ACE_UINT32 type_length,
@@ -102,12 +102,12 @@ public:
void timeout (const ACE_Time_Value timeout);
// = Set/get the name
- const ACE_WCHAR_T *name (void) const;
- void name (const ACE_WCHAR_T *);
+ const wchar_t *name (void) const;
+ void name (const wchar_t *);
// = Set/get the value
- const ACE_WCHAR_T *value (void) const;
- void value (const ACE_WCHAR_T *);
+ const wchar_t *value (void) const;
+ void value (const wchar_t *);
// = Set/get the type
const char *type (void) const;
@@ -169,17 +169,17 @@ private:
/// The data portion contains the <name_>
/// followed by the <value_>
/// followed by the <type_>.
- ACE_WCHAR_T data_[MAX_NAME_LENGTH + MAXPATHLEN + MAXPATHLEN + 2];
+ wchar_t data_[MAX_NAME_LENGTH + MAXPATHLEN + MAXPATHLEN + 2];
};
/// Transfer buffer.
Transfer transfer_;
/// Pointer to the beginning of the name in this->data_.
- ACE_WCHAR_T *name_;
+ wchar_t *name_;
/// Pointer to the beginning of the value in this->data_;
- ACE_WCHAR_T *value_;
+ wchar_t *value_;
/// Pointer to the beginning of the type in this->data_;
char *type_;
diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp
index 596d4aa3aed..b7ad702ac54 100644
--- a/ace/Naming_Context.cpp
+++ b/ace/Naming_Context.cpp
@@ -600,7 +600,7 @@ ACE_Name_Options::parse_args (int argc, ACE_TCHAR *argv[])
// clean it up in the destructor).
this->database (this->process_name ());
- ACE_Get_Opt get_opt (argc, argv, ACE_LIB_TEXT ("b:c:dh:l:P:p:s:T:vr"));
+ ACE_Get_Arg_Opt<ACE_TCHAR> get_opt (argc, argv, ACE_LIB_TEXT ("b:c:dh:l:P:p:s:T:vr"));
for (int c; (c = get_opt ()) != -1; )
switch (c)
diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp
index c855adb7729..e3452744928 100644
--- a/ace/OS_NS_Thread.cpp
+++ b/ace/OS_NS_Thread.cpp
@@ -1318,7 +1318,6 @@ ACE_OS::cond_init (ACE_cond_t *cv,
ACE_OS::cond_init (cv, static_cast<short> (attributes.type), name, arg);
}
-# if defined (ACE_HAS_WCHAR)
int
ACE_OS::cond_init (ACE_cond_t *cv,
ACE_condattr_t &attributes,
@@ -1327,7 +1326,6 @@ ACE_OS::cond_init (ACE_cond_t *cv,
return
ACE_OS::cond_init (cv, static_cast<short> (attributes.type), name, arg);
}
-# endif /* ACE_HAS_WCHAR */
int
ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg)
@@ -1358,7 +1356,6 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg)
# endif /* ACE_HAS_THREADS */
}
-# if defined (ACE_HAS_WCHAR)
int
ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
{
@@ -1387,7 +1384,6 @@ ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
ACE_NOTSUP_RETURN (-1);
# endif /* ACE_HAS_THREADS */
}
-# endif /* ACE_HAS_WCHAR */
int
ACE_OS::cond_signal (ACE_cond_t *cv)
@@ -1999,7 +1995,7 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
::CreateMutexW (ACE_OS::default_win32_security_attributes_r
(sa, &sa_buffer, &sd_buffer),
FALSE,
- ACE_Ascii_To_Wide (name).wchar_rep ());
+ ACE_TEXT_TO_WCHAR_IN (name));
# else /* ACE_HAS_WINCE */
m->proc_mutex_ =
::CreateMutexA (ACE_OS::default_win32_security_attributes_r
@@ -2152,7 +2148,6 @@ ACE_OS::mutex_destroy (ACE_mutex_t *m)
#endif /* ACE_HAS_THREADS */
}
-#if defined (ACE_HAS_WCHAR)
int
ACE_OS::mutex_init (ACE_mutex_t *m,
int lock_scope,
@@ -2189,13 +2184,12 @@ ACE_OS::mutex_init (ACE_mutex_t *m,
#else /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */
return ACE_OS::mutex_init (m,
lock_scope,
- ACE_Wide_To_Ascii (name).char_rep (),
+ ACE_TEXT_TO_CHAR_IN (name),
attributes,
sa,
lock_type);
#endif /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */
}
-#endif /* ACE_HAS_WCHAR */
int
ACE_OS::mutex_lock (ACE_mutex_t *m)
@@ -2663,7 +2657,7 @@ ACE_OS::event_destroy (ACE_event_t *event)
# endif
ACE_OS::munmap (event->eventdata_,
sizeof (ACE_eventdata_t));
- ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR(event->name_));
+ ACE_OS::shm_unlink (ACE_TEXT_TO_TCHAR_IN(event->name_));
ACE_OS::free (event->name_);
return r1 != 0 || r2 != 0 ? -1 : 0;
}
@@ -2752,7 +2746,7 @@ ACE_OS::event_init (ACE_event_t *event,
(sa, &sa_buffer, &sd_buffer),
manual_reset,
initial_state,
- ACE_Ascii_To_Wide (name).wchar_rep ());
+ ACE_TEXT_TO_WCHAR_IN (name));
# else /* ACE_HAS_WINCE */
*event = ::CreateEventA (ACE_OS::default_win32_security_attributes_r
(sa, &sa_buffer, &sd_buffer),
@@ -2773,13 +2767,13 @@ ACE_OS::event_init (ACE_event_t *event,
{
int owner = 0;
// Let's see if the shared memory entity already exists.
- ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name),
+ ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN (name),
O_RDWR | O_CREAT | O_EXCL,
ACE_DEFAULT_FILE_PERMS);
if (fd == ACE_INVALID_HANDLE)
{
if (errno == EEXIST)
- fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name),
+ fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN (name),
O_RDWR | O_CREAT,
ACE_DEFAULT_FILE_PERMS);
if (fd == ACE_INVALID_HANDLE) // Still can't get it.
@@ -2807,7 +2801,7 @@ ACE_OS::event_init (ACE_event_t *event,
if (evtdata == MAP_FAILED)
{
if (owner)
- ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name));
+ ACE_OS::shm_unlink (ACE_TEXT_TO_TCHAR_IN (name));
return -1;
}
@@ -2816,7 +2810,7 @@ ACE_OS::event_init (ACE_event_t *event,
event->name_ = ACE_OS::strdup (name);
if (event->name_ == 0)
{
- ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name));
+ ACE_OS::shm_unlink (ACE_TEXT_TO_TCHAR_IN (name));
return -1;
}
event->eventdata_ = evtdata;
@@ -5540,7 +5534,6 @@ ACE_OS::unique_name (const void *object,
length);
}
-#if defined (ACE_USES_WCHAR)
void
ACE_OS::unique_name (const void *object,
wchar_t *name,
@@ -5553,14 +5546,13 @@ ACE_OS::unique_name (const void *object,
// <object>.
wchar_t temp_name[ACE_UNIQUE_NAME_LEN];
ACE_OS::sprintf (temp_name,
- ACE_LIB_TEXT ("%p%d"),
+ ACE_TEXT_WIDE ("%p%d"),
object,
static_cast <int> (ACE_OS::getpid ()));
ACE_OS::strsncpy (name,
temp_name,
length);
}
-#endif
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_Thread.h b/ace/OS_NS_Thread.h
index db28de9ae00..9274b5212a7 100644
--- a/ace/OS_NS_Thread.h
+++ b/ace/OS_NS_Thread.h
@@ -1272,7 +1272,6 @@ namespace ACE_OS {
const char *name = 0,
void *arg = 0);
-# if defined (ACE_HAS_WCHAR)
# if defined (ACE_LACKS_COND_T) && ! defined (ACE_PSOS_DIAB_MIPS)
extern ACE_Export
# else
@@ -1292,7 +1291,6 @@ namespace ACE_OS {
ACE_condattr_t &attributes,
const wchar_t *name,
void *arg = 0);
-# endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_COND_T) && ! defined (ACE_PSOS_DIAB_MIPS)
extern ACE_Export
@@ -1351,7 +1349,6 @@ namespace ACE_OS {
void *arg = 0,
LPSECURITY_ATTRIBUTES sa = 0);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int event_init (ACE_event_t *event,
int manual_reset,
@@ -1360,7 +1357,6 @@ namespace ACE_OS {
const wchar_t *name,
void *arg = 0,
LPSECURITY_ATTRIBUTES sa = 0);
-# endif /* ACE_HAS_WCHAR */
extern ACE_Export
int event_pulse (ACE_event_t *event);
@@ -1401,7 +1397,6 @@ namespace ACE_OS {
LPSECURITY_ATTRIBUTES sa = 0,
int lock_type = 0);
-#if defined (ACE_HAS_WCHAR)
extern ACE_Export
int mutex_init (ACE_mutex_t *m,
int lock_scope,
@@ -1409,7 +1404,6 @@ namespace ACE_OS {
ACE_mutexattr_t *arg = 0,
LPSECURITY_ATTRIBUTES sa = 0,
int lock_type = 0);
-#endif /* ACE_HAS_WCHAR */
/// Win32 note: Abandoned mutexes are not treated differently. 0 is
/// returned since the calling thread does get the ownership.
@@ -1566,7 +1560,6 @@ namespace ACE_OS {
int max = 0x7fffffff,
LPSECURITY_ATTRIBUTES sa = 0);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int sema_init (ACE_sema_t *s,
u_int count,
@@ -1575,7 +1568,6 @@ namespace ACE_OS {
void *arg = 0,
int max = 0x7fffffff,
LPSECURITY_ATTRIBUTES sa = 0);
-# endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int sema_post (ACE_sema_t *s);
@@ -1887,13 +1879,11 @@ namespace ACE_OS {
const char *name = 0,
ACE_mutexattr_t *arg = 0);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int thread_mutex_init (ACE_thread_mutex_t *m,
int lock_type,
const wchar_t *name,
ACE_mutexattr_t *arg = 0);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int thread_mutex_lock (ACE_thread_mutex_t *m);
@@ -1926,12 +1916,12 @@ namespace ACE_OS {
void unique_name (const void *object,
char *name,
size_t length);
-#if defined (ACE_USES_WCHAR)
+
extern ACE_Export
void unique_name (const void *object,
wchar_t *name,
size_t length);
-#endif /* ACE_USES_WCHAR */
+
} /* namespace ACE_OS */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_Thread.inl b/ace/OS_NS_Thread.inl
index b839a53ce94..581e5166ee5 100644
--- a/ace/OS_NS_Thread.inl
+++ b/ace/OS_NS_Thread.inl
@@ -331,24 +331,20 @@ ACE_OS::cond_init (ACE_cond_t *cv,
# endif /* ACE_HAS_THREADS */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::cond_init (ACE_cond_t *cv,
ACE_condattr_t &attributes,
const wchar_t *name,
void *arg)
{
- return ACE_OS::cond_init (cv, attributes, ACE_Wide_To_Ascii (name).char_rep (), arg);
+ return ACE_OS::cond_init (cv, attributes, ACE_TEXT_TO_CHAR_IN (name), arg);
}
-#endif /* ACE_HAS_WCHAR */
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg)
{
- return ACE_OS::cond_init (cv, type, ACE_Wide_To_Ascii (name).char_rep (), arg);
+ return ACE_OS::cond_init (cv, type, ACE_TEXT_TO_CHAR_IN (name), arg);
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::cond_signal (ACE_cond_t *cv)
@@ -525,7 +521,6 @@ ACE_OS::mutex_lock (ACE_mutex_t *m,
return timeout == 0 ? ACE_OS::mutex_lock (m) : ACE_OS::mutex_lock (m, *timeout);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::event_init (ACE_event_t *event,
int manual_reset,
@@ -554,12 +549,11 @@ ACE_OS::event_init (ACE_event_t *event,
manual_reset,
initial_state,
type,
- ACE_Wide_To_Ascii (name).char_rep (),
+ ACE_TEXT_TO_CHAR_IN (name),
arg,
sa);
#endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE long
ACE_OS::priority_control (ACE_idtype_t idtype, ACE_id_t identifier, int cmd, void *arg)
@@ -1466,13 +1460,13 @@ ACE_OS::sema_init (ACE_sema_t *s,
if (type == USYNC_PROCESS)
{
// Let's see if it already exists.
- ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name),
+ ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN(name),
O_RDWR | O_CREAT | O_EXCL,
ACE_DEFAULT_FILE_PERMS);
if (fd == ACE_INVALID_HANDLE)
{
if (errno == EEXIST)
- fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name),
+ fd = ACE_OS::shm_open (ACE_TEXT_TO_TCHAR_IN(name),
O_RDWR | O_CREAT,
ACE_DEFAULT_FILE_PERMS);
else
@@ -1581,7 +1575,7 @@ ACE_OS::sema_init (ACE_sema_t *s,
s->fd_[0] = s->fd_[1] = ACE_INVALID_HANDLE;
bool creator = false;
- if (ACE_OS::mkfifo (ACE_TEXT_CHAR_TO_TCHAR (name), mode) < 0)
+ if (ACE_OS::mkfifo (ACE_TEXT_TO_TCHAR_IN(name), mode) < 0)
{
if (errno != EEXIST) /* already exists OK else ERR */
return -1;
@@ -1759,7 +1753,6 @@ ACE_OS::sema_init (ACE_sema_t *s,
#endif /* ACE_HAS_POSIX_SEM */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::sema_init (ACE_sema_t *s,
u_int count,
@@ -1824,10 +1817,9 @@ ACE_OS::sema_init (ACE_sema_t *s,
# endif /* ACE_USES_WINCE_SEMA_SIMULATION */
# else /* ACE_HAS_WTHREADS */
// Just call the normal char version.
- return ACE_OS::sema_init (s, count, type, ACE_Wide_To_Ascii (name).char_rep (), arg, max, sa);
+ return ACE_OS::sema_init (s, count, type, ACE_TEXT_TO_CHAR_IN (name), arg, max, sa);
# endif /* ACE_HAS_WTHREADS */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::sema_post (ACE_sema_t *s)
@@ -3603,7 +3595,6 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
#endif /* ACE_HAS_THREADS */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
int lock_type,
@@ -3637,7 +3628,6 @@ ACE_OS::thread_mutex_init (ACE_thread_mutex_t *m,
#endif /* ACE_HAS_THREADS */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::thread_mutex_lock (ACE_thread_mutex_t *m)
diff --git a/ace/OS_NS_ctype.h b/ace/OS_NS_ctype.h
index 32abbe0e053..cb1719ee9c6 100644
--- a/ace/OS_NS_ctype.h
+++ b/ace/OS_NS_ctype.h
@@ -49,68 +49,64 @@ namespace ACE_OS {
//@{
/// Returns true if the character is an alphanumeric character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isalnum (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isalnum (CHAR_TYPE c);
/// Returns true if the character is an alphabetic character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isalpha (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isalpha (CHAR_TYPE c);
/// Returns true if the character is a control character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_iscntrl (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_iscntrl (CHAR_TYPE c);
/// Returns true if the character is a decimal-digit character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isdigit (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isdigit (CHAR_TYPE c);
/// Returns true if the character is a printable character other than a space.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isgraph (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isgraph (CHAR_TYPE c);
/// Returns true if the character is a lowercase character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_islower (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_islower (CHAR_TYPE c);
/// Returns true if the character is a printable character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isprint (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isprint (CHAR_TYPE c);
/// Returns true if the character is a punctuation character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_ispunct (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_ispunct (CHAR_TYPE c);
/// Returns true if the character is a space character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isspace (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isspace (CHAR_TYPE c);
/// Returns true if the character is an uppercase character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isupper (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isupper (CHAR_TYPE c);
/// Returns true if the character is a hexadecimal-digit character.
- ACE_NAMESPACE_INLINE_FUNCTION
- int ace_isxdigit (ACE_TCHAR c);
+ template <typename CHAR_TYPE> inline
+ int ace_isxdigit (CHAR_TYPE c);
/// Converts a character to lower case (char version).
ACE_NAMESPACE_INLINE_FUNCTION
int ace_tolower (int c);
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWLOWER)
/// Converts a character to lower case (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wint_t ace_towlower (wint_t c);
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWLOWER */
/// Converts a character to upper case (char version).
ACE_NAMESPACE_INLINE_FUNCTION
int ace_toupper (int c);
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWUPPER)
/// Converts a character to upper case (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wint_t ace_towupper (wint_t c);
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */
//@}
@@ -126,5 +122,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include "ace/OS_NS_ctype.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+#include "ace/OS_NS_ctype_T.inl"
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_CTYPE_H */
diff --git a/ace/OS_NS_ctype.inl b/ace/OS_NS_ctype.inl
index e7199338653..dbda1f48c2b 100644
--- a/ace/OS_NS_ctype.inl
+++ b/ace/OS_NS_ctype.inl
@@ -3,121 +3,10 @@
// $Id$
#include "ace/os_include/os_ctype.h"
-#if defined ACE_HAS_WCHAR
-# include "ace/os_include/os_wctype.h"
-#endif /* ACE_HAS_WCHAR */
+#include "ace/os_include/os_wctype.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-ACE_INLINE int
-ACE_OS::ace_isalnum (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswalnum (c);
-#else /* ACE_USES_WCHAR */
- return isalnum ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isalpha (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswalpha (c);
-#else /* ACE_USES_WCHAR */
- return isalpha ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_iscntrl (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswcntrl (c);
-#else /* ACE_USES_WCHAR */
- return iscntrl ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isdigit (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswdigit (c);
-#else /* ACE_USES_WCHAR */
- return isdigit ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isgraph (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswgraph (c);
-#else /* ACE_USES_WCHAR */
- return isgraph ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_islower (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswlower (c);
-#else /* ACE_USES_WCHAR */
- return islower ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isprint (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswprint (c);
-#else /* ACE_USES_WCHAR */
- return isprint ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_ispunct (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswpunct (c);
-#else /* ACE_USES_WCHAR */
- return ispunct ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isspace (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswspace (c);
-#else /* ACE_USES_WCHAR */
- return isspace ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isupper (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswupper (c);
-#else /* ACE_USES_WCHAR */
- return isupper ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
-
-ACE_INLINE int
-ACE_OS::ace_isxdigit (ACE_TCHAR c)
-{
-#if defined (ACE_USES_WCHAR)
- return iswxdigit (c);
-#else /* ACE_USES_WCHAR */
- return isxdigit ((unsigned char) c);
-#endif /* ACE_USES_WCHAR */
-}
ACE_INLINE int
ACE_OS::ace_tolower (int c)
@@ -125,13 +14,16 @@ ACE_OS::ace_tolower (int c)
return tolower (c);
}
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWLOWER)
ACE_INLINE wint_t
ACE_OS::ace_towlower (wint_t c)
{
- return towlower (c);
+ #if !defined (ACE_LACKS_TOWLOWER)
+ return towlower (c);
+ #else
+ ACE_UNUSED_ARG( c );
+ ACE_NOTSUP_RETURN (0);
+ #endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWLOWER */
ACE_INLINE int
ACE_OS::ace_toupper (int c)
@@ -139,12 +31,16 @@ ACE_OS::ace_toupper (int c)
return toupper (c);
}
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_TOWUPPER)
ACE_INLINE wint_t
ACE_OS::ace_towupper (wint_t c)
{
- return towupper (c);
+ #if !defined (ACE_LACKS_TOWUPPER)
+ return towupper (c);
+ #else
+ ACE_UNUSED_ARG( c );
+ ACE_NOTSUP_RETURN (0);
+ #endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_dirent.inl b/ace/OS_NS_dirent.inl
index ff562717cb9..6864e7a949d 100644
--- a/ace/OS_NS_dirent.inl
+++ b/ace/OS_NS_dirent.inl
@@ -64,7 +64,7 @@ opendir (const ACE_TCHAR *filename)
# elif defined (ACE_HAS_NONCONST_OPENDIR)
return ::opendir (const_cast<char *> (filename));
# else /* ! ACE_WIN32 && ACE_LACKS_OPENDIR */
- return ::opendir (ACE_TEXT_ALWAYS_CHAR (filename));
+ return ::opendir (ACE_TEXT_TO_CHAR_IN (filename));
# endif /* ACE_WIN32 && ACE_LACKS_OPENDIR */
# endif /* ACE_PSOS */
#else
@@ -182,7 +182,7 @@ scandir (const ACE_TCHAR *dirname,
const struct ACE_DIRENT **f2))
{
#if defined (ACE_HAS_SCANDIR)
- return ::scandir (ACE_TEXT_ALWAYS_CHAR (dirname),
+ return ::scandir (ACE_TEXT_TO_CHAR_IN (dirname),
namelist,
selector,
# if defined (ACE_SCANDIR_CMP_USES_VOIDPTR)
diff --git a/ace/OS_NS_dlfcn.inl b/ace/OS_NS_dlfcn.inl
index 6c4caeaf3e8..74a2159107c 100644
--- a/ace/OS_NS_dlfcn.inl
+++ b/ace/OS_NS_dlfcn.inl
@@ -89,7 +89,7 @@ ACE_OS::dlerror (void)
# if defined (ACE_USES_WCHAR)
const size_t BufLen = 256;
static wchar_t buf[BufLen];
- ACE_OS::strncpy (buf, ACE_TEXT_CHAR_TO_TCHAR (err), BufLen);
+ ACE_OS::string_copy (buf, err, BufLen);
return buf;
# else
return const_cast <char *> (err);
@@ -125,13 +125,13 @@ ACE_OS::dlopen (const ACE_TCHAR *fname,
void *handle;
# if defined (ACE_HAS_SGIDLADD)
ACE_OSCALL
- (::sgidladd (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle);
+ (::sgidladd (ACE_TEXT_TO_CHAR_IN (fname), mode), void *, 0, handle);
# elif defined (_M_UNIX)
ACE_OSCALL
- (::_dlopen (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle);
+ (::_dlopen (ACE_TEXT_TO_CHAR_IN (fname), mode), void *, 0, handle);
# else
ACE_OSCALL
- (::dlopen (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle);
+ (::dlopen (ACE_TEXT_TO_CHAR_IN (fname), mode), void *, 0, handle);
# endif /* ACE_HAS_SGIDLADD */
# if !defined (ACE_HAS_AUTOMATIC_INIT_FINI)
if (handle != 0)
@@ -210,24 +210,15 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle,
#endif /* ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE */
// Get the correct OS type.
+ // Define symbolname
#if defined (ACE_HAS_WINCE)
- // CE (at least thru Pocket PC 2003) offers GetProcAddressW, not ...A, so
- // we always need a wide-char string.
- const wchar_t *symbolname = 0;
-# if defined (ACE_USES_WCHAR)
- symbolname = sname;
-# else
- ACE_Ascii_To_Wide sname_xlate (sname);
- symbolname = sname_xlate.wchar_rep ();
-# endif /* ACE_USES_WCHAR */
-#elif defined (ACE_USES_WCHAR)
- // WinCE is WCHAR always; other platforms need a char * symbol name
- ACE_Wide_To_Ascii w_sname (sname);
- char *symbolname = w_sname.char_rep ();
-#elif defined (ACE_VXWORKS)
- char *symbolname = const_cast<char *> (sname);
+ // WinCE expects a wchar
+ ACE::String_Conversion::Convert_In< wchar_t, char > convert (sname);
+ const wchar_t *symbolname = convert.c_str();
#else
- const char *symbolname = sname;
+ // Otherwise we make certain we have an ANSI char version
+ ACE::String_Conversion::Convert_In< char, wchar_t > convert (sname);
+ const char *symbolname = convert.c_str();
#endif /* ACE_HAS_WINCE */
# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
diff --git a/ace/OS_NS_fcntl.cpp b/ace/OS_NS_fcntl.cpp
index bd3cbba647d..79bf7c99fe4 100644
--- a/ace/OS_NS_fcntl.cpp
+++ b/ace/OS_NS_fcntl.cpp
@@ -81,7 +81,7 @@ ACE_OS::open (const char *filename,
SECURITY_DESCRIPTOR sd_buffer;
#if defined (ACE_HAS_WINCE)
- ACE_HANDLE h = ::CreateFileW (ACE_Ascii_To_Wide (filename).wchar_rep (),
+ ACE_HANDLE h = ::CreateFileW (ACE_TEXT_TO_WCHAR_IN (filename),
access,
shared_mode,
ACE_OS::default_win32_security_attributes_r
@@ -128,7 +128,6 @@ ACE_OS::open (const char *filename,
#endif /* ACE_WIN32 */
}
-#if defined (ACE_HAS_WCHAR)
ACE_HANDLE
ACE_OS::open (const wchar_t *filename,
int mode,
@@ -220,12 +219,11 @@ ACE_OS::open (const wchar_t *filename,
return h;
#else /* ACE_WIN32 */
// Just emulate with ascii version
- return ACE_OS::open (ACE_Wide_To_Ascii (filename).char_rep (),
+ return ACE_OS::open (ACE_TEXT_TO_CHAR_IN (filename),
mode,
perms,
sa);
#endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_fcntl.h b/ace/OS_NS_fcntl.h
index 9334a1a075e..ac48e0e13e1 100644
--- a/ace/OS_NS_fcntl.h
+++ b/ace/OS_NS_fcntl.h
@@ -71,14 +71,12 @@ namespace ACE_OS {
int mode,
int perms = ACE_DEFAULT_OPEN_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
-#if defined (ACE_HAS_WCHAR)
+
extern ACE_Export
ACE_HANDLE open (const wchar_t *filename,
int mode,
int perms = ACE_DEFAULT_OPEN_PERMS,
LPSECURITY_ATTRIBUTES sa = 0);
-#endif /* ACE_HAS_WCHAR */
-
} /* namespace ACE_OS */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_stdio.cpp b/ace/OS_NS_stdio.cpp
index 46b30ef5fdb..475abea4487 100644
--- a/ace/OS_NS_stdio.cpp
+++ b/ace/OS_NS_stdio.cpp
@@ -159,7 +159,6 @@ ACE_OS::fopen (const char *filename,
return 0;
}
-#if defined (ACE_HAS_WCHAR)
FILE *
ACE_OS::fopen (const wchar_t *filename,
const ACE_TCHAR *mode)
@@ -206,7 +205,6 @@ ACE_OS::fopen (const wchar_t *filename,
}
return 0;
}
-#endif /* ACE_HAS_WCHAR */
#endif /* ACE_WIN32 */
@@ -222,7 +220,6 @@ ACE_OS::fprintf (FILE *fp, const char *format, ...)
return result;
}
-#if defined (ACE_HAS_WCHAR)
int
ACE_OS::fprintf (FILE *fp, const wchar_t *format, ...)
{
@@ -243,7 +240,6 @@ ACE_OS::fprintf (FILE *fp, const wchar_t *format, ...)
# endif /* ACE_HAS_VFWPRINTF */
}
-#endif /* ACE_HAS_WCHAR */
// The following *printf functions aren't inline because
@@ -302,8 +298,6 @@ ACE_OS::snprintf (char *buf, size_t maxlen, const char *format, ...)
#endif /* ACE_HAS_SNPRINTF */
}
-#if defined (ACE_HAS_WCHAR)
-
int
ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...)
{
@@ -347,7 +341,6 @@ ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...)
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_SNPRINTF */
}
-#endif /* ACE_HAS_WCHAR */
int
ACE_OS::sprintf (char *buf, const char *format, ...)
@@ -362,7 +355,6 @@ ACE_OS::sprintf (char *buf, const char *format, ...)
return result;
}
-#if defined (ACE_HAS_WCHAR)
int
ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...)
{
@@ -401,6 +393,6 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...)
# endif /* XPG5 || ACE_HAS_DINKUM_STL */
}
-#endif /* ACE_HAS_WCHAR */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_stdio.h b/ace/OS_NS_stdio.h
index c2ad103bc5c..450b7ce2ced 100644
--- a/ace/OS_NS_stdio.h
+++ b/ace/OS_NS_stdio.h
@@ -151,11 +151,10 @@ namespace ACE_OS {
char *cuserid (char *user,
size_t maxlen = ACE_MAX_USERID);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *cuserid (wchar_t *user,
size_t maxlen = ACE_MAX_USERID);
-# endif /* ACE_HAS_WCHAR */
+
# endif /* ACE_LACKS_CUSERID */
//@}
@@ -181,10 +180,8 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
char *fgets (char *buf, int size, FILE *fp);
-# if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *fgets (wchar_t *buf, int size, FILE *fp);
-# endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */
//@{ @name A set of wrappers for file locks.
@@ -245,14 +242,12 @@ namespace ACE_OS {
#endif /* ACE_WIN32 */
FILE *fopen (const char *filename, const ACE_TCHAR *mode);
-#if defined (ACE_HAS_WCHAR)
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
extern ACE_Export
#else
ACE_NAMESPACE_INLINE_FUNCTION
#endif /* ACE_WIN32 */
FILE *fopen (const wchar_t *filename, const ACE_TCHAR *mode);
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_WIN32)
/// Default Win32 Security Attributes definition.
@@ -295,20 +290,16 @@ namespace ACE_OS {
extern ACE_Export
int fprintf (FILE *fp, const char *format, ...);
-# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int fprintf (FILE *fp, const wchar_t *format, ...);
-# endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int fputs (const char *s,
FILE *stream);
-# if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS)
ACE_NAMESPACE_INLINE_FUNCTION
int fputs (const wchar_t *s,
FILE *stream);
-# endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */
ACE_NAMESPACE_INLINE_FUNCTION
size_t fread (void *ptr,
@@ -341,10 +332,8 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
void perror (const char *s);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
void perror (const wchar_t *s);
-#endif /* ACE_HAS_WCHAR */
extern ACE_Export
int printf (const char *format, ...);
@@ -352,22 +341,18 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
int puts (const char *s);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int puts (const wchar_t *s);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int rename (const char *old_name,
const char *new_name,
int flags = -1);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int rename (const wchar_t *old_name,
const wchar_t *new_name,
int flags = -1);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
void rewind (FILE *fp);
@@ -375,28 +360,22 @@ namespace ACE_OS {
extern ACE_Export
int snprintf (char *buf, size_t maxlen, const char *format, ...);
-# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format,...);
-# endif /* ACE_HAS_WCHAR */
extern ACE_Export
int sprintf (char *buf, const char *format, ...);
-# if defined (ACE_HAS_WCHAR)
extern ACE_Export
int sprintf (wchar_t *buf, const wchar_t *format, ...);
-# endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
char *tempnam (const char *dir = 0,
const char *pfx = 0);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *tempnam (const wchar_t *dir,
const wchar_t *pfx = 0);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int vsprintf (char *buffer, const char *format, va_list argptr);
@@ -404,13 +383,11 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
int vsnprintf (char *buffer, size_t maxlen, const char *format, va_list argptr);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr);
ACE_NAMESPACE_INLINE_FUNCTION
int vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list argptr);
-# endif /* ACE_HAS_WCHAR */
} /* namespace ACE_OS */
diff --git a/ace/OS_NS_stdio.inl b/ace/OS_NS_stdio.inl
index d3f2c08c99e..0f4a460723b 100644
--- a/ace/OS_NS_stdio.inl
+++ b/ace/OS_NS_stdio.inl
@@ -589,7 +589,6 @@ ACE_OS::cuserid (char *user, size_t maxlen)
#endif /* VXWORKS */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::cuserid (wchar_t *user, size_t maxlen)
{
@@ -600,14 +599,14 @@ ACE_OS::cuserid (wchar_t *user, size_t maxlen)
else
return user;
# else /* ACE_WIN32 */
- char *char_user;
+ char *char_user = 0;
wchar_t *result = 0;
ACE_NEW_RETURN (char_user, char[maxlen + 1], 0);
if (ACE_OS::cuserid (char_user, maxlen))
{
- ACE_OS::strcpy (user, ACE_Ascii_To_Wide (char_user).wchar_rep ());
+ ACE_OS::string_copy (user, char_user, maxlen + 1);
result = user;
}
@@ -616,7 +615,6 @@ ACE_OS::cuserid (wchar_t *user, size_t maxlen)
return result;
# endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CUSERID */
ACE_INLINE int
@@ -631,9 +629,9 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fdopen");
# if defined (ACE_HAS_WINCE)
- ACE_OSCALL_RETURN (::_wfdopen (handle, ACE_TEXT_ALWAYS_WCHAR (mode)),
- FILE*,
- 0);
+ ACE_OSCALL_RETURN (::_wfdopen (handle, ACE_TEXT_TO_WCHAR_IN (mode)),
+ FILE*,
+ 0);
# elif defined (ACE_WIN32)
// kernel file handle -> FILE* conversion...
// Options: _O_APPEND, _O_RDONLY and _O_TEXT are lost
@@ -678,7 +676,7 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
ACE_NOTSUP_RETURN (0);
# else
ACE_OSCALL_RETURN
- (::fdopen (handle, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0);
+ (::fdopen (handle, ACE_TEXT_TO_CHAR_IN (mode)), FILE *, 0);
# endif /* ACE_HAS_WINCE */
}
@@ -716,14 +714,19 @@ ACE_OS::fgets (char *buf, int size, FILE *fp)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgets (buf, size, fp), char *, 0);
}
-#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS)
ACE_INLINE wchar_t *
ACE_OS::fgets (wchar_t *buf, int size, FILE *fp)
{
+#if !defined(ACE_LACKS_FGETWS)
ACE_OS_TRACE ("ACE_OS::fgets");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetws (buf, size, fp), wchar_t *, 0);
+#else
+ ACE_UNUSED_ARG( buf );
+ ACE_UNUSED_ARG( size );
+ ACE_UNUSED_ARG( fp );
+ ACE_NOTSUP_RETURN (0);
+#endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */
#if !(defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
@@ -732,25 +735,23 @@ ACE_OS::fopen (const char *filename, const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
ACE_OSCALL_RETURN
- (::fopen (filename, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0);
+ (::fopen (filename, ACE_TEXT_TO_CHAR_IN (mode)), FILE *, 0);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE FILE *
ACE_OS::fopen (const wchar_t *filename, const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
#if defined (ACE_HAS_WINCE)
ACE_OSCALL_RETURN
- (::_wfopen (filename, ACE_TEXT_ALWAYS_WCHAR (mode)), FILE *, 0);
+ (::_wfopen (filename, ACE_TEXT_TO_WCHAR_IN (mode)), FILE *, 0);
#else
// Non-Windows doesn't use wchar_t file systems.
- ACE_Wide_To_Ascii n_filename (filename);
ACE_OSCALL_RETURN
- (::fopen (n_filename.char_rep (), ACE_TEXT_ALWAYS_CHAR (mode)), FILE*, 0);
+ (::fopen (ACE_TEXT_TO_CHAR_IN (filename),
+ ACE_TEXT_TO_CHAR_IN (mode)), FILE*, 0);
#endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
#endif /* ACE_WIN32 */
@@ -761,14 +762,18 @@ ACE_OS::fputs (const char *s, FILE *stream)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputs (s, stream), int, -1);
}
-#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS)
ACE_INLINE int
ACE_OS::fputs (const wchar_t *s, FILE *stream)
{
+#if !defined(ACE_LACKS_FPUTWS)
ACE_OS_TRACE ("ACE_OS::fputs");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputws (s, stream), int, -1);
+#else
+ ACE_UNUSED_ARG( s );
+ ACE_UNUSED_ARG( stream );
+ ACE_NOTSUP_RETURN (-1);
+#endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */
ACE_INLINE size_t
ACE_OS::fread (void *ptr, size_t size, size_t nelems, FILE *fp)
@@ -784,14 +789,14 @@ ACE_OS::freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream)
{
ACE_OS_TRACE ("ACE_OS::freopen");
#if defined (ACE_WIN32) && (defined(ACE_USES_WCHAR) || defined(ACE_HAS_WINCE))
- ACE_OSCALL_RETURN (::_wfreopen (ACE_TEXT_ALWAYS_WCHAR (filename),
- ACE_TEXT_ALWAYS_WCHAR (mode),
- stream),
- FILE *, 0);
+ ACE_OSCALL_RETURN (::_wfreopen (ACE_TEXT_TO_WCHAR_IN (filename),
+ ACE_TEXT_TO_WCHAR_IN (mode),
+ stream),
+ FILE *, 0);
#else
ACE_OSCALL_RETURN
- (ACE_STD_NAMESPACE::freopen (ACE_TEXT_ALWAYS_CHAR (filename),
- ACE_TEXT_ALWAYS_CHAR (mode),
+ (ACE_STD_NAMESPACE::freopen (ACE_TEXT_TO_CHAR_IN (filename),
+ ACE_TEXT_TO_CHAR_IN (mode),
stream),
FILE *, 0);
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
@@ -856,7 +861,6 @@ ACE_OS::perror (const char *s)
#endif /* ACE_HAS_WINCE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE_OS::perror (const wchar_t *s)
{
@@ -867,11 +871,9 @@ ACE_OS::perror (const wchar_t *s)
#elif defined (ACE_WIN32)
::_wperror (s);
#else
- ACE_Wide_To_Ascii n_s (s);
- ::perror (n_s.char_rep ());
+ ::perror (ACE_TEXT_TO_CHAR_IN (s));
#endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::puts (const char *s)
@@ -880,7 +882,6 @@ ACE_OS::puts (const char *s)
ACE_OSCALL_RETURN (::puts (s), int, -1);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::puts (const wchar_t *s)
{
@@ -889,11 +890,9 @@ ACE_OS::puts (const wchar_t *s)
ACE_OSCALL_RETURN (::_putws (s), int, -1);
#else /* ACE_WIN32 */
// There's no putws()...
- ACE_Wide_To_Ascii n_s (s);
- ACE_OSCALL_RETURN (::puts (n_s.char_rep ()), int, -1);
+ ACE_OSCALL_RETURN (::puts (ACE_TEXT_TO_CHAR_IN (s)), int, -1);
#endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::rename (const char *old_name,
@@ -908,8 +907,8 @@ ACE_OS::rename (const char *old_name,
# elif defined (ACE_HAS_WINCE)
// Win CE is always wide-char.
ACE_UNUSED_ARG (flags);
- if (0 != MoveFile (ACE_TEXT_CHAR_TO_TCHAR (old_name),
- ACE_TEXT_CHAR_TO_TCHAR (new_name)))
+ if (0 != MoveFile (ACE_TEXT_TO_TCHAR_IN (old_name),
+ ACE_TEXT_TO_TCHAR_IN (new_name)))
ACE_FAIL_RETURN (-1);
return 0;
# elif defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 == 1)
@@ -928,7 +927,6 @@ ACE_OS::rename (const char *old_name,
# endif /* ACE_LACKS_RENAME */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::rename (const wchar_t *old_name,
const wchar_t *new_name,
@@ -958,12 +956,10 @@ ACE_OS::rename (const wchar_t *old_name,
ACE_UNUSED_ARG (flags);
ACE_OSCALL_RETURN (::_wrename (old_name, new_name), int, -1);
# else /* ACE_LACKS_RENAME */
- ACE_Wide_To_Ascii nold_name (old_name);
- ACE_Wide_To_Ascii nnew_name (new_name);
- return ACE_OS::rename (nold_name.char_rep (), nnew_name.char_rep (), flags);
+ return ACE_OS::rename (ACE_TEXT_TO_CHAR_IN (old_name),
+ ACE_TEXT_TO_CHAR_IN (new_name), flags);
# endif /* ACE_LACKS_RENAME */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE void
ACE_OS::rewind (FILE *fp)
@@ -973,7 +969,7 @@ ACE_OS::rewind (FILE *fp)
::rewind (fp);
#else
// This isn't perfect since it doesn't reset EOF, but it's probably
- // the closest we can get on WINCE.
+ // the closest we can get on WINCE.
(void) fseek (fp, 0L, SEEK_SET);
#endif /* ACE_HAS_WINCE */
}
@@ -997,7 +993,6 @@ ACE_OS::tempnam (const char *dir, const char *pfx)
#endif /* ACE_LACKS_TEMPNAM */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
{
@@ -1011,28 +1006,21 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
ACE_OSCALL_RETURN (::_wtempnam (const_cast <wchar_t*> (dir), const_cast <wchar_t*> (pfx)), wchar_t *, 0);
# else
ACE_OSCALL_RETURN (::_wtempnam (dir, pfx), wchar_t *, 0);
-# endif /* __BORLANDC__ */
-#else /* ACE_LACKS_TEMPNAM */
+# endif // __BORLANDC__
+#else // ACE_LACKS_TEMPNAM
// No native wide-char support; convert to narrow and call the char* variant.
- char *ndir = ACE_Wide_To_Ascii (dir).char_rep ();
- char *npfx = ACE_Wide_To_Ascii (pfx).char_rep ();
- char *name = ACE_OS::tempnam (ndir, npfx);
+ char *name = ACE_OS::tempnam (ACE_TEXT_TO_CHAR_IN (dir),
+ ACE_TEXT_TO_CHAR_IN (pfx));
// ACE_OS::tempnam returns a pointer to a malloc()-allocated space.
// Convert that string to wide-char and free() the original.
- wchar_t *wname = 0;
if (name != 0)
{
- size_t namelen = ACE_OS::strlen (name) + 1;
- wname = reinterpret_cast<wchar_t *>
- (ACE_OS::malloc (namelen * sizeof (wchar_t)));
- if (wname != 0)
- ACE_OS::strcpy (wname, ACE_Ascii_To_Wide (name).wchar_rep ());
- ACE_OS::free (name);
+ ::free( name );
+ return ACE_TEXT_TO_MALLOC_WCHAR_OUT( name );
}
- return wname;
+ return 0;
#endif /* ACE_LACKS_TEMPNAM */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::vsprintf (char *buffer, const char *format, va_list argptr)
@@ -1074,7 +1062,6 @@ ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
#endif /* ACE_HAS_SNPRINTF */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr)
{
@@ -1103,9 +1090,7 @@ ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr)
# endif /* XPG5 || ACE_HAS_DINKUM_STL */
}
-#endif /* ACE_HAS_WCHAR */
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list ap)
{
@@ -1141,7 +1126,6 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis
# endif /* platforms with a variant of vswprintf */
}
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#if defined (ACE_WIN32)
diff --git a/ace/OS_NS_stdlib.cpp b/ace/OS_NS_stdlib.cpp
index 9a0370921f5..0da4241875c 100644
--- a/ace/OS_NS_stdlib.cpp
+++ b/ace/OS_NS_stdlib.cpp
@@ -159,7 +159,7 @@ ACE_OS::itoa_emulation (int value, char *string, int radix)
}
#endif /* !ACE_HAS_ITOA */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW)
+#if defined (ACE_LACKS_ITOW)
wchar_t *
ACE_OS::itow_emulation (int value, wchar_t *string, int radix)
{
@@ -209,7 +209,7 @@ ACE_OS::itow_emulation (int value, wchar_t *string, int radix)
return string;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */
+#endif /* ACE_LACKS_ITOW */
void *
ACE_OS::malloc (size_t nbytes)
diff --git a/ace/OS_NS_stdlib.h b/ace/OS_NS_stdlib.h
index 8e0747b7ffd..1209dce8cf4 100644
--- a/ace/OS_NS_stdlib.h
+++ b/ace/OS_NS_stdlib.h
@@ -74,10 +74,8 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
int atoi (const char *s);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int atoi (const wchar_t *s);
-# endif /* ACE_HAS_WCHAR */
// atop not in spec
# if defined (atop)
@@ -87,10 +85,8 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
void *atop (const char *s);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
void *atop (const wchar_t *s);
-# endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
void *bsearch (const void *key,
@@ -111,10 +107,8 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
char *getenv (const char *symbol);
-# if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *getenv (const wchar_t *symbol);
-# endif /* ACE_HAS_WCHAR && ACE_WIN32 */
// not in spec
extern ACE_Export
@@ -125,11 +119,9 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
char *itoa (int value, char *string, int radix);
-#if defined (ACE_HAS_WCHAR)
/// Converts an integer to a string.
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *itoa (int value, wchar_t *string, int radix);
-#endif /* ACE_HAS_WCHAR */
#if !defined (ACE_HAS_ITOA)
/// Emulated itoa - Converts an integer to a string.
@@ -137,11 +129,11 @@ namespace ACE_OS {
char *itoa_emulation (int value, char *string, int radix);
#endif /* !ACE_HAS_ITOA */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW)
+#if defined (ACE_LACKS_ITOW)
/// Emulated itow - Converts an integer to a string.
extern ACE_Export
wchar_t *itow_emulation (int value, wchar_t *string, int radix);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */
+#endif /* ACE_LACKS_ITOW */
extern ACE_Export
void *malloc (size_t);
@@ -149,40 +141,31 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE mkstemp (char *s);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE mkstemp (wchar_t *s);
-# endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_MKSTEMP)
extern ACE_Export
ACE_HANDLE mkstemp_emulation (ACE_TCHAR * s);
#endif /* ACE_LACKS_MKSTEMP */
-#if !defined (ACE_LACKS_MKTEMP)
ACE_NAMESPACE_INLINE_FUNCTION
char *mktemp (char *s);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *mktemp (wchar_t *s);
-# endif /* ACE_HAS_WCHAR */
-#else
- extern ACE_Export
- ACE_TCHAR *mktemp (ACE_TCHAR *s);
-#endif /* !ACE_LACKS_MSTEMP */
ACE_NAMESPACE_INLINE_FUNCTION
int putenv (const char *string);
-#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
+#if defined (ACE_WIN32)
// Windows is the only platform that supports a wchar_t environment.
// Since other platforms make @a string part of the environment, it's
// a certain memory leak to copy and transform wchar_t to char for
// emulating this, so it's not attempted.
ACE_NAMESPACE_INLINE_FUNCTION
int putenv (const wchar_t *string);
-#endif /* ACE_HAS_WCHAR && ACE_WIN32 */
+#endif /* ACE_WIN32 */
ACE_NAMESPACE_INLINE_FUNCTION
void qsort (void *base,
@@ -207,10 +190,8 @@ namespace ACE_OS {
# endif /* !ACE_LACKS_REALPATH */
char *realpath (const char *file_name, char *resolved_name);
-# if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *realpath (const wchar_t *file_name, wchar_t *resolved_name);
-# endif /* ACE_HAS_WCHAR */
#endif /* ACE_HAS_WINCE */
// exit_hook and set_exit_hook not in spec
@@ -234,21 +215,17 @@ namespace ACE_OS {
double strtod (const char *s, char **endptr);
#endif /* !ACE_LACKS_STRTOD */
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD)
/// Converts a string to a double value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
double strtod (const wchar_t *s, wchar_t **endptr);
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */
/// Converts a string to a long value (char version).
ACE_NAMESPACE_INLINE_FUNCTION
long strtol (const char *s, char **ptr, int base);
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL)
/// Converts a string to a long value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
long strtol (const wchar_t *s, wchar_t **ptr, int base);
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */
#if defined (ACE_LACKS_STRTOL)
extern ACE_Export
@@ -259,11 +236,9 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
unsigned long strtoul (const char *s, char **ptr, int base);
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL)
/// Converts a string to an unsigned long value (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base);
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
#if defined (ACE_LACKS_STRTOUL)
extern ACE_Export
@@ -279,6 +254,8 @@ namespace ACE_OS {
ACE_END_VERSIONED_NAMESPACE_DECL
+#include "ace/OS_NS_stdlib_base.inl"
+
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
diff --git a/ace/OS_NS_stdlib.inl b/ace/OS_NS_stdlib.inl
index 0762d7443f5..6f6ca83c71f 100644
--- a/ace/OS_NS_stdlib.inl
+++ b/ace/OS_NS_stdlib.inl
@@ -8,6 +8,8 @@
#include "ace/Global_Macros.h"
#include "ace/os_include/os_errno.h"
#include "ace/os_include/os_search.h"
+#include "ace/os_include/os_limits.h"
+//#include "ace/TSS_T.h"
#if defined(ACE_WCHAR_IN_STD_NAMESPACE)
# define ACE_WCHAR_STD_NAMESPACE std
@@ -65,17 +67,15 @@ ACE_OS::atoi (const char *s)
ACE_OSCALL_RETURN (::atoi (s), int, -1);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::atoi (const wchar_t *s)
{
#if defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_wtoi (s), int, -1);
#else /* ACE_WIN32 */
- return ACE_OS::atoi (ACE_Wide_To_Ascii(s).char_rep());
+ return ACE_OS::atoi (ACE_TEXT_TO_CHAR_IN (s));
#endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
#if defined (atop)
# undef atop
@@ -98,7 +98,6 @@ ACE_OS::atop (const char *s)
return p;
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE void *
ACE_OS::atop (const wchar_t *s)
{
@@ -110,7 +109,6 @@ ACE_OS::atop (const wchar_t *s)
void *p = reinterpret_cast<void *> (ip);
return p;
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE void *
ACE_OS::bsearch (const void *key,
@@ -143,18 +141,31 @@ ACE_OS::getenv (const char *symbol)
#endif /* ACE_LACKS_ENV */
}
-#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
ACE_INLINE wchar_t *
ACE_OS::getenv (const wchar_t *symbol)
{
#if defined (ACE_LACKS_ENV)
ACE_UNUSED_ARG (symbol);
ACE_NOTSUP_RETURN (0);
-#else
+#elif defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_wgetenv (symbol), wchar_t *, 0);
+#else
+// Including ACE_TSS_T.h causes error!
+/*
+ wchar_t* init = 0;
+ static ACE_TSS< wchar_t* > wvalue (&init);
+ ACE::String_Conversion::Allocator_malloc<wchar_t>().free(*wvalue);
+ *wvalue.ts_object() = ACE_TEXT_TO_MALLOC_WCHAR_OUT (
+ ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (symbol)));
+ return *wvalue;
+*/
+ static wchar_t* wvalue = 0;
+ ACE::String_Conversion::Allocator_malloc<wchar_t>().free(wvalue);
+ wvalue = ACE_TEXT_TO_MALLOC_WCHAR_OUT (
+ ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (symbol)));
+ return wvalue;
#endif /* ACE_LACKS_ENV */
}
-#endif /* ACE_HAS_WCHAR && ACE_WIN32 */
ACE_INLINE char *
ACE_OS::itoa (int value, char *string, int radix)
@@ -168,7 +179,6 @@ ACE_OS::itoa (int value, char *string, int radix)
#endif /* !ACE_HAS_ITOA */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::itoa (int value, wchar_t *string, int radix)
{
@@ -178,7 +188,6 @@ ACE_OS::itoa (int value, wchar_t *string, int radix)
return ::_itow (value, string, radix);
#endif /* ACE_LACKS_ITOW */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE ACE_HANDLE
ACE_OS::mkstemp (char *s)
@@ -186,54 +195,56 @@ ACE_OS::mkstemp (char *s)
#if !defined (ACE_LACKS_MKSTEMP)
return ::mkstemp (s);
#else
- return ACE_OS::mkstemp_emulation (ACE_TEXT_CHAR_TO_TCHAR (s));
+ return ACE_OS::mkstemp_emulation (ACE_TEXT_TO_TCHAR_INOUT (s) );
#endif /* !ACE_LACKS_MKSTEMP */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE ACE_HANDLE
ACE_OS::mkstemp (wchar_t *s)
{
+ s[0] = 0;
# if !defined (ACE_LACKS_MKSTEMP)
- return ::mkstemp (ACE_TEXT_WCHAR_TO_TCHAR (ACE_TEXT_ALWAYS_CHAR (s)));
+ ACE::String_Conversion::Convert_InOut<char, wchar_t> convert( s, PATH_MAX );
+ return ::mkstemp (convert.c_str());
# else
- return ACE_OS::mkstemp_emulation (ACE_TEXT_WCHAR_TO_TCHAR (s));
+ ACE::String_Conversion::Convert_InOut<ACE_TCHAR, ACE_ANTI_TCHAR> convert( s, PATH_MAX );
+ return ACE_OS::mkstemp_emulation (convert.c_str());
# endif /* !ACE_LACKS_MKSTEMP */
}
-#endif /* ACE_HAS_WCHAR */
-#if !defined (ACE_LACKS_MKTEMP)
+
ACE_INLINE char *
ACE_OS::mktemp (char *s)
{
# if defined (ACE_WIN32)
return ::_mktemp (s);
-# else /* ACE_WIN32 */
+# elif !defined (ACE_LACKS_MKTEMP)
return ::mktemp (s);
-# endif /* ACE_WIN32 */
+# else
+ ACE_UNUSED_ARG( s );
+ ACE_NOTSUP_RETURN (0);
+# endif
}
-# if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::mktemp (wchar_t *s)
{
-# if defined (ACE_WIN32)
+#if defined (ACE_LACKS_MKTEMP)
+ ACE_UNUSED_ARG( s );
+ ACE_NOTSUP_RETURN (0);
+#elif defined (ACE_WIN32)
return ::_wmktemp (s);
-# else
+#else
// For narrow-char filesystems, we must convert the wide-char input to
// a narrow-char string for mktemp(), then convert the name back to
// wide-char for the caller.
- ACE_Wide_To_Ascii narrow_s (s);
- if (::mktemp (narrow_s.char_rep ()) == 0)
+ s[0] = 0;
+ ACE::String_Conversion::Convert_InOut<char, wchar_t> convert( s, PATH_MAX );
+ if (::mktemp (convert.c_str()) == 0)
return 0;
- ACE_Ascii_To_Wide wide_s (narrow_s.char_rep ());
- ACE_OS::strcpy (s, wide_s.wchar_rep ());
return s;
-# endif
+#endif
}
-# endif /* ACE_HAS_WCHAR */
-
-#endif /* !ACE_LACKS_MKTEMP */
#if defined(INTEGRITY)
extern "C" {
@@ -257,7 +268,7 @@ ACE_OS::putenv (const char *string)
#endif /* ACE_HAS_WINCE */
}
-#if defined (ACE_HAS_WCHAR) && defined (ACE_WIN32)
+#if defined (ACE_WIN32)
ACE_INLINE int
ACE_OS::putenv (const wchar_t *string)
{
@@ -270,7 +281,7 @@ ACE_OS::putenv (const wchar_t *string)
ACE_OSCALL_RETURN (::_wputenv (string), int, -1);
#endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR && ACE_WIN32 */
+#endif /* ACE_WIN32 */
ACE_INLINE void
ACE_OS::qsort (void *base,
@@ -357,7 +368,6 @@ ACE_OS::realpath (const char *file_name,
}
# endif /* !ACE_LACKS_REALPATH */
-# if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::realpath (const wchar_t *file_name,
wchar_t *resolved_name)
@@ -365,18 +375,15 @@ ACE_OS::realpath (const wchar_t *file_name,
# if defined (ACE_WIN32)
return ::_wfullpath (resolved_name, file_name, PATH_MAX);
# else /* ACE_WIN32 */
- ACE_Wide_To_Ascii n_file_name (file_name);
char n_resolved[PATH_MAX];
- if (0 != ACE_OS::realpath (n_file_name.char_rep (), n_resolved))
+ if (0 != ACE_OS::realpath ( ACE_TEXT_TO_CHAR_IN (file_name), n_resolved))
{
- ACE_Ascii_To_Wide w_resolved (n_resolved);
- ACE_OS::strcpy (resolved_name, w_resolved.wchar_rep ());
+ ACE_OS::string_copy (resolved_name, n_resolved, PATH_MAX);
return resolved_name;
}
return 0;
# endif /* ! ACE_WIN32 */
}
-# endif /* ACE_HAS_WCHAR */
#endif /* ACE_HAS_WINCE */
ACE_INLINE ACE_EXIT_HOOK
@@ -419,8 +426,8 @@ ACE_OS::strenvdup (const ACE_TCHAR *str)
# else
// Use char * for environment on non-Windows.
char *temp = 0;
- if ((temp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&str[1]))) != 0)
- return ACE_OS::strdup (ACE_TEXT_CHAR_TO_TCHAR (temp));
+ if ((temp = ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN(&str[1]))) != 0)
+ return ACE_OS::strdup (ACE_TEXT_TO_TCHAR_IN (temp));
# endif /* ACE_WIN32 */
return ACE_OS::strdup (str);
}
@@ -437,13 +444,16 @@ ACE_OS::strtod (const char *s, char **endptr)
}
#endif /* !ACE_LACKS_STRTOD */
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOD)
ACE_INLINE double
ACE_OS::strtod (const wchar_t *s, wchar_t **endptr)
{
- return ACE_WCHAR_STD_NAMESPACE::wcstod (s, endptr);
+ #if !defined (ACE_LACKS_WCSTOD)
+ return ACE_WCHAR_STD_NAMESPACE::wcstod (s, endptr);
+ #else
+ ACE_UNUSED_ARG( s );
+ ACE_NOTSUP_RETURN (0);
+ #endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOD */
ACE_INLINE long
ACE_OS::strtol (const char *s, char **ptr, int base)
@@ -455,13 +465,18 @@ ACE_OS::strtol (const char *s, char **ptr, int base)
#endif /* ACE_LACKS_STRTOL */
}
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL)
ACE_INLINE long
ACE_OS::strtol (const wchar_t *s, wchar_t **ptr, int base)
{
+#if !defined (ACE_LACKS_WCSTOL)
return ACE_WCHAR_STD_NAMESPACE::wcstol (s, ptr, base);
+#else
+ ACE_UNUSED_ARG( s );
+ ACE_UNUSED_ARG( ptr );
+ ACE_UNUSED_ARG( base );
+ ACE_NOTSUP_RETURN (0);
+#endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */
ACE_INLINE unsigned long
ACE_OS::strtoul (const char *s, char **ptr, int base)
@@ -473,13 +488,18 @@ ACE_OS::strtoul (const char *s, char **ptr, int base)
#endif /* ACE_LACKS_STRTOUL */
}
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL)
ACE_INLINE unsigned long
ACE_OS::strtoul (const wchar_t *s, wchar_t **ptr, int base)
{
+#if !defined (ACE_LACKS_WCSTOUL)
return ACE_WCHAR_STD_NAMESPACE::wcstoul (s, ptr, base);
+#else
+ ACE_UNUSED_ARG( s );
+ ACE_UNUSED_ARG( ptr );
+ ACE_UNUSED_ARG( base );
+ ACE_NOTSUP_RETURN (0);
+#endif
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */
ACE_INLINE int
ACE_OS::system (const ACE_TCHAR *s)
@@ -493,7 +513,7 @@ ACE_OS::system (const ACE_TCHAR *s)
#elif defined(ACE_TANDEM_T1248_PTHREADS)
ACE_OSCALL_RETURN (::spt_system (s), int, -1);
#else
- ACE_OSCALL_RETURN (::system (ACE_TEXT_ALWAYS_CHAR (s)), int, -1);
+ ACE_OSCALL_RETURN (::system (ACE_TEXT_TO_CHAR_IN (s)), int, -1);
#endif /* ACE_LACKS_SYSTEM */
}
diff --git a/ace/OS_NS_string.cpp b/ace/OS_NS_string.cpp
index 098bc3ceae0..e0622063a52 100644
--- a/ace/OS_NS_string.cpp
+++ b/ace/OS_NS_string.cpp
@@ -12,9 +12,7 @@ ACE_RCSID (ace,
# include "ace/OS_NS_string.inl"
#endif /* ACE_HAS_INLINED_OS_CALLS */
-#if defined (ACE_HAS_WCHAR)
# include "ace/OS_NS_stdlib.h"
-#endif /* ACE_HAS_WCHAR */
#if !defined (ACE_LACKS_STRERROR)
# include "ace/OS_NS_stdio.h"
@@ -39,25 +37,24 @@ ACE_OS::memchr_emulation (const void *s, int c, size_t len)
}
#endif /*ACE_HAS_MEMCHR*/
-#if (defined (ACE_LACKS_STRDUP) && !defined (ACE_STRDUP_EQUIVALENT)) \
- || defined (ACE_HAS_STRDUP_EMULATION)
char *
-ACE_OS::strdup_emulation (const char *s)
+ACE_OS::strdup (const char *s)
{
+#if defined (ACE_HAS_STRDUP_EMULATION)
char *t = (char *) ACE_OS::malloc (ACE_OS::strlen (s) + 1);
if (t == 0)
return 0;
return ACE_OS::strcpy (t, s);
+#else
+ return ACE_STD_NAMESPACE::strdup (s);
+#endif /* ACE_HAS_STRDUP_EMULATION */
}
-#endif /* (ACE_LACKS_STRDUP && !ACE_STRDUP_EQUIVALENT) || ... */
-#if defined (ACE_HAS_WCHAR)
-#if (defined (ACE_LACKS_WCSDUP) && !defined (ACE_WCSDUP_EQUIVALENT)) \
- || defined (ACE_HAS_WCSDUP_EMULATION)
wchar_t *
-ACE_OS::strdup_emulation (const wchar_t *s)
+ACE_OS::strdup (const wchar_t *s)
{
+# if defined (ACE_LACKS_WCSDUP)
wchar_t *buffer =
(wchar_t *) ACE_OS::malloc ((ACE_OS::strlen (s) + 1)
* sizeof (wchar_t));
@@ -65,9 +62,16 @@ ACE_OS::strdup_emulation (const wchar_t *s)
return 0;
return ACE_OS::strcpy (buffer, s);
+# elif defined (ACE_WCSDUP_EQUIVALENT)
+ return ACE_WCSDUP_EQUIVALENT (s);
+# else /* ACE_LACKS_WCSDUP */
+# if defined (__MINGW32__)
+ return ::wcsdup (const_cast<wchar_t*> (s));
+# else /* __MINGW32__ */
+ return ::wcsdup (s);
+# endif /* __MINGW32__ */
+# endif /* ACE_LACKS_WCSDUP */
}
-#endif /* (ACE_LACKS_WCSDUP && !ACE_WCSDUP_EQUIVALENT) || ... */
-#endif /* ACE_HAS_WCHAR */
char *
ACE_OS::strecpy (char *s, const char *t)
@@ -81,7 +85,6 @@ ACE_OS::strecpy (char *s, const char *t)
return dscan;
}
-#if defined (ACE_HAS_WCHAR)
wchar_t *
ACE_OS::strecpy (wchar_t *s, const wchar_t *t)
{
@@ -93,7 +96,6 @@ ACE_OS::strecpy (wchar_t *s, const wchar_t *t)
return dscan;
}
-#endif /* ACE_HAS_WCHAR */
char *
ACE_OS::strerror (int errnum)
@@ -103,9 +105,7 @@ ACE_OS::strerror (int errnum)
if (ACE::is_sock_error (errnum))
{
const ACE_TCHAR *errortext = ACE::sock_error (errnum);
- ACE_OS::strncpy (ret_errortext,
- ACE_TEXT_ALWAYS_CHAR (errortext),
- sizeof (ret_errortext));
+ ACE_OS::string_copy (ret_errortext, errortext, sizeof (ret_errortext));
return ret_errortext;
}
#if defined (ACE_LACKS_STRERROR)
@@ -158,11 +158,11 @@ ACE_OS::strnchr (const char *s, int c, size_t len)
return 0;
}
-const ACE_WCHAR_T *
-ACE_OS::strnchr (const ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
+const wchar_t *
+ACE_OS::strnchr (const wchar_t *s, wint_t c, size_t len)
{
for (size_t i = 0; i < len; ++i)
- if (s[i] == c)
+ if (s[i] == static_cast<wchar_t> (c))
return s + i;
return 0;
@@ -191,8 +191,8 @@ ACE_OS::strnstr (const char *s1, const char *s2, size_t len2)
return 0;
}
-const ACE_WCHAR_T *
-ACE_OS::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2)
+const wchar_t *
+ACE_OS::strnstr (const wchar_t *s1, const wchar_t *s2, size_t len2)
{
// Substring length
const size_t len1 = ACE_OS::strlen (s1);
@@ -206,7 +206,7 @@ ACE_OS::strnstr (const ACE_WCHAR_T *s1, const ACE_WCHAR_T *s2, size_t len2)
for (size_t i = 0; i <= len; i++)
{
- if (ACE_OS::memcmp (s1 + i, s2, len2 * sizeof (ACE_WCHAR_T)) == 0)
+ if (ACE_OS::memcmp (s1 + i, s2, len2 * sizeof (wchar_t)) == 0)
// Found a match! Return the index.
return s1 + i;
}
@@ -318,11 +318,11 @@ ACE_OS::strsncpy (char *dst, const char *src, size_t maxlen)
return dst;
}
-ACE_WCHAR_T *
-ACE_OS::strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen)
+wchar_t *
+ACE_OS::strsncpy (wchar_t *dst, const wchar_t *src, size_t maxlen)
{
- register ACE_WCHAR_T *rdst = dst;
- register const ACE_WCHAR_T *rsrc = src;
+ register wchar_t *rdst = dst;
+ register const wchar_t *rsrc = src;
register size_t rmaxlen = maxlen;
if (rmaxlen > 0)
@@ -384,11 +384,11 @@ ACE_OS::strtok_r_emulation (char *s, const char *tokens, char **lasts)
}
#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */
-# if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOK)
+# if defined (ACE_LACKS_WCSTOK)
wchar_t*
-ACE_OS::strtok_r_emulation (ACE_WCHAR_T *s,
- const ACE_WCHAR_T *tokens,
- ACE_WCHAR_T **lasts)
+ACE_OS::strtok_r_emulation (wchar_t *s,
+ const wchar_t *tokens,
+ wchar_t **lasts)
{
if (s == 0)
s = *lasts;
@@ -407,6 +407,7 @@ ACE_OS::strtok_r_emulation (ACE_WCHAR_T *s,
*lasts = s + l_sub;
return s ;
}
-# endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOK */
+# endif /* ACE_LACKS_WCSTOK */
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_string.h b/ace/OS_NS_string.h
index 5e4da3db673..8751b39b89a 100644
--- a/ace/OS_NS_string.h
+++ b/ace/OS_NS_string.h
@@ -24,9 +24,6 @@
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Basic_Types.h" // to get ACE_WCHAR_T,
- // should be in os_stddef.h or not used like this.
#include "ace/ACE_export.h"
#if defined (ACE_EXPORT_MACRO)
@@ -91,97 +88,74 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
char *strcat (char *s, const char *t);
-#if defined (ACE_HAS_WCHAR)
/// Appends a string to another string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strcat (wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
/// Finds the first occurance of a character in a string (const char
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const char *strchr (const char *s, int c);
-#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a character in a string (const wchar_t
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
+
const wchar_t *strchr (const wchar_t *s, wchar_t c);
-#endif /* ACE_HAS_WCHAR */
/// Finds the first occurance of a character in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strchr (char *s, int c);
-#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a character in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
- wchar_t *strchr (wchar_t *s, wchar_t c);
-#endif /* ACE_HAS_WCHAR */
-
- /// Compares two strings (char version).
- ACE_NAMESPACE_INLINE_FUNCTION
- int strcmp (const char *s, const char *t);
- /// Compares two strings (wchar_t version).
- ACE_NAMESPACE_INLINE_FUNCTION
- int strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t);
+ wchar_t *strchr (wchar_t *s, wchar_t c);
/// Copies a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strcpy (char *s, const char *t);
-#if defined (ACE_HAS_WCHAR)
/// Copies a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strcpy (wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
/// Searches for the first substring without any of the specified
/// characters and returns the size of the substring (char version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strcspn (const char *s, const char *reject);
-#if defined (ACE_HAS_WCHAR)
/// Searches for the first substring without any of the specified
/// characters and returns the size of the substring (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strcspn (const wchar_t *s, const wchar_t *reject);
-#endif /* ACE_HAS_WCHAR */
/// Returns a malloced duplicated string (char version).
- ACE_NAMESPACE_INLINE_FUNCTION
- char *strdup (const char *s);
-
-#if (defined (ACE_LACKS_STRDUP) && !defined(ACE_STRDUP_EQUIVALENT)) \
- || defined (ACE_HAS_STRDUP_EMULATION)
+ //ACE_NAMESPACE_INLINE_FUNCTION
extern ACE_Export
- char *strdup_emulation (const char *s);
-#endif
+ char *strdup (const char *s);
+ /*
+ #if (defined (ACE_LACKS_STRDUP) && !defined(ACE_STRDUP_EQUIVALENT)) \
+ || defined (ACE_HAS_STRDUP_EMULATION)
+ extern ACE_Export
+ char *strdup_emulation (const char *s);
+ #endif
+ */
-#if defined (ACE_HAS_WCHAR)
/// Returns a malloced duplicated string (wchar_t version).
- ACE_NAMESPACE_INLINE_FUNCTION
- wchar_t *strdup (const wchar_t *s);
-
-#if (defined (ACE_LACKS_WCSDUP) && !defined(ACE_WCSDUP_EQUIVALENT)) \
- || defined (ACE_HAS_WCSDUP_EMULATION)
+ //ACE_NAMESPACE_INLINE_FUNCTION
extern ACE_Export
- wchar_t *strdup_emulation (const wchar_t *s);
-#endif
-#endif /* ACE_HAS_WCHAR */
+ wchar_t *strdup (const wchar_t *s);
/// Copies a string, but returns a pointer to the end of the
/// copied region (char version).
extern ACE_Export
char *strecpy (char *des, const char *src);
-#if defined (ACE_HAS_WCHAR)
/// Copies a string, but returns a pointer to the end of the
/// copied region (wchar_t version).
extern ACE_Export
wchar_t *strecpy (wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
/*
** Returns a system error message. If the supplied errnum is out of range,
@@ -197,39 +171,33 @@ namespace ACE_OS {
char *strerror_emulation (int errnum);
#endif /* ACE_LACKS_STRERROR */
- /// Finds the length of a string (char version).
- ACE_NAMESPACE_INLINE_FUNCTION
- size_t strlen (const char *s);
-
- /// Finds the length of a string (ACE_WCHAR_T version).
- ACE_NAMESPACE_INLINE_FUNCTION
- size_t strlen (const ACE_WCHAR_T *s);
-
/// Appends part of a string to another string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strncat (char *s, const char *t, size_t len);
/// Appends part of a string to another string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
- ACE_WCHAR_T *strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+ wchar_t *strncat (wchar_t *s, const wchar_t *t, size_t len);
/// Finds the first occurance of a character in an array (const char
/// version).
extern ACE_Export
const char *strnchr (const char *s, int c, size_t len);
- /// Finds the first occurance of a character in an array (const ACE_WCHAR_T
+ /// Finds the first occurance of a character in an array (const wchar_t
/// version).
extern ACE_Export
- const ACE_WCHAR_T *strnchr (const ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len);
+
+ const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len);
/// Finds the first occurance of a character in an array (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strnchr (char *s, int c, size_t len);
- /// Finds the first occurance of a character in an array (ACE_WCHAR_T version).
+ /// Finds the first occurance of a character in an array (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
- ACE_WCHAR_T *strnchr (ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len);
+
+ wchar_t *strnchr (wchar_t *s, wint_t c, size_t len);
/// Compares two arrays (char version).
ACE_NAMESPACE_INLINE_FUNCTION
@@ -237,15 +205,7 @@ namespace ACE_OS {
/// Compares two arrays (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
- int strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
-
- /// Copies an array (char version)
- ACE_NAMESPACE_INLINE_FUNCTION
- char *strncpy (char *s, const char *t, size_t len);
-
- /// Copies an array (ACE_WCHAR_T version)
- ACE_NAMESPACE_INLINE_FUNCTION
- ACE_WCHAR_T *strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+ int strncmp (const wchar_t *s, const wchar_t *t, size_t len);
/// Finds the length of a limited-length string (char version).
/**
@@ -259,7 +219,7 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
size_t strnlen (const char *s, size_t maxlen);
- /// Finds the length of a limited-length string (ACE_WCHAR_T version).
+ /// Finds the length of a limited-length string (wchar_t version).
/**
* @param s The character string to find the length of.
* @param maxlen The maximum number of characters that will be
@@ -269,7 +229,7 @@ namespace ACE_OS {
* is located, else @arg maxlen.
*/
ACE_NAMESPACE_INLINE_FUNCTION
- size_t strnlen (const ACE_WCHAR_T *s, size_t maxlen);
+ size_t strnlen (const wchar_t *s, size_t maxlen);
/// Finds the first occurance of a substring in an array (const char
/// version).
@@ -279,8 +239,8 @@ namespace ACE_OS {
/// Finds the first occurance of a substring in an array (const wchar_t
/// version).
extern ACE_Export
- const ACE_WCHAR_T *strnstr (const ACE_WCHAR_T *s,
- const ACE_WCHAR_T *t,
+ const wchar_t *strnstr (const wchar_t *s,
+ const wchar_t *t,
size_t len);
/// Finds the first occurance of a substring in an array (char version).
@@ -289,27 +249,23 @@ namespace ACE_OS {
/// Finds the first occurance of a substring in an array (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
- ACE_WCHAR_T *strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len);
+ wchar_t *strnstr (wchar_t *s, const wchar_t *t, size_t len);
/// Searches for characters in a string (const char version).
ACE_NAMESPACE_INLINE_FUNCTION
const char *strpbrk (const char *s1, const char *s2);
-#if defined (ACE_HAS_WCHAR)
/// Searches for characters in a string (const wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t *strpbrk (const wchar_t *s1, const wchar_t *s2);
-#endif /* ACE_HAS_WCHAR */
/// Searches for characters in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strpbrk (char *s1, const char *s2);
-#if defined (ACE_HAS_WCHAR)
/// Searches for characters in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strpbrk (wchar_t *s1, const wchar_t *s2);
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_STRPBRK)
/// Emulated strpbrk - Searches for characters in a string.
@@ -323,22 +279,20 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
const char *strrchr (const char *s, int c);
-#if defined (ACE_HAS_WCHAR)
/// Finds the last occurance of a character in a string (const wchar_t
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
+
const wchar_t *strrchr (const wchar_t *s, wchar_t c);
-#endif /* ACE_HAS_WCHAR */
/// Finds the last occurance of a character in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strrchr (char *s, int c);
-#if defined (ACE_HAS_WCHAR)
/// Finds the last occurance of a character in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
+
wchar_t *strrchr (wchar_t *s, wchar_t c);
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_STRRCHR)
/// Emulated strrchr (char version) - Finds the last occurance of a
@@ -390,8 +344,8 @@ namespace ACE_OS {
* strncpy() is needed.
*/
extern ACE_Export
- ACE_WCHAR_T *strsncpy (ACE_WCHAR_T *dst,
- const ACE_WCHAR_T *src,
+ wchar_t *strsncpy (wchar_t *dst,
+ const wchar_t *src,
size_t maxlen);
/// Searches for the first substring containing only the specified
@@ -399,12 +353,10 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
size_t strspn (const char *s1, const char *s2);
-#if defined (ACE_HAS_WCHAR)
/// Searches for the first substring containing only the specified
/// characters and returns the size of the substring (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
size_t strspn (const wchar_t *s1, const wchar_t *s2);
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_STRSPN)
/// Emulated wcsspn.
@@ -418,32 +370,26 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
const char *strstr (const char *s, const char *t);
-#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a substring in a string (const wchar_t
/// version).
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t *strstr (const wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
/// Finds the first occurance of a substring in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strstr (char *s, const char *t);
-#if defined (ACE_HAS_WCHAR)
/// Finds the first occurance of a substring in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strstr (wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
/// Finds the next token in a string (char version).
ACE_NAMESPACE_INLINE_FUNCTION
char *strtok (char *s, const char *tokens);
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOK)
/// Finds the next token in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *strtok (wchar_t *s, const wchar_t *tokens);
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOK */
//@}
@@ -451,11 +397,9 @@ namespace ACE_OS {
ACE_NAMESPACE_INLINE_FUNCTION
char *strtok_r (char *s, const char *tokens, char **lasts);
-#if defined (ACE_HAS_WCHAR)
/// Finds the next token in a string (wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
- wchar_t *strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts);
-#endif // ACE_HAS_WCHAR
+ wchar_t *strtok_r (wchar_t *s, const wchar_t *tokens, wchar_t **lasts);
#if !defined (ACE_HAS_REENTRANT_FUNCTIONS)
/// Emulated strtok_r.
@@ -463,14 +407,15 @@ namespace ACE_OS {
char *strtok_r_emulation (char *s, const char *tokens, char **lasts);
#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */
-# if defined (ACE_HAS_WCHAR) && defined(ACE_LACKS_WCSTOK)
+# if defined(ACE_LACKS_WCSTOK)
/// Emulated strtok_r (wchar_t version).
extern ACE_Export
- wchar_t *strtok_r_emulation (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts);
-# endif // ACE_HAS_WCHAR && ACE_LACKS_WCSTOK
+ wchar_t *strtok_r_emulation (wchar_t *s, const wchar_t *tokens, wchar_t **lasts);
+# endif // ACE_LACKS_WCSTOK
} /* namespace ACE_OS */
+
ACE_END_VERSIONED_NAMESPACE_DECL
# if defined (ACE_HAS_INLINED_OSCALLS)
diff --git a/ace/OS_NS_string.inl b/ace/OS_NS_string.inl
index 38e42378157..557dd7e0d27 100644
--- a/ace/OS_NS_string.inl
+++ b/ace/OS_NS_string.inl
@@ -61,7 +61,6 @@ ACE_OS::strcat (char *s, const char *t)
return ::strcat (s, t);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strcat (wchar_t *s, const wchar_t *t)
{
@@ -71,7 +70,6 @@ ACE_OS::strcat (wchar_t *s, const wchar_t *t)
return ::wcscat (s, t);
# endif /* ACE_LACKS_WCSCAT */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE const char *
ACE_OS::strchr (const char *s, int c)
@@ -83,7 +81,6 @@ ACE_OS::strchr (const char *s, int c)
#endif /* ACE_LACKS_STRCHR */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strchr (const wchar_t *s, wchar_t c)
{
@@ -93,7 +90,6 @@ ACE_OS::strchr (const wchar_t *s, wchar_t c)
return ::wcschr (s, c);
# endif /* ACE_LACKS_WCSCHR */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS::strchr (char *s, int c)
@@ -101,7 +97,6 @@ ACE_OS::strchr (char *s, int c)
return ::strchr (s, c);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strchr (wchar_t *s, wchar_t c)
{
@@ -109,23 +104,6 @@ ACE_OS::strchr (wchar_t *s, wchar_t c)
const_cast<wchar_t *> (ACE_OS::strchr (const_cast<const wchar_t *> (s),
c));
}
-#endif /* ACE_HAS_WCHAR */
-
-ACE_INLINE int
-ACE_OS::strcmp (const char *s, const char *t)
-{
- return ::strcmp (s, t);
-}
-
-ACE_INLINE int
-ACE_OS::strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t)
-{
-# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
- return ACE_OS::wcscmp_emulation (s, t);
-# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
- return ::wcscmp (s, t);
-# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
-}
ACE_INLINE char *
ACE_OS::strcpy (char *s, const char *t)
@@ -133,7 +111,6 @@ ACE_OS::strcpy (char *s, const char *t)
return ::strcpy (s, t);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strcpy (wchar_t *s, const wchar_t *t)
{
@@ -143,7 +120,6 @@ ACE_OS::strcpy (wchar_t *s, const wchar_t *t)
return ::wcscpy (s, t);
# endif /* ACE_LACKS_WCSCPY */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE size_t
ACE_OS::strcspn (const char *s, const char *reject)
@@ -151,7 +127,6 @@ ACE_OS::strcspn (const char *s, const char *reject)
return ::strcspn (s, reject);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE size_t
ACE_OS::strcspn (const wchar_t *s, const wchar_t *reject)
{
@@ -161,55 +136,6 @@ ACE_OS::strcspn (const wchar_t *s, const wchar_t *reject)
return ::wcscspn (s, reject);
# endif /* ACE_LACKS_WCSCSPN */
}
-#endif /* ACE_HAS_WCHAR */
-
-ACE_INLINE char *
-ACE_OS::strdup (const char *s)
-{
-# if (defined (ACE_LACKS_STRDUP) && !defined(ACE_STRDUP_EQUIVALENT)) \
- || defined (ACE_HAS_STRDUP_EMULATION)
- return ACE_OS::strdup_emulation (s);
-# elif defined (ACE_STRDUP_EQUIVALENT)
- return ACE_STRDUP_EQUIVALENT (s);
-# elif defined (ACE_HAS_NONCONST_STRDUP)
- return ::strdup (const_cast<char *> (s));
-#else
- return ::strdup (s);
-# endif /* (ACE_LACKS_STRDUP && !ACE_STRDUP_EQUIVALENT) || ... */
-}
-
-#if defined (ACE_HAS_WCHAR)
-ACE_INLINE wchar_t *
-ACE_OS::strdup (const wchar_t *s)
-{
-# if (defined (ACE_LACKS_WCSDUP) && !defined (ACE_WCSDUP_EQUIVALENT)) \
- || defined (ACE_HAS_WCSDUMP_EMULATION)
- return ACE_OS::strdup_emulation (s);
-# elif defined (ACE_WCSDUP_EQUIVALENT)
- return ACE_WCSDUP_EQUIVALENT (s);
-# elif defined (ACE_HAS_NONCONST_WCSDUP)
- return ::wcsdup (const_cast<wchar_t*> (s));
-# else
- return ::wcsdup (s);
-# endif /* (ACE_LACKS_WCSDUP && !ACE_WCSDUP_EQUIVALENT) || ... */
-}
-#endif /* ACE_HAS_WCHAR */
-
-ACE_INLINE size_t
-ACE_OS::strlen (const char *s)
-{
- return ::strlen (s);
-}
-
-ACE_INLINE size_t
-ACE_OS::strlen (const ACE_WCHAR_T *s)
-{
-# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
- return ACE_OS::wcslen_emulation (s);
-# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
- return ::wcslen (s);
-# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
-}
ACE_INLINE char *
ACE_OS::strncat (char *s, const char *t, size_t len)
@@ -217,14 +143,14 @@ ACE_OS::strncat (char *s, const char *t, size_t len)
return ::strncat (s, t, len);
}
-ACE_INLINE ACE_WCHAR_T *
-ACE_OS::strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
+ACE_INLINE wchar_t *
+ACE_OS::strncat (wchar_t *s, const wchar_t *t, size_t len)
{
-# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT)
+# if defined (ACE_LACKS_WCSNCAT)
return ACE_OS::wcsncat_emulation (s, t, len);
-# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */
+# else /* ACE_LACKS_WCSNCAT */
return ::wcsncat (s, t, len);
-# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */
+# endif /* ACE_LACKS_WCSNCAT */
}
ACE_INLINE char *
@@ -240,12 +166,12 @@ ACE_OS::strnchr (char *s, int c, size_t len)
#endif
}
-ACE_INLINE ACE_WCHAR_T *
-ACE_OS::strnchr (ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
+ACE_INLINE wchar_t *
+ACE_OS::strnchr (wchar_t *s, wint_t c, size_t len)
{
return
- const_cast<ACE_WCHAR_T *> (ACE_OS::strnchr (
- const_cast<const ACE_WCHAR_T *> (s),
+ const_cast<wchar_t *> (ACE_OS::strnchr (
+ static_cast<const wchar_t *> (s),
c,
len));
}
@@ -257,29 +183,13 @@ ACE_OS::strncmp (const char *s, const char *t, size_t len)
}
ACE_INLINE int
-ACE_OS::strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
+ACE_OS::strncmp (const wchar_t *s, const wchar_t *t, size_t len)
{
-# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
+# if defined (ACE_LACKS_WCSNCMP)
return ACE_OS::wcsncmp_emulation (s, t, len);
-# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
+# else /* ACE_LACKS_WCSNCMP */
return ::wcsncmp (s, t, len);
-# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
-}
-
-ACE_INLINE char *
-ACE_OS::strncpy (char *s, const char *t, size_t len)
-{
- return ::strncpy (s, t, len);
-}
-
-ACE_INLINE ACE_WCHAR_T *
-ACE_OS::strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
-{
-# if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
- return ACE_OS::wcsncpy_emulation (s, t, len);
-# else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
- return ::wcsncpy (s, t, len);
-# endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
+# endif /* ACE_LACKS_WCSNCMP */
}
ACE_INLINE size_t
@@ -297,9 +207,9 @@ ACE_OS::strnlen (const char *s, size_t maxlen)
}
ACE_INLINE size_t
-ACE_OS::strnlen (const ACE_WCHAR_T *s, size_t maxlen)
+ACE_OS::strnlen (const wchar_t *s, size_t maxlen)
{
-#if defined (ACE_HAS_WCHAR) && defined (ACE_HAS_WCSNLEN)
+#if defined (ACE_HAS_WCSNLEN)
return wcsnlen (s, maxlen);
#else /* ACE_HAS_WCSNLEN */
size_t i;
@@ -321,12 +231,12 @@ ACE_OS::strnstr (char *s, const char *t, size_t len)
#endif
}
-ACE_INLINE ACE_WCHAR_T *
-ACE_OS::strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
+ACE_INLINE wchar_t *
+ACE_OS::strnstr (wchar_t *s, const wchar_t *t, size_t len)
{
return
- const_cast<ACE_WCHAR_T *> (ACE_OS::strnstr (
- static_cast<const ACE_WCHAR_T *> (s),
+ const_cast<wchar_t *> (ACE_OS::strnstr (
+ static_cast<const wchar_t *> (s),
t,
len));
}
@@ -341,7 +251,6 @@ ACE_OS::strpbrk (const char *s1, const char *s2)
#endif /* ACE_LACKS_STRPBRK */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strpbrk (const wchar_t *s, const wchar_t *t)
{
@@ -351,7 +260,6 @@ ACE_OS::strpbrk (const wchar_t *s, const wchar_t *t)
return ::wcspbrk (s, t);
# endif /* ACE_LACKS_WCSPBRK */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS::strpbrk (char *s1, const char *s2)
@@ -363,14 +271,12 @@ ACE_OS::strpbrk (char *s1, const char *s2)
#endif /* ACE_LACKS_STRPBRK */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strpbrk (wchar_t *s, const wchar_t *t)
{
return const_cast<wchar_t *> (ACE_OS::strpbrk (
const_cast<const wchar_t *> (s), t));
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE const char *
ACE_OS::strrchr (const char *s, int c)
@@ -382,7 +288,6 @@ ACE_OS::strrchr (const char *s, int c)
#endif /* ! ACE_LACKS_STRRCHR */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strrchr (const wchar_t *s, wchar_t c)
{
@@ -392,7 +297,6 @@ ACE_OS::strrchr (const wchar_t *s, wchar_t c)
return const_cast <const wchar_t *> (::wcsrchr (s, c));
#endif /* ! ACE_LACKS_WCSRCHR */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS::strrchr (char *s, int c)
@@ -404,14 +308,12 @@ ACE_OS::strrchr (char *s, int c)
#endif /* ! ACE_LACKS_STRRCHR */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strrchr (wchar_t *s, wchar_t c)
{
return const_cast<wchar_t *> (ACE_OS::strrchr (
const_cast<const wchar_t *> (s), c));
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE size_t
ACE_OS::strspn (const char *s, const char *t)
@@ -423,7 +325,6 @@ ACE_OS::strspn (const char *s, const char *t)
#endif /* ACE_LACKS_STRSPN */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE size_t
ACE_OS::strspn (const wchar_t *s, const wchar_t *t)
{
@@ -433,7 +334,6 @@ ACE_OS::strspn (const wchar_t *s, const wchar_t *t)
return ::wcsspn (s, t);
# endif /* ACE_LACKS_WCSSPN */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE const char *
ACE_OS::strstr (const char *s, const char *t)
@@ -441,7 +341,6 @@ ACE_OS::strstr (const char *s, const char *t)
return (const char *) ::strstr (s, t);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE const wchar_t *
ACE_OS::strstr (const wchar_t *s, const wchar_t *t)
{
@@ -453,7 +352,6 @@ ACE_OS::strstr (const wchar_t *s, const wchar_t *t)
return const_cast <const wchar_t *> (::wcsstr (s, t));
# endif /* ACE_LACKS_WCSSTR */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS::strstr (char *s, const char *t)
@@ -461,7 +359,6 @@ ACE_OS::strstr (char *s, const char *t)
return ::strstr (s, t);
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::strstr (wchar_t *s, const wchar_t *t)
{
@@ -473,7 +370,6 @@ ACE_OS::strstr (wchar_t *s, const wchar_t *t)
return ::wcsstr (s, t);
# endif /* ACE_LACKS_WCSSTR */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE char *
ACE_OS::strtok (char *s, const char *tokens)
@@ -481,18 +377,20 @@ ACE_OS::strtok (char *s, const char *tokens)
return ::strtok (s, tokens);
}
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOK)
ACE_INLINE wchar_t *
ACE_OS::strtok (wchar_t *s, const wchar_t *tokens)
{
#if defined (ACE_HAS_3_PARAM_WCSTOK)
static wchar_t *lasts;
return ::wcstok (s, tokens, &lasts);
-#else
+#elif !defined (ACE_LACKS_WCSTOK)
return ::wcstok (s, tokens);
+#else
+ ACE_UNUSED_ARG( s );
+ ACE_UNUSED_ARG( tokens );
+ ACE_NOTSUP_RETURN (0);
#endif /* ACE_HAS_3_PARAM_WCSTOK */
}
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOK */
ACE_INLINE char *
ACE_OS::strtok_r (char *s, const char *tokens, char **lasts)
@@ -504,9 +402,8 @@ ACE_OS::strtok_r (char *s, const char *tokens, char **lasts)
#endif /* (ACE_HAS_REENTRANT_FUNCTIONS) */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t*
-ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts)
+ACE_OS::strtok_r (wchar_t *s, const wchar_t *tokens, wchar_t **lasts)
{
#if defined (ACE_LACKS_WCSTOK)
return ACE_OS::strtok_r_emulation (s, tokens, lasts);
@@ -519,6 +416,6 @@ ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts
# endif /* ACE_HAS_3_PARAM_WCSTOK */
#endif /* ACE_LACKS_WCSTOK */
}
-#endif // ACE_HAS_WCHAR
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_strings.h b/ace/OS_NS_strings.h
index 70d8e17cf5b..e834afac831 100644
--- a/ace/OS_NS_strings.h
+++ b/ace/OS_NS_strings.h
@@ -44,21 +44,17 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int strcasecmp (const char *s, const char *t);
-#if defined (ACE_HAS_WCHAR)
/// Compares two strings (case insensitive const wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
int strcasecmp (const wchar_t *s, const wchar_t *t);
-#endif /* ACE_HAS_WCHAR */
/// Compares two arrays (case insensitive const char version).
ACE_NAMESPACE_INLINE_FUNCTION
int strncasecmp (const char *s, const char *t, size_t len);
-#if defined (ACE_HAS_WCHAR)
/// Compares two arrays (case insensitive const wchar_t version).
ACE_NAMESPACE_INLINE_FUNCTION
int strncasecmp (const wchar_t *s, const wchar_t *t, size_t len);
-#endif /* ACE_HAS_WCHAR */
#if defined (ACE_LACKS_STRCASECMP)
/// Emulated strcasecmp - Performs a case insensitive comparison of strings.
diff --git a/ace/OS_NS_strings.inl b/ace/OS_NS_strings.inl
index 2b2012b2f38..4e5d0f40dc0 100644
--- a/ace/OS_NS_strings.inl
+++ b/ace/OS_NS_strings.inl
@@ -2,9 +2,7 @@
//
// $Id$
-#if defined (ACE_HAS_WCHAR)
# include "ace/OS_NS_wchar.h"
-#endif /* ACE_HAS_WCHAR */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -20,7 +18,6 @@ ACE_OS::strcasecmp (const char *s, const char *t)
#endif /* ACE_LACKS_STRCASECMP */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t)
{
@@ -30,7 +27,6 @@ ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t)
return ::_wcsicmp (s, t);
# endif /* ACE_LACKS_WCSICMP */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::strncasecmp (const char *s, const char *t, size_t len)
@@ -44,7 +40,6 @@ ACE_OS::strncasecmp (const char *s, const char *t, size_t len)
#endif /* ACE_LACKS_STRCASECMP */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len)
{
@@ -54,6 +49,5 @@ ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len)
return ::_wcsnicmp (s, t, len);
#endif /* ACE_LACKS_WCSNICMP */
}
-#endif /* ACE_HAS_WCHAR */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_sys_mman.inl b/ace/OS_NS_sys_mman.inl
index eb7449779fb..0379ca02468 100644
--- a/ace/OS_NS_sys_mman.inl
+++ b/ace/OS_NS_sys_mman.inl
@@ -308,9 +308,9 @@ ACE_OS::shm_open (const ACE_TCHAR *filename,
ACE_OS_TRACE ("ACE_OS::shm_open");
# if defined (ACE_HAS_SHM_OPEN)
ACE_UNUSED_ARG (sa);
- ACE_OSCALL_RETURN (::shm_open (ACE_TEXT_ALWAYS_CHAR(filename), mode, perms), ACE_HANDLE, ACE_INVALID_HANDLE);
+ ACE_OSCALL_RETURN (::shm_open (ACE_TEXT_TO_CHAR_IN(filename), mode, perms), ACE_HANDLE, ACE_INVALID_HANDLE);
# elif defined (ACE_OPENVMS)
- ACE_OSCALL_RETURN (::open (filename, mode, perms, ACE_TEXT("shr=get,put,upd")), ACE_HANDLE, ACE_INVALID_HANDLE);
+ ACE_OSCALL_RETURN (::open (filename, mode, perms, ACE_LIB_TEXT("shr=get,put,upd")), ACE_HANDLE, ACE_INVALID_HANDLE);
# else /* ! ACE_HAS_SHM_OPEN */
// Just use ::open.
return ACE_OS::open (filename, mode, perms, sa);
@@ -322,7 +322,7 @@ ACE_OS::shm_unlink (const ACE_TCHAR *path)
{
ACE_OS_TRACE ("ACE_OS::shm_unlink");
# if defined (ACE_HAS_SHM_OPEN)
- ACE_OSCALL_RETURN (::shm_unlink (ACE_TEXT_ALWAYS_CHAR(path)), int, -1);
+ ACE_OSCALL_RETURN (::shm_unlink (ACE_TEXT_TO_CHAR_IN(path)), int, -1);
# else /* ! ACE_HAS_SHM_OPEN */
// Just use ::unlink.
return ACE_OS::unlink (path);
diff --git a/ace/OS_NS_sys_stat.h b/ace/OS_NS_sys_stat.h
index 76f029245cc..dfae190203e 100644
--- a/ace/OS_NS_sys_stat.h
+++ b/ace/OS_NS_sys_stat.h
@@ -68,21 +68,17 @@ namespace ACE_OS
int lstat (const char *,
ACE_stat *);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int lstat (const wchar_t *,
ACE_stat *);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int mkdir (const char *path,
mode_t mode = ACE_DEFAULT_DIR_PERMS);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int mkdir (const wchar_t *path,
mode_t mode = ACE_DEFAULT_DIR_PERMS);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int mkfifo (const ACE_TCHAR *file,
@@ -91,10 +87,8 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int stat (const char *file, ACE_stat *);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int stat (const wchar_t *file, ACE_stat *);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
mode_t umask (mode_t cmask);
diff --git a/ace/OS_NS_sys_stat.inl b/ace/OS_NS_sys_stat.inl
index 448cfcd3246..6ae9a7a435d 100644
--- a/ace/OS_NS_sys_stat.inl
+++ b/ace/OS_NS_sys_stat.inl
@@ -27,7 +27,7 @@ namespace ACE_OS
ACE_UNUSED_ARG (mode);
ACE_NOTSUP_RETURN (-1);
#else
- ACE_OSCALL_RETURN (::creat (ACE_TEXT_ALWAYS_CHAR (filename), mode),
+ ACE_OSCALL_RETURN (::creat (ACE_TEXT_TO_CHAR_IN (filename), mode),
ACE_HANDLE, ACE_INVALID_HANDLE);
#endif /* ACE_WIN32 */
}
@@ -154,7 +154,6 @@ namespace ACE_OS
# endif /* ACE_LACKS_LSTAT */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
lstat (const wchar_t *file, ACE_stat *stp)
{
@@ -162,10 +161,9 @@ namespace ACE_OS
# if defined (ACE_LACKS_LSTAT)
return ACE_OS::stat (file, stp);
# else
- return ACE_OS::lstat (ACE_Wide_To_Ascii (file).char_rep (), stp);
+ return ACE_OS::lstat (ACE_TEXT_TO_CHAR_IN (file), stp);
# endif /* ACE_LACKS_LSTAT */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
mkdir (const char *path, mode_t mode)
@@ -214,7 +212,7 @@ namespace ACE_OS
ACE_OSCALL_RETURN (::_mkdir (const_cast <char *> (path)), int, -1);
#elif defined (ACE_HAS_WINCE)
ACE_UNUSED_ARG (mode);
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreateDirectory (ACE_TEXT_CHAR_TO_TCHAR (path), 0),
+ ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreateDirectory (ACE_TEXT_TO_TCHAR_IN (path), 0),
ace_result_),
int, -1);
#elif defined (ACE_MKDIR_LACKS_MODE)
@@ -225,8 +223,6 @@ namespace ACE_OS
#endif /* ACE_PSOS_LACKS_PHILE */
}
-#if defined (ACE_HAS_WCHAR)
-
ACE_INLINE int
mkdir (const wchar_t *path, mode_t mode)
{
@@ -239,12 +235,10 @@ namespace ACE_OS
ACE_UNUSED_ARG (mode);
ACE_OSCALL_RETURN (::_wmkdir (path), int, -1);
#else
- return ACE_OS::mkdir (ACE_Wide_To_Ascii (path).char_rep (), mode);
+ return ACE_OS::mkdir (ACE_TEXT_TO_CHAR_IN (path), mode);
#endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
-
ACE_INLINE int
mkfifo (const ACE_TCHAR *file, mode_t mode)
{
@@ -254,7 +248,7 @@ namespace ACE_OS
ACE_UNUSED_ARG (mode);
ACE_NOTSUP_RETURN (-1);
#else
- ACE_OSCALL_RETURN (::mkfifo (ACE_TEXT_ALWAYS_CHAR (file), mode), int, -1);
+ ACE_OSCALL_RETURN (::mkfifo (ACE_TEXT_TO_CHAR_IN (file), mode), int, -1);
#endif /* ACE_LACKS_MKFIFO */
}
@@ -275,7 +269,7 @@ namespace ACE_OS
HANDLE fhandle;
- fhandle = ::FindFirstFile (ACE_TEXT_CHAR_TO_TCHAR (file), &fdata);
+ fhandle = ::FindFirstFile (ACE_TEXT_TO_TCHAR_IN (file), &fdata);
if (fhandle == INVALID_HANDLE_VALUE)
{
ACE_OS::set_errno_to_last_error ();
@@ -309,7 +303,6 @@ namespace ACE_OS
#endif /* ACE_HAS_NONCONST_STAT */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
stat (const wchar_t *file, ACE_stat *stp)
{
@@ -343,11 +336,9 @@ namespace ACE_OS
#elif defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_wstat (file, (struct _stat *) stp), int, -1);
#else /* ACE_HAS_WINCE */
- ACE_Wide_To_Ascii nfile (file);
- return ACE_OS::stat (nfile.char_rep (), stp);
+ return ACE_OS::stat (ACE_TEXT_TO_CHAR_IN (file), stp);
#endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE mode_t
umask (mode_t cmask)
diff --git a/ace/OS_NS_time.inl b/ace/OS_NS_time.inl
index 99ca079478c..fbce238b080 100644
--- a/ace/OS_NS_time.inl
+++ b/ace/OS_NS_time.inl
@@ -7,6 +7,7 @@
#include "ace/Time_Value.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_time.h"
+//#include "ace/TSS_T.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -115,24 +116,31 @@ ACE_OS::ctime (const time_t *t)
#elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
ACE_OSCALL_RETURN (::_wctime (t), wchar_t *, 0);
#else
-# if defined (ACE_USES_WCHAR) /* Not Win32, else it would do the above */
+# if defined (ACE_USES_WCHAR) // Wide and not Win32
char *narrow_time;
ACE_OSCALL (::ctime (t), char *, 0, narrow_time);
if (narrow_time == 0)
return 0;
- // ACE_Ascii_To_Wide::convert allocates (via new []) a wchar_t[]. If
+ // ACE_TEXT_TO_MALLOC_WCHAR_OUT allocates (via malloc) a wchar_t[]. If
// we've done this before, free the previous one. Yes, this leaves a
// small memory leak (26 characters) but there's no way around this
// that I know of. (Steve Huston, 12-Feb-2003).
- static wchar_t *wide_time = 0;
- if (wide_time != 0)
- delete [] wide_time;
- wide_time = ACE_Ascii_To_Wide::convert (narrow_time);
+// Including ACE_TSS_T.h causes error!
+/*
+ wchar_t* init = 0;
+ static ACE_TSS< wchar_t* > wide_time (&init);
+ ACE::String_Conversion::Allocator_malloc<wchar_t>().free(*wide_time);
+ *wide_time.ts_object() = ACE_TEXT_TO_MALLOC_WCHAR_OUT (narrow_time);
+ return *wide_time;
+*/
+ static wchar_t* wide_time = 0;
+ ACE::String_Conversion::Allocator_malloc<wchar_t>().free(wide_time);
+ wide_time = ACE_TEXT_TO_MALLOC_WCHAR_OUT (narrow_time);
return wide_time;
# else
ACE_OSCALL_RETURN (::ctime (t), char *, 0);
-# endif /* ACE_USES_WCHAR */
-# endif /* ACE_HAS_BROKEN_CTIME */
+# endif // ACE_USES_WCHAR
+# endif // ACE_HAS_BROKEN_CTIME
}
#if !defined (ACE_HAS_WINCE) /* CE version in OS.cpp */
@@ -178,8 +186,7 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen)
return 0;
# if defined (ACE_USES_WCHAR)
- ACE_Ascii_To_Wide wide_buf (bufp);
- ACE_OS_String::strcpy (buf, wide_buf.wchar_rep ());
+ ACE_OS::string_copy (buf, bufp, buflen);
return buf;
# else
return bufp;
@@ -558,4 +565,5 @@ ACE_OS::tzset (void)
# endif /* ACE_HAS_WINCE && !VXWORKS && !ACE_PSOS && !__rtems__ && !ACE_HAS_DINKUM_STL */
}
+
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_unistd.cpp b/ace/OS_NS_unistd.cpp
index b39f0e527e3..3c3c2ecd823 100644
--- a/ace/OS_NS_unistd.cpp
+++ b/ace/OS_NS_unistd.cpp
@@ -54,7 +54,7 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv,
// Account for environment variables.
if (substitute_env_args && argv[i][0] == ACE_LIB_TEXT ('$'))
{
-# if defined (ACE_WIN32) || !defined (ACE_HAS_WCHAR)
+# if defined (ACE_WIN32)
ACE_TCHAR *temp = 0;
// Win32 is the only platform with a wide-char ACE_OS::getenv().
if ((temp = ACE_OS::getenv (&argv[i][1])) != 0)
@@ -62,17 +62,17 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv,
else
buf_len += ACE_OS::strlen (argv[i]);
# else
- // This is an ACE_HAS_WCHAR platform and not ACE_WIN32.
+ // This is not ACE_WIN32.
// Convert the env variable name for getenv(), then add
// the length of the returned char *string. Later, when we
// actually use the returned env variable value, convert it
// as well.
- char *ctemp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&argv[i][1]));
+ char *ctemp = ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (&argv[i][1]));
if (ctemp == 0)
buf_len += ACE_OS::strlen (argv[i]);
else
buf_len += ACE_OS::strlen (ctemp);
-# endif /* ACE_WIN32 || !ACE_HAS_WCHAR */
+# endif /* ACE_WIN32 */
}
else
#endif /* ACE_LACKS_ENV */
@@ -101,7 +101,7 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv,
// Account for environment variables.
if (substitute_env_args && argv[j][0] == ACE_LIB_TEXT ('$'))
{
-# if defined (ACE_WIN32) || !defined (ACE_HAS_WCHAR)
+# if defined (ACE_WIN32)
// Win32 is the only platform with a wide-char ACE_OS::getenv().
ACE_TCHAR *temp = ACE_OS::getenv (&argv[j][1]);
if (temp != 0)
@@ -109,15 +109,15 @@ ACE_OS::argv_to_string (ACE_TCHAR **argv,
else
end = ACE_OS::strecpy (end, argv[j]);
# else
- // This is an ACE_HAS_WCHAR platform and not ACE_WIN32.
+ // This is not ACE_WIN32.
// Convert the env variable name for getenv(), then convert
// the returned char *string back to wchar_t.
- char *ctemp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&argv[j][1]));
+ char *ctemp = ACE_OS::getenv (ACE_TEXT_TO_CHAR_IN (&argv[j][1]));
if (ctemp == 0)
end = ACE_OS::strecpy (end, argv[j]);
else
- end = ACE_OS::strecpy (end, ACE_TEXT_CHAR_TO_TCHAR (ctemp));
-# endif /* ACE_WIN32 || !ACE_HAS_WCHAR */
+ end = ACE_OS::strecpy (end, ACE_TEXT_TO_TCHAR_IN (ctemp));
+# endif /* ACE_WIN32 */
}
else
#endif /* ACE_LACKS_ENV */
@@ -248,7 +248,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
// narrow char strings for execv().
char **cargv;
int arg_count;
-# endif /* ACE_HAS_WCHAR */
+# endif /* ACE_USES_WCHAR */
switch (result)
{
@@ -267,7 +267,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
--arg_count; // Back to 0-indexed
cargv[arg_count] = 0;
while (--arg_count >= 0)
- cargv[arg_count] = ACE_Wide_To_Ascii::convert (argv[arg_count]);
+ cargv[arg_count] = ACE_TEXT_TO_CHAR_OUT(argv[arg_count]); // memory allocated!
// Don't worry about freeing the cargv or the strings it points to.
// Either the process will be replaced, or we'll exit.
if (ACE_OS::execv (cargv[0], cargv) == -1)
@@ -282,7 +282,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
// If the execv fails, this child needs to exit.
ACE_OS::exit (errno);
}
-# endif /* ACE_HAS_WCHAR */
+# endif /* ACE_USES_WCHAR */
default:
// Server process. The fork succeeded.
@@ -616,135 +616,6 @@ ACE_OS::pwrite (ACE_HANDLE handle,
# endif /* ACE_HAD_P_READ_WRITE */
}
-int
-ACE_OS::string_to_argv (ACE_TCHAR *buf,
- int &argc,
- ACE_TCHAR **&argv,
- bool substitute_env_args)
-{
- // Reset the number of arguments
- argc = 0;
-
- if (buf == 0)
- return -1;
-
- ACE_TCHAR *cp = buf;
-
- // First pass: count arguments.
-
- // '#' is the start-comment token..
- while (*cp != ACE_LIB_TEXT ('\0') && *cp != ACE_LIB_TEXT ('#'))
- {
- // Skip whitespace..
- while (ACE_OS::ace_isspace (*cp))
- cp++;
-
- // Increment count and move to next whitespace..
- if (*cp != ACE_LIB_TEXT ('\0'))
- argc++;
-
- while (*cp != ACE_LIB_TEXT ('\0') && !ACE_OS::ace_isspace (*cp))
- {
- // Grok quotes....
- if (*cp == ACE_LIB_TEXT ('\'') || *cp == ACE_LIB_TEXT ('"'))
- {
- ACE_TCHAR quote = *cp;
-
- // Scan past the string..
- for (cp++; *cp != ACE_LIB_TEXT ('\0') && *cp != quote; cp++)
- continue;
-
- // '\0' implies unmatched quote..
- if (*cp == ACE_LIB_TEXT ('\0'))
- {
- argc--;
- break;
- }
- else
- cp++;
- }
- else
- cp++;
- }
- }
-
- // Second pass: copy arguments.
- ACE_TCHAR arg[ACE_DEFAULT_ARGV_BUFSIZ];
- ACE_TCHAR *argp = arg;
-
- // Make sure that the buffer we're copying into is always large
- // enough.
- if (cp - buf >= ACE_DEFAULT_ARGV_BUFSIZ)
- ACE_NEW_RETURN (argp,
- ACE_TCHAR[cp - buf + 1],
- -1);
-
- // Make a new argv vector of argc + 1 elements.
- ACE_NEW_RETURN (argv,
- ACE_TCHAR *[argc + 1],
- -1);
-
- ACE_TCHAR *ptr = buf;
-
- for (int i = 0; i < argc; i++)
- {
- // Skip whitespace..
- while (ACE_OS::ace_isspace (*ptr))
- ptr++;
-
- // Copy next argument and move to next whitespace..
- cp = argp;
- while (*ptr != ACE_LIB_TEXT ('\0') && !ACE_OS::ace_isspace (*ptr))
- if (*ptr == ACE_LIB_TEXT ('\'') || *ptr == ACE_LIB_TEXT ('"'))
- {
- ACE_TCHAR quote = *ptr++;
-
- while (*ptr != ACE_LIB_TEXT ('\0') && *ptr != quote)
- *cp++ = *ptr++;
-
- if (*ptr == quote)
- ptr++;
- }
- else
- *cp++ = *ptr++;
-
- *cp = ACE_LIB_TEXT ('\0');
-
-#if !defined (ACE_LACKS_ENV)
- // Check for environment variable substitution here.
- if (substitute_env_args) {
- argv[i] = ACE_OS::strenvdup(argp);
-
- if (argv[i] == 0)
- {
- if (argp != arg)
- delete [] argp;
- errno = ENOMEM;
- return -1;
- }
- }
- else
-#endif /* ACE_LACKS_ENV */
- {
- argv[i] = ACE_OS::strdup(argp);
-
- if (argv[i] == 0)
- {
- if (argp != arg)
- delete [] argp;
- errno = ENOMEM;
- return -1;
- }
- }
- }
-
- if (argp != arg)
- delete [] argp;
-
- argv[argc] = 0;
- return 0;
-}
-
// Write <len> bytes from <buf> to <handle> (uses the <write>
// system call on UNIX and the <WriteFile> call on Win32).
diff --git a/ace/OS_NS_unistd.h b/ace/OS_NS_unistd.h
index 831646bf47e..664102547fd 100644
--- a/ace/OS_NS_unistd.h
+++ b/ace/OS_NS_unistd.h
@@ -49,10 +49,8 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int access (const char *path, int amode);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int access (const wchar_t *path, int amode);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
unsigned int alarm (u_int secs);
@@ -70,19 +68,15 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int chdir (const char *path);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int chdir (const wchar_t *path);
-#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CHDIR */
ACE_NAMESPACE_INLINE_FUNCTION
int rmdir (const char *path);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int rmdir (const wchar_t *path);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int close (ACE_HANDLE handle);
@@ -144,10 +138,8 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
char *getcwd (char *, size_t);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t *getcwd (wchar_t *, size_t);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
gid_t getgid (void);
@@ -183,11 +175,9 @@ namespace ACE_OS
int hostname (char *name,
size_t maxnamelen);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int hostname (wchar_t *name,
size_t maxnamelen);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
int isatty (int handle);
@@ -294,10 +284,10 @@ namespace ACE_OS
int sleep (const ACE_Time_Value &tv);
// used by ARGV::string_to_argv
- extern ACE_Export
- int string_to_argv (ACE_TCHAR *buf,
+ template <typename CHAR_TYPE>
+ int string_to_argv (CHAR_TYPE *buf,
int &argc,
- ACE_TCHAR **&argv,
+ CHAR_TYPE **&argv,
bool substitute_env_args = true);
ACE_NAMESPACE_INLINE_FUNCTION
@@ -326,10 +316,8 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int unlink (const char *path);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
int unlink (const wchar_t *path);
-#endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t write (ACE_HANDLE handle,
@@ -367,5 +355,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# include "ace/OS_NS_unistd.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
+#include "ace/OS_NS_unistd_T.inl"
+
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_UNISTD_H */
diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl
index b961b822551..1e73cc50320 100644
--- a/ace/OS_NS_unistd.inl
+++ b/ace/OS_NS_unistd.inl
@@ -41,7 +41,7 @@ ACE_OS::access (const char *path, int amode)
// @@ WINCE: There should be a Win32 API that can do this.
// Hard coded read access here.
ACE_UNUSED_ARG (amode);
- FILE* handle = ACE_OS::fopen (ACE_TEXT_CHAR_TO_TCHAR(path),
+ FILE* handle = ACE_OS::fopen (ACE_TEXT_TO_TCHAR_IN(path),
ACE_LIB_TEXT ("r"));
if (handle != 0)
{
@@ -62,18 +62,15 @@ ACE_OS::access (const char *path, int amode)
#endif /* ACE_LACKS_ACCESS */
}
-
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::access (const wchar_t *path, int amode)
{
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
ACE_OSCALL_RETURN (::_waccess (path, amode), int, -1);
#else /* ACE_WIN32 && !ACE_HAS_WINCE */
- return ACE_OS::access (ACE_Wide_To_Ascii (path).char_rep (), amode);
+ return ACE_OS::access (ACE_TEXT_TO_CHAR_IN (path), amode);
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE u_int
ACE_OS::alarm (u_int secs)
@@ -147,17 +144,15 @@ ACE_OS::chdir (const char *path)
#endif /* ACE_HAS_NONCONST_CHDIR */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::chdir (const wchar_t *path)
{
#if defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_wchdir (path), int, -1);
#else /* ACE_WIN32 */
- return ACE_OS::chdir (ACE_Wide_To_Ascii (path).char_rep ());
+ return ACE_OS::chdir (ACE_TEXT_TO_CHAR_IN (path));
#endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CHDIR */
ACE_INLINE int
@@ -201,7 +196,7 @@ ACE_OS::rmdir (const char *path)
#elif defined (ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400)
ACE_OSCALL_RETURN (::_rmdir ((char *) path), int, -1);
#elif defined (ACE_HAS_WINCE)
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::RemoveDirectory (ACE_TEXT_CHAR_TO_TCHAR (path)),
+ ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::RemoveDirectory (ACE_TEXT_TO_TCHAR_IN (path)),
ace_result_),
int, -1);
#else
@@ -209,7 +204,6 @@ ACE_OS::rmdir (const char *path)
#endif /* ACE_PSOS_LACKS_PHILE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::rmdir (const wchar_t *path)
{
@@ -220,11 +214,9 @@ ACE_OS::rmdir (const wchar_t *path)
#elif defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_wrmdir (path), int, -1);
#else
- ACE_Wide_To_Ascii n_path (path);
- return ACE_OS::rmdir (n_path.char_rep ());
+ return ACE_OS::rmdir (ACE_TEXT_TO_CHAR_IN (path));
#endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
// @todo: which 4 and why??? dhinton
// NOTE: The following four function definitions must appear before
@@ -540,7 +532,6 @@ ACE_OS::getcwd (char *buf, size_t size)
#endif /* ACE_PSOS_LACKS_PHILE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::getcwd (wchar_t *buf, size_t size)
{
@@ -551,17 +542,12 @@ ACE_OS::getcwd (wchar_t *buf, size_t size)
# elif defined (ACE_WIN32)
return ::_wgetcwd (buf, static_cast<int> (size));
# else
- char *narrow_buf = new char[size];
- char *result = 0;
- result = ACE_OS::getcwd (narrow_buf, size);
- ACE_Ascii_To_Wide wide_buf (result);
- delete [] narrow_buf;
- if (result != 0)
- ACE_OS::strsncpy (buf, wide_buf.wchar_rep (), size);
- return result == 0 ? 0 : buf;
+ buf[0]=0;
+ ACE::String_Conversion::Convert_InOut< char, wchar_t > convert( buf, size );
+ char* result = ACE_OS::getcwd( convert.c_str(), convert.size() );
+ return ( result ? buf : 0 );
# endif /* ACE_WIN32 */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE gid_t
ACE_OS::getgid (void)
@@ -721,7 +707,6 @@ ACE_OS::hostname (char name[], size_t maxnamelen)
#endif /* ACE_HAS_PHARLAP */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::hostname (wchar_t name[], size_t maxnamelen)
{
@@ -731,19 +716,11 @@ ACE_OS::hostname (wchar_t name[], size_t maxnamelen)
ace_result_), int, -1);
#else /* ACE_WIN32 && !ACE_HAS_WINCE */
// Emulate using the char version
- char *char_name = 0;
- int result = 0;
-
- ACE_NEW_RETURN (char_name, char[maxnamelen], -1);
-
- result = ACE_OS::hostname(char_name, maxnamelen);
- ACE_OS::strcpy (name, ACE_Ascii_To_Wide (char_name).wchar_rep ());
-
- delete [] char_name;
- return result;
+ name[0]=0;
+ ACE::String_Conversion::Convert_InOut< char, wchar_t > convert (name, maxnamelen);
+ return ACE_OS::hostname (convert.c_str(), convert.size());
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::isatty (int handle)
@@ -1220,7 +1197,7 @@ ACE_OS::truncate (const ACE_TCHAR *filename,
/* NOTREACHED */
#elif !defined (ACE_LACKS_TRUNCATE)
ACE_OSCALL_RETURN
- (::truncate (ACE_TEXT_ALWAYS_CHAR (filename), offset), int, -1);
+ (::truncate (ACE_TEXT_TO_CHAR_IN (filename), offset), int, -1);
#else
ACE_UNUSED_ARG (filename);
ACE_UNUSED_ARG (offset);
@@ -1280,7 +1257,7 @@ ACE_OS::unlink (const char *path)
int, -1);
# elif defined (ACE_HAS_WINCE)
// @@ The problem is, DeleteFile is not actually equals to unlink. ;(
- ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::DeleteFile (ACE_TEXT_CHAR_TO_TCHAR (path)), ace_result_),
+ ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::DeleteFile (ACE_TEXT_TO_TCHAR_IN (path)), ace_result_),
int, -1);
# elif defined (ACE_LACKS_UNLINK)
ACE_UNUSED_ARG (path);
@@ -1290,7 +1267,6 @@ ACE_OS::unlink (const char *path)
# endif /* ACE_HAS_NONCONST_UNLINK */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::unlink (const wchar_t *path)
{
@@ -1302,11 +1278,9 @@ ACE_OS::unlink (const wchar_t *path)
# elif defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_wunlink (path), int, -1);
# else
- ACE_Wide_To_Ascii npath (path);
- return ACE_OS::unlink (npath.char_rep ());
+ return ACE_OS::unlink (ACE_TEXT_TO_CHAR_IN (path));
# endif /* ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE ssize_t
ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte)
diff --git a/ace/OS_NS_wchar.cpp b/ace/OS_NS_wchar.cpp
index bc6fd7bae93..b6701492a67 100644
--- a/ace/OS_NS_wchar.cpp
+++ b/ace/OS_NS_wchar.cpp
@@ -1,17 +1,15 @@
// $Id$
-#include "ace/OS_NS_wchar.h"
+# include "ace/OS_NS_wchar.h"
-ACE_RCSID(ace, OS_NS_wchar, "$Id$")
+ACE_RCSID(ace, OS_NS_wchar_t, "$Id$")
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "ace/OS_NS_wchar.inl"
#endif /* ACE_HAS_INLINED_OS_CALLS */
-#if defined (ACE_HAS_WCHAR)
-# include "ace/OS_NS_ctype.h"
-# include "ace/OS_NS_string.h"
-#endif /* ACE_HAS_WCHAR */
+#include "ace/OS_NS_ctype.h"
+#include "ace/OS_NS_string.h"
// The following wcs*_emulation methods were created based on BSD code:
/*-
@@ -52,7 +50,8 @@ ACE_RCSID(ace, OS_NS_wchar, "$Id$")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCAT)
+#if defined (ACE_LACKS_WCSCAT)
+
wchar_t *
ACE_OS::wcscat_emulation (wchar_t *destination,
const wchar_t *source)
@@ -63,9 +62,9 @@ ACE_OS::wcscat_emulation (wchar_t *destination,
while ((*destination++ = *source++));
return save;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */
+#endif /* ACE_LACKS_WCSCAT */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCHR)
+#if defined (ACE_LACKS_WCSCHR)
wchar_t *
ACE_OS::wcschr_emulation (const wchar_t *string, wint_t c)
{
@@ -75,21 +74,21 @@ ACE_OS::wcschr_emulation (const wchar_t *string, wint_t c)
return 0;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */
+#endif /* ACE_LACKS_WCSCHR */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
+#if defined (ACE_LACKS_WCSCMP)
int
-ACE_OS::wcscmp_emulation (const ACE_WCHAR_T *string1,
- const ACE_WCHAR_T *string2)
+ACE_OS::wcscmp_emulation (const wchar_t *string1,
+ const wchar_t *string2)
{
while (*string1 == *string2++)
if (*string1++ == 0)
return (0);
return (*string1 - *--string2);
}
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
+#endif /* ACE_LACKS_WCSCMP */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY)
+#if defined (ACE_LACKS_WCSCPY)
wchar_t *
ACE_OS::wcscpy_emulation (wchar_t *destination,
const wchar_t *source)
@@ -99,9 +98,9 @@ ACE_OS::wcscpy_emulation (wchar_t *destination,
for (; (*destination = *source); ++source, ++destination);
return save;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCPY */
+#endif /* ACE_LACKS_WCSCPY */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCSPN)
+#if defined (ACE_LACKS_WCSCSPN)
size_t
ACE_OS::wcscspn_emulation (const wchar_t *s, const wchar_t *reject)
{
@@ -121,9 +120,9 @@ ACE_OS::wcscspn_emulation (const wchar_t *s, const wchar_t *reject)
return count;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCSPN */
+#endif /* ACE_LACKS_WCSCSPN */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSICMP)
+#if defined (ACE_LACKS_WCSICMP)
int
ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t)
{
@@ -151,31 +150,31 @@ ACE_OS::wcsicmp_emulation (const wchar_t *s, const wchar_t *t)
else
return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_towlower (*scan2);
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */
+#endif /* ACE_LACKS_WCSICMP */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
+#if defined (ACE_LACKS_WCSLEN)
size_t
-ACE_OS::wcslen_emulation (const ACE_WCHAR_T *string)
+ACE_OS::wcslen_emulation (const wchar_t *string)
{
- const ACE_WCHAR_T *s;
+ const wchar_t *s;
for (s = string; *s; ++s)
continue;
return s - string;
}
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
+#endif /* ACE_LACKS_WCSLEN */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT)
-ACE_WCHAR_T *
-ACE_OS::wcsncat_emulation (ACE_WCHAR_T *destination,
- const ACE_WCHAR_T *source,
+#if defined (ACE_LACKS_WCSNCAT)
+wchar_t *
+ACE_OS::wcsncat_emulation (wchar_t *destination,
+ const wchar_t *source,
size_t count)
{
if (count != 0)
{
- ACE_WCHAR_T *d = destination;
- const ACE_WCHAR_T *s = source;
+ wchar_t *d = destination;
+ const wchar_t *s = source;
while (*d != 0)
d++;
@@ -193,12 +192,12 @@ ACE_OS::wcsncat_emulation (ACE_WCHAR_T *destination,
return destination;
}
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCAT */
+#endif /* ACE_LACKS_WCSCAT */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
+#if defined (ACE_LACKS_WCSNCMP)
int
-ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1,
- const ACE_WCHAR_T *s2,
+ACE_OS::wcsncmp_emulation (const wchar_t *s1,
+ const wchar_t *s2,
size_t len)
{
if (len == 0)
@@ -214,18 +213,18 @@ ACE_OS::wcsncmp_emulation (const ACE_WCHAR_T *s1,
return 0;
}
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
+#endif /* ACE_LACKS_WCSNCMP */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
-ACE_WCHAR_T *
-ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination,
- const ACE_WCHAR_T *source,
+#if defined (ACE_LACKS_WCSNCPY)
+wchar_t *
+ACE_OS::wcsncpy_emulation (wchar_t *destination,
+ const wchar_t *source,
size_t len)
{
if (len != 0)
{
- ACE_WCHAR_T *d = destination;
- const ACE_WCHAR_T *s = source;
+ wchar_t *d = destination;
+ const wchar_t *s = source;
do
{
@@ -241,9 +240,9 @@ ACE_OS::wcsncpy_emulation (ACE_WCHAR_T *destination,
return destination;
}
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
+#endif /* ACE_LACKS_WCSNCPY */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP)
+#if defined (ACE_LACKS_WCSNICMP)
int
ACE_OS::wcsnicmp_emulation (const wchar_t *s,
const wchar_t *t,
@@ -278,9 +277,9 @@ ACE_OS::wcsnicmp_emulation (const wchar_t *s,
else
return ACE_OS::ace_towlower (*scan1) - ACE_OS::ace_towlower (*scan2);
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNICMP */
+#endif /* ACE_LACKS_WCSNICMP */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSPBRK)
+#if defined (ACE_LACKS_WCSPBRK)
wchar_t *
ACE_OS::wcspbrk_emulation (const wchar_t *string,
const wchar_t *charset)
@@ -297,9 +296,9 @@ ACE_OS::wcspbrk_emulation (const wchar_t *string,
return 0;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSPBRK */
+#endif /* ACE_LACKS_WCSPBRK */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSRCHR)
+#if defined (ACE_LACKS_WCSRCHR)
const wchar_t *
ACE_OS::wcsrchr_emulation (const wchar_t *s, wint_t c)
{
@@ -327,9 +326,9 @@ ACE_OS::wcsrchr_emulation (wchar_t *s, wint_t c)
return p;
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSRCHR */
+#endif /* ACE_LACKS_WCSRCHR */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSPN)
+#if defined (ACE_LACKS_WCSSPN)
size_t
ACE_OS::wcsspn_emulation (const wchar_t *string,
const wchar_t *charset)
@@ -346,9 +345,9 @@ cont:
goto cont;
return (p - 1 - string);
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSPN */
+#endif /* ACE_LACKS_WCSSPN */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSTR)
+#if defined (ACE_LACKS_WCSSTR)
wchar_t *
ACE_OS::wcsstr_emulation (const wchar_t *string,
const wchar_t *charset)
@@ -372,6 +371,6 @@ ACE_OS::wcsstr_emulation (const wchar_t *string,
return const_cast<wchar_t *> (string);
}
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */
+#endif /* ACE_LACKS_WCSSTR */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_NS_wchar.h b/ace/OS_NS_wchar.h
index 55999db6e59..73db3b1c6ef 100644
--- a/ace/OS_NS_wchar.h
+++ b/ace/OS_NS_wchar.h
@@ -14,8 +14,8 @@
*/
//=============================================================================
-#ifndef ACE_OS_NS_WCHAR_H
-# define ACE_OS_NS_WCHAR_H
+#ifndef ACE_OS_NS_wchar_t_H
+# define ACE_OS_NS_wchar_t_H
# include /**/ "ace/pre.h"
@@ -25,10 +25,9 @@
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/os_include/os_wchar.h"
+#include "ace/ace_wchar.h"
#include "ace/Basic_Types.h"
#include "ace/ACE_export.h"
-#include "ace/ace_wchar.h" // include for the time being, but this code needs to be moved. dhinton
#include "ace/os_include/os_errno.h"
@@ -42,100 +41,96 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE_OS
{
- typedef ACE_WCHAR_T WChar;
-
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wint_t fgetwc (FILE* fp);
-#endif /* ACE_HAS_WCHAR */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCAT)
+#if defined (ACE_LACKS_WCSCAT)
/// Emulated wcscat - Appends a string.
extern ACE_Export
wchar_t *wcscat_emulation (wchar_t *destination,
const wchar_t *source);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCAT */
+#endif /* ACE_LACKS_WCSCAT */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCHR)
+#if defined (ACE_LACKS_WCSCHR)
/// Emulated wcschr - Finds a character in a string.
extern ACE_Export
wchar_t *wcschr_emulation (const wchar_t *string, wint_t c);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCHR */
+#endif /* ACE_LACKS_WCSCHR */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSCMP)
+#if defined (ACE_LACKS_WCSCMP)
/// Emulated wcscmp - Compares strings.
extern ACE_Export
- int wcscmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2);
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCMP */
+ int wcscmp_emulation (const wchar_t *string1, const wchar_t *string2);
+#endif /* ACE_LACKS_WCSCMP */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCPY)
+#if defined (ACE_LACKS_WCSCPY)
/// Emulated wcscpy - Copies a string.
extern ACE_Export
wchar_t *wcscpy_emulation (wchar_t *destination,
const wchar_t *source);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCPY */
+#endif /* ACE_LACKS_WCSCPY */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSCSPN)
+#if defined (ACE_LACKS_WCSCSPN)
/// Emulated wcscspn.
extern ACE_Export
size_t wcscspn_emulation (const wchar_t *string,
const wchar_t *reject);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSCSPN */
+#endif /* ACE_LACKS_WCSCSPN */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSICMP)
+#if defined (ACE_LACKS_WCSICMP)
/// Emulated wcsicmp - Performs a case insensitive comparison of strings.
extern ACE_Export
int wcsicmp_emulation (const wchar_t *string1,
const wchar_t *string2);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSICMP */
+#endif /* ACE_LACKS_WCSICMP */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSLEN)
+#if defined (ACE_LACKS_WCSLEN)
/// Emulated wcslen - Returns the length of a string.
extern ACE_Export
- size_t wcslen_emulation (const ACE_WCHAR_T *string);
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSLEN */
+ size_t wcslen_emulation (const wchar_t *string);
+#endif /* ACE_LACKS_WCSLEN */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT)
+#if defined (ACE_LACKS_WCSNCAT)
/// Emulated wcscat - Appends a string.
extern ACE_Export
- ACE_WCHAR_T *wcsncat_emulation (ACE_WCHAR_T *destination,
- const ACE_WCHAR_T *source,
+ wchar_t *wcsncat_emulation (wchar_t *destination,
+ const wchar_t *source,
size_t count);
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSCAT */
+#endif /* ACE_LACKS_WCSCAT */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCMP)
+#if defined (ACE_LACKS_WCSNCMP)
/// Emulated wcsncmp - Compares two arrays.
extern ACE_Export
- int wcsncmp_emulation (const ACE_WCHAR_T *string1,
- const ACE_WCHAR_T *string2,
+ int wcsncmp_emulation (const wchar_t *string1,
+ const wchar_t *string2,
size_t len);
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCMP */
+#endif /* ACE_LACKS_WCSNCMP */
-#if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCPY)
+#if defined (ACE_LACKS_WCSNCPY)
/// Emulated wcsncpy - Copies an array.
extern ACE_Export
- ACE_WCHAR_T *wcsncpy_emulation (ACE_WCHAR_T *destination,
- const ACE_WCHAR_T *source,
+ wchar_t *wcsncpy_emulation (wchar_t *destination,
+ const wchar_t *source,
size_t len);
-#endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCPY */
+#endif /* ACE_LACKS_WCSNCPY */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSNICMP)
+#if defined (ACE_LACKS_WCSNICMP)
/// Emulated wcsnicmp - Performs a case insensitive comparison of two
/// arrays
extern ACE_Export
int wcsnicmp_emulation (const wchar_t *string1,
const wchar_t *string2,
size_t len);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSNICMP */
+#endif /* ACE_LACKS_WCSNICMP */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSPBRK)
+#if defined (ACE_LACKS_WCSPBRK)
/// Emulated wcspbrk - Searches for characters in a string.
extern ACE_Export
wchar_t *wcspbrk_emulation (const wchar_t *string,
const wchar_t *charset);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSPBRK */
+#endif /* ACE_LACKS_WCSPBRK */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSRCHR)
+#if defined (ACE_LACKS_WCSRCHR)
/// Emulated wcsrchr (wchar_t version) - Finds the last occurance of a
/// character in a string.
extern ACE_Export
@@ -145,43 +140,41 @@ namespace ACE_OS
/// character in a string.
extern ACE_Export
const wchar_t *wcsrchr_emulation (const wchar_t *string, wint_t c);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSRCHR */
+#endif /* ACE_LACKS_WCSRCHR */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSPN)
+#if defined (ACE_LACKS_WCSSPN)
/// Emulated wcsspn.
extern ACE_Export
size_t wcsspn_emulation (const wchar_t *string,
const wchar_t *charset);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSPN */
+#endif /* ACE_LACKS_WCSSPN */
-#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSSTR)
+#if defined (ACE_LACKS_WCSSTR)
/// Emulated wcsstr - Performs a case insensitive comparison of two strings.
extern ACE_Export
wchar_t *wcsstr_emulation (const wchar_t *string,
const wchar_t *charset);
-#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSSTR */
+#endif /* ACE_LACKS_WCSSTR */
// these are named wrong. should be wcslen, etc... dhinton
ACE_NAMESPACE_INLINE_FUNCTION
- u_int wslen (const WChar *);
+ u_int wslen (const wchar_t *);
ACE_NAMESPACE_INLINE_FUNCTION
- WChar *wscpy (WChar *,
- const WChar *);
+ wchar_t *wscpy (wchar_t *,
+ const wchar_t *);
ACE_NAMESPACE_INLINE_FUNCTION
- int wscmp (const WChar *,
- const WChar *);
+ int wscmp (const wchar_t *,
+ const wchar_t *);
ACE_NAMESPACE_INLINE_FUNCTION
- int wsncmp (const WChar *,
- const WChar *,
+ int wsncmp (const wchar_t *,
+ const wchar_t *,
size_t len);
-#if defined (ACE_HAS_WCHAR)
ACE_NAMESPACE_INLINE_FUNCTION
wint_t ungetwc (wint_t c, FILE* fp);
-#endif /* ACE_HAS_WCHAR */
} /* namespace ACE_OS */
diff --git a/ace/OS_NS_wchar.inl b/ace/OS_NS_wchar.inl
index 7f2abac8d8f..19cddfcb413 100644
--- a/ace/OS_NS_wchar.inl
+++ b/ace/OS_NS_wchar.inl
@@ -4,7 +4,7 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-#if defined (ACE_HAS_WCHAR)
+
ACE_INLINE wint_t
ACE_OS::fgetwc (FILE* fp)
{
@@ -15,10 +15,9 @@ ACE_OS::fgetwc (FILE* fp)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetwc (fp), wint_t, WEOF);
# endif /* ACE_LACKS_FGETWC */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE u_int
-ACE_OS::wslen (const WChar *s)
+ACE_OS::wslen (const wchar_t *s)
{
u_int len = 0;
@@ -28,10 +27,10 @@ ACE_OS::wslen (const WChar *s)
return len;
}
-ACE_INLINE ACE_OS::WChar *
-ACE_OS::wscpy (WChar *dest, const WChar *src)
+ACE_INLINE wchar_t *
+ACE_OS::wscpy (wchar_t *dest, const wchar_t *src)
{
- WChar *original_dest = dest;
+ wchar_t *original_dest = dest;
while ((*dest++ = *src++) != 0)
continue;
@@ -40,10 +39,10 @@ ACE_OS::wscpy (WChar *dest, const WChar *src)
}
ACE_INLINE int
-ACE_OS::wscmp (const WChar *s, const WChar *t)
+ACE_OS::wscmp (const wchar_t *s, const wchar_t *t)
{
- const WChar *scan1 = s;
- const WChar *scan2 = t;
+ const wchar_t *scan1 = s;
+ const wchar_t *scan2 = t;
while (*scan1 != 0 && *scan1 == *scan2)
{
@@ -55,10 +54,10 @@ ACE_OS::wscmp (const WChar *s, const WChar *t)
}
ACE_INLINE int
-ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len)
+ACE_OS::wsncmp (const wchar_t *s, const wchar_t *t, size_t len)
{
- const WChar *scan1 = s;
- const WChar *scan2 = t;
+ const wchar_t *scan1 = s;
+ const wchar_t *scan2 = t;
while (len != 0 && *scan1 != 0 && *scan1 == *scan2)
{
@@ -70,7 +69,6 @@ ACE_OS::wsncmp (const WChar *s, const WChar *t, size_t len)
return len == 0 ? 0 : *scan1 - *scan2;
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE wint_t
ACE_OS::ungetwc (wint_t c, FILE* fp)
{
@@ -82,6 +80,5 @@ ACE_OS::ungetwc (wint_t c, FILE* fp)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::ungetwc (c, fp), wint_t, WEOF);
# endif /* ACE_LACKS_FGETWC */
}
-#endif /* ACE_HAS_WCHAR */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/OS_main.cpp b/ace/OS_main.cpp
index 65087b8057b..79e8413bea9 100644
--- a/ace/OS_main.cpp
+++ b/ace/OS_main.cpp
@@ -138,7 +138,7 @@ int ACE_Main_Base::run (HINSTANCE,
{
ACE_TCHAR cmdline[1024];
ACE_OS::strcpy (cmdline, ACE_LIB_TEXT ("program "));
- ACE_OS::strcat (cmdline, ACE_TEXT_WCHAR_TO_TCHAR (lpCmdLine));
+ ACE_OS::strcat (cmdline, ACE_TEXT_TO_TCHAR_IN (lpCmdLine));
ACE_ARGV ce_argv (cmdline);
ACE::init ();
ACE_MAIN_OBJECT_MANAGER
diff --git a/ace/Object_Manager.h b/ace/Object_Manager.h
index 70477591e56..293864096b3 100644
--- a/ace/Object_Manager.h
+++ b/ace/Object_Manager.h
@@ -158,7 +158,7 @@ template <class T> class ACE_Cleanup_Adapter;
* With ACE_HAS_NONSTATIC_OBJECT_MANAGER enabled, the ACE
* library has no static objects that require destruction.
* However, there are two drawbacks to using it:
- * 1) main (int, char *[]) must be declared with arguments, even
+ * 1) ACE_TMAIN (int, ACE_TCHAR *[]) must be declared with arguments, even
* if they're not used. All of ACE is converted to this, so
* just applications have to be concerned with it.
* 2) If there any static objects that depend on those that are
diff --git a/ace/Object_Manager_Base.cpp b/ace/Object_Manager_Base.cpp
index f61247558e9..185ab58d5be 100644
--- a/ace/Object_Manager_Base.cpp
+++ b/ace/Object_Manager_Base.cpp
@@ -409,7 +409,7 @@ ACE_OS_Object_Manager::print_error_message (unsigned int line_number,
#if !defined (ACE_HAS_WINCE)
fprintf (stderr, "ace/OS.cpp, line %u: %s ",
line_number,
- ACE_TEXT_ALWAYS_CHAR (message));
+ ACE_TEXT_TO_CHAR_IN (message));
perror ("failed");
#else
// @@ Need to use the following information.
diff --git a/ace/Process.cpp b/ace/Process.cpp
index 1aa0adbd4e9..dcf34f36c16 100644
--- a/ace/Process.cpp
+++ b/ace/Process.cpp
@@ -350,8 +350,8 @@ ACE_Process::spawn (ACE_Process_Options &options)
// releasing any of the converted string memory since this
// process will either exec() or exit() shortly.
# if defined (ACE_USES_WCHAR)
- ACE_Wide_To_Ascii n_procname (options.process_name ());
- const char *procname = n_procname.char_rep ();
+ ACE::String_Conversion::Convert_In< char, wchar_t > n_procname (options.process_name ());
+ const char *procname = n_procname.c_str ();
wchar_t * const *wargv = options.command_line_argv ();
size_t vcount, i;
@@ -359,8 +359,9 @@ ACE_Process::spawn (ACE_Process_Options &options)
;
char **procargv = new char *[vcount + 1]; // Need 0 at the end
procargv[vcount] = 0;
+
for (i = 0; i < vcount; ++i)
- procargv[i] = ACE_Wide_To_Ascii::convert (wargv[i]);
+ procargv[i] = ACE_TEXT_TO_CHAR_OUT (wargv[i]); // memory allocated!
wargv = options.env_argv ();
for (vcount = 0; wargv[vcount] != 0; ++vcount)
@@ -368,7 +369,7 @@ ACE_Process::spawn (ACE_Process_Options &options)
char **procenv = new char *[vcount + 1]; // Need 0 at the end
procenv[vcount] = 0;
for (i = 0; i < vcount; ++i)
- procenv[i] = ACE_Wide_To_Ascii::convert (wargv[i]);
+ procenv[i] = ACE_TEXT_TO_CHAR_OUT (wargv[i]); // memory allocated!
# else
const char *procname = options.process_name ();
char *const *procargv = options.command_line_argv ();
@@ -963,7 +964,7 @@ ACE_Process_Options::command_line (const ACE_TCHAR *format, ...)
return 0;
}
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_HAS_WINCE)
+#if !defined (ACE_HAS_WINCE)
/**
* @note Not available on Windows CE because it doesn't have a char version of
* vsprintf.
@@ -989,14 +990,14 @@ ACE_Process_Options::command_line (const ACE_ANTI_TCHAR *format, ...)
va_end (argp);
ACE_OS::strcpy (this->command_line_buf_,
- ACE_TEXT_ANTI_TO_TCHAR (anti_clb));
+ ACE_TEXT_TO_TCHAR_IN (anti_clb));
delete [] anti_clb;
command_line_argv_calculated_ = 0;
return 0;
}
-#endif /* ACE_HAS_WCHAR && !ACE_HAS_WINCE */
+#endif /* !ACE_HAS_WINCE */
ACE_TCHAR *
ACE_Process_Options::env_buf (void)
diff --git a/ace/Process.h b/ace/Process.h
index 98582720e1c..6c057bd2ed7 100644
--- a/ace/Process.h
+++ b/ace/Process.h
@@ -128,10 +128,8 @@ public:
/// be <= MAXPATHLEN.
void working_directory (const char *wd);
-#if defined (ACE_HAS_WCHAR)
/// wchar_t version of working_directory
void working_directory (const wchar_t *wd);
-#endif /* ACE_HAS_WCHAR */
/**
* Set the command-line arguments. @a format can use any printf
@@ -144,10 +142,10 @@ public:
*/
int command_line (const ACE_TCHAR *format, ...);
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_HAS_WINCE)
+#if !defined (ACE_HAS_WINCE)
/// Anti-TChar version of command_line ()
int command_line (const ACE_ANTI_TCHAR *format, ...);
-#endif /* ACE_HAS_WCHAR && !ACE_HAS_WINCE */
+#endif /* !ACE_HAS_WINCE */
/// Same as above in argv format. @a argv must be null terminated.
int command_line (const ACE_TCHAR * const argv[]);
diff --git a/ace/Process.inl b/ace/Process.inl
index 3b9b18f6429..5af3893100f 100644
--- a/ace/Process.inl
+++ b/ace/Process.inl
@@ -250,7 +250,7 @@ ACE_INLINE int
ACE_Process_Options::setreugid (const ACE_TCHAR* user)
{
#if !defined (ACE_LACKS_PWD_FUNCTIONS)
- struct passwd *ent = ACE_OS::getpwnam (ACE_TEXT_ALWAYS_CHAR (user));
+ struct passwd *ent = ACE_OS::getpwnam (ACE_TEXT_TO_CHAR_IN (user));
if (ent != 0)
{
@@ -342,23 +342,21 @@ ACE_INLINE void
ACE_Process_Options::working_directory (const char *wd)
{
#if !defined(ACE_HAS_WINCE)
- ACE_OS::strcpy (working_directory_, ACE_TEXT_CHAR_TO_TCHAR (wd));
+ ACE_OS::strcpy (working_directory_, ACE_TEXT_TO_TCHAR_IN (wd));
#else
ACE_UNUSED_ARG (wd);
#endif /* !ACE_HAS_WINCE */
}
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE_Process_Options::working_directory (const wchar_t *wd)
{
#if !defined(ACE_HAS_WINCE)
- ACE_OS::strcpy (working_directory_, ACE_TEXT_WCHAR_TO_TCHAR (wd));
+ ACE_OS::strcpy (working_directory_, ACE_TEXT_TO_TCHAR_IN (wd));
#else
ACE_UNUSED_ARG (wd);
#endif /* !ACE_HAS_WINCE */
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE void
ACE_Process_Options::process_name (const ACE_TCHAR *p)
diff --git a/ace/Process_Mutex.cpp b/ace/Process_Mutex.cpp
index 9aba33a7894..6078bfdbc68 100644
--- a/ace/Process_Mutex.cpp
+++ b/ace/Process_Mutex.cpp
@@ -40,7 +40,7 @@ ACE_Process_Mutex::unique_name (void)
ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode)
#if defined (_ACE_USE_SV_SEM)
- : lock_ (name ? name : ACE_TEXT_ALWAYS_CHAR (this->unique_name ()),
+ : lock_ (name ? name : ACE_TEXT_TO_CHAR_IN (this->unique_name ()),
ACE_SV_Semaphore_Complex::ACE_CREATE,
1,
1,
@@ -48,7 +48,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode)
#else
: lock_ (USYNC_PROCESS,
name ?
- ACE_TEXT_CHAR_TO_TCHAR (name) : this->unique_name (),
+ ACE_TEXT_TO_TCHAR_IN (name) : this->unique_name (),
(ACE_mutexattr_t *) arg,
mode)
#endif /* _ACE_USE_SV_SEM */
@@ -58,14 +58,13 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode)
#endif /* !_ACE_USE_SV_SEM */
}
-#if defined (ACE_HAS_WCHAR)
ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name,
void *arg,
mode_t mode)
#if defined (_ACE_USE_SV_SEM)
: lock_ (name ?
- ACE_Wide_To_Ascii (name).char_rep () :
- ACE_TEXT_ALWAYS_CHAR (this->unique_name ()),
+ ACE_TEXT_TO_CHAR_IN (name) :
+ ACE_TEXT_TO_CHAR_IN (this->unique_name ()),
ACE_SV_Semaphore_Complex::ACE_CREATE,
1,
1,
@@ -73,7 +72,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name,
#else
: lock_ (USYNC_PROCESS,
name ?
- ACE_TEXT_WCHAR_TO_TCHAR (name) : this->unique_name (),
+ ACE_TEXT_TO_TCHAR_IN (name) : this->unique_name (),
(ACE_mutexattr_t *) arg,
mode)
#endif /* _ACE_USE_SV_SEM */
@@ -82,7 +81,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name,
ACE_UNUSED_ARG (arg);
#endif /* _ACE_USE_SV_SEM */
}
-#endif /* ACE_HAS_WCHAR */
+
ACE_Process_Mutex::~ACE_Process_Mutex (void)
{
}
diff --git a/ace/Process_Mutex.h b/ace/Process_Mutex.h
index 130f59980f1..604d7ee0c80 100644
--- a/ace/Process_Mutex.h
+++ b/ace/Process_Mutex.h
@@ -90,8 +90,6 @@ public:
ACE_Process_Mutex (const char *name = 0,
void *arg = 0,
mode_t mode = ACE_DEFAULT_FILE_PERMS);
-
-#if defined (ACE_HAS_WCHAR)
/**
* Create a Process_Mutex, passing in the optional @c name. (@c wchar_t
* version)
@@ -109,7 +107,6 @@ public:
ACE_Process_Mutex (const wchar_t *name,
void *arg = 0,
mode_t mode = ACE_DEFAULT_FILE_PERMS);
-#endif /* ACE_HAS_WCHAR */
~ACE_Process_Mutex (void);
diff --git a/ace/Process_Semaphore.cpp b/ace/Process_Semaphore.cpp
index 952f20a99f6..1ac13b44065 100644
--- a/ace/Process_Semaphore.cpp
+++ b/ace/Process_Semaphore.cpp
@@ -32,7 +32,7 @@ ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count,
#if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS)
: lock_ (count, USYNC_PROCESS, name, arg, max)
#else
- : lock_ (ACE_TEXT_ALWAYS_CHAR (name),
+ : lock_ (ACE_TEXT_TO_CHAR_IN (name),
ACE_SV_Semaphore_Complex::ACE_CREATE,
count)
#endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS */
diff --git a/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp b/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp
index 548c56bef12..408d5f22a62 100644
--- a/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp
+++ b/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp
@@ -134,8 +134,7 @@ ACE_SOCK_Dgram_Mcast_QoS::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
if (this->subscribe (mcast_addr,
qos_params,
reuse_addr,
- ACE_TEXT_CHAR_TO_TCHAR
- (if_addrs[if_cnt].get_host_addr()),
+ ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr()),
protocol_family,
protocol,
protocolinfo) == 0)
diff --git a/ace/Registry_Name_Space.cpp b/ace/Registry_Name_Space.cpp
index e382af8482e..465da31d34b 100644
--- a/ace/Registry_Name_Space.cpp
+++ b/ace/Registry_Name_Space.cpp
@@ -82,7 +82,7 @@ ACE_Registry_Name_Space::bind (const ACE_NS_WString &name,
#else
return this->context_.bind (name.char_rep(),
object);
-#endif /* ACE_HAS_WCHAR */
+#endif /* ACE_USES_WCHAR */
}
diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp
index 2b55cf684a5..2d3f7795e38 100644
--- a/ace/Remote_Name_Space.cpp
+++ b/ace/Remote_Name_Space.cpp
@@ -46,12 +46,12 @@ ACE_Remote_Name_Space::bind (const ACE_NS_WString &name,
const char *type)
{
ACE_TRACE ("ACE_Remote_Name_Space::bind");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> value_urep (value.rep ());
ACE_UINT32 name_len =
- static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t));
ACE_UINT32 value_len =
- static_cast<ACE_UINT32> (value.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (value.length () * sizeof (wchar_t));
ACE_UINT32 type_len =
static_cast<ACE_UINT32> (ACE_OS::strlen (type));
ACE_Name_Request request (ACE_Name_Request::BIND,
@@ -70,12 +70,12 @@ ACE_Remote_Name_Space::rebind (const ACE_NS_WString &name,
const char *type)
{
ACE_TRACE ("ACE_Remote_Name_Space::rebind");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> value_urep (value.rep ());
ACE_UINT32 name_len =
- static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t));
ACE_UINT32 value_len =
- static_cast<ACE_UINT32> (value.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (value.length () * sizeof (wchar_t));
ACE_UINT32 type_len =
static_cast<ACE_UINT32> (ACE_OS::strlen (type));
ACE_Name_Request request (ACE_Name_Request::REBIND,
@@ -94,9 +94,9 @@ ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
char *&type)
{
ACE_TRACE ("ACE_Remote_Name_Space::resolve");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ());
ACE_UINT32 name_len =
- static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::RESOLVE,
name_urep.get (),
name_len,
@@ -110,7 +110,7 @@ ACE_Remote_Name_Space::resolve (const ACE_NS_WString &name,
if (this->ns_proxy_.recv_reply (reply) == -1)
return -1;
- ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (ACE_WCHAR_T));
+ ACE_NS_WString temp (reply.value (), reply.value_len () / sizeof (wchar_t));
value = temp;
ACE_NEW_RETURN (type,
char[reply.type_len () + 1],
@@ -123,9 +123,9 @@ int
ACE_Remote_Name_Space::unbind (const ACE_NS_WString &name)
{
ACE_TRACE ("ACE_Remote_Name_Space::unbind");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> name_urep (name.rep ());
ACE_UINT32 name_len =
- static_cast<ACE_UINT32> (name.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (name.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::UNBIND,
name_urep.get (),
name_len,
@@ -138,9 +138,9 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_names");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ());
ACE_UINT32 pattern_len =
- static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::LIST_NAMES,
pattern_urep.get (),
pattern_len,
@@ -160,7 +160,7 @@ ACE_Remote_Name_Space::list_names (ACE_WSTRING_SET &set,
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
ACE_NS_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_WCHAR_T));
+ reply.name_len () / sizeof (wchar_t));
set.insert (name);
}
}
@@ -172,9 +172,9 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_values");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ());
ACE_UINT32 pattern_len =
- static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::LIST_VALUES,
pattern_urep.get (),
pattern_len,
@@ -194,7 +194,7 @@ ACE_Remote_Name_Space::list_values (ACE_WSTRING_SET &set,
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
ACE_NS_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_WCHAR_T));
+ reply.value_len () / sizeof (wchar_t));
set.insert (value);
}
}
@@ -207,9 +207,9 @@ ACE_Remote_Name_Space::list_types (ACE_WSTRING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_types");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ());
ACE_UINT32 pattern_len =
- static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::LIST_TYPES,
pattern_urep.get (),
pattern_len,
@@ -242,9 +242,9 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_name_entries");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ());
ACE_UINT32 pattern_len =
- static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::LIST_NAME_ENTRIES,
pattern_urep.get (),
pattern_len,
@@ -265,9 +265,9 @@ ACE_Remote_Name_Space::list_name_entries (ACE_BINDING_SET &set,
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
ACE_NS_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_WCHAR_T));
+ reply.name_len () / sizeof (wchar_t));
ACE_NS_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_WCHAR_T));
+ reply.value_len () / sizeof (wchar_t));
ACE_Name_Binding entry (name,
value,
reply.type ());
@@ -283,9 +283,9 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_value_entries");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ());
ACE_UINT32 pattern_len =
- static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::LIST_VALUE_ENTRIES,
pattern_urep.get (),
pattern_len,
@@ -306,9 +306,9 @@ ACE_Remote_Name_Space::list_value_entries (ACE_BINDING_SET &set,
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
ACE_NS_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_WCHAR_T));
+ reply.name_len () / sizeof (wchar_t));
ACE_NS_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_WCHAR_T));
+ reply.value_len () / sizeof (wchar_t));
ACE_Name_Binding entry (name,
value,
reply.type());
@@ -324,9 +324,9 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_TRACE ("ACE_Remote_Name_Space::list_type_entries");
- ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> pattern_urep (pattern.rep ());
+ ACE_Auto_Basic_Array_Ptr<wchar_t> pattern_urep (pattern.rep ());
ACE_UINT32 pattern_len =
- static_cast<ACE_UINT32> (pattern.length () * sizeof (ACE_WCHAR_T));
+ static_cast<ACE_UINT32> (pattern.length () * sizeof (wchar_t));
ACE_Name_Request request (ACE_Name_Request::LIST_TYPE_ENTRIES,
pattern_urep.get (),
pattern_len,
@@ -347,9 +347,9 @@ ACE_Remote_Name_Space::list_type_entries (ACE_BINDING_SET &set,
if (reply.msg_type () != ACE_Name_Request::MAX_ENUM)
{
ACE_NS_WString name (reply.name (),
- reply.name_len () / sizeof (ACE_WCHAR_T));
+ reply.name_len () / sizeof (wchar_t));
ACE_NS_WString value (reply.value (),
- reply.value_len () / sizeof (ACE_WCHAR_T));
+ reply.value_len () / sizeof (wchar_t));
ACE_Name_Binding entry (name,
value,
reply.type ());
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index dc0c925fe02..249a6af39a8 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -616,7 +616,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq,
#else
ifreq if_address;
- ACE_OS::strcpy (if_address.ifr_name, ACE_TEXT_ALWAYS_CHAR (net_if));
+ ACE_OS::string_copy (if_address.ifr_name, net_if, sizeof(if_address.ifr_name));
if (ACE_OS::ioctl (this->get_handle (),
SIOCGIFADDR,
@@ -658,7 +658,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
#if defined(__linux__)
if (net_if != 0)
{
- lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (ACE_TEXT_ALWAYS_CHAR(net_if));
+ lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (ACE_TEXT_TO_CHAR_IN(net_if));
}
else
#elif defined (ACE_WIN32)
@@ -702,10 +702,11 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
{
if ((num_if && pAddrs->Ipv6IfIndex == static_cast<unsigned int>(if_ix))
|| (!num_if &&
- (ACE_OS::strcmp (ACE_TEXT_ALWAYS_CHAR (net_if),
- pAddrs->AdapterName) == 0
- || ACE_OS::strcmp (ACE_TEXT_ALWAYS_CHAR (net_if),
- ACE_Wide_To_Ascii (pAddrs->FriendlyName).char_rep()) == 0)))
+ // Do we need these conversions?
+ (ACE_OS::strcmp (ACE_TEXT_TO_CHAR_IN (net_if),
+ ACE_TEXT_TO_CHAR_IN (pAddrs->AdapterName)) == 0
+ || ACE_OS::strcmp (ACE_TEXT_TO_CHAR_IN (net_if),
+ ACE_TEXT_TO_CHAR_IN (pAddrs->FriendlyName)) == 0)))
{
lmreq.ipv6mr_interface = pAddrs->Ipv6IfIndex;
break;
diff --git a/ace/SOCK_Dgram_Bcast.cpp b/ace/SOCK_Dgram_Bcast.cpp
index 4138d067c37..ff8d9f1fd69 100644
--- a/ace/SOCK_Dgram_Bcast.cpp
+++ b/ace/SOCK_Dgram_Bcast.cpp
@@ -146,7 +146,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name)
// Get host ip address
if (host_name)
{
- hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name));
+ hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_TO_CHAR_IN (host_name));
if (hp == 0)
return -1;
diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp
index 5f325a7e519..2e5daad30a7 100644
--- a/ace/SOCK_Dgram_Mcast.cpp
+++ b/ace/SOCK_Dgram_Mcast.cpp
@@ -273,7 +273,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
while (intf[index].if_index != 0 || intf[index].if_name != 0)
{
if (this->join (mcast_addr, reuse_addr,
- ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0)
+ ACE_TEXT_TO_TCHAR_IN(intf[index].if_name)) == 0)
++nr_subscribed;
++index;
@@ -314,7 +314,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
while (pAddrs)
{
if (this->join (mcast_addr, reuse_addr,
- ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0)
+ ACE_TEXT_TO_TCHAR_IN(pAddrs->AdapterName)) == 0)
++nr_subscribed;
pAddrs = pAddrs->Next;
@@ -365,8 +365,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
continue;
if (this->subscribe (mcast_addr,
reuse_addr,
- ACE_TEXT_CHAR_TO_TCHAR
- (if_addrs[if_cnt].get_host_addr ())) == 0)
+ ACE_TEXT_TO_TCHAR_IN(if_addrs[if_cnt].get_host_addr ())) == 0)
++nr_subscribed;
}
}
@@ -416,8 +415,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr,
continue;
if (this->subscribe (mcast_addr,
reuse_addr,
- ACE_TEXT_CHAR_TO_TCHAR
- (if_addrs[if_cnt].get_host_addr ())) == 0)
+ ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr ())) == 0)
++nr_subscribed;
}
}
@@ -657,7 +655,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
int index = 0;
while (intf[index].if_index != 0 || intf[index].if_name != 0)
{
- if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0)
+ if (this->leave (mcast_addr, ACE_TEXT_TO_TCHAR_IN(intf[index].if_name)) == 0)
++nr_unsubscribed;
++index;
@@ -697,7 +695,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
while (pAddrs)
{
- if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0)
+ if (this->leave (mcast_addr, ACE_TEXT_TO_TCHAR_IN(pAddrs->AdapterName)) == 0)
++nr_unsubscribed;
pAddrs = pAddrs->Next;
@@ -750,8 +748,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
if (if_addrs[if_cnt].get_type () != AF_INET || if_addrs[if_cnt].is_loopback ())
continue;
if (this->leave (mcast_addr,
- ACE_TEXT_CHAR_TO_TCHAR
- (if_addrs[if_cnt].get_host_addr ())) == 0)
+ ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr ())) == 0)
++nr_unsubscribed;
}
}
@@ -799,8 +796,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr,
if (if_addrs[if_cnt].is_loopback ())
continue;
if (this->leave (mcast_addr,
- ACE_TEXT_CHAR_TO_TCHAR
- (if_addrs[if_cnt].get_host_addr ())) == 0)
+ ACE_TEXT_TO_TCHAR_IN (if_addrs[if_cnt].get_host_addr ())) == 0)
++nr_unsubscribed;
}
}
diff --git a/ace/SSL/SSL_Asynch_Stream.cpp b/ace/SSL/SSL_Asynch_Stream.cpp
index 23ab69059fd..2e0188475c5 100644
--- a/ace/SSL/SSL_Asynch_Stream.cpp
+++ b/ace/SSL/SSL_Asynch_Stream.cpp
@@ -121,8 +121,8 @@ ACE_SSL_Asynch_Stream::ACE_SSL_Asynch_Stream (
if (this->ssl_ == 0)
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("- cannot allocate new SSL structure")
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("- cannot allocate new SSL structure")
));
::SSL_set_verify (this->ssl_,
@@ -141,9 +141,9 @@ ACE_SSL_Asynch_Stream::~ACE_SSL_Asynch_Stream (void)
if (this->flags_ & SF_STREAM_OPEN) // open
if ((this->flags_ & SF_DELETE_ENABLE) == 0) // but ..
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("ACE_SSL_Asynch_Stream::DTOR-")
- ACE_TEXT("possible access violation ")
- ACE_TEXT("if proactor still handles events\n")));
+ ACE_LIB_TEXT("ACE_SSL_Asynch_Stream::DTOR-")
+ ACE_LIB_TEXT("possible access violation ")
+ ACE_LIB_TEXT("if proactor still handles events\n")));
::SSL_free (this->ssl_);
@@ -232,22 +232,22 @@ ACE_SSL_Asynch_Stream::open (ACE_Handler & handler,
if (this->flags_ & SF_STREAM_OPEN)
ACE_ERROR_RETURN
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
- ACE_TEXT ("- already opened")),
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
+ ACE_LIB_TEXT ("- already opened")),
-1);
if (this->ssl_ == 0)
ACE_ERROR_RETURN
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
- ACE_TEXT ("- SSL structure is absent")),
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
+ ACE_LIB_TEXT ("- SSL structure is absent")),
-1);
if (handle == ACE_INVALID_HANDLE)
ACE_ERROR_RETURN
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
- ACE_TEXT ("- invalid handle")),
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
+ ACE_LIB_TEXT ("- invalid handle")),
-1);
@@ -275,8 +275,8 @@ ACE_SSL_Asynch_Stream::open (ACE_Handler & handler,
if (this->bio_ == 0)
ACE_ERROR_RETURN
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
- ACE_TEXT ("- cannot allocate new BIO structure")),
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
+ ACE_LIB_TEXT ("- cannot allocate new BIO structure")),
-1);
::SSL_set_bio (this->ssl_ , this->bio_ , this->bio_);
@@ -294,8 +294,8 @@ ACE_SSL_Asynch_Stream::open (ACE_Handler & handler,
default:
ACE_ERROR_RETURN
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
- ACE_TEXT ("- invalid stream type")),
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream::open() %p\n"),
+ ACE_LIB_TEXT ("- invalid stream type")),
-1);
}
@@ -464,7 +464,7 @@ ACE_SSL_Asynch_Stream::do_SSL_shutdown (void)
default:
this->print_error (status,
- ACE_TEXT ("Shutdown error"));
+ ACE_LIB_TEXT ("Shutdown error"));
retval = -1;
break;
}
@@ -505,8 +505,8 @@ ACE_SSL_Asynch_Stream::do_SSL_handshake (void)
default:
ACE_ERROR_RETURN
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("- invalid stream type")),
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("- invalid stream type")),
-1);
}
@@ -528,7 +528,7 @@ ACE_SSL_Asynch_Stream::do_SSL_handshake (void)
case SSL_ERROR_SYSCALL:
default:
this->print_error (status,
- ACE_TEXT ("Handshake error"));
+ ACE_LIB_TEXT ("Handshake error"));
return -1;
}
@@ -587,7 +587,7 @@ ACE_SSL_Asynch_Stream::do_SSL_read (void)
this->notify_read (0, EFAULT);
this->print_error (status,
- ACE_TEXT ("SSL_read error"));
+ ACE_LIB_TEXT ("SSL_read error"));
return -1;
}
@@ -637,7 +637,7 @@ ACE_SSL_Asynch_Stream::do_SSL_write (void)
this->notify_write(0, EFAULT);
this->print_error (status,
- ACE_TEXT ("SSL_write error"));
+ ACE_LIB_TEXT ("SSL_write error"));
return -1;
}
@@ -820,8 +820,8 @@ ACE_SSL_Asynch_Stream::ssl_bio_read (char * buf,
{
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("error in ACE_Message_Block::size() ")
+ ACE_LIB_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("error in ACE_Message_Block::size() ")
));
errval = EINVAL;
@@ -843,8 +843,8 @@ ACE_SSL_Asynch_Stream::ssl_bio_read (char * buf,
{
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("%N:%l (%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("attempt read failed")
+ ACE_LIB_TEXT ("%N:%l (%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("attempt read failed")
));
errval = EINVAL; // may be leave EINPROGRESS ??
@@ -884,8 +884,8 @@ ACE_SSL_Asynch_Stream::ssl_bio_write (const char * buf,
{
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("error in ACE_Message_Block::size() ")
+ ACE_LIB_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("error in ACE_Message_Block::size() ")
));
errval = EINVAL;
@@ -901,8 +901,8 @@ ACE_SSL_Asynch_Stream::ssl_bio_write (const char * buf,
{
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("error in ACE_Message_Block::copy() ")
+ ACE_LIB_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("error in ACE_Message_Block::copy() ")
));
errval = EINVAL;
@@ -920,8 +920,8 @@ ACE_SSL_Asynch_Stream::ssl_bio_write (const char * buf,
{
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("attempt write failed")
+ ACE_LIB_TEXT ("%N:%l ((%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("attempt write failed")
));
errval = EINVAL; // may be leave EINPROGRESS ??
@@ -971,8 +971,8 @@ ACE_SSL_Asynch_Stream::handle_write_stream (
ACE_ERROR
((LM_ERROR,
- ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
- ACE_TEXT ("attempt write failed")
+ ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
+ ACE_LIB_TEXT ("attempt write failed")
));
this->bio_out_errno_ = EINVAL;
diff --git a/ace/SSL/SSL_Context.cpp b/ace/SSL/SSL_Context.cpp
index fa120632038..fd884dd9044 100644
--- a/ace/SSL/SSL_Context.cpp
+++ b/ace/SSL/SSL_Context.cpp
@@ -503,7 +503,7 @@ ACE_SSL_Context::report_error (unsigned long error_code)
(void) ::ERR_error_string (error_code, error_string);
ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("ACE_SSL (%P|%t) error code: %u - %C\n"),
+ ACE_LIB_TEXT ("ACE_SSL (%P|%t) error code: %u - %C\n"),
error_code,
error_string));
}
diff --git a/ace/SSL/SSL_SOCK_Stream.cpp b/ace/SSL/SSL_SOCK_Stream.cpp
index d0ed9f3709e..f5ba831ad17 100644
--- a/ace/SSL/SSL_SOCK_Stream.cpp
+++ b/ace/SSL/SSL_SOCK_Stream.cpp
@@ -45,7 +45,7 @@ ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream (ACE_SSL_Context *context)
ACE_ERROR ((LM_ERROR,
"(%P|%t) ACE_SSL_SOCK_Stream "
"- cannot allocate new SSL structure %p\n",
- ACE_TEXT ("")));
+ ACE_LIB_TEXT ("")));
}
}
diff --git a/ace/SString.cpp b/ace/SString.cpp
index 6c16c6b7697..1c03657398f 100644
--- a/ace/SString.cpp
+++ b/ace/SString.cpp
@@ -41,12 +41,7 @@ operator<< (ACE_OSTREAM_TYPE &os, const ACE_WString &ws)
{
// @@ Need to figure out how to print the "wide" string
// on platforms that don't support "wide" strings.
-#if defined (ACE_HAS_WCHAR)
- os << ACE_Wide_To_Ascii (ws.fast_rep ()).char_rep ();
-#else
- ACE_UNUSED_ARG (ws);
- os << "(*non-printable string*)";
-#endif
+ os << ACE_TEXT_TO_CHAR_IN (ws.fast_rep ());
return os;
}
diff --git a/ace/SStringfwd.h b/ace/SStringfwd.h
index 315553751ce..8910233ed56 100644
--- a/ace/SStringfwd.h
+++ b/ace/SStringfwd.h
@@ -19,7 +19,7 @@
#include /**/ "ace/pre.h"
-#include "ace/Basic_Types.h" /* ACE_WCHAR_T definition */
+#include "ace/Basic_Types.h" /* wchar_t definition */
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
@@ -29,7 +29,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
template <class CHAR> class ACE_String_Base; // Forward declaration.
-typedef ACE_WCHAR_T ACE_WSTRING_TYPE;
+typedef wchar_t ACE_WSTRING_TYPE;
typedef ACE_String_Base<char> ACE_CString;
typedef ACE_String_Base<ACE_WSTRING_TYPE> ACE_WString;
diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp
index 42fac9be0c7..3156338c44b 100644
--- a/ace/SV_Semaphore_Simple.cpp
+++ b/ace/SV_Semaphore_Simple.cpp
@@ -188,7 +188,6 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name,
ACE_LIB_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple")));
}
-#if defined (ACE_HAS_WCHAR)
ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name,
short flags,
int initial_value,
@@ -196,7 +195,7 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name,
mode_t perms)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple(wchar_t)");
- if (this->open (ACE_Wide_To_Ascii (name).char_rep (),
+ if (this->open (ACE_TEXT_TO_CHAR_IN (name),
flags,
initial_value,
nsems,
@@ -205,7 +204,6 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name,
ACE_LIB_TEXT ("%p\n"),
ACE_LIB_TEXT ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple")));
}
-#endif /* ACE_HAS_WCHAR */
ACE_SV_Semaphore_Simple::~ACE_SV_Semaphore_Simple (void)
{
diff --git a/ace/SV_Semaphore_Simple.h b/ace/SV_Semaphore_Simple.h
index af999654f0f..d2c82b71181 100644
--- a/ace/SV_Semaphore_Simple.h
+++ b/ace/SV_Semaphore_Simple.h
@@ -69,13 +69,12 @@ public:
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
-#if defined (ACE_HAS_WCHAR)
+
ACE_SV_Semaphore_Simple (const wchar_t *name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
-#endif /* ACE_HAS_WCHAR */
~ACE_SV_Semaphore_Simple (void);
@@ -85,13 +84,11 @@ public:
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
-#if defined (ACE_HAS_WCHAR)
int open (const wchar_t *name,
short flags = ACE_SV_Semaphore_Simple::ACE_CREATE,
int initial_value = 1,
u_short nsems = 1,
mode_t perms = ACE_DEFAULT_FILE_PERMS);
-#endif /* ACE_HAS_WCHAR */
/// Open or create one or more SV_Semaphores. We return 0 if all is
/// OK, else -1.
diff --git a/ace/SV_Semaphore_Simple.inl b/ace/SV_Semaphore_Simple.inl
index 5dde75ffff6..81a828b4401 100644
--- a/ace/SV_Semaphore_Simple.inl
+++ b/ace/SV_Semaphore_Simple.inl
@@ -7,7 +7,6 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-#if defined (ACE_HAS_WCHAR)
// Semaphores don't offer wide-char names, so convert the name and forward
// to the narrow-char open().
ACE_INLINE int
@@ -18,13 +17,12 @@ ACE_SV_Semaphore_Simple::open (const wchar_t *name,
mode_t perms)
{
ACE_TRACE ("ACE_SV_Semaphore_Simple::open (wchar_t)");
- return this->open (ACE_Wide_To_Ascii (name).char_rep (),
+ return this->open (ACE_TEXT_TO_CHAR_IN (name),
flags,
initial_value,
nsems,
perms);
}
-#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_SV_Semaphore_Simple::control (int cmd,
diff --git a/ace/Service_Config.h b/ace/Service_Config.h
index a6607f4e1e4..9cba0012a76 100644
--- a/ace/Service_Config.h
+++ b/ace/Service_Config.h
@@ -50,6 +50,18 @@ class ACE_DLL;
ACE_LIB_TEXT ("() \"") \
ACE_LIB_TEXT (parameters) \
ACE_LIB_TEXT ("\"")
+#define ACE_DYNAMIC_SERVICE_DIRECTIVE_A(ident, libpathname, objectclass, parameters) \
+ "dynamic " \
+ ident \
+ " Service_Object * " \
+ libpathname \
+ ":" \
+ objectclass \
+ "() \"" \
+ parameters \
+ "\""
+
+
#define ACE_REMOVE_SERVICE_DIRECTIVE(ident) \
ACE_LIB_TEXT ("remove ") \
ACE_LIB_TEXT (ident)
diff --git a/ace/Service_Config.inl b/ace/Service_Config.inl
index a3cdbea8000..aad291eaa22 100644
--- a/ace/Service_Config.inl
+++ b/ace/Service_Config.inl
@@ -126,32 +126,32 @@ ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd,
ACE_INLINE int
ACE_Service_Config::initialize (const ACE_Service_Type *sp, ACE_ANTI_TCHAR parameters[])
{
- return ACE_Service_Config::initialize (sp, ACE_TEXT_ANTI_TO_TCHAR (parameters));
+ return ACE_Service_Config::initialize (sp, ACE_TEXT_TO_TCHAR_IN (parameters));
}
ACE_INLINE int
ACE_Service_Config::initialize (const ACE_ANTI_TCHAR svc_name[], ACE_ANTI_TCHAR parameters[])
{
- return ACE_Service_Config::initialize (ACE_TEXT_ANTI_TO_TCHAR (svc_name),
- ACE_TEXT_ANTI_TO_TCHAR (parameters));
+ return ACE_Service_Config::initialize (ACE_TEXT_TO_TCHAR_IN (svc_name),
+ ACE_TEXT_TO_TCHAR_IN (parameters));
}
ACE_INLINE int
ACE_Service_Config::resume (const ACE_ANTI_TCHAR svc_name[])
{
- return ACE_Service_Config::resume (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
+ return ACE_Service_Config::resume (ACE_TEXT_TO_TCHAR_IN (svc_name));
}
ACE_INLINE int
ACE_Service_Config::suspend (const ACE_ANTI_TCHAR svc_name[])
{
- return ACE_Service_Config::suspend (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
+ return ACE_Service_Config::suspend (ACE_TEXT_TO_TCHAR_IN (svc_name));
}
ACE_INLINE int
ACE_Service_Config::remove (const ACE_ANTI_TCHAR svc_name[])
{
- return ACE_Service_Config::remove (ACE_TEXT_ANTI_TO_TCHAR (svc_name));
+ return ACE_Service_Config::remove (ACE_TEXT_TO_TCHAR_IN (svc_name));
}
#endif /* ACE_HAS_WINCE && !ACE_USES_WCHAR */
diff --git a/ace/Service_Manager.cpp b/ace/Service_Manager.cpp
index 446302ce87a..3dd1c8e151c 100644
--- a/ace/Service_Manager.cpp
+++ b/ace/Service_Manager.cpp
@@ -96,7 +96,7 @@ ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[])
{
ACE_TRACE ("ACE_Service_Manager::init");
ACE_INET_Addr local_addr (ACE_Service_Manager::DEFAULT_PORT_);
- ACE_Get_Opt getopt (argc, argv, ACE_LIB_TEXT ("dp:s:"), 0); // Start at argv[0]
+ ACE_Get_Arg_Opt<ACE_TCHAR> getopt (argc, argv, ACE_LIB_TEXT ("dp:s:"), 0); // Start at argv[0]
for (int c; (c = getopt ()) != -1; )
switch (c)
@@ -301,7 +301,7 @@ ACE_Service_Manager::handle_input (ACE_HANDLE)
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("accepted from host %s at port %d\n"),
- ACE_TEXT_CHAR_TO_TCHAR (sa.get_host_name ()),
+ ACE_TEXT_TO_TCHAR_IN (sa.get_host_name ()),
sa.get_port_number ()));
}
diff --git a/ace/Shared_Memory_Pool.cpp b/ace/Shared_Memory_Pool.cpp
index c61334485b7..93fb2e97fcf 100644
--- a/ace/Shared_Memory_Pool.cpp
+++ b/ace/Shared_Memory_Pool.cpp
@@ -251,7 +251,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_n
// key.
int segment_key;
- int result = ::sscanf (ACE_TEXT_ALWAYS_CHAR (backing_store_name),
+ int result = ::sscanf (ACE_TEXT_TO_CHAR_IN (backing_store_name),
"%d",
&segment_key);
@@ -259,7 +259,7 @@ ACE_Shared_Memory_Pool::ACE_Shared_Memory_Pool (const ACE_TCHAR *backing_store_n
// The conversion to a number failed so hash with crc32
// ACE::crc32 is also used in <SV_Semaphore_Simple>.
this->base_shm_key_ =
- (key_t) ACE::crc32 (ACE_TEXT_ALWAYS_CHAR (backing_store_name));
+ (key_t) ACE::crc32 (ACE_TEXT_TO_CHAR_IN (backing_store_name));
else
this->base_shm_key_ = segment_key;
diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp
index fa3c00993b0..ec7797ae156 100644
--- a/ace/Singleton.cpp
+++ b/ace/Singleton.cpp
@@ -526,7 +526,7 @@ ACE_DLL_Singleton_Adapter_T<TYPE>::dll_name (void)
{
// @todo make this a constant somewhere (or it there already is one
// then use it.
- return ACE_TEXT("ACE");
+ return ACE_LIB_TEXT("ACE");
}
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp
index 98b4e3079dd..e2b316e1097 100644
--- a/ace/Sock_Connect.cpp
+++ b/ace/Sock_Connect.cpp
@@ -391,7 +391,7 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
// Get host ip address if necessary.
if (host_name)
{
- hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_ALWAYS_CHAR (host_name));
+ hostent *hp = ACE_OS::gethostbyname (ACE_TEXT_TO_CHAR_IN (host_name));
if (hp == 0)
return -1;
diff --git a/ace/Stats.cpp b/ace/Stats.cpp
index 058830a8cc6..fa75340c83e 100644
--- a/ace/Stats.cpp
+++ b/ace/Stats.cpp
@@ -521,7 +521,7 @@ ACE_Throughput_Stats::accumulate (const ACE_Throughput_Stats &rhs)
}
void
-ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
+ACE_Throughput_Stats::dump_results (const char* msg,
ACE_UINT32 sf)
{
if (this->samples_count () == 0u)
@@ -584,7 +584,56 @@ ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg,
}
void
-ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg,
+ACE_Throughput_Stats::dump_results (const wchar_t* msg,
+ ACE_UINT32 sf)
+{
+ if (this->samples_count () == 0u)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("%s : no data collected\n"), msg));
+ return;
+ }
+
+ this->ACE_Basic_Stats::dump_results (msg, sf);
+
+ ACE_Throughput_Stats::dump_throughput (msg, sf,
+ this->throughput_last_,
+ this->samples_count ());
+}
+
+void
+ACE_Throughput_Stats::dump_throughput (const char *msg,
+ ACE_UINT32 sf,
+ ACE_UINT64 elapsed_time,
+ ACE_UINT32 samples_count)
+{
+#ifndef ACE_NLOGGING
+ double seconds =
+# if defined ACE_LACKS_LONGLONG_T
+ elapsed_time / sf;
+#elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
+ static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (
+ ACE_U_LongLong(elapsed_time / sf)));
+# else /* ! ACE_LACKS_LONGLONG_T */
+ static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf));
+# endif /* ! ACE_LACKS_LONGLONG_T */
+ seconds /= ACE_HR_SCALE_CONVERSION;
+
+ const double t_avg = samples_count / seconds;
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("%s throughput: %.2f (events/second)\n"),
+ msg, t_avg));
+#else
+ ACE_UNUSED_ARG (msg);
+ ACE_UNUSED_ARG (sf);
+ ACE_UNUSED_ARG (elapsed_time);
+ ACE_UNUSED_ARG (samples_count);
+#endif /* ACE_NLOGGING */
+}
+
+void
+ACE_Throughput_Stats::dump_throughput (const wchar_t *msg,
ACE_UINT32 sf,
ACE_UINT64 elapsed_time,
ACE_UINT32 samples_count)
diff --git a/ace/Stats.h b/ace/Stats.h
index a95328b74d1..e98305cb0b8 100644
--- a/ace/Stats.h
+++ b/ace/Stats.h
@@ -243,10 +243,19 @@ public:
void accumulate (const ACE_Throughput_Stats &throughput);
/// Print down the stats
- void dump_results (const ACE_TCHAR* msg, ACE_UINT32 scale_factor);
+ void dump_results (const char* msg, ACE_UINT32 scale_factor);
+
+ /// Print down the stats
+ void dump_results (const wchar_t* msg, ACE_UINT32 scale_factor);
+
+ /// Dump the average throughput stats.
+ static void dump_throughput (const char *msg,
+ ACE_UINT32 scale_factor,
+ ACE_UINT64 elapsed_time,
+ ACE_UINT32 samples_count);
/// Dump the average throughput stats.
- static void dump_throughput (const ACE_TCHAR *msg,
+ static void dump_throughput (const wchar_t *msg,
ACE_UINT32 scale_factor,
ACE_UINT64 elapsed_time,
ACE_UINT32 samples_count);
diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp
index 360cbecaed2..b4c85d5ca14 100644
--- a/ace/Svc_Conf_y.cpp
+++ b/ace/Svc_Conf_y.cpp
@@ -1722,7 +1722,7 @@ ace_get_module (const ACE_Service_Type *sr,
// Main driver program.
int
-main (int argc, char *argv[])
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_Svc_Conf_Param param (stdin);
diff --git a/ace/UNIX_Addr.cpp b/ace/UNIX_Addr.cpp
index 8dd3c52a36c..cb23ba91ef5 100644
--- a/ace/UNIX_Addr.cpp
+++ b/ace/UNIX_Addr.cpp
@@ -50,7 +50,7 @@ int
ACE_UNIX_Addr::addr_to_string (ACE_TCHAR s[], size_t len) const
{
ACE_OS::strsncpy (s,
- ACE_TEXT_CHAR_TO_TCHAR (this->unix_addr_.sun_path),
+ ACE_TEXT_TO_TCHAR_IN (this->unix_addr_.sun_path),
len);
return 0;
}
diff --git a/ace/UNIX_Addr.h b/ace/UNIX_Addr.h
index fcd6ed9bf46..eacabcf0d90 100644
--- a/ace/UNIX_Addr.h
+++ b/ace/UNIX_Addr.h
@@ -73,13 +73,11 @@ public:
/// Transform the string into the current addressing format.
virtual int string_to_addr (const char addr[]);
-#if defined (ACE_HAS_WCHAR)
/// Creates an ACE_UNIX_Addr from a string.
ACE_UNIX_Addr (const wchar_t rendezvous_point[]);
/// Creates an ACE_UNIX_Addr from a string.
int set (const wchar_t rendezvous_point[]);
-#endif /* ACE_HAS_WCHAR */
/// Compare two addresses for equality.
bool operator == (const ACE_UNIX_Addr &SAP) const;
diff --git a/ace/UNIX_Addr.inl b/ace/UNIX_Addr.inl
index 34fa002ef34..4e9e369d8f0 100644
--- a/ace/UNIX_Addr.inl
+++ b/ace/UNIX_Addr.inl
@@ -10,21 +10,18 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-#if defined (ACE_HAS_WCHAR)
-/// Creates an ACE_UNIX_Addr from a string.
ACE_INLINE
ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[])
{
- this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point));
+ this->set (rendezvous_point);
}
/// Creates an ACE_UNIX_Addr from a string.
ACE_INLINE int
ACE_UNIX_Addr::set (const wchar_t rendezvous_point[])
{
- return this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point));
+ return this->set (ACE_TEXT_TO_CHAR_IN (rendezvous_point));
}
-#endif /* ACE_HAS_WCHAR */
// Compare two addresses for equality.
diff --git a/ace/ace_wchar.h b/ace/ace_wchar.h
index ef0026fb7d0..740100eb671 100644
--- a/ace/ace_wchar.h
+++ b/ace/ace_wchar.h
@@ -17,83 +17,49 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-// These macros have been deprecated and should be replaced by their
-// ACE_TEXT_* equivalents. These macros are just hacks and may not
-// completely provide the old functionality.
-#if defined (ACE_LEGACY_MODE)
-// Convert the old unicode indicators
-# if defined (ACE_HAS_MOSTLY_UNICODE_APIS)
-# define ACE_USES_WCHAR
-# endif /* ACE_HAS_MOSTLY_UNICODE_APIS */
-# if defined (ACE_HAS_UNICODE)
-# define ACE_HAS_WCHAR
-# endif /* ACE_HAS_UNICODE */
-
-// These are defined to get older stuff to compile
-// FUZZ: disable check_for_tchar
-# define ASYS_TCHAR ACE_TCHAR
-# define ASYS_TEXT ACE_TEXT
-# define ASYS_ONLY_MULTIBYTE_STRING ACE_TEXT_ALWAYS_CHAR
-# define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR
-# define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
-# define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
-
-# if defined (ACE_USES_WCHAR)
-# define ASYS_ONLY_WIDE_STRING(STRING) STRING
-# else /* ACE_USES_WCHAR */
-# define ASYS_ONLY_WIDE_STRING(STRING) \
- ACE_Ascii_To_Wide (STRING).wchar_rep ()
-# endif /* ACE_USES_WCHAR */
-
-# define ACE_TEXT_STRING ACE_TString
-
-#endif /* ACE_LEGACY_MODE */
-
-#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
-# if !defined (ACE_HAS_WCHAR)
-# define ACE_HAS_WCHAR
-# endif
-# include /**/ <wchar.h>
-#endif /* ACE_HAS_XPG4_MULTIBYPTE_CHAR */
-
-#if defined (ACE_HAS_WCHAR)
-# if defined (ACE_VXWORKS)
+#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 /**/ <stdlib.h> /* For mbstowcs, etc. */
-# include /**/ <string.h> /* For strlen */
-# if !defined (__RTP__)
-# define wint_t unsigned int /* VxWorks has wchar_t but not wint_t */
-# else
-# include /**/ <wchar.h>
-# include /**/ <wctype.h>
-# endif
+# 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 */
-#endif /* ACE_HAS_WCHAR */
#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 */
-// This makes the somewhat dubious assumption that if a platform lacks
-// a native wchar_t type, then it will typedef it as unsigned short.
-#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_NATIVE_WCHAR_T)
-# if !defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
-# define ACE_WSTRING_HAS_USHORT_SUPPORT
-# endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
-#endif /* ACE_HAS_WCHAR && !ACE_LACKS_NATIVE_WCHAR_T */
-
// 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
@@ -110,26 +76,6 @@ using std::size_t;
# define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING)
# endif /* ACE_TEXT_WIDE */
-#if defined (ACE_USES_WCHAR)
-typedef wchar_t ACE_TCHAR;
-typedef char ACE_ANTI_TCHAR;
-# define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE (STRING)
-# define ACE_TEXT_ALWAYS_CHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
-# define ACE_TEXT_ALWAYS_WCHAR(STRING) STRING
-# define ACE_TEXT_CHAR_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
-# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) STRING
-# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
-#else /* ACE_USES_WCHAR */
-typedef char ACE_TCHAR;
-typedef wchar_t ACE_ANTI_TCHAR;
-# define ACE_LIB_TEXT(STRING) STRING
-# define ACE_TEXT_ALWAYS_CHAR(STRING) STRING
-# define ACE_TEXT_ALWAYS_WCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
-# define ACE_TEXT_CHAR_TO_TCHAR(STRING) STRING
-# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
-# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
-#endif /* ACE_USES_WCHAR */
-
#if defined (ACE_LEGACY_MODE)
# define ACE_TEXT TEXT
#else /* ACE_LEGACY_MODE */
@@ -161,188 +107,33 @@ typedef wchar_t ACE_ANTI_TCHAR;
#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
-#if defined ACE_HAS_WCHAR
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-
-/**
- * @class ACE_Wide_To_Ascii
- *
- * @brief A lightweight wchar* to char* string conversion class.
- *
- * The purpose of this class is to perform conversion from
- * wchar* to char* strings. It is not intended for general
- * purpose use.
- */
-class ACE_Wide_To_Ascii
-{
-public:
- /// Ctor must take a wchar string.
- ACE_Wide_To_Ascii (const wchar_t *s);
-
- /// Dtor will free up the memory.
- ~ACE_Wide_To_Ascii (void);
-
- /// Return the internal char* representation.
- char *char_rep (void);
-
- /// Converts an wchar_t string to ascii and returns a new string.
- static char *convert (const wchar_t *wstr);
-
-private:
- /// Internal pointer to the converted string.
- char *s_;
-
- /// Disallow these operation.
- ACE_Wide_To_Ascii (void);
- ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &);
- ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &);
-};
-
-/**
- * @class ACE_Ascii_To_Wide
- *
- * @brief A lightweight char* to wchar* string conversion class.
- *
- * The purpose of this class is to perform conversion from
- * char* to wchar* strings. It is not intended for general
- * purpose use.
- */
-class ACE_Ascii_To_Wide
-{
-public:
- /// Ctor must take a wchar string.
- ACE_Ascii_To_Wide (const char *s);
-
- /// Dtor will free up the memory.
- ~ACE_Ascii_To_Wide (void);
-
- /// Return the internal wchar* representation.
- wchar_t *wchar_rep (void);
-
- /// Converts an char string to unicode/wide and returns a new string.
- static wchar_t *convert (const char *str);
-
-private:
- /// Internal pointer to the converted string.
- wchar_t *s_;
-
- /// Disallow these operation.
- ACE_Ascii_To_Wide (void);
- ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &);
- ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &);
-};
-
-#if defined (ACE_LEGACY_MODE)
-typedef ACE_Ascii_To_Wide ACE_OS_CString;
-typedef ACE_Wide_To_Ascii ACE_OS_WString;
-#endif /* ACE_LEGACY_MODE */
-
-ACE_END_VERSIONED_NAMESPACE_DECL
-
-#endif /* ACE_HAS_WCHAR */
-
-#if defined (ACE_WIN32)
#if defined (ACE_USES_WCHAR)
-#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYW
-#define ACE_TEXT_STARTUPINFO STARTUPINFOW
-#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW
-
-#define ACE_TEXT_CreateEvent ::CreateEventW
-#define ACE_TEXT_CreateFile ::CreateFileW
-#define ACE_TEXT_CreateFileMapping ::CreateFileMappingW
-#define ACE_TEXT_CreateMutex ::CreateMutexW
-#define ACE_TEXT_CreateProcess ::CreateProcessW
-#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreW
-#define ACE_TEXT_CreateService ::CreateServiceW
-#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsW
-#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationW
-#define ACE_TEXT_FindFirstFile ::FindFirstFileW
-#define ACE_TEXT_FindNextFile ::FindNextFileW
-#define ACE_TEXT_FormatMessage ::FormatMessageW
-#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsW
-#define ACE_TEXT_GetComputerName ::GetComputerNameW
-#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsW
-#define ACE_TEXT_GetFileAttributes ::GetFileAttributesW
-#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameW
-#define ACE_TEXT_GetTempPath ::GetTempPathW
-#define ACE_TEXT_GetUserName ::GetUserNameW
-#define ACE_TEXT_LoadLibrary ::LoadLibraryW
-#define ACE_TEXT_MoveFileEx ::MoveFileExW
-#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeW
-#define ACE_TEXT_OpenFileMapping ::OpenFileMappingW
-#define ACE_TEXT_OpenSCManager ::OpenSCManagerW
-#define ACE_TEXT_OpenService ::OpenServiceW
-#define ACE_TEXT_OutputDebugString ::OutputDebugStringW
-#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceW
-#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerW
-#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryW
-#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExW
-#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyW
-#define ACE_TEXT_RegDeleteValue ::RegDeleteValueW
-#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExW
-#define ACE_TEXT_RegEnumValue ::RegEnumValueW
-#define ACE_TEXT_RegCreateKey ::RegCreateKeyW
-#define ACE_TEXT_RegOpenKey ::RegOpenKeyW
-#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExW
-#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExW
-#define ACE_TEXT_RegSetValueEx ::RegSetValueExW
-#define ACE_TEXT_ReportEvent ::ReportEventW
-#define ACE_TEXT_SearchPath ::SearchPathW
-#define ACE_TEXT_StartService ::StartServiceW
-#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherW
-
+ typedef wchar_t ACE_TCHAR;
+ typedef char ACE_ANTI_TCHAR;
+ # define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE( STRING )
#else /* ACE_USES_WCHAR */
-#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA
-#define ACE_TEXT_STARTUPINFO STARTUPINFOA
-#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA
-
-#define ACE_TEXT_CreateEvent ::CreateEventA
-#define ACE_TEXT_CreateFile ::CreateFileA
-#define ACE_TEXT_CreateFileMapping ::CreateFileMappingA
-#define ACE_TEXT_CreateMutex ::CreateMutexA
-#define ACE_TEXT_CreateProcess ::CreateProcessA
-#define ACE_TEXT_CreateSemaphore ::CreateSemaphoreA
-#define ACE_TEXT_CreateService ::CreateServiceA
-#define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsA
-#define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationA
-#define ACE_TEXT_FindFirstFile ::FindFirstFileA
-#define ACE_TEXT_FindNextFile ::FindNextFileA
-#define ACE_TEXT_FormatMessage ::FormatMessageA
-#define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsA
-#define ACE_TEXT_GetComputerName ::GetComputerNameA
-#define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsA
-#define ACE_TEXT_GetFileAttributes ::GetFileAttributesA
-#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameA
-#define ACE_TEXT_GetTempPath ::GetTempPathA
-#define ACE_TEXT_GetUserName ::GetUserNameA
-#define ACE_TEXT_LoadLibrary ::LoadLibraryA
-#define ACE_TEXT_MoveFileEx ::MoveFileExA
-#define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeA
-#define ACE_TEXT_OpenFileMapping ::OpenFileMappingA
-#define ACE_TEXT_OpenSCManager ::OpenSCManagerA
-#define ACE_TEXT_OpenService ::OpenServiceA
-#define ACE_TEXT_OutputDebugString ::OutputDebugStringA
-#define ACE_TEXT_RegisterEventSource ::RegisterEventSourceA
-#define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerA
-#define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryA
-#define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExA
-#define ACE_TEXT_RegDeleteKey ::RegDeleteKeyA
-#define ACE_TEXT_RegDeleteValue ::RegDeleteValueA
-#define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExA
-#define ACE_TEXT_RegEnumValue ::RegEnumValueA
-#define ACE_TEXT_RegCreateKey ::RegCreateKeyA
-#define ACE_TEXT_RegOpenKey ::RegOpenKeyA
-#define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExA
-#define ACE_TEXT_RegQueryValueEx ::RegQueryValueExA
-#define ACE_TEXT_RegSetValueEx ::RegSetValueExA
-#define ACE_TEXT_ReportEvent ::ReportEventA
-#define ACE_TEXT_SearchPath ::SearchPathA
-#define ACE_TEXT_StartService ::StartServiceA
-#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherA
+ typedef char ACE_TCHAR;
+ typedef wchar_t ACE_ANTI_TCHAR;
+ # define ACE_LIB_TEXT(STRING) STRING
#endif /* ACE_USES_WCHAR */
-#endif /* ACE_WIN32 */
-#include "ace/ace_wchar.inl"
+#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 */
diff --git a/ace/config-all.h b/ace/config-all.h
index 9c0f3bf6efc..3763d81dc8f 100644
--- a/ace/config-all.h
+++ b/ace/config-all.h
@@ -72,6 +72,9 @@
# include "ace/Trace.h"
#endif /* ACE_OS_NTRACE */
+// Include the string conversion services here for backward compatibility
+#include "ace/String_Conversion_T.h"
+
// These includes are here to avoid circular dependencies.
// Keep this at the bottom of the file. It contains the main macros.
#include "ace/OS_main.h"
diff --git a/ace/config-borland-common.h b/ace/config-borland-common.h
index b692f07aecd..ab35738edca 100644
--- a/ace/config-borland-common.h
+++ b/ace/config-borland-common.h
@@ -64,7 +64,9 @@
# define ACE_HAS_NEW_NOTHROW
# define ACE_TEMPLATES_REQUIRE_SOURCE 1
# define ACE_SIZEOF_LONG_DOUBLE 10
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Lu")
+# define ACE_TEMPLATES_REQUIRE_SOURCE 1
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%Lu"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld")
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 0
diff --git a/ace/config-doxygen.h b/ace/config-doxygen.h
index d779436acd3..bb80a9c2b87 100644
--- a/ace/config-doxygen.h
+++ b/ace/config-doxygen.h
@@ -18,9 +18,6 @@
/// Make sure that we always turn inlining on.
#define __ACE_INLINE__
-/// Make the wchar_t interfaces available.
-#define ACE_HAS_WCHAR
-
/// Make all the emulation versions of string operations visible
// #define ACE_LACKS_WCSTOK
#define ACE_LACKS_ITOW
diff --git a/ace/config-freebsd.h b/ace/config-freebsd.h
index 6ed6e250bcc..e4bd5543a7c 100644
--- a/ace/config-freebsd.h
+++ b/ace/config-freebsd.h
@@ -256,7 +256,6 @@ typedef union sigval sigval_t;
#define ACE_LACKS_STROPTS_H
-// Needed when ACE_HAS_WCHAR is defined.
#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_WCSICMP
#define ACE_LACKS_WCSDUP
diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h
index 38c5fe91bb0..c40ada25f69 100644
--- a/ace/config-hpux-11.00.h
+++ b/ace/config-hpux-11.00.h
@@ -147,8 +147,6 @@
// Platform has XPG4 wide character support
# define ACE_HAS_XPG4_MULTIBYTE_CHAR
-# define ACE_HAS_WCHAR
-# define ACE_SIZEOF_WCHAR _WCHAR_T
# endif /* __cplusplus < 199707L */
diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h
index a0f91d1f175..7323735b3de 100644
--- a/ace/config-linux-common.h
+++ b/ace/config-linux-common.h
@@ -230,7 +230,7 @@
# endif /* __cplusplus */
#endif /* ! __GNUG__ && ! __KCC */
-// Completely common part :-)
+// Completely common part :-)
// Platform/compiler has the sigwait(2) prototype
# define ACE_HAS_SIGWAIT
@@ -287,6 +287,12 @@
#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES
+// ACE WChar support
+#define ACE_SIZEOF_WCHAR 4
+#define ACE_WCHAR_MAX 0x7FFFFFFF
+#define ACE_LACKS_BUILTIN_WCHAR_T
+
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
@@ -384,9 +390,12 @@
#if defined (__ia64) || defined(__alpha) || defined (__x86_64__)
// On 64 bit platforms, the "long" type is 64-bits. Override the
// default 32-bit platform-specific format specifiers appropriately.
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
-# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld")
-# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%lu"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
+# define ACE_SSIZE_T_FORMAT_SPECIFIER_A "%ld"
+# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_A)
+# define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu"
+# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
#endif /* __ia64 */
#define ACE_SIZEOF_WCHAR 4
@@ -415,3 +424,4 @@
#include /**/ "ace/post.h"
#endif /* ACE_LINUX_COMMON_H */
+
diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h
index bcb1635aac0..6f837b09f50 100644
--- a/ace/config-lynxos.h
+++ b/ace/config-lynxos.h
@@ -21,6 +21,11 @@
# define ACE_NEEDS_IPC_1C_H
#endif /* ACE_LYNXOS_MAJOR */
+// Describe the native wchar_t
+#define ACE_SIZEOF_WCHAR 4
+#define ACE_WCHAR_MAX 0x7fffffff
+#define ACE_LACKS_BUILTIN_WCHAR_T
+
#if defined (__x86__)
# define ACE_HAS_PENTIUM
#elif defined (__powerpc__)
@@ -100,6 +105,32 @@
#define ACE_LACKS_TIMESPEC_T
#define ACE_LACKS_UCONTEXT_H
#define ACE_LACKS_WCHAR_H
+#define ACE_LACKS_WCSLEN
+#define ACE_LACKS_WCSNCPY
+#define ACE_LACKS_WCSTOUL
+#define ACE_LACKS_WCSTOL
+#define ACE_LACKS_WCSTOD
+#define ACE_LACKS_ITOW
+#define ACE_LACKS_WCSTOK
+#define ACE_LACKS_WCSSTR
+#define ACE_LACKS_WCSSPN
+#define ACE_LACKS_WCSRCHR
+#define ACE_LACKS_WCSPBRK
+#define ACE_LACKS_WCSNCMP
+#define ACE_LACKS_WCSNCAT
+#define ACE_LACKS_WCSCSPN
+#define ACE_LACKS_WCSCPY
+#define ACE_LACKS_WCSCMP
+#define ACE_LACKS_WCSCHR
+#define ACE_LACKS_WCSCAT
+#define ACE_LACKS_TOWLOWER
+#define ACE_LACKS_TOWUPPER
+#define ACE_LACKS_FGETWC
+#define ACE_LACKS_UNGETWC
+#define ACE_LACKS_FGETWS
+#define ACE_LACKS_FPUTWS
+#define ACE_LACKS_WCSICMP
+#define ACE_LACKS_WCSNICMP
#define ACE_LACKS_SUSECONDS_T
#define ACE_LACKS_USECONDS_T
#define ACE_MALLOC_ALIGN 8
diff --git a/ace/config-macosx-panther.h b/ace/config-macosx-panther.h
index 8807bdf17fa..c8308edb975 100644
--- a/ace/config-macosx-panther.h
+++ b/ace/config-macosx-panther.h
@@ -16,8 +16,9 @@
#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
+#define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu"
+#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
#define ACE_LACKS_SUSECONDS_T
-#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
#if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
diff --git a/ace/config-macosx-tiger.h b/ace/config-macosx-tiger.h
index 1345bc18193..5b897b6d9ba 100644
--- a/ace/config-macosx-tiger.h
+++ b/ace/config-macosx-tiger.h
@@ -18,7 +18,8 @@
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR
#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
-#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
+#define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu"
+#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
#if !defined (ACE_SIZEOF_LONG_DOUBLE)
# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3)
diff --git a/ace/config-macosx.h b/ace/config-macosx.h
index 7238c440bfd..a6d1f1d7521 100644
--- a/ace/config-macosx.h
+++ b/ace/config-macosx.h
@@ -16,7 +16,8 @@
#undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
-#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
+#define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu"
+#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
#if defined (ACE_HAS_PENTIUM)
# undef ACE_HAS_PENTIUM
diff --git a/ace/config-netbsd.h b/ace/config-netbsd.h
index 1c7f52f3cf7..d92e16c32e4 100644
--- a/ace/config-netbsd.h
+++ b/ace/config-netbsd.h
@@ -84,7 +84,6 @@
#define ACE_HAS_UCONTEXT_T 1
#define ACE_HAS_VOIDPTR_MMAP 1
#define ACE_HAS_VOIDPTR_SOCKOPT 1
-#define ACE_HAS_WCHAR 1
#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1
#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1
#define ACE_IOCTL_TYPE_ARG2 u_long
@@ -135,8 +134,10 @@
typedef unsigned long ACE_UINT64;
typedef signed long ACE_INT64;
-#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld")
-#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu")
+#define ACE_SSIZE_T_FORMAT_SPECIFIER_A "%ld"
+#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_A)
+#define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu"
+#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A)
#elif defined(__i386__)
#define ACE_HAS_PENTIUM 1
diff --git a/ace/config-pharlap.h b/ace/config-pharlap.h
index fa274e22383..928e3395f9c 100644
--- a/ace/config-pharlap.h
+++ b/ace/config-pharlap.h
@@ -54,7 +54,6 @@
// Let the config-win32.h file do its thing
#undef ACE_CONFIG_H
#include "ace/config-win32.h"
-#undef ACE_HAS_WCHAR
#include /**/ <embkern.h>
#if defined (ACE_HAS_PHARLAP_RT)
diff --git a/ace/config-rtems.h b/ace/config-rtems.h
index cb93a725dec..81cb8778a8f 100644
--- a/ace/config-rtems.h
+++ b/ace/config-rtems.h
@@ -135,8 +135,6 @@ ACE_HAS_SEND_TIMEDWAIT
ACE_HAS_SENDTO_TIMEDWAIT
ACE_HAS_IP_MULTICAST
ACE_HAS_NONCONST_SELECT_TIMEVAL
-ACE_HAS_WCHAR_TYPEDEFS_CHAR
-ACE_HAS_WCHAR_TYPEDEFS_USHORT
ACE_HAS_SIGNAL_SAFE_OS_CALLS
ACE_HAS_SIZET_SOCKET_LEN
ACE_HAS_SOCKADDR_MSG_NAME
diff --git a/ace/config-tandem-nsk-mips-v2.h b/ace/config-tandem-nsk-mips-v2.h
index cba5b7b8148..fe35e30ba68 100644
--- a/ace/config-tandem-nsk-mips-v2.h
+++ b/ace/config-tandem-nsk-mips-v2.h
@@ -241,7 +241,8 @@ typedef enum CMA_T_SCHED_POLICY {
#define ACE_HRTIME_T_IS_BASIC_TYPE
// printf format specifiers for 64 bit integers
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld")
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%Ld"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%Ld")
//=========================================================================
diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h
index ae13a39d880..146c5d65e86 100644
--- a/ace/config-vxworks5.x.h
+++ b/ace/config-vxworks5.x.h
@@ -36,6 +36,11 @@
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
+// ACE WChar support
+#define ACE_SIZEOF_WCHAR 4
+#define ACE_WCHAR_MAX 0xFFFFFFFF
+#undef ACE_LACKS_BUILTIN_WCHAR_T
+
// An explicit check for Tornado 2.1, which had very limited release.
// See include/makeinclude/platform_vxworks5.x_g++.GNU for details
// on version conventions used by ACE for VxWorks.
@@ -140,8 +145,11 @@
#define ACE_LACKS_ACCESS
#define ACE_LACKS_EXEC
#define ACE_LACKS_FCNTL
+#define ACE_LACKS_FGETWC
+#define ACE_LACKS_FGETWS
#define ACE_LACKS_FILELOCKS
#define ACE_LACKS_FORK
+#define ACE_LACKS_FPUTWS
#define ACE_LACKS_FSYNC
#define ACE_LACKS_GETHOSTENT
#define ACE_LACKS_GETOPT
@@ -196,6 +204,7 @@
#define ACE_LACKS_NATIVE_STRPTIME
#define ACE_LACKS_WAIT
#define ACE_LACKS_WAITPID
+#define ACE_LACKS_WCTYPE_H
#define ACE_LACKS_DUP2
#define ACE_LACKS_DUP
#define ACE_LACKS_SUSECONDS_T
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index 9b53c7143fd..bc8964d2ab9 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -295,6 +295,13 @@
#define ACE_UINT64_TYPE unsigned long long
#endif
+// ACE WChar support
+#define ACE_SIZEOF_WCHAR 2
+#define ACE_WCHAR_MAX 0xFFFF
+#if !defined(_NATIVE_WCHAR_T_DEFINED)
+# define ACE_LACKS_BUILTIN_WCHAR_T
+#endif
+
// Optimize ACE_Handle_Set for select().
#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT
@@ -302,12 +309,6 @@
// is controlled in compiler configs since it's a compiler switch.
// Additionally, if the user selected use of wide chars (by setting either
// ACE_USES_WCHAR or UNICODE) make sure both are enabled.
-#define ACE_HAS_WCHAR
-#if defined (ACE_USES_WCHAR)
-# ifndef UNICODE
-# define UNICODE
-# endif
-#endif /* ACE_USES_WCHAR */
#if defined (UNICODE) && !defined (ACE_USES_WCHAR)
# define ACE_USES_WCHAR
#endif /* UNICODE && !ACE_USES_WCHAR */
diff --git a/ace/config-win32-dmc.h b/ace/config-win32-dmc.h
index 6012e44620e..fa623098e74 100644
--- a/ace/config-win32-dmc.h
+++ b/ace/config-win32-dmc.h
@@ -23,7 +23,6 @@
# undef ACE_LACKS_STRUCT_DIR
#endif
-// Changed ACE_TEXT to ACE_LIB_TEXT in the following line
# define ACE_CC_NAME ACE_LIB_TEXT ("Digital Mars")
# define ACE_CC_MAJOR_VERSION (1)
# define ACE_CC_MINOR_VERSION (8)
@@ -66,7 +65,6 @@
//# define ACE_NEW_THROWS_EXCEPTIONS 1
# define ACE_SIZEOF_LONG_DOUBLE 10
# define ACE_TEMPLATES_REQUIRE_SOURCE 1
-// Changed ACE_TEXT to ACE_LIB_TEXT in the following two lines
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# define ACE_HAS_STRBUF_T
#define ACE_HAS_3_PARAM_WCSTOK
diff --git a/ace/config-win32-ghs.h b/ace/config-win32-ghs.h
index 2d332f58e16..e4c2ef327f4 100644
--- a/ace/config-win32-ghs.h
+++ b/ace/config-win32-ghs.h
@@ -25,11 +25,9 @@
//Green Hills Native x86 does not support structural exceptions
# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS
-# undef ACE_HAS_WCHAR
# define ACE_CONFIG_INCLUDE_GHS_COMMON
# include "ace/config-ghs-common.h"
-// Changed ACE_TEXT to ACE_LIB_TEXT in the following line
# define ACE_CC_NAME ACE_LIB_TEXT ("Green Hills C++")
# define ACE_CC_MAJOR_VERSION (1)
# define ACE_CC_MINOR_VERSION (8)
@@ -76,8 +74,8 @@
//# define ACE_NEW_THROWS_EXCEPTIONS 1
# define ACE_SIZEOF_LONG_DOUBLE 10
# define ACE_TEMPLATES_REQUIRE_SOURCE 1
-// Changed ACE_TEXT to ACE_LIB_TEXT in the following two lines
-# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
+# define ACE_UINT64_FORMAT_SPECIFIER_A "%I64u"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
// Set the following to zero to placate SString.h ACE_WString CTOR
diff --git a/ace/config-win32-mingw.h b/ace/config-win32-mingw.h
index 104b40c6c04..c49dcd97115 100644
--- a/ace/config-win32-mingw.h
+++ b/ace/config-win32-mingw.h
@@ -99,7 +99,8 @@
#endif
#define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
-#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
+#define ACE_UINT64_FORMAT_SPECIFIER_A "%I64u"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) (STATUS))
diff --git a/ace/config-win32-msvc-7.h b/ace/config-win32-msvc-7.h
index fd28598d0f4..2fbae1e20aa 100644
--- a/ace/config-win32-msvc-7.h
+++ b/ace/config-win32-msvc-7.h
@@ -66,7 +66,8 @@
#define ACE_HAS_TEMPLATE_SPECIALIZATION
#define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
-#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
+#define ACE_UINT64_FORMAT_SPECIFIER_A "%I64u"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
diff --git a/ace/config-win32-msvc-8.h b/ace/config-win32-msvc-8.h
index 6fbcca6de4c..897bf4b44f4 100644
--- a/ace/config-win32-msvc-8.h
+++ b/ace/config-win32-msvc-8.h
@@ -64,7 +64,8 @@
#define ACE_HAS_TEMPLATE_SPECIALIZATION
#define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64d")
-#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
+#define ACE_UINT64_FORMAT_SPECIFIER_A "%I64u"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
// Platform provides ACE_TLI function prototypes.
// For Win32, this is not really true, but saves a lot of hassle!
diff --git a/ace/config-win32-msvc.h b/ace/config-win32-msvc.h
index 77bcedec66f..68713115275 100644
--- a/ace/config-win32-msvc.h
+++ b/ace/config-win32-msvc.h
@@ -55,7 +55,7 @@
#endif /* _CPPRTTI */
#if ! defined(_NATIVE_WCHAR_T_DEFINED)
- #define ACE_LACKS_NATIVE_WCHAR_T
+ #define ACE_LACKS_BUILTIN_WCHAR_T
#endif
// Win Mobile still does thread exits differently than PC Windows.
diff --git a/ace/config-win32-visualage.h b/ace/config-win32-visualage.h
index 451687a00b2..1a3ac304e0c 100644
--- a/ace/config-win32-visualage.h
+++ b/ace/config-win32-visualage.h
@@ -74,7 +74,8 @@
#define ACE_SIZEOF_LONG_DOUBLE 10
#define ACE_TEMPLATES_REQUIRE_SOURCE 1
#define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS 1
-#define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%I64u")
+#define ACE_UINT64_FORMAT_SPECIFIER_A "%I64u"
+# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_UINT64_FORMAT_SPECIFIER_A)
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_LACKS_NET_IF_H
diff --git a/ace/os_include/os_stddef.h b/ace/os_include/os_stddef.h
index 87bcbdd2e36..f909488e16b 100644
--- a/ace/os_include/os_stddef.h
+++ b/ace/os_include/os_stddef.h
@@ -72,12 +72,6 @@ extern "C"
value equal to its value when used as the lone character in an integer
character constant.
*/
-#if defined (ACE_LACKS_WCHAR_T)
-# if !defined (ACE_WCHAR_T_TYPE)
-# define ACE_WCHAR_T_TYPE long;
-# endif /* !ACE_WCHAR_T_TYPE */
- typedef ACE_WCHAR_T_TYPE wchar_t;
-#endif /* ACE_LACKS_WCHAR_T */
// Unsigned integer type of the result of the sizeof operator.
#if defined (ACE_LACKS_SIZE_T)