X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fatom.cc;h=9dd82bc754f88893320db90a009ea5253fb0f57a;hb=a6193f6f613e0b2ff519b804d28f99fcd6ec9b92;hp=cc2bde40be01f211d289b59360968f200294e2f9;hpb=07e33979c286e1ed73758276fe2c1de6234e9bf4;p=lilypond.git diff --git a/lily/atom.cc b/lily/atom.cc index cc2bde40be..9dd82bc754 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -7,74 +7,49 @@ */ #include -#include "ly-smobs.icc" #include "atom.hh" -#include "interval.hh" -#include "string.hh" -#include "array.hh" -#include "debug.hh" -#include "dimensions.hh" #include "lookup.hh" -#include "main.hh" #include "global-ctor.hh" #include "font-metric.hh" -Atom::Atom(SCM s) + +#if 0 +SCM translate_sym; + +static void init() { - SCM onstack = s; // protection. just to be sure. - func_ = s; - self_scm_ = SCM_EOL; - smobify_self (); + translate_sym = sly_symbol2scm ("translate-atom"); } +ADD_SCM_INIT_FUNC(atom, init); +#endif + SCM -Atom::mark_smob (SCM s) +translate_atom (Offset o, SCM func) { - Atom* a = SMOB_TO_TYPE(Atom, s); - assert (s == a->self_scm_); - return a->func_; + return gh_list (ly_symbol2scm ("translate-atom"), + ly_quote_scm (ly_offset2scm (o)), + func, + SCM_UNDEFINED); } -void -Atom::fontify (Font_metric * met) +SCM +translate_atom_axis (Real r, Axis a, SCM func) { - SCM desc = ly_quote_scm (met->description ()); - SCM font_switch = gh_list (ly_symbol2scm ("select-font"), - desc, - SCM_UNDEFINED); - - SCM f =func_; - func_ = gh_list (ly_symbol2scm ("string-append"), - font_switch , f, - SCM_UNDEFINED); + // off_[a] += r; + Offset o ; + o[a] = r; + return gh_list (ly_symbol2scm ("translate-atom"), + ly_quote_scm (ly_offset2scm (o)), + func, + SCM_UNDEFINED); } -void -Atom::do_smobify_self () -{ -} -Atom::Atom (Atom const &s) -{ - off_ = s.off_; - func_ = s.func_; - self_scm_= SCM_EOL; - smobify_self (); -} -int -Atom::print_smob (SCM s, SCM p, scm_print_state*) +SCM +fontify_atom(Font_metric * met, SCM f) { - Atom * a = unsmob_atom (s); - - scm_puts ("#off_.str ()); - scm_puts ((char *)str.ch_C(), p); - scm_display (a->func_, p); - scm_puts ("> ",p); - return 1; + return gh_list (ly_symbol2scm ("fontify"), + ly_quote_scm (met->description ()), f, SCM_UNDEFINED); } - -IMPLEMENT_UNSMOB(Atom, atom) -IMPLEMENT_SMOBS(Atom) -