return x;
}
-LY_DEFINE (ly_parser_print_book, "ly:book-process",
+LY_DEFINE (ly_book_process, "ly:book-process",
4, 0, 0, (SCM book_smob,
SCM default_paper,
SCM default_layout,
}
-LY_DEFINE (ly_parser_print_book_to_systems, "ly:book-process-to-systems",
+LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems",
4, 0, 0, (SCM book_smob,
SCM default_paper,
SCM default_layout,
return tr->internal_get_property (name);
}
-LY_DEFINE (ly_context_set_property, "ly:context-set-property!",
+LY_DEFINE (ly_context_set_property_x, "ly:context-set-property!",
3, 0, 0, (SCM context, SCM name, SCM val),
"Set value of property @var{name} in context @var{context} "
"to @var{val}.")
return SCM_EOL;
}
-LY_DEFINE (ly_unset_context_property, "ly:context-unset-property", 2, 0, 0,
+LY_DEFINE (ly_context_unset_property, "ly:context-unset-property", 2, 0, 0,
(SCM context, SCM name),
"Unset value of property @var{name} in context @var{context}.")
{
return (new Dispatcher ())->unprotect ();
}
-LY_DEFINE (ly_register_dispatcher, "ly:connect-dispatchers",
+LY_DEFINE (ly_connect_dispatchers, "ly:connect-dispatchers",
2, 0, 0, (SCM to, SCM from),
"Makes the dispatcher @var{to} listen to events from @var{from}." )
{
return Moment (unsmob_duration (dur)->get_length ()).smobbed_copy ();
}
-LY_DEFINE (ly_duration2string, "ly:duration->string",
+LY_DEFINE (ly_duration_2_string, "ly:duration->string",
1, 0, 0, (SCM dur),
"Convert @var{dur} to string.")
{
#include "std-string.hh"
#include "lily-guile.hh"
+#include "warn.hh"
static SCM doc_hash_table;
-void ly_add_function_documentation (SCM func,
+void
+ly_check_name (string cxx, string scm_name)
+{
+ string mangle = mangle_cxx_identifier (cxx);
+ if (mangle != scm_name)
+ {
+ programming_error ("wrong cxx name: " + mangle + ", " + cxx + ", " + scm_name);
+ }
+}
+
+
+void
+ly_add_function_documentation (SCM func,
string fname,
string varlist,
string doc)
return ly_string2scm (ss);
}
-LY_DEFINE (ly_number2string, "ly:number->string",
+LY_DEFINE (ly_number_2_string, "ly:number->string",
1, 0, 0, (SCM s),
"Convert @var{num} to a string without generating many decimals.")
{
return lst;
}
-LY_DEFINE (ly_wchar_to_utf_8, "ly:wide-char->utf-8",
+LY_DEFINE (ly_wide_char_2_utf_8, "ly:wide-char->utf-8",
1, 0, 0, (SCM wc),
"Encode the Unicode codepoint @var{wc}, an integer, as UTF-8")
{
NULL, SCM_EOL, tab);
}
-LY_DEFINE (ly_camel_case_to_lisp_identifier, "ly:camel-case->lisp-identifier",
+LY_DEFINE (ly_camel_case_2_lisp_identifier, "ly:camel-case->lisp-identifier",
1, 0, 0, (SCM name_sym),
"Convert FooBar_Bla to foo-bar-bla style symbol.")
{
context ()->set_property ("busyGrobs", SCM_EOL);
}
-LY_DEFINE (ly_grob_pq_less_p, "ly:grob-pq-less?",
+LY_DEFINE (ly_grob_pq_less_p, "ly:grob-pq<?",
2, 0, 0, (SCM a, SCM b),
"Compare 2 grob priority queue entries. Internal")
{
return sc->get_property_alist_chain (global);
}
-LY_DEFINE (ly_get_extent, "ly:grob-extent",
+LY_DEFINE (ly_grob_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}")
void \
TYPE ## _ ## FUNC ## _init_functions () \
{ \
- string id = mangle_cxx_identifier (string (#TYPE) + "::" + string (#FUNC)); \
+ string cxx = string (#TYPE) + "::" + string (#FUNC); \
+ string id = mangle_cxx_identifier (cxx); \
TYPE ::FUNC ## _proc = scm_c_define_gsubr (id.c_str(), \
(ARGCOUNT-OPTIONAL_COUNT), OPTIONAL_COUNT, 0, \
(Scheme_function_unknown) TYPE::FUNC); \
#define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \
MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT, 0, "");
-void
-ly_add_function_documentation (SCM proc, string fname, string varlist, string doc);
+void ly_add_function_documentation (SCM proc, string fname, string varlist, string doc);
+void ly_check_name (string cxx, string fname);
#define ADD_SCM_INIT_FUNC(name, func) \
class name ## _scm_initter \
{ \
FNAME ## _proc = scm_c_define_gsubr (PRIMNAME, REQ, OPT, VAR, \
(Scheme_function_unknown) FNAME); \
+ ly_check_name (#FNAME, PRIMNAME);\
ly_add_function_documentation (FNAME ## _proc, PRIMNAME, #ARGLIST, \
DOCSTRING); \
scm_c_export (PRIMNAME, NULL); \
SCM ly_make_anonymous_module (bool safe);
SCM ly_module_copy (SCM dest, SCM src);
-SCM ly_module2alist (SCM mod);
+SCM ly_module_2_alist (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);
Music *unsmob_music (SCM);
Music *make_music_by_name (SCM sym);
SCM ly_music_deep_copy (SCM);
-SCM ly_camel_case_to_lisp_identifier (SCM name_sym);
+SCM ly_camel_case_2_lisp_identifier (SCM name_sym);
extern SCM ly_music_p_proc;
/* We don't use IMPLEMENT_TYPE_P, since the smobification part is
implemented separately from the class. */
-LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0,
+LY_DEFINE (ly_input_location_p, "ly:input-location?", 1, 0, 0,
(SCM x),
"Is @var{x} an @code{input-location}?")
{
}
-LY_DEFINE (ly_input_file_line_column,
+LY_DEFINE (ly_input_file_line_char_column,
"ly:input-file-line-char-column",
1, 0, 0, (SCM sip),
"Return input location in @var{sip} as (file-name line char column).")
cxx_id = "ly:" + cxx_id;
}
if (cxx_id.substr (cxx_id.length () - 2) == "_p")
- cxx_id = cxx_id.replace (cxx_id.length () - 2, 1, "?");
+ cxx_id = cxx_id.replace (cxx_id.length () - 2, 2, "?");
else if (cxx_id.substr (cxx_id.length () - 2) == "_x")
- cxx_id = cxx_id.replace (cxx_id.length () - 2, 1, "!");
+ cxx_id = cxx_id.replace (cxx_id.length () - 2, 2, "!");
+ cxx_id = replace_all (cxx_id, "_less?", "<?");
+ cxx_id = replace_all (cxx_id, "_2_", "->");
+ cxx_id = replace_all (cxx_id, "__", "::");
cxx_id = replace_all (cxx_id, '_', '-');
+
+
return cxx_id;
}
return clone->unprotect ();
}
-LY_DEFINE (ly_parser_define, "ly:parser-define!",
+LY_DEFINE (ly_parser_define_x, "ly:parser-define!",
3, 0, 0, (SCM parser_smob, SCM symbol, SCM val),
"Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.")
{
return result;
}
-LY_DEFINE (ly_module2alist, "ly:module->alist",
+LY_DEFINE (ly_module_2_alist, "ly:module->alist",
1, 0, 0, (SCM mod),
"Dump the contents of module @var{mod} as an alist.")
{
Rational (grace_num, grace_den)).smobbed_copy ();
}
-LY_DEFINE (ly_sub_moment, "ly:moment-sub",
+LY_DEFINE (ly_moment_sub, "ly:moment-sub",
2, 0, 0, (SCM a, SCM b),
"Subtract two moments.")
{
return ly_prob_property (mus,sym,dfault);
}
-LY_DEFINE (ly_music_set_property, "ly:music-set-property!",
+LY_DEFINE (ly_music_set_property_x, "ly:music-set-property!",
3, 0, 0, (SCM mus, SCM sym, SCM val),
"Set property @var{sym} in music expression @var{mus} to @var{val}.")
{
Stream_event *
Music::to_event () const
{
- SCM class_name = ly_camel_case_to_lisp_identifier (get_property ("name"));
+ SCM class_name = ly_camel_case_2_lisp_identifier (get_property ("name"));
// catch programming mistakes.
if (!internal_is_music_type (class_name))
#include "context-def.hh"
#include "lily-parser.hh"
-LY_DEFINE (ly_layout_lookup, "ly:output-def-lookup",
+LY_DEFINE (ly_output_def_lookup, "ly:output-def-lookup",
2, 1, 0, (SCM pap, SCM sym, SCM def),
"Lookup @var{sym} in the Output_def @var{pap}. "
"Return the value or @var{def} (which defaults to @code{'()}) if undefined.")
{
Output_def *id = unsmob_output_def (output_def);
- SCM al = ly_module2alist (id->scope_);
+ SCM al = ly_module_2_alist (id->scope_);
SCM ell = SCM_EOL;
for (SCM s = al; scm_is_pair (s); s = scm_cdr (s))
{
return out;
}
-LY_DEFINE (ly_pfb_to_pfa, "ly:pfb->pfa",
+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.")
{
return pfa_scm;
}
-LY_DEFINE (ly_otf_to_cff, "ly:otf->cff",
+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_DEFINE (ly_all_option, "ly:all-options",
+LY_DEFINE (ly_all_options, "ly:all-options",
0, 0, 0, (),
"Get all option settings in an alist.")
{
#include "spanner.hh"
#include "item.hh"
-LY_DEFINE (ly_spanner_get_bound, "ly:spanner-bound",
+LY_DEFINE (ly_spanner_bound, "ly:spanner-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: naming add/combine.
*/
-LY_DEFINE (ly_translate_stencil_axis, "ly:stencil-translate-axis",
+LY_DEFINE (ly_stencil_translate_axis, "ly:stencil-translate-axis",
3, 0, 0, (SCM stil, SCM amount, SCM axis),
"Return a copy of @var{stil} but translated by @var{amount} in @var{axis} direction.")
{
return new_s;
}
-LY_DEFINE (ly_translate_stencil, "ly:stencil-translate",
+LY_DEFINE (ly_stencil_translate, "ly:stencil-translate",
2, 0, 0, (SCM stil, SCM offset),
"Return a @var{stil}, "
"but translated by @var{offset} (a pair of numbers).")
0.95 * scm_to_double (t)).smobbed_copy ();
}
-LY_DEFINE (ly_rotate_stencil, "ly:stencil-rotate",
+LY_DEFINE (ly_stencil_rotate, "ly:stencil-rotate",
4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y),
"Return a @var{stil} rotated @var{angle} degrees around point (@var{x}, @var{y}).")
{
return new_s;
}
-LY_DEFINE (ly_filled_box, "ly:round-filled-box",
+LY_DEFINE (ly_round_filled_box, "ly:round-filled-box",
3, 0, 0,
(SCM xext, SCM yext, SCM blot),
"Make a @code{Stencil} "
return e->internal_get_property (sym);
}
-LY_DEFINE (ly_event_set_property, "ly:event-set-property!",
+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);
-LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa",
+LY_DEFINE (ly_ttf_2_pfa, "ly:ttf->pfa",
1, 0, 0, (SCM ttf_file_name),
"Convert the contents of a TTF file to Type42 PFA, returning it as "
" a string.")
ly:grob-original
ly:grob-layout
ly:grob-parent
- ly:grob-pq-less?
ly:grob-property
ly:grob-script-priority-less
ly:grob-set-property!