aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-12 18:22:14 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-12 18:26:27 +0100
commitf0259663d5f279300449c3f6a916218b33cf2402 (patch)
tree8b7926a478c5e29e03df7a8df661db687f625464 /paludis
parent9932da12a0310806ada93eff65a71d389415449e (diff)
downloadpaludis-f0259663d5f279300449c3f6a916218b33cf2402.tar.gz
paludis-f0259663d5f279300449c3f6a916218b33cf2402.tar.xz
New so hooks API
Diffstat (limited to 'paludis')
-rw-r--r--paludis/hook.hh5
-rw-r--r--paludis/hooker.cc14
-rw-r--r--paludis/sohooks_TEST.cc4
3 files changed, 13 insertions, 10 deletions
diff --git a/paludis/hook.hh b/paludis/hook.hh
index cd0865a..93abbff 100644
--- a/paludis/hook.hh
+++ b/paludis/hook.hh
@@ -29,6 +29,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/sequence-fwd.hh>
#include <paludis/util/named_value.hh>
+#include <paludis/output_manager-fwd.hh>
#include <memory>
#include <string>
@@ -153,8 +154,8 @@ namespace paludis
extern template class WrappedForwardIterator<Hook::ConstIteratorTag, const std::pair<const std::string, std::string> >;
}
-extern "C" paludis::HookResult PALUDIS_VISIBLE paludis_hook_run(
- const paludis::Environment *, const paludis::Hook &);
+extern "C" paludis::HookResult PALUDIS_VISIBLE paludis_hook_run_3(
+ const paludis::Environment *, const paludis::Hook &, const std::shared_ptr<paludis::OutputManager> &);
extern "C" void PALUDIS_VISIBLE paludis_hook_add_dependencies(
const paludis::Environment *, const paludis::Hook &, paludis::DirectedGraph<std::string, int> &);
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index 3311a71..6eacba4 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -132,7 +132,7 @@ namespace
const Environment * const _env;
void * _dl;
- HookResult (*_run)(const Environment *, const Hook &);
+ HookResult (*_run)(const Environment *, const Hook &, const std::shared_ptr<OutputManager> &);
void (*_add_dependencies)(const Environment *, const Hook &, DirectedGraph<std::string, int> &);
const std::shared_ptr<const Sequence<std::string > > (*_auto_hook_names)(const Environment *);
@@ -406,12 +406,12 @@ SoHookFile::SoHookFile(const FSEntry & f, const bool, const Environment * const
if (_dl)
{
_run = reinterpret_cast<HookResult (*)(
- const Environment *, const Hook &)>(
- reinterpret_cast<uintptr_t>(dlsym(_dl, "paludis_hook_run")));
+ const Environment *, const Hook &, const std::shared_ptr<OutputManager> &)>(
+ reinterpret_cast<uintptr_t>(dlsym(_dl, "paludis_hook_run_3")));
if (! _run)
- Log::get_instance()->message("hook.so.no_paludis_hook_run", ll_warning, lc_no_context)
- << ".so hook '" << f << "' does not define the paludis_hook_run function";
+ Log::get_instance()->message("hook.so.no_paludis_hook_run_3", ll_warning, lc_no_context)
+ << ".so hook '" << f << "' does not define the paludis_hook_run_3 function";
_add_dependencies = reinterpret_cast<void (*)(
const Environment *, const Hook &, DirectedGraph<std::string, int> &)>(
@@ -428,7 +428,7 @@ SoHookFile::SoHookFile(const FSEntry & f, const bool, const Environment * const
HookResult
SoHookFile::run(const Hook & hook,
- const std::shared_ptr<OutputManager> &) const
+ const std::shared_ptr<OutputManager> & optional_output_manager) const
{
Context c("When running .so hook '" + stringify(file_name()) + "' for hook '" + hook.name() + "':");
@@ -438,7 +438,7 @@ SoHookFile::run(const Hook & hook,
Log::get_instance()->message("hook.so.starting", ll_debug, lc_no_context) << "Starting .so hook '" <<
file_name() << "' for '" << hook.name() << "'";
- return _run(_env, hook);
+ return _run(_env, hook, optional_output_manager);
}
void
diff --git a/paludis/sohooks_TEST.cc b/paludis/sohooks_TEST.cc
index bb97637..c6d7c85 100644
--- a/paludis/sohooks_TEST.cc
+++ b/paludis/sohooks_TEST.cc
@@ -61,8 +61,9 @@ namespace
}
}
+extern "C"
HookResult
-paludis_hook_run(const Environment * env, const Hook & hook)
+paludis_hook_run_3(const Environment * env, const Hook & hook, const std::shared_ptr<OutputManager> &)
{
if ("so_hook" == hook.name())
return so_hook_run(env, hook);
@@ -74,6 +75,7 @@ paludis_hook_run(const Environment * env, const Hook & hook)
return make_named_values<HookResult>(n::max_exit_status() = 0, n::output() = "");
}
+extern "C"
void
paludis_hook_add_dependencies(const Environment * env, const Hook & hook,
DirectedGraph<std::string, int> & graph)