source file of the GNU LilyPond music typesetter
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include <math.h>
+
#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)
-{
- func_ = s;
-}
+#if 0
+SCM translate_sym;
-#ifdef ATOM_SMOB
-int
-Atom::smob_display (SCM smob, SCM port, scm_print_state*)
+static void init()
{
- Atom* a =(Atom*) SCM_CDR(smob);
- String i (a->off_.str ());
-
- scm_puts ("#<Atom ", port);
- scm_puts (i.ch_C(), port);
- gh_display (a->func_);
- scm_puts (">", port);
-
- /* non-zero means success */
- return 1;
+ translate_sym = sly_symbol2scm ("translate-atom");
}
-
-scm_sizet
-Atom::smob_free (SCM smob)
-{
- Atom * a= (Atom*) SCM_CDR(smob);
- delete a;
- return sizeof (Atom);
-}
+ADD_SCM_INIT_FUNC(atom, init);
+#endif
SCM
-Atom::smob_mark (SCM smob)
+translate_atom (Offset o, SCM func)
{
- Atom * a= (Atom*) SCM_CDR(smob);
- scm_gc_mark (a->func_);
- return a->font_;
+ return gh_list (ly_symbol2scm ("translate-atom"),
+ ly_quote_scm (ly_offset2scm (o)),
+ func,
+ SCM_UNDEFINED);
}
-long Atom::smob_tag_;
-
-void
-Atom::init_smob ()
-{
- static scm_smobfuns type_rec;
-
- type_rec.mark = smob_mark;
- type_rec.free = smob_free;
- type_rec.print = smob_display;
- type_rec.equalp = 0;
-
- smob_tag_ = scm_newsmob (&type_rec);
-}
-
-
SCM
-Atom::make_smob () const
+translate_atom_axis (Real r, Axis a, SCM func)
{
- SCM smob;
- SCM_NEWCELL (smob);
- SCM_SETCAR (smob, smob_tag_);
- SCM_SETCDR (smob, this);
- return smob;
+ // off_[a] += r;
+ Offset o ;
+ o[a] = r;
+ return gh_list (ly_symbol2scm ("translate-atom"),
+ ly_quote_scm (ly_offset2scm (o)),
+ func,
+ SCM_UNDEFINED);
}
-SCM
-Atom::make_atom (SCM outputfunc)
-{
- Atom * a= new Atom(outputfunc);
- return a->make_smob ();
-}
SCM
-Atom::copy_self () const
-{
- return (new Atom (*this))->make_smob ();
-}
-
-bool
-Atom::Atom_b (SCM obj)
-{
- return(SCM_NIMP(obj) && SCM_CAR(obj) == smob_tag_);
-}
-
-Atom*
-Atom::atom_l (SCM a)
+fontify_atom(Font_metric * met, SCM f)
{
- assert (Atom_b (a));
- return (Atom*) SCM_CDR(a);
+ return gh_list (ly_symbol2scm ("fontify"),
+ ly_quote_scm (met->description ()), f, SCM_UNDEFINED);
}
-
-
-ADD_GLOBAL_CTOR_WITHNAME(atomsmob, Atom::init_smob);
-#endif
-
-