+2004-03-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * lily/stencil-scheme.cc:
+ * lily/staff-symbol-referencer.cc:
+ * lily/script-column.cc:
+ * lily/pitch.cc:
+ * lily/music.cc:
+ * lily/grob-pq-engraver.cc:
+ * lily/font-interface.cc:
+ * lily/music-output-def.cc:
+ * lily/duration.cc:
+ * lily/grob-scheme.cc:
+ * lily/context-scheme.cc: Put scheme name on first line in
+ LY_DEFINE to help etags (multiline regexps are broken). Stray
+ style cleanups.
+
+ * stepmake/stepmake/scm-vars.make:
+ * stepmake/stepmake/c++-vars.make (TAGS_HEADERS, TAGS_SOURCES):
+ Rename and split TAGS_FILES.
+
+ * GNUmakefile.in (ALL-TAGS): Remove.
+
+ * stepmake/stepmake/generic-targets.make (TAGS): Also include
+ deeper TAGS files. Fixes regexp tags in TOP dir.
+
2004-03-07 Han-Wen Nienhuys <hanwen@xs4all.nl>
* Documentation/user/changing-defaults.itely (Changing defaults):
src-ext = c cc yy ll hh icc py scm tex ps texi itexi tely itely sh
-# FIXME: rename to TAGS; should include deeper TAGS files, see guile-core
-ALL-TAGS:
- etags $(shell find . $(src-ext:%=-name '*.%' -or) -false \
- | grep -v '/out')
-
web-clean:
$(MAKE) out=www clean
$(MAKE) $(builddir)/share/lilypond-force
# USER_LDFLAGS += -static -lltdl -ldl
#
-ETAGS_FLAGS += -r '/^LY_DEFINE *(\([^,]+\),/\1/' -r '/^LY_DEFINE *([^,]+, *"\([^"]+\)"/\1/'
+ETAGS_FLAGS += --regex='{c++}/^LY_DEFINE *(\([^,]+\)/\1/'
+ETAGS_FLAGS += --regex='{c++}/^LY_DEFINE *([^"]*"\([^"]+\)"/\1/'
default:
+/*
+ context-scheme.cc --
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+ Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
#include "context.hh"
#include "context-def.hh"
-
-LY_DEFINE(ly_context_id,
- "ly:context-id", 1,0,0, (SCM context),
- "Return the id string of @var{context}, i.e. for @code{\\context Voice "
-"= one .. } it will return the string @code{one}.")
+LY_DEFINE (ly_context_id, "ly:context-id",
+ 1, 0, 0, (SCM context),
+ "Return the id string of @var{context}, "
+ "i.e. for @code{\\context Voice = one .. } "
+ "return the string @code{one}.")
{
- Context * tr = (unsmob_context (context));
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
return scm_makfrom0str (tr->id_string_. to_str0 ());
}
-
-LY_DEFINE(ly_context_name,
- "ly:context-name", 1,0,0, (SCM context),
- "Return the name of @var{context}, i.e. for @code{\\context Voice "
-"= one .. } it will return the symbol @code{Voice}.")
+LY_DEFINE (ly_context_name, "ly:context-name",
+ 1, 0, 0, (SCM context),
+ "Return the name of @var{context}, "
+ "i.e. for @code{\\context Voice = one .. } "
+ "return the symbol @code{Voice}.")
{
- Context * tr = (unsmob_context (context));
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
return unsmob_context_def (tr->definition_)->get_context_name ();
}
-
-LY_DEFINE(ly_context_pushpop_property,
- "ly:context-pushpop-property", 3, 1, 0,
- (SCM context, SCM grob, SCM eltprop, SCM val),
- "Do a single @code{\\override} or @code{\\revert} operation "
- "in @var{context}. The grob definition @code{grob} is extended with "
- "@code{eltprop} (if @var{val} is specified) "
- "or reverted (if unspecified).")
+LY_DEFINE (ly_context_pushpop_property, "ly:context-pushpop-property",
+ 3, 1, 0, (SCM context, SCM grob, SCM eltprop, SCM val),
+ "Do a single @code{\\override} or @code{\\revert} operation "
+ "in @var{context}. The grob definition @code{grob} is extended "
+ "with @code{eltprop} (if @var{val} is specified) "
+ "or reverted (if unspecified).")
{
- Context *tg = (unsmob_context (context));
-
- SCM_ASSERT_TYPE(tg, context, SCM_ARG1, __FUNCTION__, "context");
- SCM_ASSERT_TYPE(gh_symbol_p (grob), grob, SCM_ARG2, __FUNCTION__, "symbol");
- SCM_ASSERT_TYPE(gh_symbol_p (eltprop), eltprop, SCM_ARG3, __FUNCTION__, "symbol");
+ Context *tg = unsmob_context (context);
+ SCM_ASSERT_TYPE (tg, context, SCM_ARG1, __FUNCTION__, "context");
+ SCM_ASSERT_TYPE (gh_symbol_p (grob), grob, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (gh_symbol_p (eltprop), eltprop, SCM_ARG3, __FUNCTION__, "symbol");
execute_pushpop_property (tg, grob, eltprop, val);
return SCM_UNDEFINED;
}
-
-LY_DEFINE(ly_context_property,
- "ly:context-property", 2, 0, 0,
- (SCM context, SCM name),
- "retrieve the value of @var{name} from context @var{context}")
+LY_DEFINE (ly_context_property, "ly:context-property",
+ 2, 0, 0, (SCM context, SCM name),
+ "Return the value of @var{name} from context @var{context}")
{
Context *t = unsmob_context (context);
- Context * tr= (t);
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Translator group");
- SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ Context * tr= (t);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Translator group");
+ SCM_ASSERT_TYPE (gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
return tr->internal_get_property (name);
-
}
-LY_DEFINE(ly_context_set_property,
- "ly:context-set-property!", 3, 0, 0,
- (SCM context, SCM name, SCM val),
- "set value of property @var{name} in context @var{context} to @var{val}.")
+LY_DEFINE (ly_context_set_property, "ly:context-set-property!",
+ 3, 0, 0, (SCM context, SCM name, SCM val),
+ "set value of property @var{name} in context @var{context} "
+ "to @var{val}.")
{
- Context *t = unsmob_context (context);
- Context * tr= (t);
-
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ SCM_ASSERT_TYPE (gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
tr->internal_set_property (name, val);
return SCM_UNSPECIFIED;
}
-
-LY_DEFINE(ly_context_property_where_defined,
- "ly:context-property-where-defined", 2, 0, 0,
- (SCM context, SCM name),
- "Return the context above @var{context} where @var{name} is defined.")
+LY_DEFINE (ly_context_property_where_defined, "ly:context-property-where-defined",
+ 2, 0, 0, (SCM context, SCM name),
+ "Return the context above @var{context} "
+ "where @var{name} is defined.")
{
- Context *t = unsmob_context (context);
- Context * tr = (t);
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
-
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ SCM_ASSERT_TYPE (gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
tr = tr->where_defined (name);
-
if (tr)
- return tr->self_scm();
+ return tr->self_scm ();
return SCM_EOL;
}
-LY_DEFINE(ly_unset_context_property,
- "ly:unset-context-property", 2, 0, 0,
- (SCM context, SCM name),
- "Unset value of property @var{name} in context @var{context}.")
+LY_DEFINE (ly_unset_context_property, "ly:unset-context-property", 2, 0, 0,
+ (SCM context, SCM name),
+ "Unset value of property @var{name} in context @var{context}.")
{
- Context *t = unsmob_context (context);
- Context * tr = (t);
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
- SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ SCM_ASSERT_TYPE (gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
tr->unset_property (name);
-
return SCM_UNSPECIFIED;
}
-
-
-LY_DEFINE(ly_context_parent,
- "ly:context-parent", 1, 0, 0,
- (SCM context),
- "Return the parent of @var{context}, #f if none.")
+LY_DEFINE (ly_context_parent, "ly:context-parent",
+ 1, 0, 0, (SCM context),
+ "Return the parent of @var{context}, #f if none.")
{
- Context *t = unsmob_context (context);
- Context * tr= (t);
-
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
- tr = tr->daddy_context_ ;
+ tr = tr->daddy_context_ ;
if (tr)
- return tr->self_scm();
+ return tr->self_scm ();
else
return SCM_BOOL_F;
}
-/*
- Todo: should support translator IDs, and creation?
- */
-LY_DEFINE(ly_translator_find,
- "ly:translator-find", 2, 0,0,
- (SCM context, SCM name),
- "Find a parent of @var{context} that has name or alias @var{name}. "
- "Return @code{#f} if not found." )
+/* FIXME: todo: should support translator IDs, and creation? */
+LY_DEFINE (ly_translator_find, "ly:translator-find",
+ 2, 0, 0, (SCM context, SCM name),
+ "Find a parent of @var{context} that has name or alias @var{name}. "
+ "Return @code{#f} if not found.")
{
- Context * tr= ( unsmob_context (context));
-
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "context");
- SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "context");
+ SCM_ASSERT_TYPE (gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
while (tr)
{
if (tr->is_alias (name))
- return tr->self_scm();
+ return tr->self_scm ();
tr = tr->daddy_context_ ;
}
return SCM_BOOL_F;
}
-
-LY_DEFINE(ly_context_properties,
- "ly:context-properties", 1, 0, 0,
- (SCM context),
- "Return all properties of @var{context} in an alist.")
+LY_DEFINE (ly_context_properties, "ly:context-properties",
+ 1, 0, 0, (SCM context),
+ "Return all properties of @var{context} in an alist.")
{
- Context *t = unsmob_context (context);
- Context * tr= (t);
-
- SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-
+ Context *tr = unsmob_context (context);
+ SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context");
return tr->properties_as_alist ();
}
/*
duration.cc -- implement Duration
-
+
source file of the LilyPond music typesetter
(c) 1997--2004 Jan Nieuwenhuizen <janneke@gnu.org>
- Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "ly-smobs.icc"
-
int
Duration::compare (Duration const &left, Duration const &right)
{
{
durlog_ = 0;
dots_ = 0;
- factor_ = Rational (1,1);
+ factor_ = Rational (1, 1);
}
-Duration::Duration (int l, int d)
+Duration::Duration (int log, int d)
{
- durlog_ = l;
+ durlog_ = log;
dots_ = d;
- factor_ = Rational (1,1);
+ factor_ = Rational (1, 1);
}
Duration
Rational mom (1 << abs (durlog_));
if (durlog_> 0)
- mom = Rational (1)/mom;
+ mom = Rational (1) / mom;
Rational delta = mom;
-
- for (int d = dots_; d; d--)
+ for (int i = 0; i < dots_; i++)
{
delta /= Rational (2);
mom += delta;
return mom * factor_;
}
-
-
String
Duration::to_string () const
{
s = "log = " + ::to_string (durlog_);
else
s = ::to_string (1 << durlog_);
-
+
s += ::to_string ('.', dots_);
- if (factor_ != Moment (Rational (1,1)))
- {
- s += "*" + factor_.to_string ();
- }
+ if (factor_ != Moment (Rational (1, 1)))
+ s += "*" + factor_.to_string ();
return s;
}
Duration::print_smob (SCM s, SCM port, scm_print_state *)
{
Duration *r = (Duration *) ly_cdr (s);
-
+
scm_puts ("#<Duration ", port);
scm_display (scm_makfrom0str (r->to_string ().to_str0 ()), port);
scm_puts (" >", port);
-
+
return 1;
}
Duration::equal_p (SCM a , SCM b)
{
Duration *p = (Duration *) ly_cdr (a);
- Duration *q = (Duration *) ly_cdr (b);
+ Duration *q = (Duration *) ly_cdr (b);
bool eq = p->dots_ == q->dots_
&& p->durlog_ == q->durlog_
return eq ? SCM_BOOL_T : SCM_BOOL_F;
}
-
+
MAKE_SCHEME_CALLBACK (Duration, less_p, 2);
SCM
Duration::less_p (SCM p1, SCM p2)
return SCM_BOOL_F;
}
-LY_DEFINE(duration_less, "ly:duration<?", 2,0,0, (SCM p1, SCM p2),
+LY_DEFINE (duration_less, "ly:duration<?",
+ 2, 0, 0, (SCM p1, SCM p2),
"Is @var{p1} shorter than @var{p2}?")
{
Duration *a = unsmob_duration (p1);
Duration *b = unsmob_duration (p2);
- SCM_ASSERT_TYPE(a, p1, SCM_ARG1, __FUNCTION__, "Duration");
- SCM_ASSERT_TYPE(b, p2, SCM_ARG2, __FUNCTION__, "Duration");
+ SCM_ASSERT_TYPE (a, p1, SCM_ARG1, __FUNCTION__, "Duration");
+ SCM_ASSERT_TYPE (b, p2, SCM_ARG2, __FUNCTION__, "Duration");
if (Duration::compare (*a, *b) < 0)
return SCM_BOOL_T;
return SCM_BOOL_F;
}
-
-LY_DEFINE(make_duration,
- "ly:make-duration", 2, 2, 0, (SCM length, SCM dotcount,
- SCM num, SCM den),
-" \n"
-"@var{length} is the negative logarithm (base 2) of the duration:\n"
-"1 is a half note, 2 is a quarter note, 3 is an eighth\n"
-"note, etc. The number of dots after the note is given by\n"
-"@var{dotcount}.\n"
-"\n"
-"The duration factor is optionally given by @var{num} and @var{den}.\n"
-"\n"
-"A duration is a musical duration, i.e. a length of time described by a\n"
-"power of two (whole, half, quarter, etc.) and a number of augmentation\n"
-"dots. \n"
-"\n"
-"")
+LY_DEFINE (make_duration, "ly:make-duration",
+ 2, 2, 0, (SCM length, SCM dotcount, SCM num, SCM den),
+ "@var{length} is the negative logarithm (base 2) of the duration:\n"
+ "1 is a half note, 2 is a quarter note, 3 is an eighth\n"
+ "note, etc. The number of dots after the note is given by\n"
+ "@var{dotcount}.\n"
+ "\n"
+ "The duration factor is optionally given by @var{num}\n"
+ "and @var{den}.\n\n"
+ "A duration is a musical duration, "
+ "i.e. a length of time described by a power of two "
+ "(whole, half, quarter, etc.) and a number of augmentation\n"
+ "dots. \n")
{
- SCM_ASSERT_TYPE(gh_number_p (length), length, SCM_ARG1, __FUNCTION__, "integer");
- SCM_ASSERT_TYPE(gh_number_p (dotcount), dotcount, SCM_ARG2, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (gh_number_p (length), length, SCM_ARG1, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (gh_number_p (dotcount), dotcount, SCM_ARG2, __FUNCTION__, "integer");
bool compress = false;
if (num != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE(gh_number_p (num), length, SCM_ARG3, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (gh_number_p (num), length, SCM_ARG3, __FUNCTION__, "integer");
compress = true;
}
else
num = gh_int2scm (1);
-
+
if (den != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE(gh_number_p (den), length, SCM_ARG4, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (gh_number_p (den), length, SCM_ARG4, __FUNCTION__, "integer");
compress = true;
}
else
den = gh_int2scm (1);
-
+
Duration p (gh_scm2int (length), gh_scm2int (dotcount));
if (compress)
p = p.compressed (Rational (gh_scm2int (num), gh_scm2int (den)));
return p.smobbed_copy ();
}
-
-
-LY_DEFINE(duration_log,
- "ly:duration-log", 1, 0, 0, (SCM dur),
- "Extract the duration log from @var{dur}"
-)
+LY_DEFINE (duration_log, "ly:duration-log",
+ 1, 0, 0, (SCM dur),
+ "Extract the duration log from @var{dur}")
{
- SCM_ASSERT_TYPE(unsmob_duration(dur), dur, SCM_ARG1, __FUNCTION__, "duration");
-
+ SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration");
return gh_int2scm (unsmob_duration (dur)->duration_log ());
}
-
-LY_DEFINE(dot_count_log,
- "ly:duration-dot-count", 1, 0, 0, (SCM dur),
+LY_DEFINE (dot_count_log, "ly:duration-dot-count", 1, 0, 0, (SCM dur),
"Extract the dot count from @var{dur}"
)
{
- SCM_ASSERT_TYPE(unsmob_duration(dur), dur, SCM_ARG1, __FUNCTION__, "duration");
-
+ SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration");
return gh_int2scm (unsmob_duration (dur)->dot_count ());
}
-LY_DEFINE(ly_intlog2,
- "ly:intlog2", 1, 0, 0, (SCM d),
- "The 2-logarithm of 1/@var{d}."
-)
+LY_DEFINE (ly_intlog2, "ly:intlog2",
+ 1, 0, 0, (SCM d),
+ "The 2-logarithm of 1/@var{d}.")
{
- SCM_ASSERT_TYPE(gh_number_p (d), d, SCM_ARG1, __FUNCTION__, "integer");
-
- int l = intlog2 (gh_scm2int (d));
-
- return gh_int2scm (l);
+ SCM_ASSERT_TYPE (gh_number_p (d), d, SCM_ARG1, __FUNCTION__, "integer");
+ int log = intlog2 (gh_scm2int (d));
+ return gh_int2scm (log);
}
-LY_DEFINE(compression_factor,
- "ly:duration-factor", 1, 0, 0, (SCM dur),
- "Extract the compression factor from @var{dur}. Return as a pair."
-)
+LY_DEFINE (compression_factor, "ly:duration-factor",
+ 1, 0, 0, (SCM dur),
+ "Extract the compression factor from @var{dur}. Return as a pair.")
{
- SCM_ASSERT_TYPE(unsmob_duration(dur), dur, SCM_ARG1, __FUNCTION__, "duration");
- Rational r =unsmob_duration (dur)->factor ();
-
- return gh_cons(gh_int2scm (r.num()),gh_int2scm (r.den ()));
+ SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration");
+ Rational r = unsmob_duration (dur)->factor ();
+ return gh_cons (gh_int2scm (r.num ()), gh_int2scm (r.den ()));
}
SCM
-Duration::smobbed_copy ()const
+Duration::smobbed_copy () const
{
- Duration * p = new Duration (*this);
+ Duration *p = new Duration (*this);
return p->smobbed_self ();
}
{
return dots_;
}
-
-/*
+/*
font-interface.cc -- implement Font_interface
source file of the GNU LilyPond music typesetter
-
+
(c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
+*/
#include "all-font-metrics.hh"
#include "font-metric.hh"
#include "warn.hh"
-/*
- todo: split up this func, reuse in text_item?
- */
+/* todo: split up this func, reuse in text_item? */
Font_metric *
-Font_interface::get_default_font (Grob*me)
+Font_interface::get_default_font (Grob *me)
{
- Font_metric * fm = unsmob_metrics (me->get_property ("font"));
- if (fm)
- return fm;
-
- fm = select_font (me->get_paper (), font_alist_chain (me));
- me->set_property ("font", fm->self_scm ());
+ Font_metric *fm = unsmob_metrics (me->get_property ("font"));
+ if (!fm)
+ {
+ fm = select_font (me->get_paper (), font_alist_chain (me));
+ me->set_property ("font", fm->self_scm ());
+ }
return fm;
}
-
-LY_DEFINE(ly_font_interface_get_default_font,
- "ly:get-default-font", 1 , 0, 0,
- (SCM grob), "Return the default font for grob @var{gr}.")
+LY_DEFINE (ly_font_interface_get_default_font, "ly:get-default-font",
+ 1 , 0, 0, (SCM grob),
+ "Return the default font for grob @var{gr}.")
{
- Grob * gr = unsmob_grob (grob);
- SCM_ASSERT_TYPE(gr, grob, SCM_ARG1, __FUNCTION__, "grob");
+ Grob *gr = unsmob_grob (grob);
+ SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
return Font_interface::get_default_font (gr)->self_scm ();
}
-
SCM
-Font_interface::font_alist_chain (Grob*g)
+Font_interface::font_alist_chain (Grob *g)
{
SCM defaults = g->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
-
return g->get_property_alist_chain (defaults);
}
-
-
-
-
ADD_INTERFACE (Font_interface, "font-interface",
- "Any symbol that is typeset through fixed sets of glyphs (ie. fonts)",
+ "Any symbol that is typeset through fixed sets of glyphs, "
+ " (ie. fonts)",
"font-magnification font font-series font-shape "
"font-family font-name font-size");
daddy_context_->set_property ("busyGrobs", SCM_EOL);
}
-LY_DEFINE(ly_grob_pq_less_p,
- "ly:grob-pq-less?", 2 , 0 ,0, (SCM a, SCM b),
+LY_DEFINE(ly_grob_pq_less_p, "ly:grob-pq-less?",
+ 2, 0 ,0, (SCM a, SCM b),
"Compare 2 Grob PQ entries. Internal")
{
if (Moment::compare (*unsmob_moment (gh_car (a)),
+/*
+ grob-scheme.cc --
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
+ Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
#include "grob.hh"
#include "warn.hh"
#include "spanner.hh"
LY_DEFINE (ly_grob_set_property,"ly:grob-set-property!", 3, 0, 0,
- (SCM grob, SCM sym, SCM val),
+ (SCM grob, SCM sym, SCM val),
"Set @var{sym} in grob @var{grob} to value @var{val}")
{
Grob * sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
if (!type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
error ("typecheck failed");
-
+
sc->internal_set_property (sym, val);
return SCM_UNSPECIFIED;
}
-LY_DEFINE (ly_get_property,
- "ly:grob-property", 2, 0, 0, (SCM grob, SCM sym),
- "Get the value of a value in grob @var{g} of property @var{sym}. It\n"
-"will return @code{'()} (end-of-list) if @var{g} doesn't have @var{sym} set.\n"
-"\n"
-"Grob properties are stored as GUILE association lists, with symbols as\n"
-"keys. All lookup functions identify undefined properties with\n"
-"end-of-list (i.e. @code{'()} in Scheme or @code{SCM_EOL} in C)\n"
-"\n")
+LY_DEFINE (ly_get_property, "ly:grob-property",
+ 2, 0, 0, (SCM grob, SCM sym),
+ "Return the value of a value in grob @var{g} of property @var{sym}. "
+ "It will return @code{' ()} (end-of-list) "
+ "if @var{g} does nott have @var{sym} set."
+ "\n\n"
+ "Grob properties are stored as GUILE association lists, "
+ "with symbols as keys. "
+ "All lookup functions identify undefined properties "
+ "with end-of-list (i.e. @code{' ()} in Scheme "
+ "or @code{SCM_EOL} in C.")
{
- Grob * sc = unsmob_grob (grob);
+ Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return sc->internal_get_property (sym);
}
/* TODO: make difference between scaled and unscalead variable in
calling (i.e different funcs.) */
LY_DEFINE (ly_grob_paper,"ly:grob-paper", 1, 0, 0,
- (SCM grob),
+ (SCM grob),
"Get \\paper definition from a grob.")
{
Grob * sc = unsmob_grob (grob);
return sc->get_paper ()->self_scm ();
}
-
-
-
LY_DEFINE (ly_get_extent, "ly:grob-extent", 3, 0, 0,
(SCM grob, SCM refp, SCM axis),
"Get the extent in @var{axis} direction of @var{grob} relative to "
Grob * ref = unsmob_grob (refp);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob");
-
+
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
return ly_interval2scm ( sc->extent (ref, Axis (gh_scm2int (axis))));
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
- Grob * par = sc->get_parent (Axis (gh_scm2int (axis)));
+ Grob *par = sc->get_parent (Axis (gh_scm2int (axis)));
return par ? par->self_scm () : SCM_EOL;
}
-LY_DEFINE (ly_get_system,
- "ly:grob-system",
+LY_DEFINE (ly_get_system, "ly:grob-system",
1, 0, 0, (SCM grob),
"Return the System Grob of @var{grob}.")
{
Grob *me = unsmob_grob (grob);
SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
-
+
if (System *g = me->get_system ())
return g->self_scm ();
-
+
return SCM_EOL;
}
-LY_DEFINE (ly_get_original,
- "ly:grob-original",
+LY_DEFINE (ly_get_original, "ly:grob-original",
1, 0, 0, (SCM grob),
"Return the unbroken original Grob of @var{grob}.")
{
return me->original_ ? me->original_->self_scm () : me->self_scm ();
}
-
-/* ly prefix? spanner in name? */
+/* FIXME: ly prefix? spanner in name? */
/* TODO: maybe we should return a vector -- random access is more
- logical for this list? */
-
-LY_DEFINE (get_broken_into,
- "ly:spanner-broken-into", 1, 0, 0, (SCM spanner),
+ logical for this list? */
+LY_DEFINE (get_broken_into, "ly:spanner-broken-into",
+ 1, 0, 0, (SCM spanner),
"Return broken-into list for @var{spanner}.")
{
- /// Spanner *me = unsmob_spanner (spanner);
Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (spanner));
SCM_ASSERT_TYPE (me, spanner, SCM_ARG1, __FUNCTION__, "spanner");
return s;
}
-
-LY_DEFINE (ly_grob_suicide,
- "ly:grob-suicide", 1, 0, 0, (SCM g),
+LY_DEFINE (ly_grob_suicide, "ly:grob-suicide",
+ 1, 0, 0, (SCM g),
"Kill @var{g}.")
{
Grob *me = unsmob_grob (g);
return SCM_UNDEFINED;
}
-
-
-LY_DEFINE (ly_grob_translate_axis_x,
- "ly:grob-translate-axis!", 3, 0, 0,
- (SCM g, SCM d, SCM a),
+LY_DEFINE (ly_grob_translate_axis_x, "ly:grob-translate-axis!",
+ 3, 0, 0, (SCM g, SCM d, SCM a),
"Translate @var{g} on axis @var{a} over distance @var{d}.")
{
Grob *me = unsmob_grob (g);
SCM_ASSERT_TYPE (gh_number_p (d), d, SCM_ARG2, __FUNCTION__, "dimension");
SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG3, __FUNCTION__, "axis");
- me->translate_axis (gh_scm2double (d),
- Axis (gh_scm2int (a)));
+ me->translate_axis (gh_scm2double (d), Axis (gh_scm2int (a)));
return SCM_UNDEFINED;
}
-
-
-LY_DEFINE (ly_spanner_p,
- "ly:spanner?", 1, 0, 0,
- (SCM g),
+LY_DEFINE (ly_spanner_p, "ly:spanner?",
+ 1, 0, 0, (SCM g),
"Is @var{g} a spanner object?")
{
Grob *me = unsmob_grob (g);
return gh_bool2scm (b);
}
-LY_DEFINE (ly_item_p,
- "ly:item?", 1, 0, 0,
- (SCM g),
- "Is @var{g} a item object?")
+LY_DEFINE (ly_item_p, "ly:item?",
+ 1, 0, 0, (SCM g),
+ "Is @var{g} a item object?")
{
Grob *me = unsmob_grob (g);
bool b = dynamic_cast<Item*> (me);
-
return gh_bool2scm (b);
}
-
-LY_DEFINE (ly_item_break_dir,
- "ly:item-break-dir", 1, 0, 0,
- (SCM it),
+LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
+ 1, 0, 0, (SCM it),
"The break status dir of @var{it}.")
{
- Item * me = dynamic_cast<Item*> ( unsmob_grob (it));
+ Item *me = dynamic_cast<Item*> ( unsmob_grob (it));
SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item");
-
- return gh_int2scm (me->break_status_dir ());
+ return gh_int2scm (me->break_status_dir ());
}
-
smobify_self ();
scm_gc_unprotect_object (translator_tab_->self_scm ());
- scope_ = ly_make_anonymous_module();
+ scope_ = ly_make_anonymous_module ();
}
Music_output_def::~Music_output_def ()
String nm = ly_symbol2string (tp->get_context_name ()) + "Context";
- scm_module_define (scope_, ly_symbol2scm (nm.to_str0()), transdef);
+ scm_module_define (scope_, ly_symbol2scm (nm.to_str0 ()), transdef);
}
/*
find the translator for NAME. NAME must be a symbol.
- */
+*/
SCM
Music_output_def::find_context_def (SCM name) const
{
return val;
}
-
int
Music_output_def::print_smob (SCM s, SCM p, scm_print_state *)
{
return 1;
}
-
SCM
Music_output_def::get_scmvar (String s) const
{
return lookup_variable (ly_symbol2scm (s.to_str0 ()));
}
-
void
Music_output_def::set_variable (SCM sym, SCM val)
{
return scm_variable_ref (var);
}
-LY_DEFINE(ly_paper_lookup,
- "ly:paper-lookup",
- 2, 0,0,
- (SCM pap, SCM sym),
- "Lookup @var{sym} in @var{pap}. Return the value "
- " or '() if undefined. "
- )
+LY_DEFINE (ly_paper_lookup, "ly:paper-lookup",
+ 2, 0,0, (SCM pap, SCM sym),
+ "Lookup @var{sym} in @var{pap}. "
+ "Return the value or ' () if undefined.")
{
Music_output_def *op = unsmob_music_output_def (pap);
SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Paper");
return SCM_EOL;
}
-LY_DEFINE(ly_output_def_scope,
- "ly:output-def-scope",
- 1, 0,0,
- (SCM def),
- "Get the scope inside @var{def}."
- )
+LY_DEFINE (ly_output_def_scope, "ly:output-def-scope",
+ 1, 0,0, (SCM def),
+ "Get the scope inside @var{def}.")
{
Music_output_def *op = unsmob_music_output_def (def);
SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition");
-
return op->scope_;
}
-
-LY_DEFINE(ly_output_def_clone,
- "ly:output-def-clone",
- 1, 0,0,
- (SCM def),
- "Clone @var{def}."
- )
+LY_DEFINE (ly_output_def_clone, "ly:output-def-clone",
+ 1, 0, 0, (SCM def),
+ "Clone @var{def}.")
{
Music_output_def *op = unsmob_music_output_def (def);
SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition");
-
SCM s = op->clone ()->self_scm ();
scm_gc_unprotect_object (s);
return s;
#include "warn.hh"
#include "pitch.hh"
#include "ly-smobs.icc"
-
+#include "main.hh"
bool
-Music::internal_is_music_type (SCM k)const
+Music::internal_is_music_type (SCM k) const
{
SCM ifs = get_property ("types");
}
}
-
+Music::Music ()
+{
+ self_scm_ = SCM_EOL;
+ immutable_property_alist_ = SCM_EOL;
+ mutable_property_alist_ = SCM_EOL;
+ smobify_self ();
+}
Music::Music (Music const &m)
{
mutable_property_alist_ = SCM_EOL;
self_scm_ = SCM_EOL;
- /*
- First we smobify_self, then we copy over the stuff. If we don't,
- stack vars that hold the copy might be optimized away, meaning
- that they won't be protected from GC.
- */
+ /* First we smobify_self, then we copy over the stuff. If we don't,
+ stack vars that hold the copy might be optimized away, meaning
+ that they won't be protected from GC. */
smobify_self ();
mutable_property_alist_ = ly_deep_mus_copy (m.mutable_property_alist_);
set_spot (*m.origin ());
}
-Music::Music ()
+Music::~Music ()
{
- self_scm_ = SCM_EOL;
- immutable_property_alist_ = SCM_EOL;
- mutable_property_alist_ = SCM_EOL;
- smobify_self ();
}
+ADD_MUSIC (Music);
+
SCM
Music::get_property_alist (bool m) const
{
SCM
Music::mark_smob (SCM m)
{
- Music * mus = (Music *)SCM_CELL_WORD_1 (m);
+ Music *mus = (Music*) SCM_CELL_WORD_1 (m);
scm_gc_mark (mus->immutable_property_alist_);
scm_gc_mark (mus->mutable_property_alist_);
return SCM_EOL;
Moment
Music::get_length () const
{
- SCM l = get_property ("length");
- if (unsmob_moment (l))
- return *unsmob_moment (l);
- else if (gh_procedure_p (l))
+ SCM lst = get_property ("length");
+ if (unsmob_moment (lst))
+ return *unsmob_moment (lst);
+ else if (gh_procedure_p (lst))
{
- SCM res = gh_call1 (l, self_scm ());
+ SCM res = gh_call1 (lst, self_scm ());
return *unsmob_moment (res);
}
-
+
return 0;
}
Moment
Music::start_mom () const
{
- SCM l = get_property ("start-moment-function");
- if (gh_procedure_p (l))
+ SCM lst = get_property ("start-moment-function");
+ if (gh_procedure_p (lst))
{
- SCM res = gh_call1 (l, self_scm ());
+ SCM res = gh_call1 (lst, self_scm ());
return *unsmob_moment (res);
}
- Moment m ;
+ Moment m;
return m;
}
void
print_alist (SCM a, SCM port)
{
- /*
- SCM_EOL -> catch malformed lists.
- */
+ /* SCM_EOL -> catch malformed lists. */
for (SCM s = a; gh_pair_p (s); s = ly_cdr (s))
{
scm_display (ly_caar (s), port);
- scm_puts (" = ", port);
+ scm_puts (" = ", port);
scm_write (ly_cdar (s), port);
scm_puts ("\n", port);
}
SCM nm = m->get_property ("name");
if (gh_symbol_p (nm) || gh_string_p (nm))
- {
- scm_display (nm, p);
- }
+ scm_display (nm, p);
else
- {
- scm_puts (classname (m),p);
- }
-
- /*
- Printing properties takes a lot of time, especially during backtraces.
- For inspecting, it is better to explicitly use an inspection
- function.
- */
+ scm_puts (classname (m),p);
+
+ /* Printing properties takes a lot of time, especially during backtraces.
+ For inspecting, it is better to explicitly use an inspection
+ function. */
scm_puts (">",p);
return 1;
{
SCM elt = get_property ("element");
- if (Music* m = unsmob_music (elt))
+ if (Music *m = unsmob_music (elt))
p = m->to_relative_octave (p);
- p = music_list_to_relative (get_property ("elements"),
- p, false);
+ p = music_list_to_relative (get_property ("elements"), p, false);
return p;
}
{
SCM elt = get_property ("element");
- if (Music* m = unsmob_music (elt))
+ if (Music *m = unsmob_music (elt))
m->compress (factor);
compress_music_list (get_property ("elements"), factor);
}
-
void
Music::transpose (Pitch delta)
{
transpose_music_list (get_property ("elements"), delta);
}
-
IMPLEMENT_TYPE_P (Music, "ly:music?");
-
IMPLEMENT_SMOBS (Music);
IMPLEMENT_DEFAULT_EQUAL_P (Music);
-/****************************/
-
SCM
Music::internal_get_property (SCM sym) const
{
return ly_cdr (s);
s = scm_sloppy_assq (sym, immutable_property_alist_);
- return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s);
+ return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s);
}
void
mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
}
-#include "main.hh"
-
void
Music::set_spot (Input ip)
{
Music::origin () const
{
Input *ip = unsmob_input (get_property ("origin"));
- return ip ? ip : & dummy_input_global;
-}
-
-
-Music::~Music ()
-{
-
+ return ip ? ip : & dummy_input_global;
}
-LY_DEFINE(ly_music_length,
- "ly:music-length", 1, 0, 0, (SCM mus),
+LY_DEFINE (ly_music_length, "ly:music-length",
+ 1, 0, 0, (SCM mus),
"Get the length (in musical time) of music expression @var{mus}.")
{
- Music * sc = unsmob_music (mus);
- SCM_ASSERT_TYPE(sc, mus, SCM_ARG1, __FUNCTION__, "music");
- return sc->get_length().smobbed_copy();
+ Music *sc = unsmob_music (mus);
+ SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
+ return sc->get_length ().smobbed_copy ();
}
-LY_DEFINE(ly_music_property,
- "ly:music-property", 2, 0, 0, (SCM mus, SCM sym),
+LY_DEFINE (ly_music_property,
+ "ly:music-property", 2, 0, 0, (SCM mus, SCM sym),
"Get the property @var{sym} of music expression @var{mus}.\n"
- "If @var{sym} is undefined, return @code{'()}.\n" )
+ "If @var{sym} is undefined, return @code{' ()}.\n" )
{
Music * sc = unsmob_music (mus);
- SCM_ASSERT_TYPE(sc, mus, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE(gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
+ SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return sc->internal_get_property (sym);
}
-LY_DEFINE(ly_music_set_property,
- "ly:music-set-property!", 3, 0, 0,
- (SCM mus, SCM sym, SCM val),
+LY_DEFINE (ly_music_set_property, "ly:music-set-property!",
+ 3, 0, 0, (SCM mus, SCM sym, SCM val),
"Set property @var{sym} in music expression @var{mus} to @var{val}.")
{
Music * sc = unsmob_music (mus);
- SCM_ASSERT_TYPE(sc, mus, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE(gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
+ SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
bool ok = type_check_assignment (sym, val, ly_symbol2scm ("music-type?"));
if (ok)
{
sc->internal_set_property (sym, val);
}
-
+
return SCM_UNSPECIFIED;
}
-
-LY_DEFINE(ly_music_name, "ly:music-name", 1, 0, 0,
- (SCM mus),
- "Return the name of @var{music}.")
+LY_DEFINE (ly_music_name, "ly:music-name",
+ 1, 0, 0, (SCM mus),
+ "Return the name of @var{music}.")
{
- Music * m = unsmob_music (mus);
- SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__ ,"music");
-
- const char * nm = classname (m);
+ Music *m = unsmob_music (mus);
+ SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__ ,"music");
+
+ char const *nm = classname (m);
return scm_makfrom0str (nm);
}
-
-
-// to do property args
-LY_DEFINE(ly_extended_make_music,
- "ly:make-bare-music", 2, 0, 0, (SCM type, SCM props),
+/* todo: property args */
+LY_DEFINE (ly_extended_make_music, "ly:make-bare-music",
+ 2, 0, 0, (SCM type, SCM props),
"Make a C++ music object of type @var{type}, initialize with\n"
"@var{props}. \n\n"
""
"for creating music objects. "
)
{
- SCM_ASSERT_TYPE(gh_string_p (type), type, SCM_ARG1, __FUNCTION__, "string");
-
+ SCM_ASSERT_TYPE (gh_string_p (type), type, SCM_ARG1, __FUNCTION__, "string");
SCM s = make_music (ly_scm2string (type))->self_scm ();
unsmob_music (s)->immutable_property_alist_ = props;
scm_gc_unprotect_object (s);
return s;
}
-// to do property args
-LY_DEFINE(ly_get_mutable_properties,
- "ly:get-mutable-properties", 1, 0, 0, (SCM mus),
+/* todo: property args */
+LY_DEFINE (ly_get_mutable_properties, "ly:get-mutable-properties",
+ 1, 0, 0, (SCM mus),
"Return an alist containing the mutable properties of @var{mus}.\n"
- "The immutable properties are not available; they should be initialized\n"
- "by the @code{make-music} function.\n"
- )
+ "The immutable properties are not available; "
+ "they should be initialized by the @code{make-music} function.\n")
{
Music *m = unsmob_music (mus);
- SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "music");
-
+ SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "music");
return m->get_property_alist (true);
}
-LY_DEFINE(ly_music_list_p,"ly:music-list?", 1, 0, 0,
- (SCM l),"Type predicate: return true if @var{l} is a list of music objects.")
+LY_DEFINE (ly_music_list_p,"ly:music-list?",
+ 1, 0, 0, (SCM lst),
+ "Type predicate: return true if @var{lst} is a list "
+ "of music objects.")
{
- if (scm_list_p (l) != SCM_BOOL_T)
- return SCM_BOOL_F;
+ if (scm_list_p (lst) == SCM_BOOL_T)
+ while (gh_pair_p (lst))
+ {
+ if (!unsmob_music (gh_car (lst)))
+ return SCM_BOOL_F;
+ lst = gh_cdr (lst);
+ }
- while (gh_pair_p (l))
- {
- if (!unsmob_music (gh_car (l)))
- return SCM_BOOL_F;
- l =gh_cdr (l);
- }
return SCM_BOOL_T;
}
-ADD_MUSIC(Music);
-
-
-LY_DEFINE(ly_deep_mus_copy,
- "ly:music-deep-copy", 1,0,0, (SCM m),
+LY_DEFINE (ly_deep_mus_copy, "ly:music-deep-copy",
+ 1, 0, 0, (SCM m),
"Copy @var{m} and all sub expressions of @var{m}")
{
+ SCM copy = m;
if (unsmob_music (m))
{
- SCM ss = unsmob_music (m)->clone ()->self_scm ();
- scm_gc_unprotect_object (ss);
- return ss;
+ copy = unsmob_music (m)->clone ()->self_scm ();
+ scm_gc_unprotect_object (copy);
}
else if (gh_pair_p (m))
- {
- return gh_cons (ly_deep_mus_copy (ly_car (m)), ly_deep_mus_copy (ly_cdr (m)));
- }
- else
- return m;
+ copy = gh_cons (ly_deep_mus_copy (ly_car (m)),
+ ly_deep_mus_copy (ly_cdr (m)));
+ return copy;
}
-LY_DEFINE(ly_music_transpose,
- "ly:music-transpose", 2,0,0, (SCM m, SCM p),
+LY_DEFINE (ly_music_transpose, "ly:music-transpose",
+ 2, 0, 0, (SCM m, SCM p),
"Transpose @var{m} such that central C is mapped to @var{p}. "
-"Return @var{m}.")
+ "Return @var{m}.")
{
Music * sc = unsmob_music (m);
Pitch * sp = unsmob_pitch (p);
- SCM_ASSERT_TYPE(sc, m, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE(sp, p, SCM_ARG2, __FUNCTION__, "pitch");
+ SCM_ASSERT_TYPE (sc, m, SCM_ARG1, __FUNCTION__, "music");
+ SCM_ASSERT_TYPE (sp, p, SCM_ARG2, __FUNCTION__, "pitch");
sc->transpose (*sp);
- return sc->self_scm(); // SCM_UNDEFINED ?
+ // SCM_UNDEFINED ?
+ return sc->self_scm ();
}
-
SCM make_music_proc;
-
Music*
make_music_by_name (SCM sym)
{
SCM rv = scm_call_1 (make_music_proc, sym);
- /*
- UGH.
- */
+ /* UGH. */
scm_gc_protect_object (rv);
return unsmob_music (rv);
}
-/*
+/*
musical-pitch.cc -- implement Pitch
-
+
source file of the GNU LilyPond music typesetter
-
+
(c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
+*/
+
#include "pitch.hh"
#include "warn.hh"
#include "main.hh"
#include "ly-smobs.icc"
-
Pitch::Pitch (int o, int n, int a)
{
notename_ = n;
int a = m1.alteration_ - m2.alteration_;
if (o)
- return o;
+ return o;
if (n)
- return n;
+ return n;
if (a)
- return a;
+ return a;
return 0;
}
return notename_ + octave_*7;
}
-/*
- should be settable from input?
- */
+/* Should be settable from input? */
static Byte diatonic_scale_semitones[ ] = { 0, 2, 4, 5, 7, 9, 11 };
}
if (alteration_ % 2)
- {
- programming_error ("Calling semitone_pitch() for quarter tone alterations.");
-
- }
-
- return (o + n / 7) * 12 + diatonic_scale_semitones[n % 7] + (alteration_/2);
+ programming_error ("semitone_pitch () called on quarter tone alteration.");
+
+ return ((o + n / 7) * 12
+ + diatonic_scale_semitones[n % 7]
+ + (alteration_ / 2));
}
int
n += 7;
o --;
}
-
- return (o + n / 7) * 24 + 2* diatonic_scale_semitones[n % 7] + (alteration_);
+
+ return ((o + n / 7) * 24
+ + 2 * diatonic_scale_semitones[n % 7]
+ + alteration_);
}
void
alteration_ = 0;
alteration_ -= quartertone_pitch () - pitch;
}
-
+
while (alteration_ < DOUBLE_FLAT)
{
if (notename_ == 0)
void
Pitch::transpose (Pitch delta)
{
- int new_semi = quartertone_pitch () +delta.quartertone_pitch();
+ int new_semi = quartertone_pitch () +delta.quartertone_pitch ();
octave_ += delta.octave_;
notename_ += delta.notename_;
- alteration_ += new_semi - quartertone_pitch();
+ alteration_ += new_semi - quartertone_pitch ();
normalise ();
}
Pitch
interval (Pitch const & from , Pitch const & to )
{
- int sound = to.quartertone_pitch() - from.quartertone_pitch ();
+ int sound = to.quartertone_pitch () - from.quartertone_pitch ();
Pitch pt (to.get_octave () - from.get_octave (),
- to.get_notename() - from.get_notename(),
+ to.get_notename () - from.get_notename (),
- to.get_alteration() - from.get_alteration());
+ to.get_alteration () - from.get_alteration ());
- return pt.transposed (Pitch(0,0,sound - pt.quartertone_pitch()));
+ return pt.transposed (Pitch (0,0,sound - pt.quartertone_pitch ()));
}
/* FIXME
- Merge with *pitch->text* funcs in chord-name.scm
- */
+ Merge with *pitch->text* funcs in chord-name.scm */
char const *accname[] = {"eses", "eseh", "es", "eh", "",
"ih", "is" , "isih", "isis"};
return s;
}
-/*
- change me to relative, counting from last pitch p
- return copy of resulting pitch
- */
+/* Change me to relative, counting from last pitch p
+ return copy of resulting pitch. */
Pitch
Pitch::to_relative_octave (Pitch p) const
{
- int oct_mod = octave_ + 1; // account for c' = octave 1 iso. 0 4
+ /* account for c' = octave 1 iso. 0 4 */
+ int oct_mod = octave_ + 1;
Pitch up_pitch (p);
Pitch down_pitch (p);
up_pitch.alteration_ = alteration_;
down_pitch.alteration_ = alteration_;
-
+
Pitch n = *this;
up_pitch.up_to (notename_);
down_pitch.down_to (notename_);
n = up_pitch;
else
n = down_pitch;
-
+
n.octave_ += oct_mod;
return n;
}
void
Pitch::up_to (int notename)
{
- if (notename_ > notename)
- {
- octave_ ++;
- }
+ if (notename_ > notename)
+ octave_++;
notename_ = notename;
}
Pitch::down_to (int notename)
{
if (notename_ < notename)
- {
- octave_ --;
- }
+ octave_--;
notename_ = notename;
}
-
-LY_DEFINE(ly_pitch_transpose,
- "ly:pitch-transpose", 2, 0, 0,
- (SCM p, SCM delta),
- "Transpose @var{p} by the amount @var{delta}, where @var{delta} is the "
-" pitch that central C is transposed to.")
+
+LY_DEFINE (ly_pitch_transpose, "ly:pitch-transpose",
+ 2, 0, 0, (SCM p, SCM delta),
+ "Transpose @var{p} by the amount @var{delta}, "
+ "where @var{delta} is the pitch that middle C is transposed to.")
{
Pitch* t = unsmob_pitch (p);
Pitch *d = unsmob_pitch (delta);
- SCM_ASSERT_TYPE(t, p, SCM_ARG1, __FUNCTION__, "pitch") ;
- SCM_ASSERT_TYPE(d, delta, SCM_ARG1, __FUNCTION__, "pitch") ;
-
+ SCM_ASSERT_TYPE (t, p, SCM_ARG1, __FUNCTION__, "pitch");
+ SCM_ASSERT_TYPE (d, delta, SCM_ARG1, __FUNCTION__, "pitch");
return t->transposed (*d).smobbed_copy ();
}
-/****************************************************************/
-
-
IMPLEMENT_TYPE_P (Pitch, "ly:pitch?");
SCM
int
Pitch::print_smob (SCM s, SCM port, scm_print_state *)
{
- Pitch *r = (Pitch *) ly_cdr (s);
-
+ Pitch *r = (Pitch *) ly_cdr (s);
scm_puts ("#<Pitch ", port);
scm_display (scm_makfrom0str (r->to_string ().to_str0 ()), port);
scm_puts (" >", port);
-
return 1;
}
SCM
Pitch::equal_p (SCM a , SCM b)
{
- Pitch *p = (Pitch *) ly_cdr (a);
- Pitch *q = (Pitch *) ly_cdr (b);
+ Pitch *p = (Pitch *) ly_cdr (a);
+ Pitch *q = (Pitch *) ly_cdr (b);
bool eq = p->notename_ == q->notename_
&& p->octave_ == q->octave_
return SCM_BOOL_F;
}
-/*
- should add optional args
- */
-
-LY_DEFINE(make_pitch, "ly:make-pitch", 3, 0, 0,
- (SCM octave, SCM note, SCM alter),
- "@var{octave} is specified by an integer, zero for the octave containing "
- "middle C. @var{note} is a number from 0 to 6, with 0 corresponding to C "
- "and 6 corresponding to B. The @var{alter} is zero for a natural, negative for "
- "flats, or positive for sharps. ")
+/* Should add optional args. */
+LY_DEFINE (make_pitch, "ly:make-pitch",
+ 3, 0, 0, (SCM octave, SCM note, SCM alter),
+ "@var{octave} is specified by an integer, "
+ "zero for the octave containing middle C. "
+ "@var{note} is a number from 0 to 6, "
+ "with 0 corresponding to C and 6 corresponding to B. "
+ "The @var{alter} is zero for a natural, negative for "
+ "flats, or positive for sharps. ")
{
- SCM_ASSERT_TYPE(scm_integer_p (octave)== SCM_BOOL_T , octave, SCM_ARG1, __FUNCTION__, "integer");
- SCM_ASSERT_TYPE(scm_integer_p (note)== SCM_BOOL_T, note, SCM_ARG2, __FUNCTION__, "integer");
- SCM_ASSERT_TYPE(scm_integer_p (alter)== SCM_BOOL_T, alter, SCM_ARG3, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (scm_integer_p (octave)== SCM_BOOL_T , octave, SCM_ARG1, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (scm_integer_p (note)== SCM_BOOL_T, note, SCM_ARG2, __FUNCTION__, "integer");
+ SCM_ASSERT_TYPE (scm_integer_p (alter)== SCM_BOOL_T, alter, SCM_ARG3, __FUNCTION__, "integer");
Pitch p (gh_scm2int (octave), gh_scm2int (note), gh_scm2int (alter));
return p.smobbed_copy ();
}
-LY_DEFINE(pitch_steps, "ly:pitch-steps", 1, 0,0,
- (SCM p),
- "Number of steps counted from central C of the pitch @var{p}.")
+LY_DEFINE (pitch_steps, "ly:pitch-steps", 1, 0, 0,
+ (SCM p),
+ "Number of steps counted from middle C of the pitch @var{p}.")
{
Pitch *pp = unsmob_pitch (p);
- SCM_ASSERT_TYPE(pp, p, SCM_ARG1, __FUNCTION__, "Pitch");
-
- return gh_int2scm (pp->steps());
+ SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch");
+ return gh_int2scm (pp->steps ());
}
-LY_DEFINE(pitch_octave, "ly:pitch-octave", 1, 0, 0,
- (SCM pp),
- "extract the octave from pitch @var{p}.")
+LY_DEFINE (pitch_octave, "ly:pitch-octave",
+ 1, 0, 0, (SCM pp),
+ "extract the octave from pitch @var{p}.")
{
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
+ SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->get_octave ();
-
return gh_int2scm (q);
}
-LY_DEFINE(pitch_alteration, "ly:pitch-alteration", 1, 0, 0,
- (SCM pp),
- "extract the alteration from pitch @var{p}.")
+LY_DEFINE (pitch_alteration, "ly:pitch-alteration",
+ 1, 0, 0, (SCM pp),
+ "extract the alteration from pitch @var{p}.")
{
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
- int q = p->get_alteration ();
+ SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
+ int q = p->get_alteration ();
return gh_int2scm (q);
}
-LY_DEFINE(pitch_notename, "ly:pitch-notename", 1, 0, 0,
- (SCM pp),
- "extract the note name from pitch @var{pp}.")
+LY_DEFINE (pitch_notename, "ly:pitch-notename",
+ 1, 0, 0, (SCM pp),
+ "extract the note name from pitch @var{pp}.")
{
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
- int q = p->get_notename ();
-
+ SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
+ int q = p->get_notename ();
return gh_int2scm (q);
}
-LY_DEFINE(ly_pitch_quartertones, "ly:pitch-quartertones", 1, 0, 0,
- (SCM pp),
- "calculate the number of semitones of @var{p} from central C.")
+LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
+ 1, 0, 0, (SCM pp),
+ "calculate the number of semitones of @var{p} from middle C.")
{
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
-
+ SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->quartertone_pitch ();
-
return gh_int2scm (q);
}
-LY_DEFINE(ly_pitch_semitones, "ly:pitch-semitones", 1, 0, 0,
- (SCM pp),
- "calculate the number of semitones of @var{p} from central C.")
+LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones",
+ 1, 0, 0, (SCM pp),
+ "calculate the number of semitones of @var{p} from middle C.")
{
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
-
+ SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->semitone_pitch ();
-
return gh_int2scm (q);
}
-LY_DEFINE(pitch_less, "ly:pitch<?", 2,0,0, (SCM p1, SCM p2),
- "Is @var{p1} lower than @var{p2}? This uses lexicographic ordening.")
+LY_DEFINE (pitch_less, "ly:pitch<?",
+ 2, 0, 0, (SCM p1, SCM p2),
+ "Is @var{p1} lower than @var{p2}? "
+ "This uses lexicographic ordening.")
{
Pitch *a = unsmob_pitch (p1);
Pitch *b = unsmob_pitch (p2);
-
- SCM_ASSERT_TYPE(a, p1, SCM_ARG1, __FUNCTION__, "Pitch");
- SCM_ASSERT_TYPE(b, p2, SCM_ARG2, __FUNCTION__, "Pitch");
+
+ SCM_ASSERT_TYPE (a, p1, SCM_ARG1, __FUNCTION__, "Pitch");
+ SCM_ASSERT_TYPE (b, p2, SCM_ARG2, __FUNCTION__, "Pitch");
if (Pitch::compare (*a, *b) < 0)
return SCM_BOOL_T;
return SCM_BOOL_F;
}
-LY_DEFINE(ly_pitch_diff, "ly:pitch-diff", 2 ,0 ,0,
- (SCM pitch, SCM root),
- "Return pitch @var{delta} such that @code{pitch} transposed by "
- "@var{delta} equals @var{root}"
- )
+LY_DEFINE (ly_pitch_diff, "ly:pitch-diff",
+ 2 ,0, 0, (SCM pitch, SCM root),
+ "Return pitch @var{delta} such that @code{pitch} transposed by "
+ "@var{delta} equals @var{root}" )
{
Pitch *p = unsmob_pitch (pitch);
Pitch *r = unsmob_pitch (root);
- SCM_ASSERT_TYPE(p, pitch, SCM_ARG1, __FUNCTION__, "Pitch");
- SCM_ASSERT_TYPE(r, root, SCM_ARG2, __FUNCTION__, "Pitch");
+ SCM_ASSERT_TYPE (p, pitch, SCM_ARG1, __FUNCTION__, "Pitch");
+ SCM_ASSERT_TYPE (r, root, SCM_ARG2, __FUNCTION__, "Pitch");
- return interval (*r, *p).smobbed_copy();
+ return interval (*r, *p).smobbed_copy ();
}
SCM
Pitch::smobbed_copy ()const
{
- Pitch * p = new Pitch (*this);
+ Pitch *p = new Pitch (*this);
return p->smobbed_self ();
}
Pitch
Pitch::transposed (Pitch d) const
{
- Pitch p =*this;
+ Pitch p = *this;
p.transpose (d);
return p;
}
me->add_dependency (i);
}
-LY_DEFINE(grob_script_priority_less,
- "ly:grob-script-priority-less", 2, 0, 0,
- (SCM a, SCM b),
+LY_DEFINE (grob_script_priority_less, "ly:grob-script-priority-less",
+ 2, 0, 0, (SCM a, SCM b),
"Compare two grobs by script priority. For internal use.")
{
- Grob * i1 = unsmob_grob (a);
- Grob* i2 = unsmob_grob (b);
+ Grob *i1 = unsmob_grob (a);
+ Grob *i2 = unsmob_grob (b);
SCM p1 = i1->get_property ("script-priority");
SCM p2 = i2->get_property ("script-priority");
return gh_scm2int (p1) < gh_scm2int (p2) ? SCM_BOOL_T : SCM_BOOL_F;
}
-
-
-MAKE_SCHEME_CALLBACK (Script_column,before_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Script_column, before_line_breaking, 1);
SCM
Script_column::before_line_breaking (SCM smob)
{
Drul_array<SCM> scripts (SCM_EOL, SCM_EOL);
Link_array<Grob> staff_sided;
- for (SCM s = me->get_property( "scripts"); gh_pair_p (s); s = gh_cdr( s))
+ for (SCM s = me->get_property ("scripts"); gh_pair_p (s); s = gh_cdr (s))
{
Grob *sc = unsmob_grob (gh_car (s));
- if (!sc->has_offset_callback (Side_position_interface::aligned_side_proc, X_AXIS))
+ if (!sc->has_offset_callback (Side_position_interface::aligned_side_proc,
+ X_AXIS))
staff_sided.push (sc);
}
- for (int i=0; i < staff_sided.size (); i++)
+ for (int i = 0; i < staff_sided.size (); i++)
{
Grob* g = staff_sided[i];
Direction d = Side_position_interface::get_direction (g);
g->set_property ("direction", gh_int2scm (d));
}
- scripts[d] = scm_cons (g->self_scm(), scripts[d]);
+ scripts[d] = scm_cons (g->self_scm (), scripts[d]);
}
Direction d = DOWN;
- do {
- SCM ss = scm_reverse_x (scripts[d], SCM_EOL);
- ss = scm_stable_sort_x (ss, grob_script_priority_less_proc);
-
- Grob * last = 0;
- for (SCM s = ss; gh_pair_p (s); s = gh_cdr (s))
- {
- Grob* g = unsmob_grob (gh_car (s));
- if (last)
- Side_position_interface::add_support (g,last);
-
- last = g;
- }
-
- } while (flip (&d) != DOWN);
+ do
+ {
+ SCM ss = scm_reverse_x (scripts[d], SCM_EOL);
+ ss = scm_stable_sort_x (ss, grob_script_priority_less_proc);
+
+ Grob * last = 0;
+ for (SCM s = ss; gh_pair_p (s); s = gh_cdr (s))
+ {
+ Grob *g = unsmob_grob (gh_car (s));
+ if (last)
+ Side_position_interface::add_support (g,last);
+
+ last = g;
+ }
+
+ } while (flip (&d) != DOWN);
return SCM_UNSPECIFIED;
}
-
ADD_INTERFACE (Script_column,"script-column-interface",
- "An interface that sorts scripts according to their @code{script-priority}",
- "");
-
-
+ "An interface that sorts scripts "
+ "according to their @code{script-priority}",
+ "");
-/*
+/*
staff-symbol-referencer.cc -- implement Staff_symbol_referencer
-
+
source file of the GNU LilyPond music typesetter
-
+
(c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- */
+*/
#include <math.h>
#include "staff-symbol-referencer.hh"
#include "staff-symbol.hh"
#include "paper-def.hh"
-#include "libc-extension.hh"
+#include "libc-extension.hh"
int
-Staff_symbol_referencer::line_count (Grob*me)
+Staff_symbol_referencer::line_count (Grob *me)
{
- Grob *st = get_staff_symbol (me);
- return st ? Staff_symbol::line_count (st) : 0;
+ Grob *st = get_staff_symbol (me);
+ return st ? Staff_symbol::line_count (st) : 0;
}
bool
-Staff_symbol_referencer::on_staffline (Grob*me)
+Staff_symbol_referencer::on_staffline (Grob *me)
{
return on_staffline (me, (int) rint (get_position (me)));
}
bool
-Staff_symbol_referencer::on_staffline (Grob*me, int pos)
+Staff_symbol_referencer::on_staffline (Grob *me, int pos)
{
- int sz = line_count (me)-1;
+ int sz = line_count (me) - 1;
return ((pos + sz) % 2) == 0;
}
Grob*
-Staff_symbol_referencer::get_staff_symbol (Grob*me)
+Staff_symbol_referencer::get_staff_symbol (Grob *me)
{
SCM st = me->get_property ("staff-symbol");
return unsmob_grob (st);
}
Real
-Staff_symbol_referencer::staff_space (Grob*me)
+Staff_symbol_referencer::staff_space (Grob *me)
{
- Grob * st = get_staff_symbol (me);
+ Grob *st = get_staff_symbol (me);
if (st)
return Staff_symbol::staff_space (st);
-
return 1.0;
}
Real
-Staff_symbol_referencer::line_thickness (Grob*me)
+Staff_symbol_referencer::line_thickness (Grob *me)
{
- Grob * st = get_staff_symbol (me);
+ Grob *st = get_staff_symbol (me);
if (st)
return Staff_symbol::get_line_thickness (st);
-
return me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
}
Real
-Staff_symbol_referencer::get_position (Grob*me)
+Staff_symbol_referencer::get_position (Grob *me)
{
- Real p =0.0;
- Grob * st = get_staff_symbol (me);
- Grob * c = st ? me->common_refpoint (st, Y_AXIS) : 0;
+ Real p = 0.0;
+ Grob *st = get_staff_symbol (me);
+ Grob *c = st ? me->common_refpoint (st, Y_AXIS) : 0;
if (st && c)
{
Real y = me->relative_coordinate (c, Y_AXIS)
return p;
}
- return robust_scm2double ( me->get_property ("staff-position"), p);
+ return robust_scm2double (me->get_property ("staff-position"), p);
}
-LY_DEFINE(ly_grob_staff_position,
- "ly:grob-staff-position",
- 1, 0,0, (SCM sg),
- "Return the Y-position of this grob relative to the staff.")
+LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position",
+ 1, 0,0, (SCM sg),
+ "Return the Y-position of this grob relative to the staff.")
{
- Grob * g = unsmob_grob (sg);
+ Grob *g = unsmob_grob (sg);
SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob");
Real pos = Staff_symbol_referencer::get_position (g);
}
-/*
- should use offset callback!
- */
+/* should use offset callback! */
MAKE_SCHEME_CALLBACK (Staff_symbol_referencer,callback,2);
SCM
Staff_symbol_referencer::callback (SCM element_smob, SCM)
Grob *me = unsmob_grob (element_smob);
SCM pos = me->get_property ("staff-position");
- Real off =0.0;
+ Real off = 0.0;
if (gh_number_p (pos))
{
Real space = Staff_symbol_referencer::staff_space (me);
- off = gh_scm2double (pos) * space/2.0;
+ off = gh_scm2double (pos) * space / 2.0;
me->set_property ("staff-position", gh_int2scm (0));
}
return gh_double2scm (off);
}
- /*
-
- This sets the position relative to the center of the staff symbol.
-
- The function is hairy, because it can be callled in two situations:
-
- 1. There is no staff yet; we must set staff-position
-
- 2. There is a staff, and perhaps someone even applied a
- translate_axis (). Then we must compensate for the translation
-
- In either case, we set a callback to be sure that our new position
- will be extracted from staff-position
-
- */
+/* This sets the position relative to the center of the staff symbol.
+
+The function is hairy, because it can be callled in two situations:
+
+1. There is no staff yet; we must set staff-position
+
+2. There is a staff, and perhaps someone even applied a
+translate_axis (). Then we must compensate for the translation
+
+In either case, we set a callback to be sure that our new position
+will be extracted from staff-position */
+
void
-Staff_symbol_referencer::set_position (Grob*me,Real p)
+Staff_symbol_referencer::set_position (Grob *me, Real p)
{
- Grob * st = get_staff_symbol (me);
+ Grob *st = get_staff_symbol (me);
if (st && me->common_refpoint (st, Y_AXIS))
{
Real oldpos = get_position (me);
me->set_property ("staff-position", gh_double2scm (p - oldpos));
}
else
- {
- me->set_property ("staff-position",
- gh_double2scm (p));
+ me->set_property ("staff-position", gh_double2scm (p));
- }
-
- if (me->has_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS))
- return ;
-
- me->add_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS);
+ if (!me->has_offset_callback (Staff_symbol_referencer::callback_proc,
+ Y_AXIS))
+ me->add_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS);
}
-/*
- Half of the height, in staff space, i.e. 2.0 for a normal staff.
-*/
+/* Half of the height, in staff space, i.e. 2.0 for a normal staff. */
Real
-Staff_symbol_referencer::staff_radius (Grob*me)
+Staff_symbol_referencer::staff_radius (Grob *me)
{
- return (line_count (me) -1) / 2.0;
+ return (line_count (me) - 1) / 2.0;
}
-
int
-compare_position (Grob *const &a, Grob * const &b)
+compare_position (Grob *const &a, Grob *const &b)
{
- return sign (Staff_symbol_referencer::get_position ((Grob*)a) -
- Staff_symbol_referencer::get_position ((Grob*)b));
+ return sign (Staff_symbol_referencer::get_position ((Grob*)a)
+ - Staff_symbol_referencer::get_position ((Grob*) b));
}
ADD_INTERFACE (Staff_symbol_referencer,"staff-symbol-referencer-interface",
"An object whose Y position is meant relative to a staff "
- "symbol. These usually have "
- "@code{Staff_symbol_referencer::callback} in their @code{Y-offset-callbacks}. "
+ "symbol. "
+ "These usually have @code{Staff_symbol_referencer::callback} "
+ "in their @code{Y-offset-callbacks}. "
,
"staff-position");
#include "font-metric.hh"
#include "stencil.hh"
-LY_DEFINE (ly_stencil_set_extent_x,"ly:stencil-set-extent!", 3 , 0, 0,
- (SCM stil, SCM axis, SCM np),
+
+LY_DEFINE (ly_stencil_set_extent_x,"ly:stencil-set-extent!",
+ 3, 0, 0, (SCM stil, SCM axis, SCM np),
"Set the extent of @var{stil} "
"(@var{extent} must be a pair of numbers) "
"in @var{axis} direction (0 or 1 for x- and y-axis respectively).")
return SCM_UNDEFINED;
}
-LY_DEFINE (ly_translate_stencil_axis,"ly:stencil-translate-axis", 3, 0, 0,
- (SCM stil, SCM amount, SCM axis),
+LY_DEFINE (ly_translate_stencil_axis, "ly:stencil-translate-axis",
+ 3, 0, 0, (SCM stil, SCM amount, SCM axis),
"Return a @var{stil}, "
"but translated by @var{amount} in @var{axis} direction.")
{
return q.smobbed_copy();
}
-LY_DEFINE (ly_translate_stencil,"ly:stencil-translate", 2, 0, 0,
- (SCM stil, SCM offset),
+LY_DEFINE (ly_translate_stencil,"ly:stencil-translate",
+ 2, 0, 0, (SCM stil, SCM offset),
"Return a @var{stil}, "
"but translated by @var{offset} (a pair of numbers).")
{
SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
SCM_ASSERT_TYPE (is_number_pair (offset), offset, SCM_ARG2, __FUNCTION__, "number pair");
Offset o = ly_scm2offset (offset);
-
+
Stencil q (*s);
q.translate (o);
return q.smobbed_copy();
}
-LY_DEFINE (ly_stencil_get_expr,
- "ly:stencil-get-expr", 1 , 0, 0, (SCM stil),
+LY_DEFINE (ly_stencil_get_expr, "ly:stencil-get-expr",
+ 1 , 0, 0, (SCM stil),
"Return the expression of @var{stil}.")
{
Stencil *s = unsmob_stencil (stil);
Stencil *s = unsmob_stencil (stil);
SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
-
+
return ly_interval2scm (s->extent (Axis (gh_scm2int (axis))));
}
SCM_ASSERT_TYPE(gh_number_p (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
m = gh_scm2double (minimum);
}
-
+
if (s1)
result = *s1;
if (s2)
}
/* FIXME: support variable number of arguments. */
-LY_DEFINE (ly_stencil_add ,
+LY_DEFINE (ly_stencil_add ,
"ly:stencil-add", 0, 0, 1, (SCM args),
"Combine stencils. Takes any number of arguments.")
{
result.add_stencil (*s);
args = gh_cdr (args);
}
-
+
return result.smobbed_copy ();
}
"2: the vertical and horizontal extents of the object.\n\n")
{
SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair");
- SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair");
+ SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair");
Box b (ly_scm2interval (xext), ly_scm2interval(yext));
Stencil s (b, expr);
ly_quote_scm (met->description_), f, SCM_UNDEFINED);
}
-LY_DEFINE (ly_fontify_atom,"ly:fontify-atom", 2, 0, 0,
+LY_DEFINE (ly_fontify_atom,"ly:fontify-atom", 2, 0, 0,
(SCM met, SCM f),
"Add a font selection command for the font metric @var{met} "
"to @var{f}.")
return fontify_atom (unsmob_metrics (met), f);
}
-LY_DEFINE (ly_align_to_x,"ly:stencil-align-to!", 3, 0, 0,
- (SCM stil, SCM axis, SCM dir),
+LY_DEFINE (ly_align_to_x, "ly:stencil-align-to!",
+ 3, 0, 0, (SCM stil, SCM axis, SCM dir),
"Align @var{stil} using its own extents. "
"@var{dir} is a number -1, 1 are left and right respectively. "
"Other values are interpolated (so 0 means the center. ")
unsmob_stencil (stil)->align_to ((Axis)gh_scm2int (axis),
gh_scm2double (dir));
-
return SCM_UNDEFINED;
}
-/*
+/*
translator-scheme.cc -- implement Scheme context functions
-
+
source file of the GNU LilyPond music typesetter
(c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
#include "translator.hh"
#include "context-def.hh"
-
#include "translator-group.hh"
#include "lily-guile.hh"
-
-
-LY_DEFINE(ly_translator_name,
- "ly:translator-name", 1,0,0, (SCM trans),
- "Return the type name of the translator object @var{trans}. The name is a symbol.")
+LY_DEFINE (ly_translator_name, "ly:translator-name",
+ 1, 0, 0, (SCM trans),
+ "Return the type name of the translator object @var{trans}. "
+ "The name is a symbol.")
{
- Translator * tr = unsmob_translator (trans);
- SCM_ASSERT_TYPE(tr, trans, SCM_ARG1, __FUNCTION__, "Translator");
-
- char const* nm = classname (tr);
+ Translator *tr = unsmob_translator (trans);
+ SCM_ASSERT_TYPE (tr, trans, SCM_ARG1, __FUNCTION__, "Translator");
+ char const *nm = classname (tr);
return ly_symbol2scm (nm);
}
-
-LY_DEFINE(ly_translator_description,
- "ly:translator-description",
+LY_DEFINE (ly_translator_description, "ly:translator-description",
1,0,0, (SCM me),
"Return an alist of properties of translator @var{me}.")
{
- Translator *tr =unsmob_translator (me);
+ Translator *tr = unsmob_translator (me);
SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Translator");
-
return tr->translator_description ();
}
-
int
Translator::print_smob (SCM s, SCM port, scm_print_state *)
{
- Translator *sc = (Translator *) ly_cdr (s);
-
+ Translator *sc = (Translator*) ly_cdr (s);
scm_puts ("#<Translator ", port);
scm_puts (classname (sc), port);
scm_puts (" >", port);
-
return 1;
}
O_FILES+=$(addprefix $(outdir)/, $(CC_FILES:.cc=.o) $(LL_FILES:.ll=.o) $(YY_FILES:.yy=.o))
-TAGS_FILES += $(TCC_FILES) $(HH_FILES) $(INL_FILES) $(CC_FILES) $(YY_FILES) $(LL_FILES)
+TAGS_SOURCES += $(TCC_FILES) $(INL_FILES) $(CC_FILES) $(YY_FILES) $(LL_FILES)
+TAGS_HEADERS += $(HH_FILES) $(INL_FILES)
O_FILES+=$(addprefix $(outdir)/, $(Y_FILES:.y=.o) $(C_FILES:.c=.o) $(L_FILES:.l=.o))
-TAGS_FILES += $(C_FILES) $(H_FILES)
+TAGS_SOURCES += $(C_FILES)
+TAGS_HEADERS += $(H_FILES)
ALL_C_SOURCES += $(H_FILES) $(C_FILES) $(Y_FILES) $(L_FILES)
html: $(HTML_FILES)
TAGS:
- -if [ "$(TAGS_FILES)" != "" ]; then \
- etags $(ETAGS_FLAGS) $(TAGS_FILES) || \
- ctags $(CTAGS_FLAGS) ".h.hh.tcc.icc" $(TAGS_FILES) $(ERROR_LOG); \
- fi
-
$(LOOP)
+ $(MAKE) local-tags
+
+DEEPER_TAGS_FILES = $(shell find $(pwd) -mindepth 2 -name 'TAGS')
+local-tags:
+ -if [ -n "$(TAGS_HEADERS)$(TAGS_SOURCES)$(DEEPER_TAGS_FILES)" ]; then \
+ etags $(ETAGS_FLAGS) $(DEEPER_TAGS_FILES:%=--include=%) \
+ $(TAGS_SOURCES) $(TAGS_HEADERS) $(ERROR_LOG) ; \
+ ctags $(CTAGS_FLAGS) $(TAGS_SOURCES) $(TAGS_HEADERS) \
+ $(ERROR_LOG) ; \
+ fi
$(outdir)/version.hh: $(depth)/VERSION $(config_make)
$(PYTHON) $(step-bindir)/make-version.py $< > $@
DO_STRIP=true
LOOP=$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) package=$(package) -C $(i) $@ &&) true
-# different redhat releases need different flags for etags. Just use defaults.
-ETAGS_FLAGS= # -CT
-CTAGS_FLAGS=-h
+ETAGS_FLAGS =
+CTAGS_FLAGS =
makeflags=$(patsubst %==, %, $(patsubst ---%,,$(patsubst ----%,,$(MAKEFLAGS:%=--%))))
SOURCE_FILES += $(SCM_FILES)
-TAGS_FILES += $(SCM_FILES)
+TAGS_SOURCES += $(SCM_FILES)