bump simplecpp
This commit is contained in:
parent
947ace6194
commit
c75b90487e
|
@ -1675,18 +1675,9 @@ namespace simplecpp {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace simplecpp {
|
|
||||||
#ifdef SIMPLECPP_WINDOWS
|
#ifdef SIMPLECPP_WINDOWS
|
||||||
|
static bool realFileName(const std::string &f, std::string *result)
|
||||||
bool realFileName(const std::string &f, std::string *result)
|
{
|
||||||
{
|
|
||||||
// If path is a drive letter, uppercase it
|
|
||||||
if (f.size() == 2 && std::isalpha((unsigned char)f[0]) && f[1] == ':') {
|
|
||||||
*result = (char)std::toupper((unsigned char)f[0]) + std::string(":");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// are there alpha characters in last subpath?
|
// are there alpha characters in last subpath?
|
||||||
bool alpha = false;
|
bool alpha = false;
|
||||||
for (std::string::size_type pos = 1; pos < f.size(); ++pos) {
|
for (std::string::size_type pos = 1; pos < f.size(); ++pos) {
|
||||||
|
@ -1716,11 +1707,11 @@ namespace simplecpp {
|
||||||
*result = FindFileData.cFileName;
|
*result = FindFileData.cFileName;
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Change case in given path to match filesystem */
|
/** Change case in given path to match filesystem */
|
||||||
std::string realFilename(const std::string &f)
|
static std::string realFilename(const std::string &f)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
ret.reserve(f.size()); // this will be the final size
|
ret.reserve(f.size()); // this will be the final size
|
||||||
|
|
||||||
|
@ -1763,24 +1754,24 @@ namespace simplecpp {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAbsolutePath(const std::string &path)
|
static bool isAbsolutePath(const std::string &path)
|
||||||
{
|
{
|
||||||
if (path.length() >= 3 && path[0] > 0 && std::isalpha(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/'))
|
if (path.length() >= 3 && path[0] > 0 && std::isalpha(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/'))
|
||||||
return true;
|
return true;
|
||||||
return path.length() > 1U && (path[0] == '/' || path[0] == '/');
|
return path.length() > 1U && (path[0] == '/' || path[0] == '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define realFilename(f) f
|
#define realFilename(f) f
|
||||||
|
|
||||||
bool isAbsolutePath(const std::string &path)
|
static bool isAbsolutePath(const std::string &path)
|
||||||
{
|
{
|
||||||
return path.length() > 1U && path[0] == '/';
|
return path.length() > 1U && path[0] == '/';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace simplecpp {
|
||||||
/**
|
/**
|
||||||
* perform path simplifications for . and ..
|
* perform path simplifications for . and ..
|
||||||
*/
|
*/
|
||||||
|
@ -1944,7 +1935,7 @@ static const simplecpp::Token *gotoNextLine(const simplecpp::Token *tok)
|
||||||
|
|
||||||
static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader)
|
static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader)
|
||||||
{
|
{
|
||||||
if (simplecpp::isAbsolutePath(header)) {
|
if (isAbsolutePath(header)) {
|
||||||
f.open(header.c_str());
|
f.open(header.c_str());
|
||||||
return f.is_open() ? simplecpp::simplifyPath(header) : "";
|
return f.is_open() ? simplecpp::simplifyPath(header) : "";
|
||||||
}
|
}
|
||||||
|
@ -1977,7 +1968,7 @@ static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const
|
||||||
|
|
||||||
static std::string getFileName(const std::map<std::string, simplecpp::TokenList *> &filedata, const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader)
|
static std::string getFileName(const std::map<std::string, simplecpp::TokenList *> &filedata, const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader)
|
||||||
{
|
{
|
||||||
if (simplecpp::isAbsolutePath(header)) {
|
if (isAbsolutePath(header)) {
|
||||||
return (filedata.find(header) != filedata.end()) ? simplecpp::simplifyPath(header) : "";
|
return (filedata.find(header) != filedata.end()) ? simplecpp::simplifyPath(header) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue