aboutsummaryrefslogtreecommitdiff
path: root/build2/module
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-01 18:24:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-01 19:30:26 +0300
commit70317569c6dcd9809ed4a8c425777e653ec6ca08 (patch)
tree07a538b296933e9e2a1f81088f8fcc8da3f749ad /build2/module
parentcbec9ea8841c8a58b2d50bb628b28aea7a6fe179 (diff)
Add hxx extension for headers
Diffstat (limited to 'build2/module')
-rw-r--r--build2/module114
1 files changed, 0 insertions, 114 deletions
diff --git a/build2/module b/build2/module
deleted file mode 100644
index 7c4672f..0000000
--- a/build2/module
+++ /dev/null
@@ -1,114 +0,0 @@
-// file : build2/module -*- C++ -*-
-// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#ifndef BUILD2_MODULE
-#define BUILD2_MODULE
-
-#include <map>
-
-#include <build2/types>
-#include <build2/utility>
-
-#include <build2/variable>
-#include <build2/diagnostics>
-
-namespace build2
-{
- class scope;
- class location;
-
- class module_base
- {
- public:
- virtual
- ~module_base () = default;
- };
-
- using module_boot_function =
- void (scope& root,
- const location&,
- unique_ptr<module_base>&);
-
- // Return false if the module configuration (normally based on the default
- // values) was unsuccessful but this is not (yet) an error. One example
- // would be the optional use of a module. Or a module might remain
- // unconfigured for as long as it is actually not used (e.g., install,
- // dist). The return value is used to set the <module>.configured variable.
- //
- using module_init_function =
- bool (scope& root,
- scope& base,
- const location&,
- unique_ptr<module_base>&,
- bool first, // First time for this project.
- bool optional, // Loaded with using? (optional module).
- const variable_map& hints); // Configuration hints (see below).
-
- struct module_functions
- {
- module_boot_function* boot;
- module_init_function* init;
- };
-
- // The register() function will be written in C++ and will be called from
- // C++ but we need to suppress name mangling to be able to use dlsym() and
- // equivalent.
- //
- extern "C"
- using module_register_function = module_functions ();
-
- // Loaded modules state.
- //
- struct module_state
- {
- bool boot; // True if the module boot'ed but not yet init'ed.
- module_init_function* init;
- unique_ptr<module_base> module;
- const location loc; // Boot location.
- };
-
- struct loaded_module_map: std::map<string, module_state>
- {
- template <typename T>
- T*
- lookup (const string& name) const
- {
- auto i (find (name));
- return i != end ()
- ? static_cast<T*> (i->second.module.get ())
- : nullptr;
- }
- };
-
- // Load and boot the specified module.
- //
- void
- boot_module (scope& root, const string& name, const location&);
-
- // Load (if not already loaded) and initialize the specified module. Used
- // by the parser but also by some modules to load prerequisite modules.
- // Return true if the module was both successfully loaded and configured
- // (false can only be returned if optional).
- //
- // The config_hints variable map can be used to pass configuration hints
- // from one module to another. For example, the cxx modude may pass the
- // target platform (which was extracted from the C++ compiler) to the bin
- // module (which may not always be able to extract the same information from
- // its tools).
- //
- bool
- load_module (scope& root,
- scope& base,
- const string& name,
- const location&,
- bool optional = false,
- const variable_map& config_hints = variable_map ());
-
- // Builtin modules.
- //
- using available_module_map = std::map<string, module_functions>;
- extern available_module_map builtin_modules;
-}
-
-#endif // BUILD2_MODULE