Commit 504c1081 authored by Bill Hoffman's avatar Bill Hoffman

ENH: add support for watcom wmake and wcl386

parent d5363c6a
......@@ -74,7 +74,7 @@ const char* Directory::GetFile(unsigned long dindex)
// First microsoft compilers
#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(__WATCOMC__)
#include <windows.h>
#include <io.h>
#include <ctype.h>
......
......@@ -12,7 +12,9 @@
=========================================================================*/
#include <stdio.h>
#ifdef __WATCOMC__
#define _unlink unlink
#endif
int main(int argc, char* argv[])
{
FILE* ifp;
......@@ -76,6 +78,9 @@ int main(int argc, char* argv[])
fprintf(ofp, "extern %s_EXPORT int %sEncodedWriteArray%s(const char* fname)\n",
argv[3], argv[3], argv[4]);
fprintf(ofp, "{\n");
fprintf(ofp, "#ifdef __WATCOMC__\n");
fprintf(ofp, "#define _unlink unlink\n");
fprintf(ofp, "#endif\n");
fprintf(ofp, " FILE* ofp = fopen(fname, \"wb\");\n");
fprintf(ofp, " if(!ofp) { return 0; }\n");
for(i=0; i < count; ++i)
......
......@@ -35,7 +35,7 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
namespace KWSYS_NAMESPACE
{
#if defined( _WIN32 ) || defined( APPLE ) || defined( __CYGWIN__ )
......
......@@ -45,6 +45,9 @@ Q190351 and Q150956.
#include <string.h> /* strlen, strdup */
#include <stdio.h> /* sprintf */
#include <io.h> /* _unlink */
#ifdef __WATCOMC__
#define _unlink unlink
#endif
#ifndef _MAX_FNAME
#define _MAX_FNAME 4096
......
......@@ -367,9 +367,7 @@ RegistryHelper::~RegistryHelper()
bool RegistryHelper::Open(const char *toplevel, const char *subkey,
int readonly)
{
this->EntriesMap.erase(
this->EntriesMap.begin(),
this->EntriesMap.end());
this->EntriesMap.clear();
m_Empty = 1;
#ifdef _WIN32
......@@ -416,7 +414,7 @@ bool RegistryHelper::Open(const char *toplevel, const char *subkey,
}
}
m_HomeDirectory = homeDirectory;
str << m_HomeDirectory << "/." << toplevel << "rc";
str << m_HomeDirectory.c_str() << "/." << toplevel << "rc";
if ( readonly == Registry::READWRITE )
{
kwsys_ios::ofstream ofs( str.str().c_str(), kwsys_ios::ios::out|kwsys_ios::ios::app );
......@@ -503,7 +501,7 @@ bool RegistryHelper::Close()
}
kwsys_ios::ostringstream str;
str << m_HomeDirectory << "/." << this->GetTopLevel() << "rc";
str << m_HomeDirectory.c_str() << "/." << this->GetTopLevel() << "rc";
kwsys_ios::ofstream *ofs = new kwsys_ios::ofstream(str.str().c_str(), kwsys_ios::ios::out);
if ( !ofs )
{
......@@ -531,9 +529,7 @@ bool RegistryHelper::Close()
*ofs << it->first.c_str() << " = " << this->EncodeValue(it->second.c_str()).c_str() << kwsys_ios::endl;
}
}
this->EntriesMap.erase(
this->EntriesMap.begin(),
this->EntriesMap.end());
this->EntriesMap.clear();
ofs->close();
delete ofs;
this->SetSubKey(0);
......@@ -673,7 +669,8 @@ kwsys_stl::string RegistryHelper::CreateKey( const char *key )
return "";
}
kwsys_ios::ostringstream ostr;
ostr << this->EncodeKey(this->m_SubKey.c_str()) << "\\" << this->EncodeKey(key);
ostr << this->EncodeKey(this->m_SubKey.c_str()).c_str()
<< "\\" << this->EncodeKey(key).c_str();
return ostr.str();
}
......
......@@ -85,7 +85,7 @@ public:
}
#endif
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__))
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) ||defined(__BORLANDC__) || defined(__MINGW32__))
#include <io.h>
#include <direct.h>
#define _unlink unlink
......@@ -99,8 +99,15 @@ public:
#else
# define KWSYS_SYSTEMTOOLS_MAXPATH 16384
#endif
#if defined(__WATCOMC__)
#include <direct.h>
#define _mkdir mkdir
#define _rmdir rmdir
#define _getcwd getcwd
#define _chdir chdir
#endif
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__))
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
inline int Mkdir(const char* dir)
{
return _mkdir(dir);
......@@ -1856,7 +1863,11 @@ kwsys_stl::string SystemTools
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
SystemTools::GetPath(path);
// now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end());
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
i != userPaths.end(); ++i)
{
path.push_back(*i);
}
// now look for the file
kwsys_stl::string tryPath;
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
......@@ -1911,8 +1922,11 @@ kwsys_stl::string SystemTools::FindProgram(
}
// now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end());
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
i != userPaths.end(); ++i)
{
path.push_back(*i);
}
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
p != path.end(); ++p)
{
......@@ -1987,7 +2001,11 @@ kwsys_stl::string SystemTools
kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path);
// now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end());
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
i != userPaths.end(); ++i)
{
path.push_back(*i);
}
kwsys_stl::string tryPath;
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
p != path.end(); ++p)
......
......@@ -18,6 +18,7 @@
#include <@KWSYS_NAMESPACE@/stl/string>
#include <@KWSYS_NAMESPACE@/stl/vector>
#include <@KWSYS_NAMESPACE@/stl/map>
#include <@KWSYS_NAMESPACE@/stl/algorithm>
#include <@KWSYS_NAMESPACE@/Configure.h>
......
......@@ -26,7 +26,16 @@ int main() { return 0; }
#ifdef TEST_KWSYS_IOS_USE_SSTREAM
#include <sstream>
int main() { return 0; }
int main()
{
std::ostringstream ostr;
ostr << "hello";
if(ostr.str().size() == 5)
{
return 0;
}
return -1;
}
#endif
#ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
......
......@@ -16,6 +16,7 @@
#include KWSYS_HEADER(Registry.hxx)
#include KWSYS_HEADER(ios/iostream)
#include <string.h>
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment