+2005-04-27 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/lily-guile.cc (ly_chain_assoc): remove.
+
+ * lily/general-scheme.cc (LY_DEFINE): export ly:chain_assoc_get
+ (LY_DEFINE): recurse, iso. calling ly_chain_assoc.
+
2005-04-26 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/beaming-info.cc: remove infinity_i
+
* scripts/abc2ly.py (out_filename): fix thinko with \version.
2005-04-26 Graham Percival <gperlist@shaw.ca>
SCM val;
if (!pango_dict_->try_retrieve (key, &val))
{
- progress_indication ("[" + String (pango_fn));
+ if (be_verbose_global)
+ progress_indication ("[" + String (pango_fn));
Pango_font *pf = new Pango_font (pango_ft2_fontmap_,
RIGHT,
beams_i_drul_[RIGHT] = i;
}
-const int infinity_i = INT_MAX; // guh.
-const int at_beat = 1<<15;
+const int at_beat = 1 << 15;
int
Beaming_info_list::best_splitpoint_index (Moment &beat_length, bool subdivide) const
{
- int minden = infinity_i;
+ int minden = INT_MAX;
int minidx = -1;
Moment beat_pos;
Font_metric *
select_encoded_font (Output_def *layout, SCM chain)
{
- SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain);
+ SCM name = ly_chain_assoc_get (ly_symbol2scm ("font-name"), chain, SCM_BOOL_F);
- if (!scm_is_pair (name) || !scm_is_string (scm_cdr (name)))
+ if (!scm_is_string (name))
{
SCM fonts = layout->lookup_variable (ly_symbol2scm ("fonts"));
name = properties_to_font_size_family (fonts, chain);
}
- else
- name = scm_cdr (name);
#if HAVE_PANGO_FT2
if (scm_is_string (name)
#endif
if (scm_is_string (name))
{
- SCM mag = ly_chain_assoc (ly_symbol2scm ("font-magnification"), chain);
- Real rmag = (scm_is_pair (mag)
- ? robust_scm2double (scm_cdr (mag), 1.0)
- : 1);
+ 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);
SCM base_size = scm_slot_ref (name, ly_symbol2scm ("default-size"));
SCM vec = scm_slot_ref (name, ly_symbol2scm ("size-vector"));
- SCM font_size = ly_chain_assoc (ly_symbol2scm ("font-size"), chain);
- Real req = 0;
- if (scm_is_pair (font_size))
- req = scm_to_double (scm_cdr (font_size));
-
+ 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));
}
}
+
+LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
+ 2, 1, 0, (SCM key, SCM achain, SCM dfault),
+ "Return value for @var{key} from a list of alists @var{achain}. Return @var{dfault} "
+ "if no entry is found, or #f if not specified. ")
+{
+ if (scm_is_pair (achain))
+ {
+ SCM handle = scm_assoc (key, scm_car (achain));
+ if (scm_is_pair (handle))
+ return scm_cdr (handle);
+ else
+ return ly_chain_assoc_get (key, scm_cdr (achain), dfault);
+ }
+ else
+ return dfault == SCM_UNDEFINED ? SCM_BOOL_F : dfault;
+}
return src;
}
-SCM
-ly_chain_assoc_get (SCM key, SCM achain, SCM dfault)
-{
- if (scm_is_pair (achain))
- {
- SCM handle = scm_assoc (key, scm_car (achain));
- if (scm_is_pair (handle))
- return scm_cdr (handle);
- else
- return ly_chain_assoc (key, scm_cdr (achain));
- }
- else
- return dfault;
-}
-SCM
-ly_chain_assoc (SCM key, SCM achain)
-{
- if (scm_is_pair (achain))
- {
- SCM handle = scm_assoc (key, scm_car (achain));
- if (scm_is_pair (handle))
- return handle;
- else
- return ly_chain_assoc (key, scm_cdr (achain));
- }
- else
- return SCM_BOOL_F;
-}
/* looks the key up in the cdrs of the alist-keys
- ignoring the car and ignoring non-pair keys.
static Long_option_init options_static[]
= {
{_i ("BACK"), "backend", 'b', _i ("use backend BACK (gnome, ps [default],\n scm, svg, tex, texstr)")},
+
+ {_i ("SYM=VAL"), "define-default", 'd',
+ _i ("define a default Scheme setting.")},
+
{_i ("EXPR"), "evaluate", 'e', _i ("set scheme option, for help use\n -e '(ly:option-usage)'")},
/* Bug in option parser: --output =foe is taken as an abbreviation
for --output-format. */
make_print = false;
break;
+ case 'd':
+
+ break;
+
case 'v':
notice ();
exit (0);
PangoFontDescription *
properties_to_pango_description (SCM chain, Real text_size)
{
- SCM name = ly_chain_assoc (ly_symbol2scm ("font-name"), chain);
+ SCM name = ly_chain_assoc_get (ly_symbol2scm ("font-name"), chain, SCM_BOOL_F);
PangoFontDescription *description = 0;
- if (scm_is_pair (name) && scm_is_string (scm_cdr (name)))
+ if (scm_is_string (name))
{
- String name_str = ly_scm2string (scm_cdr (name));
+ String name_str = ly_scm2string (name);
description = pango_font_description_from_string (name_str.to_str0 ());
}
else
. (
(print-function . ,Grid_line_interface::print)
(X-extent-callback . ,Grid_line_interface::width_callback)
+ (self-alignment-X . ,CENTER)
+ (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
+ ,Self_alignment_interface::centered_on_parent))
(layer . 0)
(meta . ((interfaces . (grid-line-interface)))
)))