From 49d5628e35593a5300d39596286c768d7aa435b6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 Jul 2015 09:18:22 +0200 Subject: 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. --- build/scope | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'build/scope') diff --git a/build/scope b/build/scope index 5266370..d1cd941 100644 --- a/build/scope +++ b/build/scope @@ -12,8 +12,11 @@ #include #include +#include #include #include +#include +#include #include namespace build @@ -60,10 +63,11 @@ namespace build return operator[] (variable_pool.find (name)); } - // Return a value_proxy suitable for assignment. If the variable - // does not exist in this scope's map, then a new one with the - // NULL value is added and returned. Otherwise the existing value - // if returned. + // Return a value_proxy suitable for assignment (or append if you + // only want to append to the value from this scope). If the variable + // does not exist in this scope's map, then a new one with the NULL + // value is added and returned. Otherwise the existing value is + // returned. // value_proxy assign (const variable& var) @@ -92,6 +96,8 @@ namespace build return append (variable_pool.find (name)); } + // Prerequisite cache. + // public: prerequisite_set prerequisites; @@ -109,6 +115,33 @@ namespace build // std::unordered_set buildfiles; + // Target types. + // + public: + target_type_map target_types; + + const target_type* + find_target_type (const char*, const scope** = nullptr) const; + + // Given a name, figure out its type, taking into account extensions, + // special names (e.g., '.' and '..'), or anything else that might be + // relevant. Also process the name (in place) by extracting the + // extension, adjusting dir/value, etc., (note that the dir is not + // necessarily normalized). Return NULL if not found. + // + const target_type* + find_target_type (name&, const std::string*& ext) const; + + // Rules. + // + public: + rule_map rules; + + // Modules. + // + public: + loaded_module_map modules; // Only on root scope. + private: friend class scope_map; friend class temp_scope; -- cgit v1.1