aboutsummaryrefslogtreecommitdiff
path: root/build/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-07 09:18:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-07 09:18:22 +0200
commit49d5628e35593a5300d39596286c768d7aa435b6 (patch)
tree43f20983a381c54aac7536e78e4f9543d8761aac /build/target.cxx
parent16c19b739a58845af7f807c3dee8021a1c421006 (diff)
Rework module architecture
Now the target type and rule maps are in scopes (builtins -- in global scope). We also now have the map of loaded modules in the root scope of each project.
Diffstat (limited to 'build/target.cxx')
-rw-r--r--build/target.cxx77
1 files changed, 0 insertions, 77 deletions
diff --git a/build/target.cxx b/build/target.cxx
index f692a5e..63bb2fe 100644
--- a/build/target.cxx
+++ b/build/target.cxx
@@ -197,83 +197,6 @@ namespace build
return os;
}
- //
- //
- target_type_map target_types;
-
- const target_type* target_type_map::
- find (name& n, const string*& ext) const
- {
- ext = nullptr;
-
- string& v (n.value);
-
- // First determine the target type.
- //
- const char* tt;
- if (n.type.empty ())
- {
- // Empty name or '.' and '..' signify a directory.
- //
- if (v.empty () || v == "." || v == "..")
- tt = "dir";
- else
- //@@ TODO: derive type from extension.
- //
- tt = "file";
- }
- else
- tt = n.type.c_str ();
-
- auto i (find (tt));
- if (i == end ())
- return nullptr;
-
- const target_type& ti (i->second);
-
- // Directories require special name processing. If we find that more
- // targets deviate, then we should make this target-type-specific.
- //
- if (ti.id == dir::static_type.id || ti.id == fsdir::static_type.id)
- {
- // The canonical representation of a directory name is with empty
- // value.
- //
- if (!v.empty ())
- {
- n.dir /= dir_path (v); // Move name value to dir.
- v.clear ();
- }
- }
- else
- {
- // Split the path into its directory part (if any) the name part,
- // and the extension (if any). We cannot assume the name part is
- // a valid filesystem name so we will have to do the splitting
- // manually.
- //
- path::size_type i (path::traits::rfind_separator (v));
-
- if (i != string::npos)
- {
- n.dir /= dir_path (v, i != 0 ? i : 1); // Special case: "/".
- v = string (v, i + 1, string::npos);
- }
-
- // Extract the extension.
- //
- string::size_type j (path::traits::find_extension (v));
-
- if (j != string::npos)
- {
- ext = &extension_pool.find (v.c_str () + j + 1);
- v.resize (j);
- }
- }
-
- return &ti;
- }
-
// path_target
//
void path_target::