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
#if defined(WIN32)
#ifdef WIN32
/* begin Win32-specific code */
#ifdef WIN32_VC
#include <direct.h>
#include <windows.h>
#endif
static string
front_to_back_slash(const string &str) {
@ -132,8 +134,13 @@ convert_pathname(const string &unix_style_pathname) {
unix_style_pathname[2] == '/') {
// This pathname begins with a slash and a single letter. That
// 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 =
string(1, toupper(unix_style_pathname[1])) + ":" +
string(1, (char)toupper(unix_style_pathname[1])) + ":" +
front_to_back_slash(unix_style_pathname.substr(2));
} else {

View File

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

View File

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

View File

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

View File

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

View File

@ -112,18 +112,30 @@
<File
RelativePath="config_msvc.h">
</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
RelativePath="filename.cxx">
</File>
<File
RelativePath="filename.h">
</File>
<File
RelativePath="find_searchpath.cxx">
</File>
<File
RelativePath="find_searchpath.h">
</File>
<File
RelativePath="gnu_getopt.c">
</File>
@ -136,9 +148,6 @@
<File
RelativePath="gnu_regex.h">
</File>
<File
RelativePath="include_access.h">
</File>
<File
RelativePath="ppCommandFile.cxx">
</File>