more VC++ support

This commit is contained in:
David Rose 2002-05-23 00:08:47 +00:00
parent 966a057c91
commit 2efe23bdad
6 changed files with 43 additions and 25 deletions

View File

@ -44,11 +44,13 @@
#endif #endif
#if defined(WIN32) #ifdef WIN32
/* begin Win32-specific code */ /* begin Win32-specific code */
#ifdef WIN32_VC
#include <direct.h> #include <direct.h>
#include <windows.h> #include <windows.h>
#endif
static string static string
front_to_back_slash(const string &str) { front_to_back_slash(const string &str) {
@ -132,8 +134,13 @@ convert_pathname(const string &unix_style_pathname) {
unix_style_pathname[2] == '/') { unix_style_pathname[2] == '/') {
// This pathname begins with a slash and a single letter. That // This pathname begins with a slash and a single letter. That
// must be the drive letter. // must be the drive letter.
// We have to cast the result of toupper() to (char) to help some
// compilers (e.g. Cygwin's gcc 2.95.3) happy; so that they do not
// confuse this string constructor with one that takes two
// iterators.
windows_pathname = windows_pathname =
string(1, toupper(unix_style_pathname[1])) + ":" + string(1, (char)toupper(unix_style_pathname[1])) + ":" +
front_to_back_slash(unix_style_pathname.substr(2)); front_to_back_slash(unix_style_pathname.substr(2));
} else { } else {

View File

@ -300,10 +300,11 @@ get_scope() const {
// Description: Reads input from the given filename. // Description: Reads input from the given filename.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool PPCommandFile:: bool PPCommandFile::
read_file(const string &filename) { read_file(Filename filename) {
ifstream in(filename.c_str()); filename.set_text();
ifstream in;
if (!in) { if (!filename.open_read(in)) {
cerr << "Unable to open " << filename << ".\n"; cerr << "Unable to open " << filename << ".\n";
return false; return false;
} }
@ -1451,10 +1452,11 @@ handle_addmap_command() {
// particular named file at this point. // particular named file at this point.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool PPCommandFile:: bool PPCommandFile::
include_file(const string &filename) { include_file(Filename filename) {
ifstream in(filename.c_str()); filename.set_text();
if (!in) { ifstream in;
if (!filename.open_read(in)) {
cerr << "Unable to open include file " << filename << ".\n"; cerr << "Unable to open include file " << filename << ".\n";
return false; return false;
} }

View File

@ -30,7 +30,7 @@ public:
void set_scope(PPScope *scope); void set_scope(PPScope *scope);
PPScope *get_scope() const; PPScope *get_scope() const;
bool read_file(const string &filename); bool read_file(Filename filename);
bool read_stream(istream &in, const string &filename); bool read_stream(istream &in, const string &filename);
bool read_stream(istream &in); bool read_stream(istream &in);
void begin_read(); void begin_read();
@ -65,7 +65,7 @@ protected:
bool handle_map_command(); bool handle_map_command();
bool handle_addmap_command(); bool handle_addmap_command();
bool include_file(const string &filename); bool include_file(Filename filename);
bool replay_forscopes(const string &name); bool replay_forscopes(const string &name);
bool replay_foreach(const string &varname, const vector<string> &words); bool replay_foreach(const string &varname, const vector<string> &words);
bool replay_formap(const string &varname, const string &mapvar); bool replay_formap(const string &varname, const string &mapvar);

View File

@ -275,7 +275,7 @@ report_reverse_depends(const string &dirname) const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
string PPMain:: string PPMain::
get_root() { get_root() {
return _root; return _root.get_fullpath();
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -1305,7 +1305,7 @@ expand_isdir(const string &params) {
Filename filename = results[0]; Filename filename = results[0];
if (filename.is_directory()) { if (filename.is_directory()) {
return filename; return filename.get_fullpath();
} else { } else {
return string(); return string();
} }
@ -1333,7 +1333,7 @@ expand_isfile(const string &params) {
Filename filename = results[0]; Filename filename = results[0];
if (filename.is_regular_file()) { if (filename.is_regular_file()) {
return filename; return filename.get_fullpath();
} else { } else {
return string(); return string();
} }
@ -1423,7 +1423,7 @@ expand_libtest(const string &params) {
#endif #endif
if (found) { if (found) {
return libname; return libname.get_fullpath();
} else { } else {
return string(); return string();
} }
@ -1452,7 +1452,7 @@ expand_bintest(const string &params) {
// An explicit path from the root does not require a search. // An explicit path from the root does not require a search.
if (binname.is_fully_qualified()) { if (binname.is_fully_qualified()) {
if (binname.exists()) { if (binname.exists()) {
return binname; return binname.get_fullpath();
} else { } else {
return string(); return string();
} }
@ -1490,7 +1490,7 @@ expand_bintest(const string &params) {
#endif #endif
if (found) { if (found) {
return binname; return binname.get_fullpath();
} else { } else {
return string(); return string();
} }

View File

@ -112,18 +112,30 @@
<File <File
RelativePath="config_msvc.h"> RelativePath="config_msvc.h">
</File> </File>
<File
RelativePath="dSearchPath.I">
</File>
<File
RelativePath="dSearchPath.cxx">
</File>
<File
RelativePath="dSearchPath.h">
</File>
<File
RelativePath="executionEnvironment.cxx">
</File>
<File
RelativePath="executionEnvironment.h">
</File>
<File
RelativePath="filename.I">
</File>
<File <File
RelativePath="filename.cxx"> RelativePath="filename.cxx">
</File> </File>
<File <File
RelativePath="filename.h"> RelativePath="filename.h">
</File> </File>
<File
RelativePath="find_searchpath.cxx">
</File>
<File
RelativePath="find_searchpath.h">
</File>
<File <File
RelativePath="gnu_getopt.c"> RelativePath="gnu_getopt.c">
</File> </File>
@ -136,9 +148,6 @@
<File <File
RelativePath="gnu_regex.h"> RelativePath="gnu_regex.h">
</File> </File>
<File
RelativePath="include_access.h">
</File>
<File <File
RelativePath="ppCommandFile.cxx"> RelativePath="ppCommandFile.cxx">
</File> </File>