From 2efe23bdad77f7bc0143233e0a20b3291a0b0e7b Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 23 May 2002 00:08:47 +0000 Subject: [PATCH] more VC++ support --- ppremake/filename.cxx | 11 +++++++++-- ppremake/ppCommandFile.cxx | 14 ++++++++------ ppremake/ppCommandFile.h | 4 ++-- ppremake/ppMain.cxx | 2 +- ppremake/ppScope.cxx | 10 +++++----- ppremake/ppremake.vcproj | 27 ++++++++++++++++++--------- 6 files changed, 43 insertions(+), 25 deletions(-) diff --git a/ppremake/filename.cxx b/ppremake/filename.cxx index 8a9dd88f31..fe297321cf 100644 --- a/ppremake/filename.cxx +++ b/ppremake/filename.cxx @@ -44,11 +44,13 @@ #endif -#if defined(WIN32) +#ifdef WIN32 /* begin Win32-specific code */ +#ifdef WIN32_VC #include #include +#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 { diff --git a/ppremake/ppCommandFile.cxx b/ppremake/ppCommandFile.cxx index b26f2feea3..51d087cb5a 100644 --- a/ppremake/ppCommandFile.cxx +++ b/ppremake/ppCommandFile.cxx @@ -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; } diff --git a/ppremake/ppCommandFile.h b/ppremake/ppCommandFile.h index a35f560577..a183a65134 100644 --- a/ppremake/ppCommandFile.h +++ b/ppremake/ppCommandFile.h @@ -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 &words); bool replay_formap(const string &varname, const string &mapvar); diff --git a/ppremake/ppMain.cxx b/ppremake/ppMain.cxx index fbdf2abd78..a98d7879b1 100644 --- a/ppremake/ppMain.cxx +++ b/ppremake/ppMain.cxx @@ -275,7 +275,7 @@ report_reverse_depends(const string &dirname) const { //////////////////////////////////////////////////////////////////// string PPMain:: get_root() { - return _root; + return _root.get_fullpath(); } //////////////////////////////////////////////////////////////////// diff --git a/ppremake/ppScope.cxx b/ppremake/ppScope.cxx index 55447e1f35..0a1ba08da8 100644 --- a/ppremake/ppScope.cxx +++ b/ppremake/ppScope.cxx @@ -1305,7 +1305,7 @@ expand_isdir(const string ¶ms) { 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 ¶ms) { 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 ¶ms) { #endif if (found) { - return libname; + return libname.get_fullpath(); } else { return string(); } @@ -1452,7 +1452,7 @@ expand_bintest(const string ¶ms) { // 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 ¶ms) { #endif if (found) { - return binname; + return binname.get_fullpath(); } else { return string(); } diff --git a/ppremake/ppremake.vcproj b/ppremake/ppremake.vcproj index 4d9e4ffb60..f14ec1d73a 100644 --- a/ppremake/ppremake.vcproj +++ b/ppremake/ppremake.vcproj @@ -112,18 +112,30 @@ + + + + + + + + + + + + - - - - @@ -136,9 +148,6 @@ - -