+(define (get-current-filename parser)
+ "return any suffix value for output filename allowing for settings by
+calls to bookOutputName function"
+ (let ((book-filename (ly:parser-lookup parser 'book-filename)))
+ (if (not book-filename)
+ (ly:parser-output-name parser)
+ book-filename)))
+
+(define (get-current-suffix parser)
+ "return any suffix value for output filename allowing for settings by calls to
+bookoutput function"
+ (let ((book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
+ (if (not (string? book-output-suffix))
+ (ly:parser-lookup parser 'output-suffix)
+ book-output-suffix)))
+
+(define-public current-outfile-name #f) ; for use by regression tests
+
+(define (get-outfile-name parser)
+ "return current filename for generating backend output files"
+ ;; user can now override the base file name, so we have to use
+ ;; the file-name concatenated with any potential output-suffix value
+ ;; as the key to out internal a-list
+ (let* ((base-name (get-current-filename parser))
+ (output-suffix (get-current-suffix parser))
+ (alist-key (format "~a~a" base-name output-suffix))