return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F;
}
+LY_DEFINE (ly_input_warning, "ly:input-warning", 2, 0, 1, (SCM sip, SCM msg, SCM rest),
+ "Print @var{msg} as a GNU compliant warning message, pointing"
+ " to the location in @var{sip}. @var{msg} is interpreted"
+ " similar to @code{format}'s argument, using @var{rest}.")
+{
+ Input *ip = unsmob_input (sip);
+
+ LY_ASSERT_TYPE (unsmob_input, sip, 1);
+ LY_ASSERT_TYPE (scm_is_string, msg, 2);
+
+ msg = scm_simple_format (SCM_BOOL_F, msg, rest);
+
+ string m = ly_scm2string (msg);
+ ip->warning (m);
+
+ return SCM_UNSPECIFIED;
+}
+
LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM rest),
"Print @var{msg} as a GNU compliant error message, pointing"
" to the location in @var{sip}. @var{msg} is interpreted"
(lambda (c)
(let ((cbn (ly:context-property c 'currentBarNumber)))
(if (and (number? cbn) (not (= cbn n)))
- (ly:input-message location
+ (ly:input-warning location
"Barcheck failed got ~a expect ~a"
cbn n))))))
(instrument-def (if handle (cdr handle) '())))
(if (not handle)
- (ly:input-message location "No such instrument: ~a" name))
+ (ly:input-warning location "No such instrument: ~a" name))
(context-spec-music
(make-music 'SimultaneousMusic
'elements
(begin
(set! pitchnames previous-pitchnames)
(ly:parser-set-note-names parser pitchnames))
- (ly:warning (_ "No other language was defined previously. Ignoring.")))
+ (ly:input-warning location (_ "No other language was defined previously. Ignoring.")))
(make-music 'Music 'void #t))
(let ((moment-reference (ly:music-length (car seqs))))
(for-each (lambda (seq moment)
(if (not (equal? moment moment-reference))
- (ly:music-message seq
+ (ly:music-warning seq
"Bars in parallel music don't have the same length")))
seqs (map-in-order ly:music-length seqs))))
voices)
(for-each (lambda (m)
(ly:music-set-property! m 'pitch trill-pitch)) trill-events)
(begin
- (ly:warning (_ "Second argument of \\pitchedTrill should be single note: "))
+ (ly:input-warning location (_ "Second argument of \\pitchedTrill should be single note: "))
(display sec-note-events)))
(if (eq? forced #t)
(if (equal? (object-property sym 'backend-type?) #f)
(begin
- (ly:warning (_ "cannot find property type-check for ~a") sym)
+ (ly:input-warning location (_ "cannot find property type-check for ~a") sym)
(ly:warning (_ "doing assignment anyway"))))
(set!
(ly:music-property arg 'tweaks)
(set! (ly:grob-property grob symbol) val))))
-;;
-(define-public (smart-bar-check n)
- "Make a bar check that checks for a specific bar number."
- (let ((m (make-music 'ApplyContext)))
- (define (checker tr)
- (let* ((bn (ly:context-property tr 'currentBarNumber)))
- (or (= bn n)
- (ly:error
- ;; FIXME: uncomprehensable message
- (_ "Bar check failed. Expect to be at ~a, instead at ~a")
- n bn))))
- (set! (ly:music-property m 'procedure) checker)
- m))
-
-
(define-public (skip->rest mus)
"Replace @var{mus} by @code{RestEvent} of the same duration if it is a
@code{SkipEvent}. Useful for extracting parts from crowded scores."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; warn for bare chords at start.
-
(define-public (ly:music-message music msg)
(let ((ip (ly:music-property music 'origin)))
(if (ly:input-location? ip)
- (ly:input-message ip msg)
- (ly:warning msg))))
+ (ly:input-message ip msg)
+ (ly:message msg))))
+
+(define-public (ly:music-warning music msg)
+ (let ((ip (ly:music-property music 'origin)))
+ (if (ly:input-location? ip)
+ (ly:input-warning ip msg)
+ (ly:warning msg))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
(set! (ly:music-property music 'quoted-events) quoted-vector)
(set! (ly:music-property music 'iterator-ctor)
ly:quote-iterator::constructor))
- (ly:music-message music (ly:format (_ "cannot find quoted music: `~S'") quoted-name))))
+ (ly:music-warning music (ly:format (_ "cannot find quoted music: `~S'") quoted-name))))
music))
(if (not (null? quote-contents))
(hash-set! tab name (list->vector (reverse! quote-contents '())))
- (ly:music-message mus (ly:format (_ "quoted music `~a' is empty") name)))))
+ (ly:music-warning mus (ly:format (_ "quoted music `~a' is empty") name)))))