[Cmake-commits] [cmake-commits] king committed SystemTools.cxx 1.243 1.244
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Jun 10 13:02:50 EDT 2009
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv21000/Source/kwsys
Modified Files:
SystemTools.cxx
Log Message:
ENH: Teach KWSys SystemTools about VMS paths
This teaches ConvertToUnixSlashes to convert VMS paths into posix-style
paths. We also set the DECC$FILENAME_UNIX_ONLY feature so the process
always sees posix-style paths on disk.
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.243
retrieving revision 1.244
diff -C 2 -d -r1.243 -r1.244
*** SystemTools.cxx 5 Jun 2009 17:17:01 -0000 1.243
--- SystemTools.cxx 10 Jun 2009 17:02:48 -0000 1.244
***************
*** 1484,1487 ****
--- 1484,1511 ----
}
+ #ifdef __VMS
+ static void ConvertVMSToUnix(kwsys_stl::string& path)
+ {
+ kwsys_stl::string::size_type rootEnd = path.find(":[");
+ kwsys_stl::string::size_type pathEnd = path.find("]");
+ if(rootEnd != path.npos)
+ {
+ kwsys_stl::string root = path.substr(0, rootEnd);
+ kwsys_stl::string pathPart = path.substr(rootEnd+2, pathEnd - rootEnd-2);
+ const char* pathCString = pathPart.c_str();
+ const char* pos0 = pathCString;
+ for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos )
+ {
+ if ( *pos0 == '.' )
+ {
+ pathPart[pos] = '/';
+ }
+ pos0 ++;
+ }
+ path = "/"+ root + "/" + pathPart;
+ }
+ }
+ #endif
+
// convert windows slashes to unix slashes
void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
***************
*** 1489,1493 ****
const char* pathCString = path.c_str();
bool hasDoubleSlash = false;
!
const char* pos0 = pathCString;
const char* pos1 = pathCString+1;
--- 1513,1519 ----
const char* pathCString = path.c_str();
bool hasDoubleSlash = false;
! #ifdef __VMS
! ConvertVMSToUnix(path);
! #else
const char* pos0 = pathCString;
const char* pos1 = pathCString+1;
***************
*** 1523,1527 ****
SystemTools::ReplaceString(path, "//", "/");
}
!
// remove any trailing slash
if(!path.empty())
--- 1549,1553 ----
SystemTools::ReplaceString(path, "//", "/");
}
! #endif
// remove any trailing slash
if(!path.empty())
***************
*** 4535,4540 ****
--- 4561,4583 ----
}
+ #if defined(__VMS)
+ // On VMS we configure the run time C library to be more UNIX like.
+ // http://h71000.www7.hp.com/doc/732final/5763/5763pro_004.html
+ extern "C" int decc$feature_get_index(char *name);
+ extern "C" int decc$feature_set_value(int index, int mode, int value);
+ static int SetVMSFeature(char* name, int value)
+ {
+ int i;
+ errno = 0;
+ i = decc$feature_get_index(name);
+ return i >= 0 && (decc$feature_set_value(i, 1, value) >= 0 || errno == 0);
+ }
+ #endif
+
void SystemTools::ClassInitialize()
{
+ #ifdef __VMS
+ SetVMSFeature("DECC$FILENAME_UNIX_ONLY", 1);
+ #endif
// Allocate the translation map first.
SystemTools::TranslationMap = new SystemToolsTranslationMap;
More information about the Cmake-commits
mailing list