+2004-06-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * lily/paper-score.cc (process): Do not show progress newline.
+
+ * lily/paper-book.cc (output, classic_output): Show progess
+ newline after score.
+
2004-06-14 Heikki Junes <hjunes@cc.hut.fi>
* buildscripts/lilypond-words.py: add ly/vlaams.ly
2004-06-14 Jan Nieuwenhuizen <janneke@gnu.org>
+ * lily/score.cc (ly:run-translator): Do not crash on empty music
+ list.
+
+ * lily/book.cc (process): Do not render score when systems is empty.
+
* input/simple-song.ly: Down one octave.
* scm/output-gnome.scm: Remove script again; re-add modules fix
/*
book-paper-def.cc -- implement Output_def
-
+
source file of the GNU LilyPond music typesetter
-
+
(c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
*/
-#include "ly-module.hh"
-#include "output-def.hh"
#include "dimensions.hh"
-#include "ly-smobs.icc"
#include "font-metric.hh"
-#include "virtual-font-metric.hh"
+#include "ly-module.hh"
+#include "output-def.hh"
#include "scaled-font-metric.hh"
+#include "virtual-font-metric.hh"
Real
-output_scale (Output_def * od)
+output_scale (Output_def *od)
{
return ly_scm2double (od->lookup_variable (ly_symbol2scm ("outputscale")));
}
-/*
- TODO: should add nesting for Output_def here too.
- */
-Font_metric*
-find_scaled_font (Output_def * mod,
+/* TODO: should add nesting for Output_def here too. */
+Font_metric *
+find_scaled_font (Output_def *mod,
Font_metric *f, Real m, SCM input_enc_name)
{
if (mod->parent_)
- {
- return find_scaled_font (mod->parent_,
- f, m, input_enc_name);
- }
+ return find_scaled_font (mod->parent_, f, m, input_enc_name);
Real lookup_mag = m;
if (!dynamic_cast<Virtual_font_metric*> (f))
SCM val = SCM_EOL;
if (Virtual_font_metric * vf = dynamic_cast<Virtual_font_metric*> (f))
{
- /*
- For fontify_atom (), the magnification and name must be known
- at the same time. That's impossible for
-
- Scaled (Virtual_font (Font1,Font2))
-
- so we replace by
-
- Virtual_font (Scaled (Font1), Scaled (Font2))
-
- */
-
+ /* For fontify_atom (), the magnification and name must be known
+ at the same time. That's impossible for
+
+ Scaled (Virtual_font (Font1,Font2))
+
+ so we replace by
+
+ Virtual_font (Scaled (Font1), Scaled (Font2)) */
SCM lst = SCM_EOL;
SCM *t = &lst;
for (SCM s = vf->get_font_list (); ly_c_pair_p (s); s = ly_cdr (s))
{
if (!ly_c_symbol_p (input_enc_name))
{
- SCM var = ly_module_lookup (mod->scope_, ly_symbol2scm ("inputencoding"));
+ SCM var = ly_module_lookup (mod->scope_,
+ ly_symbol2scm ("inputencoding"));
if (var != SCM_BOOL_F)
input_enc_name = scm_variable_ref (var);
if (!ly_c_symbol_p (input_enc_name))
return unsmob_metrics (val);
}
-/*
- TODO: this is a nasty interface. During formatting,
- the Output_def should be scaled to the output_scale_
- specified in the toplevel Output_def.
- */
-Output_def*
-scale_output_def (Output_def * o, Real amount)
+/* TODO: this is a nasty interface. During formatting,
+ the Output_def should be scaled to the output_scale_
+ specified in the toplevel Output_def. */
+Output_def *
+scale_output_def (Output_def *o, Real amount)
{
SCM proc = ly_scheme_function ("scale-paper");
- SCM new_pap = scm_call_2 (proc, o->self_scm (),
- scm_double2num (amount));
+ SCM new_pap = scm_call_2 (proc, o->self_scm (), scm_double2num (amount));
scm_gc_protect_object (new_pap);
return unsmob_output_def (new_pap);
s = ly_cdr (s))
{
SCM entry = ly_car (s);
- for (SCM t = ly_cdr (entry); ly_c_pair_p (t); t = ly_cdr (t))
+ for (SCM t = ly_cdr (entry); ly_c_pair_p (t); t = ly_cdr (t))
{
Font_metric *fm = unsmob_metrics (ly_cdar (t));
#include <stdio.h>
-
-#include "ly-smobs.icc"
-#include "stencil.hh"
#include "book.hh"
#include "global-context.hh"
#include "ly-module.hh"
#include "main.hh"
#include "music-iterator.hh"
-#include "output-def.hh"
#include "music-output.hh"
#include "music.hh"
-#include "paper-book.hh"
#include "output-def.hh"
+#include "paper-book.hh"
#include "score.hh"
+#include "stencil.hh"
#include "warn.hh"
Book::Book ()
{
}
+#include "ly-smobs.icc"
IMPLEMENT_SMOBS (Book);
IMPLEMENT_DEFAULT_EQUAL_P (Book);
return 1;
}
-/*
- This function does not dump the output; outname is required eg. for
- dumping header fields.
- */
+/* This function does not dump the output; outname is required eg. for
+ dumping header fields. */
Paper_book *
Book::process (String outname, Output_def *default_def)
{
SCM systems = scores_[i]->book_rendering (outname,
paper_book->bookpaper_,
default_def);
- if (systems != SCM_UNDEFINED)
+
+ /* If the score is empty, generate no output. Should we
+ do titling? */
+ if (systems != SCM_EOL
+ /* FIXME: can systems be SCM_UNDEFINED at all?
+ it seesm to be initialise with SCM_EOL and only gets assigned
+ non-SCM_UNDEFINED values -- jcn */
+ && systems != SCM_UNDEFINED)
{
Score_lines sc;
sc.lines_ = systems;
sc.header_ = header_;
-
paper_book->score_lines_.push (sc);
}
}
/*
translator-def.cc -- implement Context_def
-
+
source file of the GNU LilyPond music typesetter
-
+
(c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
+*/
-/*
- TODO: should junk this class an replace by
- a single list of context modifications?
- */
+/* TODO: should junk this class an replace by
+ a single list of context modifications? */
-#include "lily-proto.hh"
#include "context-def.hh"
-#include "translator-group.hh"
-#include "warn.hh"
+#include "engraver.hh"
+#include "lily-proto.hh"
#include "output-def.hh"
-#include "ly-smobs.icc"
-#include "score-context.hh"
-
#include "performer.hh"
-#include "engraver.hh"
-
-int
-Context_def::print_smob (SCM smob, SCM port, scm_print_state*)
-{
- Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob);
-
- scm_puts ("#<Context_def ", port);
- scm_display (me->context_name_, port);
- scm_puts (">", port);
- return 1;
-}
-
-
-SCM
-Context_def::mark_smob (SCM smob)
-{
- Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob);
-
- scm_gc_mark (me->description_);
- scm_gc_mark (me->context_aliases_);
- scm_gc_mark (me->accept_mods_);
- scm_gc_mark (me->translator_mods_);
- scm_gc_mark (me->property_ops_);
- scm_gc_mark (me->translator_group_type_);
-
- return me->context_name_;
-}
-
+#include "score-context.hh"
+#include "translator-group.hh"
+#include "warn.hh"
Context_def::Context_def ()
{
context_name_ = ly_symbol2scm ("");
}
-Context_def::~Context_def ()
-{
-}
-
Context_def::Context_def (Context_def const & s)
: Input (s)
{
context_name_ = s.context_name_;
}
+Context_def::~Context_def ()
+{
+}
+
+#include "ly-smobs.icc"
+IMPLEMENT_SMOBS (Context_def);
+IMPLEMENT_DEFAULT_EQUAL_P (Context_def);
+
+int
+Context_def::print_smob (SCM smob, SCM port, scm_print_state*)
+{
+ Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob);
+
+ scm_puts ("#<Context_def ", port);
+ scm_display (me->context_name_, port);
+ scm_puts (">", port);
+ return 1;
+}
+
+SCM
+Context_def::mark_smob (SCM smob)
+{
+ Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob);
+
+ scm_gc_mark (me->description_);
+ scm_gc_mark (me->context_aliases_);
+ scm_gc_mark (me->accept_mods_);
+ scm_gc_mark (me->translator_mods_);
+ scm_gc_mark (me->property_ops_);
+ scm_gc_mark (me->translator_group_type_);
+
+ return me->context_name_;
+}
void
Context_def::add_context_mod (SCM mod)
{
- SCM tag = ly_car (mod);
- if (ly_symbol2scm ("description") == tag)
+ SCM tag = ly_car (mod);
+ if (ly_symbol2scm ("description") == tag)
{
description_ = ly_cadr (mod);
- return ;
+ return;
}
SCM sym = ly_cadr (mod);
|| ly_symbol2scm ("remove") == tag)
{
if (!get_translator (sym))
- error (_f ("Program has no such type: `%s'", ly_symbol2string (sym).to_str0 ()));
+ error (_f ("Program has no such type: `%s'",
+ ly_symbol2string (sym).to_str0 ()));
else
- translator_mods_ = scm_cons (scm_list_2 (tag, sym), translator_mods_ );
+ translator_mods_ = scm_cons (scm_list_2 (tag, sym), translator_mods_);
}
else if (ly_symbol2scm ("accepts") == tag
|| ly_symbol2scm ("denies") == tag)
- {
- accept_mods_ = scm_cons (scm_list_2 (tag, sym), accept_mods_);
- }
+ accept_mods_ = scm_cons (scm_list_2 (tag, sym), accept_mods_);
else if (ly_symbol2scm ("poppush") == tag
|| ly_symbol2scm ("pop") == tag
|| ly_symbol2scm ("push") == tag
|| ly_symbol2scm ("assign") == tag
|| ly_symbol2scm ("unset") == tag)
- {
- property_ops_ = scm_cons (mod, property_ops_);
- }
+ property_ops_ = scm_cons (mod, property_ops_);
else if (ly_symbol2scm ("alias") == tag)
- {
- context_aliases_ = scm_cons (sym, context_aliases_);
- }
+ context_aliases_ = scm_cons (sym, context_aliases_);
else if (ly_symbol2scm ("translator-type") == tag)
- {
- translator_group_type_ = sym;
- }
+ translator_group_type_ = sym;
else if (ly_symbol2scm ("context-name") == tag)
- {
- context_name_ = sym;
- }
+ context_name_ = sym;
else
- {
- programming_error ("Unknown context mod tag.");
- }
+ programming_error ("Unknown context mod tag.");
}
-
-
SCM
Context_def::get_context_name () const
{
SCM
Context_def::get_accepted (SCM user_mod) const
{
- SCM mods = scm_reverse_x (scm_list_copy (accept_mods_),
- user_mod);
+ SCM mods = scm_reverse_x (scm_list_copy (accept_mods_), user_mod);
SCM acc = SCM_EOL;
for (SCM s = mods; ly_c_pair_p (s); s = ly_cdr (s))
{
return acc;
}
-
Link_array<Context_def>
-Context_def::path_to_acceptable_context (SCM type_sym, Output_def* odef) const
+Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const
{
assert (ly_c_symbol_p (type_sym));
Link_array<Context_def> accepteds;
for (SCM s = accepted; ly_c_pair_p (s); s = ly_cdr (s))
- {
- Context_def *t = unsmob_context_def (find_context_def (odef, ly_car (s)));
- if (!t)
- continue;
+ if (Context_def *t = unsmob_context_def (find_context_def (odef,
+ ly_car (s))))
accepteds.push (t);
- }
Link_array<Context_def> best_result;
for (int i=0; i < accepteds.size (); i++)
{
- /*
- don't check aliases, because \context Staff should not create RhythmicStaff.
- */
+ /* do not check aliases, because \context Staff should not
+ create RhythmicStaff. */
if (ly_c_equal_p (accepteds[i]->get_context_name (), type_sym))
{
best_result.push (accepteds[i]);
return best_result;
}
}
-
+
int best_depth= INT_MAX;
for (int i=0; i < accepteds.size (); i++)
{
result.insert (g,0);
best_result = result;
- /*
- this following line was added in 1.9.3, but hsould've been
- there all along... Let's hope it doesn't cause nightmares.
- */
+ /* this following line was added in 1.9.3, but hsould've been
+ there all along... Let's hope it doesn't cause nightmares. */
best_depth = result.size ();
}
}
return best_result;
}
-IMPLEMENT_SMOBS (Context_def);
-IMPLEMENT_DEFAULT_EQUAL_P (Context_def);
-
-
SCM
Context_def::get_translator_names (SCM user_mod) const
{
SCM l1 = SCM_EOL;
SCM l2 = SCM_EOL;
- SCM mods = scm_reverse_x (scm_list_copy (translator_mods_),
- user_mod);
+ SCM mods = scm_reverse_x (scm_list_copy (translator_mods_), user_mod);
for (SCM s = mods; ly_c_pair_p (s); s = ly_cdr (s))
{
l2 = scm_delete_x (arg, l2);
}
}
-
return scm_append_x (scm_list_2 (l1, l2));
}
-
SCM
-filter_performers (SCM l)
+filter_performers (SCM ell)
{
- for (SCM *tail = &l; ly_c_pair_p (*tail); tail = SCM_CDRLOC (*tail))
+ for (SCM *tail = ℓ ly_c_pair_p (*tail); tail = SCM_CDRLOC (*tail))
{
if (dynamic_cast<Performer*> (unsmob_translator (ly_car (*tail))))
{
break ;
}
}
- return l;
+ return ell;
}
-
SCM
-filter_engravers (SCM l)
+filter_engravers (SCM ell)
{
- SCM *tail = &l;
+ SCM *tail = ℓ
for (; ly_c_pair_p (*tail) ; tail = SCM_CDRLOC (*tail))
{
if (dynamic_cast<Engraver*> (unsmob_translator (ly_car (*tail))))
break ;
}
}
- return l;
+ return ell;
}
Context *
Context_def::instantiate (SCM ops)
{
- Context * tg = 0;
+ Context *tg = 0;
if (context_name_ == ly_symbol2scm ("Score"))
tg = new Score_context ();
SCM trans_names = get_translator_names (ops);
- Translator * g = get_translator (translator_group_type_);
+ Translator *g = get_translator (translator_group_type_);
g = g->clone ();
- g->simple_trans_list_ = SCM_EOL;
+ g->simple_trans_list_ = SCM_EOL;
for (SCM s = trans_names; ly_c_pair_p (s) ; s = ly_cdr (s))
{
- Translator * t = get_translator (ly_car (s));
+ Translator *t = get_translator (ly_car (s));
if (!t)
warning (_f ("can't find: `%s'", s));
else
{
- Translator * tr = t->clone ();
+ Translator *tr = t->clone ();
SCM str = tr->self_scm ();
g->simple_trans_list_ = scm_cons (str, g->simple_trans_list_);
tr->daddy_context_ = tg;
scm_gc_unprotect_object (str);
}
}
-
-
tg->implementation_ = g->self_scm ();
if (dynamic_cast<Engraver*> (g))
return tg;
}
-
SCM
Context_def::clone_scm () const
{
Context_def * t = new Context_def (*this);
-
SCM x = t->self_scm ();
scm_gc_unprotect_object (x);
return x;
Context_def::make_scm ()
{
Context_def* t = new Context_def;
-
- SCM x =t->self_scm ();
+ SCM x = t->self_scm ();
scm_gc_unprotect_object (x);
return x;
}
void
Context_def::apply_default_property_operations (Context *tg)
{
- apply_property_operations (tg , property_ops_);
+ apply_property_operations (tg, property_ops_);
}
SCM
Context_def::to_alist () const
{
- SCM l = SCM_EOL;
-
- l = scm_cons (scm_cons (ly_symbol2scm ("consists"),
- get_translator_names (SCM_EOL)), l);
- l = scm_cons (scm_cons (ly_symbol2scm ("description"), description_), l);
- l = scm_cons (scm_cons (ly_symbol2scm ("aliases"), context_aliases_), l);
- l = scm_cons (scm_cons (ly_symbol2scm ("accepts"), get_accepted (SCM_EOL)), l);
- l = scm_cons (scm_cons (ly_symbol2scm ("property-ops"), property_ops_), l);
- l = scm_cons (scm_cons (ly_symbol2scm ("context-name"), context_name_), l);
+ SCM ell = SCM_EOL;
+
+ ell = scm_cons (scm_cons (ly_symbol2scm ("consists"),
+ get_translator_names (SCM_EOL)), ell);
+ ell = scm_cons (scm_cons (ly_symbol2scm ("description"), description_), ell);
+ ell = scm_cons (scm_cons (ly_symbol2scm ("aliases"), context_aliases_), ell);
+ ell = scm_cons (scm_cons (ly_symbol2scm ("accepts"), get_accepted (SCM_EOL)),
+ ell);
+ ell = scm_cons (scm_cons (ly_symbol2scm ("property-ops"), property_ops_),
+ ell);
+ ell = scm_cons (scm_cons (ly_symbol2scm ("context-name"), context_name_),
+ ell);
if (ly_c_symbol_p (translator_group_type_))
- l = scm_cons (scm_cons (ly_symbol2scm ("group-type"), translator_group_type_), l);
-
- return l;
+ ell = scm_cons (scm_cons (ly_symbol2scm ("group-type"),
+ translator_group_type_), ell);
+ return ell;
}
return SCM_BOOL_F;
}
-LY_DEFINE (duration_less, "ly:duration<?",
+LY_DEFINE (ly_duration_less_p, "ly:duration<?",
2, 0, 0, (SCM p1, SCM p2),
"Is @var{p1} shorter than @var{p2}?")
{
return SCM_BOOL_F;
}
-LY_DEFINE (make_duration, "ly:make-duration",
+LY_DEFINE (ly_make_duration, "ly:make-duration",
1, 3, 0, (SCM length, SCM dotcount, SCM num, SCM den),
"@var{length} is the negative logarithm (base 2) of the duration:\n"
"1 is a half note, 2 is a quarter note, 3 is an eighth\n"
return p.smobbed_copy ();
}
-LY_DEFINE (duration_log, "ly:duration-log",
+LY_DEFINE (ly_duration_log, "ly:duration-log",
1, 0, 0, (SCM dur),
"Extract the duration log from @var{dur}")
{
return scm_int2num (unsmob_duration (dur)->duration_log ());
}
-LY_DEFINE (dot_count_log, "ly:duration-dot-count", 1, 0, 0, (SCM dur),
- "Extract the dot count from @var{dur}"
-)
+LY_DEFINE (ly_duration_dot_count, "ly:duration-dot-count",
+ 1, 0, 0, (SCM dur),
+ "Extract the dot count from @var{dur}")
{
SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration");
return scm_int2num (unsmob_duration (dur)->dot_count ());
}
-
LY_DEFINE (ly_intlog2, "ly:intlog2",
1, 0, 0, (SCM d),
"The 2-logarithm of 1/@var{d}.")
return scm_int2num (log);
}
-LY_DEFINE (compression_factor, "ly:duration-factor",
+LY_DEFINE (ly_duration_factor, "ly:duration-factor",
1, 0, 0, (SCM dur),
"Extract the compression factor from @var{dur}. Return as a pair.")
{
#include "system.hh"
-LY_DEFINE (ly_grob_set_property,"ly:grob-set-property!", 3, 0, 0,
- (SCM grob, SCM sym, SCM val),
- "Set @var{sym} in grob @var{grob} to value @var{val}")
+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}")
{
- Grob * sc = unsmob_grob (grob);
+ Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (ly_c_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return SCM_UNSPECIFIED;
}
-LY_DEFINE (ly_get_property, "ly:grob-property",
+LY_DEFINE (ly_grob_property, "ly:grob-property",
2, 0, 0, (SCM grob, SCM sym),
"Return the value of a value in grob @var{g} of property @var{sym}. "
"It will return @code{' ()} (end-of-list) "
return sc->internal_get_property (sym);
}
-LY_DEFINE (spanner_get_bound, "ly:spanner-get-bound", 2 , 0, 0,
- (SCM slur, SCM dir),
+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} "
"for left, and @code{1} for right.")
{
/* TODO: make difference between scaled and unscalead variable in
calling (i.e different funcs.) */
-LY_DEFINE (ly_grob_paper,"ly:grob-paper", 1, 0, 0,
- (SCM g),
- "Get @code{\\paper} definition from grob @var{g}.")
+LY_DEFINE (ly_grob_paper, "ly:grob-paper",
+ 1, 0, 0, (SCM g),
+ "Get @code{\\paper} definition from grob @var{g}.")
{
Grob * sc = unsmob_grob (g);
SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob");
return sc->get_paper ()->self_scm ();
}
-
-LY_DEFINE(ly_grob_alist_chain, "ly:grob-alist-chain",
- 1, 1, 0,
- (SCM g, SCM global),
- "Get an alist chain for grob @var{g}, with @var{global} as the "
- "global default. If unspecified, @code{font-defaults} "
- "from the paper block is taken. "
- )
+LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain",
+ 1, 1, 0, (SCM g, SCM global),
+ "Get an alist chain for grob @var{g}, with @var{global} as the "
+ "global default. If unspecified, @code{font-defaults} "
+ "from the paper block is taken. ")
{
- Grob * sc = unsmob_grob (g);
+ Grob *sc = unsmob_grob (g);
SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob");
if (global == SCM_UNDEFINED)
- global = sc->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
+ global
+ = sc->get_paper ()->lookup_variable (ly_symbol2scm ("font-defaults"));
return sc->get_property_alist_chain (global);
}
-
-LY_DEFINE (ly_get_extent, "ly:grob-extent", 3, 0, 0,
- (SCM grob, SCM refp, SCM axis),
+LY_DEFINE (ly_get_extent, "ly:grob-extent",
+ 3, 0, 0, (SCM grob, SCM refp, SCM axis),
"Get the extent in @var{axis} direction of @var{grob} relative to "
"the grob @var{refp}")
{
- Grob * sc = unsmob_grob (grob);
- Grob * ref = unsmob_grob (refp);
+ Grob *sc = unsmob_grob (grob);
+ Grob *ref = unsmob_grob (refp);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob");
-
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
return ly_interval2scm ( sc->extent (ref, Axis (ly_scm2int (axis))));
}
-LY_DEFINE (ly_get_parent, "ly:grob-parent", 2, 0, 0, (SCM grob, SCM axis),
+LY_DEFINE (ly_grob_parent, "ly:grob-parent",
+ 2, 0, 0, (SCM grob, SCM axis),
"Get the parent of @var{grob}. @var{axis} is 0 for the X-axis, "
"1 for the Y-axis.")
{
- Grob * sc = unsmob_grob (grob);
+ Grob *sc = unsmob_grob (grob);
SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
return par ? par->self_scm () : SCM_EOL;
}
-LY_DEFINE (ly_get_system, "ly:grob-system",
+LY_DEFINE (ly_grob_system, "ly:grob-system",
1, 0, 0, (SCM g),
"Return the System Grob of @var{g}.")
{
return SCM_EOL;
}
-LY_DEFINE (ly_get_original, "ly:grob-original",
+LY_DEFINE (ly_grob_original, "ly:grob-original",
1, 0, 0, (SCM grob),
"Return the unbroken original Grob of @var{grob}.")
{
return me->original_ ? me->original_->self_scm () : me->self_scm ();
}
-/* FIXME: ly prefix? spanner in name? */
/* TODO: maybe we should return a vector -- random access is more
logical for this list? */
-LY_DEFINE (get_broken_into, "ly:spanner-broken-into",
+LY_DEFINE (ly_spanner_broken_into, "ly:spanner-broken-into",
1, 0, 0, (SCM spanner),
"Return broken-into list for @var{spanner}.")
{
-/*
-identifier-smob.cc -- implement glue to pass Scheme expressions off as
-identifiers.
+/*
+ identifier-smob.cc -- implement glue to pass Scheme expressions off as
+ identifiers.
-source file of the GNU LilyPond music typesetter
-
-(c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ source file of the GNU LilyPond music typesetter
+ (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
#include "identifier-smob.hh"
return 1;
}
-
/* This defines the primitve `make-box', which returns a new smob of
type `box', initialized to `#f'. */
-LY_DEFINE (package_identifier, "ly:export", 1,0,0, (SCM arg),
- "Export a Scheme object to the parser, so it is treated as an identifier.")
+LY_DEFINE (ly_export, "ly:export",
+ 1, 0, 0, (SCM arg),
+ "Export a Scheme object to the parser, "
+ "so it is treated as an identifier.")
{
SCM_RETURN_NEWSMOB (package_tag, arg);
}
-
SCM
unpack_identifier (SCM box)
{
scm_set_smob_mark (package_tag, scm_markcdr);
scm_set_smob_print (package_tag, print_box);
}
+
ADD_SCM_INIT_FUNC (package, init_box_type);
SCM ly_make_anonymous_module (bool safe);
void ly_import_module (SCM dest, SCM src);
-SCM ly_module_to_alist (SCM mod);
+SCM ly_module2alist (SCM mod);
SCM ly_module_lookup (SCM module, SCM sym);
SCM ly_modules_lookup (SCM modules, SCM sym, SCM);
SCM ly_module_symbols (SCM mod);
source file of the GNU LilyPond music typesetter
(c) 1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
-
- Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
return s;
}
-LY_DEFINE (ly_warning,"ly:warn", 1, 0, 0,
- (SCM str), "Scheme callable function to issue the warning @code{msg}.")
+LY_DEFINE (ly_warn, "ly:warn",
+ 1, 0, 0, (SCM str),
+ "Scheme callable function to issue the warning @code{msg}.")
{
SCM_ASSERT_TYPE (ly_c_string_p (str), str, SCM_ARG1, __FUNCTION__, "string");
progress_indication ("\n");
return SCM_BOOL_T;
}
-LY_DEFINE (ly_dir_p, "ly:dir?", 1,0, 0, (SCM s),
+LY_DEFINE (ly_dir_p, "ly:dir?",
+ 1, 0, 0, (SCM s),
"type predicate. A direction is @code{-1}, @code{0} or "
"@code{1}, where @code{-1} represents "
"left or down and @code{1} represents right or up.")
bool
is_number_pair (SCM p)
{
- return ly_c_pair_p (p) && ly_c_number_p (ly_car (p)) && ly_c_number_p (ly_cdr (p));
+ return ly_c_pair_p (p)
+ && ly_c_number_p (ly_car (p)) && ly_c_number_p (ly_cdr (p));
}
typedef void (*Void_fptr) ();
scm_init_funcs_->push (f);
}
-
void
ly_init_ly_module (void *)
{
scm_c_use_module ("lily");
}
-unsigned int ly_scm_hash (SCM s)
+unsigned int
+ly_scm_hash (SCM s)
{
return scm_ihashv (s, ~1u);
}
-
-
bool
is_direction (SCM s)
{
return false;
}
-
bool
is_axis (SCM s)
{
scm_set_car_x (l, newcons);
}
-
SCM
ly_offset2scm (Offset o)
{
ly_scm2double (ly_cdr (s)));
}
-
LY_DEFINE (ly_number2string, "ly:number->string",
1, 0, 0, (SCM s),
"Convert @var{num} to a string without generating many decimals.")
return scm_cons (scm_cons (key, scm_variable_ref (val)), result);
}
-LY_DEFINE(ly_module_to_alist, "ly:module->alist",
- 1,0,0, (SCM mod),
- "Dump the contents of module @var{mod} as an alist.")
+LY_DEFINE (ly_module2alist, "ly:module->alist",
+ 1, 0, 0, (SCM mod),
+ "Dump the contents of module @var{mod} as an alist.")
{
SCM_VALIDATE_MODULE (1, mod);
SCM obarr= SCM_MODULE_OBARRAY (mod);
#undef FUNC_NAME
}
-/*
- Lookup SYM in a list of modules, which do not have to be related.
- Return the first instance.
- */
-LY_DEFINE(ly_modules_lookup, "ly:modules-lookup",
- 2, 1, 0,
- (SCM modules, SCM sym, SCM def),
- "Lookup @var{sym} in the list @var{modules}, returning the "
- "first occurence. If not found, return @var{default}, or @code{#f}.")
+/* Lookup SYM in a list of modules, which do not have to be related.
+ Return the first instance. */
+LY_DEFINE (ly_modules_lookup, "ly:modules-lookup",
+ 2, 1, 0,
+ (SCM modules, SCM sym, SCM def),
+ "Lookup @var{sym} in the list @var{modules}, "
+ "returning the first occurence. "
+ "If not found, return @var{default}, or @code{#f}.")
{
for (SCM s = modules; ly_c_pair_p (s); s = ly_cdr (s))
{
SCM mod = ly_car (s);
- SCM v = scm_sym2var (sym, scm_module_lookup_closure (mod), SCM_UNDEFINED);
- if (SCM_VARIABLEP(v) && SCM_VARIABLE_REF(v) != SCM_UNDEFINED)
+ SCM v = scm_sym2var (sym, scm_module_lookup_closure (mod),
+ SCM_UNDEFINED);
+ if (SCM_VARIABLEP(v) && SCM_VARIABLE_REF(v) != SCM_UNDEFINED)
return SCM_VARIABLE_REF(v);
}
if (def != SCM_UNDEFINED)
return def;
- else
- return SCM_BOOL_F;
+ return SCM_BOOL_F;
}
void
/*
moment.cc -- implement Moment
-
+
source file of the GNU LilyPond music typesetter
-
- (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
+ (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
#include "lily-guile.hh"
#include "moment.hh"
#include "warn.hh"
-#include "ly-smobs.icc"
+
+Moment::Moment ()
+{
+}
+
+Moment::Moment (int m)
+{
+ main_part_ = Rational (m);
+ grace_part_ = Rational ( 0);
+}
+
+Moment::Moment (Rational m, Rational g)
+{
+ main_part_ = m;
+ grace_part_ = g;
+}
+
+Moment::Moment (Rational m)
+{
+ main_part_ = m;
+ grace_part_ = Rational (0);
+}
+
+#include "ly-smobs.icc"
IMPLEMENT_SIMPLE_SMOBS (Moment);
IMPLEMENT_TYPE_P (Moment, "ly:moment?");
return SCM_EOL;
}
-
-
-
int
Moment::print_smob (SCM s, SCM port, scm_print_state *)
{
return 1;
}
-/*
- TODO: add optional factor argument.
-*/
-LY_DEFINE (make_moment,"ly:make-moment", 2,2,0, (SCM n, SCM d, SCM gn, SCM gd),
+/* TODO: add optional factor argument. */
+LY_DEFINE (ly_make_moment, "ly:make-moment",
+ 2, 2, 0, (SCM n, SCM d, SCM gn, SCM gd),
"Create the rational number with main timing @var{n}/@var{d}, "
"and optional grace timin @var{gn}/@var{gd}.\n"
"\n"
"\n"
- "Moment is a point in musical time. It is consists of a pair of\n"
- "rationals (@var{m},@var{g}), where @var{m} is the timing for the main\n"
- "notes, and @var{g} the timing for grace notes. In absence of grace\n"
- "notes, @var{g} is zero.\n"
- )
+ "Moment is a point in musical time. "
+ "It is consists of a pair of rationals (@var{m},@var{g}), "
+ "where @var{m} is the timing for the main\n"
+ "notes, and @var{g} the timing for grace notes. "
+ "In absence of grace notes, @var{g} is zero.\n")
{
SCM_ASSERT_TYPE (SCM_INUMP (n), n, SCM_ARG1, __FUNCTION__, "integer");
SCM_ASSERT_TYPE (SCM_INUMP (d), d, SCM_ARG2, __FUNCTION__, "integer");
Rational (grace_num, grace_den)).smobbed_copy ();
}
-LY_DEFINE (add_moment,"ly:add-moment", 2,0,0, (SCM a, SCM b),
- "Add two moments."
- )
+LY_DEFINE (ly_add_moment, "ly:add-moment",
+ 2, 0, 0, (SCM a, SCM b),
+ "Add two moments.")
{
- Moment * ma = unsmob_moment (a);
- Moment * mb = unsmob_moment (b);
+ Moment *ma = unsmob_moment (a);
+ Moment *mb = unsmob_moment (b);
SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment");
SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment");
-
return (*ma + *mb).smobbed_copy ();
}
-
-LY_DEFINE (mul_moment,"ly:mul-moment", 2,0,0, (SCM a, SCM b),
- "Multiply two moments."
- )
+LY_DEFINE (ly_mul_moment,"ly:mul-moment",
+ 2, 0, 0, (SCM a, SCM b),
+ "Multiply two moments.")
{
- Moment * ma = unsmob_moment (a);
- Moment * mb = unsmob_moment (b);
+ Moment *ma = unsmob_moment (a);
+ Moment *mb = unsmob_moment (b);
SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment");
SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment");
-
- return (*ma * *mb).smobbed_copy ();
+ return (*ma * *mb).smobbed_copy ();
}
-
-
-LY_DEFINE (div_moment,"ly:div-moment", 2,0,0, (SCM a, SCM b),
- "Divide two moments."
- )
+LY_DEFINE (ly_div_moment,"ly:div-moment",
+ 2, 0, 0, (SCM a, SCM b),
+ "Divide two moments.")
{
- Moment * ma = unsmob_moment (a);
- Moment * mb = unsmob_moment (b);
+ Moment *ma = unsmob_moment (a);
+ Moment *mb = unsmob_moment (b);
SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment");
SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment");
-
- return (*ma / *mb).smobbed_copy ();
+ return (*ma / *mb).smobbed_copy ();
}
-LY_DEFINE (ly_moment_less_p,"ly:moment<?", 2,0,0, (SCM a, SCM b),
+LY_DEFINE (ly_moment_less_p,"ly:moment<?",
+ 2, 0, 0, (SCM a, SCM b),
"Compare two moments.")
{
- Moment * ma = unsmob_moment (a);
- Moment * mb = unsmob_moment (b);
+ Moment *ma = unsmob_moment (a);
+ Moment *mb = unsmob_moment (b);
SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment");
SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment");
-
return ly_bool2scm (*ma < *mb);
}
-
-
SCM
Moment::equal_p (SCM a, SCM b)
{
return Rational::compare (a.grace_part_, b.grace_part_);
}
-Moment::Moment ()
-{
-
-}
-
-Moment::Moment (int m)
-{
- main_part_ = Rational (m);
- grace_part_ = Rational ( 0);
-}
-
-Moment::Moment (Rational m, Rational g)
-{
- main_part_ = m;
- grace_part_ = g;
-}
-
-Moment::Moment (Rational m)
-{
- main_part_ = m;
- grace_part_ = Rational (0);
-}
-
void
Moment::operator += (Moment const &src)
{
grace_part_ /= src.main_part_;
}
-
-
int
-Moment::den () const { return main_part_.den (); }
+Moment::den () const
+{
+ return main_part_.den ();
+}
int
-Moment::num () const { return main_part_.num (); }
+Moment::num () const
+{
+ return main_part_.num ();
+}
bool
Moment::to_bool () const
main_part_.set_infinite (k);
}
-
String
Moment::to_string () const
{
*/
#include "book.hh"
-
#include "file-name.hh"
#include "file-path.hh"
#include "lily-version.hh"
#include "source.hh"
#include "warn.hh"
-#include "ly-smobs.icc"
-
My_lily_parser::My_lily_parser (Sources *sources)
{
// FIXME: Memleak: del lexer
}
+#include "ly-smobs.icc"
+
IMPLEMENT_SMOBS (My_lily_parser);
IMPLEMENT_TYPE_P (My_lily_parser, "ly:my-lily-parser?");
IMPLEMENT_DEFAULT_EQUAL_P (My_lily_parser);
My_lily_parser::mark_smob (SCM s)
{
My_lily_parser *parser = (My_lily_parser*) ly_cdr (s);
+ (void) parser;
return SCM_EOL;
}
bool store_locations_global_b;
/* Do not append `!' suffix, since 1st argument is not modified. */
-LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click", 1, 0, 0,
- (SCM what),
+LY_DEFINE (ly_set_point_and_click, "ly:set-point-and-click",
+ 1, 0, 0, (SCM what),
"Set the options for Point-and-click source specials output. The\n"
"argument is a symbol. Possible options are @code{none} (no source specials),\n"
"@code{line} and @code{line-column}")
}
LY_DEFINE (ly_parse_file, "ly:parse-file",
- 1, 0, 0,
- (SCM name),
+ 1, 0, 0, (SCM name),
"Parse a single @code{.ly} file. "
"Upon failure, throw @code{ly-file-failed} key.")
{
}
LY_DEFINE (ly_parse_string, "ly:parse-string",
- 1, 0, 0,
- (SCM ly_code),
+ 1, 0, 0, (SCM ly_code),
"Parse the string LY_CODE. "
"Upon failure, throw @code{ly-file-failed} key.")
{
}
LY_DEFINE (ly_clone_parser, "ly:clone-parser",
- 1, 0, 0,
- (SCM parser_smob),
+ 1, 0, 0, (SCM parser_smob),
"Return a clone of PARSER_SMOB.")
{
My_lily_parser *parser = unsmob_my_lily_parser (parser_smob);
My_lily_parser *clone = new My_lily_parser (*parser);
- /*
- FIXME: should copy scopes too.
- */
+ /* FIXME: should copy scopes too. */
return scm_gc_unprotect_object (clone->self_scm ());
}
-LY_DEFINE(ly_parser_define, "ly:parser-define",
- 3, 0, 0,
- (SCM parser_smob, SCM symbol, SCM val),
- "Bind SYMBOL to VAL in PARSER_SMOB's module.")
+LY_DEFINE (ly_parser_define, "ly:parser-define",
+ 3, 0, 0, (SCM parser_smob, SCM symbol, SCM val),
+ "Bind SYMBOL to VAL in PARSER_SMOB's module.")
{
My_lily_parser *parser = unsmob_my_lily_parser (parser_smob);
SCM_ASSERT_TYPE (ly_c_symbol_p (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
parser->lexer_->set_identifier (scm_symbol_to_string (symbol), val);
return SCM_UNSPECIFIED;
}
-LY_DEFINE(ly_parser_lookup, "ly:parser-lookup",
- 2, 0, 0,
- (SCM parser_smob, SCM symbol),
- "Lookup @var{symbol} in @var{parser_smob}'s module. Undefined is '().")
+
+LY_DEFINE (ly_parser_lookup, "ly:parser-lookup",
+ 2, 0, 0, (SCM parser_smob, SCM symbol),
+ "Lookup @var{symbol} in @var{parser_smob}'s module. "
+ "Undefined is '().")
{
My_lily_parser *parser = unsmob_my_lily_parser (parser_smob);
}
LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string",
- 2, 0, 0,
- (SCM parser_smob, SCM ly_code),
+ 2, 0, 0, (SCM parser_smob, SCM ly_code),
"Parse the string LY_CODE with PARSER_SMOB."
"Upon failure, throw @code{ly-file-failed} key.")
{
-
My_lily_parser *parser = unsmob_my_lily_parser (parser_smob);
SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "parser");
}
-/*
- TODO: move this to Scheme? Why take the parser arg, and all the back
- & forth between scm and c++?
- */
+/* TODO: move this to Scheme? Why take the parser arg, and all the back
+ & forth between scm and c++? */
LY_DEFINE (ly_parser_print_score, "ly:parser-print-score",
2, 0, 0,
(SCM parser_smob, SCM score_smob),
}
-LY_DEFINE (ly_parser_set_names, "ly:parser-set-note-names",
- 2, 0, 0,
- (SCM parser, SCM names),
- "Replace current note names in @var{parser}. @var{names} is an alist of "
- "symbols. This only has effect if the current mode is notes.")
+LY_DEFINE (ly_parser_set_note_names, "ly:parser-set-note-names",
+ 2, 0, 0, (SCM parser, SCM names),
+ "Replace current note names in @var{parser}. "
+ "@var{names} is an alist of symbols. "
+ "This only has effect if the current mode is notes.")
{
My_lily_parser *p = unsmob_my_lily_parser (parser);
SCM_ASSERT_TYPE(p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
}
LY_DEFINE (ly_parser_print_book, "ly:parser-print-book",
- 2, 0, 0,
- (SCM parser_smob, SCM book_smob),
+ 2, 0, 0, (SCM parser_smob, SCM book_smob),
"Print book.")
{
My_lily_parser *parser = unsmob_my_lily_parser (parser_smob);
(c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
#include "context-def.hh"
#include "file-path.hh"
#include "global-context.hh"
+#include "interval.hh"
#include "lily-guile.hh"
#include "ly-module.hh"
#include "main.hh"
#include "scm-hash.hh"
#include "warn.hh"
-#include "ly-smobs.icc"
-
Output_def::Output_def ()
{
scope_ = SCM_EOL;
scope_ = ly_make_anonymous_module (false);
}
-Output_def::~Output_def ()
-{
-}
-
Output_def::Output_def (Output_def const &s)
{
scope_ = SCM_EOL;
ly_import_module (scope_, s.scope_);
}
+Output_def::~Output_def ()
+{
+}
+#include "ly-smobs.icc"
IMPLEMENT_SMOBS (Output_def);
IMPLEMENT_DEFAULT_EQUAL_P (Output_def);
-
SCM
Output_def::mark_smob (SCM m)
{
- Output_def * mo = (Output_def*) SCM_CELL_WORD_1 (m);
+ Output_def *mo = (Output_def*) SCM_CELL_WORD_1 (m);
- /*
- FIXME: why is this necessary?
- all bookpaper_ should be protected by themselves.
- */
+ /* FIXME: why is this necessary?
+ all bookpaper_ should be protected by themselves. */
if (mo->parent_)
scm_gc_mark (mo->parent_->self_scm ());
-
mo->derived_mark ();
return mo->scope_;
}
void
-Output_def::derived_mark () {}
+Output_def::derived_mark ()
+{
+}
void
assign_context_def (Output_def * m, SCM transdef)
}
}
-/*
- find the translator for NAME. NAME must be a symbol.
-*/
+/* find the translator for NAME. NAME must be a symbol. */
SCM
find_context_def (Output_def const *m, SCM name)
{
return ly_scm2double (val);
}
-
SCM
Output_def::lookup_variable (SCM sym) const
{
}
LY_DEFINE (ly_output_def_scope, "ly:output-def-scope",
- 1, 0,0, (SCM def),
+ 1, 0, 0, (SCM def),
"Get the variable scope inside @var{def}.")
{
Output_def *op = unsmob_output_def (def);
return op->scope_;
}
-
LY_DEFINE (ly_output_def_parent, "ly:output-def-parent",
1, 0, 0, (SCM def),
"Get the parent output-def of @var{def}.")
return op->parent_ ? op->parent_->self_scm () : SCM_EOL;
}
-
LY_DEFINE (ly_output_def_clone, "ly:output-def-clone",
1, 0, 0, (SCM def),
"Clone @var{def}.")
return s;
}
-LY_DEFINE(ly_output_description, "ly:output-description",
- 1,0,0,
- (SCM output_def),
- "Return the description of translators in @var{output-def}.")
+LY_DEFINE (ly_output_description, "ly:output-description",
+ 1, 0, 0, (SCM output_def),
+ "Return the description of translators in @var{output-def}.")
{
Output_def *id = unsmob_output_def (output_def);
- SCM al =ly_module_to_alist (id->scope_);
+ SCM al = ly_module2alist (id->scope_);
- SCM l = SCM_EOL;
- for (SCM s = al ; ly_c_pair_p (s); s = ly_cdr (s))
+ SCM ell = SCM_EOL;
+ for (SCM s = al; ly_c_pair_p (s); s = ly_cdr (s))
{
Context_def * td = unsmob_context_def (ly_cdar (s));
SCM key = ly_caar (s);
if (td && key == td->get_context_name ())
- {
-
- l = scm_cons (scm_cons (key, td->to_alist ()), l);
- }
+ ell = scm_cons (scm_cons (key, td->to_alist ()), ell);
}
- return l;
+ return ell;
}
-
-
-#include "interval.hh"
-
/* FIXME. This is broken until we have a generic way of
putting lists inside the \paper block. */
Interval
line_dimensions_int (Output_def *def, int n)
{
- Real lw = def->get_dimension (ly_symbol2scm ("linewidth"));
+ Real lw = def->get_dimension (ly_symbol2scm ("linewidth"));
Real ind = n ? 0.0 : def->get_dimension (ly_symbol2scm ("indent"));
-
return Interval (ind, lw);
}
return ly_bool2scm (unsmob_output_def (def));
}
-
-
LY_DEFINE (ly_bookpaper_outputscale, "ly:bookpaper-outputscale",
- 1, 0, 0,
- (SCM bp),
+ 1, 0, 0, (SCM bp),
"Get outputscale for BP.")
{
Output_def *b = unsmob_output_def (bp);
return scm_make_real (output_scale (b));
}
-
-
LY_DEFINE (ly_make_output_def, "ly:make-output-def",
0, 0, 0, (),
"Make a output def.")
return scm_gc_unprotect_object (bp->self_scm ());
}
+
Array<String> output_formats = split_string (output_format_global, ',');
SCM lst = SCM_EOL;
- for (int i = 0; i < output_formats.size (); i ++)
+ int output_formats_count = output_formats.size ();
+ for (int i = 0; i < output_formats_count; i ++)
lst = scm_cons (scm_makfrom0str (output_formats[i].to_str0 ()), lst);
return lst;
if (!score_lines_.size ())
return;
-
/* Generate all stencils to trigger font loads. */
pages ();
-
SCM formats = ly_output_formats();
for (SCM s = formats; ly_c_pair_p (s); s = ly_cdr (s))
{
String format = ly_scm2string (ly_car (s));
-
- Paper_outputter *out = get_paper_outputter (outname + "." + format, format);
+ Paper_outputter *out = get_paper_outputter (outname + "." + format,
+ format);
SCM scopes = SCM_EOL;
if (ly_c_module_p (header_))
scopes,
dump_fields (),
scm_makfrom0str (outname.to_str0 ()),
- SCM_UNDEFINED
- )) ;
+ SCM_UNDEFINED));
scm_gc_unprotect_object (out->self_scm ());
+ progress_indication ("\n");
}
}
-
void
Paper_book::classic_output (String outname)
{
-
/* Generate all stencils to trigger font loads. */
lines ();
-
// ugh code dup
SCM scopes = SCM_EOL;
if (ly_c_module_p (header_))
scopes = scm_cons (score_lines_[0].header_, scopes);
//end ugh
-
Array<String> output_formats = split_string (output_format_global, ',');
for (int i = 0; i < output_formats.size (); i++)
func_nm = "output-classic-framework-" + func_nm;
SCM func = ly_scheme_function (func_nm.to_str0 ());
+ Paper_outputter *out = get_paper_outputter (outname + "." + format,
+ format);
- Paper_outputter *out = get_paper_outputter (outname + "." + format, format);
-
- scm_apply_0 (func, scm_list_n (out->self_scm (),
- self_scm (),
- scopes,
+ scm_apply_0 (func, scm_list_5 (out->self_scm (), self_scm (), scopes,
dump_fields (),
- scm_makfrom0str (outname.to_str0 ()),
- SCM_UNDEFINED
- )) ;
+ scm_makfrom0str (outname.to_str0 ())));
scm_gc_unprotect_object (out->self_scm ());
+ progress_indication ("\n");
}
-
- progress_indication ("\n");
}
-
-
-
-LY_DEFINE(ly_paper_book_pages, "ly:paper-book-pages",
- 1,0,0,
- (SCM pb),
+LY_DEFINE (ly_paper_book_pages, "ly:paper-book-pages",
+ 1, 0, 0, (SCM pb),
"Return pages in book PB.")
{
return unsmob_paper_book(pb)->pages ();
}
-
-LY_DEFINE(ly_paper_book_scopes, "ly:paper-book-scopes",
- 1,0,0,
- (SCM book),
+LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes",
+ 1, 0, 0, (SCM book),
"Return pages in paper book @var{book}.")
{
- Paper_book * pb = unsmob_paper_book(book);
+ Paper_book *pb = unsmob_paper_book(book);
SCM_ASSERT_TYPE(pb, book, SCM_ARG1, __FUNCTION__, "Paper_book");
SCM scopes = SCM_EOL;
return scopes;
}
-
-LY_DEFINE(ly_paper_book_lines, "ly:paper-book-lines",
- 1,0,0,
- (SCM pb),
- "Return lines in book PB.")
+LY_DEFINE (ly_paper_book_lines, "ly:paper-book-lines",
+ 1, 0, 0, (SCM pb),
+ "Return lines in book PB.")
{
return unsmob_paper_book (pb)->lines ();
}
-
-LY_DEFINE(ly_paper_book_book_paper, "ly:paper-book-book-paper",
- 1,0,0,
- (SCM pb),
+LY_DEFINE (ly_paper_book_book_paper, "ly:paper-book-book-paper",
+ 1, 0, 0, (SCM pb),
"Return pages in book PB.")
{
- return unsmob_paper_book(pb)->bookpaper_->self_scm ();
+ return unsmob_paper_book (pb)->bookpaper_->self_scm ();
}
-/*
-
-TODO: resurrect more complex user-tweaks for titling?
-
-*/
+/* TODO: resurrect more complex user-tweaks for titling? */
Stencil
Paper_book::book_title ()
{
return title;
}
-
-
Stencil
Paper_book::score_title (int i)
{
if (unsmob_stencil (tit))
title = *unsmob_stencil (tit);
-
if (!title.is_empty ())
title.align_to (Y_AXIS, UP);
return title;
}
-
SCM
Paper_book::lines ()
{
- if (SCM_BOOL_F != lines_)
+ if (lines_ != SCM_BOOL_F)
return lines_;
lines_ = SCM_EOL;
if (!title.is_empty ())
{
Paper_system *pl = new Paper_system (title, true);
-
lines_ = scm_cons (pl->self_scm (), lines_);
scm_gc_unprotect_object (pl->self_scm ());
}
if (scm_vector_p (score_lines_[i].lines_) == SCM_BOOL_T)
{
- SCM line_list = scm_vector_to_list (score_lines_[i].lines_); // guh.
+ // guh.
+ SCM line_list = scm_vector_to_list (score_lines_[i].lines_);
line_list = scm_reverse (line_list);
lines_ = scm_append (scm_list_2 (line_list, lines_));
lines_ = scm_reverse (lines_);
int i = 0;
- Paper_system * last = 0;
+ Paper_system *last = 0;
for (SCM s = lines_; s != SCM_EOL; s = ly_cdr (s))
{
Paper_system * p = unsmob_paper_line (ly_car (s));
p->number_ = ++i;
if (last && last->is_title ())
- {
- p->penalty_ = 10000; // ugh, hardcoded.
- }
+ // ugh, hardcoded.
+ p->penalty_ = 10000;
last = p;
}
-
return lines_;
}
-
SCM
Paper_book::pages ()
{
return pages_;
pages_ = SCM_EOL;
-
Output_def *paper = bookpaper_;
-
SCM proc = paper->c_variable ("page-breaking");
- pages_ = scm_apply_0 (proc, scm_list_n (lines (),
- self_scm (),
- SCM_UNDEFINED));
-
+ pages_ = scm_apply_0 (proc, scm_list_2 (lines (), self_scm ()));
return pages_;
}
-
-
/****************************************************************/
Score_lines::Score_lines ()
progress_indication (_f ("paper output to `%s'...",
outname == "-" ? String ("<stdout>") : outname));
return new Paper_outputter (outname, f);
-
}
/* FIXME: why is output_* wrapper called dump? */
(c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include "score.hh"
-#include "main.hh"
-#include "warn.hh"
+#include "all-font-metrics.hh"
#include "font-metric.hh"
-#include "spanner.hh"
+#include "gourlay-breaking.hh"
+#include "ly-module.hh"
+#include "main.hh"
+#include "misc.hh"
#include "output-def.hh"
-#include "system.hh"
+#include "paper-book.hh"
#include "paper-column.hh"
#include "paper-score.hh"
-#include "paper-column.hh"
#include "scm-hash.hh"
-#include "gourlay-breaking.hh"
-//#include "paper-outputter.hh"
-#include "misc.hh"
-#include "all-font-metrics.hh"
-
+#include "score.hh"
+#include "spanner.hh"
#include "stencil.hh"
-#include "paper-book.hh"
-#include "ly-module.hh"
+#include "system.hh"
+#include "warn.hh"
Paper_score::Paper_score ()
{
Array<Column_x_positions>
Paper_score::calc_breaking ()
{
- Break_algorithm *algorithm=0;
+ Break_algorithm *algorithm = 0;
Array<Column_x_positions> sol;
algorithm = new Gourlay_breaking ;
Array<Column_x_positions> breaking = calc_breaking ();
system_->break_into_pieces (breaking);
SCM lines = system_->get_lines ();
+#if 0
+ /* gourlay:do_solve also prints newline. */
progress_indication ("\n");
-
+#endif
+
/* Only keep result stencils in lines_, *title_; delete all grobs. */
systems_ = SCM_EOL;
}
/* Should add optional args. */
-LY_DEFINE (make_pitch, "ly:make-pitch",
+LY_DEFINE (ly_make_pitch, "ly:make-pitch",
3, 0, 0, (SCM octave, SCM note, SCM alter),
"@var{octave} is specified by an integer, "
"zero for the octave containing middle C. "
return p.smobbed_copy ();
}
-LY_DEFINE (pitch_steps, "ly:pitch-steps", 1, 0, 0,
+LY_DEFINE (ly_pitch_steps, "ly:pitch-steps", 1, 0, 0,
(SCM p),
"Number of steps counted from middle C of the pitch @var{p}.")
{
return scm_int2num (pp->steps ());
}
-LY_DEFINE (pitch_octave, "ly:pitch-octave",
+LY_DEFINE (ly_pitch_octave, "ly:pitch-octave",
1, 0, 0, (SCM pp),
"Extract the octave from pitch @var{p}.")
{
return scm_int2num (q);
}
-LY_DEFINE (pitch_alteration, "ly:pitch-alteration",
+LY_DEFINE (ly_pitch_alteration, "ly:pitch-alteration",
1, 0, 0, (SCM pp),
"Extract the alteration from pitch @var{p}.")
{
return scm_int2num (q);
}
-LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
+LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones",
1, 0, 0, (SCM pp),
"Calculate the number of quarter tones of @var{p} from middle C.")
{
return scm_int2num (q);
}
-LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones",
+LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones",
1, 0, 0, (SCM pp),
"calculate the number of semitones of @var{p} from middle C.")
{
return scm_int2num (q);
}
-LY_DEFINE (pitch_less, "ly:pitch<?",
+LY_DEFINE (ly_pitch_less_p, "ly:pitch<?",
2, 0, 0, (SCM p1, SCM p2),
"Is @var{p1} lexicographically smaller than @var{p2}?")
{
return interval (*r, *p).smobbed_copy ();
}
-
int
-Pitch::get_octave ()const
+Pitch::get_octave () const
{
return octave_;
}
#include "score.hh"
#include "warn.hh"
-/*
- TODO: junkme.
- */
+/* TODO: junkme. */
Score::Score ()
: Input ()
{
return 1;
}
-
-
-/*
- store point & click locations.
- Global to save some time. (Sue us!)
- */
Score::Score (Score const &s)
: Input (s)
{
music_ = SCM_EOL;
- // FIXME: SCM_EOL?
+ /* FIXME: SCM_EOL? */
header_ = 0;
smobify_self ();
}
LY_DEFINE (ly_run_translator, "ly:run-translator",
- 2, 0, 0, (SCM mus, SCM output_def),
+ 2, 0, 0, (SCM mus, SCM output_def),
"Process @var{mus} according to @var{output_def}. "
"An interpretation context is set up, "
"and @var{mus} is interpreted with it. "
Output_def *odef = unsmob_output_def (output_def);
Music *music = unsmob_music (mus);
+ if (!music)
+ return SCM_BOOL_F;
+
SCM_ASSERT_TYPE (music, mus, SCM_ARG1, __FUNCTION__, "Music");
SCM_ASSERT_TYPE (odef, output_def, SCM_ARG2, __FUNCTION__, "Output definition");
Cpu_timer timer;
- Global_context * trans = new Global_context (odef, music->get_length ());
+ Global_context *trans = new Global_context (odef, music->get_length ());
if (!trans)
{
Music_output *output = g->get_output ();
progress_indication ("\n");
- // ugh, midi still wants outname
+ /* ugh, midi still wants outname */
return output->process (ly_scm2string (outname));
}
Output_def *bpd = unsmob_output_def (book_outputdef);
- /*
- ugh.
- */
+ /* ugh. */
if (bpd->c_variable ("is-bookpaper") == SCM_BOOL_T)
{
Real scale = ly_scm2double (bpd->c_variable ("outputscale"));
- Output_def * def = scale_output_def (unsmob_output_def (outdef), scale);
+ Output_def *def = scale_output_def (unsmob_output_def (outdef), scale);
scaled_def = def->self_scm ();
scaled_bookdef = scale_output_def (bpd, scale)->self_scm ();
- unsmob_output_def (scaled_def)->parent_ = unsmob_output_def (scaled_bookdef);
+ unsmob_output_def (scaled_def)->parent_
+ = unsmob_output_def (scaled_bookdef);
scm_gc_unprotect_object (scaled_bookdef);
scm_gc_unprotect_object (scaled_def);
}
SCM context = ly_run_translator (music, scaled_def);
-
if (Global_context *g = dynamic_cast<Global_context*>
(unsmob_context (context)))
{
Music_output *output = g->get_output ();
if (systems != SCM_UNDEFINED)
{
- /*
- ugh, this is strange, Paper_book without a Book object.
- */
+ /* ugh, this is strange, Paper_book without a Book object. */
Paper_book *paper_book = new Paper_book ();
paper_book->header_ = header;
paper_book->bookpaper_ = unsmob_output_def (scaled_bookdef);
scm_remember_upto_here_1 (scaled_bookdef);
}
-/*
- PAPERBOOK should be scaled already.
- */
+/* PAPERBOOK should be scaled already. */
SCM
Score::book_rendering (String outname,
Output_def *paperbook,
Real scale = 1.0;
if (paperbook && paperbook->c_variable ("is-bookpaper") == SCM_BOOL_T)
- {
- scale = ly_scm2double (paperbook->c_variable ("outputscale"));
- }
+ scale = ly_scm2double (paperbook->c_variable ("outputscale"));
SCM out = scm_makfrom0str (outname.to_str0 ());
SCM systems = SCM_EOL;
scm_gc_unprotect_object (scaled);
}
- /*
- TODO: fix or junk --no-paper.
- */
-
+ /* TODO: fix or junk --no-paper. */
SCM context = ly_run_translator (music_, def->self_scm ());
if (dynamic_cast<Global_context*> (unsmob_context (context)))
{
SCM s = ly_format_output (context, out);
if (s != SCM_UNDEFINED)
- {
- systems = s;
- }
+ systems = s;
}
scm_remember_upto_here_1 (scaled);
LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format",
2, 0, 0, (SCM score, SCM paper),
- "Run @var{score} through @var{paper}, a output definition, "
- " scaled to correct outputscale already, return a list of paper-lines. ")
+ "Run @var{score} through @var{paper}, an output definition, "
+ "scaled to correct outputscale already, "
+ "return a list of paper-lines.")
{
Score * sc = unsmob_score (score);
Output_def *od = unsmob_output_def (paper);
SCM lines = SCM_EOL;
Output_def * score_def = 0;
- /*
- UGR, FIXME, these are default \paper blocks once again. They suck.
- */
+ /* UGR, FIXME, these are default \paper blocks once again. They
+ suck. */
for (int i = 0; !score_def && i < sc->defs_.size (); i++)
- {
- if (sc->defs_[i]->c_variable ("is-paper") == SCM_BOOL_T)
- {
- score_def = sc->defs_[i];
- }
- }
+ if (sc->defs_[i]->c_variable ("is-paper") == SCM_BOOL_T)
+ score_def = sc->defs_[i];
if (!score_def)
return lines;
-
score_def = score_def->clone ();
SCM prot = score_def->self_scm ();
scm_gc_unprotect_object (prot);
- /*
-
- TODO: SCORE_DEF should be scaled according to OD->parent_ or OD
- itself.
-
- */
-
+ /* TODO: SCORE_DEF should be scaled according to OD->parent_ or OD
+ itself. */
score_def->parent_ = od;
SCM context = ly_run_translator (sc->music_, score_def->self_scm ());
me->add_dependency (i);
}
-LY_DEFINE (grob_script_priority_less, "ly:grob-script-priority-less",
+LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less",
2, 0, 0, (SCM a, SCM b),
"Compare two grobs by script priority. For internal use.")
{
do
{
SCM ss = scm_reverse_x (scripts[d], SCM_EOL);
- ss = scm_stable_sort_x (ss, grob_script_priority_less_proc);
+ ss = scm_stable_sort_x (ss, ly_grob_script_priority_less_proc);
Grob * last = 0;
for (SCM s = ss; ly_c_pair_p (s); s = ly_cdr (s))
}
-LY_DEFINE (ly_align_to_x, "ly:stencil-align-to!",
+LY_DEFINE (ly_stencil_align_to_x, "ly:stencil-align-to!",
3, 0, 0, (SCM stil, SCM axis, SCM dir),
"Align @var{stil} using its own extents. "
"@var{dir} is a number -1, 1 are left and right respectively. "
if (verbose_global_b)
progress_indication (_f ("Grob count %d", element_count ()));
-
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
unsmob_grob (ly_car (s))->handle_prebroken_dependencies ();
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
{
- Grob* sc = unsmob_grob (ly_car (s));
+ Grob *sc = unsmob_grob (ly_car (s));
sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
}
- progress_indication ("\n" + _ ("Calculating line breaks...") + " ");
+ progress_indication ("\n");
+ progress_indication (_ ("Calculating line breaks..."));
+ progress_indication (" ");
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
{
Grob *e = unsmob_grob (ly_car (s));
(def-markup-command (combine paper props m1 m2) (markup? markup?)
"Print two markups on top of each other."
(let*
- ((s1 (interpret-markup paper props m1))
- (s2 (interpret-markup paper props m2)))
+ ((s1 (interpret-markup paper props m1))
+ (s2 (interpret-markup paper props m2)))
(ly:stencil-add s1 s2)))