X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Foutput-def.cc;h=f9fbda9fb6d3335dd90ad623ce917f5d06510f74;hb=414e6ba6630d111217f0887ae3bb203a44506ddb;hp=eedf75c9881e1c6a8fe775bd2fe1e2edbf820d6f;hpb=e24df7c27635dc996c466295eacf2981bddccaf7;p=lilypond.git diff --git a/lily/output-def.cc b/lily/output-def.cc index eedf75c988..f9fbda9fb6 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2005 Han-Wen Nienhuys + (c) 1997--2009 Han-Wen Nienhuys */ #include "output-def.hh" @@ -19,12 +19,17 @@ #include "ly-smobs.icc" +#include "program-option.hh" + +#include "string-convert.hh" + Output_def::Output_def () { scope_ = SCM_EOL; parent_ = 0; - smobify_self (); + smobify_self (); + scope_ = ly_make_anonymous_module (false); } @@ -36,7 +41,7 @@ Output_def::Output_def (Output_def const &s) input_origin_ = s.input_origin_; scope_ = ly_make_anonymous_module (false); - if (ly_c_module_p (s.scope_)) + if (ly_is_module (s.scope_)) ly_module_copy (scope_, s.scope_); } @@ -76,7 +81,7 @@ assign_context_def (Output_def * m, SCM 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; } @@ -86,9 +91,7 @@ Output_def::print_smob (SCM s, SCM p, scm_print_state *) { Output_def * def = unsmob_output_def (s); scm_puts ("#< ", p); - scm_puts (classname (def), p); - - (void)def; + scm_puts (def->class_name (), p); scm_puts (">", p); return 1; } @@ -104,19 +107,19 @@ SCM Output_def::lookup_variable (SCM sym) const { SCM var = ly_module_lookup (scope_, sym); - if (SCM_VARIABLEP (var) && SCM_VARIABLE_REF(var) != SCM_UNDEFINED) + if (SCM_VARIABLEP (var) && SCM_VARIABLE_REF (var) != SCM_UNDEFINED) return SCM_VARIABLE_REF (var); if (parent_) return parent_->lookup_variable (sym); - return SCM_EOL; + return SCM_UNDEFINED; } SCM -Output_def::c_variable (String s) const +Output_def::c_variable (string s) const { - return lookup_variable (ly_symbol2scm (s.to_str0 ())); + return lookup_variable (ly_symbol2scm (s.c_str ())); } void @@ -131,8 +134,10 @@ Output_def::set_variable (SCM sym, SCM val) Interval line_dimensions_int (Output_def *def, int n) { - Real lw = def->get_dimension (ly_symbol2scm ("linewidth")); - Real ind = n ? 0.0 : def->get_dimension (ly_symbol2scm ("indent")); + Real lw = def->get_dimension (ly_symbol2scm ("line-width")); + Real ind = n + ? def->get_dimension (ly_symbol2scm ("short-indent")) + : def->get_dimension (ly_symbol2scm ("indent")); return Interval (ind, lw); }