summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2003-04-16 20:57:05 +0000
committerSteve Huston <shuston@riverace.com>2003-04-16 20:57:05 +0000
commit1de1cfc6d4a4ae18177d261f2f41986d04072377 (patch)
tree6db0a279af61014650d05783e89be22ff06d1347
parent7a96e9028753f86ff5b2b8fd80f5534720e84501 (diff)
downloadATCD-1de1cfc6d4a4ae18177d261f2f41986d04072377.tar.gz
ChangeLogTag:Fri Mar 28 16:04:28 2003 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog23
-rw-r--r--ace/Makefile.ace4
-rw-r--r--ace/OS.cpp158
-rw-r--r--ace/OS.h99
-rw-r--r--ace/OS.i16
-rw-r--r--ace/config-win32-common.h2
-rw-r--r--bin/PerlACE/Process_Win32.pm8
-rw-r--r--docs/ACE-subsets.html4
8 files changed, 74 insertions, 240 deletions
diff --git a/ChangeLog b/ChangeLog
index 034d680248a..7211516e4a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1086,6 +1086,29 @@ Sat Mar 29 16:34:56 2003 Balachandran Natarajan <bala@isis-server.isis.vanderb
* THANKS: Added Bertin Colpron to the hall of fame.
+Fri Mar 28 16:04:28 2003 Steve Huston <shuston@riverace.com>
+
+ * ace/OS.{h,i,cpp} (string_to_argv): Use ACE_LIB_TEXT around characters
+ to make them compare correctly when ACE_USES_WCHAR. Fixes this
+ method for use with CE. Obviates the need for ACE_CE_ARGV, which
+ is now gone. Users of ACE_CE_ARGV should use ACE_ARGV, which does
+ the same thing as ACE_CE_ARGV.
+ Also added /**/ to #include <sys/mman.h> to prevent warnings from
+ Visual C++.
+
+ * ace/config-win32-common.h: Corrected the Winsock 2, WinCE checks to
+ check for UNDER_CE >= 400, not == 4.
+
+ * ace/Makefile.ace:
+ * docs/ACE-subsets.html: Moved ARGV and Argv_Type_Converter from UTILS
+ to OS; getting command lines correct is needed for basic OS function.
+
+ * bin/PerlACE/Process_Win32.pm: Move the pocketcontroller-required
+ sleep from after each test to before it. This accounts for the
+ need to sleep after copying the initial DLLs and test files down
+ before beginning the test runs. The copying does a reset, requiring
+ some delay before attempting the first test.
+
Fri Mar 28 10:18:48 2003 Steve Huston <shuston@riverace.com>
* bin/PerlACE/Process_Win32.pm: For WinCE, when generating the
diff --git a/ace/Makefile.ace b/ace/Makefile.ace
index a20dc307cbc..7d423f88b36 100644
--- a/ace/Makefile.ace
+++ b/ace/Makefile.ace
@@ -10,6 +10,8 @@ LIB = $(LIBACE).a
SHLIB = $(LIBACE).$(SOEXT)
OS_FILES = \
+ ARGV \
+ Argv_Type_Converter \
Basic_Types \
Time_Value \
OS \
@@ -30,8 +32,6 @@ UTILS_FILES = \
ACE \
Active_Map_Manager \
Arg_Shifter \
- ARGV \
- Argv_Type_Converter \
Capabilities \
Containers \
Configuration \
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 09d88b6a746..801ab5d246d 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -3914,29 +3914,29 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
// First pass: count arguments.
// '#' is the start-comment token..
- while (*cp != '\0' && *cp != '#')
+ 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 != '\0')
+ if (*cp != ACE_LIB_TEXT ('\0'))
argc++;
- while (*cp != '\0' && !ACE_OS::ace_isspace (*cp))
+ while (*cp != ACE_LIB_TEXT ('\0') && !ACE_OS::ace_isspace (*cp))
{
// Grok quotes....
- if (*cp == '\'' || *cp == '"')
+ if (*cp == ACE_LIB_TEXT ('\'') || *cp == ACE_LIB_TEXT ('"'))
{
ACE_TCHAR quote = *cp;
// Scan past the string..
- for (cp++; *cp != '\0' && *cp != quote; cp++)
+ for (cp++; *cp != ACE_LIB_TEXT ('\0') && *cp != quote; cp++)
continue;
// '\0' implies unmatched quote..
- if (*cp == '\0')
+ if (*cp == ACE_LIB_TEXT ('\0'))
{
argc--;
break;
@@ -3975,12 +3975,12 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
// Copy next argument and move to next whitespace..
cp = argp;
- while (*ptr != '\0' && !ACE_OS::ace_isspace (*ptr))
- if (*ptr == '\'' || *ptr == '"')
+ 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 != '\0' && *ptr != quote)
+ while (*ptr != ACE_LIB_TEXT ('\0') && *ptr != quote)
*cp++ = *ptr++;
if (*ptr == quote)
@@ -3989,7 +3989,7 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
else
*cp++ = *ptr++;
- *cp = '\0';
+ *cp = ACE_LIB_TEXT ('\0');
#if !defined (ACE_LACKS_ENV)
// Check for environment variable substitution here.
@@ -4016,8 +4016,8 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf,
errno = ENOMEM;
return -1;
}
- }
- }
+ }
+ }
if (argp != arg)
delete [] argp;
@@ -6955,140 +6955,6 @@ ACE_OS_Object_Manager_Manager::~ACE_OS_Object_Manager_Manager (void)
static ACE_OS_Object_Manager_Manager ACE_OS_Object_Manager_Manager_instance;
#endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */
-# if defined (ACE_HAS_WINCE)
-ACE_CE_ARGV::ACE_CE_ARGV(ACE_TCHAR* cmdLine)
-: ce_argv_(0)
-, ce_argc_(0)
-{
- // Note: ACE has argv parser and processor; however, they cannot be
- // used because of dependency. ACE_OS is now separate from ACE, and
- // ACE depends on ACE_OS. Still, using all this array and complicated
- // pointer manipulation should be considered to be replaced and use STL
- // (or something) for better readability and code management. Also,
- // string_to_argv() does not work well for CE argv because of incorrect
- // '"' identification.
- const ACE_TCHAR* dummyArgv = ACE_TEXT("root"); // dummy for the first argv
- const ACE_TCHAR* separator = ACE_TEXT(" "); // blank space is a separator
-
- int formattedCmdLineLength =
- ACE_OS::strlen(dummyArgv) + ACE_OS::strlen(separator) + 1; // for 0 term.
- if (ACE_OS::strlen(cmdLine) > 0)
- {
- formattedCmdLineLength += ACE_OS::strlen(cmdLine);
- formattedCmdLineLength += ACE_OS::strlen(separator);
- }
-
- // formattedCmdLine will have dummyArgv and a separator at the beginning
- // of cmdLine and a separator at the end to generalize format and reduce
- // the amount of code.
- ACE_TCHAR* formattedCmdLine = 0;
- ACE_NEW(formattedCmdLine, ACE_TCHAR[formattedCmdLineLength]);
-
- ACE_OS::strcpy(formattedCmdLine, dummyArgv);
- ACE_OS::strcat(formattedCmdLine, separator);
-
- // start with 1 because of the dummyArgv at the beginning
- int max_possible_argc = 1;
- if (ACE_OS::strlen(cmdLine) > 0)
- {
- int formattedPos = ACE_OS::strlen(formattedCmdLine);
- int cmdLineLength = ACE_OS::strlen(cmdLine);
-
- // Inside of this for loop, it does same thing as strcat except it
- // checks and puts only one single white space between two argv entries.
- for (int i = 0; i < cmdLineLength; ++i)
- {
- if (iswspace(cmdLine[i]) != 0)
- ++max_possible_argc; // counting the number of white spaces
-
- formattedCmdLine[formattedPos++] = cmdLine[i];
-
- if (iswspace(cmdLine[i]) != 0)
- {
- // make sure there is only one white space between two
- // argv entries.
- while ((i < cmdLineLength) && (iswspace(cmdLine[i + 1]) != 0))
- ++i;
- }
- }
-
- formattedCmdLine[formattedPos] = 0;
- // make sure formattedCmdLine ends with a blank
- ACE_OS::strcat (formattedCmdLine, separator);
- }
-
- int formattedCmdLength = ACE_OS::strlen(formattedCmdLine);
-
- int insideQuotation = 0;
- int* argv_strlen = 0;
- int entry_size = 0;
- ACE_NEW (argv_strlen, int[max_possible_argc]);
-
- // determine argc
- for (int i = 0; i < formattedCmdLength; ++i)
- {
- if (formattedCmdLine[i] == '\\')
- {
- ++i; // ignore the following character
- ++entry_size;
- }
- else if (formattedCmdLine[i] == '"')
- {
- insideQuotation = (insideQuotation ? 0 : 1);
- }
- else if ((!insideQuotation) && (iswspace(formattedCmdLine[i]) != 0))
- {
- // new argv entry end found
- argv_strlen[ce_argc_++] = entry_size; // cache this entry size
- entry_size = 0;
- }
- else
- {
- ++entry_size;
- }
- }
-
- ACE_NEW (ce_argv_, ACE_TCHAR*[ce_argc_ + 1]);
- ce_argv_[ce_argc_] = 0; // Last command line entry is a NULL.
-
- for (int j = 0, cmdLinePos = 0; j < ce_argc_; ++j, ++cmdLinePos)
- {
- int length = argv_strlen[j];
-
- ACE_NEW (ce_argv_[j], ACE_TCHAR[length + 1]);
- ce_argv_[j][length] = 0; // string termination null
-
- if (iswspace (formattedCmdLine[cmdLinePos]) != 0)
- {
- // This is where prior argv has trailing '"' at the end.
- ++cmdLinePos;
- }
-
- for (int n = 0; n < length; ++n, ++cmdLinePos)
- {
- if ((formattedCmdLine[cmdLinePos] == '\\') ||
- (formattedCmdLine[cmdLinePos] == '"') )
- {
- ++cmdLinePos;
- }
-
- ce_argv_[j][n] = formattedCmdLine[cmdLinePos];
- }
- }
-
- delete argv_strlen;
- delete formattedCmdLine;
-}
-
-ACE_CE_ARGV::~ACE_CE_ARGV(void)
-{
- for (int i = 0; i < ce_argc_; ++i)
- delete [] ce_argv_[i];
-
- delete [] ce_argv_;
-}
-# endif // ACE_HAS_WINCE
-
// You may be asking yourself, why are we doing this? Well, in winbase.h,
// MS didn't follow their normal Api_FunctionA and Api_FunctionW style,
// so we have to #undef their define to get access to the unicode version.
diff --git a/ace/OS.h b/ace/OS.h
index 64469f60437..81478b21f02 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -6767,96 +6767,50 @@ ACE_MAIN () /* user's entry point, e.g., "main" w/out argc, argv */ \
} \
int \
ace_main_i
+
# elif defined (ACE_HAS_WINCE)
-/**
- * @class ACE_CE_ARGV
- *
- * @brief This class is to hash input parameters, argc and argv, for
- * WinCE platform.
- *
- * Since WinCE only supports wchar_t as an input from OS, some
- * implementation detail, especially for CORBA spec, will not support
- * ACE_TCHAR (wchar_t) type parameter. Moreover, WinCE's input parameter
- * type is totally different than any other OS; all command line
- * parameters will be stored in a single wide-character string with
- * each unit parameter divided by blank space, and it does not provide
- * the name of executable (generally known as argv[0]).
- * This class is to convert CE's command line parameters and simulate as
- * in the same manner as other general platforms, adding 'root' as a
- * first argc, which is for the name of executable in other OS.
- */
-class ACE_OS_Export ACE_CE_ARGV
-{
-public:
- /**
- * Ctor accepts CE command line as a paramter.
- */
- ACE_CE_ARGV(ACE_TCHAR* cmdLine);
-
- /**
- * Default Dtor that deletes any memory allocated for the converted string.
- */
- ~ACE_CE_ARGV(void);
-
- /**
- * Returns the number of command line paramters, same as argc on Unix.
- */
- int argc(void);
-
- /**
- * Returns the char** that contains the converted command line parameters.
- */
- ACE_TCHAR** const argv(void);
-private:
- /**
- * Copy Ctor is not allowed.
- */
- ACE_CE_ARGV(void);
-
- /**
- * Copy Ctor is not allowed.
- */
- ACE_CE_ARGV(ACE_CE_ARGV&);
-
- /**
- * Pointer of converted command line paramters.
- */
- ACE_TCHAR** ce_argv_;
-
- /**
- * Integer that is same as argc on other OS's.
- */
- int ce_argc_;
-};
# if defined (ACE_TMAIN) // Use WinMain on CE; others give warning/error.
# undef ACE_TMAIN
# endif // ACE_TMAIN
-// Support for ACE_TMAIN, which is a recommended way.
+// CE only gets a command line string; no argv. So we need to convert it
+// when the main entrypoint expects argc/argv. ACE_ARGV supports this.
+# include "ace/ARGV.h"
+
+// Support for ACE_TMAIN, which is a recommended way. It would be nice if
+// CE had CommandLineToArgvW()... but it's only on NT3.5 and up.
+
# define ACE_TMAIN \
ace_main_i (int, ACE_TCHAR *[]); /* forward declaration */ \
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
{ \
- ACE_CE_ARGV ce_argv(lpCmdLine); \
- ACE::init(); \
+ ACE_TCHAR cmdline[1024]; \
+ ACE_OS::strcpy (cmdline, ACE_LIB_TEXT ("program ")); \
+ ACE_OS::strcat (cmdline, lpCmdLine); \
+ ACE_ARGV ce_argv (cmdline); \
+ ACE::init (); \
ACE_MAIN_OBJECT_MANAGER \
- int i = ace_main_i (ce_argv.argc(), ce_argv.argv()); \
- ACE::fini(); \
+ int i = ace_main_i (ce_argv.argc (), ce_argv.argv ()); \
+ ACE::fini (); \
return i; \
} \
int ace_main_i
-// Support for wchar_t but still can't fit to CE because of the command line parameters.
+// Support for wchar_t but still can't fit to CE because of the command
+// line parameters.
# define wmain \
ace_main_i (int, ACE_TCHAR *[]); /* forward declaration */ \
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
{ \
- ACE_CE_ARGV ce_argv(lpCmdLine); \
- ACE::init(); \
+ ACE_TCHAR cmdline[1024]; \
+ ACE_OS::strcpy (cmdline, ACE_LIB_TEXT ("program ")); \
+ ACE_OS::strcat (cmdline, lpCmdLine); \
+ ACE_ARGV ce_argv (cmdline); \
+ ACE::init (); \
ACE_MAIN_OBJECT_MANAGER \
- int i = ace_main_i (ce_argv.argc(), ce_argv.argv()); \
- ACE::fini(); \
+ int i = ace_main_i (ce_argv.argc (), ce_argv.argv ()); \
+ ACE::fini (); \
return i; \
} \
int ace_main_i
@@ -6869,7 +6823,10 @@ int ace_main_i
ace_main_i (int, char *[]); /* forward declaration */ \
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) \
{ \
- ACE_CE_ARGV ce_argv (lpCmdLine); \
+ ACE_TCHAR cmdline[1024]; \
+ ACE_OS::strcpy (cmdline, ACE_LIB_TEXT ("program ")); \
+ ACE_OS::strcat (cmdline, lpCmdLine); \
+ ACE_ARGV ce_argv (cmdline); \
ACE::init (); \
ACE_MAIN_OBJECT_MANAGER \
ACE_Argv_Type_Converter command_line (ce_argv.argc (), ce_argv.argv ()); \
diff --git a/ace/OS.i b/ace/OS.i
index 64ddaac52a2..b2674e190b8 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -851,7 +851,7 @@ ACE_OS::tempnam (const ACE_TCHAR *dir, const ACE_TCHAR *pfx)
}
#if defined (ACE_HAS_SHM_OPEN) && defined(INTEGRITY)
-#include <sys/mman.h>
+#include /**/ <sys/mman.h>
#endif
ACE_INLINE ACE_HANDLE
@@ -11156,17 +11156,3 @@ ACE_OS::set_win32_resource_module (HINSTANCE instance)
ACE_OS::win32_resource_module_ = instance;
}
#endif /* ACE_WIN32 */
-
-#if defined (ACE_HAS_WINCE)
-ACE_INLINE int
-ACE_CE_ARGV::argc()
-{
- return ce_argc_;
-}
-
-ACE_INLINE ACE_TCHAR** const
-ACE_CE_ARGV::argv()
-{
- return ce_argv_;
-}
-#endif // ACE_HAS_WINCE
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index fcefdfdebf5..0031e38ff51 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -425,7 +425,7 @@ typedef unsigned long long ACE_UINT64;
# include /**/ <winsock2.h>
// WinCE 4 doesn't define the Exxx values without the WSA prefix, so do that
// here. This is all lifted from the #if 0'd out part of winsock2.h.
-# if defined (UNDER_CE) && (UNDER_CE == 4)
+# if defined (UNDER_CE) && (UNDER_CE >= 400)
# define EWOULDBLOCK WSAEWOULDBLOCK
# define EINPROGRESS WSAEINPROGRESS
# define EALREADY WSAEALREADY
diff --git a/bin/PerlACE/Process_Win32.pm b/bin/PerlACE/Process_Win32.pm
index b63518224ef..2689f005006 100644
--- a/bin/PerlACE/Process_Win32.pm
+++ b/bin/PerlACE/Process_Win32.pm
@@ -205,6 +205,11 @@ sub Spawn ()
"> failed to create start_test.cmd\n";
return -1;
}
+
+ # The device was soft-reset at the end of the test. Wait a few seconds
+ # for it to come back up.
+ sleep (10);
+
my $testname = basename($executable,'.EXE');
my $here = getcwd();
$here =~ s/\//\\/g;
@@ -365,9 +370,6 @@ sub TimedWait ($)
$log_name =~ s/\.txt$/.log/i;
rename($log_name_txt, $log_name);
}
- # The device was soft-reset at the end of the test. Wait a few seconds
- # for it to come back up.
- sleep (10);
}
return $status;
diff --git a/docs/ACE-subsets.html b/docs/ACE-subsets.html
index 16a46f53aaf..df10f41cd59 100644
--- a/docs/ACE-subsets.html
+++ b/docs/ACE-subsets.html
@@ -198,6 +198,8 @@ ACE library subsets. All of the other libraries will depend on this
library. The following classes are included in this library.
<PRE><CODE>
+ ARGV
+ Argv_Type_Converter
Basic_Types
Time_Value
OS
@@ -225,8 +227,6 @@ miscellaneous classes.
ACE
Active_Map_Manager
Arg_Shifter
- ARGV
- Argv_Type_Converter
Capabilities
Containers
Configuration