Currently, on the Scheme side, ly:warning and ly:programming-error are
redefined to ly:error. This works, but if the user wants to override
this setting in an LY file, he will not be able to.
This commit moves the handling for the callbacks to C++, thus permitting
users to override -dwarning-as-error in LY files for calls to ly:warning
and ly:programming-error.
- lily-guile.cc -- implement assorted Guile bindings
+ general-scheme.cc -- implement assorted Guile bindings
source file of the GNU LilyPond music typesetter
source file of the GNU LilyPond music typesetter
#include <cstring> /* memset */
using namespace std;
#include <cstring> /* memset */
using namespace std;
+#include "dimensions.hh"
+#include "file-name.hh"
+#include "file-path.hh"
#include "international.hh"
#include "libc-extension.hh"
#include "lily-guile.hh"
#include "international.hh"
#include "libc-extension.hh"
#include "lily-guile.hh"
-#include "misc.hh"
-#include "warn.hh"
-#include "version.hh"
-#include "dimensions.hh"
+#include "misc.hh"
+#include "program-option.hh"
#include "string-convert.hh"
#include "string-convert.hh"
+#include "version.hh"
+#include "warn.hh"
LY_DEFINE (ly_start_environment, "ly:start-environment",
0, 0, 0, (),
LY_DEFINE (ly_start_environment, "ly:start-environment",
0, 0, 0, (),
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
- programming_error (ly_scm2string (str));
+
+ if (get_program_option ("warning-as-error"))
+ error (ly_scm2string (str));
+ else
+ programming_error (ly_scm2string (str));
+
return SCM_UNSPECIFIED;
}
return SCM_UNSPECIFIED;
}
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
{
LY_ASSERT_TYPE (scm_is_string, str, 1);
str = scm_simple_format (SCM_BOOL_F, str, rest);
- warning (ly_scm2string (str));
+
+ if (get_program_option ("warning-as-error"))
+ error (ly_scm2string (str));
+ else
+ warning (ly_scm2string (str));
+
return SCM_UNSPECIFIED;
}
return SCM_UNSPECIFIED;
}
(if (ly:get-option 'trace-scheme-coverage)
(coverage:enable))
(if (ly:get-option 'trace-scheme-coverage)
(coverage:enable))
-(if (ly:get-option 'warning-as-error)
- (begin
- (set! ly:warning ly:error)
- (set! ly:programming-error ly:error)))
-
(define-public parser #f)
(define-public parser #f)