+#include "book-paper-def.hh"
+#include "context-def.hh"
+#include "file-path.hh"
+#include "global-context.hh"
+#include "lily-guile.hh"
+#include "ly-module.hh"
+#include "main.hh"
+#include "output-def.hh"
+#include "output-def.hh"
+#include "scm-hash.hh"
+#include "warn.hh"
+
+#include "ly-smobs.icc"
+
+Output_def::Output_def ()
+{
+ scope_ = SCM_EOL;
+ parent_ = 0;
+ smobify_self ();
+
+ scope_ = ly_make_anonymous_module (false);
+}
+
+Output_def::~Output_def ()
+{
+}
+
+Output_def::Output_def (Output_def const &s)
+{
+ scope_ = SCM_EOL;
+ parent_ = 0;
+ smobify_self ();
+
+ scope_= ly_make_anonymous_module (false);
+ if (is_module (s.scope_))
+ ly_import_module (scope_, s.scope_);
+}
+
+
+IMPLEMENT_SMOBS (Output_def);
+IMPLEMENT_DEFAULT_EQUAL_P (Output_def);
+
+
+SCM
+Output_def::mark_smob (SCM m)
+{
+ Output_def * mo = (Output_def*) SCM_CELL_WORD_1 (m);
+
+ /*
+ FIXME: why is this necessary?
+ all bookpaper_ should be protected by themselves.
+ */
+ if (mo->parent_)
+ scm_gc_mark (mo->parent_->self_scm ());
+
+
+ mo->derived_mark ();
+ return mo->scope_;
+}
+
+void
+Output_def::derived_mark () {}
+
+void
+assign_context_def (Output_def * m, SCM transdef)
+{
+ Context_def *tp = unsmob_context_def (transdef);
+ assert (tp);
+
+ if (tp)
+ {
+ SCM sym = tp->get_context_name ();
+ scm_module_define (m->scope_, sym, transdef);
+ }
+}
+
+/*
+ find the translator for NAME. NAME must be a symbol.
+*/
+SCM
+find_context_def (Output_def const *m, SCM name)
+{
+ Context_def *cd = unsmob_context_def (m->lookup_variable (name));
+ return cd ? cd->self_scm () : SCM_EOL;
+}