]> git.donarmstrong.com Git - lilypond.git/commitdiff
Loglevels: Also document Grob:: warning functions and clean them up
authorReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 15 Aug 2011 10:13:26 +0000 (12:13 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 15 Aug 2011 13:41:36 +0000 (15:41 +0200)
Documentation/contributor/programming-work.itexi
lily/grob.cc

index 7b193d58f74d5b0ce192d4ce64150fd04c9b1e60..b90042d7a34c392c975e19a9a040ad09997058a0 100644 (file)
@@ -754,7 +754,8 @@ only prints out the message, but no location.
 @end itemize
 
 There are also Scheme functions to access all of these logging functions from
-scheme.
+scheme. In addition, the Grob class contains some convenience wrappers for
+even easier access to these functions.
 
 The message and debug functions in @code{warn.hh} also have an optional 
 argument @code{newline}, which specifies whether the message should always
@@ -797,51 +798,56 @@ so it is basically identical to PROGRESS.
 @item @tab @tab
 
 @headitem
-@tab Scheme, no location
-@tab Scheme, input location
+@tab C++ from a Grob
+@tab Scheme, music expression
 
 @item ERROR
+@tab @code{Grob::programming_error (msg)}
 @tab -
-@tab @code{(ly:error msg args)}, @code{(ly:programming-error msg args)}
 
 @item WARN
-@tab @code{(ly:warning msg args)}
-@tab @code{(ly:input-warning input msg args)}
+@tab @code{Grob::warning (msg)}
+@tab @code{(ly:music-warning music msg)}
 
 @item BASIC
-@tab @code{(ly:success msg args)}
+@tab -
 @tab -
 
 @item PROGRESS
-@tab (ly:progress msg args), (ly:message msg args)
-@tab @code{(ly:input-message input msg args)}
+@tab -
+@tab @code{(ly:music-message music msg)}
 
 @item DEBUG
-@tab @code{(ly:debug msg args)}
 @tab -
-
+@tab -
 
 @item @tab @tab
 
 @headitem
-@tab Scheme, music expression
-@tab 
+@tab Scheme, no location
+@tab Scheme, input location
 
 @item ERROR
 @tab -
+@tab @code{(ly:error msg args)}, @code{(ly:programming-error msg args)}
 
 @item WARN
-@tab @code{(ly:music-warning music msg)}
+@tab @code{(ly:warning msg args)}
+@tab @code{(ly:input-warning input msg args)}
 
 @item BASIC
+@tab @code{(ly:success msg args)}
 @tab -
 
 @item PROGRESS
-@tab @code{(ly:music-message music msg)}
+@tab (ly:progress msg args), (ly:message msg args)
+@tab @code{(ly:input-message input msg args)}
 
 @item DEBUG
+@tab @code{(ly:debug msg args)}
 @tab -
 
+
 @end multitable
 
 
index 993b18a31b5648e1c47a4039c386b11e4cf3fa1b..41a445d5bfbb361971e19d4e9824aa469b4aa8ae 100644 (file)
@@ -573,11 +573,24 @@ Grob::fixup_refpoint ()
   MESSAGES
 ****************************************************************/
 void
-Grob::warning (string s) const
+Grob::programming_error (string s) const
 {
-  if (get_program_option ("warning-as-error"))
-    error (s);
+  SCM cause = self_scm ();
+  while (Grob *g = unsmob_grob (cause))
+    cause = g->get_property ("cause");
 
+  /* ES TODO: cause can't be Music*/
+  if (Music *m = unsmob_music (cause))
+    m->origin ()->programming_error (s);
+  else if (Stream_event *ev = unsmob_stream_event (cause))
+    ev->origin ()->programming_error (s);
+  else
+    ::programming_error (s);
+}
+
+void
+Grob::warning (string s) const
+{
   SCM cause = self_scm ();
   while (Grob *g = unsmob_grob (cause))
     cause = g->get_property ("cause");
@@ -600,27 +613,6 @@ Grob::name () const
   return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name ();
 }
 
-void
-Grob::programming_error (string s) const
-{
-  if (get_program_option ("warning-as-error"))
-    error (s);
-
-  SCM cause = self_scm ();
-  while (Grob *g = unsmob_grob (cause))
-    cause = g->get_property ("cause");
-
-  s = _f ("programming error: %s", s);
-
-  /* ES TODO: cause can't be Music*/
-  if (Music *m = unsmob_music (cause))
-    m->origin ()->message (s);
-  else if (Stream_event *ev = unsmob_stream_event (cause))
-    ev->origin ()->message (s);
-  else
-    ::message (s);
-}
-
 ADD_INTERFACE (Grob,
                "A grob represents a piece of music notation.\n"
                "\n"