[cmake-commits] hoffman committed CMakeLists.txt 1.96.2.3 1.96.2.4
System.c 1.4.2.1 1.4.2.2 System.h.in 1.3.2.1 1.3.2.2
SystemTools.cxx 1.157.2.9 1.157.2.10 SystemTools.cxx.bak
1.1.2.1 1.1.2.2 kwsysPlatformCxxTests.cmake 1.8.16.1 NONE
kwsysPlatformCxxTests.cxx 1.22 NONE
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Oct 27 16:01:52 EDT 2006
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv22632/Source/kwsys
Modified Files:
Tag: CMake-2-4
CMakeLists.txt System.c System.h.in SystemTools.cxx
SystemTools.cxx.bak
Removed Files:
Tag: CMake-2-4
kwsysPlatformCxxTests.cmake kwsysPlatformCxxTests.cxx
Log Message:
ENH: move changes from main tree
--- kwsysPlatformCxxTests.cmake DELETED ---
Index: System.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/System.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -d -r1.4.2.1 -r1.4.2.2
--- System.c 13 Oct 2006 14:58:11 -0000 1.4.2.1
+++ System.c 27 Oct 2006 20:01:50 -0000 1.4.2.2
@@ -59,7 +59,7 @@
/*--------------------------------------------------------------------------*/
static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
{
- return ((c == '\'') || (c == '`') || (c == ';') ||
+ return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
(c == '&') || (c == '$') || (c == '(') || (c == ')'));
}
@@ -222,7 +222,7 @@
}
}
- /* Check whether this character needs escaping. */
+ /* Check whether this character needs escaping for the shell. */
if(isUnix)
{
/* On Unix a few special characters need escaping even inside a
@@ -261,7 +261,7 @@
}
}
- /* The dollar sign needs special handling in some environments. */
+ /* Check whether this character needs escaping for a make tool. */
if(*c == '$')
{
if(flags & kwsysSystem_Shell_Flag_Make)
@@ -277,6 +277,16 @@
size += 2;
}
}
+ else if(*c == '#')
+ {
+ if((flags & kwsysSystem_Shell_Flag_Make) &&
+ (flags & kwsysSystem_Shell_Flag_WatcomWMake))
+ {
+ /* In Watcom WMake makefiles a pound is written $# so we need
+ one extra character. */
+ ++size;
+ }
+ }
}
/* Check whether the argument needs surrounding quotes. */
@@ -333,7 +343,7 @@
}
}
- /* Check whether this character needs escaping. */
+ /* Check whether this character needs escaping for the shell. */
if(isUnix)
{
/* On Unix a few special characters need escaping even inside a
@@ -377,7 +387,7 @@
}
}
- /* The dollar sign needs special handling in some environments. */
+ /* Check whether this character needs escaping for a make tool. */
if(*c == '$')
{
if(flags & kwsysSystem_Shell_Flag_Make)
@@ -405,6 +415,23 @@
*out++ = '$';
}
}
+ else if(*c == '#')
+ {
+ if((flags & kwsysSystem_Shell_Flag_Make) &&
+ (flags & kwsysSystem_Shell_Flag_WatcomWMake))
+ {
+ /* In Watcom WMake makefiles a pound is written $#. The make
+ tool will replace it with just # before passing it to the
+ shell. */
+ *out++ = '$';
+ *out++ = '#';
+ }
+ else
+ {
+ /* Otherwise a pound is written just #. */
+ *out++ = '#';
+ }
+ }
else
{
/* Store this character. */
Index: SystemTools.cxx.bak
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/Attic/SystemTools.cxx.bak,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- SystemTools.cxx.bak 13 Oct 2006 14:58:11 -0000 1.1.2.1
+++ SystemTools.cxx.bak 27 Oct 2006 20:01:50 -0000 1.1.2.2
@@ -337,6 +337,10 @@
bool SystemTools::MakeDirectory(const char* path)
{
+ if(!path)
+ {
+ return false;
+ }
if(SystemTools::FileExists(path))
{
return true;
@@ -1366,18 +1370,32 @@
{
ret.erase(pos, 1);
}
- // now escape spaces if there is a space in the path
- if(ret.find(" ") != kwsys_stl::string::npos)
+ // escape spaces and () in the path
+ if(ret.find_first_of(" ()") != kwsys_stl::string::npos)
{
kwsys_stl::string result = "";
char lastch = 1;
+ bool inDollarVariable = false;
for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
{
// if it is already escaped then don't try to escape it again
- if(*ch == ' ' && lastch != '\\')
+ if((*ch == ' ' || *ch == '(' || *ch == ')') && lastch != '\\')
+ {
+ if(*ch == '(' && lastch == '$')
+ {
+ inDollarVariable = true;
+ }
+ // if we are in a $(..... and we get a ) then do not escape
+ // the ) and but set inDollarVariable to false
+ else if(*ch == ')' && inDollarVariable)
+ {
+ inDollarVariable = false;
+ }
+ else
{
result += '\\';
}
+ }
result += *ch;
lastch = *ch;
}
@@ -1764,7 +1782,7 @@
bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt)
{
- if (!str || !tmt || strlen(str) < 12)
+ if (!str || !tmt || strlen(str) > 11)
{
return false;
}
@@ -1812,7 +1830,7 @@
bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt)
{
- if (!str || !tmt || strlen(str) < 27)
+ if (!str || !tmt || strlen(str) > 26)
{
return false;
}
@@ -2242,6 +2260,17 @@
bool SystemTools::FileIsDirectory(const char* name)
{
+ // Remove any trailing slash from the name.
+ char buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
+ int last = static_cast<int>(strlen(name))-1;
+ if(last >= 0 && (name[last] == '/' || name[last] == '\\'))
+ {
+ memcpy(buffer, name, last);
+ buffer[last] = 0;
+ name = buffer;
+ }
+
+ // Now check the file node type.
struct stat fs;
if(stat(name, &fs) == 0)
{
@@ -2441,7 +2470,8 @@
void SystemTools::AddKeepPath(const char* dir)
{
- kwsys_stl::string cdir = SystemTools::CollapseFullPath(dir);
+ kwsys_stl::string cdir;
+ Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir);
SystemTools::AddTranslationPath(cdir.c_str(), dir);
}
@@ -2798,20 +2828,36 @@
kwsys_stl::string
SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components)
{
+ return SystemTools::JoinPath(components.begin(), components.end());
+}
+
+//----------------------------------------------------------------------------
+kwsys_stl::string
+SystemTools
+::JoinPath(kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
+ kwsys_stl::vector<kwsys_stl::string>::const_iterator last)
+{
+ // Construct result in a single string.
kwsys_stl::string result;
- if(components.size() > 0)
+
+ // The first two components do not add a slash.
+ if(first != last)
{
- result += components[0];
+ result += *first++;
}
- if(components.size() > 1)
+ if(first != last)
{
- result += components[1];
+ result += *first++;
}
- for(unsigned int i=2; i < components.size(); ++i)
+
+ // All remaining components are always separated with a slash.
+ while(first != last)
{
result += "/";
- result += components[i];
+ result += *first++;
}
+
+ // Return the concatenated result.
return result;
}
@@ -3348,7 +3394,7 @@
time_t t;
time(&t);
strftime(buf, sizeof(buf), format, localtime(&t));
- return buf;
+ return kwsys_stl::string(buf);
}
kwsys_stl::string SystemTools::MakeCindentifier(const char* s)
@@ -3374,39 +3420,49 @@
// Due to a buggy stream library on the HP and another on Mac OSX, we
// need this very carefully written version of getline. Returns true
// if any data were read before the end-of-file was reached.
-bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, kwsys_stl::string& line,
- bool *has_newline /* = 0 */)
+bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
+ kwsys_stl::string& line,
+ bool* has_newline /* = 0 */)
{
const int bufferSize = 1024;
char buffer[bufferSize];
- line = "";
bool haveData = false;
- if ( has_newline )
- {
- *has_newline = false;
- }
+ bool haveNewline = false;
+
+ // Start with an empty line.
+ line = "";
// If no characters are read from the stream, the end of file has
- // been reached.
- while((is.getline(buffer, bufferSize), is.gcount() > 0))
+ // been reached. Clear the fail bit just before reading.
+ while(!haveNewline &&
+ (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
+ is.getline(buffer, bufferSize), is.gcount() > 0))
{
+ // We have read at least one byte.
haveData = true;
- line.append(buffer);
- // If newline character was read, the gcount includes the
- // character, but the buffer does not. The end of line has been
- // reached.
- if(strlen(buffer) < static_cast<size_t>(is.gcount()))
+ // If newline character was read the gcount includes the character
+ // but the buffer does not: the end of line has been reached.
+ size_t length = strlen(buffer);
+ if(length < static_cast<size_t>(is.gcount()))
{
- if ( has_newline )
+ haveNewline = true;
+ }
+
+ // Avoid storing a carriage return character.
+ if(length > 0 && buffer[length-1] == '\r')
{
- *has_newline = true;
+ buffer[length-1] = 0;
}
- break;
+
+ // Append the data read to the line.
+ line.append(buffer);
}
- // The fail bit may be set. Clear it.
- is.clear(is.rdstate() & ~kwsys_ios::ios::failbit);
+ // Return the results.
+ if(has_newline)
+ {
+ *has_newline = haveNewline;
}
return haveData;
}
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/CMakeLists.txt,v
retrieving revision 1.96.2.3
retrieving revision 1.96.2.4
diff -u -d -r1.96.2.3 -r1.96.2.4
--- CMakeLists.txt 13 Oct 2006 14:52:07 -0000 1.96.2.3
+++ CMakeLists.txt 27 Oct 2006 20:01:50 -0000 1.96.2.4
@@ -914,6 +914,7 @@
GET_TEST_PROPERTY(kwsys.testFail WILL_FAIL wfv)
SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR;FAIL;Test failed")
SET_TESTS_PROPERTIES(kwsys.testRegistry PROPERTIES PASS_REGULAR_EXPRESSION "Test passed")
+ SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value")
MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}")
ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE)
ENDIF(BUILD_TESTING)
--- kwsysPlatformCxxTests.cxx DELETED ---
Index: System.h.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/System.h.in,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -d -r1.3.2.1 -r1.3.2.2
--- System.h.in 13 Oct 2006 14:58:11 -0000 1.3.2.1
+++ System.h.in 27 Oct 2006 20:01:50 -0000 1.3.2.2
@@ -32,6 +32,7 @@
#define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
#define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
#define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
+#define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
#define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
#if defined(__cplusplus)
@@ -82,12 +83,15 @@
/** In a windows whell the argument is being passed to "echo". */
kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
+ /** The target shell is in a Watcom WMake makefile. */
+ kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
+
/** Make variable reference syntax $(MAKEVAR) should not be escaped
to allow a build tool to replace it. Replacement values
containing spaces, quotes, backslashes, or other
non-alphanumeric characters that have significance to some makes
or shells produce undefined behavior. */
- kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<3)
+ kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<4)
};
#if defined(__cplusplus)
@@ -107,6 +111,7 @@
# undef kwsysSystem_Shell_Flag_Make
# undef kwsysSystem_Shell_Flag_VSIDE
# undef kwsysSystem_Shell_Flag_EchoWindows
+# undef kwsysSystem_Shell_Flag_WatcomWMake
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
#endif
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.157.2.9
retrieving revision 1.157.2.10
diff -u -d -r1.157.2.9 -r1.157.2.10
--- SystemTools.cxx 13 Oct 2006 14:52:07 -0000 1.157.2.9
+++ SystemTools.cxx 27 Oct 2006 20:01:50 -0000 1.157.2.10
@@ -4091,12 +4091,14 @@
static int SystemToolsDebugReport(int, char* message, int*)
{
- fprintf(stderr, message);
- exit(1);
+ fprintf(stderr, "%s", message);
+ fflush(stderr);
+ return 1; // no further reporting required
}
+
void SystemTools::EnableMSVCDebugHook()
{
- if(getenv("DART_TEST_FROM_DART"))
+ if (getenv("DART_TEST_FROM_DART"))
{
_CrtSetReportHook(SystemToolsDebugReport);
}
@@ -4109,5 +4111,3 @@
void SystemTools::EnableMSVCDebugHook() {}
} // namespace KWSYS_NAMESPACE
#endif
-
-
More information about the Cmake-commits
mailing list