]> git.donarmstrong.com Git - lilypond.git/commitdiff
document Text_interface::interpret_markup.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 14:52:02 +0000 (15:52 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 26 Jan 2007 14:52:02 +0000 (15:52 +0100)
lily/beam.cc
lily/font-metric-scheme.cc
lily/function-documentation.cc
lily/include/lily-guile-macros.hh
lily/output-def-scheme.cc
lily/rest-collision.cc
lily/side-position-interface.cc
lily/slur.cc
lily/text-interface.cc

index ecc9d0b5a6ea979dcec6546bb7078fe44cf8ebac..28492eaee14f74722599118a5f344ea4621aea3a 100644 (file)
@@ -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)
 {
index 18edb7513a060344de7036c85cb641ae29376493..db231fd11d50f4554c5c8a36aba43ac6ad27da84 100644 (file)
@@ -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");
index 7e450528ae13e65813f26cbbd6baeba9fa61a6ef..b700fad3202ca744e961881c8d7090c77b9f4a0b 100644 (file)
@@ -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",
index 555d65bfd3a6aa116923ec46456796184f582f37..85c30ffb4772bf20c89ee44ea20ff794c6669950 100644 (file)
@@ -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                   \
index e7533eed16597c2d68a1595dd16abfc660bffb97..a806781015b6d3ae2cfee5a0d4c1ff01278e2170 100644 (file)
@@ -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);
index 8ba0d49c7bc43db14cab429444cde325e9076c9c..e470e9154c838263e3bf988513705fd01dc315e7 100644 (file)
@@ -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)
 {
index 0d56fe18681968efe5b5c4f739717336e8ff0688..ceee8a37cba397e79f099f9aaf41c5b1238d7809 100644 (file)
@@ -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)
 {
index 1f9e605fb96f10d5e26bccb8507a87f7d9a0adbc..9ce45e61f59bbd515522d72f59eb306ad25cf6f5 100644 (file)
@@ -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)
 {
index eec815089429a4ff115244552bbcea2e33c46535..27af0dbdf7f562f59d6dae4d224d71b8c433155f 100644 (file)
@@ -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 "