"a string (for file based outputs) or a socket (for network based "
"output).")
{
- Book *book = unsmob_book (book_smob);
+ LY_ASSERT_FIRST_SMOB (Book, book_smob);
+
+ Book *book = unsmob_book (book_smob);
- LY_FUNC_NOTE_FIRST_ARG(book_smob);
-
- LY_ASSERT_SMOB(Book,1);
LY_ASSERT_SMOB(Output_def, 2);
LY_ASSERT_SMOB(Output_def, 3);
"the grob to be created and the corresponding line number in the "
"C++ source file.")
{
- SCM_ASSERT_TYPE(ly_is_procedure (cb), cb, SCM_ARG1, __FUNCTION__,
- "procedure");
+ LY_ASSERT_FIRST_TYPE (ly_is_procedure, cb);
creation_callback = cb;
(SCM name),
"Get the file for font @var{name}")
{
- SCM_ASSERT_TYPE (scm_is_string (name), name,
- SCM_ARG1, __FUNCTION__, "string");
-
+ LY_ASSERT_FIRST_TYPE(scm_is_string, name);
FcPattern*pat = FcPatternCreate ();
FcValue val;
"is not available, return @code{#f}.")
{
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
- SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+ LY_ASSERT_TYPE(scm_is_string, 2);
Stencil m = fm->find_by_name (ly_scm2string (name));
"in @var{font}.")
{
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
- SCM_ASSERT_TYPE (scm_is_number (index), index, SCM_ARG2, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+ LY_ASSERT_TYPE(scm_is_number, 2);
return fm->get_ascii_char_stencil (scm_to_int (index)).smobbed_copy ();
}
"Return the index for @var{name} in @var{font}.")
{
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
- SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+ LY_ASSERT_TYPE(scm_is_string, 2);
return scm_from_int (fm->name_to_index (ly_scm2string (name)));
}
"Return the character code for @var{index} @var{font}.")
{
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
- SCM_ASSERT_TYPE (scm_is_integer (index), index, SCM_ARG2, __FUNCTION__, "index");
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+ LY_ASSERT_TYPE(scm_is_integer, 2);
return scm_from_unsigned_integer (fm->index_to_charcode (scm_to_int (index)));
}
"Return the character code for glyph @var{name} in @var{font}.")
{
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
- SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+ LY_ASSERT_TYPE(scm_is_string, 2);
return scm_from_unsigned_integer (fm->index_to_charcode (fm->name_to_index (ly_scm2string (name))));
}
Modified_font_metric *fm = dynamic_cast<Modified_font_metric *>
(unsmob_metrics (font));
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "modified font metric");
- SCM_ASSERT_TYPE (scm_is_string (text), text, SCM_ARG2, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+ LY_ASSERT_TYPE(scm_is_string, 2);
Stencil stc (fm->text_stencil (ly_scm2string (text)));
return scm_cons (ly_interval2scm (stc.extent (X_AXIS)),
ly_interval2scm (stc.extent (Y_AXIS)));
"Given the font metric @var{font}, "
"return the corresponding file name.")
{
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
SCM name = fm->font_file_name ();
return name;
"Given the font metric @var{font}, "
"return the corresponding name.")
{
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
return ly_string2scm (fm->font_name ());
}
"Given the font metric @var{font}, return the "
"magnification, relative to the current output-scale.")
{
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
return scm_cdr (fm->description_);
}
"Given the font metric @var{font}, return the "
"design size, relative to the current output-scale.")
{
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
+
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
return scm_from_double (fm->design_size ());
}
#include "lily-guile.hh"
#include "warn.hh"
+/* type predicates. */
+#include "spanner.hh"
+#include "item.hh"
+
+
static SCM doc_hash_table;
void
ly_add_type_predicate ((void*) &ly_is_symbol, "symbol");
ly_add_type_predicate ((void*) &scm_is_vector, "vector");
ly_add_type_predicate ((void*) &is_axis, "axis");
+ ly_add_type_predicate ((void*) &unsmob_spanner, "spanner");
+ ly_add_type_predicate ((void*) &unsmob_item, "item");
}
ADD_SCM_INIT_FUNC(func_doc, init_func_doc);
"Return the absolute file name of @var{name}, "
"or @code{#f} if not found.")
{
- SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, name);
string nm = ly_scm2string (name);
string file_name = global_path.find (nm);
"Read the file @var{name}, and return its contents in a string. "
"The file is looked up using the search path. ")
{
- SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, name);
int sz = INT_MAX;
if (size != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (scm_is_number (size), size, SCM_ARG2, __FUNCTION__, "number");
+ LY_ASSERT_TYPE(scm_is_number, 2);
sz = scm_to_int (size);
}
"Scheme callable function to issue the error @code{msg}. "
"The error is formatted with @code{format} and @code{rest}.")
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
str = scm_simple_format (SCM_BOOL_F, str, rest);
error (ly_scm2string (str));
return SCM_UNSPECIFIED;
"Scheme callable function to issue the message @code{msg}. "
"The message is formatted with @code{format} and @code{rest}.")
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
str = scm_simple_format (SCM_BOOL_F, str, rest);
message (ly_scm2string (str));
return SCM_UNSPECIFIED;
"Scheme callable function to print progress @code{str}. "
"The message is formatted with @code{format} and @code{rest}.")
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
str = scm_simple_format (SCM_BOOL_F, str, rest);
progress_indication (ly_scm2string (str));
return SCM_UNSPECIFIED;
"Scheme callable function to issue the warning @code{msg}. "
"The message is formatted with @code{format} and @code{rest}.")
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
str = scm_simple_format (SCM_BOOL_F, str, rest);
programming_error (ly_scm2string (str));
return SCM_UNSPECIFIED;
"Scheme callable function to issue the warning @code{str}. "
"The message is formatted with @code{format} and @code{rest}.")
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
str = scm_simple_format (SCM_BOOL_F, str, rest);
warning (ly_scm2string (str));
return SCM_UNSPECIFIED;
3, 0, 0, (SCM a, SCM b, SCM s),
"Replace @var{a} by @var{b} in @var{s}.")
{
- SCM_ASSERT_TYPE (scm_is_string (a), s, SCM_ARG1, __FUNCTION__, "string");
- SCM_ASSERT_TYPE (scm_is_string (b), s, SCM_ARG2, __FUNCTION__, "string");
- SCM_ASSERT_TYPE (scm_is_string (s), s, SCM_ARG3, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, s);
+ LY_ASSERT_TYPE(scm_is_string, 2);
+ LY_ASSERT_TYPE(scm_is_string, 3);
string ss = ly_scm2string (s);
replace_all (ss, string (scm_i_string_chars (a)),
1, 0, 0, (SCM s),
"Convert @var{num} to a string without generating many decimals.")
{
- SCM_ASSERT_TYPE (scm_is_number (s), s, SCM_ARG1, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_TYPE(scm_is_number, s);
char str[400]; // ugh.
1, 0, 0, (SCM string),
"Gettext wrapper.")
{
- SCM_ASSERT_TYPE (scm_is_string (string), string, SCM_ARG1,
- __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, string);
return ly_string2scm (_ (scm_i_string_chars (string)));
}
{
char buf[5];
- SCM_ASSERT_TYPE (scm_is_integer (wc), wc, SCM_ARG1, __FUNCTION__, "integer");
+ LY_ASSERT_FIRST_TYPE(scm_is_integer, wc);
unsigned wide_char = (unsigned) scm_to_int (wc);
char *p = buf;
1, 1, 0, (SCM file_name, SCM mode),
"Redirect stderr to FILE-NAME, opened with MODE.")
{
- SCM_ASSERT_TYPE (scm_is_string (file_name), file_name, SCM_ARG1,
- __FUNCTION__, "file_name");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, file_name);
string m = "w";
if (mode != SCM_UNDEFINED && scm_string_p (mode))
1, 0, 0, (SCM name_sym),
"Convert FooBar_Bla to foo-bar-bla style symbol.")
{
- SCM_ASSERT_TYPE(scm_is_symbol (name_sym), name_sym,
- SCM_ARG1, __FUNCTION__, "symbol");
+ LY_ASSERT_FIRST_TYPE(ly_is_symbol, name_sym);
/*
TODO: should use strings instead?
1, 0, 0, (SCM str),
"Expand $VAR and $@{VAR@} in @var{str}.")
{
- SCM_ASSERT_TYPE(scm_is_string (str), str,
- SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
return ly_string2scm (expand_environment_variables (ly_scm2string (str)));
}
2, 0, 0, (SCM lst, SCM i),
"Take at most the first @var{i} of list @var{lst}")
{
- SCM_ASSERT_TYPE(scm_is_integer (i), i,
- SCM_ARG1, __FUNCTION__, "integer");
+ LY_ASSERT_FIRST_TYPE(scm_is_integer, i);
int k = scm_to_int (i);
if (k == 0)
1, 0, 1, (SCM str, SCM rest),
"LilyPond specific format, supporting ~a ~[0-9]f.")
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
string format = ly_scm2string (str);
vector<string> results;
(c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
+
#include "cpu-timer.hh"
#include "global-context.hh"
#include "international.hh"
"process it and return the @code{Music_output} object in its final state.")
{
Global_context *g = dynamic_cast<Global_context *> (unsmob_context (context));
- SCM_ASSERT_TYPE (g, context, SCM_ARG1, __FUNCTION__, "Global context");
+
+ LY_ASSERT_FIRST_TYPE (unsmob_global_context, context)
SCM output = g->get_output ();
progress_indication ("\n");
"@var{global}. The translator group is returned.")
{
Global_context *g = dynamic_cast<Global_context *> (unsmob_context (global));
- SCM_ASSERT_TYPE (g, global, SCM_ARG1, __FUNCTION__, "Global context");
+ LY_ASSERT_FIRST_TYPE (unsmob_global_context, global)
Translator_group *tg = new Translator_group ();
tg->connect_to_context (g);
"The context is returned.\n"
)
{
- Output_def *odef = unsmob_output_def (output_def);
-
- SCM_ASSERT_TYPE (odef, output_def, SCM_ARG1, __FUNCTION__,
- "Output definition");
+ LY_ASSERT_FIRST_SMOB (Output_def, output_def);
+ Output_def *odef = unsmob_output_def (output_def);
Global_context *glob = new Global_context (odef);
"global context @var{ctx}. The context is returned in its\n"
"final state.\n")
{
- Music *music = unsmob_music (mus);
- Global_context *g = dynamic_cast<Global_context *> (unsmob_context (ctx));
- SCM_ASSERT_TYPE (music, mus, SCM_ARG1, __FUNCTION__, "Music");
- SCM_ASSERT_TYPE (g, ctx, SCM_ARG2, __FUNCTION__, "Global context");
+ LY_ASSERT_FIRST_SMOB (Music, mus);
+ LY_ASSERT_TYPE (unsmob_global_context, 2);
+ Music *music = unsmob_music (mus);
if (!music
|| !music->get_length ().to_bool ())
{
return SCM_BOOL_F;
}
+ Global_context *g = dynamic_cast<Global_context *> (unsmob_context (ctx));
+
Cpu_timer timer;
message (_ ("Interpreting music... "));
"Optionally, this routine takes an Object-key to\n"
"to uniquely identify the Score block containing it.\n")
{
+ LY_ASSERT_FIRST_SMOB (Music, mus);
+ LY_ASSERT_SMOB (Output_def, 2);
+
SCM glob = ly_make_global_context (output_def);
ly_make_global_translator (glob);
ly_interpret_music_expression (mus, glob);
else
return Context::get_default_interpreter ();
}
+
+Global_context *
+unsmob_global_context (SCM x)
+{
+ return dynamic_cast<Global_context *> (unsmob_context (x));
+}
(SCM grob_arr),
"Return the grob_array length.")
{
+ LY_ASSERT_FIRST_SMOB (Grob_array, grob_arr);
+
Grob_array *me = unsmob_grob_array (grob_arr);
- SCM_ASSERT_TYPE (me, grob_arr, SCM_ARG1, __FUNCTION__, "Grob_array");
return scm_from_int (me->size ());
}
"Retrieve the @code{index} element of @code{grob-arr}.")
{
Grob_array *me = unsmob_grob_array (grob_arr);
- SCM_ASSERT_TYPE (me, grob_arr, SCM_ARG1, __FUNCTION__, "Grob_array");
- SCM_ASSERT_TYPE (scm_is_integer (index), index, SCM_ARG2, __FUNCTION__, "integer");
+ LY_ASSERT_FIRST_SMOB (Grob_array, grob_arr);
+ LY_ASSERT_TYPE(scm_is_integer, 2);
vsize i = scm_to_unsigned (index);
if (i == VPOS || i >= me->size ())
3, 0, 0, (SCM a, SCM b, SCM c),
"Add an interface description.")
{
- SCM_ASSERT_TYPE (scm_is_symbol (a), a, SCM_ARG1, __FUNCTION__, "symbol");
- SCM_ASSERT_TYPE (scm_is_string (b), b, SCM_ARG2, __FUNCTION__, "string");
- SCM_ASSERT_TYPE (ly_is_list (c), c, SCM_ARG3, __FUNCTION__, "list of syms");
+ LY_ASSERT_FIRST_TYPE (ly_is_symbol, a);
+ LY_ASSERT_TYPE(scm_is_string, 2);
+ LY_ASSERT_TYPE(ly_is_list, 3);
if (!all_ifaces)
{
SCM tab = scm_c_make_hash_table (59);
"which the modification was requested, the property to be changed and "
"the new value for the property.")
{
-
- SCM_ASSERT_TYPE(ly_is_procedure (cb), cb, SCM_ARG1, __FUNCTION__,
- "procedure");
+ LY_ASSERT_FIRST_TYPE(ly_is_procedure, cb);
modification_callback = cb;
return SCM_UNSPECIFIED;
{
Grob *sc = unsmob_grob (grob);
- LY_FUNC_NOTE_FIRST_ARG(grob);
- LY_ASSERT_SMOB(Grob, 1);
-
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
return sc->get_property_data (sym);
}
"Set @var{sym} in grob @var{grob} to value @var{val}")
{
Grob *sc = unsmob_grob (grob);
- SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
if (!ly_is_procedure (val)
&& !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
"\n\n")
{
Grob *sc = unsmob_grob (grob);
- SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
if (deflt == SCM_UNDEFINED)
deflt = SCM_EOL;
"Return the interfaces list of grob @var{grob}.")
{
Grob *sc = unsmob_grob (grob);
- SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
return sc->interfaces ();
}
"\n\n")
{
Grob *sc = unsmob_grob (grob);
- SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
return sc->internal_get_object (sym);
}
/* TODO: make difference between scaled and unscalead variable in
calling (i.e different funcs.) */
LY_DEFINE (ly_grob_layout, "ly:grob-layout",
- 1, 0, 0, (SCM g),
- "Get @code{\\layout} definition from grob @var{g}.")
+ 1, 0, 0, (SCM grob),
+ "Get @code{\\layout} definition from grob @var{grob}.")
{
- Grob *sc = unsmob_grob (g);
- SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob");
+ Grob *sc = unsmob_grob (grob);
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
return sc->layout ()->self_scm ();
}
"from the layout block is taken. ")
{
Grob *sc = unsmob_grob (grob);
- SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
if (global == SCM_UNDEFINED)
{
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");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_SMOB(Grob, 2);
+ LY_ASSERT_TYPE(is_axis, 3);
Axis a = Axis (scm_to_int (axis));
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");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_SMOB(Grob, 2);
+ LY_ASSERT_TYPE(is_axis, 3);
Axis a = Axis (scm_to_int (axis));
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");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_SMOB(Grob, 2);
+ LY_ASSERT_TYPE(is_axis, 3);
Axis a = Axis (scm_to_int (axis));
"1 for the Y-axis.")
{
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");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_TYPE(is_axis, 2);
Grob *par = sc->get_parent (Axis (scm_to_int (axis)));
return par ? par->self_scm () : SCM_EOL;
"Get the mutable proprerties of @var{grob}.")
{
Grob *g = unsmob_grob (grob);
- SCM_ASSERT_TYPE (g, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
/* FIXME: uhg? copy/read only? */
return g->mutable_property_alist_;
"Get the immutable properties of @var{grob}.")
{
Grob *g = unsmob_grob (grob);
- SCM_ASSERT_TYPE (g, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
/* FIXME: uhg? copy/read only? */
return g->immutable_property_alist_;
}
LY_DEFINE (ly_grob_system, "ly:grob-system",
- 1, 0, 0, (SCM g),
- "Return the System Grob of @var{g}.")
+ 1, 0, 0, (SCM grob),
+ "Return the System Grob of @var{grob}.")
{
- Grob *me = unsmob_grob (g);
- SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob");
+ Grob *me = unsmob_grob (grob);
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
if (System *g = me->get_system ())
return g->self_scm ();
"Return the unbroken original Grob of @var{grob}.")
{
Grob *me = unsmob_grob (grob);
- SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
return me->original () ? me->original ()->self_scm () : me->self_scm ();
}
LY_DEFINE (ly_grob_suicide_x, "ly:grob-suicide!",
- 1, 0, 0, (SCM g),
- "Kill @var{g}.")
+ 1, 0, 0, (SCM grob),
+ "Kill @var{grob}.")
{
- Grob *me = unsmob_grob (g);
- SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob");
+ Grob *me = unsmob_grob (grob);
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
me->suicide ();
return SCM_UNSPECIFIED;
}
LY_DEFINE (ly_grob_translate_axis_x, "ly:grob-translate-axis!",
- 3, 0, 0, (SCM g, SCM d, SCM a),
+ 3, 0, 0, (SCM grob, SCM d, SCM a),
"Translate @var{g} on axis @var{a} over distance @var{d}.")
{
- Grob *me = unsmob_grob (g);
- SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (scm_is_number (d), d, SCM_ARG2, __FUNCTION__, "dimension");
- SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG3, __FUNCTION__, "axis");
+ Grob *me = unsmob_grob (grob);
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_TYPE(scm_is_number, 2);
+ LY_ASSERT_TYPE(is_axis, 3);
me->translate_axis (scm_to_double (d), Axis (scm_to_int (a)));
return SCM_UNSPECIFIED;
"Return the default font for grob @var{gr}.")
{
Grob *gr = unsmob_grob (grob);
- SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
return Font_interface::get_default_font (gr)->self_scm ();
}
{
Grob *gr = unsmob_grob (grob);
- SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_SMOB(Grob, 2);
Grob *o = unsmob_grob (other);
- SCM_ASSERT_TYPE (o, other, SCM_ARG2, __FUNCTION__, "grob");
- SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+ LY_ASSERT_TYPE(is_axis, 3);
Grob *refp = gr->common_refpoint (o, Axis (scm_to_int (axis)));
return refp ? refp->self_scm () : SCM_BOOL_F;
)
{
Grob *gr = unsmob_grob (grob);
- SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob");
+
+ LY_ASSERT_FIRST_SMOB(Grob, grob);
+ LY_ASSERT_SMOB(Grob_array, 2);
Grob_array *ga = unsmob_grob_array (others);
- SCM_ASSERT_TYPE (ga, others, SCM_ARG2, __FUNCTION__, "grob array");
- SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+ LY_ASSERT_TYPE(is_axis, 3);
Grob *refp = common_refpoint_of_array (ga->array (), gr, Axis (scm_to_int (axis)));
return refp ? refp->self_scm () : SCM_BOOL_F;
Box lookup_tex_text_dimension (Font_metric *font, SCM text);
+char *pfb2pfa (Byte const *pfb, int length);
+
#endif /* FONT_METRIC_HH */
};
SCM ly_format_output (SCM);
+Global_context *unsmob_global_context (SCM x);
#endif // GLOBAL_CONTEXT_HH
extern int function_argument_direction;
#define LY_FUNC_NOTE_FIRST_ARG(a) \
- SCM *first_arg_ptr = &a; \
- int stack_grow_dir = 0; \
- stack_grow_dir = ((void*) &first_arg_ptr < (void*) &stack_grow_dir) ? -1 : 1;
+ SCM *first_arg_ptr = &a;
#define LY_ASSERT_TYPE(pred, number) \
{ \
- if (!pred (first_arg_ptr[(number-1)*stack_grow_dir])) \
+ if (!pred (first_arg_ptr[(number-1)*function_argument_direction])) \
{ \
scm_wrong_type_arg_msg(mangle_cxx_identifier (__FUNCTION__).c_str(), \
- number, first_arg_ptr[(number-1)*stack_grow_dir], \
+ number, first_arg_ptr[(number-1)*function_argument_direction], \
predicate_to_typename ((void*) &pred).c_str()); \
} \
}
};
DECLARE_UNSMOB (Music_output, music_output);
-
+Paper_score *unsmob_paper_score (SCM);
+Performance *unsmob_performance (SCM);
#endif /* MUSIC_OUTPUT_HH */
"location in @var{sip}. @var{msg} is interpreted similar to @code{format}'s argument\n")
{
Input *ip = unsmob_input (sip);
-
- SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string");
+
+ LY_ASSERT_FIRST_TYPE (unsmob_input, sip);
+ LY_ASSERT_TYPE(scm_is_string, 2);
msg = scm_simple_format (SCM_BOOL_F, msg, rest);
1, 0, 0, (SCM sip),
"Return input location in @var{sip} as (file-name line char column).")
{
+ LY_ASSERT_FIRST_TYPE (unsmob_input, sip);
Input *ip = unsmob_input (sip);
- SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
int l = 0;
int ch = 0;
"Return input location in @var{sip} as "
"(file-name first-line first-column last-line last-column).")
{
+
+ LY_ASSERT_FIRST_TYPE (unsmob_input, sip);
Input *ip = unsmob_input (sip);
- SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location");
+
return scm_list_5 (ly_string2scm (ip->file_string ()),
scm_from_int (ip->line_number ()),
scm_from_int (ip->column_number ()),
"The break status dir of item @var{it}. @code{-1} is end of "
"line, @code{0} unbroken, and @code{1} begin of line.")
{
- Item *me = dynamic_cast<Item *> (unsmob_grob (it));
- SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item");
+ LY_ASSERT_FIRST_TYPE (unsmob_item, it);
+ Item *me = unsmob_item (it);
return scm_from_int (me->break_status_dir ());
}
char *
ly_scm2newstr (SCM str, size_t *lenp)
{
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, str);
size_t len = scm_i_string_length (str);
if (char *new_str = (char *) malloc ((len + 1) * sizeof (char)))
1, 0, 0, (SCM lexer),
"Return a list of (KEY . CODE) pairs, signifying the lilypond reserved words list.")
{
+ LY_ASSERT_FIRST_SMOB(Lily_lexer, lexer);
+
Lily_lexer * lex = Lily_lexer::unsmob (lexer);
- SCM_ASSERT_TYPE(lex, lexer, SCM_ARG1, __FUNCTION__, "lily lexer");
return lex->keyword_list ();
}
"Parse a single @code{.ly} file. "
"Upon failure, throw @code{ly-file-failed} key.")
{
- SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, name);
string file = ly_scm2string (name);
char const *extensions[] = {"ly", "", 0};
/*
outside the if-else to ensure cleanup fo Sources object,
- */
+ */
if (error)
/* TODO: pass renamed input file too. */
scm_throw (ly_symbol2scm ("ly-file-failed"),
1, 0, 0, (SCM parser_smob),
"Return a clone of @var{parser-smob}.")
{
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser_smob);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
Lily_parser *clone = new Lily_parser (*parser);
3, 0, 0, (SCM parser_smob, SCM symbol, SCM val),
"Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.")
{
+
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser_smob);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
- SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
- SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG2, __FUNCTION__, "parser");
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
+
parser->lexer_->set_identifier (scm_symbol_to_string (symbol), val);
return SCM_UNSPECIFIED;
}
"Lookup @var{symbol} in @var{parser-smob}'s module. "
"Undefined is '().")
{
- Lily_parser *parser = unsmob_lily_parser (parser_smob);
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser_smob);
- SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol");
- SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG2, __FUNCTION__, "parser");
+ Lily_parser *parser = unsmob_lily_parser (parser_smob);
+
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
SCM val = parser->lexer_->lookup_identifier (ly_scm2string (scm_symbol_to_string (symbol)));
if (val != SCM_UNDEFINED)
"Parse the string @code{ly-code} with @code{parser-smob}."
"Upon failure, throw @code{ly-file-failed} key.")
{
- Lily_parser *parser = unsmob_lily_parser (parser_smob);
-
- SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "parser");
- SCM_ASSERT_TYPE (scm_is_string (ly_code), ly_code, SCM_ARG2, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser_smob);
+ Lily_parser *parser = unsmob_lily_parser (parser_smob);
+ LY_ASSERT_TYPE(scm_is_string, 2);
parser->parse_string (ly_scm2string (ly_code));
"@var{names} is an alist of symbols. "
"This only has effect if the current mode is notes.")
{
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser);
Lily_parser *p = unsmob_lily_parser (parser);
- SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
if (p->lexer_->is_note_state ())
{
1, 0, 0, (SCM parser),
"Return the base name of the output file.")
{
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser);
Lily_parser *p = unsmob_lily_parser (parser);
- SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
return ly_string2scm (p->output_basename_);
}
2, 1, 0, (SCM parser, SCM msg, SCM input),
"Display an error message, and make the parser fail")
{
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser);
Lily_parser *p = unsmob_lily_parser (parser);
- SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
- SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string");
+
+ LY_ASSERT_TYPE(scm_is_string, 2);
string s = ly_scm2string (msg);
Input *i = unsmob_input (input);
1, 0, 0, (SCM parser),
"Clear the error flag for the parser.")
{
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser);
Lily_parser *p = unsmob_lily_parser (parser);
- SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
+
p->error_level_ = 0;
p->lexer_->error_level_ = 0;
1, 0, 0, (SCM parser),
"Does @var{parser} have an error flag?")
{
+ LY_ASSERT_FIRST_SMOB (Lily_parser, parser);
Lily_parser *p = unsmob_lily_parser (parser);
- SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser");
return scm_from_bool (p->error_level_ || p->lexer_->error_level_);
}
"notes, and @var{g} the timing for grace notes. "
"In absence of grace notes, @var{g} is zero.\n")
{
- SCM_ASSERT_TYPE (scm_is_integer (n), n, SCM_ARG1, __FUNCTION__, "integer");
- SCM_ASSERT_TYPE (scm_is_integer (d), d, SCM_ARG2, __FUNCTION__, "integer");
+ LY_ASSERT_FIRST_TYPE(scm_is_integer, n);
+ LY_ASSERT_TYPE(scm_is_integer, 2);
int grace_num = 0;
if (gn != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (scm_is_integer (gn), gn, SCM_ARG3, __FUNCTION__, "integer");
+ LY_ASSERT_TYPE(scm_is_integer, 3);
grace_num = scm_to_int (gn);
}
int grace_den = 1;
if (gd != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (scm_is_integer (gd), gd, SCM_ARG4, __FUNCTION__, "integer");
+ LY_ASSERT_TYPE(scm_is_integer, 4);
grace_den = scm_to_int (gd);
}
2, 0, 0, (SCM a, SCM b),
"Subtract two moments.")
{
+ LY_ASSERT_FIRST_SMOB (Moment, a);
+ LY_ASSERT_SMOB (Moment, 2);
+
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 ();
}
2, 0, 0, (SCM a, SCM b),
"Add two moments.")
{
+ LY_ASSERT_FIRST_SMOB(Moment, a);
+ LY_ASSERT_SMOB(Moment, 2);
+
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 ();
}
2, 0, 0, (SCM a, SCM b),
"Multiply two moments.")
{
+ LY_ASSERT_FIRST_SMOB(Moment, a);
+ LY_ASSERT_SMOB(Moment, 2);
+
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 ();
}
2, 0, 0, (SCM a, SCM b),
"Divide two moments.")
{
+ LY_ASSERT_FIRST_SMOB(Moment, a);
+ LY_ASSERT_SMOB(Moment, 2);
+
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 ();
}
2, 0, 0, (SCM a, SCM b),
"Modulo of two moments.")
{
+ LY_ASSERT_FIRST_SMOB(Moment, a);
+ LY_ASSERT_SMOB(Moment, 2);
+
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 ();
}
1, 0, 0, (SCM mom),
"Extract numerator from grace timing.")
{
+ LY_ASSERT_FIRST_SMOB (Moment, mom);
+
Moment *ma = unsmob_moment (mom);
- SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment");
return scm_from_int (ma->grace_part_.numerator ());
}
1, 0, 0, (SCM mom),
"Extract denominator from grace timing.")
{
+ LY_ASSERT_FIRST_SMOB (Moment, mom);
Moment *ma = unsmob_moment (mom);
- SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment");
return scm_from_int (ma->grace_part_.denominator ());
}
1, 0, 0, (SCM mom),
"Extract numerator from main timing.")
{
+ LY_ASSERT_FIRST_SMOB (Moment, mom);
Moment *ma = unsmob_moment (mom);
- SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment");
return scm_from_int (ma->main_part_.numerator ());
}
1, 0, 0, (SCM mom),
"Extract denominator from main timing.")
{
+ LY_ASSERT_FIRST_SMOB (Moment, mom);
Moment *ma = unsmob_moment (mom);
- SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment");
return scm_from_int (ma->main_part_.denominator ());
}
2, 0, 0, (SCM a, SCM b),
"Compare two moments.")
{
+ LY_ASSERT_FIRST_SMOB(Moment, a);
+ LY_ASSERT_SMOB (Moment, 2);
+
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 x),
"Return the Scheme function inside @var{x}")
{
- SCM_ASSERT_TYPE(is_music_function (x), x, SCM_ARG1, __FUNCTION__,
- "music function");
+ LY_ASSERT_FIRST_TYPE(is_music_function, x);
return SCM_CELL_OBJECT_1(x);
}
"Its arguments. @code{signature} is a list containing either "
"@code{ly:music?} predicates or other type predicates.")
{
- SCM_ASSERT_TYPE(ly_is_procedure (func), func, SCM_ARG1, __FUNCTION__, "function");
+ LY_ASSERT_FIRST_TYPE(ly_is_procedure, func);
return make_music_function (signature, func);
}
1, 0, 0, (SCM mus),
"Get the length of music expression @var{mus}, and return as a @code{Moment} object.")
{
+ LY_ASSERT_FIRST_TYPE (unsmob_music, mus);
Music *sc = unsmob_music (mus);
- SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
return sc->get_length ().smobbed_copy ();
}
"Get the property @var{sym} of music expression @var{mus}.\n"
"If @var{sym} is undefined, return @code{'()}.\n")
{
- Music *sc = unsmob_music (mus);
- SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
+ LY_ASSERT_FIRST_TYPE (unsmob_music, mus);
return ly_prob_property (mus,sym,dfault);
}
3, 0, 0, (SCM mus, SCM sym, SCM val),
"Set property @var{sym} in music expression @var{mus} to @var{val}.")
{
- Music *sc = unsmob_music (mus);
- SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music");
+ LY_ASSERT_FIRST_TYPE (unsmob_music, mus);
+
return ly_prob_set_property_x (mus, sym, val);
}
"they are constant and initialized by the "
"@code{make-music} function.\n")
{
+ LY_ASSERT_FIRST_TYPE (unsmob_music, mus);
Music *m = unsmob_music (mus);
- SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "music");
return m->get_property_alist (true);
}
"Transpose @var{m} such that central C is mapped to @var{p}. "
"Return @var{m}.")
{
+ LY_ASSERT_FIRST_TYPE (unsmob_music, m);
+ LY_ASSERT_SMOB (Pitch, 2);
+
Music *sc = unsmob_music (m);
Pitch *sp = unsmob_pitch (p);
- SCM_ASSERT_TYPE (sc, m, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE (sp, p, SCM_ARG2, __FUNCTION__, "pitch");
sc->transpose (*sp);
// SCM_UNDEFINED ?
2, 0, 0, (SCM m, SCM factor),
"Compress music object @var{m} by moment @var{factor}.")
{
- Music *sc = unsmob_music (m);
-
- SCM_ASSERT_TYPE (sc, m, SCM_ARG1, __FUNCTION__, "music");
- SCM_ASSERT_TYPE (unsmob_moment (factor), factor, SCM_ARG2, __FUNCTION__, "moment");
+ LY_ASSERT_FIRST_TYPE (unsmob_music, m);
+ LY_ASSERT_TYPE(unsmob_moment, 2);
+ Music *sc = unsmob_music (m);
sc->compress (*unsmob_moment (factor));
return sc->self_scm ();
}
(SCM mus),
"Extract the duration field from @var{mus}, and return the length.")
{
+ LY_ASSERT_FIRST_TYPE (unsmob_music, mus);
Music *m = unsmob_music (mus);
- SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music");
Duration *d = unsmob_duration (m->get_property ("duration"));
Moment len;
(SCM mus, SCM fact),
"Compress @var{mus} by factor @var{fact}, which is a @code{Moment}.")
{
+ LY_ASSERT_FIRST_TYPE (unsmob_music, mus);
+ LY_ASSERT_SMOB (Moment, 2);
+
Music *m = unsmob_music (mus);
Moment *f = unsmob_moment (fact);
- SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music");
- SCM_ASSERT_TYPE (f, fact, SCM_ARG2, __FUNCTION__, "Moment");
Duration *d = unsmob_duration (m->get_property ("duration"));
if (d)
"Get attachment in @var{font-metric} for attaching a stem to notehead "
"@var{glyph-name}.")
{
+ LY_ASSERT_FIRST_SMOB (Font_metric, font_metric);
Font_metric *fm = unsmob_metrics (font_metric);
- SCM_ASSERT_TYPE(fm, font_metric, SCM_ARG1, __FUNCTION__, "font metric");
- SCM_ASSERT_TYPE(scm_is_string (glyph_name), glyph_name, SCM_ARG2, __FUNCTION__, "string");
+ LY_ASSERT_TYPE(scm_is_string, 2);
return ly_offset2scm (Note_head::get_stem_attachment (fm, ly_scm2string (glyph_name)));
}
"Given the font metric @var{font} of an OpenType font, return the "
"names of the subfonts within @var{font}.")
{
+ LY_ASSERT_FIRST_SMOB (Font_metric, font);
Font_metric *fm = unsmob_metrics (font);
- SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
return fm->sub_fonts ();
}
Modified_font_metric *fm
= dynamic_cast<Modified_font_metric *> (unsmob_metrics (font));
Open_type_font *otf = dynamic_cast<Open_type_font *> (fm->original_font ());
+
+ LY_FUNC_NOTE_FIRST_ARG (font);
SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font-metric");
- SCM_ASSERT_TYPE (scm_is_string (glyph), glyph, SCM_ARG1,
- __FUNCTION__, "string");
+ LY_ASSERT_TYPE(scm_is_string, 2);
SCM sym = scm_string_to_symbol (glyph);
return scm_hashq_ref (otf->get_char_table (), sym, SCM_EOL);
: 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");
+ LY_FUNC_NOTE_FIRST_ARG (font);
+ LY_ASSERT_TYPE (scm_is_string, 2);
char ctag [5] = " ";
: dynamic_cast<Open_type_font *> (unsmob_metrics (font));
- SCM_ASSERT_TYPE (otf,font, SCM_ARG1, __FUNCTION__, "OTF font");
+ SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font");
return otf->glyph_list ();
}
"Lookup @var{sym} in the Output_def @var{pap}. "
"Return the value or @var{def} (which defaults to @code{'()}) if undefined.")
{
+ LY_ASSERT_FIRST_SMOB (Output_def, pap);
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");
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
SCM answer = op->lookup_variable (sym);
if (answer == SCM_UNDEFINED)
1, 0, 0, (SCM def),
"Get the variable scope inside @var{def}.")
{
+ LY_ASSERT_FIRST_SMOB (Output_def, def);
Output_def *op = unsmob_output_def (def);
- SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition");
return op->scope_;
}
1, 0, 0, (SCM def),
"Get the parent output-def of @var{def}.")
{
+ LY_ASSERT_FIRST_SMOB (Output_def, def);
Output_def *op = unsmob_output_def (def);
- SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition");
return op->parent_ ? op->parent_->self_scm () : SCM_EOL;
}
1, 0, 0, (SCM def),
"Clone @var{def}.")
{
+ LY_ASSERT_FIRST_SMOB (Output_def, def);
Output_def *op = unsmob_output_def (def);
- SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition");
Output_def *clone = op->clone ();
return clone->unprotect ();
1, 0, 0, (SCM bp),
"Get output-scale for BP.")
{
+ LY_ASSERT_FIRST_SMOB (Output_def, bp);
Output_def *b = unsmob_output_def (bp);
- SCM_ASSERT_TYPE (b, bp, SCM_ARG1, __FUNCTION__, "paper");
return scm_from_double (output_scale (b));
}
"(An alist chain is a list of alists, "
"containing grob properties).\n")
{
- Output_def *paper = unsmob_output_def (paper_smob);
- SCM_ASSERT_TYPE (paper, paper_smob, SCM_ARG1,
- __FUNCTION__, "paper definition");
+ LY_ASSERT_FIRST_SMOB (Output_def, paper_smob);
+ Output_def *paper = unsmob_output_def (paper_smob);
Font_metric *fm = select_font (paper, chain);
return fm->self_scm ();
}
(SCM layout_smob, SCM name),
"Return the layout variable @var{name}.")
{
+
+ LY_ASSERT_FIRST_SMOB (Output_def, layout_smob);
Output_def *layout = unsmob_output_def (layout_smob);
- SCM_ASSERT_TYPE (layout, layout_smob, SCM_ARG1,
- __FUNCTION__, "layout definition");
return scm_from_double (layout->get_dimension (name));
}
(SCM bp),
"Return fonts from the @code{\\paper} block @var{bp}.")
{
+ LY_ASSERT_FIRST_SMOB (Output_def, bp);
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"));
SCM tab2 = b->lookup_variable (ly_symbol2scm ("pango-fonts"));
2, 0, 0, (SCM chain, SCM size),
"Make a PangoFontDescription string for the property alist @var{chain} at size @var{size}.")
{
- SCM_ASSERT_TYPE (scm_is_number (size), size, SCM_ARG1, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_TYPE(scm_is_number, size);
PangoFontDescription *pfd = properties_to_pango_description (chain, scm_to_double (size));
char *str = pango_font_description_to_string (pfd);
1, 0, 0, (SCM pb),
"Return pages in book PB.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_book, pb);
return unsmob_paper_book (pb)->pages ();
}
1, 0, 0, (SCM book),
"Return pages in layout book @var{book}.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_book, book);
Paper_book *pb = unsmob_paper_book (book);
- SCM_ASSERT_TYPE (pb, book, SCM_ARG1, __FUNCTION__, "Paper_book");
SCM scopes = SCM_EOL;
if (ly_is_module (pb->header_))
1, 0, 0, (SCM paper_book),
"Return performances in book @var{paper-book}.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_book, paper_book);
return unsmob_paper_book (paper_book)->performances ();
}
1, 0, 0, (SCM pb),
"Return systems in book PB.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_book, pb);
return unsmob_paper_book (pb)->systems ();
}
1, 0, 0, (SCM pb),
"Return pages in book PB.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_book, pb);
Paper_book *pbook = unsmob_paper_book (pb);
- SCM_ASSERT_TYPE(pbook, pb, SCM_ARG1, __FUNCTION__, "Paper_book");
return pbook->paper_->self_scm ();
}
"Create an outputter that evaluates within "
"@code{output-}@var{format}, writing to @var{port}.")
{
- SCM_ASSERT_TYPE (ly_is_port (port), port, SCM_ARG1, __FUNCTION__,
- "port");
- SCM_ASSERT_TYPE (scm_is_string (format), format, SCM_ARG2, __FUNCTION__,
- "String");
+ LY_ASSERT_FIRST_TYPE(ly_is_port, port);
+ LY_ASSERT_TYPE (scm_is_string, 2);
string f = ly_scm2string (format);
2, 0, 0, (SCM outputter, SCM stencil),
"Dump stencil @var{expr} onto @var{outputter}.")
{
+
+ LY_ASSERT_FIRST_SMOB (Paper_outputter, outputter);
+ LY_ASSERT_SMOB(Stencil, 2);
+
Paper_outputter *po = unsmob_outputter (outputter);
Stencil *st = unsmob_stencil (stencil);
- SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter");
- SCM_ASSERT_TYPE (st, stencil, SCM_ARG1, __FUNCTION__, "Paper_outputter");
+
po->output_stencil (*st);
return SCM_UNSPECIFIED;
}
2, 0, 0, (SCM outputter, SCM str),
"Dump @var{str} onto @var{outputter}.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_outputter, outputter);
+ LY_ASSERT_TYPE(scm_is_string, 2);
+
Paper_outputter *po = unsmob_outputter (outputter);
- SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter");
- SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "Paper_outputter");
return po->dump_string (str);
}
1, 0, 0, (SCM outputter),
"Return output port for @var{outputter}.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_outputter, outputter);
Paper_outputter *po = unsmob_outputter (outputter);
- SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter");
return po->file ();
}
1, 0, 0, (SCM outputter),
"Close port of @var{outputter}.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_outputter, outputter);
Paper_outputter *po = unsmob_outputter (outputter);
- SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter");
po->close ();
return SCM_UNSPECIFIED;
2, 0, 0, (SCM outputter, SCM expr),
"Eval @var{expr} in module of @var{outputter}.")
{
+ LY_ASSERT_FIRST_SMOB (Paper_outputter, outputter);
Paper_outputter *po = unsmob_outputter (outputter);
- SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter");
po->output_scheme (expr);
(SCM paper_score),
"Return vector of paper_system objects from @var{paper-score}.")
{
- Paper_score *pscore = dynamic_cast<Paper_score *> (unsmob_music_output (paper_score));
- SCM_ASSERT_TYPE (pscore, paper_score, SCM_ARG1, __FUNCTION__, "Paper score (Music output)");
+ LY_ASSERT_FIRST_TYPE (unsmob_paper_score, paper_score);
+ Paper_score *pscore = dynamic_cast<Paper_score *> (unsmob_music_output (paper_score));
return pscore->get_paper_systems ();
}
return paper_systems_;
}
+
+Paper_score *
+unsmob_paper_score (SCM x)
+{
+ return dynamic_cast<Paper_score*> (unsmob_music_output (x));
+}
2, 0, 0, (SCM performance, SCM filename),
"Write @var{performance} to @var{filename}")
{
- Performance *perf = dynamic_cast<Performance *> (unsmob_music_output (performance));
+ LY_ASSERT_FIRST_TYPE (unsmob_performance, performance);
+ LY_ASSERT_TYPE(scm_is_string, 2);
- 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));
+ unsmob_performance (performance)->write_output (ly_scm2string (filename));
return SCM_UNSPECIFIED;
}
Performance::process ()
{
}
+
+Performance *
+unsmob_performance (SCM x)
+{
+ return dynamic_cast<Performance*> (unsmob_music_output (x));
+}
--- /dev/null
+
+#include "program-option.hh"
+#include "source-file.hh"
+#include "memory-stream.hh"
+#include "open-type-font.hh"
+#include "main.hh"
+#include "warn.hh"
+
+LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa",
+ 1, 0, 0, (SCM pfb_file_name),
+ "Convert the contents of a PFB file to PFA.")
+{
+ LY_ASSERT_FIRST_TYPE(scm_is_string, pfb_file_name);
+
+ string file_name = ly_scm2string (pfb_file_name);
+
+ if (be_verbose_global)
+ progress_indication ("[" + file_name);
+
+ vector<char> pfb_string = gulp_file (file_name, 0);
+ char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ());
+
+ SCM pfa_scm = scm_from_locale_string (pfa);
+ free (pfa);
+
+ if (be_verbose_global)
+ progress_indication ("]");
+
+ return pfa_scm;
+}
+
+LY_DEFINE (ly_otf_2_cff, "ly:otf->cff",
+ 1, 0, 0, (SCM otf_file_name),
+ "Convert the contents of a OTF file to CFF file, returning it as "
+ " a string.")
+{
+ LY_ASSERT_FIRST_TYPE(scm_is_string, otf_file_name);
+
+ string file_name = ly_scm2string (otf_file_name);
+ if (be_verbose_global)
+ progress_indication ("[" + file_name);
+
+ FT_Face face = open_ft_face (file_name);
+ string table = get_otf_table (face, "CFF ");
+
+ SCM asscm = scm_from_locale_stringn ((char *) table.data (),
+ table.length ());
+
+ if (be_verbose_global)
+ progress_indication ("]");
+
+ return asscm;
+}
return out;
}
-LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa",
- 1, 0, 0, (SCM pfb_file_name),
- "Convert the contents of a PFB file to PFA.")
-{
- SCM_ASSERT_TYPE (scm_is_string (pfb_file_name), pfb_file_name,
- SCM_ARG1, __FUNCTION__, "string");
-
- string file_name = ly_scm2string (pfb_file_name);
-
- if (be_verbose_global)
- progress_indication ("[" + file_name);
-
- vector<char> pfb_string = gulp_file (file_name, 0);
- char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ());
-
- SCM pfa_scm = scm_from_locale_string (pfa);
- free (pfa);
-
- if (be_verbose_global)
- progress_indication ("]");
-
- return pfa_scm;
-}
-
-LY_DEFINE (ly_otf_2_cff, "ly:otf->cff",
- 1, 0, 0, (SCM otf_file_name),
- "Convert the contents of a OTF file to CFF file, returning it as "
- " a string.")
-{
- SCM_ASSERT_TYPE (scm_is_string (otf_file_name), otf_file_name,
- SCM_ARG1, __FUNCTION__, "string");
-
- string file_name = ly_scm2string (otf_file_name);
- if (be_verbose_global)
- progress_indication ("[" + file_name);
-
- FT_Face face = open_ft_face (file_name);
- string table = get_otf_table (face, "CFF ");
-
- SCM asscm = scm_from_locale_stringn ((char *) table.data (),
- table.length ());
-
- if (be_verbose_global)
- progress_indication ("]");
-
- return asscm;
-}
-
"Transpose @var{p} by the amount @var{delta}, "
"where @var{delta} is relative to middle C.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, p);
+ LY_ASSERT_SMOB (Pitch, 2);
+
Pitch *t = unsmob_pitch (p);
Pitch *d = unsmob_pitch (delta);
- SCM_ASSERT_TYPE (t, p, SCM_ARG1, __FUNCTION__, "pitch");
- SCM_ASSERT_TYPE (d, delta, SCM_ARG1, __FUNCTION__, "pitch");
return t->transposed (*d).smobbed_copy ();
}
"with 0 corresponding to C and 6 corresponding to B. "
"The @var{alter} is a rational number of whole tones for alteration.")
{
- SCM_ASSERT_TYPE (scm_is_integer (octave), octave, SCM_ARG1, __FUNCTION__, "integer");
- SCM_ASSERT_TYPE (scm_is_integer (note), note, SCM_ARG2, __FUNCTION__, "integer");
- SCM_ASSERT_TYPE (scm_is_rational (alter),
- alter, SCM_ARG3, __FUNCTION__, "rational");
+ LY_ASSERT_FIRST_TYPE(scm_is_integer, octave);
+ LY_ASSERT_TYPE(scm_is_integer, 2);
+ LY_ASSERT_TYPE(scm_is_rational, 3);
Pitch p (scm_to_int (octave), scm_to_int (note),
ly_scm2rational (alter));
(SCM p),
"Negate @var{p}.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, p);
Pitch *pp = unsmob_pitch (p);
- SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch");
return pp->negated ().smobbed_copy ();
}
(SCM p),
"Number of steps counted from middle C of the pitch @var{p}.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, p);
Pitch *pp = unsmob_pitch (p);
- SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch");
return scm_from_int (pp->steps ());
}
1, 0, 0, (SCM pp),
"Extract the octave from pitch @var{p}.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, pp);
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->get_octave ();
return scm_from_int (q);
}
1, 0, 0, (SCM pp),
"Extract the alteration from pitch @var{p}.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, pp);
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
Rational q = p->get_alteration ();
return ly_rational2scm (q);
1, 0, 0, (SCM pp),
"Extract the note name from pitch @var{pp}.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, pp);
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->get_notename ();
return scm_from_int (q);
}
1, 0, 0, (SCM pp),
"Calculate the number of quarter tones of @var{p} from middle C.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, pp);
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->rounded_quartertone_pitch ();
return scm_from_int (q);
}
1, 0, 0, (SCM pp),
"calculate the number of semitones of @var{p} from middle C.")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, pp);
Pitch *p = unsmob_pitch (pp);
- SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
int q = p->rounded_semitone_pitch ();
return scm_from_int (q);
}
2, 0, 0, (SCM p1, SCM p2),
"Is @var{p1} lexicographically smaller than @var{p2}?")
{
+ LY_ASSERT_FIRST_SMOB (Pitch, p1);
+ LY_ASSERT_SMOB (Pitch, 2);
+
Pitch *a = unsmob_pitch (p1);
Pitch *b = unsmob_pitch (p2);
- SCM_ASSERT_TYPE (a, p1, SCM_ARG1, __FUNCTION__, "Pitch");
- SCM_ASSERT_TYPE (b, p2, SCM_ARG2, __FUNCTION__, "Pitch");
-
if (Pitch::compare (*a, *b) < 0)
return SCM_BOOL_T;
else
"Return pitch @var{delta} such that @code{pitch} transposed by "
"@var{delta} equals @var{root}")
{
+
+ LY_ASSERT_FIRST_SMOB (Pitch, pitch);
+ LY_ASSERT_SMOB (Pitch, 2);
+
Pitch *p = unsmob_pitch (pitch);
Pitch *r = unsmob_pitch (root);
- SCM_ASSERT_TYPE (p, pitch, SCM_ARG1, __FUNCTION__, "Pitch");
- SCM_ASSERT_TYPE (r, root, SCM_ARG2, __FUNCTION__, "Pitch");
return pitch_interval (*r, *p).smobbed_copy ();
}
2, 1, 0, (SCM obj, SCM sym, SCM value),
"Set property @var{sym} of @var{obj} to @var{value}")
{
+ LY_ASSERT_FIRST_SMOB (Prob, obj);
Prob *ps = unsmob_prob (obj);
- SCM_ASSERT_TYPE (ps, obj, SCM_ARG1, __FUNCTION__, "Prob");
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
ps->set_property (sym, value);
return SCM_UNSPECIFIED;
/*
Hmm, this is not orthogonal.
- */
+*/
LY_DEFINE (ly_prob_property_p, "ly:prob-property?",
2, 1, 0, (SCM obj, SCM sym),
"Is boolean prop @var{sym} set?")
2, 1, 0, (SCM obj, SCM sym, SCM dfault),
"Return the value for @var{sym}.")
{
+ LY_ASSERT_FIRST_SMOB (Prob, obj);
Prob *ps = unsmob_prob (obj);
- SCM_ASSERT_TYPE (ps, obj, SCM_ARG1, __FUNCTION__, "Prob");
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
if (dfault == SCM_UNDEFINED)
dfault = SCM_EOL;
--- /dev/null
+/*
+ program-option-scheme.cc -- implement option setting from Scheme
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2001--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+*/
+
+#include "program-option.hh"
+
+#include <cstdio>
+#include <cstring>
+using namespace std;
+
+#include "profile.hh"
+#include "international.hh"
+#include "main.hh"
+#include "parse-scm.hh"
+#include "string-convert.hh"
+#include "warn.hh"
+
+bool debug_skylines;
+
+/*
+ Backwards compatibility.
+*/
+bool lily_1_8_relative = false;
+bool lily_1_8_compatibility_used = false;
+bool profile_property_accesses = false;
+/*
+ crash if internally the wrong type is used for a grob property.
+*/
+bool do_internal_type_checking_global;
+bool strict_infinity_checking = false;
+
+static SCM option_hash;
+
+void internal_set_option (SCM var, SCM val)
+{
+ scm_hashq_set_x (option_hash, var, val);
+
+ if (0)
+ ;
+ else if (var == ly_symbol2scm ("profile-property-accesses"))
+ {
+ profile_property_accesses = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+ else if (var == ly_symbol2scm ("point-and-click"))
+ {
+ point_and_click_global = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+ else if (var == ly_symbol2scm ("protected-scheme-parsing"))
+ {
+ parse_protect_global = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+ else if (var == ly_symbol2scm ("check-internal-types"))
+ {
+ do_internal_type_checking_global = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+ else if (var == ly_symbol2scm ("debug-gc-assert-parsed-dead"))
+ {
+ parsed_objects_should_be_dead = to_boolean (val);
+ val = scm_from_bool (parsed_objects_should_be_dead);
+ }
+ else if (var == ly_symbol2scm ("safe"))
+ {
+ be_safe_global = to_boolean (val);
+ val = scm_from_bool (be_safe_global);
+ }
+ else if (var == ly_symbol2scm ("old-relative"))
+ {
+ lily_1_8_relative = to_boolean (val);
+ /* Needs to be reset for each file that uses this option. */
+ lily_1_8_compatibility_used = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+ else if (var == ly_symbol2scm ("strict-infinity-checking"))
+ {
+ strict_infinity_checking = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+ else if (var == ly_symbol2scm ("debug-skylines"))
+ {
+ debug_skylines = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
+}
+
+
+
+
+bool
+get_program_option (const char *s)
+{
+ SCM sym = ly_symbol2scm (s);
+
+ return to_boolean (ly_get_option (sym));
+}
+
+
+ssize const HELP_INDENT = 30;
+ssize const INDENT = 2;
+ssize const 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");
+
+ vector<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)
+ + ly_symbol2string (sym)
+ + " ("
+ + ly_scm2string (scm_call_1 (convertor, val))
+ + ")";
+
+ if (opt_spec.length () + SEPARATION > HELP_INDENT)
+ {
+ opt_spec += "\n"
+ + String_convert::char_string (' ', HELP_INDENT);
+ }
+ else
+ opt_spec += String_convert::char_string (' ', HELP_INDENT - opt_spec.length ());
+
+ SCM opt_help_scm
+ = scm_object_property (sym, ly_symbol2scm ("program-option-documentation"));
+ string opt_help = ly_scm2string (opt_help_scm);
+ replace_all (opt_help,
+ string ("\n"),
+ string ("\n")
+ + String_convert::char_string (' ', HELP_INDENT));
+
+ opts.push_back (opt_spec + opt_help + "\n");
+ }
+
+ string help ("Options supported by ly:set-option\n\n");
+ vector_sort (opts, less<string> ());
+ for (vsize i = 0; i < opts.size (); i++)
+ help += opts[i];
+
+ help += string ("\n");
+ return help;
+}
+
+
+LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (),
+ "Print @code{ly:set-option} usage")
+{
+ string help = get_help_string ();
+ progress_indication (help);
+
+ return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0,
+ (SCM sym, SCM val, SCM description),
+ "Add a program option @var{sym} with default @var{val}.")
+{
+ if (!option_hash)
+ {
+ option_hash = scm_permanent_object (scm_c_make_hash_table (11));
+ }
+ LY_ASSERT_FIRST_TYPE (ly_is_symbol, sym);
+ LY_ASSERT_TYPE (scm_is_string, 3);
+
+ internal_set_option (sym, val);
+
+ scm_set_object_property_x (sym, ly_symbol2scm ("program-option-documentation"),
+ description);
+
+ return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
+ "Set a program option.")
+{
+ LY_ASSERT_FIRST_TYPE(ly_is_symbol, var);
+
+ if (val == SCM_UNDEFINED)
+ val = SCM_BOOL_T;
+
+ string varstr = ly_scm2string (scm_symbol_to_string (var));
+ if (varstr.substr (0, 3) == string ("no-"))
+ {
+ var = ly_symbol2scm (varstr.substr (3, varstr.length () -3).c_str ());
+ val = scm_from_bool (!to_boolean (val));
+ }
+
+ SCM handle = scm_hashq_get_handle (option_hash, var);
+ if (handle == SCM_BOOL_F)
+ warning (_f ("no such internal option: %s", varstr.c_str ()));
+
+ internal_set_option (var, val);
+ return SCM_UNSPECIFIED;
+}
+
+LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (),
+ "The Scheme specified on command-line with @samp{-d}.")
+{
+ return ly_string2scm (init_scheme_variables_global);
+}
+
+LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (),
+ "The Scheme specified on command-line with @samp{-e}.")
+{
+ return ly_string2scm (init_scheme_code_global);
+}
+
+LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (),
+ "Was be_verbose_global set?")
+{
+ return scm_from_bool (be_verbose_global);
+}
+
+
+
+LY_DEFINE (ly_all_options, "ly:all-options",
+ 0, 0, 0, (),
+ "Get all option settings in an alist.")
+{
+ return ly_hash2alist (option_hash);
+}
+
+
+LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
+ "Get a global option setting.")
+{
+ LY_ASSERT_FIRST_TYPE(ly_is_symbol, var);
+ return scm_hashq_ref (option_hash, var, SCM_BOOL_F);
+}
-/*
- scm-option.cc -- implement option setting from Scheme
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2001--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#include "program-option.hh"
-
-#include <cstdio>
-#include <cstring>
-using namespace std;
-
-#include "profile.hh"
-#include "international.hh"
-#include "main.hh"
-#include "parse-scm.hh"
-#include "string-convert.hh"
-#include "warn.hh"
-
-bool debug_skylines;
-
-/*
- Backwards compatibility.
-*/
-bool lily_1_8_relative = false;
-bool lily_1_8_compatibility_used = false;
-bool profile_property_accesses = false;
-/*
- crash if internally the wrong type is used for a grob property.
-*/
-bool do_internal_type_checking_global;
-bool strict_infinity_checking = false;
-
-static SCM option_hash;
-
-void internal_set_option (SCM var, SCM val)
-{
- scm_hashq_set_x (option_hash, var, val);
-
- if (0)
- ;
- else if (var == ly_symbol2scm ("profile-property-accesses"))
- {
- profile_property_accesses = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
- else if (var == ly_symbol2scm ("point-and-click"))
- {
- point_and_click_global = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
- else if (var == ly_symbol2scm ("protected-scheme-parsing"))
- {
- parse_protect_global = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
- else if (var == ly_symbol2scm ("check-internal-types"))
- {
- do_internal_type_checking_global = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
- else if (var == ly_symbol2scm ("debug-gc-assert-parsed-dead"))
- {
- parsed_objects_should_be_dead = to_boolean (val);
- val = scm_from_bool (parsed_objects_should_be_dead);
- }
- else if (var == ly_symbol2scm ("safe"))
- {
- be_safe_global = to_boolean (val);
- val = scm_from_bool (be_safe_global);
- }
- else if (var == ly_symbol2scm ("old-relative"))
- {
- lily_1_8_relative = to_boolean (val);
- /* Needs to be reset for each file that uses this option. */
- lily_1_8_compatibility_used = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
- else if (var == ly_symbol2scm ("strict-infinity-checking"))
- {
- strict_infinity_checking = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
- else if (var == ly_symbol2scm ("debug-skylines"))
- {
- debug_skylines = to_boolean (val);
- val = scm_from_bool (to_boolean (val));
- }
-}
-
-ssize const HELP_INDENT = 30;
-ssize const INDENT = 2;
-ssize const 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");
-
- vector<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)
- + ly_symbol2string (sym)
- + " ("
- + ly_scm2string (scm_call_1 (convertor, val))
- + ")";
-
- if (opt_spec.length () + SEPARATION > HELP_INDENT)
- {
- opt_spec += "\n"
- + String_convert::char_string (' ', HELP_INDENT);
- }
- else
- opt_spec += String_convert::char_string (' ', HELP_INDENT - opt_spec.length ());
-
- SCM opt_help_scm
- = scm_object_property (sym, ly_symbol2scm ("program-option-documentation"));
- string opt_help = ly_scm2string (opt_help_scm);
- replace_all (opt_help,
- string ("\n"),
- string ("\n")
- + String_convert::char_string (' ', HELP_INDENT));
-
- opts.push_back (opt_spec + opt_help + "\n");
- }
-
- string help ("Options supported by ly:set-option\n\n");
- vector_sort (opts, less<string> ());
- for (vsize i = 0; i < opts.size (); i++)
- help += opts[i];
-
- help += string ("\n");
- return help;
-}
-
-LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (),
- "Print @code{ly:set-option} usage")
-{
- string help = get_help_string ();
- progress_indication (help);
-
- return SCM_UNSPECIFIED;
-}
-
-LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0,
- (SCM sym, SCM val, SCM description),
- "Add a program option @var{sym} with default @var{val}.")
-{
- if (!option_hash)
- {
- option_hash = scm_permanent_object (scm_c_make_hash_table (11));
- }
- 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"),
- description);
-
- return SCM_UNSPECIFIED;
-}
-
-LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
- "Set a program option. Try setting 'help for a help string.")
-{
- SCM_ASSERT_TYPE (scm_is_symbol (var), var, SCM_ARG1,
- __FUNCTION__, "symbol");
-
- if (val == SCM_UNDEFINED)
- val = SCM_BOOL_T;
-
- string varstr = ly_scm2string (scm_symbol_to_string (var));
- if (varstr.substr (0, 3) == string ("no-"))
- {
- var = ly_symbol2scm (varstr.substr (3, varstr.length () -3).c_str ());
- val = scm_from_bool (!to_boolean (val));
- }
-
- SCM handle = scm_hashq_get_handle (option_hash, var);
- if (handle == SCM_BOOL_F)
- warning (_f ("no such internal option: %s", varstr.c_str ()));
-
- internal_set_option (var, val);
- return SCM_UNSPECIFIED;
-}
-
-LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (),
- "The Scheme specified on command-line with @samp{-d}.")
-{
- return ly_string2scm (init_scheme_variables_global);
-}
-
-LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (),
- "The Scheme specified on command-line with @samp{-e}.")
-{
- return ly_string2scm (init_scheme_code_global);
-}
-
-LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (),
- "Was be_verbose_global set?")
-{
- return scm_from_bool (be_verbose_global);
-}
-
-
-
-LY_DEFINE (ly_all_options, "ly:all-options",
- 0, 0, 0, (),
- "Get all option settings in an alist.")
-{
- return ly_hash2alist (option_hash);
-}
-
-
-LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
- "Get a global option setting.")
-{
- SCM_ASSERT_TYPE (scm_is_symbol (var), var,
- SCM_ARG1, __FUNCTION__, "symbol");
- return scm_hashq_ref (option_hash, var, SCM_BOOL_F);
-}
-
-
-
-bool
-get_program_option (const char *s)
-{
- SCM sym = ly_symbol2scm (s);
-
- return to_boolean (ly_get_option (sym));
-}
1, 0, 0, (SCM scale),
"Set the global default scale.")
{
- Scale *s = Scale::unsmob (scale);
- SCM_ASSERT_TYPE (s, scale, SCM_ARG1, __FUNCTION__, "scale");
+ LY_ASSERT_FIRST_SMOB (Scale, scale);
+ Scale *s = Scale::unsmob (scale);
if (default_global_scale)
default_global_scale->unprotect ();
default_global_scale = s;
"\n"
" @var{callback} should take exactly one argument." )
{
- SCM_ASSERT_TYPE (ly_is_procedure (callback), callback, SCM_ARG1, __FUNCTION__, "procedure");
+ LY_ASSERT_FIRST_TYPE(ly_is_procedure, callback);
Scheme_listener *l = new Scheme_listener (callback);
SCM listener = GET_LISTENER (l->call).smobbed_copy ();
l->unprotect ();
(SCM music),
"Return score with @var{music} encapsulated in @var{score}.")
{
+ LY_ASSERT_FIRST_SMOB (Music, music);
Music *mus = unsmob_music (music);
- SCM_ASSERT_TYPE (mus, music, SCM_ARG1, __FUNCTION__, "music");
Score *score = new Score;
score->set_music (music);
1, 0, 0, (SCM score),
"All output defs in a score.")
{
+ LY_ASSERT_FIRST_SMOB (Score, score);
Score *sc = unsmob_score (score);
- SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
SCM l = SCM_EOL;
for (vsize i = 0; i < sc->defs_.size (); i++)
1, 0, 0, (SCM score),
"return score header.")
{
+ LY_ASSERT_FIRST_SMOB (Score, score);
Score *sc = unsmob_score (score);
- SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
return sc->header_;
}
1, 0, 0, (SCM score),
"return score music.")
{
+ LY_ASSERT_FIRST_SMOB (Score, score);
Score *sc = unsmob_score (score);
- SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
return sc->get_music ();
}
1, 0, 0, (SCM score),
"Was there an error in the score?")
{
+ LY_ASSERT_FIRST_SMOB (Score, score);
Score *sc = unsmob_score (score);
- SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score");
return scm_from_bool (sc->error_found_);
}
"return a list of layout-lines. "
"\nTake optional Object_key argument.")
{
+ LY_ASSERT_FIRST_SMOB (Score, score);
+ LY_ASSERT_SMOB (Output_def, 2);
+
Score *sc = unsmob_score (score);
Output_def *od = unsmob_output_def (layout);
if (sc->error_found_)
return SCM_EOL;
- SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "Score");
- SCM_ASSERT_TYPE (od, layout, SCM_ARG2, __FUNCTION__, "Output_def");
-
Output_def *score_def = 0;
/* UGR, FIXME, these are default \layout blocks once again. They
"negative for compressing and #f for non-satisfied constraints) "
"followed by the @var{spring-count}+1 positions of the objects. ")
{
+ LY_FUNC_NOTE_FIRST_ARG(springs);
+
int len = scm_ilength (springs);
if (len == 0)
return scm_list_2 (scm_from_double (0.0), scm_from_double (0.0));
SCM_ASSERT_TYPE (len >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs");
- SCM_ASSERT_TYPE (scm_ilength (rods) >= 0, rods, SCM_ARG2, __FUNCTION__, "list of rods");
- SCM_ASSERT_TYPE (scm_is_number (length) || length == SCM_BOOL_F,
- length, SCM_ARG3, __FUNCTION__, "number or #f");
+ SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods");
+ LY_ASSERT_TYPE(scm_is_number, 3);
bool is_ragged = ragged == SCM_BOOL_T;
Simple_spacer spacer;
"Get one of the bounds of @var{spanner}. @var{dir} is @code{-1} "
"for left, and @code{1} for right.")
{
- Spanner *sl = dynamic_cast<Spanner *> (unsmob_grob (slur));
- SCM_ASSERT_TYPE (sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob");
- SCM_ASSERT_TYPE (is_direction (dir), slur, SCM_ARG2, __FUNCTION__, "dir");
- return sl->get_bound (to_dir (dir))->self_scm ();
+ LY_ASSERT_FIRST_TYPE (unsmob_spanner, slur);
+ LY_ASSERT_TYPE(is_direction, 2);
+
+ return unsmob_spanner (slur)->get_bound (to_dir (dir))->self_scm ();
}
/* TODO: maybe we should return a vector -- random access is more
1, 0, 0, (SCM spanner),
"Return broken-into list for @var{spanner}.")
{
+ SCM_ASSERT_FIRST_TYPE (unsmob_spanner, spanner);
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (spanner));
- SCM_ASSERT_TYPE (me, spanner, SCM_ARG1, __FUNCTION__, "spanner");
SCM s = SCM_EOL;
for (vsize i = me->broken_intos_.size (); i--;)
1, 0, 0, (SCM sg),
"Return the Y-position of @var{sg} relative to the staff.")
{
+ LY_ASSERT_FIRST_SMOB (Grob, sg);
Grob *g = unsmob_grob (sg);
-
- SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob");
Real pos = Staff_symbol_referencer::get_position (g);
if (fabs (rint (pos) -pos) < 1e-6) // ugh.
"Return a copy of @var{stil} but translated by @var{amount} in @var{axis} direction.")
{
Stencil *s = unsmob_stencil (stil);
- SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
- SCM_ASSERT_TYPE (scm_is_number (amount), amount, SCM_ARG2, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
+ LY_ASSERT_TYPE(scm_is_number, 2);
Real real_amount = scm_to_double (amount);
amount, SCM_ARG2, __FUNCTION__, "finite number");
#endif
- SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+ LY_ASSERT_TYPE(is_axis, 3);
SCM new_s = s->smobbed_copy ();
Stencil *q = unsmob_stencil (new_s);
"but translated by @var{offset} (a pair of numbers).")
{
Stencil *s = unsmob_stencil (stil);
- SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
- SCM_ASSERT_TYPE (is_number_pair (offset), offset, SCM_ARG2, __FUNCTION__, "number pair");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
+ LY_ASSERT_TYPE(is_number_pair, 2);
Offset o = ly_scm2offset (offset);
SCM new_s = s->smobbed_copy ();
"Return the expression of @var{stil}.")
{
Stencil *s = unsmob_stencil (stil);
- SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
return s->expr ();
}
"@var{axis} direction (0 or 1 for x and y axis respectively).")
{
Stencil *s = unsmob_stencil (stil);
- SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
- SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
+ LY_ASSERT_TYPE(is_axis, 2);
return ly_interval2scm (s->extent (Axis (scm_to_int (axis))));
}
"Return whether @var{stil} is empty ")
{
Stencil *s = unsmob_stencil (stil);
- SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
return scm_from_bool (s->is_empty ());
}
Stencil *s2 = unsmob_stencil (second);
Stencil result;
+ LY_FUNC_NOTE_FIRST_ARG(first);
SCM_ASSERT_TYPE (s1 || first == SCM_BOOL_F || first == SCM_EOL,
first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()");
SCM_ASSERT_TYPE (s2 || second == SCM_BOOL_F || second == SCM_EOL,
second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()");
- SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
- SCM_ASSERT_TYPE (is_direction (direction), direction, SCM_ARG3, __FUNCTION__, "dir");
+ LY_ASSERT_TYPE(is_axis, 2);
+ LY_ASSERT_TYPE(is_direction, 3);
Real p = 0.0;
if (padding != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (scm_is_number (padding), padding, SCM_ARG5, __FUNCTION__, "number");
+ LY_ASSERT_TYPE(scm_is_number, 5);
p = scm_to_double (padding);
}
Real m = 0.0;
if (minimum != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (scm_is_number (minimum), minimum, SCM_ARG6, __FUNCTION__, "number");
+ LY_ASSERT_TYPE(scm_is_number, 6);
m = scm_to_double (minimum);
}
"If the extents are unspecified, they are taken to be empty."
)
{
+ LY_FUNC_NOTE_FIRST_ARG (expr);
SCM_ASSERT_TYPE (!scm_is_pair (expr)
|| is_stencil_head (scm_car (expr)),
expr, SCM_ARG1, __FUNCTION__, "registered stencil expression");
Interval x;
if (xext != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair");
+ LY_ASSERT_TYPE(is_number_pair, 2);
x = ly_scm2interval (xext);
}
Interval y;
if (yext != SCM_UNDEFINED)
{
- SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair");
+ LY_ASSERT_TYPE(is_number_pair, 3);
y = ly_scm2interval (yext);
}
"@var{dir} is a number -1, 1 are left and right respectively. "
"Other values are interpolated (so 0 means the center).")
{
- SCM_ASSERT_TYPE (unsmob_stencil (stil), stil, SCM_ARG1, __FUNCTION__, "stencil");
- SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
- SCM_ASSERT_TYPE (scm_is_number (dir), dir, SCM_ARG3, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
+ LY_ASSERT_TYPE(is_axis, 2);
+ LY_ASSERT_TYPE(scm_is_number, 3);
Stencil target = *unsmob_stencil (stil);
1, 0, 0, (SCM s),
" Analyse @var{s}, and return a list of fonts used in @var{s}.")
{
+ LY_ASSERT_FIRST_SMOB (Stencil, s);
Stencil *stil = unsmob_stencil (s);
- SCM_ASSERT_TYPE (stil, s, SCM_ARG1, __FUNCTION__, "Stencil");
return find_expression_fonts (stil->expr ());
}
4, 0, 0, (SCM stc, SCM r, SCM g, SCM b),
"Put @var{stc} in a different color.")
{
+ LY_ASSERT_FIRST_SMOB (Stencil, stc);
Stencil *stil = unsmob_stencil (stc);
- SCM_ASSERT_TYPE (stil, stc, SCM_ARG1, __FUNCTION__, "Stencil");
return Stencil (stil->extent_box (),
scm_list_3 (ly_symbol2scm ("color"),
scm_list_3 (r, g, b),
4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset),
"Parse EXPR, feed bits to FUNC with first arg ARG1")
{
- SCM_ASSERT_TYPE (ly_is_procedure (func), func, SCM_ARG1, __FUNCTION__,
- "procedure");
+ LY_FUNC_NOTE_FIRST_ARG(expr);
+ LY_ASSERT_TYPE (ly_is_procedure, 2);
Stencil_interpret_arguments a;
a.func = func;
"given by @var{iv}. The wings protude by an amount of @var{p}, which "
"may be negative. The thickness is given by @var{t}.")
{
- SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG1, __FUNCTION__, "axis");
- SCM_ASSERT_TYPE (is_number_pair (iv), iv, SCM_ARG2, __FUNCTION__, "number pair");
- SCM_ASSERT_TYPE (scm_is_number (t), a, SCM_ARG3, __FUNCTION__, "number");
- SCM_ASSERT_TYPE (scm_is_number (p), a, SCM_ARG4, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_TYPE(is_axis, a);
+ LY_ASSERT_TYPE(is_number_pair, 2);
+ LY_ASSERT_TYPE(scm_is_number, 3);
+ LY_ASSERT_TYPE(scm_is_number, 4);
return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
scm_to_double (t),
"Return a @var{stil} rotated @var{angle} degrees around point (@var{x}, @var{y}).")
{
Stencil *s = unsmob_stencil (stil);
- SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil");
- SCM_ASSERT_TYPE (scm_is_number (angle), angle, SCM_ARG2, __FUNCTION__, "number");
- SCM_ASSERT_TYPE (scm_is_number (x), x, SCM_ARG3, __FUNCTION__, "number");
- SCM_ASSERT_TYPE (scm_is_number (y), y, SCM_ARG4, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_SMOB(Stencil, stil);
+ LY_ASSERT_TYPE(scm_is_number, 2);
+ LY_ASSERT_TYPE(scm_is_number, 3);
+ LY_ASSERT_TYPE(scm_is_number, 4);
Real a = scm_to_double (angle);
Real x_off = scm_to_double (x);
Real y_off = scm_to_double (y);
"that prints a black box of dimensions @var{xext}, "
"@var{yext} and roundness @var{blot}.")
{
- SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair");
- SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair");
- SCM_ASSERT_TYPE (scm_is_number (blot), blot, SCM_ARG3, __FUNCTION__, "number");
+ LY_ASSERT_FIRST_TYPE(is_number_pair, xext);
+ LY_ASSERT_TYPE(is_number_pair, 2);
+ LY_ASSERT_TYPE(scm_is_number, 3);
return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
scm_to_double (blot)).smobbed_copy ();
(SCM symbol),
"Add @var{symbol} as head of a stencil expression")
{
- SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol,
- SCM_ARG1, __FUNCTION__, "Symbol");
+ LY_ASSERT_FIRST_TYPE(ly_is_symbol, symbol);
register_stencil_head (symbol);
return SCM_UNSPECIFIED;
}
1, 1, 0, (SCM cl, SCM proplist),
"Creates a stream event of class @var{cl} with the given mutable property list.\n" )
{
- SCM_ASSERT_TYPE (scm_is_symbol (cl), cl, SCM_ARG1, __FUNCTION__, "symbol");
+ LY_ASSERT_FIRST_TYPE (ly_is_symbol, cl);
/* should be scm_list_p, but scm_list_p is expensive. */
- SCM_ASSERT_TYPE (scm_is_pair (proplist), proplist, SCM_ARG2, __FUNCTION__, "association list");
+ LY_ASSERT_TYPE(scm_is_pair, 2);
if (proplist == SCM_UNDEFINED)
proplist = SCM_EOL;
"Get the property @var{sym} of stream event @var{mus}.\n"
"If @var{sym} is undefined, return @code{'()}.\n")
{
+ LY_ASSERT_FIRST_SMOB (Stream_event, sev);
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
+
Stream_event *e = unsmob_stream_event (sev);
- SCM_ASSERT_TYPE (e, sev, SCM_ARG1, __FUNCTION__, "stream event");
- SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol");
return e->internal_get_property (sym);
}
LY_DEFINE (ly_event_set_property_x, "ly:event-set-property!",
3, 0, 0, (SCM ev, SCM sym, SCM val),
- "Set property @var{sym} in event @var{ev} to @var{val}."){
- Stream_event *sc = unsmob_stream_event (ev);
- SCM_ASSERT_TYPE (sc, ev, SCM_ARG1, __FUNCTION__, "event");
+ "Set property @var{sym} in event @var{ev} to @var{val}.")
+{
+ LY_ASSERT_FIRST_SMOB (Stream_event, ev);
+ LY_ASSERT_TYPE (ly_is_symbol, 2);
+
return ly_prob_set_property_x (ev, sym, val);
}
SCM props,
SCM markup)
{
- Output_def *layout = unsmob_output_def (layout_smob);
-
- SCM_ASSERT_TYPE (layout, layout_smob, SCM_ARG1,
- __FUNCTION__, "Layout definition");
- SCM_ASSERT_TYPE (scm_is_string (markup), markup, SCM_ARG3,
- __FUNCTION__, "string");
+ LY_ASSERT_FIRST_SMOB (Output_def, layout_smob);
+ LY_ASSERT_TYPE (scm_is_string, 3);
string str = ly_scm2string (markup);
-
+ Output_def *layout = unsmob_output_def (layout_smob);
Font_metric *fm = select_encoded_font (layout, props);
return fm->word_stencil (str).smobbed_copy ();
}
"Return the type name of the translator object @var{trans}. "
"The name is a symbol.")
{
+ LY_ASSERT_FIRST_SMOB (Translator, trans);
Translator *tr = unsmob_translator (trans);
- SCM_ASSERT_TYPE (tr, trans, SCM_ARG1, __FUNCTION__, "Translator");
char const *nm = tr->class_name ();
return ly_symbol2scm (nm);
}
1, 0, 0, (SCM me),
"Return an alist of properties of translator @var{me}.")
{
+ LY_ASSERT_FIRST_SMOB (Translator, me);
Translator *tr = unsmob_translator (me);
- SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Translator");
return tr->translator_description ();
}
1, 0, 0, (SCM ttf_file_name),
"Extract the PostScript name from a TrueType font.")
{
- SCM_ASSERT_TYPE (scm_is_string (ttf_file_name), ttf_file_name,
- SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, ttf_file_name);
string file_name = ly_scm2string (ttf_file_name);
if (be_verbose_global)
progress_indication ("[" + file_name);
"Convert the contents of a TTF file to Type42 PFA, returning it as "
" a string.")
{
- SCM_ASSERT_TYPE (scm_is_string (ttf_file_name), ttf_file_name,
- SCM_ARG1, __FUNCTION__, "string");
+ LY_ASSERT_FIRST_TYPE(scm_is_string, ttf_file_name);
string file_name = ly_scm2string (ttf_file_name);
if (be_verbose_global)