]> git.tdb.fi Git - builder.git/commitdiff
Style update: add spaces around assignment operators
authorMikko Rasa <tdb@tdb.fi>
Thu, 3 Dec 2009 09:03:56 +0000 (09:03 +0000)
committerMikko Rasa <tdb@tdb.fi>
Thu, 3 Dec 2009 09:03:56 +0000 (09:03 +0000)
37 files changed:
source/action.h
source/analyzer.cpp
source/analyzer.h
source/architecture.cpp
source/architecture.h
source/archive.cpp
source/binary.cpp
source/binarypackage.cpp
source/builder.cpp
source/buildinfo.cpp
source/compile.cpp
source/component.cpp
source/condition.cpp
source/config.cpp
source/copy.cpp
source/datacompile.cpp
source/datafile.cpp
source/dependencycache.cpp
source/externalaction.cpp
source/filetarget.cpp
source/install.cpp
source/link.cpp
source/misc.cpp
source/objectfile.cpp
source/package.cpp
source/pkgconfig.cpp
source/pkgconfigaction.cpp
source/sourcefile.cpp
source/sourcepackage.cpp
source/sourcepackage.h
source/staticlibrary.cpp
source/systemlibrary.cpp
source/tar.cpp
source/tarball.cpp
source/target.cpp
source/target.h
source/unlink.cpp

index 4ae787a505814137f960c2093268e2017e4e7b05..3892ac78786cf95036bb7b453032b06dd11af17b 100644 (file)
@@ -34,7 +34,7 @@ public:
        if the action has completed successfully, 1 if an error was encountered and
        -1 if it is still executing.
        */
-       virtual int check()=0;
+       virtual int check() = 0;
        
 protected:
        /**
index eae9de75a182c5c83c4b36850464634e4b19e11b..f8af44ff9a6295497102bd80989ef3f64c24c096 100644 (file)
@@ -46,9 +46,9 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth)
        if(mode!=REBUILD && mode!=ALLDEPS)
        {
                // Skip trivial targets
-               if(ObjectFile *obj=dynamic_cast<ObjectFile *>(&tgt))
+               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(&tgt))
                        return build_depend_table(obj->get_source(), depth);
-               else if(Install *inst=dynamic_cast<Install *>(&tgt))
+               else if(Install *inst = dynamic_cast<Install *>(&tgt))
                        return build_depend_table(inst->get_source(), depth);
        }
        else if(mode==REBUILD && !tgt.get_rebuild())
@@ -60,12 +60,12 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth)
 
        string fn;
        if(full_paths)
-               fn=tgt.get_name();
+               fn = tgt.get_name();
        else
-               fn=FS::basename(tgt.get_name());
+               fn = FS::basename(tgt.get_name());
        row.push_back(string(depth*2, ' ')+fn);
 
-       const Package *pkg=tgt.get_package();
+       const Package *pkg = tgt.get_package();
        if(pkg)
                row.push_back(pkg->get_name());
        else
@@ -85,7 +85,7 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth)
 
        if(!max_depth || depth<max_depth-1)
        {
-               const TargetList &depends=tgt.get_depends();
+               const TargetList &depends = tgt.get_depends();
                //XXX If we want to sort the targets, we need to take the value of full_paths into account
                //depends.sort(target_order);
                for(TargetList::const_iterator i=depends.begin(); i!=depends.end(); ++i)
@@ -103,7 +103,7 @@ void Analyzer::print_table() const
                if(col_width.size()<i->size())
                        col_width.resize(i->size(), 0);
                for(unsigned j=0; j<i->size(); ++j)
-                       col_width[j]=max(col_width[j], (*i)[j].size());
+                       col_width[j] = max(col_width[j], (*i)[j].size());
        }
 
        for(Table::const_iterator i=table.begin(); i!=table.end(); ++i)
@@ -112,8 +112,8 @@ void Analyzer::print_table() const
                for(unsigned j=0; j<i->size(); ++j)
                {
                        if(j>0)
-                               line+="  ";
-                       line+=lexical_cast((*i)[j], Fmt("%-s").width(col_width[j]));
+                               line += "  ";
+                       line += lexical_cast((*i)[j], Fmt("%-s").width(col_width[j]));
                }
                IO::print("%s\n", line);
        }
index 7dd4c1345d8e3b5d09f25835da88ce996be48bb7..b9afffa9e7e8896a58a10a53535f43fd4d823f85 100644 (file)
@@ -41,9 +41,9 @@ private:
 
 public:
        Analyzer(Builder &);
-       void set_mode(Mode m) { mode=m; }
-       void set_max_depth(unsigned m) { max_depth=m; }
-       void set_full_paths(bool f) { full_paths=f; }
+       void set_mode(Mode m) { mode = m; }
+       void set_max_depth(unsigned m) { max_depth = m; }
+       void set_full_paths(bool f) { full_paths = f; }
 
        /**
        Performs the analysis and prints out the resulting dependency tree.
index c2e91620de962b3246de8cf4f28434fe3fc53f94..65a7577bc2bb36e6f3c26df03c17a3cad4f4462a 100644 (file)
@@ -19,12 +19,12 @@ Architecture::Architecture(Builder &b, const string &n, bool a):
 
 void Architecture::set_tool(const string &t, const string &p)
 {
-       tools[t]=p;
+       tools[t] = p;
 }
 
 std::string Architecture::get_tool(const string &t) const
 {
-       StringMap::const_iterator i=tools.find(t);
+       StringMap::const_iterator i = tools.find(t);
        if(i!=tools.end())
        {
                if(i->second[0]=='-')
@@ -35,7 +35,7 @@ std::string Architecture::get_tool(const string &t) const
 
        if(!native)
        {
-               const Architecture &native_arch=builder.get_native_arch();
+               const Architecture &native_arch = builder.get_native_arch();
                return prefix+"-"+native_arch.get_tool(t);
        }
        else
@@ -52,5 +52,5 @@ Architecture::Loader::Loader(Architecture &a):
 
 void Architecture::Loader::tool(const string &t, const string &p)
 {
-       arch.tools[t]=p;
+       arch.tools[t] = p;
 }
index 3a4d7ec50d966f44d19cdc95f19d8133e3319aa6..aa5f8650ddae92803114d9ffd98049b9e6647071 100644 (file)
@@ -37,7 +37,7 @@ private:
        StringMap tools;
 
 public:
-       Architecture(Builder &b, const std::string &n, bool a=false);
+       Architecture(Builder &b, const std::string &n, bool a = false);
        void set_tool(const std::string &t, const std::string &p);
        std::string get_tool(const std::string &t) const;
        const std::string &get_name() const { return name; }
index 64a88afc63227d33a186de482859d8fd391b3115..a56891b3df15880c33f3da4521a92ef4bd758502 100644 (file)
@@ -21,21 +21,21 @@ using namespace Msp;
 Archive::Archive(Builder &b, const StaticLibrary &lib):
        ExternalAction(b)
 {
-       const Component &comp=lib.get_component();
+       const Component &comp = lib.get_component();
 
-       work_dir=comp.get_package().get_source();
+       work_dir = comp.get_package().get_source();
 
-       std::string tool="AR";
+       std::string tool = "AR";
        argv.push_back(builder.get_current_arch().get_tool(tool));
        argv.push_back("rc");
 
        argv.push_back(relative(lib.get_path(), work_dir).str());
-       const TargetList &deps=lib.get_depends();
+       const TargetList &deps = lib.get_depends();
        for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
-               if(ObjectFile *obj=dynamic_cast<ObjectFile *>(*i))
+               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(*i))
                        argv.push_back(relative(obj->get_path(), work_dir).str());
 
-       FS::Path lpath=lib.get_path();
+       FS::Path lpath = lib.get_path();
        if(!builder.get_dry_run())
        {
                FS::mkpath(FS::dirname(lpath), 0755);
index 591e9347f59298cda7e454f56320d09fb173a4b3..08da59af1c82a4de868cfdb20381a60857d06321 100644 (file)
@@ -24,38 +24,38 @@ Binary::Binary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
        FileTarget(b, &c.get_package(), generate_target_path(c)),
        comp(c)
 {
-       buildable=true;
+       buildable = true;
        for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
                add_depend(*i);
 }
 
 void Binary::find_depends()
 {
-       LibMode libmode=comp.get_package().get_library_mode();
+       LibMode libmode = comp.get_package().get_library_mode();
        if(dynamic_cast<SharedLibrary *>(this))
-               libmode=DYNAMIC;
+               libmode = DYNAMIC;
 
        list<const Component *> queue;
        list<Target *> dep_libs;
        queue.push_back(&comp);
        while(!queue.empty())
        {
-               const Component *c=queue.front();
+               const Component *c = queue.front();
                queue.erase(queue.begin());
 
-               const StringList &libpath=c->get_build_info().libpath;
+               const StringList &libpath = c->get_build_info().libpath;
 
-               const list<string> &libs=c->get_build_info().libs;
+               const list<string> &libs = c->get_build_info().libs;
                for(StringList::const_iterator i=libs.begin(); i!=libs.end(); ++i)
                {
-                       Target *lib=builder.get_library(*i, libpath, libmode);
+                       Target *lib = builder.get_library(*i, libpath, libmode);
                        if(lib)
                        {
                                dep_libs.push_back(lib);
 
-                               if(Install *inst=dynamic_cast<Install *>(lib))
-                                       lib=&inst->get_source();
-                               if(StaticLibrary *stlib=dynamic_cast<StaticLibrary *>(lib))
+                               if(Install *inst = dynamic_cast<Install *>(lib))
+                                       lib = &inst->get_source();
+                               if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(lib))
                                        queue.push_back(&stlib->get_component());
                        }
                        else
@@ -67,14 +67,14 @@ void Binary::find_depends()
        This ensures that static library ordering is correct. */
        for(list<Target *>::iterator i=dep_libs.begin(); i!=dep_libs.end(); ++i)
        {
-               bool last=true;
+               bool last = true;
                for(list<Target *>::iterator j=i; (last && j!=dep_libs.end()); ++j)
-                       last=(j==i || *j!=*i);
+                       last = (j==i || *j!=*i);
                if(last)
                        add_depend(*i);
        }
 
-       deps_ready=true;
+       deps_ready = true;
 }
 
 Action *Binary::create_action()
