markers when necessary.
* lily/program-option.cc (internal_set_option): add
strict_infinity_checking option.
2006-02-19 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * scm/stencil.scm (annotate-y-interval): robustify: print nan/inf
+ markers when necessary.
+
+ * lily/program-option.cc (internal_set_option): add
+ strict_infinity_checking option.
+
* scm/output-lib.scm (cyan): swap yellow and cyan.
2006-02-19 Graham Percival <gpermus@gmail.com>
extern bool point_and_click_global;
extern string prefix_directory;
extern bool use_object_keys;
-
+extern bool strict_infinity_checking;
/*
todo: collect in Output_option struct?
*/
crash if internally the wrong type is used for a grob property.
*/
bool do_internal_type_checking_global;
+bool strict_infinity_checking = false;
+
static SCM option_hash;
use_object_keys = to_boolean (val);
val = scm_from_bool (to_boolean (val));
}
+ else if (var == ly_symbol2scm ("strict-infinity-checking"))
+ {
+ strict_infinity_checking = to_boolean (val);
+ val = scm_from_bool (to_boolean (val));
+ }
}
ssize const HELP_INDENT = 30;
#include "note-head.hh"
#include "warn.hh"
-#include "warn.hh"
-#include "dimensions.hh"
+#include "main.hh"
#include "staff-symbol-referencer.hh"
#include "pointer-group-interface.hh"
#include "directional-element-interface.hh"
if (fabs (total_off) > 1000)
{
string msg
- = String_convert::form_string ("Improbable offset for grob %s: %f%s",
- me->name ().c_str (), total_off,
- INTERNAL_UNIT);
+ = String_convert::form_string ("Improbable offset for grob %s: %f",
+ me->name ().c_str (), total_off);
programming_error (msg);
+ if (strict_infinity_checking)
+ scm_misc_error (__FUNCTION__, "Improbable offset.", SCM_EOL);
}
return scm_from_double (total_off);
}
#include "stencil.hh"
-
-#include "dimensions.hh"
+#include "main.hh"
#include "font-metric.hh"
#include "input-smob.hh"
#include "string-convert.hh"
+ "\n"
+ "Setting to zero.");
o[a] = 0.0;
+ if (strict_infinity_checking)
+ scm_misc_error (__FUNCTION__, "Improbable offset.", SCM_EOL);
}
incr (a);
}
(srfi srfi-1)
(ice-9 pretty-print)
(srfi srfi-13)
+ (scm page)
(lily))
(define-public (output-framework basename book scopes fields )
"delete unusable PostScript files")
(safe #f "Run safely")
(verbose ,(ly:command-line-verbose?) "value for the --verbose flag")
+ (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN")
(ttf-verbosity 0
"how much verbosity for TTF font embedding?")
(debug-gc #f
page-stencil))
-(define (page-stencil page)
+(define-public (page-stencil page)
(if (not (ly:stencil? (page-property page 'stencil)))
;; todo: make tweakable.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-public (annotate-y-interval layout name extent is-length)
- ;; do something sensible for 0,0 intervals.
- (set! extent (interval-widen extent 0.001))
(let*
((text-props (cons
'((font-size . -3)
(font-family . typewriter))
(layout-extract-page-properties layout)))
- (annotation (interpret-markup
- layout text-props
- (make-column-markup
- (list
- (make-whiteout-markup (make-simple-markup name))
- (make-whiteout-markup
- (make-simple-markup
- (begin
- (display extent)
- (cond
- ((interval-empty? extent) "empty")
- ((not (interval-sane? extent)) "insane")
- (is-length (format "~$" (interval-length extent)))
- (else
- (format "(~$,~$)" (car extent)
- (cdr extent)))))))))))
- (arrows
- (ly:stencil-translate-axis
- (dimension-arrows (cons 0 (interval-length extent)))
- (interval-start extent) Y)))
+ (annotation #f)
+ )
- (set! annotation
- (ly:stencil-aligned-to annotation Y CENTER))
-
- (set! annotation (ly:stencil-translate annotation
- (cons 0 (interval-center extent))))
+ ;; do something sensible for 0,0 intervals.
+ (set! extent (interval-widen extent 0.001))
+ (if (not (interval-sane? extent))
+ (set! annotation (interpret-markup layout text-props
+ (make-simple-markup (format "~a: NaN/inf" name))))
+ (let*
+ ((text-stencil (interpret-markup
+ layout text-props
+ (make-column-markup
+ (list
+ (make-whiteout-markup (make-simple-markup name))
+ (make-whiteout-markup
+ (make-simple-markup
+ (cond
+ ((interval-empty? extent) "empty")
+ (is-length (format "~$" (interval-length extent)))
+ (else
+ (format "(~$,~$)" (car extent)
+ (cdr extent))))))))))
+ (arrows
+ (ly:stencil-translate-axis
+ (dimension-arrows (cons 0 (interval-length extent)))
+ (interval-start extent) Y)))
+
+ (set! annotation
+ (ly:stencil-aligned-to text-stencil Y CENTER))
+
+ (set! annotation (ly:stencil-translate
+ annotation
+ (cons 0 (interval-center extent))))
+
- (set! annotation
- (ly:stencil-combine-at-edge arrows X RIGHT annotation 0.5 0))
+ (set! annotation
+ (ly:stencil-combine-at-edge arrows X RIGHT annotation 0.5 0))
- (set! annotation
- (ly:make-stencil (ly:stencil-expr annotation)
- (ly:stencil-extent annotation X)
- (cons 10000 -10000)))
+ (set! annotation
+ (ly:make-stencil (ly:stencil-expr annotation)
+ (ly:stencil-extent annotation X)
+ (cons 10000 -10000)))))
annotation))