From: ishmal Date: Thu, 16 Nov 2006 21:45:33 +0000 (+0000) Subject: fix circ dep check X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=18c4466f5fcc07fbb8e13d342c6cdf26960e5895;p=inkscape.git fix circ dep check --- diff --git a/buildtool.cpp b/buildtool.cpp index 606214784..bcec40c93 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -42,7 +42,6 @@ #include #include - #include #include #include @@ -1181,7 +1180,7 @@ public: /** * */ - ~URI() + virtual ~URI() {} @@ -2129,7 +2128,7 @@ void MakeBase::status(char *fmt, ...) { va_list args; va_start(args,fmt); - fprintf(stdout, "-"); + //fprintf(stdout, " "); vfprintf(stdout, fmt, args); fprintf(stdout, "\n"); va_end(args) ; @@ -2316,7 +2315,8 @@ static String win32LastError() /** - * Execute a system call via the shell + * Execute a system call, using pipes to send data to the + * program's stdin, and reading stdout and stderr. */ bool MakeBase::executeCommand(const String &command, const String &inbuf, @@ -2324,11 +2324,17 @@ bool MakeBase::executeCommand(const String &command, String &errbuf) { - status("-------- cmd --------\n%s\n---------------------", + status("============ cmd ============\n%s\n=============================", command.c_str()); #ifdef __WIN32__ + /* + I really hate having win32 code in this program, but the + read buffer in command.com and cmd.exe are just too small + for the large commands we need for compiling and linking. + */ + bool ret = true; //# Allocate a separate buffer for safety @@ -2429,7 +2435,7 @@ bool MakeBase::executeCommand(const String &command, { break; } - for (int i=0 ; i DepTool::loadDepFile(const String &depFile) depObject.files.push_back(depName); } } - result.push_back(depObject); + //Insert into the result list, in a sorted manner + bool inserted = false; + std::vector::iterator iter; + for (iter = result.begin() ; iter != result.end() ; iter++) + { + if (iter->path > depObject.path) + { + inserted = true; + iter = result.insert(iter, depObject); + break; + } + else if (iter->path == depObject.path) + { + if (iter->name > depObject.name) + { + inserted = true; + iter = result.insert(iter, depObject); + break; + } + } + } + if (!inserted) + result.push_back(depObject); } } @@ -4932,8 +4959,9 @@ public: //Get the immediate parent directory's base name String baseFileSetDir = fileSetDir; - int pos = baseFileSetDir.find_last_of('/'); - if (pos>0 && pos < baseFileSetDir.size()-1) + unsigned int pos = baseFileSetDir.find_last_of('/'); + if (pos!=baseFileSetDir.npos && + pos < baseFileSetDir.size()-1) baseFileSetDir = baseFileSetDir.substr(pos+1, baseFileSetDir.size()); @@ -4971,8 +4999,8 @@ public: //the source appended to the dest dir status(" : %s", fileName.c_str()); String baseName = fileName; - int pos = baseName.find_last_of('/'); - if (pos > 0 && pos &depList); + std::vector &depList); /** * @@ -6233,20 +6256,25 @@ bool Make::execute() * */ bool Make::checkTargetDependencies(Target &target, - std::set &depList) + std::vector &depList) { String tgtName = target.getName().c_str(); - depList.insert(tgtName); + depList.push_back(tgtName); std::vector deps = target.getDependencies(); for (unsigned int i=0 ; i::iterator diter = depList.find(dep); - if (diter != depList.end()) + //First thing entered was the starting Target + if (dep == depList[0]) { error("Circular dependency '%s' found at '%s'", dep.c_str(), tgtName.c_str()); + std::vector::iterator diter; + for (diter=depList.begin() ; diter!=depList.end() ; diter++) + { + error(" %s", diter->c_str()); + } return false; } @@ -6544,7 +6572,7 @@ bool Make::parseFile() for (iter = targets.begin() ; iter!= targets.end() ; iter++) { Target tgt = iter->second; - std::set depList; + std::vector depList; if (!checkTargetDependencies(tgt, depList)) { return false; @@ -6627,7 +6655,10 @@ static bool sequ(const buildtool::String &buf, char *key) return true; } - +/** + * Parse the command-line args, get our options, + * and run this thing + */ static bool parseOptions(int argc, char **argv) { if (argc < 1) @@ -6688,6 +6719,10 @@ static bool parseOptions(int argc, char **argv) return true; } + + + +/* static bool runMake() { buildtool::Make make; @@ -6696,7 +6731,7 @@ static bool runMake() return true; } -/* + static bool pkgConfigTest() { buildtool::PkgConfig pkgConfig;