@@ -84,24 +84,24 @@ Action *Binary::create_action()
 
 FS::Path Binary::generate_target_path(const Component &c)
 {
-       const SourcePackage &pkg=c.get_package();
+       const SourcePackage &pkg = c.get_package();
        string prefix, suffix;
-       const string &arch=pkg.get_builder().get_current_arch().get_name();
+       const string &arch = pkg.get_builder().get_current_arch().get_name();
 
        if(c.get_type()==Component::LIBRARY)
        {
-               prefix="lib";
+               prefix = "lib";
                if(arch=="win32")
-                       suffix=".dll";
+                       suffix = ".dll";
                else
-                       suffix=".so";
+                       suffix = ".so";
        }
        else if(c.get_type()==Component::MODULE)
-               suffix=".m";
+               suffix = ".m";
        else if(c.get_type()==Component::PROGRAM)
        {
                if(arch=="win32")
-                       suffix=".exe";
+                       suffix = ".exe";
        }
 
        return pkg.get_out_dir()/(prefix+c.get_name()+suffix);
index cc15888d3db1d7760bea4682893b750d96eaceb4..8c9ba5c442ef239be662c36672e7f35837ff0773 100644 (file)
@@ -17,34 +17,34 @@ BinaryPackage::BinaryPackage(Builder &b, const string &n):
        Package(b, n),
        need_path(false)
 {
-       use_pkgconfig=false;
+       use_pkgconfig = false;
 }
 
 void BinaryPackage::set_path(const FS::Path &p)
 {
-       path=builder.get_cwd()/p;
+       path = builder.get_cwd()/p;
 }
 
 void BinaryPackage::create_build_info()
 {
        for(StringList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i)
                if((*i)[0]=='@')
-                       *i=(path/i->substr(1)).str();
+                       *i = (path/i->substr(1)).str();
 
        for(StringList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i)
                if((*i)[0]=='@')
-                       *i=(path/i->substr(1)).str();
+                       *i = (path/i->substr(1)).str();
 }
 
 BinaryPackage *BinaryPackage::from_pkgconfig(Builder &builder, const string &name)
 {
-       string info=builder.run_pkgconfig(name, "flags");
+       string info = builder.run_pkgconfig(name, "flags");
 
-       BinaryPackage *pkg=new BinaryPackage(builder, name);
-       pkg->use_pkgconfig=true;
-       BuildInfo &binfo=pkg->export_binfo;
+       BinaryPackage *pkg = new BinaryPackage(builder, name);
+       pkg->use_pkgconfig = true;
+       BuildInfo &binfo = pkg->export_binfo;
 
-       vector<string> flags=split(info);
+       vector<string> flags = split(info);
        for(vector<string>::const_iterator i=flags.begin(); i!=flags.end(); ++i)
        {
                if(!i->compare(0, 2, "-I"))
index ce82ba33351f191f1055eae0a053c915247a2053..76522ad1aaa446f0f305f97881e0d2216491b694 100644 (file)
@@ -46,7 +46,7 @@ namespace {
 void update_hash(string &hash, const string &value)
 {
        for(unsigned i=0; i<value.size(); ++i)
-               hash[i%hash.size()]^=value[i];
+               hash[i%hash.size()] ^= value[i];
 }
 
 }
@@ -70,8 +70,8 @@ Builder::Builder(int argc, char **argv):
 {
        string analyze_mode;
        string work_dir;
-       bool full_paths=false;
-       unsigned max_depth=5;
+       bool full_paths = false;
+       unsigned max_depth = 5;
        StringList cmdline_warn;
        string prfx;
        string arch;
@@ -96,13 +96,13 @@ Builder::Builder(int argc, char **argv):
        getopt.add_option(     "max-depth",  max_depth,     GetOpt::REQUIRED_ARG).set_help("Maximum depth to show in analysis.", "NUM");
        getopt.add_option(     "prefix",     prfx,          GetOpt::REQUIRED_ARG).set_help("Directory to install things to.", "DIR");
        getopt.add_option(     "warnings",   cmdline_warn,  GetOpt::REQUIRED_ARG).set_help("Compiler warnings to use.", "LIST");
-       usagemsg=getopt.generate_usage(argv[0])+" [<target> ...]";
-       helpmsg=getopt.generate_help();
+       usagemsg = getopt.generate_usage(argv[0])+" [<target> ...]";
+       helpmsg = getopt.generate_help();
        getopt(argc, argv);
 
        if(!analyze_mode.empty())
        {
-               analyzer=new Analyzer(*this);
+               analyzer = new Analyzer(*this);
 
                if(analyze_mode=="deps")
                        analyzer->set_mode(Analyzer::DEPS);
@@ -119,12 +119,12 @@ Builder::Builder(int argc, char **argv):
                analyzer->set_full_paths(full_paths);
        }
        else if(!clean && !create_makefile)
-               build=true;
+               build = true;
 
-       const vector<string> &args=getopt.get_args();
+       const vector<string> &args = getopt.get_args();
        for(vector<string>::const_iterator i=args.begin(); i!=args.end(); ++i)
        {
-               string::size_type equal=i->find('=');
+               string::size_type equal = i->find('=');
                if(equal!=string::npos)
                        cmdline_options.insert(StringMap::value_type(i->substr(0, equal), i->substr(equal+1)));
                else
@@ -137,14 +137,14 @@ Builder::Builder(int argc, char **argv):
        if(!work_dir.empty())
                FS::chdir(work_dir);
 
-       cwd=FS::getcwd();
+       cwd = FS::getcwd();
 
        utsname un;
-       string sysname="native";
+       string sysname = "native";
        if(uname(&un)==0)
-               sysname=tolower(un.sysname);
+               sysname = tolower(un.sysname);
 
-       native_arch=&archs.insert(ArchMap::value_type(sysname, Architecture(*this, sysname, true))).first->second;
+       native_arch = &archs.insert(ArchMap::value_type(sysname, Architecture(*this, sysname, true))).first->second;
        native_arch->set_tool("CC",  "gcc");
        native_arch->set_tool("CXX", "g++");
        native_arch->set_tool("LD",  "gcc");
@@ -155,19 +155,19 @@ Builder::Builder(int argc, char **argv):
        load_build_file((FS::get_user_data_dir("builder")/"rc").str());
 
        if(arch.empty())
-               current_arch=native_arch;
+               current_arch = native_arch;
        else
-               current_arch=&get_architecture(arch);
+               current_arch = &get_architecture(arch);
 
        if(prfx.empty())
        {
                if(current_arch->is_native())
-                       prefix=(FS::get_home_dir()/"local").str();
+                       prefix = (FS::get_home_dir()/"local").str();
                else
-                       prefix=(FS::get_home_dir()/"local"/current_arch->get_name()).str();
+                       prefix = (FS::get_home_dir()/"local"/current_arch->get_name()).str();
        }
        else
-               prefix=FS::getcwd()/prfx;
+               prefix = FS::getcwd()/prfx;
 
        warnings.push_back("all");
        warnings.push_back("extra");
@@ -176,7 +176,7 @@ Builder::Builder(int argc, char **argv):
        warnings.push_back("error");
        for(StringList::iterator i=cmdline_warn.begin(); i!=cmdline_warn.end(); ++i)
        {
-               vector<string> warns=split(*i, ',');
+               vector<string> warns = split(*i, ',');
                warnings.insert(warnings.end(), warns.begin(), warns.end());
        }
 
@@ -197,13 +197,13 @@ int Builder::main()
 {
        if(prefix.str()!="/usr")
        {
-               FS::Path pcdir=prefix/"lib"/"pkgconfig";
-               if(const char *pcp=getenv("PKG_CONFIG_PATH"))
+               FS::Path pcdir = prefix/"lib"/"pkgconfig";
+               if(const char *pcp = getenv("PKG_CONFIG_PATH"))
                {
-                       vector<string> path=split(pcp, ':');
-                       bool found=false;
+                       vector<string> path = split(pcp, ':');
+                       bool found = false;
                        for(vector<string>::const_iterator i=path.begin(); (!found && i!=path.end()); ++i)
-                               found=(*i==pcdir.str());
+                               found = (*i==pcdir.str());
                        if(!found)
                        {
                                path.push_back(pcdir.str());
@@ -241,7 +241,7 @@ int Builder::main()
        if(!conf_only && create_targets())
                return 1;
 
-       PackageList all_reqs=main_pkg->collect_requires();
+       PackageList all_reqs = main_pkg->collect_requires();
 
        if(conf_only)
                return 0;
@@ -257,8 +257,8 @@ int Builder::main()
                        IO::print(" %s", (*i)->get_name());
                        if(dynamic_cast<SourcePackage *>(*i))
                                IO::print("*");
-                       unsigned count=0;
-                       unsigned to_be_built=0;
+                       unsigned count = 0;
+                       unsigned to_be_built = 0;
                        for(TargetMap::iterator j=targets.begin(); j!=targets.end(); ++j)
                                if(j->second->get_package()==*i)
                                {
@@ -291,9 +291,9 @@ int Builder::main()
        }
 
        if(clean)
-               exit_code=do_clean();
+               exit_code = do_clean();
        else if(build)
-               exit_code=do_build();
+               exit_code = do_build();
 
        return exit_code;
 }
@@ -317,7 +317,7 @@ string Builder::run_pkgconfig(const string &pkg, const string &what)
                IO::print("Running %s\n", join(argv.begin(), argv.end()));
 
        int status;
-       string res=run_command(argv, &status);
+       string res = run_command(argv, &status);
        if(status)
                throw Exception(format("pkg-config for package %s failed", pkg));
 
@@ -326,25 +326,25 @@ string Builder::run_pkgconfig(const string &pkg, const string &what)
 
 Package *Builder::get_package(const string &name)
 {
-       PackageMap::iterator i=packages.find(format("%s/%s", name, current_arch->get_name()));
+       PackageMap::iterator i = packages.find(format("%s/%s", name, current_arch->get_name()));
        if(i==packages.end())
-               i=packages.find(name);
+               i = packages.find(name);
        if(i!=packages.end())
                return i->second;
 
-       FS::Path path=get_package_location(name);
+       FS::Path path = get_package_location(name);
        if(!path.empty() && !load_build_file(path/"Build"))
        {
-               i=packages.find(name);
+               i = packages.find(name);
                if(i!=packages.end())
                        return i->second;
        }
 
-       Package *pkg=0;
+       Package *pkg = 0;
        try
        {
                // Package source not found - create a binary package
-               pkg=BinaryPackage::from_pkgconfig(*this, name);
+               pkg = BinaryPackage::from_pkgconfig(*this, name);
        }
        catch(...)
        {
@@ -359,7 +359,7 @@ Package *Builder::get_package(const string &name)
 Target *Builder::get_target(const string &n) const
 {
        // XXX Used for getting targets by path.  get_target(const FS::Path &)?
-       TargetMap::const_iterator i=targets.find(n);
+       TargetMap::const_iterator i = targets.find(n);
        if(i!=targets.end())
                return i->second;
        return 0;
@@ -373,8 +373,8 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
        for(list<string>::const_iterator i=path.begin(); i!=path.end(); ++i)
                update_hash(hash, *i);
 
-       string id=hash+include;
-       TargetMap::iterator i=includes.find(id);
+       string id = hash+include;
+       TargetMap::iterator i = includes.find(id);
        if(i!=includes.end())
                return i->second;
 
@@ -384,12 +384,12 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
                StringList argv;
                argv.push_back(current_arch->get_tool("CXX"));
                argv.push_back("--version");
-               if(RegMatch m=Regex("[0-9]\\.[0-9.]+").match(run_command(argv)))
+               if(RegMatch m = Regex("[0-9]\\.[0-9.]+").match(run_command(argv)))
                {
-                       cxx_ver=m[0].str;
+                       cxx_ver = m[0].str;
                        while(!cxx_ver.empty() && !FS::is_dir(FS::Path("/usr/include/c++")/cxx_ver))
                        {
-                               string::size_type dot=cxx_ver.rfind('.');
+                               string::size_type dot = cxx_ver.rfind('.');
                                if(dot==string::npos)
                                        break;
                                cxx_ver.erase(dot);
@@ -398,10 +398,10 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
                                IO::print("C++ version is %s\n", cxx_ver);
                }
                else
-                       cxx_ver="-";
+                       cxx_ver = "-";
        }
 
-       string fn=include.substr(1);
+       string fn = include.substr(1);
        if(verbose>=5)
                IO::print("Looking for include %s from %s with path %s\n", fn, from, join(path.begin(), path.end()));
 
@@ -413,13 +413,13 @@ Target *Builder::get_header(const string &include, const FS::Path &from, const l
        if(cxx_ver!="-")
                syspath.push_back((FS::Path("/usr/include/c++/")/cxx_ver).str());
 
-       Target *tgt=0;
+       Target *tgt = 0;
        if(include[0]=='\"')
-               tgt=get_header(FS::Path(from)/fn);
+               tgt = get_header(FS::Path(from)/fn);
        for(list<string>::const_iterator j=path.begin(); (!tgt && j!=path.end()); ++j)
-               tgt=get_header(cwd/ *j/fn);
+               tgt = get_header(cwd/ *j/fn);
        for(list<string>::const_iterator j=syspath.begin(); (!tgt && j!=syspath.end()); ++j)
-               tgt=get_header(FS::Path(*j)/fn);
+               tgt = get_header(FS::Path(*j)/fn);
 
        includes.insert(TargetMap::value_type(id, tgt));
 
@@ -432,8 +432,8 @@ Target *Builder::get_library(const string &lib, const list<string> &path, LibMod
        for(list<string>::const_iterator i=path.begin(); i!=path.end(); ++i)
                update_hash(hash, *i);
 
-       string id=hash+string(1, mode)+lib;
-       TargetMap::iterator i=libraries.find(id);
+       string id = hash+string(1, mode)+lib;
+       TargetMap::iterator i = libraries.find(id);
        if(i!=libraries.end())
                return i->second;
 
@@ -449,11 +449,11 @@ Target *Builder::get_library(const string &lib, const list<string> &path, LibMod
        if(verbose>=5)
                IO::print("Looking for library %s with path %s\n", lib, join(path.begin(), path.end()));
 
-       Target *tgt=0;
+       Target *tgt = 0;
        for(StringList::const_iterator j=path.begin(); (!tgt && j!=path.end()); ++j)
-               tgt=get_library(lib, cwd/ *j, mode);
+               tgt = get_library(lib, cwd/ *j, mode);
        for(StringList::iterator j=syspath.begin(); (!tgt && j!=syspath.end()); ++j)
-               tgt=get_library(lib, *j, mode);
+               tgt = get_library(lib, *j, mode);
 
        libraries.insert(TargetMap::value_type(id, tgt));
 
@@ -462,7 +462,7 @@ Target *Builder::get_library(const string &lib, const list<string> &path, LibMod
 
 const Architecture &Builder::get_architecture(const string &arch) const
 {
-       ArchMap::const_iterator i=archs.find(arch);
+       ArchMap::const_iterator i = archs.find(arch);
        if(i==archs.end())
                throw KeyError("Unknown architecture", arch);
 
@@ -471,11 +471,11 @@ const Architecture &Builder::get_architecture(const string &arch) const
 
 void Builder::apply_profile_template(Config &config, const string &pt) const
 {
-       vector<string> parts=split(pt, '-');
+       vector<string> parts = split(pt, '-');
 
        for(vector<string>::iterator i=parts.begin(); i!=parts.end(); ++i)
        {
-               ProfileTemplateMap::const_iterator j=profile_tmpl.find(*i);
+               ProfileTemplateMap::const_iterator j = profile_tmpl.find(*i);
                if(j==profile_tmpl.end())
                        continue;
 
@@ -518,7 +518,7 @@ FS::Path Builder::get_package_location(const string &name)
        try
        {
                // Try to get source directory with pkgconfig
-               string srcdir=strip(run_pkgconfig(name, "source"));
+               string srcdir = strip(run_pkgconfig(name, "source"));
                if(!srcdir.empty())
                        return srcdir;
        }
@@ -529,10 +529,10 @@ FS::Path Builder::get_package_location(const string &name)
        {
                for(list<FS::Path>::const_iterator i=pkg_path.begin(); i!=pkg_path.end(); ++i)
                {
-                       list<string> files=list_files(*i);
+                       list<string> files = list_files(*i);
                        for(list<string>::const_iterator j=files.begin(); j!=files.end(); ++j)
                        {
-                               FS::Path full=*i / *j;
+                               FS::Path full = *i / *j;
                                if(FS::exists(full/"Build"))
                                        pkg_dirs.push_back(full);
                        }
@@ -541,11 +541,11 @@ FS::Path Builder::get_package_location(const string &name)
                        IO::print("%d packages found in path\n", pkg_dirs.size());
        }
 
-       bool msp=!name.compare(0, 3, "msp");
+       bool msp = !name.compare(0, 3, "msp");
        for(list<FS::Path>::const_iterator i=pkg_dirs.begin(); i!=pkg_dirs.end(); ++i)
        {
-               string base=basename(*i);
-               unsigned dash=base.rfind('-');
+               string base = basename(*i);
+               unsigned dash = base.rfind('-');
 
                if(!base.compare(0, dash, name))
                        return *i;
@@ -579,31 +579,31 @@ int Builder::load_build_file(const FS::Path &fn)
 
 int Builder::create_targets()
 {
-       Target *world=new VirtualTarget(*this, "world");
+       Target *world = new VirtualTarget(*this, "world");
 
-       Target *def_tgt=new VirtualTarget(*this, "default");
+       Target *def_tgt = new VirtualTarget(*this, "default");
        world->add_depend(def_tgt);
 
-       Target *install=new VirtualTarget(*this, "install");
+       Target *install = new VirtualTarget(*this, "install");
        world->add_depend(install);
 
-       Target *tarballs=new VirtualTarget(*this, "tarballs");
+       Target *tarballs = new VirtualTarget(*this, "tarballs");
        world->add_depend(tarballs);
 
-       PackageList all_reqs=main_pkg->collect_requires();
+       PackageList all_reqs = main_pkg->collect_requires();
        for(PackageList::iterator i=all_reqs.begin(); i!=all_reqs.end(); ++i)
        {
-               SourcePackage *spkg=dynamic_cast<SourcePackage *>(*i);
+               SourcePackage *spkg = dynamic_cast<SourcePackage *>(*i);
                if(!spkg)
                        continue;
 
-               const ComponentList &components=spkg->get_components();
+               const ComponentList &components = spkg->get_components();
                for(ComponentList::const_iterator j=components.begin(); j!=components.end(); ++j)
                        j->create_targets();
 
                if(spkg->get_install_flags()&(SourcePackage::LIB|SourcePackage::INCLUDE))
                {
-                       PkgConfig *pc=new PkgConfig(*this, *spkg);
+                       PkgConfig *pc = new PkgConfig(*this, *spkg);
                        install->add_depend(new Install(*this, *spkg, *pc));
                }
        }
@@ -611,7 +611,7 @@ int Builder::create_targets()
        // Find dependencies until no new targets are created
        while(!new_tgts.empty())
        {
-               Target *tgt=new_tgts.front();
+               Target *tgt = new_tgts.front();
                new_tgts.erase(new_tgts.begin());
                tgt->find_depends();
                if(!tgt->get_depends_ready())
@@ -621,7 +621,7 @@ int Builder::create_targets()
        // Apply what-ifs
        for(StringList::iterator i=what_if.begin(); i!=what_if.end(); ++i)
        {
-               Target *tgt=get_target((cwd/ *i).str());
+               Target *tgt = get_target((cwd/ *i).str());
                if(!tgt)
                {
                        IO::print(IO::cerr, "Unknown what-if target %s\n", *i);
@@ -631,27 +631,27 @@ int Builder::create_targets()
        }
 
        // Make the cmdline target depend on all targets mentioned on the command line
-       Target *cmdline=new VirtualTarget(*this, "cmdline");
-       bool build_world=false;
+       Target *cmdline = new VirtualTarget(*this, "cmdline");
+       bool build_world = false;
        for(list<string>::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
        {
-               Target *tgt=get_target(*i);
+               Target *tgt = get_target(*i);
                if(!tgt)
-                       tgt=get_target((cwd/ *i).str());
+                       tgt = get_target((cwd/ *i).str());
                if(!tgt)
                {
                        IO::print("I don't know anything about %s\n", *i);
                        return -1;
                }
                if(tgt==world)
-                       build_world=true;
+                       build_world = true;
                cmdline->add_depend(tgt);
        }
 
        cmdline->prepare();
 
        for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i)
-               if(SourcePackage *spkg=dynamic_cast<SourcePackage *>(i->second))
+               if(SourcePackage *spkg = dynamic_cast<SourcePackage *>(i->second))
                        spkg->get_deps_cache().save();
 
        return 0;
@@ -659,12 +659,12 @@ int Builder::create_targets()
 
 Target *Builder::get_header(const FS::Path &fn)
 {
-       Target *tgt=get_target(fn.str());
+       Target *tgt = get_target(fn.str());
        if(tgt) return tgt;
 
        if(FS::is_reg(fn))
        {
-               tgt=new SystemHeader(*this, fn.str());
+               tgt = new SystemHeader(*this, fn.str());
                return tgt;
        }
        return 0;
@@ -694,14 +694,14 @@ Target *Builder::get_library(const string &lib, const FS::Path &path, LibMode mo
 
        for(StringList::iterator i=candidates.begin(); i!=candidates.end(); ++i)
        {
-               string full=(path/ *i).str();
-               Target *tgt=get_target(full);
+               string full = (path/ *i).str();
+               Target *tgt = get_target(full);
 
                if(tgt)
                {
-                       Target *real_tgt=tgt;
-                       if(Install *inst=dynamic_cast<Install *>(tgt))
-                               real_tgt=&inst->get_source();
+                       Target *real_tgt = tgt;
+                       if(Install *inst = dynamic_cast<Install *>(tgt))
+                               real_tgt = &inst->get_source();
 
                        /* Ignore dynamic libraries from local packages unless library mode is
                        DYNAMIC */
@@ -712,7 +712,7 @@ Target *Builder::get_library(const string &lib, const FS::Path &path, LibMode mo
                }
                else if(FS::is_reg(full))
                {
-                       tgt=new SystemLibrary(*this, full);
+                       tgt = new SystemLibrary(*this, full);
                        return tgt;
                }
        }
@@ -722,9 +722,9 @@ Target *Builder::get_library(const string &lib, const FS::Path &path, LibMode mo
 
 int Builder::do_build()
 {
-       Target *cmdline=get_target("cmdline");
+       Target *cmdline = get_target("cmdline");
 
-       unsigned total=0;
+       unsigned total = 0;
        for(map<string, Target *>::const_iterator i=targets.begin(); i!=targets.end(); ++i)
                if(i->second->is_buildable() && i->second->get_rebuild())
                        ++total;
@@ -739,19 +739,19 @@ int Builder::do_build()
 
        vector<Action *> actions;
 
-       unsigned count=0;
+       unsigned count = 0;
 
-       bool fail=false;
-       bool finish=false;
+       bool fail = false;
+       bool finish = false;
 
        while(!finish)
        {
                if(actions.size()<jobs && !fail)
                {
-                       Target *tgt=cmdline->get_buildable_target();
+                       Target *tgt = cmdline->get_buildable_target();
                        if(tgt)
                        {
-                               Action *action=tgt->build();
+                               Action *action = tgt->build();
                                if(action)
                                        actions.push_back(action);
 
@@ -759,14 +759,14 @@ int Builder::do_build()
                                        IO::print("%d of %d target%s built\033[1G", count, total, (total!=1 ? "s" : ""));
                        }
                        else if(actions.empty())
-                               finish=true;
+                               finish = true;
                }
                else
                        Time::sleep(10*Time::msec);
 
                for(unsigned i=0; i<actions.size();)
                {
-                       int status=actions[i]->check();
+                       int status = actions[i]->check();
                        if(status>=0)
                        {
                                ++count;
@@ -774,9 +774,9 @@ int Builder::do_build()
                                delete actions[i];
                                actions.erase(actions.begin()+i);
                                if(status>0)
-                                       fail=true;
+                                       fail = true;
                                if(actions.empty() && fail)
-                                       finish=true;
+                                       finish = true;
                        }
                        else
                                ++i;
@@ -803,22 +803,22 @@ int Builder::do_clean()
 
        while(!queue.empty())
        {
-               Target *tgt=queue.front();
+               Target *tgt = queue.front();
                queue.erase(queue.begin());
 
                if(tgt->is_buildable() && (tgt->get_package()==main_pkg || clean>=2))
                        clean_tgts.insert(tgt);
 
-               const TargetList &deps=tgt->get_depends();
+               const TargetList &deps = tgt->get_depends();
                for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
                        if(!clean_tgts.count(*i))
                                queue.push_back(*i);
        }
 
        for(set<Target *>::iterator i=clean_tgts.begin(); i!=clean_tgts.end(); ++i)
-               if(FileTarget *ft=dynamic_cast<FileTarget *>(*i))
+               if(FileTarget *ft = dynamic_cast<FileTarget *>(*i))
                {
-                       Action *action=new Unlink(*this, *ft);
+                       Action *action = new Unlink(*this, *ft);
                        while(action->check()<0) ;
                        delete action;
                }
@@ -828,11 +828,11 @@ int Builder::do_clean()
 
 void Builder::package_help()
 {
-       const Config &config=main_pkg->get_config();
-       const Config::OptionMap &options=config.get_options();
+       const Config &config = main_pkg->get_config();
+       const Config::OptionMap &options = config.get_options();
 
        IO::print("Required packages:\n  ");
-       const PackageList &requires=main_pkg->get_requires();
+       const PackageList &requires = main_pkg->get_requires();
        for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
        {
                if(i!=requires.begin())
@@ -842,7 +842,7 @@ void Builder::package_help()
        IO::print("\n\nPackage configuration:\n");
        for(Config::OptionMap::const_iterator i=options.begin(); i!=options.end(); ++i)
        {
-               const Config::Option &opt=i->second;
+               const Config::Option &opt = i->second;
                IO::print("  %s: %s (%s)", opt.name, opt.descr, opt.value);
                if(opt.value!=opt.defv)
                        IO::print(" [%s]", opt.defv);
@@ -874,7 +874,7 @@ void Builder::Loader::architecture(const string &n)
 
 void Builder::Loader::binpkg(const string &n)
 {
-       BinaryPackage *pkg=new BinaryPackage(bld, n);
+       BinaryPackage *pkg = new BinaryPackage(bld, n);
        load_sub(*pkg);
        bld.packages.insert(PackageMap::value_type(n, pkg));
 }
@@ -889,9 +889,9 @@ void Builder::Loader::profile(const string &n)
 
 void Builder::Loader::package(const string &n)
 {
-       SourcePackage *pkg=new SourcePackage(bld, n, src);
+       SourcePackage *pkg = new SourcePackage(bld, n, src);
        if(!bld.main_pkg)
-               bld.main_pkg=pkg;
+               bld.main_pkg = pkg;
 
        load_sub(*pkg);
        bld.packages.insert(PackageMap::value_type(n, pkg));
index 9ad0a557706b687d2a2775044c8fc55e6386019f..82596253fe8ee103b8d153a70eeb3a9377c1c69f 100644 (file)
@@ -21,7 +21,7 @@ void unique(StringList &l)
                for(StringList::iterator j=i; j!=l.end();)
                {
                        if(j!=i && *j==*i)
-                               j=l.erase(j);
+                               j = l.erase(j);
                        else
                                ++j;
                }
@@ -52,23 +52,23 @@ void BuildInfo::unique()
 
        for(StringList::iterator i=warnings.begin(); i!=warnings.end(); ++i)
        {
-               bool flag=i->compare(0, 3, "no-");
+               bool flag = i->compare(0, 3, "no-");
 
-               string warn=(flag ? *i : i->substr(3));
-               string no_warn="no-"+warn;
+               string warn = (flag ? *i : i->substr(3));
+               string no_warn = "no-"+warn;
 
                for(StringList::iterator j=i; j!=warnings.end();)
                {
                        if(j!=i && (*j==warn || *j==no_warn))
                        {
-                               flag=(*j==warn);
-                               j=warnings.erase(j);
+                               flag = (*j==warn);
+                               j = warnings.erase(j);
                        }
                        else
                                ++j;
                }
 
-               *i=(flag ? warn : no_warn);
+               *i = (flag ? warn : no_warn);
        }
 }
 
index 4a0e85ed5cab98db2a74e125d4541cae53d7e512..f6a4dd65dc4add29b60ede81725fb2d4d62d24c8 100644 (file)
@@ -21,23 +21,23 @@ using namespace Msp;
 Compile::Compile(Builder &b, const ObjectFile &obj):
        ExternalAction(b)
 {
-       const Component &comp=obj.get_component();
+       const Component &comp = obj.get_component();
 
-       work_dir=comp.get_package().get_source();
+       work_dir = comp.get_package().get_source();
 
-       FS::Path spath=obj.get_source().get_path();
+       FS::Path spath = obj.get_source().get_path();
 
-       string ext=FS::extpart(spath.str());
-       const char *tool=0;
+       string ext = FS::extpart(spath.str());
+       const char *tool = 0;
        if(ext==".cpp" || ext==".cc")
-               tool="CXX";
+               tool = "CXX";
        else
-               tool="CC";
+               tool = "CC";
 
        argv.push_back(builder.get_current_arch().get_tool(tool));
        argv.push_back("-c");
 
-       const BuildInfo &binfo=comp.get_build_info();
+       const BuildInfo &binfo = comp.get_build_info();
        for(list<string>::const_iterator i=binfo.warnings.begin(); i!=binfo.warnings.end(); ++i)
                argv.push_back("-W"+*i);
        for(list<string>::const_iterator i=binfo.cflags.begin(); i!=binfo.cflags.end(); ++i)
@@ -47,7 +47,7 @@ Compile::Compile(Builder &b, const ObjectFile &obj):
        for(list<string>::const_iterator i=binfo.defines.begin(); i!=binfo.defines.end(); ++i)
                argv.push_back("-D"+*i);
 
-       FS::Path opath=obj.get_path();
+       FS::Path opath = obj.get_path();
        argv.push_back("-o");
        argv.push_back(relative(opath, work_dir).str());
        argv.push_back(relative(spath, work_dir).str());
index 5e32de5275f12a2dc1eb1f66c3466d15b482e050..5c1d9f6b6b6a9d3ab35d83cc1258a4921557b6d3 100644 (file)
@@ -46,24 +46,24 @@ void Component::create_build_info()
                build_info.add((*i)->get_exported_binfo());
 
        for(StringList::iterator i=build_info.incpath.begin(); i!=build_info.incpath.end(); ++i)
-               *i=(pkg.get_source() / *i).str();
+               *i = (pkg.get_source() / *i).str();
        for(StringList::iterator i=build_info.libpath.begin(); i!=build_info.libpath.end(); ++i)
-               *i=(pkg.get_source() / *i).str();
+               *i = (pkg.get_source() / *i).str();
 
        if(pkg.get_library_mode()!=DYNAMIC)
        {
                // XXX This may pull in some unnecessary libpaths too.  More thought required.
-               PackageList reqs=pkg.collect_requires();
+               PackageList reqs = pkg.collect_requires();
                for(PackageList::iterator i=reqs.begin(); i!=reqs.end(); ++i)
                {
-                       const BuildInfo &ebi=(*i)->get_exported_binfo();
+                       const BuildInfo &ebi = (*i)->get_exported_binfo();
                        build_info.libpath.insert(build_info.libpath.end(), ebi.libpath.begin(), ebi.libpath.end());
                }
        }
 
        if(type==PROGRAM)
        {
-               string strip=pkg.get_config().get_option("strip").value;
+               string strip = pkg.get_config().get_option("strip").value;
                if(lexical_cast<bool>(strip))
                        build_info.ldflags.push_back("-s");
        }
@@ -79,7 +79,7 @@ void Component::create_build_info()
        }
        else if(module_host)
        {
-               const PathList &host_src=module_host->get_sources();
+               const PathList &host_src = module_host->get_sources();
                for(PathList::const_iterator i=host_src.begin(); i!=host_src.end(); ++i)
                        build_info.incpath.push_back(i->str());
        }
@@ -89,24 +89,24 @@ void Component::create_build_info()
 
 void Component::create_targets() const
 {
-       Builder &builder=pkg.get_builder();
-       Target *world=builder.get_target("world");
-       Target *def_tgt=builder.get_target("default");
+       Builder &builder = pkg.get_builder();
+       Target *world = builder.get_target("world");
+       Target *def_tgt = builder.get_target("default");
 
-       PathList files=collect_source_files();
+       PathList files = collect_source_files();
        list<FileTarget *> inst_list;
 
        string inst_loc;
        if(type==TARBALL)
        {
-               string tarname=name;
+               string tarname = name;
                if(name=="@src")
-                       tarname=pkg.get_name()+"-"+pkg.get_version();
-               TarBall *result=new TarBall(builder, pkg, tarname);
+                       tarname = pkg.get_name()+"-"+pkg.get_version();
+               TarBall *result = new TarBall(builder, pkg, tarname);
 
                if(name=="@src")
                {
-                       const TargetMap &targets=builder.get_targets();
+                       const TargetMap &targets = builder.get_targets();
                        for(TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
                                if(i->second->get_package()==&pkg && !i->second->is_buildable())
                                        result->add_depend(i->second);
@@ -116,39 +116,39 @@ void Component::create_targets() const
                for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i)
                {
                        FileTarget *ft;
-                       if(Target *tgt=builder.get_target(i->str()))
-                               ft=dynamic_cast<FileTarget *>(tgt);
+                       if(Target *tgt = builder.get_target(i->str()))
+                               ft = dynamic_cast<FileTarget *>(tgt);
                        else
-                               ft=new File(builder, *i);
+                               ft = new File(builder, *i);
                        result->add_depend(ft);
                }
 
-               Target *tarbls_tgt=builder.get_target("tarballs");
+               Target *tarbls_tgt = builder.get_target("tarballs");
                tarbls_tgt->add_depend(result);
 
                return;
        }
        else if(type==INSTALL)
        {
-               inst_loc=name;
+               inst_loc = name;
                for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i)
                {
                        FileTarget *ft;
-                       if(Target *tgt=builder.get_target(i->str()))
-                               ft=dynamic_cast<FileTarget *>(tgt);
+                       if(Target *tgt = builder.get_target(i->str()))
+                               ft = dynamic_cast<FileTarget *>(tgt);
                        else
-                               ft=new File(builder, pkg, *i);
+                               ft = new File(builder, pkg, *i);
                        inst_list.push_back(ft);
                }
        }
        else if(type==DATAFILE)
        {
                File *source;
-               if(Target *tgt=builder.get_target(files.front().str()))
-                       source=dynamic_cast<File *>(tgt);
+               if(Target *tgt = builder.get_target(files.front().str()))
+                       source = dynamic_cast<File *>(tgt);
                else
-                       source=new File(builder, pkg, files.front());
-               ::DataFile *result=new ::DataFile(builder, *this, *source);
+                       source = new File(builder, pkg, files.front());
+               ::DataFile *result = new ::DataFile(builder, *this, *source);
 
                if(&pkg==builder.get_main_package() && deflt)
                        def_tgt->add_depend(result);
@@ -161,12 +161,12 @@ void Component::create_targets() const
        {
                for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i)
                {
-                       string ext=FS::extpart(FS::basename(*i));
+                       string ext = FS::extpart(FS::basename(*i));
                        if(ext==".h")
                        {
-                               FileTarget *hdr=dynamic_cast<FileTarget *>(builder.get_target(i->str()));
+                               FileTarget *hdr = dynamic_cast<FileTarget *>(builder.get_target(i->str()));
                                if(!hdr)
-                                       hdr=new Header(builder, *this, i->str());
+                                       hdr = new Header(builder, *this, i->str());
 
                                // Install headers if requested
                                if(type==HEADERS && install)
@@ -180,11 +180,11 @@ void Component::create_targets() const
                list<ObjectFile *> objs;
                for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i)
                {
-                       string ext=FS::extpart(FS::basename(*i));
+                       string ext = FS::extpart(FS::basename(*i));
                        if((ext==".cpp" || ext==".cc" || ext==".c"))
                        {
-                               SourceFile *src=new SourceFile(builder, *this, i->str());
-                               ObjectFile *obj=new ObjectFile(builder, *this, *src);
+                               SourceFile *src = new SourceFile(builder, *this, i->str());
+                               ObjectFile *obj = new ObjectFile(builder, *this, *src);
                                objs.push_back(obj);
                        }
                }
@@ -209,7 +209,7 @@ void Component::create_targets() const
                }
        }
 
-       Target *inst_tgt=builder.get_target("install");
+       Target *inst_tgt = builder.get_target("install");
        for(list<FileTarget *>::const_iterator i=inst_list.begin(); i!=inst_list.end(); ++i)
                inst_tgt->add_depend(new Install(builder, pkg, **i, inst_loc));
 }
@@ -221,7 +221,7 @@ PathList Component::collect_source_files() const
        {
                if(FS::is_dir(*i))
                {
-                       list<string> sfiles=list_files(*i);
+                       list<string> sfiles = list_files(*i);
                        for(list<string>::iterator j=sfiles.begin(); j!=sfiles.end(); ++j)
                                files.push_back(*i / *j);
                }
@@ -251,8 +251,8 @@ void Component::Loader::finish()
        if(!inst_hdr.empty())
        {
                Component hdrcomp(comp.pkg, HEADERS, inst_hdr);
-               hdrcomp.sources=comp.sources;
-               hdrcomp.install=true;
+               hdrcomp.sources = comp.sources;
+               hdrcomp.install = true;
                const_cast<ComponentList &>(comp.pkg.get_components()).push_back(hdrcomp);
        }
 }
@@ -264,7 +264,7 @@ void Component::Loader::source(const string &s)
 
 void Component::Loader::require(const string &n)
 {
-       Package *req=comp.pkg.get_builder().get_package(n);
+       Package *req = comp.pkg.get_builder().get_package(n);
        if(req)
                comp.requires.push_back(req);
 }
@@ -273,18 +273,18 @@ void Component::Loader::modular()
 {
        if(comp.type!=PROGRAM)
                throw Exception("Only programs can be modular");
-       comp.modular=true;
+       comp.modular = true;
 }
 
 void Component::Loader::host(const string &n)
 {
-       const ComponentList &comps=comp.pkg.get_components();
+       const ComponentList &comps = comp.pkg.get_components();
        for(ComponentList::const_iterator i=comps.begin(); i!=comps.end(); ++i)
                if(i->get_name()==n)
                {
                        if(i->get_type()!=PROGRAM || !i->is_modular())
                                throw Exception("Module host must be a modular program");
-                       comp.module_host=&*i;
+                       comp.module_host = &*i;
                        return;
                }
 
@@ -296,11 +296,11 @@ void Component::Loader::install_headers(const string &p)
        IO::print("%s: Note: install_headers is deprecated\n", get_source());
        if(comp.type==HEADERS)
        {
-               comp.name=p;
-               comp.install=true;
+               comp.name = p;
+               comp.install = true;
        }
        else
-               inst_hdr=p;
+               inst_hdr = p;
 }
 
 void Component::Loader::build_info()
index 4c9ac0b84453935c8afa3b86cc4cfcdb934afcd9..314d9c93688c592f80d9c07452cedb2c31be8cb7 100644 (file)
@@ -16,14 +16,14 @@ using namespace Msp;
 Condition::Condition(SourcePackage &p, const string &expr):
        pkg(p)
 {
-       vector<string> parts=split(expr);
+       vector<string> parts = split(expr);
 
        for(vector<string>::iterator i=parts.begin(); i!=parts.end(); ++i)
        {
                if(*i=="and")
                        continue;
 
-               string::size_type token=i->find_first_of("=!");
+               string::size_type token = i->find_first_of("=!");
                if(token==string::npos)
                        expression.insert(StringMap::value_type(*i, "!0"));
                else if(token==0 && (*i)[0]=='!')
@@ -35,24 +35,24 @@ Condition::Condition(SourcePackage &p, const string &expr):
 
 bool Condition::eval()
 {
-       const Config &conf=pkg.get_config();
+       const Config &conf = pkg.get_config();
 
-       bool result=true;
+       bool result = true;
        for(StringMap::iterator i=expression.begin(); i!=expression.end(); ++i)
        {
-               bool neg=(i->second[0]=='!');
-               unsigned start=1;
+               bool neg = (i->second[0]=='!');
+               unsigned start = 1;
                if(i->second[1]=='=')
                        ++start;
 
                string value;
                if(conf.is_option(i->first))
-                       value=conf.get_option(i->first).value;
+                       value = conf.get_option(i->first).value;
                else if(i->first=="arch")
-                       value=pkg.get_builder().get_current_arch().get_name();
+                       value = pkg.get_builder().get_current_arch().get_name();
 
                if((value==i->second.substr(start))==neg)
-                       result=false;
+                       result = false;
        }
 
        return result;
index 99bfeeaf14c84107a87dd9729356f1ea1dec8cdc..4ec969ac581d849bcd3cf6cb50bec4ef3654832d 100644 (file)
@@ -32,7 +32,7 @@ void Config::add_option(const string &n, const string &v, const string &d)
 
 const Config::Option &Config::get_option(const string &name) const
 {
-       OptionMap::const_iterator i=options.find(name);
+       OptionMap::const_iterator i = options.find(name);
        if(i==options.end())
                throw KeyError("Unknown option", name);
 
@@ -56,9 +56,9 @@ void Config::select_last_profile()
        catch(const IO::FileNotFound &)
        { }
 
-       freeze_mtime=true;
+       freeze_mtime = true;
        package.get_builder().apply_profile_template(*this, get_option("profile").value);
-       freeze_mtime=false;
+       freeze_mtime = false;
 
        load();
 }
@@ -73,24 +73,24 @@ void Config::select_profile(const string &profile)
                IO::print(out, "%s\n", profile);
        }
 
-       freeze_mtime=true;
+       freeze_mtime = true;
        package.get_builder().apply_profile_template(*this, profile);
-       freeze_mtime=false;
+       freeze_mtime = false;
 
        load();
 }
 
 bool Config::update(const StringMap &opts)
 {
-       bool changed=false;
+       bool changed = false;
        for(StringMap::const_iterator i=opts.begin(); i!=opts.end(); ++i)
        {
                if(set_option(i->first, i->second) && i->first!="profile")
-                       changed=true;
+                       changed = true;
        }
 
        if(changed && !freeze_mtime)
-               mtime=Time::now();
+               mtime = Time::now();
 
        return changed;
 }
@@ -99,41 +99,41 @@ void Config::finish()
 {
        for(unsigned n=0; n<20; ++n)
        {
-               bool changed=false;
+               bool changed = false;
                for(OptionMap::iterator i=options.begin(); i!=options.end(); ++i)
                {
-                       Option &opt=i->second;
-                       string::size_type dollar=0;
-                       while((dollar=opt.value.find('$', dollar))!=string::npos)
+                       Option &opt = i->second;
+                       string::size_type dollar = 0;
+                       while((dollar = opt.value.find('$', dollar))!=string::npos)
                        {
                                string::size_type end;
                                string var;
                                if(opt.value[dollar+1]=='{')
                                {
-                                       end=opt.value.find('}', dollar+2);
+                                       end = opt.value.find('}', dollar+2);
                                        if(end==string::npos)
                                                throw Exception("Unterminated variable reference");
-                                       var=opt.value.substr(dollar+2, end-dollar-2);
+                                       var = opt.value.substr(dollar+2, end-dollar-2);
                                        ++end;
                                }
                                else
                                {
                                        for(end=dollar+1; (isalnum(opt.value[end]) && opt.value[end]!='_'); ++end) ;
-                                       var=opt.value.substr(dollar+1, end-dollar-1);
+                                       var = opt.value.substr(dollar+1, end-dollar-1);
                                }
 
                                string value;
                                if(is_option(var))
-                                       value=get_option(var).value;
+                                       value = get_option(var).value;
                                else if(var=="arch")
-                                       value=package.get_builder().get_current_arch().get_name();
-                               else if(const char *ptr=getenv(var.c_str()))
-                                       value=ptr;
+                                       value = package.get_builder().get_current_arch().get_name();
+                               else if(const char *ptr = getenv(var.c_str()))
+                                       value = ptr;
 
                                opt.value.replace(dollar, end-dollar, value);
 
-                               dollar+=value.size();
-                               changed=true;
+                               dollar += value.size();
+                               changed = true;
                        }
                }
 
@@ -144,11 +144,11 @@ void Config::finish()
 
 void Config::save() const
 {
-       FS::Path fn=package.get_source()/".options";
+       FS::Path fn = package.get_source()/".options";
 
-       OptionMap::const_iterator i=options.find("profile");
+       OptionMap::const_iterator i = options.find("profile");
        if(i!=options.end())
-               fn=package.get_source()/(".options."+i->second.value);
+               fn = package.get_source()/(".options."+i->second.value);
 
        IO::BufferedFile out(fn.str(), IO::M_WRITE);
 
@@ -158,14 +158,14 @@ void Config::save() const
 
 bool Config::set_option(const string &opt, const string &val)
 {
-       bool result=false;
+       bool result = false;
 
-       OptionMap::iterator i=options.find(opt);
+       OptionMap::iterator i = options.find(opt);
        if(i!=options.end())
        {
                if(i->second.value!=val)
-                       result=true;
-               i->second.value=val;
+                       result = true;
+               i->second.value = val;
        }
 
        return result;
@@ -173,13 +173,13 @@ bool Config::set_option(const string &opt, const string &val)
 
 void Config::load()
 {
-       FS::Path fn=package.get_source()/(".options."+get_option("profile").value);
+       FS::Path fn = package.get_source()/(".options."+get_option("profile").value);
 
        try
        {
                IO::BufferedFile in(fn.str());
 
-               mtime=Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
+               mtime = Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
 
                DataFile::Parser parser(in, fn.str());
                Loader loader(*this);
index 6c24cdccc2e769960ff71e1631ff71139982a501..581221a516e04246a7c1e048ccfe4896cc16d584 100644 (file)
@@ -28,7 +28,7 @@ Copy::Copy(Builder &b, const Package &pkg, const FS::Path &s, const FS::Path &d)
                IO::print("%s -> %s\n", s, d);
 
        if(!builder.get_dry_run())
-               worker=new Worker(*this);
+               worker = new Worker(*this);
 }
 
 
@@ -52,7 +52,7 @@ void Copy::Worker::main()
                catch(const Exception &e)
                {
                        IO::print(IO::cerr, "%s\n", e.what());
-                       done=error=true;
+                       done = error = true;
                        return;
                }
        }
@@ -66,20 +66,20 @@ void Copy::Worker::main()
                char buf[16384];
                while(!in.eof())
                {
-                       unsigned len=in.read(buf, sizeof(buf));
+                       unsigned len = in.read(buf, sizeof(buf));
                        out.write(buf, len);
                }
        }
        catch(const Exception &e)
        {
                IO::print(IO::cerr, "%s\n", e.what());
-               done=error=true;
+               done = error = true;
                return;
        }
 
        // Preserve file permissions
-       struct stat st=FS::stat(copy.src);
+       struct stat st = FS::stat(copy.src);
        chmod(copy.dest.str().c_str(), st.st_mode&0777);
 
-       done=true;
+       done = true;
 }
index 9e9a2874b071f0d48641f0e6d76c831fe2508dc6..5fa5a53b2d8aa4b8b135754bb59b26a51cc6cff3 100644 (file)
@@ -19,19 +19,19 @@ using namespace Msp;
 DataCompile::DataCompile(Builder &b, ::DataFile &dfile):
        ExternalAction(b)
 {
-       const Component &comp=dfile.get_component();
+       const Component &comp = dfile.get_component();
 
-       work_dir=comp.get_package().get_source();
+       work_dir = comp.get_package().get_source();
 
        argv.push_back("mspdatatool");
        argv.push_back("-c");
        argv.push_back("-b");
 
-       FS::Path opath=dfile.get_path();
+       FS::Path opath = dfile.get_path();
        argv.push_back("-o");
        argv.push_back(relative(opath, work_dir).str());
 
-       FS::Path spath=dfile.get_source().get_path();
+       FS::Path spath = dfile.get_source().get_path();
        argv.push_back(relative(spath, work_dir).str());
 
        if(!builder.get_dry_run())
index 66e610c6f9c1369c824ef0240a8884cb9002b7f3..12acfe6db9de2018b51fb0384ca650ea4747c031 100644 (file)
@@ -16,7 +16,7 @@ DataFile::DataFile(Builder &b, const Component &c, File &s):
        component(c),
        source(s)
 {
-       buildable=true;
+       buildable = true;
        add_depend(&source);
 }
 
index 08d8af7538630f69cf1873672eed289b3a9d8d8e..ffc6fd63fbc7291c289395f9230abc78a83378ca 100644 (file)
@@ -24,13 +24,13 @@ DependencyCache::DependencyCache(SourcePackage &p):
 
 void DependencyCache::set_deps(const string &tgt, const StringList &d)
 {
-       deps[tgt]=d;
-       changed=true;
+       deps[tgt] = d;
+       changed = true;
 }
 
 const StringList &DependencyCache::get_deps(const string &tgt) const
 {
-       DepsMap::const_iterator i=deps.find(tgt);
+       DepsMap::const_iterator i = deps.find(tgt);
        if(i==deps.end())
                throw KeyError("Unknown dependencies", tgt);
 
@@ -55,7 +55,7 @@ void DependencyCache::save() const
 
 void DependencyCache::load()
 {
-       string fn=(package.get_source()/".deps").str();
+       string fn = (package.get_source()/".deps").str();
 
        try
        {
@@ -64,11 +64,11 @@ void DependencyCache::load()
                string line;
                while(in.getline(line))
                {
-                       vector<string> parts=split(line, '|');
-                       deps[parts[0]]=StringList(parts.begin()+1, parts.end());
+                       vector<string> parts = split(line, '|');
+                       deps[parts[0]] = StringList(parts.begin()+1, parts.end());
                }
 
-               mtime=Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
+               mtime = Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime);
        }
        catch(const IO::FileNotFound &)
        { }
index 7e0a23de5021bcd7f3211fe201e7f85169727106..6989f69bbe017c113ad3aa7fc3b7a9d6cec7a9b4 100644 (file)
@@ -23,18 +23,18 @@ void ExternalAction::launch()
                IO::print("%s\n", join(argv.begin(), argv.end()));
 
        if(builder.get_dry_run())
-               pid=-1;
+               pid = -1;
        else
        {
-               pid=fork();
+               pid = fork();
                if(pid==0)
                {
                        char *argv_[argv.size()+1];
 
-                       unsigned j=0;
+                       unsigned j = 0;
                        for(StringList::iterator i=argv.begin(); i!=argv.end(); ++i)
-                               argv_[j++]=strdup(i->c_str());
-                       argv_[j]=0;
+                               argv_[j++] = strdup(i->c_str());
+                       argv_[j] = 0;
 
                        if(!work_dir.empty())
                                FS::chdir(work_dir);
@@ -43,7 +43,7 @@ void ExternalAction::launch()
                        exit(1);
                }
                else if(pid<0)
-                       pid=0;
+                       pid = 0;
        }
 }
 
@@ -63,10 +63,10 @@ int ExternalAction::check()
        {
                signal_done.emit();
                if(WIFEXITED(status))
-                       exit_code=WEXITSTATUS(status);
+                       exit_code = WEXITSTATUS(status);
                else
-                       exit_code=254;
-               pid=0;
+                       exit_code = 254;
+               pid = 0;
                return exit_code;
        }
        else
index 08b0f3115e984e25d30b73f6d2e21d5a5543236c..37cc65ca06ee282db3b8a62d41c9bc14ba1f8463 100644 (file)
@@ -21,7 +21,7 @@ FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
        struct stat st;
        if(!FS::stat(path, st))
        {
-               mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
-               size=st.st_size;
+               mtime = Time::TimeStamp::from_unixtime(st.st_mtime);
+               size = st.st_size;
        }
 }
index 27bb9a334a970a5936efcad487ce720917bd7588..893f021387cbb81e346fb47e8418f8402ee58c49 100644 (file)
@@ -24,7 +24,7 @@ Install::Install(Builder &b, const SourcePackage &p, FileTarget &s, const std::s
        FileTarget(b, &p, generate_target_path(s, loc)),
        source(s)
 {
-       buildable=true;
+       buildable = true;
        add_depend(&source);
 }
 
@@ -48,34 +48,34 @@ FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string
        if(!tgt.get_package())
                throw InvalidParameterValue("Can't install package-less targets");
 
-       FS::Path base=tgt.get_package()->get_builder().get_prefix();
-       string tgtname=FS::basename(tgt.get_path());
+       FS::Path base = tgt.get_package()->get_builder().get_prefix();
+       string tgtname = FS::basename(tgt.get_path());
 
        string mid;
        if(!loc.empty())
-               mid=loc;
-       else if(const Header *hdr=dynamic_cast<const Header *>(&tgt))
+               mid = loc;
+       else if(const Header *hdr = dynamic_cast<const Header *>(&tgt))
        {
                if(hdr->get_component()->get_type()!=Component::HEADERS)
                        throw Exception("Header install from non-header component?");
-               mid="include/"+hdr->get_component()->get_name();
+               mid = "include/"+hdr->get_component()->get_name();
        }
        else if(dynamic_cast<const Executable *>(&tgt))
-               mid="bin";
-       else if(const SharedLibrary *shlib=dynamic_cast<const SharedLibrary *>(&tgt))
+               mid = "bin";
+       else if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&tgt))
        {
-               const Component &comp=shlib->get_component();
+               const Component &comp = shlib->get_component();
                if(comp.get_type()==Component::LIBRARY)
-                       mid="lib";
+                       mid = "lib";
                else if(comp.get_type()==Component::MODULE)
-                       mid="lib/"+tgt.get_package()->get_name();
+                       mid = "lib/"+tgt.get_package()->get_name();
        }
        else if(dynamic_cast<const StaticLibrary *>(&tgt))
-               mid="lib";
+               mid = "lib";
        else if(dynamic_cast<const PkgConfig *>(&tgt))
-               mid="lib/pkgconfig";
+               mid = "lib/pkgconfig";
        else if(dynamic_cast<const ::DataFile *>(&tgt))
-               mid="share/"+tgt.get_package()->get_name();
+               mid = "share/"+tgt.get_package()->get_name();
 
        if(mid.empty())
                throw InvalidParameterValue("Don't know where to install "+tgtname);
index 69a1d4048329562aa56029c86eb2c44cbb7ab56c..b6537d987a143e9551d893680be91f8eb29f08c8 100644 (file)
@@ -24,12 +24,12 @@ using namespace Msp;
 Link::Link(Builder &b, const Binary &bin):
        ExternalAction(b)
 {
-       const Component &comp=bin.get_component();
+       const Component &comp = bin.get_component();
 
-       work_dir=comp.get_package().get_source();
+       work_dir = comp.get_package().get_source();
 
        //XXX Determine whether to use g++ or gcc
-       string tool="LXX";
+       string tool = "LXX";
        argv.push_back(builder.get_current_arch().get_tool(tool));
 
        if(comp.get_type()==Component::LIBRARY || comp.get_type()==Component::MODULE)
@@ -37,7 +37,7 @@ Link::Link(Builder &b, const Binary &bin):
        else if(comp.get_package().get_library_mode()==ALL_STATIC)
                argv.push_back("-static");
 
-       const BuildInfo &binfo=comp.get_build_info();
+       const BuildInfo &binfo = comp.get_build_info();
        for(list<string>::const_iterator i=binfo.ldflags.begin(); i!=binfo.ldflags.end(); ++i)
                argv.push_back(*i);
        for(list<string>::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
@@ -45,22 +45,22 @@ Link::Link(Builder &b, const Binary &bin):
 
        argv.push_back("-o");
        argv.push_back(relative(bin.get_path(), work_dir).str());
-       const TargetList &deps=bin.get_depends();
+       const TargetList &deps = bin.get_depends();
        for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
        {
-               Target *tgt=*i;
-               if(Install *inst=dynamic_cast<Install *>(tgt))
-                       tgt=&inst->get_source();
+               Target *tgt = *i;
+               if(Install *inst = dynamic_cast<Install *>(tgt))
+                       tgt = &inst->get_source();
 
-               if(ObjectFile *obj=dynamic_cast<ObjectFile *>(tgt))
+               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(tgt))
                        argv.push_back(relative(obj->get_path(), work_dir).str());
-               else if(StaticLibrary *stlib=dynamic_cast<StaticLibrary *>(tgt))
+               else if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(tgt))
                        argv.push_back(stlib->get_path().str());
-               else if(Library *lib=dynamic_cast<Library *>(tgt))
+               else if(Library *lib = dynamic_cast<Library *>(tgt))
                        argv.push_back("-l"+lib->get_libname());
        }
 
-       FS::Path binpath=bin.get_path();
+       FS::Path binpath = bin.get_path();
        if(!builder.get_dry_run())
                FS::mkpath(FS::dirname(binpath), 0755);
 
index 2409e05a650a7fb5c67885d799f9359ad550037b..aadc056ea334f3784ad5adf124ca5919c465239d 100644 (file)
@@ -22,20 +22,20 @@ string run_command(const StringList &argv, int *status)
 
        string result;
 
-       pid_t pid=fork();
+       pid_t pid = fork();
        if(pid==0)
        {
                char *argv_[argv.size()+1];
 
-               unsigned j=0;
+               unsigned j = 0;
                for(StringList::const_iterator i=argv.begin(); i!=argv.end(); ++i)
-                       argv_[j++]=strdup(i->c_str());
-               argv_[j]=0;
+                       argv_[j++] = strdup(i->c_str());
+               argv_[j] = 0;
 
                close(pfd[0]);
                dup2(pfd[1], 1);
                close(pfd[1]);
-               int devnull=open("/dev/null", O_WRONLY);
+               int devnull = open("/dev/null", O_WRONLY);
                dup2(devnull, 2);
                close(devnull);
 
@@ -50,7 +50,7 @@ string run_command(const StringList &argv, int *status)
                while(1)
                {
                        char buf[1024];
-                       int len=read(pfd[0], buf, sizeof(buf));
+                       int len = read(pfd[0], buf, sizeof(buf));
                        if(len<=0)
                        {
                                int s;
@@ -59,9 +59,9 @@ string run_command(const StringList &argv, int *status)
                                        if(status)
                                        {
                                                if(WIFEXITED(s))
-                                                       *status=WEXITSTATUS(s);
+                                                       *status = WEXITSTATUS(s);
                                                else
-                                                       *status=-1;
+                                                       *status = -1;
                                        }
                                        break;
                                }
index ba20f7d8bde6428e0a951536a78f9d7cc8385a7c..766188b5ad313bc73dd5e3db1660c36e637aa785 100644 (file)
@@ -23,7 +23,7 @@ ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s):
        comp(c),
        source(s)       
 {
-       buildable=true;
+       buildable = true;
        add_depend(&source);
 }
 
@@ -31,42 +31,42 @@ void ObjectFile::find_depends()
 {
        for(TargetList::iterator i=new_deps.begin(); i!=new_deps.end();)
        {
-               Target *tgt=*i;
+               Target *tgt = *i;
                if(tgt->get_depends_ready())
                {
-                       i=new_deps.erase(i);
+                       i = new_deps.erase(i);
                        find_depends(tgt);
                }
                else
                        ++i;
        }
 
-       deps_ready=new_deps.empty();
+       deps_ready = new_deps.empty();
 }
 
 
 void ObjectFile::find_depends(Target *tgt)
 {
-       SourceFile *src=dynamic_cast<SourceFile *>(tgt);
-       FileTarget *file=src;
+       SourceFile *src = dynamic_cast<SourceFile *>(tgt);
+       FileTarget *file = src;
        if(!src)
        {
-               if(Install *inst=dynamic_cast<Install *>(tgt))
+               if(Install *inst = dynamic_cast<Install *>(tgt))
                {
-                       file=inst;
-                       src=dynamic_cast<SourceFile *>(&inst->get_source());
+                       file = inst;
+                       src = dynamic_cast<SourceFile *>(&inst->get_source());
                }
        }
        if(!src)
                return;
 
-       FS::Path spath=FS::dirname(file->get_path());
-       const StringList &incpath=comp.get_build_info().incpath;
+       FS::Path spath = FS::dirname(file->get_path());
+       const StringList &incpath = comp.get_build_info().incpath;
 
-       const list<string> &includes=src->get_includes();
+       const list<string> &includes = src->get_includes();
        for(list<string>::const_iterator i=includes.begin(); i!=includes.end(); ++i)
        {
-               Target *hdr2=builder.get_header(*i, spath, incpath);
+               Target *hdr2 = builder.get_header(*i, spath, incpath);
                if(hdr2 && find(depends.begin(), depends.end(), hdr2)==depends.end())
                        add_depend(hdr2);
        }
@@ -85,6 +85,6 @@ Action *ObjectFile::create_action()
 
 FS::Path ObjectFile::generate_target_path(const Component &comp, const string &src)
 {
-       const SourcePackage &pkg=comp.get_package();
+       const SourcePackage &pkg = comp.get_package();
        return pkg.get_temp_dir()/comp.get_name()/(FS::basepart(src)+".o");
 }
index 6e60b76992b4cc9123eca2906644deab8445cac4..f1374298eac0c8d14315a03d751498d5ba144a97 100644 (file)
@@ -28,7 +28,7 @@ PackageList Package::collect_requires()
        result.push_back(this);
        for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
        {
-               PackageList r=(*i)->collect_requires();
+               PackageList r = (*i)->collect_requires();
                result.splice(result.end(), r);
        }
 
@@ -56,7 +56,7 @@ void Package::configure(const StringMap &opts, unsigned flag)
 
        create_build_info();
 
-       conf_done=true;
+       conf_done = true;
 }
 
 
@@ -68,7 +68,7 @@ Package::Loader::Loader(Package &p):
 
 void Package::Loader::require(const string &n)
 {
-       Package *req=pkg.builder.get_package(n);
+       Package *req = pkg.builder.get_package(n);
        if(req)
                pkg.requires.push_back(req);
 }
index 5daf455d25c4e080c5b5159fdb4cad7e4e96f56f..4169f1eaed5267de40e6fe887fe4194a60bd0ca5 100644 (file)
@@ -12,7 +12,7 @@ Distributed under the LGPL
 PkgConfig::PkgConfig(Builder &b, const SourcePackage &p):
        FileTarget(b, &p, p.get_source()/(p.get_name()+".pc"))
 {
-       buildable=true;
+       buildable = true;
 }
 
 Action *PkgConfig::create_action()
index 3e5d6781e1d3c84534058a168379259813d64519..d0209fa1e33d452d0817323b644c704c4c4fa0e7 100644 (file)
@@ -18,7 +18,7 @@ using namespace Msp;
 PkgConfigAction::PkgConfigAction(Builder &b, const PkgConfig &p):
        Action(b)
 {
-       const SourcePackage &spkg=*static_cast<const SourcePackage *>(p.get_package());
+       const SourcePackage &spkg = *static_cast<const SourcePackage *>(p.get_package());
 
        announce(spkg.get_name(), "PC", basename(p.get_path()));
 
@@ -32,13 +32,13 @@ PkgConfigAction::PkgConfigAction(Builder &b, const PkgConfig &p):
        IO::print(out, "Version: %s\n", spkg.get_version());
 
        IO::print(out, "Requires:");
-       const PackageList &reqs=spkg.get_requires();
+       const PackageList &reqs = spkg.get_requires();
        for(PackageList::const_iterator i=reqs.begin(); i!=reqs.end(); ++i)
                if((*i)->get_use_pkgconfig())
                        IO::print(out, " %s", (*i)->get_name());
        out.put('\n');
 
-       const BuildInfo &binfo=spkg.get_exported_binfo();
+       const BuildInfo &binfo = spkg.get_exported_binfo();
        IO::print(out, "Libs:");
        for(StringList::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
                IO::print(out, " -L%s", *i);
index 7425a0f132c893c0448d0954993c1bde0321262f..3a1941af4b76b8ea41266ef6d237bdf846e10962 100644 (file)
@@ -31,20 +31,20 @@ void SourceFile::find_depends()
 {
        if(!comp)
        {
-               deps_ready=true;
+               deps_ready = true;
                return;
        }
 
-       const SourcePackage &spkg=comp->get_package();
-       string relname=FS::relative(name, spkg.get_source()).str();
-       DependencyCache &deps_cache=spkg.get_deps_cache();
-       bool deps_found=false;
+       const SourcePackage &spkg = comp->get_package();
+       string relname = FS::relative(name, spkg.get_source()).str();
+       DependencyCache &deps_cache = spkg.get_deps_cache();
+       bool deps_found = false;
        if(mtime<deps_cache.get_mtime())
        {
                try
                {
-                       includes=deps_cache.get_deps(relname);
-                       deps_found=true;
+                       includes = deps_cache.get_deps(relname);
+                       deps_found = true;
                }
                catch(const KeyError &)
                { }
@@ -63,7 +63,7 @@ void SourceFile::find_depends()
 
                        string line;
                        while(in.getline(line))
-                               if(RegMatch match=r_include.match(line))
+                               if(RegMatch match = r_include.match(line))
                                        includes.push_back(match[1].str);
 
                        deps_cache.set_deps(relname, includes);
@@ -75,15 +75,15 @@ void SourceFile::find_depends()
                }
        }
 
-       const StringList &incpath=comp->get_build_info().incpath;
+       const StringList &incpath = comp->get_build_info().incpath;
 
-       FS::Path dir=FS::dirname(path);
+       FS::Path dir = FS::dirname(path);
        for(list<string>::iterator i=includes.begin(); i!=includes.end(); ++i)
        {
-               Target *hdr=builder.get_header(*i, dir, incpath);
+               Target *hdr = builder.get_header(*i, dir, incpath);
                if(hdr)
                        add_depend(hdr);
        }
 
-       deps_ready=true;
+       deps_ready = true;
 }
index 889bf7baab3ff0735037b3e2809bcc8273066e70..838ab16ed53d2b1e0c7180d4972827f4c15fce82 100644 (file)
@@ -40,7 +40,7 @@ FS::Path SourcePackage::get_temp_dir() const
 
 FS::Path SourcePackage::get_out_dir() const
 {
-       const Architecture &arch=builder.get_current_arch();
+       const Architecture &arch = builder.get_current_arch();
        if(arch.is_native())
                return source/config.get_option("outdir").value;
        else
@@ -49,16 +49,16 @@ FS::Path SourcePackage::get_out_dir() const
 
 unsigned SourcePackage::get_install_flags()
 {
-       unsigned flags=0;
+       unsigned flags = 0;
        for(ComponentList::iterator i=components.begin(); i!=components.end(); ++i)
                if(i->get_install())
                {
                        if(i->get_type()==Component::PROGRAM)
-                               flags|=BIN;
+                               flags |= BIN;
                        else if(i->get_type()==Component::LIBRARY || i->get_type()==Component::MODULE)
-                               flags|=LIB;
+                               flags |= LIB;
                        else if(i->get_type()==Component::HEADERS)
-                               flags|=INCLUDE;
+                               flags |= INCLUDE;
                }
 
        return flags;
@@ -66,7 +66,7 @@ unsigned SourcePackage::get_install_flags()
 
 LibMode SourcePackage::get_library_mode() const
 {
-       const string &mode=config.get_option("staticlibs").value;
+       const string &mode = config.get_option("staticlibs").value;
        if(mode=="all")
                return ALL_STATIC;
        else if(mode=="local")
@@ -81,7 +81,7 @@ void SourcePackage::do_configure(const StringMap &opts, unsigned flag)
 {
        init_config();
 
-       StringMap::const_iterator prof=opts.find("profile");
+       StringMap::const_iterator prof = opts.find("profile");
        if(prof!=opts.end() && flag)
                config.select_profile(prof->second);
        else
@@ -100,23 +100,23 @@ void SourcePackage::do_configure(const StringMap &opts, unsigned flag)
        for(ConditionList::iterator i=conditions.begin(); i!=conditions.end(); ++i)
                if(i->eval())
                {
-                       const StringList &reqs=i->get_requires();
+                       const StringList &reqs = i->get_requires();
                        for(StringList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j)
-                               if(Package *pkg=builder.get_package(*j))
+                               if(Package *pkg = builder.get_package(*j))
                                        requires.push_back(pkg);
                }
 
-       base_reqs=requires;
+       base_reqs = requires;
 
        for(ComponentList::iterator i=components.begin(); i!=components.end(); ++i)
        {
-               const PackageList &reqs=i->get_requires();
+               const PackageList &reqs = i->get_requires();
                requires.insert(requires.end(), reqs.begin(), reqs.end());
        }
 
        for(PackageList::iterator i=requires.begin(); i!=requires.end(); ++i)
        {
-               BinaryPackage *bpkg=dynamic_cast<BinaryPackage *>(*i);
+               BinaryPackage *bpkg = dynamic_cast<BinaryPackage *>(*i);
                if(bpkg && bpkg->get_need_path())
                        bpkg->set_path(config.get_option(bpkg->get_name()+"_path").value);
        }
@@ -140,7 +140,7 @@ void SourcePackage::init_config()
 
        for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
        {
-               BinaryPackage *bpkg=dynamic_cast<BinaryPackage *>(*i);
+               BinaryPackage *bpkg = dynamic_cast<BinaryPackage *>(*i);
                if(bpkg && bpkg->get_need_path())
                        config.add_option(bpkg->get_name()+"_path", "/usr", "Path for "+bpkg->get_name());
        }
@@ -150,7 +150,7 @@ void SourcePackage::create_build_info()
 {
        for(PackageList::iterator i=base_reqs.begin(); i!=base_reqs.end(); ++i)
        {
-               const BuildInfo &ebi=(*i)->get_exported_binfo();
+               const BuildInfo &ebi = (*i)->get_exported_binfo();
                build_info.add(ebi);
 
                export_binfo.cflags.insert(export_binfo.cflags.end(), ebi.cflags.begin(), ebi.cflags.end());
@@ -159,10 +159,10 @@ void SourcePackage::create_build_info()
        }
 
        // XXX Currently, a package-specific settings will override cmdline.  This might or might not be desirable.
-       const StringList &warnings=builder.get_warnings();
+       const StringList &warnings = builder.get_warnings();
        build_info.warnings.insert(build_info.warnings.begin(), warnings.begin(), warnings.end());
 
-       unsigned flags=get_install_flags();
+       unsigned flags = get_install_flags();
 
        build_info.incpath.push_back((builder.get_prefix()/"include").str());
        build_info.libpath.push_back((builder.get_prefix()/"lib").str());
@@ -172,12 +172,12 @@ void SourcePackage::create_build_info()
        if(flags&LIB)
                export_binfo.libpath.push_back((builder.get_prefix()/"lib").str());
 
-       string optimize=config.get_option("optimize").value;
+       string optimize = config.get_option("optimize").value;
        if(lexical_cast<unsigned>(optimize))
        {
                build_info.cflags.push_back("-O"+optimize);
                build_info.ldflags.push_back("-O"+optimize);
-               string cpu=config.get_option("cpu").value;
+               string cpu = config.get_option("cpu").value;
                if(cpu!="none")
                        build_info.cflags.push_back("-march="+cpu);
        }
@@ -229,7 +229,7 @@ SourcePackage::Loader::Loader(Package &p):
 
 void SourcePackage::Loader::finish()
 {
-       SourcePackage &spkg=static_cast<SourcePackage &>(pkg);
+       SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
        spkg.components.sort(component_sort);
 }
 
@@ -244,7 +244,7 @@ void SourcePackage::Loader::feature(const string &n, const string &d)
 
 void SourcePackage::Loader::condition(const string &c)
 {
-       SourcePackage &spkg=static_cast<SourcePackage &>(pkg);
+       SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
        Condition cond(spkg, c);
        load_sub(cond);
        spkg.conditions.push_back(cond);
@@ -253,7 +253,7 @@ void SourcePackage::Loader::condition(const string &c)
 template<Component::Type t>
 void SourcePackage::Loader::component(const string &n)
 {
-       SourcePackage &spkg=static_cast<SourcePackage &>(pkg);
+       SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
        Component comp(spkg, t, n);
        load_sub(comp);
        spkg.components.push_back(comp);
@@ -266,7 +266,7 @@ void SourcePackage::Loader::build_info()
 
 void SourcePackage::Loader::tarball(const string &n)
 {
-       SourcePackage &spkg=static_cast<SourcePackage &>(pkg);
+       SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
        if(n=="@src")
        {
                for(ComponentList::iterator i=spkg.components.begin(); i!=spkg.components.end(); ++i)
@@ -283,7 +283,7 @@ void SourcePackage::Loader::tarball(const string &n)
 void SourcePackage::Loader::tar_file(const string &f)
 {
        IO::print("%s: Note: tar_file is deprecated\n", get_source());
-       SourcePackage &spkg=static_cast<SourcePackage &>(pkg);
+       SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
        for(ComponentList::iterator i=spkg.components.begin(); i!=spkg.components.end(); ++i)
                if(i->get_type()==Component::TARBALL && i->get_name()=="@src")
                        const_cast<PathList &>(i->get_sources()).push_back(spkg.source/f);
index 0745a1b1614389643e5bf6ffc3936283a08bddc1..883bbf65f345fe70fea0551ab14864362ba67526 100644 (file)
@@ -27,10 +27,10 @@ class SourcePackage: public Package
 public:
        enum InstallFlags
        {
-               INCLUDE=1,
-               BIN=2,
-               LIB=4,
-               DATA=8
+               INCLUDE = 1,
+               BIN = 2,
+               LIB = 4,
+               DATA = 8
        };
 
        class Loader: public Package::Loader
index b7e4eff1d43941391393986f92c1acecd1bdab43..c5998867ecb2368a11b3cd0bb59648d84e6442fb 100644 (file)
@@ -18,7 +18,7 @@ StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFi
        Library(b, package, path, c.get_name()),
        comp(c)
 {
-       buildable=true;
+       buildable = true;
        for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
                add_depend(*i);
 }
index 58eaea7087a095246aba7e2a7e496a2177158b56..66a346f8be4c1d8da5b8787e47c112425af41c9e 100644 (file)
@@ -19,7 +19,7 @@ SystemLibrary::SystemLibrary(Builder &b, const FS::Path &p):
 
 string SystemLibrary::extract_libname(const FS::Path &p)
 {
-       string result=FS::basepart(FS::basename(p));
+       string result = FS::basepart(FS::basename(p));
        if(!result.compare(0, 3, "lib"))
                result.erase(0, 3);
        return result;
index 75018fb0850b138c93b00d4fad09595f7643490f..bfb4f5f9761f245dfa83cd8279a0b7a01c05bab0 100644 (file)
@@ -22,13 +22,13 @@ Tar::Tar(Builder &b, const TarBall &t):
        InternalAction(b),
        tarball(t)
 {
-       string basename=FS::basename(tarball.get_path());
+       string basename = FS::basename(tarball.get_path());
        announce(tarball.get_package()->get_name(), "TAR ", basename);
        if(builder.get_verbose()>=2)
                IO::print("Create %s\n", basename);
 
        if(!builder.get_dry_run())
-               worker=new Worker(*this);
+               worker = new Worker(*this);
 }
 
 
@@ -40,63 +40,63 @@ Tar::Worker::Worker(Tar &t):
 
 void Tar::Worker::main()
 {
-       const FS::Path &pkg_src=tar.tarball.get_package()->get_source();
-       FS::Path basedir=FS::basepart(FS::basename(tar.tarball.get_path()));
+       const FS::Path &pkg_src = tar.tarball.get_package()->get_source();
+       FS::Path basedir = FS::basepart(FS::basename(tar.tarball.get_path()));
 
        IO::File out(tar.tarball.get_path().str(), IO::M_WRITE);
-       const TargetList &deps=tar.tarball.get_depends();
+       const TargetList &deps = tar.tarball.get_depends();
        for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
        {
-               FileTarget *ft=dynamic_cast<FileTarget *>(*i);
+               FileTarget *ft = dynamic_cast<FileTarget *>(*i);
                if(!ft)
                        continue;
 
                char buf[4096];
                memset(buf, 0, 512);
 
-               string rel_path=(basedir/relative(ft->get_path(), pkg_src)).str();
+               string rel_path = (basedir/relative(ft->get_path(), pkg_src)).str();
                if(rel_path.size()>99)
                {
                        IO::print("Can't store %s in tar archive - too long name\n", rel_path);
-                       error=true;
+                       error = true;
                        break;
                }
 
                memcpy(buf, rel_path.data(), rel_path.size());
 
-               struct stat st=FS::stat(ft->get_path());
+               struct stat st = FS::stat(ft->get_path());
                store_number(buf+100, st.st_mode, 7);
                store_number(buf+108, st.st_uid, 7);
                store_number(buf+116, st.st_gid, 7);
                store_number(buf+124, st.st_size, 11);
                store_number(buf+136, st.st_mtime, 11);
-               buf[156]='0';
+               buf[156] = '0';
 
                memset(buf+148, ' ', 8);
-               unsigned chk=0;
+               unsigned chk = 0;
                for(unsigned j=0; j<512; ++j)
-                       chk+=static_cast<unsigned char>(buf[j]);
+                       chk += static_cast<unsigned char>(buf[j]);
                store_number(buf+148, chk, 7);
-               buf[155]=0;
+               buf[155] = 0;
 
                out.write(buf, 512);
                IO::File in(ft->get_path().str());
                for(int j=0; j<st.st_size; j+=4096)
                {
-                       unsigned len=in.read(buf, 4096);
-                       len+=((~len)+1)&0777;
+                       unsigned len = in.read(buf, 4096);
+                       len += ((~len)+1)&0777;
                        out.write(buf, len);
                }
        }
 
-       done=true;
+       done = true;
 }
 
 void Tar::Worker::store_number(char *buf, unsigned value, unsigned length)
 {
        for(unsigned i=length; i--;)
        {
-               buf[i]='0'+value%8;
-               value/=8;
+               buf[i] = '0'+value%8;
+               value /= 8;
        }
 }
index 2ed9e6b5d5a6a1cb920f976f1675c9d2b14dedb2..521b6ac738c6ce76eca6a5fddec30ea58659e829 100644 (file)
@@ -14,7 +14,7 @@ using namespace std;
 TarBall::TarBall(Builder &b, const SourcePackage &p, const string &n):
        FileTarget(b, &p, p.get_source()/(n+".tar"))
 {
-       buildable=true;
+       buildable = true;
 }
 
 const SourcePackage *TarBall::get_package() const
index 2005d25cfc55817792d47289a2c1c2dabb58ce9d..3ee6bc5efe1528fc5573ed0ea8e8a9fc23107c93 100644 (file)
@@ -37,14 +37,14 @@ Target *Target::get_buildable_target()
        if(!rebuild)
                return 0;
 
-       bool self_ok=!building;
+       bool self_ok = !building;
        for(TargetList::iterator i=depends.begin(); i!=depends.end(); ++i)
        {
-               Target *tgt=(*i)->get_buildable_target();
+               Target *tgt = (*i)->get_buildable_target();
                if(tgt)
                        return tgt;
                else if((*i)->get_rebuild())
-                       self_ok=false;
+                       self_ok = false;
        }
 
        if(self_ok)
@@ -71,33 +71,33 @@ void Target::prepare()
                return;
        }
 
-       preparing=true;
+       preparing = true;
        for(TargetList::iterator i=depends.begin(); i!=depends.end(); ++i)
                (*i)->prepare();
 
        check_rebuild();
-       preparing=false;
-       prepared=true;
+       preparing = false;
+       prepared = true;
 }
 
 Action *Target::build()
 {
        if(!buildable)
        {
-               rebuild=false;
+               rebuild = false;
                return 0;
        }
 
-       if(FileTarget *ft=dynamic_cast<FileTarget *>(this))
+       if(FileTarget *ft = dynamic_cast<FileTarget *>(this))
                if(!builder.get_dry_run() && FS::exists(ft->get_path()))
                        FS::unlink(ft->get_path());
 
-       Action *action=create_action();
+       Action *action = create_action();
        if(action)
        {
                action->signal_done.connect(sigc::mem_fun(this, &Target::build_done));
 
-               building=true;
+               building = true;
        }
 
        return action;
@@ -105,13 +105,13 @@ Action *Target::build()
 
 void Target::touch()
 {
-       mtime=Time::now();
+       mtime = Time::now();
 }
 
 void Target::mark_rebuild(const std::string &reason)
 {
-       rebuild=true;
-       rebuild_reason=reason;
+       rebuild = true;
+       rebuild_reason = reason;
 }
 
 void Target::check_rebuild()
@@ -134,13 +134,13 @@ void Target::check_rebuild()
                }
        }
 
-       const SourcePackage *spkg=dynamic_cast<const SourcePackage *>(package);
+       const SourcePackage *spkg = dynamic_cast<const SourcePackage *>(package);
        if(!rebuild && spkg && spkg->get_config().get_mtime()>mtime)
                mark_rebuild("Package options changed");
 }
 
 void Target::build_done()
 {
-       building=false;
-       rebuild=false;
+       building = false;
+       rebuild = false;
 }
index 805b64a09a891ecbea2c2039c1a7c60379b672fd..80c6a17832edf804760f7d640c3e7993d125492d 100644 (file)
@@ -49,7 +49,7 @@ protected:
 public:
        virtual ~Target() { }
 
-       virtual const char *get_type() const=0;
+       virtual const char *get_type() const = 0;
        const std::string &get_name() const { return name; }
        const Package *get_package() const { return package; }
        const Msp::Time::TimeStamp &get_mtime() const { return mtime; }
@@ -72,7 +72,7 @@ public:
        Finds dependencies for the target.  When all dependencies have been found,
        the function should set deps_ready to true.
        */
-       virtual void find_depends() { deps_ready=true; }
+       virtual void find_depends() { deps_ready = true; }
 
        /**
        Prepares the target by recursively preparing dependencies, then checking
index fbe6388c90bacf02532f1a43e65bec73a903cd25..f1a548660e93da200102c255382e84853d0fe7bf 100644 (file)
@@ -13,7 +13,7 @@ Distributed under the LGPL
 Unlink::Unlink(Builder &b, const FileTarget &t):
        Action(b)
 {
-       const SourcePackage &spkg=*static_cast<const SourcePackage *>(t.get_package());
+       const SourcePackage &spkg = *static_cast<const SourcePackage *>(t.get_package());
 
        announce(spkg.get_name(), "RM", relative(t.get_path(), spkg.get_source()).str());