From: Han-Wen Nienhuys Date: Fri, 26 Jan 2007 14:52:02 +0000 (+0100) Subject: document Text_interface::interpret_markup. X-Git-Tag: release/2.11.15-1~40 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e6bb963f4341cbd6f7c8bda2e608715d271492d1;p=lilypond.git document Text_interface::interpret_markup. --- diff --git a/lily/beam.cc b/lily/beam.cc index ecc9d0b5a6..28492eaee1 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1307,7 +1307,7 @@ Beam::last_normal_stem (Grob *me) rest -> stem -> beam -> interpolate_y_position () */ -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Beam, rest_collision_callback, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Beam, rest_collision_callback, 2, 1, ""); SCM Beam::rest_collision_callback (SCM smob, SCM prev_offset) { diff --git a/lily/font-metric-scheme.cc b/lily/font-metric-scheme.cc index 18edb7513a..db231fd11d 100644 --- a/lily/font-metric-scheme.cc +++ b/lily/font-metric-scheme.cc @@ -128,7 +128,7 @@ LY_DEFINE (ly_font_name, "ly:font-name", LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0, (SCM font), "Given the font metric @var{font}, return the " - "magnification, relative to the current outputs-cale.") + "magnification, relative to the current output-scale.") { Font_metric *fm = unsmob_metrics (font); SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc index 7e450528ae..b700fad320 100644 --- a/lily/function-documentation.cc +++ b/lily/function-documentation.cc @@ -15,11 +15,11 @@ using namespace std; static SCM doc_hash_table; void ly_add_function_documentation (SCM func, - char const *fname, - char const *varlist, - char const *doc) + string fname, + string varlist, + string doc) { - if (!strlen (doc)) + if (doc == "") return; if (!doc_hash_table) @@ -30,8 +30,8 @@ void ly_add_function_documentation (SCM func, scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"), ly_string2scm (s)); - SCM entry = scm_cons (scm_from_locale_string (varlist), scm_from_locale_string (doc)); - scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry); + SCM entry = scm_cons (ly_string2scm (varlist), ly_string2scm (doc)); + scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str()), entry); } LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation", diff --git a/lily/include/lily-guile-macros.hh b/lily/include/lily-guile-macros.hh index 555d65bfd3..85c30ffb47 100644 --- a/lily/include/lily-guile-macros.hh +++ b/lily/include/lily-guile-macros.hh @@ -99,7 +99,7 @@ inline SCM ly_symbol2scm (char const *x) { return scm_str2symbol ((x)); } Make TYPE::FUNC available as a Scheme function. */ string mangle_cxx_identifier (string); -#define MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, OPTIONAL_COUNT) \ +#define MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, OPTIONAL_COUNT, DOC) \ SCM TYPE ::FUNC ## _proc; \ void \ TYPE ## _ ## FUNC ## _init_functions () \ @@ -108,19 +108,22 @@ string mangle_cxx_identifier (string); TYPE ::FUNC ## _proc = scm_c_define_gsubr (id.c_str(), \ (ARGCOUNT-OPTIONAL_COUNT), OPTIONAL_COUNT, 0, \ (Scheme_function_unknown) TYPE::FUNC); \ + ly_add_function_documentation (TYPE :: FUNC ## _proc, id.c_str(), "", \ + DOC); \ scm_c_export (id.c_str (), NULL); \ } \ \ ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, \ TYPE ## _ ## FUNC ## _init_functions); +#define MAKE_DOCUMENTED_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT, DOC) \ + MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, 0, DOC); + #define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \ - MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT,0); + MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT, 0, ""); void -ly_add_function_documentation (SCM proc, char const *fname, - char const *varlist, - char const *doc); +ly_add_function_documentation (SCM proc, string fname, string varlist, string doc); #define ADD_SCM_INIT_FUNC(name, func) \ class name ## _scm_initter \ diff --git a/lily/output-def-scheme.cc b/lily/output-def-scheme.cc index e7533eed16..a806781015 100644 --- a/lily/output-def-scheme.cc +++ b/lily/output-def-scheme.cc @@ -16,7 +16,7 @@ LY_DEFINE (ly_layout_lookup, "ly:output-def-lookup", 2, 1, 0, (SCM pap, SCM sym, SCM def), - "Lookup @var{sym} in @var{pap}. " + "Lookup @var{sym} in the Output_def @var{pap}. " "Return the value or @var{def} (which defaults to @code{'()}) if undefined.") { Output_def *op = unsmob_output_def (pap); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 8ba0d49c7b..e470e9154c 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -41,7 +41,7 @@ Rest_collision::force_shift_callback (SCM smob) return scm_from_double (0.0); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1, ""); SCM Rest_collision::force_shift_callback_rest (SCM rest, SCM offset) { diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 0d56fe1868..ceee8a37cb 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -177,21 +177,21 @@ axis_aligned_side_helper (SCM smob, Axis a, bool pure, int start, int end, SCM c } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, x_aligned_side, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, x_aligned_side, 2, 1, ""); SCM Side_position_interface::x_aligned_side (SCM smob, SCM current_off) { return axis_aligned_side_helper (smob, X_AXIS, false, 0, 0, current_off); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, y_aligned_side, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, y_aligned_side, 2, 1, ""); SCM Side_position_interface::y_aligned_side (SCM smob, SCM current_off) { return axis_aligned_side_helper (smob, Y_AXIS, false, 0, 0, current_off); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, pure_y_aligned_side, 4, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, pure_y_aligned_side, 4, 1, ""); SCM Side_position_interface::pure_y_aligned_side (SCM smob, SCM start, SCM end, SCM cur_off) { diff --git a/lily/slur.cc b/lily/slur.cc index 1f9e605fb9..9ce45e61f5 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -221,7 +221,7 @@ Slur::add_extra_encompass (Grob *me, Grob *n) Pointer_group_interface::add_grob (me, ly_symbol2scm ("encompass-objects"), n); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, pure_outside_slur_callback, 4, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, pure_outside_slur_callback, 4, 1, ""); SCM Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offset_scm) { @@ -241,7 +241,7 @@ Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offs return scm_from_double (offset + dir * slur->pure_height (slur, start, end).length () / 4); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, outside_slur_callback, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, outside_slur_callback, 2, 1, ""); SCM Slur::outside_slur_callback (SCM grob, SCM offset_scm) { diff --git a/lily/text-interface.cc b/lily/text-interface.cc index eec8150894..27af0dbdf7 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -38,7 +38,16 @@ Text_interface::interpret_string (SCM layout_smob, return fm->word_stencil (str).smobbed_copy (); } -MAKE_SCHEME_CALLBACK (Text_interface, interpret_markup, 3); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Text_interface, interpret_markup, 3, 0, + "Convert a text markup into a stencil. " +"Takes 3 arguments, @var{layout}, @var{props} and @var{markup}. " +"\n\n" +"@var{layout} is a @code{\\layout} block; it may be obtained from a grob with " +"@code{ly:grob-layout}. @var{props} is a alist chain, ie. a list of alists. " +"This is typically obtained with " +"@code{(ly:grob-alist-chain (ly:layout-lookup layout 'text-font-defaults))}. " +"@var{markup} is the markup text to be processed. " + ); SCM Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) { @@ -92,7 +101,13 @@ Text_interface::is_markup (SCM x) } ADD_INTERFACE (Text_interface, - "A scheme markup text, see @usermanref{Text markup}.", + "A scheme markup text, see @usermanref{Text markup} and " + "@usermanref{New markup command definition}. " + "\n\n" + "There are two important commands: ly:text-interface::print, which is a " + "grob callback, and ly:text-interface::interpret-markup ", + + /* props */ "baseline-skip " "text " "word-space "