2005-08-12 Jan Nieuwenhuizen <janneke@gnu.org>
+ * Remove obsolete files. Nitpick run.
+
* lily/lily-guile.cc (parse_symbol_list): Bugfix.
2005-08-11 Jan Nieuwenhuizen <janneke@gnu.org>
('(return|=) (\*|&|-|!) ([\w\(])', '\\1 \\2\\3'),
# space after `operator'
('(\Woperator) *([^\w\s])', '\\1 \\2'),
+ # delete gratuitous block
+ ('''\n( |\t)\s*{\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch|while)\b);\n\s*}''',
+ '\n\\2;'),
# dangling brace close
('\n[ \t]*(\n[ \t]*})', '\\1'),
# dangling newline
# dangling semicolon
('\n[ \t]*;', ';'),
# delete gratuitous blocks
- ('''(?ux)\n([ ]|\t\s*){\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch|while)\b);\n\s*}''',
+ ('''xx\n([ ]|\t)\s*{\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch|while)\b);\n\s*}''',
'\n\\2;'),
# brace open
('(\w)[ \t]*([^\s]*){([ \t]*\n)', '\\1\\2\n{\n'),
{
if (foo)
{
- a = 1;
+ a = 1;
}
}
-
- if (prev_delta_pitch < - 1)
- {
- glyph_name = "svaticana.reverse.plica";
- }
- if (prev_delta_pitch < - 1)
- {
- glyph_name = svaticana.reverse.plica;
- }
- if (prev_delta_pitch < - 1)
- {
- glyph_name = "2";
- }
'''
def test ():
buf[0] = (char) c;
return Memory_out_stream::writer (file, buf, 1);
}
-
} /* extern C */
return s;
}
-
File_name::File_name (String file_name)
{
#ifdef __CYGWIN__
struct stat sbuf;
if (stat (file_name.to_str0 (), &sbuf) != 0)
return false;
-
- if (!(sbuf.st_mode & __S_IFREG))
+
+ if (! (sbuf.st_mode & __S_IFREG))
return false;
#endif
struct stat sbuf;
if (stat (file_name.to_str0 (), &sbuf) != 0)
return false;
-
+
return !S_ISDIR (sbuf.st_mode);
#endif
fclose (f);
return true;
}
-
+
return false;
}
struct stat sbuf;
if (stat (file_name.to_str0 (), &sbuf) != 0)
return false;
-
+
return S_ISDIR (sbuf.st_mode);
#endif
File_name file_name (name);
if (file_name.dir_[0] == DIRSEP && is_file (file_name.to_string ()))
return file_name.to_string ();
-
+
for (int i = 0; i < dirs_.size (); i++)
{
File_name file_name (name);
dir.root_ = "";
if (file_name.dir_.is_empty ())
file_name.dir_ = dir.to_string ();
- else if (!dir.to_string ().is_empty())
+ else if (!dir.to_string ().is_empty ())
file_name.dir_ = dir.to_string ()
+ ::to_string (DIRSEP) + file_name.dir_;
if (is_file (file_name.to_string ()))
/*
Try to find
- file.EXT,
+ file.EXT,
where EXT is from EXTENSIONS.
*/
if (!find (file_name.to_string ()).is_empty ())
break;
}
-
+
/* Reshuffle extension */
file_name = File_name (file_name.to_string ());
}
for (int i = 0; i < dirs_.size (); i++)
{
s = s + dirs_[i];
- if (i < dirs_.size() - 1)
+ if (i < dirs_.size () - 1)
s += ::to_string (PATHSEP);
}
return s;
return parseshort ();
}
else
- {
- return 0;
- }
+ return 0;
}
}
extern "C" {
#endif
-
#include <stdio.h>
#include <unistd.h>
#if (! defined (__off64_t) && ! defined (__off64_t_defined)) || ! defined (__cplusplus)
#define off64_t unsigned long long
#endif
-
+
typedef struct
{
ssize_t (*read) (void *, char *, size_t);
int (*close) (void *);
} lily_cookie_io_functions_t;
-
void *lily_fopencookie (void *cookie, char const *modes,
lily_cookie_io_functions_t io_funcs);
class File_path
{
- Array<String> dirs_;
+ Array<String> dirs_;
public:
Array<String> directories () const;
String find (String name) const;
abort ();
return SCM_CAR (x);
}
-#define SCM_I_CONSP(x) SCM_CONSP(x)
+#define SCM_I_CONSP(x) SCM_CONSP (x)
inline SCM scm_caar (SCM x) { return SCM_CAAR (x); }
inline SCM scm_cdar (SCM x) { return SCM_CDAR (x); }
inline SCM scm_cadr (SCM x) { return SCM_CADR (x); }
: Drul_array<T> (src)
{
}
-
+
Interval_t (T m, T M) : Drul_array<T> (m, M)
{
}
}
-
template<class T>
String
Interval_t<T>::to_string () const
#endif
#endif
-
#if ! HAVE_MEMRCHR
unsigned char *memrchr (unsigned char const *p, int n, char c);
#endif
if (new_p)
elem_ref (i) = new_p;
else
- {
- unordered_del (i);
- }
+ unordered_del (i);
}
void default_sort ()
{
*/
typedef struct
{
- int code, /* key: C */
- wx, /* key: WX */
+ int code, /* key: C */
+ wx, /* key: WX */
wy; /* together wx and wy are associated with key: W */
char *name; /* key: N */
AFM_BBox charBBox; /* key: B */
j = i / 2;
}
else
-
- {
- break;
- }
+ break;
}
elt (i) = v;
OK ();
return 0;
}
-
template<class T> inline T sqr (T x)
{
return x * x;
}
-
inline Real
distance (Real x, Real y)
{
VIRTUAL_COPY_CONSTRUCTOR (Baseclass, Foo);
}; */
-#define VIRTUAL_COPY_CONSTRUCTOR(Base, name) \
- virtual Base *clone () const \
- { \
- return new name (*this); \
+#define VIRTUAL_COPY_CONSTRUCTOR(Base, name) \
+ virtual Base *clone () const \
+ { \
+ return new name (*this); \
}
#endif /* VIRTUAL_METHODS_HH */
{
free (fi->ccd[i].ccName);
for (j = 0; j < fi->ccd[i].numOfPieces; j++)
- {
- free (fi->ccd[i].pieces[j].AFM_PccName);
- }
+ free (fi->ccd[i].pieces[j].AFM_PccName);
free (fi->ccd[i].pieces);
}
free (fi->ccd);
return sign_ && num_;
}
-
#ifdef STREAM_SUPPORT
ostream &
operator << (ostream &o, Rational r)
*this = r;
else
{
- int lcm = (den_ / gcd (r.den_, den_)) * r.den_;
+ int lcm = (den_ / gcd (r.den_, den_)) * r.den_;
int n = sign_ * num_ * (lcm / den_) + r.sign_ * r.num_ * (lcm / r.den_);
int d = lcm;
sign_ = ::sign (n) * ::sign (d);
}
-
Byte *
String::get_bytes ()
{
{
char *found = (char *) memchr (me, set[i], n);
if (found)
- {
- return found - (char const *)me;
- }
+ return found - (char const *)me;
}
return -1;
}
void create_accidental (Accidental_entry *entry, bool, bool);
Grob *make_standard_accidental (Music *note, Grob *note_head, Engraver *trans);
Grob *make_suggested_accidental (Music *note, Grob *note_head, Engraver *trans);
-
+
protected:
TRANSLATOR_DECLARATIONS (Accidental_engraver);
void process_music ();
void acknowledge_arpeggio (Grob_info);
void acknowledge_rhythmic_head (Grob_info);
void acknowledge_finger (Grob_info);
-
+
void stop_translation_timestep ();
virtual void initialize ();
void process_acknowledged ();
Array<Accidental_entry> accidentals_;
Link_array<Spanner> ties_;
-
};
/*
/* Cannot look for ties: it's not guaranteed that they reach
us before the notes. */
if (num)
- {
- create_accidental (&accidentals_[i], num > 1, cautionary);
- }
+ create_accidental (&accidentals_[i], num > 1, cautionary);
}
}
}
Music *note = entry->melodic_;
Grob *support = entry->head_;
Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
-
-
+
bool as_suggestion = to_boolean (entry->origin_->get_property ("suggestAccidentals"));
Grob *a = 0;
if (as_suggestion)
a = make_suggested_accidental (note, support, entry->origin_engraver_);
else
a = make_standard_accidental (note, support, entry->origin_engraver_);
-
+
SCM accs = scm_cons (scm_from_int (pitch->get_alteration ()),
SCM_EOL);
if (restore_natural)
if (to_boolean (get_property ("extraNatural")))
accs = scm_cons (scm_from_int (0), accs);
}
-
+
/* TODO: add cautionary option in accidental. */
if (cautionary)
a->set_property ("cautionary", SCM_BOOL_T);
-
a->set_property ("accidentals", accs);
entry->accidental_ = a;
}
Grob *support,
Engraver *trans)
{
-
+
/*
We construct the accidentals at the originating Voice
level, so that we get the property settings for
accidental_placement_ = make_item ("AccidentalPlacement",
a->self_scm ());
Accidental_placement::add_accidental (accidental_placement_, a);
-
+
support->set_object ("accidental-grob", a->self_scm ());
return a;
}
-
Grob *
Accidental_engraver::make_suggested_accidental (Music *note,
- Grob *note_head, Engraver *trans)
+ Grob *note_head, Engraver *trans)
{
-
+
Grob *a
= make_grob_from_properties (trans,
ly_symbol2scm ("AccidentalSuggestion"),
note->self_scm (),
"AccidentalSuggestion");
-
Side_position_interface::add_support (a, note_head);
if (Grob *stem = unsmob_grob (a->get_object ("stem")))
{
return a;
}
-
void
Accidental_engraver::finalize ()
{
{
/*
String harmonics usually don't have accidentals.
- */
+ */
if (to_boolean (get_property ("harmonicAccidentals"))
|| !ly_is_equal (info.grob ()->get_property ("style"),
- ly_symbol2scm ("harmonic")))
+ ly_symbol2scm ("harmonic")))
{
Accidental_entry entry;
entry.head_ = info.grob ();
update_local_key_signature ();
}
-
ADD_ACKNOWLEDGER (Accidental_engraver, arpeggio);
ADD_ACKNOWLEDGER (Accidental_engraver, finger);
ADD_ACKNOWLEDGER (Accidental_engraver, rhythmic_head);
Interval y;
for (int j = apes[i]->extents_.size (); j--;)
- {
- y.unite (apes[i]->extents_[j][Y_AXIS]);
- }
+ y.unite (apes[i]->extents_[j][Y_AXIS]);
apes[i]->vertical_extent_ = y;
total.unite (y);
}
{
Accidental_placement_entry *ape = apes[i];
for (int j = ape->grobs_.size (); j--;)
- {
- ape->grobs_[j]->translate_axis (ape->offset_, X_AXIS);
- }
+ ape->grobs_[j]->translate_axis (ape->offset_, X_AXIS);
}
Interval left_extent, right_extent;
Axis ax = (Axis)scm_to_int (axis);
Grob *par = me->get_parent (ax);
if (par && !to_boolean (par->get_property ("positioning-done")))
- {
- Align_interface::align_elements_to_extents (par, ax);
- }
+ Align_interface::align_elements_to_extents (par, ax);
return scm_from_double (0.0);
}
Axis ax = (Axis)scm_to_int (axis);
Grob *par = me->get_parent (ax);
if (par && !to_boolean (par->get_property ("positioning-done")))
- {
- Align_interface::align_to_fixed_distance (par, ax);
- }
+ Align_interface::align_to_fixed_distance (par, ax);
return scm_from_double (0.0);
}
extract_grob_set (me, "elements", elem_source);
- Link_array<Grob> elems (elem_source); // writable..
-
+ Link_array<Grob> elems (elem_source); // writable..
+
Real where_f = 0;
Interval v;
TODO: support self-alignment-{Y, X}
*/
for (int i = 0; i < translates.size (); i++)
- {
- elems[i]->translate_axis (translates[i] - v.center (), a);
- }
+ elems[i]->translate_axis (translates[i] - v.center (), a);
}
/*
&& me_spanner
&& me_spanner->get_bound (LEFT)->break_status_dir () == CENTER)
{
- me_spanner->warning (_("vertical alignment called before line-breaking. Only do cross-staff spanners with PianoStaff."));
+ me_spanner->warning (_ ("vertical alignment called before line-breaking. Only do cross-staff spanners with PianoStaff."));
}
-
+
me->set_property ("positioning-done", SCM_BOOL_T);
SCM d = me->get_property ("stacking-dir");
while (j < all_grobs.size ())
{
if (i < elems.size () && all_grobs[j] == elems[i])
- {
- w = translates[i++];
- }
+ w = translates[i++];
all_translates.push (w);
j++;
}
}
ga->set_ordered (true);
-
}
/*
{
if (be_verbose_global)
progress_indication ("[" + String (pango_fn));
-
+
Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
RIGHT,
description,
accidentals_[d] = make_item ("AmbitusAccidental", SCM_EOL);
accidentals_[d]->set_parent (heads_[d], Y_AXIS);
heads_[d]->set_object ("accidental-grob",
- accidentals_[d]->self_scm ());
+ accidentals_[d]->self_scm ());
Axis_group_interface::add_element (group_, heads_[d]);
Axis_group_interface::add_element (group_, accidentals_[d]);
Side_position_interface::add_support (accidentals_[d], heads_[d]);
int sig_alter = (handle != SCM_BOOL_F)
? scm_to_int (scm_cdr (handle)) : 0;
-
+
if (sig_alter == p.get_alteration ())
{
accidentals_[d]->suicide ();
{
SCM l = scm_list_1 (scm_from_int (p.get_alteration ()));
accidentals_[d]->set_property ("accidentals", l);
-
}
}
while (flip (&d) != DOWN);
ambitus_->set_object ("note-heads", scm_list_2 (heads_[DOWN]->self_scm (),
- heads_[UP]->self_scm ()));
+ heads_[UP]->self_scm ()));
}
else
{
}
}
-
ADD_ACKNOWLEDGER (Ambitus_engraver, note_head);
ADD_TRANSLATOR (Ambitus_engraver,
/* doc */ "",
Side_position_interface::add_support (arpeggio_, info.grob ());
}
}
-
+
void
Arpeggio_engraver::acknowledge_note_column (Grob_info info)
{
}
ADD_ACKNOWLEDGER (Arpeggio_engraver, stem)
-ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head)
-ADD_ACKNOWLEDGER (Arpeggio_engraver, note_column)
-
-ADD_TRANSLATOR (Arpeggio_engraver,
- /* doc */ "Generate an Arpeggio symbol",
- /* create */ "Arpeggio",
- /* accept */ "arpeggio-event",
- /* read */ "",
- /* write */ "");
+ ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head)
+ ADD_ACKNOWLEDGER (Arpeggio_engraver, note_column)
+
+ ADD_TRANSLATOR (Arpeggio_engraver,
+ /* doc */ "Generate an Arpeggio symbol",
+ /* create */ "Arpeggio",
+ /* accept */ "arpeggio-event",
+ /* read */ "",
+ /* write */ "");
Grob *common = me;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size(); i++)
+ for (int i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem),
Interval heads;
Real my_y = me->relative_coordinate (common, Y_AXIS);
- for (int i = 0; i < stems.size(); i++)
+ for (int i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
Grob *ss = Staff_symbol_referencer::get_staff_symbol (stem);
{
Grob *me = unsmob_grob (smob);
Grob *common = me;
-
+
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size(); i++)
+ for (int i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem),
Interval heads;
Real my_y = me->relative_coordinate (common, Y_AXIS);
- for (int i = 0; i < stems.size(); i++)
+ for (int i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
Grob *ss = Staff_symbol_referencer::get_staff_symbol (stem);
{
Grob *me = unsmob_grob (smob);
(void) axis;
-
+
assert (scm_to_int (axis) == X_AXIS);
Stencil arpeggio = Font_interface::get_default_font (me)->find_by_name ("scripts.arpeggio");
#include "translator.icc"
-
class Auto_beam_engraver : public Engraver
{
TRANSLATOR_DECLARATIONS (Auto_beam_engraver);
virtual bool try_music (Music *);
virtual void finalize ();
virtual void derived_mark () const;
-
+
DECLARE_ACKNOWLEDGER (rest);
DECLARE_ACKNOWLEDGER (beam);
DECLARE_ACKNOWLEDGER (bar_line);
DECLARE_ACKNOWLEDGER (stem);
-
+
void process_acknowledged ();
private:
void check_bar_property ();
};
-
void
Auto_beam_engraver::derived_mark () const
{
scm_gc_mark (beam_settings_);
}
-
void
Auto_beam_engraver::check_bar_property ()
{
test.smobbed_copy ())
!= SCM_BOOL_F;
}
-
+
void
Auto_beam_engraver::consider_begin (Moment test_mom)
{
/*
Can't use make_spanner_from_properties() because we have to use
beam_settings_.
- */
+ */
Spanner *beam = new Spanner (beam_settings_,
context ()->get_grob_key ("Beam"));
{
Moment now = now_mom ();
if (extend_mom_ < now)
- {
- end_beam ();
- }
+ end_beam ();
}
forbid_ = 0;
}
-
void
Auto_beam_engraver::acknowledge_beam (Grob_info info)
{
end_beam ();
}
}
-
+
void
Auto_beam_engraver::acknowledge_bar_line (Grob_info info)
{
Auto_beam_engraver::process_acknowledged ()
{
if (extend_mom_ > now_mom ())
- return ;
+ return;
if (!process_acknowledged_count_)
{
Moment now = now_mom ();
if ((extend_mom_ < now)
|| ((extend_mom_ == now) && (last_add_mom_ != now)))
- {
- end_beam ();
- }
+ end_beam ();
else if (!stems_->size ())
- {
- junk_beam ();
- }
+ junk_beam ();
}
}
process_acknowledged_count_++;
}
-ADD_ACKNOWLEDGER (Auto_beam_engraver,stem);
-ADD_ACKNOWLEDGER (Auto_beam_engraver,bar_line);
-ADD_ACKNOWLEDGER (Auto_beam_engraver,beam);
-ADD_ACKNOWLEDGER (Auto_beam_engraver,rest);
+ADD_ACKNOWLEDGER (Auto_beam_engraver, stem);
+ADD_ACKNOWLEDGER (Auto_beam_engraver, bar_line);
+ADD_ACKNOWLEDGER (Auto_beam_engraver, beam);
+ADD_ACKNOWLEDGER (Auto_beam_engraver, rest);
ADD_TRANSLATOR (Auto_beam_engraver,
/* doc */ "Generate beams based on measure characteristics and observed "
"Stems. Uses beatLength, measureLength and measurePosition to decide "
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "axis-group-interface.hh"
#include "grob.hh"
#include "grob-array.hh"
-LY_DEFINE(ly_relative_group_extent, "ly:relative-group-extent",
- 3, 0, 0, (SCM elements, SCM common, SCM axis),
- "Determine the extent of @var{elements} relative to @var{common} in the "
- "@var{axis} direction.")
+LY_DEFINE (ly_relative_group_extent, "ly:relative-group-extent",
+ 3, 0, 0, (SCM elements, SCM common, SCM axis),
+ "Determine the extent of @var{elements} relative to @var{common} in the "
+ "@var{axis} direction.")
{
Grob_array *ga = unsmob_grob_array (elements);
-
- SCM_ASSERT_TYPE(ga || scm_is_pair (elements), elements, SCM_ARG1, __FUNCTION__, "list or Grob_array");
- SCM_ASSERT_TYPE(unsmob_grob (common), common, SCM_ARG2, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE(is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+
+ SCM_ASSERT_TYPE (ga || scm_is_pair (elements), elements, SCM_ARG1, __FUNCTION__, "list or Grob_array");
+ SCM_ASSERT_TYPE (unsmob_grob (common), common, SCM_ARG2, __FUNCTION__, "grob");
+ SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
Link_array<Grob> elts;
- if (!ga)
+ if (!ga)
{
for (SCM s = elements; scm_is_pair (s); s = scm_cdr (s))
elts.push (unsmob_grob (scm_car (s)));
}
-
+
Interval ext = Axis_group_interface::relative_group_extent (ga ? ga->array () : elts,
unsmob_grob (common),
(Axis) scm_to_int (axis));
return ly_interval2scm (ext);
}
-
-
+
SCM axes = me->get_property ("axes");
if (!scm_is_pair (axes))
programming_error ("axes should be nonempty");
-
+
for (SCM ax = axes; ax != SCM_EOL; ax = scm_cdr (ax))
{
Axis a = (Axis) scm_to_int (scm_car (ax));
e->internal_set_object ((a == X_AXIS)
? ly_symbol2scm ("axis-group-parent-X")
- : ly_symbol2scm ("axis-group-parent-Y"),
+ : ly_symbol2scm ("axis-group-parent-Y"),
me->self_scm ());
}
Grob *common, Axis a)
{
Interval r;
- for (int i = 0; i < elts.size(); i++)
+ for (int i = 0; i < elts.size (); i++)
{
Grob *se = elts[i];
Interval dims = se->extent (common, a);
}
-
MAKE_SCHEME_CALLBACK (Axis_group_interface, group_extent_callback, 2);
SCM
Axis_group_interface::group_extent_callback (SCM element_smob, SCM scm_axis)
SCM check = tr->get_property ("ignoreBarChecks");
if (to_boolean (check))
return;
-
+
SCM mp = tr->get_property ("measurePosition");
SCM sync = tr->get_property ("barCheckSynchronize");
bool warn = true;
if (to_boolean (sync))
{
- SCM mp;
+ SCM mp;
tr = tr->where_defined (ly_symbol2scm ("measurePosition"), &mp);
Moment zero;
tr->set_property ("measurePosition", zero.smobbed_copy ());
return false;
if (d == START)
- {
- start_ev_ = m;
- }
+ start_ev_ = m;
else if (d == STOP)
- {
- now_stop_ev_ = m;
- }
+ now_stop_ev_ = m;
return true;
}
return false;
Direction d = to_dir (m->get_property ("span-direction"));
if (d == START)
- {
- start_ev_ = m;
- }
+ start_ev_ = m;
else if (d == STOP)
- {
- now_stop_ev_ = m;
- }
+ now_stop_ev_ = m;
return true;
}
return false;
}
ADD_TRANSLATOR (Beam_performer, "", "",
- "beam-event", "", "");
+ "beam-event", "", "");
get_detail (SCM alist, SCM sym, Real def)
{
SCM entry = scm_assq (sym, alist);
-
+
if (scm_is_pair (entry))
{
return robust_scm2double (scm_cdr (entry), def);
Beam_quant_parameters::fill (Grob *him)
{
SCM details = him->get_property ("details");
-
+
INTER_QUANT_PENALTY = get_detail (details, ly_symbol2scm ("inter-quant-penalty"), 1000.0);
SECONDARY_BEAM_DEMERIT = get_detail (details, ly_symbol2scm ("secondary-beam-demerit"), 10.0);
STEM_LENGTH_DEMERIT_FACTOR = get_detail (details, ly_symbol2scm ("stem-length-demerit-factor"), 5);
{
Grob *me = unsmob_grob (smob);
-
Beam_quant_parameters parameters;
parameters.fill (me);
-
+
SCM s = me->get_property ("positions");
Real yl = scm_to_double (scm_car (s));
Real yr = scm_to_double (scm_cdr (s));
bool is_knee = dirs_found[LEFT] && dirs_found[RIGHT];
int region_size = (int) parameters.REGION_SIZE;
-
+
/*
Knees are harder, lets try some more possibilities for knees.
*/
}
int best_idx = best_quant_score_idx (qscores);
-
+
#if DEBUG_QUANTING
SCM inspect_quants = me->get_property ("inspect-quants");
- if ( to_boolean (me->get_layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting")))
+ if (to_boolean (me->get_layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting")))
&& scm_is_pair (inspect_quants))
{
Drul_array<Real> ins = ly_scm2interval (inspect_quants);
if (best_idx < 0)
{
warning (_ ("no feasible beam position"));
- me->set_property ("positions", ly_interval2scm (Interval (0,0)));
+ me->set_property ("positions", ly_interval2scm (Interval (0, 0)));
}
else
me->set_property ("positions",
bool knee,
Real yl, Real yr,
- Beam_quant_parameters const*parameters
- )
+ Beam_quant_parameters const *parameters)
{
Real limit_penalty = parameters->STEM_LENGTH_LIMIT_PENALTY;
Drul_array<Real> score (0, 0);
Stem_info info = stem_infos[i];
Direction d = info.dir_;
- score[d] += limit_penalty * max (0.0, (d * (info.shortest_y_ - current_y)));
+ score[d] += limit_penalty * max (0.0, (d * (info.shortest_y_ - current_y)));
Real ideal_diff = d * (current_y - info.ideal_y_);
Real ideal_score = shrink_extra_weight (ideal_diff, 1.5);
Real dy_mus, Real dy_damp,
Real dx,
bool xstaff,
-
- Beam_quant_parameters const*parameters)
+
+ Beam_quant_parameters const *parameters)
{
Real dy = yr - yl;
Real dem = 0.0;
dem += parameters->DAMPING_DIRECTION_PENALTY;
}
- dem += parameters->MUSICAL_DIRECTION_FACTOR * max (0.0, (fabs (dy) - fabs (dy_mus)));
+ dem += parameters->MUSICAL_DIRECTION_FACTOR *max (0.0, (fabs (dy) - fabs (dy_mus)));
Real slope_penalty = parameters->IDEAL_SLOPE_FACTOR;
Real thickness, Real beam_translation,
Drul_array<int> beam_counts,
Direction ldir, Direction rdir,
-
- Beam_quant_parameters const*parameters)
+
+ Beam_quant_parameters const *parameters)
{
Real dy = yr - yl;
Drul_array<Real> y (yl, yr);
int m = 0;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size(); i++)
+ for (int i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
m = max (m, (Stem::beam_multiplicity (stem).length () + 1));
}
if (i == stems.size () -1)
- {
- scm_set_cdr_x (this_beaming, SCM_EOL);
- }
+ scm_set_cdr_x (this_beaming, SCM_EOL);
if (scm_ilength (scm_cdr (this_beaming)) > 0)
{
for (int i = 0; i <= stems.size (); i++)
{
Grob *stem = (i < stems.size ()) ? stems[i] : 0;
-
+
SCM this_beaming = stem ? stem->get_property ("beaming") : SCM_EOL;
Real xposn = stem ? stem->relative_coordinate (xcommon, X_AXIS) : 0.0;
Real stem_width = stem ? robust_scm2double (stem->get_property ("thickness"), 1.0) * lt : 0;
{
int b = scm_to_int (scm_car (s));
if (scm_c_memq (scm_car (s), right) != SCM_BOOL_F)
- {
- full_beams.push (b);
- }
+ full_beams.push (b);
else
- {
- lfliebertjes.push (b);
- }
+ lfliebertjes.push (b);
}
for (SCM s = right;
scm_is_pair (s); s = scm_cdr (s))
{
int b = scm_to_int (scm_car (s));
if (scm_c_memq (scm_car (s), left) == SCM_BOOL_F)
- {
- rfliebertjes.push (b);
- }
+ rfliebertjes.push (b);
}
Drul_array<Real> break_overshoot
= robust_scm2drul (me->get_property ("break-overshoot"),
Drul_array<Real> (-0.5, 0.0));
-
Real w = (i > 0 && stem)
? (xposn - last_xposn)
- : break_overshoot[(i==0) ? LEFT: RIGHT];
+ : break_overshoot[ (i == 0) ? LEFT : RIGHT];
Real stem_offset = 0.0;
if (i > 0)
pos[-d] = -pos[d];
}
else
- {
- pos = ideal;
- }
+ pos = ideal;
/*
For broken beams this doesn't work well. In this case, the
else
{
/*
- UGH. TODO: fix dependency tracking.
- */
+ UGH. TODO: fix dependency tracking.
+ */
position_beam (beam);
pos = ly_scm2interval (beam->get_property ("positions"));
}
-
+
Real staff_space = Staff_symbol_referencer::staff_space (rest);
scale_drul (&pos, staff_space);
int
Beaming_info_list::best_splitpoint_index (Moment &beat_length, bool subdivide) const
{
- int minden = INT_MAX;
+ int minden = INT_MAX;
int minidx = -1;
Moment beat_pos;
#include "warn.hh"
#include "libc-extension.hh"
-Real binomial_coefficient_3[] = {1,3 ,3, 1};
+Real binomial_coefficient_3[] = {1, 3, 3, 1};
Real
binomial_coefficient (Real over, int under)
one_min_tj[0] = 1;
for (int i = 1; i < 4; i++)
{
- one_min_tj[i] = one_min_tj[i-1] * (1-t);
+ one_min_tj[i] = one_min_tj[i - 1] * (1 - t);
}
Real r = 0.0;
for (int j = 0; j < 4; j++)
{
r += control_[j][a] * binomial_coefficient_3[j]
- * tj * one_min_tj[3-j];
+ * tj * one_min_tj[3 - j];
tj *= t;
}
one_min_tj[0] = 1;
for (int i = 1; i < 4; i++)
{
- one_min_tj[i] = one_min_tj[i-1] * (1-t);
+ one_min_tj[i] = one_min_tj[i - 1] * (1 - t);
}
Offset o;
for (int j = 0; j < 4; j++)
{
o += control_[j] * binomial_coefficient_3[j]
- * tj * one_min_tj[3-j];
+ * tj * one_min_tj[3 - j];
tj *= t;
}
Cache binom(3,j) t^j (1-t)^{3-j}
*/
static struct Polynomial bezier_term_cache[4];
-static bool done_cache_init;
+static bool done_cache_init;
void
init_polynomial_cache ()
{
- for (int j = 0; j <= 3; j++)
- bezier_term_cache[j] =
- binomial_coefficient_3[j]
+ for (int j = 0; j <= 3; j++)
+ bezier_term_cache[j]
+ = binomial_coefficient_3[j]
* Polynomial::power (j, Polynomial (0, 1))
* Polynomial::power (3 - j, Polynomial (1, -1));
done_cache_init = true;
{
if (!done_cache_init)
init_polynomial_cache ();
-
+
Polynomial p (0.0);
- Polynomial q ;
+ Polynomial q;
for (int j = 0; j <= 3; j++)
{
q = bezier_term_cache[j];
book->scores_ = scm_append (scm_list_2 (scores, book->scores_));
-
SCM x = book->self_scm ();
book->unprotect ();
return x;
}
/* Concatenate all score outputs into a Paper_book
-
- */
+
+*/
Paper_book *
Book::process (Output_def *default_paper,
Output_def *default_layout)
return 0;
Output_def *paper = paper_ ? default_paper : paper_;
-
+
Paper_book *paper_book = new Paper_book ();
Real scale = scm_to_double (paper->c_variable ("outputscale"));
Output_def *scaled_bookdef = scale_output_def (paper, scale);
Object_key *key = new Lilypond_general_key (0, user_key_, 0);
SCM scm_key = key->unprotect ();
-
+
paper_book->paper_ = scaled_bookdef;
scaled_bookdef->unprotect ();
Music_output *output = unsmob_music_output (scm_car (outputs));
if (Performance *perf = dynamic_cast<Performance *> (output))
- {
- paper_book->add_performance (perf->self_scm ());
- }
- else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
+ paper_book->add_performance (perf->self_scm ());
+ else if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
{
SCM systems = pscore->get_paper_systems ();
if (ly_is_module (score->header_))
paper_book->add_score (score->header_);
paper_book->add_score (systems);
}
-
+
outputs = scm_cdr (outputs);
}
}
interval_a_[Y_AXIS].widen (y);
}
-
-IMPLEMENT_SIMPLE_SMOBS(Box);
+IMPLEMENT_SIMPLE_SMOBS (Box);
IMPLEMENT_TYPE_P (Box, "ly:box?");
-IMPLEMENT_DEFAULT_EQUAL_P(Box);
+IMPLEMENT_DEFAULT_EQUAL_P (Box);
SCM
-Box::mark_smob (SCM x)
+Box::mark_smob (SCM x)
{
(void)x;
return SCM_EOL;
return h;
}
-
Break_algorithm::~Break_algorithm ()
{
}
public:
TRANSLATOR_DECLARATIONS (Break_align_engraver);
DECLARE_ACKNOWLEDGER (break_aligned);
-
};
void
Context *origin = inf.origin_contexts (this)[0];
- Translator_group *tg = origin ->implementation ();
- Engraver *random_source = dynamic_cast<Engraver*> (unsmob_translator (scm_car (tg->get_simple_trans_list ())));
+ Translator_group *tg = origin->implementation ();
+ Engraver *random_source = dynamic_cast<Engraver *> (unsmob_translator (scm_car (tg->get_simple_trans_list ())));
/*
Make left edge appear to come from same context as clef/bar-line etc.
- */
+ */
left_edge_ = make_item_from_properties (random_source,
ly_symbol2scm ("LeftEdge"),
SCM_EOL,
Break_align_interface::self_align_callback (SCM element_smob, SCM axis)
{
Grob *me = unsmob_grob (element_smob);
- (void) axis;
+ (void) axis;
assert (scm_to_int (axis) == X_AXIS);
Item *item = dynamic_cast<Item *> (me);
{
Item *me = dynamic_cast<Item *> (grob);
extract_grob_set (me, "elements", elts);
-
+
SCM order_vec = me->get_property ("break-align-orders");
if (!scm_is_vector (order_vec)
|| scm_c_vector_length (order_vec) < 3)
{
SCM sym = scm_car (order);
- for (int i = writable_elts.size(); i --; )
+ for (int i = writable_elts.size (); i--;)
{
Grob *g = writable_elts[i];
if (g && sym == g->get_property ("break-align-symbol"))
}
}
}
-
+
return new_elts;
}
Find the first grob with a space-alist entry.
*/
extract_grob_set (l, "elements", elts);
-
- for (int i = elts.size(); i--; )
+
+ for (int i = elts.size (); i--;)
{
Grob *elt = elts[i];
if (r)
{
extract_grob_set (r, "elements", elts);
- for (int i = elts.size();
+ for (int i = elts.size ();
!scm_is_symbol (rsym) && i--;)
{
Grob *elt = elts[i];
offsets[next_idx] = max (extents[idx][RIGHT], distance);
}
else
- {
- extra_right_space = distance;
- }
+ extra_right_space = distance;
idx = next_idx;
}
}
if (total_extent.is_empty ())
- return ;
-
+ return;
+
if (me->break_status_dir () == LEFT)
{
alignment_off = -total_extent[RIGHT] - extra_right_space;
source file of the GNU LilyPond music typesetter
(c) 2001--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include <cstdio>
System *line
= dynamic_cast<System *> (unsmob_grob (break_criterion));
if (sc->get_system () != line)
- {
- sc = sc->find_broken_piece (line);
- }
+ sc = sc->find_broken_piece (line);
/* now: !sc || (sc && sc->get_system () == line) */
if (!sc)
if (sc->common_refpoint (line, X_AXIS)
&& sc->common_refpoint (line, Y_AXIS))
- {
- return sc;
- }
+ return sc;
return 0;
}
if (unsmob_grob (src))
{
- Grob * new_ptr = substitute_grob (unsmob_grob (src));
+ Grob *new_ptr = substitute_grob (unsmob_grob (src));
return new_ptr ? new_ptr->self_scm () : SCM_UNDEFINED;
}
else if (scm_is_vector (src))
*/
Link_array<Grob> temporary_substition_array;
void
-substitute_grob_array (Grob_array *grob_arr, Grob_array * new_arr)
+substitute_grob_array (Grob_array *grob_arr, Grob_array *new_arr)
{
Link_array<Grob> &old_grobs (grob_arr->array_reference ());
Link_array<Grob> *new_grobs (new_arr == grob_arr
- ? &temporary_substition_array
+ ? & temporary_substition_array
: &new_arr->array_reference ());
-
+
new_grobs->set_size (old_grobs.size ());
- Grob **array = (Grob**) new_grobs->accesses();
- Grob **ptr = array;
+ Grob **array = (Grob **) new_grobs->accesses ();
+ Grob **ptr = array;
for (int i = 0; i < old_grobs.size (); i++)
{
Grob *orig = old_grobs[i];
Grob *new_grob = substitute_grob (orig);
if (new_grob)
- {
- *ptr ++ = new_grob;
- }
+ *ptr++ = new_grob;
}
- new_grobs->set_size (ptr - array);
+ new_grobs->set_size (ptr - array);
if (new_arr == grob_arr)
{
new_arr->set_array (*new_grobs);
{
if (sp->broken_intos_.size ())
rv = Slice (sp->broken_intos_[0]->get_system ()->get_rank (),
- sp->broken_intos_.top ()->get_system ()->get_rank());
+ sp->broken_intos_.top ()->get_system ()->get_rank ());
}
return rv;
}
Spanner::fast_substitute_grob_array (SCM sym,
Grob_array *grob_array)
{
- int len = grob_array->size();
+ int len = grob_array->size ();
if (grob_array->ordered ())
return false;
int spanner_index = len;
int item_index = 0;
-
- for (int i = 0 ; i < grob_array->size (); i++)
+
+ for (int i = 0; i < grob_array->size (); i++)
{
Grob *g = grob_array->grob (i);
int idx = 0;
if (dynamic_cast<Spanner *> (g))
- {
- idx = --spanner_index;
- }
+ idx = --spanner_index;
else if (dynamic_cast<Item *> (g))
- {
- idx = item_index++;
- }
+ idx = item_index++;
vec[idx].set (g, sr);
}
item_indices.push (Slice (len, 0));
spanner_indices.push (Slice (len, 0));
}
-
+
Array<Slice> *arrs[]
= {
&item_indices, &spanner_indices
for (int i = 0; i < item_index;i++)
{
for (int j = vec[i].left_; j <= vec[i].right_; j++)
- {
- item_indices[j - system_range[LEFT]].add_point (i);
- }
+ item_indices[j - system_range[LEFT]].add_point (i);
}
/*
newval = Grob_array::make_array ();
sc->internal_set_object (sym, newval);
}
-
- Grob_array *new_array = unsmob_grob_array (newval);
+
+ Grob_array *new_array = unsmob_grob_array (newval);
for (int k = 0; k < 2;k++)
for (int j = (*arrs[k])[i][LEFT]; j <= (*arrs[k])[i][RIGHT]; j++)
{
Grob *substituted = substitute_grob (vec[j].grob_);
if (substituted)
- {
- new_array->add (substituted);
- }
+ new_array->add (substituted);
}
#ifdef PARANOIA
SCM sym = scm_caar (s);
SCM val = scm_cdar (s);
- if (Grob_array * orig = unsmob_grob_array (val))
+ if (Grob_array *orig = unsmob_grob_array (val))
{
SCM handle = scm_assq (sym, dest);
- SCM newval =
- (scm_is_pair (handle))
+ SCM newval
+ = (scm_is_pair (handle))
? scm_cdr (handle)
: Grob_array::make_array ();
-
+
Grob_array *new_arr = unsmob_grob_array (newval);
substitute_grob_array (orig, new_arr);
Spanner *s = this;
bool fast_done = false;
- Grob_array * grob_array = unsmob_grob_array (val);
+ Grob_array *grob_array = unsmob_grob_array (val);
if (grob_array)
fast_done = s->fast_substitute_grob_array (sym, grob_array);
if (!unsmob_grob_array (newval))
{
newval = Grob_array::make_array ();
- sc->internal_set_object (sym, newval);
+ sc->internal_set_object (sym, newval);
}
substitute_grob_array (grob_array, unsmob_grob_array (newval));
}
{
/* We could change the current translator's id, but that would make
errors hard to catch.
-
+
last->translator_id_string () = get_change
()->change_to_id_string (); */
error (_f ("not changing to same context type: %s", to_type));
}
if (info.music_cause ()->is_mus_type ("rhythmic-event"))
- {
- Beam::add_stem (beam_, s);
- }
+ Beam::add_stem (beam_, s);
else
{
String s = _ ("stem must have Rhythmic structure");
stem_tremolo_->set_property ("flag-count",
scm_from_int (flags_));
stem_tremolo_->set_object ("stem",
- info.grob ()->self_scm ());
+ info.grob ()->self_scm ());
stem_tremolo_->set_parent (info.grob (), X_AXIS);
}
}
typeset_beam ();
}
-
-ADD_ACKNOWLEDGER (Chord_tremolo_engraver,stem);
+ADD_ACKNOWLEDGER (Chord_tremolo_engraver, stem);
ADD_TRANSLATOR (Chord_tremolo_engraver,
/* doc */ "Generates beams for tremolo repeats.",
/* create */ "Beam",
SCM octavation = get_property ("clefOctavation");
SCM force_clef = get_property ("forceClef");
- if (clefpos == SCM_EOL
- || scm_equal_p (glyph, prev_glyph_) == SCM_BOOL_F
- || scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F
- || scm_equal_p (octavation, prev_octavation_) == SCM_BOOL_F
- || to_boolean (force_clef))
+ if (clefpos == SCM_EOL
+ || scm_equal_p (glyph, prev_glyph_) == SCM_BOOL_F
+ || scm_equal_p (clefpos, prev_cpos_) == SCM_BOOL_F
+ || scm_equal_p (octavation, prev_octavation_) == SCM_BOOL_F
+ || to_boolean (force_clef))
{
set_glyph ();
if (prev_cpos_ != SCM_BOOL_F || to_boolean (get_property ("firstClef")))
{
points.push (bottom_points[0] - vpadding + hpadding);
for (int i = 1; i < size - 1; i++)
- {
- points.push (bottom_points[i] - vpadding);
- }
+ points.push (bottom_points[i] - vpadding);
points.push (bottom_points[size - 1] - vpadding - hpadding);
points.push (top_points[size - 1] + vpadding - hpadding);
for (int i = size - 2; i > 0; i--)
- {
- points.push (top_points[i] + vpadding);
- }
+ points.push (top_points[i] + vpadding);
points.push (top_points[0] + vpadding + hpadding);
out.add_stencil (Lookup::round_filled_polygon (points, blotdiameter));
}
line with the center of the note heads?
*/
- for (int i = 0; i < cols.size (); i++)
+ for (int i = 0; i < cols.size (); i++)
{
Grob *col = cols[i];
-
+
Interval yext = col->extent (commony, Y_AXIS);
Real x = col->relative_coordinate (commonx, X_AXIS) - left_coord;
{
Spanner *next = orig->broken_intos_[spanner->get_break_index () + 1];
Link_array<Grob> const &next_cols = extract_grob_array (next, "columns");
- if (next_cols.size() > 0)
+ if (next_cols.size () > 0)
{
Grob *next_commony = common_refpoint_of_array (next_cols, next, Y_AXIS);
Grob *col = next_cols[0];
Grob *sl = Staff_symbol_referencer::get_staff_symbol (item);
extract_item_set (parent, "elements", elements);
-
+
for (int i = elements.size (); i--;)
{
Item *sibling = elements[i];
#include "pitch.hh"
-
/*
TODO: make matching rest engraver.
*/
continue;
}
else
- {
- d = Duration (d.duration_log () + 1, 2);
- }
+ d = Duration (d.duration_log () + 1, 2);
}
if (d.duration_log () >= log_limit)
}
/*
- other modifiers take symbols as argument.
+ other modifiers take symbols as argument.
*/
SCM sym = scm_cadr (mod);
if (scm_is_string (sym))
default_child_ = sym;
}
else if (ly_symbol2scm ("consists") == tag
- || ly_symbol2scm ("consists-end") == tag
- || ly_symbol2scm ("remove") == tag)
+ || ly_symbol2scm ("consists-end") == tag
+ || ly_symbol2scm ("remove") == tag)
{
if (!get_translator (sym))
error (_f ("program has no such type: `%s'",
acc = scm_delete_x (def, acc);
acc = scm_cons (def, acc);
}
-
+
return acc;
}
-
SCM
Context_def::get_default_child (SCM user_mod) const
{
if (ly_symbol2scm ("consists") == tag)
l1 = scm_cons (arg, l1);
else if (ly_symbol2scm ("remove") == tag)
- {
- l1 = scm_delete_x (arg, l1);
- }
+ l1 = scm_delete_x (arg, l1);
}
return l1;
if (dynamic_cast<Performer *> (unsmob_translator (scm_car (*tail))))
*tail = scm_cdr (*tail);
else
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
return ell;
}
if (dynamic_cast<Engraver *> (unsmob_translator (scm_car (*tail))))
*tail = scm_cdr (*tail);
else
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
return ell;
}
trans_list = cons;
}
else
- {
- trans_list = scm_cons (str, trans_list);
- }
+ trans_list = scm_cons (str, trans_list);
tr->daddy_context_ = context;
tr->unprotect ();
}
}
-
/*
Ugh, todo: should just make a private
copy of Context_def with the user mods.
g->unprotect ();
context->accepts_list_ = get_accepted (ops);
-
+
return context;
}
execute_pushpop_property (tg, scm_car (entry), scm_cadr (entry), val);
}
else if (type == ly_symbol2scm ("assign"))
- {
- tg->internal_set_property (scm_car (entry), scm_cadr (entry));
- }
+ tg->internal_set_property (scm_car (entry), scm_cadr (entry));
}
}
Object_key const *key = context->get_grob_key (name);
Grob *grob = 0;
-
+
SCM handle = scm_sloppy_assq (ly_symbol2scm ("meta"), props);
SCM klass = scm_cdr (scm_sloppy_assq (ly_symbol2scm ("class"), scm_cdr (handle)));
-
+
if (klass == ly_symbol2scm ("Item"))
grob = new Item (props, key);
else if (klass == ly_symbol2scm ("Spanner"))
Item *
make_item_from_properties (Engraver *tr, SCM x, SCM cause, char const *name)
{
- Item *it = dynamic_cast<Item*> (make_grob_from_properties (tr, x, cause, name));
+ Item *it = dynamic_cast<Item *> (make_grob_from_properties (tr, x, cause, name));
assert (it);
return it;
}
Paper_column *
make_paper_column_from_properties (Engraver *tr, SCM x, char const *name)
{
- return dynamic_cast<Paper_column*> (make_grob_from_properties (tr, x, SCM_EOL, name));
+ return dynamic_cast<Paper_column *> (make_grob_from_properties (tr, x, SCM_EOL, name));
}
-
Spanner *
make_spanner_from_properties (Engraver *tr, SCM x, SCM cause, char const *name)
{
- Spanner *sp = dynamic_cast<Spanner*> (make_grob_from_properties (tr, x, cause, name));
+ Spanner *sp = dynamic_cast<Spanner *> (make_grob_from_properties (tr, x, cause, name));
assert (sp);
return sp;
}
#include "lilypond-key.hh"
#include "profile.hh"
-
bool
Context::is_removable () const
{
definition_ = SCM_EOL;
smobify_self ();
-
+
Scheme_hash_table *tab = new Scheme_hash_table;
- properties_scm_ = tab->unprotect ();
+ properties_scm_ = tab->unprotect ();
/*
- UGH UGH
- const correctness.
+ UGH UGH
+ const correctness.
*/
if (key_)
- ((Object_key*)key)->unprotect ();
+ ((Object_key *)key)->unprotect ();
}
/* TODO: this shares code with find_create_context (). */
String this_id = "";
if (i == path.size () -1)
- {
- this_id = id;
- }
+ this_id = id;
current = current->create_context (path[i],
this_id,
{
if (!use_object_keys)
return 0;
-
+
String now_key = type + "@" + id;
int disambiguation_count = 0;
{
if (!use_object_keys)
return 0;
-
+
int disambiguation_count = 0;
if (grob_counts_.find (name) != grob_counts_.end ())
{
Context::default_child_context_name () const
{
return scm_is_pair (accepts_list_)
- ? scm_car (accepts_list_)
+ ? scm_car (accepts_list_)
: SCM_EOL;
}
note_property_access (&context_property_lookup_table, sym);
}
#endif
-
+
SCM val = SCM_EOL;
if (properties_dict ()->try_retrieve (sym, &val))
return val;
{
p = p->daddy_context_;
}
-
+
return p->now_mom ();
}
Context *me = (Context *) SCM_CELL_WORD_1 (sm);
if (me->key_)
scm_gc_mark (me->key_->self_scm ());
-
+
scm_gc_mark (me->context_list_);
scm_gc_mark (me->aliases_);
scm_gc_mark (me->definition_);
{
if (!use_object_keys)
return;
-
+
grob_counts_.clear ();
context_counts_.clear ();
for (SCM s = context_list_; scm_is_pair (s); s = scm_cdr (s))
}
}
-
/*
- Ugh. Where to put this?
+ Ugh. Where to put this?
*/
Rational
measure_length (Context const *context)
{
SCM l = context->get_property ("measureLength");
- Rational length (1);
+ Rational length (1);
if (unsmob_moment (l))
length = unsmob_moment (l)->main_part_;
return length;
#include "translator.icc"
-
/*
* This class implements an engraver for custos symbols.
*
custodes_.clear ();
}
-
-ADD_ACKNOWLEDGER (Custos_engraver,bar);
-ADD_ACKNOWLEDGER (Custos_engraver,note_head);
+ADD_ACKNOWLEDGER (Custos_engraver, bar);
+ADD_ACKNOWLEDGER (Custos_engraver, note_head);
ADD_TRANSLATOR (Custos_engraver,
/* doc */ "",
+++ /dev/null
-/*
- default-actions.cc -- implement default toplevel actions for .ly
- file.
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-*/
-
#include "grob.hh"
#include "warn.hh"
-
class Default_bar_line_engraver : public Engraver
{
protected:
ADD_TRANSLATOR (Default_bar_line_engraver,
"This engraver determines what kind of automatic bar lines should be produced, "
"and sets @code{whichBar} accordingly. It should be at the same "
- "level as @ref{Timing_translator}. ",
+ "level as @ref{Timing_translator}. ",
/* create */ "",
/* accept */ "",
- /* read */
+ /* read */
"measurePosition automaticBars whichBar barAlways defaultBarType "
"measureLength",
/* write */ "automaticBars");
-
Default_bar_line_engraver::Default_bar_line_engraver ()
{
last_moment_.main_part_ = Rational (-1);
DECLARE_ACKNOWLEDGER (stem);
DECLARE_ACKNOWLEDGER (rhythmic_head);
-
+
void stop_translation_timestep ();
};
}
}
-
void
Dot_column_engraver::acknowledge_stem (Grob_info info)
{
else
{
if (new_cfg.find (p) == new_cfg.end ())
- {
- offset = 0;
- }
+ offset = 0;
new_cfg[p + offset] = i->second;
}
}
else
{
if (new_cfg.find (p) == new_cfg.end ())
- {
- offset = 0;
- }
+ offset = 0;
new_cfg[p + offset] = i->second;
}
if (!e->get_parent (X_AXIS)
&& Side_position_interface::get_axis (e) == Y_AXIS)
- {
- e->set_parent (inf.grob (), X_AXIS);
- }
+ e->set_parent (inf.grob (), X_AXIS);
}
}
#include "translator.icc"
ADD_ACKNOWLEDGER (Drum_notes_engraver, stem);
-ADD_ACKNOWLEDGER (Drum_notes_engraver,note_column);
+ADD_ACKNOWLEDGER (Drum_notes_engraver, note_column);
ADD_TRANSLATOR (Drum_notes_engraver,
/* doc */ "Generate noteheads.",
/* create */ "NoteHead Dots Script",
Link_array<Audio_note> notes_;
};
-
Drum_note_performer::Drum_note_performer ()
{
}
DECLARE_ACKNOWLEDGER (note_column);
DECLARE_ACKNOWLEDGER (slur);
-
protected:
virtual void finalize ();
virtual bool try_music (Music *event);
cresc_->set_bound (RIGHT, script_);
add_bound_item (line_spanner_, script_);
}
-
+
finished_cresc_ = cresc_;
cresc_ = 0;
current_cresc_ev_ = 0;
}
cresc_->set_property ("grow-direction",
scm_from_int ((start_type == "crescendo")
- ? BIGGER : SMALLER));
+ ? BIGGER : SMALLER));
}
/*
finished_line_spanner_ = line_spanner_;
line_spanner_ = 0;
}
-
+
typeset_all ();
if (cresc_ && !cresc_->get_bound (LEFT))
if (script_ && !script_->get_parent (X_AXIS))
{
extract_grob_set (info.grob (), "note-heads", heads);
- if (heads.size())
+ if (heads.size ())
{
Grob *head = heads[0];
script_->set_parent (head, X_AXIS);
script_->add_offset_callback (Self_alignment_interface::centered_on_parent_proc,
X_AXIS);
-
}
}
ADD_ACKNOWLEDGER (Dynamic_engraver, slur);
ADD_TRANSLATOR (Dynamic_engraver,
- /* doc */
+ /* doc */
"This engraver creates hairpins, dynamic texts, and their vertical\n"
"alignments. The symbols are collected onto a DynamicLineSpanner grob\n"
"which takes care of vertical positioning. ",
#include "music.hh"
#include "translator.icc"
-
/*
TODO:
SCM eq = get_property ("instrumentEqualizer");
if (ly_is_procedure (eq))
- {
- s = scm_call_1 (eq, s);
- }
+ s = scm_call_1 (eq, s);
if (is_number_pair (s))
{
SCM text = index_get_cell (edge_text, d);
if (Text_interface::is_markup (text))
- edge[d] = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (), properties, text));
+ edge[d] = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (), properties, text));
if (!edge[d].is_empty ())
edge[d].align_to (Y_AXIS, CENTER);
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "note-head.hh"
Stencil head;
Box extent (Interval (-radius, radius),
Interval (-radius, radius));
-
+
Stencil black_head (extent,
scm_list_4 (ly_symbol2scm ("circle"),
scm_from_double (radius),
Stencil white_head;
if (black)
{
- l = l.in_color (1, 1, 1);
+ l = l.in_color (1, 1, 1);
}
else
{
white_head = Stencil (extent,
scm_list_4 (ly_symbol2scm ("circle"),
- scm_from_double (radius - stem_thick),
- scm_from_double (0.0),
- SCM_BOOL_T));
+ scm_from_double (radius - stem_thick),
+ scm_from_double (0.0),
+ SCM_BOOL_T));
white_head = white_head.in_color (1, 1, 1);
}
-
Stencil total;
total.add_stencil (l);
{
announce_infos_.push (info);
- Engraver_group_engraver * dad_eng =
- context_->get_parent_context ()
- ? dynamic_cast<Engraver_group_engraver*> (context_->get_parent_context ()->implementation ())
+ Engraver_group_engraver *dad_eng
+ = context_->get_parent_context ()
+ ? dynamic_cast<Engraver_group_engraver *> (context_->get_parent_context ()->implementation ())
: 0;
if (dad_eng)
dad_eng->announce_grob (info);
scm_hashq_set_x (acknowledge_hash_table_, nm, acklist);
}
-
if (dispatch)
- {
- dispatch->apply (info);
- }
+ dispatch->apply (info);
}
}
while (pending_grob_count () > 0);
}
-
Engraver_group_engraver::Engraver_group_engraver ()
{
acknowledge_hash_table_ = SCM_EOL;
/* write */ "");
-
void
Engraver_group_engraver::derived_mark () const
{
{
extract_item_set (sp, "heads", heads);
if (heads.size ())
- {
- sp->set_bound (RIGHT, heads.top());
- }
+ sp->set_bound (RIGHT, heads.top ());
}
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Extender_engraver,lyric_syllable);
+ADD_ACKNOWLEDGER (Extender_engraver, lyric_syllable);
ADD_TRANSLATOR (Extender_engraver,
/* doc */ "Create lyric extenders",
/* create */ "LyricExtender",
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include <map>
String
map_file_name (String s)
{
- if (file_name_map_global.find (s) != file_name_map_global.end ())
+ if (file_name_map_global.find (s) != file_name_map_global.end ())
{
s = file_name_map_global[s];
}
#include "self-alignment-interface.hh"
#include "pitch.hh"
-
class Fingering_engraver : public Engraver
{
Link_array<Music> events_;
#include "translator.icc"
-ADD_ACKNOWLEDGER (Fingering_engraver,rhythmic_head);
-ADD_ACKNOWLEDGER (Fingering_engraver,stem);
+ADD_ACKNOWLEDGER (Fingering_engraver, rhythmic_head);
+ADD_ACKNOWLEDGER (Fingering_engraver, stem);
ADD_TRANSLATOR (Fingering_engraver,
/* doc */ "Create fingering-scripts",
/* create */ "Fingering",
{
if (be_verbose_global)
message (_ ("Initializing FontConfig..."));
-
+
if (!FcInit ())
error (_ ("initializing FontConfig failed"));
-
font_config_global = FcConfigGetCurrent ();
Array<String> dirs;
- struct stat statbuf;
+ struct stat statbuf;
String builddir = prefix_directory + "/mf/out/";
if (stat (builddir.to_str0 (), &statbuf) == 0)
dirs.push (prefix_directory + "/fonts/type1/");
dirs.push (prefix_directory + "/fonts/svg/");
}
-
+
for (int i = 0; i < dirs.size (); i++)
{
String dir = dirs[i];
void
init_fontconfig ()
{
-
}
#endif
#endif
if (scm_is_string (name))
{
- Real rmag =
- robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-magnification"), chain, SCM_BOOL_F),
- 1.0);
+ Real rmag
+ = robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-magnification"), chain, SCM_BOOL_F),
+ 1.0);
Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name));
return find_scaled_font (layout, fm, rmag);
Real req = robust_scm2double (ly_chain_assoc_get (ly_symbol2scm ("font-size"), chain, SCM_BOOL_F),
0.0);
-
+
return get_font_by_mag_step (layout, req, vec,
scm_to_double (base_size));
}
size = 0.0;
}
-
void
Font_size_engraver::process_music ()
{
- size = robust_scm2double (get_property ("fontSize"), 0.0);
+ size = robust_scm2double (get_property ("fontSize"), 0.0);
}
void
We only want to process a grob once.
*/
if (!size)
- return ;
+ return;
if (gi.context () != context ())
- return ;
+ return;
Real font_size = size
+ robust_scm2double (gi.grob ()->get_property ("font-size"), 0);
#include "translator.icc"
-ADD_ACKNOWLEDGER (Font_size_engraver,font);
+ADD_ACKNOWLEDGER (Font_size_engraver, font);
ADD_TRANSLATOR (Font_size_engraver,
/* doc */ "Puts fontSize into font-relative-size grob property.",
/* create */ "",
{
Grob *g = unsmob_grob (scm_cdar (busy));
if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")))
- {
- get_score_engraver ()->forbid_breaks ();
- }
+ get_score_engraver ()->forbid_breaks ();
busy = scm_cdr (busy);
}
}
-
ADD_TRANSLATOR (Forbid_line_break_engraver,
/* doc */ "Forbid line breaks when note heads "
"are still playing at some point.",
{
SCM_ASSERT_TYPE (scm_string_p (file_name), file_name, SCM_ARG1,
__FUNCTION__, "file_name");
- char const* m = "w";
+ char const *m = "w";
if (mode != SCM_UNDEFINED && scm_string_p (mode))
m = ly_scm2newstr (mode, 0);
/* dup2 and (fileno (current-error-port)) do not work with mingw'c
#include "translator.icc"
-ADD_ACKNOWLEDGER (Glissando_engraver,rhythmic_head);
+ADD_ACKNOWLEDGER (Glissando_engraver, rhythmic_head);
ADD_TRANSLATOR (Glissando_engraver,
/* doc */ "Engrave a glissandi",
/* create */ "Glissando",
Moment w;
w.set_infinite (1);
if (iter->ok ())
- {
- w = iter->pending_moment ();
- }
+ w = iter->pending_moment ();
w = sneaky_insert_extra_moment (w);
if (w.main_part_.is_infinity ())
SCM lst = get_property ("finalizations");
set_property ("finalizations", SCM_EOL);
for (SCM s = lst; scm_is_pair (s); s = scm_cdr (s))
-
+
/* TODO: make safe. */
scm_primitive_eval (scm_car (s));
}
if (be_verbose_global)
{
message (_f ("Optimal demerits: %f",
- optimal_paths.top ().demerits_) + "\n");
+ optimal_paths.top ().demerits_) + "\n");
}
if (optimal_paths.top ().demerits_ >= infinity_f)
{
SCM pen = pc->get_property ("penalty");
if (scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000)
- {
- break_penalties += scm_to_double (pen);
- }
+ break_penalties += scm_to_double (pen);
}
/*
protected:
void start_translation_timestep ();
virtual void derived_mark () const;
- virtual void initialize ();
+ virtual void initialize ();
TRANSLATOR_DECLARATIONS (Grace_engraver);
Moment last_moment_;
Grace_engraver::Grace_engraver ()
{
grace_settings_ = SCM_EOL;
- last_moment_ = Moment (Rational (-1,1));
+ last_moment_ = Moment (Rational (-1, 1));
}
void
Context *c = context ();
while (c && !c->is_alias (context_name))
- {
- c = c->get_parent_context ();
- }
+ c = c->get_parent_context ();
if (c)
{
}
}
- last_moment_ = now_mom();
+ last_moment_ = now_mom ();
}
void
#include "music-wrapper.hh"
#include "moment.hh"
-
class Grace_music
{
public:
if (prefix_set & PES_OR_FLEXA)
if (!i) // ligature may not start with 2nd head of pes or flexa
{
- primitive->warning (_ ( "can't apply `\\~' on first head of ligature"));
+ primitive->warning (_ ("can't apply `\\~' on first head of ligature"));
}
else if (pitch > prev_pitch) // pes
{
primitive->warning (_ ("can't apply `\\~' on heads with identical pitch"));
}
if (prev_prefix_set & DEMINUTUM)
- {
- context_info |= AFTER_DEMINUTUM;
- }
+ context_info |= AFTER_DEMINUTUM;
if (prev_primitive)
prev_primitive->set_property ("context-info",
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "grid-line-interface.hh"
#include "output-def.hh"
#include "stencil.hh"
-
MAKE_SCHEME_CALLBACK (Grid_line_interface, print, 1);
SCM
Grid_line_interface::print (SCM smobbed_me)
/* compute common refpoint of elements */
Grob *refp = common_refpoint_of_array (elts, me, Y_AXIS);
Interval iv;
-
- for (int i = 0; i < elts.size(); i++)
+
+ for (int i = 0; i < elts.size (); i++)
{
Grob *point = elts[i];
Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
* staffline;
- iv += - me->relative_coordinate (refp, Y_AXIS);
+ iv += -me->relative_coordinate (refp, Y_AXIS);
Stencil st = Lookup::filled_box (Box (Interval (0, thick),
iv));
Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
* staffline;
-
+
return ly_interval2scm (Interval (0, thick));
}
"A line that spanned between grid-points. ",
"elements thickness");
-
ADD_INTERFACE (Grid_point_interface, "grid-point-interface",
"A spanning point for grid lines. ",
"");
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "engraver.hh"
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "engraver.hh"
void
Grid_point_engraver::process_music ()
{
- SCM grid_interval = get_property ("gridInterval");
+ SCM grid_interval = get_property ("gridInterval");
if (Moment *mom = unsmob_moment (grid_interval))
{
Moment now = now_mom ();
{
}
-
ADD_TRANSLATOR (Grid_point_engraver,
/* doc */ "generate grid points.",
/* create */ "GridPoint",
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "grob-array.hh"
Item *
Grob_array::item (int i)
{
- return dynamic_cast<Item*> (grobs_.elem (i));
+ return dynamic_cast<Item *> (grobs_.elem (i));
}
-Spanner*
+Spanner *
Grob_array::spanner (int i)
{
- return dynamic_cast<Spanner*> (grobs_.elem (i));
+ return dynamic_cast<Spanner *> (grobs_.elem (i));
}
Grob_array::Grob_array ()
return grobs_;
}
-
Link_array<Grob> const &
Grob_array::array () const
{
return grobs_;
}
-
SCM
Grob_array::mark_smob (SCM s)
{
(void) s;
-
+
#if 0 /* see System::derived_mark () const */
- Grob_array *ga = unsmob_grob_array (s);
- for (int i = 0; i < ga->grobs_.size(); i++)
+ Grob_array *ga = unsmob_grob_array (s);
+ for (int i = 0; i < ga->grobs_.size (); i++)
scm_gc_mark (ga->grobs_[i]->self_scm ());
-#endif
+#endif
return SCM_UNDEFINED;
}
{
scm_puts ("#<Grob_array", port);
- Grob_array * grob_arr = unsmob (arr);
- for (int i = 0; i < grob_arr->size(); i++)
+ Grob_array *grob_arr = unsmob (arr);
+ for (int i = 0; i < grob_arr->size (); i++)
{
scm_display (grob_arr->grob (i)->self_scm (), port);
- scm_puts (" " , port);
+ scm_puts (" ", port);
}
scm_puts (">", port);
return 1;
}
-
SCM
Grob_array::make_array ()
void
Grob_array::set_array (Link_array<Grob> const &src)
{
- grobs_ = src;
+ grobs_ = src;
}
IMPLEMENT_SIMPLE_SMOBS (Grob_array);
IMPLEMENT_DEFAULT_EQUAL_P (Grob_array);
-
SCM
grob_list_to_grob_array (SCM lst)
{
#include "spanner.hh"
#include "item.hh"
-
Grob_info::Grob_info (Translator *t, Grob *g)
{
origin_trans_ = t;
return r;
}
-
-Context*
+Context *
Grob_info::context () const
{
return origin_trans_->context ();
}
-Spanner*
+Spanner *
Grob_info::spanner () const
{
- return dynamic_cast<Spanner*> (grob_);
+ return dynamic_cast<Spanner *> (grob_);
}
-Item*
+Item *
Grob_info::item () const
{
- return dynamic_cast<Item*> (grob_);
+ return dynamic_cast<Item *> (grob_);
}
Grob_pq_entry e;
e.grob_ = gi.grob ();
e.end_ = end;
-
+
started_now_.push (e);
}
}
*tail = scm_acons (started_now_[i].end_.smobbed_copy (),
started_now_[i].grob_->self_scm (),
SCM_EOL);
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
-
+
busy = scm_merge_x (lst, busy, ly_grob_pq_less_p_proc);
context ()->set_property ("busyGrobs", busy);
}
-
extern void check_interfaces_for_property (Grob const *me, SCM sym);
void
SCM grob_p = ly_lily_module_constant ("ly:grob?");
SCM grob_list_p = ly_lily_module_constant ("grob-list?");
SCM type = scm_object_property (sym, ly_symbol2scm ("backend-type?"));
-
+
if (type == grob_p
|| type == grob_list_p
|| (unsmob_grob (v) && ly_symbol2scm ("cause") != sym))
{
- scm_display (scm_list_2 (sym, type), scm_current_output_port());
+ scm_display (scm_list_2 (sym, type), scm_current_output_port ());
assert (0);
}
#endif
-
SCM
Grob::internal_get_property (SCM sym) const
{
note_property_access (&grob_property_lookup_table, sym);
}
#endif
-
+
SCM s = scm_sloppy_assq (sym, mutable_property_alist_);
if (s != SCM_BOOL_F)
return scm_cdr (s);
-
+
s = scm_sloppy_assq (sym, immutable_property_alist_);
if (do_internal_type_checking_global && scm_is_pair (s))
}
-
void
Grob::internal_set_object (SCM s, SCM v)
{
#include "system.hh"
#include "font-interface.hh"
-
LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!",
3, 0, 0, (SCM grob, SCM sym, SCM val),
"Set @var{sym} in grob @var{grob} to value @var{val}")
return sc->internal_get_object (sym);
}
-
LY_DEFINE (ly_spanner_get_bound, "ly:spanner-get-bound",
2, 0, 0, (SCM slur, SCM dir),
"Get one of the bounds of @var{spanner}. @var{dir} is @code{-1} "
if (global == SCM_UNDEFINED)
global = SCM_EOL;
}
-
+
return sc->get_property_alist_chain (global);
}
}
-
LY_DEFINE (ly_grob_default_font, "ly:grob-default-font",
1, 0, 0, (SCM grob),
"Return the default font for grob @var{gr}.")
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
-
#include "grob.hh"
mutable_property_alist_ = SCM_EOL;
object_alist_ = SCM_EOL;
-
/* We do smobify_self () as the first step. Since the object lives
on the heap, none of its SCM variables are protected from
GC. After smobify_self (), they are. */
*/
if (key_)
{
- ((Object_key*)key_)->unprotect ();
+ ((Object_key *)key_)->unprotect ();
}
-
+
SCM meta = get_property ("meta");
if (scm_is_pair (meta))
{
for (int a = X_AXIS; a <= Y_AXIS; a++)
{
SCM l = off_callbacks[a];
-
+
if (scm_ilength (l) >= 0)
{
dim_cache_[a].offset_callbacks_ = l;
SCM cb = extent_callbacks[a];
if (cb == SCM_BOOL_F)
- {
- dim_cache_[a].dimension_ = SCM_BOOL_F;
- }
+ dim_cache_[a].dimension_ = SCM_BOOL_F;
SCM xt = extents[a];
if (is_number_pair (xt))
- {
- dim_cache_[a].dimension_ = xt;
- }
+ dim_cache_[a].dimension_ = xt;
else if (ly_is_procedure (cb))
- {
- dim_cache_[a].dimension_callback_ = cb;
- }
+ dim_cache_[a].dimension_callback_ = cb;
else if (cb == SCM_EOL
&& ly_is_procedure (get_property ("print-function")))
dim_cache_[a].dimension_callback_ = stencil_extent_proc;
mutable_property_alist_ = ly_deep_copy (s.mutable_property_alist_);
interfaces_ = s.interfaces_;
object_alist_ = SCM_EOL;
-
+
/* No properties are copied. That is the job of
handle_broken_dependencies. */
status_ = s.status_;
smobify_self ();
if (key_)
{
- ((Object_key*)key_)->unprotect ();
+ ((Object_key *)key_)->unprotect ();
}
}
SCM expr = m->expr ();
if (point_and_click_global)
expr = scm_list_3 (ly_symbol2scm ("grob-cause"), self_scm (), expr);
-
+
stil = Stencil (m->extent_box (), expr).smobbed_copy ();
}
{
for (SCM s = object_alist_; scm_is_pair (s); s = scm_cdr (s))
sp->substitute_one_mutable_property (scm_caar (s), scm_cdar (s));
-
}
System *system = get_system ();
object_alist_ = SCM_EOL;
immutable_property_alist_ = SCM_EOL;
interfaces_ = SCM_EOL;
-
+
set_extent (SCM_EOL, Y_AXIS);
set_extent (SCM_EOL, X_AXIS);
extra = (a == X_AXIS)
? get_property ("minimum-X-extent")
: get_property ("minimum-Y-extent");
-
+
if (scm_is_pair (extra))
ext.unite (Interval (scm_to_double (scm_car (extra)),
scm_to_double (scm_cdr (extra))));
void
Grob::discretionary_processing ()
{
-
}
bool
#include "text-interface.hh"
#include "pointer-group-interface.hh"
-MAKE_SCHEME_CALLBACK(Hairpin,after_line_breaking,1);
+MAKE_SCHEME_CALLBACK (Hairpin, after_line_breaking, 1);
SCM
Hairpin::after_line_breaking (SCM smob)
{
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
-
+
Drul_array<bool> broken;
Drul_array<Item *> bounds;
Direction d = LEFT;
if (broken[LEFT]
&& ly_is_equal (bounds[RIGHT]->get_column ()->get_property ("when"),
- bounds[LEFT]->get_property ("when")))
+ bounds[LEFT]->get_property ("when")))
{
me->suicide ();
}
return SCM_UNSPECIFIED;
}
-
MAKE_SCHEME_CALLBACK (Hairpin, print, 1);
SCM
Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
Drul_array<Real> x_points;
-
+
do
{
Item *b = bounds[d];
{
bool neighbor_found = false;
extract_grob_set (me, "adjacent-hairpins", pins);
- for (int i = 0; i < pins.size(); i++)
+ for (int i = 0; i < pins.size (); i++)
{
/*
FIXME: this will fuck up in case of polyphonic
in the current staff/voice.
*/
- Spanner *pin = dynamic_cast<Spanner*> (pins[i]);
+ Spanner *pin = dynamic_cast<Spanner *> (pins[i]);
if (pin
&& (pin->get_bound (LEFT)->get_column () == b->get_column ()
|| pin->get_bound (RIGHT)->get_column () == b->get_column ()))
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "axis-group-engraver.hh"
{
scm_gc_mark (interesting_);
}
-
+
void
Hara_kiri_engraver::start_translation_timestep ()
{
interesting_ = get_property ("keepAliveInterfaces");
}
-
void
Hara_kiri_engraver::add_element (Grob *e)
{
interesting_ = SCM_EOL;
}
-
ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
ADD_TRANSLATOR (Hara_kiri_engraver,
/* doc */ "Like Axis_group_engraver, but make a hara-kiri spanner, and add "
{
Spanner *sp = dynamic_cast<Spanner *> (me);
- extract_grob_set (me,"items-worth-living", worth);
+ extract_grob_set (me, "items-worth-living", worth);
if (worth.size ())
return;
{
Grob *me = unsmob_grob (element_smob);
(void) axis;
-
+
assert (scm_to_int (axis) == Y_AXIS);
consider_suicide (me);
return scm_from_double (0.0);
DECLARE_ACKNOWLEDGER (note_column);
};
-
-ADD_ACKNOWLEDGER (Horizontal_bracket_engraver,note_column);
+ADD_ACKNOWLEDGER (Horizontal_bracket_engraver, note_column);
ADD_TRANSLATOR (Horizontal_bracket_engraver,
"Create horizontal brackets over notes for musical analysis purposes.",
"HorizontalBracket",
{
Grob *me = unsmob_grob (smob);
Spanner *sp = dynamic_cast<Spanner *> (me);
-
+
extract_grob_set (me, "columns", gs);
if (!gs.size ())
{
void
Hyphen_engraver::acknowledge_lyric_syllable (Grob_info i)
{
- Item *item = i.item();
+ Item *item = i.item ();
if (hyphen_)
hyphen_->set_bound (LEFT, item);
{
extract_item_set (sp, "heads", heads);
if (heads.size ())
- {
- sp->set_bound (RIGHT, heads.top ());
- }
+ sp->set_bound (RIGHT, heads.top ());
}
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Hyphen_engraver,lyric_syllable);
+ADD_ACKNOWLEDGER (Hyphen_engraver, lyric_syllable);
ADD_TRANSLATOR (Hyphen_engraver,
/* doc */ "Create lyric hyphens",
/* create */ "LyricHyphen",
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef AXIS_GROUP_ENGRAVER_HH
#include "lily-guile.hh"
#include "stem-info.hh"
-
/*
TODO: move quanting in separate file.
- */
-struct Beam_quant_parameters {
+*/
+struct Beam_quant_parameters
+{
Real INTER_QUANT_PENALTY;
Real SECONDARY_BEAM_DEMERIT;
Real STEM_LENGTH_DEMERIT_FACTOR;
Real REGION_SIZE;
-
/*
threshold to combat rounding errors.
*/
Real IDEAL_SLOPE_FACTOR;
Real ROUND_TO_ZERO_SLOPE;
- void fill (Grob *him);
+ void fill (Grob *him);
};
class Beam
DECLARE_SCHEME_CALLBACK (slope_damping, (SCM));
DECLARE_SCHEME_CALLBACK (shift_region_to_valid, (SCM));
DECLARE_SCHEME_CALLBACK (quanting, (SCM));
- static Real score_slopes_dy (Real, Real, Real, Real, Real, bool, Beam_quant_parameters const*);
+ static Real score_slopes_dy (Real, Real, Real, Real, Real, bool, Beam_quant_parameters const *);
static Real score_stem_lengths (Link_array<Grob> const &stems,
Array<Stem_info> const &stem_infos,
Array<Real> const &stem_xs,
Real xl, Real xr,
bool knee,
- Real yl, Real yr, Beam_quant_parameters const*);
+ Real yl, Real yr, Beam_quant_parameters const *);
static Real score_forbidden_quants (Real, Real,
Real, Real, Real, Real,
Drul_array<int>, Direction, Direction,
- Beam_quant_parameters const*);
+ Beam_quant_parameters const *);
static int get_direction_beam_count (Grob *me, Direction d);
private:
class Box
{
Interval interval_a_[NO_AXES];
- DECLARE_SIMPLE_SMOBS(Box,);
+ DECLARE_SIMPLE_SMOBS (Box,);
public:
Interval &x () {return interval_a_[X_AXIS]; }
Interval &y (){ return interval_a_[Y_AXIS]; }
SCM context_aliases_;
SCM translator_group_type_;
SCM default_child_;
-
+
public:
void add_context_mod (SCM);
SCM get_default_child (SCM user_mods) const;
Array<Grob_info> announce_infos_;
SCM acknowledge_hash_table_;
public:
- VIRTUAL_COPY_CONSTRUCTOR ( Translator_group, Engraver_group_engraver);
+ VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Engraver_group_engraver);
Engraver_group_engraver ();
virtual void derived_mark () const;
void do_announces ();
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef FILE_NAME_MAP_HH
void init_freetype ();
extern FT_Library freetype2_library;
-
FT_Face open_ft_face (String str);
#endif /* FREETYPE_HH */
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef GRID_LINE_INTERFACE_HH
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef GROB_ARRAY_HH
{
Link_array<Grob> grobs_;
bool ordered_;
-
- DECLARE_SIMPLE_SMOBS(Grob_array,);
+
+ DECLARE_SIMPLE_SMOBS (Grob_array,);
Grob_array ();
public:
void set_ordered (bool b) { ordered_ = b; }
Item *item (int i);
Spanner *spanner (int i);
- Grob * grob (int i) { return grobs_.elem (i); }
- int size () const { return grobs_.size(); }
+ Grob *grob (int i) { return grobs_.elem (i); }
+ int size () const { return grobs_.size (); }
bool is_empty () const;
- void clear ();
+ void clear ();
void add (Grob *x) { grobs_.push (x); }
void set_array (Link_array<Grob> const &src);
Link_array<Grob> &array_reference ();
Link_array<Grob> const &ly_scm2link_array (SCM x);
SCM grob_list_to_grob_array (SCM lst);
-
#endif /* GROB_ARRAY_HH */
friend class Engraver;
public:
Grob *grob () const { return grob_; }
- Translator *origin_translator () const { return origin_trans_; }
+ Translator *origin_translator () const { return origin_trans_; }
- Context *context () const;
+ Context *context () const;
Music *music_cause ();
Link_array<Context> origin_contexts (Translator *) const;
Grob_info (Translator *, Grob *);
/*
If this is a property, it accounts for 25% of the property
lookups.
- */
+ */
SCM interfaces_;
-
-
+
/* BARF */
friend class Spanner;
friend SCM ly_grob_properties (SCM);
friend SCM ly_grob_basic_properties (SCM);
- friend void check_interfaces_for_property (Grob const*, SCM);
+ friend void check_interfaces_for_property (Grob const *, SCM);
void substitute_object_links (SCM, SCM);
char status_;
/*
JUNKME.
- */
+ */
void add_to_list_property (SCM, SCM);
void add_to_object_list (SCM sym, SCM thing);
Source_file *get_source_file () const;
char const *start () const;
char const *end () const;
-
+
void set (Source_file *, char const *, char const *);
void warning (String) const; // should use member func?
void non_fatal_error (String) const;
String location_string () const;
String line_number_string () const;
String file_string ()const;
-
+
int line_number ()const;
int column_number ()const;
int end_line_number ()const;
int end_column_number ()const;
- void get_counts (int*line, int *char_count, int *col) const;
-
+ void get_counts (int *line, int *char_count, int *col) const;
+
Input (Input const &i);
Input ();
};
void stop_translation_timestep ();
virtual void finalize ();
-
DECLARE_ACKNOWLEDGER (rest);
DECLARE_ACKNOWLEDGER (note_head);
virtual bool try_music (Music *);
if (__builtin_constant_p ((x))) \
{ \
if (!cached) \
- value = cached = scm_eval (scm_str2symbol (x), \
- global_lily_module); \
+ value = cached = scm_eval (scm_str2symbol (x), \
+ global_lily_module); \
} \
else \
value = scm_eval (scm_str2symbol (x), global_lily_module); \
inline bool ly_is_procedure (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); }
inline bool ly_is_port (SCM x) { return SCM_NFALSEP (scm_port_p (x)); }
-
inline bool ly_is_equal (SCM x, SCM y)
{
return SCM_NFALSEP (scm_equal_p (x, y));
typedef SCM (*Scheme_function_3) (...);
#endif
-
-#define scm_cdr ly_cdr
+#define scm_cdr ly_cdr
#define scm_car ly_car
#ifndef scm_is_pair
-
#endif /* LILY_GUILE_HH */
Output_def *get_layout (Lily_parser *parser);
Output_def *get_midi (Lily_parser *parser);
Output_def *get_paper (Lily_parser *parser);
-SCM get_header(Lily_parser *parser);
+SCM get_header (Lily_parser *parser);
#endif /* LILY_PARSER_HH */
class Type_swallow_translator;
class yyFlexLexer;
-
-typedef void (*Engraver_void_function_engraver_grob_info)(Engraver*, Grob_info);
-typedef void (*Translator_void_method_ptr)(Translator*);
-
+typedef void (*Engraver_void_function_engraver_grob_info) (Engraver *, Grob_info);
+typedef void (*Translator_void_method_ptr) (Translator *);
static Stencil arrows (Grob *me, Offset from, Offset to,
bool from_arrow,
bool to_arrow);
-
};
#endif /* LINE_INTERFACE_HH */
#define IMPLEMENT_SMOBS(CL) \
IMPLEMENT_BASE_SMOBS (CL) \
- void \
+ void \
CL::smobify_self () \
{ \
self_scm_ = unprotected_smobify_self (); \
- protection_cons_ = SCM_EOL;\
- protect();\
- }\
- void\
- CL::protect(){ \
- protect_smob (self_scm_, &protection_cons_);\
- }\
- SCM\
- CL::unprotect ()\
- {\
- unprotect_smob (&protection_cons_);\
- return self_scm_;\
+ protection_cons_ = SCM_EOL; \
+ protect (); \
+ } \
+ void \
+ CL::protect () \
+ { \
+ protect_smob (self_scm_, &protection_cons_); \
+ } \
+ SCM \
+ CL::unprotect () \
+ { \
+ unprotect_smob (&protection_cons_); \
+ return self_scm_; \
} \
SCM \
CL::unprotected_smobify_self () \
/*
* These are all possible mensural ligature primitives.
*/
-#define MLP_NONE 0x00 // no output
-#define MLP_UP 0x01 // upward left stem
-#define MLP_DOWN 0x02 // downward left stem
-#define MLP_BREVIS 0x04 // mensural brevis head
-#define MLP_LONGA 0x08 // mensural brevis head with right cauda
-#define MLP_MAXIMA 0x10 // mensural maxima head without stem
-#define MLP_FLEXA 0x20 // mensural flexa-like shape
+#define MLP_NONE 0x00 // no output
+#define MLP_UP 0x01 // upward left stem
+#define MLP_DOWN 0x02 // downward left stem
+#define MLP_BREVIS 0x04 // mensural brevis head
+#define MLP_LONGA 0x08 // mensural brevis head with right cauda
+#define MLP_MAXIMA 0x10 // mensural maxima head without stem
+#define MLP_FLEXA 0x20 // mensural flexa-like shape
#define MLP_STEM (MLP_UP | MLP_DOWN)
#define MLP_SINGLE_HEAD (MLP_BREVIS | MLP_LONGA | MLP_MAXIMA)
investigated whether this is a mingw bug or a windows bug (ie,
mingw compatibility feature), also not reported yet. */
-# ifdef CHAR
-# define LILY_CHAR CHAR
-# undef CHAR
-# endif
-# define CHAR MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_CHAR
-
-# ifdef CONTEXT
-# define LILY_CONTEXT CONTEXT
-# undef CONTEXT
-# endif
-# define CONTEXT MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_CONTEXT
-
-# ifdef DATADIR
-# define LILY_DATADIR DATADIR
-# undef DATADIR
-# endif
-# define DATADIR MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_DATADIR
-
-# ifdef RELATIVE
-# define LILY_RELATIVE RELATIVE
-# undef RELATIVE
-# endif
-# define RELATIVE MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_RELATIVE
-
-# ifdef THIS
-# define LILY_THIS THIS
-# undef THIS
-# endif
-# define THIS MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_THIS
-
-//# include <winsock2.h>
+# ifdef CHAR
+# define LILY_CHAR CHAR
+# undef CHAR
+# endif
+# define CHAR MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_CHAR
+
+# ifdef CONTEXT
+# define LILY_CONTEXT CONTEXT
+# undef CONTEXT
+# endif
+# define CONTEXT MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_CONTEXT
+
+# ifdef DATADIR
+# define LILY_DATADIR DATADIR
+# undef DATADIR
+# endif
+# define DATADIR MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_DATADIR
+
+# ifdef RELATIVE
+# define LILY_RELATIVE RELATIVE
+# undef RELATIVE
+# endif
+# define RELATIVE MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_RELATIVE
+
+# ifdef THIS
+# define LILY_THIS THIS
+# undef THIS
+# endif
+# define THIS MINGW_INFRINGES_ON_OUR_NAMESPACE_USING_THIS
+
+//#include <winsock2.h>
#if defined (__MINGW32__) && !defined (STATIC)
# define SCM_IMPORT 1
#endif
-# include <libguile.h>
-
-# undef CHAR
-# ifdef LILY_CHAR
-# define CHAR LILY_CHAR
-# endif
-
-# undef CONTEXT
-# ifdef LILY_CONTEXT
-# define CONTEXT LILY_CONTEXT
-# endif
-# undef CONTEXT
-
-# undef DATADIR
-# ifdef LILY_DATADIR
-# define DATADIR LILY_DATADIR
-# endif
-# undef DATADIR
-
-# undef RELATIVE
-# ifdef LILY_RELATIVE
-# define RELATIVE LILY_RELATIVE
-# endif
-
-# undef THIS
-# ifdef LILY_THIS
-# define THIS LILY_THIS
-# endif
-
+#include <libguile.h>
+
+# undef CHAR
+# ifdef LILY_CHAR
+# define CHAR LILY_CHAR
+# endif
+
+# undef CONTEXT
+# ifdef LILY_CONTEXT
+# define CONTEXT LILY_CONTEXT
+# endif
+# undef CONTEXT
+
+# undef DATADIR
+# ifdef LILY_DATADIR
+# define DATADIR LILY_DATADIR
+# endif
+# undef DATADIR
+
+# undef RELATIVE
+# ifdef LILY_RELATIVE
+# define RELATIVE LILY_RELATIVE
+# endif
+
+# undef THIS
+# ifdef LILY_THIS
+# define THIS LILY_THIS
+# endif
#endif /* __MINGW__ */
+++ /dev/null
-/*
- -- declare MInterval
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#ifndef
-#define
-
-#include "moment.hh"
-
-typedef Interval_t<Moment> MInterval;
-
-#endif //
-
-#error
(), \
"") \
{ \
- Class *c = (new Class);\
- return c->unprotect();\
+ Class *c = (new Class); \
+ return c->unprotect (); \
}
DECLARE_UNSMOB (Music_iterator, iterator);
class Music_output
{
- DECLARE_SMOBS(Music_output, foo);
+ DECLARE_SMOBS (Music_output, foo);
protected:
Music_output ();
public:
- virtual void derived_mark () const;
- virtual void process ();
+ virtual void derived_mark () const;
+ virtual void process ();
};
DECLARE_UNSMOB (Music_output, music_output);
SCM lily_character_table_;
SCM lily_global_table_;
SCM lily_index_to_bbox_table_;
-
+
Index_to_charcode_map index_to_charcode_map_;
Open_type_font (FT_Face);
Output_def *paper_;
Paper_book ();
-
+
void add_score (SCM);
void add_performance (SCM);
void classic_output (SCM output_channel);
void output (SCM output_channel);
void post_processing (SCM, SCM);
-
};
DECLARE_UNSMOB (Paper_book, paper_book)
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef PAPER_COLUMN_ENGRAVER_HH
#define PAPER_COLUMN_ENGRAVER_HH
-
#include "engraver.hh"
-
class Paper_column_engraver : public Engraver
{
void make_columns ();
- void set_columns (Paper_column*, Paper_column*);
- TRANSLATOR_DECLARATIONS(Paper_column_engraver);
+ void set_columns (Paper_column *, Paper_column *);
+ TRANSLATOR_DECLARATIONS (Paper_column_engraver);
protected:
void stop_translation_timestep ();
void process_music ();
virtual void initialize ();
virtual void finalize ();
- virtual bool try_music (Music*);
+ virtual bool try_music (Music *);
DECLARE_ACKNOWLEDGER (item);
DECLARE_ACKNOWLEDGER (note_spacing);
public:
// ug.h
void forbid_breaks ();
-
};
#endif /* PAPER_COLUMN_ENGRAVER_HH */
/// if lines are broken then this column is in #line#
System *system_;
-
// ugh: friend declarations.
friend void set_loose_columns (System *which, Column_x_positions const *posns);
friend class System;
int get_rank () const { return rank_; }
void set_rank (int);
-
+
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
Output_def *layout () const;
System *root_system () const;
-
+
void typeset_system (System *);
Array<Column_x_positions> calc_breaking ();
class Performer_group_performer : public virtual Translator_group
{
public:
- VIRTUAL_COPY_CONSTRUCTOR (Translator_group,Performer_group_performer);
+ VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Performer_group_performer);
void do_announces ();
virtual void announce_element (Audio_element_info);
virtual void play_element (Audio_element *p);
virtual int get_tempo () const;
-
+
protected:
Array<Audio_element_info> announce_infos_;
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef POINTER_GROUP_INTERFACE_HH
#include "lily-proto.hh"
#include "lily-guile.hh"
-
struct Pointer_group_interface
{
public:
Link_array<Grob> const &internal_extract_grob_array (Grob const *elt, SCM symbol);
Link_array<Item> internal_extract_item_array (Grob const *elt, SCM symbol);
-#define extract_grob_array(x,prop) internal_extract_grob_array (x, ly_symbol2scm (prop))
-#define extract_item_array(x,prop) internal_extract_item_array (x, ly_symbol2scm (prop))
-
+#define extract_grob_array(x, prop) internal_extract_grob_array (x, ly_symbol2scm (prop))
+#define extract_item_array(x, prop) internal_extract_item_array (x, ly_symbol2scm (prop))
/*
This is dubious coding style, but lets not risk that we change the
representation of grob sets again.
- */
-#define extract_grob_set(grob,prop,set) \
- Link_array<Grob> const &set (internal_extract_grob_array (grob, ly_symbol2scm (prop)))
-#define extract_item_set(grob,prop,set) \
+*/
+#define extract_grob_set(grob, prop, set) \
+ Link_array<Grob> const &set (internal_extract_grob_array (grob, ly_symbol2scm (prop)))
+#define extract_item_set(grob, prop, set) \
Link_array<Item> set (internal_extract_item_array (grob, ly_symbol2scm (prop)))
-
#endif /* POINTER_GROUP_INTERFACE_HH */
/*
- profile.hh -- declare property profiling utils.
+ profile.hh -- declare property profiling utils.
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef PROFILE_HH
SCM ly_set_option (SCM, SCM);
-
#endif /* SCM_OPTION_HH */
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef RECORDING_GROUP_ENGRAVER_HH
#define RECORDING_GROUP_ENGRAVER_HH
-
#include "engraver-group-engraver.hh"
class Recording_group_engraver : public Engraver_group_engraver
virtual void prepare (Moment);
virtual void one_time_step ();
-
/* Engraver_group_engraver interface */
virtual bool try_music (Music *);
virtual void initialize ();
/*
Translator interface
- */
+ */
virtual void derived_mark () const;
public:
class Score_performer : public Score_translator, public virtual Performer_group_performer
{
public:
- VIRTUAL_COPY_CONSTRUCTOR (Translator_group,Score_performer);
+ VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Score_performer);
~Score_performer ();
Performance *performance_;
Slur_configuration ();
void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
- Array<Offset> const&);
+ Array<Offset> const &);
void score (Slur_score_state const &);
protected:
void score_extra_encompass (Slur_score_state const &);
private: \
void smobify_self (); \
SCM self_scm_; \
- SCM protection_cons_; \
+ SCM protection_cons_; \
public: \
- SCM unprotect();\
- void protect();\
+ SCM unprotect (); \
+ void protect (); \
SCM self_scm () const { return self_scm_; } \
private:
public:
Slice line_slice (char const *pos_str0) const;
String line_string (char const *pos_str0) const;
- void get_counts (char const *pos_str0, int*, int*, int*) const;
+ void get_counts (char const *pos_str0, int *, int *, int *) const;
/*
JUNKME.
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef SPACING_SPANNER_HH
bool float_nonmusical_columns_;
Rational global_shortest_;
Real increment_;
- Real shortest_duration_space_;
-
+ Real shortest_duration_space_;
+
void init ();
void init_from_grob (Grob *me);
- Real get_duration_space (Moment d, bool*) const;
+ Real get_duration_space (Moment d, bool *) const;
};
/*
TODO: prune to public interface.
- */
+*/
class Spacing_spanner
{
public:
static void generate_pair_spacing (Grob *me,
Paper_column *l, Paper_column *r,
Paper_column *nextr,
- Spacing_options const *options);
+ Spacing_options const *options);
static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
Real *fixed, Real *space,
- Spacing_options const*);
+ Spacing_options const *);
static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment);
- static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const*, bool *);
- static Real get_duration_space (Moment dur, Spacing_options const*, bool *);
+ static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
+ static Real get_duration_space (Moment dur, Spacing_options const *, bool *);
static Rational find_shortest (Grob *, Link_array<Grob> const &);
static Rational effective_shortest_duration (Grob *me, Link_array<Grob> const &all);
- static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const*);
- static void prune_loose_columns (Grob *, Link_array<Grob> *cols, Spacing_options const*);
+ static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
+ static void prune_loose_columns (Grob *, Link_array<Grob> *cols, Spacing_options const *);
static void set_explicit_neighbor_columns (Link_array<Grob> const &cols);
static void set_implicit_neighbor_columns (Link_array<Grob> const &cols);
- static void generate_springs (Grob *me, Link_array<Grob> const &cols, Spacing_options const*);
- static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const*);
+ static void generate_springs (Grob *me, Link_array<Grob> const &cols, Spacing_options const *);
+ static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
DECLARE_SCHEME_CALLBACK (set_springs, (SCM));
static bool has_interface (Grob *);
};
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef STAFF_SYMBOL_ENGRAVER_HH
Spanner *span_;
Spanner *finished_span_;
bool first_start_;
-
+
protected:
virtual void start_spanner ();
virtual void stop_spanner ();
Interval extent (Axis) const;
Box extent_box () const;
bool is_empty () const;
- Stencil in_color (Real r, Real g, Real b) const;
+ Stencil in_color (Real r, Real g, Real b) const;
static SCM ly_get_stencil_extent (SCM mol, SCM axis);
static SCM ly_set_stencil_extent_x (SCM, SCM, SCM);
{
int rank_;
Grob_array *all_elements_;
- void init_elements ();
+ void init_elements ();
public:
int get_rank () const;
void post_processing ();
Rational measure_length () const;
};
-
#endif // TIMING_TRANSLATOR_HH
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef TRANSLATOR_DISPATCH_LIST_HH
SCM static create (SCM trans_list,
SCM iface_list);
- DECLARE_SIMPLE_SMOBS(Engraver_dispatch_list,);
+ DECLARE_SIMPLE_SMOBS (Engraver_dispatch_list,);
};
#endif /* TRANSLATOR_DISPATCH_LIST_HH */
typedef void (Translator:: *Translator_method) (void);
typedef void (Translator_group:: *Translator_group_method) (void);
-typedef void (*Translator_group_void_method)(Translator_group*);
+typedef void (*Translator_group_void_method) (Translator_group *);
struct Translator_method_binding
{
Translator *translator_;
Translator_void_method_ptr method_;
-
- Translator_method_binding()
+
+ Translator_method_binding ()
{
}
- Translator_method_binding (Translator*tr, Translator_void_method_ptr ptr)
+ Translator_method_binding (Translator *tr, Translator_void_method_ptr ptr)
{
translator_ = tr;
method_ = ptr;
void invoke ()
{
if (method_)
- (*method_)(translator_);
+ (*method_) (translator_);
}
};
-
class Translator_group
{
private:
void precompute_method_bindings ();
Array<Translator_method_binding>
- precomputed_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
+ precomputed_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
Translator_group_void_method
- precomputed_self_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
+ precomputed_self_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
public:
VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Translator_group);
DECLARE_SMOBS (Translator_group, dummy);
-
+
public:
virtual Translator_group *get_daddy_translator ()const;
virtual SCM get_simple_trans_list ();
void stop_translation_timestep ();
void start_translation_timestep ();
-
+
virtual void fetch_precomputable_methods (Translator_group_void_method[]);
-
+
Translator_group ();
void precomputed_translator_foreach (Translator_precompute_index);
void call_precomputed_self_method (Translator_precompute_index);
-
- Context * context () const { return context_; }
+ Context *context () const { return context_; }
protected:
SCM simple_trans_list_;
SCM accept_hash_table_;
Context *context_;
-
+
friend class Context_def;
virtual void derived_mark () const;
};
void precomputed_recurse_over_translators (Context *c, Translator_precompute_index idx, Direction dir);
Translator_group *get_translator_group (SCM sym);
-#define ADD_TRANSLATOR_GROUP(classname, desc, grobs, accepted, read, write) \
+#define ADD_TRANSLATOR_GROUP(classname, desc, grobs, accepted, read, write)
DECLARE_UNSMOB (Translator_group, translator_group);
Engraver_void_function_engraver_grob_info function_;
};
-#define TRANSLATOR_DECLARATIONS(NAME) \
- public: \
- NAME (); \
- VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
- static SCM static_description_; \
- static Array<Acknowledge_information> acknowledge_static_array_; \
- virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]);\
- virtual SCM static_translator_description () const; \
- virtual SCM translator_description () const; \
- virtual Engraver_void_function_engraver_grob_info get_acknowledger (SCM sym) { \
- return static_get_acknowledger (sym);\
- }\
+#define TRANSLATOR_DECLARATIONS(NAME) \
+ public: \
+ NAME (); \
+ VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
+ static SCM static_description_; \
+ static Array<Acknowledge_information> acknowledge_static_array_; \
+ virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]); \
+ virtual SCM static_translator_description () const; \
+ virtual SCM translator_description () const; \
+ virtual Engraver_void_function_engraver_grob_info get_acknowledger (SCM sym) \
+ { \
+ return static_get_acknowledger (sym); \
+ } \
static Engraver_void_function_engraver_grob_info static_get_acknowledger (SCM sym);
-#define DECLARE_ACKNOWLEDGER(x) public: void acknowledge_ ## x (Grob_info); protected:
+#define DECLARE_ACKNOWLEDGER(x) public : void acknowledge_ ## x (Grob_info); protected:
-enum Translator_precompute_index {
- START_TRANSLATION_TIMESTEP,
- STOP_TRANSLATION_TIMESTEP,
- PROCESS_MUSIC,
- PROCESS_ACKNOWLEDGED,
- TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
-};
+enum Translator_precompute_index
+ {
+ START_TRANSLATION_TIMESTEP,
+ STOP_TRANSLATION_TIMESTEP,
+ PROCESS_MUSIC,
+ PROCESS_ACKNOWLEDGED,
+ TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
+ };
/*
Translate music into grobs.
class Translator
{
void init ();
-
+
protected:
bool must_be_last_;
virtual Output_def *get_output_def () const;
virtual Translator_group *get_daddy_translator ()const;
virtual Moment now_mom () const;
-
+
virtual bool try_music (Music *req);
virtual void initialize ();
virtual void finalize ();
void start_translation_timestep ();
void process_music ();
void process_acknowledged ();
-
+
Score_context *get_score_context () const;
Global_context *get_global_context () const;
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#ifndef TRANSLATOR_ICC
} \
ADD_GLOBAL_CTOR (_ ## T ## _adder);
-#define ADD_TRANSLATOR(classname, desc, grobs, accepted, read, write) \
- Array<Acknowledge_information> classname::acknowledge_static_array_;\
- IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(classname); \
+#define ADD_TRANSLATOR(classname, desc, grobs, accepted, read, write) \
+ Array<Acknowledge_information> classname::acknowledge_static_array_; \
+ IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \
ADD_THIS_TRANSLATOR (classname); \
- Engraver_void_function_engraver_grob_info\
+ Engraver_void_function_engraver_grob_info \
classname::static_get_acknowledger (SCM sym) \
- {\
- return generic_get_acknowledger (sym, &acknowledge_static_array_);\
- }\
+ { \
+ return generic_get_acknowledger (sym, &acknowledge_static_array_); \
+ } \
SCM \
classname::static_translator_description () const \
{ \
return static_properties; \
}
-#define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \
-void \
-T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[])\
-{ \
- ptrs[START_TRANSLATION_TIMESTEP] = \
- ((Translator_void_method_ptr) &T::start_translation_timestep == \
- (Translator_void_method_ptr) &Translator::start_translation_timestep) \
- ? 0 \
- : (Translator_void_method_ptr) &T::start_translation_timestep; \
+#define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \
+ void \
+ T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[]) \
+ { \
+ ptrs[START_TRANSLATION_TIMESTEP] = \
+ ((Translator_void_method_ptr) & T::start_translation_timestep == \
+ (Translator_void_method_ptr) & Translator::start_translation_timestep) \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::start_translation_timestep; \
\
- ptrs[STOP_TRANSLATION_TIMESTEP] = \
- ((Translator_void_method_ptr) &T::stop_translation_timestep == (Translator_void_method_ptr) &Translator::stop_translation_timestep) \
- ? 0 \
- : (Translator_void_method_ptr) &T::stop_translation_timestep; \
+ ptrs[STOP_TRANSLATION_TIMESTEP] = \
+ ((Translator_void_method_ptr) & T::stop_translation_timestep == (Translator_void_method_ptr) & Translator::stop_translation_timestep) \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::stop_translation_timestep; \
\
- ptrs[PROCESS_MUSIC] = \
- ((Translator_void_method_ptr) &T::process_music == (Translator_void_method_ptr) &Translator::process_music) \
- ? 0 \
- : (Translator_void_method_ptr) &T::process_music; \
+ ptrs[PROCESS_MUSIC] = \
+ ((Translator_void_method_ptr) & T::process_music == (Translator_void_method_ptr) & Translator::process_music) \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::process_music; \
\
- ptrs[PROCESS_ACKNOWLEDGED] = \
- ((Translator_void_method_ptr) &T::process_acknowledged == (Translator_void_method_ptr) &Translator::process_acknowledged) \
- ? 0 \
- : (Translator_void_method_ptr) &T::process_acknowledged; \
-}
+ ptrs[PROCESS_ACKNOWLEDGED] = \
+ ((Translator_void_method_ptr) & T::process_acknowledged == (Translator_void_method_ptr) & Translator::process_acknowledged) \
+ ? 0 \
+ : (Translator_void_method_ptr) & T::process_acknowledged; \
+ }
void add_acknowledger (Engraver_void_function_engraver_grob_info ptr,
char const *func_name,
generic_get_acknowledger (SCM sym,
Array<Acknowledge_information> const *ack_array);
-#define ADD_ACKNOWLEDGER(CLASS,NAME) \
-void CLASS ## NAME ## _ack_adder () \
-{\
- add_acknowledger ((Engraver_void_function_engraver_grob_info) &CLASS::acknowledge_ ## NAME, #NAME, &CLASS::acknowledge_static_array_);\
-}\
- ADD_SCM_INIT_FUNC(CLASS ## NAME ## _ack_adder_initclass, CLASS ## NAME ## _ack_adder); \
-
+#define ADD_ACKNOWLEDGER(CLASS, NAME) \
+ void CLASS ## NAME ## _ack_adder () \
+ { \
+ add_acknowledger ((Engraver_void_function_engraver_grob_info) & CLASS::acknowledge_ ## NAME, #NAME, &CLASS::acknowledge_static_array_); \
+ } \
+ ADD_SCM_INIT_FUNC (CLASS ## NAME ## _ack_adder_initclass, CLASS ## NAME ## _ack_adder);
static bool has_interface (Grob *);
static void add_tuplet_bracket (Grob *me, Grob *smaller_bracket);
- static void get_bounds (Grob *,Grob **,Grob **);
+ static void get_bounds (Grob *, Grob **, Grob **);
static void add_column (Grob *me, Item *);
static void add_beam (Grob *me, Grob *);
static Grob *parallel_beam (Grob *me, Link_array<Grob> const &cols, bool *equally_long);
Input *ip = unsmob_input (sip);
SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
- int l, ch, col;
+ int l, ch, col;
ip->get_counts (&l, &ch, &col);
return scm_list_4 (scm_makfrom0str (ip->file_string ().to_str0 ()),
scm_from_int (l),
}
void
-Input::get_counts (int *line, int *chr, int*col) const
+Input::get_counts (int *line, int *chr, int *col) const
{
source_file_->get_counts (start_, line, chr, col);
}
{
source_file_ = sf;
start_ = start;
- end_ = end;
+ end_ = end;
}
-Source_file*
+Source_file *
Input::get_source_file () const
{
return source_file_;
}
-
-char const *
+char const *
Input::start () const
{
return start_;
}
-char const *
+char const *
Input::end () const
{
return end_;
class Instrument_name_engraver : public Engraver
{
- bool first_;
+ bool first_;
public:
TRANSLATOR_DECLARATIONS (Instrument_name_engraver);
DECLARE_ACKNOWLEDGER (bar_line);
DECLARE_ACKNOWLEDGER (axis_group);
-
+
void stop_translation_timestep ();
void process_music ();
-
};
Instrument_name_engraver::Instrument_name_engraver ()
grob_list_to_grob_array (get_property ("instrumentSupport")));
text_ = 0;
}
-
+
first_ = false;
}
create_text ();
}
-
void
Instrument_name_engraver::acknowledge_axis_group (Grob_info i)
{
#include "translator.icc"
-
ADD_ACKNOWLEDGER (Instrument_name_engraver, bar_line);
ADD_ACKNOWLEDGER (Instrument_name_engraver, axis_group);
ADD_TRANSLATOR (Instrument_name_engraver,
SCM vis = get_property ("break-visibility");
if (scm_is_vector (vis))
{
- bool visible = to_boolean (scm_vector_ref (vis, scm_from_int (break_status_dir () + 1)));
+ bool visible = to_boolean (scm_vector_ref (vis, scm_from_int (break_status_dir () + 1)));
if (!visible)
suicide ();
{
*tail = scm_acons (scm_caar (s),
scm_from_int (0), *tail);
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
}
-
+
cancellation_->set_property ("alteration-alist", restore);
cancellation_->set_property ("c0-position",
get_property ("middleCPosition"));
context ()->set_property ("tonic", p.smobbed_copy ());
}
-
-ADD_ACKNOWLEDGER (Key_engraver,clef);
-ADD_ACKNOWLEDGER (Key_engraver,bar_line);
+ADD_ACKNOWLEDGER (Key_engraver, clef);
+ADD_ACKNOWLEDGER (Key_engraver, bar_line);
ADD_TRANSLATOR (Key_engraver,
/* doc */ "",
bool minor = (scm_is_pair (third)
&& scm_is_integer (scm_cdr (third))
&& scm_to_int (scm_cdr (third)) == FLAT);
-
+
audio_ = new Audio_key (scm_to_int (acc),
!minor);
-
+
Audio_element_info info (audio_, key_ev_);
announce_element (info);
key_ev_ = 0;
{
key_ev_ = ev;
}
-
+
return true;
}
SCM
Key_signature_interface::print (SCM smob)
{
- Item *me = dynamic_cast<Item*> (unsmob_grob (smob));
+ Item *me = dynamic_cast<Item *> (unsmob_grob (smob));
Real inter = Staff_symbol_referencer::staff_space (me) / 2.0;
int pos = alteration_pos (what, alteration, c0p);
acc.translate_axis (pos * inter, Y_AXIS);
-
- /*
- The natural sign (unlike flat & sharp)
- has vertical edges on both sides. A little padding is
- needed to prevent collisions.
- */
+ /*
+ The natural sign (unlike flat & sharp)
+ has vertical edges on both sides. A little padding is
+ needed to prevent collisions.
+ */
Real padding = 0.0;
if (alteration == 0
&& last_pos < pos + 2
&& last_pos > pos - 6)
padding = 0.3;
-
+
mol.add_at_edge (X_AXIS, LEFT, acc, padding, 0);
last_pos = pos;
}
protected:
virtual void finalize ();
void process_music ();
-
+
DECLARE_ACKNOWLEDGER (ledgered);
DECLARE_ACKNOWLEDGER (staff_symbol);
void
Ledger_line_engraver::finalize ()
{
- stop_spanner();
+ stop_spanner ();
}
void
void
Ledger_line_engraver::acknowledge_staff_symbol (Grob_info s)
{
- Spanner *sym = dynamic_cast<Spanner*> (s.grob ());
+ Spanner *sym = dynamic_cast<Spanner *> (s.grob ());
if (!span_
|| span_->get_bound (LEFT) != sym->get_bound (LEFT))
#include "translator.icc"
-ADD_ACKNOWLEDGER (Ledger_line_engraver,ledgered);
-ADD_ACKNOWLEDGER (Ledger_line_engraver,staff_symbol);
+ADD_ACKNOWLEDGER (Ledger_line_engraver, ledgered);
+ADD_ACKNOWLEDGER (Ledger_line_engraver, staff_symbol);
ADD_TRANSLATOR (Ledger_line_engraver,
"Creates the spanner to draw ledger lines, and notices objects that need ledger lines",
/* create */ "LedgerLineSpanner",
contain a lot of noteheads, superlinear performance is too slow.
*/
extract_item_set (me, "note-heads", heads);
- for (int i = heads.size(); i --; )
+ for (int i = heads.size (); i--;)
{
Item *h = heads[i];
i != reqs.end (); last = i++)
{
if (last == reqs.end ())
- {
- continue;
- }
+ continue;
Direction d = DOWN;
do
ADD_INTERFACE (Ledger_line_spanner,
"ledger-line-interface",
-
+
"This spanner draws the ledger lines of a staff.\n"
"This is a separate grob because it has to process\n"
"all potential collisions between all note heads.",
-
+
"note-heads thickness minimum-length-fraction length-fraction gap");
struct Ledgered_interface
ADD_INTERFACE (Ledgered_interface,
"ledgered-interface",
-
+
"Objects that need ledger lines, typically "
"note heads. See also @ref{ledger-line-interface}.",
-
+
"no-ledgers");
events_drul_[STOP]->origin ()->warning (_ ("no right bound"));
}
else
- {
- ligature_->set_bound (RIGHT, last_bound_);
- }
+ ligature_->set_bound (RIGHT, last_bound_);
prev_start_event_ = 0;
finished_primitives_ = primitives_;
events_drul_[START]->origin ()->warning (_ ("no left bound"));
}
else
- {
- ligature_->set_bound (LEFT, bound);
- }
+ ligature_->set_bound (LEFT, bound);
ligature_start_mom_ = now_mom ();
}
-
/* looks the key up in the cdrs of the alist-keys
- ignoring the car and ignoring non-pair keys.
Returns first match found, i.e.
s = scm_cons (ly_symbol2scm (a[i].to_str0 ()), s);
return s;
}
-
+
/* SYMBOLS is a whitespace separated list. */
SCM
parse_symbol_list (char const *symbols)
pitchname_tab_stack_ = src.pitchname_tab_stack_;
sources_ = src.sources_;
start_module_ = SCM_EOL;
-
+
error_level_ = src.error_level_;
is_main_input_ = src.is_main_input_;
ly_reexport_module (scm_current_module ());
if (!scm_is_pair (scopes_))
start_module_ = scm_current_module ();
-
+
for (SCM s = scopes_; scm_is_pair (s); s = scm_cdr (s))
{
ly_use_module (module, scm_car (s));
set_current_scope ();
}
-
SCM
Lily_lexer::remove_scope ()
{
Lily_lexer::set_current_scope ()
{
SCM old = scm_current_module ();
-
+
if (scm_is_pair (scopes_))
scm_set_current_module (scm_car (scopes_));
else
void
Lily_lexer::add_lexed_char (int count)
{
- char const * start = here_str0 ();
+ char const *start = here_str0 ();
lexloc->set (get_source_file (),
start, start + count);
char_count_stack_.top () += count;
message (_f ("Changing working directory to `%s'",
output_name_global.to_str0 ()));
chdir (output_name_global.to_str0 ());
-
}
output_name_global = "";
}
- else
+ else
out_file_name = File_name (output_name_global);
}
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_parser_output_name, "ly:parser-output-name",
1, 0, 0, (SCM parser),
"Return the base name of the output file.")
/*
Don't mix cyclic pointers with weak tables.
- */
+ */
lexer_->set_identifier (ly_symbol2scm ("parser"),
SCM_EOL);
ly_reexport_module (scm_current_module ());
-
- scm_set_current_module (mod);
-
+ scm_set_current_module (mod);
+
if (!define_spots_.is_empty ())
{
define_spots_.top ().warning (_ ("braces don't match"));
void
Lily_parser::parse_string (String ly_code)
{
- // TODO: use $parser
+ // TODO: use $parser
lexer_->set_identifier (ly_symbol2scm ("parser"),
self_scm ());
-
+
lexer_->main_input_name_ = "<string>";
lexer_->is_main_input_ = true;
SCM mod = lexer_->set_current_scope ();
do_yyparse ();
scm_set_current_module (mod);
-
+
if (!define_spots_.is_empty ())
{
if (define_spots_.is_empty ()
}
SCM
-get_header(Lily_parser *parser)
+get_header (Lily_parser *parser)
{
- SCM id = parser->lexer_->lookup_identifier("$defaultheader");
+ SCM id = parser->lexer_->lookup_identifier ("$defaultheader");
if (!ly_is_module (id))
id = ly_make_anonymous_module (be_safe_global);
{
Real angle = (end - begin).arg ();
Array<Offset> points;
-
+
points.push (Offset (0, 0));
points.push (Offset (-length, width));
points.push (Offset (-length, -width));
- for (int i = 0; i < points.size(); i++)
+ for (int i = 0; i < points.size (); i++)
points[i] = points[i] * complex_exp (Offset (0, angle)) + end;
-
+
return Lookup::round_filled_polygon (points, thick);
}
{
Real thick = Staff_symbol_referencer::line_thickness (me)
* robust_scm2double (me->get_property ("thickness"), 1);
- Real ss = Staff_symbol_referencer::staff_space (me);
-
+ Real ss = Staff_symbol_referencer::staff_space (me);
+
Real len = robust_scm2double (me->get_property ("arrow-length"), 1.3 * ss);
Real wid = robust_scm2double (me->get_property ("arrow-width"), 0.5 * ss);
if (to_arrow)
- a.add_stencil (make_arrow (from, to, thick, len, wid));
-
+ a.add_stencil (make_arrow (from, to, thick, len, wid));
+
if (from_arrow)
- a.add_stencil (make_arrow (to, from, thick, len, wid));
+ a.add_stencil (make_arrow (to, from, thick, len, wid));
}
return a;
}
-
Stencil
Line_interface::line (Grob *me, Offset from, Offset to)
SCM type = me->get_property ("style");
Stencil stil;
-
+
SCM dash_fraction = me->get_property ("dash-fraction");
if (scm_is_number (dash_fraction) || type == ly_symbol2scm ("dotted-line"))
{
if (period < 0)
return Stencil ();
- stil = make_dashed_line (thick, from, to, period, fraction);
+ stil = make_dashed_line (thick, from, to, period, fraction);
}
else
- stil = make_line (thick, from, to);
+ stil = make_line (thick, from, to);
return stil;
}
Real staff_space = Staff_symbol_referencer::staff_space (me);
Real w = robust_scm2double (me->get_property ("zigzag-width"), 1) * staff_space;
- int count = (int) ceil (dz.length() / w);
+ int count = (int) ceil (dz.length () / w);
w = dz.length () / count;
Real l = robust_scm2double (me->get_property ("zigzag-length"), 1) * w;
Offset rotation_factor = complex_exp (Offset (0, dz.arg ()));
Offset points[3];
- points[0] = Offset (0, -h/2);
- points[1] = Offset (w/2, h/2);
- points[2] = Offset (w, -h/2);
+ points[0] = Offset (0, -h / 2);
+ points[1] = Offset (w / 2, h / 2);
+ points[2] = Offset (w, -h / 2);
for (int i = 0; i < 3; i++)
points[i] = complex_multiply (points[i], rotation_factor);
-
- Stencil squiggle (Line_interface::make_line (thick,points[0], points[1]));
- squiggle.add_stencil (Line_interface::make_line (thick,points[1], points[2]));
+
+ Stencil squiggle (Line_interface::make_line (thick, points[0], points[1]));
+ squiggle.add_stencil (Line_interface::make_line (thick, points[1], points[2]));
Stencil total;
for (int i = 0; i < count; i++)
SCM type = me->get_property ("style");
Stencil line;
-
+
if (scm_is_symbol (type)
&& (type == ly_symbol2scm ("line")
|| type == ly_symbol2scm ("dashed-line")
if (to_boolean (me->get_property ("arrow")))
line.add_stencil (Line_interface::arrows (me, from, to, false, true));
-
+
return line;
}
Offset p;
- p = Offset (0, thick/2);
+ p = Offset (0, thick / 2);
b.add_point (p);
- p += Offset (1,-1) * (blot/2);
+ p += Offset (1, -1) * (blot / 2);
SCM points = SCM_EOL;
-
+
points = scm_cons (scm_from_double (p[X_AXIS]),
scm_cons (scm_from_double (p[Y_AXIS]),
points));
-
-
- p = Offset (0, -thick/2);
+
+ p = Offset (0, -thick / 2);
b.add_point (p);
- p += Offset (1,1) * (blot/2);
+ p += Offset (1, 1) * (blot / 2);
points = scm_cons (scm_from_double (p[X_AXIS]),
scm_cons (scm_from_double (p[Y_AXIS]),
points));
-
-
- p = Offset (width, width * slope - thick/2);
+
+ p = Offset (width, width * slope - thick / 2);
b.add_point (p);
- p += Offset (-1, 1) * (blot/2);
+ p += Offset (-1, 1) * (blot / 2);
points = scm_cons (scm_from_double (p[X_AXIS]),
scm_cons (scm_from_double (p[Y_AXIS]),
points));
-
-
- p = Offset (width, width * slope + thick/2);
+
+ p = Offset (width, width * slope + thick / 2);
b.add_point (p);
- p += Offset (-1, -1) * (blot/2);
+ p += Offset (-1, -1) * (blot / 2);
points = scm_cons (scm_from_double (p[X_AXIS]),
scm_cons (scm_from_double (p[Y_AXIS]),
points));
-
+
SCM expr = scm_list_n (ly_symbol2scm ("polygon"),
ly_quote_scm (points),
scm_from_double (blot),
SCM_BOOL_T,
SCM_UNDEFINED);
-
+
return Stencil (b, expr);
}
programming_error ("Polygon should not have duplicate points");
}
#endif
-
+
/* special cases: degenerated polygons */
if (points.size () == 0)
return Stencil ();
Lookup::repeat_slash (Real w, Real s, Real t)
{
#if 0 /* TODO */
- Array<Offset> points ;
+ Array<Offset> points;
Real blotdiameter = 0.0;
- Offset p1(0, 0);
- Offset p2(w, w*s);
-
-
-
+ Offset p1 (0, 0);
+ Offset p2 (w, w * s);
+
+
return Lookup::round_filled_polygon (points, blotdiameter);
#endif
-
+
SCM wid = scm_from_double (w);
SCM sl = scm_from_double (s);
SCM thick = scm_from_double (t);
Protected_scm anonymous_modules = SCM_EOL;
#endif
-
void
clear_anonymous_modules ()
{
s = scm_cdr (s))
{
SCM module = scm_car (s);
- SCM closure = SCM_MODULE_EVAL_CLOSURE(module);
- SCM prop = scm_procedure_property (closure, ly_symbol2scm ("module"));
+ SCM closure = SCM_MODULE_EVAL_CLOSURE (module);
+ SCM prop = scm_procedure_property (closure, ly_symbol2scm ("module"));
if (ly_is_module (prop))
{
SCM maker = ly_lily_module_constant ("make-module");
SCM scm_module = ly_lily_module_constant ("the-scm-module");
-
+
mod = scm_call_0 (maker);
scm_module_define (mod, ly_symbol2scm ("%module-public-interface"),
mod);
-
+
ly_use_module (mod, scm_module);
ly_use_module (mod, global_lily_module);
}
#ifdef MODULE_GC_KLUDGE
anonymous_modules = scm_cons (mod, anonymous_modules);
#endif
-
+
return mod;
}
#define FUNC_NAME __FUNCTION__
-
static SCM
accumulate_symbol (void *closure, SCM key, SCM val, SCM result)
{
}
-
#ifdef MODULE_GC_KLUDGE
static SCM
redefine_keyval (void *closure, SCM key, SCM val, SCM result)
/*
UGH UGH.
Kludge for older GUILE 1.6 versions.
- */
+*/
void
make_stand_in_procs_weak ()
{
SCM old_tab = scm_stand_in_procs;
SCM new_tab = scm_make_weak_key_hash_table (scm_from_int (257));
-
- new_tab = scm_internal_hash_fold ((Hash_closure_function) &redefine_keyval,
+
+ new_tab = scm_internal_hash_fold ((Hash_closure_function) & redefine_keyval,
NULL,
new_tab,
old_tab);
scm_stand_in_procs = new_tab;
}
-ADD_SCM_INIT_FUNC(make_stand_in_procs_weak, make_stand_in_procs_weak);
+ADD_SCM_INIT_FUNC (make_stand_in_procs_weak, make_stand_in_procs_weak);
#endif
Music *event_;
Item *text_;
Item *last_text_;
-
+
Context *get_voice_context ();
};
if (event_)
{
SCM text = event_->get_property ("text");
-
+
if (ly_is_equal (text, scm_makfrom0str (" ")))
{
if (last_text_)
text_->set_property ("self-alignment-X", scm_from_int (LEFT));
}
}
-
+
last_text_ = text_;
text_ = 0;
}
#include "translator.icc"
ADD_TRANSLATOR (Lyric_performer, "", "", "lyric-event",
- "", "");
+ "", "");
(c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
+
#include "main.hh"
#include <cassert>
#if HAVE_GRP_H
#include <grp.h>
-#endif
+#endif
#if HAVE_PWD_H
#include <pwd.h>
-#endif
+#endif
#if HAVE_GETTEXT
#include <libintl.h>
#endif
#if HAVE_CHROOT
{_i ("USER,GROUP,JAIL,DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n"
"and cd into DIR")},
-#endif
+#endif
{0, "no-print", 0, _i ("do not generate printed output")},
{0, "preview", 'p', _i ("generate a preview of the first system")},
{0, "safe-mode", 's', _i ("run in safe mode")},
#define LILYPOND_DATADIR PACKAGE_DATADIR "/" TOPLEVEL_VERSION
static void
-env_var_info (FILE *out, char const* key)
+env_var_info (FILE *out, char const *key)
{
if (char const *value = getenv (key))
fprintf (out, "%s=\"%s\"\n", key, value);
env_var_info (out, "GUILE_LOAD_PATH");
env_var_info (out, "PANGO_RC_FILE");
env_var_info (out, "PATH");
-#endif
+#endif
}
static void
}
static int
-sane_putenv (char const* key, String value, bool overwrite = true)
+sane_putenv (char const *key, String value, bool overwrite = true)
{
if (overwrite || !getenv (key))
{
#if ARGV0_RELOCATION
static int
-set_env_file (char const* key, String value)
+set_env_file (char const *key, String value)
{
if (is_file (value))
return sane_putenv (key, value, false);
{
if (is_dir (value))
{
- if (char const* cur = getenv (key))
+ if (char const *cur = getenv (key))
value += to_string (PATHSEP) + cur;
return sane_putenv (key, value.to_str0 ());
}
/*
ugh. C&P font-config.cc
*/
- struct stat statbuf;
+ struct stat statbuf;
String builddir = prefix_directory + "/mf/out/";
if (stat (builddir.to_str0 (), &statbuf) == 0)
{
}
for (int i = 0; i < dirs.size (); i++)
- global_path.prepend (dirs[i]);
+ global_path.prepend (dirs[i]);
}
-
+
static void
prepend_load_path (String dir)
{
#endif
-
static void
main_with_guile (void *, int, char **)
{
call_constructors ();
ly_set_option (ly_symbol2scm ("verbose"), scm_from_bool (be_verbose_global));
-
init_global_tweak_registry ();
init_fontconfig ();
all_fonts_global = new All_font_metrics (global_path.to_string ());
-
if (!init_scheme_variables.is_empty ()
|| !init_scheme_code_string.is_empty ())
{
init_scheme_variables = "(map (lambda (x) (ly:set-option (car x) (cdr x))) (list "
+ init_scheme_variables + "))";
-
+
init_scheme_code_string
+= "(begin #t "
+ init_scheme_variables
+ ")";
char const *str0 = init_scheme_code_string.to_str0 ();
-
+
if (be_verbose_global)
- progress_indication (_f("Evaluating %s", str0));
+ progress_indication (_f ("Evaluating %s", str0));
scm_c_eval_string ((char *) str0);
}
-
/* We accept multiple independent music files on the command line to
reduce compile time when processing lots of small files.
Starting the GUILE engine is very time consuming. */
String localedir = LOCALEDIR;
if (char const *env = getenv ("LILYPOND_LOCALEDIR"))
localedir = env;
-
+
bindtextdomain ("lilypond", localedir.to_str0 ());
textdomain ("lilypond");
#endif
String key = arg;
String val = "#t";
-
+
if (eq >= 0)
{
key = arg.left_string (eq);
}
init_scheme_variables
- += "(cons \'" + key + " " + val + ")\n";
+ += "(cons \'" + key + " " + val + ")\n";
}
break;
-
+
case 'v':
notice ();
exit (0);
if (output_format_global == "")
output_format_global = "pdf";
-
+
if (show_help)
{
identify (stdout);
void
setup_guile_env ()
{
- char * yield = getenv ("LILYPOND_GC_YIELD");
+ char *yield = getenv ("LILYPOND_GC_YIELD");
bool overwrite = true;
if (!yield)
{
yield = "70";
overwrite = false;
}
-
+
sane_putenv ("GUILE_MIN_YIELD_1", yield, overwrite);
sane_putenv ("GUILE_MIN_YIELD_2", yield, overwrite);
sane_putenv ("GUILE_MIN_YIELD_MALLOC", yield, overwrite);
}
-
int
main (int argc, char **argv)
{
#include "translator.icc"
-ADD_ACKNOWLEDGER (Mark_engraver,bar_line);
+ADD_ACKNOWLEDGER (Mark_engraver, bar_line);
ADD_TRANSLATOR (Mark_engraver,
/* doc */ "This engraver will create RehearsalMark objects. "
"It puts them on top of all staves (which is taken from "
event_ = 0;
}
-
ADD_TRANSLATOR (Melisma_translator,
/* doc */ "This translator collects melisma information about ties, beams, and user settings (@code{melismaBusy}, and signals it to the @code{\addlyrics} code. ",
/* create */ "",
{
Item *current = dynamic_cast<Item *> (primitives[i].grob ());
if (i == 0)
- {
- first = current;
- }
+ first = current;
get_set_column (current, first->get_column ());
if (i > 0)
- {
- current->translate_axis (distance, X_AXIS);
- }
+ current->translate_axis (distance, X_AXIS);
distance
+= scm_to_double (current->get_property ("head-width"))
(c) 1997--2005 Jan Nieuwenhuizen <janneke@gnu.org>
*/
-
#include "midi-stream.hh"
#include <errno.h>
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "lily-guile.hh"
return SCM_UNSPECIFIED;
}
-LY_DEFINE(ly_clear_anonymous_modules, "ly:clear-anonymous-modules",
- 0, 0, 0, (),
- "Plug a GUILE 1.6 and 1.7 memory leak by breaking a weak reference "
- "pointer cycle explicitly."
- )
+LY_DEFINE (ly_clear_anonymous_modules, "ly:clear-anonymous-modules",
+ 0, 0, 0, (),
+ "Plug a GUILE 1.6 and 1.7 memory leak by breaking a weak reference "
+ "pointer cycle explicitly.")
{
#ifdef MODULE_GC_KLUDGE
- clear_anonymous_modules();
+ clear_anonymous_modules ();
#endif
return SCM_UNSPECIFIED;
}
-
/* Lookup SYM, but don't give error when it is not defined. */
SCM
ly_module_lookup (SCM module, SCM sym)
Rational (grace_num, grace_den)).smobbed_copy ();
}
-
LY_DEFINE (ly_sub_moment, "ly:moment-sub",
2, 0, 0, (SCM a, SCM b),
"Subtract two moments.")
return (*ma % * mb).smobbed_copy ();
}
-
LY_DEFINE (ly_moment_grace_numerator, "ly:moment-grace-numerator",
1, 0, 0, (SCM mom),
"Extract numerator from grace timing.")
/*
For the start of a score.
- */
+ */
bar_seen_ = true;
start_measure_ = 0;
mmrest_ = 0;
#include "translator.icc"
ADD_TRANSLATOR (Multi_measure_rest_engraver,
- /* doc */
+ /* doc */
"Engraves multi-measure rests that are produced with @code{R}. Reads "
"measurePosition and currentBarNumber to determine what number to print "
"over the MultiMeasureRest. Reads measureLength to determine if it "
-/*
+/*
music-output.cc -- implement Music_output
-
+
source file of the GNU LilyPond music typesetter
-
+
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
-#include "music-output.hh"
+#include "music-output.hh"
#include "ly-smobs.icc"
#include "virtual-methods.hh"
Music_output::~Music_output ()
{
-
}
-
+
void
Music_output::derived_mark () const
{
SCM copy = m;
if (unsmob_music (m))
{
- Music * mcopy = unsmob_music (m)->clone ();
+ Music *mcopy = unsmob_music (m)->clone ();
copy = mcopy->unprotect ();
}
else if (scm_is_pair (m))
{
Moment l = unsmob_music (scm_car (s))->get_length ();
if (last_len.grace_part_ && l.main_part_)
- {
- last_len.grace_part_ = Rational (0);
- }
+ last_len.grace_part_ = Rational (0);
cumulative += last_len;
last_len = l;
}
#include "music.hh"
-
MAKE_SCHEME_CALLBACK (Music_wrapper, start_callback, 1);
SCM
Music_wrapper::start_callback (SCM m)
{
length_callback_ = duration_length_callback_proc;
}
-
+
start_callback_ = get_property ("start-callback");
}
{
}
-
SCM
Music::get_property_alist (bool m) const
{
return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s);
}
-
SCM
Music::internal_get_object (SCM s) const
{
void
Music::internal_set_object (SCM s, SCM v)
{
- return internal_set_property (s,v);
+ return internal_set_property (s, v);
}
void
return m;
}
-
MAKE_SCHEME_CALLBACK (Music, duration_length_callback, 1);
SCM
Music::duration_length_callback (SCM m)
Array<Finger_tuple> fingerings_;
Array<Finger_tuple> articulations_;
Array<Finger_tuple> string_numbers_;
-
+
Link_array<Grob> heads_;
Grob *stem_;
continue;
if (m->is_mus_type ("fingering-event"))
- {
- add_fingering (inf.grob (), m, note_ev);
- }
+ add_fingering (inf.grob (), m, note_ev);
else if (m->is_mus_type ("text-script-event"))
{
m->origin ()->warning (_ ("can't add text scripts to individual note heads"));
}
else if (m->is_mus_type ("script-event"))
- {
- add_script (inf.grob (), m, note_ev);
- }
+ add_script (inf.grob (), m, note_ev);
else if (m->is_mus_type ("string-number-event"))
- {
- add_string (inf.grob (), m, note_ev);
- }
+ add_string (inf.grob (), m, note_ev);
else if (m->is_mus_type ("harmonic-event"))
{
inf.grob ()->set_property ("style", ly_symbol2scm ("harmonic"));
fingerings_.push (ft);
}
-
void
New_fingering_engraver::add_string (Grob *head,
Music *event,
/* Do not merge notes typeset in different style. */
if (!ly_is_equal (nu->get_property ("style"),
- nd->get_property ("style")))
+ nd->get_property ("style")))
merge_possible = false;
int upball_type = Note_head::get_balltype (nu);
wipe_ball = nu;
}
else
- {
- dot_wipe_head = nu;
- }
+ dot_wipe_head = nu;
}
else if (dnball_type > upball_type)
{
}
}
-Drul_array < Link_array<Grob> >
-Note_collision_interface::get_clash_groups (Grob *me)
+Drul_array < Link_array<Grob>
+> Note_collision_interface::get_clash_groups (Grob *me)
{
Drul_array<Link_array<Grob> > clash_groups;
SCM tups = SCM_EOL;
extract_grob_set (me, "elements", elements);
- for (int i = 0; i < elements.size (); i++)
+ for (int i = 0; i < elements.size (); i++)
{
Grob *se = elements[i];
iv.set_empty ();
extract_grob_set (me, "note-heads", heads);
- for (int i = 0; i < heads.size(); i++)
+ for (int i = 0; i < heads.size (); i++)
{
Grob *se = heads[i];
if (heads.size ())
return (Direction)sign (head_positions_interval (me).center ());
}
-
+
programming_error ("note column without heads and stem");
return CENTER;
}
{
extract_grob_set (me, "note-heads", heads);
Grob *acc = 0;
- for (int i = 0; i < heads.size(); i++)
+ for (int i = 0; i < heads.size (); i++)
{
Grob *h = heads[i];
acc = h ? unsmob_grob (h->get_object ("accidental-grob")) : 0;
return acc;
}
-
Grob *
Note_column::arpeggio (Grob *me)
{
#include <cctype>
#include <algorithm> // min, max
-using namespace std;
+using namespace std;
#include "directional-element-interface.hh"
#include "staff-symbol.hh"
}
SCM log = scm_from_int (Note_head::get_balltype (me));
- String suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
+ String suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
if (style != ly_symbol2scm ("default"))
{
SCM proc = me->get_property ("glyph-name-procedure");
if (ly_is_procedure (proc))
suffix = ly_scm2string (scm_call_2 (proc, log, style));
- }
+ }
Font_metric *fm = Font_interface::get_default_font (me);
String idx = "noteheads.s" + suffix;
String prefix = "noteheads.";
Grob *stem = unsmob_grob (me->get_object ("stem"));
Direction stem_dir = stem ? get_grob_direction (stem) : CENTER;
-
+
if (stem_dir == CENTER)
programming_error ("must have stem dir for note head");
String idx = prefix + ((stem_dir == UP) ? "u" : "d") + suffix;
if (out.is_empty ())
{
me->warning (_f ("note head `%s' not found", idx.to_str0 ()));
- out = Stencil (Box(Interval (0, 0),Interval (0, 0)), SCM_EOL);
+ out = Stencil (Box (Interval (0, 0), Interval (0, 0)), SCM_EOL);
}
else
{
ev->origin ()->warning (_ ("NoteEvent without pitch"));
}
#endif
-
+
int pos = pit ? pit->steps () : 0;
SCM c0 = get_property ("middleCPosition");
if (scm_is_number (c0))
SCM style = SCM_EOL;
if (scm_c_vector_length (shape_vector) > delta
&& scm_is_symbol (scm_vector_ref (shape_vector, scm_from_int (delta))))
- {
- style = scm_vector_ref (shape_vector, scm_from_int (delta));
- }
+ style = scm_vector_ref (shape_vector, scm_from_int (delta));
if (scm_is_symbol (style))
{
note->set_property ("style", style);
ADD_TRANSLATOR (Note_performer, "", "",
"note-event busy-playing-event",
- "", "");
+ "", "");
Note_performer::Note_performer ()
{
#include "output-def.hh"
#include "pointer-group-interface.hh"
-
/*
TODO: detect hshifts due to collisions, and account for them in
spacing?
Item *it = dynamic_cast<Item *> (items[i]);
if (d == RIGHT && it->break_status_dir () != col_dir)
- {
- it = it->find_prebroken_piece (col_dir);
- }
-
+ it = it->find_prebroken_piece (col_dir);
+
/*
some kind of mismatch, eg. a note column, that is behind a
linebreak.
extents[d].unite (v);
}
-
if (Grob *arpeggio = Note_column::arpeggio (it))
- {
- extents[d].unite (arpeggio->extent (it_col, X_AXIS));
- }
+ extents[d].unite (arpeggio->extent (it_col, X_AXIS));
}
}
/*
Add that which sticks out a lot.
- */
+ */
+ max (0.0, -extents[RIGHT][LEFT] - (base_space - increment))));
-
/*
We don't do complicated stuff: (base_space - increment) is the
if (!me->is_live ())
return 0;
- Grob_array * a = unsmob_grob_array (me->get_object ("right-items"));
+ Grob_array *a = unsmob_grob_array (me->get_object ("right-items"));
Item *mincol = 0;
int min_rank = INT_MAX;
bool prune = false;
- for (int i = 0; a && i < a->size (); i++)
+ for (int i = 0; a && i < a->size (); i++)
{
Item *ri = a->item (i);
Item *col = ri->get_column ();
if (prune && a)
{
- Link_array<Grob> & right = a->array_reference ();
- for (int i = right.size(); i--;)
+ Link_array<Grob> &right = a->array_reference ();
+ for (int i = right.size (); i--;)
{
- if (dynamic_cast<Item*> (right[i])->get_column () != mincol)
+ if (dynamic_cast<Item *> (right[i])->get_column () != mincol)
right.del (i);
}
}
do
{
Link_array<Grob> const &items (ly_scm2link_array (props [d]));
- for (int i = 0; i < items.size(); i++)
+ for (int i = 0; i < items.size (); i++)
{
Item *it = dynamic_cast<Item *> (items[i]);
if (d == RIGHT && Separation_item::has_interface (it))
{
if (it->get_column () != rcolumn)
- {
- it = it->find_prebroken_piece (rcolumn->break_status_dir ());
- }
+ it = it->find_prebroken_piece (rcolumn->break_status_dir ());
Grob *last = Separation_item::extremal_break_aligned_grob (it, LEFT, &bar_xextent);
*/
if (d == LEFT
&& Stem::duration_log (stem) > 2 && !Stem::get_beam (stem))
- {
- correct_stem_dirs = false;
- }
+ correct_stem_dirs = false;
Interval hp = Stem::head_positions (stem);
if (!hp.is_empty ())
Real chord_start = hp[sd];
Real stem_end = Stem::stem_end_position (stem);
- stem_posns[d] = Interval (min (chord_start, stem_end), max (chord_start, stem_end));
+ stem_posns[d] = Interval (min (chord_start, stem_end), max (chord_start, stem_end));
head_posns[d].unite (hp);
}
}
}
if (!bar_yextent.is_empty ())
- {
- correction *= 0.5;
- }
+ correction *= 0.5;
}
}
else if (correct_stem_dirs && stem_dirs[LEFT] * stem_dirs[RIGHT] == UP)
Real delta = head_posns[-lowest][DOWN] - head_posns[lowest][UP];
Real corr = robust_scm2double (me->get_property ("same-direction-correction"), 0);
-
+
if (delta > 1)
correction = -lowest * corr;
}
for (SCM s = skey; scm_is_pair (s); s = scm_cdr (s))
{
if (Object_key const *sub_key = unsmob_key (scm_car (s)))
- {
- scm_set_car_x (s, dump_key (sub_key));
- }
+ scm_set_car_x (s, dump_key (sub_key));
else if (Moment *mom = unsmob_moment (scm_car (s)))
{
scm_set_car_x (s,
*tail = scm_cons (key->self_scm (), SCM_EOL);
}
else
- {
- *tail = scm_cons (item, SCM_EOL);
- }
+ *tail = scm_cons (item, SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
return scm_hashq_ref (otf->get_char_table (), sym, SCM_EOL);
}
-LY_DEFINE(ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0,
- (SCM font, SCM tag),
- "Extract a table @var{tag} from @var{font}. Return empty string for "
- "non-existent @var{tag}.")
+LY_DEFINE (ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0,
+ (SCM font, SCM tag),
+ "Extract a table @var{tag} from @var{font}. Return empty string for "
+ "non-existent @var{tag}.")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
-
+
Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ())
: dynamic_cast<Open_type_font *> (unsmob_metrics (font));
- SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "Open type font");
- SCM_ASSERT_TYPE (scm_is_string (tag), tag, SCM_ARG1, __FUNCTION__, "Open type font");
+ SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "Open type font");
+ SCM_ASSERT_TYPE (scm_is_string (tag), tag, SCM_ARG1, __FUNCTION__, "Open type font");
char ctag [5] = " ";
String tag_string = ly_scm2string (tag);
- strncpy (ctag, tag_string.to_str0 (), tag_string.length());
+ strncpy (ctag, tag_string.to_str0 (), tag_string.length ());
String tab = otf->get_otf_table (String (ctag));
- return scm_from_locale_stringn ((char const*) tab.to_bytes (), tab.length ());
+ return scm_from_locale_stringn ((char const *) tab.to_bytes (), tab.length ());
}
-LY_DEFINE(ly_otf_font_p, "ly:otf-font?", 1, 0, 0,
- (SCM font),
- "Is @var{font} an OpenType font?")
+LY_DEFINE (ly_otf_font_p, "ly:otf-font?", 1, 0, 0,
+ (SCM font),
+ "Is @var{font} an OpenType font?")
{
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
-
+
Open_type_font *otf = fm ? dynamic_cast<Open_type_font *> (fm->original_font ())
: dynamic_cast<Open_type_font *> (unsmob_metrics (font));
{
programming_error ("Cannot find OpenType table.");
}
-
+
return 0;
}
-
String
Open_type_font::get_otf_table (String tag) const
{
FT_Done_Face (face_);
}
-
/*
UGH fix naming
*/
get_otf_table (FT_Face face, String tag)
{
FT_ULong len;
- FT_Byte *tab = load_table (tag.to_str0 (), face, &len);
+ FT_Byte *tab = load_table (tag.to_str0 (), face, &len);
return String (tab, len);
}
lily_global_table_ = SCM_EOL;
lily_subfonts_ = SCM_EOL;
lily_index_to_bbox_table_ = SCM_EOL;
-
+
lily_character_table_ = alist_to_hashq (load_scheme_table ("LILC", face_));
lily_global_table_ = alist_to_hashq (load_scheme_table ("LILY", face_));
lily_subfonts_ = load_scheme_table ("LILF", face_);
if (SCM_HASHTABLE_P (lily_index_to_bbox_table_))
{
SCM box = scm_hashq_ref (lily_index_to_bbox_table_, scm_from_int (signed_idx), SCM_BOOL_F);
- Box * box_ptr = Box::unsmob (box);
+ Box *box_ptr = Box::unsmob (box);
if (box_ptr)
return *box_ptr;
}
Grob *dots = Rhythmic_head::get_dots (h);
if (dots && d == RIGHT)
- {
- ext.unite (dots->extent (common, X_AXIS));
- }
+ ext.unite (dots->extent (common, X_AXIS));
}
}
if (ext.is_empty ())
- {
- ext = robust_relative_extent (b, common, X_AXIS);
- }
+ ext = robust_relative_extent (b, common, X_AXIS);
if (broken[d])
{
Real text_size = text.extent (X_AXIS).is_empty ()
? 0.0 : text.extent (X_AXIS)[RIGHT] + 0.3;
- span_points[LEFT] =
- min (span_points[LEFT],
- (span_points[RIGHT] - text_size
- - robust_scm2double (me->get_property ("minimum-length"), -1.0)));
+ span_points[LEFT]
+ = min (span_points[LEFT],
+ (span_points[RIGHT] - text_size
+ - robust_scm2double (me->get_property ("minimum-length"), -1.0)));
Interval bracket_span_points = span_points;
bracket_span_points[LEFT] += text_size;
TRANSLATOR_DECLARATIONS (Ottava_spanner_engraver);
protected:
virtual void finalize ();
-
+
DECLARE_ACKNOWLEDGER (note_column);
-
+
void process_music ();
void stop_translation_timestep ();
virtual void derived_mark () const;
void
Ottava_spanner_engraver::acknowledge_note_column (Grob_info info)
{
- Item *it = info.item();
+ Item *it = info.item ();
if (span_ && it)
{
Side_position_interface::add_support (span_, it);
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "font-metric.hh"
Output_def *op = unsmob_output_def (pap);
SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Output_def");
SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
-
+
SCM answer = op->lookup_variable (sym);
if (answer == SCM_UNDEFINED)
{
Output_def *op = unsmob_output_def (def);
SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition");
- Output_def *clone = op->clone ();
+ Output_def *clone = op->clone ();
return clone->unprotect ();
}
"Return the description of translators in @var{output-def}.")
{
Output_def *id = unsmob_output_def (output_def);
-
+
SCM al = ly_module2alist (id->scope_);
SCM ell = SCM_EOL;
for (SCM s = al; scm_is_pair (s); s = scm_cdr (s))
{
- Context_def * td = unsmob_context_def (scm_cdar (s));
+ Context_def *td = unsmob_context_def (scm_cdar (s));
SCM key = scm_caar (s);
if (td && key == td->get_context_name ())
- ell = scm_cons (scm_cons (key, td->to_alist ()), ell);
+ ell = scm_cons (scm_cons (key, td->to_alist ()), ell);
}
- return ell;
+ return ell;
}
LY_DEFINE (ly_layout_def_p, "ly:layout-def?",
}
LY_DEFINE (ly_paper_outputscale, "ly:paper-outputscale",
- 1, 0, 0, (SCM bp),
- "Get outputscale for BP.")
+ 1, 0, 0, (SCM bp),
+ "Get outputscale for BP.")
{
Output_def *b = unsmob_output_def (bp);
SCM_ASSERT_TYPE (b, bp, SCM_ARG1, __FUNCTION__, "paper");
0, 0, 0, (),
"Make a output def.")
{
- Output_def *bp = new Output_def ;
+ Output_def *bp = new Output_def;
return bp->unprotect ();
}
Output_def *paper = unsmob_output_def (paper_smob);
SCM_ASSERT_TYPE (paper, paper_smob, SCM_ARG1,
__FUNCTION__, "paper definition");
-
+
Font_metric *fm = select_font (paper, chain);
return fm->self_scm ();
}
{
Output_def *b = unsmob_output_def (bp);
-
SCM_ASSERT_TYPE (b, bp, SCM_ARG1, __FUNCTION__, "paper");
SCM tab1 = b->lookup_variable (ly_symbol2scm ("scaled-fonts"));
if (scm_hash_table_p (tab1) == SCM_BOOL_T)
{
alist1 = scm_append (ly_alist_vals (ly_hash2alist (tab1)));
-
+
alist1 = ly_alist_vals (alist1);
}
alist2 = scm_append (ly_alist_vals (ly_hash2alist (tab2)));
// strip size factors
- alist2 = ly_alist_vals (alist2);
+ alist2 = ly_alist_vals (alist2);
}
SCM alist = scm_append (scm_list_2 (alist1, alist2));
for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
{
SCM entry = scm_car (s);
-
+
Font_metric *fm = unsmob_metrics (entry);
- if (dynamic_cast<Modified_font_metric*> (fm)
- || dynamic_cast<Pango_font*> (fm))
+ if (dynamic_cast<Modified_font_metric *> (fm)
+ || dynamic_cast<Pango_font *> (fm))
font_list = scm_cons (fm->self_scm (), font_list);
}
-
+
return font_list;
}
PANGO_ASCENT (ink_rect)));
b.scale (scale_);
-
+
SCM glyph_exprs = SCM_EOL;
SCM *tail = &glyph_exprs;
FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
-
- SCM char_id;
+ SCM char_id;
if (glyph_name[0] == '\0')
{
/*
CID entry
- */
+ */
cid_keyed = true;
char_id = scm_from_int (pg);
}
scores_ = scm_cons (s, scores_);
}
-
void
Paper_book::add_performance (SCM s)
{
performances_ = scm_cons (s, performances_);
}
-
void
Paper_book::output (SCM output_channel)
{
header_0_ = header;
}
else if (Music_output *mop = unsmob_music_output (scm_car (s)))
-
+
{
if (Paper_score *pscore = dynamic_cast<Paper_score *> (mop))
{
add_score_title (header);
-
+
header = SCM_EOL;
-
+
SCM system_list = scm_vector_to_list (pscore->get_paper_systems ());
system_list = scm_reverse (system_list);
systems_ = scm_append (scm_list_2 (system_list, systems_));
else if (scm_is_vector (scm_car (s)))
{
/*
- UGH. code dup.
+ UGH. code dup.
*/
add_score_title (header);
header = SCM_EOL;
-
+
SCM system_list = scm_vector_to_list (scm_car (s));
system_list = scm_reverse (system_list);
systems_ = scm_append (scm_list_2 (system_list, systems_));
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "paper-column-engraver.hh"
#include "translator.icc"
-
Paper_column_engraver::Paper_column_engraver ()
{
command_column_ = 0;
{
command_column_->set_property ("breakable", SCM_BOOL_T);
system_->set_bound (RIGHT, command_column_);
- }
+ }
}
void
Paper_column *p1 = make_paper_column ("NonMusicalPaperColumn");
Paper_column *p2 = make_paper_column ("PaperColumn");
- SCM m = now_mom().smobbed_copy();
+ SCM m = now_mom ().smobbed_copy ();
p1->set_property ("when", m);
p2->set_property ("when", m);
-
+
set_columns (p1, p2);
}
-
void
Paper_column_engraver::initialize ()
{
- system_ = dynamic_cast<System*> (unsmob_grob (get_property ("rootSystem")));
+ system_ = dynamic_cast<System *> (unsmob_grob (get_property ("rootSystem")));
make_columns ();
-
system_->set_bound (LEFT, command_column_);
command_column_->set_property ("breakable", SCM_BOOL_T);
}
system_->add_column (musical_column_);
}
-
void
Paper_column_engraver::forbid_breaks ()
{
command_column_->set_property ("breakable", SCM_EOL);
}
-
bool
Paper_column_engraver::try_music (Music *m)
{
command_column_->set_property ("page-penalty", scm_from_double (total_pp));
}
-
bool start_of_measure = (last_moment_.main_part_ != now_mom ().main_part_
&& !measure_position (context ()).main_part_);
if (start_of_measure)
{
Moment mlen = Moment (measure_length (context ()));
- Grob * column = unsmob_grob (get_property ("currentCommandColumn"));
+ Grob *column = unsmob_grob (get_property ("currentCommandColumn"));
if (column)
column->set_property ("measure-length", mlen.smobbed_copy ());
else
- programming_error("No command column?");
+ programming_error ("No command column?");
}
}
}
}
items_.clear ();
-
+
if (to_boolean (command_column_->get_property ("breakable")))
{
breaks_++;
make_columns ();
}
-ADD_ACKNOWLEDGER (Paper_column_engraver,item);
-ADD_ACKNOWLEDGER (Paper_column_engraver,note_spacing);
-ADD_ACKNOWLEDGER (Paper_column_engraver,staff_spacing);
-
+ADD_ACKNOWLEDGER (Paper_column_engraver, item);
+ADD_ACKNOWLEDGER (Paper_column_engraver, note_spacing);
+ADD_ACKNOWLEDGER (Paper_column_engraver, staff_spacing);
ADD_TRANSLATOR (Paper_column_engraver,
/* doc */ "Takes care of generating columns."
bool
Paper_column::is_used (Grob *me)
{
- extract_grob_set (me ,"elements", elts);
- if (elts.size())
+ extract_grob_set (me, "elements", elts);
+ if (elts.size ())
return true;
-
- extract_grob_set (me ,"bounded-by-me", bbm);
- if (bbm.size())
+
+ extract_grob_set (me, "bounded-by-me", bbm);
+ if (bbm.size ())
return true;
return Item::is_breakable (me);
}
Moment *mom = unsmob_moment (me->get_property ("when"));
String when = mom ? mom->to_string () : "?/?";
-
+
SCM properties = Font_interface::text_font_alist_chain (me);
SCM scm_mol = Text_interface::interpret_markup (me->get_layout ()->self_scm (),
Grob *me = unsmob_grob (grob);
SCM bbm = me->get_object ("bounded-by-me");
- Grob_array * ga = unsmob_grob_array (bbm);
+ Grob_array *ga = unsmob_grob_array (bbm);
if (!ga)
return SCM_UNSPECIFIED;
-
+
Link_array<Grob> &array (ga->array_reference ());
-
- for (int i = array.size(); i--; )
+
+ for (int i = array.size (); i--;)
{
Grob *g = array[i];
#include "stencil.hh"
-
LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter",
2, 0, 0, (SCM port, SCM format),
"Create an outputter that evaluates within "
String f = ly_scm2string (format);
String output_name = "<unknown>";
-
+
SCM port_name = scm_port_filename (port);
if (scm_is_string (port_name))
output_name = ly_scm2string (port_name);
-
+
message (_f ("Layout output to `%s'...",
output_name.to_str0 ()));
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "paper-score.hh"
assert (false);
}
-
void
Paper_score::derived_mark () const
{
{
return layout_;
}
-
SCM
Paper_score::get_paper_systems () const
protected:
DECLARE_ACKNOWLEDGER (note_head);
DECLARE_ACKNOWLEDGER (stem);
-
+
void process_music ();
void stop_translation_timestep ();
virtual bool try_music (Music *);
Part_combine_engraver::acknowledge_stem (Grob_info i)
{
if (text_)
- Side_position_interface::add_support (text_, i.grob ());
+ Side_position_interface::add_support (text_, i.grob ());
}
void
if (meas_len == body_length_)
repeat_sign_type_ = MEASURE;
else if (Moment (2) * meas_len == body_length_)
- {
- repeat_sign_type_ = DOUBLE_MEASURE;
- }
+ repeat_sign_type_ = DOUBLE_MEASURE;
else
{
warning (_f ("can't handle a percent repeat of length: %s",
if (repeat_sign_type_ == DOUBLE_MEASURE)
next_moment_ += meas_len;
-
+
return true;
}
else if (repeat_sign_type_ == DOUBLE_MEASURE)
{
double_percent_ = make_item ("DoublePercentRepeat", repeat_->self_scm ());
-
+
/*
forbid breaks on a % line. Should forbid all breaks, really.
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
-
#include "performance.hh"
-
LY_DEFINE (ly_performance_write, "ly:performance-write",
- 2,0,0, (SCM performance, SCM filename),
+ 2, 0, 0, (SCM performance, SCM filename),
"Write @var{performance} to @var{filename}")
{
- Performance * perf = dynamic_cast<Performance*> (unsmob_music_output (performance));
+ Performance *perf = dynamic_cast<Performance *> (unsmob_music_output (performance));
- SCM_ASSERT_TYPE(perf, performance, SCM_ARG1, __FUNCTION__, "Performance");
- SCM_ASSERT_TYPE(scm_is_string (filename), filename, SCM_ARG2, __FUNCTION__, "file name");
+ SCM_ASSERT_TYPE (perf, performance, SCM_ARG1, __FUNCTION__, "Performance");
+ SCM_ASSERT_TYPE (scm_is_string (filename), filename, SCM_ARG2, __FUNCTION__, "file name");
perf->write_output (ly_scm2string (filename));
return SCM_UNSPECIFIED;
}
-
audio_element_list_ = new Killing_cons<Audio_element> (p, audio_element_list_);
}
-
void
Performance::write_output (String out)
{
#include "warn.hh"
ADD_TRANSLATOR_GROUP (Performer_group_performer,
- /* doc */ "",
- /* create */ "",
- /* accept */ "",
- /* read */ "",
- /* write */ "");
+ /* doc */ "",
+ /* create */ "",
+ /* accept */ "",
+ /* read */ "",
+ /* write */ "");
void
Performer_group_performer::announce_element (Audio_element_info info)
}
}
-
void
Performer_group_performer::play_element (Audio_element *e)
{
Context *c = context_->get_parent_context ();
if (c)
{
- Performer_group_performer *pgp = dynamic_cast<Performer_group_performer*> (c->implementation ());
+ Performer_group_performer *pgp = dynamic_cast<Performer_group_performer *> (c->implementation ());
pgp->play_element (e);
}
}
Context *c = context_->get_parent_context ();
if (c)
{
- Performer_group_performer *pgp = dynamic_cast<Performer_group_performer*> (c->implementation ());
+ Performer_group_performer *pgp = dynamic_cast<Performer_group_performer *> (c->implementation ());
return pgp->get_tempo ();
}
return 60;
}
-
+
delete str;
if (be_verbose_global)
progress_indication ("]");
-
+
return pfa_scm;
}
-
LY_DEFINE (ly_otf_to_cff, "ly:otf->cff",
1, 0, 0, (SCM otf_file_name),
"Convert the contents of a OTF file to CFF file, returning it as "
FT_Face face = open_ft_face (file_name);
String table = get_otf_table (face, "CFF ");
- SCM asscm = scm_from_locale_stringn ((char*) table.get_bytes (),
+ SCM asscm = scm_from_locale_stringn ((char *) table.get_bytes (),
table.length ());
if (be_verbose_global)
progress_indication ("]");
-
+
return asscm;
-}
-
+}
+
DECLARE_ACKNOWLEDGER (slur);
DECLARE_ACKNOWLEDGER (text_script);
DECLARE_ACKNOWLEDGER (tie);
-
+
void stop_translation_timestep ();
virtual void finalize ();
void process_music ();
void
Phrasing_slur_engraver::acknowledge_extra_object (Grob_info info)
{
- Grob*e = info.grob ();
+ Grob *e = info.grob ();
SCM inside = e->get_property ("inside-slur");
if (Tie::has_interface (e)
|| to_boolean (inside))
acknowledge_extra_object (info);
}
-
void
Phrasing_slur_engraver::acknowledge_slur (Grob_info info)
{
#include "translator.icc"
-
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, accidental);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, dynamic_line_spanner);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, fingering)
-ADD_ACKNOWLEDGER (Phrasing_slur_engraver, note_column);
+ ADD_ACKNOWLEDGER (Phrasing_slur_engraver, note_column);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, script);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, slur);
ADD_ACKNOWLEDGER (Phrasing_slur_engraver, text_script);
{
String nm = p->name_ + String ("Event");
if (ly_is_equal (m->get_property ("name"),
- scm_str2symbol (nm.to_str0 ())))
+ scm_str2symbol (nm.to_str0 ())))
{
Direction d = to_dir (m->get_property ("span-direction"));
p->event_drul_[d] = m;
p->event_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", p->name_));
}
else
- {
- s = scm_cadr (strings);
- }
+ s = scm_cadr (strings);
p->start_ev_ = p->event_drul_[START];
}
}
p->event_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", p->name_));
}
else
- {
- s = scm_caddr (strings);
- }
+ s = scm_caddr (strings);
p->start_ev_ = 0;
}
}
SCM cc = get_property ("currentCommandColumn");
Item *c = unsmob_item (cc);
if (p->line_spanner_)
- {
- p->line_spanner_->set_bound (RIGHT, c);
- }
+ p->line_spanner_->set_bound (RIGHT, c);
p->bracket_->set_bound (RIGHT, c);
p->finished_bracket_ = p->bracket_;
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Piano_pedal_engraver,note_column);
+ADD_ACKNOWLEDGER (Piano_pedal_engraver, note_column);
ADD_TRANSLATOR (Piano_pedal_engraver,
/* doc */ "Engrave piano pedal symbols and brackets.",
/* create */ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner",
{
String nm = p->name_ + String ("Event");
if (ly_is_equal (r->get_property ("name"),
- scm_str2symbol (nm.to_str0 ())))
+ scm_str2symbol (nm.to_str0 ())))
{
Direction d = to_dir (r->get_property ("span-direction"));
p->event_drul_[d] = r;
ADD_TRANSLATOR (Piano_pedal_performer, "", "",
"pedal-event",
- "", "");
+ "", "");
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Pitch_squash_engraver,note_head);
+ADD_ACKNOWLEDGER (Pitch_squash_engraver, note_head);
ADD_TRANSLATOR (Pitch_squash_engraver,
- /* doc */
+ /* doc */
"Set the vertical position of noteheads to "
"@code{squashedPosition}, if that "
"property is set. "
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "engraver.hh"
#include "note-head.hh"
#include "item.hh"
#include "side-position-interface.hh"
-#include "pitch.hh"
+#include "pitch.hh"
#include "warn.hh"
class Pitched_trill_engraver : public Engraver
{
public:
- TRANSLATOR_DECLARATIONS(Pitched_trill_engraver);
-
+ TRANSLATOR_DECLARATIONS (Pitched_trill_engraver);
+
protected:
- DECLARE_ACKNOWLEDGER ( note_head);
- DECLARE_ACKNOWLEDGER ( dots);
- DECLARE_ACKNOWLEDGER ( text_spanner);
+ DECLARE_ACKNOWLEDGER (note_head);
+ DECLARE_ACKNOWLEDGER (dots);
+ DECLARE_ACKNOWLEDGER (text_spanner);
void process_music ();
- virtual bool try_music (Music*);
+ virtual bool try_music (Music *);
void stop_translation_timestep ();
private:
void make_trill (Music *);
};
-
Pitched_trill_engraver::Pitched_trill_engraver ()
{
trill_head_ = 0;
{
heads_.push (info.grob ());
}
-
+
void
Pitched_trill_engraver::acknowledge_text_spanner (Grob_info info)
{
if (trill_head_)
{
programming_error ("already have a trill head.");
- trill_head_ = 0;
+ trill_head_ = 0;
}
trill_head_ = make_item ("TrillPitchHead", mus->self_scm ());
trill_head_->set_property ("staff-position",
scm_from_int (unsmob_pitch (scm_pitch)->steps ()
+ c0));
-
- trill_group_ = make_item ("TrillPitchGroup", mus->self_scm());
- Axis_group_interface::add_element (trill_group_, trill_head_);
+ trill_group_ = make_item ("TrillPitchGroup", mus->self_scm ());
+
+ Axis_group_interface::add_element (trill_group_, trill_head_);
if (print_acc)
{
if (trill_group_)
for (int i = 0; i < heads_.size (); i++)
Side_position_interface::add_support (trill_group_, heads_[i]);
-
+
heads_.clear ();
trill_head_ = 0;
trill_group_ = 0;
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "pointer-group-interface.hh"
Pointer_group_interface::count (Grob *me, SCM sym)
{
Grob_array *arr = unsmob_grob_array (me->internal_get_object (sym));
- return arr ? arr->size() : 0;
+ return arr ? arr->size () : 0;
}
void
add_grob (me, sym, unsmob_grob (p));
}
-
void
Pointer_group_interface::add_grob (Grob *me, SCM sym, Grob *p)
{
}
arr->add (p);
}
-
+
static Link_array<Grob> empty_array;
Link_array<Grob> const &
Grob_array *arr = unsmob_grob_array (x);
return arr ? arr->array () : empty_array;
}
-
Link_array<Grob> const &
internal_extract_grob_array (Grob const *elt, SCM symbol)
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "profile.hh"
SCM context_property_lookup_table;
SCM grob_property_lookup_table;
-LY_DEFINE(ly_context_property_lookup_stats, "ly:context-property-lookup-stats",
- 0,0,0, (),
- "")
+LY_DEFINE (ly_context_property_lookup_stats, "ly:context-property-lookup-stats",
+ 0, 0, 0, (),
+ "")
{
- return context_property_lookup_table ? context_property_lookup_table
+ return context_property_lookup_table ? context_property_lookup_table
: scm_c_make_hash_table (1);
}
-
-LY_DEFINE(ly_property_lookup_stats, "ly:grob-property-lookup-stats",
- 0,0,0, (),
- "")
+LY_DEFINE (ly_property_lookup_stats, "ly:grob-property-lookup-stats",
+ 0, 0, 0, (),
+ "")
{
- return grob_property_lookup_table ? grob_property_lookup_table :
- scm_c_make_hash_table (1);
+ return grob_property_lookup_table ? grob_property_lookup_table
+ : scm_c_make_hash_table (1);
}
void
note_property_access (SCM *table, SCM sym)
{
/*
- Statistics: which properties are looked up?
+ Statistics: which properties are looked up?
*/
if (!*table)
*table = scm_permanent_object (scm_c_make_hash_table (259));
-
+
SCM hashhandle = scm_hashq_get_handle (*table, sym);
if (hashhandle == SCM_BOOL_F)
{
hashhandle = scm_hashq_get_handle (*table, sym);
}
- int count = scm_to_int (scm_cdr (hashhandle)) + 1;
+ int count = scm_to_int (scm_cdr (hashhandle)) + 1;
scm_set_cdr_x (hashhandle, scm_from_int (count));
}
#include "warn.hh"
#include "main.hh"
-
/* Write midi as formatted ascii stream? */
bool do_midi_debugging_global;
bool use_object_keys;
}
}
-const int HELP_INDENT = 30;
-const int INDENT = 2;
-const int SEPARATION = 5;
+const int HELP_INDENT = 30;
+const int INDENT = 2;
+const int SEPARATION = 5;
/*
Hmmm. should do in SCM / C++ ?
- */
+*/
static String
get_help_string ()
{
SCM alist = ly_hash2alist (option_hash_);
SCM convertor = ly_lily_module_constant ("scm->string");
-
-
+
Array<String> opts;
-
+
for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
{
SCM sym = scm_caar (s);
SCM val = scm_cdar (s);
- String opt_spec =
- String_convert::char_string (' ', INDENT)
+ String opt_spec
+ = String_convert::char_string (' ', INDENT)
+ ly_symbol2string (sym)
+ " ("
+ ly_scm2string (scm_call_1 (convertor, val))
opt_spec += String_convert::char_string (' ', HELP_INDENT - opt_spec.length ());
SCM opt_help_scm
- = scm_object_property (sym, ly_symbol2scm ("program-option-documentation"));
+ = scm_object_property (sym, ly_symbol2scm ("program-option-documentation"));
String opt_help = ly_scm2string (opt_help_scm);
opt_help.substitute (String ("\n"),
String ("\n")
String help ("Options supported by ly:set-option\n\n");
opts.sort (String::compare);
- for (int i = 0; i < opts.size (); i++)
+ for (int i = 0; i < opts.size (); i++)
help += opts[i];
-
+
help += String ("\n");
return help;
}
"Print ly:set-option usage")
{
String help = get_help_string ();
- fputs (help.to_str0 (), stdout);
+ fputs (help.to_str0 (), stdout);
exit (0);
return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0,
- (SCM sym, SCM val, SCM description),
+ (SCM sym, SCM val, SCM description),
"Add a program option @var{sym} with default @var{val}.")
{
if (scm_hash_table_p (option_hash_) == SCM_BOOL_F)
SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG1, __FUNCTION__, "symbol");
SCM_ASSERT_TYPE (scm_is_string (description), description,
SCM_ARG3, __FUNCTION__, "string");
-
+
internal_set_option (sym, val);
scm_set_object_property_x (sym, ly_symbol2scm ("program-option-documentation"),
"Set a program option. Try setting 'help for a help string.")
{
SCM_ASSERT_TYPE (scm_is_symbol (var), var, SCM_ARG1,
- __FUNCTION__, "symbol");
+ __FUNCTION__, "symbol");
if (ly_symbol2scm ("help") == var)
{
if (val == SCM_UNDEFINED)
val = SCM_BOOL_T;
- String varstr = ly_scm2string (scm_symbol_to_string (var));
+ String varstr = ly_scm2string (scm_symbol_to_string (var));
if (varstr.left_string (3) == String ("no-"))
{
var = ly_symbol2scm (varstr.nomid_string (0, 3).to_str0 ());
val = scm_from_bool (!to_boolean (val));
}
-
+
SCM handle = scm_hashq_get_handle (option_hash_, var);
if (handle == SCM_BOOL_F)
{
"Get a global option setting.")
{
SCM_ASSERT_TYPE (scm_is_symbol (var), var,
- SCM_ARG1, __FUNCTION__, "symbol");
+ SCM_ARG1, __FUNCTION__, "symbol");
return scm_hashq_ref (option_hash_, var, SCM_BOOL_F);
-}
+}
return g;
}
-
void
Push_property_iterator::process (Moment m)
{
#include "recording-group-engraver.hh"
#include "context.hh"
-
void
Recording_group_engraver::derived_mark () const
{
void
Recording_group_engraver::finalize ()
{
- SCM proc = context()->get_property ("recordEventSequence");
+ SCM proc = context ()->get_property ("recordEventSequence");
if (ly_is_procedure (proc))
scm_call_2 (proc, context ()->self_scm (), scm_cdr (accumulator_));
void
recording_engraver (Translator_group *tg)
{
- Recording_group_engraver *rg = dynamic_cast<Recording_group_engraver*> (tg);
+ Recording_group_engraver *rg = dynamic_cast<Recording_group_engraver *> (tg);
rg->stop_translation_timestep ();
}
}
ADD_TRANSLATOR_GROUP (Recording_group_engraver,
- "Engraver_group_engraver that records all music events "
- "for this context. Calls the procedure "
- "in @code{recordEventSequence} when finished.",
- "",
- "",
- "recordEventSequence",
- "");
+ "Engraver_group_engraver that records all music events "
+ "for this context. Calls the procedure "
+ "in @code{recordEventSequence} when finished.",
+ "",
+ "",
+ "recordEventSequence",
+ "");
}
}
-
ADD_TRANSLATOR (Repeat_acknowledge_engraver,
/* doc */ "Acknowledge repeated music, and convert the contents of "
"repeatCommands ainto an appropriate setting for whichBar.",
Direction d = LEFT;
do
- {
- ordered_rests[d].sort (Note_column::shift_compare);
- }
- while (flip (&d) != LEFT);
+ ordered_rests[d].sort (Note_column::shift_compare);
+ while (flip (&d) != LEFT)
+ ;
do
{
Interval notedim;
for (int i = 0; i < notes.size (); i++)
- {
- notedim.unite (notes[i]->extent (common, Y_AXIS));
- }
+ notedim.unite (notes[i]->extent (common, Y_AXIS));
Real dist
= minimum_dist + dir * max (notedim[dir] - restdim[-dir], 0.0);
#include "rhythmic-head.hh"
#include "music.hh"
-
class Rest_engraver : public Engraver
{
Music *rest_event_;
dot_ = 0;
}
-
void
Rest_engraver::process_music ()
{
if (lc % 2)
{
if (bt == 0 && lc > 1)
- {
- me->translate_axis (ss, Y_AXIS);
- }
+ me->translate_axis (ss, Y_AXIS);
}
else
{
Grob *last_spacing_;
Grob *spacing_;
- void add_spacing_item (Grob*);
-
+ void add_spacing_item (Grob *);
+
TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver);
protected:
{
if (dotcol_
&& !dotcol_->get_parent (X_AXIS))
- {
- Note_column::set_dotcol (note_column_, dotcol_);
- }
+ Note_column::set_dotcol (note_column_, dotcol_);
if (stem_
&& !stem_->get_parent (X_AXIS))
void
Rhythmic_column_engraver::acknowledge_stem (Grob_info i)
{
- stem_ = i.grob();
+ stem_ = i.grob ();
}
void
stem_ = 0;
}
-
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, dot_column);
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem);
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, rhythmic_head);
#include "ly-smobs.icc"
-using namespace std;
+using namespace std;
/*
Return: number of objects.
Engraver_group_engraver::derived_mark ();
}
-
void
Score_engraver::prepare (Moment m)
{
(void) m;
-
+
precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, DOWN);
}
}
pscore_ = new Paper_score (dynamic_cast<Output_def *> (context ()->get_output_def ()));
- pscore_->unprotect ();
+ pscore_->unprotect ();
SCM props = updated_grob_properties (context (), ly_symbol2scm ("System"));
Object_key const *sys_key = context ()->get_grob_key ("System");
pscore_->typeset_system (new System (props, sys_key));
system_ = pscore_->root_system ();
- context ()->set_property ("rootSystem", system_->self_scm ());
-
+ context ()->set_property ("rootSystem", system_->self_scm ());
+
Engraver_group_engraver::initialize ();
}
return o->self_scm ();
}
-
/*
UGH UGH
- */
+*/
void
Score_engraver::forbid_breaks ()
{
for (SCM s = simple_trans_list_; scm_is_pair (s); s = scm_cdr (s))
{
Translator *tr = unsmob_translator (scm_car (s));
- if (Paper_column_engraver* pce = dynamic_cast<Paper_column_engraver*> (tr))
- {
- pce->forbid_breaks ();
- }
+ if (Paper_column_engraver *pce = dynamic_cast<Paper_column_engraver *> (tr))
+ pce->forbid_breaks ();
}
}
}
ADD_TRANSLATOR_GROUP (Score_engraver,
- /* doc */ "Top level engraver. Takes care of generating columns and the complete system (ie. System) "
- "\n\n "
- "This engraver decides whether a column is breakable. The default is "
- "that a column is always breakable. However, when every Bar_engraver "
- "that does not have a barline at a certain point will call "
- "Score_engraver::forbid_breaks to stop linebreaks. In practice, this "
- "means that you can make a breakpoint by creating a barline (assuming "
- "that there are no beams or notes that prevent a breakpoint.) ",
- /* create */ "System PaperColumn NonMusicalPaperColumn",
- /* accept */ "break-event",
- /* read */ "currentMusicalColumn currentCommandColumn verticallySpacedContexts",
- /* write */ "");
+ /* doc */ "Top level engraver. Takes care of generating columns and the complete system (ie. System) "
+ "\n\n "
+ "This engraver decides whether a column is breakable. The default is "
+ "that a column is always breakable. However, when every Bar_engraver "
+ "that does not have a barline at a certain point will call "
+ "Score_engraver::forbid_breaks to stop linebreaks. In practice, this "
+ "means that you can make a breakpoint by creating a barline (assuming "
+ "that there are no beams or notes that prevent a breakpoint.) ",
+ /* create */ "System PaperColumn NonMusicalPaperColumn",
+ /* accept */ "break-event",
+ /* read */ "currentMusicalColumn currentCommandColumn verticallySpacedContexts",
+ /* write */ "");
#include "context.hh"
ADD_TRANSLATOR_GROUP (Score_performer,
- /* doc */ "",
- /* create */ "",
- /* accept */ "",
- /* read */ "",
- /* write */ "");
+ /* doc */ "",
+ /* create */ "",
+ /* accept */ "",
+ /* read */ "",
+ /* write */ "");
Score_performer::Score_performer ()
{
#include "global-context.hh"
#include "lilypond-key.hh"
-
LY_DEFINE (ly_make_score, "ly:make-score",
1, 0, 0,
(SCM music),
{
Music *mus = unsmob_music (music);
SCM_ASSERT_TYPE (mus, music, SCM_ARG1, __FUNCTION__, "music");
-
+
Score *score = new Score;
score->set_music (music);
default_header, SCM_ARG3, __FUNCTION__, "\\paper block");
SCM_ASSERT_TYPE (unsmob_output_def (default_layout),
default_header, SCM_ARG4, __FUNCTION__, "\\layout block");
-
+
Object_key *key = new Lilypond_general_key (0, score->user_key_, 0);
if (score->error_found_)
SCM header = ly_is_module (score->header_)
? score->header_
: default_header;
-
+
for (int i = 0; i < score->defs_.size (); i++)
default_rendering (score->get_music (), score->defs_[i]->self_scm (),
default_paper, header, basename, key->self_scm ());
return SCM_UNSPECIFIED;
}
-
#include "paper-score.hh"
#include "warn.hh"
-
#include "music.hh"
#include "ly-smobs.icc"
Music *m = unsmob_music (s.music_);
if (m)
{
- Music *mclone = m->clone ();
+ Music *mclone = m->clone ();
music_ = mclone->unprotect ();
}
else
music_ = SCM_EOL;
-
for (int i = 0, n = s.defs_.size (); i < n; i++)
{
- Output_def * copy = s.defs_[i]->clone ();
+ Output_def *copy = s.defs_[i]->clone ();
defs_.push (copy);
copy->unprotect ();
}
def->parent_ = bdef;
scaled_def = def->self_scm ();
- scaled_bookdef = bdef->self_scm();
+ scaled_bookdef = bdef->self_scm ();
- def->unprotect();
- bdef->unprotect ();
+ def->unprotect ();
+ bdef->unprotect ();
}
SCM context = ly_run_translator (music, scaled_def, key);
SCM output_as_scm = ly_format_output (context);
Music_output *output = unsmob_music_output (output_as_scm);
-
- if (Paper_score *pscore = dynamic_cast<Paper_score*> (output))
+
+ if (Paper_score *pscore = dynamic_cast<Paper_score *> (output))
{
/* ugh, this is strange, Paper_book without a Book object. */
Paper_book *paper_book = new Paper_book ();
}
/*
- Format score, return list of Music_output objects.
+ Format score, return list of Music_output objects.
LAYOUTBOOK should be scaled already.
*/
SCM outputs = SCM_EOL;
SCM *tail = &outputs;
-
+
int outdef_count = defs_.size ();
Object_key *key = new Lilypond_general_key (book_key, user_key_, 0);
if (dynamic_cast<Global_context *> (unsmob_context (context)))
{
SCM s = ly_format_output (context);
-
+
*tail = scm_cons (s, SCM_EOL);
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
scm_remember_upto_here_1 (scaled);
#include "translator.icc"
-
/**
Find potentially colliding scripts, and put them in a
Script_column, that will fix the collisions. */
{
if (!Item::is_breakable (thing)
&& Side_position_interface::get_axis (inf.grob ()) == Y_AXIS)
- {
- scripts_.push (thing);
- }
+ scripts_.push (thing);
}
}
void stop_translation_timestep ();
void process_music ();
- DECLARE_ACKNOWLEDGER ( slur);
- DECLARE_ACKNOWLEDGER ( rhythmic_head);
- DECLARE_ACKNOWLEDGER ( stem);
- DECLARE_ACKNOWLEDGER ( note_column);
+ DECLARE_ACKNOWLEDGER (slur);
+ DECLARE_ACKNOWLEDGER (rhythmic_head);
+ DECLARE_ACKNOWLEDGER (stem);
+ DECLARE_ACKNOWLEDGER (note_column);
public:
TRANSLATOR_DECLARATIONS (Script_engraver);
void
Script_engraver::process_music ()
{
- for (int i = 0; i < scripts_.size(); i++)
- {
+ for (int i = 0; i < scripts_.size (); i++)
+ {
Music *m = scripts_[i].event_;
Grob *p = make_item ("Script", m->self_scm ());
}
}
-
void
Script_engraver::acknowledge_stem (Grob_info info)
{
void
Script_engraver::acknowledge_rhythmic_head (Grob_info info)
{
- if(info.music_cause ())
+ if (info.music_cause ())
{
- for (int i = 0; i < scripts_.size(); i++)
+ for (int i = 0; i < scripts_.size (); i++)
{
Grob *e = scripts_[i].script_;
As the note head to put it on is not known now, postpone this
decision to Script_interface::before_line_breaking (). */
-
- for (int i = 0; i < scripts_.size(); i++)
+
+ for (int i = 0; i < scripts_.size (); i++)
{
Grob *e = scripts_[i].script_;
e->set_parent (info.grob (), X_AXIS);
}
}
-
+
void
Script_engraver::acknowledge_slur (Grob_info info)
{
extract_grob_set (me, "elements", elts);
for (int i = elts.size ();
- i-- > 1; )
+ i-- > 1;)
{
- Item *r = dynamic_cast<Item*> (elts[i]);
+ Item *r = dynamic_cast<Item *> (elts[i]);
if (!r)
continue;
{
Item *it = make_item ("StaffSpacing", SCM_EOL);
current_spacings_.staff_spacing_ = it;
- Pointer_group_interface::add_grob (it, ly_symbol2scm ("left-items"),
+ Pointer_group_interface::add_grob (it, ly_symbol2scm ("left-items"),
break_item_);
if (int i = last_spacings_.note_spacings_.size ())
else if (last_spacings_.staff_spacing_)
{
SCM ri = last_spacings_.staff_spacing_->get_object ("right-items");
- Grob_array *ga = unsmob_grob_array (ri);
+ Grob_array *ga = unsmob_grob_array (ri);
if (!ga)
{
SCM ga_scm = Grob_array::make_array ();
extract_grob_set (me, "conditional-elements", elts);
for (int i = 0; i < elts.size (); i++)
{
- Item *il = dynamic_cast<Item*> (elts[i]);
+ Item *il = dynamic_cast<Item *> (elts[i]);
if (pc != il->get_column ())
{
/* this shouldn't happen, but let's continue anyway. */
}
if (to_boolean (il->get_property ("no-spacing-rods")))
- {
- continue;
- }
+ continue;
if (Accidental_placement::has_interface (il))
- {
- w.unite (Accidental_placement::get_relevant_accidental_extent (il, pc, left));
- }
+ w.unite (Accidental_placement::get_relevant_accidental_extent (il, pc, left));
}
SCM pad = me->get_property ("padding");
extract_grob_set (me, "elements", elts);
for (int i = 0; i < elts.size (); i++)
{
- Item *il = dynamic_cast<Item*> (elts[i]);
+ Item *il = dynamic_cast<Item *> (elts[i]);
if (pc != il->get_column ())
{
/* this shouldn't happen, but let's continue anyway. */
}
if (to_boolean (il->get_property ("no-spacing-rods")))
- {
- continue;
- }
+ continue;
Interval iv (il->extent (pc, X_AXIS));
if (!iv.is_empty ())
- {
- w.unite (iv);
- }
+ w.unite (iv);
}
SCM pad = me->get_property ("padding");
Grob *col = dynamic_cast<Item *> (me)->get_column ();
last_ext->set_empty ();
Grob *last_grob = 0;
-
+
extract_grob_set (me, "elements", elts);
- for (int i = elts.size (); i--; )
+ for (int i = elts.size (); i--;)
{
Grob *break_item = elts[i];
if (!scm_is_symbol (break_item->get_property ("break-align-symbol")))
#include <math.h> // ceil.
#include <algorithm>
-
#include "note-head.hh"
#include "warn.hh"
#include "warn.hh"
"side-relative-direction "
"side-support-elements "
"slur-padding "
- "staff-padding "
- );
+ "staff-padding ");
/*
desc.is_active_ ?
*/
- desc.block_force_ = - desc.ideal_ / desc.inverse_hooke_;
+ desc.block_force_ = -desc.ideal_ / desc.inverse_hooke_;
// block at distance 0
active_count_++;
Simple_spacer_wrapper::add_columns (Link_array<Grob> const &icols)
{
Link_array<Grob> cols (icols);
- cols.clear();
-
- for (int i = 0; i < icols.size (); i++)
+ cols.clear ();
+
+ for (int i = 0; i < icols.size (); i++)
if (scm_is_pair (icols[i]->get_object ("between-cols")))
{
loose_cols_.push (icols[i]);
{
cols.push (icols[i]);
}
-
+
spaced_cols_ = cols;
for (int i = 0; i < cols.size () - 1; i++)
{
Grob *other = unsmob_grob (scm_caar (s));
int j = binsearch_links (cols, other, &compare_paper_column_rank);
if (j >= 0 && cols[j] == other)
- {
- spacer_->add_rod (i, j, scm_to_double (scm_cdar (s)));
- }
+ spacer_->add_rod (i, j, scm_to_double (scm_cdar (s)));
}
if (i
tail = SCM_CDRLOC (*tail);
}
else
- {
- mi->quit ();
- }
+ mi->quit ();
}
}
Music_iterator *i = unsmob_iterator (scm_car (*proc));
if (i->run_always ()
|| i->pending_moment () == until)
- {
- i->process (until);
- }
+ i->process (until);
if (!i->ok ())
{
i->quit ();
*proc = scm_cdr (*proc);
}
else
- {
- proc = SCM_CDRLOC (*proc);
- }
+ proc = SCM_CDRLOC (*proc);
}
}
distance = max (distance, (buildings[i].height_ - clouds[j].height_));
if (i > 0 && buildings[i].width_[LEFT] >= clouds[j].width_[LEFT])
- {
- i--;
- }
+ i--;
else if (j > 0 && buildings[i].width_[LEFT] <= clouds[j].width_[LEFT])
- {
- j--;
- }
+ j--;
}
return distance;
Moment meas_length
= robust_scm2moment (get_property ("measureLength"), Moment (0));
if (body_length_ < meas_length)
- {
- repeat_ = m;
- }
+ repeat_ = m;
else
return false;
beat_slash_ = 0;
}
-
#include "translator.icc"
ADD_TRANSLATOR (Slash_repeat_engraver,
Real y = curve.get_other_coordinate (X_AXIS, p[X_AXIS]);
if (y)
- {
- fit_factor = max (fit_factor, (p[Y_AXIS] / y));
- }
+ fit_factor = max (fit_factor, (p[Y_AXIS] / y));
}
return fit_factor;
}
void
Slur_configuration::generate_curve (Slur_score_state const &state,
Real r_0, Real h_inf,
- Array<Offset> const &avoid
- )
+ Array<Offset> const &avoid)
{
Offset dz = attachment_[RIGHT]- attachment_[LEFT];;
Offset dz_unit = dz;
variance_penalty = state.parameters_.head_slur_distance_max_ratio_;
if (min_dist > 0.0)
variance_penalty
- = min ((avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0), variance_penalty);
+ = min ((avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0), variance_penalty);
variance_penalty = max (variance_penalty, 0.0);
variance_penalty *= state.parameters_.head_slur_distance_factor_;
#include "translator.icc"
-ADD_ACKNOWLEDGER (Slur_engraver,accidental);
-ADD_ACKNOWLEDGER (Slur_engraver,dynamic_line_spanner);
-ADD_ACKNOWLEDGER (Slur_engraver,fingering)
-ADD_ACKNOWLEDGER (Slur_engraver,note_column);
-ADD_ACKNOWLEDGER (Slur_engraver,script);
-ADD_ACKNOWLEDGER (Slur_engraver,text_script);
-ADD_ACKNOWLEDGER (Slur_engraver,tie);
+ADD_ACKNOWLEDGER (Slur_engraver, accidental);
+ADD_ACKNOWLEDGER (Slur_engraver, dynamic_line_spanner);
+ADD_ACKNOWLEDGER (Slur_engraver, fingering)
+ ADD_ACKNOWLEDGER (Slur_engraver, note_column);
+ADD_ACKNOWLEDGER (Slur_engraver, script);
+ADD_ACKNOWLEDGER (Slur_engraver, text_script);
+ADD_ACKNOWLEDGER (Slur_engraver, tie);
ADD_TRANSLATOR (Slur_engraver,
/* doc */ "Build slur grobs from slur events",
/* create */ "Slur",
Direction d = to_dir (m->get_property ("span-direction"));
if (d == START)
- {
- start_ev_ = m;
- }
+ start_ev_ = m;
else if (d == STOP)
- {
- now_stop_ev_ = m;
- }
+ now_stop_ev_ = m;
return true;
}
return false;
do not issue warning. This happens for rests and
whole notes.
*/
- s = Interval (0,0)
+ s = Interval (0, 0)
+ extremes[d].stem_->relative_coordinate (common_[ax], ax);
}
- extremes[d].stem_extent_[ax] = s;
+ extremes[d].stem_extent_[ax] = s;
}
-
+
extremes[d].slur_head_
= Stem::extremal_heads (extremes[d].stem_)[dir];
if (!extremes[d].slur_head_
&& Note_column::has_rests (extremes[d].bound_))
- {
- extremes[d].slur_head_ = Note_column::get_rest (extremes[d].bound_);
- }
+ extremes[d].slur_head_ = Note_column::get_rest (extremes[d].bound_);
if (extremes[d].slur_head_)
extremes[d].slur_head_extent_
#endif
{
for (int i = 0; i < configurations_.size (); i++)
- {
- configurations_[i]->score (*this);
- }
+ configurations_[i]->score (*this);
for (int i = 0; i < configurations_.size (); i++)
{
if (configurations_[i]->score_ < opt)
{
Real x, y;
if (d == RIGHT)
- {
- x = extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)[d];
- }
+ x = extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)[d];
else
- {
- x = slur_->get_broken_left_end_align ();
- }
+ x = slur_->get_broken_left_end_align ();
Grob *col = (d == LEFT) ? columns_[0] : columns_.top ();
if (extremes_[-d].bound_ != col)
}
while (flip (&d) != LEFT);
-
do
{
for (int a = X_AXIS; a < NO_AXES; a++)
programming_error ("slur attachment is inf/nan");
b = 0.0;
}
-
}
}
while (flip (&d) != LEFT);
-
-
+
return base_attachment;
}
Slur_score_state::move_away_from_staffline (Real y,
Grob *on_staff) const
{
- Grob * staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff);
+ Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (on_staff);
if (!staff_symbol)
return y;
-
+
Real pos
= (y - staff_symbol->relative_coordinate (common_[Y_AXIS],
- Y_AXIS))
+ Y_AXIS))
* 2.0 / staff_space_;
if (fabs (pos - my_round (pos)) < 0.2
}
-
Array<Offset>
Slur_score_state::generate_avoid_offsets () const
{
avoid.push (Offset (inf.x_, y + dir_ * parameters_.free_head_distance_));
}
-
+
extract_grob_set (slur_, "encompass-objects", extra_encompasses);
for (int i = 0; i < extra_encompasses.size (); i++)
if (Slur::has_interface (extra_encompasses[i]))
Real r_0 = robust_scm2double (slur_->get_property ("ratio"), 0.33);
Real h_inf = staff_space_ * scm_to_double (slur_->get_property ("height-limit"));
- Array<Offset> avoid = generate_avoid_offsets ();
+ Array<Offset> avoid = generate_avoid_offsets ();
for (int i = 0; i < configurations_.size (); i++)
configurations_[i]->generate_curve (*this, r_0, h_inf, avoid);
}
return scm_from_double (offset);
}
-
MAKE_SCHEME_CALLBACK (Slur, after_line_breaking, 1);
SCM
Slur::after_line_breaking (SCM smob)
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "smobs.hh"
static SCM smob_protection_list;
void
-init_smob_protection()
+init_smob_protection ()
{
smob_protection_list = scm_cons (SCM_UNDEFINED, SCM_EOL);
scm_permanent_object (smob_protection_list);
}
-ADD_SCM_INIT_FUNC(init_smob_protection, init_smob_protection);
+ADD_SCM_INIT_FUNC (init_smob_protection, init_smob_protection);
void
protect_smob (SCM smob, SCM *prot_cons)
while (scm_is_pair (next)
&& scm_car (next) == SCM_UNDEFINED)
- {
- next = scm_cdr (next);
- }
+ next = scm_cdr (next);
scm_set_cdr_x (*prot_cons, next);
}
{
int l, ch, col;
get_counts (context_str0, &l, &ch, &col);
-
+
return name_string () + ":" + to_string (l)
+ ":" + to_string (col);
}
}
-
String
-Source_file::quote_input (char const* pos_str0) const
+Source_file::quote_input (char const *pos_str0) const
{
if (!contains (pos_str0))
return " (" + _ ("position unknown") + ")";
return String ((Byte const *)data_str0 + line[LEFT], line.length ());
}
-
void
Source_file::get_counts (char const *pos_str0,
int *line_number,
return;
*line_number = get_line (pos_str0);
-
+
Slice line = line_slice (pos_str0);
char const *data = to_str0 ();
Byte const *line_start = (Byte const *)data + line[LEFT];
- int left = (Byte const*) pos_str0 - line_start;
+ int left = (Byte const *) pos_str0 - line_start;
String line_begin (line_start, left);
- char const *line_chars = line_begin.to_str0();
-
+ char const *line_chars = line_begin.to_str0 ();
+
*column = 0;
*line_char = 0;
-
+
mbstate_t state;
/* Initialize the state. */
FIXME, this is apparently locale dependent.
*/
size_t thislen = mbrtowc (multibyte, line_chars, left, &state);
-
+
/* Stop converting at invalid character;
this can mean we have read just the first part
of a valid character. */
if (thislen == (size_t) -1)
break;
-
+
/* We want to handle embedded NUL bytes
but the return value is 0. Correct this. */
if (thislen == 0)
}
bool
-Source_file::contains (char const* pos_str0) const
+Source_file::contains (char const *pos_str0) const
{
return (pos_str0 && (pos_str0 >= to_str0 ()) && (pos_str0 <= to_str0 () + length ()));
}
int
-Source_file::get_line (char const* pos_str0) const
+Source_file::get_line (char const *pos_str0) const
{
if (!contains (pos_str0))
return 0;
if (!newline_locations_.size ())
return 1;
-
+
int lo = 0;
int hi = newline_locations_.size ();
if (newline_locations_[lo] > pos_str0)
return 1;
-
- if (newline_locations_[hi-1] < pos_str0)
+
+ if (newline_locations_[hi - 1] < pos_str0)
return hi;
-
+
binary_search_bounds (newline_locations_,
- pos_str0,
+ pos_str0,
Link_array<char>::default_compare,
&lo, &hi);
SCM
Source_file::get_port () const
{
- return str_port_;
+ return str_port_;
}
// printf ("rod %lf\n", d);
if (d < 0)
return;
-
+
if (isinf (d))
programming_error ("infinite rod");
{
programming_error ("Adding reverse rod");
}
-
+
mins = scm_cons (scm_cons (p->self_scm (), newdist), mins);
me->set_object ("minimum-distances", mins);
}
}
}
-
void
Spaceable_grob::remove_interface (Grob *me)
{
/*
spacing-basic.cc -- implement Spacing_spanner, simplistic spacing routines
-
+
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "spacing-spanner.hh"
#include "warn.hh"
/*
- LilyPond spaces by taking a simple-minded spacing algorithm, and
- adding subtle adjustments to that. This file does the simple-minded
- spacing routines.
+ LilyPond spaces by taking a simple-minded spacing algorithm, and
+ adding subtle adjustments to that. This file does the simple-minded
+ spacing routines.
*/
-
/*
- Get the measure wide ant for arithmetic spacing.
+ Get the measure wide ant for arithmetic spacing.
*/
Real
Spacing_options::get_duration_space (Moment d,
}
}
-
/*
The one-size-fits all spacing. It doesn't take into account
different spacing wishes from one to the next column.
Real
Spacing_spanner::note_spacing (Grob *me, Grob *lc, Grob *rc,
- Spacing_options const *options ,
+ Spacing_options const *options,
bool *expand_only)
{
Moment shortest_playing_len = 0;
if (delta_t.main_part_ && !lwhen.grace_part_)
{
dist = options->get_duration_space (shortest_playing_len,
- expand_only);
+ expand_only);
dist *= double (delta_t.main_part_ / shortest_playing_len.main_part_);
}
else if (delta_t.grace_part_)
return dist;
}
-
/****************************************************************/
void
shortest_duration_space_ = robust_scm2double (me->get_property ("shortest-duration-space"), 1);
}
-
void
Spacing_options::init ()
{
float_nonmusical_columns_ = false;
shortest_duration_space_ = 2.0;
- global_shortest_ = Rational (1,8);
+ global_shortest_ = Rational (1, 8);
}
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "staff-spacing.hh"
if (Paper_column::is_musical (c)
|| Item::is_breakable (c))
return false;
-
+
extract_grob_set (c, "right-neighbors", rns);
extract_grob_set (c, "left-neighbors", lns);
-
+
/*
If this column doesn't have a proper neighbor, we should really
make it loose, but spacing it correctly is more than we can
in any case, we don't want to move bar lines.
*/
extract_grob_set (c, "elements", elts);
- for (int i = elts.size (); i--; )
+ for (int i = elts.size (); i--;)
{
Grob *g = elts[i];
if (g && Break_align_interface::has_interface (g))
{
extract_grob_set (g, "elements", gelts);
- for (int j = gelts.size (); j--; )
+ for (int j = gelts.size (); j--;)
{
Grob *h = gelts[j];
Spacing_options const *options)
{
Link_array<Grob> newcols;
-
+
for (int i = 0; i < cols->size (); i++)
{
Grob *c = cols->elem (i);
- bool loose = (i > 0 && i < cols->size()-1)
+ bool loose = (i > 0 && i < cols->size () - 1)
&& is_loose_column (cols->elem (i - 1), c, cols->elem (i + 1), options);
-
-
+
if (loose)
{
extract_grob_set (c, "right-neighbors", rns_arr);
extract_grob_set (c, "left-neighbors", lns_arr);
-
- SCM lns = lns_arr.size () ? lns_arr.top()->self_scm () : SCM_BOOL_F;
- SCM rns = rns_arr.size () ? rns_arr.top()->self_scm () : SCM_BOOL_F;
-
+
+ SCM lns = lns_arr.size () ? lns_arr.top ()->self_scm () : SCM_BOOL_F;
+ SCM rns = rns_arr.size () ? rns_arr.top ()->self_scm () : SCM_BOOL_F;
+
/*
Either object can be non existent, if the score ends
prematurely.
Item *rc = dynamic_cast<Item *> (d == LEFT ? c : next_door[RIGHT]);
extract_grob_set (lc, "spacing-wishes", wishes);
- for (int k = wishes.size(); k--;)
+ for (int k = wishes.size (); k--;)
{
Grob *sp = wishes[k];
if (Note_spacing::left_column (sp) != lc
r.add_to_cols ();
}
else
- {
- newcols.push (c);
- }
+ newcols.push (c);
}
*cols = newcols;
int min_rank = 100000; // inf.
extract_grob_set (cols[i], "spacing-wishes", wishes);
- for (int k = wishes.size(); k--;)
+ for (int k = wishes.size (); k--;)
{
- Item *wish = dynamic_cast<Item *> ( wishes[k]);
+ Item *wish = dynamic_cast<Item *> (wishes[k]);
Item *lc = wish->get_column ();
Grob *right = Note_spacing::right_column (wish);
extract_grob_set (rc, "left-neighbors", lns_arr);
if (lns_arr.size ())
{
- Item *it = dynamic_cast<Item *> (lns_arr.top());
+ Item *it = dynamic_cast<Item *> (lns_arr.top ());
maxrank = Paper_column::get_rank (it->get_column ());
}
if (left_rank >= maxrank)
{
-
+
if (left_rank > maxrank)
{
Grob_array *ga = unsmob_grob_array (rc->get_object ("left-neighbors"));
sloppy with typing left/right-neighbors should take list, but paper-column found instead.
*/
extract_grob_set (cols[i], "left-neighbors", lns);
- if (lns.is_empty () && i )
+ if (lns.is_empty () && i)
{
- SCM ga_scm = Grob_array::make_array();
+ SCM ga_scm = Grob_array::make_array ();
Grob_array *ga = unsmob_grob_array (ga_scm);
- ga->add (cols[i-1]);
+ ga->add (cols[i - 1]);
cols[i]->set_object ("left-neighbors", ga_scm);
}
extract_grob_set (cols[i], "right-neighbors", rns);
if (rns.is_empty () && i < cols.size () - 1)
{
- SCM ga_scm = Grob_array::make_array();
+ SCM ga_scm = Grob_array::make_array ();
Grob_array *ga = unsmob_grob_array (ga_scm);
- ga->add (cols[i+1]);
+ ga->add (cols[i + 1]);
cols[i]->set_object ("right-neighbors", ga_scm);
}
}
static int time_compare (Rhythmic_tuple const &, Rhythmic_tuple const &);
};
-
/*
TODO: allow starting & stopping of spacing regions.
- */
+*/
/*
- Acknowledge rhythmic elements, for initializing spacing fields in
- the columns.
+ Acknowledge rhythmic elements, for initializing spacing fields in
+ the columns.
*/
class Spacing_engraver : public Engraver
{
Spanner *spacing_;
TRANSLATOR_DECLARATIONS (Spacing_engraver);
-
+
protected:
DECLARE_ACKNOWLEDGER (staff_spacing);
DECLARE_ACKNOWLEDGER (note_spacing);
DECLARE_ACKNOWLEDGER (rhythmic_head);
-
+
void start_translation_timestep ();
void stop_translation_timestep ();
void process_music ();
{
Pointer_group_interface::add_grob (spacing_, ly_symbol2scm ("wishes"), i.grob ());
}
-
+
void
Spacing_engraver::acknowledge_rhythmic_head (Grob_info i)
{
{
Paper_column *musical_column
= dynamic_cast<Paper_column *> (unsmob_grob (get_property ("currentMusicalColumn")));
-
+
SCM proportional = get_property ("proportionalNotationDuration");
if (unsmob_moment (proportional))
{
musical_column->set_property ("shortest-playing-duration", proportional);
musical_column->set_property ("shortest-starter-duration", proportional);
- return;
+ return;
}
-
+
Moment shortest_playing;
shortest_playing.set_infinite (1);
for (int i = 0; i < playing_durations_.size (); i++)
shortest_playing = min (shortest_playing, starter);
-
assert (starter.to_bool ());
SCM sh = shortest_playing.smobbed_copy ();
SCM st = starter.smobbed_copy ();
ADD_ACKNOWLEDGER (Spacing_engraver, staff_spacing);
ADD_ACKNOWLEDGER (Spacing_engraver, note_spacing);
ADD_ACKNOWLEDGER (Spacing_engraver, rhythmic_head);
-
+
ADD_TRANSLATOR (Spacing_engraver,
"make a SpacingSpanner and do "
"bookkeeping of shortest starting and playing notes ",
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-
#include "system.hh"
#include "paper-column.hh"
#include "column-x-positions.hh"
{
int loose_col_count = posns->loose_cols_.size ();
if (!loose_col_count)
- return;
+ return;
Real default_padding = 1.0;
for (int i = 0; i < loose_col_count; i++)
clique.push (left);
}
-
+
clique.push (loose);
divide_over++;
clique.push (right);
Grob *common = right->common_refpoint (left, X_AXIS);
- Item *finished_right_column = clique.top();
-
- for (int j = clique.size() - 2; j > 0; j--)
+ Item *finished_right_column = clique.top ();
+
+ for (int j = clique.size () - 2; j > 0; j--)
{
int count = 0;
Real total_space = 0.0;
Real fixed = 0.0;
if (Staff_spacing::has_interface (spacing))
- {
- Staff_spacing::get_spacing_params (spacing, &space, &fixed);
- }
+ Staff_spacing::get_spacing_params (spacing, &space, &fixed);
else if (Note_spacing::has_interface (spacing))
{
Spacing_options options;
&space, &fixed);
}
else
- {
- continue;
- }
-
+ continue;
+
count++;
total_space += space;
}
Real distance_to_next = 0.0;
- Real right_point = 0.0;
+ Real right_point = 0.0;
if (count)
{
total_space /= count;
}
Real my_offset = right_point - distance_to_next;
-
+
col->system_ = which;
col->translate_axis (my_offset - col->relative_coordinate (common, X_AXIS), X_AXIS);
}
}
-
#include "spacing-interface.hh"
-
Rational
Spacing_spanner::effective_shortest_duration (Grob *me, Link_array<Grob> const &all)
{
return global_shortest;
}
-
MAKE_SCHEME_CALLBACK (Spacing_spanner, set_springs, 1);
SCM
Spacing_spanner::set_springs (SCM smob)
Spacing_options options;
options.init_from_grob (me);
options.global_shortest_ = effective_shortest_duration (me, all);
-
+
prune_loose_columns (me, &all, &options);
set_implicit_neighbor_columns (all);
generate_springs (me, all, &options);
if (Paper_column::is_musical (left_col))
{
bool skip_unbroken_right = false;
-
+
if (!Paper_column::is_musical (right_col)
&& options->float_nonmusical_columns_
&& after_right_col
&& Paper_column::is_musical (after_right_col))
- {
- skip_unbroken_right = true;
- }
+ skip_unbroken_right = true;
if (skip_unbroken_right)
{
}
else
musical_column_spacing (me, left_col, right_col, options);
-
if (Item *rb = right_col->find_prebroken_piece (LEFT))
musical_column_spacing (me, left_col, rb, options);
if (left_col && right_col)
breakable_column_spacing (me, left_col, right_col, options);
-
+
if (lb && right_col)
breakable_column_spacing (me, lb, right_col, options);
{
bool expand_only = false;
Real base_note_space = note_spacing (me, left_col, right_col, options, &expand_only);
-
+
Real compound_note_space = 0.0;
Real compound_fixed_note_space = 0.0;
compound_fixed_note_space = min (compound_fixed_note_space,
compound_note_space);
}
-
+
Real inverse_strength = 1.0;
Real distance = 1.0;
{
compound_fixed = 0.0;
}
-
+
assert (!isinf (compound_space));
compound_space = max (compound_space, compound_fixed);
"gets 2 note heads width (i.e. the space following a note is 1 note\n"
"head width) A 16th note is followed by 0.5 note head width. The\n"
"quarter note is followed by 3 NHW, the half by 4 NHW, etc.\n",
-
+
"grace-space-factor spacing-increment base-shortest-duration strict-note-spacing "
"shortest-duration-space common-shortest-duration uniform-stretching "
"packed-spacing "
-
);
ADD_INTERFACE (Spacing_interface, "spacing-interface",
for (int j = 0; j < arpeggios_.size (); j++)
{
extract_grob_set (arpeggios_[j], "stems", stems);
- for (int i = stems.size() ; i--;)
+ for (int i = stems.size (); i--;)
Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("stems"),
stems[i]);
extract_grob_set (arpeggios_[j], "side-support-elements", sses);
- for (int i = sses.size() ; i--;)
+ for (int i = sses.size (); i--;)
Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("side-support-elements"),
sses[i]);
#include "translator.icc"
-ADD_ACKNOWLEDGER (Span_arpeggio_engraver,arpeggio);
+ADD_ACKNOWLEDGER (Span_arpeggio_engraver, arpeggio);
ADD_TRANSLATOR (Span_arpeggio_engraver,
/* doc */ "",
/* create */ "Arpeggio",
#include "grob.hh"
#include "pointer-group-interface.hh"
-
void
Span_bar::add_bar (Grob *me, Grob *b)
{
if (!model_bar)
model_bar = me;
-
+
extents.sort (&Interval::left_comparison);
Stencil span_bar;
- for (int i = 1; i < extents.size (); i ++)
+ for (int i = 1; i < extents.size (); i++)
{
- Interval prev_extent = extents[i-1];
- Interval ext = extents[i];
+ Interval prev_extent = extents[i - 1];
+ Interval ext = extents[i];
if (!prev_extent.is_empty ())
{
Interval l (prev_extent [UP],
}
span_bar.translate_axis (- me->relative_coordinate (refp, Y_AXIS),
- Y_AXIS);
+ Y_AXIS);
return span_bar.smobbed_copy ();
}
Grob *se = unsmob_grob (element_smob);
(void) scm_axis;
- assert ( (Axis) scm_to_int (scm_axis) == X_AXIS);
+ assert ((Axis) scm_to_int (scm_axis) == X_AXIS);
String gl = ly_scm2string (se->get_property ("glyph"));
/*
return;
extract_grob_set (me, "elements", elements);
- for (int i = elements.size();
- i-- && !scm_is_string (gl); )
+ for (int i = elements.size ();
+ i-- && !scm_is_string (gl);)
{
gl = elements[i]->get_property ("glyph");
}
ADD_TRANSLATOR (Span_dynamic_performer,
"", "",
"crescendo-event decrescendo-event",
- "", "");
+ "", "");
int
Spanner::compare (Spanner *const &p1, Spanner *const &p2)
{
- return p1->get_system ()->get_rank() - p2->get_system ()->get_rank();
+ return p1->get_system ()->get_rank () - p2->get_system ()->get_rank ();
}
bool
Spring_smob::mark_smob (SCM x)
{
(void)x;
-
+
return SCM_UNSPECIFIED;
}
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Staff_collecting_engraver,staff_symbol);
+ADD_ACKNOWLEDGER (Staff_collecting_engraver, staff_symbol);
ADD_TRANSLATOR (Staff_collecting_engraver,
/* doc */ "Maintain the stavesFound variable",
ADD_TRANSLATOR (Staff_performer, "", "",
"",
- "", "");
+ "", "");
Staff_performer::Staff_performer ()
{
{
Interval v;
if (Accidental_placement::has_interface (a))
- {
- v = Accidental_placement::get_relevant_accidental_extent (a, col, me);
- }
+ v = Accidental_placement::get_relevant_accidental_extent (a, col, me);
else
v = a->extent (col, X_AXIS);
Interval bar_size = bar_y_positions (last_grob);
Real max_corr = 0.0;
-
extract_grob_set (me, "right-items", right_items);
for (int i = right_items.size (); i--;)
{
max_corr = max (max_corr, next_note_correction (me, g, bar_size));
extract_grob_set (g, "elements", elts);
- for (int j = elts.size(); j--;)
+ for (int j = elts.size (); j--;)
max_corr = max (max_corr, next_note_correction (me, elts[j], bar_size));
}
Item *me_item = dynamic_cast<Item *> (me);
extract_grob_set (me, "left-items", items);
- for (int i = items.size(); i--;)
+ for (int i = items.size (); i--;)
{
Grob *cand = items[i];
if (cand && Separation_item::has_interface (cand))
Staff_symbol_engraver::Staff_symbol_engraver ()
{
finished_span_ = 0;
- first_start_ = true;
+ first_start_ = true;
span_ = 0;
span_events_[LEFT] = 0;
span_events_[RIGHT] = 0;
span_events_[d] = music;
return true;
}
-
+
return false;
}
/*
Todo: staff-symbol-referencer iface.
- */
+*/
void
Staff_symbol_engraver::acknowledge_grob (Grob_info s)
{
/*
Perhaps should try to take SeparationItem as bound of the staff
symbol?
- */
- if (span_ || finished_span_ )
+ */
+ if (span_ || finished_span_)
{
Spanner *my = span_ ? span_ : finished_span_;
s.grob ()->set_object ("staff-symbol", my->self_scm ());
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Staff_symbol_engraver,grob);
+ADD_ACKNOWLEDGER (Staff_symbol_engraver, grob);
ADD_TRANSLATOR (Staff_symbol_engraver,
/* doc */ "Create the constellation of five (default) "
"staff lines.",
lyrics_.clear ();
}
-ADD_ACKNOWLEDGER (Stanza_number_align_engraver,lyric_syllable);
-ADD_ACKNOWLEDGER (Stanza_number_align_engraver,stanza_number);
+ADD_ACKNOWLEDGER (Stanza_number_align_engraver, lyric_syllable);
+ADD_ACKNOWLEDGER (Stanza_number_align_engraver, stanza_number);
ADD_TRANSLATOR (Stanza_number_align_engraver,
"This engraver ensures that stanza numbers are neatly aligned. ",
"",
#include "translator.icc"
-ADD_ACKNOWLEDGER (Stanza_number_engraver,lyric_syllable);
+ADD_ACKNOWLEDGER (Stanza_number_engraver, lyric_syllable);
ADD_TRANSLATOR (Stanza_number_engraver,
/* doc */ "",
/* create */ "StanzaNumber",
*/
Music *music = gi.music_cause ();
Duration *dur = unsmob_duration (music->get_property ("duration"));
-
+
stem_->set_property ("duration-log", dur ? scm_from_int (dur->duration_log ()) : 0);
if (tremolo_ev_)
return;
Duration *d = unsmob_duration (cause->get_property ("duration"));
if (!d)
- return ;
-
+ return;
+
if (!stem_)
make_stem (gi);
-
+
if (Stem::duration_log (stem_) != d->duration_log ())
{
// FIXME:
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Stem_engraver,rhythmic_head);
+ADD_ACKNOWLEDGER (Stem_engraver, rhythmic_head);
ADD_TRANSLATOR (Stem_engraver,
/* doc */ "Create stems and single-stem tremolos. It also works together with "
"the beam engraver for overriding beaming.",
extract_grob_set (me, "note-heads", heads);
if (heads.size () == 1)
return heads[0];
-
+
return first_head (me);
}
Drul_array<Grob *> exthead (0, 0);
extract_grob_set (me, "note-heads", heads);
-
+
for (int i = heads.size (); i--;)
{
Grob *n = heads[i];
{
Array<int> ps;
extract_grob_set (me, "note-heads", heads);
-
+
for (int i = heads.size (); i--;)
{
Grob *n = heads[i];
}
else
{
- r = Interval (-1,1) * thickness (me) * 0.5;
+ r = Interval (-1, 1) * thickness (me) * 0.5;
r.unite (flag (me).extent (X_AXIS));
}
return ly_interval2scm (r);
y_ext.widen (0.5); // FIXME. Should be tunable?
minimum_length = max (minimum_length, y_ext.length ());
}
-
+
ideal_y *= my_dir;
Real minimum_y = note_start + minimum_length;
Real shortest_y = minimum_y * my_dir;
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "stencil.hh"
{
scm_set_object_property_x (symbol, ly_symbol2scm ("stencil-head?"), SCM_BOOL_T);
heads = scm_cons (symbol, heads);
-
}
bool
is_stencil_head (SCM symbol)
{
return heads;
}
-
+
/*
- stencil-interpret.cc -- implement Stencil expression interpreting
+ stencil-interpret.cc -- implement Stencil expression interpreting
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "stencil.hh"
SCM_VALIDATE_REST_ARGUMENT (args);
SCM expr = SCM_EOL;
- SCM *tail = &expr;
+ SCM *tail = &expr;
Box extent;
extent.set_empty ();
-
+
while (!SCM_NULLP (args))
{
Stencil *s = unsmob_stencil (scm_car (args));
if (!s)
SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil");
-
extent.unite (s->extent_box ());
*tail = scm_cons (s->expr (), SCM_EOL);
tail = SCM_CDRLOC (*tail);
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");
-
-
+
Box b (ly_scm2interval (xext), ly_scm2interval (yext));
Stencil s (b, expr);
return s.smobbed_copy ();
return find_expression_fonts (stil->expr ());
}
-
LY_DEFINE (ly_stencil_in_color, "ly:stencil-in-color",
4, 0, 0, (SCM stc, SCM r, SCM g, SCM b),
"Put @var{stc} in a different color.")
stil->expr ())).smobbed_copy ();
}
-
struct Stencil_interpret_arguments
{
SCM func;
}
-
LY_DEFINE (ly_register_stencil_expression, "ly:register-stencil-expression",
1, 0, 0,
(SCM symbol),
|| isnan (o[a])
// ugh, hardcoded.
- || fabs (o[a]) > 1e6)
+ || fabs (o[a]) > 1e6)
{
programming_error (String_convert::form_string ("Improbable offset for stencil: %f staff space", o[a])
+ "\n"
}
-
Stencil
Stencil::in_color (Real r, Real g, Real b) const
{
#include "performer.hh"
#include "music.hh"
-
class Swallow_performer : public Performer
{
public:
#include "pointer-group-interface.hh"
-
Stencil
System_start_delimiter::staff_bracket (Grob *me, Real height)
{
Real thickness = robust_scm2double (me->get_property ("thickness"), 0.25);
-
Real overlap = 0.1 * thickness;
-
+
Stencil bracket = Lookup::filled_box (Box (Interval (0, thickness),
Interval (-1, 1)
- * (height/2 + overlap)));
+ * (height / 2 + overlap)));
Direction d = DOWN;
do
{
bracket.add_at_edge (Y_AXIS, d, tips[d], -overlap, 0.0);
}
- while (flip (&d) != DOWN);
+ while (flip (&d) != DOWN);
return bracket;
}
-
Stencil
System_start_delimiter::simple_bar (Grob *me, Real h)
{
System_start_delimiter::after_line_breaking (SCM smob)
{
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
-
+
SCM gl = me->get_property ("glyph");
if (ly_is_equal (gl, scm_makfrom0str ("bar-line")))
{
int count = 0;
- Paper_column *left_column = me->get_bound (LEFT)->get_column ();
+ Paper_column *left_column = me->get_bound (LEFT)->get_column ();
#if 1 /* slur-script.ly test */
/*
for (int i = elts.size (); i--;)
{
- Spanner *staff = dynamic_cast<Spanner*> (elts[i]);
- if (!staff ||
- staff->get_bound (LEFT)->get_column () != left_column)
+ Spanner *staff = dynamic_cast<Spanner *> (elts[i]);
+ if (!staff
+ || staff->get_bound (LEFT)->get_column () != left_column)
continue;
-
+
Interval v = staff->extent (common, Y_AXIS);
-
+
if (!v.is_empty ())
count++;
}
if (count <= 1)
me->suicide ();
-#endif
+#endif
}
return SCM_UNSPECIFIED;
}
Interval ext;
- for (int i = elts.size(); i--;)
+ for (int i = elts.size (); i--;)
{
- Spanner *sp = dynamic_cast<Spanner*> (elts[i]);
+ Spanner *sp = dynamic_cast<Spanner *> (elts[i]);
if (sp
&& sp->get_bound (LEFT) == me->get_bound (LEFT))
{
fm = select_font (me->get_layout (), scm_list_n (alist, SCM_UNDEFINED));
int lo = 0;
- int hi = max (fm->count () - 1,2);
+ int hi = max (fm->count () - 1, 2);
Box b;
/* do a binary search for each Y, not very efficient, but passable? */
{
all_elements_ = 0;
rank_ = 0;
- init_elements ();
+ init_elements ();
}
System::System (SCM s, Object_key const *key)
{
all_elements_ = 0;
rank_ = 0;
- init_elements ();
+ init_elements ();
}
void
set_object ("all-elements", scm_arr);
}
-
Grob *
System::clone (int count) const
{
System::spanner_count () const
{
int k = 0;
- for (int i = all_elements_->size(); i--;)
+ for (int i = all_elements_->size (); i--;)
if (dynamic_cast<Spanner *> (all_elements_->grob (i)))
k++;
return k;
while (ptr < end)
{
scm_gc_mark ((*ptr)->self_scm ());
- ptr ++;
+ ptr++;
}
}
if (pscore_)
scm_gc_mark (pscore_->self_scm ());
-
+
Spanner::derived_mark ();
}
static void
fixup_refpoints (Link_array<Grob> const &grobs)
{
- for (int i = grobs.size (); i--; )
+ for (int i = grobs.size (); i--;)
{
grobs[i]->fixup_refpoint ();
}
SCM
System::get_paper_systems ()
{
- for (int i = 0; i < all_elements_->size(); i++)
+ for (int i = 0; i < all_elements_->size (); i++)
{
Grob *g = all_elements_->grob (i);
if (g->internal_has_interface (ly_symbol2scm ("only-prebreak-interface")))
for (int i = 0; i < broken_intos_.size (); i++)
{
Grob *se = broken_intos_[i];
-
+
extract_grob_set (se, "all-elements", all_elts);
- for (int j = 0; j < all_elts.size(); j++)
+ for (int j = 0; j < all_elts.size (); j++)
{
Grob *g = all_elts[j];
g->fixup_refpoint ();
}
-
+
count += all_elts.size ();
}
needed for doing items.
*/
fixup_refpoints (all_elements_->array ());
-
- for (int i = 0 ; i < all_elements_->size(); i++)
+
+ for (int i = 0; i < all_elements_->size (); i++)
all_elements_->grob (i)->handle_broken_dependencies ();
handle_broken_dependencies ();
-
+
#if 0 /* FIXME: strange side effects. */
/* Because the this->get_property (all-elements) contains items in 3
}
p->rank_
- = ga->size()
+ = ga->size ()
? Paper_column::get_rank (ga->array ().top ()) + 1
: 0;
-
+
ga->add (p);
Axis_group_interface::add_element (this, p);
}
void
System::pre_processing ()
{
- for (int i = 0 ; i < all_elements_->size(); i ++)
+ for (int i = 0; i < all_elements_->size (); i++)
all_elements_->grob (i)->discretionary_processing ();
-
if (be_verbose_global)
message (_f ("Grob count %d", element_count ()));
array, and should be processed before the original is potentially
killed.
*/
- for (int i = all_elements_->size(); i --; )
+ for (int i = all_elements_->size (); i--;)
all_elements_->grob (i)->handle_prebroken_dependencies ();
fixup_refpoints (all_elements_->array ());
- for (int i = 0 ; i < all_elements_->size(); i ++)
+ for (int i = 0; i < all_elements_->size (); i++)
apply_tweaks (all_elements_->grob (i), false);
- for (int i = 0 ; i < all_elements_->size(); i ++)
+ for (int i = 0; i < all_elements_->size (); i++)
all_elements_->grob (i)->calculate_dependencies (PRECALCED, PRECALCING,
ly_symbol2scm ("before-line-breaking-callback"));
message (_ ("Calculating line breaks..."));
progress_indication (" ");
-
- for (int i = 0 ; i < all_elements_->size(); i ++)
+
+ for (int i = 0; i < all_elements_->size (); i++)
{
Grob *e = all_elements_->grob (i);
SCM proc = e->get_property ("spacing-procedure");
void
System::post_processing ()
{
- for (int i = 0 ; i < all_elements_->size(); i ++)
+ for (int i = 0; i < all_elements_->size (); i++)
{
Grob *g = all_elements_->grob (i);
This might seem inefficient, but Stencils are cached per grob
anyway. */
-
Link_array<Grob> all_elts_sorted (all_elements_->array ());
all_elts_sorted.default_sort ();
all_elts_sorted.uniq ();
/* Output stencils in three layers: 0, 1, 2. Default layer: 1. */
for (int i = 0; i < LAYER_COUNT; i++)
- for (int j = all_elements_->size (); j --;)
+ for (int j = all_elements_->size (); j--;)
{
Grob *g = all_elements_->grob (j);
Stencil *stil = g->get_stencil ();
Interval staff_refpoints;
staff_refpoints.set_empty ();
extract_grob_set (this, "spaceable-staves", staves);
- for (int i = staves.size (); i--; )
+ for (int i = staves.size (); i--;)
{
Grob *g = staves[i];
staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS));
extract_grob_set (this, "columns", cols);
int i = 0;
- while (i < cols.size()
+ while (i < cols.size ()
&& cols[i] != left)
i++;
- if (i < cols.size())
- i ++;
-
- while (i < cols.size()
+ if (i < cols.size ())
+ i++;
+
+ while (i < cols.size ()
&& cols[i] != right)
{
Paper_column *c = dynamic_cast<Paper_column *> (cols[i]);
if (Item::is_breakable (c) && !c->system_)
ret.push (c);
- i++;
+ i++;
}
return ret;
int last_breakable = ro_columns.size ();
- while (last_breakable --)
+ while (last_breakable--)
{
if (Item::is_breakable (ro_columns [last_breakable]))
break;
#include "warn.hh"
#include "duration.hh"
-
/**
make (guitar-like) tablature note
*/
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "staff-symbol-engraver.hh"
#include "translator.icc"
-ADD_ACKNOWLEDGER (Tab_staff_symbol_engraver,grob);
+ADD_ACKNOWLEDGER (Tab_staff_symbol_engraver, grob);
ADD_TRANSLATOR (Tab_staff_symbol_engraver,
/* doc */ "Create a staff-symbol, but look at stringTunings for the number of lines."
"staff lines.",
ADD_TRANSLATOR (Tempo_performer, "", "",
"metronome-change-event",
- "", "");
+ "", "");
if (scm_hash_ref (text_dimension_hash_tab, key, SCM_BOOL_F)
== SCM_BOOL_F)
- {
- scm_hash_set_x (text_dimension_hash_tab, key, val);
- }
+ scm_hash_set_x (text_dimension_hash_tab, key, val);
}
return SCM_UNSPECIFIED;
}
#include "translator.icc"
-ADD_ACKNOWLEDGER (Text_spanner_engraver,note_column);
+ADD_ACKNOWLEDGER (Text_spanner_engraver, note_column);
ADD_TRANSLATOR (Text_spanner_engraver,
/* doc */ "Create text spanner from a Music.",
/* create */ "TextSpanner",
if (last_tie
&& Tie::get_column_rank (t, LEFT)
< Tie::get_column_rank (last_tie, LEFT))
- {
- d = DOWN;
- }
+ d = DOWN;
else if (last_down_pos - p > 5)
- {
- d = UP;
- }
+ d = UP;
else
- {
- d = DOWN;
- }
+ d = DOWN;
set_grob_direction (t, d);
}
{
if (dir * tie->get_bound (dir)->get_column ()->get_rank ()
> dir * me->get_bound (dir)->get_column ()->get_rank ())
- {
- me->set_bound (dir, Tie::head (tie, dir));
- }
+ me->set_bound (dir, Tie::head (tie, dir));
}
while (flip (&dir) != LEFT);
}
if (ties_.size ())
{
if (!to_boolean (get_property ("tieWaitForNote")))
- {
- heads_to_tie_.clear ();
- }
+ heads_to_tie_.clear ();
for (int i = 0; i < ties_.size (); i++)
- {
- typeset_tie (ties_[i]);
- }
+ typeset_tie (ties_[i]);
ties_.clear ();
tie_column_ = 0;
#include "audio-item.hh"
#include "pqueue.hh"
-
class Tie_performer : public Performer
{
Music *event_;
if (right_mus && left_mus
&& ly_is_equal (right_mus->get_property ("pitch"),
- left_mus->get_property ("pitch")))
+ left_mus->get_property ("pitch")))
{
an->tie_to (th);
ties_created_ = true;
Grob *dots = Rhythmic_head::get_dots (l);
if (fabs (staff_space * Staff_symbol_referencer::get_position (dots) / 2
- ypos) < 0.5)
- {
- ypos += 0.5 * dir;
- }
+ ypos += 0.5 * dir;
}
/*
we don't want horizontal ties
*/
if (fabs (newy - b.control_[0][Y_AXIS]) < 1e-2)
- {
- newy = newy + dir * staff_space;
- }
+ newy = newy + dir * staff_space;
}
Real y0 = b.control_ [0][Y_AXIS];
if (!scm_is_pair (cp))
return Stencil ().smobbed_copy ();
-
Real staff_thick = Staff_symbol_referencer::line_thickness (me);
Real base_thick = robust_scm2double (me->get_property ("thickness"), 1);
Real thick = base_thick * staff_thick;
-
Bezier b;
int i = 0;
for (SCM s = cp; s != SCM_EOL; s = scm_cdr (s))
get_grob_direction (me) * staff_thick,
thick);
-
return a.smobbed_copy ();
}
ADD_INTERFACE (Tie,
"tie-interface",
"A tie connecting two noteheads.\n",
-
+
"y-offset dash-period dash-fraction "
"staffline-clearance control-points head-pair "
"details thickness x-gap direction minimum-length");
TRANSLATOR_DECLARATIONS (Time_signature_engraver);
};
-
void
Time_signature_engraver::derived_mark () const
{
scm_gc_mark (last_time_fraction_);
}
-
Time_signature_engraver::Time_signature_engraver ()
{
time_signature_ = 0;
if /* neither C2/2 nor C4/4 */
(((n != 2) || (d != 2))
&& ((n != 4) || (d != 4)))
- {
- return numbered_time_signature (me, n, d);
- }
+ return numbered_time_signature (me, n, d);
}
String char_name = style + to_string (n) + to_string (d);
{
}
-
void
Timing_translator::start_translation_timestep ()
{
"this engraver should be removed from @code{Score} and placed in "
"@code{Staff}. "
"\n\nThis engraver adds the alias @code{Timing} to its containing context."
-
,
- "", "", "", "");
+ "", "", "", "");
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "translator-dispatch-list.hh"
#include "ly-smobs.icc"
-void
+void
Engraver_dispatch_list::apply (Grob_info gi)
{
Translator *origin = gi.origin_translator ();
{
Engraver_dispatch_entry const &e (dispatch_entries_[i]);
if (e.engraver_ == origin)
- continue;
+ continue;
(*e.function_) (e.engraver_, gi);
}
Engraver_dispatch_list::create (SCM trans_list,
SCM iface_list)
{
- SCM retval = Engraver_dispatch_list().smobbed_copy ();
- Engraver_dispatch_list * list = Engraver_dispatch_list::unsmob (retval);
+ SCM retval = Engraver_dispatch_list ().smobbed_copy ();
+ Engraver_dispatch_list *list = Engraver_dispatch_list::unsmob (retval);
Engraver_dispatch_entry entry;
- bool found = false;
+ bool found = false;
for (SCM s = trans_list; scm_is_pair (s); s = scm_cdr (s))
{
- Engraver * eng
- = dynamic_cast<Engraver*> (unsmob_translator (scm_car (s)));
+ Engraver *eng
+ = dynamic_cast<Engraver *> (unsmob_translator (scm_car (s)));
if (!eng)
continue;
entry.engraver_ = eng;
- for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i))
+ for (SCM i = iface_list; scm_is_pair (i); i = scm_cdr (i))
{
Engraver_void_function_engraver_grob_info ptr
= eng->get_acknowledger (scm_car (i));
list->dispatch_entries_.push (entry);
found = true;
}
-
}
}
-
return found ? retval : SCM_EOL;
}
return SCM_BOOL_F;
}
-
int
Engraver_dispatch_list::print_smob (SCM x, SCM p, scm_print_state *)
{
return 1;
}
-IMPLEMENT_SIMPLE_SMOBS(Engraver_dispatch_list);
-IMPLEMENT_DEFAULT_EQUAL_P(Engraver_dispatch_list);
+IMPLEMENT_SIMPLE_SMOBS (Engraver_dispatch_list);
+IMPLEMENT_DEFAULT_EQUAL_P (Engraver_dispatch_list);
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
-
#include "score-engraver.hh"
#include "score-performer.hh"
#include "engraver-group-engraver.hh"
/*
Quick & dirty.
- */
+*/
Translator_group *
get_translator_group (SCM sym)
{
if (sym == ly_symbol2scm ("Engraver_group_engraver"))
return new Engraver_group_engraver ();
else if (sym == ly_symbol2scm ("Performer_group_performer"))
- return new Performer_group_performer();
+ return new Performer_group_performer ();
else if (sym == ly_symbol2scm ("Score_engraver"))
- return new Score_engraver();
+ return new Score_engraver ();
else if (sym == ly_symbol2scm ("Score_performer"))
- return new Score_performer();
+ return new Score_performer ();
else if (sym == ly_symbol2scm ("Recording_group_engraver"))
- return new Recording_group_engraver();
+ return new Recording_group_engraver ();
assert (0);
return 0;
#include "main.hh"
#include "music.hh"
-
Translator_group *
Translator_group::get_daddy_translator () const
{
return simple_trans_list_;
}
-
void
precomputed_recurse_over_translators (Context *c, Translator_precompute_index idx, Direction dir)
{
Translator_group *tg
= dynamic_cast<Translator_group *> (c->implementation ());
-
+
if (dir == DOWN)
{
tg->precomputed_translator_foreach (idx);
tg->precomputed_translator_foreach (idx);
tg->call_precomputed_self_method (idx);
}
-
}
void
{
Translator_group *tg
= dynamic_cast<Translator_group *> (c->implementation ());
-
+
if (dir == DOWN)
{
(tg->*tg_ptr) ();
{
}
-
void
Translator_group::precompute_method_bindings ()
{
for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
{
if (ptrs[i])
- {
- precomputed_method_bindings_[i].push (Translator_method_binding (tr, ptrs[i]));
- }
+ precomputed_method_bindings_[i].push (Translator_method_binding (tr, ptrs[i]));
}
}
void
Translator_group::precomputed_translator_foreach (Translator_precompute_index idx)
{
- Array<Translator_method_binding> &bindings(precomputed_method_bindings_[idx]);
+ Array<Translator_method_binding> &bindings (precomputed_method_bindings_[idx]);
for (int i = 0; i < bindings.size (); i++)
{
bindings[i].invoke ();
Translator_group::call_precomputed_self_method (Translator_precompute_index idx)
{
if (precomputed_self_method_bindings_[idx])
- (*precomputed_self_method_bindings_[idx])(this);
+ (*precomputed_self_method_bindings_[idx]) (this);
}
-
Translator_group::~Translator_group ()
{
}
IMPLEMENT_DEFAULT_EQUAL_P (Translator_group);
IMPLEMENT_TYPE_P (Translator_group, "ly:translator-group?");
-
int
Translator_group::print_smob (SCM s, SCM port, scm_print_state *)
{
return 1;
}
-
SCM
Translator_group::mark_smob (SCM smob)
{
- Translator_group *me = (Translator_group*)SCM_CELL_WORD_1 (smob);
+ Translator_group *me = (Translator_group *)SCM_CELL_WORD_1 (smob);
me->derived_mark ();
scm_gc_mark (me->accept_hash_table_);
smobify_self ();
}
-
void
Translator::process_music ()
{
Acknowledge_information inf;
inf.function_ = ptr;
- String interface_name(func_name);
+ String interface_name (func_name);
interface_name = interface_name.substitute ('_', '-');
interface_name += "-interface";
Engraver_void_function_engraver_grob_info
generic_get_acknowledger (SCM sym, Array<Acknowledge_information> const *ack_array)
{
- for (int i = 0; i < ack_array->size(); i++)
+ for (int i = 0; i < ack_array->size (); i++)
{
if (ack_array->elem (i).symbol_ == sym)
- {
- return ack_array->elem(i).function_;
- }
+ return ack_array->elem (i).function_;
}
return 0;
}
-ADD_TRANSLATOR(Translator,
- "Base class. Unused",
- "",
- "",
- "",
- "");
+ADD_TRANSLATOR (Translator,
+ "Base class. Unused",
+ "",
+ "",
+ "",
+ "");
span_ = 0;
}
}
-ADD_ACKNOWLEDGER (Trill_spanner_engraver,note_column);
+ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column);
ADD_TRANSLATOR (Trill_spanner_engraver,
/* doc */ "Create trill spanner from a Music.",
/* create */ "TrillSpanner",
/*
- ttf.cc -- implement ttf -> pfa routine.
+ ttf.cc -- implement ttf -> pfa routine.
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "freetype.hh"
#include "lily-guile.hh"
#include "main.hh"
-
/*
Based on ttfps by Juliusz Chroboczek
- */
+*/
static void
print_header (void *out, FT_Face face)
{
lily_cookie_fprintf (out, "%%!PS-TrueTypeFont\n");
- TT_Postscript *pt =
- (TT_Postscript*) FT_Get_Sfnt_Table(face, ft_sfnt_post);
+ TT_Postscript *pt
+ = (TT_Postscript *) FT_Get_Sfnt_Table (face, ft_sfnt_post);
if (pt->maxMemType42)
lily_cookie_fprintf (out, "%%%%VMUsage: %ld %ld\n", 0, 0);
-
+
lily_cookie_fprintf (out, "%d dict begin\n", 11);
lily_cookie_fprintf (out, "/FontName /%s def\n",
- FT_Get_Postscript_Name (face));
+ FT_Get_Postscript_Name (face));
lily_cookie_fprintf (out, "/Encoding StandardEncoding def\n");
lily_cookie_fprintf (out, "/PaintType 0 def\n");
lily_cookie_fprintf (out, "/FontMatrix [1 0 0 1 0 0] def\n");
- TT_Header *ht =
- (TT_Header*)FT_Get_Sfnt_Table(face, ft_sfnt_head);
-
+ TT_Header *ht
+ = (TT_Header *)FT_Get_Sfnt_Table (face, ft_sfnt_head);
+
lily_cookie_fprintf (out, "/FontBBox [%ld %ld %ld %ld] def\n",
- ht->xMin * 1000L / ht->Units_Per_EM,
- ht->yMin * 1000L / ht->Units_Per_EM,
- ht->xMax * 1000L / ht->Units_Per_EM,
- ht->yMax * 1000L / ht->Units_Per_EM);
-
+ ht->xMin *1000L / ht->Units_Per_EM,
+ ht->yMin *1000L / ht->Units_Per_EM,
+ ht->xMax *1000L / ht->Units_Per_EM,
+ ht->yMax *1000L / ht->Units_Per_EM);
+
lily_cookie_fprintf (out, "/FontType 42 def\n");
lily_cookie_fprintf (out, "/FontInfo 8 dict dup begin\n");
lily_cookie_fprintf (out, "/version (%d.%d) def\n",
(ht->Font_Revision >> 16),
- (ht->Font_Revision & ((1 << 16) -1)));
+ (ht->Font_Revision &((1 << 16) -1)));
#if 0
if (strings[0])
lily_cookie_fprintf (out, ") def\n");
}
#endif
-
+
lily_cookie_fprintf (out, "/isFixedPitch %s def\n",
- pt->isFixedPitch ? "true" : "false");
+ pt->isFixedPitch ? "true" : "false");
lily_cookie_fprintf (out, "/UnderlinePosition %ld def\n",
- pt->underlinePosition * 1000L / ht->Units_Per_EM);
+ pt->underlinePosition *1000L / ht->Units_Per_EM);
lily_cookie_fprintf (out, "/UnderlineThickness %ld def\n",
- pt->underlineThickness * 1000L / ht->Units_Per_EM);
+ pt->underlineThickness *1000L / ht->Units_Per_EM);
lily_cookie_fprintf (out, "end readonly def\n");
}
-
#define CHUNKSIZE 65534
static void
print_body (void *out, String name)
{
FILE *fd = fopen (name.to_str0 (), "rb");
-
+
static char xdigits[] = "0123456789ABCDEF";
unsigned char *buffer;
if (j != 0 && j % 36 == 0)
lily_cookie_putc ('\n', out);
/* lily_cookie_fprintf (out,"%02X",(int)buffer[j]) is too slow */
- lily_cookie_putc (xdigits[(buffer[j] & 0xF0) >> 4], out);
+ lily_cookie_putc (xdigits[ (buffer[j] & 0xF0) >> 4], out);
lily_cookie_putc (xdigits[buffer[j] & 0x0F], out);
}
lily_cookie_fprintf (out, "00>"); /* Adobe bug? */
const int GLYPH_NAME_LEN = 256;
char glyph_name[GLYPH_NAME_LEN];
- TT_MaxProfile * mp =
- (TT_MaxProfile *)FT_Get_Sfnt_Table(face, ft_sfnt_maxp);
-
+ TT_MaxProfile *mp
+ = (TT_MaxProfile *)FT_Get_Sfnt_Table (face, ft_sfnt_maxp);
+
lily_cookie_fprintf (out, "/CharStrings %d dict dup begin\n", mp->numGlyphs);
for (int i = 0; i < mp->numGlyphs; i++)
{
else
lily_cookie_fprintf (out, "/%s %d def ", glyph_name, i);
- if (!(i % 5))
+ if (! (i % 5))
lily_cookie_fprintf (out, "\n");
}
lily_cookie_fprintf (out, "end readonly def\n");
create_type42_font (void *out, String name)
{
FT_Face face = open_ft_face (name);
-
+
print_header (out, face);
print_body (out, name);
print_trailer (out, face);
}
-
LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa",
1, 0, 0, (SCM ttf_file_name),
"Convert the contents of a TTF file to Type42 PFA, returning it as "
String file_name = ly_scm2string (ttf_file_name);
if (be_verbose_global)
progress_indication ("[" + file_name);
-
+
Memory_out_stream stream;
create_type42_font (&stream, file_name);
if (be_verbose_global)
progress_indication ("]");
-
+
return asscm;
}
static Item *
get_x_bound_item (Grob *me_grob, Direction hdir, Direction my_dir)
{
- Spanner *me = dynamic_cast<Spanner*> (me_grob);
+ Spanner *me = dynamic_cast<Spanner *> (me_grob);
Item *g = me->get_bound (hdir);
if (Note_column::has_interface (g)
&& Note_column::get_stem (g)
Grob *s1 = Note_column::get_stem (cols[0]);
Grob *s2 = Note_column::get_stem (cols.top ());
-
if (s2 != me->get_bound (RIGHT))
return 0;
Grob *b1 = s1 ? Stem::get_beam (s1) : 0;
Grob *b2 = s2 ? Stem::get_beam (s2) : 0;
-
*equally_long = false;
if (! (b1 && (b1 == b2) && !me->is_broken ()))
return 0;
{
/*
UGH. dependency tracking!
- */
+ */
extract_grob_set (me, "tuplets", tuplets);
for (int i = 0; i < tuplets.size (); i++)
- Tuplet_bracket::print (tuplets[i]->self_scm());
+ Tuplet_bracket::print (tuplets[i]->self_scm ());
after_line_breaking (smob);
}
{
x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[d];
Direction break_dir = bounds[d]->break_status_dir ();
- Spanner *orig_spanner = dynamic_cast<Spanner*> (me->original_);
+ Spanner *orig_spanner = dynamic_cast<Spanner *> (me->original_);
connect_to_other[d]
= (break_dir
- && (me->get_break_index() - break_dir < orig_spanner->broken_intos_.size()));
+ && (me->get_break_index () - break_dir < orig_spanner->broken_intos_.size ()));
if (connect_to_other[d])
{
if (d == RIGHT)
x_span[d] += d * overshoot[d];
else
- x_span[d] = robust_relative_extent(bounds[d], commonx, X_AXIS)[RIGHT]
+ x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[RIGHT]
- overshoot[LEFT];
}
else if (d == RIGHT
&& (columns.is_empty ()
- || (bounds[d]->get_column ()
- != dynamic_cast<Item*> (columns.top())->get_column ())))
+ || (bounds[d]->get_column ()
+ != dynamic_cast<Item *> (columns.top ())->get_column ())))
{
/*
TODO: make padding tunable?
- */
+ */
x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS) [LEFT] - 1.0;
}
}
while (flip (&d) != LEFT);
- Real w = x_span.length();
+ Real w = x_span.length ();
SCM number = me->get_property ("text");
Output_def *pap = me->get_layout ();
}
while (flip (&d) != LEFT);
-
Stencil brack = make_bracket (me, Y_AXIS,
Offset (w, ry - ly),
height,
}
while (flip (&d) != LEFT);
-
mol.add_stencil (brack);
}
}
}
-
/*
use first -> last note for slope, and then correct for disturbing
notes in between. */
void
Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy)
{
- Spanner *me = dynamic_cast<Spanner*> (me_grob);
+ Spanner *me = dynamic_cast<Spanner *> (me_grob);
extract_grob_set (me, "note-columns", columns);
extract_grob_set (me, "tuplets", tuplets);
Let's not take padding into account for nested tuplets.
the edges can come very close to the stems, likewise for
nested tuplets?
- */
+ */
Drul_array<Real> my_height
= robust_scm2drul (me->get_property ("edge-height"),
Interval (0, 0));
- if (dynamic_cast<Spanner*> (tuplets[i])->get_bound (d)
- == me->get_bound (d))
- {
- y += dir * my_height[d];
- }
+ if (dynamic_cast<Spanner *> (tuplets[i])->get_bound (d)
+ == me->get_bound (d))
+ y += dir * my_height[d];
#endif
points.push (Offset (tuplet_x[d] - x0, y));
{
Drul_array<int> dirs (0, 0);
extract_grob_set (me, "note-columns", columns);
- for (int i = 0 ; i < columns.size (); i++)
+ for (int i = 0; i < columns.size (); i++)
{
Grob *nc = columns[i];
Direction d = Note_column::dir (nc);
}
-
ADD_INTERFACE (Tuplet_bracket,
"tuplet-bracket-interface",
"A bracket with a number in the middle, used for tuplets. "
};
-
class Tuplet_engraver : public Engraver
{
public:
{
if (!tuplets_.size ())
return;
-
tuplets_.sort (&Tuplet_description::compare);
for (int i = 0; i < tuplets_.size (); i++)
tuplets_[i].music_->self_scm ());
tuplets_[i].spanner_ = spanner;
- if (i > 0 && tuplets_[i-1].spanner_)
- Tuplet_bracket::add_tuplet_bracket (tuplets_[i].spanner_, tuplets_[i-1].spanner_);
- if (i < tuplets_.size()-1 && tuplets_[i+1].spanner_)
- Tuplet_bracket::add_tuplet_bracket (tuplets_[i+1].spanner_, tuplets_[i].spanner_);
+ if (i > 0 && tuplets_[i - 1].spanner_)
+ Tuplet_bracket::add_tuplet_bracket (tuplets_[i].spanner_, tuplets_[i - 1].spanner_);
+ if (i < tuplets_.size () - 1 && tuplets_[i + 1].spanner_)
+ Tuplet_bracket::add_tuplet_bracket (tuplets_[i + 1].spanner_, tuplets_[i].spanner_);
SCM proc = get_property ("tupletNumberFormatFunction");
if (ly_is_procedure (proc))
Moment now = now_mom ();
last_tuplets_.clear ();
- if (tuplets_.is_empty())
+ if (tuplets_.is_empty ())
return;
Moment tsdmom = robust_scm2moment (get_property ("tupletSpannerDuration"), Moment (0));
{
if (tuplets_[i].spanner_)
{
- if (full_length )
+ if (full_length)
{
- Item * col = unsmob_item (get_property ("currentMusicalColumn"));
-
+ Item *col = unsmob_item (get_property ("currentMusicalColumn"));
+
tuplets_[i].spanner_->set_bound (RIGHT, col);
}
else if (!tuplets_[i].spanner_->get_bound (RIGHT))
}
if (now.main_part_ >= tuplets_[i].stop_)
- {
- tuplets_.del (i);
- }
+ tuplets_.del (i);
}
}
{
for (int i = 0; i < last_tuplets_.size (); i++)
{
- Item * col = unsmob_item (get_property ("currentCommandColumn"));
+ Item *col = unsmob_item (get_property ("currentCommandColumn"));
last_tuplets_[i]->set_bound (RIGHT, col);
}
}
{
}
-ADD_ACKNOWLEDGER (Tuplet_engraver,note_column);
+ADD_ACKNOWLEDGER (Tuplet_engraver, note_column);
ADD_TRANSLATOR (Tuplet_engraver,
/* doc */ "Catch Time_scaled_music and generate appropriate bracket ",
/* create */ "TupletBracket",
/* accept */ "time-scaled-music",
- /* read */ "tupletNumberFormatFunction tupletSpannerDuration tupletFullLength" ,
+ /* read */ "tupletNumberFormatFunction tupletSpannerDuration tupletFullLength",
/* write */ "");
"",
"note-event",
"",
-
+
"");
/*
unfolded-repeat-iterator.cc -- implement Unfolded_repeat_iterator
-
+
source file of the GNU LilyPond music typesetter
(c) 2002--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
{
SCM delta_pitch_scm = prev_primitive->get_property ("delta-pitch");
if (delta_pitch_scm != SCM_EOL)
- {
- delta_pitch = scm_to_int (delta_pitch_scm);
- }
+ delta_pitch = scm_to_int (delta_pitch_scm);
else
{
primitive->programming_error ("Vaticana_ligature:"
int delta_pitch;
SCM delta_pitch_scm = primitive->get_property ("delta-pitch");
if (delta_pitch_scm != SCM_EOL)
- {
- delta_pitch = scm_to_int (delta_pitch_scm);
- }
+ delta_pitch = scm_to_int (delta_pitch_scm);
else
{
primitive->programming_error ("Vaticana_ligature:"
prev_primitive->set_property ("add-cauda",
ly_bool2scm (false));
}
- if (prev_delta_pitch < - 1)
- {
- glyph_name = "svaticana.reverse.plica";
- }
- else
- {
- glyph_name = "svaticana.reverse.vplica";
- }
+ if (prev_delta_pitch < - 1)
+ {
+ glyph_name = "svaticana.reverse.plica";
+ }
+ else
+ {
+ glyph_name = "svaticana.reverse.vplica";
+ }
}
else // (prev_delta_pitch == 0)
{
{
Spanner *valign_;
bool qualifies (Grob_info) const;
- SCM id_to_group_hashtab_;
-
+ SCM id_to_group_hashtab_;
+
public:
TRANSLATOR_DECLARATIONS (Vertical_align_engraver);
DECLARE_ACKNOWLEDGER (axis_group);
/* read */ "",
/* write */ "");
-
Vertical_align_engraver::Vertical_align_engraver ()
{
valign_ = 0;
void
Vertical_align_engraver::derived_mark () const
{
- scm_gc_mark (id_to_group_hashtab_);
+ scm_gc_mark (id_to_group_hashtab_);
}
void
id_to_group_hashtab_ = scm_c_make_hash_table (11);
}
-
void
Vertical_align_engraver::process_music ()
{
scm_hash_set_x (id_to_group_hashtab_, scm_makfrom0str (id.to_str0 ()),
i.grob ()->self_scm ());
-
SCM before_id = i.context ()->get_property ("alignAboveContext");
SCM after_id = i.context ()->get_property ("alignBelowContext");
-
- SCM before = scm_hash_ref (id_to_group_hashtab_, before_id, SCM_BOOL_F);
- SCM after = scm_hash_ref (id_to_group_hashtab_, after_id, SCM_BOOL_F);
- Grob * before_grob = unsmob_grob (before);
- Grob * after_grob = unsmob_grob (after);
-
+ SCM before = scm_hash_ref (id_to_group_hashtab_, before_id, SCM_BOOL_F);
+ SCM after = scm_hash_ref (id_to_group_hashtab_, after_id, SCM_BOOL_F);
+
+ Grob *before_grob = unsmob_grob (before);
+ Grob *after_grob = unsmob_grob (after);
+
Align_interface::add_element (valign_, i.grob (),
get_property ("verticalAlignmentChildCallback"));
if (before_grob || after_grob)
{
- Grob_array * ga = unsmob_grob_array (valign_->get_object ("elements"));
+ Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
Link_array<Grob> &arr = ga->array_reference ();
-
- Grob *added = arr.pop();
- for (int i = 0 ; i < arr.size (); i++)
+
+ Grob *added = arr.pop ();
+ for (int i = 0; i < arr.size (); i++)
{
if (arr[i] == before_grob)
{
arr.insert (added, i);
- break ;
+ break;
}
else if (arr[i] == after_grob)
{
arr.insert (added, i + 1);
- break ;
+ break;
}
}
}
source file of the GNU LilyPond music typesetter
(c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
#include "engraver.hh"
class Vertically_spaced_contexts_engraver : public Engraver
{
- TRANSLATOR_DECLARATIONS(Vertically_spaced_contexts_engraver);
+ TRANSLATOR_DECLARATIONS (Vertically_spaced_contexts_engraver);
protected:
virtual void initialize ();
DECLARE_ACKNOWLEDGER (vertically_spaceable);
};
-
Vertically_spaced_contexts_engraver::Vertically_spaced_contexts_engraver ()
{
system_ = 0;
bool no_vertical_end = orig_span && !broken_last_bracket;
extract_grob_set (me, "bars", bars);
- Grob *endbar = bars.size() ? bars.top () : 0;
+ Grob *endbar = bars.size () ? bars.top () : 0;
SCM glyph = endbar ? endbar->get_property ("glyph") : SCM_EOL;
String str;
DECLARE_ACKNOWLEDGER (staff_symbol);
DECLARE_ACKNOWLEDGER (note_column);
DECLARE_ACKNOWLEDGER (bar_line);
-
+
virtual void finalize ();
virtual void derived_mark () const;
void stop_translation_timestep ();
void process_music ();
-
+
Moment started_mom_;
Spanner *volta_span_;
Spanner *end_volta_span_;
Volta_engraver::acknowledge_note_column (Grob_info i)
{
if (volta_span_)
- Volta_bracket_interface::add_column (volta_span_, i.grob());
+ Volta_bracket_interface::add_column (volta_span_, i.grob ());
}
void
if (end_volta_span_)
Volta_bracket_interface::add_bar (end_volta_span_, i.item ());
}
-
+
void
Volta_engraver::acknowledge_staff_symbol (Grob_info i)
{
(c) 2002--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
#include "music.hh"
#include "sequential-iterator.hh"
#include "context.hh"